Skip to content

Commit 514c724

Browse files
committed
ecer-5117 connecting backend submit icra eligibility application to the frontend
1 parent b434212 commit 514c724

File tree

8 files changed

+79
-14
lines changed

8 files changed

+79
-14
lines changed

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/api/icra.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,16 @@ const createOrUpdateDraftIcraEligibility = async (
3030
});
3131
};
3232

33-
export { createOrUpdateDraftIcraEligibility, getIcraEligibilities };
33+
const submitIcraEligibilityApplication = async (eligibilityId: string): Promise<ApiResponse<Components.Schemas.SubmitICRAEligibilityResponse | null | undefined>> => {
34+
const client = await getClient();
35+
const body: Components.Schemas.ICRAEligibilitySubmissionRequest = {
36+
id: eligibilityId,
37+
};
38+
39+
return apiResultHandler.execute<Components.Schemas.SubmitICRAEligibilityResponse | null | undefined>({
40+
request: client.icra_post(null, body),
41+
key: "icra_post",
42+
});
43+
};
44+
45+
export { createOrUpdateDraftIcraEligibility, getIcraEligibilities, submitIcraEligibilityApplication };
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
<template></template>
1+
<template>Not implemented you are viewing eligibility application id: {{ icraEligibilityId }}</template>
22

33
<script lang="ts">
44
import { defineComponent } from "vue";
55
66
export default defineComponent({
77
name: "IcraEligibilitySummary",
8+
props: {
9+
icraEligibilityId: {
10+
type: String,
11+
required: true,
12+
},
13+
},
814
});
915
</script>

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/pages/IcraEligibility.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
v-if="showSubmitEligibilitySubmission"
6060
rounded="lg"
6161
color="primary"
62-
:loading="loadingStore.isLoading('icra_put')"
62+
:loading="loadingStore.isLoading('icra_put') || loadingStore.isLoading('icra_post')"
6363
@click="handleSubmit"
6464
>
6565
Submit eligibility submission
@@ -150,7 +150,14 @@ export default defineComponent({
150150
},
151151
methods: {
152152
async handleSubmit() {
153-
// TODO: Implement this when the backend API is implemented
153+
const submitIcraEligibilityResponse = await this.icraStore.submitIcraEligibilityApplication();
154+
155+
if (submitIcraEligibilityResponse?.eligibility) {
156+
if (submitIcraEligibilityResponse !== null && submitIcraEligibilityResponse !== undefined && submitIcraEligibilityResponse.eligibility) {
157+
this.icraStore.icraEligibility = submitIcraEligibilityResponse.eligibility;
158+
}
159+
this.router.push({ name: "icra-eligibility-submitted", params: { icraEligibilityId: submitIcraEligibilityResponse.eligibility.id } });
160+
}
154161
},
155162
async handleSaveAndContinue() {
156163
const valid = await this.validateForm();

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/pages/IcraEligibilitySubmitted.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<br />
5555

5656
<router-link :to="{ name: 'manage-icra-eligibility', params: { icraEligibilityId: icraEligibilityId } }">
57-
<v-btn id="btnIcraEligibilitySummary" class="mt-5" type="" rounded="lg" color="primary">Go to submission summary (TODO NOT IMPLEMENTED)</v-btn>
57+
<v-btn id="btnIcraEligibilitySummary" class="mt-5" rounded="lg" color="primary">Go to submission summary</v-btn>
5858
</router-link>
5959
</PageContainer>
6060
</template>

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/pages/Submitted.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<br />
6767

6868
<router-link :to="{ name: 'manageApplication', params: { applicationId: applicationId } }">
69-
<v-btn id="btnApplicationSummary" class="mt-5" type="" rounded="lg" color="primary">Go to application summary</v-btn>
69+
<v-btn id="btnApplicationSummary" class="mt-5" rounded="lg" color="primary">Go to application summary</v-btn>
7070
</router-link>
7171
</PageContainer>
7272
</template>

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/router.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,6 @@ const router = createRouter({
266266
props: true,
267267
meta: { requiresAuth: true, requiresVerification: true },
268268
},
269-
{
270-
path: "/icra-eligibility/submitted/:icraEligibilityId",
271-
name: "icra-eligibility-submitted",
272-
component: () => import("./components/pages/IcraEligibilitySubmitted.vue"),
273-
props: true,
274-
meta: { requiresAuth: true, requiresVerification: true, requiresICRAFeature: true },
275-
},
276269
{
277270
path: "/verify/:token",
278271
component: () => import("./components/reference/Reference.vue"),
@@ -321,10 +314,18 @@ const router = createRouter({
321314
name: "icra-eligibility-declaration",
322315
props: { stream: "Eligibility" },
323316
},
317+
{
318+
path: "/icra-eligibility/submitted/:icraEligibilityId",
319+
name: "icra-eligibility-submitted",
320+
component: () => import("./components/pages/IcraEligibilitySubmitted.vue"),
321+
props: true,
322+
meta: { requiresAuth: true, requiresVerification: true, requiresICRAFeature: true },
323+
},
324324
{
325325
path: "/icra-eligibility/manage/:icraEligibilityId",
326326
name: "manage-icra-eligibility",
327327
component: () => import("./components/IcraEligibilitySummary.vue"),
328+
props: true,
328329
meta: { requiresAuth: true, requiresVerification: true, requiresICRAFeature: true },
329330
},
330331
{

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/icra.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineStore } from "pinia";
22

3-
import { createOrUpdateDraftIcraEligibility, getIcraEligibilities } from "@/api/icra";
3+
import { createOrUpdateDraftIcraEligibility, getIcraEligibilities, submitIcraEligibilityApplication } from "@/api/icra";
44
import type { Components } from "@/types/openapi";
55
import type { FileItem } from "@/components/UploadFileItem.vue";
66

@@ -117,5 +117,9 @@ export const useIcraStore = defineStore("icra", {
117117
this.$patch({ draftIcraEligibility: draftIcraEligibility });
118118
return await this.upsertDraftIcraEligibility();
119119
},
120+
async submitIcraEligibilityApplication(): Promise<Components.Schemas.SubmitICRAEligibilityResponse | null | undefined> {
121+
const { data: submitIcraEligibilityResponse } = await submitIcraEligibilityApplication(this.draftIcraEligibility.id!);
122+
return submitIcraEligibilityResponse;
123+
},
120124
},
121125
});

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/types/openapi.d.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ declare namespace Components {
327327
internationalCertifications?: InternationalCertification[] | null;
328328
employmentReferences?: EmploymentReference[] | null;
329329
}
330+
export interface ICRAEligibilitySubmissionRequest {
331+
id?: string | null;
332+
}
330333
export type ICRAStatus = "Active" | "Draft" | "Eligible" | "Inactive" | "Ineligible" | "InReview" | "ReadyforReview" | "Submitted";
331334
export interface IdentificationType {
332335
id?: string | null;
@@ -514,6 +517,9 @@ declare namespace Components {
514517
export interface SubmitApplicationResponse {
515518
application?: Application;
516519
}
520+
export interface SubmitICRAEligibilityResponse {
521+
eligibility?: ICRAEligibility;
522+
}
517523
export interface SubmittedApplicationStatus {
518524
id?: string | null;
519525
submittedOn?: string; // date-time
@@ -993,6 +999,15 @@ declare namespace Paths {
993999
export type $400 = Components.Schemas.HttpValidationProblemDetails;
9941000
}
9951001
}
1002+
namespace IcraPost {
1003+
export type RequestBody = Components.Schemas.ICRAEligibilitySubmissionRequest;
1004+
namespace Responses {
1005+
export type $200 = Components.Schemas.SubmitICRAEligibilityResponse;
1006+
export type $400 = Components.Schemas.ProblemDetails | Components.Schemas.HttpValidationProblemDetails;
1007+
export interface $404 {
1008+
}
1009+
}
1010+
}
9961011
namespace IcraPut {
9971012
namespace Parameters {
9981013
export type Id = string;
@@ -1342,6 +1357,14 @@ export interface OperationMethods {
13421357
data?: Paths.IcraPut.RequestBody,
13431358
config?: AxiosRequestConfig
13441359
): OperationResponse<Paths.IcraPut.Responses.$200>
1360+
/**
1361+
* icra_post - Submit an ICRA Eligibility
1362+
*/
1363+
'icra_post'(
1364+
parameters?: Parameters<UnknownParamsObject> | null,
1365+
data?: Paths.IcraPost.RequestBody,
1366+
config?: AxiosRequestConfig
1367+
): OperationResponse<Paths.IcraPost.Responses.$200>
13451368
/**
13461369
* files_certificate_get - Handles fetching certificate PDF's
13471370
*/
@@ -1731,6 +1754,16 @@ export interface PathsDictionary {
17311754
config?: AxiosRequestConfig
17321755
): OperationResponse<Paths.IcraGet.Responses.$200>
17331756
}
1757+
['/api/icra']: {
1758+
/**
1759+
* icra_post - Submit an ICRA Eligibility
1760+
*/
1761+
'post'(
1762+
parameters?: Parameters<UnknownParamsObject> | null,
1763+
data?: Paths.IcraPost.RequestBody,
1764+
config?: AxiosRequestConfig
1765+
): OperationResponse<Paths.IcraPost.Responses.$200>
1766+
}
17341767
['/api/files/certificate/{certificateId}']: {
17351768
/**
17361769
* files_certificate_get - Handles fetching certificate PDF's
@@ -2013,6 +2046,7 @@ export type FiveYearRenewalExplanations = Components.Schemas.FiveYearRenewalExpl
20132046
export type GetMessagesResponse = Components.Schemas.GetMessagesResponse;
20142047
export type HttpValidationProblemDetails = Components.Schemas.HttpValidationProblemDetails;
20152048
export type ICRAEligibility = Components.Schemas.ICRAEligibility;
2049+
export type ICRAEligibilitySubmissionRequest = Components.Schemas.ICRAEligibilitySubmissionRequest;
20162050
export type ICRAStatus = Components.Schemas.ICRAStatus;
20172051
export type IdentificationType = Components.Schemas.IdentificationType;
20182052
export type IdentityDocument = Components.Schemas.IdentityDocument;
@@ -2048,6 +2082,7 @@ export type SendMessageRequest = Components.Schemas.SendMessageRequest;
20482082
export type SendMessageResponse = Components.Schemas.SendMessageResponse;
20492083
export type StatusCode = Components.Schemas.StatusCode;
20502084
export type SubmitApplicationResponse = Components.Schemas.SubmitApplicationResponse;
2085+
export type SubmitICRAEligibilityResponse = Components.Schemas.SubmitICRAEligibilityResponse;
20512086
export type SubmittedApplicationStatus = Components.Schemas.SubmittedApplicationStatus;
20522087
export type SystemMessage = Components.Schemas.SystemMessage;
20532088
export type Transcript = Components.Schemas.Transcript;

0 commit comments

Comments
 (0)