diff --git a/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx b/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx
index ecac049..0e2bbe2 100644
--- a/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx
+++ b/Components/Calculation/Form/Insurance/FinGAPTable/index.jsx
@@ -5,12 +5,12 @@ import { columns } from './config';
const FinGAPTable = observer(() => {
const { $tables } = useStore();
- const { finGAP } = $tables;
+ const { fingap } = $tables;
return (
{
@@ -21,7 +21,7 @@ const FinGAPTable = observer(() => {
return acc;
}, []);
- finGAP.setSelectedKeys(selectedKeys);
+ fingap.setSelectedKeys(selectedKeys);
},
}}
pagination={false}
diff --git a/Components/Calculation/Form/Insurance/InsuranceTable/types.ts b/Components/Calculation/Form/Insurance/InsuranceTable/types.ts
index d3d56bc..163f6b4 100644
--- a/Components/Calculation/Form/Insurance/InsuranceTable/types.ts
+++ b/Components/Calculation/Form/Insurance/InsuranceTable/types.ts
@@ -1,6 +1,6 @@
import type { BaseOption, Status } from 'Elements/types';
-export type Keys = 'osago' | 'kasko' | 'finGAP';
+export type Keys = 'osago' | 'kasko' | 'fingap';
export type RowValues = {
key: Keys;
@@ -17,6 +17,4 @@ export type RowOptions = {
[ValueName in Values]?: BaseOption[];
};
-export type RowStatuses = Record & {
- key: Keys;
-};
+export type RowStatuses = Record;
diff --git a/config/tables/insurance-table.ts b/config/tables/insurance-table.ts
index 2bf71b7..3c8efd8 100644
--- a/config/tables/insurance-table.ts
+++ b/config/tables/insurance-table.ts
@@ -46,7 +46,7 @@ export const defaultOptions: Record = {
},
],
},
- finGAP: {
+ fingap: {
insured: [
{
label: 'ЛП',
@@ -88,7 +88,7 @@ export const defaultValues: Insurance.RowValues[] = [
insTerm: null,
},
{
- key: 'finGAP',
+ key: 'fingap',
policyType: 'Safe Finance',
insuranceCompany: null,
insured: 100_000_000,
@@ -97,29 +97,26 @@ export const defaultValues: Insurance.RowValues[] = [
},
];
-export const defaultStatuses: Insurance.RowStatuses[] = [
- {
- key: 'osago',
+export const defaultStatuses: Record = {
+ osago: {
insTerm: 'Disabled',
insCost: 'Default',
insuranceCompany: 'Default',
insured: 'Default',
policyType: 'Default',
},
- {
- key: 'kasko',
+ kasko: {
insTerm: 'Disabled',
insCost: 'Default',
insuranceCompany: 'Default',
insured: 'Default',
policyType: 'Default',
},
- {
- key: 'finGAP',
+ fingap: {
insCost: 'Disabled',
insuranceCompany: 'Default',
insured: 'Default',
insTerm: 'Default',
policyType: 'Default',
},
-];
+};
diff --git a/process/init/__generated__/GetInsuranceData.ts b/process/init/__generated__/GetInsuranceData.ts
index b09d3f1..4c2df00 100644
--- a/process/init/__generated__/GetInsuranceData.ts
+++ b/process/init/__generated__/GetInsuranceData.ts
@@ -19,7 +19,7 @@ export interface GetInsuranceData_kasko {
label: string | null;
}
-export interface GetInsuranceData_finGAP {
+export interface GetInsuranceData_fingap {
__typename: "account";
value: any | null;
label: string | null;
@@ -37,7 +37,7 @@ export interface GetInsuranceData {
/**
* Контрагенты. statecode по умолчанию 0
*/
- finGAP: (GetInsuranceData_finGAP | null)[] | null;
+ fingap: (GetInsuranceData_fingap | null)[] | null;
}
export interface GetInsuranceDataVariables {
diff --git a/process/init/get-data.ts b/process/init/get-data.ts
index 194a950..4ece2f7 100644
--- a/process/init/get-data.ts
+++ b/process/init/get-data.ts
@@ -51,7 +51,7 @@ const QUERY_GET_INSURANCE_DATA = gql`
label: name
}
- finGAP: accounts(
+ fingap: accounts(
evo_account_type: $evo_account_type
evo_type_ins_policy: [100000002]
statecode: 0
@@ -78,7 +78,7 @@ export async function getCRMData(apolloClient: ApolloClient, us
});
const {
- data: { kasko, osago, finGAP },
+ data: { kasko, osago, fingap },
} = await apolloClient.query({
query: QUERY_GET_INSURANCE_DATA,
});
@@ -90,8 +90,8 @@ export async function getCRMData(apolloClient: ApolloClient, us
kasko: {
insuranceCompany: normalizeOptions(kasko),
},
- finGAP: {
- insuranceCompany: normalizeOptions(finGAP),
+ fingap: {
+ insuranceCompany: normalizeOptions(fingap),
},
};
diff --git a/stores/tables/index.ts b/stores/tables/index.ts
index 576e509..34792ec 100644
--- a/stores/tables/index.ts
+++ b/stores/tables/index.ts
@@ -6,11 +6,11 @@ import PaymentsTable from './payments';
export default class TablesStore {
payments: PaymentsTable;
insurance: InsuranceTable;
- finGAP: FinGAPTable;
+ fingap: FinGAPTable;
constructor(rootStore: RootStore) {
this.payments = new PaymentsTable(rootStore);
this.insurance = new InsuranceTable(rootStore);
- this.finGAP = new FinGAPTable(rootStore);
+ this.fingap = new FinGAPTable(rootStore);
}
}
diff --git a/stores/tables/insurance/index.ts b/stores/tables/insurance/index.ts
index 59a8bfb..9193823 100644
--- a/stores/tables/insurance/index.ts
+++ b/stores/tables/insurance/index.ts
@@ -9,7 +9,7 @@ import Validation from '../validation';
export interface InsuranceTableData {
values?: Insurance.RowValues[];
options?: Record;
- statuses?: Insurance.RowStatuses[];
+ statuses?: Record;
}
export default class InsuranceTable {
@@ -17,7 +17,7 @@ export default class InsuranceTable {
validation: Validation;
values: Insurance.RowValues[] = insuranceTableConfig.defaultValues;
options: Record = insuranceTableConfig.defaultOptions;
- statuses: Insurance.RowStatuses[] = insuranceTableConfig.defaultStatuses;
+ statuses: Record = insuranceTableConfig.defaultStatuses;
constructor(rootStore: RootStore) {
this.root = rootStore;
@@ -61,17 +61,11 @@ export default class InsuranceTable {
};
getRowStatuses(key: Insurance.Keys) {
- const rowIndex = this.values.findIndex((x) => x.key === key);
-
- return this.statuses[rowIndex];
+ return this.statuses[key];
}
setRowStatuses = (key: Insurance.Keys, rowStatuses: Insurance.RowStatuses) => {
- const rowIndex = this.values.findIndex((x) => x.key === key);
-
- if (rowIndex >= 0) {
- mergeWith(this.statuses[rowIndex], rowStatuses);
- }
+ mergeWith(this.statuses[key], rowStatuses);
};
reset = () => {