load-kp: fix load actual elt rows

This commit is contained in:
vchikalkin 2024-08-14 14:25:15 +03:00
parent 681fe6139a
commit 3446ac8502

View File

@ -15,7 +15,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
reaction(
() => $calculation.$values.getValue('quote'),
async () => {
() => {
const quote = $calculation.element('selectQuote').getOption();
if (!quote || $process.has('LoadKP') || $process.has('Calculate') || $process.has('CreateKP'))
@ -29,8 +29,6 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
onClick: () => message.destroy(key),
});
const eltInitialValues = await initElt();
trpcClient.getQuote
.query({
values: {
@ -38,7 +36,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
...$calculation.$values.getValues(['lead', 'opportunity', 'recalcWithRevision']),
},
})
.then(({ values, payments, insurance, fingap, elt, options }) => {
.then(async ({ values, payments, insurance, fingap, elt, options }) => {
if (options?.selectTarif) {
$calculation.element('selectTarif').setOptions(normalizeOptions(options.selectTarif));
} else {
@ -76,6 +74,7 @@ export function common({ store, trpcClient, apolloClient }: ProcessContext) {
$tables.fingap.setRisks(fingap.risks);
$tables.fingap.setSelectedKeys(fingap.keys);
}
const eltInitialValues = await initElt();
if (eltInitialValues) {
$tables.elt.kasko.setRows(eltInitialValues.kasko);