2 lines
21 KiB
JavaScript
2 lines
21 KiB
JavaScript
|
|
import{j as e,a as j}from"./vendor-react-YMhRUmcb.js";import{d as n,B as b,C as g,s as E,m as I}from"./index-D2uzyr9g.js";import{S as l}from"./skeleton-BPDNnZ8E.js";import{al as L,aa as v,x as G,aW as M,X as P,a_ as O,a$ as F,a as U,b0 as V,D as B,O as W,b1 as S,b2 as H,b3 as z,L as _}from"./vendor-icons-DINCNwpk.js";import{S as X}from"./input-DL1WY4HG.js";import"./vendor-fFnFILYR.js";import"./vendor-router-DX94Iu-2.js";import"./vendor-tanstack-CoFNL2zy.js";import"./vendor-utils-4BWoYre8.js";const $="GEAR LOCKER",K="Manage hardware assets, documentation, and warranties.";function A({title:r=$,subtitle:t=K,onExport:d,onRegister:a,isLoading:o=!1,error:x=null,className:i}){return x?e.jsx("div",{className:n("max-w-layout-content mx-auto p-4",i),children:e.jsx("p",{className:"text-destructive font-medium",children:x})}):o?e.jsxs("div",{className:n("flex flex-col md:flex-row justify-between items-start md:items-center gap-4",i),children:[e.jsxs("div",{children:[e.jsx(l,{variant:"text",className:"h-9 w-48 mb-2"}),e.jsx(l,{variant:"text",className:"h-4 w-80"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(l,{variant:"rectangular",className:"h-10 w-28 rounded-xl"}),e.jsx(l,{variant:"rectangular",className:"h-10 w-36 rounded-xl"})]})]}):e.jsxs("div",{className:n("flex flex-col md:flex-row justify-between items-start md:items-center gap-4",i),children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-display font-bold text-foreground mb-2",children:r}),e.jsx("p",{className:"text-muted-foreground font-mono text-sm",children:t})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(b,{variant:"ghost",icon:e.jsx(L,{className:"w-4 h-4"}),onClick:d,children:"EXPORT CSV"}),e.jsx(b,{variant:"glass",icon:e.jsx(v,{className:"w-4 h-4"}),onClick:a,children:"REGISTER GEAR"})]})]})}const q=["All","Synth","Interface","Microphone","Active","Maintenance","Sold"];function D({search:r,onSearchChange:t,filter:d,onFilterChange:a,searchPlaceholder:o="Search brand, model, serial...",isLoading:x=!1,error:i=null,className:m}){return i?e.jsx("div",{className:n("p-4 rounded-xl border border-border bg-muted/30",m),children:e.jsx("p",{className:"text-sm text-muted-foreground",children:i})}):x?e.jsxs("div",{className:n("flex flex-col md:flex-row gap-4 items-center bg-muted/30 p-4 rounded-xl border border-border",m),children:[e.jsx(l,{variant:"rectangular",className:"h-11 w-full md:w-64 rounded-xl"}),e.jsx("div",{className:"flex gap-2 w-full md:w-auto",children:[1,2,3,4].map(s=>e.jsx(l,{variant:"rectangular",className:"h-9 w-20 rounded-lg"},s))})]}):e.jsxs("div",{className:n("flex flex-col md:flex-row gap-4 items-center bg-muted/30 p-4 rounded-xl border border-border",m),children:[e.jsx("div",{className:"w-full md:w-64",children:e.jsx(X,{placeholder:o,value:r,onChange:s=>t(s.target.value)})}),e.jsx("div",{className:"flex gap-2 overflow-x-auto w-full md:w-auto pb-2 md:pb-0",children:q.map(s=>e.jsx("button",{type:"button",onClick:()=>a(s),className:n("px-4 py-1.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-colors border shrink-0",d===s?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-transparent hover:border-border"),children:s},s))})]})}function T(r){if(!r)return{label:"Unknown",color:"text-muted-foreground",bg:"bg-muted"};const t=new Date(r),d=new Date,a=Math.ceil((t.getTime()-d.getTime())/(1e3*60*60*24));return a<0?{label:"Expired",color:"text-destructive",bg:"bg-destructive/10"}:a<90?{label:`Expiring (${a}d)`,color:"text-amber-500",bg:"bg-amber-500/10"}:{label:"Active",color:"text-green-600",bg:"bg-green-600/10"}}function C({item:r,onClick:t,className:d}){const a=T(r.warrantyExpire),o=r.status==="Active"?"bg-green-600/10 text-green-600":"bg-amber-500/10 text-amber-500";return e.jsxs(g,{variant:"glass",className:n("group cursor-pointer hover:border-border transition-colors",d),onClick:t,children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx(E,{label:r.category,variant:"terminal"}),e.jsx("div",{className:n("px-2 py-0.5 rounded text-xs
|