feat: add License Types management tab for creating and editing license configurations

This commit is contained in:
estifanos
2026-08-31 12:19:50 +00:00
parent 6f141baca9
commit b48fe86ea7
6 changed files with 541 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import type {
Attachment,
Department,
DocumentRequirement,
FamilyKind,
FormSchemaPalette,
FormSectionConfig,
InitiatePaymentResult,
@@ -18,6 +19,7 @@ import type {
LicenseCategoryDefinition,
LicenseStatus,
LicenseType,
LicenseTypeCreate,
LicenseTypeRequirements,
OperatorType,
AssignableOfficer,
@@ -173,6 +175,38 @@ export const licensingApi = baseApi
providesTags: () => [listTag('LicenseType')],
}),
/**
* Creates the licence type row.
*
* The one write on this resource with no screen until now: everything
* after creation — form, documents, staff rules, fees, validity,
* certificate design — had an editor, but the type itself had to be
* added by seed or by calling the API directly.
*/
createLicenseType: builder.mutation<LicenseType, LicenseTypeCreate>({
query: (body) => ({ url: '/license-types', method: 'POST', body }),
invalidatesTags: (_r, error) => (error ? [] : [listTag('LicenseType')]),
}),
/**
* Replaces the row's own fields. The narrow routes (`/fees`,
* `/validity`, `/behavior`, `/form-schema`) are still the way to change
* what they own; this is the catalogue entry itself — key, names,
* category, family kind, prefix, sort order, active.
*/
updateLicenseType: builder.mutation<
LicenseType,
{ id: string } & Partial<LicenseTypeCreate>
>({
query: ({ id, ...body }) => ({
url: `/license-types/${id}`,
method: 'PUT',
body,
}),
invalidatesTags: (_r, error, { id }) =>
error ? [] : [listTag('LicenseType'), itemTag('LicenseType', id)],
}),
/**
* Fee configuration, for licensing administrators.
*
@@ -222,6 +256,8 @@ export const licensingApi = baseApi
id: string;
workflowProfile?: WorkflowProfile;
serviceKind?: ServiceKind;
/** Licence / certificate / document — see `FamilyKind`. */
familyKind?: FamilyKind;
completionEffect?: CompletionEffect | null;
certificateCategory?: CertificateCategory | null;
requiresExamination?: boolean;
@@ -1369,6 +1405,8 @@ export const licensingApi = baseApi
export const {
useGetLicenseTypesQuery,
useGetLicenseCategoriesQuery,
useCreateLicenseTypeMutation,
useUpdateLicenseTypeMutation,
useUpdateLicenseFeesMutation,
useUpdateLicenseBehaviorMutation,
useUpdateFormSchemaMutation,