1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[2596],{22596:function(e,t,l){l.r(t),l.d(t,{default:function(){return y}});var a=l(20641),i=l(90033);const o={class:"o-maxwidth"},n={class:"page-header mb-6"},s={class:"is-flex is-align-items-center"},m={class:"icon"},c={class:"page-title"},d={class:"form-actions mt-6"},u={class:"icon is-small"};function r(e,t,l,r,p,h){const g=(0,a.g2)("b-loading"),b=(0,a.g2)("font-awesome-icon"),L=(0,a.g2)("Form");return(0,a.uX)(),(0,a.CE)("section",o,[(0,a.bF)(g,{modelValue:p.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>p.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),(0,a.Lk)("div",n,[(0,a.Lk)("div",s,[(0,a.Lk)("a",{class:"back-button mr-4",onClick:t[1]||(t[1]=t=>e.$router.go(-1))},[(0,a.Lk)("span",m,[(0,a.bF)(b,{icon:"fa-light fa-arrow-left"})])]),(0,a.Lk)("h1",c,(0,i.v_)(e.$t("Edit Company")),1)])]),(0,a.bF)(L,{item:p.item,onLogoChange:h.handleLogoChange},null,8,["item","onLogoChange"]),(0,a.Lk)("div",d,[(0,a.Lk)("button",{class:"button is-light is-rounded",onClick:t[2]||(t[2]=t=>e.$router.go(-1))},(0,i.v_)(e.$t("Cancel")),1),(0,a.Lk)("button",{class:(0,i.C4)(["button is-primary is-rounded",{"is-loading":p.isSaving}]),onClick:t[3]||(t[3]=(...e)=>h.save&&h.save(...e))},[(0,a.Lk)("span",u,[(0,a.bF)(b,{icon:"fa-light fa-check"})]),(0,a.Lk)("span",null,(0,i.v_)(e.$t("Save")),1)],2)])])}l(44114);var p=l(82222),h=l(40834),g={components:{Form:p.A},data(){return{isLoading:!1,isSaving:!1,pendingLogoFile:null,item:{name:null,description:null,website:null,town:null,contactEmail:null,ccEmail1:null,ccEmail2:null,contactPhone:null,contactPhoneCountry:null,contactFullName:null,address:null,vatNumber:null,legalName:null,registrationNumber:null,logo:null,mapLatitude:null,mapLongitude:null,mapPlaceName:null}}},computed:{...(0,h.L8)(["tenant","user","isGranted"]),isMyCompanyRoute(){return"MyCompanyUpdate"===this.$route.name}},created(){this.fetchItem()},methods:{handleLogoChange(e){this.pendingLogoFile=e},fetchItem(){this.isLoading=!0;const e=this.isMyCompanyRoute?"/my-company":`/companies/${this.$route.params.uuid}`;this.$http.plain.get(e).then(e=>{if(this.isMyCompanyRoute&&(!e.data||204===e.status))return this.$buefy.toast.open({message:this.$t("You are not associated with any company"),type:"is-info"}),void this.$router.push({name:"Dashboard"});this.item=this.isMyCompanyRoute?e.data.company:e.data}).catch(e=>{console.log(e),this.$router.push({name:"Dashboard"})}).finally(()=>{this.isLoading=!1})},save(){if(!this.item.name)return void this.$buefy.toast.open({message:this.$t("Company name is required"),type:"is-danger"});this.isSaving=!0;let e={name:this.item.name,description:this.item.description,website:this.item.website,town:this.item.town?this.item.town["@id"]||this.item.town:null,country:this.item.country?this.item.country["@id"]||this.item.country:null,contactEmail:this.item.contactEmail,ccEmail1:this.item.ccEmail1,ccEmail2:this.item.ccEmail2,contactPhone:this.item.contactPhone,contactPhoneCountry:this.item.contactPhoneCountry,contactFullName:this.item.contactFullName,address:this.item.address,vatNumber:this.item.vatNumber,legalName:this.item.legalName,registrationNumber:this.item.registrationNumber,mapLatitude:this.item.mapLatitude,mapLongitude:this.item.mapLongitude,mapPlaceName:this.item.mapPlaceName};this.$http.plain.patch(`/companies/${this.item.uuid}`,e,{headers:{"Content-Type":"application/merge-patch+json"}}).then(e=>this.pendingLogoFile?this.uploadLogo().then(()=>e):e).then(e=>this.saveSuccess(e)).catch(e=>{console.log(e),this.$buefy.toast.open({message:this.$t("Error updating company"),type:"is-danger"})}).finally(()=>{this.isSaving=!1})},uploadLogo(){const e=this.pendingLogoFile,t=new FormData;return t.append("file",e),t.append("type","company"),t.append("entity_id",this.item.id),this.$http.plain.post("/media_objects",t,{headers:{"Content-Type":"multipart/form-data"}}).then(e=>{this.item.logo=e.data.contentUrl,this.pendingLogoFile=null}).catch(e=>{console.log(e),this.$buefy.toast.open({message:this.$t("Failed to upload logo"),type:"is-danger"})})}
1,saveSuccess(){this.$buefy.toast.open({message:this.$t("Company updated"),type:"is-success"}),this.isMyCompanyRoute?this.$router.push({name:"MyCompany"}):this.$router.push({name:"CompanyShow",params:{uuid:this.item.uuid}})}}},b=l(66262);const L=(0,b.A)(g,[["render",r],["__scopeId","data-v-706288bc"]]);var y=L},82222:function(e,t,l){l.d(t,{A:function(){return K}});var a=l(20641),i=l(90033);const o={class:"columns is-multiline"},n={class:"column is-8"},s={class:"column is-4"},m={class:"has-text-grey is-size-7 mb-2"},c={class:"card p-4"},d={class:"is-flex is-flex-direction-column is-align-items-center"},u={key:0,class:"image is-96x96 mb-3"},r=["src","alt"],p={key:1,class:"image is-96x96 mb-3"},h=["src","alt"],g={key:2,class:"logo-placeholder mb-3"},b={class:"icon is-large has-text-grey-light"},L={class:"is-flex"},y={class:"button is-small is-light is-rounded"},v={class:"icon is-small"},k={class:"icon is-small"},f={class:"is-size-7 has-text-grey-dark has-text-weight-semibold is-uppercase mt-6 mb-2"},F={class:"card p-5 mb-5"},$={class:"columns is-multiline"},V={class:"column is-6"},C={class:"column is-6"},w={class:"column is-6"},P={class:"column is-6"},U={class:"column is-6"},N={class:"column is-6"},_={key:0,class:"column is-12"},E={class:"help"},x={class:"is-size-7 has-text-grey-dark has-text-weight-semibold is-uppercase mt-5 mb-2"},S={class:"card p-5"},A={class:"columns is-multiline"},R={class:"column is-6"},j={class:"column is-6"},M={class:"column is-6"},T={class:"field has-addons"},D={class:"control"},X={class:"control is-expanded"},I={class:"column is-6"},O={class:"column is-6"};function q(e,t,l,q,z,B){const Q=(0,a.g2)("b-loading"),G=(0,a.g2)("b-input"),W=(0,a.g2)("b-field"),Y=(0,a.g2)("font-awesome-icon"),H=(0,a.g2)("b-upload"),J=(0,a.g2)("TownAutocomplete"),K=(0,a.g2)("CountryAutocomplete"),Z=(0,a.g2)("MapLocationSelector"),ee=(0,a.g2)("PhoneCountryPrefixSelect");return(0,a.uX)(),(0,a.CE)("section",null,[(0,a.bF)(Q,{modelValue:z.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>z.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),(0,a.Lk)("div",o,[(0,a.Lk)("div",n,[(0,a.bF)(W,{label:e.$t("Company Name"),class:"required",type:l.errors.name?"is-danger":"",message:l.errors.name},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.name,"onUpdate:modelValue":t[1]||(t[1]=e=>l.item.name=e),placeholder:e.$t("Display name"),required:""},null,8,["modelValue","placeholder"])]),_:1},8,["label","type","message"]),(0,a.bF)(W,{label:e.$t("Description"),class:"mt-4"},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.description,"onUpdate:modelValue":t[2]||(t[2]=e=>l.item.description=e),type:"textarea",placeholder:e.$t("Brief description of your company"),rows:"2"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,a.bF)(W,{label:e.$t("Website"),class:"mt-4"},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.website,"onUpdate:modelValue":t[3]||(t[3]=e=>l.item.website=e),type:"url",placeholder:"https://example.com"},null,8,["modelValue"])]),_:1},8,["label"])]),(0,a.Lk)("div",s,[(0,a.Lk)("p",m,(0,i.v_)(e.$t("Company Logo")),1),(0,a.Lk)("div",c,[(0,a.Lk)("div",d,[l.item.logo&&!z.pendingLogoPreview?((0,a.uX)(),(0,a.CE)("figure",u,[(0,a.Lk)("img",{src:l.item.logo,alt:l.item.name,class:"is-rounded"},null,8,r)])):z.pendingLogoPreview?((0,a.uX)(),(0,a.CE)("figure",p,[(0,a.Lk)("img",{src:z.pendingLogoPreview,alt:e.$t("New logo"),class:"is-rounded"},null,8,h)])):((0,a.uX)(),(0,a.CE)("div",g,[(0,a.Lk)("span",b,[(0,a.bF)(Y,{icon:"fa-light fa-building",size:"2x"})])])),(0,a.Lk)("div",L,[(0,a.bF)(H,{modelValue:z.pendingLogoFile,"onUpdate:modelValue":[t[4]||(t[4]=e=>z.pendingLogoFile=e),B.handlePendingLogoUpload],accept:"image/png, image/jpeg, image/jpg"},{default:(0,a.k6)(()=>[(0,a.Lk)("a",y,[(0,a.Lk)("span",v,[(0,a.bF)(Y,{icon:"fa-light fa-camera"})]),(0,a.Lk)("span",null,(0,i.v_)(l.item.logo||z.pendingLogoPreview?e.$t("Change"):e.$t("Upload")),1)])]),_:1},8,["modelValue","onUpdate:modelValue"]),z.pendingLogoPreview?((0,a.uX)(),(0,a.CE)("button",{key:0,class:"button is-small is-light is-rounded ml-2",type:"button",onClick:t[5]||(t[5]=(...e)=>B.clearPendingLogo&&B.clearPendingLogo(...e))},[(0,a.Lk)("span",k,[(0,a.bF)(Y,{icon:"fa-light fa-times"})])])):(0,a.Q3)("",!0)])])])])]),(0,a.Lk)("p",f,(0,i.v_)(e.$t("Billing Details")),1),(0,a.Lk)("div",F,[(0,a.Lk)("div",$,[(0,a.Lk)("div",V,[(0,a.bF)(W,{label:e.$t("Legal Name")},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.legalName,"onUpdate:modelValue":t[6]||(t[6]=e=>l.item.legalName=e),placeholder:e.$t("Full legal company name for invoices")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),(0,a.Lk)("div",C,[(0,a.bF)(W,{label:e.$t("Registration Number")},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.registrationNumber,"onUpdate:modelValue":t[7]||(t[7]=e=>l.item.registrationNumber=e),placeholder:e.$t("CUI / Company ID")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),(0,a.Lk)("div",w,[(0,a.bF)(W,{label:e.$t("VAT Number")},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.vatNumber,"onUpdate:modelValue":t[8]||(t[8]=e=>l.item.vatNumber=e),placeholder:"RO12345678"},null,8,["modelValue"])]),_:1},8,["label"])]),(0,a.Lk)("div",P,[(0,a.bF)(W,{label:e.$t("Billing Address")},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.address,"onUpdate:modelValue":t[9]||(t[9]=e=>l.item.address=e),placeholder:e.$t("Full billing address")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),(0,a.Lk)("div",U,[(0,a.bF)(J,{modelValue:l.item.town,"onUpdate:modelValue":[t[10]||(t[10]=e=>l.item.town=e),B.onTownSelected],label:e.$t("Town"),town:l.item.town,"is-result-object":!0,"show-map-icon":!0},null,8,["modelValue","label","town","onUpdate:modelValue"])]),(0,a.Lk)("div",N,[(0,a.bF)(K,{country:l.item.country,label:e.$t("Country"),placeholder:e.$t("Select country"),"is-result-object":!0,"onUpdate:modelValue":B.onCountrySelected},null,8,["country","label","placeholder","onUpdate:modelValue"])]),e.tenant?.settingFeatures?.company?.isActive?((0,a.uX)(),(0,a.CE)("div",_,[(0,a.bF)(Z,{modelValue:B.mapLocation,"onUpdate:modelValue":t[11]||(t[11]=e=>B.mapLocation=e),label:e.$t("Location on companies map"),placeholder:e.$t("Search for your address")},null,8,["modelValue","label","placeholder"]),(0,a.Lk)("p",E,(0,i.v_)(e.$t("Used to place your company on the directory map. Leave empty to use the town centre.")),1)])):(0,a.Q3)("",!0)])]),(0,a.Lk)("p",x,
1(0,i.v_)(e.$t("Financial Contact")),1),(0,a.Lk)("div",S,[(0,a.Lk)("div",A,[(0,a.Lk)("div",R,[(0,a.bF)(W,{label:e.$t("Financial contact full name")},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.contactFullName,"onUpdate:modelValue":t[12]||(t[12]=e=>l.item.contactFullName=e),placeholder:e.$t("Financial contact person")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),(0,a.Lk)("div",j,[(0,a.bF)(W,{label:e.$t("Financial contact email")},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.contactEmail,"onUpdate:modelValue":t[13]||(t[13]=e=>l.item.contactEmail=e),type:"email",placeholder:"[email protected]"},null,8,["modelValue"])]),_:1},8,["label"])]),(0,a.Lk)("div",M,[(0,a.bF)(W,{label:e.$t("Financial contact phone")},{default:(0,a.k6)(()=>[(0,a.Lk)("div",T,[(0,a.Lk)("div",D,[(0,a.bF)(ee,{modelValue:l.item.contactPhoneCountry,"onUpdate:modelValue":t[14]||(t[14]=e=>l.item.contactPhoneCountry=e),placeholder:e.$t("Prefix")},null,8,["modelValue","placeholder"])]),(0,a.Lk)("div",X,[(0,a.bF)(G,{modelValue:l.item.contactPhone,"onUpdate:modelValue":t[15]||(t[15]=e=>l.item.contactPhone=e),type:"tel",disabled:!l.item.contactPhoneCountry,placeholder:e.$t("Phone number")},null,8,["modelValue","disabled","placeholder"])])])]),_:1},8,["label"])]),(0,a.Lk)("div",I,[(0,a.bF)(W,{label:e.$t("Additional contact email 1 (Cc)")},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.ccEmail1,"onUpdate:modelValue":t[16]||(t[16]=e=>l.item.ccEmail1=e),type:"email",placeholder:"[email protected]"},null,8,["modelValue"])]),_:1},8,["label"])]),(0,a.Lk)("div",O,[(0,a.bF)(W,{label:e.$t("Additional contact email 2 (Cc)")},{default:(0,a.k6)(()=>[(0,a.bF)(G,{modelValue:l.item.ccEmail2,"onUpdate:modelValue":t[17]||(t[17]=e=>l.item.ccEmail2=e),type:"email",placeholder:"[email protected]"},null,8,["modelValue"])]),_:1},8,["label"])])])])])}l(14603),l(47566),l(98721);var z=l(40834),B=l(99440),Q=l(53369),G=l(36401),W=l(83806),Y={components:{PhoneCountryPrefixSelect:B.A,TownAutocomplete:Q.A,CountryAutocomplete:G.A,MapLocationSelector:W.A},props:{item:{type:Object,required:!0},errors:{type:Object,default:()=>({})}},data(){return{isLoading:!1,pendingLogoFile:null,pendingLogoPreview:null}},computed:{...(0,z.L8)(["tenant"]),mapLocation:{get(){return this.item.mapLatitude||this.item.mapLongitude||this.item.mapPlaceName?{latitude:this.item.mapLatitude,longitude:this.item.mapLongitude,placeName:this.item.mapPlaceName}:null},set(e){e?(this.item.mapLatitude=e.latitude?String(e.latitude):null,this.item.mapLongitude=e.longitude?String(e.longitude):null,this.item.mapPlaceName=e.placeName||null):(this.item.mapLatitude=null,this.item.mapLongitude=null,this.item.mapPlaceName=null)}}},methods:{onTownSelected(e){this.item.town=e,e&&e.country&&"object"===typeof e.country&&(this.item.country=e.country)},onCountrySelected(e){this.item.country=e||null},handlePendingLogoUpload(e){e&&(this.pendingLogoPreview&&URL.revokeObjectURL(this.pendingLogoPreview),this.pendingLogoPreview=URL.createObjectURL(e),this.$emit("logo-change",e))},clearPendingLogo(){this.pendingLogoPreview&&URL.revokeObjectURL(this.pendingLogoPreview),this.pendingLogoFile=null,this.pendingLogoPreview=null,this.$emit("logo-change",null)}}},H=l(66262);const J=(0,H.A)(Y,[["render",q],["__scopeId","data-v-7d66de62"]]);var K=J}}]);
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.