import{r as h,j as e,B as r,E as l,J as j}from"./index-7414fd54.js";import{u}from"./index.esm-87a8ddec.js";import{o as x}from"./yup-42c56a9b.js";import{c as f,b as v}from"./index.esm-24ac0554.js";import{T as C}from"./TextArea-5df59b36.js";import{T as F}from"./ThumbUp-ae9433d5.js";import{T as L}from"./ThumbDown-89b0eec2.js";import{D as b}from"./Dialog-8695d0ea.js";import{D as y}from"./DialogTitle-68b28184.js";import{D as g}from"./DialogContent-05d9166f.js";import{D as k}from"./DialogContentText-ab6f5201.js";import{D as A}from"./DialogActions-0c149659.js";import{L as D}from"./LoadingButton-75c9b57b.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};
