process/configurator: auto set value for specific fields
This commit is contained in:
parent
86c9bdb113
commit
fc3610079d
@ -1,4 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import dayjs from 'dayjs';
|
||||
@ -174,4 +175,29 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext)
|
||||
$calculation.element('tbxCreditRate').setValue(evo_rate?.evo_base_rate);
|
||||
}
|
||||
);
|
||||
|
||||
(
|
||||
[
|
||||
'selectProduct',
|
||||
'selectLeaseObjectType',
|
||||
'selectBrand',
|
||||
'selectModel',
|
||||
'selectConfiguration',
|
||||
'selectTracker',
|
||||
'selectTelematic',
|
||||
'selectTechnicalCard',
|
||||
'selectFuelCard',
|
||||
'selectRegistration',
|
||||
'selectTownRegistration',
|
||||
] as Elements[]
|
||||
).forEach((elementName) => {
|
||||
reaction(
|
||||
() => $calculation.element(elementName).getOptions(),
|
||||
(options) => {
|
||||
if (options.length === 1) {
|
||||
$calculation.element(elementName).setValue(options[0]?.value);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user