From 2d0117bc4c935795528e3e5911aa2f98f5d61d91 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Wed, 31 May 2023 11:02:03 +0300 Subject: [PATCH] Calculation/Form: disable elements when Calculate || CreateKP --- .../Calculation/Form/Insurance/FinGAPTable/index.jsx | 2 +- apps/web/process/create-kp/action.ts | 6 +++++- apps/web/stores/calculation/statuses/index.ts | 6 +++++- apps/web/stores/process/index.ts | 2 +- apps/web/stores/tables/insurance/index.ts | 7 ++++++- apps/web/stores/tables/payments/index.ts | 7 ++++++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/apps/web/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx b/apps/web/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx index d7bd22b..00c3bdd 100644 --- a/apps/web/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx +++ b/apps/web/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx @@ -35,7 +35,7 @@ const FinGAP = observer(() => { const dataSource = toJS(fingap.risks); const selectedRowKeys = [...toJS(fingap.selectedKeys)]; - const disabled = $process.has('LoadKP'); + const disabled = $process.has('LoadKP') || $process.has('Calculate') || $process.has('CreateKP'); return ( ; export default function createProcessStore() { diff --git a/apps/web/stores/tables/insurance/index.ts b/apps/web/stores/tables/insurance/index.ts index 6c3d8f2..bc8011a 100644 --- a/apps/web/stores/tables/insurance/index.ts +++ b/apps/web/stores/tables/insurance/index.ts @@ -105,7 +105,12 @@ export default class InsuranceTable { getStatus: (valueName: Insurance.Values) => { if (this.root.$process.has('Unlimited')) return 'Default'; - if (this.root.$process.has('LoadKP')) return 'Disabled'; + if ( + this.root.$process.has('LoadKP') || + this.root.$process.has('Calculate') || + this.root.$process.has('CreateKP') + ) + return 'Disabled'; return this.statuses[key][valueName]; }, diff --git a/apps/web/stores/tables/payments/index.ts b/apps/web/stores/tables/payments/index.ts index 289b033..e423448 100644 --- a/apps/web/stores/tables/payments/index.ts +++ b/apps/web/stores/tables/payments/index.ts @@ -74,7 +74,12 @@ export default class PaymentsTable { public getStatus(index: number) { if (this.root.$process.has('Unlimited')) return 'Default'; - if (this.root.$process.has('LoadKP')) return 'Disabled'; + if ( + this.root.$process.has('LoadKP') || + this.root.$process.has('Calculate') || + this.root.$process.has('CreateKP') + ) + return 'Disabled'; return this.overridedStatus.get() ?? this.statuses[index]; }