import{at as a,j as e,k as o,E as s,h as t,i as n,a_ as i,aZ as m,aA as r,aV as l,aW as d,aD as c,aB as p,ap as u}from"../../../../vendor-element-plus.js?ver=3.1.0";import{C as _}from"../../../../CompanyInfoSide.js?ver=3.1.0";import{P as f}from"../../../../PageHeader.js?ver=3.1.0";import{C as y}from"../../../../Confirm2.js?ver=3.1.0";import{r as h,c as v,o as g,d as w,aR as C,w as j,O as $,P as k,b,Q as x,as as A,a as P,n as T,bk as q}from"../../../../vendor.js?ver=3.1.0";import{_ as B}from"../../../../fc-bits-ui.js?ver=3.1.0";import"../../../../data_config.js?ver=3.1.0";import"../../../../CompanyEditForm.js?ver=3.1.0";import"../../../../fc-bits.js?ver=3.1.0";import"../../../../BaseCard.js?ver=3.1.0";const D={class:"fluentcrm-campaigns fluentcrm-view-wrapper fluentcrm_view"},E={key:0,class:"fcrm_view_company_wrapper"},H={key:1};const R=B({name:"ViewCompany",props:["company_id"],components:{PageHeader:f,Confirm:y,ArrowDown:a,CompanyInfoSide:_},data(){return{ArrowRightBold:q(u),company:null,loading:!1,updating:!1,show_profile:!0,menu_items:window.fcAdmin.company_profile_sections,activeTab:this.$route.name}},watch:{company_id(){this.company=null,this.fetchCompany()}},methods:{setup(a){this.company=a,this.changeTitle(a.name+" - Company")},fetchCompany(){this.loading=!0,this.show_profile=!1,this.$get("companies/"+this.company_id).then(a=>{this.setup(a.company)}).catch(a=>{this.handleError(a)}).finally(()=>{this.loading=!1})},deleteCompany(){this.loading=!0,this.$del(`companies/${this.company_id}`).then(a=>{this.$notify.success(a.message),this.$router.push({name:"companies"})}).catch(a=>{this.handleError(a)}).finally(()=>{this.loading=!1})},maybeCustomHandler(a){"fluentcrm_company_profile_extended"==a.name&&(this.show_profile=!1,setTimeout(()=>{this.show_profile=!0},100))}},mounted(){this.fetchCompany(),this.changeTitle(this.$t("View Company"))}},[["render",function(a,u,_,f,y,q){const B=m,R=i,V=h("ArrowDown"),z=s,I=o,S=h("confirm"),F=n,O=t,Q=e,W=h("page-header"),Y=d,Z=l,G=h("router-view"),J=r,K=h("company-info-side"),L=c,M=p;return g(),v("div",D,[y.company?(g(),v("div",E,[w(W,null,C({breadcrumb:j(()=>[w(R,{"separator-icon":y.ArrowRightBold},{default:j(()=>[w(B,{to:{name:"companies"}},{default:j(()=>[$(k(a.$t("Companies")),1)],void 0,!0),_:1}),w(B,null,{default:j(()=>[$(k(y.company.name),1)],void 0,!0),_:1})],void 0,!0),_:1},8,["separator-icon"])]),_:2},[a.hasPermission("fcrm_manage_contact_cats_delete")?{name:"actions",fn:j(()=>[w(Q,{size:"small",trigger:"click","popper-class":"fcrm_action_dropdown_menu"},{dropdown:j(()=>[w(O,null,{default:j(()=>[w(F,{class:"fc_dropdown_action"},{default:j(()=>[w(S,{placement:"top-start",message:a.$t("Are you sure you want to delete this company?"),onYes:u[0]||(u[0]=a=>q.deleteCompany())},{reference:j(()=>[b("span",null,k(a.$t("Delete Company")),1)]),_:1},8,["message"])],void 0,!0),_:1})],void 0,!0),_:1})]),default:j(()=>[w(I,{size:"small",class:"el-dropdown-link"},{default:j(()=>[$(k(a.$t("Actions"))+" ",1),w(z,{class:"el-icon--right"},{default:j(()=>[w(V)],void 0,!0),_:1})],void 0,!0),_:1})],void 0,!0),_:1})]),key:"0"}:void 0]),1024),w(L,{gutter:24,class:"fcrm_view_company_content"},{default:j(()=>[w(J,{lg:18,md:16,sm:24,xs:24},{default:j(()=>[w(Z,{router:!0,"default-active":y.activeTab,class:"fcrm_segment_menu"},{default:j(()=>[(g(!0),v(x,null,A(y.menu_items,(a,e)=>(g(),P(Y,{class:T("fcrm_item_"+a.name+" "+(a.item_class||"")),route:{name:a.name,query:a.query},key:e,index:a.query?a.query.handler:a.name},{default:j(()=>[b("span",null,k(a.title),1)],void 0,!0),_:2},1032,["class","route","index"]))),128))],void 0,!0),_:1},8,["default-active"]),w(G,{company_id:_.company_id,company:y.company},null,8,["company_id","company"])],void 0,!0),_:1}),w(J,{lg:6,md:8,sm:24,xs:24},{default:j(()=>[b("div",null,[w(K,{company:y.company},null,8,["company"])])],void 0,!0),_:1})],void 0),_:1})])):(g(),v("div",H,[w(L,{gutter:30},{default:j(()=>[w(J,{lg:6,md:8,sm:24,xs:24},{default:j(()=>[w(M,{class:"fcrm_skeleton_loader",animated:!0,rows:25})],void 0,!0),_:1}),w(J,{lg:18,md:16,sm:24,xs:24},{default:j(()=>[w(M,{class:"fcrm_skeleton_loader",animated:!0,rows:10})],void 0,!0),_:1})],void 0),_:1})]))])}]]);export{R as default};
