обновление cbxSupplierFinancing

This commit is contained in:
vchikalkin 2023-04-17 11:51:00 +03:00
parent 87e4783dd5
commit e0be27a5b9
3 changed files with 7 additions and 21 deletions

View File

@ -7,7 +7,7 @@ export const rows: FormTabRows = [
[['selectProduct'], { gridTemplateColumns: '1fr' }],
[['tbxLeaseObjectPrice', 'tbxVATInLeaseObjectPrice', 'tbxLeaseObjectPriceWthtVAT']],
[['selectSupplierCurrency', 'tbxSupplierDiscountRub', 'tbxSupplierDiscountPerc']],
[['tbxFirstPaymentPerc', 'tbxFirstPaymentRub', 'cbxSupplierFinancing']],
[['tbxFirstPaymentPerc', 'tbxFirstPaymentRub']],
[['tbxLeasingPeriod', 'tbxSaleBonus']],
[['selectSubsidy', 'tbxSubsidySum'], { gridTemplateColumns: '2fr 1fr' }],
[['selectImportProgram', 'tbxImportProgramSum', 'tbxAddEquipmentPrice']],

View File

@ -9,4 +9,5 @@ export const rows: FormTabRows = [
[['tbxMinPriceChange', 'tbxMaxPriceChange']],
[['tbxImporterRewardPerc', 'tbxImporterRewardRub']],
[['tbxBonusCoefficient', 'tbxComissionRub', 'tbxComissionPerc']],
[['cbxSupplierFinancing']],
];

View File

@ -158,10 +158,9 @@ export function common({ store, apolloClient }: ProcessContext) {
);
reaction(
() => $calculation.$values.getValues(['product', 'dealerPerson']),
async ({ product: productId, dealerPerson: dealerPersonId }) => {
() => $calculation.$values.getValues(['product']),
async ({ product: productId }) => {
let evo_baseproduct: CRMTypes.GetProductQuery['evo_baseproduct'] = null;
let dealerPerson: CRMTypes.GetDealerPersonQuery['account'] = null;
if (productId) {
const { data } = await apolloClient.query({
@ -172,23 +171,9 @@ export function common({ store, apolloClient }: ProcessContext) {
({ evo_baseproduct } = data);
}
if (dealerPersonId) {
const { data } = await apolloClient.query({
query: CRMTypes.GetDealerPersonDocument,
variables: { dealerPersonId },
});
({ account: dealerPerson } = data);
}
if (
evo_baseproduct?.evo_supplier_financing_accept &&
dealerPerson?.evo_supplier_financing_accept
) {
$calculation.element('cbxSupplierFinancing').unblock();
} else {
$calculation.element('cbxSupplierFinancing').setValue(false).block();
}
$calculation
.element('cbxSupplierFinancing')
.setValue(Boolean(evo_baseproduct?.evo_supplier_financing_accept));
}
);
}