перенесено used-pl
This commit is contained in:
parent
ad02352f46
commit
9fc4303194
@ -14,5 +14,5 @@ export const rows: FormTabRows = [
|
||||
[['tbxLeaseObjectCount', 'selectEngineType', 'tbxMaxSpeed']],
|
||||
[['tbxLeaseObjectYear', 'tbxLeaseObjectMotorPower', 'tbxCountSeats']],
|
||||
[['selectLeaseObjectCategory', 'tbxEngineVolume', 'tbxMileage']],
|
||||
[['tbxMaxMass', 'tbxEngineHours']],
|
||||
[['tbxMaxMass', 'tbxEngineHours', 'tbxVIN']],
|
||||
];
|
||||
|
||||
@ -133,6 +133,7 @@ const components = wrapComponentsMap({
|
||||
tbxMinPriceChange: e.InputNumber,
|
||||
tbxBonusCoefficient: e.InputNumber,
|
||||
selectLeasingWithoutKasko: e.Select,
|
||||
tbxVIN: e.Input,
|
||||
|
||||
/** Readonly Elements */
|
||||
labelLeaseObjectRisk: e.Text,
|
||||
|
||||
@ -127,6 +127,7 @@ const titles: Record<ActionElements | ValuesElements, string> = {
|
||||
tbxVATInLeaseObjectPrice: 'НДС в стоимости ПЛ',
|
||||
tbxBonusCoefficient: 'Коэффициент снижения бонуса',
|
||||
selectLeasingWithoutKasko: 'Лизинг без КАСКО',
|
||||
tbxVIN: 'VIN',
|
||||
|
||||
/** Link Elements */
|
||||
linkDownloadKp: '',
|
||||
|
||||
@ -164,6 +164,7 @@ const types = wrapElementsTypes({
|
||||
radioTypePTS: t.Options,
|
||||
tbxBonusCoefficient: t.Value,
|
||||
selectLeasingWithoutKasko: t.Options,
|
||||
tbxVIN: t.Value,
|
||||
|
||||
labelLeaseObjectRisk: t.Readonly,
|
||||
tbxInsKaskoPriceLeasePeriod: t.Readonly,
|
||||
|
||||
@ -130,6 +130,7 @@ const elementsToValues = wrapElementsMap({
|
||||
selectFuelCard: 'fuelCard',
|
||||
tbxMinPriceChange: 'minPriceChange',
|
||||
tbxBonusCoefficient: 'bonusCoefficient',
|
||||
tbxVIN: 'vin',
|
||||
|
||||
/** Readonly Elements */
|
||||
labelLeaseObjectRisk: 'leaseObjectRiskName',
|
||||
|
||||
@ -507,6 +507,7 @@ const defaultOptions: CalculationOptions = {
|
||||
linkQuoteUrl: [],
|
||||
tbxBonusCoefficient: [],
|
||||
selectLeasingWithoutKasko: [],
|
||||
tbxVIN: [],
|
||||
};
|
||||
|
||||
export default defaultOptions;
|
||||
|
||||
@ -134,6 +134,7 @@ const defaultStatuses: CalculationStatuses = {
|
||||
tbxSupplierDiscountRub: 'Default',
|
||||
tbxTotalPayments: 'Disabled',
|
||||
tbxVATInLeaseObjectPrice: 'Default',
|
||||
tbxVIN: 'Disabled',
|
||||
tbxVehicleTaxInLeasingPeriod: 'Disabled',
|
||||
tbxVehicleTaxInYear: 'Default',
|
||||
};
|
||||
|
||||
@ -139,6 +139,7 @@ const defaultValues: CalculationValues = {
|
||||
vehicleTaxInLeasingPeriod: 0,
|
||||
vehicleTaxInYear: 0,
|
||||
withTrailer: false,
|
||||
vin: null,
|
||||
};
|
||||
|
||||
export default defaultValues;
|
||||
|
||||
@ -126,6 +126,7 @@ const ValuesSchema = z
|
||||
vehicleTaxInLeasingPeriod: z.number(),
|
||||
vehicleTaxInYear: z.number(),
|
||||
withTrailer: z.boolean(),
|
||||
vin: z.string().nullable(),
|
||||
|
||||
/**
|
||||
* Link Values
|
||||
|
||||
@ -426,7 +426,7 @@ export type GetLeasingObjectDataFromQuoteQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetLeasingObjectDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_brandid: string | null, evo_category: number | null, evo_delivery_time: number | null, evo_engine_hours: number | null, evo_engine_type: number | null, evo_engine_volume: number | null, evo_equipmentid: string | null, evo_leasingobject_typeid: string | null, evo_leasingobject_used: boolean | null, evo_max_mass: number | null, evo_max_speed: number | null, evo_mileage: number | null, evo_modelid: string | null, evo_object_count: number | null, evo_power: number | null, evo_recalc_limit: number | null, evo_seats: number | null, evo_trailer: boolean | null, evo_use_for: number | null, evo_year: number | null } | null };
|
||||
export type GetLeasingObjectDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_brandid: string | null, evo_category: number | null, evo_delivery_time: number | null, evo_engine_hours: number | null, evo_engine_type: number | null, evo_engine_volume: number | null, evo_equipmentid: string | null, evo_leasingobject_typeid: string | null, evo_leasingobject_used: boolean | null, evo_max_mass: number | null, evo_max_speed: number | null, evo_mileage: number | null, evo_modelid: string | null, evo_object_count: number | null, evo_power: number | null, evo_recalc_limit: number | null, evo_seats: number | null, evo_trailer: boolean | null, evo_use_for: number | null, evo_vin: string | null, evo_year: number | null } | null };
|
||||
|
||||
export type GetLeasingWithoutKaskoOptionsQueryVariables = Exact<{
|
||||
currentDate: InputMaybe<Scalars['DateTime']>;
|
||||
@ -509,7 +509,7 @@ export const GetOwnerDataDocument = {"kind":"Document","definitions":[{"kind":"O
|
||||
export const GetLeadUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeadUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"lead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode<GetLeadUrlQuery, GetLeadUrlQueryVariables>;
|
||||
export const GetOpportunityUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunityUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"opportunity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"opportunityid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode<GetOpportunityUrlQuery, GetOpportunityUrlQueryVariables>;
|
||||
export const GetQuoteUrlDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteUrl"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entity"},"name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode<GetQuoteUrlQuery, GetQuoteUrlQueryVariables>;
|
||||
export const GetLeasingObjectDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingObjectDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_hours"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_speed"}},{"kind":"Field","name":{"kind":"Name","value":"evo_mileage"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_count"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_trailer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_use_for"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}}]}}]}}]} as unknown as DocumentNode<GetLeasingObjectDataFromQuoteQuery, GetLeasingObjectDataFromQuoteQueryVariables>;
|
||||
export const GetLeasingObjectDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingObjectDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_hours"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_speed"}},{"kind":"Field","name":{"kind":"Name","value":"evo_mileage"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_count"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_trailer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_use_for"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vin"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}}]}}]}}]} as unknown as DocumentNode<GetLeasingObjectDataFromQuoteQuery, GetLeasingObjectDataFromQuoteQueryVariables>;
|
||||
export const GetLeasingWithoutKaskoOptionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingWithoutKaskoOptions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000007"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_visible_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}}]} as unknown as DocumentNode<GetLeasingWithoutKaskoOptionsQuery, GetLeasingWithoutKaskoOptionsQueryVariables>;
|
||||
export const GetPaymentsDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPaymentsDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_payments_decrease_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_high_season"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdon"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sumpay_withnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_planpayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_payment_ratio"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetPaymentsDataFromQuoteQuery, GetPaymentsDataFromQuoteQueryVariables>;
|
||||
export const GetPriceDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPriceDataFromQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}}]}}]}}]} as unknown as DocumentNode<GetPriceDataFromQuoteQuery, GetPriceDataFromQuoteQueryVariables>;
|
||||
|
||||
@ -13,6 +13,7 @@ import * as subsidyReactions from '../../subsidy/reactions';
|
||||
import * as agentsReactions from '../../supplier-agent/reactions/agents';
|
||||
import leasebackReactions from '../../supplier-agent/reactions/leaseback';
|
||||
import * as supplierReactions from '../../supplier-agent/reactions/supplier';
|
||||
import * as usedPl from '../../used-pl/reactions';
|
||||
import setInitialValuesReactions from '../set-values/reactions';
|
||||
|
||||
export default function injectDefaultReactions(context) {
|
||||
@ -46,4 +47,5 @@ export default function injectDefaultReactions(context) {
|
||||
createKPReactions(context);
|
||||
bonusesReactions.common(context);
|
||||
bonusesReactions.validation(context);
|
||||
usedPl.default(context);
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ const QUERY_GET_LEASING_OBJECT_DATA_FROM_QUOTE = gql`
|
||||
evo_seats
|
||||
evo_trailer
|
||||
evo_use_for
|
||||
evo_vin
|
||||
evo_year
|
||||
}
|
||||
}
|
||||
@ -79,6 +80,7 @@ export default async function getLeasingObjectDataFromKP({
|
||||
evo_trailer,
|
||||
evo_use_for,
|
||||
evo_year,
|
||||
evo_vin,
|
||||
} = quote;
|
||||
|
||||
let leaseObjectCount = evo_object_count ?? undefined;
|
||||
@ -107,6 +109,7 @@ export default async function getLeasingObjectDataFromKP({
|
||||
maxSpeed: evo_max_speed ?? undefined,
|
||||
mileage: evo_mileage ?? undefined,
|
||||
model: evo_modelid,
|
||||
vin: evo_vin,
|
||||
withTrailer: evo_trailer ?? undefined,
|
||||
},
|
||||
};
|
||||
|
||||
318
apps/web/process/used-pl/reactions.ts
Normal file
318
apps/web/process/used-pl/reactions.ts
Normal file
@ -0,0 +1,318 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import type { ReactionsContext } from '../types';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export default function commonReactions({ store, apolloClient }: ReactionsContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
/**
|
||||
* Создаем реакцию на выбор Продукта selectProduct:
|
||||
*
|
||||
* Если в поле Продукт selectProduct значение не выбрано, то
|
||||
* поле Валюта поставщика selectSupplierCurrency закрыть для редактирования и сделать равным RUB
|
||||
* поле Скидка от поставщика tbxSupplierDiscountRub закрыть для редактирования и сделать равным 0
|
||||
* поле Скидка от поставщика, % tbxSupplierDiscountPerc закрыть для редактирования и сделать равным 0
|
||||
* поле Стоимость предмета лизинга с НДС tbxLeaseObjectPrice закрыть для редактирования
|
||||
* поле Стоимость предмета лизинга без НДС xxx закрыть для редактирования
|
||||
* поле НДС в стоимости предмета лизинга xxx закрыть для редактирования
|
||||
*
|
||||
* Если в поле Продукт selectProduct выбрана запись, у которой БУбезНДС evo_sale_without_nds = True, то:
|
||||
* поле ПЛ БУ cbxLeaseObjectUsed =True и закрыто для редактирования
|
||||
* поле Валюта поставщика selectSupplierCurrency закрыть для редактирования и сделать равным RUB
|
||||
* поле Скидка от поставщика tbxSupplierDiscountRub закрыть для редактирования и сделать равным 0
|
||||
* поле Скидка от поставщика, % tbxSupplierDiscountPerc закрыть для редактирования и сделать равным 0
|
||||
* поле Стоимость предмета лизинга с НДС tbxLeaseObjectPrice закрыть для редактирования
|
||||
* поле Стоимость предмета лизинга без НДС xxx открыть для редактирования
|
||||
* поле НДС в стоимости предмета лизинга xxx открыть для редактирования
|
||||
*
|
||||
* Если в поле Продукт selectProduct выбрана запись, у которой БУбезНДС evo_sale_without_nds != True, то:
|
||||
* поле ПЛ БУ cbxLeaseObjectUsed открыто для редактирования (проверить на другие реакции открывающие/закрывающие это поле)
|
||||
* поле Валюта поставщика selectSupplierCurrency открыто для редактирования
|
||||
* поле Скидка от поставщика tbxSupplierDiscountRub открыто для редактирования
|
||||
* поле Скидка от поставщика, % tbxSupplierDiscountPerc открыто для редактирования
|
||||
* поле Стоимость предмета лизинга с НДС tbxLeaseObjectPrice открыто для редактирования
|
||||
* поле Стоимость предмета лизинга без НДС xxx закрыть для редактирования
|
||||
* поле НДС в стоимости предмета лизинга xxx закрыть для редактирования
|
||||
*/
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['product', 'recalcWithRevision']),
|
||||
async ({ product: productId }) => {
|
||||
if (!productId) {
|
||||
$calculation.element('tbxSupplierDiscountRub').block().resetValue();
|
||||
$calculation.element('tbxSupplierDiscountPerc').block().resetValue();
|
||||
$calculation.element('tbxLeaseObjectPrice').block().resetValue();
|
||||
$calculation.element('tbxVATInLeaseObjectPrice').block().resetValue();
|
||||
$calculation.element('selectImportProgram').unblock().resetValue();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_baseproduct },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetProductDocument,
|
||||
variables: {
|
||||
productId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_baseproduct?.evo_sale_without_nds) {
|
||||
$calculation.element('tbxSupplierDiscountRub').block().resetValue();
|
||||
$calculation.element('tbxSupplierDiscountPerc').block().resetValue();
|
||||
$calculation.element('tbxLeaseObjectPrice').unblock();
|
||||
$calculation.element('tbxVATInLeaseObjectPrice').unblock();
|
||||
$calculation.element('selectImportProgram').block().resetValue();
|
||||
$calculation.element('cbxLeaseObjectUsed').setValue(true);
|
||||
} else {
|
||||
$calculation.element('tbxSupplierDiscountRub').unblock();
|
||||
$calculation.element('tbxSupplierDiscountPerc').unblock();
|
||||
$calculation.element('tbxLeaseObjectPrice').unblock();
|
||||
$calculation.element('tbxVATInLeaseObjectPrice').block();
|
||||
$calculation.element('selectImportProgram').unblock();
|
||||
}
|
||||
},
|
||||
{
|
||||
fireImmediately: true,
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Добавить реакцию на изменение поля Пересчет без пересмотра cbxRecalcWithRevision и загрузку КП:
|
||||
* ЕСЛИ в поле Продукт selectProduct выбрана запись и поле БУбезНДС evo_sale_without_nds = True
|
||||
* и Пересчет без пересмотра cbxRecalcWithRevision = True,
|
||||
*
|
||||
* то поля "Первый платеж, руб." tbxFirstPaymentRub
|
||||
* и "Первый платеж %" tbxFirstPaymentPerc закрыты для редактирования,
|
||||
* иначе открыты для редактирования
|
||||
*/
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['recalcWithRevision', 'quote']),
|
||||
async ({ recalcWithRevision }) => {
|
||||
const productId = $calculation.element('selectProduct').getValue();
|
||||
|
||||
if (!productId) {
|
||||
$calculation.element('tbxFirstPaymentPerc').unblock();
|
||||
$calculation.element('tbxFirstPaymentRub').unblock();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_baseproduct },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetProductDocument,
|
||||
variables: {
|
||||
productId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_baseproduct?.evo_sale_without_nds && recalcWithRevision) {
|
||||
$calculation.element('tbxFirstPaymentPerc').block();
|
||||
$calculation.element('tbxFirstPaymentRub').block();
|
||||
} else {
|
||||
$calculation.element('tbxFirstPaymentPerc').unblock();
|
||||
$calculation.element('tbxFirstPaymentRub').unblock();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Реакция на изменение ПЛ БУ cbxLeaseObjectUsed и Тип ПЛ selectLeaseObjectType
|
||||
* Если ПЛ БУ cbxLeaseObjectUsed = True и Тип ПЛ selectLeaseObjectType = Спецтехника (id=9) ,
|
||||
* то поле Моточасы tbxEngineHours открыто для редактирования, иначе закрыто и равно 0.
|
||||
*/
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['leaseObjectUsed', 'leaseObjectType']),
|
||||
async ({ leaseObjectUsed, leaseObjectType: leaseObjectTypeId }) => {
|
||||
if (!leaseObjectTypeId) {
|
||||
$calculation.element('tbxEngineHours').resetValue().unblock();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_leasingobject_type },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetLeaseObjectTypeDocument,
|
||||
variables: { leaseObjectTypeId },
|
||||
});
|
||||
|
||||
if (leaseObjectUsed && evo_leasingobject_type?.evo_id === '9') {
|
||||
$calculation.element('tbxEngineHours').unblock();
|
||||
} else {
|
||||
$calculation.element('tbxEngineHours').resetValue().block();
|
||||
}
|
||||
},
|
||||
{
|
||||
fireImmediately: true,
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Добавить реакцию на изменение Типа ПЛ selectLeaseObjectType , ПЛ БУ cbxLeaseObjectUsed и Моточасы tbxEngineHours:
|
||||
* Если ПЛ БУ cbxLeaseObjectUsed = True и Тип ПЛ selectLeaseObjectType = Спецтехника (id=9) и Моточасы = 0,
|
||||
* то поле Моточасы tbxEngineHours должно обводиться красной рамкой и выводиться сообщение
|
||||
* "Укажите Моточасы, иначе красная рамка снимается.
|
||||
* При красной рамке в данном поле нельзя осуществить расчет графика.
|
||||
*/
|
||||
{
|
||||
const validationHelper = new ValidationHelper();
|
||||
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['leaseObjectUsed', 'engineHours', 'leaseObjectType']),
|
||||
async ({ leaseObjectType: leaseObjectTypeId, leaseObjectUsed, engineHours }) => {
|
||||
if (!leaseObjectTypeId) {
|
||||
validationHelper.removeErrors();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_leasingobject_type },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetLeaseObjectTypeDocument,
|
||||
variables: { leaseObjectTypeId },
|
||||
});
|
||||
|
||||
$calculation.element('tbxEngineHours').validate({
|
||||
helper: validationHelper,
|
||||
invalid: leaseObjectUsed && evo_leasingobject_type?.evo_id === '9' && !engineHours,
|
||||
message: 'Не заполнено поле',
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('cbxLeaseObjectUsed').getValue(),
|
||||
(leaseObjectUsed) => {
|
||||
if (leaseObjectUsed) {
|
||||
$calculation.element('tbxMileage').unblock();
|
||||
} else {
|
||||
$calculation.element('tbxMileage').resetValue().block();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['mileage', 'leaseObjectUsed']),
|
||||
({ mileage, leaseObjectUsed }) => {
|
||||
$calculation.element('tbxMileage').validate({
|
||||
invalid: leaseObjectUsed && !mileage,
|
||||
message: 'Не заполнено поле',
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('cbxLeaseObjectUsed').getValue(),
|
||||
(leaseObjectUsed) => {
|
||||
if (leaseObjectUsed === true) {
|
||||
$calculation.element('selectSubsidy').resetValue().block();
|
||||
} else {
|
||||
$calculation.element('selectSubsidy').unblock();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* реакция на ПЛ БУ, Субсидию и Продукт и Салон
|
||||
* если ПЛ БУ = Да или Субсидия содержит данные
|
||||
* или в Продукте БУбезНДС = Да,
|
||||
* или в selectDealer указан account, у которого evo_return_leasing_dealer === true
|
||||
* то поле Срок поставки = 100 000 000 и закрыто для редактирования, иначе открыто для редактирования
|
||||
*/
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['leaseObjectUsed', 'subsidy', 'product', 'dealer']),
|
||||
async ({ leaseObjectUsed, subsidy, product: productId, dealer: dealerId }) => {
|
||||
if (!productId || !dealerId) {
|
||||
$calculation.element('radioDeliveryTime').unblock();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_baseproduct },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetProductDocument,
|
||||
variables: { productId },
|
||||
});
|
||||
|
||||
const {
|
||||
data: { dealer },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetDealerDocument,
|
||||
variables: { dealerId },
|
||||
});
|
||||
|
||||
if (
|
||||
leaseObjectUsed ||
|
||||
subsidy ||
|
||||
evo_baseproduct?.evo_sale_without_nds ||
|
||||
dealer?.evo_return_leasing_dealer
|
||||
) {
|
||||
$calculation.element('radioDeliveryTime').setValue(100_000_000).block();
|
||||
} else {
|
||||
$calculation.element('radioDeliveryTime').unblock();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectSubsidy').getValue(),
|
||||
(subsidyId) => {
|
||||
if (subsidyId) {
|
||||
$calculation.element('tbxLeaseObjectCount').setValue(1).block();
|
||||
$calculation.element('cbxLeaseObjectUsed').setValue(false).block();
|
||||
} else {
|
||||
$calculation.element('tbxLeaseObjectCount').unblock();
|
||||
$calculation.element('cbxLeaseObjectUsed').unblock();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Если "Категория" содержит данные, то должны быть доступными для набора только арабские цифры и буквы латинского алфавита за исключением I, O, Q, так как они сходны по начертанию с цифрами 1, 0, 9. Можно использовать регулярное выражение: "^[A-HJ-NPR-Za-hj-npr-z0-9]{17}$".
|
||||
* Иначе (если Категория = пусто) то требуется аналогичная первому условию маска, но без проверки 17ти символов (допускать и больше и меньше символов, мб так: "^[A-HJ-NPR-Za-hj-npr-z0-9]{99}$".
|
||||
* Вот так: /^[A-HJ-NPR-Za-hj-npr-z0-9]+$/
|
||||
*/
|
||||
{
|
||||
const vinRegex = /^[\dA-HJ-NPR-Za-hj-npr-z]+$/u;
|
||||
const validationHelper = new ValidationHelper();
|
||||
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['vin', 'leaseObjectCategory', 'leaseObjectUsed']),
|
||||
({ vin, leaseObjectCategory }) => {
|
||||
if (!vin) {
|
||||
validationHelper.removeErrors();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let invalid = vinRegex.test(vin) === false;
|
||||
if (leaseObjectCategory && vin?.length !== 17) {
|
||||
invalid = true;
|
||||
}
|
||||
|
||||
$calculation.element('tbxVIN').validate({
|
||||
helper: validationHelper,
|
||||
invalid,
|
||||
message: 'Неверно заполнено поле',
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('cbxLeaseObjectUsed').getValue(),
|
||||
(leaseObjectUsed) => {
|
||||
if (leaseObjectUsed) {
|
||||
$calculation.element('tbxVIN').unblock();
|
||||
} else {
|
||||
$calculation.element('tbxVIN').resetValue().block();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user