PageSourceSearch

https://admin-snowy-three.vercel.app/assets/index-CI91qQkA.js

js admin-snowy-three.vercel.app collected 2026-10-03 06:11:11 UTC 10,677 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-ui-r4iVzRl6.js";import{L as x,m as L,i as I,r as R}from"./vendor-react-BfGFalVa.js";import{C as r,g as n,h as c,F as C,B as m,i as d,a as o,P as S,b as f,j as v,k as _,X as T,L as z}from"./index-DrTqwVsL.js";import{A as E,a as F,b as M,c as H,d as O,e as U,f as V,g as X}from"./alert-dialog-2ZJErjf2.js";import{c as q}from"./use-clients-DPg42HOk.js";import{u as G}from"./use-properties-D8HnZHpL.js";import{I as J}from"./invoice-status-badge-EFM81ewP.js";import{u as K}from"./use-invoices-BxFoSq9v.js";import{f as y}from"./billing-DlrqDUd6.js";import{P}from"./plus-BmE18SAb.js";import{A as b}from"./arrow-left-tscW42Lh.js";import{P as Q}from"./pencil-DpzIaX0M.js";import{M as N}from"./mail-C_k2pCDI.js";import{P as w}from"./phone-DPwBVNEa.js";import{M as W}from"./map-pin-i4zEv0SS.js";import{B as Y}from"./building-BBLG3-oa.js";import"./vendor-query-DHLwvY3K.js";import"./vendor-supabase-OAvKDiam.js";import"./vendor-charts-D47kEIWf.js";function Z({clientId:t}){const{data:l,isLoading:s}=K(t),h=l?.reduce((a,u)=>a+u.balance_due,0)||0;return e.jsxs(r,{children:[e.jsxs(n,{className:"flex flex-row items-center justify-between",children:[e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(C,{className:"h-5 w-5"}),"Billing"]}),e.jsx(m,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(x,{to:`/billing/invoices?client=${t}&create=true`,children:[e.jsx(P,{className:"h-4 w-4 mr-1"}),"New Invoice"]})})]}),e.jsxs(d,{children:[h>0&&e.jsxs("div",{className:"mb-4 p-3 bg-muted rounded-lg",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Outstanding Balance"}),e.jsx("p",{className:"text-2xl font-bold",children:y(h)})]}),s?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."}):l?.length?e.jsxs("div",{className:"space-y-2",children:[l.slice(0,5).map(a=>e.jsxs(x,{to:`/billing/invoices/${a.id}`,className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted transition-colors",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:a.invoice_number}),e.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(a.invoice_date).toLocaleDateString()})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"font-medium",children:y(a.balance_due)}),e.jsx(J,{status:a.status})]})]},a.id)),l.length>5&&e.jsx(m,{variant:"ghost",size:"sm",className:"w-full",asChild:!0,children:e.jsxs(x,{to:`/billing/invoices?client=${t}`,children:["View all ",l.length," invoices"]})})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No invoices"})]})]})}function Ne(){const{id:t}=L(),l=I(),{data:s,isLoading:h,error:a,refetch:u}=q(t),g=G(),[j,p]=R.useState(null),A=async()=>{j&&(await g.mutateAsync({id:j.id,data:{client_id:null}}),p(null),u())};if(h)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(o,{className:"h-10 w-64"}),e.jsx(o,{className:"h-10 w-24"})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(o,{className:"h-48"}),e.jsx(o,{className:"h-48"}),e.jsx(o,{className:"h-48"}),e.jsx(o,{className:"h-48"})]})]});if(a||!s)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-center",children:[e.jsx("p",{className:"text-destructive mb-4",children:"Client not found"}),e.jsxs(m,{variant:"outline",onClick:()=>l("/clients"),children:[e.jsx(b,{className:"mr-2 h-4 w-4"}),"Back to Clients"]})]});const B=s.secondary_first_name||s.secondary_email||s.secondary_phone,$=s.billing_email||s.billing_address_line1||s.billing_city,D=s.properties&&Array.isArray(s.properties)&&s.properties.length>0;return e.jsxs("div",{children:[e.jsxs(S,{title:`${s.first_name} ${s.last_name}`,description:s.source?`via ${s.source}`:void 0,children:[e.jsxs(m,{variant:"outline",onClick:()=>l("/clients"),children:[e.jsx(b,{className:"mr-2 h-4 w-4"}),"Back"]}),e.jsx(m,{asChild:!0,children:e.jsxs(x,{to:`/clients/${t}/edit`,children:[e.jsx(Q,{className:"mr-2 h-4 w-4"}),"Edit"]})})]}),e.jsx("div",{className:"flex items-center gap-2 mb-6",children:e.jsx(f,{variant:s.is_active?"success":"secondary",children:s.is_active?"Active":"Archived"})}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs(r,{children:[e.jsx(n,{children:e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(v,{className:"h-5 w-5"}),"Contact Information"]})}),e.jsxs(d,{className:"space-y-4",children:[s.email&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(N,{className:"h-5 w-5 text-muted-foreground mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Email"}),e.jsx("a",{href:`mailto:${s.email}`,className:"text-sm text-primary hover:underline",children:s.email})]})]}),s.phone&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(w,{className:"h-5 w-5 text-muted-foreground mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Phone"}),e.jsx("a",{href:`tel:${s.phone}`,className:"text-sm text-primary hover:underline",children:s.phone})]})]}),!s.email&&!s.phone&&e.jsx("p",{className:"text-muted-foreground",children:"No contact information"})]})]}),e.jsxs(r,{children:[e.jsxs(n,{children:[e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(v,{className:"h-5 w-5"}),"Secondary Contact"]}),s.secondary_relationship&&e.jsx(_,{children:s.secondary_relationship})]}),e.jsx(d,{className:"space-y-4",children:B?e.jsxs(e.Fragment,{children:[(s.secondary_first_name||s.secondary_last_name)&&e.jsx("div",{children:e.jsxs("p",{className:"font-medium",children:[s.secondary_first_name," ",s.secondary_last_name]})}),s.secondary_email&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(N,{className:"h-5 w-5 text-muted-foreground mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Email"}),e.jsx("a",{href:`mailto:${s.secondary_email}`,className:"text-sm text-primary hover:underline",children:s.secondary_email})]})]}),s.secondary_phone&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(w,{className:"h-5 w-5 text-muted-foreground mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Phone"}),e.jsx("a",{href:`tel:${s.secondary_phone}`,className:"text-sm text-primary hover:underline",children:s.secondary_phone})]})]})]}):e.jsx("p",{className:"text-muted-foreground",children:"No secondary contact"})})]}),e.jsxs(r,{children:[e.jsx(n,{children:e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(C,{className:"h-5 w-5"}),"Billing Information"]})}),e.jsx(d,{className:"space-y-4",children:$?e.jsxs(e.Fragment,{children:[s.billing_email&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(N,{className:"h-5 w-5 text-muted-foreground mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Billing Email"}),e.jsx("a",{href:`mailto:${s.billing_email}`,className:"text-sm text-primary hover:underline",children:s.billing_email})]})]}),s.billing_address_line1&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(W,{className:"h-5 w-5 text-muted-foreground mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Billing Address"}),e.jsx("p",{className:"text-sm",children:s.billing_address_line1}),s.billing_address_line2&&e.jsx("p",{className:"text-sm",children:s.billing_address_line2}),(s.billing_city||s.billing_state||s.billing_zip)&&e.jsx("p",{className:"text-sm",children:[s.billing_city,s.billing_state,s.billing_zip].filter(
1Boolean).join(", ")})]})]})]}):e.jsx("p",{className:"text-muted-foreground",children:"No billing information"})})]}),e.jsxs(r,{children:[e.jsxs(n,{className:"flex flex-row items-start justify-between space-y-0",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"h-5 w-5"}),"Properties"]}),e.jsx(_,{children:"Properties associated with this client"})]}),e.jsx(m,{asChild:!0,size:"sm",children:e.jsxs(x,{to:`/properties/new?client=${t}`,children:[e.jsx(P,{className:"mr-1 h-4 w-4"}),"Add Property"]})})]}),e.jsx(d,{children:D?e.jsx("div",{className:"space-y-3",children:s.properties.map(i=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted/50 transition-colors",children:[e.jsx(x,{to:`/properties/${i.id}`,className:"flex-1",children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:i.name}),i.address_line1&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.address_line1,i.city&&`, ${i.city}`,i.state&&`, ${i.state}`]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:i.is_active?"success":"secondary",children:i.is_active?"Active":"Inactive"}),e.jsx(m,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:k=>{k.preventDefault(),p({id:i.id,name:i.name})},children:e.jsx(T,{className:"h-4 w-4"})})]})]},i.id))}):e.jsx("p",{className:"text-muted-foreground",children:"No properties linked"})})]}),e.jsx(Z,{clientId:t}),e.jsx(E,{open:!!j,onOpenChange:i=>!i&&p(null),children:e.jsxs(F,{children:[e.jsxs(M,{children:[e.jsx(H,{children:"Remove Property"}),e.jsxs(O,{children:['Are you sure you want to remove "',j?.name,'" from this client? The property will remain in the system but will no longer be associated with this client.']})]}),e.jsxs(U,{children:[e.jsx(V,{children:"Cancel"}),e.jsx(X,{onClick:A,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:g.isPending,children:g.isPending?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}),"Removing..."]}):"Remove Property"})]})]})}),s.notes&&e.jsxs(r,{className:"md:col-span-2",children:[e.jsx(n,{children:e.jsx(c,{children:"Notes"})}),e.jsx(d,{children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:s.notes})})]}),(s.referral_source||s.tags?.length)&&e.jsxs(r,{className:"md:col-span-2",children:[e.jsx(n,{children:e.jsx(c,{children:"Additional Information"})}),e.jsxs(d,{className:"space-y-4",children:[s.referral_source&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Referral Source"}),e.jsx("p",{className:"font-medium",children:s.referral_source})]}),s.tags&&s.tags.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.tags.map(i=>e.jsx(f,{variant:"outline",children:i},i))})]})]})]})]})]})}export{Ne as ClientDetailPage,Ne 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.