remove unused quote parameter

This commit is contained in:
vchikalkin 2023-04-19 13:56:06 +03:00
parent 40932ae489
commit 6c3cc2a96b
3 changed files with 3 additions and 35 deletions

View File

@ -49,7 +49,6 @@ export async function getKPData({ values }: GetQuoteInputData): Promise<GetQuote
const { account } = await getData({
lead: leadId,
opportunity: opportunityId,
quote: null,
});
const objectRegistration = recalcWithRevision

View File

@ -1,18 +1,6 @@
import * as CRMTypes from '@/graphql/crm.types';
import type { ProcessContext } from '@/process/types';
import type { CalculationValues } from '@/stores/calculation/values/types';
import { gql } from '@apollo/client';
const QUERY_GET_QUOTE_REGION_TOWN = gql`
query GetQuoteRegionTown($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
evo_regionid
evo_townid
evo_legal_regionid
evo_legal_townid
}
}
`;
export default function helper({ apolloClient }: Pick<ProcessContext, 'apolloClient'>) {
async function getRegionByFias(evo_region_fias_id: string) {
@ -42,11 +30,9 @@ export default function helper({ apolloClient }: Pick<ProcessContext, 'apolloCli
async getData({
lead: leadid,
opportunity: opportunityid,
quote: quoteId,
}: Pick<CalculationValues, 'lead' | 'opportunity' | 'quote'>) {
}: Pick<CalculationValues, 'lead' | 'opportunity'>) {
let lead: CRMTypes.GetLeadQuery['lead'] = null;
let opportunity: CRMTypes.GetOpportunityQuery['opportunity'] = null;
let quote: CRMTypes.GetQuoteRegionTownQuery['quote'] = null;
if (leadid) {
const { data } = await apolloClient.query({
@ -65,17 +51,6 @@ export default function helper({ apolloClient }: Pick<ProcessContext, 'apolloCli
({ opportunity } = data);
}
if (quoteId) {
const { data } = await apolloClient.query<
CRMTypes.GetQuoteRegionTownQuery,
CRMTypes.GetQuoteRegionTownQueryVariables
>({
query: QUERY_GET_QUOTE_REGION_TOWN,
variables: { quoteId },
});
({ quote } = data);
}
// region
let region: Awaited<ReturnType<typeof getRegionByFias>> = null;
const evo_region_fias_id =
@ -103,12 +78,6 @@ export default function helper({ apolloClient }: Pick<ProcessContext, 'apolloCli
evo_regionid: region?.value,
evo_townid: town?.value,
},
quote: {
evo_legal_regionid: quote?.evo_legal_regionid,
evo_legal_townid: quote?.evo_legal_townid,
evo_regionid: quote?.evo_regionid,
evo_townid: quote?.evo_townid,
},
};
},
};

View File

@ -382,7 +382,7 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
reaction(
() => $calculation.$values.getValues(['lead', 'opportunity']),
async ({ lead, opportunity }) => {
const { account } = await getData({ lead, opportunity, quote: null });
const { account } = await getData({ lead, opportunity });
if (account.evo_legal_regionid) {
$calculation
@ -407,7 +407,7 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
reaction(
() => $calculation.$values.getValues(['lead', 'opportunity', 'objectRegistration']),
async ({ lead, objectRegistration, opportunity }) => {
const { account } = await getData({ lead, opportunity, quote: null });
const { account } = await getData({ lead, opportunity });
if (objectRegistration === 100_000_000 && account.evo_regionid) {
$calculation.element('selectRegionRegistration').setValue(account.evo_regionid).block();