From 482d6b32847b0289ab2e4f64cab2ce95b169f52e Mon Sep 17 00:00:00 2001 From: indigane Date: Thu, 25 Apr 2024 09:12:42 +0300 Subject: [PATCH] frontend: Change apartment sale validation to compare only debtFreePurchasePrice to its maximum --- .../features/apartment/ApartmentSalePage/utils.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/frontend/src/features/apartment/ApartmentSalePage/utils.ts b/frontend/src/features/apartment/ApartmentSalePage/utils.ts index 225d6098a..fc258dde7 100644 --- a/frontend/src/features/apartment/ApartmentSalePage/utils.ts +++ b/frontend/src/features/apartment/ApartmentSalePage/utils.ts @@ -126,7 +126,7 @@ export const getRefinedApartmentSaleFormSchema = (apartment, maximumPrices, warn // Normal apartment sale with confirmed maximum price calculation else { // Price can not be bigger than the maximum price calculations maximum price. - if (data.purchase_price && data.purchase_price > Math.round(maximumPrices.maximumPrice)) { + if (debtFreePurchasePrice > Math.round(maximumPrices.debtFreePurchasePrice)) { ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["maximum_price_calculation"], @@ -141,19 +141,6 @@ export const getRefinedApartmentSaleFormSchema = (apartment, maximumPrices, warn } } - // The apartment share of housing company loans must match the maximum price calculations value - if ( - isCalculationValid && - data.apartment_share_of_housing_company_loans !== null && - data.apartment_share_of_housing_company_loans !== maximumPrices.apartmentShareOfHousingCompanyLoans - ) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - path: ["apartment_share_of_housing_company_loans"], - message: errorMessages.loanShareChanged, - }); - } - // Warn that the price is over a million, as it is a rare case and might be a mistake. if (!warningsGiven.purchase_price_over_million) { if (data.purchase_price && data.purchase_price > 999999) {