region, town registraion fill from kp
This commit is contained in:
parent
a089eae12b
commit
d6e3739e76
@ -55,6 +55,7 @@ const query = gql`
|
||||
selectRegionRegistration: evo_regions(statecode: $statecode) {
|
||||
evo_name
|
||||
evo_regionid
|
||||
evo_fias_id
|
||||
}
|
||||
selectAccount: accounts(
|
||||
evo_account_type: $account_account_type
|
||||
|
||||
@ -12,6 +12,12 @@ const query = gql`
|
||||
evo_double_agent_accountid
|
||||
evo_broker_accountid
|
||||
evo_fin_department_accountid
|
||||
accountidData {
|
||||
evo_address_legalidData {
|
||||
evo_region_fias_id
|
||||
evo_city_fias_id
|
||||
}
|
||||
}
|
||||
}
|
||||
selectOpportunity: opportunities(
|
||||
statecode: $statecode
|
||||
@ -24,6 +30,12 @@ const query = gql`
|
||||
evo_client_riskid
|
||||
parentaccountid
|
||||
evo_programsolution
|
||||
accountidData {
|
||||
evo_address_legalidData {
|
||||
evo_region_fias_id
|
||||
evo_city_fias_id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@ -79,6 +79,44 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
})),
|
||||
);
|
||||
|
||||
let regionRegistration = quote.evo_regionid,
|
||||
townRegistration = quote.evo_townid;
|
||||
|
||||
let accountidData;
|
||||
if (lead) {
|
||||
const selected_lead = calculationStore.options.selectLead?.find(
|
||||
x => x.value === lead,
|
||||
);
|
||||
if (selected_lead && selected_lead.accountidData) {
|
||||
accountidData = selected_lead.accountidData;
|
||||
}
|
||||
}
|
||||
|
||||
if (opportunity) {
|
||||
const selected_opportunity = calculationStore.options.selectOpportunity?.find(
|
||||
x => x.value === opportunity,
|
||||
);
|
||||
if (selected_opportunity && selected_opportunity.accountidData) {
|
||||
accountidData = selected_opportunity.accountidData;
|
||||
}
|
||||
}
|
||||
|
||||
let evo_region_fias_id, evo_city_fias_id;
|
||||
if (accountidData) {
|
||||
const { evo_address_legalidData } = accountidData;
|
||||
evo_region_fias_id = evo_address_legalidData.evo_region_fias_id;
|
||||
evo_city_fias_id = evo_address_legalidData.evo_city_fias_id;
|
||||
}
|
||||
|
||||
if (evo_region_fias_id) {
|
||||
const region = calculationStore.options.selectRegionRegistration?.find(
|
||||
x => x.evo_fias_id === evo_region_fias_id,
|
||||
);
|
||||
if (region) {
|
||||
regionRegistration = region.evo_regionid;
|
||||
}
|
||||
}
|
||||
|
||||
const { entities: options } = await CrmService.crmgqlquery({
|
||||
query: optionsQuery,
|
||||
variables: {
|
||||
@ -96,7 +134,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
findepartment_accountid:
|
||||
quote.evo_fin_department_accountid || NIL,
|
||||
evo_gps_brandid: quote.evo_gps_brandid || NIL,
|
||||
evo_regionid: quote.evo_regionid || NIL,
|
||||
evo_regionid: regionRegistration || NIL,
|
||||
},
|
||||
toOptions: [
|
||||
'selectModel',
|
||||
@ -156,6 +194,15 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
},
|
||||
]);
|
||||
|
||||
if (evo_city_fias_id) {
|
||||
const city = calculationStore.options.selectTownRegistration?.find(
|
||||
x => x.evo_fias_id === evo_city_fias_id,
|
||||
);
|
||||
if (city) {
|
||||
townRegistration = city.evo_townid;
|
||||
}
|
||||
}
|
||||
|
||||
const evo_planpayments = quote.evo_graphs.sort(
|
||||
(a, b) => b.createdon - a.createdon,
|
||||
)[0].evo_planpayments;
|
||||
@ -228,7 +275,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
|
||||
if (evo_programsolution === 100000000) {
|
||||
const midClientRisk = calculationStore.options.selectClientRisk?.find(
|
||||
x => x.evo_id === 2,
|
||||
x => x.evo_id === '2',
|
||||
);
|
||||
if (midClientRisk) {
|
||||
clientRisk = midClientRisk.evo_client_riskid;
|
||||
@ -250,6 +297,8 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
recalcWithRevision,
|
||||
leaseObjectCount,
|
||||
clientRisk,
|
||||
regionRegistration,
|
||||
townRegistration,
|
||||
});
|
||||
|
||||
message.success({
|
||||
|
||||
@ -61,8 +61,6 @@ const mapKPtoValues: TValues<string> = {
|
||||
finDepartmentRewardSumm: 'evo_fin_department_reward_total',
|
||||
GPSBrand: 'evo_gps_brandid',
|
||||
GPSModel: 'evo_gps_modelid',
|
||||
regionRegistration: 'evo_regionid',
|
||||
townRegistration: 'evo_townid',
|
||||
infuranceOPF: 'evo_ins_legal_form',
|
||||
insKaskoType: 'evo_insurance_type',
|
||||
insKaskoPriceLeasePeriod: 'evo_kasko_price_leasperiod',
|
||||
|
||||
@ -129,6 +129,7 @@ export default gql`
|
||||
) {
|
||||
evo_name
|
||||
evo_townid
|
||||
evo_fias_id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@ -29,6 +29,8 @@ export default gql`
|
||||
evo_quotename
|
||||
evo_rateid
|
||||
evo_client_riskid
|
||||
evo_regionid
|
||||
evo_townid
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@ -1117,6 +1117,7 @@ export default [
|
||||
) {
|
||||
evo_name
|
||||
evo_townid
|
||||
evo_fias_id
|
||||
}
|
||||
}
|
||||
`,
|
||||
|
||||
@ -15,6 +15,12 @@ export interface IAccount {
|
||||
evo_type_ins_policy?: number[];
|
||||
customerid?: string;
|
||||
evo_kpp?: string;
|
||||
evo_address_legalidData?: IEvoAddress;
|
||||
}
|
||||
|
||||
export interface IEvoAddress {
|
||||
evo_region_fias_id?: string;
|
||||
evo_city_fias_id?: string;
|
||||
}
|
||||
|
||||
export interface ILead {
|
||||
@ -76,6 +82,8 @@ export interface IQuote {
|
||||
evo_max_mass?: number;
|
||||
evo_seats?: number;
|
||||
evo_year?: number;
|
||||
evo_regionid?: string;
|
||||
evo_townid?: string;
|
||||
}
|
||||
|
||||
interface IEvoGraph {
|
||||
@ -184,12 +192,14 @@ export interface IEvoGPSModel {
|
||||
export interface IEvoRegion {
|
||||
evo_name?: string;
|
||||
evo_regionid?: string;
|
||||
evo_fias_id?: string;
|
||||
statecode?: number;
|
||||
}
|
||||
export interface IEvoTown {
|
||||
evo_name?: string;
|
||||
evo_townid?: string;
|
||||
statecode?: number;
|
||||
evo_fias_id?: string;
|
||||
}
|
||||
export interface IEvoContact {
|
||||
parentcustomerid?: string;
|
||||
|
||||
Reference in New Issue
Block a user