Skip to content

Commit 86f88b7

Browse files
authored
Merge branch 'main' into feat/gold_test
2 parents a74f55c + 6f1b9ff commit 86f88b7

File tree

19 files changed

+257
-93
lines changed

19 files changed

+257
-93
lines changed

frontend/src/common/components/banners/BcGovAlertBanner.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
background-color: orbcStyles.$bc-messages-red-text;
1616
color: orbcStyles.$white;
1717
}
18+
19+
&#{&}--error-alt {
20+
background-color: orbcStyles.$bc-messages-red-background;
21+
color: orbcStyles.$bc-messages-red-text;
22+
}
1823

1924
&#{&}--info {
2025
background-color: orbcStyles.$bc-messages-blue-background;
@@ -65,4 +70,4 @@
6570
& &__additional-info {
6671
margin-top: 0.5rem;
6772
}
68-
}
73+
}

frontend/src/common/components/banners/BcGovAlertBanner.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const BcGovAlertBanner = ({
2626
className,
2727
}: {
2828
msg: string | JSX.Element;
29-
additionalInfo?: JSX.Element;
29+
additionalInfo?: string | JSX.Element;
3030
bannerType: AlertBannerType;
3131
className?: string;
3232
}) => {
@@ -39,6 +39,7 @@ export const BcGovAlertBanner = ({
3939
case ALERT_BANNER_TYPES.WARNING:
4040
return faExclamationTriangle;
4141
case ALERT_BANNER_TYPES.ERROR:
42+
case ALERT_BANNER_TYPES.ERROR_ALT:
4243
default:
4344
return faExclamationCircle;
4445
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { BcGovAlertBanner } from "./BcGovAlertBanner";
2+
import { ALERT_BANNER_TYPES } from "./types/AlertBannerType";
3+
4+
export const ErrorAltBcGovBanner = ({
5+
msg,
6+
additionalInfo,
7+
className,
8+
}: {
9+
msg: string | JSX.Element;
10+
additionalInfo?: string | JSX.Element;
11+
className?: string;
12+
}) => (
13+
<BcGovAlertBanner
14+
msg={msg}
15+
additionalInfo={additionalInfo}
16+
bannerType={ALERT_BANNER_TYPES.ERROR_ALT}
17+
className={className}
18+
/>
19+
);

frontend/src/common/components/banners/types/AlertBannerType.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export const ALERT_BANNER_TYPES = {
33
SUCCESS: "success",
44
WARNING: "warning",
55
ERROR: "error",
6+
ERROR_ALT: "error-alt",
67
} as const;
78

89
export type AlertBannerType =

frontend/src/common/constants/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ export const DEFAULT_EMPTY_SELECT_OPTION = {
3131
export const DEFAULT_SELECT_OPTIONS = [DEFAULT_EMPTY_SELECT_OPTION];
3232

3333
export const EMPTY_VEHICLE_UNIT_NUMBER = DEFAULT_EMPTY_SELECT_VALUE;
34+
35+
//Inventory GVW
36+
export const GVW_LIMIT = 63500;

frontend/src/common/constants/validation_messages.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@
8787
},
8888
"invalid": "You must enter a valid address."
8989
},
90+
"clientName": {
91+
"defaultMessage": "Invalid Client Name format",
92+
"length": {
93+
"messageTemplate": "Client Name length must be between :min-:max characters",
94+
"placeholders": [":min", ":max"]
95+
}
96+
},
9097
"dba": {
9198
"defaultMessage": "Invalid DBA format",
9299
"length": {
@@ -174,4 +181,4 @@
174181
"placeholders": [":max"]
175182
}
176183
}
177-
}
184+
}

frontend/src/common/helpers/validationMessages.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ export const invalidPhoneLength = (min: number, max: number) => {
6969
return replacePlaceholders(messageTemplate, placeholders, min, max);
7070
};
7171

72-
export const invalidExtension = () => validationMessages.extension.defaultMessage;
72+
export const invalidExtension = () =>
73+
validationMessages.extension.defaultMessage;
7374

7475
export const invalidExtensionLength = (max: number) => {
7576
const { messageTemplate, placeholders } = validationMessages.extension.length;
@@ -125,6 +126,12 @@ export const licensedGVWExceeded = (max: number, localizeNumber?: boolean) => {
125126
);
126127
};
127128

129+
export const invalidClientNameLength = (min: number, max: number) => {
130+
const { messageTemplate, placeholders } =
131+
validationMessages.clientName.length;
132+
return replacePlaceholders(messageTemplate, placeholders, min, max);
133+
};
134+
128135
export const invalidDBALength = (min: number, max: number) => {
129136
const { messageTemplate, placeholders } = validationMessages.dba.length;
130137
return replacePlaceholders(messageTemplate, placeholders, min, max);
@@ -154,9 +161,9 @@ export const requiredHighway = () => validationMessages.highway.missing;
154161
export const requiredPowerUnit = () => validationMessages.powerUnit.required;
155162

156163
export const provinceVehicleDoesNotRequirePermit = (province: string) => {
157-
const { messageTemplate, placeholders }
158-
= validationMessages.province.provinceVehicleDoesNotRequirePermit;
159-
164+
const { messageTemplate, placeholders } =
165+
validationMessages.province.provinceVehicleDoesNotRequirePermit;
166+
160167
return replacePlaceholders(messageTemplate, placeholders, province);
161168
};
162169

frontend/src/features/manageProfile/components/forms/companyInfo/CompanyInfoForm.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ import {
2424
} from "../../../../../common/helpers/util";
2525

2626
import {
27+
invalidClientNameLength,
2728
invalidDBALength,
2829
isValidOptionalString,
30+
requiredMessage,
2931
} from "../../../../../common/helpers/validationMessages";
3032
import { ORBC_FORM_FEATURES } from "../../../../../common/types/common";
33+
import { WarningBcGovBanner } from "../../../../../common/components/banners/WarningBcGovBanner";
3134

3235
/**
3336
* The Company Information Form contains multiple subs forms including
@@ -147,6 +150,30 @@ export const CompanyInfoForm = memo(
147150
return (
148151
<div className="company-info-form">
149152
<FormProvider {...formMethods}>
153+
<Typography variant="h2" gutterBottom>
154+
Client Name
155+
</Typography>
156+
<WarningBcGovBanner
157+
msg={BANNER_MESSAGES.CLIENT_NAME_MUST_BE_REGISTERED_OWNER}
158+
/>
159+
<CustomFormComponent
160+
type="input"
161+
feature={FEATURE}
162+
options={{
163+
name: "legalName",
164+
rules: {
165+
required: { value: true, message: requiredMessage() },
166+
validate: {
167+
validateLegalName: (legalName: string) =>
168+
isValidOptionalString(legalName, {
169+
maxLength: 150,
170+
}) || invalidClientNameLength(1, 150),
171+
},
172+
},
173+
label: "Client Name",
174+
}}
175+
/>
176+
150177
<Typography variant="h2" gutterBottom>
151178
Doing Business As (DBA)
152179
</Typography>

frontend/src/features/manageProfile/components/forms/companyInfo/CompanyInfoForms.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
.company-info-form {
22
width: 100%;
3-
max-width: 528px;
3+
max-width: 1056px;
44
display: flex;
55
flex-direction: column;
66
margin-top: 1em;
77

88
.bc-gov-alertbanner {
99
margin-top: 1.5rem;
1010
margin-bottom: 1.5rem;
11+
width: auto;
1112
}
1213

1314
&__submission {

frontend/src/features/manageProfile/pages/CompanyInfo.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ export const CompanyInfo = ({
2828

2929
return (
3030
<div className="company-info-page">
31-
{isEditing ? <Header /> : null}
32-
<CompanyBanner
33-
companyName={companyInfoData?.legalName}
34-
clientNumber={companyInfoData?.clientNumber}
35-
/>
31+
{isEditing && <Header />}
32+
{!isEditing && (
33+
<CompanyBanner
34+
companyName={companyInfoData?.legalName}
35+
clientNumber={companyInfoData?.clientNumber}
36+
/>
37+
)}
3638
{isEditing ? (
3739
<CompanyInfoForm
3840
companyInfo={companyInfoData}

0 commit comments

Comments
 (0)