2 lines
21 KiB
JavaScript
2 lines
21 KiB
JavaScript
|
|
import{j as e,a as j}from"./vendor-react-C9dYU-TK.js";import{c as n,S as l,B as b,C as g,n as E,u as I}from"./index-BMBS6scK.js";import{aa as L,P as v,V as G,h as M,X as P,az as O,aA as F,b as V,aB as U,D as z,_ as B,a5 as S,aC as H,aD as W,aE as _}from"./vendor-icons-BSV6HBy1.js";import{S as X}from"./input-DeoQfymd.js";import"./vendor-CjLUfV8Y.js";import"./vendor-security-DsrNJhpn.js";import"./vendor-router-Dr0ZB7zf.js";import"./vendor-tanstack-C4XaEYj2.js";import"./vendor-http-CctT3C58.js";import"./vendor-utils-D0JLFg89.js";import"./vendor-motion-CbAtAbUE.js";import"./vendor-i18n-PN7w4axr.js";const $="GEAR LOCKER",q="Manage hardware assets, documentation, and warranties.";function A({title:r=$,subtitle:a=q,onExport:d,onRegister:t,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-heading font-bold text-foreground mb-2",children:r}),e.jsx("p",{className:"text-muted-foreground font-mono text-sm",children:a})]}),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:t,children:"REGISTER GEAR"})]})]})}const K=["All","Synth","Interface","Microphone","Active","Maintenance","Sold"];function D({search:r,onSearchChange:a,filter:d,onFilterChange:t,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=>a(s.target.value)})}),e.jsx("div",{className:"flex gap-2 overflow-x-auto w-full md:w-auto pb-2 md:pb-0",children:K.map(s=>e.jsx("button",{type:"button",onClick:()=>t(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 a=new Date(r),d=new Date,t=Math.ceil((a.getTime()-d.getTime())/(1e3*60*60*24));return t<0?{label:"Expired",color:"text-destructive",bg:"bg-destructive/10"}:t<90?{label:`Expiring (${t}d)`,color:"text-warning",bg:"bg-warning/10"}:{label:"Active",color:"text-success",bg:"bg-success/10"}}function C({item:r,onClick:a,className:d}){const t=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:a,children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.js
|