PageSourceSearch

https://ultimatecrm-efgomez.vercel.app/admin-assets/BillDetailPage-Dq3iYh_a.js

js ultimatecrm-efgomez.vercel.app collected 2026-10-03 07:57:04 UTC 9,003 bytes, 1 lines download raw bytes

1import{j as e,B as f}from"./index-CnSS26s7.js";import{B as j}from"./badge-MkjWWpdT.js";import{T as g,a as b,b as n,c as i}from"./tabs-HMjjwhaJ.js";import{S as N}from"./scroll-area-DlYVpx8x.js";import{S as v,a as y,b as w,c as S,d as _}from"./select-DSgSjRDm.js";import{u as B,a as C,b as T,c as L}from"./useBills-BnAx-ceg.js";import{M as $}from"./MobileScreenHeader-Cd2J5U1e.js";import{a as M,u as k}from"./vendor-DcN6wP78.js";import{T as D}from"./triangle-alert-GbhqC_Df.js";import{B as P}from"./building-2-jOd3z4Em.js";import{F as c}from"./file-text-C-XtNvCB.js";import{C as o}from"./calendar-BGi7tqRF.js";import{C as V}from"./credit-card-BtXIurwJ.js";import{i as F}from"./isPast-BFyq0tV_.js";import{f as x}from"./format-Fx8JdiJ0.js";import"./index-D6vAyAA8.js";import"./index-BdQq_4o_.js";import"./Combination-DOt44nKk.js";import"./index-CgnsySVI.js";import"./chevron-down-CXZgFGJu.js";import"./chevron-up-CWpQjv9P.js";import"./check-Br5XUqED.js";import"./useMutation-BAHbXwmP.js";import"./arrow-left-D4ACdZ8m.js";import"./plus-Dsn3S7_W.js";import"./search-CAphlQ8v.js";import"./en-US-BNFyvVb6.js";import"./differenceInCalendarDays-_R9ZBkp7.js";const I={draft:{color:"text-gray-600",bgColor:"bg-gray-100"},pending:{color:"text-yellow-600",bgColor:"bg-yellow-100"},approved:{color:"text-blue-600",bgColor:"bg-blue-100"},paid:{color:"text-green-600",bgColor:"bg-green-100"},overdue:{color:"text-red-600",bgColor:"bg-red-100"},partial:{color:"text-orange-600",bgColor:"bg-orange-100"}};function O(a,r){return r?"red":a==="paid"||a==="approved"?"green":a==="pending"||a==="partial"?"gold":a==="overdue"?"red":"muted"}const ue=()=>{const{id:a}=M(),r=k(),{data:s,isLoading:u}=B(a),{data:d=[]}=C(a),{data:m=[]}=T(a),p=L();if(u)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary border-t-transparent rounded-full animate-spin"})});if(!s)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("p",{className:"text-muted-foreground",children:"Bill not found"}),e.jsx(f,{variant:"outline",onClick:()=>r(-1),children:"Go Back"})]});const l=!!(s.due_date&&F(new Date(s.due_date))&&s.status!=="paid"),h=l?"Overdue":s.status??"draft";return e.jsxs("div",{className:"flex flex-col h-full bg-[#fbf8f1]",children:[e.jsx($,{title:s.bill_number||"Bill",subtitle:s.vendor_name??void 0,statusPill:{label:h,tone:O(s.status,l)},onBack:()=>r(-1),children:e.jsxs("div",{className:"grid grid-cols-2 gap-2 px-4 pb-4",children:[e.jsxs("div",{className:"bg-white border border-[#f0ebdd] rounded-xl p-2 text-center",children:[e.jsx("p",{className:"text-xs text-[#8a8377]",children:"Total"}),e.jsxs("p",{className:"text-lg font-bold text-[#1a1714]",children:["$",(s.total||0).toLocaleString()]})]}),e.jsxs("div",{className:"bg-white border border-[#f0ebdd] rounded-xl p-2 text-center",children:[e.jsx("p",{className:"text-xs text-[#8a8377]",children:"Balance"}),e.jsxs("p",{className:`text-lg font-bold ${(s.balance_due||0)>0?"text-red-700":"text-[#1f8a5b]"}`,children:["$",(s.balance_due||0).toLocaleString()]})]})]})}),e.jsxs(g,{defaultValue:"details",className:"flex-1 flex flex-col",children:[e.jsxs(b,{className:"mx-4 mt-3 grid grid-cols-3",children:[e.jsx(n,{value:"details",children:"Details"}),e.jsxs(n,{value:"items",children:["Items (",d.length,")"]}),e.jsx(n,{value:"payments",children:"Payments"})]}),e.jsxs(N,{className:"flex-1",children:[e.jsxs(i,{value:"details",className:"p-4 space-y-3 pb-24",children:[e.jsxs("div",{className:"bg-card border rounded-xl p-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Change Status"}),e.jsxs(v,{value:s.status||"",onValueChange:t=>p.mutate({id:a,status:t}),children:[e.jsx(y,{className:"h-10",children:e.jsx(w,{})}),e.jsx(S,{children:Object.keys(I).map(t=>e.jsx(_,{value:t,className:"capitalize",children:t},t))})]})]}),l&&e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-xl p-3 flex items-center gap-2",children:[e.jsx(D,{className:"w-5 h-5 text-red-600 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-red-700 font-medium",children:"This bill is overdue"})]}),e.jsxs("div",{className:"bg-card border rounded-xl divide-y",children:[s.vendor_name&&e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx(P,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Vendor"}),e.jsx("p",{className:"text-sm",children:s.vendor_name})]})]}),s.project_name&&e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx(c,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Project"}),e.jsx("p",{className:"text-sm",children:s.project_name})]})]}),e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx(o,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Bill Date"}),e.jsx("p",{className:"text-sm",children:x(new Date(s.bill_date),"MMM d, yyyy")})]})]}),s.due_date&&e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx(o,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Due Date"}),e.jsx("p",{className:`text-sm ${l?"text-red-600 font-medium":""}`,children:x(new Date(s.due_date),"MMM d, yyyy")})]})]}),s.terms&&e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx(c,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Terms"}),e.jsx("p",{className:"text-sm",children:s.terms})]})]})]}),e.jsxs("div",{className:"bg-card border rounded-xl p-3 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Financial Summary"}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Subtotal"}
1),e.jsxs("span",{children:["$",(s.sub_total||0).toLocaleString()]})]}),s.tax!==null&&e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Tax"}),e.jsxs("span",{children:["$",(s.tax||0).toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between text-sm font-bold border-t pt-1",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{children:["$",(s.total||0).toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Paid"}),e.jsxs("span",{className:"text-green-700",children:["$",(s.paid||0).toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between text-sm font-bold border-t pt-1",children:[e.jsx("span",{children:"Balance"}),e.jsxs("span",{className:(s.balance_due||0)>0?"text-red-700":"text-green-700",children:["$",(s.balance_due||0).toLocaleString()]})]})]})]}),e.jsx(i,{value:"items",className:"p-4 space-y-3 pb-24",children:d.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(c,{className:"w-10 h-10 mx-auto text-muted-foreground/30 mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No line items"})]}):d.map(t=>e.jsxs("div",{className:"bg-card border rounded-xl p-3",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:t.item_name}),e.jsxs("span",{className:"text-sm font-bold",children:["$",(t.total||0).toLocaleString()]})]}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.description}),e.jsxs("div",{className:"flex gap-3 mt-1 text-xs text-muted-foreground",children:[t.quantity!==null&&e.jsxs("span",{children:[t.quantity," ",t.unit||"ea"]}),t.unit_cost!==null&&e.jsxs("span",{children:["@ $",t.unit_cost.toLocaleString()]})]})]},t.id))}),e.jsx(i,{value:"payments",className:"p-4 space-y-3 pb-24",children:m.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(V,{className:"w-10 h-10 mx-auto text-muted-foreground/30 mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No payments recorded"})]}):m.map(t=>e.jsxs("div",{className:"bg-card border rounded-xl p-3",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx(j,{variant:"outline",className:"text-xs capitalize",children:t.payment_method||"Payment"}),e.jsxs("span",{className:"text-sm font-bold text-green-700",children:["$",(t.amount||0).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(o,{className:"w-3 h-3 text-muted-foreground/60"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:x(new Date(t.payment_date),"MMM d, yyyy")})]}),t.notes&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.notes})]},t.id))})]})]})]})};export{ue as BillDetailPage};

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.