import{d as i,b as n}from"./app-DTeOhhdM.js";import{l as N}from"./defualtLogo-C0dU5cUD.js";function w({sales:t,auth:j}){var m,x;const g=r=>{var e,l,h,s,b;return((e=r==null?void 0:r.product)==null?void 0:e.name)??((h=(l=r==null?void 0:r.attribute)==null?void 0:l.product)==null?void 0:h.name)??((b=(s=r==null?void 0:r.arribute)==null?void 0:s.product)==null?void 0:b.name)??(r==null?void 0:r.name)??(r==null?void 0:r.product_name)??"—"},o={name:i.name,address:i.address,phone:i.phone,slogan:i.slogan},a=(t&&typeof t=="object"&&Array.isArray(t.details)?t.details:[]).map(r=>({name:g(r),quantity:Number(r.qty??r.quantity??1)||1,note:r.note??r.remark??""})),y=t!=null&&t.created_at?new Date(t.created_at).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",timeZone:"UTC"}):"",d=((m=t==null?void 0:t.table)==null?void 0:m.name)??((x=t==null?void 0:t.table)==null?void 0:x.label)??(t==null?void 0:t.table_name)??(t==null?void 0:t.order_type)??"",c=(t==null?void 0:t.order_slot)??null,p=(t==null?void 0:t.table_order_key)??(d&&c?`${d} #${c}`:null);return n.jsxs("div",{className:"print-2inch mx-auto break-after-avoid-page hidden print:!block print:bg-white print:relative",style:{width:"58mm",maxWidth:"58mm"},children:[n.jsx("style",{children:`
        @media print {
          @page { size: 58mm auto; margin: 0; padding: 0; }
          body { margin: 0; padding: 0; }
          .print-2inch { width: 220px !important; max-width: 220px !important; min-width: 220px !important; font-size: 13px !important; overflow: visible !important; color: #000 !important; }
          .print-2inch * { overflow: visible !important; color: inherit !important; }
          .print-2inch p, .print-2inch span, .print-2inch div { color: #000 !important; font-weight: 500 !important; }
          .print-2inch .font-semibold, .print-2inch .font-bold { font-weight: 700 !important; }
          .print-2inch .font-medium { font-weight: 600 !important; }
        }
        @media print and (max-width: 768px) {
          .print-2inch { width: 220px !important; max-width: 220px !important; min-width: 220px !important; box-sizing: border-box !important; }
        }
      `}),n.jsxs("div",{className:"print-2inch text-center py-1.5 border-b-2 border-gray-800",children:[i.companyLogo&&n.jsx("img",{src:i.companyLogo||N,alt:"Logo",className:"w-10 h-10 mx-auto mb-1 object-contain"}),n.jsx("h2",{className:"text-[14px] font-bold uppercase tracking-wide leading-tight",children:o.name}),o.slogan&&n.jsx("p",{className:"text-[13px] text-gray-600 italic mt-0.5",children:o.slogan})]}),n.jsxs("div",{className:"print-2inch text-center py-1.5 border-b-2 border-amber-600 bg-amber-50/80",children:[n.jsx("h3",{className:"text-[13px] font-bold uppercase tracking-wider text-amber-900",children:"KITCHEN ORDER"}),n.jsxs("div",{className:"text-[13px] mt-0.5 space-y-0.5 text-gray-700",children:[t!=null&&t.invoice_no?n.jsxs("p",{children:[n.jsx("span",{className:"font-semibold",children:"Inv#:"})," ",t.invoice_no]}):null,n.jsxs("p",{children:[n.jsx("span",{className:"font-semibold",children:"Date:"})," ",y]}),p&&n.jsxs("p",{children:[n.jsx("span",{className:"font-semibold",children:"Slot No.:"})," ",p]})]})]}),n.jsxs("div",{className:"print-2inch py-1",children:[n.jsx("p",{className:"text-[12px] font-bold uppercase mb-0.5 border-b border-gray-400 pb-0.5",children:"Items"}),n.jsxs("div",{className:"text-[13px] font-semibold grid grid-cols-12 gap-0.5 py-0.5 border-b border-gray-400",children:[n.jsx("div",{className:"col-span-8",children:"Item"}),n.jsx("div",{className:"col-span-4 text-center",children:"Qty"})]}),a.length===0?n.jsx("p",{className:"text-[12px] text-gray-500 py-1",children:"No items"}):a.map((r,e)=>n.jsx("div",{className:"border-b border-gray-200 py-0.5 text-[12px]",children:n.jsxs("div",{className:"grid grid-cols-12 gap-x-0.5 items-baseline",children:[n.jsxs("div",{className:"col-span-8 min-w-0 overflow-visible",children:[n.jsx("p",{className:"font-medium leading-tight break-words",children:r.name}),r.note&&n.jsxs("p",{className:"text-[10px] text-amber-700 italic",children:["Note: ",r.note]})]}),n.jsx("div",{className:"col-span-4 text-center font-bold",children:r.quantity})]})},e))]}),n.jsx("div",{className:"print-2inch text-center py-1.5 mt-1 border-t border-gray-400",children:n.jsx("p",{className:"text-[13px] font-bold text-gray-600",children:"— KITCHEN COPY —"})})]})}export{w as default};
