1import{r as x,j as e}from"./ui-CPW3-RCR.js";import{u as I,L as m,i as z,y as N,Z as y,B as n,_ as A,$ as O,N as q,l as C,m as _,n as b,o as w,T as F,q as T,d as i,I as H}from"./index-BraPXa8T.js";import{u as P}from"./useBrainTransfers-B1ZkaAJ5.js";import"./supabase-B2z4OhLQ.js";import"./charts-DCB9_QAo.js";import"./vendor-CIXof4MH.js";const Z={1:"××× 1 - ×××¢ ×ר×××",2:"××× 2 - ס×× ×× ×ת×××",3:"××× 3 - ×××¢ ××§××"};function V(){const{clearanceLevel:L,loading:B}=I(),p=L===1,{transfers:f,loading:D,editTransfer:k,deleteTransfer:R,restoreTransfer:g}=P(p),[t,c]=x.useState(null),[d,v]=x.useState(""),[u,o]=x.useState(null),[h,j]=x.useState(""),[a,l]=x.useState(!1);if(B)return e.jsx("div",{className:"p-8 flex justify-center",children:e.jsx(m,{className:"w-5 h-5 animate-spin"})});if(!p)return e.jsx("div",{className:"p-8 text-center text-muted-foreground",dir:"rtl",children:"××¢××× ×××× ×× ×××× ×ער×ת ××××."});const $=async()=>{if(t){l(!0);try{await k(t,d),i.success("×××§×¡× ×¢×××× ×××× ××××× ×××"),c(null)}catch(s){i.error(`××¢×××× × ×ש×: ${(s==null?void 0:s.message)||"ש××××"}`)}finally{l(!1)}}},E=async()=>{if(u){l(!0);try{await R(u,h),i.success("×רש××× ×××¡×¨× ××××× ×ס××× × ×××××§×"),o(null),j("")}catch(s){i.error(`×××××§× × ×ש××: ${(s==null?void 0:s.message)||"ש××××"}`)}finally{l(!1)}}},S=async s=>{l(!0);try{await g(s),i.success("×רש××× ×©××××¨× ×××××¨×§× ×××ש ××××")}catch(r){i.error(`×ש×××ר × ×ש×: ${(r==null?void 0:r.message)||"ש××××"}`)}finally{l(!1)}};return e.jsxs("div",{className:"p-4 md:p-6 space-y-4",dir:"rtl",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"text-xl font-semibold",children:"××× ×ª××××ת ×××××ת"})]}),D?e.jsx("div",{className:"p-8 flex justify-center",children:e.jsx(m,{className:"w-5 h-5 animate-spin"})}):f.length===0?e.jsx(N,{className:"p-8 text-center text-muted-foreground",children:"××× ××¢×ר×ת ×¢××××."}):e.jsx("div",{className:"space-y-2",children:f.map(s=>{const r=s.status==="deleted";return e.jsxs(N,{className:"p-3 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:new Date(s.created_at).toLocaleString("he-IL")}),e.jsx("span",{children:"·"}),e.jsx("span",{children:s.user_name||"×שת×ש ×× ××××¢"}),e.jsx("span",{children:"·"}),e.jsx("span",{children:s.client_name||"××× ××§××"}),e.jsx(y,{variant:"secondary",children:Z[s.brain_type]||`××× ${s.brain_type}`}),r&&e.jsx(y,{variant:"destructive",children:"××××§"})]}),e.jsx("div",{className:`text-sm whitespace-pre-wrap ${r?"line-through opacity-60":""}`,children:s.original_comment_text}),r&&s.delete_reason&&e.jsxs("div",{className:"text-xs text-destructive",children:["ס××ת ××××§×: ",s.delete_reason]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsxs(n,{size:"sm",variant:"outline",disabled:a,onClick:()=>{c(s),v(s.original_comment_text)},children:[e.jsx(A,{className:"w-3.5 h-3.5 ml-1"}),"ער×××"]}),r?e.jsxs(n,{size:"sm",variant:"outline",disabled:a,onClick:()=>S(s),children:[e.jsx(O,{className:"w-3.5 h-3.5 ml-1"}),"ש×××ר"]}):e.jsxs(n,{size:"sm",variant:"outline",disabled:a,className:"text-destructive",onClick:()=>{o(s),j("")},children:[e.jsx(q,{className:"w-3.5 h-3.5 ml-1"}),"××××§×"]})]})]},s.id)})}),e.jsx(C,{open:!!t,onOpenChange:s=>!a&&!s&&c(null),children:e.jsxs(_,{dir:"rtl",children:[e.jsx(b,{children:e.jsx(w,{className:"text-right",children:"ער××ת ×קס×"})}),e.jsx(F,{value:d,onChange:s=>v(s.target.value),rows:8,className:"text-right"}),e.jsxs(T,{className:"flex-row-reverse sm:flex-row-reverse gap-2",children:[e.jsxs(n,{onClick:$,disabled:a||!d.trim(),children:[a&&e.jsx(m,{className:"w-4 h-4 animate-spin ml-2"}),"ש××ר"]}),(t==null?void 0:t.status)==="deleted"&&e.jsx(n,{variant:"outline",disabled:a||!d.trim(),onClick:async()=>{if(t){l(!0);try{await g(t,d),i.success("×××§×¡× ×¢×××× ××רש××× ×©××××¨× ××××"),c(null)}catch(s){i.error(`×ש×××ר × ×ש×: ${(s==null?void 0:s.message)||"ש××××"}`)}finally{l(!1)}}},children:"ש××ר ×ש××ר ××××"}),e.jsx(n,{variant:"ghost",onClick:()=>c(null),disabled:a,children:"×××××"})]})]})}),e.jsx(C,{open:!!u,onOpenChange:s=>!a&&!s&&o(null),children:e.jsxs(_,{dir:"rtl",children:[e.jsx(b,{children:e.jsx(w,{className:"text-right",children:"××××§× ×××××"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"×רש××× ×ª×סר ××××× ××× ×תס××× ×××××§× ××××. × ××ª× ×ש××ר ×××ש×."}),e.jsx(H,{value:h,onChange:s=>j(s.target.value),placeholder:"ס××ת ××××§× (××××)",className:"text-right"}),e.jsxs(T,{className:"flex-row-reverse sm:flex-row-reverse gap-2",children:[e.jsxs(n,{variant:"destructive",onClick:E,disabled:a||!h.trim(),children:[a&&e.jsx(m,{className:"w-4 h-4 animate-spin ml-2"}),"×××§"]}),e.jsx(n,{variant:"ghost",onClick:()=>o(null),disabled:a,children:"×××××"})]})]})})]})}export{V 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.