diff --git a/backend/src/types/models/office/office-assignment-dto.ts b/backend/src/types/models/office/office-assignment-dto.ts index 0120739f3..58fad1fd5 100644 --- a/backend/src/types/models/office/office-assignment-dto.ts +++ b/backend/src/types/models/office/office-assignment-dto.ts @@ -4,4 +4,5 @@ export interface OfficeAssignmentDto { id: UUID; name: string; agency: string; + code: string; } diff --git a/backend/src/v1/office/office.service.ts b/backend/src/v1/office/office.service.ts index c608a7c79..df6e44fe2 100644 --- a/backend/src/v1/office/office.service.ts +++ b/backend/src/v1/office/office.service.ts @@ -73,7 +73,7 @@ export class OfficeService { .select("office.office_guid") .leftJoin("office.cos_geo_org_unit", "organization") .leftJoin("office.agency_code", "agency") - .addSelect(["organization.office_location_name", "agency.short_description"]); + .addSelect(["organization.office_location_name", "agency.short_description", "agency.agency_code"]); const data = await queryBuilder.getMany(); @@ -81,9 +81,9 @@ export class OfficeService { const { office_guid: id, cos_geo_org_unit: { office_location_name: name }, - agency_code: { short_description: description }, + agency_code: { short_description: description, agency_code: code }, } = item; - const record: OfficeAssignmentDto = { id, name, agency: description }; + const record: OfficeAssignmentDto = { id, name, agency: description, code }; return record; }); diff --git a/frontend/src/app/components/containers/admin/user-management.tsx b/frontend/src/app/components/containers/admin/user-management.tsx index 8473db6a0..c422e17bb 100644 --- a/frontend/src/app/components/containers/admin/user-management.tsx +++ b/frontend/src/app/components/containers/admin/user-management.tsx @@ -4,7 +4,11 @@ import { useAppDispatch, useAppSelector } from "../../../hooks/hooks"; import { assignOfficerToOffice, selectOfficersDropdown } from "../../../store/reducers/officer"; import { CompSelect } from "../../common/comp-select"; import Option from "../../../types/app/option"; -import { fetchOfficeAssignments, selectOfficesForAssignmentDropdown } from "../../../store/reducers/office"; +import { + fetchOfficeAssignments, + selectOfficesForAssignmentDropdown, + selectOffices, +} from "../../../store/reducers/office"; import { ToastContainer } from "react-toastify"; import { ToggleError, ToggleSuccess } from "../../../common/toast"; import { clearNotification, selectNotification } from "../../../store/reducers/app"; @@ -14,7 +18,6 @@ import { generateApiParameters, get, patch } from "../../../common/api"; import config from "../../../../config"; import { Officer } from "../../../types/person/person"; import { UUID } from "crypto"; -import Roles from "../../../types/app/roles"; import { ValidationMultiSelect } from "../../../common/validation-multiselect"; export const UserManagement: FC = () => { @@ -25,6 +28,8 @@ export const UserManagement: FC = () => { const teams = useAppSelector(selectTeamDropdown); const agency = useAppSelector(selectAgencyDropdown); + const availableOffices = useAppSelector(selectOffices); + const [officer, setOfficer] = useState