Files
Lucky_Wheel/apps/admin/dist/assets/SmsLogListView-D0rdB4Fo.js

2 lines
6.2 KiB
JavaScript

import{t as C}from"./farsi-number-stB7JMN0.js";import{b as l,I as F,d as P,l as T,c as d,a as _,w as i,h as S,n as M,r as m,g as U,o,f as b,e as y,R as V,S as j,t as k,F as I,y as E,H as $,x as Q,B as H,_ as q}from"./index-BOpodV_K.js";var G={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"}}]},name:"redo",theme:"outlined"};function A(c){for(var a=1;a<arguments.length;a++){var n=arguments[a]!=null?Object(arguments[a]):{},p=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(p=p.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),p.forEach(function(t){J(c,t,n[t])})}return c}function J(c,a,n){return a in c?Object.defineProperty(c,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):c[a]=n,c}var O=function(a,n){var p=A({},a,n.attrs);return l(F,A({},p,{icon:G}),null)};O.displayName="RedoOutlined";O.inheritAttrs=!1;const W={class:"sms-log-page"},X={class:"page-header-title"},Y={class:"table-header"},Z={class:"filters"},K={key:0,class:"num-cell"},ee={key:0,class:"code-badge"},te={key:1,class:"text-muted"},ae={key:0,class:"text-danger"},se={key:1,class:"text-muted"},oe={key:4,class:"date-cell"},le={key:1,class:"text-muted"},ne=P({__name:"SmsLogListView",setup(c){const a=S(!1),n=S([]),p=S(0),t=U({page:1,pageSize:10,mobile:"",status:void 0});async function f(){var g,e,v,x;a.value=!0;try{const u=await M.get("/admin/sms-logs",{params:{page:t.page,pageSize:t.pageSize,mobile:t.mobile||void 0,status:t.status||void 0}}),h=Array.isArray(u.data)?u.data:((g=u.data)==null?void 0:g.data)||[];n.value=h,p.value=((e=u.meta)==null?void 0:e.total)||((x=(v=u.data)==null?void 0:v.meta)==null?void 0:x.total)||h.length}finally{a.value=!1}}async function L(g){try{await M.post(`/admin/sms-logs/${g}/resend`),H.success("پیامک مجدداً در صف ارسال قرار گرفت."),f()}catch{}}const z=[{title:"شماره همراه",dataIndex:"mobile",key:"mobile",width:140},{title:"متن پیامک",dataIndex:"message",key:"message"},{title:"سرویس‌دهنده",dataIndex:"provider",key:"provider",width:120},{title:"شناسه پیامک",dataIndex:"providerMessageId",key:"providerMessageId",width:150},{title:"وضعیت",dataIndex:"status",key:"status",width:130,align:"center"},{title:"خطا",dataIndex:"errorMessage",key:"errorMessage",ellipsis:!0},{title:"زمان ثبت",dataIndex:"createdAt",key:"createdAt",width:160},{title:"عملیات",key:"actions",width:70,align:"center"}];function w(g){switch(g){case"SENT":return{text:"ارسال شد",color:"green",dotColor:"#10b981"};case"QUEUED":return{text:"در صف ارسال",color:"orange",dotColor:"#f59e0b"};case"FAILED":return{text:"خطا در ارسال",color:"red",dotColor:"#ef4444"};default:return{text:g,color:"default",dotColor:"#94a3b8"}}}return T(()=>{f()}),(g,e)=>{const v=m("a-button"),x=m("a-input-search"),u=m("a-select-option"),h=m("a-select"),D=m("a-tag"),N=m("a-tooltip"),R=m("a-table"),B=m("a-card");return o(),d("div",W,[_("div",X,[e[5]||(e[5]=_("div",null,[_("h1",{class:"title"},"لاگ‌های پیامک"),_("p",{class:"subtitle"},"تاریخچه ارسال پیامک‌های رمز یکبار مصرف (OTP) و اطلاع‌رسانی جوایز")],-1)),l(v,{onClick:f,loading:a.value},{icon:i(()=>[l(y(V))]),default:i(()=>[e[4]||(e[4]=b(" به‌روزرسانی ",-1))]),_:1},8,["loading"])]),l(B,{bordered:!1,class:"main-card"},{default:i(()=>[_("div",Y,[_("div",Z,[l(x,{value:t.mobile,"onUpdate:value":e[0]||(e[0]=s=>t.mobile=s),placeholder:"جستجوی شماره همراه...",style:{width:"240px"},allowClear:"",onSearch:e[1]||(e[1]=()=>{t.page=1,f()})},{prefix:i(()=>[l(y(j),{style:{color:"#94a3b8","margin-left":"4px"}})]),_:1},8,["value"]),l(h,{value:t.status,"onUpdate:value":e[2]||(e[2]=s=>t.status=s),placeholder:"فیلتر وضعیت",allowClear:"",style:{width:"150px"},onChange:e[3]||(e[3]=()=>{t.page=1,f()})},{default:i(()=>[l(u,{value:"SENT"},{default:i(()=>[...e[6]||(e[6]=[b("ارسال شد",-1)])]),_:1}),l(u,{value:"QUEUED"},{default:i(()=>[...e[7]||(e[7]=[b("در صف ارسال",-1)])]),_:1}),l(u,{value:"FAILED"},{default:i(()=>[...e[8]||(e[8]=[b("خطا در ارسال",-1)])]),_:1})]),_:1},8,["value"])])]),l(R,{dataSource:n.value,columns:z,loading:a.value,rowKey:"id",size:"middle",pagination:{current:t.page,pageSize:t.pageSize,total:p.value,showTotal:s=>`مجموع: ${y(C)(s)} پیامک`,onChange:s=>{t.page=s,f()}}},{bodyCell:i(({column:s,record:r})=>[s.key==="mobile"?(o(),d("span",K,k(y(C)(r.mobile)),1)):s.key==="providerMessageId"?(o(),d(I,{key:1},[r.providerMessageId?(o(),d("code",ee,k(r.providerMessageId),1)):(o(),d("span",te,"—"))],64)):s.key==="status"?(o(),E(D,{key:2,color:w(r.status).color,class:"status-tag"},{default:i(()=>[_("span",{class:"status-dot",style:$({backgroundColor:w(r.status).dotColor})},null,4),b(" "+k(w(r.status).text),1)]),_:2},1032,["color"])):s.key==="errorMessage"?(o(),d(I,{key:3},[r.errorMessage?(o(),d("span",ae,k(r.errorMessage),1)):(o(),d("span",se,"—"))],64)):s.key==="createdAt"?(o(),d("span",oe,k(y(C)(new Date(r.createdAt).toLocaleString("fa-IR"))),1)):s.key==="actions"?(o(),d(I,{key:5},[r.status==="FAILED"?(o(),E(N,{key:0,title:"ارسال مجدد پیامک"},{default:i(()=>[l(v,{type:"text",shape:"circle",class:"action-more-btn",onClick:ie=>L(r.id)},{default:i(()=>[l(y(O),{style:{"font-size":"15px",color:"#4f46e5"}})]),_:1},8,["onClick"])]),_:2},1024)):(o(),d("span",le,"—"))],64)):Q("",!0)]),_:1},8,["dataSource","loading","pagination"])]),_:1})])}}}),ce=q(ne,[["__scopeId","data-v-3ed5f551"]]);export{ce as default};