Skip to content

Commit

Permalink
fix: disable income validation (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludtkemorgan authored Oct 12, 2023
1 parent ae32a00 commit e2e3e7b
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions sites/public/src/pages/applications/financial/income.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { UserStatus } from "../../../lib/constants"
type IncomeError = "low" | "high" | null
type IncomePeriod = "perMonth" | "perYear"

// eslint-disable-next-line @typescript-eslint/no-unused-vars
function verifyIncome(listing: Listing, income: number, period: IncomePeriod): IncomeError {
// Look through all the units on this listing to see what the absolute max/min income requirements are.
const [annualMin, annualMax, monthlyMin] = listing.units.reduce(
Expand Down Expand Up @@ -80,19 +81,20 @@ const ApplicationIncome = () => {
const onSubmit = (data) => {
const { income, incomePeriod } = data
const incomeValue = income.replaceAll(",", "")
// Skip validation of total income if the applicant has income vouchers.
const validationError = application.incomeVouchers
? null
: verifyIncome(listing, incomeValue, incomePeriod)
setIncomeError(validationError)

if (!validationError) {
const toSave = { income: incomeValue, incomePeriod }

conductor.completeSection(currentPageSection)
conductor.currentStep.save(toSave)
conductor.routeToNextOrReturnUrl()
}
// Commenting out validation to not have income be a blocker https://github.com/bloom-housing/bloom/issues/3675
// // Skip validation of total income if the applicant has income vouchers.
// const validationError = application.incomeVouchers
// ? null
// : verifyIncome(listing, incomeValue, incomePeriod)
// setIncomeError(validationError)

// if (!validationError) {
const toSave = { income: incomeValue, incomePeriod }

conductor.completeSection(currentPageSection)
conductor.currentStep.save(toSave)
conductor.routeToNextOrReturnUrl()
// }
}
const onError = () => {
window.scrollTo(0, 0)
Expand Down Expand Up @@ -179,7 +181,8 @@ const ApplicationIncome = () => {
<Field
id="income"
name="income"
type="currency"
// TODO: Commenting out temporarily due to application issues
// type="currency"
label={t("application.financial.income.prompt")}
caps={true}
placeholder={t("application.financial.income.placeholder")}
Expand All @@ -201,7 +204,8 @@ const ApplicationIncome = () => {
error={errors.incomePeriod}
errorMessage={t("errors.selectOption")}
register={register}
validation={{ required: true }}
// TODO: Commenting out temporarily due to application issues
// validation={{ required: true, min: 0.01 }}
fields={incomePeriodValues}
dataTestId={"app-income-period"}
fieldGroupClassName="grid grid-cols-1"
Expand Down

0 comments on commit e2e3e7b

Please sign in to comment.