1import{aa as Z,cU as I,r as n,d as y,z as u,j as e,b as S,w as ee,L as se,aU as X,bE as te,x as q,a7 as J,aF as ae,C as P,aK as le,aG as ie}from"./index-BuF13C9R.js";import{S as ne}from"./SitePageShell-D3rwKhmW.js";import{S as re}from"./SignaturePad-XCCnnVBI.js";import{R as ce}from"./ResidentLoginRedirect-C4cTFDh_.js";import{P as R}from"./pen-line-CuBxLD5W.js";import{C as K}from"./clipboard-check-CMT0h_dd.js";import{M as B}from"./message-square-plus-sO0cIKtO.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"./folder-open-BSPTKQzn.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"./personalHeading-D8itHFYD.js";import"./ContentPageHero-BxCWcB43.js";import"./eraser-HIMwNg90.js";const b="#0d9488",C="#c026d3",oe=a=>{if(!a)return"";const l=String(a).slice(0,10).split("-");return`${l[2]}/${l[1]}/${l[0]}`},v=a=>{if(!a)return"";const l=String(a).slice(11,16);return`${oe(a)}${l?" "+l:""}`};function de(a,l){var o;const[c,m]=a.split(","),r=((o=/:(.*?);/.exec(c))==null?void 0:o[1])||"image/png",t=atob(m),p=new Uint8Array(t.length);for(let d=0;d<t.length;d++)p[d]=t.charCodeAt(d);return new File([p],l,{type:r})}function Ae(){const{kibbutzId:a}=Z(),l=I(a),c=l==null?void 0:l.phone,[m,r]=n.useState(!0),[t,p]=n.useState([]),[o,d]=n.useState(null),f=n.useCallback(async()=>{var i;if(!c){r(!1);return}r(!0);try{const x=await y.functions.invoke("residentVoteObserver",{community_id:a,action:"list"});p(((i=x==null?void 0:x.data)==null?void 0:i.votes)||[])}catch{u.error("ש×××× ×××¢×× ×ª ××צ××¢×ת")}r(!1)},[a,c]);return n.useEffect(()=>{f()},[f]),e.jsx(ne,{kibbutzId:a,moduleKey:"resident_registration",showHero:!1,hidePageTitleHeader:!0,hideFooter:!0,pageTitle:"× ×××× ×צ××¢×ת | ×שק××£",mainClassName:"flex-1 w-full pt-24 md:pt-28 pb-12",children:()=>l?m?e.jsx("div",{className:"flex justify-center py-24",children:e.jsx(S,{className:"w-8 h-8 animate-spin text-slate-400"})}):t.length?o?e.jsx(xe,{kibbutzId:a,vote:o,onBack:()=>{d(null),f()}}):e.jsx("div",{className:"max-w-5xl mx-auto w-full px-4",dir:"rtl",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(i=>{const x=i.eligible?Math.round(i.voted/i.eligible*100):0;return e.jsxs("button",{onClick:()=>d(i),className:"card-float p-4 text-right hover:shadow-md transition-all",children:[e.jsxs("div",{className:"flex items-start gap-2 mb-1.5",children:[e.jsx("h3",{className:"text-sm font-bold text-slate-900 flex-1 min-w-0",children:i.title||"×צ××¢×"}),i.closed?e.jsx("span",{className:"text-[11px] font-medium px-2 py-0.5 rounded-full bg-slate-100 text-slate-600 flex-shrink-0",children:"× ×¡×ר×"}):e.jsx("span",{className:"text-[11px] font-medium px-2 py-0.5 rounded-full bg-emerald-50 text-emerald-700 flex-shrink-0",children:"פע×××"})]}),i.category&&e.jsx("p",{className:"text-[11px] text-teal-600 font-medium mb-1",children:i.category}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 mb-2",children:[e.jsx(q,{className:"w-3.5 h-3.5"})," ",i.voted,"/",i.eligible," ×צ×××¢× (",x,"%)"]}),e.jsx("div",{className:"h-1.5 rounded-full bg-slate-100 overflow-hidden mb-2",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${x}%`,backgroundColor:b}})}),i.signed?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-emerald-700",children:[e.jsx(J,{className:"w-3.5 h-3.5"})," × ××ª× â ××¦× ×¤×¨××××§××"]}):i.closed?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-fuchsia-700",children:[e.jsx(R,{className:"w-3.5 h-3.5"})," ××ת×× ××ת××ת ×שק××£"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] text-slate-400",children:[e.jsx(ae,{className:"w-3.5 h-3.5"})," ×ת××× ×ª×ª×פשר ×ס××ר×"]})]},i.id)})})}):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(ee,{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(se,{to:te(`/kibbutz-site/${a}/personal`),className:"inline-flex items-center gap-1 mt-6 text-sm font-medium",style:{color:b},children:[e.jsx(X,{className:"w-4 h-4"})," ×××¨× ××××ר ×××ש×"]})]}):e.jsx(ce,{kibbutzId:a})})}
1const w=({icon:a,title:l,extra:c,children:m,tone:r=b})=>e.jsxs("section",{className:"card-float p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4 pb-2.5 border-b border-slate-100",children:[e.jsx("span",{className:"w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",style:{backgroundColor:`${r}14`,color:r},children:e.jsx(a,{className:"w-4 h-4"})}),e.jsx("h2",{className:"text-sm font-bold text-slate-800",children:l}),c&&e.jsx("span",{className:"text-xs text-slate-400 mr-auto",children:c})]}),m]});function xe({kibbutzId:a,vote:l,onBack:c}){var H,M;const[m,r]=n.useState(!0),[t,p]=n.useState(null),[o,d]=n.useState(""),[f,i]=n.useState(!1),[x,$]=n.useState(!1),[U,Q]=n.useState(""),[L,V]=n.useState(""),[D,E]=n.useState(!1),_=n.useCallback(async()=>{r(!0);try{const s=await y.functions.invoke("residentVoteObserver",{community_id:a,action:"detail",vote_id:l.id});p((s==null?void 0:s.data)||null)}catch{u.error("ש×××× ×××¢×× ×ª ×פר×××")}r(!1)},[a,l.id]);n.useEffect(()=>{_()},[_]);const W=async()=>{if(o.trim()){i(!0);try{await y.functions.invoke("residentVoteObserver",{community_id:a,action:"add_note",vote_id:l.id,content:o.trim()}),d(""),u.success("×××¢×¨× × ×ספ×"),await _()}catch{u.error("ש×××× ×××ספת ××ער×")}i(!1)}},Y=async()=>{if(!L){u.error("×ש ××ת×× ××××ר ××ת×××");return}E(!0);try{const{file_url:s}=await y.integrations.Core.UploadFile({file:de(L,`observer-signature-${l.id}.png`)});await y.functions.invoke("residentVoteObserver",{community_id:a,action:"sign",vote_id:l.id,signature_url:s,assessment:U.trim()}),u.success("××ת××× × ×©×ר×"),$(!1),await _()}catch(s){u.error((s==null?void 0:s.message)||"ש×××× ×ש××רת ××ת×××")}E(!1)};if(m||!t)return e.jsxs("div",{className:"max-w-6xl mx-auto w-full px-4",dir:"rtl",children:[e.jsx(G,{onBack:c}),e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(S,{className:"w-8 h-8 animate-spin text-slate-400"})})]});const N=t.vote.closed,T=!!((H=t.my_observer)!=null&&H.signed_at),j=N&&T,A=((M=t.participation)==null?void 0:M.voters)||[],F=A.filter(s=>s.has_voted),O=A.filter(s=>!s.has_voted),z=(t.observers||[]).filter(s=>s.signed_at&&s.signature_url);return e.jsxs("div",{className:"max-w-6xl mx-auto w-full px-4",dir:"rtl",children:[e.jsx(G,{onBack:c}),e.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[e.jsx("span",{className:"w-11 h-11 rounded-2xl flex items-center justify-center text-white flex-shrink-0",style:{backgroundColor:j?C:b},children:j?e.jsx(J,{className:"w-6 h-6"}):e.jsx(K,{className:"w-6 h-6"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{className:"text-2xl font-extrabold text-slate-900 truncate",children:t.vote.title||"×צ××¢×"}),e.jsx("span",{className:`text-[11px] font-medium px-2 py-0.5 rounded-full ${N?"bg-slate-100 text-slate-600":"bg-emerald-50 text-emerald-700"}`,children:N?"× ×¡×ר×":"פע×××"})]}),e.jsx("p",{className:"text-sm text-slate-500",children:j?"פר××××§×× ××צ××¢× â × ××ª× ×¢× ×××, ×צפ××× ××××":"× ×××× ×שק××£ â ×שתתפ×ת, ×ער×ת ××ת×××"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 items-start",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs(w,{icon:K,title:"פר×× ××צ××¢×",children:[e.jsxs("dl",{className:"space-y-2 text-sm",children:[t.vote.category&&e.jsx(k,{label:"×§×××ר××",value:t.vote.category}),e.jsx(k,{label:"ס××",value:t.vote.voting_type==="public"?"×××××":"×ש××ת"}),e.jsx(k,{label:"פת×××",value:v(t.vote.start_at)||"â"}),e.jsx(k,{label:"ס××ר×",value:v(t.vote.end_at)||"â"})]}),t.vote.description&&e.jsx("p",{className:"text-sm text-slate-500 mt-3 pt-3 border-t border-slate-100",children:t.vote.description})]}),e.jsx(w,{icon:q,title:"×שתתפ×ת",extra:`${t.participation.voted}/${t.participation.eligible}`,children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs font-semibold text-emerald-700 mb-1.5 flex items-center gap-1",children:[e.jsx(P,{className:"w-3.5 h-3.5"})," ×צ×××¢× (",F.length,")"]}),e.jsxs("div",{className:"max-h-52 overflow-y-auto space-y-1",children:[F.map((s,h)=>e.jsx("div",{className:"text-xs text-slate-600 truncate",children:s.full_name},h)),F.length===0&&e.jsx("p",{className:"text-xs text-slate-300",children:"â"})]})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs font-semibold text-slate-500 mb-1.5 flex items-center gap-1",children:[e.jsx(le,{className:"w-3.5 h-3.5"})," ××¨× ×צ×××¢× (",O.length,")"]}),e.jsxs("div",{className:"max-h-52 overflow-y-auto space-y-1",children:[O.map((s,h)=>e.jsx("div",{className:"text-xs text-slate-600 truncate",children:s.full_name},h)),O.length===0&&e.jsx("p",{className:"text-xs text-slate-300",children:"â"})]})]})]})})]}),e.jsx("div",{className:"space-y-4",children:e.jsx(w,{icon:ie,title:"ת×צ××ת",extra:t.results?`${t.results.total_ballots} פתק××`:void 0,children:t.results?e.jsx("div",{className:"space-y-4",children:t.results.questions.map(s=>{const h=Math.max(1,...s.options.map(g=>g.count));return e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-slate-800 mb-1.5",children:s.title}),e.jsx("div",{className:"space-y-1.5",children:s.options.map(g=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-slate-600 w-24 truncate flex-shrink-0",children:g.title}),e.jsx("div",{className:"flex-1 h-4 rounded bg-slate-100 overflow-hidden",children:e.jsx("div",{className:"h-full rounded",style:{width:`${g.count/h*100}%`,backgroundColor:b}})}),e.jsx("span",{className:"text-xs font-bold text-slate-700 w-7 text-left flex-shrink-0",children:g.count})]},g.option_id))})]},s.question_id)})}):e.jsx("p",{className:"text-sm text-slate-400",children:N?"×ת×צ××ת ××× × ××צ××ת ×¢××ר ×צ××¢× ××.":"×ת×צ××ת ××צ×× ×××ר ס××רת ××צ××¢×."})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(w,{icon:B,title:"×ער×ת ×שק×פ××",children:[t.notes.length>0?e.jsx("div",{className:"space-y-2.5 mb-3",children:t.notes.map(s=>e.jsxs("div",{className:"rounded-xl bg-slate-50 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-slate-400 mb-0.5",children:[e.jsx("span",{className:"font-semibold text-slate-600",children:s.author_name}),e.jsxs("span",{children:["· ",v(s.created_date)]})]}),e.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:s.content})]},s.id))}):e.jsx("p",{className:"text-xs text-slate-400 mb-3",children:"××× ×ער×ת ×¢××××."}),!j&&e.jsxs(e.Fragment,{children:[e.jsx("textarea",{value:o,onChange:s=>d(s.target.value),rows:2,placeholder:"××ספת ×ערת ×שק××£ (ת××¨×©× ×פר××××§××)â¦",className:"w-full rounded-xl border border-slate-200 p-2.5 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-teal-100 focus:border-teal-300"}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsxs("button",{onClick:W,disabled:!o.trim()||f,className:"inline-flex items-center gap-1.5 h-9 px-4 roun
1ded-full text-white text-xs font-semibold disabled:opacity-50",style:{backgroundColor:b},children:[f?e.jsx(S,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(B,{className:"w-3.5 h-3.5"})," ××סף ×ער×"]})})]})]}),e.jsx(w,{icon:R,title:j?"×ת×××ת ×שק×פ××":"×ת××ת ×שק××£",tone:C,children:j?z.length>0?e.jsx("div",{className:"space-y-4",children:z.map((s,h)=>e.jsxs("div",{className:"text-center",children:[e.jsx("img",{src:s.signature_url,alt:"×ת×××",className:"h-16 mx-auto object-contain"}),e.jsxs("p",{className:"text-sm font-semibold text-slate-700 border-t border-slate-200 pt-1.5 mt-1",children:[s.signed_name||s.full_name," · ×ת××ת ×שק××£"]}),s.signature_assessment&&e.jsx("p",{className:"text-xs text-slate-500 mt-1 whitespace-pre-wrap",children:s.signature_assessment}),e.jsx("p",{className:"text-[10px] text-slate-400 mt-0.5",children:v(s.signed_at)})]},h))}):e.jsx("p",{className:"text-sm text-slate-400",children:"××× ×ת×××ת."}):T?e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-emerald-700 font-medium mb-2 flex items-center gap-1.5",children:[e.jsx(P,{className:"w-4 h-4"})," ×ת×ת ×Ö¾",v(t.my_observer.signed_at)]}),t.my_observer.signature_assessment&&e.jsxs("p",{className:"text-sm text-slate-600 mb-2",children:["×ער××: ",t.my_observer.signature_assessment]}),t.my_observer.signature_url&&e.jsx("img",{src:t.my_observer.signature_url,alt:"×ת×××",className:"h-20 border border-slate-200 rounded-lg bg-white"})]}):N?x?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"×ער×× (רש×ת)"}),e.jsx("textarea",{value:U,onChange:s=>Q(s.target.value),rows:2,placeholder:"×ער×ת ××שק××£ ×××× ×ª×§×× ×ת ××צ××¢×â¦",className:"w-full rounded-xl border border-slate-200 p-2.5 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-fuchsia-100 focus:border-fuchsia-300"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"×ת××× ×××××××ת"}),e.jsx(re,{onChange:V})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{$(!1),V("")},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:Y,disabled:D||!L,className:"inline-flex items-center gap-2 h-11 px-6 rounded-xl text-white font-semibold disabled:opacity-60",style:{backgroundColor:C},children:[D?e.jsx(S,{className:"w-4 h-4 animate-spin"}):e.jsx(P,{className:"w-4 h-4"})," ××ש×ר ×ת×××"]})]})]}):e.jsxs("button",{onClick:()=>$(!0),className:"inline-flex items-center gap-2 h-11 px-5 rounded-xl text-white font-semibold",style:{backgroundColor:C},children:[e.jsx(R,{className:"w-4 h-4"})," ×ת×× ××שק××£"]}):e.jsx("p",{className:"text-sm text-slate-400",children:"×ת××ת ××שק××£ תת×פשר ×××ר ס××רת ××צ××¢×."})})]})]})]})}const G=({onBack:a})=>e.jsxs("button",{onClick:a,className:"inline-flex items-center gap-1.5 h-9 px-3 mb-4 rounded-full border border-slate-200 bg-white text-sm font-medium text-slate-600 hover:bg-slate-50",children:[e.jsx(X,{className:"w-4 h-4"})," ×××¨× ×רש××ת ××צ××¢×ת"]}),k=({label:a,value:l})=>e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("dt",{className:"text-xs text-slate-400 flex-shrink-0",children:a}),e.jsx("dd",{className:"text-sm font-medium text-slate-800 text-left truncate",children:l})]});export{Ae 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.