Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORV2-2755 - STOS application form and review #1674

Merged
merged 57 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
80f63c6
Add additional types and fields to permitData for STOS permit type
zgong-gov Oct 16, 2024
da00f9b
Add licensedGVW field to permit vehicle details type for STOS
zgong-gov Oct 16, 2024
b13b536
Move helper methods for permit vehicles into permit vehicle and subty…
zgong-gov Oct 16, 2024
13c47cc
Merge branch 'main' into ORV2-2755, fix conflicts
zgong-gov Oct 18, 2024
fb40a25
Merge branch 'main' into ORV2-2755
zgong-gov Oct 21, 2024
c1905c8
Install policy engine on frontend, replace ineligible vehicle subtype…
zgong-gov Oct 22, 2024
74ec2c3
Use STOS constants for helper methods
zgong-gov Oct 22, 2024
e808ea2
Add commodities section to the application form
zgong-gov Oct 22, 2024
cb32a9f
Add application notes section to application form, refactor styling f…
zgong-gov Oct 23, 2024
c2b7acf
Fix width styling for vehicle details select unit or plate and vehicl…
zgong-gov Oct 23, 2024
05ce692
Merge branch 'main' into ORV2-2755, fix conflicts
zgong-gov Oct 24, 2024
67c8017
Add trip details section components to application form
zgong-gov Oct 25, 2024
e4e4198
Remove empty highway numbers from highway sequence when serializing a…
zgong-gov Oct 25, 2024
67bb4e0
Add Loaded Dimensions Section to Application form, fix styling for cu…
zgong-gov Oct 25, 2024
1880238
Add basic policy engine logic and configuration fetching on frontend,…
zgong-gov Oct 25, 2024
791c09a
Merge branch 'main' into ORV2-2755
zgong-gov Oct 25, 2024
d19d4a7
Fix Map type iterable error
zgong-gov Oct 25, 2024
3946ad7
Add default vehicle configuration data to application form data
zgong-gov Oct 26, 2024
66b18c0
Refactor vehicle information section, add vehicle configuration logic…
zgong-gov Nov 1, 2024
8e10f3a
Refactor policy engine and vehicle related logic
zgong-gov Nov 2, 2024
4d88a03
Remove unused ApplicationContext in shopping cart page
zgong-gov Nov 2, 2024
1168434
Refactor ApplicationFormContext and move form update methods to useCh…
zgong-gov Nov 2, 2024
1fef863
Add undefined for policy instantiation to distinguish between policy …
zgong-gov Nov 2, 2024
df1aa40
Improve naming for hook using custom methods to update certain applic…
zgong-gov Nov 2, 2024
dce30a9
Add comment for describing useApplicationFormUpdateMethods hook
zgong-gov Nov 2, 2024
a6d4b52
Refactor code related to using permitted commodity, add proper logic …
zgong-gov Nov 4, 2024
00e7938
Update policy engine, refactor application serialization logic and code
zgong-gov Nov 6, 2024
81914c0
Update policy engine, add basic policy engine validation for applicat…
zgong-gov Nov 7, 2024
3564d97
Merge branch 'main' into ORV2-2755, fix conflicts
zgong-gov Nov 8, 2024
eb3b130
Update commodity related logic, add custom autocomplete component
zgong-gov Nov 13, 2024
7a6ca2c
Merge branch 'main' into ORV2-2755
zgong-gov Nov 13, 2024
8b715e5
Update policy engine version
zgong-gov Nov 13, 2024
8c9306d
Add validation rule for licensed GVW, fix validation logic for add po…
zgong-gov Nov 14, 2024
ae67fea
Add fee calculation for STOS permit type
zgong-gov Nov 14, 2024
f32fb4c
Add licensedGVW rule and helpers, refactor vehicle related helpers an…
zgong-gov Nov 18, 2024
be9df42
Merge branch 'main' into ORV2-2755, fix conflicts
zgong-gov Nov 18, 2024
7f3f292
Add restriction rules as param for allowed vehicles, filter vehicle o…
zgong-gov Nov 18, 2024
dd1694e
Refactor code related to countries and provinces
zgong-gov Nov 19, 2024
c726407
Refactor country helper method, show proper province info for STOS po…
zgong-gov Nov 19, 2024
0b5b957
Show proper vehicle subtype display, sort and show properly the None …
zgong-gov Nov 19, 2024
44bb019
Separate phone extension input from number input, add custom number i…
zgong-gov Nov 20, 2024
5f0eed0
Refactor loaded dimensions input components
zgong-gov Nov 20, 2024
1904e3f
Add and implement sections for application and permit review page for…
zgong-gov Nov 21, 2024
e38caa8
Refactor queue query keys, add submit STOS application for review fun…
zgong-gov Nov 22, 2024
6e79a98
Merge branch 'main' into ORV2-2755, fix conflicts
zgong-gov Nov 22, 2024
08e2860
Handling error redirect inside application form and review pages inst…
zgong-gov Nov 22, 2024
8f0a7a0
Refactor ApplicationSteps to facilitate editing application and appli…
zgong-gov Nov 27, 2024
9a449f2
Merge branch 'main' into ORV2-2755
zgong-gov Nov 27, 2024
777c498
Fix broken power unit and trailer form tests
zgong-gov Nov 27, 2024
629a07f
Fix code smell
zgong-gov Nov 27, 2024
f37e1b9
Fix code smells, minor refactoring
zgong-gov Nov 28, 2024
0587f81
Fix nested string literal code smell
zgong-gov Nov 28, 2024
9513e01
Add policy endpoint url to config.js
zgong-gov Nov 28, 2024
1afd2d1
Merge branch 'main' into ORV2-2755
zgong-gov Nov 28, 2024
08ce280
Add feature flags for STOS on frontend
zgong-gov Nov 28, 2024
692d12c
Change config for policy url injection on frontend
zgong-gov Nov 28, 2024
14ef596
Hide submit for review button for staff users, show add to cart butto…
zgong-gov Nov 29, 2024
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
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ services:
args:
VITE_DEPLOY_ENVIRONMENT: ${VITE_DEPLOY_ENVIRONMENT}
VITE_API_VEHICLE_URL: ${VITE_API_VEHICLE_URL}
VITE_POLICY_URL: ${VITE_POLICY_URL}
VITE_KEYCLOAK_ISSUER_URL: ${VITE_KEYCLOAK_ISSUER_URL}
VITE_KEYCLOAK_AUDIENCE: ${VITE_KEYCLOAK_AUDIENCE}
VITE_SITEMINDER_LOG_OFF_URL: ${VITE_SITEMINDER_LOG_OFF_URL}
Expand Down
2 changes: 2 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
#ENV NODE_ENV production
ARG VITE_DEPLOY_ENVIRONMENT
ARG VITE_API_VEHICLE_URL
ARG VITE_POLICY_URL
ARG VITE_KEYCLOAK_ISSUER_URL
ARG VITE_KEYCLOAK_AUDIENCE
ARG VITE_SITEMINDER_LOG_OFF_URL

ENV VITE_DEPLOY_ENVIRONMENT $VITE_DEPLOY_ENVIRONMENT

Check warning on line 15 in frontend/Dockerfile

View workflow job for this annotation

GitHub Actions / Builds (frontend)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV VITE_API_VEHICLE_URL $VITE_API_VEHICLE_URL

Check warning on line 16 in frontend/Dockerfile

View workflow job for this annotation

GitHub Actions / Builds (frontend)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV VITE_POLICY_URL $VITE_POLICY_URL

Check warning on line 17 in frontend/Dockerfile

View workflow job for this annotation

GitHub Actions / Builds (frontend)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV VITE_KEYCLOAK_ISSUER_URL $VITE_KEYCLOAK_ISSUER_URL

Check warning on line 18 in frontend/Dockerfile

View workflow job for this annotation

GitHub Actions / Builds (frontend)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV VITE_KEYCLOAK_AUDIENCE $VITE_KEYCLOAK_AUDIENCE

Check warning on line 19 in frontend/Dockerfile

View workflow job for this annotation

GitHub Actions / Builds (frontend)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV VITE_SITEMINDER_LOG_OFF_URL $VITE_SITEMINDER_LOG_OFF_URL

Check warning on line 20 in frontend/Dockerfile

View workflow job for this annotation

GitHub Actions / Builds (frontend)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

# Install app dependencies
COPY ./package*.json ./
Expand All @@ -39,7 +41,7 @@
EXPOSE 3000

# Have only the compiled app, ready for production with Nginx
FROM nginx:1.27-alpine as production-stage

Check warning on line 44 in frontend/Dockerfile

View workflow job for this annotation

GitHub Actions / Builds (frontend)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
RUN mkdir /app
COPY --from=builder /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
Expand Down
1 change: 1 addition & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Create a .env file in the root directory of onRouteBC and add the following vari
```conf
VITE_DEPLOY_ENVIRONMENT=local
VITE_API_VEHICLE_URL=http://localhost:5000
VITE_POLICY_URL=http://localhost:5002
VITE_KEYCLOAK_ISSUER_URL=
VITE_KEYCLOAK_AUDIENCE=
VITE_SITEMINDER_LOG_OFF_URL=
Expand Down
93 changes: 93 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"material-react-table": "^2.13.1",
"mui-nested-menu": "^3.4.0",
"oidc-client-ts": "^3.0.1",
"onroute-policy-engine": "^0.4.6",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.0.13",
Expand Down
3 changes: 2 additions & 1 deletion frontend/public/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const envConfig = (() => {
VITE_KEYCLOAK_ISSUER_URL: "",
VITE_KEYCLOAK_AUDIENCE: "",
VITE_SITEMINDER_LOG_OFF_URL: "",
VITE_FRONTEND_PR_NUM: ""
VITE_FRONTEND_PR_NUM: "",
VITE_POLICY_URL: "http://localhost:5002",
zgong-gov marked this conversation as resolved.
Show resolved Hide resolved
};
})();
3 changes: 3 additions & 0 deletions frontend/src/common/apiManager/endpoints/endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export const VEHICLES_URL =
import.meta.env.VITE_API_VEHICLE_URL || envConfig.VITE_API_VEHICLE_URL;

export const POLICY_URL =
import.meta.env.VITE_POLICY_URL || envConfig.VITE_POLICY_URL;
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
.permit-expiry-date-banner {
background-color: $banner-grey;
color: $bc-primary-blue;
margin-top: 1.25rem;
padding: 1.5em;
display: flex;
align-items: center;
justify-content: space-between;
max-width: 270px;
padding: 1.5rem;
width: fit-content;
width: -moz-fit-content; /* For Firefox, Firefox Android */

& &__label {
font-size: 0.875rem;
margin: 0;
}

& &__expiry-date {
margin: 0.25rem 0 0 0;
font-size: 1.5rem;
font-weight: bold;
}
}
22 changes: 12 additions & 10 deletions frontend/src/common/components/banners/PermitExpiryDateBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Box, Typography } from "@mui/material";

import "./PermitExpiryDateBanner.scss";

export const PermitExpiryDateBanner = ({
Expand All @@ -8,13 +6,17 @@ export const PermitExpiryDateBanner = ({
expiryDate: string;
}) => {
return (
<Box className="permit-expiry-date-banner">
<div>
<Typography variant="h5">PERMIT EXPIRY DATE</Typography>
<Typography variant="h4" data-testid="permit-expiry-date">
{expiryDate}
</Typography>
</div>
</Box>
<div className="permit-expiry-date-banner">
<p className="permit-expiry-date-banner__label">
PERMIT EXPIRY DATE
</p>

<p
className="permit-expiry-date-banner__expiry-date"
data-testid="permit-expiry-date"
>
{expiryDate}
</p>
</div>
);
};
36 changes: 4 additions & 32 deletions frontend/src/common/components/form/CountryAndProvince.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { useFormContext, FieldPath } from "react-hook-form";
import { useCallback, useEffect, useState } from "react";
import { SelectChangeEvent } from "@mui/material/Select";
import MenuItem from "@mui/material/MenuItem";
import { COUNTRIES_THAT_SUPPORT_PROVINCE } from "../../constants/countries";

import CountriesAndStates from "../../constants/countries_and_states.json";
import { COUNTRIES } from "../../constants/countries";
import { countrySupportsProvinces } from "../../helpers/countries/countrySupportsProvinces";
import { DEFAULT_WIDTH } from "../../../themes/bcGovStyles";
import { CustomFormComponent } from "./CustomFormComponents";
import { Nullable, ORBC_FormTypes } from "../../types/common";
Expand All @@ -14,32 +14,11 @@ import {
requiredMessage,
} from "../../helpers/validationMessages";

/**
* The props that can be passed to the country and provinces subsection of a form.
*/
interface CountryAndProvinceProps {
/**
* Name of the feature that the field belongs to.
* This name is used for Id's and keys.
* Example: feature={"profile"}
*/
feature: string;

/**
* The value for the width of the select box
*/
width?: string;

/**
* Name used for the API call. Example: countryField="primaryContact.countryCode"
*/
countryField: string;
provinceField: string;

/**
* Boolean for react hook form rules. Example-> rules: { required: isCountryRequired }
* Should default to true
*/
isCountryRequired?: boolean;
isProvinceRequired?: boolean;
countryClassName?: string;
Expand All @@ -50,9 +29,6 @@ interface CountryAndProvinceProps {

/**
* The CountryAndProvince component provides form fields for country and province.
* This implementation uses {@link COUNTRIES_THAT_SUPPORT_PROVINCE} to display or hide
* the province field.
*
* @returns A react component with the country and province fields.
*/
export const CountryAndProvince = <T extends ORBC_FormTypes>({
Expand All @@ -68,10 +44,6 @@ export const CountryAndProvince = <T extends ORBC_FormTypes>({
readOnly,
}: CountryAndProvinceProps): JSX.Element => {
const { resetField, watch, setValue } = useFormContext();

const countrySupportsProvinces = (country: string) =>
COUNTRIES_THAT_SUPPORT_PROVINCE.includes(country);

const countrySelected = watch(countryField);
const provinceSelected = watch(provinceField);

Expand Down Expand Up @@ -130,7 +102,7 @@ export const CountryAndProvince = <T extends ORBC_FormTypes>({
* @param selectedCountry string representing the country
*/
const getProvinces = useCallback(function (selectedCountry: string) {
return CountriesAndStates.filter(
return COUNTRIES.filter(
(country) => country.code === selectedCountry,
).flatMap((country) => country.states);
}, []);
Expand Down Expand Up @@ -173,7 +145,7 @@ export const CountryAndProvince = <T extends ORBC_FormTypes>({
label: "Country",
width: width,
}}
menuOptions={CountriesAndStates.map((country) => (
menuOptions={COUNTRIES.map((country) => (
<MenuItem key={`country-${country.name}`} value={country.code}>
{country.name}
</MenuItem>
Expand Down
Loading
Loading