import{r as h,j as e,B as r,E as l,J as j}from"./index-c1429e77.js";import{u}from"./index.esm-e372dd1f.js";import{o as x}from"./yup-0d492cec.js";import{c as f,b as v}from"./index.esm-85841cf7.js";import{T as C}from"./TextArea-d5dc99f9.js";import{T as F}from"./ThumbUp-92e165d6.js";import{T as L}from"./ThumbDown-07343f42.js";import{D as b}from"./Dialog-f34656f2.js";import{D as y}from"./DialogTitle-7578ca2e.js";import{D as g}from"./DialogContent-189c94c5.js";import{D as k}from"./DialogContentText-7ab1972a.js";import{D as A}from"./DialogActions-7758c09d.js";import{L as D}from"./LoadingButton-a5f23242.js";const Q=({selectedItems:o,onBulkApprove:B,onBulkReject:R,loading:s=!1,disabled:d=!1})=>{const[S,i]=h.useState(!1),[T,a]=h.useState(!1),w=f().shape({description:v().notRequired()}),E=f().shape({description:v().required("Please enter reason before you reject")}),t=u({resolver:x(w)}),n=u({resolver:x(E)}),M=m=>{B(m.description||void 0),i(!1),t.reset()},W=m=>{R(m.description||""),a(!1),n.reset()},c=()=>{i(!1),t.reset()},p=()=>{a(!1),n.reset()};return e.jsxs(r,{display:"flex",gap:2,children:[e.jsxs(l,{variant:"contained",color:"success",disabled:d||o.length===0||s,startIcon:e.jsx(F,{}),onClick:()=>i(!0),children:["Bulk Approve (",o.length,")"]}),e.jsxs(l,{variant:"contained",color:"error",disabled:d||o.length===0||s,startIcon:e.jsx(L,{}),onClick:()=>a(!0),children:["Bulk Reject (",o.length,")"]}),e.jsxs(b,{open:S,onClose:c,maxWidth:"sm",fullWidth:!0,children:[e.jsx(y,{children:e.jsxs(r,{display:"flex",justifyContent:"space-between",alignItems:"center",children:["Bulk Approve Items",e.jsx(j,{style:{cursor:"pointer"},onClick:c})]})}),e.jsxs("form",{onSubmit:t.handleSubmit(M),children:[e.jsxs(g,{children:[e.jsxs(k,{children:["Are you sure you want to approve ",o.length," selected items?"]}),e.jsx(r,{mt:2,children:e.jsx(C,{control:t.control,name:"description",label:"Comments (Optional)",placeholder:"Enter approval comments...",rows:3})})]}),e.jsxs(A,{children:[e.jsx(l,{onClick:c,color:"inherit",children:"Cancel"}),e.jsx(D,{type:"submit",variant:"contained",color:"success",loading:s,children:"Approve"})]})]})]}),e.jsxs(b,{open:T,onClose:p,maxWidth:"sm",fullWidth:!0,children:[e.jsx(y,{children:e.jsxs(r,{display:"flex",justifyContent:"space-between",alignItems:"center",children:["Bulk Reject Items",e.jsx(j,{style:{cursor:"pointer"},onClick:p})]})}),e.jsxs("form",{onSubmit:n.handleSubmit(W),children:[e.jsxs(g,{children:[e.jsxs(k,{children:["Are you sure you want to reject ",o.length," selected items?"]}),e.jsx(r,{mt:2,children:e.jsx(C,{control:n.control,name:"description",label:"Rejection Reason *",placeholder:"Enter reason for rejection...",rows:3})})]}),e.jsxs(A,{children:[e.jsx(l,{onClick:p,color:"inherit",children:"Cancel"}),e.jsx(D,{type:"submit",variant:"contained",color:"error",loading:s,children:"Reject"})]})]})]})]})};export{Q as B};
