PageSourceSearch

https://tsofit.org.il/assets/PublicationsManager-C5iK0UAt.js

js tsofit.org.il collected 2026-10-02 14:22:03 UTC 59,885 bytes, 1 lines download raw bytes

1import{r as c,d as k,z as y,j as e,aa as Se,M as be,F as Ie,aj as Te,ar as R,x as Ee,b as T,T as B,P as le,aN as fe,aF as $e,aD as Le,aR as Me,J as Fe,aS as U,I as Ae,af as Be,aV as ge,au as ae,Z as re}from"./index-BH8Hq4fF.js";import{L as De}from"./LoadError-DtFBUis7.js";import{b as me}from"./notificationCatalog-BP5L2CAl.js";import{I as V}from"./image-DgoP-ctX.js";import{B as Oe}from"./bell-ring-Db0rTCDW.js";import{C as Pe}from"./chevron-left-DaNP-hnR.js";import{U as z}from"./upload-DtbdHLAK.js";import{D as Re,a as xe,b as Ue}from"./defaultMessageTemplates-O7fWkcUA.js";import{B as Ke}from"./baseline-CoO2TSdU.js";import{Y}from"./youtube-CpfQxPon.js";import{P as ze}from"./play-BtMz3qTH.js";import{C as Ve}from"./chevron-up-Nk0mcmku.js";import{S as q}from"./sparkles-DYMjDKmN.js";import{L as je}from"./lightbulb-B7_-PNqe.js";import{E as Ge}from"./eye-off-B4MzD2pP.js";import"./refresh-cw-kjmzcQOe.js";const X=[{key:"whatsapp",label:"וואטסאפ",hint:"תמונת כותרת (media) בהודעת הוואטסאפ",Icon:Se,color:"#059669",chip:"bg-emerald-50 text-emerald-700"},{key:"email",label:"דוא״ל",hint:"באנר בראש הודעת הדוא״ל",Icon:be,color:"#2563eb",chip:"bg-blue-50 text-blue-700"},{key:"push",label:"התראת Push",hint:"תמונה בהתראת הפוש (הערוץ בפיתוח)",Icon:Oe,color:"#64748b",chip:"bg-slate-100 text-slate-600"}],ue=Object.keys(me).map(t=>{const r=Te(t)||{};return{key:t,label:r.label||t,Icon:r.icon||R,situations:(me[t]||[]).length}}).sort((t,r)=>t.label.localeCompare(r.label,"he"));function He(){const[t,r]=c.useState([]),[o,p]=c.useState(!0),[i,g]=c.useState(null),m=c.useCallback(async()=>{p(!0);try{const l=await k.entities.NotificationImage.list();r(l||[])}catch(l){console.error(l),y.error("שגיאה בטעינת התמונות")}finally{p(!1)}},[]);c.useEffect(()=>{m()},[m]);const N=(l,a)=>t.find(u=>u.module_key===l&&u.channel===a),x=(l,a)=>{var u;return((u=N(l,a))==null?void 0:u.image_url)||""},b=l=>X.reduce((a,u)=>a+(x(l,u.key)?1:0),0),h=async(l,a,u)=>{const _=N(l,a);if(u){if(_){r(v=>v.map(C=>C.id===_.id?{...C,image_url:u}:C));try{await k.entities.NotificationImage.update(_.id,{image_url:u})}catch(v){console.error(v),y.error("שגיאה בשמירה"),m()}}else try{const v=await k.entities.NotificationImage.create({module_key:l,channel:a,image_url:u});r(C=>[...C,v])}catch(v){console.error(v),y.error("שגיאה בשמירה"),m()}y.success("התמונה נשמרה")}else if(_){r(v=>v.filter(C=>C.id!==_.id));try{await k.entities.NotificationImage.delete(_.id),y.success("התמונה הוסרה")}catch(v){console.error(v),y.error("שגיאה במחיקה"),m()}}};if(o)return e.jsx("div",{className:"flex items-center justify-center h-48",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})});const n=i?ue.find(l=>l.key===i):null;return e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[e.jsx("span",{className:"w-9 h-9 rounded-xl grid place-items-center flex-none bg-fuchsia-50 text-fuchsia-600",children:e.jsx(V,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-[0.9375rem] font-bold text-slate-800",children:"תמונות להתראות"}),e.jsx("p",{className:"text-xs text-slate-400",children:"קבעו תמונה ייחודית לכל מודול ולכל ערוץ. כל ההתראות שאותו מודול שולח (בכל הסטטוסים) יישלחו עם התמונה שהוגדרה — באנר בדוא״ל, כותרת בוואטסאפ ותמונה בפוש."})]})]}),!n&&e.jsx(Qe,{}),n?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsxs("button",{onClick:()=>g(null),className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-full border border-slate-200 text-sm font-bold text-slate-600 hover:bg-slate-50",children:[e.jsx(Ie,{className:"w-4 h-4"})," לכל המודולים"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-9 h-9 rounded-xl grid place-items-center flex-none bg-fuchsia-50 text-fuchsia-600",children:n.Icon&&e.jsx(n.Icon,{className:"w-5 h-5"})}),e.jsx("h3",{className:"text-[1rem] font-extrabold text-slate-800",children:n.label})]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:X.map(l=>e.jsx(Ye,{channel:l,value:x(i,l.key),fallback:l.key!=="email"?x(i,"email"):"",onSave:a=>h(i,l.key,a)},l.key))})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:ue.map(l=>{const a=l.Icon,u=b(l.key);return e.jsx("button",{onClick:()=>g(l.key),className:"text-right rounded-2xl border border-slate-200 bg-white p-4 transition-all hover:shadow-md hover:-translate-y-0.5 hover:border-fuchsia-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"w-11 h-11 rounded-xl grid place-items-center flex-none bg-fuchsia-50 text-fuchsia-600",children:a&&e.jsx(a,{className:"w-[22px] h-[22px]"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"text-[0.9375rem] font-extrabold text-slate-800 truncate",children:l.label}),e.jsxs("p",{className:"text-[0.75rem] text-slate-400 mt-0.5",children:[l.situations," סוגי התראות"]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1",children:X.map(_=>{const v=!!x(l.key,_.key),C=_.Icon;return e.jsx("span",{title:`${_.label}: ${v?"תמונה מוגדרת":"אין תמונה"}`,className:`w-6 h-6 rounded-lg grid place-items-center ${v?_.chip:"bg-slate-50 text-slate-300"}`,children:e.jsx(C,{className:"w-3.5 h-3.5"})},_.key)})}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs font-bold ms-auto ${u>0?"text-fuchsia-600":"text-slate-400"}`,children:[u>0?`${u}/3 מוגדרות`:"הגדר תמונות"," ",e.jsx(Pe,{className:"w-3.5 h-3.5"})]})]})]})]})},l.key)})})]})}function Qe(){const[t,r]=c.useState(null),[o,p]=c.useState({name:"",phone:"",email:""}),[i,g]=c.useState(!1),m=c.useCallback(async()=>{try{r(await k.entities.NotificationTestRecipient.list("-created_date",200)||[])}catch(n){console.error(n),r([])}},[]);c.useEffect(()=>{m()},[m]);const N=async()=>{const n=o.name.trim(),l=o.phone.trim(),a=o.email.trim();if(!n||!l&&!a){y.error("נדרש שם + טלפון או דוא״ל");return}g(!0);try{const u=await k.entities.NotificationTestRecipient.create({name:n,phone:l,email:a});r(_=>[u,..._||[]]),p({name:"",phone:"",email:""}),y.success("נוסף לרשימת הבדיקות")}catch(u){console.error(u),y.error("שגיאה בהוספה")}finally{g(!1)}},x=async(n,l)=>{r(a=>a.map(u=>u.id===n?{...u,...l}:u));try{await k.entities.NotificationTestRecipient.update(n,l)}catch(a){console.error(a),y.error("שגיאה בשמירה"),m()}},b=async n=>{if(confirm("להסיר נמען בדיקה?")){r(l=>l.filter(a=>a.id!==n));try{await k.entities.NotificationTestRecipient.delete(n),y.success("הוסר")}catch(l){console.error(l),y.error("שגיאה בהסרה"),m()}}},h="h-9 rounded-lg border border-slate-200 bg-white px-2.5 text-sm focus:outline-none focus:border-fuchsia-300 focus:ring-2 focus:ring-fuchsia-50";return e.jsxs("div",{className:"rounded-2xl border border-fuchsia-100 bg-fuchsia-50/40 p-4 mb-4",children:[e.jsxs("div",{className:"flex items-start gap-2.5 mb-3",children:[e.jsx("span",{className:"w-8 h-8 rounded-lg grid place-items-center flex-none bg-fuchsia-100 text-fuchsia-700",children:e.jsx(Ee,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[0.875rem] font-extrabold text-slate-800",children:"נמעני בדיקה"}),e.jsx("p",{className:"text-[0.75rem] text-slate-500",children:"רשימת אנשי קשר לשליחת בדיקות. מכל תבנית, כפתור «שלח לבדיקה» (לסופר-אדמין בלבד) פותח את הרשימה הזו — בוחרים למי לשלוח וההודעה נשלחת בכל הערוצים הפעילים."})]})]}),t===null?e.jsx("div",{className:"flex justify-center py-4 text-slate-400",children:e.jsx(T,{className:"w-5 h-5 animate-spin"})}):e.jsxs("div",{className:"space-y-2",children:[t.map(n=>e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_1fr_1.4fr_auto] gap-2 items-center bg-white rounded-xl border border-slate-200 p-2",children:[e.jsx("input",{className:h,defaultValue:n.name||"",placeholder:"שם מלא",onBlur:l=>{const a=l.target.value.trim();a!==(n.name||"")&&x(n.id,{name:a})}}),e.jsx("input",{className:h,dir:"ltr",defaultValue:n.phone||"",placeholder:"טלפון",onBlur:l=>{const a=l.target.value.trim();a!==(n.phone||"")&&x(n.id,{phone:a})}}),e.jsx("input",{className:h,dir:"ltr",defaultValue:n.email||"",placeholder:"דוא״ל",onBlur:l=>{const a=l.target.value.trim();a!==(n.email||"")&&x(n.id,{email:a})}}),e.jsx("button",{onClick:()=>b(n.id),className:"w-9 h-9 rounded-lg text-red-500 hover:bg-red-50 grid place-items-center justify-self-start","aria-label":"הסר",children:e.jsx(B,{className:"w-4 h-4"})})]},n.id)),t.length===0&&e.jsx("p",{className:"text-sm text-slate-400 text-center py-2",children:"אין נמעני בדיקה עדיין."}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_1fr_1.4fr_auto] gap-2 items-center pt-1",children:[e.jsx("input",{className:h,value:o.name,placeholder:"שם מלא",onChange:n=>p(l=>({...l,name:n.target.value}))}),e.jsx("input",{className:h,dir:"ltr",value:o.phone,placeholder:"טלפון",onChange:n=>p(l=>({...l,phone:n.target.value}))}),e.jsx("input",{className:h,dir:"ltr",value:o.email,placeholder:"דוא״ל",onChange:n=>p(l=>({...l,email:n.target.value})),onKeyDown:n=>{n.key==="Enter"&&N()}}),e.jsxs("button",{onClick:N,disabled:i,className:"inline-flex items-center justify-center gap-1.5 h-9 px-3 rounded-lg text-white text-sm font-bold disabled:opacity-60 justify-self-start",style:{backgroundColor:"#c026d3"},children:[i?e.jsx(T,{className:"w-4 h-4 animate-spin"}):e.jsx(le,{className:"w-4 h-4"})," הוסף"]})]})]})]})}function Ye({channel:t,value:r,fallback:o,onSave:p}){const[i,g]=c.useState(!1),{Icon:m}=t,N=!r&&!!o,x=async b=>{var n;const h=(n=b.target.files)==null?void 0:n[0];if(b.target.value="",!!h){g(!0);try{const{file_url:l}=await k.integrations.Core.UploadFile({file:h});await p(l)}catch(l){console.error(l),y.error("שגיאה בהעלאת התמונה")}finally{g(!1)}}};return e.jsxs("div",{className:"rounded-2xl border border-slate-200 overflow-hidden bg-white flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-slate-100",children:[e.jsx("span",{className:"w-7 h-7 rounded-lg grid place-items-center flex-none",style:{backgroundColor:`${t.color}15`,color:t.color},children:e.jsx(m,{className:"w-4 h-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-bold text-slate-800",children:t.label}),e.jsx("div",{className:"text-[0.6875rem] text-slate-400 truncate",children:t.hint})]})]}),e.jsxs("div",{className:"p-3 flex-1 flex flex-col gap-2",children:[e.jsx("div",{className:"aspect-[16/9] rounded-xl bg-slate-100 overflow-hidden grid place-items-center relative",children:r?e.jsx("img",{src:r,alt:"",className:"w-full h-full object-cover"}):N?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:o,alt:"",className:"w-full h-full object-cover opacity-45"}),e.jsx("span",{className:"absolute inset-0 grid place-items-center",children:e.jsxs("span",{className:"inline-flex items-center gap-1 text-[0.625rem] font-bold text-slate-700 bg-white/85 rounded-full px-2 py-0.5",children:[e.jsx(be,{className:"w-3 h-3 text-blue-600"})," ברירת מחדל מהדוא״ל"]})})]}):e.jsx(V,{className:"w-8 h-8 text-slate-300"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"flex-1 inline-flex items-center justify-center gap-1.5 h-9 px-3 rounded-lg border border-slate-200 text-xs font-bold text-slate-600 hover:bg-slate-50 cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:x,disabled:i}),i?e.jsx(T,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(z,{className:"w-3.5 h-3.5"})," ",i?"מעלה...":r?"החלף תמונה":"העלה תמונה"]}),r&&e.jsxs("button",{onClick:()=>p(""),disabled:i,className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-lg text-xs font-bold text-red-500 hover:bg-red-50",children:[e.jsx(B,{className:"w-3.5 h-3.5"})," הסר"]})]})]})]})}const he={marketing:{chip:"bg-purple-50 text-purple-700",dot:"#7c3aed"},service:{chip:"bg-cyan-50 text-cyan-700",dot:"#0891b2"},emergency:{chip:"bg-red-50 text-red-700",dot:"#dc2626"}};function qe(){const[t,r]=c.useState([]),[o,p]=c.useState(!0),i=c.useCallback(async()=>{p(!0);try{r(await k.entities.MessageTemplateDefaultImage.list()||[])}catch(h){console.error(h),y.error("שגיאה בטעינת התמונות")}finally{p(!1)}},[]);c.useEffect(()=>{i()},[i]);const g=h=>t.find(n=>n.template_key===h),m=h=>{var n;return((n=g(h))==null?void 0:n.image_url)||""},N=async(h,n)=>{const l=g(h);if(n){if(l){r(a=>a.map(u=>u.id===l.id?{...u,image_url:n}:u));try{await k.entities.MessageTemplateDefaultImage.update(l.id,{image_url:n})}catch(a){console.error(a),y.error("שגיאה בשמירה"),i()}}else try{const a=await k.entities.MessageTemplateDefaultImage.create({template_key:h,image_url:n});r(u=>[...u,a])}catch(a){console.error(a),y.error("שגיאה בשמירה"),i()}y.success("התמונה נשמרה")}else if(l){r(a=>a.filter(u=>u.id!==l.id));try{await k.entities.MessageTemplateDefaultImage.delete(l.id),y.success("התמונה הוסרה")}catch(a){console.error(a),y.error("שגיאה במחיקה"),i()}}},x=c.useMemo(()=>Re.map(h=>({...h,templates:xe.filter(n=>n.cat===h.key)})),[]),b=t.filter(h=>h.image_url).length;return o?e.jsx("div",{className:"flex items-center justify-center h-48",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[e.jsx("span",{className:"w-9 h-9 rounded-xl grid place-items-center flex-none bg-fuchsia-50 text-fuchsia-600",children:e.jsx(fe,{className:"w-5 h-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-[0.9375rem] font-bold text-slate-800",children:"תמונות לתבניות קהילה"}),e.jsx("p",{className:"text-xs text-slate-400",children:"העלו תמונה אחת לכל תבנית ברירת מחדל (משמשת בכל הערוצים — דוא״ל, וואטסאפ, פוש ואתר). התמונה תחליף את הבאנר האוטומטי כשקהילה תטען את תבניות ברירת המחדל."})]}),e.jsxs("span",{className:`ms-auto flex-none text-xs font-bold px-2.5 py-1 rounded-full ${b>0?"bg-fuchsia-50 text-fuchsia-600":"bg-slate-100 text-slate-400"}`,children:[b,"/",xe.length," מוגדרות"]})]}),e.jsx("div",{className:"space-y-6",children:x.map(h=>{const n=he[h.key]||he.marketing;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-none",style:{backgroundColor:n.dot}}),e.jsx("h3",{className:"text-sm font-extrabold text-slate-700",children:h.title}),e.jsxs("span",{className:"text-[0.6875rem] text-slate-400",children:[h.templates.length," תבניות"]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:h.templates.map(l
1=>e.jsx(Je,{tpl:l,tint:n,value:m(l.key),onSave:a=>N(l.key,a)},l.key))})]},h.key)})})]})}function Je({tpl:t,tint:r,value:o,onSave:p}){const[i,g]=c.useState(!1),m=c.useMemo(()=>Ue(t,{}),[t]),N=async x=>{var h;const b=(h=x.target.files)==null?void 0:h[0];if(x.target.value="",!!b){g(!0);try{const{file_url:n}=await k.integrations.Core.UploadFile({file:b});await p(n)}catch(n){console.error(n),y.error("שגיאה בהעלאת התמונה")}finally{g(!1)}}};return e.jsxs("div",{className:"rounded-2xl border border-slate-200 overflow-hidden bg-white flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-slate-100",children:[e.jsx("span",{className:"text-lg flex-none leading-none",children:t.emoji||"✨"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"text-[0.8125rem] font-bold text-slate-800 truncate",children:t.title})}),e.jsx("span",{className:`flex-none text-[0.625rem] font-bold px-1.5 py-0.5 rounded-full ${o?r.chip:"bg-slate-100 text-slate-400"}`,children:o?"תמונה":"ברירת מחדל"})]}),e.jsxs("div",{className:"p-3 flex-1 flex flex-col gap-2",children:[e.jsx("div",{className:"aspect-[16/9] rounded-xl bg-slate-100 overflow-hidden grid place-items-center relative",children:o?e.jsx("img",{src:o,alt:"",className:"w-full h-full object-cover"}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:m,alt:"",className:"w-full h-full object-cover opacity-90"}),e.jsx("span",{className:"absolute bottom-1 inset-x-0 grid place-items-center",children:e.jsxs("span",{className:"inline-flex items-center gap-1 text-[0.625rem] font-bold text-slate-700 bg-white/85 rounded-full px-2 py-0.5",children:[e.jsx(V,{className:"w-3 h-3"})," באנר ברירת מחדל"]})})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"flex-1 inline-flex items-center justify-center gap-1.5 h-9 px-3 rounded-lg border border-slate-200 text-xs font-bold text-slate-600 hover:bg-slate-50 cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:N,disabled:i}),i?e.jsx(T,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(z,{className:"w-3.5 h-3.5"})," ",i?"מעלה...":o?"החלף תמונה":"העלה תמונה"]}),o&&e.jsxs("button",{onClick:()=>p(""),disabled:i,className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-lg text-xs font-bold text-red-500 hover:bg-red-50",children:[e.jsx(B,{className:"w-3.5 h-3.5"})," הסר"]})]})]})]})}const We=[{key:"templates",update_type:"info_center",title:"חדש: תבניות הודעה מוכנות בלחיצה",body:"מעכשיו אפשר לטעון בלחיצה 25 תבניות הודעה מוכנות — שיווק, שירות וחירום — לכל מודול שנוגע לתושב (אינדקס עסקים, אירועים, חוגים, הצבעות ועוד). כל תבנית מגיעה עם תוכן מנוסח ובאנר ממותג, וניתנת לעריכה מלאה. היכנסו למודול «תבניות להודעות» ← «טען תבניות ברירת מחדל».",module_key:"message_templates",category:"general"},{key:"youtube",update_type:"info_center",title:"חדש: הוספת סרטון יוטיוב להודעות",body:"בשליחת הודעה אפשר עכשיו לצרף סרטון יוטיוב — הוא יוצג בהודעת הווצאפ ובדוא״ל עם תמונה ממוזערת וקישור לצפייה. לחצו על «סרטון» בעת חיבור ההודעה והדביקו קישור.",module_key:"send_message",category:"general"},{key:"vote_alerts",update_type:"info_center",title:"חדש: התראות אוטומטיות בהצבעות דיגיטליות",body:"ההצבעות הדיגיטליות שולחות כעת התראות אוטומטית: הזמנה עם פתיחת ההצבעה, ושתי תזכורות — באמצע תקופת ההצבעה ושעה לפני הסיום — בוואטסאפ, דוא״ל ופוש, לפי הערוצים שבחרתם. הנוסחים נשלפים מתבניות ההתראות של המערכת.",module_key:"digital_votes",category:"general"},{key:"unsubscribe",update_type:"info_center",title:"חדש: הסרה מרשימת התפוצה — עמידה בחוק",body:"כל דוא״ל שנשלח כולל כעת קישור «הסרה מרשימת התפוצה» בפוטר, כנדרש בחוק. תושבים שהסירו את עצמם לא יקבלו עוד דוא״ל, ותוכלו לראות אותם ולבטל את החסימה תחת «מפרט הודעות» ← פעולות נוספות ← «דוח הסרה מהדיוור».",module_key:"message_reports",category:"general"},{key:"message_report",update_type:"info_center",title:"שיפור: דוח הודעות בתצוגה חדשה",body:"דוח ההודעות עוצב מחדש — רשימת ההודעות מצד אחד, ומפרט מלא מהצד השני עם תצוגה לפי ערוץ (נמענים, וואטסאפ, דוא״ל, פוש) וסטטוס שליחה לכל נמען. נוספה גם אפשרות מחיקת הודעה.",module_key:"message_reports",category:"general"},{key:"personal_links",update_type:"info_center",title:"שיפור: כניסה חלקה לאזור האישי",body:"קישורים לאזור האישי בהתראות מובילים כעת ישירות: תושב מחובר נכנס מיד, ותושב שאינו מחובר מגיע למסך ההתחברות וחוזר אוטומטית ליעד המקורי. פחות חיכוך — יותר שימוש בשירותים.",module_key:"resident_app",category:"general"},{key:"alert_images",update_type:"info_center",title:"שיפור: תמונת דוא״ל כברירת מחדל להתראות",body:"בהגדרת תמונות ההתראות, התמונה שמוגדרת לדוא״ל משמשת כברירת מחדל גם לוואטסאפ ולפוש — כך שדי בהעלאת תמונה אחת כדי למתג את ההתראות בכל הערוצים.",module_key:"",category:"general"}];function Xe(t){const r=String(t||"").match(/(?:youtu\.be\/|v=|embed\/|shorts\/)([\w-]{11})/);return r?`https://img.youtube.com/vi/${r[1]}/hqdefault.jpg`:null}const ne=Object.entries(ge||{}).filter(([,t])=>t&&t.path).map(([t,r])=>({value:t,label:r.label||t})).sort((t,r)=>t.label.localeCompare(r.label,"he")),P="w-full h-10 rounded-xl border border-slate-200 bg-white px-3 text-sm focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50 transition-all",ye=[{key:"residents",label:"תושבים"},{key:"community",label:"קהילה"},{key:"info",label:"מידע"},{key:"office",label:"משרד"},{key:"messages",label:"הודעות"},{key:"emergency",label:"חירום"},{key:"general",label:"כללי"}],Ne={banner:{label:"באנרים מתחלפים",icon:V,color:"#2563eb",desc:"מוצגים באמצע לוח המנהל במקום הגרפים ומתחלפים אוטומטית."},video:{label:"סרטוני יוטיוב",icon:Y,color:"#dc2626",desc:"אפשר להוסיף כמה סרטונים. סרטון אחד מוצג באמצע לוח המנהל; שניים או יותר מוצגים ברצועת כרטיסים נעה שנפתחת בלחיצה."},ticker:{label:"עדכוני מערכת",icon:Ke,color:"#7c3aed",desc:'כרטיסי "עדכונים חדשים" ו"מרכז מידע" בלוח המנהל של כל הקהילות. בחרו לכל פריט סוג: עדכון קצר (כותרת + תיאור) או כתבת מרכז מידע (כותרת + תיאור מלא + תמונה).'}};function Ns(){const[t,r]=c.useState([]),[o,p]=c.useState(!0),[i,g]=c.useState(!1),[m,N]=c.useState(!1),[x,b]=c.useState("banner"),[h,n]=c.useState(""),[l,a]=c.useState("message"),[u,_]=c.useState(!1),[v,C]=c.useState(!1),[I,$]=c.useState("all"),[F,D]=c.useState([]),[L,G]=c.useState(null),[J,ie]=c.useState(!1),O=c.useCallback(async()=>{p(!0),g(!1);try{const s=await k.entities.AdminPublication.list("display_order",200);r(s||[])}catch(s){console.error(s),g(!0)}finally{p(!1)}},[]);c.useEffect(()=>{O()},[O]);const A=s=>t.filter(d=>d.kind===s).sort((d,f)=>(d.display_order||0)-(f.display_order||0)),K=s=>A(s).reduce((d,f)=>
1Math.max(d,f.display_order||0),0)+1,H=async s=>{try{const d=await k.entities.AdminPublication.create({is_active:!0,...s});return r(f=>[...f,d]),d}catch(d){return console.error(d),y.error("שגיאה בהוספה"),null}},we=async()=>{if(!J&&confirm("לטעון כרטיסי מרכז מידע על היכולות החדשות? הכרטיסים ייווצרו כעדכונים ניתנים לעריכה.")){ie(!0);try{const s=new Set(t.filter(j=>j.kind==="ticker").map(j=>j.title));let d=K("ticker"),f=0;for(const j of We)s.has(j.title)||(await k.entities.AdminPublication.create({kind:"ticker",update_type:j.update_type||"info_center",title:j.title,body:j.body,module_key:j.module_key||"",category:j.category||"general",image_url:"",is_active:!0,display_order:d++}),f++);y.success(f?`נוצרו ${f} כרטיסי מרכז מידע`:"הכרטיסים כבר קיימים"),await O()}catch(s){console.error(s),y.error("שגיאה בטעינת כרטיסי המידע")}finally{ie(!1)}}},E=async(s,d)=>{r(f=>f.map(j=>j.id===s?{...j,...d}:j));try{await k.entities.AdminPublication.update(s,d)}catch(f){console.error(f),y.error("שגיאה בשמירה"),O()}},W=async s=>{if(!confirm("למחוק את הפרסום?"))return!1;r(d=>d.filter(f=>f.id!==s));try{return await k.entities.AdminPublication.delete(s),y.success("נמחק"),!0}catch(d){return console.error(d),y.error("שגיאה במחיקה"),O(),!1}},oe=async(s,d)=>{const f=A("video"),j=f.findIndex(M=>M.id===s.id),S=j+d;if(S<0||S>=f.length)return;const w=[...f];[w[j],w[S]]=[w[S],w[j]];for(let M=0;M<w.length;M+=1)(w[M].display_order||0)!==M+1&&await E(w[M].id,{display_order:M+1})},ce=async()=>{const s=h.trim();if(s.length<2){y.error("כתבו נושא");return}_(!0);try{const d=await k.functions.invoke("composeSystemUpdate",{action:"compose",topic:s,mode:l}),f=(d==null?void 0:d.data)||{},j=[];if(f.message&&j.push({kind:"new_update",title:f.message.title||"",body:f.message.body||"",module_key:f.message.module_key||""}),f.info&&j.push({kind:"info_center",title:f.info.title||"",body:f.info.body||"",category:"general",image_url:"",module_key:f.info.module_key||""}),!j.length){y.error("לא הופק תוכן, נסו שוב");return}D(j),n("")}catch(d){console.error(d),y.error("שגיאה בניסוח")}finally{_(!1)}},ke=async(s,d)=>{const f={kind:"ticker",update_type:s.kind,title:s.title,body:s.body,module_key:s.module_key||"",is_active:d,display_order:K("ticker")};s.kind==="info_center"&&(f.category=s.category||"general",f.image_url=s.image_url||"");const j=await H(f);return j&&y.success(d?"פורסם":"נשמר כטיוטה"),j},_e=s=>{C(!1),D([{kind:s.kind,title:s.title,body:s.body,category:"general",image_url:"",module_key:s.module_key||""}])},Ce=async s=>{var f;const d=(f=s.target.files)==null?void 0:f[0];if(s.target.value="",!!d){N(!0);try{const{file_url:j}=await k.integrations.Core.UploadFile({file:d});await H({kind:"banner",image_url:j,display_order:K("banner")}),y.success("הבאנר נוסף")}catch(j){console.error(j),y.error("שגיאה בהעלאת הבאנר")}finally{N(!1)}}},de=t.filter(s=>s.is_active&&(s.kind==="banner"||s.kind==="video")).length;return o?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):i?e.jsx("div",{dir:"rtl",children:e.jsx(De,{onRetry:O})}):e.jsxs("div",{dir:"rtl",className:"space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"w-11 h-11 rounded-xl bg-purple-50 grid place-items-center flex-none",children:e.jsx($e,{className:"w-6 h-6 text-purple-600"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-extrabold text-slate-900",children:"פרסומים"}),e.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:"פרסמו באנר, סרטון או סטריפ עדכונים שיוצגו בלוח המנהל של כל הקהילות. הפרסום מופיע רק כשהוא פעיל."})]})]}),x!=="notif_images"&&x!=="template_images"&&de>1&&e.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-200 text-amber-800 text-xs font-medium px-3 py-2",children:["שימו לב: מוגדרים ",de," פרסומים פעילים לאמצע הלוח — הם יתחלפו זה אחר זה."]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(Ne).map(([s,d])=>{const f=d.icon,j=x===s,S=A(s).length;return e.jsxs("button",{onClick:()=>
1b(s),className:`inline-flex items-center gap-2 h-11 px-4 rounded-xl text-sm font-bold border-2 transition-all ${j?"text-white shadow-md":"bg-white text-slate-600 border-slate-200 hover:border-slate-300 hover:shadow-sm"}`,style:j?{backgroundColor:d.color,borderColor:d.color}:void 0,children:[e.jsx("span",{className:`w-6 h-6 rounded-lg grid place-items-center flex-none ${j?"bg-white/20 text-white":""}`,style:j?void 0:{backgroundColor:`${d.color}15`,color:d.color},children:e.jsx(f,{className:"w-4 h-4"})}),d.label,e.jsx("span",{className:`text-xs tabular-nums rounded-full px-1.5 py-0.5 ${j?"bg-white/25 text-white":"bg-slate-100 text-slate-500"}`,children:S})]},s)}),e.jsxs("button",{onClick:()=>b("notif_images"),className:`inline-flex items-center gap-2 h-11 px-4 rounded-xl text-sm font-bold border-2 transition-all ${x==="notif_images"?"text-white shadow-md":"bg-white text-slate-600 border-slate-200 hover:border-slate-300 hover:shadow-sm"}`,style:x==="notif_images"?{backgroundColor:"#c026d3",borderColor:"#c026d3"}:void 0,children:[e.jsx("span",{className:`w-6 h-6 rounded-lg grid place-items-center flex-none ${x==="notif_images"?"bg-white/20 text-white":""}`,style:x!=="notif_images"?{backgroundColor:"#c026d315",color:"#c026d3"}:void 0,children:e.jsx(V,{className:"w-4 h-4"})}),"תמונות להתראות"]}),e.jsxs("button",{onClick:()=>b("template_images"),className:`inline-flex items-center gap-2 h-11 px-4 rounded-xl text-sm font-bold border-2 transition-all ${x==="template_images"?"text-white shadow-md":"bg-white text-slate-600 border-slate-200 hover:border-slate-300 hover:shadow-sm"}`,style:x==="template_images"?{backgroundColor:"#0891b2",borderColor:"#0891b2"}:void 0,children:[e.jsx("span",{className:`w-6 h-6 rounded-lg grid place-items-center flex-none ${x==="template_images"?"bg-white/20 text-white":""}`,style:x!=="template_images"?{backgroundColor:"#0891b215",color:"#0891b2"}:void 0,children:e.jsx(fe,{className:"w-4 h-4"})}),"תמונות לתבניות קהילה"]})]}),x==="banner"&&e.jsx(Z,{kind:"banner",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:[A("banner").map(s=>e.jsxs("div",{className:`rounded-2xl border overflow-hidden bg-white ${s.is_active?"border-slate-200":"border-slate-100 opacity-60"}`,children:[e.jsx("div",{className:"aspect-[16/9] bg-slate-100",children:s.image_url&&e.jsx("img",{src:s.image_url,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsx(as,{moduleKey:s.module_key,linkUrl:s.link_url,onChange:d=>E(s.id,d)}),(s.module_key||s.link_url)&&e.jsx(se,{label:"טקסט הכפתור על התמונה",value:s.button_label,onSave:d=>E(s.id,{button_label:d}),placeholder:"לפרטים נוספים"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(te,{active:s.is_active,onToggle:()=>E(s.id,{is_active:!s.is_active})}),e.jsx("button",{onClick:()=>W(s.id),className:"w-8 h-8 rounded-lg text-red-500 hover:bg-red-50 grid place-items-center","aria-label":"מחק",children:e.jsx(B,{className:"w-4 h-4"})})]})]})]},s.id)),e.jsxs("label",{className:"rounded-2xl border-2 border-dashed border-slate-200 hover:border-blue-300 hover:bg-blue-50/40 transition-colors grid place-items-center cursor-pointer min-h-[180px]",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:Ce,disabled:m}),e.jsxs("span",{className:"flex flex-col items-center gap-2 text-slate-400",children:[m?e.jsx(T,{className:"w-7 h-7 animate-spin"}):e.jsx(z,{className:"w-7 h-7"}),e.jsx("span",{className:"text-sm font-semibold",children:m?"מעלה...":"הוסף באנר"})]})]})]})}),x==="video"&&e.jsx(Z,{kind:"video",onAdd:()=>H({kind:"video",display_order:K("video")}),addLabel:"הוסף סרטון",children:A("video").length===0?e.jsx(Q,{text:"אין סרטונים מוגדרים. הוסיפו סרטון יוטיוב (או כמה) שיוצגו בלוח המנהל."}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3",children:A("video").map((s,d,f)=>{const j=Xe(s.video_url);return e.jsxs("div",{className:`rounded-2xl border overflow-hidden bg-white flex flex-col ${s.is_active?"border-slate-200":"border-slate-100 opacity-60"}`,children:[e.jsxs("div",{className:"relative aspect-video bg-slate-900",children:[j?e.jsx("img",{src:j,alt:"",className:"absolute inset-0 w-full h-full object-cover"}):e.jsx("div",{className:"absolute inset-0 grid place-items-center",children:e.jsx(Y,{className:"w-9 h-9 text-slate-500"})}),e.jsx("span",{className:"absolute inset-0 grid place-items-center bg-black/10",children:e.jsx("span",{className:"w-11 h-11 rounded-full bg-red-600/95 grid place-items-center shadow-lg",children:e.jsx(ze,{className:"w-5 h-5 text-white translate-x-[1px]",fill:"currentColor"})})}),e.jsxs("div",{className:"absolute top-1.5 right-1.5 flex items-center gap-1 rounded-full bg-black/45 backdrop-blur px-1 py-0.5",children:[e.jsx("button",{onClick:()=>oe(s,-1),disabled:d===0,className:"w-6 h-6 rounded-full grid place-items-center text-white/90 hover:bg-white/20 disabled:opacity-30","aria-label":"הזז מעלה",children:e.jsx(Ve,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-[0.6875rem] font-bold text-white tabular-nums px-0.5",children:d+1}),e.jsx("button",{onClick:()=>
1oe(s,1),disabled:d===f.length-1,className:"w-6 h-6 rounded-full grid place-items-center text-white/90 hover:bg-white/20 disabled:opacity-30","aria-label":"הזז מטה",children:e.jsx(Le,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"p-3 flex flex-col gap-2 flex-1",children:[e.jsx(se,{label:"כותרת (אופציונלי)",value:s.title,onSave:S=>E(s.id,{title:S}),placeholder:"כותרת הסרטון"}),e.jsx(se,{label:"קישור יוטיוב",value:s.video_url,onSave:S=>E(s.id,{video_url:S}),placeholder:"https://www.youtube.com/watch?v=...",dir:"ltr",icon:Y}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:"מודול מקושר (איזה נושא הסרטון מלמד)"}),e.jsxs("select",{value:s.module_key||"",onChange:S=>E(s.id,{module_key:S.target.value}),className:P,children:[e.jsx("option",{value:"",children:"ללא מודול"}),ne.map(S=>e.jsx("option",{value:S.value,children:S.label},S.value))]})]}),e.jsxs("div",{className:"flex items-center flex-wrap gap-1.5 mt-auto pt-1",children:[e.jsx(te,{active:s.is_active,onToggle:()=>E(s.id,{is_active:!s.is_active})}),e.jsx(ee,{on:s.show_on_board!==!1,icon:Me,onLabel:"מוצג בניהול",offLabel:"הצג בניהול",title:s.show_on_board!==!1?"מוצג בלוח המנהל — לחצו כדי להסתיר":"לא מוצג בלוח המנהל — לחצו כדי להציג",tone:"emerald",onClick:()=>E(s.id,{show_on_board:s.show_on_board===!1})}),e.jsx(ee,{on:!!s.show_on_site,icon:Fe,onLabel:"מוצג באתר",offLabel:"הצג באתר",title:s.show_on_site?"מוצג באתר השיווקי — לחצו כדי להסתיר":"לא מוצג באתר — לחצו כדי להציג",tone:"blue",onClick:()=>E(s.id,{show_on_site:!s.show_on_site})}),e.jsx(ee,{on:!!s.show_in_gallery,icon:Y,onLabel:"בגלריה",offLabel:"הצג בגלריה",title:s.show_in_gallery?"מוצג בגלריית סרטוני ההדרכה — לחצו כדי להסתיר":"לא מוצג בגלריה — לחצו כדי להציג",tone:"purple",onClick:()=>E(s.id,{show_in_gallery:!s.show_in_gallery})}),e.jsx("button",{onClick:()=>W(s.id),className:"w-8 h-8 rounded-lg text-red-500 hover:bg-red-50 grid place-items-center ms-auto","aria-label":"מחק",children:e.jsx(B,{className:"w-4 h-4"})})]})]})]},s.id)})})}),x==="ticker"&&e.jsxs(Z,{kind:"ticker",onAdd:()=>H({kind:"ticker",title:"",update_type:"new_update",display_order:K("ticker")}),addLabel:"הוסף עדכון",children:[e.jsxs("div",{className:"rounded-2xl border border-purple-100 bg-purple-50/50 p-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 text-purple-800 font-bold text-sm",children:[e.jsx(q,{className:"w-4 h-4"})," ניסוח עם AI"]}),e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center gap-2",children:[e.jsx("input",{value:h,onChange:s=>n(s.target.value),onKeyDown:s=>{s.key==="Enter"&&ce()},placeholder:"כתבו נושא — לדוגמה: מודול הצבעות דיגיטליות חדש",className:"flex-1 h-10 rounded-xl border border-slate-200 bg-white px-3 text-sm focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50"}),e.jsx("div",{className:"inline-flex rounded-full bg-white border border-slate-200 p-1 flex-none",children:[{k:"message",l:"נסח הודעה"},{k:"info",l:"נסח מידע"},{k:"both",l:"גם וגם"}].map(s=>e.jsx("button",{onClick:()=>a(s.k),className:`px-3 h-8 rounded-full text-xs font-bold transition-all ${l===s.k?"bg-purple-600 text-white shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:s.l},s.k))}),e.jsxs("button",{onClick:ce,disabled:u,className:"inline-flex items-center justify-center gap-1.5 h-10 px-4 rounded-xl text-white text-sm font-bold shadow-sm hover:brightness-110 transition-all disabled:opacity-60 flex-none",style:{backgroundImage:"linear-gradient(90deg,#7c3aed,#2563eb)"},children:[u?e.jsx(T,{className:"w-4 h-4 animate-spin"}):e.jsx(q,{className:"w-4 h-4"})," נסח"]}),e.jsxs("button",{onClick:()=>C(!0),className:"inline-flex items-center justify-center gap-1.5 h-10 px-4 roun
1ded-xl border-2 border-purple-200 text-purple-700 text-sm font-bold hover:bg-purple-50 transition-all flex-none",children:[e.jsx(je,{className:"w-4 h-4"})," הצעות לעדכונים ומידע"]}),e.jsxs("button",{onClick:we,disabled:J,className:"inline-flex items-center justify-center gap-1.5 h-10 px-4 rounded-xl bg-white border-2 border-emerald-200 text-emerald-700 text-sm font-bold hover:bg-emerald-50 transition-all disabled:opacity-60 flex-none",children:[J?e.jsx(T,{className:"w-4 h-4 animate-spin"}):e.jsx(U,{className:"w-4 h-4"})," טען כרטיסי מרכז מידע"]})]})]}),(()=>{const s=A("ticker");if(s.length===0)return e.jsx(Q,{text:"אין עדכונים מוגדרים. נסחו עם AI, בקשו הצעות, או הוסיפו עדכון/כתבה ידנית."});const d=s.filter(w=>(w.update_type||"new_update")!=="info_center"),f=s.filter(w=>w.update_type==="info_center"),j=I!=="info_center",S=I!=="new_update";return e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:[{k:"all",l:`הכל (${s.length})`},{k:"new_update",l:`עדכונים (${d.length})`},{k:"info_center",l:`מרכז מידע (${f.length})`}].map(w=>e.jsx("button",{onClick:()=>$(w.k),className:`h-9 px-4 rounded-full text-sm font-bold border-2 transition-all ${I===w.k?"bg-purple-600 border-purple-600 text-white shadow-sm":"bg-white border-slate-200 text-slate-600 hover:border-purple-300 hover:bg-purple-50"}`,children:w.l},w.k))}),j&&(d.length>0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2.5 text-indigo-700 font-bold text-sm",children:[e.jsx(R,{className:"w-4 h-4"})," עדכונים חדשים ",e.jsxs("span",{className:"text-xs font-semibold text-slate-400",children:["(",d.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-4 gap-3",children:d.map(w=>e.jsx(pe,{row:w,onEdit:()=>G(w)},w.id))})]}):I==="new_update"&&e.jsx(Q,{text:"אין עדכונים חדשים."})),S&&(f.length>0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2.5 text-blue-700 font-bold text-sm",children:[e.jsx(U,{className:"w-4 h-4"})," מרכז מידע ",e.jsxs("span",{className:"text-xs font-semibold text-slate-400",children:["(",f.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-4 gap-3",children:f.map(w=>e.jsx(pe,{row:w,onEdit:()=>G(w)},w.id))})]}):I==="info_center"&&e.jsx(Q,{text:"אין כתבות מרכז מידע."}))]})})()]}),x==="notif_images"&&e.jsx(He,{}),x==="template_images"&&e.jsx(qe,{}),L&&e.jsx(Ze,{row:L,onSave:async s=>{await E(L.id,s)},onDelete:async()=>{await W(L.id)&&G(null)},onClose:()=>G(null)}),v&&e.jsx(ss,{onClose:()=>C(!1),onCreate:_e}),F.length>0&&e.jsx(es,{draft:F[0],remaining:F.length,onSave:async(s,d)=>{await ke(s,d),D(f=>f.slice(1))},onDiscard:()=>D(s=>s.slice(1))})]})}function pe({row:t,onEdit:r}){var g,m;const o=t.update_type==="info_center",p=o?((g=ye.find(N=>N.key===(t.category||"general")))==null?void 0:g.label)||"כללי":null,i=t.module_key&&((m=ge[t.module_key])==null?void 0:m.label)||"";return e.jsxs("button",{onClick:r,className:`group text-right bg-white rounded-2xl border overflow-hidden flex flex-col shadow-sm hover:shadow-md hover:-translate-y-0.5 transition-all ${t.is_active?"border-slate-200":"border-slate-100 opacity-60"}`,children:[e.jsxs("div",{className:`relative aspect-[16/9] overflow-hidden ${o?"bg-slate-100":""}`,style:o?void 0:{backgroundImage:"linear-gradient(135deg,#6366f1,#2563eb)"},children:[o?t.image_url?e.jsx("img",{src:t.image_url,alt:"",className:"w-full h-full object-cover group-hover:scale-[1.03] transition-transform duration-500"}):e.jsx("div",{className:"w-full h-full grid place-items-center",children:e.jsx(U,{className:"w-8 h-8 text-slate-300"})}):e.jsx("div",{className:"w-full h-full grid place-items-center",children:e.jsx(R,{className:"w-9 h-9 text-white/90"})}),e.jsxs("span",{className:`absolute top-2 right-2 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[0.625rem] font-bold ${o?"bg-white/90 text-blue-700":"bg-white/20 text-white backdrop-blur-sm"}`,children:[o?e.jsx(U,{className:"w-3 h-3"}):e.jsx(R,{className:"w-3 h-3"})," ",o?"מרכז מידע":"עדכון"]}),!t.is_active&&e.jsx("span",{className:"absolute top-2 left-2 px-2 py-0.5 rounded-full text-[0.625rem] font-bold bg-amber-100 text-amber-700",children:"מושהה"})]}),e.jsxs("div",{className:"p-3 flex-1 flex flex-col",children:[p&&e.jsx("span",{className:"inline-block self-start mb-1.5 px-2 py-0.5 rounded-full text-[0.625rem] font-bold bg-blue-50 text-blue-700",children:p}),e.jsx("h3",{className:"text-sm font-bold text-slate-800 leading-snug line-clamp-2",children:t.title||"ללא כותרת"}),e.jsxs("div",{className:"mt-auto pt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-purple-600 flex-none",children:"עריכה ←"}),i&&e.jsx("span",{className:"text-[0.625rem] text-slate-400 truncate",children:i})]})]})]})}function Ze({row:t,onSave:r,onDelete:o,onClose:p}){const[i,g]=c.useState(t.update_type||"new_update"),[m,N]=c.useState(t.title||""),[x,b]=c.useState(t.body||""),[h,n]=c.useState(t.category||"general"),[l,a]=c.useState(t.image_url||""),[u,_]=c.useState(t.module_key||""),[v,C]=c.useState(t.is_active!==!1),[I,$]=c.useState(!1),F=i==="info_center",D=async()=>
1{if(!m.trim()){y.error("נדרשת כותרת");return}$(!0);try{await r({update_type:i,title:m.trim(),body:x.trim(),module_key:u||"",is_active:v,category:h||"general",image_url:F?l:t.image_url||""}),p()}finally{$(!1)}};return ae.createPortal(e.jsxs("div",{dir:"rtl",className:"fixed inset-0 z-[100] flex items-center justify-center p-3 sm:p-6",onClick:p,children:[e.jsx("div",{className:"absolute inset-0 bg-slate-900/50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative w-full max-w-2xl max-h-[90vh] overflow-hidden bg-white rounded-3xl shadow-2xl flex flex-col",onClick:L=>L.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-slate-100",children:[e.jsxs("div",{className:"flex items-center gap-2 text-purple-800 font-extrabold",children:[F?e.jsx(U,{className:"w-5 h-5"}):e.jsx(R,{className:"w-5 h-5"})," עריכת ",F?"כתבת מידע":"עדכון"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{active:v,onToggle:()=>C(L=>!L)}),e.jsx("button",{"aria-label":"סגירה",onClick:p,className:"w-9 h-9 rounded-full bg-slate-100 hover:bg-slate-200 grid place-items-center text-slate-600",children:e.jsx(re,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"p-5 overflow-y-auto space-y-3.5",children:e.jsx(ve,{kind:i,setKind:g,title:m,setTitle:N,body:x,setBody:b,category:h,setCategory:n,image:l,setImage:a,moduleKey:u,setModuleKey:_})}),e.jsxs("div",{className:"flex items-center justify-between gap-2 px-5 py-4 border-t border-slate-100",children:[e.jsxs("button",{onClick:o,disabled:I,className:"inline-flex items-center gap-1.5 h-10 px-4 rounded-full text-sm font-bold text-red-500 hover:bg-red-50",children:[e.jsx(B,{className:"w-4 h-4"})," מחק"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:p,disabled:I,className:"h-10 px-4 rounded-full text-sm font-bold text-slate-500 hover:bg-slate-100",children:"בטל"}),e.jsxs("button",{onClick:D,disabled:I,className:"inline-flex items-center gap-1.5 h-10 px-5 rounded-full text-white text-sm font-bold shadow-sm hover:brightness-110 disabled:opacity-60",style:{backgroundImage:"linear-gradient(90deg,#7c3aed,#2563eb)"},children:[I?e.jsx(T,{className:"w-4 h-4 animate-spin"}):null," שמור"]})]})]})]})]}),document.body)}function ve({kind:t,setKind:r,title:o,setTitle:p,body:i,setBody:g,category:m,setCategory:N,image:x,setImage:b,moduleKey:h,setModuleKey:n}){const l=t==="info_center";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"inline-flex rounded-full bg-slate-100 p-1",children:[{k:"new_update",l:"עדכון חדש"},{k:"info_center",l:"מרכז מידע"}].map(a=>e.jsx("button",{onClick:()=>r(a.k),className:`px-3.5 h-8 rounded-full text-xs font-bold transition-all ${t===a.k?"bg-white text-purple-700 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:a.l},a.k))}),l&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:"קטגוריה"}),e.jsx("select",{value:m,onChange:a=>N(a.target.value),className:P,children:ye.map(a=>e.jsx("option",{value:a.key,children:a.label},a.key))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:"כותרת"}),e.jsx("input",{value:o,onChange:a=>p(a.target.value),placeholder:"כותרת",className:"w-full h-10 rounded-xl border border-slate-200 bg-white px-3 text-sm focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:l?"תיאור מלא":"תיאור"}),e.jsx("textarea",{value:i,onChange:a=>g(a.target.value),rows:l?7:4,placeholder:"תוכן",className:"w-full rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm leading-relaxed resize-y focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50"})]}),l&&e.jsx(ls,{value:x,onSave:b}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:'מודול מקושר (כפתור "מעבר לניהול" + איתור סרטון בנושא)'}),e.jsxs("select",{value:h,onChange:a=>n(a.target.value),className:P,children:[e.jsx("option",{value:"",children:"ללא מודול"}),ne.map(a=>e.jsx("option",{value:a.value,children:a.label},a.value))]})]})]})}function es({draft:t,remaining:r,onSave:o,onDiscard:p}){const[i,g]=c.useState(t.kind||"new_update"),[m,N]=c.useState(t.title||""),[x,b]=c.useState(t.body||""),[h,n]=c.useState(t.category||"general"),[l,a]=c.useState(t.image_url||""),[u,_]=c.useState(t.module_key||""),[v,C]=c.useState(!1),I=async $=>{if(!m.trim()){y.error("נדרשת כותרת");return}C(!0);try{await o({kind:i,title:m.trim(),body:x.trim(),category:h,image_url:l,module_key:u},$)}finally{C(!1)}};return ae.createPortal(e.jsxs("div",{dir:"rtl",className:"fixed inset-0 z-[100] flex items-center justify-center p-3 sm:p-6",onClick:p,children:[e.jsx("div",{className:"absolute inset-0 bg-slate-900/50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative w-full max-w-2xl max-h-[90vh] overflow-hidden bg-white rounded-3xl shadow-2xl flex flex-col",onClick:$=>$.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-slate-100",children:[e.jsxs("div",{className:"flex items-center gap-2 text-purple-800 font-extrabold",children:[e.jsx(q,{className:"w-5 h-5"})," טיוטה לעריכה ואישור",r>1?` (נותרו ${r})`:""]}),e.jsx("button",{onClick:p,className:"w-9 h-9 rounded-full bg-slate-100 hover:bg-slate-200 grid place-items-center text-slate-600",children:e.jsx(re,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"p-5 overflow-y-auto space-y-3.5",children:e.jsx(ve,{
1kind:i,setKind:g,title:m,setTitle:N,body:x,setBody:b,category:h,setCategory:n,image:l,setImage:a,moduleKey:u,setModuleKey:_})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-4 border-t border-slate-100",children:[e.jsx("button",{onClick:p,disabled:v,className:"h-10 px-4 rounded-full text-sm font-bold text-slate-500 hover:bg-slate-100",children:"בטל"}),e.jsx("button",{onClick:()=>I(!1),disabled:v,className:"h-10 px-4 rounded-full text-sm font-bold border-2 border-slate-200 text-slate-700 hover:bg-slate-50",children:"שמור כטיוטה"}),e.jsxs("button",{onClick:()=>I(!0),disabled:v,className:"inline-flex items-center gap-1.5 h-10 px-5 rounded-full text-white text-sm font-bold shadow-sm hover:brightness-110 disabled:opacity-60",style:{backgroundImage:"linear-gradient(90deg,#7c3aed,#2563eb)"},children:[v?e.jsx(T,{className:"w-4 h-4 animate-spin"}):null," שמור ופרסם"]})]})]})]}),document.body)}function ss({onClose:t,onCreate:r}){const[o,p]=c.useState(""),[i,g]=c.useState(!1),[m,N]=c.useState(null),[x,b]=c.useState({}),h=async()=>{var l;g(!0);try{const a=await k.functions.invoke("composeSystemUpdate",{action:"suggest",recent:o.trim()});N(((l=a==null?void 0:a.data)==null?void 0:l.suggestions)||[])}catch(a){console.error(a),y.error("שגיאה בהפקת הצעות"),N([])}finally{g(!1)}},n=async(l,a)=>{await r(l),b(u=>({...u,[a]:!0}))};return ae.createPortal(e.jsxs("div",{dir:"rtl",className:"fixed inset-0 z-[100] flex items-center justify-center p-3 sm:p-6",onClick:t,children:[e.jsx("div",{className:"absolute inset-0 bg-slate-900/50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative w-full max-w-3xl max-h-[88vh] overflow-hidden bg-white rounded-3xl shadow-2xl flex flex-col",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-slate-100",children:[e.jsxs("div",{className:"flex items-center gap-2 text-purple-800 font-extrabold",children:[e.jsx(je,{className:"w-5 h-5"})," הצעות לעדכונים ומידע"]}),e.jsx("button",{"aria-label":"סגירה",onClick:t,className:"w-9 h-9 rounded-full bg-slate-100 hover:bg-slate-200 grid place-items-center text-slate-600",children:e.jsx(re,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-5 overflow-y-auto space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500 mb-2",children:"אפשר להדביק את מה ששודרג/נוסף במערכת לאחרונה (לפי מודול) — או להשאיר ריק כדי לקבל הצעות תוכן על יכולות המערכת."}),e.jsx("textarea",{value:o,onChange:l=>p(l.target.value),rows:3,placeholder:"לדוגמה: מודול הצבעות דיגיטליות — נוספה שליחת תזכורות; מודול תושבים — סינון מתקדם חדש...",className:"w-full rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm resize-y focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50"}),e.jsxs("button",{onClick:h,disabled:i,className:"mt-2 inline-flex items-center gap-1.5 h-10 px-5 rounded-full text-white text-sm font-bold shadow-sm hover:brightness-110 disabled:opacity-60",style:{backgroundImage:"linear-gradient(90deg,#7c3aed,#2563eb)"},children:[i?e.jsx(T,{className:"w-4 h-4 animate-spin"}):e.jsx(q,{className:"w-4 h-4"})," ",m?"רענן הצעות":"הפק הצעות"]})]}),i&&e.jsxs("div",{className:"flex items-center gap-2 text-slate-500 text-sm justify-center py-6",children:[e.jsx(T,{className:"w-4 h-4 animate-spin"})," מכין הצעות…"]}),m&&!i&&(m.length===0?e.jsx("p",{className:"text-sm text-slate-400 text-center py-6",children:"לא נוצרו הצעות, נסו שוב."}):e.jsx("div",{className:"space-y-3",children:m.map((l,a)=>{const u=l.kind==="info_center";return e.jsxs("div",{className:"rounded-2xl border border-slate-200 p-3.5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[0.6875rem] font-bold ${u?"bg-blue-50 text-blue-700":"bg-indigo-50 text-indigo-700"}`,children:[u?e.jsx(U,{className:"w-3 h-3"}):e.jsx(R,{className:"w-3 h-3"})," ",u?"מרכז מידע":"עדכון חדש"]}),e.jsx("h4",{className:"text-sm font-bold text-slate-800 flex-1",children:l.title})]}),e.jsx("p",{className:"text-sm text-slate-600 leading-relaxed whitespace-pre-wrap line-clamp-4",children:l.body}),e.jsx("div",{className:"mt-2 flex justify-end",children:x[a]?e.jsx("span",{className:"text-xs font-bold text-emerald-600",children:"נוסף ✓"}):e.jsxs("button",{onClick:()=>n(l,a),className:"inline-flex items-center gap-1.5 h-9 px-4 roun
1ded-full bg-purple-600 text-white text-xs font-bold hover:brightness-110",children:[e.jsx(le,{className:"w-3.5 h-3.5"})," צור ",u?"כתבה":"עדכון"]})})]},a)})}))]})]})]}),document.body)}function Z({kind:t,children:r,onAdd:o,addLabel:p}){const i=Ne[t],g=i.icon;return e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"w-9 h-9 rounded-xl grid place-items-center flex-none",style:{backgroundColor:`${i.color}15`,color:i.color},children:e.jsx(g,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-[0.9375rem] font-bold text-slate-800",children:i.label}),e.jsx("p",{className:"text-xs text-slate-400",children:i.desc})]})]}),o&&e.jsxs("button",{onClick:o,className:"inline-flex items-center gap-1.5 h-9 px-4 rounded-full text-white text-sm font-bold shadow-sm hover:brightness-110 transition-all flex-none",style:{backgroundColor:i.color},children:[e.jsx(le,{className:"w-4 h-4"})," ",p]})]}),r]})}function Q({text:t}){return e.jsx("p",{className:"text-sm text-slate-400 text-center py-6",children:t})}function te({active:t,onToggle:r,compact:o}){return e.jsxs("button",{onClick:r,title:t?"פעיל — מוצג בלוח המנהל. לחצו כדי להשהות":"מושהה — שמור אך אינו מוצג. לחצו כדי להפעיל",className:`inline-flex items-center gap-1.5 rounded-full text-xs font-bold transition-colors ${o?"px-2 py-1":"px-3 py-1.5"} ${t?"bg-emerald-50 text-emerald-700":"bg-amber-50 text-amber-700"}`,children:[t?e.jsx(Be,{className:"w-3.5 h-3.5"}):e.jsx(Ge,{className:"w-3.5 h-3.5"}),o?"":t?"פעיל":"מושהה"]})}const ts={emerald:"bg-emerald-50 text-emerald-700 ring-1 ring-emerald-200",blue:"bg-blue-50 text-blue-700 ring-1 ring-blue-200"};function ee({on:t,icon:r,onLabel:o,offLabel:p,title:i,tone:g="emerald",onClick:m}){return e.jsxs("button",{onClick:m,title:i,className:`inline-flex items-center gap-1.5 rounded-full text-xs font-bold px-3 py-1.5 transition-colors ${t?ts[g]:"bg-slate-100 text-slate-400"}`,children:[r&&e.jsx(r,{className:"w-3.5 h-3.5"}),t?o:p]})}function se({label:t,value:r,onSave:o,placeholder:p,dir:i,icon:g}){const[m,N]=c.useState(r||"");c.useEffect(()=>{N(r||"")},[r]);const x=()=>{(m||"")!==(r||"")&&o(m.trim())};return e.jsxs("label",{className:"block",children:[t&&e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:t}),e.jsxs("div",{className:"relative",children:[g&&e.jsx(g,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx("input",{value:m,onChange:b=>N(b.target.value),onBlur:x,onKeyDown:b=>{b.key==="Enter"&&b.currentTarget.blur()},placeholder:p,dir:i,className:`w-full h-10 rounded-xl border border-slate-200 bg-white ${g?"pr-9":"px-3"} pl-3 text-sm focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50 transition-all`})]})]})}function ls({value:t,onSave:r}){const[o,p]=c.useState(!1),i=async g=>{var N;const m=(N=g.target.files)==null?void 0:N[0];if(g.target.value="",!!m){p(!0);try{const{file_url:x}=await k.integrations.Core.UploadFile({file:m});r(x)}catch(x){console.error(x),y.error("שגיאה בהעלאת התמונה")}finally{p(!1)}}};return e.jsxs("div",{children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:"תמונת הכתבה"}),t?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-24 h-16 rounded-lg overflow-hidden bg-slate-100 flex-none",children:e.jsx("img",{src:t,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("label",{className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-lg border border-slate-200 text-xs font-bold text-slate-600 hover:bg-slate-50 cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:i,disabled:o}),o?e.jsx(T,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(z,{className:"w-3.5 h-3.5"})," החלף"]}),e.jsxs("button",{onClick:()=>r(""),className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-lg text-xs font-bold text-red-500 hover:bg-red-50",children:[e.jsx(B,{className:"w-3.5 h-3.5"})," הסר"]})]}):e.jsxs("label",{className:"flex items-center justify-center gap-2 h-16 rounded-lg border-2 border-dashed border-slate-200 hover:border-blue-300 hover:bg-blue-50/40 transition-colors cursor-pointer text-slate-400 text-sm font-semibold",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:i,disabled:o}),o?e.jsx(T,{className:"w-5 h-5 animate-spin"}):e.jsx(z,{className:"w-5 h-5"})," ",o?"מעלה...":"העלה תמונה"]})]})}function as({moduleKey:t,linkUrl:r,onChange:o}){const p=t?"module":r?"link":"none",[i,g]=c.useState(p),[m,N]=c.useState(r||"");c.useEffect(()=>{g(t?"module":r?"link":"none"),N(r||"")},[t,r]);const x=b=>{g(b),b==="none"?o({module_key:"",link_url:""}):b==="link"&&o({module_key:"",link_url:m.trim()})};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("select",{value:i,onChange:b=>x(b.target.value),className:P,children:[e.jsx("option",{value:"none",children:"ללא יעד בלחיצה"}),e.jsx("option",{value:"module",children:"מעבר למודול במערכת"}),e.jsx("option",{value:"link",children:"קישור חיצוני"})]}),i==="module"&&e.jsxs("select",{value:t||"",onChange:b=>o({module_key:b.target.value,link_url:""}),className:P,children:[e.jsx("option",{value:"",children:"בחר מודול…"}),ne.map(b=>e.jsx("option",{value:b.value,children:b.label},b.value))]}),i==="link"&&e.jsxs("div",{className:"relative",children:[e.jsx(Ae,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx("input",{value:m,onChange:b=>N(b.target.value),onBlur:()=>o({module_key:"",link_url:m.trim()}),onKeyDown:b=>{b.key==="Enter"&&b.currentTarget.blur()},placeholder:"https://...",dir:"ltr",className:`${P} pr-9`})]})]})}export{ye as INFO_CATEGORIES,Ns 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.