PageSourceSearch

https://arzancell.com/wp-content/themes/onum/custom/panel/pages/user-information/template.js?ver=20,3,24

js arzancell.com collected 2026-10-02 20:39:05 UTC 12,392 bytes, 281 lines download raw bytes

1import {handleBtnLoading} from 'utils-utils';
2import {BASE_URL} from 'config';
3import { setUserRefundAPI , setUserInformationAPI , getUserInformationAPI , getRefundListAPI } from "api-virtual-number";
4import { loading } from "panel-components-loading";
5
6
7export function formatCardNumber(input, index) {
8    input.value = input.value.replace(/[^0-9]/g, '');
9
10    if (input.value.length === 4 && index < 3) {
11        document.querySelectorAll('input.number')[index + 1].focus();
12    }
13}
14
15
16export function formatAmountNumber(input, index) {
17    let value = input.value.replace(/[^0-9]/g, '');
18
19    value = value.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
20
21    input.value = value;
22
23}
24export function userinformationTemplate() {
25    let mobile = localStorage.getItem("mobile");
26    let cardChunks = ['', '', '', ''];
27    let refundList = '';
28    let TableRow = document.querySelector('.refund-list table tbody tr');
29    let wallet = '';
30    loading(TableRow);
31    getUserInformationAPI(mobile,async (isOk, res) => {
32        // ? ---------- Handle Response ----------
33        if (isOk) {
34            if (res["success"]) {
35                let data = res["message"]['data'];
36                let cardNumebr = data['card_number'] || '';
37                let cardNumberStr = cardNumebr.toString();
38                cardChunks = [
39                    cardNumberStr.slice(0, 4),
40                    cardNumberStr.slice(4, 8),
41                    cardNumberStr.slice(8, 12),
42                    cardNumberStr.slice(12, 16)
43                ];
44                document.querySelectorAll('input.number').forEach((input, index) => {
45                    input.value = cardChunks[index];
46                });
47
48                document.querySelector('.wallet b').textContent = data['wallet'].toLocaleString();
49            }
50            // ? ---------- Handle Error ----------
51        } else {
52            alert("خطا در ثبت اطلاعات");
53        }
54    });
55
56    getRefundListAPI(mobile , async (isOk, res) => {
57        if (isOk){
58            if (res["success"]) {
59                refundList = res["message"]['data'];
60
61                let refundTable = '';
62                if (refundList.length > 0) {
63                    refundList.forEach((refund) => {
64                        const {id, amount, statusLabelRaw, statusLabel, description, createdAt} = refund;
65                        refundTable += `
66                                           <tr>
67                                               <td>
68                                                    <div>
69                                                        <span>${id}</span>
70                                                    </div>
71                                               </td>
72                                               <td>
73                                                    <div>
74                                                        <span>${statusLabel}</span>
75                                                    </div>
76                                               </td>
77                                               <td>
78                                                    <div>
79                                                        <span>${amount.toLocaleString()}</span>
80                                                    </div>
81                                               </td>
82                                               <td>
83                                                    <div>
84                                                        <span>${description}</span>
85                                                    </div>
86                                               </td>
87                                               <td>
88                                                    <div>
89                                                        <span>${createdAt}</span>
90                                                    </div>
91                                               </td>
92                                           </tr>
93                        `;
94                    });
95                }else{
96                    refundTable += `<tr class="table-msg-box">
97                                        <td colspan="5">درخواستی برای شما ثبت نشده است</td>
98                                    </tr>`;
99                }
100                document.querySelector('.refund-list table tbody').innerHTML = refundTable;
101
102            }
103        }
104    });
105    let output = `
106        <div class="box-form">
107            <div class="alert-box alert-info" style="margin-bottom: 10px !important">در صورت درخواست برای استرداد وجه شماره کارت و مبلغ درخواستی خود را وارد نمایید</div>
108            <div class="alert-box alert-info" style="margin-bottom: 10px !important">
109              <ul style="text-align: right">
110               <li>مبلغ درخواست بازگشت وجه باید بیش از ۱۰٬۰۰۰ تومان باشد.</li>
111               <li>شماره کارتی که با آن پرداخت انجام داده‌اید باید وارد شود؛ در غیر این صورت درخواست قابل بررسی نیست.</li>
112               <li>فرآیند بازگشت وجه بین ۱ الی ۷ روز کاری زمان خواهد برد.</li>
113              </ul>
114            </div>
115        </div>  
116        <div class="refund-list box-table" style="margin-top: 50px">
117            <table>
118               <thead>
119                 <tr>
120                   <th>شناسه</th>
121                   <th>وضعیت</th>
122                   <th>مبلغ</th>
123                   <th>توضیحات</th>
124                   <th>زمان ایجاد</th>
125                 </tr>
126               </thead>
127               <tbody>
128                  <tr class="table-msg-box">
129                        <td colspan="5"></td>
130                  </tr>
131               </tbody>
132            </table>
133        </div>   
134    `;
135
136
137    return output;
138
139}
140
141export function pasteWallet(){
142    let wallet = jQuery('.wallet b').text();
143    jQuery('.amount-number').val(wallet);
144}
145export function submitUserInfo() {
146    handleBtnLoading(jQuery("#btn-user-info"), 10);
147    const cart = document.getElementsByClassName('number');
148    let cardNumber = '';
149    for (let i = 0; i < cart.length; i++) {
150        cardNumber += cart[i].value;
151    }
152    if (cardNumber.length !== 16) {
153
154        if (jQuery.Toast()) {
155            jQuery(".toast-item-wrapper").remove();
156            jQuery.Toast("هشدار", "لطفاً فیلد شماره کارت را تکمیل کنید", "warning");
157        }
158        return;
159    }
160
161    let mobile = localStorage.getItem("mobile");
162    let userToken = localStorage.getItem("uwt");
163    setUserInformationAPI(mobile,userToken ,cardNumber ,async (isOk, res) => {
164        // ? ---------- Handle Response ----------
165        if (isOk) {
166            if (res["success"]) {
167                jQuery.Toast("موفق", "درخواست شما با موفقیت ثبت شد", "success");
168            }else {
169                jQuery.Toast("هشدار", res["message"]["message"], "warning");
170            }
171            // ? ---------- Handle Error ----------
172        } else {
173
174            jQuery.Toast("هشدار", "خطا در ثبت درخواست", "warning");
175        }
176    });
177    handleBtnLoading(jQuery("#btn-user-info"), 0);
178}
179
180// export function submitRefund() {
181//     handleBtnLoading(jQuery("#btn-refound"), 10);
182//     const cart = document.getElementsByClassName('number');
183//     let amountElement = document.getElementsByClassName('amount-number');
184//     let cardNumber = '';
185//     for (let i = 0; i < cart.length; i++) {
186//         cardNumber += cart[i].value;
187//     }
188//     if (cardNumber.length !== 16) {
189//
190//         if (jQuery.Toast()) {
191//             jQuery(".toast-item-wrapper").remove();
192//             jQuery.Toast("هشدار", "لطفاً فیلد شماره کارت را تکمیل کنید", "warning");
193//         }
194//         return;
195//     }
196//     let amount = amountElement[0].value;
197//     amount = amount.replace(/,/g, '');
198//     if (amount.length == 0){
199//         if (jQuery.Toast()) {
200//             jQuery(".toast-item-wrapper").remove();
201//             jQuery.Toast("هشدار", "لطفاً ملبغ درخواستی را وارد نمایید", "warning");
202//         }
203//         return;
204//     }
205//
206//     let mobile = localStorage.getItem("mobile");
207//     let userToken = localStorage.getItem("uwt");
208//     setUserRefundAPI(mobile,userToken ,cardNumber , amount ,async (isOk, res) => {
209//         // ? ---------- Handle Response ----------
210//         if (isOk) {
211//             if (res["success"]) {
212//                 jQuery.Toast("موفق", res["message"]["message"], "success");
213//             }else {
214//                 jQuery.Toast("هشدار", res["message"]["message"], "warning");
215//             }
216//             amountElement[0].value = '';
217//             // ? ---------- Handle Error ----------
218//
219//             //*******
220//             let refundList = '';
221//             getRefundListAPI(mobile , async (isOk, res) => {
222//                 if (isOk){
223//                     if (res["success"]) {
224//                         refundList = res["message"]['data'];
225//
226//                         let refundTable = '';
227//                         if (refundList.length > 0) {
228//                             refundList.forEach((refund) => {
229//                                 const {id, amount, statusLabelRaw, statusLabel, description, createdAt} = refund;
230//                                 refundTable += `
231//                                            <tr>
232//                                                <td>
233//                                                     <div>
234//                                                         <span>${id}</span>
235//                                                     </div>
236//                                                </td>
237//                                                <td>
238//                                                     <div>
239//                                                         <span>${statusLabel}</span>
240//                                                     </div>
241//                                                </td>
242//                                                <td>
243//                                                     <div>
244//                                                         <span>${amount.toLocaleString()}</span>
245//                                                     </div>
246//                                                </td>
247//                                                <td>
248//                                                     <div>
249//                                                         <span>${description}</span>
250//                                                     </div>
251//                                                </td>
252//                                                <td>
253//                                                     <div>
254//                                                         <span>${createdAt}</span>
255//                                                     </div>
256//                                                </td>
257//                                            </tr>
258//                         `;
259//                             });
260//                         }else{
261//                             refundTable += `<tr class="table-msg-box">
262//                                         <td colspan="5">درخواستی برای شما ثبت نشده است</td>
263//                                     </tr>`;
264//                         }
265//                         document.querySelector('.refund-list table tbody').innerHTML = refundTable;
266//
267//                     }
268//                 }
269//             });
270//         } else {
271//
272//             jQuery.Toast("هشدار", "خطا در ثبت درخواست", "warning");
273//             amountElement[0].value = '';
274//         }
275//     });
276//
277//     handleBtnLoading(jQuery("#btn-refound"), 0);
278//
279//
280// }
281

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.