process/load-kp: run initElt before getQuote
This commit is contained in:
parent
903b32084a
commit
5f7586bb0d
@ -15,7 +15,7 @@ export function common({ store, trpcClient, apolloClient, user }: ProcessContext
|
||||
|
||||
reaction(
|
||||
() => $calculation.$values.getValue('quote'),
|
||||
() => {
|
||||
async () => {
|
||||
const quote = $calculation.element('selectQuote').getOption();
|
||||
|
||||
if (!quote || $process.has('LoadKP') || $process.has('Calculate') || $process.has('CreateKP'))
|
||||
@ -28,6 +28,8 @@ export function common({ store, trpcClient, apolloClient, user }: ProcessContext
|
||||
key,
|
||||
});
|
||||
|
||||
const eltInitialValues = await initElt();
|
||||
|
||||
trpcClient.getQuote
|
||||
.query({
|
||||
values: {
|
||||
@ -65,21 +67,19 @@ export function common({ store, trpcClient, apolloClient, user }: ProcessContext
|
||||
|
||||
if (fingap) $tables.fingap.setSelectedKeys(fingap.keys);
|
||||
|
||||
initElt().then((initialValues) => {
|
||||
if (initialValues) {
|
||||
$tables.elt.kasko.setRows(initialValues.kasko);
|
||||
$tables.elt.osago.setRows(initialValues.osago);
|
||||
}
|
||||
if (eltInitialValues) {
|
||||
$tables.elt.kasko.setRows(eltInitialValues.kasko);
|
||||
$tables.elt.osago.setRows(eltInitialValues.osago);
|
||||
}
|
||||
|
||||
if (elt?.kasko) {
|
||||
$tables.elt.kasko.setRow(elt.kasko);
|
||||
$tables.elt.kasko.setSelectedKey(elt.kasko.key);
|
||||
}
|
||||
if (elt?.osago) {
|
||||
$tables.elt.osago.setRow(elt.osago);
|
||||
$tables.elt.osago.setSelectedKey(elt.osago.key);
|
||||
}
|
||||
});
|
||||
if (elt?.kasko) {
|
||||
$tables.elt.kasko.setRow(elt.kasko);
|
||||
$tables.elt.kasko.setSelectedKey(elt.kasko.key);
|
||||
}
|
||||
if (elt?.osago) {
|
||||
$tables.elt.osago.setRow(elt.osago);
|
||||
$tables.elt.osago.setSelectedKey(elt.osago.key);
|
||||
}
|
||||
|
||||
message.success({
|
||||
content: `КП ${quote.label} загружено`,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user