import{q as g,S as j,r as v,j as e,J as w,f as y}from"./app-DB4YCWeF.js";import{A as N}from"./AuthenticatedLayout-DqLtl3fm.js";import S from"./DeleteModal-DffYy1fk.js";import k from"./ConfigurationForm-BIU_lPBQ.js";import"./clsx-B-dksMZM.js";import"./WithModal-BI-p938E.js";import"./Input-BfNm_9oA.js";import"./BaseForm-CkSb_d40.js";import"./FormBuilder-Dm7wfKiL.js";import"./Select-DXXQNVxU.js";import"./index-D_LogWT2.js";import"./Checkbox-Bn48SEXM.js";import"./lib-C9iOZMGt.js";function C(a){let n=[];return n=[{name:"configuration",label:"Pengaturan Umum",value:"/admin/configuration"}],n}function R(a){const{url:n}=g(),{data:m,setData:c,post:u,processing:s}=j(a.configurations),d=t=>(t.preventDefault(),u("/admin/configuration",{onSuccess:()=>{y.reload({only:["configurations"]})}})),[i,f]=v.useState(null),x=t=>{f(t)},p={data:m,setData:c},h=C();return e.jsxs(N,{title:a.title,auth:a.auth,children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("div",{className:"flex flex-col w-full sm:w-max border",children:h.map((t,l)=>e.jsx(w,{href:t.value,className:`p-2 border-y border-neutral-300 ${n==t.value?"bg-neutral-200 font-semibold":""}`,children:t.label},l))}),e.jsxs("div",{className:"relative w-full max-w-xl border bg-white sm:p-4 rounded-lg",children:[a.options.map((t,l)=>{const b=a.configurations.filter(r=>r[t]);return e.jsx("div",{className:"",children:b[0][t].map((r,o)=>e.jsx("div",{children:e.jsx(k,{...p,inputType:a.inputType[t],type:t,configuration:r,typeIndex:l,index:o})},o))},l)}),e.jsx("div",{className:"sticky bottom-5 flex w-full z-50 mt-2",children:e.jsx("button",{onClick:d,className:"btn btn-primary btn-sm w-full",disabled:s,children:e.jsx("span",{className:`${s&&"loading"}`,children:"Simpan"})})})]})]}),i?e.jsx(e.Fragment,{children:e.jsx(S,{data:i,handleClick:()=>x(null)})}):null]})}export{R as default};
