mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-07 15:25:47 +00:00
feat: add StaffRolesCard component for managing license type staff requirements and integrate with existing API endpoints.
This commit is contained in:
@@ -40,6 +40,7 @@ import type {
|
||||
SavedQueueView,
|
||||
SchemaIssue,
|
||||
ServiceKind,
|
||||
StaffRoleRequirement,
|
||||
TemplateFieldPlacement,
|
||||
TemplateLogoPlacement,
|
||||
TemplatePageOptions,
|
||||
@@ -99,6 +100,7 @@ const TAGS = [
|
||||
'PickupAppointment',
|
||||
'Department',
|
||||
'Rank',
|
||||
'StaffRoleRequirement',
|
||||
// Owned by the personal-document slice; named here so declaring a mode of
|
||||
// operation can invalidate the vault, whose slots depend on it.
|
||||
'PersonalDocument',
|
||||
@@ -366,6 +368,42 @@ export const licensingApi = baseApi
|
||||
invalidatesTags: (_r, error) => (error ? [] : [listTag('DocumentRequirement')]),
|
||||
}),
|
||||
|
||||
// ----------------------------------------------- staff role requirements
|
||||
/**
|
||||
* Every staff role requirement, filtered by licence type at the call
|
||||
* site — same reasoning as `getDocumentRequirements`: small
|
||||
* configuration data with no pagination need.
|
||||
*/
|
||||
getStaffRoleRequirements: builder.query<Paginated<StaffRoleRequirement>, void>({
|
||||
query: () => ({ url: '/staff-role-requirements' }),
|
||||
providesTags: () => [listTag('StaffRoleRequirement')],
|
||||
}),
|
||||
|
||||
createStaffRoleRequirement: builder.mutation<
|
||||
StaffRoleRequirement,
|
||||
Partial<StaffRoleRequirement> & { licenseTypeId: string; roleKey: string; name: StaffRoleRequirement['name'] }
|
||||
>({
|
||||
query: (body) => ({ url: '/staff-role-requirements', method: 'POST', body }),
|
||||
invalidatesTags: (_r, error) => (error ? [] : [listTag('StaffRoleRequirement')]),
|
||||
}),
|
||||
|
||||
updateStaffRoleRequirement: builder.mutation<
|
||||
StaffRoleRequirement,
|
||||
{ id: string } & Partial<StaffRoleRequirement>
|
||||
>({
|
||||
query: ({ id, ...body }) => ({
|
||||
url: `/staff-role-requirements/${id}`,
|
||||
method: 'PUT',
|
||||
body,
|
||||
}),
|
||||
invalidatesTags: (_r, error) => (error ? [] : [listTag('StaffRoleRequirement')]),
|
||||
}),
|
||||
|
||||
deleteStaffRoleRequirement: builder.mutation<unknown, string>({
|
||||
query: (id) => ({ url: `/staff-role-requirements/${id}`, method: 'DELETE' }),
|
||||
invalidatesTags: (_r, error) => (error ? [] : [listTag('StaffRoleRequirement')]),
|
||||
}),
|
||||
|
||||
// --------------------------------------------------- departments & ranks
|
||||
/** Every department, for the admin editor. */
|
||||
getDepartments: builder.query<Paginated<Department>, void>({
|
||||
@@ -1341,6 +1379,10 @@ export const {
|
||||
useCreateDocumentRequirementMutation,
|
||||
useUpdateDocumentRequirementMutation,
|
||||
useDeleteDocumentRequirementMutation,
|
||||
useGetStaffRoleRequirementsQuery,
|
||||
useCreateStaffRoleRequirementMutation,
|
||||
useUpdateStaffRoleRequirementMutation,
|
||||
useDeleteStaffRoleRequirementMutation,
|
||||
useGetDepartmentsQuery,
|
||||
useGetActiveDepartmentsQuery,
|
||||
useCreateDepartmentMutation,
|
||||
|
||||
Reference in New Issue
Block a user