1import{d as K,h as O,s as W,i as m,j,J as G,k as q,_ as Q,r as u,o as c,c as v,b as t,t as f,a as s,m as P,K as X,w as $,l as T,g as Y,u as Z,q as x,af as ee,aj as oe,N as F,ae as z,M as D,L as ne}from"./index-0dd53362.js";import{T as te}from"./TelInput-75900473.js";import{S as ae}from"./SettingsSaveBar-d01ef332.js";import{C as se}from"./ConfirmModal-14e0d682.js";import{P as le}from"./PlacesAutocomplete-ff56a57e.js";import{C as ie}from"./ChartStatistic-e4e96e1a.js";import{p as re,n as me}from"./helpers-12e6c486.js";const de=K({name:"SubscriptionInformation",components:{ChartStatistic:ie,HButton:O},setup(){const e=W(),o=m([]),r=j(()=>{var l;return(l=e.teamSubscription)==null?void 0:l.team_subscription_plan}),w=j(()=>{var b,i;let l=(b=r==null?void 0:r.value)==null?void 0:b.name.toLowerCase();return e.isDemoAccount?l="Demo":e.trial?l="Free Trial":!e.trialEnded&&!e.isFreePlan&&(l=`${(i=r==null?void 0:r.value)==null?void 0:i.name.toLowerCase()} - Free Trial`),l}),I=()=>{q.get(`/teams/${e.teamHash}/subscription/info`).then(l=>{o.value=l.data.data})};return G(()=>e.teamSubscription,()=>{I()},{deep:!0}),I(),{subscriptionPlan:r,planName:w,subscriptionInformation:o,demo:e.isDemoAccount}}}),ue={class:"w-full bg-white rounded-lg py-10 px-9 md:pl-10 md:pr-5 mb-5"},pe={class:"w-full"},ce={class:"font-bold text-primary mb-5 text-sm mb-10"},fe={class:"text-black text-3xl sm:mb-3 font-bold capitalize"},be={key:0,class:"lg:mb-5 w-full"},ge={class:"text-sm font-medium text-primary mb-10 max-w-2xl w-full"},ve={class:"block"};function he(e,o,r,w,I,l){const b=u("ChartStatistic"),i=u("FontAwesomeIcon"),d=u("HButton");return c(),v("div",ue,[t("div",pe,[t("p",ce,f(e.$t("settings.subscription.subscriptionTitle")),1),t("h2",fe,f(e.planName),1),e.demo?P("",!0):(c(),v("div",be,[s(b,{statistic:e.subscriptionInformation},null,8,["statistic"])])),t("p",ge,f(e.$t("settings.subscription.subscriptionText")),1),e.demo?P("",!0):(c(),X(d,{key:1,variant:"yellow",size:"small",class:"flex items-center justify-between",onClick:o[0]||(o[0]=T(M=>e.$emit("openPlanSelectModal"),["prevent"]))},{default:$(()=>[t("span",ve,f(e.$t("settings.subscription.subscriptionButton")),1),s(i,{icon:["far","arrow-to-right"],class:"text-primary ml-1.5"})]),_:1}))])])}const ye=Q(de,[["render",he]]),J={company_name:"",registration_code:"",vat_code:"",address:"",phone:"",emails:[{emails:""}],bank_name:"",account_number:""},$e=K({name:"SubscriptionSettings",components:{SubscriptionInformation:ye,PlacesAutocomplete:le,HInput:Y,ConfirmModal:se,SettingsSaveBar:ae,TelInput:te,HButton:O},emits:["openPlanSelectModal"],setup(){const e=W(),o=Z(),r=m(!1),w=m(!1),I=m(!1),l=m({}),b=m(!1),i=m(!0),d=m({...J}),M=m({...J}),h=x(),A=m(""),k=m(!1),S=m(),g=m(!1),_=()=>{const a={emails:""};d.value.emails.push(a)},H=a=>{d.value.emails=d.value.emails.filter((p,y)=>y!==a)},R=()=>{r.value=!r.value},B=()=>{o.params.type==="upgrade"&&R()};q.get(`/teams/${e.teamHash}/settings/billing`).then(a=>{a.data.data.phone=re(a.data.data.phone);const p=a.data.data;p&&!p.emails&&(p.emails=[{emails:""}]),i.value=!p.company_name,M.value={...p},d.value={...p},g.value=!1}).finally(()=>{S.value=!0});const N=()=>{l.value={},q.put(`/teams/${e.teamHash}/settings/billing/update`,d.value).then(()=>{me(F.Success,"notifications.settings.billingInformationUpdated")}).catch(a=>{var p,y;l.value=(p=a==null?void 0:a.response)==null?void 0:p.data.errors,z(F.Error,`${(y=a==null?void 0:a.response)==null?void 0:y.data.message}`)})},L=()=>{q.post(`/teams/${e.teamHash}/subscription/cancel-subscription`).then(a=>{w.value=!1,z(F.Success,a.data.message)})},U=j(()=>{var a;return(a=e.teamSubscription)==null?void 0:a.team_subscription_plan.name}),E=()=>{b.value=!0},n=()=>{k.value=!0},V=()=>{g.value&&(d.value={...M.value},setTimeout(()=>{g.value=!1},50))},C=()=>{V(),setTimeout(()=>{k.value=!1,h.push(A.value)},60)};return ee((a,p,y)=>{g.value?(A.value=a.fullPath,y(!1),n()):y()}),G(()=>d.value,()=>{S.value&&(g.value=!0)},{deep:!0}),oe(B),{RemoveItem:H,AddEmailRow:_,openSubscriptionUpdate:R,upgradePlanView:B,saveSubscription:N,openPlanSelectModal:E,leavePage:C,resetChanges:V,cancelPlan:L,teamPlanName:U,clientHasChanged:g,showLeaveModal:k,billingInformation:d,errorResponse:l,showSubscriptionInformation:r,freePlan:I,disablePlanModal:w,showPlanSelectModal:b,firstTimeInformation:i,clientLoaded:S,demo:e.isDemoAccount}}}),we={key:0,class:"w-full bg-white rounded-lg py-10 px-9 md:pl-10 md:pr-5 mb-5"},Ie={class:"font-bold text-primary mb-5 text-sm"},Se={class:"mb-5 w-full max-w-2xl"},Ve={class:"grid grid-col-1 md:grid-cols-2 gap-5 w-full max-w-2xl mb-9"},Ce={class:"font-bold text-primary mb-5 text-sm"},Pe={class:"grid grid-col-1 md:grid-cols-2 gap-5 w-full max-w-2xl items-start mb-9"},Me={class:"flex items center h-12"},ke=t("span",{class:"font-medium text-xss text-grey-low ml-2.5"}," Add ",-1),Re=["onClick"],Be=t("span",{class:"font-medium text-xss text-grey-low ml-2.5"}," Remove ",-1),Te={class:"font-bold text-primary mb-5 text-sm"},Ae={class:"grid grid-col-1 md:grid-cols-2 gap-5 w-full max-w-2xl"},_e={key:1,class:"w-full bg-white rounded-lg py-10 px-9 md:pl-10 md:pr-5 mb-5"},He={class:"max-w-2xl w-full"},Ne={class:"font-bold text-primary mb-5 text-sm"},Le={class:"mb-3 text-primary text-sm font-medium"},Ue=["innerHTML"];function Ee(e,o,r,w,I,l){var _,H,R,B,N,L,U,E;const b=u("SubscriptionInformation"),i=u("HInput"),d=u("PlacesAutocomplete"),M=u("TelInput"),h=u("FontAwesomeIcon"),A=u("HButton"),k=u("SettingsSaveBar"),S=u("ConfirmModal"),g=u("ElDialog");return c(),v(D,null,[t("form",{class:"w-full settings-scroll-top",autocomplete:"off",onSubmit:o[10]||(o[10]=T((...n)=>e.saveSubscription&&e.saveSubscription(...n),["prevent"]))},[s(b,{onOpenPlanSelectModal:o[0]||(o[0]=n=>e.$emit("openPlanSelectModal"))}),!e.freePlan&&e.clientLoaded&&!e.demo?(c(),v("div",we,[t("p",Ie,f(e.$t("settings.subscription.billingInformation")),1),t("div",Se,[s(i,{variant:"grey",modelValue:e.billingInformation.company_name,"onUpdate:modelValue":o[1]||(o[1]=n=>e.billingInformation.company_name=n),name:"company_name",type:"text",required:"",placeholder:`${e.$t("placeholders.common.companyName")}`,error:(_=e.errorResponse)!=null&&_.company_name?e.errorResponse.company_name[0]:""},null,8,["modelValue","placeholder","error"])]),t("div",Ve,[s(i,{variant:"grey",modelValue:e.billingInformation.registration_code,"onUpdate:modelValue":o[2]||(o[2]=n=>e.billingInformation.registration_code=n),name:"registration_code",type:"text",required:"",placeholder:`${e.$t("placeholders.common.registrationCode")}`,error:(H=e.errorResponse)!=null&&H.registration_code?e.errorResponse.registration_code[0]:""},null,8,["modelValue","placeholder","error"]),s(i,{variant:"grey",modelValue:e.billingInformation.vat_code,"onUpdate:modelValue":o[3]||(o[3]=n=>e.billingInformation.vat_code=n),name:"vat_code",type:"text",required:"",placeholder:`${e.$t("placeholders.common.vatCode")}`,error:(R=e.errorResponse)!=null&&R.vat_code?e.errorResponse.vat_code[0]:""},null,8,["modelValue","placeholder","error"])]),t("p",Ce,f(e.$t("settings.subscription.billingContactInformation")),1),t("div",Pe,[s(d,{modelValue:e.billingInformation.address,"onUpdate:modelValue":o[4]||(o[4]=n=>
1e.billingInformation.address=n),name:"address",type:"text",required:"",placeholder:e.$t("placeholders.billing.billingAddress"),error:(N=(B=e.errorResponse)==null?void 0:B.address)==null?void 0:N[0]},null,8,["modelValue","placeholder","error"]),s(M,{modelValue:e.billingInformation.phone,"onUpdate:modelValue":o[5]||(o[5]=n=>e.billingInformation.phone=n),placeholder:`${e.$t("placeholders.billing.billingPhoneNumber")}`,variant:"grey",required:"",error:(L=e.errorResponse)!=null&&L.phone?e.errorResponse.phone[0]:""},null,8,["modelValue","placeholder","error"]),(c(!0),v(D,null,ne(e.billingInformation.emails,(n,V)=>(c(),v(D,{key:V},[s(i,{variant:"grey",type:"email",placeholder:`${e.$t("placeholders.billing.billingEmail")}`,modelValue:n.emails,"onUpdate:modelValue":C=>n.emails=C},null,8,["placeholder","modelValue","onUpdate:modelValue"]),t("div",Me,[t("button",{class:"flex items-center w-max mr-2.5",onClick:o[6]||(o[6]=T((...C)=>e.AddEmailRow&&e.AddEmailRow(...C),["prevent"]))},[s(h,{icon:"plus",class:"text-green"}),ke]),V>0?(c(),v("button",{key:0,class:"flex items-center w-max",onClick:T(C=>e.RemoveItem(V),["prevent"])},[s(h,{icon:"minus",class:"text-red"}),Be],8,Re)):P("",!0)])],64))),128))]),t("p",Te,f(e.$t("settings.subscription.billingBankInformation")),1),t("div",Ae,[s(i,{variant:"grey",modelValue:e.billingInformation.bank_name,"onUpdate:modelValue":o[7]||(o[7]=n=>e.billingInformation.bank_name=n),name:"bank_name",type:"text",required:"",placeholder:`${e.$t("placeholders.billing.bankName")}`,error:(U=e.errorResponse)!=null&&U.bank_name?e.errorResponse.bank_name[0]:""},null,8,["modelValue","placeholder","error"]),s(i,{variant:"grey",modelValue:e.billingInformation.account_number,"onUpdate:modelValue":o[8]||(o[8]=n=>e.billingInformation.account_number=n),name:"account_number",type:"text",required:"",placeholder:`${e.$t("placeholders.common.accountNumber")}`,error:(E=e.errorResponse)!=null&&E.account_number?e.errorResponse.account_number[0]:""},null,8,["modelValue","placeholder","error"])])])):P("",!0),!e.freePlan&&!e.demo?(c(),v("div",_e,[t("div",He,[t("p",Ne,f(e.$t("settings.subscription.cancelPlanTitle")),1),t("p",Le,f(e.$t("settings.subscription.cancelPlanText",{team:e.billingInformation.company_name})),1),s(A,{size:"small",class:"flex items-center",variant:"grey",onClick:o[9]||(o[9]=T(n=>e.disablePlanModal=!0,["prevent"]))},{default:$(()=>[t("span",null,f(e.$t("settings.subscription.cancelPlanButton")),1),s(h,{class:"text-grey-low ml-1.5",icon:["far","ban"]})]),_:1})])])):P("",!0),!e.freePlan&&e.clientHasChanged?(c(),X(k,{key:2,"show-cancel-btn":e.clientHasChanged,onResetChanges:e.resetChanges},null,8,["show-cancel-btn","onResetChanges"])):P("",!0)],32),s(g,{modelValue:e.disablePlanModal,"onUpdate:modelValue":o[12]||(o[12]=n=>e.disablePlanModal=n),width:452},{header:$(()=>[s(h,{icon:["far","ban"],class:"text-grey-low text-4xl"})]),default:$(()=>[s(S,{title:"settings.subscription.cancelModalTitle",action:"settings.subscription.cancelPlanButtonConfirm",variant:"red",onAction:e.cancelPlan,onCloseModal:o[11]||(o[11]=n=>e.disablePlanModal=!1)},{text:$(()=>[t("span",{innerHTML:e.$t("settings.subscription.cancelModalText",{planName:e.teamPlanName})},null,8,Ue)]),_:1},8,["onAction"])]),_:1},8,["modelValue"]),s(g,{modelValue:e.showLeaveModal,"onUpdate:modelValue":o[14]||(o[14]=n=>e.showLeaveModal=n),width:422},{header:$(()=>[s(h,{icon:["far","door-open"],class:"text-grey-low text-4xl"})]),default:$(()=>[s(S,{title:"components.confirmLeaveModal.title",text:"components.confirmLeaveModal.text",action:"common.utils.stay","cancel-text":"common.utils.leave",variant:"primary",onCloseModal:e.leavePage,onAction:o[13]||(o[13]=n=>e.showLeaveModal=!1)},null,8,["onCloseModal"])]),_:1},8,["modelValue"])],64)}const Oe=Q($e,[["render",Ee]]);export{Oe 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.