fill clientRisk when loadkp
This commit is contained in:
parent
16e0016b6b
commit
cb5814decf
@ -34,6 +34,7 @@ const query = gql`
|
||||
selectClientRisk: evo_client_risks(statecode: $statecode) {
|
||||
evo_name
|
||||
evo_client_riskid
|
||||
evo_id
|
||||
}
|
||||
selectClientType: evo_client_types(statecode: $statecode) {
|
||||
evo_name
|
||||
|
||||
@ -23,6 +23,7 @@ const query = gql`
|
||||
evo_leadid
|
||||
evo_client_riskid
|
||||
parentaccountid
|
||||
evo_programsolution
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@ -217,6 +217,27 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
const rate = calculationStore.getOptions('selectRate');
|
||||
const target_rate = rate.find(x => x.evo_rateid === quote.evo_rateid);
|
||||
|
||||
let clientRisk = quote.evo_client_riskid;
|
||||
if (opportunity) {
|
||||
const {
|
||||
evo_programsolution,
|
||||
evo_client_riskid,
|
||||
} = calculationStore.options.selectOpportunity?.find(
|
||||
x => x.value === opportunity,
|
||||
);
|
||||
|
||||
if (evo_programsolution === 100000000) {
|
||||
const midClientRisk = calculationStore.options.selectClientRisk?.find(
|
||||
x => x.evo_id === 2,
|
||||
);
|
||||
if (midClientRisk) {
|
||||
clientRisk = midClientRisk.evo_client_riskid;
|
||||
}
|
||||
} else if (evo_programsolution !== 100000000 && evo_client_riskid) {
|
||||
clientRisk = evo_client_riskid;
|
||||
}
|
||||
}
|
||||
|
||||
calculationStore.setValues({
|
||||
...initialValues,
|
||||
...newValues,
|
||||
@ -228,6 +249,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
quote: quoteId,
|
||||
recalcWithRevision,
|
||||
leaseObjectCount,
|
||||
clientRisk,
|
||||
});
|
||||
|
||||
message.success({
|
||||
|
||||
@ -3,7 +3,6 @@ import { TValues } from 'core/types/Calculation/Store/values';
|
||||
|
||||
const mapKPtoValues: TValues<string> = {
|
||||
product: 'evo_baseproductid',
|
||||
clientRisk: 'evo_client_riskid',
|
||||
clientType: 'evo_client_typeid',
|
||||
leaseObjectPrice: 'evo_supplier_currency_price',
|
||||
supplierCurrency: 'evo_transactioncurrencyid',
|
||||
|
||||
@ -28,6 +28,7 @@ export default gql`
|
||||
evo_last_payment_perc
|
||||
evo_quotename
|
||||
evo_rateid
|
||||
evo_client_riskid
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user