From 3ac5757e76c3377200323acc02a4b30689a56178 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Mon, 21 Jun 2021 11:01:20 +0300 Subject: [PATCH] min insurance value --- .../Calculation/ELT/Content/Kasko/lib/onSelectRow.ts | 7 +++++++ .../Calculation/ELT/Content/Osago/lib/onSelectRow.ts | 11 ++++++++++- src/core/constants/stores/Calculation/limits.js | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/lib/onSelectRow.ts b/src/client/Components/Calculation/ELT/Content/Kasko/lib/onSelectRow.ts index d1a8b1a..dd32e8e 100644 --- a/src/client/Components/Calculation/ELT/Content/Kasko/lib/onSelectRow.ts +++ b/src/client/Components/Calculation/ELT/Content/Kasko/lib/onSelectRow.ts @@ -1,6 +1,7 @@ import { MAX_FRANCHISE, MAX_INSURANCE, + MIN_INSURANCE, } from 'core/constants/stores/Calculation/limits'; import { ICalculationStore } from 'core/types/Calculation/Store'; @@ -24,6 +25,12 @@ export default function ( }; } + if (kaskoSum < MIN_INSURANCE) { + return { + message: `Сумма по страховке не должна быть меньше ${MIN_INSURANCE}`, + }; + } + this.setValue('insFranchise', totalFranchise); this.setTableRows( diff --git a/src/client/Components/Calculation/ELT/Content/Osago/lib/onSelectRow.ts b/src/client/Components/Calculation/ELT/Content/Osago/lib/onSelectRow.ts index 0f25b6c..544bb1c 100644 --- a/src/client/Components/Calculation/ELT/Content/Osago/lib/onSelectRow.ts +++ b/src/client/Components/Calculation/ELT/Content/Osago/lib/onSelectRow.ts @@ -1,4 +1,7 @@ -import { MAX_INSURANCE } from 'core/constants/stores/Calculation/limits'; +import { + MAX_INSURANCE, + MIN_INSURANCE, +} from 'core/constants/stores/Calculation/limits'; import { ICalculationStore } from 'core/types/Calculation/Store'; export default function ( @@ -16,6 +19,12 @@ export default function ( }; } + if (premiumSum < MIN_INSURANCE) { + return { + message: `Сумма по страховке не должна быть меньше ${MIN_INSURANCE}`, + }; + } + this.setTableRow( 'tableInsurance', 0, diff --git a/src/core/constants/stores/Calculation/limits.js b/src/core/constants/stores/Calculation/limits.js index a8f072f..0c65e8f 100644 --- a/src/core/constants/stores/Calculation/limits.js +++ b/src/core/constants/stores/Calculation/limits.js @@ -1,2 +1,3 @@ export const MAX_FRANCHISE = 75000; export const MAX_INSURANCE = 2500000; +export const MIN_INSURANCE = 3000;