PageSourceSearch

https://inscalia.de/assets/AdminPipelinePage-mUxGAUm_.js

js inscalia.de collected 2026-10-08 01:56:40 UTC 18,615 bytes, 1 lines download raw bytes

1import{R as xe,u as P,r as m,j as e}from"./react-vendor-Byk_u4_X.js";import{u as ue,a as ge,K as fe}from"./useObjektKennzahlenListe-DfvWIuqc.js";import{g as he,h as be,bJ as je,V as S,B as ve,Y as W,C as Ne,aY as Y,s as D,a9 as ye,t as _e,f as ke}from"./index-BBBV1oA-.js";import{a as q}from"./AdminLayout-B7i2bDBP.js";import{A as we}from"./AdminPageHeader-DB5x9kcl.js";import{P as Ce}from"./progress-Df7QdJP9.js";import{N as De}from"./NewDealWizard-D2-2KpxH.js";import{D as Z,i as Pe,c as Se,n as J,d as Ee}from"./dealStatus-D_Jua60a.js";import{a as H,F as Q}from"./motion-DVOIi5I3.js";import{u as ze,a as Ae,P as $e,D as Ke,b as Oe,c as Ie,d as Le}from"./core.esm-DncGq8WR.js";import{S as Re}from"./SEOHead-DFf7zBOy.js";import{u as Fe,m as w}from"./framer-motion-ClkXBPBC.js";import{P as Me}from"./plus-BN1rUtdb.js";import{C as Ve}from"./chevron-down-Bav_zYh6.js";import{M as X}from"./map-pin-C3SWkwZn.js";import"./portalSicht-D24TqcUM.js";import"./kundenprozessEinstellungenLaden-mL0dXQqi.js";import"./kundenprozess-DUBDn0pD.js";import"./objektKennzahlen-BUnRAC_T.js";import"./dealCalculations-B2_lwCkI.js";import"./objektWerte-B-NxYbDL.js";import"./exposeRechnung-Te_MclcT.js";import"./taxCalculator-DlzJJlRe.js";import"./objektAnnahmen-NeGLU_Dn.js";import"./liveAnalyseFormeln-Dk4FfhkC.js";import"./kundenStartwerte-CyAVWU6Q.js";import"./supabase-CRGcyFpg.js";import"./vendor-utils-kGa5bYp2.js";import"./tanstack-DDYcxB9q.js";import"./Navbar-VQbl5_AA.js";import"./BackButton-D2ghk39d.js";import"./index-BdQq_4o_.js";import"./user-plus-D6BsfnVu.js";import"./credit-card-BXyaVHS_.js";import"./share-2-9kgrOw__.js";import"./message-square-DTewqW1o.js";import"./voicemail-QK4qc364.js";import"./phone-YqmgHEQN.js";import"./circle-help-BDMvEd5o.js";import"./arrow-left-LeErwWV-.js";import"./use-mobile-jiYRTNn4.js";import"./orgMenue-B1jWom6p.js";import"./calendar-kqDakhUT.js";import"./clock-hOBhXFSA.js";import"./users-DMC6AT9q.js";import"./arrow-right-DHZhb1LA.js";/* empty css                */import"./dropdown-menu-BVn-Scqe.js";import"./circle-DEpU1wz3.js";import"./sun-CTnv951F.js";import"./book-open-BFkQDXHL.js";import"./shield-CV88edtg.js";import"./layout-dashboard-D3stOY_D.js";import"./settings-BR6v63Tm.js";import"./reportTabs-DPyhW78S.js";import"./AkquiseSidebar-BQ-NDjRi.js";import"./KiSymbol-MLJAqCzt.js";import"./sparkles-dFJo9uF1.js";import"./nurSuperAdmin-BgzV9u9a.js";import"./label-CP41nqMo.js";import"./filter-32lGm1LA.js";import"./save-DIZOa2bh.js";import"./flame-DQRvBaSg.js";import"./popover-DVJ5GF76.js";import"./inbox-BCFfoLiK.js";import"./message-circle-CkTqL7qL.js";import"./phone-call-BUPY53W5.js";import"./headset-1VHuQ-a5.js";import"./calendar-clock-BiukR7T5.js";import"./activity-B53Q-1IF.js";import"./radio-BJfDYyGC.js";import"./store-C_EGhZz_.js";import"./chart-column-DgManq71.js";import"./presentation-BctAb-Ms.js";import"./list-ordered-C3U_85-T.js";import"./sliders-horizontal-C_VgoBRM.js";import"./list-D3tMX0xY.js";import"./pencil-BV4YJuJp.js";import"./chevron-up-ChQXHYAP.js";import"./trash-2-DMDScpAn.js";import"./caller-portal-logo-CfGgCOOW.js";import"./caller-portal-logo-light-DXuQWsq_.js";import"./kopfzeile-CqrTBrEl.js";import"./usePortalEinstellung-3gmfs7bw.js";import"./OrgMenueLinks-Dbn38k-c.js";import"./orgNews-Fmf9lmKQ.js";import"./star-Suj5K2AZ.js";import"./AkquiseMobileTabs-CO62wz2p.js";import"./shield-check-FUcO9DsW.js";import"./ImpersonationBanner-B8vY1lfr.js";import"./appStore-DZla2nbi.js";import"./play-jtfqtHek.js";import"./supportWidgetBridge-CcYJlXuW.js";import"./appOberflaeche-DCOkq0vx.js";import"./einheitenVorlage-jyL8qtPx.js";import"./einheitenCsv-BrnlIIlg.js";import"./einheitWerte-C3uSUpHk.js";import"./rechnerLink-DX7PvMKB.js";import"./switch-Dj6Wcmbk.js";import"./aiFeldZuordnung-CdCVBJS-.js";import"./form-feld-fehler-BEv7cXTI.js";import"./circle-alert-BoK91A6T.js";import"./haptik-B5ysJvZH.js";import"./house-DrfjBmHs.js";import"./file-spreadsheet-B61ygs4e.js";import"./hash-D08HB5X4.js";import"./scale-Ccbv6ADZ.js";import"./banknote-C3lAW7YE.js";import"./trophy-WciHVoY5.js";import"./key-round-Dm42aQYH.js";const ee=xe.createContext(new Map),z=Z.map(t=>({key:t.key,label:t.label,icon:t.icon,accent:t.color,borderClass:t.borderClass})),C=t=>
1t?t.toLocaleString("de-DE",{minimumFractionDigits:0,maximumFractionDigits:0})+" €":"–",Be=({card:t,colKey:o,isDragging:d,accent:l})=>{const g=P(),{attributes:c,listeners:r,setNodeRef:p,transform:x}=Le({id:`${t.deal.id}__${t.investor?.email??"none"}`,data:{card:t,fromCol:o}}),v=t.investor?.name||t.investor?.email||t.deal.title||"Unbekannt",f=ge(m.useContext(ee).get(t.deal.id),"bruttorendite"),N=t.deal._price,y=t.deal.address_city||t.deal.address?.city,i=t.access?.granted_at?new Date(t.access.granted_at).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"2-digit"}):new Date(t.deal.created_at).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"2-digit"}),u=v.split(" ").map(_=>_[0]).join("").slice(0,2).toUpperCase();return e.jsxs("div",{ref:p,className:S("bg-card border border-border rounded-lg p-4 cursor-grab active:cursor-grabbing group touch-manipulation",!d&&!x&&"transition-[border-color,transform] duration-200 hover:-translate-y-0.5"),style:{transform:x?`translate3d(${x.x}px,${x.y}px,0)`:void 0,opacity:d?.35:1},onClick:_=>{_.target.closest("[data-drag-handle]")||g(`/admin/deals/${t.deal.id}`)},...r,...c,children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[e.jsx("h4",{className:"text-sm font-semibold text-foreground leading-snug line-clamp-2",children:t.deal.title}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap tabular-nums",children:i})]}),e.jsxs("div",{className:"flex items-baseline justify-between gap-2 mb-3",children:[N?e.jsx("p",{className:"text-base font-bold text-foreground tabular-nums",children:C(N)}):e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Kein Preis"}),f===fe?null:f?e.jsx("span",{className:"text-xs font-bold tabular-nums text-accent",children:f}):t.deal.bruttorendite?e.jsxs("span",{className:"text-xs font-bold tabular-nums text-accent",children:[ye(Number(t.deal.bruttorendite),1),"%"]}):null]}),e.jsx("div",{className:"border-t border-border my-3"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("div",{className:"h-5 w-5 rounded-full flex items-center justify-center text-2xs font-bold shrink-0",style:{background:`${l}25`,color:l},children:u}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:v})]}),y&&e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(X,{className:"h-2.5 w-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:y})]})]})]})},Te=({unit:t})=>{const o=P(),d=t._price,l=Ee(t.status_pipeline);return e.jsxs("div",{className:"bg-card border border-border rounded-lg p-3 cursor-pointer",onClick:()=>o(`/admin/deals/${t.id}`),children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs font-semibold text-foreground truncate",children:t.einheiten_bezeichnung||t.title}),e.jsx(Y,{className:S("text-2xs px-1.5 py-0 font-medium",l.badgeClass),children:l.label})]}),e.jsxs("div",{className:"flex items-center gap-3 text-2xs text-muted-foreground",children:[t.living_area_sqm&&e.jsxs("span",{children:[t.living_area_sqm," m²"]}),d?e.jsx("span",{className:"font-semibold text-foreground",children:C(d)}):null]})]})},G=({project:t,units:o,expanded:d,onToggle:l})=>{const g=P(),c=t.anzahl_einheiten||o.length,r=o.filter(i=>Pe(i.status_pipeline)).length,p=o.filter(i=>Se(i.status_pipeline)).length,x=Math.max(0,c-r-p),v=c>0?Math.round(r/c*100):0,f=t.address_city||t.address?.city,N=t._price||o.reduce((i,u)=>i+(u._price||0),0),y=Z.map(i=>({key:i.key,label:i.label,units:o.filter(u=>J(u.status_pipeline)===i.key)}));return e.jsxs("div",{className:"bg-card border border-border rounded-lg border-l-2 border-l-accent overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 p-4 cursor-pointer hover:bg-muted/30 transition-colors",onClick:l,children:[e.jsx("div",{className:"shrink-0 text-muted-foreground",children:d?e.jsx(Ve,{className:"h-4 w-4"}):e.jsx(Ne,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(W,{className:"h-4 w-4 text-accent"}),e.jsx(Y,{variant:"outline",className:"text-2xs px-1.5 py-0 border-accent/40 text-accent font-bold uppercase tracking-wider",children:"Projekt"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground truncate cursor-pointer hover:text-accent transition-colors",onClick:i=>{i.stopPropagation(),g(`/admin/deals/${t.id}`)},children:t.title}),f&&e.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1 shrink-0",children:[e.jsx(X,{className:"h-2.5 w-2.5"})," ",f]})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-1.5",children:[e.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[r," / ",c," Einheiten verkauft"]}),N>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[C(N)," Volumen"]})]})]}),e.jsxs("div",{className:"w-32 shrink-0",children:[e.jsx(Ce,{value:v,className:"h-2 [&>div]:bg-accent"}),e.jsxs("span",{className:"text-2xs text-muted-foreground mt-0.5 block text-right",children:[v,"%"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 shrink-0",children:[x>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-medium px-2 py-0.5 rounded-full bg-accent/15 text-accent",children:[e.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-accent"})," ",x," Verfügbar"]}),p>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-medium px-2 py-0.5 rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:[e.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500"})," ",p," Reserviert"]}),r>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-medium px-2 py-0.5 rounded-full bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",children:[e.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-emerald-500"})," ",r," Verkauft"]})]})]}),d&&e.jsx("div",{className:"border-t border-border bg-muted/20 p-4",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:y.map(i=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:i.label}),e.jsx("span",{className:"text-2xs font-bold text-muted-foreground bg-muted rounded-full px-1.5",children:i.units.length})]}
1),e.jsx("div",{className:"space-y-2 min-h-[60px]",children:i.units.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-3 text-center",children:e.jsx("p",{className:"text-2xs text-muted-foreground",children:"—"})}):i.units.map(u=>e.jsx(Te,{unit:u},u.id))})]},i.key))})})]})},Ue=({col:t,cards:o,activeCardId:d})=>{const{setNodeRef:l,isOver:g}=Ie({id:t.key}),c=t.icon;return e.jsx(w.div,{variants:Q,className:"w-[280px] flex-shrink-0 max-md:snap-start",children:e.jsxs("div",{className:S("rounded-md border border-[#2e2e2e] bg-[#191919] [.light_&]:border-x-black/10 [.light_&]:border-b-black/10 [.light_&]:bg-white transition-colors duration-300",t.borderClass,g&&"border-accent/40"),children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"h-[18px] w-[18px]",style:{color:t.accent},strokeWidth:1.5}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:t.label})]}),e.jsx("span",{className:"text-xs font-bold tabular-nums rounded-full px-2 py-0.5",style:{color:t.accent,background:`${t.accent}15`},children:o.length})]}),e.jsxs("div",{ref:l,className:"space-y-2.5 min-h-[200px] p-3 pt-0 card-stagger",style:g?{background:`${t.accent}08`}:void 0,children:[o.length===0&&!g?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-8 text-center",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"Keine Deals"})}):o.map((r,p)=>{const x=`${r.deal.id}__${r.investor?.email??"none"}`;return e.jsx(Be,{card:r,colKey:t.key,isDragging:d===x,accent:t.accent},`${r.deal.id}-${p}`)}),g&&e.jsx(w.div,{initial:{opacity:0,scale:.97},animate:{opacity:1,scale:1},transition:{duration:.18,ease:[.16,1,.3,1]},className:"rounded-lg p-3 border-2 border-dashed text-center",style:{borderColor:`${t.accent}40`,background:`${t.accent}08`},children:e.jsx("p",{className:"text-xs font-medium",style:{color:t.accent},children:"Hier ablegen"})})]})]})})},qe=({card:t,colKey:o})=>{const d=z.find(l=>l.key===o)||z[0];return e.jsxs("div",{className:"w-[260px] bg-card border border-border rounded-lg p-4 cursor-grabbing",style:{borderColor:`${d.accent}50`,boxShadow:"0 24px 48px rgba(0,0,0,0.50)",transform:"rotate(2deg) scale(1.03)"},children:[e.jsx("h4",{className:"text-sm font-semibold text-foreground mb-1.5",children:t.deal.title}),e.jsx("p",{className:"text-base font-bold text-foreground tabular-nums",children:C(t.deal._price)})]})},Ws=()=>{const{isAdmin:t,isAdvisor:o,loading:d}=he(),{currentOrg:l}=be(),g=je(l?.org_type),c=l?.org_type==="bautraeger";P();const[r,p]=m.useState([]),x=ue(r),[v,f]=m.useState([]),[N,y]=m.useState({}),[i,u]=m.useState(!0),[_,A]=m.useState(null),[te,$]=m.useState(null),[se,K]=m.useState(!1),[O,re]=m.useState(new Set),[k,ae]=m.useState("all"),I=Fe(),ie=ze(Ae($e,{activationConstraint:{distance:8}}));m.useEffect(()=>{if(d||!t&&!o||!l?.id)return;let s=!1;return u(!0),(async()=>{try{const{data:a,error:h}=await D.from("deals").select("id, title, slug, numbers, address, address_city, purchase_price, bruttorendite, status_pipeline, created_at, cover_image_url, deal_level, parent_project_id, anzahl_einheiten, living_area_sqm").eq("organization_id",l.id).is("archived_at",null).order("created_at",{ascending:!1});h&&console.error("[Pipeline] deals error:",h.message,h.hint,h.details);const{data:b,error:M}=await D.from("deal_access").select("deal_id, investor_user_id, access_level, granted_at").order("granted_at",{ascending:!1});M&&console.error("[Pipeline] access error:",M.message);const V=[...new Set((b||[]).map(j=>j.investor_user_id).filter(Boolean))];let B={};if(V.length>0){const{data:j}=await D.from("profiles").select("id, name, email").in("id",V);(j||[]).forEach(U=>{B[U.id]=U})}if(s)return;const T=(a||[]).map(j=>({...j,_price:j.purchase_price||j.numbers?.purchasePrice||0,status_pipeline:J(j.status_pipeline)}));T.length,l.id,p(T),f(b||[]),y(B)}catch(a){console.error("[Pipeline] fetch exception:",a),s||(p([]),f([]),y({}))}finally{s||u(!1)}})(),()=>{s=!0}},[d,t,o,l?.id]);const ne=async(s,n)=>{const{error:a}=await D.from("deals").update({status_pipeline:n}).eq("id",s);if(a){console.error("[Pipeline] status update failed:",a.message),_e.error(ke(a,"Status konnte nicht gespeichert werden"));return}p(h=>h.map(b=>b.id===s?{...b,status_pipeline:n}:b))},oe=s=>{const{card:n,fromCol:a}=s.active.data.current;A({card:n,colKey:a}),$(s.active.id)},le=s=>{const{over:n,active:a}=s;
1if(A(null),$(null),!n)return;const{card:h}=a.data.current,b=n.id;h.deal.status_pipeline!==b&&ne(h.deal.id,b)},L=s=>{re(n=>{const a=new Set(n);return a.has(s)?a.delete(s):a.add(s),a})},E=m.useMemo(()=>c?r.filter(s=>s.deal_level==="project"):[],[r,c]),R=s=>r.filter(n=>n.parent_project_id===s),de=m.useMemo(()=>c?k==="projects"?[]:k==="units"?r.filter(s=>s.deal_level!=="project"):r.filter(s=>s.deal_level!=="project"):r,[r,c,k]),ce=c&&k!=="units"&&E.length>0;if(d||i)return e.jsxs(q,{children:[e.jsx(Re,{title:"Prozessboard — Inscalia",description:"Dein Objekt-Prozessboard.",noIndex:!0}),e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:e.jsx("div",{className:"h-6 w-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin"})})]});const F=c?r.filter(s=>s.deal_level!=="project"):r,me=F.reduce((s,n)=>s+(n._price||0),0),pe=de.map(s=>{const n=v.filter(a=>a.deal_id===s.id);return n.length===0?[{deal:s,investor:null,access:null}]:n.map(a=>({deal:s,investor:N[a.investor_user_id]||null,access:a}))}).flat();return e.jsx(ee.Provider,{value:x,children:e.jsxs(q,{children:[e.jsx(we,{title:"Prozessboard",subtitle:`${F.length} ${g.deals} · ${C(me)} Volumen`,actions:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c&&e.jsx(e.Fragment,{children:e.jsx("div",{className:"flex items-center bg-muted rounded-lg p-0.5 text-xs",children:[{key:"all",label:"Alle"},{key:"projects",label:"Nur Projekte"},{key:"units",label:"Nur Einheiten"}].map(s=>e.jsx("button",{onClick:()=>ae(s.key),className:S("px-3 py-1.5 rounded-md font-medium transition-colors",k===s.key?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:s.label},s.key))})}),e.jsxs(ve,{onClick:()=>K(!0),size:"sm",className:"bg-primary text-primary-foreground hover:bg-primary/90 font-semibold gap-2 h-9 px-4 text-sm",children:[e.jsx(Me,{className:"h-3.5 w-3.5"})," Neues Vorhaben"]})]})}),ce&&e.jsxs("div",{className:"px-6 pb-2",children:[e.jsxs("h2",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground mb-3 flex items-center gap-2",children:[e.jsx(W,{className:"h-3.5 w-3.5"}),"Aktive Projekte (",E.length,")"]}),e.jsx(w.div,{className:"space-y-3",variants:H,initial:I?!1:"hidden",animate:"show",children:E.map((s,n)=>n<20?e.jsx(w.div,{variants:Q,children:e.jsx(G,{project:s,units:R(s.id),expanded:O.has(s.id),onToggle:()=>L(s.id)})},s.id):e.jsx(G,{project:s,units:R(s.id),expanded:O.has(s.id),onToggle:()=>L(s.id)},s.id))})]}),k!=="projects"&&e.jsxs(Ke,{sensors:ie,onDragStart:oe,onDragEnd:le,children:[e.jsx("div",{className:"px-6 py-6 overflow-x-auto kanban-container max-md:snap-x max-md:snap-mandatory",children:e.jsx(w.div,{className:"flex gap-4 min-w-max",variants:H,initial:I?!1:"hidden",animate:"show",children:z.map(s=>{const n=pe.filter(a=>a.deal.status_pipeline===s.key);return e.jsx(Ue,{col:s,cards:n,activeCardId:te},s.key)})})}),e.jsx(Oe,{dropAnimation:{duration:200,easing:"cubic-bezier(0.18,0.67,0.6,1.22)"},children:_?e.jsx(qe,{card:_.card,colKey:_.colKey}):null})]}),e.jsx(De,{open:se,onOpenChange:K})]})})};export{Ws 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.