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

fix: disable income validation #646

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
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
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
Loading