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.10";import{aQ as _,W as f,X as y,ab as h,ay as v,a5 as g,a9 as w,aa as C,Z as j,J as $,az as k,Y as b,a0 as x,av as A}from"../../../../vendor.js?ver=3.1.10";import{C as T}from"../../../../CompanyInfoSide.js?ver=3.1.10";import{P as q}from"../../../../PageHeader.js?ver=3.1.10";import{C as B}from"../../../../Confirm2.js?ver=3.1.10";import{_ as D}from"../../../../fc-bits-ui.js?ver=3.1.10";import"../../../../data_config.js?ver=3.1.10";import"../../../../CompanyEditForm.js?ver=3.1.10";import"../../../../fc-bits.js?ver=3.1.10";import"../../../../BaseCard.js?ver=3.1.10";const E={class:"fluentcrm-campaigns fluentcrm-view-wrapper fluentcrm_view"},P={key:0,class:"fcrm_view_company_wrapper"},z={key:1};const H=D({name:"ViewCompany",props:["company_id"],components:{PageHeader:q,Confirm:B,ArrowDown:a,CompanyInfoSide:T},data(){return{ArrowRightBold:A(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,A,T,q,B){const D=m,H=i,V=_("ArrowDown"),I=s,R=o,S=_("confirm"),W=n,Y=t,Z=e,F=_("page-header"),J=d,Q=l,X=_("router-view"),G=r,K=_("company-info-side"),L=c,M=p;return f(),y("div",E,[q.company?(f(),y("div",P,[h(F,null,v({breadcrumb:g(()=>[h(H,{"separator-icon":q.ArrowRightBold},{default:g(()=>[h(D,{to:{name:"companies"}},{default:g(()=>[w(C(a.$t("Companies")),1)],void 0,!0),_:1}),h(D,null,{default:g(()=>[w(C(q.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:g(()=>[h(Z,{size:"small",trigger:"click","popper-class":"fcrm_action_dropdown_menu"},{dropdown:g(()=>[h(Y,null,{default:g(()=>[h(W,{class:"fc_dropdown_action"},{default:g(()=>[h(S,{placement:"top-start",message:a.$t("Are you sure you want to delete this company?"),onYes:u[0]||(u[0]=a=>B.deleteCompany())},{reference:g(()=>[j("span",null,C(a.$t("Delete Company")),1)]),_:1},8,["message"])],void 0,!0),_:1})],void 0,!0),_:1})]),default:g(()=>[h(R,{size:"small",class:"el-dropdown-link"},{default:g(()=>[w(C(a.$t("Actions"))+" ",1),h(I,{class:"el-icon--right"},{default:g(()=>[h(V)],void 0,!0),_:1})],void 0,!0),_:1})],void 0,!0),_:1})]),key:"0"}:void 0]),1024),h(L,{gutter:24,class:"fcrm_view_company_content"},{default:g(()=>[h(G,{lg:18,md:16,sm:24,xs:24},{default:g(()=>[h(Q,{router:!0,"default-active":q.activeTab,class:"fcrm_segment_menu"},{default:g(()=>[(f(!0),y($,null,k(q.menu_items,(a,e)=>(f(),b(J,{class:x("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:g(()=>[j("span",null,C(a.title),1)],void 0,!0),_:2},1032,["class","route","index"]))),128))],void 0,!0),_:1},8,["default-active"]),h(X,{company_id:A.company_id,company:q.company},null,8,["company_id","company"])],void 0,!0),_:1}),h(G,{lg:6,md:8,sm:24,xs:24},{default:g(()=>[j("div",null,[h(K,{company:q.company},null,8,["company"])])],void 0,!0),_:1})],void 0),_:1})])):(f(),y("div",z,[h(L,{gutter:30},{default:g(()=>[h(G,{lg:6,md:8,sm:24,xs:24},{default:g(()=>[h(M,{class:"fcrm_skeleton_loader",animated:!0,rows:25})],void 0,!0),_:1}),h(G,{lg:18,md:16,sm:24,xs:24},{default:g(()=>[h(M,{class:"fcrm_skeleton_loader",animated:!0,rows:10})],void 0,!0),_:1})],void 0),_:1})]))])}]]);export{H as default};
