import{r as h,j as e,B as r,E as l,J as j}from"./index-5768b108.js";import{u}from"./index.esm-4803c918.js";import{o as x}from"./yup-7ddf262a.js";import{c as f,b as v}from"./index.esm-85e2fec5.js";import{T as C}from"./TextArea-286cc2d2.js";import{T as F}from"./ThumbUp-b84d3577.js";import{T as L}from"./ThumbDown-2699f7ff.js";import{D as b}from"./Dialog-82ae8e2c.js";import{D as y}from"./DialogTitle-399fe93b.js";import{D as g}from"./DialogContent-281dc416.js";import{D as k}from"./DialogContentText-28299755.js";import{D as A}from"./DialogActions-96d02ef8.js";import{L as D}from"./LoadingButton-b684247e.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};
