PageSourceSearch

https://www.thepersonnelstore.com/assets/JobOrderStatus-D27DX9_y.js

js thepersonnelstore.com collected 2026-10-08 10:26:32 UTC 8,256 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-ui-D6IH9Nnp.js";import{a as p}from"./vendor-react-CZ1WiVuX.js";import{bB as A,Q as J,a as E,C as c,n as m,aW as x,H as b,J as j,d as v,e as B,g as I,h as S,i as u,j as M,k as g,m as L}from"./index--_WOeBIW.js";import{u as H}from"./mermaid-VLURNSYL-C0NilJqc.js";import"./papaparse.min-LzNWm9XN.js";import{a as k,R as P}from"./ReportDateRangeFilter-Dn6DGNUa.js";import{M as D,b as q,a as K}from"./MobileTableCard-BZGQvvx4.js";import{R as Q,P as U,f as G,C as V,T as W,L as $}from"./vendor-charts-DYu1yavn.js";import"./types-B-MxnkgG.js";import"./calendar-vIqYzqvm.js";import"./payrollWeek-NpnqRiCk.js";import"./isBefore-Da3Yti17.js";import"./isSameDay-BSr0Bkqa.js";import"./subDays-SAy7z2xA.js";import"./isSameYear-CvNTPvnj.js";import"./popover-C3EdeqeQ.js";import"./subWeeks-DF6MoKYt.js";import"./subMonths-C2qz5NtI.js";function z(a){H({description:"Job Order Status report showing the distribution of job orders by status (Active, Filled, On Hold, Draft, Closed, Cancelled) with recent job orders and client details.",value:{totalJobOrders:a.totalJobOrders,statusDistribution:a.statusCounts,recentJobOrders:a.recentJobOrders.slice(0,20).map(r=>({id:r.id,title:r.title,status:r.status,client:r.clientName,startDate:r.startDate}))}})}function X(a){return z(a),null}function Y(a){return A()?p.createElement(X,a):null}const Z=["Draft","Open","In Progress","Filled","Completed","Cancelled"],w={Draft:{color:"#8B5CF6",badgeClass:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400"},Open:{color:"#10B981",badgeClass:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"},"In Progress":{color:"#F59E0B",badgeClass:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"},Filled:{color:"#0EA5E9",badgeClass:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"},Completed:{color:"#6B7280",badgeClass:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300"},Cancelled:{color:"#EF4444",badgeClass:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"}},ee="bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300";function O(a){return w[a]?.badgeClass??ee}function f(a){return a?new Date(a).toLocaleDateString():"—"}const je=()=>{const[a,r]=p.useState(()=>k().start),[h,_]=p.useState(()=>k().end),d=J(),{data:l=[],isLoading:i,isError:N}=E({queryKey:["job-orders-report",a,h],queryFn:async()=>{let s=L().from("job_orders").select("id, title, status, start_date, created_at, clients(name, industry)").is("deleted_at",null).order("created_at",{ascending:!1});if(a&&(s=s.gte("created_at",a.toISOString())),h){const y=new Date(h);y.setHours(23,59,59,999),s=s.lte("created_at",y.toISOString())}const{data:R,error:C}=await s;if(C)throw C;return R??[]}}),o=p.useMemo(()=>{const t={};for(const s of l)t[s.status]=(t[s.status]??0)+1;return t},[l]),n=p.useMemo(()=>Object.entries(o).filter(([,t])=>t>0).map(([t,s])=>({name:t,value:s,color:w[t]?.color??"#6B7280"})),[o]),F=Z.filter(t=>(o[t]??0)>0||["Open","In Progress","Filled"].includes(t)),T=[{key:"client",label:"Client",accessor:t=>t.clients?.name??"—"},{key:"start_date",label:"Start Date",accessor:t=>f(t.start_date)},{key:"created_at",label:"Created",accessor:t=>f(t.created_at)}];return e.jsxs("div",{className:"container mx-auto py-6 px-4 md:px-0 space-y-6",children:[e.jsx(Y,{statusCounts:o,totalJobOrders:l.length,recentJobOrders:l.slice(0,20).map(t=>({id:t.id,title:t.title,status:t.status,clientName:t.clients?.name??void 0,startDate:t.start_date??void 0}))}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl md:text-3xl font-bold tracking-tight",children:"Job Order Status"}),e.jsx("p",{className:"text-muted-foreground text-sm md:text-base",children:"Overview of current job orders and their status distribution"})]}),e.jsx(P,{startDate:a,endDate:h,onStartDateChange:r,onEndDateChange:_}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:i?Array.from({length:6}).map((t,s)=>e.jsx(c,{children:e.jsxs(m,{className:"p-4",children:[e.jsx(x,{className:"h-7 w-10 mb-1"}),e.jsx(x,{className:"h-4 w-20"})]})},s)):F.map(t=>e.jsx(c,{children:e.jsxs(m,{className:"p-4 flex flex-col justify-center min-h-[72px]",children:[e.jsx("div",{className:"text-2xl font-bold",children:o[t]??0}),e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:t})]})},t))}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 md:gap-6",children:[e.jsxs(c,{children:[e.jsx(b,{className:"p-4 md:p-6",children:e.jsx(j,{className:"text-base md:text-lg",children:"Status Distribution"})}),e.jsx(m,{className:"p-4 pt-0 md:p-6 md:pt-0",children:i?e.jsx(x,{className:"h-[280px] w-full rounded-lg"}):N?e.jsx("div",{className:"h-[280px] flex items-center justify-center text-sm text-muted-foreground",children:"Failed to load chart data."}):n.length===0?e.jsx("div",{className:"h-[280px] flex items-center justify-center text-sm text-muted-foreground",children:"No data for selected range."}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{width:"100%",height:d?220:280,children:e.jsxs(U,{children:[e.jsx(G,{data:n,cx:"50%",cy:"50%",innerRadius:d?40:60,outerRadius:d?70:100,paddingAngle:3,dataKey:"value",nameKey:"name",children:n.map((t,s)=>e.jsx(V,{fill:t.color},`cell-${s}`))}
1),e.jsx(W,{formatter:(t,s)=>[t,s]}),!d&&e.jsx($,{})]})}),d&&e.jsx("div",{className:"flex flex-wrap justify-center gap-3 mt-3 text-xs",children:n.map(t=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:t.color}}),e.jsxs("span",{children:[t.name,": ",t.value]})]},t.name))})]})})]}),e.jsxs(c,{children:[e.jsx(b,{className:"p-4 md:p-6",children:e.jsx(j,{className:"text-base md:text-lg",children:"Summary"})}),e.jsx(m,{className:"p-4 pt-0 md:p-6 md:pt-0",children:i?e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Array.from({length:4}).map((t,s)=>e.jsx(x,{className:"h-[68px] rounded-lg"},s))}):e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.map(t=>e.jsxs("div",{className:"p-3 md:p-4 bg-muted/50 dark:bg-muted/20 rounded-lg min-h-[60px] flex flex-col justify-center",children:[e.jsx("div",{className:"text-xl md:text-2xl font-bold",children:t.value}),e.jsx("div",{className:"text-xs md:text-sm text-muted-foreground",children:t.name})]},t.name)),n.length===0&&e.jsx("div",{className:"col-span-2 h-[120px] flex items-center justify-center text-sm text-muted-foreground",children:"No data for selected range."})]})})]})]}),e.jsxs(c,{children:[e.jsx(b,{className:"p-4 md:p-6",children:e.jsxs(j,{className:"text-base md:text-lg",children:["Recent Job Orders",!i&&e.jsxs("span",{className:"ml-2 text-sm font-normal text-muted-foreground",children:["(",l.length,")"]})]})}),e.jsx(m,{className:"p-4 pt-0 md:p-6 md:pt-0",children:i?d?e.jsx(D,{children:Array.from({length:4}).map((t,s)=>e.jsx(q,{fieldCount:3},s))}):e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((t,s)=>e.jsx(x,{className:"h-12 w-full rounded-lg"},s))}):N?e.jsx("div",{className:"h-[120px] flex items-center justify-center text-sm text-muted-foreground",children:"Failed to load job orders."}):l.length===0?e.jsx("div",{className:"h-[120px] flex items-center justify-center text-sm text-muted-foreground",children:"No job orders found for selected range."}):d?e.jsx(D,{children:l.map(t=>e.jsx(K,{data:t,columns:T,primaryField:"title",secondaryField:s=>s.clients?.name??"—",badge:e.jsx(v,{variant:"secondary",className:O(t.status),children:t.status}),maxVisibleFields:3,showAllFields:!0},t.id))}):e.jsxs(B,{children:[e.jsx(I,{children:e.jsxs(S,{children:[e.jsx(u,{children:"Title"}),e.jsx(u,{children:"Client"}),e.jsx(u,{children:"Status"}),e.jsx(u,{children:"Start Date"}),e.jsx(u,{children:"Created"})]})}),e.jsx(M,{children:l.map(t=>e.jsxs(S,{children:[e.jsx(g,{className:"font-medium max-w-[220px] truncate",children:t.title}),e.jsx(g,{className:"text-muted-foreground",children:t.clients?.name??"—"}),e.jsx(g,{children:e.jsx(v,{variant:"secondary",className:O(t.status),children:t.status})}),e.jsx(g,{className:"text-muted-foreground",children:f(t.start_date)}),e.jsx(g,{className:"text-muted-foreground",children:f(t.created_at)})]},t.id))})]})})]})]})};export{je 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.