芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/public/build/assets/Create-BYYVb1qp.js
import{a8 as oe,ae as re,G as le,E as se,v as ae,e as ie,L as ue,f as w,k as h,j as de,r as p,o as f,m as _,w as i,b as m,a as r,J as E,p as G,t as $,l as e,af as me,K as v,n as k,c as j,q as ce,g,h as N,I as z,ag as T,i as pe,a0 as ge,ah as be,ai as S}from"./main-WS8l16KQ.js";import{_ as Ce}from"./CreateCustomFields-KP2lJheQ.js";import"./dynamic-import-helper-BheWnx7M.js";const fe={class:"flex items-center justify-end"},_e={class:"grid grid-cols-5 gap-4 mb-8"},$e={class:"col-span-5 text-lg font-semibold text-left lg:col-span-1"},ve={class:"grid grid-cols-5 gap-4 mb-8"},ye={class:"col-span-5 text-lg font-semibold text-left lg:col-span-1"},Ve={class:"md:col-span-2"},we={class:"text-sm text-gray-500"},he={class:"grid grid-cols-5 gap-4 mb-8"},Be={class:"col-span-5 text-lg font-semibold text-left lg:col-span-1"},Ie={class:"space-y-6"},Me={class:"flex items-center justify-start mb-6 md:justify-end md:mb-0"},xe={class:"p-1"},Ue={key:0,class:"grid grid-cols-5 gap-4 mb-8"},ke={class:"col-span-5 text-lg font-semibold text-left lg:col-span-1"},Se={class:"space-y-6"},qe={class:"grid grid-cols-5 gap-2 mb-8"},Le={key:0,class:"col-span-5 text-lg font-semibold text-left lg:col-span-1"},ze={class:"col-span-5 lg:col-span-4"},A="customFields",Ge={__name:"Create",setup(Fe){const n=oe(),F=re(),q=le(),R=se(),{t:c}=ae.useI18n(),H=ie(),O=ue();let l=w(!1),b=w(!1),C=w(!1);w(!1);const B=w(!1),V=h(()=>O.name==="customers.edit");let J=h(()=>n.isFetchingInitialSettings);const P=h(()=>V.value?c("customers.edit_customer"):c("customers.new_customer")),K=h(()=>({currentCustomer:{name:{required:g.withMessage(c("validation.required"),N),minLength:g.withMessage(c("validation.name_min_length",{count:3}),z(3))},prefix:{minLength:g.withMessage(c("validation.name_min_length",{count:3}),z(3))},currency_id:{required:g.withMessage(c("validation.required"),N)},email:{required:g.withMessage(c("validation.required"),T(n.currentCustomer.enable_portal==!0)),email:g.withMessage(c("validation.email_incorrect"),pe)},password:{required:g.withMessage(c("validation.required"),T(n.currentCustomer.enable_portal==!0&&!n.currentCustomer.password_added)),minLength:g.withMessage(c("validation.password_min_length",{count:8}),z(8))},confirm_password:{sameAsPassword:g.withMessage(c("validation.password_incorrect"),ge(n.currentCustomer.password))},website:{url:g.withMessage(c("validation.invalid_url"),be)},billing:{address_street_1:{maxLength:g.withMessage(c("validation.address_maxlength",{count:255}),S(255))},address_street_2:{maxLength:g.withMessage(c("validation.address_maxlength",{count:255}),S(255))}},shipping:{address_street_1:{maxLength:g.withMessage(c("validation.address_maxlength",{count:255}),S(255))},address_street_2:{maxLength:g.withMessage(c("validation.address_maxlength",{count:255}),S(255))}}}})),Q=h(()=>`${window.location.origin}/${R.selectedCompany.slug}/customer/login`),a=de(K,n,{$scope:A});n.resetCurrentCustomer(),n.fetchCustomerInitialSettings(V.value);async function W(){if(a.value.$touch(),a.value.$invalid)return!0;B.value=!0;let s={...n.currentCustomer},t=null;try{t=await(V.value?n.updateCustomer:n.addCustomer)(s)}catch{B.value=!1;return}H.push(`/admin/customers/${t.data.data.id}/view`)}return(s,t)=>{const I=p("BaseBreadcrumbItem"),X=p("BaseBreadcrumb-item"),Y=p("BaseBreadcrumb"),y=p("BaseIcon"),D=p("BaseButton"),Z=p("BasePageHeader"),d=p("BaseInput"),u=p("BaseInputGroup"),L=p("BaseMultiselect"),M=p("BaseInputGrid"),x=p("BaseDivider"),ee=p("BaseSwitch"),U=p("BaseTextarea"),te=p("BaseCard"),ne=p("BasePage");return f(),_(ne,null,{default:i(()=>[m("form",{onSubmit:ce(W,["prevent"])},[r(Z,{title:P.value},{actions:i(()=>[m("div",fe,[r(D,{type:"submit",loading:B.value,disabled:B.value},{left:i(o=>[r(y,{name:"SaveIcon",class:E(o.class)},null,8,["class"])]),default:i(()=>[G(" "+$(V.value?s.$t("customers.update_customer"):s.$t("customers.save_customer")),1)]),_:1},8,["loading","disabled"])])]),default:i(()=>[r(Y,null,{default:i(()=>[r(I,{title:s.$t("general.home"),to:"dashboard"},null,8,["title"]),r(I,{title:s.$t("customers.customer",2),to:"/admin/customers"},null,8,["title"]),r(X,{title:P.value,to:"#",active:""},null,8,["title"])]),_:1})]),_:1},8,["title"]),r(te,{class:"mt-5"},{default:i(()=>[m("div",_e,[m("h6",$e,$(s.$t("customers.basic_info")),1),r(M,{class:"col-span-5 lg:col-span-4"},{default:i(()=>[r(u,{label:s.$t("customers.display_name"),required:"",error:e(a).currentCustomer.name.$error&&e(a).currentCustomer.name.$errors[0].$message,"content-loading":e(l)},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.name,"onUpdate:modelValue":t[0]||(t[0]=o=>e(n).currentCustomer.name=o),"content-loading":e(l),type:"text",name:"name",class:"",invalid:e(a).currentCustomer.name.$error,onInput:t[1]||(t[1]=o=>e(a).currentCustomer.name.$touch())},null,8,["modelValue","content-loading","invalid"])]),_:1},8,["label","error","content-loading"]),r(u,{label:s.$t("customers.primary_contact_name"),"content-loading":e(l)},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.contact_name,"onUpdate:modelValue":t[2]||(t[2]=o=>e(n).currentCustomer.contact_name=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text"},null,8,["modelValue","content-loading"])]),_:1},8,["label","content-loading"]),r(u,{error:e(a).currentCustomer.email.$error&&e(a).currentCustomer.email.$errors[0].$message,"content-loading":e(l),label:s.$t("customers.email")},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.email,"onUpdate:modelValue":t[3]||(t[3]=o=>e(n).currentCustomer.email=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text",name:"email",invalid:e(a).currentCustomer.email.$error,onInput:t[4]||(t[4]=o=>e(a).currentCustomer.email.$touch())},null,8,["modelValue","content-loading","invalid"])]),_:1},8,["error","content-loading","label"]),r(u,{label:s.$t("customers.phone"),"content-loading":e(l)},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.phone,"onUpdate:modelValue":t[5]||(t[5]=o=>e(n).currentCustomer.phone=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text",name:"phone"},null,8,["modelValue","content-loading"])]),_:1},8,["label","content-loading"]),r(u,{label:s.$t("customers.primary_currency"),"content-loading":e(l),error:e(a).currentCustomer.currency_id.$error&&e(a).currentCustomer.currency_id.$errors[0].$message,required:""},{default:i(()=>[r(L,{modelValue:e(n).currentCustomer.currency_id,"onUpdate:modelValue":t[6]||(t[6]=o=>e(n).currentCustomer.currency_id=o),"value-prop":"id",label:"name","track-by":"name","content-loading":e(l),options:e(q).currencies,searchable:"","can-deselect":!1,placeholder:s.$t("customers.select_currency"),invalid:e(a).currentCustomer.currency_id.$error,class:"w-full"},null,8,["modelValue","content-loading","options","placeholder","invalid"])]),_:1},8,["label","content-loading","error"]),r(u,{error:e(a).currentCustomer.website.$error&&e(a).currentCustomer.website.$errors[0].$message,label:s.$t("customers.website"),"content-loading":e(l)},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.website,"onUpdate:modelValue":t[7]||(t[7]=o=>e(n).currentCustomer.website=o),"content-loading":e(l),type:"url",onInput:t[8]||(t[8]=o=>e(a).currentCustomer.website.$touch())},null,8,["modelValue","content-loading"])]),_:1},8,["error","label","content-loading"]),r(u,{label:s.$t("customers.prefix"),error:e(a).currentCustomer.prefix.$error&&e(a).currentCustomer.prefix.$errors[0].$message,"content-loading":e(l)},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.prefix,"onUpdate:modelValue":t[9]||(t[9]=o=>e(n).currentCustomer.prefix=o),"content-loading":e(l),type:"text",name:"name",class:"",invalid:e(a).currentCustomer.prefix.$error,onInput:t[10]||(t[10]=o=>e(a).currentCustomer.prefix.$touch())},null,8,["modelValue","content-loading","invalid"])]),_:1},8,["label","error","content-loading"])]),_:1})]),r(x,{class:"mb-5 md:mb-8"}),m("div",ve,[m("h6",ye,$(s.$t("customers.portal_access")),1),r(M,{class:"col-span-5 lg:col-span-4"},{default:i(()=>[m("div",Ve,[m("p",we,$(s.$t("customers.portal_access_text")),1),r(ee,{modelValue:e(n).currentCustomer.enable_portal,"onUpdate:modelValue":t[11]||(t[11]=o=>e(n).currentCustomer.enable_portal=o),class:"mt-1 flex"},null,8,["modelValue"])]),e(n).currentCustomer.enable_portal?(f(),_(u,{key:0,"content-loading":e(l),label:s.$t("customers.portal_access_url"),class:"md:col-span-2","help-text":s.$t("customers.portal_access_url_help")},{default:i(()=>[r(me,{token:Q.value},null,8,["token"])]),_:1},8,["content-loading","label","help-text"])):v("",!0),e(n).currentCustomer.enable_portal?(f(),_(u,{key:1,"content-loading":e(l),error:e(a).currentCustomer.password.$error&&e(a).currentCustomer.password.$errors[0].$message,label:s.$t("customers.password")},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.password,"onUpdate:modelValue":t[14]||(t[14]=o=>e(n).currentCustomer.password=o),modelModifiers:{trim:!0},"content-loading":e(l),type:e(b)?"text":"password",name:"password",invalid:e(a).currentCustomer.password.$error,onInput:t[15]||(t[15]=o=>e(a).currentCustomer.password.$touch())},{right:i(()=>[e(b)?(f(),_(y,{key:0,name:"EyeOffIcon",class:"w-5 h-5 mr-1 text-gray-500 cursor-pointer",onClick:t[12]||(t[12]=o=>k(b)?b.value=!e(b):b=!e(b))})):(f(),_(y,{key:1,name:"EyeIcon",class:"w-5 h-5 mr-1 text-gray-500 cursor-pointer",onClick:t[13]||(t[13]=o=>k(b)?b.value=!e(b):b=!e(b))}))]),_:1},8,["modelValue","content-loading","type","invalid"])]),_:1},8,["content-loading","error","label"])):v("",!0),e(n).currentCustomer.enable_portal?(f(),_(u,{key:2,error:e(a).currentCustomer.confirm_password.$error&&e(a).currentCustomer.confirm_password.$errors[0].$message,"content-loading":e(l),label:s.$t("customers.confirm_password")},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.confirm_password,"onUpdate:modelValue":t[18]||(t[18]=o=>e(n).currentCustomer.confirm_password=o),modelModifiers:{trim:!0},"content-loading":e(l),type:e(C)?"text":"password",name:"confirm_password",invalid:e(a).currentCustomer.confirm_password.$error,onInput:t[19]||(t[19]=o=>e(a).currentCustomer.confirm_password.$touch())},{right:i(()=>[e(C)?(f(),_(y,{key:0,name:"EyeOffIcon",class:"w-5 h-5 mr-1 text-gray-500 cursor-pointer",onClick:t[16]||(t[16]=o=>k(C)?C.value=!e(C):C=!e(C))})):(f(),_(y,{key:1,name:"EyeIcon",class:"w-5 h-5 mr-1 text-gray-500 cursor-pointer",onClick:t[17]||(t[17]=o=>k(C)?C.value=!e(C):C=!e(C))}))]),_:1},8,["modelValue","content-loading","type","invalid"])]),_:1},8,["error","content-loading","label"])):v("",!0)]),_:1})]),r(x,{class:"mb-5 md:mb-8"}),m("div",he,[m("h6",Be,$(s.$t("customers.billing_address")),1),e(n).currentCustomer.billing?(f(),_(M,{key:0,class:"col-span-5 lg:col-span-4"},{default:i(()=>[r(u,{label:s.$t("customers.name"),"content-loading":e(l)},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.billing.name,"onUpdate:modelValue":t[20]||(t[20]=o=>e(n).currentCustomer.billing.name=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text",class:"w-full",name:"address_name"},null,8,["modelValue","content-loading"])]),_:1},8,["label","content-loading"]),r(u,{label:s.$t("customers.country"),"content-loading":e(l)},{default:i(()=>[r(L,{modelValue:e(n).currentCustomer.billing.country_id,"onUpdate:modelValue":t[21]||(t[21]=o=>e(n).currentCustomer.billing.country_id=o),"value-prop":"id",label:"name","track-by":"name","resolve-on-load":"",searchable:"","content-loading":e(l),options:e(q).countries,placeholder:s.$t("general.select_country"),class:"w-full"},null,8,["modelValue","content-loading","options","placeholder"])]),_:1},8,["label","content-loading"]),r(u,{label:s.$t("customers.state"),"content-loading":e(l)},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.billing.state,"onUpdate:modelValue":t[22]||(t[22]=o=>e(n).currentCustomer.billing.state=o),"content-loading":e(l),name:"billing.state",type:"text"},null,8,["modelValue","content-loading"])]),_:1},8,["label","content-loading"]),r(u,{"content-loading":e(l),label:s.$t("customers.city")},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.billing.city,"onUpdate:modelValue":t[23]||(t[23]=o=>e(n).currentCustomer.billing.city=o),"content-loading":e(l),name:"billing.city",type:"text"},null,8,["modelValue","content-loading"])]),_:1},8,["content-loading","label"]),r(u,{label:s.$t("customers.address"),error:e(a).currentCustomer.billing.address_street_1.$error&&e(a).currentCustomer.billing.address_street_1.$errors[0].$message||e(a).currentCustomer.billing.address_street_2.$error&&e(a).currentCustomer.billing.address_street_2.$errors[0].$message,"content-loading":e(l)},{default:i(()=>[r(U,{modelValue:e(n).currentCustomer.billing.address_street_1,"onUpdate:modelValue":t[24]||(t[24]=o=>e(n).currentCustomer.billing.address_street_1=o),modelModifiers:{trim:!0},"content-loading":e(l),placeholder:s.$t("general.street_1"),type:"text",name:"billing_street1","container-class":"mt-3",onInput:t[25]||(t[25]=o=>e(a).currentCustomer.billing.address_street_1.$touch())},null,8,["modelValue","content-loading","placeholder"]),r(U,{modelValue:e(n).currentCustomer.billing.address_street_2,"onUpdate:modelValue":t[26]||(t[26]=o=>e(n).currentCustomer.billing.address_street_2=o),modelModifiers:{trim:!0},"content-loading":e(l),placeholder:s.$t("general.street_2"),type:"text",class:"mt-3",name:"billing_street2","container-class":"mt-3",onInput:t[27]||(t[27]=o=>e(a).currentCustomer.billing.address_street_2.$touch())},null,8,["modelValue","content-loading","placeholder"])]),_:1},8,["label","error","content-loading"]),m("div",Ie,[r(u,{"content-loading":e(l),label:s.$t("customers.phone"),class:"text-left"},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.billing.phone,"onUpdate:modelValue":t[28]||(t[28]=o=>e(n).currentCustomer.billing.phone=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text",name:"phone"},null,8,["modelValue","content-loading"])]),_:1},8,["content-loading","label"]),r(u,{label:s.$t("customers.zip_code"),"content-loading":e(l),class:"mt-2 text-left"},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.billing.zip,"onUpdate:modelValue":t[29]||(t[29]=o=>e(n).currentCustomer.billing.zip=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text",name:"zip"},null,8,["modelValue","content-loading"])]),_:1},8,["label","content-loading"])])]),_:1})):v("",!0)]),r(x,{class:"mb-5 md:mb-8"}),m("div",Me,[m("div",xe,[r(D,{type:"button","content-loading":e(l),size:"sm",variant:"primary-outline",onClick:t[30]||(t[30]=o=>e(n).copyAddress(!0))},{left:i(o=>[r(y,{name:"DocumentDuplicateIcon",class:E(o.class)},null,8,["class"])]),default:i(()=>[G(" "+$(s.$t("customers.copy_billing_address")),1)]),_:1},8,["content-loading"])])]),e(n).currentCustomer.shipping?(f(),j("div",Ue,[m("h6",ke,$(s.$t("customers.shipping_address")),1),r(M,{class:"col-span-5 lg:col-span-4"},{default:i(()=>[r(u,{"content-loading":e(l),label:s.$t("customers.name")},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.shipping.name,"onUpdate:modelValue":t[31]||(t[31]=o=>e(n).currentCustomer.shipping.name=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text",name:"address_name"},null,8,["modelValue","content-loading"])]),_:1},8,["content-loading","label"]),r(u,{label:s.$t("customers.country"),"content-loading":e(l)},{default:i(()=>[r(L,{modelValue:e(n).currentCustomer.shipping.country_id,"onUpdate:modelValue":t[32]||(t[32]=o=>e(n).currentCustomer.shipping.country_id=o),"value-prop":"id",label:"name","track-by":"name","resolve-on-load":"",searchable:"","content-loading":e(l),options:e(q).countries,placeholder:s.$t("general.select_country"),class:"w-full"},null,8,["modelValue","content-loading","options","placeholder"])]),_:1},8,["label","content-loading"]),r(u,{label:s.$t("customers.state"),"content-loading":e(l)},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.shipping.state,"onUpdate:modelValue":t[33]||(t[33]=o=>e(n).currentCustomer.shipping.state=o),"content-loading":e(l),name:"shipping.state",type:"text"},null,8,["modelValue","content-loading"])]),_:1},8,["label","content-loading"]),r(u,{"content-loading":e(l),label:s.$t("customers.city")},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.shipping.city,"onUpdate:modelValue":t[34]||(t[34]=o=>e(n).currentCustomer.shipping.city=o),"content-loading":e(l),name:"shipping.city",type:"text"},null,8,["modelValue","content-loading"])]),_:1},8,["content-loading","label"]),r(u,{label:s.$t("customers.address"),"content-loading":e(l),error:e(a).currentCustomer.shipping.address_street_1.$error&&e(a).currentCustomer.shipping.address_street_1.$errors[0].$message||e(a).currentCustomer.shipping.address_street_2.$error&&e(a).currentCustomer.shipping.address_street_2.$errors[0].$message},{default:i(()=>[r(U,{modelValue:e(n).currentCustomer.shipping.address_street_1,"onUpdate:modelValue":t[35]||(t[35]=o=>e(n).currentCustomer.shipping.address_street_1=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text",placeholder:s.$t("general.street_1"),name:"shipping_street1",onInput:t[36]||(t[36]=o=>e(a).currentCustomer.shipping.address_street_1.$touch())},null,8,["modelValue","content-loading","placeholder"]),r(U,{modelValue:e(n).currentCustomer.shipping.address_street_2,"onUpdate:modelValue":t[37]||(t[37]=o=>e(n).currentCustomer.shipping.address_street_2=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text",placeholder:s.$t("general.street_2"),name:"shipping_street2",class:"mt-3","container-class":"mt-3",onInput:t[38]||(t[38]=o=>e(a).currentCustomer.shipping.address_street_2.$touch())},null,8,["modelValue","content-loading","placeholder"])]),_:1},8,["label","content-loading","error"]),m("div",Se,[r(u,{"content-loading":e(l),label:s.$t("customers.phone"),class:"text-left"},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.shipping.phone,"onUpdate:modelValue":t[39]||(t[39]=o=>e(n).currentCustomer.shipping.phone=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text",name:"phone"},null,8,["modelValue","content-loading"])]),_:1},8,["content-loading","label"]),r(u,{label:s.$t("customers.zip_code"),"content-loading":e(l),class:"mt-2 text-left"},{default:i(()=>[r(d,{modelValue:e(n).currentCustomer.shipping.zip,"onUpdate:modelValue":t[40]||(t[40]=o=>e(n).currentCustomer.shipping.zip=o),modelModifiers:{trim:!0},"content-loading":e(l),type:"text",name:"zip"},null,8,["modelValue","content-loading"])]),_:1},8,["label","content-loading"])])]),_:1})])):v("",!0),e(F).customFields.length>0?(f(),_(x,{key:1,class:"mb-5 md:mb-8"})):v("",!0),m("div",qe,[e(F).customFields.length>0?(f(),j("h6",Le,$(s.$t("settings.custom_fields.title")),1)):v("",!0),m("div",ze,[r(Ce,{type:"Customer",store:e(n),"store-prop":"currentCustomer","is-edit":V.value,"is-loading":e(J),"custom-field-scope":A},null,8,["store","is-edit","is-loading"])])])]),_:1})],32)]),_:1})}}};export{Ge as default};