Skip to content

Commit

Permalink
feat: Other license categories
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Oct 6, 2023
1 parent 7ab25c8 commit 9c99b4a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 4 deletions.
1 change: 1 addition & 0 deletions apps/api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,7 @@ enum DriversLicenseCategoryType {
FIREARM
HUNTING
FISHING
OTHER
}

enum EmployeeAsEnum {
Expand Down
6 changes: 3 additions & 3 deletions apps/client/locales/en/citizen.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"fishingLicenseCategory": "Fishing License Categories",
"huntingLicenseCategory": "Hunting License Categories",
"huntingLicensePoints": "Hunting License Points",
"fishingLicensePoints": "Fishing License Points"
"fishingLicensePoints": "Fishing License Points",
"otherLicenseCategory": "Other License Categories"
},
"Vehicles": {
"model": "Model",
Expand Down Expand Up @@ -156,12 +157,11 @@
"LawBook": {
"lawBook": "Law Book",
"warningApplicable": "Warning Applicable",
"noPenalCodes": "No penal code has been registered",
"noPenalCodes": "No penal code has been registered",
"warningNotApplicable": "Warning Not Applicable",
"fines": "Fines",
"bail": "Bail",
"jailTime": "Jail Time",
"isPrimary": "Is Primary"
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export function createDefaultLicensesValues(citizen: Citizen | null): LicenseIni
citizen?.dlCategory
.filter((v) => v.type === DriversLicenseCategoryType.HUNTING)
.map((v) => v.id) ?? [],
otherLicenseCategory:
citizen?.dlCategory
.filter((v) => v.type === DriversLicenseCategoryType.OTHER)
.map((v) => v.id) ?? [],
};
}

Expand Down Expand Up @@ -483,6 +487,27 @@ export function ManageLicensesFormFields({ isLeo, allowRemoval }: Props) {
) : null}
</section>
)}

<section className="w-full">
<FormRow>
<SelectField
label={t("Citizen.otherLicenseCategory")}
errorMessage={errors.otherLicenseCategory}
selectionMode="multiple"
selectedKeys={values.otherLicenseCategory}
isOptional
isClearable={allowRemoval}
onSelectionChange={(keys) => setFieldValue("otherLicenseCategory", keys)}
options={driverslicenseCategory.values
.filter((v) => v.type === DriversLicenseCategoryType.OTHER)
.map((value) => ({
label: value.value.value,
value: value.id,
description: value.description,
}))}
/>
</FormRow>
</section>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export function CitizenLicenses({ citizen }: Props) {
DriversLicenseCategoryType.HUNTING,
["huntingLicense", "huntingLicenseTimeEnd", "huntingLicenseNumber"],
],
// todo: other license categories
};

return (
Expand Down Expand Up @@ -160,7 +161,6 @@ export function CitizenLicenses({ citizen }: Props) {
{t("Leo.suspended")}
{typeof suspendedTimeEnd === "string" ? (
<span>
{" "}
({t("Leo.endsOn")} <FullDate onlyDate>{new Date(suspendedTimeEnd)}</FullDate>)
</span>
) : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface LicenseInitialValues {
firearmLicenseCategory: string[];
huntingLicenseCategory: string[];
fishingLicenseCategory: string[];
otherLicenseCategory: string[];
}

export function ManageLicensesModal({
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export const DriversLicenseCategoryType = {
FIREARM: "FIREARM",
HUNTING: "HUNTING",
FISHING: "FISHING",
OTHER: "OTHER",
} as const;

export type DriversLicenseCategoryType =
Expand Down

0 comments on commit 9c99b4a

Please sign in to comment.