import{L as w}from"./Layout-BNWXhjq5.js";import{T as x}from"./TextInput-CRQDtFka.js";import{L as k}from"./LoadingButton-BKJMdZnQ.js";import{Z as C,i as N,r as a,c as l,o,a as m,b as n,d as L,h as _,f as c,w as d,F as b,j as g,t as u,e as B}from"./app-BhD6J0Va.js";import{S}from"./SelectInput-Cao9wiYo.js";import{_ as h}from"./FlashMessages-DW2Y2mP0.js";import"./moment-DeOISj6Y.js";import"./v4-SoommWqA.js";const H={metaInfo:{title:"Create Category"},components:{SelectInput:S,LoadingButton:k,TextInput:x,Link:N,Head:C},layout:w,props:{title:String,categories:{required:!1},departments:{required:!1}},remember:"form",data(){return{form:this.$inertia.form({name:null,parent_id:null,department_id:null,color:null})}},methods:{store(){this.form.post(this.route("categories.store"))}}},I={class:"bg-white rounded-md shadow overflow-hidden max-w-3xl"},T={class:"p-8 -mr-6 -mb-8 flex flex-wrap"},U=["value"],j=["value"],q={class:"px-8 py-4 bg-gray-50 border-t border-gray-100 flex justify-end items-center"};function D(s,t,i,F,r,p){const y=a("Head"),f=a("select-input"),v=a("text-input"),V=a("loading-button");return o(),l("div",null,[m(y,{title:i.title},null,8,["title"]),n("div",I,[n("form",{onSubmit:t[3]||(t[3]=L((...e)=>p.store&&p.store(...e),["prevent"]))},[n("div",T,[r.form.parent_id?c("",!0):(o(),_(f,{key:0,modelValue:r.form.department_id,"onUpdate:modelValue":t[0]||(t[0]=e=>r.form.department_id=e),error:r.form.errors.department_id,class:"pr-6 pb-8 w-full",label:s.$t("Department")},{default:d(()=>[t[4]||(t[4]=n("option",{value:null},"None",-1)),(o(!0),l(b,null,g(i.departments,e=>(o(),l("option",{key:e.id,value:e.id},u(e.name),9,U))),128))]),_:1},8,["modelValue","error","label"])),r.form.department_id?c("",!0):(o(),_(f,{key:1,modelValue:r.form.parent_id,"onUpdate:modelValue":t[1]||(t[1]=e=>r.form.parent_id=e),error:r.form.errors.parent_id,class:"pr-6 pb-8 w-full",label:s.$t("Parent")},{default:d(()=>[t[5]||(t[5]=n("option",{value:null},"None",-1)),(o(!0),l(b,null,g(i.categories,e=>(o(),l("option",{key:e.id,value:e.id},u(e.name),9,j))),128))]),_:1},8,["modelValue","error","label"])),m(v,{modelValue:r.form.name,"onUpdate:modelValue":t[2]||(t[2]=e=>r.form.name=e),error:r.form.errors.name,class:"pr-6 pb-8 w-full",label:"Name"},null,8,["modelValue","error"])]),n("div",q,[m(V,{loading:r.form.processing,class:"btn-indigo",type:"submit"},{default:d(()=>[B(u(s.$t("Create Category")),1)]),_:1},8,["loading"])])],32)])])}const K=h(H,[["render",D]]);export{K as default};
