Skip to content

Commit

Permalink
fix: ORV2-1987 Add DBA to ManageProfile\CompanyInfo (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
praju-aot authored Feb 15, 2024
1 parent 1d56ebb commit a88552f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ import { CompanyContactDetailsForm } from "./subForms/CompanyContactDetailsForm"
import { CompanyPrimaryContactForm } from "./subForms/CompanyPrimaryContactForm";
import { formatPhoneNumber } from "../../../../../common/components/form/subFormComponents/PhoneNumberInput";
import { InfoBcGovBanner } from "../../../../../common/components/banners/InfoBcGovBanner";
import { CompanyProfile, UpdateCompanyProfileRequest } from "../../../types/manageProfile";
import {
CompanyProfile,
UpdateCompanyProfileRequest,
} from "../../../types/manageProfile";
import { getCompanyEmailFromSession } from "../../../../../common/apiManager/httpRequestHandler";
import {
applyWhenNotNullable,
getDefaultRequiredVal,
} from "../../../../../common/helpers/util";
import { BANNER_MESSAGES } from "../../../../../common/constants/bannerMessages";
import { CustomFormComponent } from "../../../../../common/components/form/CustomFormComponents";
import {
invalidDBALength,
isValidOptionalString,
} from "../../../../../common/helpers/validationMessages";

/**
* The Company Information Form contains multiple subs forms including
Expand All @@ -38,6 +46,7 @@ export const CompanyInfoForm = memo(
const formMethods = useForm<UpdateCompanyProfileRequest>({
defaultValues: {
legalName: getDefaultRequiredVal("", companyInfo?.legalName),
alternateName: getDefaultRequiredVal("", companyInfo?.alternateName),
mailingAddress: {
addressLine1: getDefaultRequiredVal(
"",
Expand Down Expand Up @@ -132,6 +141,30 @@ export const CompanyInfoForm = memo(
return (
<div className="company-info-form">
<FormProvider {...formMethods}>
<Typography variant="h2" gutterBottom>
Doing Business As (DBA)
</Typography>
<CustomFormComponent
type="input"
feature={FEATURE}
options={{
name: "alternateName",
rules: {
required: false,
validate: {
validateAlternateName: (alternateName: string) =>
isValidOptionalString(alternateName, { maxLength: 150 }) ||
invalidDBALength(1, 150),
},
},
label: "DBA",
}}
/>

<Typography variant="h2" gutterBottom>
Company Mailing Address
</Typography>

<CompanyInfoGeneralForm feature={FEATURE} />

<Typography variant="h2" gutterBottom>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ export const DisplayInfo = memo(
return (
<div className="display-company-info">
<Box>
<Typography variant="h3">Mailing Address</Typography>
{companyInfo?.alternateName && (
<>
<Typography variant="h3">Doing Business As (DBA)</Typography>
<Typography>{companyInfo?.alternateName}</Typography>
</>
)}
<Typography variant="h3">Company Mailing Address</Typography>
<Typography>{companyInfo?.mailingAddress.addressLine1}</Typography>
<Typography>
{formatCountry(companyInfo?.mailingAddress.countryCode)}
Expand Down

0 comments on commit a88552f

Please sign in to comment.