generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ORV2-2338 - Applying and amending permits using LOAs (#1637)
Co-authored-by: gchauhan-aot <[email protected]>
- Loading branch information
1 parent
8872a39
commit c43068a
Showing
70 changed files
with
2,400 additions
and
565 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
frontend/src/features/permits/context/ApplicationFormContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { createContext } from "react"; | ||
import { Dayjs } from "dayjs"; | ||
|
||
import { PermitVehicleDetails } from "../types/PermitVehicleDetails"; | ||
import { LOADetail } from "../../settings/types/SpecialAuthorization"; | ||
import { ApplicationFormData } from "../types/application"; | ||
import { getDefaultValues } from "../helpers/getDefaultApplicationFormData"; | ||
import { DEFAULT_PERMIT_TYPE } from "../types/PermitType"; | ||
import { PermitCondition } from "../types/PermitCondition"; | ||
import { PowerUnit, Trailer, VehicleSubType } from "../../manageVehicles/types/Vehicle"; | ||
import { Nullable } from "../../../common/types/common"; | ||
import { CompanyProfile } from "../../manageProfile/types/manageProfile.d"; | ||
import { | ||
PAST_START_DATE_STATUSES, | ||
PastStartDateStatus, | ||
} from "../../../common/components/form/subFormComponents/CustomDatePicker"; | ||
|
||
interface ApplicationFormContextType { | ||
initialFormData: ApplicationFormData; | ||
formData: ApplicationFormData; | ||
durationOptions: { | ||
value: number; | ||
label: string; | ||
}[]; | ||
vehicleOptions: (PowerUnit | Trailer)[]; | ||
powerUnitSubtypes: VehicleSubType[]; | ||
trailerSubtypes: VehicleSubType[]; | ||
isLcvDesignated: boolean; | ||
feature: string; | ||
companyInfo?: Nullable<CompanyProfile>; | ||
isAmendAction: boolean; | ||
createdDateTime?: Nullable<Dayjs>; | ||
updatedDateTime?: Nullable<Dayjs>; | ||
pastStartDateStatus: PastStartDateStatus; | ||
companyLOAs: LOADetail[]; | ||
revisionHistory: { | ||
permitId: number; | ||
name: string; | ||
revisionDateTime: string; | ||
comment: string; | ||
}[]; | ||
onLeave?: () => void; | ||
onSave?: () => Promise<void>; | ||
onCancel?: () => void; | ||
onContinue: () => Promise<void>; | ||
onSetDuration: (duration: number) => void; | ||
onSetExpiryDate: (expiry: Dayjs) => void; | ||
onSetConditions: (conditions: PermitCondition[]) => void; | ||
onToggleSaveVehicle: (saveVehicle: boolean) => void; | ||
onSetVehicle: (vehicleDetails: PermitVehicleDetails) => void; | ||
onClearVehicle: (saveVehicle: boolean) => void; | ||
onUpdateLOAs: (updatedLOAs: LOADetail[]) => void; | ||
} | ||
|
||
export const ApplicationFormContext = createContext<ApplicationFormContextType>({ | ||
initialFormData: getDefaultValues(DEFAULT_PERMIT_TYPE, undefined), | ||
formData: getDefaultValues(DEFAULT_PERMIT_TYPE, undefined), | ||
durationOptions: [], | ||
vehicleOptions: [], | ||
powerUnitSubtypes: [], | ||
trailerSubtypes: [], | ||
isLcvDesignated: false, | ||
feature: "", | ||
companyInfo: undefined, | ||
isAmendAction: false, | ||
createdDateTime: undefined, | ||
updatedDateTime: undefined, | ||
pastStartDateStatus: PAST_START_DATE_STATUSES.ALLOWED, | ||
companyLOAs: [], | ||
revisionHistory: [], | ||
onLeave: undefined, | ||
onSave: undefined, | ||
onCancel: undefined, | ||
onContinue: async () => undefined, | ||
onSetDuration: () => undefined, | ||
onSetExpiryDate: () => undefined, | ||
onSetConditions: () => undefined, | ||
onToggleSaveVehicle: () => undefined, | ||
onSetVehicle: () => undefined, | ||
onClearVehicle: () => undefined, | ||
onUpdateLOAs: () => undefined, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.