import{s as e}from"./utils-BO1RPuol.js";import{es as t,os as n,ss as r,za as i}from"./index-CsuVxiRQ.js";import{t as a}from"./page-content-DdXVZwik.js";import{t as o}from"./card-CBaLHc_f.js";import{t as s}from"./badge-DLCseWie.js";import{i as c}from"./inventoryApi-BDhL4nCe.js";import{t as l}from"./audit-info-B4AWyeNJ.js";var u=e(),d={inbound:`Inbound`,outbound:`Outbound`,adjustment_in:`Adjustment In`,adjustment_out:`Adjustment Out`,transfer_in:`Transfer In`,transfer_out:`Transfer Out`},f={draft:`secondary`,confirmed:`default`,cancelled:`destructive`};function p(){let{id:e}=r(),p=n(),{data:m,isLoading:h}=c(e);return h?(0,u.jsx)(`div`,{className:`text-center py-8`,children:`Loading...`}):m?(0,u.jsxs)(a,{children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,u.jsx)(i,{variant:`ghost`,size:`icon`,onClick:()=>p(`/inventory/stock-movements`),children:(0,u.jsx)(t,{className:`h-4 w-4`})}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`text-3xl font-bold`,children:m.code}),(0,u.jsxs)(`p`,{className:`text-muted-foreground`,children:[d[m.movement_type]||m.movement_type,` — `,m.item_description]})]}),(0,u.jsx)(s,{variant:f[m.movement_status]||`secondary`,children:m.movement_status})]}),(0,u.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,children:[(0,u.jsxs)(o,{className:`p-6 space-y-3`,children:[(0,u.jsx)(`h2`,{className:`font-semibold text-lg`,children:`Movement Information`}),(0,u.jsxs)(`div`,{className:`grid grid-cols-2 gap-y-2 text-sm`,children:[(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Code:`}),(0,u.jsx)(`span`,{className:`font-mono`,children:m.code}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Type:`}),(0,u.jsx)(`span`,{children:d[m.movement_type]||m.movement_type}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Date:`}),(0,u.jsx)(`span`,{children:m.movement_date}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Status:`}),(0,u.jsx)(`span`,{children:(0,u.jsx)(s,{variant:f[m.movement_status]||`secondary`,children:m.movement_status})}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Quantity:`}),(0,u.jsx)(`span`,{className:`font-mono`,children:Number(m.quantity).toLocaleString()}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Unit Cost:`}),(0,u.jsx)(`span`,{className:`font-mono`,children:Number(m.unit_cost).toLocaleString(void 0,{minimumFractionDigits:2})}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Total Cost:`}),(0,u.jsx)(`span`,{className:`font-mono font-semibold`,children:Number(m.total_cost).toLocaleString(void 0,{minimumFractionDigits:2})})]})]}),(0,u.jsxs)(o,{className:`p-6 space-y-3`,children:[(0,u.jsx)(`h2`,{className:`font-semibold text-lg`,children:`Warehouse & Item`}),(0,u.jsxs)(`div`,{className:`grid grid-cols-2 gap-y-2 text-sm`,children:[(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Warehouse:`}),(0,u.jsxs)(`span`,{children:[m.warehouse_name,` (`,m.warehouse_code,`)`]}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Item Code:`}),(0,u.jsx)(`span`,{className:`font-mono`,children:m.item_code}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Item Description:`}),(0,u.jsx)(`span`,{children:m.item_description}),m.related_warehouse_name&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Related Warehouse:`}),(0,u.jsx)(`span`,{children:m.related_warehouse_name})]})]})]})]}),(0,u.jsxs)(o,{className:`p-6 space-y-3`,children:[(0,u.jsx)(`h2`,{className:`font-semibold text-lg`,children:`Reference & Remarks`}),(0,u.jsxs)(`div`,{className:`grid grid-cols-2 gap-y-2 text-sm max-w-lg`,children:[(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Reference Type:`}),(0,u.jsx)(`span`,{children:m.reference_type||`—`}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Reference Code:`}),(0,u.jsx)(`span`,{className:`font-mono`,children:m.reference_code||`—`}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Reference ID:`}),(0,u.jsx)(`span`,{className:`font-mono text-xs`,children:m.reference_id||`—`})]}),m.remarks&&(0,u.jsxs)(`div`,{className:`pt-2 border-t text-sm`,children:[(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:`Remarks: `}),(0,u.jsx)(`span`,{children:m.remarks})]})]}),(0,u.jsx)(l,{createdByName:m.created_by_name,createdAt:m.created_at,updatedByName:m.updated_by_name,updatedAt:m.updated_at})]}):(0,u.jsx)(`div`,{className:`text-center py-8`,children:`Stock movement not found`})}export{p as default};