1import{E as U,a as $,u as q,r as D,j as e,m as Q,w as c,x as o,B as y,L as F,K as A,N as S,O as X}from"./index-MoAbC8_9.js";import{L as k}from"./Layout-jB2m3rBw.js";import{B as h}from"./badge-BHbYeRgi.js";import{S as ee}from"./separator-CQ84aZ0V.js";import{f as i,g as se}from"./types-DDfmYF_E.js";import{b as ae,a as te}from"./useReserveFundData-CaCbmV8U.js";import{A as T}from"./arrow-left-CZKmX_Y-.js";import{E as z}from"./euro-Cc6O9qjZ.js";import{C as I}from"./calendar-CnsXUgOr.js";import{F as re}from"./file-text-Bif0RP8Y.js";import{L as P}from"./landmark-C0TkBs1l.js";import{W as K}from"./wrench-B4A_f5hE.js";import{B as M}from"./building-crte1H4H.js";import{S as V}from"./Header-CnJGZ8vQ.js";import{C as Z}from"./circle-alert-CI-iPm0z.js";import"./mountain-BHfTfCFy.js";import"./user-Cvsz7Lm_.js";const ke=()=>{const{year:J}=U(),p=$(),{language:n}=q(),w=se(n),{data:m,isLoading:Y}=ae(),{data:g,isLoading:_}=te(),l=parseInt(J||"2024"),t=n,x=D.useMemo(()=>m==null?void 0:m.find(s=>s.year===l),[m,l]),u=D.useMemo(()=>(g==null?void 0:g.filter(s=>s.year===l))||[],[g,l]),B=u.filter(s=>s.category==="loan_repayment"),C=u.filter(s=>s.category==="maintenance"),L=u.filter(s=>s.category==="repair"),R=u.filter(s=>s.category==="insurance"),E=u.filter(s=>s.category==="other"),j=B.reduce((s,d)=>s+d.amount,0),v=C.reduce((s,d)=>s+d.amount,0),N=L.reduce((s,d)=>s+d.amount,0),f=R.reduce((s,d)=>s+d.amount,0),b=E.reduce((s,d)=>s+d.amount,0),r=(x==null?void 0:x.expenditures)||j+v+N+f+b,G=s=>{switch(s){case"loan_repayment":return e.jsx(P,{className:"h-5 w-5 text-orange-600"});case"maintenance":return e.jsx(K,{className:"h-5 w-5 text-purple-600"});case"repair":return e.jsx(M,{className:"h-5 w-5 text-blue-600"});case"insurance":return e.jsx(V,{className:"h-5 w-5 text-cyan-600"});default:return e.jsx(Z,{className:"h-5 w-5 text-gray-600"})}},W=s=>{switch(s){case"loan_repayment":return e.jsx(h,{variant:"outline",className:"bg-orange-100 text-orange-700 border-orange-300",children:w.loanRepayments});case"maintenance":return e.jsx(h,{variant:"outline",className:"bg-purple-100 text-purple-700 border-purple-300",children:w.maintenance});case"repair":return e.jsx(h,{variant:"outline",className:"bg-blue-100 text-blue-700 border-blue-300",children:t==="cs"?"Oprava":t==="de"?"Reparatur":"Repair"});case"insurance":return e.jsx(h,{variant:"outline",className:"bg-cyan-100 text-cyan-700 border-cyan-300",children:t==="cs"?"PojiÅ¡tÄnÃ":t==="de"?"Versicherung":"Insurance"});default:return e.jsx(h,{variant:"outline",children:t==="cs"?"OstatnÃ":t==="de"?"Sonstiges":"Other"})}},O={cs:{title:"Detail výdajů",backToOverview:"ZpÄt na pÅehled",yearOverview:"PÅehled roku",totalExpenditures:"Celkové výdaje",fundBalance:"Stav fondu",startBalance:"PoÄáteÄnà stav",endBalance:"KoneÄný stav",expenditureCategories:"Kategorie výdajů",loanRepayments:"Splátky úvÄrů",maintenance:"Ãdržba",repairs:"Opravy",insurance:"PojiÅ¡tÄnÃ",other:"OstatnÃ",items:"položek",noData:"Žádná data pro tento rok",detailedBreakdown:"Detailnà rozpad",notes:"Poznámky",vendor:"Dodavatel",invoiceNumber:"ÄÃslo faktury",date:"Datum",loading:"NaÄÃtám..."},de:{title:"Ausgabendetails",backToOverview:"Zurück zur Ãbersicht",yearOverview:"Jahresübersicht",totalExpenditures:"Gesamtausgaben",fundBalance:"Rücklagenstand",startBalance:"Anfangsstand",endBalance:"Endstand",expenditureCategories:"Ausgabenkategorien",loanRepayments:"Darlehenstilgung",maintenance:"Instandhaltung",repairs:"Reparaturen",insurance:"Versicherung",other:"Sonstiges",items:"Positionen",noData:"Keine Daten für dieses Jahr",detailedBreakdown:"Detaillierte Aufstellung",notes:"Anmerkungen",vendor:"Lieferant",invoiceNumber:"Rechnungsnummer",date:"Datum",loading:"Laden..."},en:{title:"Expenditure Details",backToOverview:"Back to overview",yearOverview:"Year Overview",totalExpenditures:"Total Expenditures",fundBalance:"Fund Balance",startBalance:"Starting Balance",endBalance:"Ending Balance",expenditureCategories:"Expenditure Categories",loanRepayments:"Loan Repayments",maintenance:"Maintenance",repairs:"Repairs",insurance:"Insurance",other:"Other",items:"items",noData:"No data for this year",detailedBreakdown:"Detailed Breakdown",notes:"Notes",vendor:"Vendor",invoiceNumber:"Invoice Number",date:"Date",loading:"Loading..."}},a=O[t]||O.cs;if(Y||_)return e.jsx(k,{children:e.jsxs("div",{className:"container mx-auto px-4 py-8 flex items-center justify-center",children:[e.jsx(Q,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:a.loading})]})});if(!x)return e.jsx(k,{children:e.jsx("div",{className:"container mx-auto px-4 py-8",children:e.jsx(c,{children:e.jsxs(o,{className:"py-12 text-center",children:[e.jsx("p",{className:"text-muted-foreground",children:a.noData}),e.jsxs(y,{variant:"outline",className:"mt-4",onClick:()=>p("/costs"),children:[e.jsx(T,{className:"h-4 w-4 mr-2"}),a.backToOverview]})]})})})});const H=(m==null?void 0:m.map(s=>s.year).sort((s,d)=>
1s-d))||[];return e.jsx(k,{children:e.jsxs("div",{className:"container mx-auto px-4 py-8 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(y,{variant:"ghost",size:"sm",onClick:()=>p("/costs?tab=house&subtab=reserve"),children:[e.jsx(T,{className:"h-4 w-4 mr-2"}),a.backToOverview]}),e.jsx(ee,{orientation:"vertical",className:"h-6"}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(F,{to:"/costs",className:"hover:underline",children:t==="cs"?"Náklady":t==="de"?"Kosten":"Costs"}),e.jsx("span",{children:"/"}),e.jsx(F,{to:"/costs?tab=house&subtab=reserve",className:"hover:underline",children:t==="cs"?"Fond oprav":t==="de"?"Rücklage":"Reserve Fund"}),e.jsx("span",{children:"/"}),e.jsx("span",{className:"font-medium text-foreground",children:l})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-full bg-red-100 dark:bg-red-900",children:e.jsx(z,{className:"h-6 w-6 text-red-600"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold",children:[a.title," - ",l]}),e.jsx("p",{className:"text-muted-foreground",children:x.notes})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(c,{children:e.jsxs(o,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm mb-1",children:[e.jsx(I,{className:"h-4 w-4"}),a.startBalance]}),e.jsx("div",{className:"text-2xl font-bold",children:i(x.startBalance,n)})]})}),e.jsx(c,{className:"border-red-200 bg-red-50/50 dark:bg-red-950/20",children:e.jsxs(o,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-red-700 dark:text-red-300 text-sm mb-1",children:[e.jsx(z,{className:"h-4 w-4"}),a.totalExpenditures]}),e.jsx("div",{className:"text-2xl font-bold text-red-600",children:i(r,n)})]})}),e.jsx(c,{children:e.jsxs(o,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm mb-1",children:[e.jsx(re,{className:"h-4 w-4"}),a.items]}),e.jsx("div",{className:"text-2xl font-bold",children:u.length})]})}),e.jsx(c,{children:e.jsxs(o,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm mb-1",children:[e.jsx(I,{className:"h-4 w-4"}),a.endBalance]}),e.jsx("div",{className:"text-2xl font-bold",children:i(x.endBalance,n)})]})})]}),e.jsxs(c,{children:[e.jsxs(A,{children:[e.jsx(S,{children:a.expenditureCategories}),e.jsxs(X,{children:[a.yearOverview," ",l]})]}),e.jsx(o,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-lg border bg-orange-50/50 dark:bg-orange-950/20 border-orange-200",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(P,{className:"h-5 w-5 text-orange-600"}),e.jsx("span",{className:"font-medium text-orange-700 dark:text-orange-300",children:a.loanRepayments})]}),e.jsx("div",{className:"text-2xl font-bold text-orange-600",children:i(j,n)}),e.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[B.length," ",a.items," ⢠",r>0?(j/r*100).toFixed(0):0,"%"]})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-purple-50/50 dark:bg-purple-950/20 border-purple-200",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(K,{className:"h-5 w-5 text-purple-600"}),e.jsx("span",{className:"font-medium text-purple-700 dark:text-purple-300",children:a.maintenance})]}),e.jsx("div",{className:"text-2xl font-bold text-purple-600",children:i(v,n)}),e.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[C.length," ",a.items," ⢠",r>0?(v/r*100).toFixed(0):0,"%"]})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-blue-50/50 dark:bg-blue-950/20 border-blue-200",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(M,{className:"h-5 w-5 text-blue-600"}),e.jsx("span",{className:"font-medium text-blue-700 dark:text-blue-300",children:a.repairs})]}),e.jsx("div",{className:"text-2xl font-bold text-blue-600",children:i(N,n)}),e.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[L.length," ",a.items," ⢠",r>0?(N/r*100).toFixed(0):0,"%"]})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-cyan-50/50 dark:bg-cyan-950/20 border-cyan-200",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(V,{className:"h-5 w-5 text-cyan-600"}),e.jsx("span",{className:"font-medium text-cyan-700 dark:text-cyan-300",children:a.insurance})]}),e.jsx("div",{className:"text-2xl font-bold text-cyan-600",children:i(f,n)}),e.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[R.length," ",a.items," ⢠",r>0?(f/r*100).toFixed(0):0,"%"]})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-gray-50/50 dark:bg-gray-950/20 border-gray-200",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Z,{className:"h-5 w-5 text-gray-600"}),e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:a.other})]}),e.jsx("div",{className:"text-2xl font-bold text-gray-600",children:i(b,n)}),e.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[E.length," ",a.items," ⢠",r>0?(b/r*100).toFixed(0):0,"%"]})]})]})})]}),e.jsxs(c,{children:[e.jsx(A,{children:e.jsx(S,{children:a.detailedBreakdown})}),e.jsx(o,{children:e.jsx("div",{className:"space-y-4",children:u.map(s=>e.jsxs("div",{className:"flex items-start gap-4 p-4 rounded-lg border hover:bg-muted/50 transition-colors",children:[e.jsx("div",{className:"mt-1",children:G(s.category)}),e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:s.description}),s.descriptionEn&&t==="en"&&e.jsx("p",{className:"text-sm text-muted-foreground",children:s.descriptionEn}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:W(s.category)}),(s.vendor||s.invoiceNumber||s.itemDate)&&e.jsxs("div",{className:"mt-2 text-sm text-muted-foreground space-y-1",children:[s.vendor&&e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[a.vendor,":"]}
1)," ",s.vendor]}),s.invoiceNumber&&e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[a.invoiceNumber,":"]})," ",s.invoiceNumber]}),s.itemDate&&e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[a.date,":"]})," ",new Date(s.itemDate).toLocaleDateString(t==="cs"?"cs-CZ":t==="de"?"de-AT":"en-US")]})]}),s.notes&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1 italic",children:s.notes})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-xl font-bold",children:i(s.amount,n)}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[r>0?(s.amount/r*100).toFixed(1):0,"% ",t==="cs"?"z celku":t==="de"?"vom Gesamtbetrag":"of total"]})]})]})})]},s.id))})})]}),e.jsx(c,{children:e.jsx(o,{className:"py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:t==="cs"?"Zobrazit jiný rok:":t==="de"?"Anderes Jahr anzeigen:":"View another year:"}),e.jsx("div",{className:"flex gap-2",children:H.map(s=>e.jsx(y,{variant:s===l?"default":"outline",size:"sm",onClick:()=>p(`/costs/expenditure/${s}`),children:s},s))})]})})})]})})};export{ke 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.