This repository has been archived on 2025-05-09. You can view files and clone it, but cannot push or open issues or pull requests.
2020-11-25 14:37:47 +03:00

64 lines
1.7 KiB
JavaScript

import customValues from './lib/customValues';
const LEASE_OBJECT_RISK = {
100000000: 'Низкий',
100000001: 'Средний',
100000002: 'Высокий',
};
const computedEffects = {
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;
}
}
},
leaseObjectRiskName() {
const configurationId = this.values.configuration;
if (configurationId) {
const configuration = this.options.selectConfiguration?.find(
x => x.evo_equipmentid === configurationId,
);
if (configuration) {
if (configuration.evo_leasingobject_risk) {
const res = LEASE_OBJECT_RISK[configuration.evo_leasingobject_risk];
return res;
}
}
}
const modelId = this.values.model;
if (modelId) {
const model = this.options.selectModel?.find(
x => x.evo_modelid === modelId,
);
if (model) {
const evo_leasingobject_risk = model.evo_leasingobject_risk;
return LEASE_OBJECT_RISK[evo_leasingobject_risk];
}
}
},
insKaskoPriceLeasePeriod() {
return customValues.insKaskoPriceLeasePeriod.call(this).toFixed(2);
},
};
export default computedEffects;