Calculation/Form: disable elements when LoadKP

This commit is contained in:
vchikalkin 2023-05-31 10:26:50 +03:00
parent 4f509aefdf
commit 05ed1b6aef
4 changed files with 13 additions and 2 deletions

View File

@ -29,17 +29,20 @@ const Validation = observer(() => {
});
const FinGAP = observer(() => {
const { $tables } = useStore();
const { $tables, $process } = useStore();
const { fingap } = $tables;
const dataSource = toJS(fingap.risks);
const selectedRowKeys = [...toJS(fingap.selectedKeys)];
const disabled = $process.has('LoadKP');
return (
<Table
columns={columns}
dataSource={dataSource}
rowSelection={{
getCheckboxProps: () => ({ disabled }),
onChange: (_, selectedRows) => {
const selectedKeys = selectedRows.reduce((acc, row) => {
acc.push(row.key);

View File

@ -22,10 +22,14 @@ export default class StatusStore {
public getStatus(elementName: ElementsActions | ElementsValues) {
const status = this.overrided[elementName] || this.statuses[elementName];
if (this.root.$process.has('Unlimited') && status === 'Disabled') {
if (this.root.$process.has('Unlimited')) {
return 'Default';
}
if (this.root.$process.has('LoadKP')) {
return 'Disabled';
}
return status;
}

View File

@ -105,6 +105,8 @@ export default class InsuranceTable {
getStatus: (valueName: Insurance.Values) => {
if (this.root.$process.has('Unlimited')) return 'Default';
if (this.root.$process.has('LoadKP')) return 'Disabled';
return this.statuses[key][valueName];
},

View File

@ -74,6 +74,8 @@ export default class PaymentsTable {
public getStatus(index: number) {
if (this.root.$process.has('Unlimited')) return 'Default';
if (this.root.$process.has('LoadKP')) return 'Disabled';
return this.overridedStatus.get() ?? this.statuses[index];
}