mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-07 14:15:45 +00:00
feat: implement auto-filling of license and registration document slots from personal vault and add UI labels for vault-sourced files
This commit is contained in:
@@ -524,6 +524,36 @@ export const licensingApi = baseApi
|
||||
providesTags: (_r, _e, arg) => [itemTag('Attachment', arg.ownerId)],
|
||||
}),
|
||||
|
||||
/**
|
||||
* Copies the applicant's personal documents onto an application, for
|
||||
* every requirement their vault answers and this application has not
|
||||
* already got. Idempotent — a filled slot is never touched.
|
||||
*/
|
||||
fillApplicationDocumentsFromVault: builder.mutation<
|
||||
{ filled: string[] },
|
||||
string
|
||||
>({
|
||||
query: (applicationId) => ({
|
||||
url: `/license-applications/${applicationId}/documents/fill-from-vault`,
|
||||
method: 'POST',
|
||||
}),
|
||||
invalidatesTags: (_r, error, applicationId) =>
|
||||
error ? [] : [itemTag('Attachment', applicationId)],
|
||||
}),
|
||||
|
||||
/** The same, for a seafarer registration. */
|
||||
fillRegistrationDocumentsFromVault: builder.mutation<
|
||||
{ filled: string[] },
|
||||
string
|
||||
>({
|
||||
query: (registrationId) => ({
|
||||
url: `/seafarer-registrations/${registrationId}/documents/fill-from-vault`,
|
||||
method: 'POST',
|
||||
}),
|
||||
invalidatesTags: (_r, error, registrationId) =>
|
||||
error ? [] : [itemTag('Attachment', registrationId)],
|
||||
}),
|
||||
|
||||
deleteAttachment: builder.mutation<unknown, { attachmentId: string; ownerId: string }>({
|
||||
query: ({ attachmentId }) => ({
|
||||
url: `/attachments/${attachmentId}`,
|
||||
@@ -1342,6 +1372,8 @@ export const {
|
||||
useResolveRemarkMutation,
|
||||
useResubmitApplicationMutation,
|
||||
useGetAttachmentsQuery,
|
||||
useFillApplicationDocumentsFromVaultMutation,
|
||||
useFillRegistrationDocumentsFromVaultMutation,
|
||||
useDeleteAttachmentMutation,
|
||||
useGetQueueQuery,
|
||||
useGetAssignedToMeQuery,
|
||||
|
||||
@@ -433,6 +433,12 @@ export interface Attachment {
|
||||
ownerType: string;
|
||||
ownerId: string;
|
||||
documentKey: string;
|
||||
/**
|
||||
* Set when this was filled from the applicant's personal document vault
|
||||
* rather than uploaded here — what both apps badge as "From My Documents".
|
||||
* Null for an ordinary upload, and cleared the moment the file is replaced.
|
||||
*/
|
||||
copiedFromAttachmentId?: string | null;
|
||||
title: string | null;
|
||||
validFrom: string | null;
|
||||
validTo: string | null;
|
||||
|
||||
Reference in New Issue
Block a user