PageSourceSearch

https://bovistas.com/assets/CustomersList-Bnq00xGl.js

js bovistas.com collected 2026-10-07 15:09:00 UTC 4,850 bytes, 11 lines download raw bytes

1import{a4 as w,a8 as C,j as e,d as x,e as u,B as i,a_ as S,aX as K,aY as T,aZ as E,a3 as k,ai as L}from"./index-XQyBZDTl.js";import{f as _,r as n}from"./react-BOHO1DJm.js";import{T as H,a as M,b as c,c as r,d as B,e as a}from"./table-BuLnZmOg.js";import{S as q}from"./search-BuNb6cf2.js";import{S as z}from"./square-pen-GVLcUrrK.js";import{f as A,d as D}from"./de-O0FWX8S5.js";import"./pdf-DDFMIuq6.js";import"./supabase-Di0cMgX3.js";import"./constructFrom-rJN6zrQ_.js";function W(){const d=_(),[b,y]=n.useState([]),[j,N]=n.useState(!0),[l,p]=n.useState("");n.useEffect(()=>{g()},[]);const g=async()=>{try{const{data:s,error:o}=await w.from("customers").select(`
2          id,
3          name,
4          city,
5          country,
6          email,
7          phone,
8          owner,
9          created_at,
10          offers(count)
11        `).order("created_at",{ascending:!1});if(o)throw o;const v=(s||[]).map(m=>{var h,f;return{...m,offers_count:((f=(h=m.offers)==null?void 0:h[0])==null?void 0:f.count)||0}});y(v)}catch(s){console.error("Error loading customers:",s),C.error("Fehler beim Laden der Kunden",{description:s.message})}finally{N(!1)}},t=b.filter(s=>{const o=l.toLowerCase();return s.name.toLowerCase().includes(o)||s.city.toLowerCase().includes(o)||s.email.toLowerCase().includes(o)});return j?e.jsxs("div",{className:"space-y-12",children:[e.jsx("div",{className:"h-16 bg-muted animate-pulse rounded"}),e.jsx(x,{className:"shadow-soft border-border/40 bg-card",children:e.jsx(u,{className:"p-6",children:e.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>e.jsx("div",{className:"h-12 bg-muted animate-pulse rounded"},s))})})})]}):e.jsxs("div",{className:"space-y-12",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:justify-between md:items-start gap-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-body text-3xl font-bold text-foreground mb-3",children:"Kunden"}),e.jsx("p",{className:"text-muted-foreground font-body text-lg max-w-2xl",children:"Verwalten Sie Ihre Kunden und Hotels"})]}),e.jsxs(i,{onClick:()=>d("/crm/customers/new"),className:"bg-primary text-primary-foreground hover:bg-primary-hover transition-smooth font-body tracking-wide shadow-soft hover:shadow-medium shrink-0",children:[e.jsx(S,{className:"mr-2 h-4 w-4"}),"Neuer Kunde"]})]}),e.jsxs(x,{className:"shadow-soft border-border/40 bg-card",children:[e.jsxs(K,{className:"pb-5",children:[e.jsx(T,{className:"font-body text-xl font-semibold text-foreground",children:"Kundenliste"}),e.jsxs(E,{className:"font-body text-sm text-muted-foreground mt-2",children:[t.length," ",t.length===1?"Kunde":"Kunden"," gefunden"]})]}),e.jsxs(u,{children:[e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"relative",children:[e.jsx(q,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(k,{placeholder:"Nach Name, Stadt oder E-Mail suchen...",value:l,onChange:s=>p(s.target.value),className:"pl-10 font-body border-border/40"})]})}
11),e.jsxs(H,{children:[e.jsx(M,{children:e.jsxs(c,{children:[e.jsx(r,{className:"font-body",children:"Name"}),e.jsx(r,{className:"font-body",children:"Ort"}),e.jsx(r,{className:"font-body",children:"E-Mail"}),e.jsx(r,{className:"font-body",children:"Telefon"}),e.jsx(r,{className:"font-body",children:"Zuständig"}),e.jsx(r,{className:"font-body",children:"Angebote"}),e.jsx(r,{className:"font-body",children:"Erstellt"}),e.jsx(r,{className:"text-right font-body",children:"Aktionen"})]})}),e.jsx(B,{children:t.length===0?e.jsx(c,{children:e.jsx(a,{colSpan:8,className:"text-center text-muted-foreground py-12 font-body",children:l?"Keine Kunden gefunden":"Noch keine Kunden vorhanden"})}):t.map(s=>e.jsxs(c,{className:"hover:bg-muted/50 transition-smooth",children:[e.jsx(a,{className:"font-body font-medium",children:s.name}),e.jsxs(a,{className:"font-body",children:[s.city,", ",s.country]}),e.jsx(a,{className:"font-body",children:s.email}),e.jsx(a,{className:"font-body",children:s.phone||"-"}),e.jsx(a,{className:"font-body",children:s.owner||"-"}),e.jsx(a,{className:"font-body",children:s.offers_count||0}),e.jsx(a,{className:"font-body",children:A(new Date(s.created_at),"dd.MM.yyyy",{locale:D})}),e.jsx(a,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(i,{variant:"outline",size:"sm",onClick:()=>d(`/crm/customers/${s.id}`),className:"font-body border-border/40 hover:bg-primary hover:text-primary-foreground hover:border-primary transition-smooth",children:e.jsx(L,{className:"h-4 w-4"})}),e.jsx(i,{variant:"outline",size:"sm",onClick:()=>d(`/crm/customers/${s.id}/edit`),className:"font-body border-border/40 hover:bg-primary hover:text-primary-foreground hover:border-primary transition-smooth",children:e.jsx(z,{className:"h-4 w-4"})})]})})]},s.id))})]})]})]})]})}export{W 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.