}) => {
return permit ? (
- {permitTypeDisplayText(permit.permitType)}
+ {getPermitTypeName(permit.permitType)}
diff --git a/frontend/src/features/permits/types/PermitCategory.ts b/frontend/src/features/permits/types/PermitCategory.ts
new file mode 100644
index 000000000..cb76673df
--- /dev/null
+++ b/frontend/src/features/permits/types/PermitCategory.ts
@@ -0,0 +1,51 @@
+import {
+ NON_RESIDENT_PERMIT_LIST,
+ PermitType,
+ SINGLE_TRIP_PERMIT_LIST,
+ TERM_PERMIT_LIST,
+} from "./PermitType";
+
+export const PERMIT_CATEGORIES = {
+ TERM: "TERM",
+ SINGLE_TRIP: "SINGLE_TRIP",
+ NON_RESIDENT: "NON_RESIDENT",
+};
+
+export type PermitCategory =
+ (typeof PERMIT_CATEGORIES)[keyof typeof PERMIT_CATEGORIES];
+
+/**
+ * Returns the name of the permit category.
+ * @param permitCategory String that represents the permit category
+ * @returns Name of the permit category, or empty string if no mapping exists for permit category
+ */
+export const getPermitCategoryName = (permitCategory: PermitCategory) => {
+ switch (permitCategory) {
+ case PERMIT_CATEGORIES.TERM:
+ return "Term";
+ case PERMIT_CATEGORIES.SINGLE_TRIP:
+ return "Single Trip";
+ case PERMIT_CATEGORIES.NON_RESIDENT:
+ return "Non-Resident";
+ default:
+ return "";
+ }
+};
+
+/**
+ * Returns the permit category for the given permit type.
+ * @param permitType String that represents the permit type
+ * @returns Name of the permit category, or empty string if no mapping exists for permit category
+ */
+export const getPermitCategory = (permitType: PermitType) => {
+ if (TERM_PERMIT_LIST.includes(permitType)) {
+ return PERMIT_CATEGORIES.TERM;
+ }
+ if (SINGLE_TRIP_PERMIT_LIST.includes(permitType)) {
+ return PERMIT_CATEGORIES.SINGLE_TRIP;
+ }
+ if (NON_RESIDENT_PERMIT_LIST.includes(permitType)) {
+ return PERMIT_CATEGORIES.NON_RESIDENT;
+ }
+ return "";
+};
diff --git a/frontend/src/features/permits/types/PermitType.ts b/frontend/src/features/permits/types/PermitType.ts
index 1d2bb9341..a85676631 100644
--- a/frontend/src/features/permits/types/PermitType.ts
+++ b/frontend/src/features/permits/types/PermitType.ts
@@ -1,36 +1,74 @@
import { Nullable } from "../../../common/types/common";
+import { getPermitCategory, getPermitCategoryName } from "./PermitCategory";
export const PERMIT_TYPES = {
- EPTOP: "EPTOP",
+ /* TERM */
+ // Term Oversize
+ TROS: "TROS",
+ // Term Overweight
+ TROW: "TROW",
+ // Highway Crossing
HC: "HC",
- LCV: "LCV",
- MFP: "MFP",
- NRQBS: "NRQBS",
- NRQCL: "NRQCL",
- NRQCV: "NRQCV",
- NRQFT: "NRQFT",
- NRQFV: "NRQFV",
- NRQXP: "NRQXP",
- NRSBS: "NRSBS",
- NRSCL: "NRSCL",
- NRSCV: "NRSCV",
- NRSFT: "NRSFT",
- NRSFV: "NRSFV",
- NRSXP: "NRSXP",
- RIG: "RIG",
- STOL: "STOL",
- STOS: "STOS",
+ // Axle Overweight
+
+ /* SINGLE TRIP */
+ // Extra Provincial Temp Operating Permit
+ EPTOP: "EPTOP",
+ // Single Trip Overweight
STOW: "STOW",
+ // Single Trip Oversize
+ STOS: "STOS",
+ // Single Trip Oversize Overweight
STWS: "STWS",
- TRAX: "TRAX",
- TROS: "TROS",
- TROW: "TROW",
+ // Empty - Single Trip Over Length 27.5
+ STOL: "STOL",
+ // Rig Move
+ RIG: "RIG",
+ // Increased GVW
+ IGVW: "IGVW",
+
+ /* NON RESIDENT */
+ // Quarterly ICBC Basic Insurance (FR)
+ QRFR: "QRFR",
+ // Quarterly Non-Resident
+ QNRBS: "QNRBS",
+ // Single Trip ICBC Basic Insurance (FR)
+ STFR: "STFR",
+ // Single Trip Non-Resident
+ NRSCV: "NRSCV",
+
+ /* MOTIVE FUEL USER PERMIT */
+ MFP: "MFP",
} as const;
export type PermitType = (typeof PERMIT_TYPES)[keyof typeof PERMIT_TYPES];
export const DEFAULT_PERMIT_TYPE = PERMIT_TYPES.TROS;
-export const EMPTY_PERMIT_TYPE_SELECT = "select";
+export const EMPTY_PERMIT_TYPE_SELECT = "Select";
+
+export const TERM_PERMIT_LIST: PermitType[] = [
+ PERMIT_TYPES.TROS,
+ PERMIT_TYPES.TROW,
+ /* TODO uncomment this when required */
+ // PERMIT_TYPES.HC,
+];
+
+export const SINGLE_TRIP_PERMIT_LIST: PermitType[] = [
+ PERMIT_TYPES.STOL,
+ PERMIT_TYPES.EPTOP,
+ PERMIT_TYPES.IGVW,
+ PERMIT_TYPES.STOS,
+ PERMIT_TYPES.STWS,
+ PERMIT_TYPES.STOW,
+ PERMIT_TYPES.RIG,
+];
+
+export const NON_RESIDENT_PERMIT_LIST: PermitType[] = [
+ PERMIT_TYPES.QNRBS,
+ PERMIT_TYPES.QRFR,
+ PERMIT_TYPES.NRSCV,
+ PERMIT_TYPES.STFR,
+];
/**
* Returns the name/description of the permit type.
@@ -39,73 +77,109 @@ export const EMPTY_PERMIT_TYPE_SELECT = "select";
*/
export const getPermitTypeName = (permitType?: Nullable) => {
switch (permitType) {
- case PERMIT_TYPES.EPTOP:
- return "Extra-Provincial Temporary Operating";
+ /* TERM */
+ case PERMIT_TYPES.TROS:
+ return "Term Oversize";
+ case PERMIT_TYPES.TROW:
+ return "Term Overweight";
case PERMIT_TYPES.HC:
return "Highway Crossing";
- case PERMIT_TYPES.LCV:
- return "Long Combination Vehicle";
- case PERMIT_TYPES.MFP:
- return "Motive Fuel User";
- case PERMIT_TYPES.NRQBS:
- return "Quarterly Non Resident Reg. / Ins. - Bus";
- case PERMIT_TYPES.NRQCL:
- return "Non Resident Quarterly Conditional License";
- case PERMIT_TYPES.NRQCV:
- return "Quarterly Non Resident Reg. / Ins. - Comm Vehicle";
- case PERMIT_TYPES.NRQFT:
- return "Non Resident Quarterly Farm Tractor";
- case PERMIT_TYPES.NRQFV:
- return "Quarterly Non Resident Reg. / Ins. - Farm Vehicle";
- case PERMIT_TYPES.NRQXP:
- return "Non Resident Quarterly X Plated";
- case PERMIT_TYPES.NRSBS:
- return "Single Trip Non-Resident Registration / Insurance - Buses";
- case PERMIT_TYPES.NRSCL:
- return "Non Resident Single Trip Conditional License";
- case PERMIT_TYPES.NRSCV:
- return "Single Trip Non-Resident Reg. / Ins. - Commercial Vehicle";
- case PERMIT_TYPES.NRSFT:
- return "Non Resident Farm Tractor Single Trip";
- case PERMIT_TYPES.NRSFV:
- return "Single Trip Non-Resident Reg. / Ins. - Farm Vehicle";
- case PERMIT_TYPES.NRSXP:
- return "Non Resident Single Trip X Plated Vehicle";
- case PERMIT_TYPES.RIG:
- return "Rig Move";
- case PERMIT_TYPES.STOL:
- return "Single Trip Over Length";
+
+ /* SINGLE TRIP */
case PERMIT_TYPES.STOS:
return "Single Trip Oversize";
- case PERMIT_TYPES.STOW:
- return "Single Trip Over Weight";
case PERMIT_TYPES.STWS:
return "Single Trip Overweight Oversize";
- case PERMIT_TYPES.TRAX:
- return "Term Axle Overweight";
- case PERMIT_TYPES.TROS:
- return "Term Oversize";
- case PERMIT_TYPES.TROW:
- return "Term Overweight";
+ case PERMIT_TYPES.STOW:
+ return "Single Trip Over Weight";
+ case PERMIT_TYPES.EPTOP:
+ return "Extra-Provincial Temporary Operating";
+ case PERMIT_TYPES.STOL:
+ return "Single Trip Over Length";
+ case PERMIT_TYPES.RIG:
+ return "Rig Move";
+ case PERMIT_TYPES.IGVW:
+ return "Increased GVW";
+
+ /* NON-RESIDENT */
+ case PERMIT_TYPES.NRSCV:
+ return "Single Trip Non-Resident";
+ case PERMIT_TYPES.QNRBS:
+ return "Quarterly Non-Resident";
+ case PERMIT_TYPES.QRFR:
+ return "Quarterly ICBC Basic Insurance (FR)";
+ case PERMIT_TYPES.STFR:
+ return "Single Trip ICBC Basic Insurance (FR)";
+
+ /* MOTIVE FUEL USER PERMIT */
+ case PERMIT_TYPES.MFP:
+ return "Motive Fuel User Permit";
+
default:
return "";
}
};
/**
- * Gets display text for permit type.
- * @param permitType Permit type (eg. TROS, STOS, etc)
- * @returns display text for the permit type
+ * Returns the shortened name/description of the permit type.
+ * @param permitType String (if any) that represents the permit type
+ * @returns Short name/description of the permit type, or empty string if no mapping exists for permit type
*/
-export const permitTypeDisplayText = (permitType?: Nullable) => {
+export const getPermitTypeShortName = (permitType?: Nullable) => {
switch (permitType) {
+ /* TERM */
case PERMIT_TYPES.TROS:
- return "Oversize: Term";
+ return "Oversize";
+ case PERMIT_TYPES.TROW:
+ return "Overweight";
+ case PERMIT_TYPES.HC:
+ return "Highway Crossing";
+
+ /* SINGLE TRIP */
+ case PERMIT_TYPES.EPTOP:
+ return "Extra-Provincial Temporary Operating Permit";
+ case PERMIT_TYPES.STOW:
+ return "Overweight";
case PERMIT_TYPES.STOS:
- return "Oversize: Single Trip";
+ return "Oversize";
+ case PERMIT_TYPES.STWS:
+ return "Oversized Overweight";
+ case PERMIT_TYPES.STOL:
+ return "Empty - Length Over 27.5 m";
+ case PERMIT_TYPES.RIG:
+ return "Rig Move";
+ case PERMIT_TYPES.IGVW:
+ return "Increased GVW";
+
+ /* NON RESIDENT */
+ case PERMIT_TYPES.QRFR:
+ return "Quarterly ICBC Basic Insurance (FR)";
+ case PERMIT_TYPES.QNRBS:
+ return "Quarterly";
+ case PERMIT_TYPES.STFR:
+ return "Single Trip ICBC Basic Insurance (FR)";
+ case PERMIT_TYPES.NRSCV:
+ return "Single Trip";
+
+ /* MOTIVE FUEL USER PERMIT */
+ case PERMIT_TYPES.MFP:
+ return "Motive Fuel User Permit";
+
default:
- return getPermitTypeName(permitType);
+ return "";
+ }
+};
+
+/**
+ * Gets formatted Permit Type name as "PermitCategory > PermitType". Used in the Select Permit Type dropdown
+ * @param permitType Permit type (eg. TROS, STOS, etc)
+ * @returns formatted display text for the permit category type
+ */
+export const getFormattedPermitTypeName = (permitType: PermitType) => {
+ if (permitType === PERMIT_TYPES.MFP) {
+ return getPermitTypeName(PERMIT_TYPES.MFP);
}
+ return `${getPermitCategoryName(getPermitCategory(permitType))} > ${getPermitTypeShortName(permitType)}`;
};
/**
@@ -114,7 +188,10 @@ export const permitTypeDisplayText = (permitType?: Nullable) => {
* @returns true if string is a valid permit type, or false otherwise
*/
export const isPermitTypeValid = (permitType?: Nullable) => {
- return permitType && (Object.values(PERMIT_TYPES) as string[]).includes(permitType.toUpperCase());
+ return (
+ permitType &&
+ (Object.values(PERMIT_TYPES) as string[]).includes(permitType.toUpperCase())
+ );
};
/**
@@ -123,6 +200,5 @@ export const isPermitTypeValid = (permitType?: Nullable) => {
* @returns Whether or not the permit of that type is considered a term permit
*/
export const isTermPermitType = (permitType: PermitType) => {
- return permitType === PERMIT_TYPES.TROS
- || permitType === PERMIT_TYPES.TROW;
+ return permitType === PERMIT_TYPES.TROS || permitType === PERMIT_TYPES.TROW;
};
diff --git a/frontend/src/themes/orbcStyles.scss b/frontend/src/themes/orbcStyles.scss
index 128161cdc..fe51cdc8a 100644
--- a/frontend/src/themes/orbcStyles.scss
+++ b/frontend/src/themes/orbcStyles.scss
@@ -36,6 +36,7 @@ $blue: #0000ff;
$button-hover: #2d5992;
$disabled-colour: #b5c0cf;
$focus-blue: #3b99fc;
+$border-blue: #5697F5;
$shadow-colour: #00000029;
$white: #ffffff;