1import{j as e}from"./index-DdU35jPJ.js";import{B as c}from"./badge-O5l_SoDq.js";import{S as g,a as j,b as N,c as u,d as m}from"./select-CicXJDZx.js";import{D as v,a as w,b as y,c as _}from"./dialog-gVN6KGjC.js";import{T as h}from"./triangle-alert-l3tEQyle.js";import{F as k}from"./filter-BeAXHBRV.js";import{P as q}from"./package-DYJogmeO.js";import{W as D}from"./warehouse-Byif8V9M.js";import"./index-Dp3B9jqt.js";import"./clsx-B-dksMZM.js";import"./utils-DCmAa5as.js";import"./bundle-mjs-BTmSotT-.js";import"./index-12QbP6l0.js";import"./index-B1Cc5OXO.js";import"./index-gN4drEn4.js";import"./index-BsvT06Lq.js";import"./index-9bdZCgcr.js";import"./index-BvvUEucZ.js";import"./index-7px4L8n5.js";import"./index-CkK8lBUI.js";import"./index-DGERrSaP.js";import"./chevron-down-DcLGbHop.js";import"./createLucideIcon-DMxicyrC.js";import"./check-BECSssz0.js";import"./chevron-up-w1zviHLx.js";import"./index-BhZ8ej-y.js";import"./index-Bwgqm7vL.js";import"./x-DAruoHhn.js";function te({open:p,onOpenChange:f,lowStockItems:a,inventoryLocations:x,locationFilter:i,onLocationFilterChange:b}){return e.jsx(v,{open:p,onOpenChange:f,children:e.jsxs(w,{className:"bg-white border-[#e6e9ef] sm:max-w-6xl max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsx(y,{children:e.jsxs(_,{className:"flex items-center gap-2 text-[#323338]",children:[e.jsx(h,{className:"w-5 h-5 text-[#fdab3d]"}),"Low Stock Alert - ",a.filter(t=>i==="all"||t.location_id===i).length," Items"]})}),e.jsx("div",{className:"pb-4 border-b border-[#e6e9ef]",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(k,{className:"w-4 h-4 text-[#676879]"}),e.jsxs(g,{value:i,onValueChange:b,children:[e.jsx(j,{className:"w-64 bg-[#f6f7fb] border-[#e6e9ef] text-[#323338]",children:e.jsx(N,{})}),e.jsxs(u,{className:"bg-white border-[#e6e9ef]",children:[e.jsxs(m,{value:"all",children:["All Locations (",a.length," items)"]}),x.map(t=>{const r=a.filter(d=>d.location_id===t.id).length;return r>0?e.jsxs(m,{value:t.id,children:[t.name," (",r," items)"]},t.id):null})]})]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto py-4",children:a.length===0?e.jsxs("div",{className:"text-center py-12 bg-[#f6f7fb] rounded-xl",children:[e.jsx(q,{className:"w-12 h-12 text-[#00c875] mx-auto mb-3"}),e.jsx("p",{className:"text-[#323338] font-medium",children:"All items are well-stocked!"})]}):e.jsx("div",{className:"space-y-6",children:x.filter(t=>a.filter(d=>d.location_id===t.id).length>0&&(i==="all"||t.id===i)).map(t=>{const r=a.filter(s=>s.location_id===t.id).sort((s,l)=>(l.min_stock_level||5)-l.quantity-((s.min_stock_level||5)-s.quantity)),d=r.reduce((s,l)=>s+((l.min_stock_level||5)-l.quantity),0),o=r.filter(s=>s.quantity===0).length;return e.jsxs("div",{className:"bg-[#f6f7fb] rounded-2xl border border-[#e6e9ef] overflow-hidden",children:[e.jsx("div",{className:"bg-gradient-to-r from-[#fdab3d]/10 to-transparent p-4 border-b border-[#e6e9ef]",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-[#fdab3d]/20 rounded-xl flex items-center justify-center",children:e.jsx(D,{className:"w-5 h-5 text-[#fdab3d]"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[#323338] font-bold text-lg",children:t.name}),e.jsxs("p",{className:"text-[#676879] text-sm",children:[r.length," low stock items"]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-[#9699a6] text-xs",children:"Total Needed"}),e.jsxs("p",{className:"text-[#e2445c] text-2xl font-bold",children:["+",d]}),o>0&&e.jsxs(c,{className:"bg-[#e2445c] text-white border-0 mt-1",children:[o," out of stock"]})]})]})}),e.jsx("div",{className:"p-4 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:r.map(s=>{const l=(s.min_stock_level||5)-s.quantity,n=s.quantity===0?"critical":l>=5?"high":"medium";return e.jsxs("div",{className:`bg-white rounded-xl p-4 border-2 ${n==="critical"?"border-[#e2445c]":n==="high"?"border-[#fdab3d]":"border-[#e6e9ef]"}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[#323338] font-bold truncate",children:[s.brand," ",s.model||""]}),e.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[s.ply_rating&&e.jsx(c,{className:"bg-[#0073ea]/10 text-[#0073ea] border-0 text-xs",children:s.ply_rating}),e.jsx(c,{className:"bg-[#323338]/10 text-[#323338] border-0 text-xs",children:s.size}),e.jsx(c,{className:`${s.position==="Steer"?"bg-[#0073ea]":s.position==="Drive"?"bg-[#00c875]":s.position==="Trailer"?"bg-[#a25ddc]":"bg-[#fdab3d]"} text-white border-0 text-xs`,children:s.position})]})]}),n==="critical"&&e.jsx(h,{className:"w-5 h-5 text-[#e2445c] shrink-0 ml-2"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 bg-[#f6f7fb] rounded-lg p-2",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[#9699a6] text-[10px] uppercase",children:"Stock"}),e.jsx("p",{className:`font-bold text-lg ${s.quantity===0?"text-[#e2445c]":"text-[#fdab3d]"}`,children:s.quantity})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[#9699a6] text-[10px] uppercase",children:"Min"}),e.jsx("p",{className:"text-[#323338] font-bold text-lg",children:s.min_stock_level||5})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[#9699a6] text-[10px] uppercase",children:"Need"}),e.jsxs("p",{className:"text-[#e2445c] font-bold text-lg",children:["+",l]})]})]})]},s.id)})})]},t.id)})})})]})})}export{te as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.