import{j as l,B as r,b as e,q as u,E as w,an as s,bv as S,ac as z,a6 as T,r as m,T as B,d as _}from"./index-ktJf6c6X.js";import{d as $}from"./ArrowBack-LOmLSQMc.js";import{d as j}from"./Edit-yG08B1CI.js";import{d as H}from"./Refresh-BLaRV1O5.js";import{d as W}from"./CleaningServices-DbZ4BtsA.js";const N=({title:c,subtitle:n,status:i,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}),n&&e(u,{variant:"caption",color:"text.secondary",component:"div",children:n})]}),i&&e(w,{label:i,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:n,sx:i})=>{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",...i}),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))}),n&&e(r,{sx:{display:"flex",gap:1,alignItems:"center",flexShrink:0},children:n})]})},A=({onSearch:c,onRefresh:n,onClear:i,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:n,sx:v,children:"Refresh"}),e(s,{variant:"outlined",size:"small",color:"warning",startIcon:e(W,{}),onClick:i,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};
