Calculation/Form: disable elements when Calculate || CreateKP
This commit is contained in:
parent
05ed1b6aef
commit
2d0117bc4c
@ -35,7 +35,7 @@ const FinGAP = observer(() => {
|
|||||||
const dataSource = toJS(fingap.risks);
|
const dataSource = toJS(fingap.risks);
|
||||||
const selectedRowKeys = [...toJS(fingap.selectedKeys)];
|
const selectedRowKeys = [...toJS(fingap.selectedKeys)];
|
||||||
|
|
||||||
const disabled = $process.has('LoadKP');
|
const disabled = $process.has('LoadKP') || $process.has('Calculate') || $process.has('CreateKP');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table
|
<Table
|
||||||
|
|||||||
@ -8,7 +8,9 @@ const errorMessage = 'Ошибка во время создания КП!';
|
|||||||
const successMessage = 'КП создано!';
|
const successMessage = 'КП создано!';
|
||||||
|
|
||||||
export function action({ store, trpcClient, apolloClient }: ProcessContext) {
|
export function action({ store, trpcClient, apolloClient }: ProcessContext) {
|
||||||
const { $calculation, $tables, $results } = store;
|
const { $calculation, $tables, $results, $process } = store;
|
||||||
|
|
||||||
|
$process.add('CreateKP');
|
||||||
|
|
||||||
$calculation.$status.setStatus('btnCalculate', 'Loading');
|
$calculation.$status.setStatus('btnCalculate', 'Loading');
|
||||||
$calculation.$status.setStatus('btnCreateKP', 'Loading');
|
$calculation.$status.setStatus('btnCreateKP', 'Loading');
|
||||||
@ -72,5 +74,7 @@ export function action({ store, trpcClient, apolloClient }: ProcessContext) {
|
|||||||
$calculation.$status.setStatus('btnCalculate', 'Default');
|
$calculation.$status.setStatus('btnCalculate', 'Default');
|
||||||
$calculation.$status.setStatus('btnCreateKP', 'Default');
|
$calculation.$status.setStatus('btnCreateKP', 'Default');
|
||||||
$calculation.$status.setStatus('btnCreateKPMini', 'Default');
|
$calculation.$status.setStatus('btnCreateKPMini', 'Default');
|
||||||
|
|
||||||
|
$process.delete('CreateKP');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,11 @@ export default class StatusStore {
|
|||||||
return 'Default';
|
return 'Default';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.root.$process.has('LoadKP')) {
|
if (
|
||||||
|
this.root.$process.has('LoadKP') ||
|
||||||
|
this.root.$process.has('Calculate') ||
|
||||||
|
this.root.$process.has('CreateKP')
|
||||||
|
) {
|
||||||
return 'Disabled';
|
return 'Disabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import type { ObservableSet } from 'mobx';
|
import type { ObservableSet } from 'mobx';
|
||||||
import { observable } from 'mobx';
|
import { observable } from 'mobx';
|
||||||
|
|
||||||
export type Process = 'Calculate' | 'ELT' | 'LoadKP' | 'Unlimited';
|
export type Process = 'Calculate' | 'CreateKP' | 'ELT' | 'LoadKP' | 'Unlimited';
|
||||||
export type ProcessStore = ObservableSet<Process>;
|
export type ProcessStore = ObservableSet<Process>;
|
||||||
|
|
||||||
export default function createProcessStore() {
|
export default function createProcessStore() {
|
||||||
|
|||||||
@ -105,7 +105,12 @@ export default class InsuranceTable {
|
|||||||
getStatus: (valueName: Insurance.Values) => {
|
getStatus: (valueName: Insurance.Values) => {
|
||||||
if (this.root.$process.has('Unlimited')) return 'Default';
|
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];
|
return this.statuses[key][valueName];
|
||||||
},
|
},
|
||||||
|
|||||||
@ -74,7 +74,12 @@ export default class PaymentsTable {
|
|||||||
public getStatus(index: number) {
|
public getStatus(index: number) {
|
||||||
if (this.root.$process.has('Unlimited')) return 'Default';
|
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];
|
return this.overridedStatus.get() ?? this.statuses[index];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user