PageSourceSearch

https://bneyzion.co.il/assets/ControlCenter-3RCOEvHo.js

js bneyzion.co.il collected 2026-10-02 16:25:37 UTC 11,732 bytes, 1 lines download raw bytes

1import{_ as O,bu as V,r as y,j as e,S as q,aH as k,bv as E,R as $,ac as g,p as B,b0 as C,bw as S,bx as D,by as L,bz as z,ad as U,bh as Y,bA as I,l as J,b6 as j}from"./main-mxLlKCGe.js";import{A as G}from"./AdminLayout-3FEBGP8m.js";import{T as K}from"./textarea-tQUHmgD2.js";import{S as W,C as _,a as A}from"./siteCopyRegistry-Bqky6kgG.js";import{L as P}from"./lock-BmgV_gkJ.js";import{C as R}from"./circle-check-ZjFHvYvM.js";import{A as F}from"./arrow-up-dzi6u4LS.js";import{A as H}from"./arrow-down-Dlt_x8i6.js";import{S as T}from"./save-DHu0PNfD.js";import"./classApi-lEW1nuAj.js";import"./credit-card-C_mzvN51.js";import"./target-hHyrE940.js";import"./package-5aN_2ptI.js";import"./receipt-CF86ZucX.js";import"./triangle-alert-B58YiETs.js";function Q({field:c,currentValue:h,hasOverride:d,canEdit:m}){const[n,i]=y.useState(null),t=E(),l=z(),N=n??h,p=n!=null&&n!==h,s=()=>{p&&t.mutate({key:c.key,value:n},{onSuccess:()=>{j.success(`"${c.label}" נשמר — האתר מציג את הנוסח החדש`),i(null)},onError:a=>j.error(`השמירה נכשלה: ${a.message??a}`)})},b=()=>{l.mutate(c.key,{onSuccess:()=>{j.success(`"${c.label}" חזר לנוסח המקורי`),i(null)},onError:a=>j.error(`האיפוס נכשל: ${a.message??a}`)})};return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-sm",children:c.label}),c.sensitive&&e.jsxs(C,{variant:"secondary",className:"gap-1 text-[11px]",children:[e.jsx(P,{className:"h-3 w-3"})," רק סער"]}),d&&e.jsxs(C,{variant:"outline",className:"gap-1 text-[11px] text-primary border-primary/40",children:[e.jsx(R,{className:"h-3 w-3"})," נערך"]})]}),e.jsx("code",{className:"text-[10px] text-muted-foreground",dir:"ltr",children:c.key})]}),c.hint&&e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:c.hint}),c.type==="textarea"?e.jsx(K,{dir:"rtl",value:N,disabled:!m,rows:3,onChange:a=>i(a.target.value)}):e.jsx(k,{dir:"rtl",value:N,disabled:!m,onChange:a=>i(a.target.value)}),m?e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsxs(g,{size:"sm",onClick:s,disabled:!p||t.isPending,className:"gap-1",children:[e.jsx(T,{className:"h-3.5 w-3.5"})," שמירה"]}),d&&e.jsxs(g,{size:"sm",variant:"outline",onClick:b,disabled:l.isPending,className:"gap-1",children:[e.jsx(I,{className:"h-3.5 w-3.5"})," חזרה לנוסח המקורי"]}),p&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"שינוי לא שמור"})]}):e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"שדה זה נערך רק על ידי סער."})]})}function X({overrides:c,isSuperAdmin:h}){const[d,m]=y.useState(""),[n,i]=y.useState(!1),[t,l]=y.useState(null),N=E(),p=async()=>{if(!(!d.trim()||n)){i(!0),l(null);try{const a=A.map(v=>({key:v.key,label:v.label,group:v.group,hint:v.hint,sensitive:v.sensitive,current:c.get(v.key)??v.defaultValue})),{data:o,error:w}=await J.functions.invoke("copy-assistant",{body:{message:d.trim(),registry:a}});if(w)throw w;l(o)}catch(a){j.error(`הבקשה נכשלה: ${a.message??a}`)}finally{i(!1)}}},s=t?.key&&t.new_value&&(!t.sensitive||h)&&A.some(a=>a.key===t.key),b=()=>{s&&N.mutate({key:t.key,value:t.new_value},{onSuccess:()=>{j.success(`"${t.label}" עודכן — האתר מציג את הנוסח החדש`),l(null),m("")},onError:a=>j.error(`ההחלה נכשלה: ${a.message??a}`)})};return e.jsxs("div",{className:"rounded-xl border border-primary/30 bg-primary/5 p-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx($,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-semibold text-sm",children:"בקשה חופשית"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"— כותבים מה לשנות, מקבלים הצעה, מאשרים ביד"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{dir:"rtl",placeholder:'למשל: "תשנה את כותרת החנות — זה לא רק ספרי תנ״ך"',value:d,onChange:a=>m(a.target.value),onKeyDown:a=>a.key==="Enter"&&p(),disabled:n}),e.jsxs(g,{onClick:p,disabled:n||!d.trim(),className:"gap-1 shrink-0",children:[n?e.jsx(B,{className:"h-4 w-4 animate-spin"}):e.jsx($,{className:"h-4 w-4"}),"הצע"]})]}),t&&!t.key&&e.jsx("p",{className:"text-sm text-muted-foreground mt-3",children:t.explanation}),t?.key&&e.jsxs("div",{className:"mt-3 rounded-lg border border-border bg-card p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[e.jsx(C,{variant:"outline",children:t.label}),t.sensitive&&e.jsxs(C,{variant:"secondary",className:"gap-1 text-[11px]",children:[e.jsx(P,{className:"h-3 w-3"})," רק סער"]})]}),e.jsxs("div",{className:"grid gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground block mb-0.5",children:"לפני:"}),e.jsx("p",{className:"line-through opacity-60",children:t.current})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground block mb-0.5",children:"אחרי:"}),e.jsx("p",{className:"font-medium",children:t.new_value})]}),t.explanation&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.explanation})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsxs(g,{size:"sm",onClick:b,disabled:!s||N.isPending,className:"gap-1",children:[e.jsx(R,{className:"h-3.5 w-3.5"})," אישור והחלה"]}),e.jsx(g,{size:"sm",variant:"outline",onClick:()=>l(null),children:"ביטול"}),t.sensitive&&!h&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"שדה זה נערך רק על ידי סער."})]})]})]})}function Z({overrides:c}){const h=c.get(S),d=h&&D(h)||L,[m,n]=y.useState(null),i=E(),t=z(),l=m??d,N=m!=null&&JSON.stringify(m)!==JSON.stringify(d),p=(r,x)=>{const u=l.map((f,M)=>M===r?{...f,...x}:f);n(u)},s=(r,x)=>{const u=r+x;if(u<0||u>=l.length)return;const f=[...l];[f[r],f[u]]=[f[u],f[r]],n(f)},b=r=>n(l.filter((x,u)=>u!==r)),a=()=>n([...l,{label:"",href:"/"}]),o=l.length>0&&l.every(r=>r.label.trim().length>0&&r.label.length<=30&&(r.href.startsWith("/")||r.href.startsWith("https://"))),w=()=>{!o||!N||i.mutate({key:S,value:JSON.stringify(l.map(r=>({label:r.label.trim(),href:r.href.trim()})))},{onSuccess:()=>{j.success("התפריט נשמר — חי באתר"),n(null)},onError:r=>j.error(`השמירה נכשלה: ${r.message??r}`)})},v=()=>{t.mutate(S,{onSuccess:()=>{j.success("התפריט חזר לברירת המחדל"),n(null)},onError:r=>j.error(`האיפוס נכשל: ${r.message??r}`)})};return e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-lg font-bold mb-3 border-b border-border pb-1.5",children:"התפריט הראשי"}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"הפריטים בתפריט העליון ובמגירת המובייל (מימין לשמאל). נתיב = כתובת בתוך האתר, למשל /store."}),e.jsx("div",{className:"flex flex-col gap-2",children:l.map((r,x)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{dir:"rtl",className:"flex-1",placeholder:"תווית",value:r.label,onChange:u=>p(x,{label:u.target.value})}),e.jsx(k,{dir:"ltr",className:"flex-1 font-mono text-xs",placeholder:"/path",value:r.href,onCh
1ange:u=>p(x,{href:u.target.value})}),e.jsx(g,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>s(x,-1),disabled:x===0,"aria-label":"העלאה",children:e.jsx(F,{className:"h-3.5 w-3.5"})}),e.jsx(g,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>s(x,1),disabled:x===l.length-1,"aria-label":"הורדה",children:e.jsx(H,{className:"h-3.5 w-3.5"})}),e.jsx(g,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive",onClick:()=>b(x),"aria-label":"הסרה",children:e.jsx(U,{className:"h-3.5 w-3.5"})})]},x))}),e.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[e.jsxs(g,{size:"sm",variant:"outline",onClick:a,disabled:l.length>=12,className:"gap-1",children:[e.jsx(Y,{className:"h-3.5 w-3.5"})," פריט חדש"]}),e.jsxs(g,{size:"sm",onClick:w,disabled:!N||!o||i.isPending,className:"gap-1",children:[e.jsx(T,{className:"h-3.5 w-3.5"})," שמירת התפריט"]}),c.has(S)&&e.jsxs(g,{size:"sm",variant:"outline",onClick:v,disabled:t.isPending,className:"gap-1",children:[e.jsx(I,{className:"h-3.5 w-3.5"})," חזרה לברירת המחדל"]}),!o&&e.jsx("span",{className:"text-xs text-destructive",children:"תווית ריקה או נתיב לא תקין (חייב להתחיל ב-/)"})]})]})]})}function pe(){const{user:c}=O(),h=W.includes(c?.email??""),{data:d}=V(),[m,n]=y.useState(""),i=y.useMemo(()=>new Map((d??[]).map(s=>[s.key,s.value])),[d]),t=m.trim(),l=s=>{if(!t)return!0;const b=`${s.label} ${s.group} ${s.hint??""} ${s.defaultValue} ${i.get(s.key)??""}`;return t.split(/\s+/).every(a=>b.includes(a))},N=[{id:"sec-ai",label:"בקשה חופשית"},{id:"sec-menu",label:"התפריט הראשי"},..._.map((s,b)=>({id:`sec-group-${b}`,label:s}))],p=s=>document.getElementById(s)?.scrollIntoView({behavior:"smooth",block:"start"});return e.jsx(G,{children:e.jsxs("div",{dir:"rtl",className:"max-w-3xl mx-auto",children:[e.jsx("h1",{className:"text-2xl font-bold mb-1",children:"מרכז שליטה — נוסחים ותמונות"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-5",children:'כל שינוי כאן חי באתר מיד אחרי שמירה. "חזרה לנוסח המקורי" מבטלת את השינוי.'}),e.jsx("nav",{"aria-label":"דילוג בין מדורי העריכה",className:"sticky top-14 z-20 -mx-2 mb-6 flex flex-wrap gap-1.5 rounded-b-xl border-b border-border bg-background/95 px-2 py-2 backdrop-blur",children:N.map(s=>e.jsx("button",{type:"button",onClick:()=>p(s.id),className:"rounded-full border border-border bg-card px-3 py-1 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary",children:s.label},s.id))}),e.jsx("div",{id:"sec-ai",className:"scroll-mt-32",children:e.jsx(X,{overrides:i,isSuperAdmin:h})}),e.jsx("div",{id:"sec-menu",className:"scroll-mt-32",children:e.jsx(Z,{overrides:i})}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6 -mt-2",children:["מחירי המשלוח ונקודות האיסוף מנוהלים עכשיו במקום אחד:"," ",e.jsx("a",{href:"/admin/products",className:"underline text-primary",children:"ניהול מוצרים ← משלוח ואיסוף"}),"."]}),e.jsxs("div",{className:"relative mb-6",children:[e.jsx(q,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(k,{dir:"rtl",className:"pr-9",placeholder:'חיפוש נוסח — למשל "כותרת דף הבית" או חלק מהטקסט עצמו',value:m,onChange:s=>n(s.target.value)})]}),_.map((s,b)=>{const a=A.filter(o=>o.group===s).filter(l);return a.length===0?null:e.jsxs("section",{id:`sec-group-${b}`,className:"mb-8 scroll-mt-32",children:[e.jsx("h2",{className:"text-lg font-bold mb-3 border-b border-border pb-1.5",children:s}),e.jsx("div",{className:"flex flex-col gap-3",children:a.map(o=>e.jsx(Q,{field:o,currentValue:i.get(o.key)??o.defaultValue,hasOverride:i.has(o.key),canEdit:!o.sensitive||h},o.key))})]},s)}),A.filter(l).length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-10",children:"לא נמצא נוסח שמתאים לחיפוש. אפשר לבקש מסער להוסיף את השדה למרשם."})]})})}export{pe 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.