PageSourceSearch

https://bacctrack-7ha7hyw7.manus.space/assets/AdminNotificationsPage-iWvZjihd.js

js bacctrack-7ha7hyw7.manus.space collected 2026-10-03 05:02:16 UTC 9,455 bytes, 1 lines download raw bytes

1import{r as o,t as f,b as c,j as e}from"./index-C3Qps0S4.js";import{B as A}from"./bell-BS0Ukiqj.js";import{U as z}from"./users-DTIsUZbE.js";import{U as v}from"./user-K4lTKbuI.js";import{M as N}from"./megaphone-BztIUHgH.js";import{C as u}from"./coins-Cn4zgY_g.js";import{S as h}from"./settings-Cj6VgvAK.js";import{S as w}from"./send-CbRcUDpe.js";import{Z as y}from"./zap-Dg3Ucl6s.js";const S=[{value:"promotion",label:"โปรโมชั่น",icon:e.jsx(N,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:9",className:"w-4 h-4"}),color:"text-green-400"},{value:"system",label:"ระบบ",icon:e.jsx(h,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:10",className:"w-4 h-4"}),color:"text-gray-400"},{value:"credit",label:"Point",icon:e.jsx(u,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:11",className:"w-4 h-4"}),color:"text-amber-400"}];function B(){const[s,m]=o.useState("broadcast"),[t,P]=o.useState("promotion"),[n,r]=o.useState(""),[i,d]=o.useState(""),[l,x]=o.useState(""),g=f.adminNotifications.broadcast.useMutation({onSuccess:a=>{c.success(`ส่งแจ้งเตือนสำเร็จ! (${a.sent} คน)`),r(""),d("")},onError:a=>c.error(a.message)}),p=f.adminNotifications.sendToUser.useMutation({onSuccess:()=>{c.success("ส่งแจ้งเตือนสำเร็จ!"),r(""),d(""),x("")},onError:a=>c.error(a.message)}),j=()=>{if(!n.trim()||!i.trim()){c.error("กรุณากรอกหัวข้อและข้อความ");return}if(s==="broadcast")g.mutate({type:t,title:n.trim(),message:i.trim()});else{if(!l.trim()){c.error("กรุณากรอก User ID");return}p.mutate({userId:Number(l),type:t,title:n.trim(),message:i.trim()})}},b=g.isPending||p.isPending;return e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:64",className:"space-y-4 max-w-2xl",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:66",className:"flex items-center gap-2",children:[e.jsx(A,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:67",className:"w-5 h-5 text-orange-400"}),e.jsx("h1",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:68",className:"text-lg font-bold text-orange-400",children:"ส่งการแจ้งเตือน"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:72",className:"flex gap-2",children:[e.jsxs("button",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:73",onClick:()=>m("broadcast"),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium transition-all ${s==="broadcast"?"bg-orange-500/20 border border-orange-500/50 text-orange-400":"bg-zinc-900/60 border border-zinc-800 text-zinc-400"}`,children:[e.jsx(z,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:81",className:"w-3.5 h-3.5"}),"ส่งทุกคน (Broadcast)"]}),e.jsxs("button",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:84",onClick:()=>m("individual"),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium transition-all ${s==="individual"?"bg-blue-500/20 border border-blue-500/50 text-blue-400":"bg-zinc-900/60 border border-zinc-800 text-zinc-400"}`,children:[e.jsx(v,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:92",className:"w-3.5 h-3.5"}),"ส่งรายบุคคล"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:98",className:"bg-zinc-900/60 border border-zinc-800 rounded-xl p-4 space-y-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:100",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:101",className:"text-[11px] text-zinc-500 mb-1.5 block",children:"ประเภทแจ้งเตือน"}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:102",className:"flex gap-2",children:S.map(a=>e.jsxs("button",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:104",onClick:()=>
1P(a.value),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs transition-all ${t===a.value?`bg-zinc-800 border border-zinc-600 ${a.color}`:"bg-zinc-900 border border-zinc-800 text-zinc-500"}`,children:[a.icon,a.label]},a.value))})]}),s==="individual"&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:122",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:123",className:"text-[11px] text-zinc-500 mb-1.5 block",children:"User ID"}),e.jsx("input",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:124",type:"number",value:l,onChange:a=>x(a.target.value),placeholder:"กรอก User ID",className:"w-full px-3 py-2 rounded-lg bg-zinc-800 border border-zinc-700 text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-blue-500"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:135",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:136",className:"text-[11px] text-zinc-500 mb-1.5 block",children:"หัวข้อ"}),e.jsx("input",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:137",type:"text",value:n,onChange:a=>r(a.target.value),placeholder:"เช่น โปรโมชั่นพิเศษ! Point ฟรี 100",maxLength:255,className:"w-full px-3 py-2 rounded-lg bg-zinc-800 border border-zinc-700 text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-orange-500"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:148",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:149",className:"text-[11px] text-zinc-500 mb-1.5 block",children:"ข้อความ"}),e.jsx("textarea",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:150",value:i,onChange:a=>d(a.target.value),placeholder:"รายละเอียดการแจ้งเตือน...",maxLength:1e3,rows:3,className:"w-full px-3 py-2 rounded-lg bg-zinc-800 border border-zinc-700 text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-orange-500 resize-none"}),e.jsxs("p",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:158",className:"text-[10px] text-zinc-600 mt-1 text-right",children:[i.length,"/1000"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:162",className:"border border-zinc-700 rounded-lg p-3 bg-zinc-800/50",children:[e.jsx("p",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:163",className:"text-[10px] text-zinc-500 mb-2",children:"ตัวอย่างการแจ้งเตือน:"}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:164",className:"flex items-start gap-2",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:165",className:`p-1.5 rounded-lg ${t==="promotion"?"bg-green-500/20 text-green-400":t==="credit"?"bg-amber-500/20 text-amber-400":"bg-gray-500/20 text-gray-400"}`,children:t==="promotion"?e.jsx(N,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:166",className:"w-3.5 h-3.5"}):t==="credit"?e.jsx(u,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:166",className:"w-3.5 h-3.5"}):e.jsx(h,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:166",className:"w-3.5 h-3.5"})}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:168",children:[e.jsx("p",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:169",className:"text-xs font-medium text-white",children:n||"หัวข้อ..."}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:170",className:"text-[11px] text-zinc-400 mt-0.5",children:i||"ข้อความ..."})]})]})]}),e.jsxs("button",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:176",onClick:j,disabled:b||!n.trim()||!i.trim(),className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg bg-gradient-to-r from-orange-500 to-red-500 text-white text-sm font-medium hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed",children:[b?e.jsx("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:182",className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):e.jsx(w,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:184",className:"w-4 h-4"}),s==="broadcast"?"ส่งแจ้งเตือนทุกคน":"ส่งแจ้งเตือน"]})]}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:191",className:"rounded-lg border border-zinc-800 bg-zinc-900/40 p-3",children:e.jsxs("p",{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:192",className:"text-[11px] text-zinc-500",children:[e.jsx(y,{"data-loc":"client/src/pages/admin/AdminNotificationsPage.tsx:193",className:"w-3 h-3 inline mr-1 text-orange-400"}),s==="broadcast"?"การแจ้งเตือนจะถูกส่งไปยังผู้ใช้ทุกคนในระบบ ผู้ใช้จะเห็นในหน้าการแจ้งเตือน":"ส่งการแจ้งเตือนไปยังผู้ใช้เฉพาะรายด้วย User ID"]})})]})}export{B 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.