import{q as v,r as N,S as C,j as e}from"./app-Bup04Qnx.js";import{W as R}from"./WithModal-CbKxT3eW.js";import{T as S}from"./TextArea-DiAj0IR8.js";import{u as T}from"./useFormChange-D35moWjQ.js";const D=u=>{const{id:l,data:o=null,isLabel:x=!0,content:t=null,handleClick:r}=u,c=`rejected_${l}`,{page:s}=v().props,i=N.useRef(),{data:d,setData:h,put:p,errors:b,processing:m}=C({rejected:"1",rejected_message:""});function j(n){const{name:a,value:k}=T(n,d);h(g=>({...g,[a]:k}))}const f=n=>{n.preventDefault(),p(`${s.url}/${l}`,{onSuccess:()=>{var a;(a=i.current)==null||a.click()}})};return e.jsx(R,{type:c,backdrop:!0,onClick:r,modalBoxSize:"max-w-3xl",children:e.jsxs("form",{action:"",children:[e.jsx("h1",{className:"text-lg font-bold",children:"Konfirmasi"}),x?e.jsxs("p",{children:["Apakah anda yakin ingin tolak ",s.label," ini?"]}):null,e.jsx("div",{className:"w-full max-h-[50vh] md:max-h-[30vh] overflow-auto",children:!!o&&!!t&&typeof t=="function"&&t(o)}),e.jsx("div",{className:"mt-2",children:e.jsx(S,{required:!0,type:"text",placeHolder:"Tulis alasan penolakan",name:"rejected_message",isLabel:!1,handleChange:j,data:d,errors:b})}),e.jsxs("div",{className:"modal-action",children:[e.jsx("label",{ref:i,onClick:r,htmlFor:`modal_${c}`,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:m,children:[e.jsx("span",{className:`${m&&"loading"}`}),e.jsxs("span",{children:["Tolak ",s.label]})]})]})]})})};export{D as R};
