1import{cW as w,L as N,bZ as S,aa as g,a9 as b,z as u,d as R,D as W,E as X,g as Z,G as $,c as C,e as G,f as o,n as V,l,bi as J,p as a,m as n,I as r,J as d,H as v,x as F,q as p,S as K,v as j,K as Q,k as Y,B as P}from"./BA3nnhvB.js";import{l as ee,b as E,d as ae,e as se,h as te}from"./BHPDcwEc.js";import{S as U}from"./-WB-KBIa.js";import{I as x}from"./DqUo2CtM.js";import{c as le,u as re,m as ie}from"./CC1omtox.js";import{G as oe}from"./CB9qiDR-.js";import{F as ne}from"./cWnGEcWf.js";import{u as de}from"./CAcw3JVX.js";function me(q){const f=w().countries.find(m=>m.iso===q.country),h=u(()=>f?.iso==="US"||f?.iso==="CA"||f?.iso==="MX");return{firstName:{required:N,minLength:b(2),maxLength:g(30)},lastName:{required:N,minLength:b(2),maxLength:g(30)},phoneNumber:{required:N,minLength:b(5),maxLength:g(25),phoneNumberChecker:function(m){return m?/^([+\d]|-| )*$/.test(m):!0}},companyName:{required:N,minLength:b(2),maxLength:g(50)},country:{required:N},additionalInfo:{maxLength:g(500)},vatIdNumber:{required:S(u(()=>f?.status==="Full")),minLength:b(5),maxLength:g(30),vatIdChecker:function(m){return m==="vatNonWhiteListed"?!0:m?/^[A-Za-z]{2,4}(?=.{2,12}$)[-_\s0-9]*(?:[a-zA-Z][-_\s0-9]*){0,2}$/.test(m):!0}},pxcNumber:{},street:{required:N,minLength:b(2),maxLength:g(30),atLeastOneNonNumeric:se},houseNumber:{required:S(!h.value),houseNumberValidator:m=>h.value?!0:te(m),atLeastOneNumeric:m=>h.value?!0:E(m)},postalCode:{required:N,letterNumberValidator:ae,minLength:b(4),maxLength:g(10),atLeastOneNumeric:E},city:{required:N,letterSpecialValidator:ee,minLength:b(3),maxLength:g(30)},state:{requiredIf:S(u(()=>f?.iso==="US"||f?.iso==="MX"))},province:{requiredIf:S(u(()=>f?.iso==="CA"))}}}const ue={firstName:{required:"Name is required",minLength:"Name should be at least 2 characters long",maxLength:"Name can be maximum 30 characters long"},lastName:{required:"Last name is required",minLength:"Last name should be at least 2 characters long",maxLength:"Last name can be maximum 30 characters long"},phoneNumber:{required:"Phone number is required",minLength:"Phone number should be at least 5 characters long",maxLength:"Phone number can be maximum 25 characters long",phoneNumberChecker:"Please enter a valid phone number"},companyName:{required:"Company name is required",minLength:"Company name should be at least 2 characters long",maxLength:"Company name can be maximum 50 characters long"},country:{required:"Country is required"},vatIdNumber:{required:"VAT ID Number is required",minLength:"VAT ID should be at least 5 characters long",maxLength:"VAT ID can be maximum 30 characters long",vatIdChecker:"Please enter a valid VAT ID"},pxcNumber:{},additionalInfo:{maxLength:"Additional info can be maximum 500 characters long"},street:{required:"Street is required",minLength:"Street should be at least 2 characters long",maxLength:"Street can be maximum 30 characters long",atLeastOneNonNumeric:"Street must contain at least one letter"},houseNumber:{required:"House number is required",houseNumberValidator:"Please enter a valid house number",atLeastOneNumeric:"House number must contain at least one digit"},postalCode:{required:"Postal code is required",letterNumberValidator:"Please enter a valid postal code",minLength:"Postal code should be at least 4 characters long",maxLength:"Postal code can be maximum 10 characters long",atLeastOneNumeric:"Postal code must contain at least one digit"},city:{required:"City is required",letterSpecialValidator:"Please enter a valid city name",minLength:"City should be at least 3 characters long",maxLength:"City can be maximum 30 characters long"},state:{requiredIf:"State is required."},province:{requiredIf:"Province is required."}},ce={firstName:"First Name",lastName:"Last Name",phoneNumber:"Phone Number",companyName:"Company Name",country:"Country",vatIdNumber:"VAT ID Number",pxcNumber:"PXC Number",additionalInfo:"Additional Info",street:"Street",houseNumber:"House Number",postalCode:"Postal Code",city:"City",state:"State",province:"Province"},ve={class:"mainWrap mt-3 mb-5"},fe={class:"form-group row my-3 mb-2 align-items-center"},ge={class:"col-12 col-lg-9"},Ne={class:"row"},be={class:"col-7"},ye={class:"col-5"},Ie={class:"form-group row my-3 mb-2 align-items-center"},Ce={class:"col-12 col-lg-9"},he={class:"row"},Ve={class:"col-5"},Fe={class:"col-7"},pe={class:"row"},xe={class:"col-12"},Le={class:"form-group row my-3 mb-2 align-items-center"},Se={class:"col-12 col-lg-9"},Me={class:"row"},Ue={class:"col-7"},qe={class:"col-5"}
1,Be=R({__name:"index",setup(q){const y=W(),f=X(),h=Z(),m=w(),A=u(()=>({firstName:y.authUser?.firstName||"",lastName:y.authUser?.lastName||"",phoneNumber:y.authUser?.phoneNumber||"",companyName:"",country:y.authUser?.country?.iso||"",vatIdNumber:"",pxcNumber:"",additionalInfo:"",street:"",houseNumber:"",postalCode:"",city:"",state:"",province:""})),t=$({...A.value}),_=u(()=>me(t)),D=async()=>{let c,s;L.value&&(c=M.value?t.province:t.state),k.value&&(s=t.vatIdNumber);const e={name:t.companyName,vatIdNumber:s,pxcNumber:t.pxcNumber,webModelUpdateUser:{phoneNumber:t.phoneNumber,firstName:t.firstName,lastName:t.lastName},webModelPostNewAddress:{country:t.country,state:c,city:t.city,postalCode:t.postalCode,street:t.street,houseNumber:t.houseNumber,additionalInfo:t.additionalInfo}};await f.createCompany(e),Y().addToastWithMessageAndTitle("Success","Company "+t.companyName+" successfully created.","success"),P().isFormDirty=!1,h.back()},I=u(()=>m.countries.find(c=>c.iso===t.country)),k=u(()=>I.value?.status==="Full"),H=u(()=>["GB","NO","CH"].includes(I.value?.iso)),L=u(()=>I.value?.iso==="US"||I.value?.iso==="CA"||I.value?.iso==="MX"),M=u(()=>I.value?.iso==="CA"),T=u(()=>I.value?.iso==="US"),B=u(()=>le.map(c=>({value:c.code,text:c.name}))),O=u(()=>re.map(c=>({value:c.code,text:c.name}))),z=u(()=>ie.map(c=>({value:c.code,text:c.name})));return de({title:"PLCnext Store | Create Company"}),(c,s)=>(C(),G("div",ve,[s[26]||(s[26]=o("div",{class:"row"},[o("div",{class:"col-12"},[o("h3",null,"Company Registration"),o("p",null,[V(" Please fill out the form below to register your company. All fields marked with "),o("span",{class:"mandatory"},"*"),V(" are required. ")])])],-1)),l(Q,{modelValue:a(t),"onUpdate:modelValue":s[19]||(s[19]=e=>j(t)?t.value=e:null),"initial-state":a(A),"validation-rules-function":()=>a(_),"validation-messages":a(ue),"field-labels-map":a(ce),"reset-button-text":"Reset","saved-callback":D},J({userDetailsHeader:n(()=>[s[20]||(s[20]=o("h5",null,"User Details",-1))]),username:n(()=>[l(v,{id:"username",mandatory:"",name:"username",label:"User Name"},{default:n(()=>[l(d,{id:"username","model-value":a(y).authUser?.userName,name:"username",disabled:"",class:"form-control form-control-sm"},null,8,["model-value"])]),_:1})]),email:n(()=>[l(v,{id:"email",mandatory:"",name:"email",label:"Email"},{default:n(()=>[l(d,{id:"email","model-value":a(y).authUser?.email,name:"email",disabled:"",class:"form-control form-control-sm"},null,8,["model-value"])]),_:1})]),firstName:n(e=>[l(v,{id:"firstName",name:"firstName",label:"First Name",mandatory:!0,"v-field":e.vForm.firstName,"validation-messages":e.validationMessages.firstName,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.firstName))},{default:n(()=>[l(d,{id:"firstName",modelValue:a(t).firstName,"onUpdate:modelValue":s[0]||(s[0]=i=>a(t).firstName=i),modelModifiers:{trim:!0},name:"firstName",class:r([e.getIsInvalidClass(e.vForm.firstName),"form-control form-control-sm"])},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])]),lastName:n(e=>[l(v,{id:"lastName",name:"lastName",label:"Last Name",mandatory:!0,"v-field":e.vForm.lastName,"validation-messages":e.validationMessages.lastName,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.lastName))},{default:n(()=>[l(d,{id:"lastName",modelValue:a(t).lastName,"onUpdate:modelValue":s[1]||(s[1]=i=>a(t).lastName=i),modelModifiers:{trim:!0},name:"lastName",class:r([e.getIsInvalidClass(e.vForm.lastName),"form-control form-control-sm"])},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])]),phoneNumber:n(e=>[l(v,{id:"phoneNumber",name:"phoneNumber",label:"Phone Number",mandatory:!0,"v-field":e.vForm.phoneNumber,"validation-messages":e.validationMessages.phoneNumber,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.phoneNumber))},{default:n(()=>[l(d,{id:"phoneNumber",modelValue:a(t).phoneNumber,"onUpdate:modelValue":s[2]||(s[2]=i=>a(t).phoneNumber=i),modelModifiers:{trim:!0},name:"phoneNumber",class:r([e.getIsInvalidClass(e.vForm.phoneNumber),"form-control form-control-sm"])},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])]),companyDetailsHeader:n(()=>[s[21]||(s[21]=o("h5",{class:"mt-5"},"Company Legal Details",-1))]),companyName:n(e=>[l(v,{id:"companyName",name:"companyName",label:"Company Name",mandatory:!0,"v-field":e.vForm.companyName,"validation-messages":e.validationMessages.companyName,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.companyName))},{default:n(()=>[l(d,{id:"companyName",modelValue:a(t).companyName,"onUpdate:modelValue":s[3]||(s[3]=i=>a(t).companyName=i),modelModifiers:{trim:!0},name:"companyName",class:r([e.getIsInvalidClass(e.vForm.companyName),"form-control form-control-sm"])},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])]),country:n(e=>[l(v,{id:"country",name:"country",label:"Country",mandatory:!0,"v-field":e.vForm.country,"validation-messages":e.validationMessages.country,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.country))},{default:n(()=>[l(U,{modelValue:a(t).country,"onUpdate:modelValue":s[4]||(s[4]=i=>a(t).country=i),name:"country",class:r(e.getIsInvalidClass(e.vForm.country)),options:a(m).getCountryOptionsForSelectField,"nothing-selected-label":"Select your country"},null,8,["modelValue","class","options"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])]),"cancel-button":n(()=>[l(K,{onClick:s[18]||(s[18]=e=>a(h).go(-1))},{default:n(()=>[...s[25]||(s[25]=[V(" Back ",-1)])]),_:1})]),_:2},[a(L)?void 0:{name:"streetAndHouseNumber",fn:n(e=>[o("div",fe,[s[22]||(s[22]=o("div",{class:"col-12 col-lg-3"},[o("label",{for:"street",class:"col-form-label"},[V("Street & Number"),o("span",{class:"mandatory"}
1,"*")])],-1)),o("div",ge,[o("div",Ne,[o("div",be,[l(x,{id:"street",name:"street",mandatory:!0,"v-field":e.vForm.street,"validation-messages":e.validationMessages.street,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.street))},{default:n(()=>[l(d,{id:"street",modelValue:a(t).street,"onUpdate:modelValue":s[5]||(s[5]=i=>a(t).street=i),modelModifiers:{trim:!0},name:"street",class:r([e.getIsInvalidClass(e.vForm.street),"form-control form-control-sm"])},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])]),o("div",ye,[l(x,{id:"houseNumber",name:"houseNumber",mandatory:!0,"v-field":e.vForm.houseNumber,"validation-messages":e.validationMessages.houseNumber,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.houseNumber))},{default:n(()=>[l(d,{id:"houseNumber",modelValue:a(t).houseNumber,"onUpdate:modelValue":s[6]||(s[6]=i=>a(t).houseNumber=i),modelModifiers:{trim:!0},class:r([e.getIsInvalidClass(e.vForm.houseNumber),"form-control form-control-sm"]),name:"houseNumber"},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])])])])]),l(v,{id:"additionalInfo",name:"additionalInfo",label:"Additional Info","v-field":e.vForm.additionalInfo,"validation-messages":e.validationMessages.additionalInfo,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.additionalInfo))},{default:n(()=>[l(d,{id:"additionalInfo",modelValue:a(t).additionalInfo,"onUpdate:modelValue":s[7]||(s[7]=i=>a(t).additionalInfo=i),modelModifiers:{trim:!0},class:r([e.getIsInvalidClass(e.vForm.additionalInfo),"form-control form-control-sm"]),name:"additionalInfo"},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"]),o("div",Ie,[s[23]||(s[23]=o("div",{class:"col-sm-4 col-lg-3"},[o("label",{for:"postalCode",class:"col-form-label"},[V("Postal Code and City"),o("span",{class:"mandatory"},"*")])],-1)),o("div",Ce,[o("div",he,[o("div",Ve,[l(x,{id:"postalCode",name:"postalCode",label:"Postal Code",mandatory:!0,"v-field":e.vForm.postalCode,"validation-messages":e.validationMessages.postalCode,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.postalCode))},{default:n(()=>[l(d,{id:"postalCode",modelValue:a(t).postalCode,"onUpdate:modelValue":s[8]||(s[8]=i=>a(t).postalCode=i),modelModifiers:{trim:!0},class:r([e.getIsInvalidClass(e.vForm.postalCode),"form-control form-control-sm"]),name:"postalCode"},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])]),o("div",Fe,[l(x,{id:"city",name:"city",mandatory:!0,"v-field":e.vForm.city,"validation-messages":e.validationMessages.city,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.city))},{default:n(()=>[l(d,{id:"city",modelValue:a(t).city,"onUpdate:modelValue":s[9]||(s[9]=i=>a(t).city=i),modelModifiers:{trim:!0},class:r([e.getIsInvalidClass(e.vForm.city),"form-control form-control-sm"]),name:"city"},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])])])])]),a(k)?(C(),F(v,{key:0,id:"vatIdNumber",name:"vatIdNumber",label:"VAT-ID",mandatory:!0,"v-field":e.vForm.vatIdNumber,"validation-messages":e.validationMessages.vatIdNumber,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.vatIdNumber))},{default:n(()=>[l(d,{id:"vatIdNumber",modelValue:a(t).vatIdNumber,"onUpdate:modelValue":s[10]||(s[10]=i=>a(t).vatIdNumber=i),modelModifiers:{trim:!0},class:r([e.getIsInvalidClass(e.vForm.vatIdNumber),"form-control form-control-sm"]),name:"vatIdNumber"},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])):p("",!0),a(H)?(C(),F(v,{key:1,id:"pxcNumber",name:"pxcNumber",label:"PXC Customer Number","v-field":e.vForm.pxcNumber,"validation-messages":e.validationMessages.pxcNumber,"field-errors":e.fieldErrors,"help-text":"If you do not have a PxC Customer number, please contact our support to prove your entrepreneurship",class:r(e.getIsInvalidClass(e.vForm.pxcNumber))},{default:n(()=>[o("div",pe,[o("div",xe,[l(d,{id:"pxcNumber",modelValue:a(t).pxcNumber,"onUpdate:modelValue":s[11]||(s[11]=i=>a(t).pxcNumber=i),modelModifiers:{trim:!0},class:r([e.getIsInvalidClass(e.vForm.pxcNumber),"form-control form-control-sm"]),name:"pxcNumber"},null,8,["modelValue","class"]),a(f).userCompany?.pxcNumberVerified===!1?(C(),F(a(oe),{key:0,size:"24",weight:"bold",class:"mb-1",style:{color:"green"},title:"verified"})):p("",!0),a(f).userCompany?.pxcNumberVerified===!1?(C(),F(a(ne),{key:1,size:"24",weight:"bold",class:"mb-1",style:{color:"red"},title:"not verified"})):p("",!0)])])]),_:2},1032,["v-field","validation-messages","field-errors","class"])):p("",!0)]),key:"0"},a(L)?{name:"usHubAddress",fn:n(e=>[l(v,{id:"street",name:"street",mandatory:!0,label:"Address Line 1","v-field":e.vForm.street,"validation-messages":e.validationMessages.street,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.street))},{default:n(()=>[l(d,{id:"additionalInfo",modelValue:a(t).street,"onUpdate:modelValue":s[12]||(s[12]=i=>a(t).street=i),modelModifiers:{trim:!0},class:r([e.getIsInvalidClass(e.vForm.street),"form-control form-control-sm"]),name:"street"},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"]),l(v,{id:"additionalInfo",name:"additionalInfo",label:"Address Line 2","v-field":e.vForm.additionalInfo,"validation-messages":e.validationMessages.additionalInfo,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.additionalInfo))},{default:n(()=>[l(d,{id:"additionalInfo",modelValue:a(t).additionalInfo,"onUpdate:modelValue":s[13]||(s[13]=i=>a(t).additionalInfo=i),modelModifiers:{trim:!0},class:r([e.getIsInvalidClass(e.vForm.additionalInfo),"form-control form-control-sm"]),name:"additionalInfo"},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"]),o("div",Le,[s[24]||(s[24]=o("div",{class:"col-sm-4 col-lg-3"},[o("label",{for:"city",class:"col-form-label"},[V("City and ZIP"),o("span",{class:"mandatory"}
1,"*")])],-1)),o("div",Se,[o("div",Me,[o("div",Ue,[l(x,{id:"city",name:"city",mandatory:!0,"v-field":e.vForm.city,"validation-messages":e.validationMessages.city,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.city))},{default:n(()=>[l(d,{id:"city",modelValue:a(t).city,"onUpdate:modelValue":s[14]||(s[14]=i=>a(t).city=i),modelModifiers:{trim:!0},class:r([e.getIsInvalidClass(e.vForm.city),"form-control form-control-sm"]),name:"city"},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])]),o("div",qe,[l(x,{id:"postalCode",name:"postalCode",label:"Postal Code",mandatory:!0,"v-field":e.vForm.postalCode,"validation-messages":e.validationMessages.postalCode,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.postalCode))},{default:n(()=>[l(d,{id:"postalCode",modelValue:a(t).postalCode,"onUpdate:modelValue":s[15]||(s[15]=i=>a(t).postalCode=i),modelModifiers:{trim:!0},class:r([e.getIsInvalidClass(e.vForm.postalCode),"form-control form-control-sm"]),name:"postalCode"},null,8,["modelValue","class"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])])])])]),a(L)&&!a(M)?(C(),F(v,{key:0,id:"state",name:"state",label:"State",mandatory:!0,"v-field":e.vForm.state,"validation-messages":e.validationMessages.state,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.state))},{default:n(()=>[l(U,{modelValue:a(t).state,"onUpdate:modelValue":s[16]||(s[16]=i=>a(t).state=i),name:"state",class:r(e.getIsInvalidClass(e.vForm.state)),options:a(T)?a(O):a(z),"nothing-selected-label":"Select your state"},null,8,["modelValue","class","options"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])):p("",!0),a(L)&&a(M)?(C(),F(v,{key:1,id:"province",name:"province",label:"Province",mandatory:!0,"v-field":e.vForm.province,"validation-messages":e.validationMessages.province,"field-errors":e.fieldErrors,class:r(e.getIsInvalidClass(e.vForm.province))},{default:n(()=>[l(U,{modelValue:a(t).province,"onUpdate:modelValue":s[17]||(s[17]=i=>a(t).province=i),name:"province",class:r(e.getIsInvalidClass(e.vForm.province)),options:a(B),"nothing-selected-label":"Select your province"},null,8,["modelValue","class","options"])]),_:2},1032,["v-field","validation-messages","field-errors","class"])):p("",!0)]),key:"1"}:void 0]),1032,["modelValue","initial-state","validation-rules-function","validation-messages","field-labels-map"])]))}});export{Be as default}; 2//# sourceMappingURL=COhYF491.js.map
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.