compute lead & opportunity names
This commit is contained in:
parent
0ca4002c8c
commit
0d42d81502
@ -13,7 +13,7 @@ const resultsList: IGroup[] = [
|
||||
Component: Label,
|
||||
props: {
|
||||
name: 'lblLead',
|
||||
valueName: 'lead',
|
||||
computedValue: 'leadName',
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -21,7 +21,7 @@ const resultsList: IGroup[] = [
|
||||
Component: Label,
|
||||
props: {
|
||||
name: 'lblOpportunity',
|
||||
valueName: 'opportunity',
|
||||
computedValue: 'opportunityName',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@ -1,9 +1,27 @@
|
||||
const computedEffects = {
|
||||
total() {
|
||||
const one = parseFloat(this.values.one || 0);
|
||||
const price = parseFloat(this.values.price || 0);
|
||||
return one + price;
|
||||
}
|
||||
leadName() {
|
||||
const leadId = this.values.lead;
|
||||
if (this.options.selectLead && this.options.selectLead.length) {
|
||||
const lead = this.options.selectLead?.find(x => x.leadid === leadId);
|
||||
if (lead) {
|
||||
return lead.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
opportunityName() {
|
||||
const opportunityId = this.values.opportunity;
|
||||
if (
|
||||
this.options.selectOpportunity &&
|
||||
this.options.selectOpportunity.length > 0
|
||||
) {
|
||||
const opportunity = this.options.selectOpportunity?.find(
|
||||
x => x.opportunityid === opportunityId,
|
||||
);
|
||||
if (opportunity) {
|
||||
return opportunity.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default computedEffects;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ElementsNames } from 'core/types/elements';
|
||||
import { ValuesNames } from 'core/types/values';
|
||||
import { ComputedValuesNames, ValuesNames } from 'core/types/values';
|
||||
|
||||
interface IElement {
|
||||
isTable?: boolean;
|
||||
@ -8,6 +8,7 @@ interface IElement {
|
||||
props: {
|
||||
name: ElementsNames;
|
||||
valueName?: ValuesNames;
|
||||
computedValue?: ComputedValuesNames;
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
|
||||
@ -147,6 +147,8 @@ export type ValuesNames =
|
||||
| 'insuranceTermNS'
|
||||
| 'insuranceTermAddEquipment';
|
||||
|
||||
export type ComputedValuesNames = 'leadName' | 'opportunityName';
|
||||
|
||||
export type TValues<T> = {
|
||||
[valueName in ValuesNames]?: T;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user