mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-07 13:05:46 +00:00
feat: add License Types management tab for creating and editing license configurations
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -277,6 +277,35 @@ export interface LicenseType {
|
||||
prerequisiteLicenseKeys?: string[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Body of `POST /license-types` — the row itself, before behaviour, fees, the
|
||||
* form or its document slots are configured.
|
||||
*
|
||||
* Mirrors `CreateLicenseTypeDto` field for field. Create the type inactive: an
|
||||
* active type with no form schema and no document requirements is immediately
|
||||
* visible to applicants.
|
||||
*/
|
||||
export interface LicenseTypeCreate {
|
||||
key: string;
|
||||
name: Bilingual;
|
||||
description?: Bilingual;
|
||||
category?: LicenseCategory;
|
||||
/** Omitted, the server derives it from `key` — see `FamilyKind`. */
|
||||
familyKind?: FamilyKind;
|
||||
certificatePrefix: string;
|
||||
feeNewApplication?: number | null;
|
||||
feeRenewal?: number | null;
|
||||
feeCurrency?: string;
|
||||
capitalThreshold?: number | null;
|
||||
validityMonths?: number;
|
||||
inspectionRequired?: boolean;
|
||||
issuesCertificate?: boolean;
|
||||
renewalEnabled?: boolean;
|
||||
formSchema?: { sections: FormSectionConfig[] };
|
||||
sortOrder?: number;
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
/** What kind of document a certificate type produces. */
|
||||
export type CertificateCategory =
|
||||
"COC" | "COP" | "ENDORSEMENT" | "GOC" | "NATIONAL";
|
||||
|
||||
Reference in New Issue
Block a user