PageSourceSearch

https://tsofit.org.il/assets/KibbutzSiteResponsibleDocuments-C30xcIoH.js

js tsofit.org.il collected 2026-09-25 02:13:24 UTC 15,103 bytes, 1 lines download raw bytes

1import{aa as G,cU as X,r as a,d as T,z as o,j as e,b as A,w as Y,L as q,aU as B,bE as J,a7 as L,ad as P,am as Q,C as V,T as W,P as H,X as I}from"./index-BuF13C9R.js";import{S as Z}from"./SitePageShell-D3rwKhmW.js";import{g as M,b as z,F as U,a as ee,f as se}from"./FileIcon-CPf_9PV5.js";import{D as te}from"./DocumentPreviewModal-B8UORRkO.js";import{R as le}from"./ResidentLoginRedirect-C4cTFDh_.js";import{F as ae}from"./folder-open-BSPTKQzn.js";import{F as $}from"./folder-CQrzkDX3.js";import{H as ie}from"./hard-drive-_MMnhbpT.js";import{C as re}from"./copy-BClGV4nG.js";import{U as ne}from"./upload-DeFZlL4S.js";import"./usePaymentPlacements-CX0SzjnY.js";import"./user-cog-BrPu6RcS.js";import"./bell-ring-DHDlhRvf.js";import"./life-buoy-DD0yJ6o8.js";import"./log-in-8daxVYSJ.js";import"./kibbutzSiteUtils-DG6eIbUJ.js";import"./info-BIFqAg3-.js";import"./graduation-cap-D9zn9IjR.js";import"./file-check-D2O-2b5u.js";import"./instagram-rO3n40RO.js";import"./sliders-horizontal-D0cjPgOh.js";import"./youtube-D4vYeyfI.js";import"./leaf-BxZ8PRn4.js";import"./paymentCatalogs-CvImawYM.js";import"./chevron-left-D2IUBEPa.js";import"./siren-DuSchdHr.js";import"./clipboard-check-CMT0h_dd.js";import"./personalHeading-D8itHFYD.js";import"./ContentPageHero-BxCWcB43.js";import"./file-BUoZaMpL.js";import"./film-BOiDnw57.js";import"./image-BzvPncEw.js";import"./file-spreadsheet-B8pSCGeX.js";const N="#0d9488";function Oe(){const{kibbutzId:d}=G(),h=X(d),v=h==null?void 0:h.phone,[w,y]=a.useState(!0),[m,S]=a.useState([]),[p,F]=a.useState([]),[f,E]=a.useState(!1),[n,k]=a.useState(null),[u,j]=a.useState(null),[D,b]=a.useState(!1),[C,_]=a.useState(null),g=a.useCallback(async()=>{var s,i,r;if(!v){y(!1);return}y(!0);try{const c=await T.functions.invoke("residentManagedDocuments",{community_id:d,action:"list"});S(((s=c==null?void 0:c.data)==null?void 0:s.folders)||[]),F(((i=c==null?void 0:c.data)==null?void 0:i.documents)||[]),E(!!((r=c==null?void 0:c.data)!=null&&r.all_scopes))}catch{o.error("שגיאה בטעינת המסמכים")}y(!1)},[d,v]);a.useEffect(()=>{g()},[g]);const x=a.useMemo(()=>n?p.filter(s=>s.folder_id===n):p,[p,n]),l=s=>{var i;return((i=m.find(r=>r.id===s))==null?void 0:i.title)||"כללי"};a.useEffect(()=>{if(x.length===0){u!==null&&j(null);return}x.some(s=>s.id===u)||j(x[0].id)},[x,u]);const t=x.find(s=>s.id===u)||null,R=async s=>{if(confirm("להסיר את המסמך?"))try{await T.functions.invoke("residentManagedDocuments",{community_id:d,action:"delete",document_id:s}),F(i=>i.filter(r=>r.id!==s)),o.success("המסמך הוסר")}catch{o.error("שגיאה בהסרה")}},O=s=>{if(!s){o.error("אין קישור להעתקה");return}navigator.clipboard.writeText(s),o.success("הקישור הועתק")};return e.jsx(Z,{kibbutzId:d,moduleKey:"resident_registration",showHero:!1,hidePageTitleHeader:!0,hideFooter:!0,pageTitle:"ניהול מסמכים",pageAction:e.jsxs("button",{onClick:()=>b(!0),className:"inline-flex items-center gap-2 h-11 px-5 rounded-xl text-white font-semibold shadow-sm",style:{backgroundColor:N},children:[e.jsx(H,{className:"w-4 h-4"})," הוספת מסמך"]}),mainClassName:"flex-1 w-full pt-24 md:pt-28 pb-12",children:()=>h?w?e.jsx("div",{className:"flex justify-center py-24",children:e.jsx(A,{className:"w-8 h-8 animate-spin text-slate-400"})}):!m.length&&!f?e.jsxs("div",{className:"max-w-md mx-auto px-4 py-20 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-slate-100 flex items-center justify-center mx-auto mb-4",children:e.jsx(Y,{className:"w-8 h-8 text-slate-400"})}),e.jsx("p",{className:"text-slate-600 font-semibold mb-1",children:"לא הוגדרת כאחראי על תיקיות מסמכים"}),e.jsx("p",{className:"text-sm text-slate-400",children:"כאשר מנהל הקהילה יגדיר אותך כאחראי על תיקיית מסמכים, היא תופיע כאן."}),e.jsxs(q,{to:J(`/kibbutz-site/${d}/personal`),className:"inline-flex items-center gap-1 mt-6 text-sm font-medium",style:{color:N},children:[e.jsx(B,{className:"w-4 h-4"})," חזרה לאזור האישי"]})]}):e.jsxs("div",{className:"max-w-5xl mx-auto w-full px-4",dir:"rtl",children:[m.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ae,{className:"w-4 h-4 text-amber-600"}),e.jsx("h2",{className:"text-sm font-semibold text-slate-700",children:"תיקיות"}),n&&e.jsx("button",{onClick:()=>k(null),className:"text-xs mr-2 hover:underline",style:{color:N},children:"הצג הכל"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 ga
1p-3",children:m.map(s=>{const i=p.filter(c=>c.folder_id===s.id).length,r=n===s.id;return e.jsxs("button",{onClick:()=>k(r?null:s.id),className:`card-float p-3 text-right transition-all ${r?"ring-2 ring-teal-400":"hover:shadow-md"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-8 h-8 rounded-lg bg-amber-50 flex items-center justify-center flex-shrink-0",children:e.jsx($,{className:"w-4 h-4 text-amber-600"})}),e.jsx("p",{className:"text-sm font-medium text-slate-800 line-clamp-1",children:s.title})]}),e.jsxs("p",{className:"text-xs text-slate-400 mt-1",children:[i," מסמכים"]})]},s.id)})})]}),x.length===0?e.jsxs("div",{className:"card-float p-12 text-center",children:[e.jsx(L,{className:"w-9 h-9 text-slate-300 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-slate-500",children:'אין מסמכים בתיקייה זו. לחצו על "הוספת מסמך" כדי להוסיף.'})]}):e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[minmax(0,360px)_1fr] gap-4 items-start",children:[e.jsx("div",{className:"card-float p-2",children:e.jsx("div",{className:"lg:max-h-[68vh] overflow-y-auto space-y-1",children:x.map(s=>{const i=M(s.file_type,s.file_url,s.title),r=z[i]||z.other,c=s.id===u;return e.jsxs("div",{onClick:()=>j(s.id),className:`flex items-center gap-2.5 p-2.5 rounded-xl cursor-pointer transition-all ${c?"bg-teal-50 ring-2 ring-teal-200":"hover:bg-slate-50"}`,children:[e.jsx("div",{className:`w-9 h-9 rounded-lg ${r.bg} flex items-center justify-center flex-shrink-0`,children:e.jsx(U,{category:i,className:`w-4 h-4 ${r.icon}`})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-slate-800 line-clamp-1",children:s.title}),e.jsxs("span",{className:"inline-flex items-center gap-1 mt-1 px-1.5 py-0.5 rounded-full bg-amber-50 text-amber-700 text-[11px] font-medium max-w-[140px]",children:[e.jsx($,{className:"w-2.5 h-2.5 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:l(s.folder_id)})]})]}),s.file_url&&e.jsx("button",{onClick:K=>{K.stopPropagation(),_(s)},className:"p-1.5 rounded-lg hover:bg-white flex-shrink-0",style:{color:N},title:"תצוגה מקדימה",children:e.jsx(P,{className:"w-4 h-4"})})]},s.id)})})}),e.jsx("div",{className:"card-float p-5 lg:sticky lg:top-4",children:t?(()=>{const s=M(t.file_type,t.file_url,t.title),i=z[s]||z.other,r=t.created_date;return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl ${i.bg} flex items-center justify-center flex-shrink-0`,children:e.jsx(U,{category:s,className:`w-6 h-6 ${i.icon}`})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"text-base font-bold text-slate-900 break-words",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-slate-500 mt-1 leading-relaxed",children:t.description})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"rounded-xl bg-slate-50 p-3",children:[e.jsxs("p",{className:"text-xs text-slate-400 mb-0.5 flex items-center gap-1",children:[e.jsx($,{className:"w-3 h-3"})," תיקייה"]}),e.jsx("p",{className:"text-sm font-medium text-slate-800 line-clamp-1",children:l(t.folder_id)})]}),e.jsxs("div",{className:"rounded-xl bg-slate-50 p-3",children:[e.jsxs("p",{className:"text-xs text-slate-400 mb-0.5 flex items-center gap-1",children:[e.jsx(L,{className:"w-3 h-3"})," סוג קובץ"]}),e.jsx("p",{className:"text-sm font-medium text-slate-800",children:ee(s)})]}),e.jsxs("div",{className:"rounded-xl bg-slate-50 p-3",children:[e.jsxs("p",{className:"text-xs text-slate-400 mb-0.5 flex items-center gap-1",children:[e.jsx(ie,{className:"w-3 h-3"})," גודל"]}),e.jsx("p",{className:"text-sm font-medium text-slate-800",children:se(t.file_size)})]}),e.jsxs("div",{className:"rounded-xl bg-slate-50 p-3",children:[e.jsxs("p",{className:"text-xs text-slate-400 mb-0.5 flex items-center gap-1",children:[e.jsx(Q,{className:"w-3 h-3"})," תאריך"]}),e.jsx("p",{className:"text-sm font-medium text-slate-800",children:r?new Date(r).toLocaleDateString("he-IL"):"—"})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-slate-400 mb-1.5",children:"סטטוס"}),e.jsxs("span",{className:`inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium ${t.is_active!==!1?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-400"}`,children:[e.jsx(V,{className:"w-3 h-3"})," ",t.is_active!==!1?"פעיל":"לא פעיל"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-3 border-t border-slate-100",children:[e.jsxs("button",{onClick:()=>_(t),disabled:!t.file_url,className:"inline-flex items-center gap-1.5 h-10 px-4 roun
1ded-xl text-white text-sm font-medium disabled:opacity-40",style:{backgroundColor:N},children:[e.jsx(P,{className:"w-4 h-4"})," צפייה"]}),e.jsxs("button",{onClick:()=>O(t.file_url),disabled:!t.file_url,className:"inline-flex items-center gap-1.5 h-10 px-4 rounded-xl border border-slate-200 text-sm font-medium text-slate-600 hover:bg-slate-100 disabled:opacity-40",children:[e.jsx(re,{className:"w-4 h-4"})," העתק קישור"]}),e.jsxs("button",{onClick:()=>R(t.id),className:"inline-flex items-center gap-1.5 h-10 px-4 rounded-xl border border-red-200 text-sm font-medium text-red-600 hover:bg-red-50",children:[e.jsx(W,{className:"w-4 h-4"})," מחיקה"]})]})]})})():e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center text-slate-400",children:[e.jsx(L,{className:"w-10 h-10 text-slate-300 mb-3"}),e.jsx("p",{className:"text-sm",children:"בחרו מסמך מהרשימה כדי לצפות בפרטים"})]})})]}),D&&e.jsx(ce,{kibbutzId:d,folders:m,allScopes:f,onClose:()=>b(!1),onAdded:()=>{b(!1),g()}}),C&&e.jsx(te,{doc:C,folderName:l(C.folder_id),onClose:()=>_(null)})]}):e.jsx(le,{kibbutzId:d})})}function ce({kibbutzId:d,folders:h,allScopes:v,onClose:w,onAdded:y}){var x;const[m,S]=a.useState(""),[p,F]=a.useState(""),[f,E]=a.useState(((x=h[0])==null?void 0:x.id)||""),[n,k]=a.useState(null),[u,j]=a.useState(!1),[D,b]=a.useState(!1),C=async l=>{const t=(l.target.files||[])[0];if(t){j(!0);try{const{file_url:R}=await T.integrations.Core.UploadFile({file:t});k({file_url:R,file_type:t.type||"",file_size:t.size||0,name:t.name}),m.trim()||S(t.name.replace(/\.[^.]+$/,""))}catch{o.error("שגיאה בהעלאת הקובץ")}j(!1),l.target.value=""}},_=async()=>{if(!m.trim()){o.error("יש להזין שם מסמך");return}if(!(n!=null&&n.file_url)){o.error("יש לצרף קובץ");return}if(!v&&!f){o.error("יש לבחור תיקייה");return}b(!0);try{await T.functions.invoke("residentManagedDocuments",{community_id:d,action:"create",title:m.trim(),description:p.trim()||void 0,folder_id:f||void 0,file_url:n.file_url,file_type:n.file_type,file_size:n.file_size}),o.success("המסמך נוסף"),y()}catch(l){o.error((l==null?void 0:l.message)||"שגיאה בהוספה")}b(!1)},g="w-full h-10 rounded-xl border border-slate-200 bg-white px-3 text-sm focus:outline-none focus:ring-2 focus:ring-teal-100 focus:border-teal-300";return e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-end sm:items-center justify-center p-0 sm:p-4 overflow-y-auto",dir:"rtl",children:[e.jsx("div",{className:"absolute inset-0 bg-slate-900/50 backdrop-blur-sm",onClick:w}),e.jsxs("div",{className:"relative bg-slate-50 w-full sm:max-w-lg sm:rounded-3xl rounded-t-3xl shadow-2xl my-0 sm:my-8",children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3.5 bg-white sm:rounded-t-3xl rounded-t-3xl border-b border-border",children:[e.jsx("h2",{className:"text-base font-extrabold text-slate-900",children:"הוספת מסמך"}),e.jsx("button",{onClick:w,className:"w-9 h-9 rounded-lg flex items-center justify-center text-slate-400 hover:bg-slate-100",children:e.jsx(I,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-5 space-y-3.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"קובץ"}),n?e.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-teal-200 bg-teal-50/50 p-3",children:[e.jsx(L,{className:"w-5 h-5 text-teal-600 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-slate-700 truncate flex-1",children:n.name}),e.jsx("button",{onClick:()=>k(null),className:"text-red-500 hover:bg-red-50 rounded-lg p-1",children:e.jsx(I,{className:"w-4 h-4"})})]}):e.jsxs("label",{className:"flex items-center justify-center gap-2 h-24 rounded-xl border-2 border-dashed border-slate-300 cursor-pointer hover:bg-slate-50 text-slate-500",children:[u?e.jsx(A,{className:"w-5 h-5 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-5 h-5"}),e.jsx("span",{className:"text-sm",children:"בחרו קובץ להעלאה"})]}),e.jsx("input",{type:"file",className:"hidden",onChange:C})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"שם המסמך"}),e.jsx("input",{value:m,onChange:l=>S(l.target.value),className:g,placeholder:"שם המסמך"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"תיקייה"}),e.jsxs("select",{value:f,onChange:l=>E(l.target.value),className:g,children:[v&&e.jsx("option",{value:"",children:"ללא תיקייה"}),h.map(l=>e.jsx("option",{value:l.id,children:l.title},l.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"תיאור (רשות)"}),e.jsx("textarea",{value:p,onChange:l=>F(l.target.value),rows:2,className:"w-full rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-teal-100 focus:border-teal-300",placeholder:"תיאור קצר"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx("button",{onClick:w,className:"h-11 px-5 rounded-xl border border-slate-200 text-sm font-semibold text-slate-600 hover:bg-slate-100",children:"ביטול"}),e.jsxs("button",{onClick:_,disabled:D||u,className:"inline-flex items-center gap-2 h-11 px-6 rounded-xl text-white font-semibold disabled:opacity-60",style:{backgroundColor:N},children:[D?e.jsx(A,{className:"w-4 h-4 animate-spin"}):e.jsx(H,{className:"w-4 h-4"})," הוספה"]})]})]})]})]})}export{Oe 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.