import{j as r,B as l,b as e,s as u,F as w,$ as s,a$ as S,a3 as z,Y as $,r as m,T,d as B}from"./index-BiWH3VAt.js";import{d as _}from"./ArrowBack-BI1nukdF.js";import{d as j}from"./Edit-Dxe9uSJL.js";import{d as H,a as W}from"./Refresh-DdIiUmdE.js";const L=({title:c,subtitle:n,status:i,statusColor:t="default",extraChips:a,onBack:o,onEdit:h,showEdit:x=!0,onPrint:p,rightActions:f,sx:g})=>r(l,{sx:{px:3,pt:2.5,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",...g},children:[r(l,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[r(l,{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]}),r(l,{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]})]}),N=({stats:c,actions:n,sx:i})=>{const t=c.filter(a=>!a.hidden);return r(l,{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(l,{sx:{display:"flex",alignItems:"center",gap:3,flexWrap:"wrap"},children:t.map((a,o)=>r(z.Fragment,{children:[a.dividerBefore&&e($,{orientation:"vertical",flexItem:!0,sx:{mx:.5}}),r(l,{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(l,{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=400})=>{const[C,y]=m.useState(""),d=m.useRef(null);m.useEffect(()=>{f!==void 0&&y("")},[f]),m.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const I=k=>{const b=k.target.value;y(b),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>c(b),g)},v={height:36,whiteSpace:"nowrap",flexShrink:0};return r(l,{display:"flex",alignItems:"center",mb:2,gap:1.5,sx:{flexWrap:"nowrap"},children:[e(T,{size:"small",placeholder:p,value:C,onChange:I,sx:{width:320,flexShrink:0,"& .MuiOutlinedInput-root":{height:36}}}),e(l,{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(B,{}),onClick:t,sx:v,children:a}):null)]})};export{L as C,N as a,A as b};
