PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/settings/payments-fb8e9da31e963b71.js

js lidomatrip.com collected 2026-09-25 07:11:23 UTC 34,487 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3551],{93672:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings/payments",function(){return n(3604)}])},56286:function(e,t,n){"use strict";n.d(t,{HM:function(){return d},Lo:function(){return o},Q8:function(){return l},Vv:function(){return x}});var r=n(47568),a=n(26042),s=n(70655),i=n(57149);function l(e){return c.apply(this,arguments)}function c(){return(c=(0,r.Z)(function(e){var t;return(0,s.__generator)(this,function(n){switch(n.label){case 0:return[4,i.Z.setUrl("/api/payment-methods").setCallMethod("GET").setParams({context:e}).call()];case 1:if((null==(t=n.sent())?void 0:t.status)!=="success"||!(null==t?void 0:t.data))throw Error((null==t?void 0:t.message)||"روش‌های پرداخت بارگذاری نشد");return[2,t.data]}})})).apply(this,arguments)}function o(e,t){return u.apply(this,arguments)}function u(){return(u=(0,r.Z)(function(e,t){var n,r;return(0,s.__generator)(this,function(s){switch(s.label){case 0:return[4,i.Z.setUrl("/api/payment-methods/claims").setCallMethod("GET").setParams((0,a.Z)({context:e},t?{reservationId:t}:{})).call()];case 1:if((null==(n=s.sent())?void 0:n.status)!=="success")throw Error((null==n?void 0:n.message)||"رسیدها بارگذاری نشد");return[2,null!==(r=n.data)&&void 0!==r?r:[]]}})})).apply(this,arguments)}function d(e){return h.apply(this,arguments)}function h(){return(h=(0,r.Z)(function(e){var t;return(0,s.__generator)(this,function(n){switch(n.label){case 0:return[4,i.Z.setUrl("/api/payment-methods/claims").setCallMethod("POST").setBody(e).call()];case 1:if((null==(t=n.sent())?void 0:t.status)!=="success"||!(null==t?void 0:t.data))throw Error((null==t?void 0:t.message)||"ثبت رسید انجام نشد");return[2,t.data]}})})).apply(this,arguments)}function x(e){return m.apply(this,arguments)}function m(){return(m=(0,r.Z)(function(e){var t,n,r;return(0,s.__generator)(this,function(a){switch(a.label){case 0:return[4,i.Z.setUrl("/api/payment-methods/gateway").setCallMethod("POST").setBody(e).call()];case 1:if(r=null==(n=a.sent())?void 0:null===(t=n.data)||void 0===t?void 0:t.url,(null==n?void 0:n.status)!=="success"||"string"!=typeof r)throw Error((null==n?void 0:n.message)||"انتقال به درگاه انجام نشد");return[2,r]}})})).apply(this,arguments)}},3604:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return O}});var r,a=n(47568),s=n(14924),i=n(26042),l=n(69396),c=n(10253),o=n(36305),u=n(70655),d=n(85893),h=n(67294),x=n(41664),m=n.n(x),b=n(44389),p=n(49759),f=n(84858),g=n(32474),v=n(84620),y=n(43632),j=n(1801),N=n(70707),w="/api/admin/payment-methods",C=[{value:"zarinpal",label:"زرین‌پال"},{value:"zibal",label:"زیبال"},{value:"idpay",label:"آیدی‌پی"},{value:"payping",label:"پی‌پینگ"},{value:"nextpay",label:"نکست‌پی"},{value:"sep",label:"سامان کیش (سپ)"},{value:"behpardakht",label:"به‌پرداخت ملت"}
1,{value:"sadad",label:"سداد (بانک ملی)"},{value:"pasargad",label:"پاسارگاد"},{value:"irankish",label:"ایران کیش"},{value:"parsian",label:"تاپ (پارسیان)"},{value:"other",label:"سایر"}],k=function(e){var t;return null!==(r=null===(t=C.find(function(t){return t.value===e}))||void 0===t?void 0:t.label)&&void 0!==r?r:e},E=[{key:"wallet",title:"افزایش اعتبار کیف پول",where:"پنل کاربر ← کیف پول ← افزایش اعتبار",icon:"icon-Wallet"},{key:"reservation",title:"پرداخت رزرو مهمان",where:"رزرو در وضعیت \xabدر انتظار پرداخت\xbb ← پرداخت صورتحساب",icon:"icon-Pay"}],Z=[{key:"gateway",label:"درگاه پرداخت",icon:"icon-Pay"},{key:"card",label:"کارت به کارت",icon:"icon-CardBank"},{key:"both",label:"هر دو",icon:"icon-Wallet"},{key:"off",label:"غیرفعال",icon:"icon-Close"}],A=[{token:"{amount}",label:"مبلغ"},{token:"{phone}",label:"شماره دریافت رسید"},{token:"{code}",label:"کد رزرو"}],_=function(e){return(0,N.cQ)(e).replace(/\D/g,"")};function B(e,t){return{gatewayEnabled:e["".concat(t,"GatewayEnabled")],cardEnabled:e["".concat(t,"CardEnabled")],gatewayIds:e["".concat(t,"GatewayIds")],cardIds:e["".concat(t,"CardIds")],cardText:e["".concat(t,"CardText")]}}function S(e,t,n){var r,a,s=B(e,t),i=s.gatewayEnabled?n.gateways.filter(function(e){return e.isActive&&s.gatewayIds.includes(e.id)}):[],l=s.cardEnabled?n.cards.filter(function(e){return e.isActive&&s.cardIds.includes(e.id)}):[];return{context:t,gateways:i.map(function(e){return{id:e.id,provider:e.provider,title:e.title}}),cards:l.map(function(e){return{id:e.id,bank_name:e.bankName,card_number:e.cardNumber,account_number:e.accountNumber,shaba:e.shaba,owner_name:e.ownerName,theme:e.theme}}),card_text:l.length?(null===(r=s.cardText)||void 0===r?void 0:r.trim())||n.defaultCardText[t]:null,receipt_phone:l.length&&(null===(a=e.receiptPhone)||void 0===a?void 0:a.trim())||null}}function I(e){var t=e.gateways.length,n=e.cards.length;return t||n?1!==t||n?t>1&&!n?{text:"کاربر از بین ".concat((0,g.N)(t)," درگاه یکی را انتخاب می‌کند."),tone:"green"}:t||1!==n?t?{text:"کاربر بین ".concat((0,g.N)(t)," درگاه و کارت به کارت (").concat((0,g.N)(n)," کارت) انتخاب می‌کند."),tone:"green"}:{text:"".concat((0,g.N)(n)," کارت نمایش داده می‌شود و کاربر بین آن‌ها جابه‌جا می‌شود."),tone:"green"}:{text:"کارت مستقیماً به همراه متن راهنما نمایش داده می‌شود.",tone
1:"green"}:{text:"کاربر با دکمه‌ی پرداخت مستقیم به درگاه \xab".concat(e.gateways[0].title,"\xbb منتقل می‌شود."),tone:"green"}:{text:"هیچ روشی به کاربر نمایش داده نمی‌شود.",tone:"red"}}function O(){var e,t=(0,b.u)(w,function(e){return(0,f.SC)(e)}),n=t.data,r=t.isLoading,o=t.mutate,x=(0,c.Z)((0,h.useState)(null),2),m=x[0],p=x[1],v=(0,c.Z)((0,h.useState)(!1),2),j=v[0],C=v[1],k=(0,c.Z)((0,h.useState)(!1),2),Z=k[0],A=k[1],B=(0,c.Z)((0,h.useState)(!1),2),O=B[0],P=B[1],G=(0,c.Z)((0,h.useState)(null),2),L=G[0],U=G[1],$=(0,c.Z)((0,h.useState)(null),2),K=$[0],V=$[1],Q=(0,c.Z)((0,h.useState)(null),2),H=Q[0],J=Q[1],W=(0,c.Z)((0,h.useState)("reservation"),2),q=W[0],X=W[1];(0,h.useEffect)(function(){n&&!j&&p(n.settings)},[n,j]);var Y=(0,h.useMemo)(function(){return n&&m?S(m,q,n):null},[n,m,q]);if(r||!n||!m)return(0,d.jsx)(D,{children:(0,d.jsx)(g.Od,{className:"h-[520px]"})});var ee=function(e,t){p(function(n){return n?(0,l.Z)((0,i.Z)({},n),(0,s.Z)({},e,t)):n}),C(!0),P(!1)};function et(){return(et=(0,a.Z)(function(){var e,t,r,a,s;return(0,u.__generator)(this,function(c){switch(c.label){case 0:if(!m||!n)return[2];A(!0),U(null),e=new Set(n.cards.map(function(e){return e.id})),t=new Set(n.gateways.map(function(e){return e.id})),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,(0,f.SC)("".concat(w,"/settings"),{method:"PUT",body:JSON.stringify((0,l.Z)((0,i.Z)({},m),{walletGatewayIds:m.walletGatewayIds.filter(function(e){return t.has(e)}),reservationGatewayIds:m.reservationGatewayIds.filter(function(e){return t.has(e)}),walletCardIds:m.walletCardIds.filter(function(t){return e.has(t)}),reservationCardIds:m.reservationCardIds.filter(function(t){return e.has(t)}),walletCardText:(null===(r=m.walletCardText)||void 0===r?void 0:r.trim())||null,reservationCardText:(null===(a=m.reservationCardText)||void 0===a?void 0:a.trim())||null,receiptPhone:m.receiptPhone&&_(m.receiptPhone)||null}))})];case 2:return c.sent(),C(!1),P(!0),o(),[3,5];case 3:return U((s=c.sent())instanceof Error?s.message:"ذخیره نشد"),[3,5];case 4:return A(!1),[7];case 5:return[2]}})})).apply(this,arguments)}return(0,d.jsxs)(D,{children:[(0,d.jsxs)("div",{className:"grid gap-16 lg:grid-cols-[1fr_400px] items-start",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,d.jsxs)("div",{className:"rounded-16 border border-[#FFE2A8] bg-[#FFF8EB] px-16 py-12 flex gap-x-10",children:[(0,d.jsx)("i",{className:"icon-Information text-20 text-[#B26A00] shrink-0"}),(0,d.jsx)("p",{className:"text-12 leading-22 text-[#5C3B00]",children:"اتصال فنی به درگاه‌های پرداخت هنوز راه‌اندازی نشده است. درگاهی که اینجا فعال کنید به کاربر نمایش داده می‌شود، ولی با انتخاب آن پیام \xabدرگاه هنوز راه‌اندازی نشده\xbb می‌بیند. کارت به کارت کامل کار می‌کند — پرداخت‌های تأییدشده را از صفحه‌ی رزرو یا کیف پول کاربر ثبت کنید."})]}),E.map(function(e){return(0,d.jsx)(M,{ctx:e,form:m,set:ee,bundle:n,onPreview:function(){return X(e.key)}},e.key)}),(0,d.jsx)(T,{cards:n.cards,onEdit:V}),(0,d.jsx)(R,{gateways:n.gateways,onEdit:J})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-y-16 lg:sticky lg:top-[90px]",children:[(0,d.jsxs)(g.Zb,{className:"p-20",children:[(0,d.jsx)("h2",{className:"text-16 leading-24 font-m text-black mb-4",children:"شماره دریافت رسید"}),(0,d.jsxs)("p",{className:"text-12 leading-20 text-gray-9B9BAA mb-12",children:["کاربری که کارت به کارت می‌کند، Û´ رقم آخر کارتش را به این شماره می‌فرستد. در متن راهنما جای"," ",(0,d.jsx)("code",{dir:"ltr",children:"{phone}"})," می‌نشیند."]}),(0,d.jsx)(g.II,{dir:"ltr",inputMode:"tel",placeholder:"09120000000",value:null!==(e=m.receiptPhone)&&void 0!==e?e:"",onChange:function(e){return ee("receiptPhone",(0,N.cQ)(e.target.value).replace(/[^\d+\- ]/g,""))}})]}),(0,d.jsxs)(g.Zb,{className:"p-20",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-12",children:[(0,d.jsx)("h2",{className:"text-16 leading-24 font-m text-black",children:"پیش‌نمایش کاربر"}),(0,d.jsx)("div",{className:"flex items-center gap-x-4 bg-gray-F0F0F0 rounded-10 p-4",children:E.map(function(e){return(0,d.jsx)("button",{type:"button",onClick:function(){return X(e.key)},"aria-pressed":q===e.key,className:"px-10 py-4 rounded-8 text-12 leading-20 font-m transition ".concat(q===e.key?"bg-white text-black shadow-sm":"text-gray-6C6A7D"),children:"wallet"===e.key?"کیÙ
1 پول":"رزرو"},e.key)})})]}),!!Y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.Ct,{tone:I(Y).tone,className:"mb-12 !whitespace-normal !leading-20",children:I(Y).text}),(0,d.jsxs)("div",{className:"mx-auto max-w-[360px] rounded-[32px] border-[10px] border-[#1C2E45] bg-white shadow-[0_20px_40px_-20px_rgba(24,39,58,0.5)]",children:[(0,d.jsx)("div",{className:"mx-auto mt-6 mb-10 h-[5px] w-[70px] rounded-full bg-[#1C2E45]"}),(0,d.jsxs)("div",{className:"px-16 pb-20 max-h-[620px] overflow-y-auto",children:[(0,d.jsx)("p",{className:"text-14 leading-24 font-m text-black mb-12 text-center",children:"wallet"===q?"افزایش اعتبار":"پرداخت صورتحساب"}),(0,d.jsx)(y.iG,{methods:Y,amount:25e5,code:"reservation"===q?"LT-104582":void 0,onGateway:function(){},payLabel:"wallet"===q?"افزایش اعتبار":void 0})]})]})]})]}),(0,d.jsxs)(g.Zb,{className:"p-16 flex items-center justify-between gap-x-12",children:[(0,d.jsx)("span",{className:"text-12 leading-20 text-gray-6C6A7D",children:L?(0,d.jsx)("span",{className:"text-[#C62828]",children:L}):O?(0,d.jsx)("span",{className:"text-[#015046]",children:"ذخیره شد ✓"}):j?"تغییرات ذخیره نشده‌اند":"کارت‌ها و درگاه‌ها همان لحظه ذخیره می‌شوند؛ این دکمه برای تنظیمات بالاست."}),(0,d.jsx)(g.zx,{onClick:function(){return et.apply(this,arguments)},disabled:Z||!j,children:Z?"در حال ذخیره...":"ذخیره تنظیمات"})]})]})]}),!!K&&(0,d.jsx)(F,{card:"new"===K?null:K,onClose:function(){return V(null)},onSaved:function(){V(null),o()}}),!!H&&(0,d.jsx)(z,{gateway:"new"===H?null:H,onClose:function(){return J(null)},onSaved:function(){J(null),o()}})]})}function D(e){var t=e.children;return(0,d.jsx)(p.Z,{title:"روش‌های پرداخت",breadcrumb:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(m(),{href:"/admin",children:"داشبورد"})," / ",(0,d.jsx)(m(),{href:"/admin/settings",children:"تنظیمات"})]}),children:t})}function M(e){var t,n=e.ctx,r=e.form,a=e.set,s=e.bundle,i=e.onPreview,l=B(r,n.key),c=l.gatewayEnabled&&l.cardEnabled?"both":l.gatewayEnabled?"gateway":l.cardEnabled?"card":"off",u=I(S(r,n.key,s)),h=function(e){a("".concat(n.key,"GatewayEnabled"),"gateway"===e||"both"===e),a("".concat(n.key,"CardEnabled"),"card"===e||"both"===e)},x=function(e,t){var n=r[e];a(e,n.includes(t)?n.filter(function(e){return e!==t}):(0,o.Z)(n).concat([t]))},m="".concat(n.key,"CardText");return(0,d.jsxs)(g.Zb,{className:"p-20",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-x-12 mb-16",children:[(0,d.jsxs)("div",{className:"flex items-start gap-x-12",children:[(0,d.jsx)("span",{className:"w-44 h-44 rounded-12 bg-[#03D6BB14] text-[#015046] flex items-center justify-center shrink-0",children:(0,d.jsx)("i",{className:"".concat(n.icon," text-24")})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-16 leading-24 font-m text-black",children:n.title}),(0,d.jsx)("p",{className:"text-12 leading-20 text-gray-9B9BAA",children:n.where})]})]}),(0,d.jsx)("button",{type:"button",onClick:i,className:"text-12 font-m text-primary-dark whitespace-nowrap",children:"پیش‌نمایش"})]}),(0,d.jsx)("p",{className:"text-12 leading-18 text-gray-6C6A7D font-m mb-8",children:"روش‌های پرداخت"}),(0,d.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-8 mb-16",children:Z.map(function(e){return(0,d.jsxs)("button",{type:"button",onClick:function(){return h(e.key)},"aria-pressed":c===e.key,className:"flex flex-col items-center gap-y-4 rounded-12 border px-8 py-12 text-13 leading-20 font-m transition ".concat(c===e.key?"border-primary-main bg-[#03D6BB0F] text-[#015046] shadow-[0_0_0_1px_#03D6BB]":"border-gray-E5E5E6 text-gray-6C6A7D hover:border-gray-D2D2D7"),children:[(0,d.jsx)("i",{className:"".concat(e.icon," text-22")}),e.label]},e.key)})}),("gateway"===c||"both"===c)&&(0,d.jsxs)("div",{className:"mb-16",children:[(0,d.jsxs)("p",{className:"text-12 leading-18 text-gray-6C6A7D font-m mb-8",children:["درگاه‌های قابل انتخاب",(0,d.jsx)("span",{className:"font-r text-gray-9B9BAA",children:" — یک درگاه یعنی انتقال مستقیم"})]}),0===s.gateways.length?(0,d.jsx)("p",{className:"text-12 text-gray-9B9BAA",children:"هنوز درگاهی تعریف نشده — از بخش \xabدرگاه‌ها\xbb پایین صفحه اضافه کنید."}):(0,d.jsx)("div",{className:"flex flex-wrap gap-8",children:s.gateways.map(function(e){var t=l.gatewayIds.includes(e.id);return(0,d.jsxs)("button",{type:"button",onClick:function(){return x("".concat(n.key,"GatewayIds"),e.id)},"aria-pressed":t,className:"inline-flex items-center gap-x-8 rounded-10 border px-12 py-8 text-13 leading-20 transition ".concat(t?"border-primary-main bg-[#03D6BB0F] text-black":"border-gray-E5E5E6 text-gray-6C6A7D"," ").concat(e.isActive?"":"opacity-60"),children:[(0,d.jsx)(P,{on:t}),e.title,!e.isActive&&(0,d.jsx)(g.Ct,{tone:"gray",children:"غیرفعال"})]},e.id)})})]}),("card"===c||"both"===c)&&(0,d.jsxs)("div",{className:"mb-16",children:[(0,d.jsx)("p",{className:"text-12 leading-18 text-gray-6C6A7D font-m mb-8",children:"کارت‌های نمایش داده‌شده"}),0===s.cards.length?(0,d.jsx)("p",{className:"text-12 text-gray-9B9BAA",children:"هنوز کارتی تعریف نشده — از بخش \xabکارت‌های بانکی\xbb پایین صفحه اضافه کنید."}):(0,d.jsx)("div",{className:"grid md:grid-cols-2 gap-8",children:s.cards.map(function(e){var t,r,a,s,i=l.cardIds.includes(e.id),c=(null!==(a=null!==(r=null!==(t=e.cardNumber)&&void 0!==t?t:e.shaba)&&void 0!==r?r:e.accountNumber)&&void 0!==a?a:"").slice(-4);return(0,d.jsxs)("button",{type:"button",onClick:function(){return x("".concat(n.key,"CardIds"),e.id)},"aria-pressed":i,className:"flex items-center gap-x-10 rounded-12 border p-10 text-right transition ".concat(i?"border-primary-main bg-[#03D6BB0F]":"border-gray-E5E5E6"," ").concat(e.isActive?"":"opacity-60"),children:[(0,d.jsx)(P,{on:i}),(0,d.jsx)("span",{className:"w-44 h-28 rounded-6 bg-gradient-to-br ".concat(null!==(s=v.K$[e.theme])&&void 0!==s?s:v.K$.teal," shrink-0")}),(0,d.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("span",{className:"block text-13 leading-20 text-black truncate",children:[e.bankName||(0,j.w$)(e.cardNumber)||"حساب بانکی",(0,d.jsxs)("span",{dir:"ltr",className:"text-gray-9B9BAA",children:[" ••",c]})]}),(0,d.jsx)("span",{className:"block text-11 leading-18 text-gray-9B9BAA truncate",children:e.ownerName})]}),!e.isActive&&(0,d.jsx)(g.Ct,{tone:"gray",children:"غیرفعال"})]},e.id)})}),(0,d.jsxs)("div",{className:"mt-14",children:[(0,d.jsx)(g.gN,{label:"متن راهنمای کارت به کارت",hint:"خالی بگذارید تا متن پیش‌فرض نمایش داده شود. برای درج متغیر روی آن بزنید.",children:(0,d.jsx)("textarea",{rows:3,value:null!==(t=r[m])&&void 0!==t?t:"",placeholder:s.defaultCardText[n.key],onChange:function(e){return a(m,e.target.value)},className:"w-full px-14 py-10 rounded-10 border border-gray-E5E5E6 text-14 leading-24 outline-none focus:border-primary-main transition resize-y"})}),(0,d.jsx)("div",{className:"flex flex-wrap gap-6 mt-6",children:A.filter(function(e){return"reservation"===n.key||"{code}"!==e.token}).map(function(e){return(0,d.jsxs)("button",{type:"button",onClick:function(){return a(m,"".concat((r[m]||s.defaultCardText[n.key]).trimEnd()," ").concat(e.token))}
1,className:"inline-flex items-center gap-x-4 rounded-8 bg-gray-F0F0F0 px-8 py-4 text-11 leading-18 text-gray-6C6A7D hover:bg-gray-E5E5E6",children:[(0,d.jsx)("code",{dir:"ltr",children:e.token})," ",e.label]},e.token)})})]})]}),(0,d.jsxs)("div",{className:"rounded-10 px-12 py-8 text-12 leading-20 flex items-center gap-x-8 ".concat("red"===u.tone?"bg-[#FFEBEB] text-[#C62828]":"bg-[#03D6BB14] text-[#015046]"),children:[(0,d.jsx)("i",{className:"".concat("red"===u.tone?"icon-Warning":"icon-Tick"," text-16 shrink-0")}),u.text]})]})}function P(e){var t=e.on;return(0,d.jsx)("span",{className:"w-18 h-18 rounded-6 border flex items-center justify-center shrink-0 transition ".concat(t?"bg-primary-main border-primary-main text-white":"border-gray-D2D2D7 bg-white"),children:t&&(0,d.jsx)("i",{className:"icon-Tick text-14"})})}function T(e){var t=e.cards,n=e.onEdit;return(0,d.jsxs)(g.Zb,{className:"p-20",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-16",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-16 leading-24 font-m text-black",children:"کارت‌های بانکی"}),(0,d.jsx)("p",{className:"text-12 leading-20 text-gray-9B9BAA",children:"حساب‌هایی که کاربر برای کارت به کارت به آن‌ها واریز می‌کند."})]}),(0,d.jsxs)(g.zx,{onClick:function(){return n("new")},children:[(0,d.jsx)("i",{className:"icon-Plus text-16"})," کارت جدید"]})]}),0===t.length?(0,d.jsx)(g.ub,{text:"کارتی ثبت نشده"}):(0,d.jsx)("div",{className:"grid md:grid-cols-2 xl:grid-cols-3 gap-16",children:t.map(function(e){return(0,d.jsxs)("button",{type:"button",onClick:function(){return n(e)},className:"text-right group",children:[(0,d.jsx)("div",{className:"transition group-hover:-translate-y-2 ".concat(e.isActive?"":"opacity-50 grayscale"),children:(0,d.jsx)(v.ZP,{showDetails:!1,card:{bank_name:e.bankName,card_number:e.cardNumber,account_number:e.accountNumber,shaba:e.shaba,owner_name:e.ownerName,theme:e.theme}})}),(0,d.jsxs)("div",{className:"flex items-center justify-between mt-8 px-4",children:[(0,d.jsxs)("span",{className:"text-12 leading-20 text-gray-6C6A7D",children:[e.shaba?"شبا ✓":"بدون شبا"," \xb7 ",e.accountNumber?"حساب ✓":"بدون حساب"]}),e.isActive?(0,d.jsx)(g.Ct,{tone:"green",children:"فعال"}):(0,d.jsx)(g.Ct,{tone:"gray",children:"غیرفعال"})]})]},e.id)})})]})}function F(e){var t,n,r,s,o,x,m,b,p=e.card,y=e.onClose,C=e.onSaved,k=(0,c.Z)((0,h.useState)({ownerName:null!==(t=null==p?void 0:p.ownerName)&&void 0!==t?t:"",cardNumber:null!==(n=null==p?void 0:p.cardNumber)&&void 0!==n?n:"",accountNumber:null!==(r=null==p?void 0:p.accountNumber)&&void 0!==r?r:"",shaba:null!==(s=null==p?void 0:p.shaba)&&void 0!==s?s:"",bankName:null!==(o=null==p?void 0:p.bankName)&&void 0!==o?o:"",theme:null!==(x=null==p?void 0:p.theme)&&void 0!==x?x:"teal",isActive:null===(m=null==p?void 0:p.isActive)||void 0===m||m,sortOrder:null!==(b=null==p?void 0:p.sortOrder)&&void 0!==b?b:0}),2),E=k[0],Z=k[1],A=(0,c.Z)((0,h.useState)(!1),2),B=A[0],S=A[1],I=(0,c.Z)((0,h.useState)(null),2),O=I[0],D=I[1],M=(0,j.w$)(E.cardNumber),P=[E.cardNumber&&16!==E.cardNumber.length?"شماره کارت باید ۱۶ رقم باشد":null,E.shaba&&24!==E.shaba.length?"شماره شبا باید ۲۴ رقم (بعد از IR) باشد":null,E.cardNumber||E.accountNumber||E.shaba?null:"حداقل یکی از کارت، حساب یا شبا لازم است",E.ownerName.trim()?null:"نام صاحب حساب لازم است"].filter(Boolean);function T(){return(T=(0,a.Z)(function(e){var t;return(0,u.__generator)(this,function(n){switch(n.label){case 0:if(e.preventDefault(),P.length)return D(P[0]),[2];S(!0),D(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,(0,f.SC)(p?"".concat(w,"/cards/").concat(p.id):"".concat(w,"/cards"),{method:p?"PATCH":"POST",body:JSON.stringify({ownerName:E.ownerName.trim(),cardNumber:E.cardNumber||null,accountNumber:E.accountNumber.trim()||null,shaba:E.shaba||null,bankName:E.bankName.trim()||null,theme:E.theme,isActive:E.isActive,sortOrder:E.sortOrder})})];
1case 2:return n.sent(),C(),[3,5];case 3:return D((t=n.sent())instanceof Error?t.message:"خطا در ذخیره"),[3,5];case 4:return S(!1),[7];case 5:return[2]}})})).apply(this,arguments)}function F(){return(F=(0,a.Z)(function(){var e;return(0,u.__generator)(this,function(t){switch(t.label){case 0:if(!p||!window.confirm("این کارت حذف شود؟ از هر دو بخش پرداخت هم برداشته می‌شود."))return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,(0,f.SC)("".concat(w,"/cards/").concat(p.id),{method:"DELETE"})];case 2:return t.sent(),C(),[3,4];case 3:return D((e=t.sent())instanceof Error?e.message:"حذف نشد"),[3,4];case 4:return[2]}})})).apply(this,arguments)}return(0,d.jsx)(g.u_,{open:!0,onClose:y,title:p?"ویرایش کارت":"کارت جدید",width:"max-w-[680px]",children:(0,d.jsxs)("form",{onSubmit:function(e){return T.apply(this,arguments)},className:"grid md:grid-cols-[1fr_260px] gap-20",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-y-12",children:[(0,d.jsx)(g.gN,{label:"به نام (صاحب حساب)",children:(0,d.jsx)(g.II,{value:E.ownerName,onChange:function(e){return Z(function(t){return(0,l.Z)((0,i.Z)({},t),{ownerName:e.target.value})})},placeholder:"نام و نام خانوادگی",required:!0})}),(0,d.jsx)(g.gN,{label:"شماره کارت",hint:M?"تشخیص: ".concat(M):void 0,children:(0,d.jsx)(g.II,{dir:"ltr",inputMode:"numeric",value:(0,j.YC)(E.cardNumber),onChange:function(e){return Z(function(t){return(0,l.Z)((0,i.Z)({},t),{cardNumber:_(e.target.value).slice(0,16)})})},placeholder:"6037 9900 0000 0000"})}),(0,d.jsx)(g.gN,{label:"شماره حساب",children:(0,d.jsx)(g.II,{dir:"ltr",value:E.accountNumber,onChange:function(e){return Z(function(t){return(0,l.Z)((0,i.Z)({},t),{accountNumber:(0,N.cQ)(e.target.value).replace(/[^\d.\-]/g,"")})})},placeholder:"0123456789"})}),(0,d.jsx)(g.gN,{label:"شماره شبا",children:(0,d.jsxs)("div",{className:"flex items-stretch",dir:"ltr",children:[(0,d.jsx)("span",{className:"px-12 flex items-center rounded-l-10 border border-r-0 border-gray-E5E5E6 bg-gray-F0F0F0 text-14 text-gray-6C6A7D",children:"IR"}),(0,d.jsx)(g.II,{dir:"ltr",inputMode:"numeric",className:"!rounded-l-none",value:E.shaba,onChange:function(e){return Z(function(t){return(0,l.Z)((0,i.Z)({},t),{shaba:_(e.target.value).slice(0,24)})})},placeholder:"000000000000000000000000"})]})}),(0,d.jsx)(g.gN,{label:"نام بانک (اختیاری)",hint:"خالی = تشخیص خودکار از شماره کارت",children:(0,d.jsx)(g.II,{value:E.bankName,onChange:function(e){return Z(function(t){return(0,l.Z)((0,i.Z)({},t),{bankName:e.target.value})})},placeholder:null!=M?M:"مثلاً بانک ملت"})})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,d.jsx)(v.ZP,{showDetails:!1,card:{bank_name:E.bankName||null,card_number:E.cardNumber||null,account_number:E.accountNumber||null,shaba:E.shaba||null,owner_name:E.ownerName||"نام صاحب حساب",theme:E.theme}}),!!E.shaba&&(0,d.jsx)("p",{dir:"ltr",className:"text-11 leading-18 text-gray-9B9BAA text-center",children:(0,j.Lm)(E.shaba)}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-12 leading-18 text-gray-6C6A7D font-m mb-8",children:"رنگ کارت"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-8",children:Object.keys(v.K$).map(function(e){return(0,d.jsx)("button",{type:"button",title:v.Kf[e],"aria-label":v.Kf[e],"aria-pressed":E.theme===e,onClick:function(){return Z(function(t){return(0,l.Z)((0,i.Z)({},t),{theme:e})})},className:"w-32 h-32 rounded-full bg-gradient-to-br ".concat(v.K$[e]," transition ").concat(E.theme===e?"ring-2 ring-offset-2 ring-primary-main":"")},e)})})]}),(0,d.jsx)(g.gN,{label:"ترتیب نمایش",children:(0,d.jsx)(g.II,{inputMode:"numeric",value:String(E.sortOrder),onChange:function(e){return Z(function(t){return(0,l.Z)((0,i.Z)({},t),{sortOrder:Number(_(e.target.value))||0})})}})}),(0,d.jsx)(g.ZD,{checked:E.isActive,onChange:function(e){return Z(function(t){return(0,l.Z)((0,i.Z)({},t),{isActive:e})})},label:E.isActive?"فعال":"غیرفعال — به هیچ کاربری نمایش داده نمی‌شود"})]}),!!O&&(0,d.jsx)("p",{className:"md:col-span-2 text-13 text-[#C62828]",children:O}),(0,d.jsxs)("div",{className:"md:col-span-2 flex items-center justify-between",children:[!!p&&(0,d.jsx)(g.zx,{type:"button",variant:"danger",onClick:function(){return F.apply(this,arguments)},children:"حذف"}),(0,d.jsxs)("div",{className:"flex items-center gap-x-10 mr-auto",children:[(0,d.jsx)(g.zx,{type:"button",variant:"secondary",onClick:y,children:"انصراف"}),(0,d.jsx)(g.zx,{type:"submit",disabled:B,children:B?"در حال ذخیره...":"ذخیره"})]})]})]})})}function R(e){var t=e.gateways,n=e.onEdit;return(0,d.jsxs)(g.Zb,{className:"p-20",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-16",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-16 leading-24 font-m text-black",children:"درگاه‌ها"}),(0,d.jsx)("p",{className:"text-12 leading-20 text-gray-9B9BAA",children:"درگاه‌های پرداخت آنلاینی که می‌توانند به کاربر پیشنهاد شوند."})]}),(0,d.jsxs)(g.zx,{onClick:function(){return n("new")},children:[(0,d.jsx)("i",{className:"icon-Plus text-16"})," درگاه جدید"]})]}),0===t.length?(0,d.jsx)(g.ub,{text:"درگاهی ثبت نشده"}):(0,d.jsx)("div",{className:"grid md:grid-cols-2 gap-10",children:t.map(function(e){return(0,d.jsxs)("button",{type:"button",onClick:function(){return n(e)},className:"flex items-center gap-x-12 p-12 rounded-12 border border-gray-E5E5E6 hover:border-primary-main transition text-right",children:[(0,d.jsx)("span",{className:"w-40 h-40 rounded-10 bg-[#E8F1FF] text-[#1B4F9C] flex items-center justify-center shrink-0",children:(0,d.jsx)("i",{className:"icon-Pay text-22"})}),(0,d.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"block text-14 leading-22 font-m text-black truncate",children:e.title}),(0,d.jsx)("span",{className:"block text-11 leading-18 text-gray-9B9BAA",children:k(e.provider)})]}),e.isActive?(0,d.jsx)(g.Ct,{tone:"green",children:"فعال"}):(0,d.jsx)(g.Ct,{tone:"gray",children:"غیرفعال"})]},e.id)})})]})}function z(e){var t,n,r,s,o=e.gateway,x=e.onClose,m=e.onSaved,b=(0,c.Z)((0,h.useState)({provider:null!==(t=null==o?void 0:o.provider)&&void 0!==t?t:"zarinpal",title:null!==(n=null==o?void 0:o.title)&&void 0!==n?n:"زرین‌پال",isActive:null===(r=null==o?void 0:o.isActive)||void 0===r||r,sortOrder:null!==(s=null==o?void 0:o.sortOrder)&&void 0!==s?s:0}),2),p=b[0],v=b[1],y=(0,c.Z)((0,h.useState)(!1),2),j=y[0],N=y[1],E=(0,c.Z)((0,h.useState)(null),2),Z=E[0],A=E[1];function B(){return(B=(0,a.Z)(function(e){var t;return(0,u.__generator)(this,function(n){switch(n.label){case 0:e.preventDefault(),N(!0),A(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,(0,f.SC)(o?"".concat(w,"/gateways/").concat(o.id):"".concat(w,"/gateways"),{method:o?"PATCH":"POST",body:JSON.stringify((0,l.Z)((0,i.Z)({},p),{title:p.title.trim()}))})];case 2:return n.sent(),m(),[3,5];case 3:return A((t=n.sent())instanceof Error?t.message:"خطا در ذخیره"),[3,5];case 4:return N(!1),[7];case 5:return[2]}})})).apply(this,arguments)}function S(){return(S=(0,a.Z)(function(){var e;return(0,u.__generator)(this,function(t){switch(t.label){case 0:if(!o||!window.confirm("این درگاه حذف شود؟ از هر دو بخش پرداخت هم برداشته می‌شود."))return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,(0,f.SC)("".concat(w,"/gateways/").concat(o.id),{method:"DELETE"})];case 2:return t.sent(),m(),[3,4];case 3:return A((e=t.sent())instanceof Error?e.message:"حذف نشد"),[3,4];case 4:return[2]}})})).apply(this,arguments)}return(0,d.jsx)(g.u_,{open:!0,onClose:x,title:o?"ویرایش درگاه":"درگاه جدید",children:(0,d.jsxs)("form",{onSubmit:function(e){return B.apply(this,arguments)},className:"flex flex-col gap-y-12",children:[(0,d.jsx)(g.gN,{label:"سرویس‌دهنده",children:(0,d.jsx)(g.Ph,{className:"w-full",value:p.provider,onCh
1ange:function(e){var t=e.target.value;v(function(e){return(0,l.Z)((0,i.Z)({},e),{provider:t,title:e.title&&e.title!==k(e.provider)?e.title:k(t)})})},children:C.map(function(e){return(0,d.jsx)("option",{value:e.value,children:e.label},e.value)})})}),(0,d.jsx)(g.gN,{label:"عنوان نمایشی برای کاربر",children:(0,d.jsx)(g.II,{value:p.title,onChange:function(e){return v(function(t){return(0,l.Z)((0,i.Z)({},t),{title:e.target.value})})},required:!0})}),(0,d.jsx)(g.gN,{label:"ترتیب نمایش",children:(0,d.jsx)(g.II,{inputMode:"numeric",value:String(p.sortOrder),onChange:function(e){return v(function(t){return(0,l.Z)((0,i.Z)({},t),{sortOrder:Number(_(e.target.value))||0})})}})}),(0,d.jsx)(g.ZD,{checked:p.isActive,onChange:function(e){return v(function(t){return(0,l.Z)((0,i.Z)({},t),{isActive:e})})},label:p.isActive?"فعال":"غیرفعال"}),!!Z&&(0,d.jsx)("p",{className:"text-13 text-[#C62828]",children:Z}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[!!o&&(0,d.jsx)(g.zx,{type:"button",variant:"danger",onClick:function(){return S.apply(this,arguments)},children:"حذف"}),(0,d.jsxs)("div",{className:"flex items-center gap-x-10 mr-auto",children:[(0,d.jsx)(g.zx,{type:"button",variant:"secondary",onClick:x,children:"انصراف"}),(0,d.jsx)(g.zx,{type:"submit",disabled:j,children:j?"در حال ذخیره...":"ذخیره"})]})]})]})})}},48228:function(e,t,n){"use strict";n.d(t,{D:function(){return h}});var r=n(67294),a=n(464),s=n(32161),i=n(89886),l=n(30081),c=n(33989);class o extends c.l{constructor(e,t){super(),this.client=e,this.setOptions(t),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var t;let n=this.options;this.options=this.client.defaultMutationOptions(e),(0,s.VS)(n,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),null==(t=this.currentMutation)||t.setOptions(this.options)}onUnsubscribe(){if(!this.listeners.length){var e;null==(e=this.currentMutation)||e.removeObserver(this)}}onMutationUpdate(e){this.updateResult();let t={listeners:!0};"success"===e.type?t.onSuccess=!0:"error"===e.type&&(t.onError=!0),this.notify(t)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(e,t){return this.mutateOptions=t,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,{...this.options,variables:void 0!==e?e:this.options.variables}),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){let e=this.currentMutation?this.currentMutation.state:(0,i.R)(),t={...e,isLoading:"loading"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset};this.currentResult=t}notify(e){l.V.batch(()=>{if(this.mutateOptions&&this.hasListeners()){var t,n,r,a,s,i,l,c;e.onSuccess?(null==(t=(n=this.mutateOptions).onSuccess)||t.call(n,this.currentResult.data,this.currentResult.variables,this.currentResult.context),null==(r=(a=this.mutateOptions).onSettled)||r.call(a,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)):e.onError&&(null==(s=(i=this.mutateOptions).onError)||s.call(i,this.currentResult.error,this.currentResult.variables,this.currentResult.context),null==(l=(c=this.mutateOptions).onSettled)||l.call(c,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context))}e.listeners&&this.listeners.forEach(e=>{e(this.currentResult)})})}}var u=n(85945),d=n(24798);function h(e,t,n){let i=(0,s.lV)(e,t,n),c=(0,u.NL)({context:i.context}),[h]=r.useState(()=>new o(c,i));r.useEffect(()=>{h.setOptions(i)},[h,i]);let m=(0,a.$)(r.useCallback(e=>h.subscribe(l.V.batchCalls(e)),[h]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),b=r.useCallback((e,t)=>{h.mutate(e,t).catch(x)},[h]);if(m.error&&(0,d.L)(h.options.useErrorBoundary,[m.error]))throw m.error;return{...m,mutate:b,mutateAsync:m.mutate}}function x(){}}},function(e){e.O(0,[9791,9759,3632,9774,2888,179],function(){return e(e.s=93672)}),_N_E=e.O()}]);

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.