Skip to content

Commit

Permalink
🐛 fix: unable to edit arrest-reports/written warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Jan 31, 2022
1 parent beeeca1 commit 1c1fbc7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
3 changes: 3 additions & 0 deletions packages/client/locales/en/leo.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@
"reportedStolen": "Reported Stolen",
"pendingAccessDepartment": "You are still awaiting access for this department. This CAD has set a default department ({defaultDepartment}) that you are in until you're accepted.",
"pendingAccessDepartmentNoDefault": "You are still awaiting access for this department. There is not default department set so this officer will be disabled until you're accepted.",
"editTicket": "Edit Ticket",
"editArrestReport": "Edit Arrest Report",
"editWrittenWarning": "Edit Written Warning",
"alert_deleteRecord": "Are you sure you want to delete this record? This action cannot be undone.",
"alert_deleteOfficer": "Are you sure you want to delete <span>{officer}</span>? This action cannot be undone.",
"alert_allowCheckout": "Are you sure you to checkout this vehicle from the impound lot?",
Expand Down
18 changes: 11 additions & 7 deletions packages/client/src/components/leo/modals/ManageRecordModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,30 @@ interface Props {
record?: FullRecord | null;
type: RecordType;
id?: ModalIds.ManageRecord | ModalIds.CreateTicket;
isEdit?: boolean;
onUpdate?(data: FullRecord): void;
}

export function ManageRecordModal({ onUpdate, record, type, id = ModalIds.CreateTicket }: Props) {
export function ManageRecordModal({ onUpdate, record, type, isEdit, id }: Props) {
const { isOpen, closeModal, getPayload } = useModal();
const common = useTranslations("Common");
const t = useTranslations("Leo");

const data = {
[RecordType.TICKET]: {
title: "createTicket",
id,
isEdit,
title: isEdit ? "editTicket" : "createTicket",
id: id ?? ModalIds.CreateTicket,
},
[RecordType.ARREST_REPORT]: {
title: "createArrestReport",
id: ModalIds.CreateArrestReport,
isEdit,
title: isEdit ? "editArrestReport" : "createArrestReport",
id: id ?? ModalIds.CreateArrestReport,
},
[RecordType.WRITTEN_WARNING]: {
title: "createWrittenWarning",
id: ModalIds.CreateWrittenWarning,
isEdit,
title: isEdit ? "editWrittenWarning" : "createWrittenWarning",
id: id ?? ModalIds.CreateWrittenWarning,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export function RecordsArea({ warrants, records }: Props) {
id={ModalIds.ManageRecord}
type={tempEditRecord.type}
record={tempEditRecord}
isEdit
/>
) : null}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/pages/admin/manage/citizens/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function ManageCitizens({ citizens: data }: Props) {
<AdminLayout>
<Title>{t("MANAGE_CITIZENS")}</Title>

<h1 className="text-3xl font-semibold">{t("MANAGE_CITIZENS")}</h1>
<h1 className="text-3xl font-semibold mb-3">{t("MANAGE_CITIZENS")}</h1>

<TabList tabs={["All Citizens", "Advanced"]}>
<AllCitizensTab setCitizens={setCitizens} citizens={citizens} />
Expand Down
2 changes: 1 addition & 1 deletion packages/schemas/src/court.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { z } from "zod";

export const RELEASE_CITIZEN_SCHEMA = z.object({
type: z.string().min(2),
releasedBy: z.string().min(2),
releasedBy: z.string(),
recordId: z.string().min(2),
});

0 comments on commit 1c1fbc7

Please sign in to comment.