import{j as l,B as r,b as e,q as u,E as w,ai as s,bt as S,a8 as z,a2 as T,r as m,T as B,d as _}from"./index-DlNZgIG9.js";import{d as $}from"./ArrowBack-Fv1ENcoB.js";import{d as j}from"./Edit-nS4AoG1a.js";import{d as H}from"./Refresh-DUhB7dKr.js";import{d as W}from"./CleaningServices-6GvlUwbp.js";const N=({title:c,subtitle:i,status:n,statusColor:t="default",extraChips:a,onBack:o,onEdit:h,showEdit:x=!0,onPrint:p,rightActions:f,sx:g})=>l(r,{sx:{px:3,pt:2.5,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",...g},children:[l(r,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[l(r,{children:[e(u,{variant:"h5",fontWeight:600,sx:{lineHeight:1.3},children:c}),i&&e(u,{variant:"caption",color:"text.secondary",component:"div",children:i})]}),n&&e(w,{label:n,color:t,size:"small"}),a]}),l(r,{sx:{display:"flex",gap:1,alignItems:"center",flexShrink:0,mt:.25},children:[o&&e(s,{variant:"outlined",size:"small",startIcon:e($,{}),onClick:o,children:"Back"}),p&&e(s,{variant:"outlined",size:"small",startIcon:e(S,{}),onClick:p,children:"Print"}),h&&x&&e(s,{variant:"outlined",size:"small",startIcon:e(j,{}),onClick:h,children:"Edit"}),f]})]}),q=({stats:c,actions:i,sx:n})=>{const t=c.filter(a=>!a.hidden);return l(r,{sx:a=>({flexShrink:0,backgroundColor:a.palette.background.paper,borderTop:`1px solid ${a.palette.divider}`,px:3,py:1.5,display:"flex",alignItems:"center",justifyContent:"space-between",...n}),children:[e(r,{sx:{display:"flex",alignItems:"center",gap:3,flexWrap:"wrap"},children:t.map((a,o)=>l(z.Fragment,{children:[a.dividerBefore&&e(T,{orientation:"vertical",flexItem:!0,sx:{mx:.5}}),l(r,{children:[e(u,{variant:"caption",color:"text.secondary",sx:{display:"block",lineHeight:1.2},children:a.label}),a.highlight?typeof a.value=="string"||typeof a.value=="number"?e(u,{variant:"h6",color:"primary",fontWeight:700,sx:{fontVariantNumeric:"tabular-nums",lineHeight:1.3},children:a.value}):a.value:typeof a.value=="string"||typeof a.value=="number"?e(u,{variant:"body2",fontWeight:600,sx:{fontVariantNumeric:"tabular-nums"},children:a.value}):a.value]})]},o))}),i&&e(r,{sx:{display:"flex",gap:1,alignItems:"center",flexShrink:0},children:i})]})},A=({onSearch:c,onRefresh:i,onClear:n,onCreate:t,createLabel:a="Create",createButton:o,exportButton:h,extraActions:x,searchPlaceholder:p="Search by customer, number, status...",resetKey:f,debounceMs:g=500})=>{const[C,b]=m.useState(""),d=m.useRef(null);m.useEffect(()=>{f!==void 0&&b("")},[f]),m.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const I=k=>{const y=k.target.value;b(y),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>c(y),g)},v={height:36,whiteSpace:"nowrap",flexShrink:0};return l(r,{display:"flex",alignItems:"center",mb:2,gap:1.5,sx:{flexWrap:"nowrap"},children:[e(B,{size:"small",placeholder:p,value:C,onChange:I,sx:{width:320,flexShrink:0,"& .MuiOutlinedInput-root":{height:36}}}),e(r,{sx:{flexGrow:1}}),h,x,e(s,{variant:"outlined",size:"small",startIcon:e(H,{}),onClick:i,sx:v,children:"Refresh"}),e(s,{variant:"outlined",size:"small",color:"warning",startIcon:e(W,{}),onClick:n,sx:v,children:"Clear All"}),o??(t?e(s,{variant:"contained",size:"small",startIcon:e(_,{}),onClick:t,sx:v,children:a}):null)]})};export{N as C,q as a,A as b};
