1import{d as G,Q as J,an as O,r as p,A as u,aj as I,al as P,ai as z,B as Q,f as l,g as s,t as a,W as n,O as o,e as _,w as U,J as N,b as W,j as H,N as R,a as b,o as r,ae as A,S as K}from"./vendor.CGg8uihD.js";import{l as X}from"./vue3-toastify.BAN_0ELK.js";import{J as x,a2 as Y,a3 as Z,u as ee,a4 as ae,R as se}from"./index.BelEvh33.js";import{B as te}from"./company.DAwrTcJr.js";import{s as oe}from"./body-utils.BxUqih8-.js";import{_ as re}from"./form-input.DDhtkuGO.js";import"./floating-vue.su9VrNNc.js";import"./application-insights.D2DKMJb2.js";const le={class:"m-b-6"},ne={class:"subtitle-2"},ie={class:"form-group"},me={class:"form-label"},ue={class:"form-group"},ce={class:"form-label"},de={class:"form-group"},pe={class:"form-label"},ve={class:"form-group"},fe={class:"form-label"},ye={class:"m-b-6"},ge={class:"subtitle-2"},he={class:"form-group"},_e={class:"form-label"},be={class:"form-group"},$e={class:"form-label"},ke={class:"form-group"},Ce={class:"form-label"},Be=G({__name:"VatCompletionForm",setup(Ve){const B=K(),v=ee(),{t:g}=J(),$=O("refForm"),c=p(!1),h=p(!1),f=p(""),k=p({vatRule:"",vatExample:""}),y=p({vatRule:"",vatExample:""}),d=u(()=>v.getters.company),C=u(()=>x(d.value)),i=u(()=>v.getters.profile),V=u(()=>x(i.value)),w=u(()=>v.getters.getVatRuleForCountry(d.value.isoCountryCode)),S=u(()=>({vatId:{required:I.withMessage(g("my-mirka.forms.requiredField"),P),validateVat:I.withMessage(e=>e.$response.message,D)}})),E=z(S,{vatId:f});function D(e){return e===""?{$valid:!0,message:""}:(k.value=Y(e,w.value),k.value==null?{$valid:!0,message:""}:{$valid:!1,message:g("my-mirka.vatErrors.commonErrorPrefix")})}async function M(){if(c.value)return;if(h.value=!1,!await E.value.$validate()){oe($.value);return}c.value=!0;try{const t={...d.value,businessId:f.value};await ae.saveCompany(t),v.dispatch("setCompany",t),await B.replace(se.Dashboard.path),X.success(g("my-mirka.common.updateSuccess"))}catch{h.value=!0}finally{c.value=!1}}return Q(()=>{const e=w.value;e&&(y.value=Z(e))}),(e,t)=>{const q=b("icon"),L=b("alert"),T=b("form-button"),m=A("fullstory"),j=A("tooltip");return r(),l("form",{ref_key:"refForm",ref:$,class:"form",onSubmit:R(()=>{},["prevent"])},[s("fieldset",le,[s("legend",null,[s("h2",ne,a(e.$t("my-mirka.account.information")),1)]),n((r(),l("p",ie,[s("span",me,a(e.$t("my-mirka.account.name")),1),o(" "+a(i.value.firstName)+" "+a(i.value.lastName),1)])),[[m,void 0,"exclude"]]),n((r(),l("p",ue,[s("span",ce,a(e.$t("my-mirka.account.email")),1),o(" "+a(i.value.email),1)])),[[m,void 0,"exclude"]]),n((r(),l("p",de,[s("span",pe,a(e.$t("my-mirka.account.phoneNumber")),1),o(" "+a(i.value.phones&&i.value.phones.length>0?i.value.phones[0]?.number:"â"),1)])),[[m,void 0,"exclude"]]),n((r(),l("p",ve,[s("span",fe,a(e.$t("my-mirka.account.address")),1),o(" "+a(V.value.streetAddress),1),t[2]||(t[2]=s("br",null,null,-1)),o(" "+a(V.value.location),1)])),[[m,void 0,"exclude"]])]),s("fieldset",ye,[s("legend",null,[s("h2",ge,a(e.$t("my-mirka.company.information")),1)]),n((r(),l("p",he,[s("span",_e,a(e.$t("my-mirka.company.customerCode")),1),o(" "+a(d.value.customerCode),1)])),[[m,void 0,"exclude"]]),n((r(),l("p",be,[s("span",$e,a(e.$t("my-mirka.company.companyName")),1),o(" "+a(d.value.name),1)])),[[m,void 0,"exclude"]]),n((r(),l("p",ke,[s("span",Ce,a(e.$t("my-mirka.account.address")),1),o(" "+a(C.value.streetAddress),1),t[3]||(t[3]=s("br",null,null,-1)),o(" "+a(C.value.location),1)])),[[m,void 0,"exclude"]]),_(re,{id:"vat-id",modelValue:f.value,"onUpdate:modelValue":t[0]||(t[0]=F=>f.value=F),"custom-error-message":"","helper-text":y.value.vatExample?`${e.$t(`my-mirka.vatErrors.${y.value.vatRule}`)} ${e.$t(y.value.vatExample)}`:void 0,label:e.$t("my-mirka.company.vat"),required:!0,v:N(E).vatId,autocomplete:"section-company vat-id","data-test-automation":"vat-id",maxlength:N(te),type:"text"},{"label-tooltip":U(()=>[n(_(q,{"aria-hidden":!1,class:"is-small m-l-3",name:"info"},null,512),[[j,e.$t("my-mirka.company.vatOrEinDescription")]])]),_:1},8,["modelValue","helper-text","label","v","maxlength"])]),h.value?(r(),W(L,{key:0,class:"m-b-6 u-max-width-100",type:"danger","message-title":e.$t("my-mirka.error.error"),message:e.$t("my-mirka.common.updateFail")},null,8,["message-title","message"])):H("",!0),_(T,{class:"btn--full-width-mobile",disabled:c.value,label:e.$t("my-mirka.common.submit"),loading:c.value,"data-test-automation":"submit",size:"large",variant:"primary",onClick:t[1]||(t[1]=R(F=>M(),["prevent","stop"]))},null,8,["disabled","label","loading"])],544)}}});
1export{Be 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.