PageSourceSearch

https://people.october.health/build/assets/assets-CyCCClnS.js

js october.health collected 2026-09-24 13:19:00 UTC 12,977 bytes, 1 lines download raw bytes

1import{a as re}from"./rolldown-runtime-DS2seoW7.js";import{O as te}from"./charts-B3EPD53g.js";import{_ as ne,a as m,i as ie,s as N}from"./vendor-DrhYhv1J.js";import{t as v}from"./utils-hoEDr7y0.js";import{t as le}from"./archive-CvMRtza3.js";import{t as k}from"./box-T2h8HrHu.js";import{t as E}from"./check-DQUwTmWS.js";import{t as oe}from"./chevrons-up-down-CCQIrGo_.js";import{t as de}from"./circle-check-big-CdPLGW7l.js";import{t as T}from"./clipboard-check-DEY_82he.js";import{t as ce}from"./download-DWeCCRtX.js";import{t as me}from"./ellipsis-BbWotfg-.js";import{t as pe}from"./headphones-DzJR_xIz.js";import{t as xe}from"./keyboard-BwgazA1b.js";import{t as he}from"./laptop-av4eNfXS.js";import{r as K}from"./StudioController-BBExYx2j.js";import{t as M}from"./plus-CQMLH3w8.js";import{t as ue}from"./search-ByiOkv2t.js";import{t as ge}from"./smartphone-Bcvevqed.js";import{t as je}from"./square-pen-CukOBlGs.js";import{t as ve}from"./trash-2-DbinjQya.js";import{t as fe}from"./upload-BKRBShI0.js";import{t as be}from"./user-minus-Dgx8P9An.js";import{t as O}from"./user-plus-DEAOxKjh.js";import{ct as o}from"./app-DkW1paqt.js";import{t as Ne}from"./badge--qZBAdZg.js";import{a as ye,i as _e,n as we,r as Ce,t as Se}from"./page-toolbar-BaM6JRQ9.js";import{n as Ae,r as Te,t as ke}from"./avatar-BuiL4G2h.js";import{a as De,n as _,o as Ie,r as $e,t as w}from"./card-svQjEXix.js";import{t as ze}from"./empty-state-BW_HUFpi.js";import{c as U,i as y,n as F,s as B,t as H}from"./select-ttJ-unBI.js";import{a as d,n as Pe,o as Ee,r as c,s as q,t as Me}from"./table-BdMGfApJ.js";import{i as g,l as Oe,p as L,r as R,t as V}from"./dropdown-menu-DydVQI0u.js";import{a as Ue,i as Fe,o as G,r as Be,s as He,t as qe}from"./command-BEXfMxDE.js";import{t as Le}from"./app-layout-DTIpDKsM.js";import{t as Re}from"./input-lQ23oUwl.js";import{t as Ve}from"./pagination-CcvTRC94.js";import{n as Ge,r as Ke,t as Je}from"./popover-BidHWyfv.js";var p=re(te(),1),e=ne(),Qe=[{title:"Dashboard",href:"/dashboard"},{title:"Assets",href:"/assets"}],We={laptop:(0,e.jsx)(he,{className:"size-4"}),phone:(0,e.jsx)(ge,{className:"size-4"}),monitor:(0,e.jsx)(K,{className:"size-4"}),keyboard:(0,e.jsx)(xe,{className:"size-4"}),headset:(0,e.jsx)(pe,{className:"size-4"}),other:(0,e.jsx)(k,{className:"size-4"})},Xe={available:"bg-secondary/10 text-secondary border-secondary/20",assigned:"bg-primary/10 text-primary border-primary/20",retired:"bg-muted text-muted-foreground border-border",pending_approval:"bg-warning/10 text-warning border-warning/30",rejected:"bg-destructive/10 text-destructive border-destructive/20"};function j({icon:i,iconClassName:n,value:x,label:C,active:f,onClick:a,className:h}){return(0,e.jsx)("button",{type:"button",onClick:a,className:"text-left","aria-pressed":f,children:(0,e.jsx)(w,{className:v("h-full pb-0 transition-colors hover:border-primary/40",f&&"border-primary ring-1 ring-primary/30",h),children:(0,e.jsxs)(_,{className:"flex h-full flex-col justify-between gap-5 px-5 py-4 first:pt-4",children:[(0,e.jsx)(i,{className:v("size-6 text-muted-foreground",n)}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)("span",{className:"text-2xl leading-none font-semibold text-foreground lg:text-3xl",children:x}),(0,e.jsx)("span",{className:"text-sm font-normal text-muted-foreground",children:C})]})]})})})}function Os({assets:i,stats:n,employees:x,types:C,statuses:f,filters:a}){const[h,J]=(0,p.useState)(a.search||""),[t,S]=(0,p.useState)(a.status||"all"),[D,Q]=(0,p.useState)(a.type||"all"),[b,I]=(0,p.useState)(a.assigned_to??null),[$,A]=(0,p.useState)(!1),[Ye,W]=(0,p.useState)(null),X=s=>{s.preventDefault(),l({search:h})},l=s=>{const r=s.status??t,P=s.type??D,ae=s.assigned_to!==void 0?s.assigned_to:b;N.get("/assets",{search:(s.search??h)||void 0,status:r!=="all"?r:void 0,type:P!=="all"?P:void 0,assigned_to:ae??void 0},{preserveState:!0})},u=s=>{S(s),l({status:s})},z=x.find(s=>s.id===b),Y=(s,r)=>{N.post(`/assets/${s}/assign`,{employee_id:r},{onFinish:()=>W(null)})},Z=s=>{N.post(`/assets/${s}/unassign`)},ee=s=>{confirm("Are you sure you want to delete this asset?")&&N.delete(`/assets/${s}`)},se=s=>s.split(" ").map(r=>r[0]).join("").toUpperCase().slice(0,2);return(0,e.jsxs)(Le,{breadcrumbs:Qe,children:[(0,e.jsx)(ie,{title:"Assets"}),(0,e.jsxs)("div",{className:"flex w-full flex-col gap-5 p-4 sm:p-6 lg:gap-7 lg:p-8",children:[(0,e.jsxs)(Se,{className:"pb-0",children:[(0,e.jsxs)(_e,{children:[(0,e.jsx)(ye,{children:"Assets"}),(0,e.jsx)(Ce,{children:"Track and manage company equipment"})]}),(0,e.jsxs)(we,{children:[(0,e.jsx)(o,{variant:"outline",asChild:!0,children:(0,e.jsxs)("a",{href:`/assets-export?${new URLSearchParams(Object.fromEntries(Object.entries({search:a.search,status:a.status,type:a.type,assigned_to:a.assigned_to!==null&&a.assigned_to!==void 0?String(a.assigned_to):null}).filter(([,s])=>s))).toString()}`,children:[(0,e.jsx)(ce,{className:"mr-2 h-4 w-4"}),"Export"]})}),(0,e.jsx)(o,{variant:"outline",asChild:!0,children:(0,e.jsxs)(m,{href:"/assets/import",children:[(0,e.jsx)(fe,{className:"mr-2 h-4 w-4"}),"Import"]})}),(0,e.jsx)(o,{asChild:!0,children:(0,e.jsxs)(m,{href:"/assets/create",children:[(0,e.jsx)(M,{className:"mr-2 h-4 w-4"}),"Add Asset"]})})]})]}),n.pending_approval>0&&t!=="pending_approval"&&(0,e.jsx)(w,{className:"border-warning/30 bg-warning/5",children:(0,e.jsxs)(_,{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(T,{className:"h-5 w-5 text-warning"}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"font-medium text-foreground",children:[n.pending_approval," asset",n.pending_approval===1?"":"s"," ","awaiting your approval"]}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Employees have submitted equipment that needs review before being added to the register."})]})]}),(0,e.jsx)(o,{variant:"outline",className:"border-warning/40 hover:bg-warning/10",onClick:()=>{S("pending_approval"),l({status:"pending_approval"})},children:"Review submissions"})]})}),(0,e.jsxs)("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-5 lg:gap-7",children:[(0,e.jsx)(j,{icon:k,value:n.total,label:"Total Assets",active:t==="all",onClick:()=>u("all")}),(0,e.jsx)(j,{icon:de,iconClassName:"text-secondary",value:n.available,label:"Available",active:t==="available",onClick:()=>u("available")}),(0,e.jsx)(j,{icon:O,iconClassName:"text-primary",value:n.assigned,label:"Assigned",active:t==="assigned",onClick:()=>u("assigned")}),(0,e.jsx)(j,{icon:le,value:n.retired,label:"Retired",active:t==="retired",onClick:()=>u("retired")}),(0,e.jsx)(j,{icon:T,iconClassName:"text-warning",value:n.pending_approval,label:"Pending Approval",active:t==="pending_approval",onClick:()=>u("pending_approval"),className:v(n.pending_approval>0&&"border-warning/30")})]}),(0,e.jsx)(w,{children:(0,e.jsx)(_,{children:(0,e.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[(0,e.jsxs)("form",{onSubmit:X,className:"relative flex-1",children:[(0,e.jsx)(ue,{className:"absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,e.jsx)(Re,{placeholder:"Search by name, serial number, or assignee...",value:h,onChange:s=>J(s.target.value),className:"pl-9"})]}),(0,e.jsxs)(H,{value:t,onValueChange:s=>{S(s),l({status:s})},children:[(0,e.jsx)(B,{className:"w-full sm:w-[150px]",children:(0,e.jsx)(U,{placeholder:"Status"})}),(0,e.jsxs)(F,{children:[(0,e.jsx)(y,{value:"all",children:"All Statuses"}
1),Object.entries(f).filter(([s])=>s!=="rejected").map(([s,r])=>(0,e.jsx)(y,{value:s,children:r},s))]})]}),(0,e.jsxs)(H,{value:D,onValueChange:s=>{Q(s),l({type:s})},children:[(0,e.jsx)(B,{className:"w-full sm:w-[150px]",children:(0,e.jsx)(U,{placeholder:"Type"})}),(0,e.jsxs)(F,{children:[(0,e.jsx)(y,{value:"all",children:"All Types"}),Object.entries(C).map(([s,r])=>(0,e.jsx)(y,{value:s,children:r},s))]})]}),(0,e.jsxs)(Je,{open:$,onOpenChange:A,children:[(0,e.jsx)(Ke,{asChild:!0,children:(0,e.jsxs)(o,{variant:"outline",role:"combobox","aria-expanded":$,className:"w-full justify-between sm:w-[200px]",children:[(0,e.jsx)("span",{className:"truncate",children:z?z.name:"All assignees"}),(0,e.jsx)(oe,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,e.jsx)(Ge,{className:"w-[260px] p-0",align:"end",children:(0,e.jsxs)(qe,{children:[(0,e.jsx)(Ue,{placeholder:"Search employees..."}),(0,e.jsxs)(He,{children:[(0,e.jsx)(Be,{children:"No employees found."}),(0,e.jsxs)(Fe,{children:[(0,e.jsxs)(G,{value:"all-assignees",onSelect:()=>{I(null),A(!1),l({assigned_to:null})},children:[(0,e.jsx)(E,{className:v("mr-2 h-4 w-4",b===null?"opacity-100":"opacity-0")}),"All assignees"]}),x.map(s=>(0,e.jsxs)(G,{value:s.name,onSelect:()=>{I(s.id),A(!1),l({assigned_to:s.id})},children:[(0,e.jsx)(E,{className:v("mr-2 h-4 w-4",b===s.id?"opacity-100":"opacity-0")}),s.name]},s.id))]})]})]})})]})]})})}),(0,e.jsxs)(w,{children:[(0,e.jsxs)(De,{children:[(0,e.jsx)(Ie,{children:t==="pending_approval"?"Pending Submissions":"All Assets"}),(0,e.jsx)($e,{children:t==="pending_approval"?`${i.data.length} submission${i.data.length===1?"":"s"} awaiting review`:`${i.data.length} asset${i.data.length===1?"":"s"} found`})]}),(0,e.jsxs)(_,{className:"p-0",children:[i.data.length===0?(0,e.jsx)(ze,{icon:t==="pending_approval"?T:K,illustration:t!=="pending_approval"&&!a.search&&!a.status&&!a.type&&!a.assigned_to?"empty-default":void 0,className:"px-5",title:t==="pending_approval"?"No pending submissions":"No assets found",description:t==="pending_approval"?"Submissions from employees will appear here for review.":a.search||a.status||a.type||a.assigned_to?"Try adjusting your filters":"Add your first asset to get started",action:!a.search&&!a.status&&!a.type&&!a.assigned_to?{label:"Add Asset",href:"/assets/create",icon:M}:void 0}):(0,e.jsxs)(Me,{children:[(0,e.jsx)(Ee,{className:"bg-muted/30",children:(0,e.jsxs)(q,{children:[(0,e.jsx)(d,{children:"Asset"}),(0,e.jsx)(d,{children:"Type"}),(0,e.jsx)(d,{children:"Serial Number"}),(0,e.jsx)(d,{children:"Status"}),(0,e.jsx)(d,{children:t==="pending_approval"?"Submitted":"Age"}),(0,e.jsx)(d,{children:t==="pending_approval"?"Submitted By":"Assigned To"}),(0,e.jsx)(d,{className:"w-[50px]"})]})}),(0,e.jsx)(Pe,{children:i.data.map(s=>(0,e.jsxs)(q,{children:[(0,e.jsxs)(c,{children:[s.status==="pending_approval"?(0,e.jsx)(m,{href:`/assets/${s.id}/review`,className:"font-medium hover:underline",children:s.name}):(0,e.jsx)(m,{href:`/assets/${s.id}`,className:"font-medium hover:underline",children:s.name}),s.notes&&(0,e.jsx)("div",{className:"line-clamp-1 text-sm text-muted-foreground",children:s.notes})]}),(0,e.jsx)(c,{children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[We[s.type]||(0,e.jsx)(k,{className:"size-4"}),(0,e.jsx)("span",{children:s.type_label})]})}),(0,e.jsx)(c,{children:(0,e.jsx)("span",{className:"font-mono text-sm",children:s.serial_number||"—"})}),(0,e.jsx)(c,{children:(0,e.jsx)(Ne,{variant:"outline",className:Xe[s.status],children:s.status_label})}),(0,e.jsx)(c,{children:(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:s.status==="pending_approval"?s.submitted_at??"—":s.age})}),(0,e.jsx)(c,{children:(()=>{const r=s.status==="pending_approval"?s.submitted_by:s.assigned_to;return r?(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)(ke,{className:"h-6 w-6",children:[(0,e.jsx)(Te,{src:r.avatar||void 0}),(0,e.jsx)(Ae,{className:"text-xs",children:se(r.name)})]}),(0,e.jsx)("span",{className:"text-sm",children:r.name})]}):(0,e.jsx)("span",{className:"text-muted-foreground",children:"—"})})()}),(0,e.jsx)(c,{children:s.status==="pending_approval"?(0,e.jsx)(o,{asChild:!0,size:"sm",variant:"outline",children:(0,e.jsx)(m,{href:`/assets/${s.id}/review`,children:"Review"})}):(0,e.jsxs)(V,{children:[(0,e.jsx)(L,{asChild:!0,children:(0,e.jsx)(o,{variant:"ghost",size:"icon",children:(0,e.jsx)(me,{className:"h-4 w-4"})})}),(0,e.jsxs)(R,{align:"end",children:[(0,e.jsx)(g,{asChild:!0,children:(0,e.jsxs)(m,{href:`/assets/${s.id}/edit`,children:[(0,e.jsx)(je,{className:"mr-2 h-4 w-4"}),"Edit"]})}),s.status==="available"&&(0,e.jsxs)(V,{children:[(0,e.jsx)(L,{asChild:!0,children:(0,e.jsxs)(g,{onSelect:r=>r.preventDefault(),children:[(0,e.jsx)(O,{className:"mr-2 h-4 w-4"}),"Assign to..."]})}),(0,e.jsx)(R,{side:"right",className:"max-h-[300px] overflow-auto",children:x.map(r=>(0,e.jsx)(g,{onClick:()=>Y(s.id,r.id),children:r.name},r.id))})]}),s.status==="assigned"&&(0,e.jsxs)(g,{onClick:()=>Z(s.id),children:[(0,e.jsx)(be,{className:"mr-2 h-4 w-4"}),"Unassign"]}),(0,e.jsx)(Oe,{}),(0,e.jsxs)(g,{className:"text-destructive focus:text-destructive",disabled:s.status==="assigned",onClick:()=>ee(s.id),children:[(0,e.jsx)(ve,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})]},s.id))})]}),i.data.length>0&&(0,e.jsx)(Ve,{data:i,itemLabel:"assets",className:"px-5 pb-5"})]})]})]})]})}export{Os 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.