1import{o as ee,u as se,p as te,r as N,s as m,j as e,w as x,x as h,K as w,N as b,O as ae,L as ne,B as re}from"./index-MoAbC8_9.js";import{O as ie,S as oe}from"./OwnersLayout-Cd0M3dw8.js";import{u as de}from"./useHouseContacts-CRglCbrb.js";import{B as K}from"./badge-BHbYeRgi.js";import{S as E}from"./separator-CQ84aZ0V.js";import{P as ce,C as le,a as me,b as pe}from"./collapsible-BIxz44zB.js";import{T as ue,a as xe,b as G,c as S,d as he,e as M}from"./table-BNHSYido.js";import{C as W}from"./circle-alert-CI-iPm0z.js";import{B as ge}from"./breadcrumb-CmKLwRya.js";import{W as je}from"./wrench-B4A_f5hE.js";import{U as R}from"./users-xui-UtA1.js";import{C as fe}from"./calendar-CnsXUgOr.js";import{E as we}from"./external-link-Bd1Ktkpe.js";import{C as Z}from"./chevron-down-BDe4YKQW.js";import{C as be}from"./chevron-up-JyGCcpt9.js";import{S as Ne}from"./Header-CnJGZ8vQ.js";import"./skeleton-ClxqB572.js";import"./switch-BHj3-8MN.js";import"./index-D9-GACGG.js";import"./house-DjS1WMqx.js";import"./receipt-DnGXta2k.js";import"./building-crte1H4H.js";import"./file-text-Bif0RP8Y.js";import"./user-Cvsz7Lm_.js";import"./chart-column-Bo5i9GGE.js";import"./upload-BH1HltYO.js";import"./piggy-bank-DP-A2O0m.js";import"./landmark-C0TkBs1l.js";import"./flame-wMx8KIS8.js";import"./trending-up-Cg9WFJWB.js";import"./euro-Cc6O9qjZ.js";import"./eye-DKrvAixa.js";import"./dialog-DrI7Oddz.js";import"./tabs-5EVsfllK.js";import"./textarea-4z16PwID.js";import"./mountain-BHfTfCFy.js";const _e=({member:i})=>{const[g,s]=N.useState(!1);return e.jsxs(K,{variant:"secondary",className:"text-sm py-1.5 px-3 gap-1.5 cursor-pointer select-none transition-all",onClick:()=>i.email&&s(o=>!o),children:[e.jsx("span",{className:"font-medium",children:[i.first_name,i.last_name].filter(Boolean).join(" ")}),i.apartment_codes.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.apartment_codes.join(", "),")"]}),i.email&&e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:`h-3 w-3 text-muted-foreground transition-transform ${g?"rotate-180":""}`}),g&&e.jsx("a",{href:`mailto:${i.email}`,className:"text-xs text-primary hover:underline ml-0.5",onClick:o=>o.stopPropagation(),children:i.email})]})]})},ve=({members:i})=>e.jsx("div",{className:"flex flex-wrap gap-2",children:i.map((g,s)=>e.jsx(_e,{member:g},s))}),ds=()=>{var U;const{user:i}=ee(),{t:g,language:s}=se(),{byType:o,loading:ye}=de();te();const[P,$]=N.useState([]),[T,F]=N.useState([]),[A,V]=N.useState(null),[v,O]=N.useState([]),[J,L]=N.useState(!0);N.useEffect(()=>{i&&(Q(),Y(),X())},[i]);const Q=async()=>{L(!0);const{data:t}=await m.from("announcements").select("*").order("created_at",{ascending:!1});$(t||[]),L(!1)},X=async()=>{const{data:t}=await m.from("user_roles").select("user_id, beirat_since").eq("role","beirat"),d=(t||[]).map(a=>a.user_id);if(d.length===0){O([]);return}const{data:p}=await m.from("owner_contacts").select("id, first_name, last_name, email, user_id").in("user_id",d),{data:u}=await m.from("owner_contact_persons").select("id, first_name, last_name, email, user_id, owner_contact_id").in("user_id",d),j=(p||[]).map(a=>a.id).filter(Boolean),B=(u||[]).map(a=>a.owner_contact_id).filter(Boolean),r=[...new Set([...j,...B])],{data:_}=await m.from("apartment_owners").select("user_id, apartment:apartments(code)").in("user_id",d).eq("is_current",!0),{data:y}=r.length>0?await m.from("apartment_owners").select("owner_contact_id, apartment:apartments(code)").in("owner_contact_id",r).eq("is_current",!0):{data:[]},f={};(p||[]).forEach(a=>{a.user_id&&(f[a.id]=a.user_id)});const k={};(u||[]).forEach(a=>{a.owner_contact_id&&a.user_id&&(k[a.owner_contact_id]||(k[a.owner_contact_id]=[]),k[a.owner_contact_id].push(a.user_id))});const c={};(_||[]).forEach(a=>{var l;c[a.user_id]||(c[a.user_id]=new Set),(l=a.apartment)!=null&&l.code&&c[a.user_id].add(a.apartment.code)}),(y||[]).forEach(a=>{var I;const l=f[a.owner_contact_id];l&&(c[l]||(c[l]=new Set),(I=a.apartment)!=null&&I.code&&c[l].add(a.apartment.code)),(k[a.owner_contact_id]||[]).forEach(C=>{var q;c[C]||(c[C]=new Set),(q=a.apartment)!=null&&q.code&&c[C].add(a.apartment.code)})});const D={};
1(t||[]).forEach(a=>{D[a.user_id]=a.beirat_since||null});const z={};(p||[]).forEach(a=>{z[a.user_id]={first_name:a.first_name,last_name:a.last_name,email:a.email||null,apartment_codes:[],beirat_since:D[a.user_id]||null}}),(u||[]).forEach(a=>{z[a.user_id]||(z[a.user_id]={first_name:a.first_name,last_name:a.last_name,email:a.email||null,apartment_codes:[],beirat_since:D[a.user_id]||null})}),O(Object.entries(z).map(([a,l])=>({...l,apartment_codes:Array.from(c[a]||[])})))},Y=async()=>{const{data:t}=await m.from("apartments").select("id, code, floor, sort_order").order("sort_order",{ascending:!0}),{data:d}=await m.from("apartment_owners").select("apartment_id, owner_contact_id, updated_at").eq("is_current",!0),p=(d||[]).map(r=>r.updated_at).filter(Boolean);if(p.length>0){const r=p.sort().reverse()[0];V(r)}const u=[...new Set((d||[]).map(r=>r.owner_contact_id).filter(Boolean))];let j={};if(u.length>0){const{data:r}=await m.from("owner_contacts").select("id, first_name, last_name").in("id",u);for(const _ of r||[])j[_.id]=[_.first_name,_.last_name].filter(Boolean).join(" ")||"â"}const B=(t||[]).map(r=>{const y=(d||[]).filter(f=>f.apartment_id===r.id).map(f=>f.owner_contact_id?j[f.owner_contact_id]:null).filter(Boolean);return{apartment_code:r.code,floor:r.floor,owner_name:y.length>0?y.join(", "):"â"}});F(B)},H=t=>new Date(t).toLocaleDateString(s==="de"?"de-DE":s==="cs"?"cs-CZ":"en-US",{year:"numeric",month:"long",day:"numeric"}),n={title:s==="cs"?"Správa domu":s==="de"?"Hausverwaltung":"House Management",description:s==="cs"?"OrganizaÄnà a provoznà pÅehled pro vlastnÃky":s==="de"?"Organisations- und Betriebsübersicht für Eigentümer":"Organizational and operational overview for owners",manager:s==="cs"?"Správa nemovitosti":s==="de"?"Hausverwaltung":"Property Management",caretaker:s==="cs"?"Správce domu":s==="de"?"Hausmeister":"Caretaker",contacts:s==="cs"?"Důležité kontakty":s==="de"?"Wichtige Kontakte":"Important Contacts",rules:s==="cs"?"Domovnà Åád":s==="de"?"Hausordnung":"House Rules",announcements:s==="cs"?"OznámenÃ":s==="de"?"Ankündigungen":"Announcements",quietHours:s==="cs"?"NoÄnà klid":s==="de"?"Nachtruhe":"Quiet Hours",quietHoursDesc:s==="cs"||s==="de"?"22:00 â 06:00":"10 PM â 6 AM",waste:s==="cs"?"TÅÃdÄnà odpadu":s==="de"?"Mülltrennung":"Waste Sorting",wasteDesc:s==="cs"?"ProsÃme o důsledné tÅÃdÄnà odpadu dle oznaÄenà kontejnerů.":s==="de"?"Bitte den Müll nach den Behälterbeschriftungen trennen.":"Please sort waste according to container labels.",parking:s==="cs"?"ParkovánÃ":s==="de"?"Parken":"Parking",parkingDesc:s==="cs"?"Parkujte pouze na vyhrazených mÃstech.":s==="de"?"Bitte nur auf den zugewiesenen Stellplätzen parken.":"Please park only in designated spots.",pets:s==="cs"?"Domácà zvÃÅata":s==="de"?"Haustiere":"Pets",petsDesc:s==="cs"?"Domácà zvÃÅata jsou povolena. Majitelé zodpovÃdajà za Äistotu.":s==="de"?"Haustiere sind erlaubt. Eigentümer sind für die Sauberkeit verantwortlich.":"Pets are allowed. Owners are responsible for cleanliness.",ownersList:s==="cs"?"Seznam majitelů":s==="de"?"Eigentümerliste":"Owners List",apartment:s==="cs"?"Byt":s==="de"?"Wohnung":"Apartment",floorLabel:s==="cs"?"Patro":s==="de"?"Stock":"Floor",ownerName:s==="cs"?"Jméno a pÅÃjmenÃ":"Name",beiratTitle:s==="cs"?"Poradnà sbor vlastnÃků (Beirat)":s==="de"?"Eigentümerbeirat":"Owners Advisory Board (Beirat)",beiratRole:s==="cs"?"Poradnà a koordinaÄnà orgán vlastnÃků, který spolupracuje se správou domu a pomáhá pÅedbÄžnÄ projednávat vybraná témata. Nemá pÅÃmou rozhodovacà pravomoc.":s==="de"?"Beratungs- und Koordinationsorgan der Eigentümer, das mit der Hausverwaltung zusammenarbeitet und ausgewählte Themen vorab bespricht. Der Beirat hat keine direkte Entscheidungsbefugnis.":"Advisory and coordination body of owners that cooperates with the property management and helps discuss selected topics in advance. The board has no direct decision-making authority.",beiratMembers:s==="cs"?"Aktuálnà Älenové":s==="de"?"Aktuelle Mitglieder":"Current Members",beiratNoMembers:s==="cs"?"Žádnà evidovanà Älenové":s==="de"?"Keine registrierten Mitglieder":"No registered members",beiratElected:s==="cs"?"Zvoleni na shromáždÄnà vlastnÃků"
1:s==="de"?"Gewählt bei der Eigentümerversammlung":"Elected at the owners' meeting",beiratElectionDetail:s==="cs"?"Bod 8 protokolu â jednomyslnÄ zvoleni pÅÃtomnými vlastnÃky (77,46 % podÃlů zastoupeno).":s==="de"?"Punkt 8 des Protokolls â einstimmig von den anwesenden Eigentümern gewählt (77,46 % der Anteile vertreten).":"Agenda item 8 â unanimously elected by the present owners (77.46% of shares represented).",beiratMemberSince:s==="cs"?"Älen od":s==="de"?"Mitglied seit":"Member since"};return e.jsx(ie,{title:n.title,description:n.description,breadcrumbs:[{label:n.title}],isLoading:J,children:e.jsxs("div",{className:"space-y-8",children:[e.jsxs("section",{children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2 mb-4",children:[e.jsx(W,{className:"h-5 w-5 text-primary"}),n.announcements]}),P.length===0?e.jsx(x,{children:e.jsx(h,{className:"p-8 text-center text-muted-foreground",children:g("owners.noAnnouncements")})}):e.jsx("div",{className:"space-y-4",children:P.map(t=>e.jsxs(x,{className:t.is_important?"border-destructive/50 bg-destructive/5":"",children:[e.jsx(w,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(b,{className:"text-xl",children:t.title}),e.jsx(ae,{children:H(t.created_at)})]}),t.is_important&&e.jsxs(K,{variant:"destructive",className:"flex items-center gap-1",children:[e.jsx(W,{className:"h-3 w-3"}),g("owners.important")]})]})}),e.jsx(h,{children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:t.content})})]},t.id))})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsxs(x,{children:[e.jsx(w,{className:"pb-3",children:e.jsxs(b,{className:"flex items-center gap-2 text-lg",children:[e.jsx(ge,{className:"h-5 w-5 text-primary"}),n.manager]})}),e.jsxs(h,{className:"space-y-3",children:[o("manager").map(t=>e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:t.name}),t.role&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.role}),e.jsx(E,{className:"my-2"}),e.jsxs("div",{className:"space-y-1 text-sm",children:[t.phone&&e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tel:"})," ",t.phone]}),t.email&&e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Email:"})," ",t.email]}),t.website&&e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Web:"})," ",t.website]})]})]},t.id)),o("manager").length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"â"})]})]}),e.jsxs(x,{children:[e.jsx(w,{className:"pb-3",children:e.jsxs(b,{className:"flex items-center gap-2 text-lg",children:[e.jsx(je,{className:"h-5 w-5 text-primary"}),n.caretaker]})}),e.jsxs(h,{className:"space-y-3",children:[o("caretaker").map(t=>e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:t.name}),t.role&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.role}),e.jsx(E,{className:"my-2"}),e.jsxs("div",{className:"space-y-1 text-sm",children:[t.phone&&e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tel:"})," ",t.phone]}),t.email&&e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Email:"})," ",t.email]})]})]},t.id)),o("caretaker").length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"â"})]})]})]}),e.jsxs(x,{children:[e.jsx(w,{className:"pb-3",children:e.jsxs(b,{className:"flex items-center gap-2 text-lg",children:[e.jsx(R,{className:"h-5 w-5 text-primary"}),n.beiratTitle]})}),e.jsxs(h,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:n.beiratRole}),v.length>0&&((U=v[0])==null?void 0:U.beirat_since)&&e.jsxs("div",{className:"rounded-md bg-muted/50 border border-border/50 px-3 py-2.5 space-y-1",children:[e.jsxs("p",{className:"text-xs font-medium text-foreground flex items-center gap-1.5",children:[e.jsx(fe,{className:"h-3.5 w-3.5 text-primary"}),n.beiratElected,": ",new Date(v[0].beirat_since).toLocaleDateString(s==="cs"?"cs-CZ":s==="de"?"de-AT":"en-GB")]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n.beiratElectionDetail})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2",children:n.beiratMembers}),v.length>0?e.jsx(ve,{members:v}):e.jsx("p",{className:"text-sm text-muted-foreground",children:n.beiratNoMembers})]})]})]}),e.jsxs(x,{children:[e.jsx(w,{className:"pb-3",children:e.jsxs(b,{className:"flex items-center gap-2 text-lg",children:[e.jsx(ce,{className:"h-5 w-5 text-primary"}),n.contacts]})}),e.jsx(h,{children:e.jsxs("div",{className:"space-y-2 text-sm",children:[o("emergency").filter(t=>[1,2,3,4,13,14].includes(t.sort_order||0)).map((t,d)=>{var j;const p=((j=t.additional_data)==null?void 0:j[`label_${s}`])||t.name,u=d===0;return e.jsxs("div",{children:[d===4&&e.jsx(E,{className:"my-1"}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:p}),e.jsx("span",{className:`font-mono font-semibold ${u?"text-destructive":""}`,children:t.phone})]})]},t.id)}),o("emergency").length>7&&e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"my-2"}),e.jsxs(ne,{to:"/owners/contacts",className:"flex items-center gap-1.5 text-xs text-primary hover:underline",children:[e.jsx(we,{className:"h-3 w-3"}),s==="cs"?"VÅ¡echny kontakty":s==="de"?"Alle Kontakte":"All contacts",` (${o("emergency").length})`]})]})]})})]}),e.jsxs(x,{children:[e.jsx(w,{className:"pb-3",children:e.jsxs(b,{className:"flex items-center gap-2 text-lg",children:[e.jsx(oe,{className:"h-5 w-5 text-primary"}),n.rules]})}),e.jsx(h,{children:e.jsxs("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"font-medium text-sm",children:n.quietHours}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n.quietHoursDesc})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"font-medium text-sm",children:n.waste}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n.wasteDesc})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"font-medium text-sm",children:n.parking}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n.parkingDesc})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"font-medium text-sm",children:n.pets}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n.petsDesc})]})]})})]}),e.jsx(le,{children:e.jsxs(x,{children:[e.jsxs(w,{className:"flex flex-row items-center justify-between",children:[e.jsxs(b,{className:"flex items-center gap-2 text-base",children:[e.jsx(R,{className:"h-5 w-5 text-primary"}),n.ownersList," (",T.length,")"]}),e.jsx(me,{asChild:!0,children:e.jsxs(re,{variant:"outline",size:"sm",className:"gap-1.5",children:[e.jsx("span",{className:"text-xs",children:s==="cs"?"Zobrazit seznam":s==="de"?"Liste anzeigen":"Show list"}),e.jsx(Z,{className:"h-4 w-4 transition-transform [[data-state=open]_&]:hidden"}),e.jsx(be,{className:"h-4 w-4 transition-transform [[data-state=closed]_&]:hidden"})]})})]}),e.jsx(pe,{children:e.jsxs(h,{children:[A&&e.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[s==="cs"?"Poslednà aktualizace: ":s==="de"?"Letzte Aktualisierung: ":"Last updated: ",H(A)]}),e.jsxs("div",{className:"flex gap-3 items-start p-3 mb-4 rounded-lg bg-muted/50 border border-border text-xs text-muted-foreground",children:[e.jsx(Ne,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"}),e.jsx("p",{children:s==="cs"?"Tato sekce je urÄena výhradnÄ pro komunikaci mezi vlastnÃky, sdÃlenà informacà souvisejÃcÃch se správou domu a výkon práv vyplývajÃcÃch ze spoluvlastnictvÃ, vÄetnÄ hlasovánÃ. Zobrazeny jsou pouze údaje v nezbytném rozsahu, zejména jméno vlastnÃka a oznaÄenà jednotky (TOP). PÅÃstup k tÄmto údajům majà pouze vlastnÃci a dalšà oprávnÄné osoby; údaje nejsou veÅejnÄ dostupné. Tyto údaje smÄjà být použÃvány pouze pro úÄely správy domu a vzájemné komunikace vlastnÃků, v souladu s GDPR a WEG 2002.":s==="de"?"Dieser Bereich dient ausschlieÃlich der Kommunikation zwischen Eigentümern, dem Austausch von Informationen zur Hausverwaltung und der Ausübung von Miteigentumsrechten, einschlieÃlich Abstimmungen. Es werden nur die notwendigsten Grunddaten angezeigt, insbesondere der Name des Eigentümers und die Bezeichnung der Einheit (TOP). Der Zugang zu diesen Daten ist auf Eigentümer und berechtigte Personen beschränkt; die Daten sind nicht öffentlich zugänglich. Diese Art der Bereitstellung entspricht den Anforderungen der DSGVO und des WEG 2002.":"This section is exclusively for communication between owners, sharing property management information, and exercising co-ownership rights, including voting. Only essential data is displayed, namely the owner's name and unit designation (TOP). Access is restricted to owners and authorized persons; data is not publicly accessible. This disclosure complies with GDPR and WEG 2002 requirements."})]}),e.jsxs(ue,{children:[e.jsx(xe,{children:e.jsxs(G,{className:"bg-muted/50 hover:bg-muted/50",children:[e.jsx(S,{className:"h-9 text-xs",children:n.apartment}),e.jsx(S,{className:"h-9 text-xs",children:n.floorLabel}),e.jsx(S,{className:"h-9 text-xs",children:n.ownerName})]})}),e.jsx(he,{children:T.map(t=>e.jsxs(G,{className:"h-7",children:[e.jsx(M,{className:"font-medium text-xs py-1",children:t.apartment_code}),e.jsx(M,{className:"text-xs py-1",children:t.floor!=null?t.floor:"â"}),e.jsx(M,{className:"text-xs py-1",children:t.owner_name})]},t.apartment_code))})]})]})})]})})]})})};export{ds 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.