PageSourceSearch

https://harbor-os.com/assets/AdminConsignments-Bx6n4_x4.js

js harbor-os.com collected 2026-10-02 01:31:56 UTC 4,748 bytes, 1 lines download raw bytes

1import{u as D,r as h,g,i as S,j as e,bk as T,L as p,Y as $,bp as q,bq as A,f,aL as L}from"./vendor-B3bqREfz.js";import{u as M,B as t,g as E,q as j,f as F}from"./index-BHZdkTHk.js";import{T as P,a as R,b as o,c as n,d as B,e as a}from"./table-D-PgbCza.js";import{C as H}from"./ConsignmentFormIntakeDialog-CAtSgMR9.js";import"./label-USjEtjxC.js";import"./textarea-BFtGXtJd.js";function U(){const{toast:m}=M(),[,x]=D(),[b,l]=h.useState(!1),[N,c]=h.useState(null),{data:i,isLoading:v}=g({queryKey:["/api/consignment/list"]}),{data:r}=g({queryKey:["/api/consignment/form-intake/drafts"]}),d=()=>j.invalidateQueries({queryKey:["/api/consignment/form-intake/drafts"]}),u=S({mutationFn:async s=>{await F("DELETE",`/api/consignment/form-intake/drafts/${s}`)},onSuccess:()=>{d(),m({title:"Draft discarded"})},onError:s=>{m({title:"Could not discard draft",description:s.message,variant:"destructive"})}}),y=()=>{c(null),l(!0)},w=s=>{c(s),l(!0)},k=s=>{switch(s){case"pending":return"bg-yellow-100 text-yellow-800";case"active":return"bg-green-100 text-green-800";case"sold":return"bg-blue-100 text-blue-800";case"cancelled":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}};return v?e.jsx("div",{className:"p-8",children:"Loading..."}):e.jsxs("div",{className:"p-4 sm:p-8",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3 mb-8",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"Consignment Submissions"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(t,{className:"gap-2",onClick:y,"data-testid":"button-scan-form",children:[e.jsx(T,{className:"w-4 h-4"}),"Add Consignor (Scan Form)"]}),e.jsx(p,{href:"/admin/consignment-payouts",children:e.jsxs(t,{variant:"outline",className:"gap-2","data-testid":"link-payout-queue",children:[e.jsx($,{className:"w-4 h-4"}),"Payout Queue"]})}),e.jsx(p,{href:"/admin/sold-history",children:e.jsxs(t,{variant:"outline",className:"gap-2",children:[e.jsx(q,{className:"w-4 h-4"}),"Sold History"]})})]})]}),r&&r.length>0&&e.jsxs("div",{className:"mb-8 rounded-lg border border-amber-200 bg-amber-50 p-4","data-testid":"section-intake-drafts",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(A,{className:"w-4 h-4 text-amber-700"}),e.jsxs("h2",{className:"text-sm font-semibold text-amber-900",children:["In-progress intakes (",r.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:r.map(s=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border bg-white px-3 py-2","data-testid":`draft-row-${s.id}`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.label||"Untitled intake"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.step==="review"?"Reviewing":"Capturing",s.updatedAt?` · saved ${f(new Date(s.updatedAt),"MMM d, h:mm a")}`:""]})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.jsx(t,{size:"sm",onClick:()=>w(s),"data-testid":`button-resume-draft-${s.id}`,children:"Resume"}),e.jsx(t,{size:"sm",variant:"ghost",className:"text-red-600 hover:text-red-700",onClick:()=>u.mutate(s.id),disabled:u.isPending,"data-testid":`button-delete-draft-${s.id}`,children:e.jsx(L,{className:"w-4 h-4"})})]})]},s.id))})]}),e.jsx("div",{className:"bg-white rounded-lg shadow border overflow-x-auto",children:e.jsxs(P,{className:"min-w-[640px]",children:[e.jsx(R,{children:e.jsxs(o,{children:[e.jsx(n,{children:"Vessel Name"}),e.jsx(n,{children:"Owner"}),e.jsx(n,{children:"Asking Price"}),e.jsx(n,{children:"Status"}),e.jsx(n,{children:"Date"}),e.jsx(n,{className:"text-right",children:"Actions"})]})}),e.jsxs(B,{children:[(!i||i.length===0)&&e.jsx(o,{children:e.jsx(a,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"No consignment submissions yet."})}),i==null?void 0:i.map(s=>e.jsxs(o,{className:"cursor-pointer hover:bg-slate-50",onClick:()=>x(`/admin/consignments/${s.id}`),"data-testid":`row-consignment-${s.id}`,children:[e.jsx(a,{className:"font-medium",children:s.vesselName}),e.jsx(a,{children:s.ownerName}),e.jsxs(a,{children:["$",s.askingPrice]}),e.jsx(a,{children:e.jsx(E,{className:k(s.status||"pending"),children:s.status})}),e.jsx(a,{children:s.createdAt?f(new Date(s.createdAt),"MMM d, yyyy"):"-"}),e.jsx(a,{className:"text-right",children:e.jsx(t,{variant:"ghost",size:"sm",onClick:C=>{C.stopPropagation(),x(`/admin/consignments/${s.id}`)},"data-testid":`button-view-${s.id}`,children:"View Details"})})]},s.id))]})]})}),e.jsx(H,{open:b,onOpenChange:s=>{l(s),s||(c(null),d())},initialDraft:N,onDraftSaved:d,onCommitted:()=>{j.invalidateQueries({queryKey:["/api/consignment/list"]}),d()}})]})}export{U 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.