import{r as h,j as e,B as r,E as l,J as j}from"./index-7d3dbb9c.js";import{u}from"./index.esm-12cc9f7b.js";import{o as x}from"./yup-55e79238.js";import{c as f,b as v}from"./index.esm-9d396c5f.js";import{T as C}from"./TextArea-4d76f175.js";import{T as F}from"./ThumbUp-b9d772b2.js";import{T as L}from"./ThumbDown-18ff0f0a.js";import{D as b}from"./Dialog-d125aee1.js";import{D as y}from"./DialogTitle-a3176c12.js";import{D as g}from"./DialogContent-d34f4ba4.js";import{D as k}from"./DialogContentText-9128b573.js";import{D as A}from"./DialogActions-99629c3a.js";import{L as D}from"./LoadingButton-323cc52e.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};
