import{q as x,r as b,S as u,j as e}from"./app-Bup04Qnx.js";import{W as j}from"./WithModal-CbKxT3eW.js";const $=m=>{const{id:s,data:c=null,content:n=null,label:i,isForceDelete:r=!0,handleClick:t}=m,o=`delete_${s}`,{page:a}=x().props,d=b.useRef(),{delete:h,processing:l}=u(),f=k=>{k.preventDefault(),h(`${a.url}/${s}`,{onSuccess:()=>{var p;(p=d.current)==null||p.click()}})};return e.jsx(j,{type:o,backdrop:!0,onClick:t,children:e.jsxs("form",{action:"",children:[e.jsx("h1",{className:"text-lg font-bold",children:"Konfirmasi"}),r?e.jsx("div",{className:"mb-3 p-2 bg-orange-200 rounded-md flex",children:e.jsx("p",{children:"Perhatian! Data akan dihapus permanen"})}):null,e.jsxs("p",{children:["Apakah anda yakin ingin menghapus ",a.label," ini?"]}),e.jsx("p",{className:"text-xl font-semibold text-center",children:i}),e.jsx("div",{className:"",children:!!c&&!!n&&typeof n=="function"&&n(c)}),e.jsxs("div",{className:"modal-action",children:[e.jsx("label",{ref:d,onClick:t,htmlFor:`modal_${o}`,className:"btn btn-sm btn-neutral btn-outline",children:"Batal"}),e.jsxs("button",{onClick:f,className:"btn btn-sm btn-error bg-red-600 text-white ",disabled:l,children:[e.jsx("span",{className:`${l&&"loading"}`}),e.jsx("span",{children:"Hapus"})]})]})]})})},C=m=>{const{id:s,label:c,handleClick:n}=m,i=`restore_${s}`,{page:r}=x().props,t=b.useRef(),{put:o,processing:a}=u({restore_data:"1"}),d=h=>{h.preventDefault(),o(`${r.url}/${s}`,{onSuccess:()=>{var l;(l=t.current)==null||l.click()}})};return e.jsx(j,{type:i,backdrop:!0,onClick:n,children:e.jsxs("form",{action:"",children:[e.jsx("h1",{className:"text-lg font-bold",children:"Konfirmasi"}),e.jsxs("p",{children:["Apakah anda yakin ingin memulihkan data ",r.label," ini?"]}),e.jsx("p",{className:"text-xl font-semibold text-center",children:c}),e.jsxs("div",{className:"modal-action",children:[e.jsx("label",{ref:t,onClick:n,htmlFor:`modal_${i}`,className:"btn btn-sm btn-neutral btn-outline",children:"Batal"}),e.jsxs("button",{onClick:d,className:"btn btn-sm btn-primary text-white ",disabled:a,children:[e.jsx("span",{className:`${a&&"loading"}`}),e.jsx("span",{children:"Pulihkan"})]})]})]})})};export{$ as D,C as R};
