Закрыть на редактирование поля при Пересчете без пересмотра recalcWithRevision = True и если в Предложении selectQuote в поле "КП по итогам КК" = Да

Срок поставки* radioDeliveryTime
Цель использования*  selectLeaseObjectUseFor
Тип двигателя selectEngineType
Децентрализованное страхование cbxInsDecentral
This commit is contained in:
vchikalkin 2024-05-08 11:55:34 +03:00
parent dd154a3004
commit 47807b7bda
4 changed files with 53 additions and 3 deletions

View File

@ -110,6 +110,7 @@ query GetQuote($quoteId: Uuid!) {
evo_promotion
evo_sale_without_nds
link
evo_committee_quote
}
}

View File

@ -2523,6 +2523,7 @@ type quote {
evo_coefficien_bonus_reducttion: Decimal
evo_comission_perc: Decimal
evo_comission_rub: Decimal
evo_committee_quote: Int
evo_contact_name: String
evo_cost_increace: Boolean
evo_cost_increase_perc: Decimal

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,11 @@
import type { ProcessContext } from '../types';
import { createValidationSchema } from './validation';
import type { Elements } from '@/Components/Calculation/config/map/values';
import * as CRMTypes from '@/graphql/crm.types';
import { createValidationReaction } from '@/process/tools';
import { reaction } from 'mobx';
export function common({ store }: ProcessContext) {
export function common({ store, apolloClient }: ProcessContext) {
const { $calculation, $tables } = store;
reaction(
@ -65,6 +66,7 @@ export function common({ store }: ProcessContext) {
// 'tbxLastPaymentRub',
'cbxPartialVAT',
];
reaction(
() => $calculation.element('cbxRecalcWithRevision').getValue(),
(recalcWithRevision) => {
@ -79,7 +81,53 @@ export function common({ store }: ProcessContext) {
}
}
);
}
{
/**
* Закрыть на редактирование поля при Пересчете без пересмотра recalcWithRevision = True и если в Предложении selectQuote в поле "КП по итогам КК" = Да
* Срок поставки* radioDeliveryTime
* Цель использования* selectLeaseObjectUseFor
* Тип двигателя selectEngineType
* Децентрализованное страхование cbxInsDecentral
*/
const elements: Elements[] = [
'radioDeliveryTime',
'selectLeaseObjectUseFor',
'selectEngineType',
'cbxInsDecentral',
];
reaction(
() => $calculation.$values.getValues(['recalcWithRevision', 'quote']),
async ({ recalcWithRevision, quote: quoteId }) => {
if (!recalcWithRevision || !quoteId) {
elements.forEach((elementName) => $calculation.$status.clearOverridedStatus(elementName));
return;
}
const {
data: { quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteDocument,
variables: {
quoteId,
},
});
if (quote?.evo_committee_quote) {
elements.forEach((elementName) =>
$calculation.$status.overrideStatus(elementName, 'Disabled')
);
} else {
elements.forEach((elementName) => $calculation.$status.clearOverridedStatus(elementName));
}
}
);
}
{
const agents: Elements[] = [
'selectCalcBrokerRewardCondition',
'selectCalcDoubleAgentRewardCondition',