Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,28 @@ VALUES
GETUTCDATE()
);

INSERT [dbo].[ORBC_FEATURE_FLAG] (
[FEATURE_ID],
[FEATURE_KEY],
[FEATURE_VALUE],
[CONCURRENCY_CONTROL_NUMBER],
[DB_CREATE_USERID],
[DB_CREATE_TIMESTAMP],
[DB_LAST_UPDATE_USERID],
[DB_LAST_UPDATE_TIMESTAMP]
)
VALUES
(
'22',
'STOW',
'ENABLED',
NULL,
N'dbo',
GETUTCDATE(),
N'dbo',
GETUTCDATE()
);


SET
IDENTITY_INSERT [dbo].[ORBC_FEATURE_FLAG] OFF
Expand Down
43 changes: 43 additions & 0 deletions database/mssql/scripts/versions/revert/v_90_ddl_revert.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET NOCOUNT ON
GO
SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
BEGIN TRANSACTION
GO

-- Remove the newly added policy configuration
DELETE FROM [dbo].[ORBC_POLICY_CONFIGURATION]
WHERE POLICY_CONFIGURATION_ID = (SELECT MAX(POLICY_CONFIGURATION_ID) FROM [dbo].[ORBC_POLICY_CONFIGURATION])
GO

IF @@ERROR <> 0 SET NOEXEC ON
GO

DECLARE @VersionDescription VARCHAR(255)
SET @VersionDescription = 'Reverting updates to policy config to support STOW'

INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [RELEASE_DATE]) VALUES (89, @VersionDescription, getutcdate())
GO

IF @@ERROR <> 0 SET NOEXEC ON
GO

COMMIT TRANSACTION
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
DECLARE @Success AS BIT
SET @Success = 1
SET NOEXEC OFF
IF (@Success = 1) PRINT 'The database revert succeeded'
ELSE BEGIN
IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION
PRINT 'The database revert failed'
END
GO
50 changes: 50 additions & 0 deletions database/mssql/scripts/versions/v_90_ddl.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/src/common/constants/bannerMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const BANNER_MESSAGES = {
"Rejected applications appear in Applications in Progress.",
APPLICATION_NOTES:
"Application notes can provide additional details to the Provincial Permit Centre when submitting a permit application for review.",
APPLICATION_NOTES_EXAMPLE: "e.g. For extraordinary load approval AB1234",
APPLICATION_NOTES_EXAMPLE: "e.g. Use the credit account for payment.",
APPLICATION_NOTES_INFO:
"Application notes will not appear on the permit document.",
HIGHWAY_SEQUENCES: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ export const ApplicationStepPage = ({

const { data: featureFlags } = useFeatureFlagsQuery();
const enableSTOS = featureFlags?.["STOS"] === "ENABLED";
const enableSTOW = featureFlags?.["STOW"] === "ENABLED";
const enableMFP = featureFlags?.["MFP"] === "ENABLED";
const enableSTFR = featureFlags?.["STFR"] === "ENABLED";
const enableQRFR = featureFlags?.["QRFR"] === "ENABLED";
const enableNRSCV = featureFlags?.["NRSCV"] === "ENABLED";
const enableNRQCV = featureFlags?.["NRQCV"] === "ENABLED";

// Query for the application data whenever this page is rendered
const {
applicationData,
Expand Down Expand Up @@ -121,6 +122,7 @@ export const ApplicationStepPage = ({
[PERMIT_TYPES.TROS, PERMIT_TYPES.TROW] as string[]
)
.concat(enableSTOS ? [PERMIT_TYPES.STOS] : [])
.concat(enableSTOW ? [PERMIT_TYPES.STOW] : [])
.concat(enableMFP ? [PERMIT_TYPES.MFP] : [])
.concat(enableSTFR ? [PERMIT_TYPES.STFR] : [])
.concat(enableQRFR ? [PERMIT_TYPES.QRFR] : [])
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/features/permits/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export const ALL_PERMIT_TYPE_CHOOSE_FROM_OPTIONS: PermitTypeChooseFromItem[] = [
value: PERMIT_TYPES.STOS,
label: getPermitTypeShortName(PERMIT_TYPES.STOS),
},
{
value: PERMIT_TYPES.STOW,
label: getPermitTypeShortName(PERMIT_TYPES.STOW),
},
],
// items: SINGLE_TRIP_PERMIT_LIST.map((permitType: PermitType) => ({
// value: permitType,
Expand Down Expand Up @@ -102,12 +106,12 @@ export const LCV_VEHICLE_SUBTYPES = [
{
typeCode: "LCVRMDB",
type: "Long Combination Vehicles (LCV) - Rocky Mountain Doubles",
description: "LCV vehicles for approved carriers and routes only."
description: "LCV vehicles for approved carriers and routes only.",
},
{
typeCode: "LCVTPDB",
type: "Long Combination Vehicles (LCV) - Turnpike Doubles",
description: "LCV vehicles for approved carriers and routes only."
description: "LCV vehicles for approved carriers and routes only.",
},
];

Expand Down
70 changes: 70 additions & 0 deletions frontend/src/features/permits/constants/stow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { PermitCondition } from "../types/PermitCondition";

export const STOW_CONDITIONS: PermitCondition[] = [
{
description: "Permit Scope and Limitation",
condition: "CVSE-1070",
conditionLink: "https://www.th.gov.bc.ca/forms/getForm.aspx?formId=1261",
checked: true,
disabled: true,
},
{
description: "Highways with Restrictive Load Limits",
condition: "CVSE-1011",
conditionLink: "https://www.th.gov.bc.ca/forms/getForm.aspx?formId=1258",
checked: false,
disabled: false,
},
];

export const MANDATORY_STOW_CONDITIONS: PermitCondition[] =
STOW_CONDITIONS.filter(
({ condition }: PermitCondition) => condition === "CVSE-1070",
);

export const MIN_STOW_DURATION = 1;
export const MAX_STOW_CV_DURATION = 7;
export const MAX_STOW_STAFF_DURATION = 30;

export const STOW_CV_DURATION_OPTIONS = [
{ value: MIN_STOW_DURATION, label: "1 Day" },
{ value: 2, label: "2 Days" },
{ value: 3, label: "3 Days" },
{ value: 4, label: "4 Days" },
{ value: 5, label: "5 Days" },
{ value: 6, label: "6 Days" },
{ value: MAX_STOW_CV_DURATION, label: "7 Days" },
];

export const STOW_STAFF_DURATION_OPTIONS = [
{ value: MIN_STOW_DURATION, label: "1 Day" },
{ value: 2, label: "2 Days" },
{ value: 3, label: "3 Days" },
{ value: 4, label: "4 Days" },
{ value: 5, label: "5 Days" },
{ value: 6, label: "6 Days" },
{ value: 7, label: "7 Days" },
{ value: 8, label: "8 Days" },
{ value: 9, label: "9 Days" },
{ value: 10, label: "10 Days" },
{ value: 11, label: "11 Days" },
{ value: 12, label: "12 Days" },
{ value: 13, label: "13 Days" },
{ value: 14, label: "14 Days" },
{ value: 15, label: "15 Days" },
{ value: 16, label: "16 Days" },
{ value: 17, label: "17 Days" },
{ value: 18, label: "18 Days" },
{ value: 19, label: "19 Days" },
{ value: 20, label: "20 Days" },
{ value: 21, label: "21 Days" },
{ value: 22, label: "22 Days" },
{ value: 23, label: "23 Days" },
{ value: 24, label: "24 Days" },
{ value: 25, label: "25 Days" },
{ value: 26, label: "26 Days" },
{ value: 27, label: "27 Days" },
{ value: 28, label: "28 Days" },
{ value: 29, label: "29 Days" },
{ value: MAX_STOW_STAFF_DURATION, label: "30 Days" },
];
8 changes: 5 additions & 3 deletions frontend/src/features/permits/constants/trow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PermitCondition } from "../types/PermitCondition";
import {
BASE_DAYS_IN_YEAR,
TERM_PERMIT_DURATION_OPTIONS,
TERM_PERMIT_MIN_DURATION,
TERM_PERMIT_MIN_DURATION,
TERM_DURATION_INTERVAL_DAYS,
} from "./constants";

Expand Down Expand Up @@ -36,15 +36,17 @@ export const TROW_CONDITIONS: PermitCondition[] = [
disabled: true,
},
{
description: "Highways and Restrictive Load Limits",
description: "Highways with Restrictive Load Limits",
condition: "CVSE-1011",
conditionLink: "https://www.th.gov.bc.ca/forms/getForm.aspx?formId=1258",
checked: true,
disabled: true,
},
];

export const MANDATORY_TROW_CONDITIONS: PermitCondition[] = [...TROW_CONDITIONS];
export const MANDATORY_TROW_CONDITIONS: PermitCondition[] = [
...TROW_CONDITIONS,
];
export const MIN_TROW_DURATION = TERM_PERMIT_MIN_DURATION;
export const MAX_TROW_DURATION = BASE_DAYS_IN_YEAR;
export const TROW_DURATION_OPTIONS = [...TERM_PERMIT_DURATION_OPTIONS];
Expand Down
65 changes: 43 additions & 22 deletions frontend/src/features/permits/helpers/conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,29 @@ import { MANDATORY_TROS_CONDITIONS, TROS_CONDITIONS } from "../constants/tros";
import { MANDATORY_TROW_CONDITIONS, TROW_CONDITIONS } from "../constants/trow";
import { PermitCondition } from "../types/PermitCondition";
import { PERMIT_TYPES, PermitType } from "../types/PermitType";
import { MANDATORY_NRSCV_CONDITIONS, NRSCV_CONDITIONS } from "../constants/nrscv";
import { MANDATORY_NRQCV_CONDITIONS, NRQCV_CONDITIONS } from "../constants/nrqcv";
import {
MANDATORY_NRSCV_CONDITIONS,
NRSCV_CONDITIONS,
} from "../constants/nrscv";
import {
MANDATORY_NRQCV_CONDITIONS,
NRQCV_CONDITIONS,
} from "../constants/nrqcv";
import { Nullable } from "../../../common/types/common";
import { MANDATORY_STOW_CONDITIONS, STOW_CONDITIONS } from "../constants/stow";

/**
* Determine whether or not a permit with given permit type can have LCV conditions attached to it.
* @param permitType Permit type
* @returns Whether or not a permit with given permit type can have LCV conditions attached to it
*/
export const canPermitTypeIncludeLCVCondition = (permitType?: Nullable<PermitType>) => {
export const canPermitTypeIncludeLCVCondition = (
permitType?: Nullable<PermitType>,
) => {
if (!permitType) return false;
return ([
PERMIT_TYPES.TROS,
PERMIT_TYPES.STOS,
] as PermitType[]).includes(permitType);
return ([PERMIT_TYPES.TROS, PERMIT_TYPES.STOS] as PermitType[]).includes(
permitType,
);
};

/**
Expand Down Expand Up @@ -53,6 +61,8 @@ export const getMandatoryConditions = (
return MANDATORY_MFP_CONDITIONS.concat(additionalConditions);
case PERMIT_TYPES.STOS:
return MANDATORY_STOS_CONDITIONS.concat(additionalConditions);
case PERMIT_TYPES.STOW:
return MANDATORY_STOW_CONDITIONS.concat(additionalConditions);
case PERMIT_TYPES.TROW:
return MANDATORY_TROW_CONDITIONS.concat(additionalConditions);
case PERMIT_TYPES.TROS:
Expand All @@ -70,7 +80,7 @@ const getConditionsByPermitType = (
includeLcvCondition && canPermitTypeIncludeLCVCondition(permitType)
? [LCV_CONDITION]
: [];

switch (permitType) {
case PERMIT_TYPES.QRFR:
return QRFR_CONDITIONS.concat(additionalConditions);
Expand All @@ -84,6 +94,8 @@ const getConditionsByPermitType = (
return MFP_CONDITIONS.concat(additionalConditions);
case PERMIT_TYPES.STOS:
return STOS_CONDITIONS.concat(additionalConditions);
case PERMIT_TYPES.STOW:
return STOW_CONDITIONS.concat(additionalConditions);
case PERMIT_TYPES.TROW:
return TROW_CONDITIONS.concat(additionalConditions);
case PERMIT_TYPES.TROS:
Expand All @@ -98,7 +110,7 @@ const isConditionMandatory = (
mandatoryConditions: PermitCondition[],
) => {
return mandatoryConditions
.map(mandatoryCondition => mandatoryCondition.condition)
.map((mandatoryCondition) => mandatoryCondition.condition)
.includes(condition.condition);
};

Expand All @@ -125,15 +137,20 @@ export const getDefaultConditions = (
permitType: PermitType,
includeLcvCondition?: boolean,
) => {
const mandatoryConditions = getMandatoryConditions(permitType, includeLcvCondition);
const mandatoryConditions = getMandatoryConditions(
permitType,
includeLcvCondition,
);

return sortConditions(
getConditionsByPermitType(permitType, includeLcvCondition).map((condition) => ({
...condition,
// must-select options are checked and disabled (for toggling) by default
checked: isConditionMandatory(condition, mandatoryConditions),
disabled: isConditionMandatory(condition, mandatoryConditions),
})),
getConditionsByPermitType(permitType, includeLcvCondition).map(
(condition) => ({
...condition,
// must-select options are checked and disabled (for toggling) by default
checked: isConditionMandatory(condition, mandatoryConditions),
disabled: isConditionMandatory(condition, mandatoryConditions),
}),
),
);
};

Expand All @@ -157,12 +174,14 @@ export const getUpdatedConditionsForLCV = (
({ condition }: PermitCondition) => condition !== LCV_CONDITION.condition,
);
}

// If LCV is designated, and vehicle subtype isn't LCV but conditions have LCV,
// then remove that LCV condition
if (
!isVehicleSubtypeLCV(vehicleSubtype)
&& prevSelectedConditions.some(({ condition }) => condition === LCV_CONDITION.condition)
!isVehicleSubtypeLCV(vehicleSubtype) &&
prevSelectedConditions.some(
({ condition }) => condition === LCV_CONDITION.condition,
)
) {
return prevSelectedConditions.filter(
({ condition }: PermitCondition) => condition !== LCV_CONDITION.condition,
Expand All @@ -172,9 +191,11 @@ export const getUpdatedConditionsForLCV = (
// If LCV is designated, and vehicle subtype is LCV but conditions don't have LCV,
// then add that LCV condition if the permit type allows it
if (
isVehicleSubtypeLCV(vehicleSubtype)
&& !prevSelectedConditions.some(({ condition }) => condition === LCV_CONDITION.condition)
&& canPermitTypeIncludeLCVCondition(permitType)
isVehicleSubtypeLCV(vehicleSubtype) &&
!prevSelectedConditions.some(
({ condition }) => condition === LCV_CONDITION.condition,
) &&
canPermitTypeIncludeLCVCondition(permitType)
) {
return sortConditions([...prevSelectedConditions, LCV_CONDITION]);
}
Expand Down
Loading
Loading