PageSourceSearch

https://hintermoos.at/assets/OwnersDocuments-Ba6lqgSl.js

js hintermoos.at collected 2026-10-09 22:01:50 UTC 10,414 bytes, 1 lines download raw bytes

1import{o as X,u as Z,r as l,s as W,j as e,k as h,X as $,w as T,x as B,K as ee,N as te,B as re}from"./index-MoAbC8_9.js";import{O as se}from"./OwnersLayout-Cd0M3dw8.js";import{B as ae}from"./badge-BHbYeRgi.js";import{L as le}from"./upload-BH1HltYO.js";import{A as ne}from"./arrow-up-down-D7o6PKMM.js";import{C as oe}from"./calendar-days-DbjuOaGz.js";import{S as P}from"./search-_fcwEKN-.js";import{P as ie}from"./plus-CkJQv7GY.js";import{C as ce}from"./Header-CnJGZ8vQ.js";import{D as me}from"./download-DXQgHLv7.js";import{E as de}from"./external-link-Bd1Ktkpe.js";import{T as ue}from"./thermometer-CsW4-4zi.js";import{C as xe}from"./clipboard-list-CzdQdj9P.js";import{R as he}from"./receipt-DnGXta2k.js";import{F as pe}from"./folder-open-CYrqGGwY.js";import"./separator-CQ84aZ0V.js";import"./collapsible-BIxz44zB.js";import"./skeleton-ClxqB572.js";import"./breadcrumb-CmKLwRya.js";import"./switch-BHj3-8MN.js";import"./index-D9-GACGG.js";import"./house-DjS1WMqx.js";import"./building-crte1H4H.js";import"./file-text-Bif0RP8Y.js";import"./user-Cvsz7Lm_.js";import"./chart-column-Bo5i9GGE.js";import"./piggy-bank-DP-A2O0m.js";import"./landmark-C0TkBs1l.js";import"./flame-wMx8KIS8.js";import"./trending-up-Cg9WFJWB.js";import"./users-xui-UtA1.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 f=[{value:"techem",label:{cs:"Techem Report",de:"Techem Bericht",en:"Techem Report"},icon:ue},{value:"protokol",label:{cs:"Protokoly",de:"Protokolle",en:"Minutes"},icon:xe},{value:"vyuctovani",label:{cs:"Roční vyúčtování",de:"Jahresabrechnung",en:"Annual Billing"},icon:he},{value:"ostatni",label:{cs:"Ostatní",de:"Sonstiges",en:"Other"},icon:pe}],fe=u=>f.find(c=>c.value===u)||f[3],d=({label:u,active:c,onClick:j})=>e.jsx("button",{onClick:j,className:h("w-full flex items-center gap-2 px-6 py-2 text-sm transition-colors text-left",c?"bg-primary/10 text-primary font-semibold":"text-foreground hover:bg-muted/50"),children:u}),et=()=>{const{user:u}=X(),{t:c,language:j}=Z(),m=j||"cs",[g,R]=l.useState([]),[_,A]=l.useState(!0),[p,F]=l.useState(""),[n,N]=l.useState(null),[o,v]=l.useState(null),[i,b]=l.useState("newest"),[w,Y]=l.useState(!0),[x,k]=l.useState(!1),[C,y]=l.useState(null),L=l.useRef(null),a={cs:{searchPlaceholder:"Hledat v dokumentech...",category:"Kategorie",sort:"Řazení",year:"Rok",all:"Vše",newest:"Nejnovější",oldest:"Nejstarší",byName:"Podle názvu",allYears:"Všechny roky",clearFilters:"Vymazat filtry",noDocuments:"Žádné dokumenty",noYear:"Bez roku"},de:{searchPlaceholder:"In Dokumenten suchen...",category:"Kategorie",sort:"Sortierung",year:"Jahr",all:"Alle",newest:"Neueste",oldest:"Älteste",byName:"Nach Name",allYears:"Alle Jahre",clearFilters:"Filter löschen",noDocuments:"Keine Dokumente",noYear:"Ohne Jahr"},en:{searchPlaceholder:"Search documents...",category:"Category",sort:"Sort",year:"Year",all:"All",newest:"Newest",oldest:"Oldest",byName:"By name",allYears:"All years",clearFilters:"Clear filters",noDocuments:"No documents",noYear:"No year"}}[m]||{searchPlaceholder:"Search documents...",category:"Category",sort:"Sort",year:"Year",all:"All",newest:"Newest",oldest:"Oldest",byName:"By name",allYears:"All years",clearFilters:"Clear filters",noDocuments:"No documents",noYear:"No year"};l.useEffect(()=>{u&&E()},[u]);const E=async()=>{A(!0);const{data:t}=await W.from("owner_documents").select("*").order("year",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});R(t||[]),A(!1)},z=l.useMemo(()=>[...new Set(g.map(r=>r.year).filter(r=>r!==null))].sort((r,s)=>s-r),[g]),S=l.useMemo(()=>{let t=g;if(n&&(t=t.filter(r=>r.category===n)),o&&(t=t.filter(r=>r.year===o)),p.trim()){const r=p.toLowerCase();t=t.filter(s=>s.title.toLowerCase().includes(r)||s.description&&s.description.toLowerCase().includes(r)||s.file_name&&s.file_name.toLowerCase().includes(r))}return t=[...t].sort((r,s)=>i==="name"?r.title.localeCompare(s.title):i==="oldest"?new Date(r.created_at).getTime()-new Date(s.created_at).getTime():new Date(s.created_at).getTime()-new Date(r.created_at).getTime()),t},[g,n,o,p,i]),O=S.reduce((t,r)=>{const s=r.year?String(r.year):a.noYear;
1return t[s]||(t[s]=[]),t[s].push(r),t},{}),V=Object.keys(O).sort((t,r)=>isNaN(Number(t))?1:isNaN(Number(r))?-1:Number(r)-Number(t)),I=t=>new Date(t).toLocaleDateString(m==="de"?"de-DE":m==="cs"?"cs-CZ":"en-US",{year:"numeric",month:"long",day:"numeric"}),D=!!(n||o||i!=="newest"),J=D||!!p,K=()=>{if(n){const t=f.find(r=>r.value===n);return t?t.label[m]:a.all}return a.all},M=()=>i==="oldest"?a.oldest:i==="name"?a.byName:a.newest,H=()=>o?String(o):a.allYears,Q=()=>{F(""),N(null),v(null),b("newest")},U=()=>{const t=[];if(t.push(String(S.length)),n){const r=f.find(s=>s.value===n);r&&t.push(r.label[m])}return o&&t.push(String(o)),t.length>1?t.join(" · "):a.searchPlaceholder};l.useEffect(()=>{w&&setTimeout(()=>{var t;return(t=L.current)==null?void 0:t.focus()},200)},[w]);const q=[{key:"category",label:a.category,icon:e.jsx(le,{className:"h-4 w-4"}),value:K(),isActive:!!n},{key:"sort",label:a.sort,icon:e.jsx(ne,{className:"h-4 w-4"}),value:M(),isActive:i!=="newest"},{key:"year",label:a.year,icon:e.jsx(oe,{className:"h-4 w-4"}),value:H(),isActive:!!o}];return e.jsxs(se,{title:c("owners.documents"),description:c("documents.description"),breadcrumbs:[{label:c("sidebar.documents")}],isLoading:_,children:[e.jsxs("div",{className:"relative mb-6",children:[x&&e.jsx("div",{className:"fixed inset-0 z-[39]",onClick:()=>{k(!1),y(null)}}),e.jsx("div",{className:"flex items-center justify-start",children:w?e.jsxs("div",{className:"flex-1 lg:flex-none lg:w-[480px] relative z-[40]",children:[e.jsxs("div",{className:"flex items-center gap-1 bg-card border border-primary/40 rounded-xl shadow-sm px-3 h-11 transition-all duration-200",children:[e.jsx(P,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("input",{ref:L,type:"text",value:p,onChange:t=>F(t.target.value),placeholder:U(),className:"flex-1 min-w-0 bg-transparent border-none outline-none text-sm text-foreground placeholder:text-muted-foreground"}),e.jsx("button",{onClick:()=>{k(!x),x&&y(null)},className:h("h-7 w-7 rounded-full flex items-center justify-center shrink-0 transition-all duration-200",x||D?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"),children:e.jsx(ie,{className:h("h-3.5 w-3.5 transition-transform duration-200",x&&"rotate-45")})}),e.jsx("button",{onClick:()=>{Y(!1),k(!1),y(null)},className:"h-7 w-7 rounded-full flex items-center justify-center shrink-0 bg-muted text-muted-foreground hover:bg-muted/80 transition-colors",children:e.jsx($,{className:"h-3.5 w-3.5"})})]}),x&&e.jsxs("div",{className:"absolute right-0 top-full mt-2 w-72 bg-card border border-border rounded-xl shadow-lg z-[41] overflow-hidden",children:[q.map((t,r)=>e.jsxs("div",{children:[r>0&&e.jsx("div",{className:"h-px bg-border"}),e.jsxs("button",{onClick:()=>y(C===t.key?null:t.key),className:"w-full flex items-center gap-3 px-4 py-3 text-sm hover:bg-muted/50 transition-colors",children:[e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsx("span",{className:"font-medium text-foreground",children:t.label}),e.jsx("span",{className:h("ml-auto text-xs",t.isActive?"text-primary font-semibold":"text-muted-foreground"),children:t.value}),e.jsx(ce,{className:h("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",C===t.key&&"rotate-90")})]}),C===t.key&&e.jsxs("div",{className:"bg-muted/30 pb-1",children:[t.key==="category"&&e.jsxs(e.Fragment,{children:[e.jsx(d,{label:a.all,active:!n,onClick:()=>N(null)}),f.map(s=>e.jsx(d,{label:s.label[m],active:n===s.value,onClick:()=>N(n===s.value?null:s.value)},s.value))]}),t.key==="sort"&&e.jsxs(e.Fragment,{children:[e.jsx(d,{label:a.newest,active:i==="newest",onClick:()=>b("newest")}),e.jsx(d,{label:a.oldest,active:i==="oldest",onClick:()=>b("oldest")}),e.jsx(d,{label:a.byName,active:i==="name",onClick:()=>b("name")})]}),t.key==="year"&&e.jsxs(e.Fragment,{children:[e.jsx(d,{label:a.allYears,active:!o,onClick:()=>v(null)}),z.map(s=>e.jsx(d,{label:String(s),active:o===s,onClick:()=>v(o===s?null:s)},s))]})]})]},t.key)),D&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-px bg-border"}),e.jsx("button",{onClick:Q,className:"w-full px-4 py-3 text-sm text-destructive hover:bg-destructive/5 transition-colors text-left font-medium",children:a.clearFilters})]})]})]}):e.jsx("button",{onClick:()=>Y(!0),className:h("h-11 w-11 rounded-full flex items-center justify-center transition-all duration-200 shadow-md ring-2 ring-primary/20",J?"bg-primary text-primary-foreground ring-primary/40":"bg-primary text-primary-foreground hover:bg-primary/90"),children:e.jsx(P,{className:"h-[18px] w-[18px]"})})})]}),S.length===0?e.jsx(T,{children:e.jsx(B,{className:"p-8 text-center text-muted-foreground",children:a.noDocuments})}):e.jsx("div",{className:"space-y-8",children:V.map(t=>e.jsxs("section",{children:[e.jsx("h2",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide border-b border-border pb-1 mb-4",children:t}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:O[t].map(r=>{const s=fe(r.category),G=s.icon;return e.jsxs(T,{className:"hover:shadow-md transition-shadow",children:[e.jsx(ee,{className:"pb-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary shrink-0",children:e.jsx(G,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(te,{className:"text-base truncate",children:r.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx(ae,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:s.label[m]}
1),e.jsx("span",{className:"text-xs text-muted-foreground",children:I(r.created_at)})]})]})]})}),e.jsxs(B,{children:[r.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-4 line-clamp-2",children:r.description}),e.jsx(re,{variant:"outline",size:"sm",className:"w-full",asChild:!0,children:e.jsxs("a",{href:r.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-4 w-4"}),c("owners.download"),e.jsx(de,{className:"h-3 w-3 ml-auto"})]})})]})]},r.id)})})]},t))})]})};export{et 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.