import{i as L,Z as C,r as u,c as i,o as a,a as s,b as n,d as k,w as f,F as V,j as g,t as p,e as F}from"./app-BhD6J0Va.js";import{L as S}from"./Layout-BNWXhjq5.js";import{F as A}from"./FileInput-9EQ4xxKj.js";import{T as B}from"./TextInput-CRQDtFka.js";import{S as E}from"./SelectInput-Cao9wiYo.js";import{L as H}from"./LoadingButton-BKJMdZnQ.js";import{_ as I}from"./FlashMessages-DW2Y2mP0.js";import"./moment-DeOISj6Y.js";import"./v4-SoommWqA.js";const N={components:{FileInput:A,Head:C,Link:L,LoadingButton:H,SelectInput:E,TextInput:B},layout:S,props:{countries:Array,cities:Array,title:String,roles:Array},remember:"form",data(){return{form:this.$inertia.form({first_name:"",last_name:"",phone:"",email:"",city:null,address:"",country_id:null,role_id:null,password:"",photo:null})}},created(){},methods:{setDefaultValue(o,r,m){const d=o.find(e=>e.name.match(new RegExp(m+".*")));d&&(this.form[r]=d.id)},store(){this.form.post(this.route("users.store"))}}},P={class:"max-w-full bg-white rounded-md shadow overflow-hidden"},T={class:"flex flex-wrap -mb-8 -mr-6 p-8"},j=["value"],D=["value"],R={class:"flex items-center justify-end px-8 py-4 bg-gray-50 border-t border-gray-100"};function h(o,r,m,d,e,b){const y=u("Head"),t=u("text-input"),w=u("select-input"),v=u("file-input"),_=u("loading-button");return a(),i("div",null,[s(y,{title:o.$t(m.title)},null,8,["title"]),n("div",P,[n("form",{onSubmit:r[10]||(r[10]=k((...l)=>b.store&&b.store(...l),["prevent"]))},[n("div",T,[s(t,{modelValue:e.form.first_name,"onUpdate:modelValue":r[0]||(r[0]=l=>e.form.first_name=l),error:e.form.errors.first_name,class:"pb-8 pr-6 w-full lg:w-1/3",label:o.$t("First name")},null,8,["modelValue","error","label"]),s(t,{modelValue:e.form.last_name,"onUpdate:modelValue":r[1]||(r[1]=l=>e.form.last_name=l),error:e.form.errors.last_name,class:"pb-8 pr-6 w-full lg:w-1/3",label:o.$t("Last name")},null,8,["modelValue","error","label"]),s(t,{modelValue:e.form.email,"onUpdate:modelValue":r[2]||(r[2]=l=>e.form.email=l),error:e.form.errors.email,class:"pb-8 pr-6 w-full lg:w-1/3",label:o.$t("Email")},null,8,["modelValue","error","label"]),s(t,{modelValue:e.form.phone,"onUpdate:modelValue":r[3]||(r[3]=l=>e.form.phone=l),error:e.form.errors.phone,class:"pb-8 pr-6 w-full lg:w-1/2",label:o.$t("Phone")},null,8,["modelValue","error","label"]),s(t,{modelValue:e.form.city,"onUpdate:modelValue":r[4]||(r[4]=l=>e.form.city=l),error:e.form.errors.city,class:"pb-8 pr-6 w-full lg:w-1/2",label:o.$t("City")},null,8,["modelValue","error","label"]),s(t,{modelValue:e.form.address,"onUpdate:modelValue":r[5]||(r[5]=l=>e.form.address=l),error:e.form.errors.address,class:"pb-8 pr-6 w-full lg:w-1/3",label:o.$t("Address")},null,8,["modelValue","error","label"]),s(w,{modelValue:e.form.country_id,"onUpdate:modelValue":r[6]||(r[6]=l=>e.form.country_id=l),error:e.form.errors.country_id,class:"pr-6 pb-8 w-full lg:w-1/3",label:o.$t("Country")},{default:f(()=>[r[11]||(r[11]=n("option",{value:null},null,-1)),(a(!0),i(V,null,g(m.countries,l=>(a(),i("option",{key:l.id,value:l.id},p(o.$t(l.name)),9,j))),128))]),_:1},8,["modelValue","error","label"]),s(t,{modelValue:e.form.password,"onUpdate:modelValue":r[7]||(r[7]=l=>e.form.password=l),error:e.form.errors.password,class:"pb-8 pr-6 w-full lg:w-1/3",type:"password",autocomplete:"new-password",label:o.$t("Password")},null,8,["modelValue","error","label"]),s(w,{modelValue:e.form.role_id,"onUpdate:modelValue":r[8]||(r[8]=l=>e.form.role_id=l),error:e.form.errors.role_id,class:"pb-8 pr-6 w-full lg:w-1/2",label:o.$t("Role")},{default:f(()=>[r[12]||(r[12]=n("option",{value:null},null,-1)),(a(!0),i(V,null,g(m.roles,(l,U)=>(a(),i("option",{key:U,value:l.id},p(l.name),9,D))),128))]),_:1},8,["modelValue","error","label"]),s(v,{modelValue:e.form.photo,"onUpdate:modelValue":r[9]||(r[9]=l=>e.form.photo=l),error:e.form.errors.photo,class:"pb-8 pr-6 w-full lg:w-1/2",type:"file",accept:"image/*",label:o.$t("Photo")},null,8,["modelValue","error","label"])]),n("div",R,[s(_,{loading:e.form.processing,class:"btn-indigo",type:"submit"},{default:f(()=>[F(p(o.$t("Create"))+" "+p(o.$t("User")),1)]),_:1},8,["loading"])])],32)])])}const O=I(N,[["render",h]]);export{O as default};
