diff --git a/packages/api/src/controllers/admin/manage/Units.ts b/packages/api/src/controllers/admin/manage/Units.ts index 52519764e..3d59969d1 100644 --- a/packages/api/src/controllers/admin/manage/Units.ts +++ b/packages/api/src/controllers/admin/manage/Units.ts @@ -145,7 +145,9 @@ export class ManageUnitsController { departmentId: data.department, divisionId: data.division, rankId: data.rank || null, - suspended: data.suspended, + suspended: data.suspended ?? false, + callsign2: data.callsign2, + callsign: data.callsign, }, }); diff --git a/packages/client/src/pages/admin/manage/units/[id].tsx b/packages/client/src/pages/admin/manage/units/[id].tsx index 519bcc279..2d880beab 100644 --- a/packages/client/src/pages/admin/manage/units/[id].tsx +++ b/packages/client/src/pages/admin/manage/units/[id].tsx @@ -19,6 +19,8 @@ import type { OfficerLog } from "@snailycad/types"; import { Toggle } from "components/form/Toggle"; import { Title } from "components/shared/Title"; import { OfficerLogsTable } from "components/leo/logs/OfficerLogsTable"; +import { FormRow } from "components/form/FormRow"; +import { Input } from "components/form/inputs/Input"; type Unit = (FullOfficer & { logs: OfficerLog[] }) | FullDeputy; @@ -63,8 +65,10 @@ export default function SupervisorPanelPage({ unit }: Props) { division: "divisionId" in unit ? unit.divisionId : "", divisions: divisions.map((v) => ({ value: v.id, label: v.value.value })) ?? [], callsign: unit.callsign, + callsign2: unit.callsign2, rank: unit.rankId, suspended: unit.suspended, + badgeNumber: unit.badgeNumber ?? "", }; return ( @@ -76,7 +80,7 @@ export default function SupervisorPanelPage({ unit }: Props) {

{makeUnitName(unit)}

- {({ handleChange, values }) => ( + {({ handleChange, values, errors }) => (
+ handleChange({ + ...e, + target: { + ...e.target, + id: "badgeNumber", + value: e.target.valueAsNumber, + }, + }) + } + /> + + + + + + + + + + + + diff --git a/packages/schemas/src/leo.ts b/packages/schemas/src/leo.ts index f36ab935d..fed0c34c2 100644 --- a/packages/schemas/src/leo.ts +++ b/packages/schemas/src/leo.ts @@ -19,6 +19,7 @@ export const CREATE_OFFICER_SCHEMA = z.object({ export const UPDATE_UNIT_SCHEMA = z.object({ callsign: z.string().min(1).max(255), + callsign2: z.string().min(1).max(255), department: z.string().min(2).max(255), division: z.string().min(2).max(255).nullable(), rank: z.string().max(255).nullable(),