1import{n as v}from"./app-PlFopkv0.js";const y={data(){return{timeline:{timeline_reload_key:0,timeline_default_filters:{},triggerReload:()=>{this.timeline.timeline_reload_key++},viewSalesStageTimelines:()=>{this.tabs.active="Timeline",this.$set(this.timeline.timeline_default_filters,"search_input","stage"),this.timeline.triggerReload()}},wizard:{contactPreviewActive:!1,contactHeaderPreviewActive:!1,quick_create_enabled:!1,step:{current:"deal",all:()=>{let e={deal:{label:"Deal",icon:"deal",icon_type:"outline"},revenue_forecast:{label:"Revenue Forecast",icon:"trending-up",icon_type:"outline"},services:{label:"Services",icon:"service",icon_type:"outline"},registration:{label:"Registration",icon:"registration",icon_type:"solid"},quote_details:{label:"Quote Details",icon:"quote",icon_type:"outline"},tsb:{label:"Technology Advisory Services",icon:"contract",icon_type:"outline"}};return this.accessDealRevenueForecasting||delete e.revenue_forecast,e},getStepIndex:e=>_.findIndex(_.keys(this.wizard.step.all()),t=>t==e),currentStepIndex:()=>this.wizard.step.getStepIndex(this.wizard.step.current),setStep:e=>{this.wizard.step.current=e},isLastStep:e=>_.size(this.wizard.step.all())-1==this.wizard.step.getStepIndex(e),isFirstStep:e=>this.wizard.step.getStepIndex(e)==0,getNextStep:()=>{let e=this.wizard.step.currentStepIndex();return e!==_.size(this.wizard.step.all())-1?_.keys(this.wizard.step.all())[e+1]:null},getPreviousStep:()=>{let e=this.wizard.step.currentStepIndex();return e!==0?_.keys(this.wizard.step.all())[e-1]:null}},modal:{show:!1,loading:!1,open:()=>{this.wizard.modal.show=!0,axios.all([this.deal.get()]).then(()=>{this.wizard.form.resetErrors(),this.$set(this.wizard.form.surveys.deal.options.business_groups,"values",this.options.business_groups),this.$set(this.wizard.form.surveys.deal.options.revenue_centers,"values",this.options.revenue_centers),this.$set(this.wizard.form.surveys.deal.options.sales_stages,"values",this.options.sales_stages),this.$set(this.wizard.form.surveys.deal.options.statuses,"values",this.options.statuses),this.$set(this.wizard.form.surveys.deal.options.contacts,"values",this.options.contacts),this.$set(this.wizard.form.surveys.deal.options.contacts,"autocomplete_filtered",this.options.contacts),this.wizard.modal.load()})},openToStep:e=>{this.wizard.step.setStep(e),this.wizard.modal.open()},close:()=>{this.timeline.triggerReload(),this.wizard.modal.show=!1},load:()=>{this.wizard.modal.loading=!0,axios.all([this.wizard.form.load()]).then(()=>{this.wizard.modal.loading=!1})}},form:{saving:!1,load:()=>axios.all(_.map(this.wizard.form.surveys,e=>e.load())),resetErrors:()=>{_.forEach(this.wizard.form.surveys,e=>e.error.reset())},isValid:()=>_.filter(this.wizard.form.surveys,e=>!e.isValid()).length===0,validate:()=>{_.forEach(this.wizard.form.surveys,e=>e.validate())},store:()=>{this.wizard.form.saving=!0,axios.all(_.map(this.wizard.form.surveys,e=>e.save())).then(()=>{axios.all([this.deal.get()]).then(()=>{this.tabs.team.deal.get(),this.wizard.form.saving=!1,this.wizard.modal.close()})})},save:()=>{this.wizard.form.validate(),this.wizard.form.isValid()&&(this.wizard.form.surveys.deal.data.has_presales_reason!=="Yes"&&this.hasPresalesTeamMembers?this.$buefy.dialog.confirm({title:"Remove Presales Engineers",message:"You have selected that there should not be presales engineers on this deal. All engineers presently marked as presales will have that designation removed. Are you sure you want to continue?",cancelText:"Cancel",confirmText:"Yes",type:"is-danger",onConfirm:()=>{this.tabs.team.deal.presales_engineers.removeAll(),this.wizard.form.store()}}):this.wizard.form.store())},surveys:{deal:{error:{reset:()=>{this.$set(this.wizard.form.surveys.deal.error,"deal_name",!1),this.$set(this.wizard.form.surveys.deal.error,"company",!1),this.$set(this.wizard.form.surveys.deal.error,"sales_stage",!1),this.$set(this.wizard.form.surveys.deal.error,"status",!1),this.$set(this.wizard.form.surveys.deal.error,"revenue_center",!1),this.$set(this.wizard.form.surveys.deal.error,"domain",!1),this.$set(this.wizard.form.surveys.deal.error,"expected_close_date",!1),this.$set(this.wizard.form.surveys.deal.error,"account_executive",!1),this.$set(this.wizard.form.surveys.deal.error,"renew
1al_deals",!1),this.$set(this.wizard.form.surveys.deal.error,"contact",!1),this.$set(this.wizard.form.surveys.deal.error,"contact",!1),this.$set(this.wizard.form.surveys.deal.error,"has_presales_reason",!1),this.$set(this.wizard.form.surveys.deal.error,"has_presales_reason_detail",!1)}},data:{default:()=>{this.$set(this.wizard.form.surveys.deal.data,"deal_name",null),this.$set(this.wizard.form.surveys.deal.data,"company",null),this.$set(this.wizard.form.surveys.deal.data,"sales_stage",null),this.$set(this.wizard.form.surveys.deal.data,"status",null),this.$set(this.wizard.form.surveys.deal.data,"revenue_center",null),this.$set(this.wizard.form.surveys.deal.data,"domain",null),this.$set(this.wizard.form.surveys.deal.data,"expected_close_date",null),this.$set(this.wizard.form.surveys.deal.data,"account_executive",null),this.$set(this.wizard.form.surveys.deal.data,"account_manager",null),this.$set(this.wizard.form.surveys.deal.data,"contact",null),this.$set(this.wizard.form.surveys.deal.data,"tags",null),this.$set(this.wizard.form.surveys.deal.data,"is_renewal",null),this.$set(this.wizard.form.surveys.deal.data,"renewal_deals",null),this.$set(this.wizard.form.surveys.deal.data,"has_presales_reason",null),this.$set(this.wizard.form.surveys.deal.data,"has_presales_reason_detail",null),this.$set(this.wizard.form.surveys.deal.data,"forecasted_services_revenue",null),this.$set(this.wizard.form.surveys.deal.data,"forecasted_services_start_at",null),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_cost",null),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_revenue",null),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_margin",null),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_percentage",null),this.$set(this.wizard.form.surveys.deal.data,"Probability_to_Close",0)}},save:()=>axios.put("/api/Explorers/Deals/"+this.opportunity_recid+"/Deal",this.wizard.form.surveys.deal.data).then(e=>{}).catch(e=>{}).finally(e=>{}),isValid:()=>_.filter(_.omitBy(this.wizard.form.surveys.deal.error,_.isFunction),e=>!!e).length===0,validate:()=>{!this.wizard.form.surveys.deal.data.company||!this.wizard.form.surveys.deal.data.company.Company_Status_Desc.includes("Active")?(this.wizard.form.surveys.deal.error.company=!1,this.wizard.form.surveys.deal.error.account_executive=!1,this.wizard.form.surveys.deal.error.contact=!1):this.deal.data.pipeline.Description=="Won"?(this.wizard.form.surveys.deal.error.company=!1,this.wizard.form.surveys.deal.error.account_executive=!1,this.wizard.form.surveys.deal.error.contact=!1):(this.wizard.form.surveys.deal.error.company=_.isEmpty(this.wizard.form.surveys.deal.data.company),this.wizard.form.surveys.deal.error.account_executive=_.isNil(this.wizard.form.surveys.deal.data.account_executive),this.wizard.form.surveys.deal.error.contact=_.isNil(this.wizard.form.surveys.deal.data.contact)),this.deal.data.pipeline.Description=="Won"?(this.wizard.form.surveys.deal.error.deal_name=!1,this.wizard.form.surveys.deal.error.expected_close_date=!1):(this.wizard.form.surveys.deal.error.deal_name=this.$emptyString(this.wizard.form.surveys.deal.data.deal_name),this.wizard.form.surveys.deal.error.expected_close_date=_.isNil(this.wizard.form.surveys.deal.data.expected_close_date)),this.wizard.form.surveys.deal.error.renewal_deals=this.wizard.form.surveys.deal.data.is_renewal=="Yes"&&_.isEmpty(this.wizard.form.surveys.deal.data.renewal_deals),this.wizard.form.surveys.deal.error.sales_stage=_.isNil(this.wizard.form.surveys.deal.data.sales_stage),this.wizard.form.surveys.deal.error.status=_.isNil(this.wizard.form.surveys.deal.data.status),this.wizard.form.surveys.deal.error.revenue_center=_.isNil(this.wizard.form.surveys.deal.data.revenue_center),this.wizard.form.surveys.deal.error.domain=_.isNil(this.wizard.form.surveys.deal.data.domain)},load:()=>(this.wizard.form.surveys.deal.data.default(),this.wizard.form.surveys.deal.error.reset(),this.wizard.form.surveys.deal.data.tags=this.deal.data.tags,this.wizard.form.surveys.deal.options.tags.typing(),Promise.all([this.wizard.form.surveys.deal.options.company.get(this.deal.data.company.Company_Name,!0)]).then(()=>{var e,t;return Promise.all([this.wizard.form.surveys.deal.options.account_executive.get((e=this.wizard.form.surveys.deal.data.company)==null?void 0:e.Company_RecID,!0),this.wizard.form.surveys.deal.options.account_manager.get((t=this.wizard.form.surveys.deal.data.company)==null?void 0:t.Company_RecID,!0)]).then(s=>{var a,r,i,o,l,d,m,u,h,p,f,g;this.wizard.form.surveys.deal.data.deal_name=this.deal.data.Opportunity_Name,this.wizard.form.surveys.deal.data.Probability_to_Close=this.deal.data.Probability_to_Close,this.wizard.form.surveys.deal.data.status=_.find(this.options.statuses,n=>n.SO_Opp_Status_RecID==this.deal.data.SO_Opp_Status_RecID),this.wizard.form.surveys.deal.data.sales_stage=_.find(this.options.sales_stages,n=>n.SO_Pipeline_RecID==this.deal.data.SO_Pipeline_RecID),this.deal.data.org_structure_assignments.length&&(this.wizard.form.surveys.deal.data.revenue_center=_.find(this.options.revenue_centers,n=>{var c;return n.id==((c=this.deal.data.org_structure_assignments[0].org_structure)==null?void 0:c.id)}),this.wizard.form.surveys.deal.data.domain=_.find(this.wizard.form.surveys.deal.options.domain.get(),n=>{var c;return n.id==((c=this.deal.data.org_structure_assignments[0].domain)==null?void 0:c.id)})),this.wizard.form.surveys.deal.data.contact=_.find(this.options.contacts,n=>n.Contact_RecID==this.deal.data.Contact_RecID),(a=this.$refs)!=null&&a.dealContactRef&&((r=this.$refs)==null||r.dealContactRef.setSelected(this.wizard.form.surveys.deal.data.contact)),this.wizard.form.surveys.deal.data.expected_close_date=Moment(this.deal.data.Date_Close_Expected).toDate(),this.wizard.form.surveys.deal.data.has_presales_reason=((i=this.deal.data.deal_details)==null?void 0:i.has_presales_reason)||"Yes",this.wizard.form.surveys.deal.data.has_presales_reason_detail=(o=this.deal.data.deal_details)==null?void 0:o.has_presales_reason_detail,this.wizard.form.surveys.deal.data.is_renewal=(l=this.deal.data.deal_details)!=null&&l.is_renewal?"Yes":"No",this.wizard.form.surveys.deal.data.is_renewal=="Yes"&&(console.log("this.wizard.form.surveys.deal.data.renewals_from",this.deal.data.renewals_from),this.wizard.form.surveys.deal.data.renewal_deals=this.deal.data.renewals_from),(d=this.$refs.autocompleteSurveysDealCompany)==null||d.setSelected(this.wizard.form.surveys.deal.data.company),this.$set(this.wizard.form.surveys.deal.data,"forecasted_services_revenue",(m=this.deal.data.deal_details)==null?void 0:m.forecasted_services_revenue),this.$set(this.wizard.form.surveys.deal.data,"forecasted_services_start_at",(u=this.deal.data.deal_details)!=null&&u.forecasted_services_start_at?new Date((h=this.deal.data.deal_details)==null?void 0:h.forecasted_services_start_at):null),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_cost",(p=this.deal.data.deal_details)==null?void 0:p.forecasted_products_cost),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_revenue",(f=this.deal.data.deal_details)==null?void 0:f.forecasted_products_revenue),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_margin",(g=this.deal.data.deal_details)==null?void 0:g.forecasted_products_margin),this.wizard.form.surveys.revenue_forecast.calculate("forecasted_products_cost")})})),options:{domain:{get:()=>this.wizard.form.surveys.deal.data.revenue_center?_.sortBy(this.wizard.form.surveys.deal.data.revenue_center.domains,["name"]):[]},has_presales_reason:{values:["Yes","No: Manufacturer led","No: TAS provider led","No: Other"]},Probability_to_Close:{values:["0","10","20","30","40","50","60","70","80","90","100"]},business_groups:{values:[]},revenue_centers:{values:[]},sales_stages:{values:[]},statuses:{values:[]}
1,contacts:{values:[],autocomplete_input:null,autocomplete_filtered:[],typing:e=>{this.wizard.form.surveys.deal.options.contacts.autocomplete_filtered=this.wizard.form.surveys.deal.options.contacts.values.filter(t=>(t==null?void 0:t.Contact_Name.toString().toLowerCase().indexOf(e.toLowerCase()))>=0)}},account_executive:{values:[],get:(e,t=!1)=>{if(!_.isNil(e))return axios.get("/api/Explorers/Deals/Company/"+e+"/Teams/"+this.opportunity_recid).then(s=>{if(this.wizard.form.surveys.deal.options.account_executive.values=s.data.team.account_executives,this.wizard.form.surveys.deal.options.account_executive.values.length)if(t){let a=_.find(this.wizard.form.surveys.deal.options.account_executive.values,r=>{var i;return r.Member_RecID==((i=this.deal.data.account_executive)==null?void 0:i.RecID)});this.wizard.form.surveys.deal.data.account_executive=a}else this.wizard.form.surveys.deal.data.account_executive=this.wizard.form.surveys.deal.options.account_executive.values[0]}).catch(s=>{this.wizard.form.surveys.deal.options.account_executive.values=[]}).finally(s=>{})}},tags:{values:[],typing:_.debounce((e="")=>axios.post(`/api/Explorers/Deals/Tags/${this.opportunity_recid||""}`,{input:e}).then(t=>{this.wizard.form.surveys.deal.options.tags.values=t.data.tags}).catch(t=>{this.wizard.form.surveys.deal.options.tags.values=[]}),750),remove:e=>{let t=_.findIndex(this.wizard.form.surveys.deal.data.tags,s=>s.id==e.id);this.wizard.form.surveys.deal.data.tags.splice(t,1)}},is_renewal:{values:["Yes","No"]},renewal_deals:{loading:!1,field:null,values:[],get:e=>{this.wizard.form.surveys.deal.options.renewal_deals.loading=!0;let t={page:1,per_page:30,company_recid:this.wizard.form.surveys.deal.data.company.Company_RecID,input_filter:e};return axios.post("/api/Explorers/Deals",t).then(s=>{this.wizard.form.surveys.deal.options.renewal_deals.values=s.data.deals}).catch(s=>{this.wizard.form.surveys.deal.options.renewal_deals.values=[]}).finally(s=>{this.wizard.form.surveys.deal.options.renewal_deals.loading=!1})},debounce:_.debounce((e=null)=>{this.wizard.form.surveys.deal.options.renewal_deals.get(e)},1e3),input:e=>{this.wizard.form.surveys.deal.error.renewal_deals=!1}},account_manager:{values:[],get:(e,t=!1)=>{if(!_.isNil(e))return axios.get("/api/Explorers/Deals/Company/"+e+"/Teams/"+this.opportunity_recid).then(s=>{if(this.wizard.form.surveys.deal.options.account_manager.values=s.data.team.account_managers,this.wizard.form.surveys.deal.options.account_manager.values.length)if(t){let a=_.find(this.wizard.form.surveys.deal.options.account_manager.values,r=>{var i;return r.Member_RecID==((i=this.deal.data.account_manager)==null?void 0:i.RecID)});this.wizard.form.surveys.deal.data.account_manager=a}else this.wizard.form.surveys.deal.data.account_manager=this.wizard.form.surveys.deal.options.account_manager.values[0]}).catch(s=>{this.wizard.form.surveys.deal.options.account_manager.values=[]}).finally(s=>{})},input:()=>{this.wizard.form.surveys.deal.error.account_manager=!1,this.$emptyString(this.wizard.form.surveys.deal.data.account_manager)&&(this.wizard.form.surveys.deal.data.account_manager=null)}},company:{loading:!1,values:[],get:(e,t=!1)=>{this.wizard.form.surveys.deal.options.company.loading=!0;
1let s=_.isNil(e)?"":"?name="+e;return axios.get("/api/Explorers/Deals/Companies"+s).then(a=>{if(this.wizard.form.surveys.deal.options.company.values=a.data.companies,t){let r=_.find(this.wizard.form.surveys.deal.options.company.values,i=>i.Company_RecID==this.deal.data.company.Company_RecID);r&&this.wizard.form.surveys.deal.options.company.select(r,!0)}}).catch(a=>{this.wizard.form.surveys.deal.options.company.values=[]}).finally(a=>{this.wizard.form.surveys.deal.options.company.loading=!1})},select:(e=null,t=!0)=>{var s,a;this.wizard.form.surveys.deal.data.company=e,this.wizard.form.surveys.deal.error.company=!1,t&&(this.wizard.form.surveys.deal.options.account_executive.get((s=this.wizard.form.surveys.deal.data.company)==null?void 0:s.Company_RecID,!0),this.wizard.form.surveys.deal.options.account_manager.get((a=this.wizard.form.surveys.deal.data.company)==null?void 0:a.Company_RecID,!0))},input:e=>{this.wizard.form.surveys.deal.error.company=!1}}},alert:()=>this.wizard.form.surveys.deal.isValid()?null:"Errors Found In Form",updateExpectedCloseDateOption:()=>{_.isNil(this.wizard.form.surveys.deal.data.estimated_close_date)?this.wizard.form.surveys.deal.data.expected_close_date=null:(this.wizard.form.surveys.deal.data.expected_close_date=Moment().add(parseInt(this.wizard.form.surveys.deal.data.estimated_close_date),"months").toDate(),this.wizard.form.surveys.deal.error.expected_close_date=!1)},updateHasPresalesOption:()=>{},updateRevenueCenterAndDomain:()=>{this.wizard.form.surveys.deal.error.revenue_center=!1,this.wizard.form.surveys.deal.error.domain=!1,this.wizard.form.surveys.deal.data.domain=null,this.$emptyString(this.wizard.form.surveys.deal.data.revenue_center)&&(this.wizard.form.surveys.deal.data.revenue_center=null)}},services:{error:{reset:()=>{this.$set(this.wizard.form.surveys.services.error,"engineers",null),this.$set(this.wizard.form.surveys.services.error,"project_manager",null)}},data:{default:()=>{this.$set(this.wizard.form.surveys.services.data,"hasServices",null),this.$set(this.wizard.form.surveys.services.data,"hasEngineers",null),this.$set(this.wizard.form.surveys.services.data,"hasProjectManager",null),this.$set(this.wizard.form.surveys.services.data,"requested_sow_delivery_date",null),this.$set(this.wizard.form.surveys.services.data,"engineers",[]),this.$set(this.wizard.form.surveys.services.data,"project_manager",null),this.$set(this.wizard.form.surveys.services.data,"notes",null)}},isValid:()=>_.filter(_.omitBy(this.wizard.form.surveys.services.error,_.isFunction),e=>!!e).length===0,validate:()=>{this.wizard.form.surveys.services.data.hasServices?(this.wizard.form.surveys.services.data.hasEngineers?this.wizard.form.surveys.services.error.engineers=_.isEmpty(this.wizard.form.surveys.services.data.engineers):this.wizard.form.surveys.services.error.engineers=!1,this.wizard.form.surveys.services.data.hasProjectManager?this.wizard.form.surveys.services.error.project_manager=_.isEmpty(this.wizard.form.surveys.services.data.project_manager):this.wizard.form.surveys.services.error.project_manager=!1):(this.wizard.form.surveys.services.error.engineers=!1,this.wizard.form.surveys.services.error.project_manager=!1)},save:()=>axios.put("/api/Explorers/Deals/"+this.opportunity_recid+"/Surveys/Services",this.wizard.form.surveys.services.data).then(e=>{}).catch(e=>{}).finally(e=>{}),load:()=>{var e;return this.wizard.form.surveys.services.error.reset(),(e=this.deal.data.services_survey)!=null&&e.data?Object.entries(this.deal.data.services_survey.data).forEach(([t,s])=>{t=="engineers"?this.$set(this.wizard.form.surveys.services.data,t,_.toArray(s)):t=="requested_sow_delivery_date"&&s!=null?this.$set(this.wizard.form.surveys.services.data,t,new Date(s)):this.$set(this.wizard.form.surveys.services.data,t,s)}):this.wizard.form.surveys.services.data.default(),axios.all([this.wizard.form.surveys.services.options.engineers.get(),this.wizard.form.surveys.services.options.project_manager.get()]).then(t=>{this.wizard.form.surveys.services.data.project_manager&&this.$refs.autocompleteSurveysDealProjectManager.setSelected(this.wizard.form.surveys.services.data.project_manager)}).catch(t=>{})},isDisableEngineers:()=>this.wizard.form.surveys.services.data.hasEngineers?_.isEmpty(this.wizard.form.surveys.services.options.engineers.values):!0,isDisableProjectManager:()=>this.wizard.form.surveys.services.data.hasProjectManager?_.isEmpty(this.wizard.form.surveys.services.options.project_manager.values):!0,options:{engineers:{values:[],filtered_data:[],typing:e=>{this.wizard.form.surveys.services.options.engineers.filtered_data=this.wizard.form.surveys.services.options.engineers.values.filter(t=>(t==null?void 0:t.name.toString().toLowerCase().indexOf(e.toLowerCase()))>=0)},get:()=>axios.get("/api/Explorers/Deals/Company/"+this.deal.data.Company_RecID+"/Teams/"+this.opportunity_recid).then(e=>{this.wizard.form.surveys.services.options.engineers.values=e.data.team.engineers,this.wizard.form.surveys.services.options.engineers.filtered_data=e.data.team.engineers}).catch(e=>{this.wizard.form.surveys.services.options.engineers.values=[],this.wizard.form.surveys.services.options.engineers.filtered_data=[]}).finally(e=>{})},project_manager:{input:null,values:[],filtered_data:[],typing:e=>{this.wizard.form.surveys.services.options.project_manager.filtered_data=this.wizard.form.surveys.services.options.project_manager.values.filter(t=>!e||(t==null?void 0:t.name.toString().toLowerCase().indexOf(e.toLowerCase()))>=0)},get:()=>axios.get("/api/Explorers/Deals/Company/"+this.deal.data.Company_RecID+"/Teams/"+this.opportunity_recid).then(e=>{this.wizard.form.surveys.services.options.project_manager.values=e.data.team.project_managers}).catch(e=>{this.wizard.form.surveys.services.options.project_manager.values=[]}).finally(e=>{})}},alert:()=>this.wizard.form.surveys.services.isValid()?null:"Errors Found In Form",updateEngineersOption:()=>{this.wizard.form.surveys.services.data.engineers=[],this.wizard.form.surveys.services.data.hasEngineers||(this.wizard.form.surveys.services.error.engineers=!1)},updateServiceOption:()=>{let e=this.wizard.form.surveys.services.data.hasServices;e||(this.wizard.form.surveys.services.data.default(),this.wizard.form.surveys.services.error.reset(),this.wizard.form.surveys.services.data.hasServices=e)},updateProjectManagerOption:()=>{this.wizard.form.surveys.services.data.hasProjectManager?this.wizard.form.surveys.services.options.project_manager.values.length&&(this.wizard.form.surveys.services.data.project_manager=this.wizard.form.surveys.services.options.project_manager.values[0]):(this.wizard.form.surveys.services.data.project_manager=null,this.wizard.form.surveys.services.error.project_manager=!1)},engineers:()=>{var e,t,s,a;return((a=(s=(t=(e=this.deal.data)==null?void 0:e.services_survey)==null?void 0:t.data)==null?void 0:s.engineers)==null?void 0:a.length)>0?this.deal.data.services_survey.data.engineers[0]:null},project_manager:()=>{var e,t,s;return(s=(t=(e=this.deal.data)==null?void 0:e.services_survey)==null?void 0:t.data)!=null&&s.project_manager?this.deal.data.services_survey.data.project_manager:null},notes:()=>{var e,t,s;return(s=(t=(e=this.deal.data)==null?void 0:e.services_survey)==null?void 0:t.data)!=null&&s.notes?this.deal.data.services_survey.data.notes:null}},revenue_forecast:{forecasted_products_percentage_dirty:!1,isDisabled:()=>{var e;return["Won","Quote"].includes((e=this.deal.data.pipeline)==null?void 0:e.Description)},error:{reset:()=>{}},data:{default:()=>{}},save:()=>{},isValid:()=>!0,validate:()=>{},load:()=>{},options:{},alert:()=>
1this.wizard.form.surveys.revenue_forecast.isValid()?null:"Errors Found In Form",debounceCalculate:_.debounce(e=>{this.wizard.form.surveys.revenue_forecast.calculate(e)},3e3),calculate:e=>{if(this.wizard.form.surveys.revenue_forecast.forecasted_products_percentage_dirty)this.wizard.form.surveys.revenue_forecast.forecasted_products_percentage_dirty=!1;else if(e==="forecasted_products_percentage")return;let t=null,s=null,a=null,r=null;if(this.wizard.form.surveys.deal.data.forecasted_products_cost!=null&&(s=this.$format.float(this.wizard.form.surveys.deal.data.forecasted_products_cost)),e==="forecasted_products_revenue"?t=this.$format.float(this.wizard.form.surveys.deal.data.forecasted_products_revenue):e==="forecasted_products_percentage"?(r=this.$format.float(this.wizard.form.surveys.deal.data.forecasted_products_percentage)/100,r>1&&(r=1),r==1&&(s=0),s==0&&(s=null,this.wizard.form.surveys.deal.data.forecasted_products_revenue!=null?t=this.$format.float(this.wizard.form.surveys.deal.data.forecasted_products_revenue):this.wizard.form.surveys.deal.data.forecasted_products_margin!=null&&(a=this.$format.float(this.wizard.form.surveys.deal.data.forecasted_products_margin)))):e==="forecasted_products_margin"&&(a=this.$format.float(this.wizard.form.surveys.deal.data.forecasted_products_margin)),_.filter([s,t,r,a],i=>i!=null).length<=1&&(this.wizard.form.surveys.deal.data.forecasted_products_revenue!=null&&(t=this.$format.float(this.wizard.form.surveys.deal.data.forecasted_products_revenue)),this.wizard.form.surveys.deal.data.forecasted_products_percentage!=null&&(r=this.$format.float(this.wizard.form.surveys.deal.data.forecasted_products_percentage)/100),this.wizard.form.surveys.deal.data.forecasted_products_margin!=null&&(a=this.$format.float(this.wizard.form.surveys.deal.data.forecasted_products_margin))),!_.isNil(s)&&!_.isNil(t))a=t-s,r=a/t;else if(!_.isNil(s)&&!_.isNil(a))t=a+s,r=a/t;else if(!_.isNil(t)&&!_.isNil(a))r=a/t,s=t-a;else if(!_.isNil(t)&&!_.isNil(r))a=t*r,s=t-a;else if(!_.isNil(s)&&!_.isNil(r))t=s/(1-r),a=t-s;else if(!_.isNil(r)&&!_.isNil(a))t=a/r,s=t-a;else if(!_.isNil(t))a=t,s=0,r=1;else if(!_.isNil(s))a=s*-1,t=0,r=0;else return;a<0&&r>=0&&(r*=-1),(r===1/0||r===-1/0)&&(r=0),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_revenue",this.$format.fixed(t)),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_cost",this.$format.fixed(s)),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_margin",this.$format.fixed(a)),this.$set(this.wizard.form.surveys.deal.data,"forecasted_products_percentage",this.$format.fixed(r*100,1))},formatServicesRevenue:()=>{this.wizard.form.surveys.deal.data.forecasted_services_revenue=this.$format.fixed(this.$format.float(this.wizard.form.surveys.deal.data.forecasted_services_revenue))}},registration:{add_registration_bar:{company:null,error:null,input:null},current_registration_index:null,registration_edit_form:{},options:{company:{loading:!1,values:[],debounce:_.debounce((e=null)=>{this.wizard.form.surveys.registration.options.company.get(e)},1e3),get:(e,t=!1)=>{this.wizard.form.surveys.registration.options.company.loading=!0;
1let s=_.isNil(e)?"":"?name="+e+"&suppliers=1";return axios.get("/api/Explorers/Deals/Companies"+s).then(a=>{this.wizard.form.surveys.registration.options.company.values=a.data.companies}).catch(a=>{this.wizard.form.surveys.registration.options.company.values=[]}).finally(a=>{this.wizard.form.surveys.registration.options.company.loading=!1})},select:(e=null)=>{(!this.wizard.form.surveys.registration.data.registrations||this.wizard.form.surveys.registration.data.registrations.length==0)&&(this.wizard.form.surveys.registration.add_registration_bar.company=e,this.wizard.form.surveys.registration.add_registration_bar.error=!1)}}},error:{reset:()=>{this.$set(this.wizard.form.surveys.registration.error,"not_approved_notes",!1),this.$set(this.wizard.form.surveys.registration.error,"name",!1),this.$set(this.wizard.form.surveys.registration.error,"company",!1)}},data:{default:()=>{this.$set(this.wizard.form.surveys.registration.data,"hasRegistration",null),this.$set(this.wizard.form.surveys.registration.data,"registrations",[])}},isValid:()=>_.filter(_.omitBy(this.wizard.form.surveys.registration.error,_.isFunction),e=>!!e).length===0,validate:()=>{if(_.isEmpty(this.wizard.form.surveys.registration.registration_edit_form))return!0;this.wizard.form.surveys.registration.data.hasRegistration?(this.wizard.form.surveys.registration.error.company=_.isEmpty(this.wizard.form.surveys.registration.registration_edit_form.company),this.wizard.form.surveys.registration.error.name=_.isEmpty(this.wizard.form.surveys.registration.registration_edit_form.name),this.wizard.form.surveys.registration.registration_edit_form.hasApproved===!1?this.wizard.form.surveys.registration.error.not_approved_notes=this.$emptyString(this.wizard.form.surveys.registration.registration_edit_form.not_approved_notes):this.wizard.form.surveys.registration.error.not_approved_notes=!1):this.wizard.form.surveys.registration.error.reset()},save:()=>{if(!_.isEmpty(this.wizard.form.surveys.registration.registration_edit_form)){if(!this.wizard.form.surveys.registration.isValid())return;this.wizard.form.surveys.registration.current_registration_index!=null?this.wizard.form.surveys.registration.data.registrations[this.wizard.form.surveys.registration.current_registration_index]=this.wizard.form.surveys.registration.registration_edit_form:this.wizard.form.surveys.registration.addRegistration(this.wizard.form.surveys.registration.registration_edit_form)}axios.put("/api/Explorers/Deals/"+this.opportunity_recid+"/Surveys/Registration",this.wizard.form.surveys.registration.data).then(e=>{}).catch(e=>{}).finally(e=>{_.isEmpty(this.wizard.form.surveys.registration.registration_edit_form)||this.wizard.form.surveys.registration.resetToList()})},load:()=>{if(this.wizard.form.surveys.tsb.options.master_agent.get(),this.wizard.form.surveys.registration.error.reset(),this.deal.data.registration_survey)if(this.deal.data.registration_survey.data.registrations)Object.entries(this.deal.data.registration_survey.data).forEach(([t,s])=>{this.$set(this.wizard.form.surveys.registration.data,t,s)});else{var e={};Object.entries(this.deal.data.registration_survey.data).forEach(([t,s])=>{t=="hasRegistration"?this.$set(this.wizard.form.surveys.registration.data,t,s):e[t]=s}),this.$set(this.wizard.form.surveys.registration.data,"registrations",[e])}else this.wizard.form.surveys.registration.data.default()},alert:()=>this.wizard.form.surveys.registration.isValid()?null:"Errors Found In Form",setRegistrationForm:(e,t=null)=>{t!=null?(this.wizard.form.surveys.registration.current_registration_index=t,this.wizard.form.surveys.registration.data.registrations[t].expiration_date!=null?this.wizard.form.surveys.registration.data.registrations[t].expiration_date=new Date(this.wizard.form.surveys.registration.data.registrations[t].expiration_date):this.wizard.form.surveys.registration.data.registrations[t].expiration_date=null,this.$set(this.wizard.form.surveys.registration,"registration_edit_form",this.wizard.form.surveys.registration.data.registrations[t]),e=this.wizard.form.surveys.registration.data.registrations[t].company):(this.$set(this.wizard.form.surveys.registration,"registration_edit_form",this.wizard.form.surveys.registration.getNewRegistrationForm(e)),this.wizard.form.surveys.registration.add_registration_bar.input=null,this.$refs.autocompleteSurveysRegistrationCompanyAddBar.setSelected(null)),Vue.nextTick(()=>{this.$refs.autocompleteSurveysRegistrationCompany.setSelected(e)})},getNewRegistrationForm:(e=null)=>({company:e,name:null,expiration_date:null,hasSubmitted:null,registration_number:null,hasApproved:null,notes:null,not_approved_notes:null}),removeRegistration:e=>{this.$buefy.dialog.confirm({title:"Remove Registration",message:"Are you sure you want to remove this registration from this deal?",cancelText:"Cancel",confirmText:"Remove",type:"is-danger",onConfirm:()=>{this.wizard.form.surveys.registration.data.registrations.splice(e,1)}})},addNewEmptyRegistration:e=>{this.$set(this.wizard.form.surveys.registration.data.registrations,this.wizard.form.surveys.registration.data.registrations.length,this.wizard.form.surveys.registration.getNewRegistrationForm(e)),this.$refs.autocompleteSurveysRegistrationCompany.setSelected(null),this.wizard.form.surveys.registration.add_registration_bar.input=null},addRegistration:e=>{this.$set(this.wizard.form.surveys.registration.data.registrations,this.wizard.form.surveys.registration.data.registrations.length,e)},updateApprovalOption:()=>{this.wizard.form.surveys.registration.registration_edit_form.hasApproved!==!1&&(this.wizard.form.surveys.registration.registration_edit_form.not_approved_notes=null)},updateSubmittedOption:()=>{this.wizard.form.surveys.registration.registration_edit_form.hasSubmitted||(this.wizard.form.surveys.registration.registration_edit_form.registration_number=null,this.wizard.form.surveys.registration.registration_edit_form.hasApproved=null,this.wizard.form.surveys.registration.registration_edit_form.notes=null,this.wizard.form.surveys.registration.registration_edit_form.not_approved_notes=null)},resetToList:()=>{this.wizard.form.surveys.registration.registration_edit_form={},this.wizard.form.surveys.registration.current_registration_index=null,this.wizard.form.surveys.registration.error.reset()},saveNew:()=>{this.wizard.form.surveys.registration.validate(),this.wizard.form.surveys.registration.isValid()&&this.wizard.form.surveys.registration.save()},openModalToRegistration:e=>{this.wizard.modal.openToStep("registration"),this.wizard.form.surveys.registration.setRegistrationForm(null,e)},status:e=>e.hasSubmitted?e.expiration_date&&Moment().isAfter(e.expiration_date)?"Expired":e.hasApproved===null?"Pending Approval":e.hasApproved===!1?"Rejected":e.hasApproved===!0?"Approved":"Unspecified":"Submission Pending"},quote_details:{error:{reset:()=>{}},data:{default:()=>{this.$set(this.wizard.form.surveys.quote_details.data,"quote_specifications",null),this.$set(this.wizard.form.surveys.quote_details.data,"pricing_instructions",null),this.$set(this.wizard.form.surveys.quote_details.data,"quote_pricing_type",null),this.$set(this.wizard.form.surveys.quote_details.data,"requested_quote_delivery_date",null),this.$set(this.wizard.form.surveys.quote_details.data,"reps",null),this.$set(this.wizard.form.surveys.quote_details.data,"notes",null)}},isValid:()=>_.filter(_.omitBy(this.wizard.form.surveys.quote_details.error,_.isFunction),e=>!!e).length===0,validate:()=>{},save:()=>axios.put("/api/Explorers/Deals/"+this.opportunity_recid+"/Surveys/Quote",this.wizard.form.surveys.quote_details.data).then(e=>{}).catch(e=>{}).finally(e=>{}),load:()=>{this.wizard.form.surveys.quote_details.error.reset(),this.deal.data.quote_survey?Object.entries(this.deal.data.quote_survey.data).forEac
1h(([e,t])=>{e=="requested_quote_delivery_date"&&t!=null?this.$set(this.wizard.form.surveys.quote_details.data,e,new Date(t)):this.$set(this.wizard.form.surveys.quote_details.data,e,t)}):this.wizard.form.surveys.quote_details.data.default()},alert:()=>this.wizard.form.surveys.quote_details.isValid()?this.wizard.form.surveys.quote_details.hasSurvey()?null:"No Quote Details Found":"Errors Found In Form",hasSurvey:()=>{var e,t;return(e=this.deal.data)!=null&&e.quote_survey?_.filter((t=this.deal.data.quote_survey)==null?void 0:t.data,s=>!this.$emptyString(s)).length!==0:!1}},tsb:{error:{reset:()=>{this.$set(this.wizard.form.surveys.tsb.error,"master_agent",null)}},data:{default:()=>{this.$set(this.wizard.form.surveys.tsb.data,"hasTSB",!1),this.$set(this.wizard.form.surveys.tsb.data,"master_agent",null),this.$set(this.wizard.form.surveys.tsb.data,"master_agent_customer_id",null),this.$set(this.wizard.form.surveys.tsb.data,"item_category",null),this.$set(this.wizard.form.surveys.tsb.data,"service_provider_1",null),this.$set(this.wizard.form.surveys.tsb.data,"service_provider_2",null),this.$set(this.wizard.form.surveys.tsb.data,"service_provider_3",null),this.$set(this.wizard.form.surveys.tsb.data,"upgrade_existing_order",null),this.$set(this.wizard.form.surveys.tsb.data,"master_agent_order_num",null),this.$set(this.wizard.form.surveys.tsb.data,"agreement",null),this.$set(this.wizard.form.surveys.tsb.data,"est_commission_percent",null),this.$set(this.wizard.form.surveys.tsb.data,"est_contract_term",null),this.$set(this.wizard.form.surveys.tsb.data,"est_billing_term",null),this.$set(this.wizard.form.surveys.tsb.data,"est_contract_start_date",new Date),this.$set(this.wizard.form.surveys.tsb.data,"est_contract_end_date",new Date),this.$set(this.wizard.form.surveys.tsb.data,"est_contract_value",null),this.$set(this.wizard.form.surveys.tsb.data,"recurring_contract_value_total",null),this.$set(this.wizard.form.surveys.tsb.data,"additional_notes",null)}},options:{item_category:{values:[],typing:e=>{var t=e?this.options.item_categories.filter(s=>s.toString().toLowerCase().indexOf(e.toLowerCase())>=0):this.options.item_categories;this.wizard.form.surveys.tsb.options.item_category.values=t.filter(s=>!(this.wizard.form.surveys.tsb.data.item_category||[]).find(a=>s===a))}},master_agent:{loading:!1,values:[],debounce:_.debounce((e=null)=>{this.wizard.form.surveys.tsb.options.master_agent.get(e)},1e3),get:(e,t=!1)=>{this.wizard.form.surveys.tsb.options.master_agent.loading=!0;
1let s="?type=Broker"+(_.isNil(e)?"":"&name="+e);return axios.get("/api/Explorers/Deals/Companies"+s).then(a=>{this.wizard.form.surveys.tsb.options.master_agent.values=a.data.companies}).catch(a=>{this.wizard.form.surveys.tsb.options.master_agent.values=[]}).finally(a=>{this.wizard.form.surveys.tsb.options.master_agent.loading=!1})},setMasterAgentID:()=>{var t,s;var e=this.wizard.form.surveys.tsb.options.master_agent.values.find(a=>a.Company_RecID==this.wizard.form.surveys.tsb.data.master_agent);(t=e.master_agent_id)!=null&&t.setting_value?this.wizard.form.surveys.tsb.data.master_agent_customer_id=JSON.parse((s=e.master_agent_id)==null?void 0:s.setting_value):this.wizard.form.surveys.tsb.data.master_agent_customer_id=null}},agreement:{loading:!1,values:[],input:null,debounce:_.debounce((e=null)=>{this.wizard.form.surveys.tsb.options.agreement.get(e)},1e3),get:(e,t=!1)=>{var a;this.wizard.form.surveys.tsb.options.agreement.loading=!0;let s="?name="+(e||"")+"&company_recid="+((a=this.wizard.form.surveys.deal.data.company)==null?void 0:a.Company_RecID);return axios.get("/api/Explorers/Deals/Agreements"+s).then(r=>{this.wizard.form.surveys.tsb.options.agreement.values=r.data.agreements}).catch(r=>{this.wizard.form.surveys.tsb.options.agreement.values=[]}).finally(r=>{this.wizard.form.surveys.tsb.options.agreement.loading=!1})}}},isValid:()=>_.filter(_.omitBy(this.wizard.form.surveys.tsb.error,_.isFunction),e=>!!e).length===0,validate:()=>{this.wizard.form.surveys.tsb.data.hasTSB&&(this.wizard.form.surveys.tsb.error.master_agent=_.isNil(this.wizard.form.surveys.tsb.data.master_agent))},save:()=>axios.put("/api/Explorers/Deals/"+this.opportunity_recid+"/Surveys/TSB",this.wizard.form.surveys.tsb.data).then(e=>{}).catch(e=>{}).finally(e=>{}),load:()=>{if(this.wizard.form.surveys.tsb.error.reset(),this.deal.data.tsb_survey){let e=["est_contract_start_date","est_contract_end_date"];Object.entries(this.deal.data.tsb_survey.data).forEach(([t,s])=>{e.includes(t)&&Moment(s).isValid()&&(s=Moment(s).toDate()),this.$set(this.wizard.form.surveys.tsb.data,t,s)}),Vue.nextTick(()=>{this.wizard.form.surveys.tsb.data.agreement&&this.$refs.autocompleteSurveysTSBAgreement.setSelected(this.wizard.form.surveys.tsb.data.agreement)})}else this.wizard.form.surveys.tsb.data.default()},alert:()=>this.wizard.form.surveys.tsb.isValid()?null:"Errors Found In Form",updateTSBOption:()=>{let e=this.wizard.form.surveys.tsb.data.hasTSB;e||(this.wizard.form.surveys.tsb.data.default(),this.wizard.form.surveys.tsb.error.reset(),this.wizard.form.surveys.tsb.data.hasTSB=e)},updateContractValues:()=>{this.wizard.form.surveys.tsb.data.est_contract_value=this.$format.fixed(this.wizard.form.surveys.tsb.data.est_contract_value),this.wizard.form.surveys.tsb.data.recurring_contract_value_total=this.$format.fixed(this.$format.float(this.wizard.form.surveys.tsb.data.est_contract_term)*this.$format.float(this.wizard.form.surveys.tsb.data.est_contract_value))},updateContractTerm:()=>{let e=this.wizard.form.surveys.tsb.data.est_contract_term,t=this.wizard.form.surveys.tsb.data.est_billing_term,s=this.wizard.form.surveys.tsb.data.est_contract_start_date;e>0&&t&&s?this.wizard.form.surveys.tsb.data.est_contract_end_date=Moment(s).add(e,t=="Monthly"?"M":"y").toDate():this.wizard.form.surveys.tsb.data.est_contract_end_date=null},hasSurvey:()=>{var e,t;return!!((t=(e=this.deal.data)==null?void 0:e.tsb_survey)!=null&&t.data.hasTSB)}}}}},deal_relationship_groups:{is_initialized:!1,current_deal:{Opportunity_RecID:null,Company_RecID:null,Opportunity_Name:null},processing:{group_data_save:!1,group_data_load:!1,adding_relationship:!1},relationship_group:{},init:(e,t,s)=>{this.deal_relationship_groups.current_deal.Opportunity_RecID=e,this.deal_relationship_groups.current_deal.Company_RecID=t,this.deal_relationship_groups.current_deal.Opportunity_Name=s,axios.all([this.deal_relationship_groups.getRelationshipGroup()]).finally(()=>{this.deal_relationship_groups.is_initialized=!0})},form:{data:{},defaults:()=>({deal_relationship_group_id:null,name:null,action_type:null,adding_opportunity_recid:null}),init:()=>{this.$set(this.deal_relationship_groups.form,"data",this.deal_relationship_groups.form.defaults())}},save:()=>{this.deal_relationship_groups.form.data.action_type==="create_new_relationship_group"?(this.deal_relationship_groups.processing.group_data_save=!0,axios.all([this.deal_relationship_groups.saveRelationshipGroup()]).then(()=>{this.deal_relationship_groups.form.data.action_type="create_new_relationship",this.deal_relationship_groups.saveRelationship()})):this.deal_relationship_groups.form.data.action_type==="add_to_other_relationship_group"?(this.deal_relationship_groups.processing.adding_relationship=!0,this.deal_relationship_groups.form.data.deal_relationship_group_id=this.deal_relationship_groups.autocomplete.deal.selected.deal_relationship.id,this.deal_relationship_groups.form.data.adding_opportunity_recid=this.deal_relationship_groups.current_deal.Opportunity_RecID,this.deal_relationship_groups.saveRelationship()):this.deal_relationship_groups.form.data.action_type==="create_new_relationship"&&(this.deal_relationship_groups.processing.adding_relationship=!0,this.deal_relationship_groups.saveRelationship())},saveRelationship:()=>(_.isEmpty(this.deal_relationship_groups.relationship_group)||(this.deal_relationship_groups.form.data.deal_relationship_group_id=this.deal_relationship_groups.relationship_group.id),this.deal_relationship_groups.processing.adding_relationship=!0,axios.post("/api/Explorers/Deals/Relationships/"+this.deal_relationship_groups.current_deal.Opportunity_RecID,this.deal_relationship_groups.form.data).then(e=>{this.deal_relationship_groups.getRelationshipGroup()}).catch(e=>{}).finally(e=>{this.deal_relationship_groups.processing.adding_relationship=!1,this.deal_relationship_groups.autocomplete.deal.input
1=null,this.$refs.dealRelationshipAutocomplete.setSelected({})})),saveRelationshipGroup:()=>(_.isEmpty(this.deal_relationship_groups.relationship_group)||(this.deal_relationship_groups.form.data.deal_relationship_group_id=this.deal_relationship_groups.relationship_group.id),this.deal_relationship_groups.processing.group_data_save=!0,axios.post(`/api/Explorers/Deals/RelationshipGroup/${this.deal_relationship_groups.current_deal.Opportunity_RecID}`,this.deal_relationship_groups.form.data).then(e=>{this.deal_relationship_groups.relationship_group=e.data.deal_relationship_group}).finally(e=>{this.deal_relationship_groups.processing.group_data_save=!1})),getRelationshipGroup:()=>(this.deal_relationship_groups.processing.group_data_load=!0,axios.get("/api/Explorers/Deals/RelationshipGroup/"+this.deal_relationship_groups.current_deal.Opportunity_RecID).then(e=>{var t;this.deal_relationship_groups.relationship_group=e.data.deal_relationship_group,this.deal_relationship_groups.form.data.name=((t=e.data.deal_relationship_group)==null?void 0:t.name)||null,_.isEmpty(this.deal_relationship_groups.relationship_group)||(this.deal_relationship_groups.form.data.action_type="create_new_relationship")}).catch(e=>{this.deal_relationship_groups.relationship_group=[]}).finally(e=>{this.deal_relationship_groups.processing.group_data_load=!1})),modal:{show:!1,open:()=>{this.deal_relationship_groups.form.init(),axios.all([this.deal_relationship_groups.getRelationshipGroup()]).then(()=>{this.deal_relationship_groups.modal.show=!0})},close:()=>{this.deal_relationship_groups.modal.show=!1}},remove:e=>{this.$buefy.dialog.confirm({title:"Remove Related Deal",message:`Are you sure you want to remove related deal #${e}?`,cancelText:"Cancel",confirmText:"Yes",type:"is-danger",onConfirm:()=>axios.delete("/api/Explorers/Deals/Relationships/"+e).then(t=>{this.deal_relationship_groups.getRelationshipGroup()}).catch(t=>{}).finally(t=>{})})},autocomplete:{deal:{loading:!1,selected:null,input:null,values:[],typing:_.debounce(e=>(this.deal_relationship_groups.autocomplete.deal.loading=!0,axios.post("/api/Explorers/Deals",{input_filter:e,company_recid:this.deal_relationship_groups.current_deal.Company_RecID,page:1,per_page:50,sort:{field:"Opportunity_Name",order:"asc"}}).then(t=>{this.deal_relationship_groups.autocomplete.deal.values=t.data.deals}).catch(t=>{this.deal_relationship_groups.autocomplete.deal.values=[]}).finally(t=>{this.deal_relationship_groups.autocomplete.deal.loading=!1})),650),select:(e=null)=>{var t,s,a;e&&!((s=(t=this.deal_relationship_groups)==null?void 0:t.relationship_group)!=null&&s.related_deals.find(r=>r.Opportunity_RecID==e.Opportunity_RecID))&&(this.deal_relationship_groups.autocomplete.deal.selected=e,this.deal_relationship_groups.form.data.adding_opportunity_recid=e.Opportunity_RecID,_.isEmpty(this.deal_relationship_groups.relationship_group)&&(_.isEmpty((a=this.deal_relationship_groups.autocomplete.deal.selected)==null?void 0:a.deal_relationship)?this.deal_relationship_groups.form.data.action_type="create_new_relationship_group":this.deal_relationship_groups.form.data.action_type="add_to_other_relationship_group"))}}},close_date(e){if(e){let t=e.Expected_Close_Date??e.Date_Closed;return t?Moment(t).format("ddd MM/DD/YYYY"):null}return null}},deal:{data:null,loading:!0,get:()=>(this.deal.loading=!0,axios.get("/api/Explorers/Deals/"+this.opportunity_recid).then(e=>{if(e.data.deal.registration_survey&&!e.data.deal.registration_survey.data.registrations){var t={hasRegistration:null,registrations:[]},s={};_.forEach(e.data.deal.registration_survey.data,(a,r)=>{r=="hasRegistration"?t[r]=a:s[r]=a}),t.registrations=[s],e.data.deal.registration_survey.data=t}this.deal.data=e.data.deal}).catch(e=>{this.deal.data=null}).finally(e=>{this.deal.loading=!1})),modal:{destroy:{show:!1,loading:!1,attachments:[],open:()=>{this.deal.modal.destroy.loading=!0,this.deal.modal.destroy.show=!0,this.tabs.transactions.artifact_transfer.form.reset(),axios.all([this.deal.modal.destroy.getAttachments(),this.tabs.transactions.artifact_transfer.source_deal.get()]).then(()=>{this.deal.modal.destroy.loading=!1})},close:()=>{this.deal.modal.destroy.show=!1},getAttachments:()=>axios.post("/api/Attachments/Search",{opportunity_recid:this.opportunity_recid,company_recid:this.deal.data.Company_RecID}).then(e=>{this.deal.modal.destroy.attachments=_.isArray(e.data.files)?e.data.files:[]}),warningText:()=>{var e="";
1if(this.deal.modal.destroy.hasRegistrationDetails()||this.tabs.transactions.artifact_transfer.hasArtifacts()||this.deal.modal.destroy.hasAttachments()){e="This deal has ";var s=[this.tabs.transactions.artifact_transfer.hasArtifacts()?"artifacts":null,this.deal.modal.destroy.hasRegistrationDetails()?"registration details":null,this.deal.modal.destroy.hasAttachments()?"attachments":null].filter(a=>!!a);if(s.length>1){let a=!1,r=_.map(_.reverse(s),(i,o)=>o==0?i:a?`${i}, `:(a=!0,`${i} and `));e+=_.join(_.reverse(r),"")}else e+=s.pop();e+="!"}return e},hasRegistrationDetails:()=>{var e,t;return!!((t=(e=this.deal.data.registration_survey)==null?void 0:e.data)!=null&&t.hasRegistration)},hasAttachments:()=>this.deal.modal.destroy.attachments.length>0,transferArtifactsFirst:()=>{this.deal.modal.destroy.close(),this.tabs.transactions.artifact_transfer.open_destroy_after_transfer=!0,this.tabs.transactions.artifact_transfer.modal.open()},confirmDestroy:()=>{this.$buefy.dialog.confirm({message:"Are you sure you want to delete this deal? This operation cannot be undone",cancelText:"Cancel",confirmText:"Yes",type:"is-danger",onConfirm:()=>{this.deal.modal.destroy()}})},destroy:()=>{this.deal.modal.destroy.loading=!0,axios.delete("/api/Explorers/Deals/"+this.opportunity_recid).then(e=>{}).catch(e=>{}).finally(e=>{this.deal.modal.destroy.loading=!0,window.open("/i/Explorers/Deals","_self")})}}}},surveys:{notes:{modal:{active:!1,form:{default:()=>{this.$set(this.surveys.notes.modal.form,"deal_notes",null)}},close:()=>{this.surveys.notes.modal.active=!1,this.surveys.notes.modal.form.default()},save:()=>{this.surveys.notes.modal.saving=!0,axios.put("/api/Explorers/Deals/"+this.opportunity_recid+"/Surveys/Notes",this.surveys.notes.modal.form).then(e=>{this.deal.get()}).catch(e=>{}).finally(e=>{this.surveys.notes.modal.close()})},show:()=>{this.surveys.notes.modal.form.default(),this.surveys.notes.modal.active=!0}}}},tabs:{active:"Transactions",attachments:{component_key:null,reload:()=>{this.tabs.attachments.component_key++}},products:{loading:!0,data:[],load:()=>{this.tabs.products.loading=!0,axios.post("/api/Explorers/Deals/Products/"+this.opportunity_recid).then(e=>{this.tabs.products.data=e.data.products}).catch(e=>{this.tabs.products.data=[]}).finally(e=>{this.tabs.products.loading=!1})}},comp:{loading:!0,methods:{loading:!1,options:[],get:()=>{this.tabs.comp.methods.loading=!0,axios.get("/api/Explorers/Deals/"+this.opportunity_recid+"/CompPools?option=methods").then(e=>{this.tabs.comp.methods.options=e.data.methods}).catch(e=>{this.tabs.comp.methods.options=[]}).finally(e=>{this.tabs.comp.methods.loading=!1})}},modal:{member:{active:!1,form:{member:null,method:null,percentage:0},hasError:{member:!1,percentage:!1},members:{loading:!1,options:[],get:()=>{let e=[];
1if(this.tabs.comp.modal.member.form.method){let t=_.map(this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name],"user_id"),s=_.filter(this.tabs.team.deal.options,a=>{var r;return t.indexOf(a.user_id)==-1&&((r=a.current_quarter_comp_method_assignments)==null?void 0:r.find(i=>i.comp_method_id==this.tabs.comp.modal.member.form.method.id))});e=_.sortBy(s,["user.last_name","user.first_name"])}this.tabs.comp.modal.member.members.options=e}},_distributeShare:()=>{let e=0;for(let t=0;t<this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name].length;t++)if(this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name][t].percentage=parseFloat((parseFloat(this.tabs.comp.modal.member.form.method.max_percentage)/parseFloat(this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name].length)).toFixed(2)),e+=this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name][t].percentage,t==this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name].length-1){let s=parseFloat((parseFloat(this.tabs.comp.modal.member.form.method.max_percentage)-parseFloat(e)).toFixed(2));this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name][t].percentage=parseFloat((s+this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name][t].percentage).toFixed(2))}},_reset:(e=!0)=>{var t,s;(s=(t=this.$refs)==null?void 0:t.autocompleteCompPoolMember)==null||s.setSelected(null),this.tabs.comp.modal.member.form.member=null,this.tabs.comp.modal.member.form.percentage=0,e&&(this._resetErrors(this.tabs.comp.modal.member.hasError),this.tabs.comp.modal.member.form.method=null)},assignedShareInPool:(e=null)=>{var s,a;let t=0;return e=e??((s=this.tabs.comp.modal.member.form.method)==null?void 0:s.name),e&&((a=this.tabs.comp.pools.options[e])==null||a.forEach(r=>{t+=parseFloat(r==null?void 0:r.percentage)})),parseFloat(t.toFixed(2))},close:()=>{if(this.tabs.comp.pools.options.hasOwnProperty(this.tabs.comp.modal.member.form.method.name)){if(!_.isEmpty(this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name])){let e=!1;for(let t=0;t<this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name].length;++t)parseFloat(this.tabs.comp.pools.options[this.tabs.comp.modal.member.form.method.name][t].percentage)==0&&(e=!0);this.tabs.comp.modal.member.deltaShareInPool()!=0||e?this.$buefy.dialog.confirm({title:"Distribution of Shares",message:'<p class="content">The shares have not been distributed equally.</p><p class="content">You can go back and manually distribute the shares or continue and the shares will be automatically distributed equally.</p>',cancelText:"Manual",confirmText:"Automatic",type:"is-success",onConfirm:()=>{this.tabs.comp.modal.member._distributeShare(),this.tabs.comp.modal.member.save(this.tabs.comp.modal.member.form.method),this.tabs.comp.modal.member._reset(),this.tabs.comp.modal.member.active=!1}}):(this.tabs.comp.modal.member.save(this.tabs.comp.modal.member.form.method),this.tabs.comp.modal.member._reset(),this.tabs.comp.modal.member.active=!1)}}else this.tabs.comp.modal.member._reset(),this.tabs.comp.modal.member.active=!1},deltaShareInPool:(e=null)=>{var s,a;let t=0;return e=e??((s=this.tabs.comp.modal.member.form.method)==null?void 0:s.name),(a=this.tabs.comp.modal.member.form.method)!=null&&a.max_percentage&&e&&(t=this.tabs.comp.modal.member.form.method.max_percentage-this.tabs.comp.modal.member.assignedShareInPool(e)),parseFloat(t.toFixed(2))},distributeShareDialog:()=>{this.$buefy.dialog.confirm({title:"Distributing Share",message:"Are you sure you want to automatically distribute the share?",cancelText:"No",confirmText:"Yes",type:"is-success",onConfirm:()=>{this.tabs.comp.modal.member._distributeShare()}})},highlightText:e=>{let t=this.tabs.comp.modal.member.assignedShareInPool(),s=this.tabs.comp.modal.member.deltaShareInPool(),a={bad:"text-stop-500",faded:"text-gray-500",good:"text-success-700",normal:""};switch(e){case"assigned":return t>100||t<0?a.bad:t==100?a.good:a.normal;case"delta":if(s==0)return a.good;if(s<0||s>0)return a.bad;case"max":if(this.tabs.comp.modal.member.form.method.max_percentage==t)return a.good;if(this.tabs.comp.modal.member.form.method.max_percentage>t||this.tabs.comp.modal.member.form.method.max_percentage<t)return a.faded}},remove:e=>{this.$buefy.dialog.confirm({title:"Remove "+e.comp_method.name+" Member",message:"Are you sure you want to remove this member?",cancelText:"No",confirmText:"Yes",type:"is-success",onConfirm:()=>{let t={member:e.user,comp_pool_id:e.id,comp_method_id:e.comp_method_id};axios.delete("/api/Explorers/Deals/"+this.opportunity_recid+"/CompPool/"+e.id+"/Member/"+e.user.id,{data:t}).then(s=>{this.tabs.comp.pools.get()}).catch(s=>{}).finally(s=>{this.tabs.comp.modal.member.members.get()})}})},show:e=>{var t;this.tabs.comp.modal.member._reset(),this.tabs.comp.modal.member.form.method=((t=this.tabs.comp.methods.options)==null?void 0:t.find(s=>
1s.id==e))??null,this.tabs.comp.modal.member.members.get(),this.tabs.comp.modal.member.active=!!this.tabs.comp.modal.member.form.method},save:(e=null)=>{let t=null,s=null;if(e?(t=this.tabs.comp.pools.options[e.name],s="/api/Explorers/Deals/"+this.opportunity_recid+"/CompPool/"+e.id):this._validate("comp",this.tabs.comp.modal.member.hasError)&&(t={member:this.tabs.comp.modal.member.form.member,comp_method_id:this.tabs.comp.modal.member.form.method.id,percentage:this.tabs.comp.modal.member.form.percentage},s="/api/Explorers/Deals/"+this.opportunity_recid+"/CompPool/Member"),s&&t)return axios.post(s,t).then(a=>{this.tabs.comp.pools.get()}).catch(a=>{}).finally(a=>{this.tabs.comp.modal.member._reset(!1),this.tabs.comp.modal.member.members.get()})}}},pools:{loading:!1,options:[],get:()=>{this.tabs.comp.pools.loading=!0,axios.get("/api/Explorers/Deals/"+this.opportunity_recid+"/CompPools").then(e=>{this.tabs.comp.pools.options=e.data.pools}).catch(e=>{this.tabs.comp.pools.options=[]}).finally(e=>{this.tabs.comp.pools.loading=!1})}},get:()=>{this.tabs.comp.loading=!0,Promise.all([this.tabs.comp.methods.get(),this.tabs.comp.pools.get()]).then(e=>{this.tabs.comp.loading=!1}).catch(e=>{this.tabs.comp.loading=!1})}},team:{all:{loading:!0,options:[],get:()=>(this.tabs.team.all.loading=!0,axios.get(`/api/Explorers/Deals/Company/${this.deal.data.Company_RecID}/Members/Addable`).then(e=>{this.tabs.team.all.options=e.data.all_members}).catch(e=>{this.tabs.team.all.options=[]}).finally(e=>{this.tabs.team.all.loading=!1}))},company:{loading:!0,options:[],get:()=>(this.tabs.team.company.loading=!0,axios.get("/api/Explorers/Deals/"+this.opportunity_recid+"/Teams?option=company").then(e=>{this.tabs.team.company.options=e.data.company_team}).catch(e=>{this.tabs.team.company.options=[]}).finally(e=>{this.tabs.team.company.loading=!1}))},deal:{loading:!0,options:[],get:()=>(this.tabs.team.deal.loading=!0,axios.get("/api/Explorers/Deals/"+this.opportunity_recid+"/Teams?option=deal").then(e=>{this.tabs.team.deal.options=e.data.deal_team}).catch(e=>{this.tabs.team.deal.options=[]}).finally(e=>{this.tabs.team.deal.loading=!1})),presales_engineers:{loading:!1,unrecognized:[],options:[],get:()=>(this.tabs.team.deal.presales_engineers.loading=!0,axios.get("/api/Explorers/Deals/"+this.opportunity_recid+"/Teams?option=presalesEngineers").then(e=>{this.tabs.team.deal.presales_engineers.options=e.data.presales_engineers,this.tabs.team.deal.presales_engineers.unrecognized=e.data.unrecognized}).catch(e=>{this.tabs.team.deal.presales_engineers.options=[]}).finally(e=>{this.tabs.team.deal.presales_engineers.loading=!1})),store:()=>(this.tabs.team.deal.presales_engineers.loading=!0,axios.post("/api/Explorers/Deals/"+this.opportunity_recid+"/Members/Presales",{presales_engineers:this.tabs.team.deal.presales_engineers.options}).then(e=>{}).catch(e=>{}).finally(e=>{this.timeline.triggerReload(),this.tabs.team.deal.presales_engineers.get()})),add:e=>{var t="Are you sure you want to add "+e.user.name+" to the Presales Team?";this.tabs.team.deal.presales_engineers.unrecognized.length>0&&(t+=" This will overwrite the existing values in ConnectWise("+_.join(this.tabs.team.deal.presales_engineers.unrecognized,", ")+")"),this.$buefy.dialog.confirm({message:t,cancelText:"No",confirmText:"Yes",type:"is-success",onConfirm:()=>{this.tabs.team.deal.presales_engineers.options.push(e),this.tabs.team.deal.presales_engineers.store()}})},confirmAndRemove:e=>{this.$buefy.dialog.confirm({message:"Are you sure you want to remove "+e.user.name+" from the Presales Team?",cancelText:"No",confirmText:"Yes",type:"is-danger",onConfirm:()=>{this.tabs.team.deal.presales_engineers.remove(e)}})},removeAll:()=>{this.tabs.team.deal.presales_engineers.options=[],this.tabs.team.deal.presales_engineers.store()},remove:e=>{var t=this.tabs.team.deal.presales_engineers.options.findIndex(s=>s.user_id==e.user_id);t!==-1&&(this.tabs.team.deal.presales_engineers.options.splice(t,1),this.tabs.team.deal.presales_engineers.store())},isAddableMember:e=>{var t,s;return!(this.tabs.team.deal.presales_engineers.hasPresalesMembership(e)||((s=(t=e==null?void 0:e.team_role)==null?void 0:t.category)==null?void 0:s.trim())!="Engineering")},hasPresalesMembership:e=>this.tabs.team.deal.presales_engineers.options.find(t=>t.user_id==(e.user_id||e.id))}},loading:!0,modal:{member:{active:!1,edit:!1,saving:!1,form:{description:null,member:null,role_id:null,user_team_id:null},hasError:{member:!1,role_id:!1},members:{options:[]},_reset:()=>{this._resetErrors(this.tabs.team.modal.member.hasError),this.tabs.team.modal.member.edit=!1,this.tabs.team.modal.member.form.description=null,this.tabs.team.modal.member.form.member=null,this.tabs.team.modal.member.form.role_id=null,this.tabs.team.modal.member.form.user_team_id=null},normalizeMemberRecord:e=>{var t,s;return{name:((t=e==null?void 0:e.user)==null?void 0:t.name)||e.name,user_id:e.user_id||e.id,member_recid:((s=e==null?void 0:e.user)==null?void 0:s.cw_member_recid)||e.cw_member_recid,description:e.description||null,team_role_id:e.team_role_id||null}},close:()=>{this.tabs.team.modal.member._reset(),this.tabs.team.modal.member.active=!1},findSelectableMemberships:()=>{let e=_.map(this.tabs.team.deal.options,"user_id"),t=_.filter(this.tabs.team.all.options,s=>e.indexOf(s.id)==-1);return _.sortBy(t,["last_name","first_name"])},typing:e=>{var t=this.tabs.team.modal.member.findSelectableMemberships();!e||this.$emptyString(e.trim())?this.tabs.team.modal.member.members.options=t:this.tabs.team.modal.member.members.options=t.filter(s=>(s==null?void 0:s.name.trim().toLowerCase().indexOf(e.trim().toLowerCase()))!==-1)}
1,onCompanyTeam:(e=null)=>e?(e=this.tabs.team.modal.member.normalizeMemberRecord(e),!!this.tabs.team.company.options.find(t=>{var s;return((s=t==null?void 0:t.user)==null?void 0:s.id)==e.user_id})):!1,show:(e=null)=>{this.tabs.team.modal.member._reset(),e?Vue.nextTick(()=>{this.tabs.team.modal.member.form.description=e.description,this.tabs.team.modal.member.form.role_id=e.team_role_id,this.tabs.team.modal.member.form.user_team_id=e.id,e=this.tabs.team.modal.member.normalizeMemberRecord(e),this.$refs.autocompleteTeamMember.setSelected(e),this.tabs.team.modal.member.edit=!0}):this.tabs.team.modal.member.members.options=this.tabs.team.modal.member.findSelectableMemberships(),this.tabs.team.modal.member.active=!0},save:()=>{if(this._validate("team",this.tabs.team.modal.member.hasError)){this.tabs.team.modal.member.saving=!0;let e={description:this.tabs.team.modal.member.form.description,user_id:this.tabs.team.modal.member.form.member.user_id,role_id:this.tabs.team.modal.member.form.role_id,user_team_id:this.tabs.team.modal.member.form.user_team_id},t=null;return this.tabs.team.modal.member.edit?t="/api/Explorers/Deals/"+this.opportunity_recid+"/Members/"+this.tabs.team.modal.member.form.member.user_id:t="/api/Explorers/Deals/"+this.opportunity_recid+"/Members",axios.post(t,e).then(s=>{setTimeout(()=>{this.deal.get()},3500),this.tabs.team.deal.get()}).catch(s=>{}).finally(s=>{this.tabs.team.modal.member.saving=!1,this.tabs.team.modal.member.close(),this.timeline.triggerReload()})}}},invalid_members:{saving:!1,active:!1,members_with_invalid_roles:null,members_not_on_company_team:null,form:{account_executive:null,account_manager:null},hasError:{account_executive:!1},open:()=>{axios.all([this.wizard.form.surveys.deal.options.account_executive.get(this.deal.data.company.Company_RecID),this.wizard.form.surveys.deal.options.account_manager.get(this.deal.data.company.Company_RecID)]).finally(()=>{this.tabs.team.modal.invalid_members.active=!0})},close:()=>{this.tabs.team.modal.invalid_members.active=!1},replaceAccountExecutive:()=>this.tabs.team.modal.invalid_members.members_with_invalid_roles.account_executive||_.filter(this.tabs.team.modal.invalid_members.members_not_on_company_team,e=>this.tabs.team.roles.isAccountExecutive(e.team_role.cw_team_role.Role_Desc)).length>0,replaceAccountManager:()=>this.tabs.team.modal.invalid_members.members_with_invalid_roles.account_manager||_.filter(this.tabs.team.modal.invalid_members.members_not_on_company_team,e=>this.tabs.team.roles.isAccountManager(e.team_role.cw_team_role.Role_Desc)).length>0,isValid:()=>!this.tabs.team.modal.invalid_members.hasError.account_executive,validate:()=>{this.tabs.team.modal.invalid_members.replaceAccountExecutive()&&!this.tabs.team.modal.invalid_members.form.account_executive?this.tabs.team.modal.invalid_members.hasError.account_executive=!0:this.tabs.team.modal.invalid_members.hasError.account_executive=!1},save:()=>{this.tabs.team.modal.invalid_members.validate(),this.tabs.team.modal.invalid_members.isValid()&&(this.tabs.team.modal.invalid_members.saving=!0,axios.post("/api/Explorers/Deals/"+this.opportunity_recid+"/Teams",{invalid_members:_.filter([this.tabs.team.modal.invalid_members.members_with_invalid_roles.account_executive,this.tabs.team.modal.invalid_members.members_with_invalid_roles.account_manager]).concat(this.tabs.team.modal.invalid_members.members_not_on_company_team),account_executive:this.tabs.team.modal.invalid_members.form.account_executive,account_manager:this.tabs.team.modal.invalid_members.form.account_manager}).then(e=>{}).catch(e=>{}).finally(e=>{window.location.reload()}))}}},roles:{loading:!0,options:[],get:()=>(this.tabs.team.roles.loading=!0,axios.get("/api/Explorers/Deals/"+this.opportunity_recid+"/Teams?option=roles").then(e=>{this.tabs.team.roles.options=e.data.team_roles}).catch(e=>{this.tabs.team.roles.options=[]}).finally(e=>{this.tabs.team.roles.loading=!1})),isAccountExecutive:e=>{var t=["Primary AE","Secondary AE"];return t.indexOf(e)!==-1},isAccountManager:e=>{var t=["Primary AM","Secondary AM"];return t.indexOf(e)!==-1}},get:()=>(this.tabs.team.loading=!0,Promise.all([this.tabs.team.company.get(),this.tabs.team.all.get(),this.tabs.team.deal.get(),this.tabs.team.deal.presales_engineers.get(),this.tabs.team.roles.get()]).then(e=>{this.tabs.team.loading=!1}
1).catch(e=>{this.tabs.team.loading=!1})),hideMenuOption:e=>e.team_role_id!=1&&e.team_role_id!=3,menu:(e,t)=>{e=="call"?t.user.work_phone?window.open("tel:"+t.user.work_phone):t.personal_phone?window.open("tel:"+t.user.personal_phone):console.log("no phone on record"):e=="delete"?this.$buefy.dialog.confirm({title:"Remove Team Member",message:"Are you sure you want to remove this team member?",cancelText:"No",confirmText:"Yes",type:"is-success",onConfirm:()=>{var a;let s={member:t.user,user_team_id:t.id,comp_method_ids:(a=t.current_quarter_comp_method_assignments)==null?void 0:a.map(r=>r.comp_method_id)};axios.delete("/api/Explorers/Deals/"+this.opportunity_recid+"/Members/"+t.user_id,{data:s}).then(r=>{var i;if((i=r.data)!=null&&i.error){this.$buefy.toast.open({message:r.data.error,type:"is-danger",duration:3500});return}this.tabs.team.deal.get(),setTimeout(()=>{this.deal.get()},3500)}).catch(r=>{}).finally(r=>{this.tabs.team.deal.presales_engineers.remove(t)})}}):e=="edit"?this.tabs.team.modal.member.show(t):e=="email"&&window.open("mailto:"+t.user.email)},assertValidTeam:()=>{var e=[],t={};this.tabs.team.deal.options.forEach(s=>{var a=this.tabs.team.company.options.filter(r=>{var i;return((i=r.user)==null?void 0:i.id)==s.user_id}).map(r=>r.role.Role_Desc);if(_.isEmpty(a)&&!this.tabs.team.roles.isAccountExecutive(s.team_role.cw_team_role.Role_Desc)&&!this.tabs.team.roles.isAccountManager(s.team_role.cw_team_role.Role_Desc))e.push(s);else{let r=a.find(o=>this.tabs.team.roles.isAccountExecutive(o));this.tabs.team.roles.isAccountExecutive(s.team_role.cw_team_role.Role_Desc)&&!r&&(t.account_executive=s);let i=a.find(o=>this.tabs.team.roles.isAccountManager(o));this.tabs.team.roles.isAccountManager(s.team_role.cw_team_role.Role_Desc)&&!i&&(t.account_manager=s)}}),(e.length>0||t.account_executive||t.account_manager)&&(this.tabs.team.modal.invalid_members.members_with_invalid_roles=t,this.tabs.team.modal.invalid_members.members_not_on_company_team=e)}},transactions:{data:{loading:!1,options:[],get:()=>{this.tabs.transactions.data.loading=!0;let e="/api/Explorers/Deals/"+this.opportunity_recid+"/Transactions";return this.tabs.transactions.filter.type!="All"&&(e+="?option="+this.tabs.transactions.filter.type),axios.get(e).then(t=>{this.tabs.transactions.data.options=t.data}).catch(t=>{this.tabs.transactions.data.options=[]}).finally(t=>{this.tabs.transactions.data.loading=!1})}},filter:{type:"All"},loading:!0,viewLoading:!1,artifact_transfer:{open_destroy_after_transfer:!1,source_deal:{data:null,get:()=>this.tabs.transactions.artifact_transfer.autocomplete.deal.getData("",!0).then(e=>{var t;this.tabs.transactions.artifact_transfer.source_deal.data=((t=e.data)==null?void 0:t.length)>0?e.data[0]:null})},modal:{active:!1,open:()=>{this.tabs.transactions.artifact_transfer.form.reset(),this.tabs.transactions.artifact_transfer.modal.active=!0,axios.all([this.tabs.transactions.artifact_transfer.source_deal.get()])},close:()=>{this.tabs.transactions.artifact_transfer.modal.active=!1}},hasQuote:()=>this.tabs.transactions.data.options.quotes.length>0,eligibleArtifactsAreTransferring:()=>(this.tabs.transactions.artifact_transfer.form.data.is_moving_sow||!this.tabs.transactions.artifact_transfer.sow.has())&&(this.tabs.transactions.artifact_transfer.form.data.is_moving_time||!this.tabs.transactions.artifact_transfer.time.has())&&(this.tabs.transactions.artifact_transfer.form.data.is_moving_expense||!this.tabs.transactions.artifact_transfer.expenses.has()),anyArtifactSelected:()=>this.tabs.transactions.artifact_transfer.form.data.is_moving_sow||this.tabs.transactions.artifact_transfer.form.data.is_moving_time||this.tabs.transactions.artifact_transfer.form.data.is_moving_expense,confirm:{active:!1,saving:!1,open:()=>{var e,t;this.tabs.transactions.artifact_transfer.form.data.is_moving_sow?(this.tabs.transactions.artifact_transfer.form.data.is_cancelling_sow=!this.tabs.transactions.artifact_transfer.sow.isDraft(),this.tabs.transactions.artifact_transfer.form.data.is_deleting_target_sow=this.tabs.transactions.artifact_transfer.sow.mustDeleteTargetDealSOW(),this.tabs.transactions.artifact_transfer.form.data.sow_id=(t=(e=this.tabs.transactions.artifact_transfer.source_deal.data)==null?void 0:e.sow)==null?void 0:t.id):(this.tabs.transactions.artifact_transfer.form.data.sow_id=null,this.tabs.transactions.artifact_transfer.form.data.is_cancelling_sow=!1),this.tabs.transactions.artifact_transfer.form.data.is_deactivating_deal=this.tabs.transactions.artifact_transfer.eligibleArtifactsAreTransferring()&&!this.tabs.transactions.artifact_transfer.hasQuote(),this.tabs.transactions.artifact_transfer.confirm.active=!0},close:()=>{this.tabs.transactions.artifact_transfer.confirm.active=!1}},form:{data:{},defaults:()=>({is_moving_sow:!1,is_moving_time:!1,is_moving_expense:!1,is_cancelling_sow:!1,is_deleting_target_sow:!1,is_deactivating_deal:!1,sow_id:null,target_opportunity_recid:null}),reset:()=>{this.tabs.transactions.artifact_transfer.form.data=this.tabs.transactions.artifact_transfer.form.defaults(),this.tabs.transactions.artifact_transfer.autocomplete.deal.reset()},submit:()=>(this.tabs.transactions.artifact_transfer.confirm.saving=!0,axios.post(`/api/Explorers/Deals/${this.deal.data.Opportunity_RecID}/TransferArtifacts`,this.tabs.transactions.artifact_transfer.form.data).then(e=>{this.tabs.transactions.artifact_transfer.confirm.close(),this.tabs.transactions.artifact_transfer.modal.close(),this.tabs.transactions.data.get(),this.tabs.attachments.reload()}).catch(e=>{}).finally(()=>{this.tabs.transactions.artifact_transfer.confirm.saving=!1,this.tabs.transactions.artifact_transfer.open_destroy_after_transfer&&(this.deal.modal.destroy.open(),this.tabs.transactions.artifact_transfer.open_destroy_after_transfer=!1)}))},loading:!1,autocomplete:{deal:{loading:!1,selected:null,input:null,values:[],typing:_.debounce(e=>(this.tabs.transactions.artifact_transfer.autocomplete.deal.loading=!0,this.tabs.transactions.artifact_transfer.autocomplete.deal.getData(e).then(t=>{this.tabs.transactions.artifact_transfer.autocomplete.deal.values=t.data}).catch(t=>{this.tabs.transactions.artifact_transfer.autocomplete.deal.values=[]}).finally(t=>{this.tabs.transactions.artifact_transfer.autocomplete.deal.loading=!1})),650),getData:(e,t=!1)=>axios.post(`/api/Explorers/Deals/${this.deal.data.Opportunity_RecID}/TransferRecipients`,{search_input:e,is_getting_source:t}),select:(e=null)=>{this.tabs.transactions.artifact_transfer.autocomplete.deal.selected=e,this.tabs.transactions.artifact_transfer.form.data.target_opportunity_recid=e.Opportunity_RecID},reset:()=>{this.tabs.transactions.artifact_transfer.autocomplete.deal.selected=null,this.tabs.transactions.artifact_transfer.autocomplete.deal.input
1=null,this.tabs.transactions.artifact_transfer.autocomplete.deal.loading=!1,this.tabs.transactions.artifact_transfer.autocomplete.deal.values=[]}}},hasArtifacts:()=>this.tabs.transactions.artifact_transfer.time.has()||this.tabs.transactions.artifact_transfer.expenses.has()||this.tabs.transactions.artifact_transfer.sow.has(),time:{modal:{active:!1,open:()=>{this.tabs.transactions.artifact_transfer.time.modal.active=!0},close:()=>{this.tabs.transactions.artifact_transfer.time.modal.active=!1}},has:()=>{var e,t;return((t=(e=this.tabs.transactions.artifact_transfer.source_deal.data)==null?void 0:e.time_entries)==null?void 0:t.length)>0},canTransfer:()=>this.tabs.transactions.artifact_transfer.time.has()},expenses:{modal:{active:!1,open:()=>{this.tabs.transactions.artifact_transfer.expenses.modal.active=!0},close:()=>{this.tabs.transactions.artifact_transfer.expenses.modal.active=!1}},has:()=>{var e,t;return((t=(e=this.tabs.transactions.artifact_transfer.source_deal.data)==null?void 0:e.ex_details)==null?void 0:t.length)>0},canTransfer:()=>this.tabs.transactions.artifact_transfer.expenses.has()},sow:{url:()=>{var e,t;return`/i/Explorers/SOWs/Wizard/${(t=(e=this.tabs.transactions.artifact_transfer.source_deal.data)==null?void 0:e.sow)==null?void 0:t.id}`},has:()=>{var e;return!!((e=this.tabs.transactions.artifact_transfer.source_deal.data)!=null&&e.sow)},isDraft:()=>{var e;return((e=this.tabs.transactions.artifact_transfer.source_deal.data)==null?void 0:e.sow.current_object.status_id)==1},targetIsUnderReview:()=>{var e,t;return((t=(e=this.tabs.transactions.artifact_transfer.autocomplete.deal.selected)==null?void 0:e.sow)==null?void 0:t.current_object.status_id)==2},isFullyExecuted:()=>{var e;return((e=this.tabs.transactions.artifact_transfer.source_deal.data)==null?void 0:e.sow.current_object.status_id)==5},canCancel:()=>{var e,t,s;return this.accessSOWApprovalCancel||this.user.id==((s=(t=(e=this.tabs.transactions.artifact_transfer.source_deal.data)==null?void 0:e.sow)==null?void 0:t.author)==null?void 0:s.id)},mustDeleteTargetDealSOW:()=>{var e;return!!((e=this.tabs.transactions.artifact_transfer.autocomplete.deal.selected)!=null&&e.sow)},canDeleteTargetDealSOW:()=>{var e,t,s;return!this.tabs.transactions.artifact_transfer.sow.targetIsUnderReview()&&(this.isSuperAdmin||this.user.id==((s=(t=(e=this.tabs.transactions.artifact_transfer.autocomplete.deal.selected)==null?void 0:e.sow)==null?void 0:t.author)==null?void 0:s.id))},canTransfer:()=>!!this.tabs.transactions.artifact_transfer.sow.has()&&!this.tabs.transactions.artifact_transfer.sow.isFullyExecuted()&&(this.tabs.transactions.artifact_transfer.sow.isDraft()||this.tabs.transactions.artifact_transfer.sow.canCancel())&&(!this.tabs.transactions.artifact_transfer.sow.mustDeleteTargetDealSOW()||this.tabs.transactions.artifact_transfer.sow.canDeleteTargetDealSOW())}},modal:{add:{quote:{show:e=>{window.location="/i/Explorers/Deals/"+this.opportunity_recid+"/Quotes/Create"+(e?"?copied_from_opportunity_recid="+e:"")}},rfp:{active:!1,loading:!1,data:{name:"",rfp_number:"",url_to_rfx:"",is_erate:null,is_sled:null,project_type:null,proposal_type:null,solution_due_date:null,qa_due_date:null,attachments:[]},setData:()=>{var e,t;this.tabs.transactions.modal.add.rfp.data={name:(t=(e=this.deal)==null?void 0:e.data)==null?void 0:t.Opportunity_Name,rfp_number:"",url_to_rfx:"",is_erate:null,is_sled:null,project_type:null,proposal_type:null,solution_due_date:null,qa_due_date:null,attachments:[]}},open:()=>{this.tabs.transactions.modal.add.rfp.setData(),this.tabs.transactions.modal.add.rfp.active=!0},close:()=>{this.tabs.transactions.modal.add.rfp.active=!1,this.tabs.transactions.modal.add.rfp.setData(),this.tabs.transactions.modal.add.rfp.resetAllErrors()},removeAttachment:e=>{this.tabs.transactions.modal.add.rfp.data.attachments.splice(e,1)},submit:()=>{if(this.tabs.transactions.modal.add.rfp.resetAllErrors(),!this.tabs.transactions.modal.add.rfp.validate.all())return;const t=new FormData;Object.entries(this.tabs.transactions.modal.add.rfp.data).forEach(([s,a])=>{s==="attachments"?a.forEach((r,i)=>{t.append(`${s}[]`,r)}):s==="qa_due_date"||s==="solution_due_date"?t.append(s,this.formatDate(a)):t.append(s,a??null)}),t.append("creator_id",this.user.id),t.append("opportunity_recid",this.opportunity_recid),this.tabs.transactions.modal.add.rfp.loading=!0,axios.post("/api/Explorers/RFPs",t).then(s=>{var a;if(s.data.hasOwnProperty("validationErrors")){Object.keys((a=s==null?void 0:s.data)==null?void 0:a.validationErrors).forEac
1h(i=>this.tabs.transactions.modal.add.rfp.errors[i]=s.data.validationErrors[i][0]);return}if(s.data.message){this.$buefy.toast.open({message:s.data.message,type:"is-danger"});return}this.tabs.transactions.modal.add.rfp.navigateToRFP(s.data)}).catch(s=>{}).finally(s=>{this.tabs.transactions.modal.add.rfp.loading=!1})},errors:{name:null,rfp_number:null,project_type:null,proposal_type:null,url_to_rfx:null,is_erate:null,is_sled:null,solution_due_date:null,qa_due_date:null},resetError:e=>{this.tabs.transactions.modal.add.rfp.errors[e]=null},resetAllErrors:()=>{for(const e in this.tabs.transactions.modal.add.rfp.errors)this.tabs.transactions.modal.add.rfp.resetError(e)},validate:{all:()=>{const t=Object.keys(this.tabs.transactions.modal.add.rfp.validate).filter(a=>a!=="all");let s=!0;return t.forEach(a=>{this.tabs.transactions.modal.add.rfp.validate[a]()||(s=!1)}),s},name:()=>{const e=this.tabs.transactions.modal.add.rfp.data.name.trim()==="";return e&&(this.tabs.transactions.modal.add.rfp.errors.name="This field cannot be empty"),!e},project_type:()=>{const e=this.tabs.transactions.modal.add.rfp.data.project_type===null;return e&&(this.tabs.transactions.modal.add.rfp.errors.project_type="This field cannot be empty"),!e},proposal_type:()=>{const e=this.tabs.transactions.modal.add.rfp.data.proposal_type===null;return e&&(this.tabs.transactions.modal.add.rfp.errors.proposal_type="This field cannot be empty"),!e},url_to_rfx:()=>{const e=this.tabs.transactions.modal.add.rfp.data.url_to_rfx.trim()==="";return e&&(this.tabs.transactions.modal.add.rfp.errors.url_to_rfx="This field cannot be empty"),!e},is_erate:()=>{const e=this.tabs.transactions.modal.add.rfp.data.is_erate===null;return e&&(this.tabs.transactions.modal.add.rfp.errors.is_erate="This field cannot be empty"),!e},rfp_number:()=>!0,is_sled:()=>{const e=this.tabs.transactions.modal.add.rfp.data.is_sled===null;return e&&(this.tabs.transactions.modal.add.rfp.errors.is_sled="This field cannot be empty"),!e},solution_due_date:()=>{const e=this.tabs.transactions.modal.add.rfp.data.solution_due_date===null;return e&&(this.tabs.transactions.modal.add.rfp.errors.solution_due_date="This field cannot be empty"),!e}},navigateToRFP:e=>{window.open("/i/Explorers/RFP/"+e.id,"_self")}},sow:{active:!1,saving:!1,templates:{filtered:[],loading:!1,options:[],value:null,debounce:_.debounce(e=>{this.tabs.transactions.modal.add.sow.templates.typing(e)},600),input:e=>{this.tabs.transactions.modal.add.sow.hasError.template_id=!1},select:e=>{this.tabs.transactions.modal.add.sow.templates.value=e,this.tabs.transactions.modal.add.sow.form.template_id=e.id},typing:e=>{if(this.$emptyString(e))this.tabs.transactions.modal.add.sow.templates.filtered=[];else{let t={page:1,per_page:30,tab:"template",template_name:e};return axios.post("/api/Explorers/SOWs/Search",t).then(s=>{this.tabs.transactions.modal.add.sow.templates.filtered=s.data.results.rows}).catch(s=>{}).finally(s=>{})}}},sows:{filtered:[],loading:!1,options:[],value:null,debounce:_.debounce(e=>{this.tabs.transactions.modal.add.sow.sows.typing(e)},600),input:e=>{this.tabs.transactions.modal.add.sow.hasError.sow_id=!1},select:e=>{this.tabs.transactions.modal.add.sow.sows.value=e,this.tabs.transactions.modal.add.sow.form.sow_id=e.id},typing:e=>{if(this.$emptyString(e))this.tabs.transactions.modal.add.sow.sows.filtered=[];else{let t={page:1,per_page:100,title_or_deal_recid:e};return axios.post("/api/Explorers/SOWs/Search",t).then(s=>{this.tabs.transactions.modal.add.sow.sows.filtered=s.data.results.rows}).catch(s=>{}).finally(s=>{})}}},form:{default:()=>{this.$set(this.tabs.transactions.modal.add.sow.form,"creation_configuration","none"),this.$set(this.tabs.transactions.modal.add.sow.form,"sow_id",null),this.$set(this.tabs.transactions.modal.add.sow.form,"template_id",null)}},hasError:{default:()=>{this.$set(this.tabs.transactions.modal.add.sow.hasError,"creation_configuration",!1),this.$set(this.tabs.transactions.modal.add.sow.hasError,"sow_id",!1),this.$set(this.tabs.transactions.modal.add.sow.hasError,"template_id",!1)},valid:()=>(this.tabs.transactions.modal.add.sow.hasError.creation_configuration=_.isNil(this.tabs.transactions.modal.add.sow.form.creation_configuration),this.tabs.transactions.modal.add.sow.form.creation_configuration=="template_id"?this.tabs.transactions.modal.add.sow.hasError.template_id=_.isNil(this.tabs.transactions.modal.add.sow.form.template_id):this.tabs.transactions.modal.add.sow.hasError.template_id=!1,this.tabs.transactions.modal.add.sow.form.creation_configuration=="sow_id"?this.tabs.transactions.modal.add.sow.hasError.
1sow_id=_.isNil(this.tabs.transactions.modal.add.sow.form.sow_id):this.tabs.transactions.modal.add.sow.hasError.sow_id=!1,!this.tabs.transactions.modal.add.sow.hasError.creation_configuration&&!this.tabs.transactions.modal.add.sow.hasError.template_id&&!this.tabs.transactions.modal.add.sow.hasError.sow_id)},close:()=>{this.tabs.transactions.modal.add.sow.form.default(),this.tabs.transactions.modal.add.sow.hasError.default(),this.tabs.transactions.modal.add.sow.active=!1},show:()=>{this.tabs.transactions.modal.add.sow.form.default(),this.tabs.transactions.modal.add.sow.hasError.default(),this.tabs.transactions.modal.add.sow.active=!0},submit:()=>{this.tabs.transactions.modal.add.sow.hasError.valid()&&(this.tabs.transactions.modal.add.sow.saving=!0,axios.post("/api/Explorers/SOWs/"+this.opportunity_recid,this.tabs.transactions.modal.add.sow.form).then(e=>{this.tabs.transactions.modal.add.sow.saving=!1,this.tabs.transactions.modal.add.sow.close(),this.deal.data.sow=e.data.sow,this.deal.data.sow.current_object=e.data.sow_object,window.open("/i/Explorers/SOWs/Wizard/"+e.data.sow.id,"_self")}).catch(e=>{}).finally(e=>{}))}}}},types:{options:[],get:()=>axios.get("/api/Explorers/Deals/"+this.opportunity_recid+"/Transactions?option=types").then(e=>{this.tabs.transactions.types.options=e.data.types}).catch(e=>{this.tabs.transactions.types.options=[]}),normalize:e=>e.toLowerCase().replace(" ","_")},canShow:(e,t)=>e=="quotes"&&t.hasOwnProperty("published_pdf_url")?!this.$emptyString(t.published_pdf_url):e!="rfps",cardLabel:e=>(e=e=="sows_refactor"?"sows":e,e==="rfps"?"RFP":e=="sows"?"SOW":e.substring(0,e.length-1).replace(/_/g," ").split(" ").map(t=>t[0].toUpperCase()+t.substring(1)).join(" ")),cardLabelColor:e=>"text-primary-400 hover:text-primary-700",cardTitle:(e,t)=>{switch(e){case"agreements":return"Agreement #"+t.AGR_Header_RecID;case"invoices":return"Invoice #"+t.Invoice_Number;case"orders":return"Order #"+t.Order_Header_RecID;case"projects":return t.Project_ID;case"purchase_orders":return"Purchase Order #"+t.PO_Number;case"quotes":return t.quote_name;case"services":return t.Summary;case"sows":return t.title;case"sows_refactor":return t.current_object.title;case"rfps":return"RFP: "+t.name}},edit:(e,t)=>{switch(e){case"quotes":window.open("https://compunet.quosalsell.com/QuosalWeb/login.quosalweb?quotenum="+parseInt(t.quote_readable_id)+"&accesskey=compunet_azure&submodules=quote.home","_blank");break;case"sows":window.open("/i/SOWWorksheet/Wizard/"+t.id,"_blank");break;case"sows_refactor":window.open("/i/Explorers/SOWs/Wizard/"+t.id,"_blank");break}},isViewing:e=>{e=this.tabs.transactions.types.normalize(e);let t=this.tabs.transactions.types.normalize(this.tabs.transactions.filter.type),s=t===e||t==="all";return["sows_refactor","sows"].includes(e)&&["sows_refactor","sows"].includes(t)&&(s=!0),s},get:()=>(this.tabs.transactions.loading=!0,Promise.all([this.tabs.transactions.data.get(),this.tabs.transactions.types.get()]).then(e=>{this.tabs.transactions.loading=!1}).catch(e=>{this.tabs.transactions.loading=!1})),iconClass:e=>{let t=this.tabs.transactions.isViewing(e),s="";return e==="All"||this.tabs.transactions.length(e)>0?s=t?"text-primary-600":"text-primary-300 hover:text-primary-600":s="cursor-default text-gray-300",s},iconClick:e=>{e==="All"?this.tabs.transactions.filter.type=e:this.tabs.transactions.filter.type=this.tabs.transactions.length(e)?e:null},iconName:e=>{switch(e){case"Agreements":case"agreements":return"agreement";case"Invoices":case"invoices":return"invoice";case"orders":case"Orders":return"order";case"projects":case"Projects":return"project";case"Purchase Orders":case"purchase_orders":return"purchase-order";case"Quotes":case"quotes":return"quote";case"Services":case"services":return"service";case"sows":case"SOWs":case"SOWs Refactor":case"sows_refactor":return"sow";case"rfps":case"RFPs":return"newspaper"}},length:e=>{let t=this.tabs.transactions.types.normalize(e);return t=="sows"||t=="sows_refactor"?this.tabs.transactions.data.options.sows.length+this.tabs.transactions.data.options.sows_refactor.length:this.tabs.transactions.data.options[this.tabs.transactions.types.normalize(e)].length},show:(e,t)=>{switch(e){case"agreements":window.open("/i/Explorers/Agreements/"+t.AGR_Header_RecID,"_blank");break;case"invoices":window.open("/i/Explorers/Invoices/"+t.Invoice_Number,"_blank");break;case"orders":window.open("/i/Explorers/Orders/"+t.Order_Header_RecID,"_blank");break;case"projects":window.open("/i/Explorers/Projects/"+t.PM_Project_RecID,"_blank");break;case"purchase_orders":window.open("/i/Explorers/PurchaseOrders/"+t.PO_Number,"_blank");break;case"quotes":this.tabs.transactions.viewLoading=!0,axios.get("/api/Explorers/Deals/"+this.opportunity_recid+"/Quotes/"+t.idQuote_Main).then(s=>{s.data.pdf_url?window.open(s.data.pdf_url,"_blank"):s.data.viewable?window.open(t.published_pdf_url,"_blank"):this.$buefy.dialog.alert({title:"Quote PDF",message:`<p class="content">This quote does not currently have a PDF and needs to be refreshed in Quosal.</p><p class="content">Please contact the account manager and let them know they need to refresh the quote's PDF in Quosal.</p>`,confirmText:"OK",type:"is-success"}),this.tabs.transactions.viewLoading=!1});break;case"services":break;case"sows":window.open("/i/SOWWorksheet/Document/"+t.id,"_blank");break;case"sows_refactor":window.open("/i/Explorers/SOWs/Document/"+t.id,"_blank");break;case"rfps":window.open("/i/Explorers/RFP/"+t.id,"_blank");break}},setPrimaryQuote:e=>{this.$buefy.dialog.confirm({message:"Are you sure you want to set this quote as the primary?",confirmText:"Yes",type:"is-danger",onConfirm:()=>axios.put(`/api/Explorers/Deals/${this.opportunity_recid}/Quotes/Primary`,{quote_readable_id:e}).then(t=>
1{this.$buefy.toast.open({message:"Success!",type:"is-success"})}).catch(t=>{}).finally(t=>{this.deal.get(),this.tabs.transactions.get()})})},remove:(e,t)=>{switch(e){case"agreements":case"invoices":case"orders":case"projects":case"purchase_orders":case"quotes":case"services":break;case"sows":case"sows_refactor":this.$buefy.dialog.confirm({title:"Deleting SOW",message:"Are you sure you want to <b>delete</b> this SOW?",confirmText:"Delete SOW",type:"is-danger",hasIcon:!0,onConfirm:()=>{var s=e=="sows_refactor"?"/api/Explorers/SOWs/DeleteSOW/":"/api/SOWWorksheetTool/DeleteSOW/";return axios.get(s+t.id).then(a=>{this.$buefy.toast.open("SOW deleted!")}).catch(a=>{}).finally(a=>{this.tabs.transactions.get()})}});break}}}},tags:{active:!1,data:{selected_tags:null},hasError:{},saving:!1,loading:!1,modal:{filter_type:"All",filtered_tags:null},_load:(e=null)=>(this.tags.loading=!0,axios.post(`/api/Explorers/Deals/Tags/${this.opportunity_recid||""}`,{input:e}).then(t=>{this.tags.modal.filtered_tags=t.data.tags}).catch(t=>{this.tags.modal.filtered_tags=[]}).finally(t=>{this.tags.loading=!1})),update:e=>{this.tags.saving=!0,axios.patch("/api/Explorers/Deals/Tags/"+this.opportunity_recid,e).then(t=>{this.deal.data.tags=t.data}).catch(t=>{}).finally(t=>{this.tags.saving=!1,this.tags.close()})},close:()=>{this._resetData(this.tags.modal),this._resetData(this.tags.data),this._resetErrors(this.tags.hasError),this.tags.modal.filter_type="All",this.tags.active=!1,this.tags.edit=!1},filter:_.debounce(e=>this.tags._load(e),700),remove:()=>{this.$buefy.dialog.confirm({title:"Remove Tag",message:"Are you sure you want to remove this tag?",cancelText:"No",confirmText:"Yes",type:"is-success",onConfirm:()=>{this.tags._delete()}})},show:(e=null,t=null)=>{this._resetErrors(this.tags.hasError),this.tags._load(),this.tags.data.selected_tags=_.cloneDeep(this.deal.data.tags),this.tags.active=!0},submit:()=>{if(!this.tags.data.selected_tags)return!1;var e={};e.tag_ids=this.tags.data.selected_tags.map(function(t,s){return t.id}),this.tags.update(e)}}}},beforeMount(){this.tabs.products.load(),Promise.all([this.deal.get(),this.tabs.transactions.get()]).then(()=>{this.deal_relationship_groups.init(this.deal.data.Opportunity_RecID,this.deal.data.Company_RecID,this.deal.data.Opportunity_Name),axios.all([this.tabs.team.get(),this.wizard.form.surveys.services.load(),this.wizard.form.surveys.quote_details.load()]).then(()=>{Moment(this.deal.data.Date_Became_Lead).isAfter(Moment().subtract(30,"seconds"))?setTimeout(()=>{axios.all([this.tabs.team.deal.get()]).then(()=>{this.tabs.team.assertValidTeam()})},3500):this.tabs.team.assertValidTeam()})})},computed:{age(){if(this.deal.data){let e=Moment(this.deal.data.Date_Became_Lead,"MM/DD/YYYY h:mm A"),s=Moment().diff(e,"days");return`${s} day`+(s==1?"":"s")}return null},business_unit(){var e,t;return(t=(e=this.deal.data)==null?void 0:e.billing_unit)==null?void 0:t.Description},campaign_name(){var e,t;return(t=(e=this.deal.data)==null?void 0:e.marketing_campaign)==null?void 0:t.Marketing_ID},close_date(){var t,s,a;let e=null;return this.deal&&((t=this.deal.data)!=null&&t.Date_Close_Expected?e=(s=this.deal.data)==null?void 0:s.Date_Close_Expected:e=(a=this.deal.data)==null?void 0:a.Date_Closed,e)?Moment(e).format("ddd MM/DD/YYYY"):e},company_address(){var t,s,a,r,i,o,l,d,m,u;let e="";return this.deal&&(t=this.deal.data)!=null&&t.company_address&&(_.isNil((s=this.deal.data)==null?void 0:s.company_address.Site_Name)||(e=((a=this.deal.data)==null?void 0:a.company_address.Site_Name)+"<br/>"),_.isNil((r=this.deal.data)==null?void 0:r.company_address.Address_Line1)||(e+=((i=this.deal.data)==null?void 0:i.company_address.Address_Line1)+"<br/>"),_.isNil((o=this.deal.data)==null?void 0:o.company_address.Address_Line2)||(e+=((l=this.deal.data)==null?void 0:l.company_address.Address_Line2)+"<br/>"),e+=`${(d=this.deal.data)==null?void 0:d.company_address.City}, ${(m=this.deal.data)==null?void 0:m.company_address.State_ID} ${(u=this.deal.data)==null?void 0:u.company_address.Zip}`),_.isEmpty(e)?null:e},company_name(){var e,t;return(t=(e=this.deal.data)==null?void 0:e.company)==null?void 0:t.Company_Name},contact_name(){var e,t,s,a,r;return(e=this.deal.data)!=null&&e.contact&&!_.isEmpty((t=this.deal.data)==null?void 0:t.contact.First_Name)&&!_.isEmpty((s=this.deal.data)==null?void 0:s.contact.Last_Name)?((a=this.deal.data)==null?void 0:a.contact.First_Name)+" "+((r=this.deal.data)==null?void 0:r.contact.Last_Name):null},contact_email(){var e,t;return(t=(e=this.deal.data)==null?void 0:e.contact)==null?void 0:t.Default_Email},contact_phone(){var e,t;return(t=(e=this.deal.data)==null?void 0:e.contact)==null?void 0:t.Default_Phone},contact_address(){var e,t;return this.getAddress((t=(e=this.deal)==null?void 0:e.data)==null?void 0:t.contact)},deal_notes(){var e,t,s;return(s=(t=(e=this.deal.data)==null?void 0:e.notes_survey)==null?void 0:t.data)==null?void 0:s.deal_notes},empty_transactions(){for(let e in this.tabs.transactions.data.options)if(this.tabs.transactions.data.options[e].length>0)return!1;return!0},hasDeal(){return!!this.deal.data},hasSelectableCompMemberships(){return!_.isEmpty(this.tabs.comp.modal.member.members.get())},hasRegistrationSurvey(){var e;return((e=this.deal.data)==null?void 0:e.registration_survey)===null?null:this.deal.data.registration_survey.data.hasRegistration},hasSelectableTeamMemberships(){return!_.isEmpty(this.tabs.team.modal.member.findSelectableMemberships())},hasPresalesTeamMembers(){return!_.isEmpty(this.tabs.team.deal.presales_engineers.options)},hasServicesSurvey(){var e;return((e=this.deal.data)==null?void 0:e.services_survey)===null?null:this.deal.data.services_survey.data.hasServices},location(){var e,t;return(t=(e=this.deal.data)==null?void 0:e.owner)==null?void 0:t.Description},probability_icon_color(){var t,s,a,r;let e="text-gray-400";return((t=this.deal.data)==null?void 0:t.Probability_to_Close)>=70?e="text-success-500":((s=this.deal.data)==null?void 0:s.Probability_to_Close)<=69&&((a=this.deal.data)==null?void 0:a.Probability_to_Close)>=30?e="text-warn-500":((r=this.deal.data)==null?void 0:r.Probability_to_Close)<=29&&(e="text-stop-500"),e},probability(){var e;return`${(e=this.deal.data)==null?void 0:e.Probability_to_Close}%`},rating_icon_color(){var t,s,a,r,i,o;let e="text-gray-400";return((s=(t=this.deal.data)==null?void 0:t.interest)==null?void 0:s.Description)=="Hot"||((r=(a=this.deal.data)==null?void 0:a.interest)==null?void 0:r.Description)=="Medium"?e="text-warn-500":((o=(i=this.deal.data)==null?void 0:i.interest)==null?void 0:o.Description)=="Cold"&&(e="text-primary-400"),e},rating(){var e,t;return(t=(e=this.deal.data)==null?void 0:e.interest)==null?void 0:t.Description},source(){var e;return(e=this.deal.data)==null?void 0:e.Source},status_icon_color(){var t,s,a,r;let e="text-gray-400";return((s=(t=this.deal.data)==null?void 0:t.status)==null?void 0:s.Won_Flag)=="1"?e="text-success-500":((r=(a=this.deal.data)==null?void 0:a.status)==null?void 0:r.Lost_Flag)=="1"&&(e="text-stop-500"),e},status(){var e,t;return(t=(e=this.deal.data)==null?void 0:e.status)==null?void 0:t.Description},timeAndExpenseSelections(){var t;let e=null;return(t=this.deal.data)!=null&&t.company&&(e={customer:{Company_Name:this.deal.data.company.Company_Name,Company_RecID:this.deal.data.company.Company_RecID},transaction:this.deal.data}),e},total_transactions(){let e=0;return Object.values(this.tabs.transactions.data.options).forEac
1h(t=>{e+=t.length}),e},isPresalesDisabled(){var e,t;return!_.isNil((e=this.deal.data.deal_details)==null?void 0:e.has_presales_reason)&&((t=this.deal.data.deal_details)==null?void 0:t.has_presales_reason)!="Yes"},isCreating(){return!this.opportunity_recid},filteredOwner(){const e=this.tabs.transactions.modal.add.rfp.data.ownerName;if(e)return this.options.active_users.filter(t=>t.name.toLowerCase().indexOf(e.toLowerCase())>=0)},canAddSOW(){var e,t,s,a;return(t=(e=this.deal.data.tsb_survey)==null?void 0:e.data)!=null&&t.hasTSB||this.deal.data.status.Description=="Moved - Archived"?!1:!((s=this.deal.data.sow)!=null&&s.id||(a=this.deal.data.sow1)!=null&&a.id)},canTransferArtifacts(){return this.accessDealArtifactsTransfer&&this.deal.data.status.Description=="Open"},canDeleteDeal(){var e;return this.user.username.toLowerCase()==((e=this.deal.data.Entered_By)==null?void 0:e.toLowerCase())||this.isSuperAdmin},isQuickCreating(){return!!this.wizard.quick_create_enabled}},methods:{_resetErrors(e){Object.keys(e).forEach(t=>{e[t]=!1})},_validate(e,t){let s=!0;return e==="team"?Object.keys(t).forEach(a=>{t[a]=_.isNull(this.tabs.team.modal.member.form[a])}):e==="comp"&&Object.keys(t).forEach(a=>{a==="member"?t[a]=_.isNull(this.tabs.comp.modal.member.form[a]):a==="percentage"&&(this.tabs.comp.modal.member.form.percentage<0||this.tabs.comp.modal.member.form.percentage>100)&&(t.percentage=!0)}),Object.values(t).forEach(a=>{a&&(s=!1)}),s},getAddress(e){let t="";return e&&(this.$emptyString(e.Address_Line1)||(t+=e.Address_Line1+"<br/>"),this.$emptyString(e.Address_Line2)||(t+=e.Address_Line2+"<br/>"),!this.$emptyString(e.City)&&!this.$emptyString(e.State_ID)&&!this.$emptyString(e.Zip)&&(t+=`${e.City}, ${e.State_ID} ${e.Zip}`)),_.isEmpty(t)?null:t},defaultMemberPhoto(){return"this.onerror=null;this.src='/images/profile_icon.jpg'"},display(e,t=null){return e?`<span class="text-gray-900">${e}</span>`:t?`<span class="text-gray-400"><i class="italic">No ${t} Found</i></span>`:""},memberPhoto(e=null){if(e){for(let t=0;t<e.length;t++)if(e[t].size=="small")return e[t].path+e[t].name}return"/images/profile_icon.jpg"},_resetData(e){Object.keys(e).forEach(t=>{e[t]=null})},onFavoriteClick(){axios.post("/api/Explorers/Deals/Favorites/Toggle",{opportunity_recid:this.deal.data.Opportunity_RecID}).then(e=>{this.deal.data.favorite=e.data.user_favorites_id,this.$buefy.toast.open({message:"Deal "+(e.data.user_favorites_id?" favorited!":" is no longer marked as a favorite."),type:"is-success",duration:2250})}).catch(e=>{this.$buefy.toast.open({message:"There was an error changing this favorite.",type:"is-danger",duration:2250})}).finally(e=>{})},salesStageCurrent(e){return e.Seq_Nbr==this.deal.data.pipeline.Seq_Nbr},salesStageCompleted(e){return e.Seq_Nbr<this.deal.data.pipeline.Seq_Nbr},salesStageUpcoming(e){return e.Seq_Nbr!=this.deal.data.pipeline.Seq_Nbr&&e.Seq_Nbr>this.deal.data.pipeline.Seq_Nbr},showTimeAndExpenseModal(e,t=null){this.$refs.componentsTimeAndExpense.showModal(e,t)},copy(){window.open(`/i/Explorers/Deals/Create?source_recid=${this.opportunity_recid}`)},openOnboard(){var t,s,a;let e={customer_name:(a=(s=(t=this.deal)==null?void 0:t.data)==null?void 0:s.company)==null?void 0:a.Company_RecID};window.open(`/i/Tools/CorporateServiceCatalog?item=51&request=true&prefilledValues=${JSON.stringify(e)}`,"_self")},rfpFormValidation(e){this.tabs.transactions.modal.add.rfp.resetError(e),this.tabs.transactions.modal.add.rfp.validate[e]()},formatDate(e){return e?e.toISOString():""},convertToLocalTime(e){if(!e)return"No date provided";const t=["YYYY-MM-DD HH:mm:ss.SSS","YYYY-MM-DD HH:mm:ss","YYYY-MM-DD","MM/DD/YYYY","MM-DD-YYYY"],s=Moment.utc(e,t,!0).local();return s.isValid()?s.format("MM/DD/YYYY"):"Invlid Date"},debounceLoadAsyncTags:_.debounce(function(){this.tags._load()},500)},props:["opportunity_recid","options","user","accessDealRevenueForecasting","accessSOWApprovalCancel","accessDealArtifactsTransfer","isSuperAdmin"]},b=null,w=null;var z=v(y,b,w,!1,null,null);const D=z.exports;export{D as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.