import{q as g,S as j,r as v,j as t,J as w,f as y}from"./app-Bup04Qnx.js";import{A as N}from"./AuthenticatedLayout-BdDF4YYO.js";import S from"./DeleteModal-CP0JmVEt.js";import k from"./ConfigurationForm-Z3UjsXGW.js";import"./index-DdNKWgRS.js";import"./clsx-B-dksMZM.js";import"./index-CtjruoRR.js";import"./floating-ui.dom-CwWDmSD9.js";import"./format-CisCU4Rs.js";import"./WithModal-CbKxT3eW.js";import"./Input-Bs1ncZB7.js";import"./BaseForm-wkPKZ5Eg.js";import"./TextArea-DiAj0IR8.js";import"./Select-Cs0aMrtU.js";import"./FormBuilder-B6qVpe84.js";import"./index-Dy_g3AZ5.js";function C(a){let n=[];return n=[{name:"configuration",label:"Pengaturan Umum",value:"/admin/configuration"}],n}function G(a){const{url:n}=g(),{data:m,setData:c,post:u,processing:l}=j(a.configurations),d=e=>(e.preventDefault(),u("/admin/configuration",{onSuccess:()=>{y.reload({only:["configurations"]})}})),[s,f]=v.useState(null),p=e=>{f(e)},x={data:m,setData:c},h=C();return t.jsxs(N,{title:a.title,auth:a.auth,children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx("div",{className:"flex flex-col w-full sm:w-max border",children:h.map((e,r)=>t.jsx(w,{href:e.value,className:`p-2 border-y border-neutral-300 ${n==e.value?"bg-neutral-200 font-semibold":""}`,children:e.label},r))}),t.jsxs("div",{className:"relative w-full max-w-xl border bg-white sm:p-4 rounded-lg",children:[a.options.map((e,r)=>{const b=a.configurations.filter(i=>i[e]);return t.jsx("div",{className:"",children:b[0][e].map((i,o)=>t.jsx("div",{children:t.jsx(k,{...x,inputType:a.inputType[e],type:e,configuration:i,typeIndex:r,index:o})},o))},r)}),t.jsx("div",{className:"sticky bottom-5 flex w-full z-50 mt-2",children:t.jsx("button",{onClick:d,className:"btn btn-primary btn-sm w-full",disabled:l,children:t.jsx("span",{className:`${l&&"loading"}`,children:"Simpan"})})})]})]}),s?t.jsx(t.Fragment,{children:t.jsx(S,{data:s,handleClick:()=>p(null)})}):null]})}export{G as default};
