import{r as h,j as e,B as r,E as l,J as j}from"./index-1350aa97.js";import{u}from"./index.esm-e43efa83.js";import{o as x}from"./yup-eafdc449.js";import{c as f,b as v}from"./index.esm-74444d29.js";import{T as C}from"./TextArea-c6344fb4.js";import{T as F}from"./ThumbUp-417e93e3.js";import{T as L}from"./ThumbDown-83b2d799.js";import{D as b}from"./Dialog-e78460a0.js";import{D as y}from"./DialogTitle-549fa0f9.js";import{D as g}from"./DialogContent-c8c72209.js";import{D as k}from"./DialogContentText-e9b61a7a.js";import{D as A}from"./DialogActions-4ba990ac.js";import{L as D}from"./LoadingButton-1c15b99a.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};
