PageSourceSearch

https://bneyzion.co.il/assets/DesignPreviewYehoshuaAdmin-DQuSYPXg.js

js bneyzion.co.il collected 2026-10-02 16:26:22 UTC 14,665 bytes, 11 lines download raw bytes

1import{_ as W,r as p,l as R,j as e}from"./main-mxLlKCGe.js";import"./classApi-lEW1nuAj.js";const v=8e4,I="/api/yehoshua/donations",k={"tier-90":"ספר יהושע — 200 ראשונים","tier-120":"ספר + הקדשה","tier-220":"הזוג","tier-yehoshua-shoftim":"יהושע + שופטים","tier-400":"הסט המלא","tier-800":"השותף","tier-1200":"השותף הבכיר","tier-2000":"שיעור בקהילה","tier-custom":"סכום חופשי"};function b(i){return"₪"+i.toLocaleString("he-IL")}function _(i){return new Date(i).toLocaleString("he-IL",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"})}function C(i){const o={completed:{bg:"hsl(142 55% 92%)",color:"hsl(142 55% 28%)",label:"שולם"},pending:{bg:"hsl(38 85% 92%)",color:"hsl(38 75% 35%)",label:"ממתין"},failed:{bg:"hsl(0 65% 92%)",color:"hsl(0 55% 38%)",label:"נכשל"}}[i]??{bg:"hsl(215 15% 90%)",color:"hsl(215 20% 40%)",label:i};return e.jsx("span",{style:{background:o.bg,color:o.color,borderRadius:99,padding:"2px 10px",fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:o.label})}function j({label:i,value:s,sub:o,accent:x}){return e.jsxs("div",{style:{background:"white",border:"1.5px solid hsl(215 15% 88%)",borderRadius:16,padding:"24px 20px",display:"flex",flexDirection:"column",gap:6},children:[e.jsx("div",{style:{fontSize:12,fontWeight:700,color:"hsl(215 20% 50%)",letterSpacing:"0.06em"},children:i}),e.jsx("div",{style:{fontSize:34,fontWeight:900,color:x??"hsl(215 55% 20%)",lineHeight:1,letterSpacing:"-0.02em"},children:s}),o&&e.jsx("div",{style:{fontSize:12,color:"hsl(215 20% 52%)"},children:o})]})}function D({onSignIn:i,loading:s,error:o}){const x=g=>{g.preventDefault(),i()};return e.jsx("div",{dir:"rtl",style:{fontFamily:"'Heebo', sans-serif",background:"hsl(215 55% 15%)",minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("form",{onSubmit:x,style:{background:"white",borderRadius:20,padding:"48px 40px",maxWidth:400,width:"100%",textAlign:"center"},children:[e.jsx("div",{style:{width:64,height:64,background:"hsl(38 85% 68%)",borderRadius:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:28,margin:"0 auto 20px"},children:"🔒"}),e.jsx("h1",{style:{fontSize:22,fontWeight:900,color:"hsl(215 55% 15%)",margin:"0 0 8px"},children:"ניהול תרומות"}),e.jsxs("p",{style:{fontSize:14,color:"hsl(215 20% 50%)",margin:"0 0 28px",lineHeight:1.6},children:["כניסה מוגבלת למנהלי המערכת.",e.jsx("br",{}),"התחברו עם חשבון Google המורשה."]}),o&&e.jsx("div",{style:{color:"hsl(0 65% 45%)",fontSize:13,fontWeight:600,marginBottom:14},children:o}),e.jsx("button",{type:"submit",disabled:s,style:{width:"100%",background:s?"hsl(215 15% 88%)":"hsl(215 55% 20%)",color:s?"hsl(215 20% 55%)":"white",border:"none",borderRadius:12,padding:"14px 24px",fontSize:15,fontWeight:700,cursor:s?"not-allowed":"pointer",transition:"background 0.2s"},children:s?"מאמת...":"התחברות עם Google"})]})})}function E(i){const s=["תאריך","שם תורם","אימייל","טלפון","סכום","מה רכש","רחוב","מספר בית","עיר","מיקוד","הערות משלוח","אסמכתא","מזהה תשלום","שיטת תשלום","4 ספרות כרטיס","סטטוס"],o=n=>{if(n==null)return"";const l=String(n);return l.includes(",")||l.includes('"')||l.includes(`
2`)?`"${l.replace(/"/g,'""')}"`:l},x=[s.join(","),...i.map(n=>[n.created_at?_(n.created_at):"",n.donor_name,n.donor_email,n.phone,n.amount,n.tier_id?k[n.tier_id]??n.tier_id:n.description??"",n.shipping_street,n.shipping_house_number,n.shipping_city,n.shipping_zip,n.shipping_notes,n.asmachta,n.payment_id,n.payment_method,n.card_suffix,n.payment_status].map(o).join(","))],g="\uFEFF",a=new Blob([g+x.join(`
3`)],{type:"text/csv;charset=utf-8;"}),c=URL.createObjectURL(a),d=document.createElement("a");d.href=c,d.download=`yehoshua-donations-${new Date().toISOString().slice(0,10)}.csv`,d.click(),URL.revokeObjectURL(c)}function A({data:i,loading:s,error:o,onRefresh:x,onSignOut:g}){const[a,c]=p.useState(""),[d,n]=p.useState(""),[l,h]=p.useState("all"),r=p.useMemo(()=>i.donations.filter(t=>!(a&&t.created_at<a||d&&t.created_at>d+"T23:59:59"||l!=="all"&&t.payment_status!==l)),[i.donations,a,d,l]),f=i.stats.raised,y=i.stats.supporters,S=Math.max(0,v-f),u=Math.min(100,Math.round(f/v*100)),w=y>0?Math.round(f/y):0;return e.jsxs("div",{dir:"rtl",style:{fontFamily:"'Heebo', sans-serif",background:"hsl(38 18% 96%)",minHeight:"100vh",color:"hsl(215 40% 12%
3)"},children:[e.jsx("style",{children:`
4        * { box-sizing: border-box; }
5        input, select { font-family: inherit; }
6        .donation-row:hover { background: hsl(38 40% 97%) !important; }
7        @media (max-width: 700px) {
8          .admin-table-wrap { overflow-x: auto; }
9          .filters-row { flex-direction: column !important; }
10        }
11      `}),e.jsxs("div",{style:{background:"hsl(215 55% 15%)",padding:"18px 28px",display:"flex",alignItems:"center",gap:12,justifyContent:"space-between",flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("a",{href:"/design-yehoshua-campaign",style:{color:"hsl(38 85% 68%)",textDecoration:"none",fontSize:13,fontWeight:600},children:"← קמפיין יהושע"}),e.jsx("span",{style:{color:"hsl(215 20% 35%)"},children:"|"}),e.jsx("h1",{style:{color:"white",fontWeight:900,fontSize:18,margin:0,letterSpacing:"-0.01em"},children:"ניהול תרומות — ספר יהושע"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("button",{onClick:x,disabled:s,style:{background:"hsl(215 40% 22%)",color:"hsl(38 60% 78%)",border:"1px solid hsl(215 30% 30%)",borderRadius:8,padding:"6px 14px",fontSize:12,fontWeight:600,cursor:s?"not-allowed":"pointer"},children:s?"מרענן...":"↻ רענן"}),e.jsx("button",{onClick:g,style:{background:"hsl(215 40% 22%)",color:"hsl(215 10% 75%)",border:"1px solid hsl(215 30% 30%)",borderRadius:8,padding:"6px 14px",fontSize:12,fontWeight:600,cursor:"pointer"},children:"התנתק"})]})]}),e.jsxs("div",{style:{maxWidth:1100,margin:"0 auto",padding:"32px 24px"},children:[o&&e.jsx("div",{style:{textAlign:"center",color:"hsl(0 65% 50%)",padding:"16px",fontSize:13,background:"hsl(0 65% 97%)",borderRadius:12,marginBottom:20},children:o}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:16,marginBlockEnd:28},children:[e.jsx(j,{label:'סה"כ נגבה',value:b(f),sub:`מתוך ${b(v)} יעד`,accent:"hsl(38 75% 40%)"}),e.jsx(j,{label:"מספר תורמים",value:String(y),sub:"תשלומים שהושלמו",accent:"hsl(215 55% 30%)"}),e.jsx(j,{label:"ממוצע תרומה",value:b(w),sub:"לתורם",accent:"hsl(215 45% 40%)"}),e.jsx(j,{label:"נשאר ליעד",value:b(S),sub:`${u}% הושג`,accent:S===0?"hsl(142 55% 42%)":"hsl(0 55% 45%)"})]}),e.jsxs("div",{style:{background:"white",border:"1.5px solid hsl(215 15% 88%)",borderRadius:14,padding:"18px 20px",marginBlockEnd:28},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBlockEnd:10,fontSize:13,fontWeight:600,color:"hsl(215 30% 35%)"},children:[e.jsx("span",{children:"התקדמות לעבר היעד"}),e.jsxs("span",{style:{color:"hsl(38 75% 40%)",fontWeight:800},children:[u,"%"]})]}),e.jsx("div",{style:{height:10,background:"hsl(215 15% 88%)",borderRadius:10,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${u}%`,background:"linear-gradient(90deg, hsl(43 85% 62%), hsl(38 75% 48%))",borderRadius:10,transition:"width 0.8s ease-out"}})})]}),e.jsxs("div",{className:"filters-row",style:{display:"flex",alignItems:"flex-end",gap:12,marginBlockEnd:16,flexWrap:"wrap"},children:[e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,fontWeight:700,color:"hsl(215 20% 45%)"},children:["מתאריך",e.jsx("input",{type:"date",value:a,onChange:t=>c(t.target.value),style:{border:"1.5px solid hsl(215 15% 85%)",borderRadius:8,padding:"7px 10px",fontSize:13,background:"white",color:"hsl(215 40% 15%)"}})]}),e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,fontWeight:700,color:"hsl(215 20% 45%)"},children:["עד תאריך",e.jsx("input",{type:"date",value:d,onChange:t=>n(t.target.value),style:{border:"1.5px solid hsl(215 15% 85%)",borderRadius:8,padding:"7px 10px",fontSize:13,background:"white",color:"hsl(215 40% 15%)"}})]}),e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,fontWeight:700,color:"hsl(215 20% 45%)"}
11,children:["סטטוס",e.jsxs("select",{value:l,onChange:t=>h(t.target.value),style:{border:"1.5px solid hsl(215 15% 85%)",borderRadius:8,padding:"7px 10px",fontSize:13,background:"white",color:"hsl(215 40% 15%)",minWidth:110},children:[e.jsx("option",{value:"all",children:"הכל"}),e.jsx("option",{value:"completed",children:"שולם"}),e.jsx("option",{value:"pending",children:"ממתין"}),e.jsx("option",{value:"failed",children:"נכשל"})]})]}),e.jsx("div",{style:{flex:1}}),e.jsxs("button",{onClick:()=>E(r),disabled:r.length===0,style:{background:r.length===0?"hsl(215 15% 88%)":"hsl(142 55% 42%)",color:r.length===0?"hsl(215 20% 55%)":"white",border:"none",borderRadius:10,padding:"10px 20px",fontSize:13,fontWeight:700,cursor:r.length===0?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:6,transition:"background 0.2s"},children:["⬇ ייצוא CSV (",r.length,")"]})]}),e.jsx("div",{className:"admin-table-wrap",style:{background:"white",border:"1.5px solid hsl(215 15% 88%)",borderRadius:16,overflow:"hidden"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13,minWidth:1300},children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"hsl(215 40% 14%)",color:"hsl(38 85% 72%)",fontSize:11,fontWeight:700,letterSpacing:"0.04em"},children:["תאריך","שם תורם","אימייל","טלפון","סכום","מה רכש","כתובת","מיקוד","הערות","אסמכתא","Payment ID","סטטוס"].map(t=>e.jsx("th",{style:{padding:"12px 14px",textAlign:"right",whiteSpace:"nowrap",borderBottom:"1px solid hsl(215 30% 22%)"},children:t},t))})}),e.jsxs("tbody",{children:[!s&&r.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:12,style:{padding:"40px",textAlign:"center",color:"hsl(215 20% 55%)",fontSize:14},children:"לא נמצאו תרומות עם הפילטרים הנוכחיים"})}),r.map((t,m)=>e.jsxs("tr",{className:"donation-row",style:{background:m%2===0?"white":"hsl(215 12% 98%)",borderBottom:"1px solid hsl(215 15% 93%)",transition:"background 0.15s"},children:[e.jsx("td",{style:{padding:"10px 14px",whiteSpace:"nowrap",color:"hsl(215 20% 45%)",fontSize:12},children:_(t.created_at)}),e.jsx("td",{style:{padding:"10px 14px",fontWeight:600,color:"hsl(215 55% 18%)"},children:t.donor_name??"—"}),e.jsx("td",{style:{padding:"10px 14px",direction:"ltr",color:"hsl(215 30% 40%)",fontSize:12},children:t.donor_email??"—"}),e.jsx("td",{style:{padding:"10px 14px",direction:"ltr",color:"hsl(215 30% 40%)",fontSize:12},children:t.phone??"—"}),e.jsx("td",{style:{padding:"10px 14px",fontWeight:800,color:"hsl(38 75% 38%)"},children:b(Number(t.amount))}),e.jsx("td",{style:{padding:"10px 14px",fontSize:12,color:"hsl(215 35% 28%)",maxWidth:160,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.tier_id?k[t.tier_id]??t.tier_id:t.description??"—"}),e.jsx("td",{style:{padding:"10px 14px",fontSize:12,color:"hsl(215 30% 35%)",whiteSpace:"nowrap"},children:t.shipping_street?`${t.shipping_street} ${t.shipping_house_number??""}, ${t.shipping_city}`:e.jsx("span",{style:{color:"hsl(215 15% 65%)"},children:"—"})}),e.jsx("td",{style:{padding:"10px 14px",fontSize:12,color:"hsl(215 30% 45%)",direction:"ltr"},children:t.shipping_zip??"—"}),e.jsx("td",{style:{padding:"10px 14px",fontSize:12,color:"hsl(215 30% 45%)",maxWidth:140,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.shipping_notes??"—"}),e.jsx("td",{style:{padding:"10px 14px",fontFamily:"monospace",fontSize:11,color:"hsl(215 30% 45%)"},children:t.asmachta??"—"}),e.jsx("td",{style:{padding:"10px 14px",fontFamily:"monospace",fontSize:11,color:"hsl(215 30% 45%)"},children:t.payment_id??"—"}),e.jsx("td",{style:{padding:"10px 14px"},children:C(t.payment_status)})]},t.id))]})]})}),e.jsxs("div",{style:{marginBlockStart:12,fontSize:11,color:"hsl(215 20% 60%)",display:"flex",gap:16,flexWrap:"wrap"},children:[e.jsxs("span",{children:["KPIs: ",e.jsx("code",{children:"yehoshua_campaign_stats"})]}),e.jsxs("span",{children:["פירוט: ",e.jsx("code",{children:"donations"})," (דרך endpoint מאובטח)"]}),e.jsx("span",{children:"מתרענן כל 45 שניות"})]})]})]})}function O(){const{user:i,isAdmin:s,isLoading:o,signInWithGoogle:x,signOut:g}=W(),[a,c]=p.useState(null),[d,n]=p.useState(!1),[l,h]=p.useState(null),r=p.useCallback(async u=>{u?.silent||n(!0),h(null);try{const{data:w}=await R.auth.getSession(),t=w.session?.access_token;if(!t){c(null),h("ההתחברות פגה — התחברו מחדש.");return}const m=await fetch(I,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:"{}"});if(m.status===401){c(null),h("ההתחברות פגה — התחברו מחדש.");return}if(m.status===403){c(null),h("החשבון הזה אינו מנהל מערכת. פנו לסער להרשאה.");return}if(!m.ok){h("שגיאה בטעינת הנתונים. נסה שוב.");return}const z=await m.json();c(z),h(null)}catch{h("שגיאת רשת. בדוק חיבור ונסה שוב.")}finally{n(!1)}},[]);p.useEffect(()=>{!o&&i&&s&&r({silent:!0})},[o,i,s,r]),p.useEffect(()=>{if(!a)return;const u=setInterval(()=>r({silent:!0}),45e3);return()=>clearInterval(u)},[a,r]);const f=()=>{c(null),h(null),g()},y=()=>void r();
11if(o||!!i&&s&&!a&&!l)return e.jsxs("div",{style:{fontFamily:"'Heebo', sans-serif",background:"hsl(215 55% 15%)",minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{style:{width:40,height:40,border:"3px solid hsl(215 30% 30%)",borderTopColor:"hsl(38 85% 68%)",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]});if(!a){const u=i&&!s?"החשבון הזה אינו מנהל מערכת. פנו לסער להרשאה.":l;return e.jsx(D,{onSignIn:()=>void x("/design-yehoshua-admin"),loading:d,error:u})}return e.jsx(A,{data:a,loading:d,error:l,onRefresh:y,onSignOut:f})}export{O 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.