1/* 2import {PAGE_URL, CURRENT_URL} from '../../config.js'; 3import { 4 separate, 5 shortNumberDisplay, 6 enterConvertToList, 7 handleBtnLoading, 8 showModal, 9 closeModal, 10 // Constants 11 modalBody, 12 regExpEmail, 13 regExpPhone, 14 handleSlider, 15} from '../../utils/utils.js'; 16import {getServicesAPI, getInstagramEmbedAPI, discountCheckAPI, orderAPI} from '../../API/api-services.js?ver=1.0.0'; 17import {handleActiveMobile} from '../../API/api-auth.js'; 18import {handleVoiceList} from './voice-list.js'; 19import {handleQualityOfServices} from './quality-of-services.js'; 20 21/!* 22 # How to add a new service 23 - Add new page in Elementor 24 - Add new path in switch statement 25 - If change url path must go to footer.php and add path in if statement's services 26 27*!/ 28jQuery(document).ready(function ($) { 29 let quality_source = []; 30 let voice_source = []; 31 32 $('.block-go-comments').css('display', 'none'); 33 34 getServices({post_id: flw_post_id}); 35 if (PAGE_URL === 'buy-pubg-uc' || PAGE_URL === 'buy-free-fire-gem') 36 $('body').addClass('game-services') 37 38 // ? ========== Switch current URL -> show services ========== 39 // switch (PAGE_URL) { 40 // // ---------- Instagram ---------- 41 // // Instagram follower 42 // case 'buy-instagram-pages': 43 // getServices('buy-instagram-pages', 'Ø¢ÛØ¯Û Ù¾ÛØ¬', 'bg-follower'); 44 // break; 45 // // Instagram follower 46 // case 'buy-instagram-follower': 47 // getServices('ig-follower', 'Ø¢ÛØ¯Û Ù¾ÛØ¬', 'bg-follower'); 48 // break; 49 // // Instagram like 50 // case 'buy-instagram-like': 51 // getServices('ig-like', 'ÙÛÙÚ© پست', 'bg-like', 'active_check_link', flw_post_id); 52 // break; 53 // // Instagram comment 54 // case 'buy-instagram-comment': 55 // getServices('instagram-comment', 'ÙÛÙÚ© پست', 'bg-comment', 'active_check_link'); 56 // break; 57 // // Instagram video view 58 // case 'buy-instagram-video-view': 59 // getServices('ig-video-view', 'ÙÛÙÚ© پست', 'bg-view', 'active_check_link'); 60 // 61 // break; 62 // // Instagram IGTV comments 63 // case 'buy-igtv-comments': 64 // getServices('instagram-comment-igtv', 'ÙÛÙÚ© IGTV', 'bg-follower', 'active_check_link'); 65 // break; 66 // // Instagram IGTV view 67 // case 'buy-igtv-views': 68 // getServices('view-igtv-instagram', 'ÙÛÙÚ© IGTV', 'bg-like', 'active_check_link'); 69 // break; 70 // // Instagram IGTV like 71 // // case 'buy-igtv-like': 72 // // getServices( 73 // // 'instagram-like-igtv', 74 // // 'ÙÛÙÚ© IGTV', 75 // // 'bg-like-igtv', 76 // // 'active_check_link' 77 // // ); 78 // // break; 79 // 80 // // Instagram impression 81 // case 'buy-instagram-impression': 82 // getServices('buy-instagram-impression', 'ÙÛÙÚ© پست', 'bg-view'); 83 // break; 84 // // Instagram comment likes 85 // case 'buy-instagram-comment-likes': 86 // getServices('buy-instagram-comment-likes', 'ÙÛÙÚ© پست', 'bg-story', 'active_check_link'); 87 // break; 88 // // Instagram saves 89 // case 'buy-instagram-saves': 90 // getServices('buy-Instagram-save', 'ÙÛÙÚ© پست', 'bg-like', 'active_check_link'); 91 // break; 92 // // Instagram sharing posts 93 // case 'buy-instagram-sharing-posts': 94 // getServices('shares-instagram', 'ÙÛÙÚ© پست', 'bg-story', 'active_check_link'); 95 // break; 96 // 97 // // Instagram live views 98 // case 'buy-instagram-live-views': 99 // getServices('buy-instagram-live-views', 'Ø¢ÛØ¯Û Ù¾ÛØ¬', 'bg-story'); 100 // break; 101 // // Instagram highlight views 102 // case 'buy-instagram-higlight-views': 103 // getServices('instagram-highlight-view', 'Highlight link', 'bg-member'); 104 // break; 105 // // Instagram story 106 // case 'buy-instagram-story': 107 // getServices('buy-instagram-view-story', 'Ø¢ÛØ¯Û Ù¾ÛØ¬', 'bg-story'); 108 // break; 109 // // Instagram story poll votes 110 // case 'buy-instagram-story-poll-votes': 111 // getServices('instagram-story-left', 'ÙÛÙÚ© Ø§Ø³ØªÙØ±Û', 'bg-story'); 112 // break; 113 // 114 // // ---------- Telegram ---------- 115 // // Telegram group member 116 // case 'buy-telegram-group-member': 117 // getServices('tlg-group-member', 'ÙÛÙÚ© گرÙÙ', 'bg-member'); 118 // break; 119 // // Telegram channel member 120 // case 'buy-telegram-channel-member': 121 // getServices('tlg-channel-member', 'ÙÛÙÚ© Ú©Ø§ÙØ§Ù', 'bg-member'); 122 // break; 123 // // Telegram post view 124 // case 'buy-telegram-view': 125 // getServices('telegram-post-view', 'ÙÛÙÚ© پست', 'bg-view'); 126 // break; 127 // 128 // // ---------- Aparat ---------- 129 // // Aparat video view 130 // case 'buy-aparat-view': 131 // getServices('buy-aparat-view', 'ÙÛÙÚ© ÙÛØ¯ÛÙ', 'bg-view'); 132 // break; 133 // 134 // // ---------- Clubhouse ---------- 135 // // Clubhouse followers 136 // case 'buy-clubhouse-followers': 137 // getServices('follower-club-house', 'ÙØ§Ù کاربرÛ', 'bg-view'); 138 // break; 139 // 140 // // ---------- Youtube ---------- 141 // // Youtube subscribe 142 // case 'buy-youtube-subscribe': 143 // getServices('', 'ÙÛÙÚ© Ú©Ø§ÙØ§Ù', 'bg-follower'); 144 // break; 145 // 146 // // Youtube like 147 // case 'buy-youtube-like': 148 // getServices('', 'ÙÛÙÚ© ÙÛØ¯ÛÙ', 'bg-like'); 149 // break; 150 // 151 // // Youtube watch-time 152 // case 'buy-youtube-watch-time': 153 // getServices('', 'ÙÛÙÚ© ÙÛØ¯ÛÙ', 'bg-like'); 154 // break; 155 // 156 // // ---------- Game ---------- 157 // // buy-pubg-uc 158 // case 'buy-pubg-uc': 159 // $('body').addClass('game-services') 160 // getServices('ig-follower', 'ÙÛÙÚ©', 'bg-pubg'); 161 // break; 162 // 163 // // buy-free-fire-gem 164 // case 'buy-free-fire-gem': 165 // $('body').addClass('game-services') 166 // getServices('ig-follower', 'ÙÛÙÚ©', 'bg-free-fire'); 167 // break; 168 // 169 // // buy-steam-wallet 170 // case 'buy-steam-wallet': 171 // $('body').addClass('game-services') 172 // getServices('ig-follower', 'ÙÛÙÚ©', 'bg-steam-wallet'); 173 // break; 174 // 175 // // buy-gift-card-minecraft 176 // case 'buy-gift-card-minecraft': 177 // $('body').addClass('game-services') 178 // getServices('ig-follower', 'ÙÛÙÚ©', 'bg-minecraft'); 179 // break; 180 // 181 // // buy-apex-coin 182 // case 'buy-apex-coin': 183 // $('body').addClass('game-services') 184 // getServices('ig-follower', 'ÙÛÙÚ©', 'bg-apex-coin'); 185 // break; 186 // 187 // // buy-rainbow-six-siege-credits-money 188 // case 'buy-rainbow-six-siege-credits-money': 189 // $('body').addClass('game-services') 190 // getServices('ig-follower', 'ÙÛÙÚ©', 'bg-rainbow'); 191 // break; 192 // 193 // // buy-fortnite-vbucks 194 // case 'buy-fortnite-vbucks': 195 // $('body').addClass('game-services') 196 // getServices('ig-follower', 'ÙÛÙÚ©', 'bg-fortnite'); 197 // break; 198 // 199 // // buy-clash-royale-gem 200 // case 'buy-clash-royale-gem': 201 // $('body').addClass('game-services') 202 // getServices('ig-follower', 'ÙÛÙÚ©', 'bg-clash-royale'); 203 // break; 204 // default: 205 // break; 206 // } 207 208 // ? ========== Services Template ========== 209 function servicesTemplate() { 210 var currency = ['تÙ٠اÙ']; 211 const { 212 id, 213 name, 214 quantity, 215 description, 216 short_description, 217 discount, 218 old_price, 219 new_price, 220 regex, 221 service_type, 222 template_link, 223 } = this; 224 225 // Change input placeholder 226 $('input#form-field-link').attr('placeholder', template_link); 227 228 let output = ` 229 <div data-service-content='${id}'> 230 <div class="box-pricing-table"> 231 <div class="pricing-table-header"> 232 <div class="service-qty" data-qty="${separate(quantity)}">${(service_type == '2' || service_type == '3') ? separate(quantity) : shortNumberDis
232play(quantity)}</div> 233 <div class="service-name">${name}</div> 234 </div> 235 <div class="pricing-table-body">`; 236 // if (discount > 0) { 237 output += ` 238 <!-- <div class="service-discount-qty"> 239 <span>تخÙÛÙ</span> 240 <span>%</span> 241 <span>${discount}</span> 242 </div> --> 243 244 245 <div class="service-original-price"> 246 <span class="original-price">${separate(old_price)}</span> 247 <span class="service-currency">${old_price > 0 ? currency[0] : ''}</span> 248 </div>`; 249 // } 250 251 output += ` 252 <div class="service-discount-price"> 253 <span class="discount-price">${separate(new_price)}</span> 254 <span class="service-currency">${currency[0]}</span> 255 </div> 256 257 258 <div class="service-description d-none"> 259 ${enterConvertToList(description)} 260 </div> 261 262 <!--<div class="service-short-description"> 263 </div>--> 264 </div> 265 266 <div class="pricing-table-footer"> 267 <span class="service-code d-none">${id}</span> 268 <a class="btn-buy" href="#buy-form">Ù Ø´Ø§ÙØ¯Ù ØªÙØ¶ÛØØ§Øª</a> 269 <!-- <button class="btn-buy btn_primary">Ø®Ø±ÛØ¯</button> --> 270 <button class="btn-buy btn_primary"> 271 <img src="https://followeran.com/wp-content/uploads/2022/04/btn-buy.png" alt="btn-buy"> 272 </button> 273 </div> 274 </div> 275 </div>`; 276 277 return output; 278 } 279 280 // ? ========== Data Table Services Template ========== 281 function dataTableServicesTemplate() { 282 const {quantity, new_price} = this; 283 let output = ` 284 <tr> 285 <td>${separate(quantity)}</td> 286 <td>${separate(new_price)}</td> 287 </tr>`; 288 return output; 289 } 290 291 // ? ========== Data Table Services Template ========== 292 function descriptionServiceTemplate() { 293 const {item, value} = this; 294 let output = ` 295 <div class="description-item"> 296 <span>${item}</span> 297 <span>${separate(value)}</span> 298 </div>`; 299 return output; 300 } 301 302 // ? ========== Handle Get Services ========== 303 function getServices({post_id}) { 304 $('#block-service').prepend(`<div class='service-categories'></div>`); 305 $('#block-service').append(`<div class='service-description-box'></div>`); 306 307 // ! ========== Handle get services request ========== 308 getServicesAPI(post_id, async (isOk, res) => { 309 var input_label = res['flw_input_label'] 310 var bg_header = res['flw_bg_header'] 311 var check_link = res['flw_check_link'] || 0 312 313 314 // Create btn close buy form element 315 $('.box-buy-form').prepend(` 316 <button class="btn btn-primary" id="btn-close-buy-form"> 317 <i class="fa fa-times"></i> 318 <span>بستÙ</span> 319 </button> 320 `) 321 322 // Change label 323 $('label[for="form-field-link"]').text(input_label); 324 325 // Stop loading 326 $('.services-loading .cell').hide(); 327 $('.data-table-loading .cell').hide(); 328 $('.container-voice .cell').hide(); 329 $('.container-quality .cell').hide(); 330 331 // ? ---------- Handle Response ---------- 332 if (isOk) { 333 let result = res['data']['message']; 334 let group_services = result['group_services']; 335 336 // console.log(result); 337 338 if (group_services.length <= 0) { 339 // Show message 340 if ($.Toast()) { 341 $('.toast-item-wrapper').remove(); 342 $.Toast('ÙØ´Ø¯Ø§Ø±', 'سرÙÛØ³Û Ø¨Ø±Ø§Û ÙÙ Ø§ÛØ´ ÙØ¬Ùد ÙØ¯Ø§Ø±Ø¯!', 'warning'); 343 } 344 } else { 345 let len = 0; 346 let serviceType = null 347 $(group_services).each(function (index, service) { 348 // // Button tab services 349 // $('.service-categories').prepend(` 350 // <button class='btn' data-service-tab='${service['id']}'>${service['name']}</button> 351 // `); 352 353 $('#box-services .elementor-widget-wrap').append(` 354 <div class='service-container-block' data-service-type=""> 355 <h2 class='service-title-box'>Ø®Ø±ÛØ¯ ${service['name']}</h2> 356 <div class="block_description_items description-items-box" id='description_items-${service['id']}'></div> 357 <div class='service-container-box' id='service-${service['id']}'></div> 358 </div> 359 `); 360 361 $(result['services']).each(function (index, item) { 362 serviceType = item.service_type 363 364 // Service Type => 2 -> Pubg --- 3 -> Free Fire --- 5 -> Buy Instagram Page --- ? -> Normal 365 if (serviceType == '2' || serviceType == '3') { 366 // console.log(result['services']) 367 368 // Removing description items 369 $('.block_description_items').remove() 370 371 if (item.additional_link == 1) { 372 // $('#form-field-link').parent().parent().prepend(` 373 $('#form-field-link').parent('.elementor-col-40').after(` 374 <div class="elementor-field-type-text elementor-field-group elementor-column elementor-field-group-link elementor-col-40 elementor-field-required elementor-mark-required"> 375 <label for="form-field-additional-link" class="elementor-field-label"></label> 376 <input size="1" type="text" name="form_fields[additional_link]" id="form-field-additional-link" class="elementor-field elementor-size-md elementor-field-textual" required="required"> 377 </div> 378 `) 379 } else if (item.additional_link == 2) { 380 $('#form-field-link').parent('.elementor-col-40').after(` 381 <div class="elementor-field-type-textarea elementor-field-group elementor-column elementor-field-group-additional-link elementor-col-40 elementor-field-required elementor-mark-required"> 382 <label for="form-field-additional-link" class="elementor-field-label"></label> 383 <textarea class="elementor-field-textual elementor-field elementor-size-md" name="form_fields[additional_link]" id="form-field-additional-link" rows="1" required="required"></textarea> 384 </div> 385 `) 386 } 387 388 // Change label and placeholder 389 $('label[for="form-field-link"]').text(item.link_label); 390 $('#form-field-link').attr('placeholder', item.template_link); 391 $('label[for="form-field-additional-link"]').text(item.additional_label); 392 $('#form-field-additional-link').attr('placeholder', item.template_link_additional); 393 } else if (serviceType == '5') { 394 $('#form-field-link').val('buy-instagram-pages') 395 $('#form-field-link').parent('.elementor-col-40').hide() 396 } 397 if (service['id'] == item['id']) { 398 // Push data to template 399 let data = servicesTemplate.apply(item); 400 $(`#box-services #service-${service['id']}`).append(data); 401 len += 1; 402 } 403 }); 404 405 // Handle slider 406 if (len >= 2) { 407 handleSlider(`#box-services #service-${service['id']}`, len); 408 len = 0; 409 } else { 410 $(`#box-services #service-${service['id']}`).css('width', '260px') 411 $(`#box-services #service-${service['id']}`).css('margin', '0 auto') 412 } 413 414 // Change background -> services header 415 $('.box-services .pricing-table-header').css('background', `${bg_header}`); 416 417 // Change border color 418 let current_color = $('.pricing-table-header:first-child').css('background-color') 419 $('body.game-services .box-pricing-table').css('border', `4px solid ${current_color}`) 420 421 422 // Append btn discount 423 $('.elementor-col-66').append(` 424 <div class="discount-box"> 425 <button type="button" class="discount-btn">اع٠اÙ</button> 426 </div> 427 `); 428 429 // Append btn check link 430 $('.elementor-col-40').append(` 431 <div class="check-link-box"> 432 <button type="button" class="btn-check-link d-none">Ø¨Ø±Ø±Ø³Û ÙÛÙÚ©</button> 433 </div> 434 `); 435 436 437 $(service['description_items']).each(function (index, item) { 438 // $('.service-categories').append('<div class="service-description-box"></div>'); 439 $(`#description_items-${service['id']}`).append(descriptionServiceTemplate.apply(item)); 440 }); 441 }); 442 443 // Submit order form 444 handleFormSubmit(check_link, serviceType); 445 446 447 // Call handle file attachment 448 handleFileAttachment(group_services); 449 450 $('[name=buy-form]').prepend(`<div class="form-service-name"></div>`) 451 } 452 453 if (result['services'].length <= 0) { 454 $('#block-service').html( 455 '<div class="alert-box alert-info">Ù ØªØ£Ø³ÙØ§Ù٠در ØØ§Ù ØØ§Ø¶Ø± سرÙÛØ³Û ÙØ¬Ùد ÙØ¯Ø§Ø±Ø¯!</div>' 456 ); 457 458 // $('#data-table-services').append( 459 // `<div class="alert-box alert-info">Ø§Ø·ÙØ§Ø¹Ø§ØªÛ Ø¨Ø±Ø§Û ÙÙ Ø§ÛØ´ ÙØ¬Ùد ÙØ¯Ø§Ø±Ø¯!</div>` 460 // ); 461 462 // Hiding buy form 463 $('[name^=buy-form]').hide(); 464 } else if (res['data']['success']) { 465 $(result['services']).each(function (index, element) { 466 // Push data to template 467 // let data = servicesTemplate.apply(element); 468 // $('#box-services .elementor-widget-wrap').append(data); 469 470 // let dataTable = dataTableServicesTemplate.apply(element); 471 // $('#data-table-services').append(dataTable); 472 }); 473 474 // handleShowTabServices( 475 // '#box-services .elementor-widget-wrap', 476 // result['services'], 477 // bg_header, 478 // check_link 479 // ); 480 481 482 // $('#box-services .elementor-widget-wrap').slick('unslick'); 483 // Service slider 484 485 // Service slider 486 // if (result['services'].length >= 2) { 487 // handleSlider('#box-services .elementor-widget-wrap', result['services'].length); 488 // } 489 490 // function handleShowTabServices(serviceId) { 491 // // console.log($('[data-service-tab]').attr('data-service-tab')); 492 // if ($('[data-service-tab]').attr('data-service-tab') == serviceId) { 493 // // if ($('[data-service-content]').attr('data-service-content') == serviceId) { 494 // console.log(serviceId); 495 // } 496 // } 497 } 498 499 // ? ---------- Handle Error ---------- 500 } else { 501 // Show message 502 if ($.Toast()) { 503 $('.toast-item-wrapper').remove(); 504 $.Toast('خطا', 'Ù ØªØ§Ø³ÙØ§ÙÙ Ù Ø´Ú©ÙÛ Ù¾ÛØ´ آ٠د! ÙØ·Ùا Ø¯ÙØ§ÛÙÛ Ø¯Ûگر ٠جددا Ø§Ù ØªØØ§Ù Ú©ÙÛØ¯', 'error'); 505 } 506 507 $('#block-service').html( 508 '<div class="alert-box alert-info">Ù ØªØ£Ø³ÙØ§ÙÙ Ù Ø´Ú©ÙÛ Ù¾ÛØ´ آ٠د! ÙØ·Ùا Ø¯ÙØ§ÛÙÛ Ø¯Ûگر ٠جدد ØµÙØÙ Ø±Ø§ Ø±ÙØ±Ø´ Ú©ÙÛØ¯</div>' 509 ); 510 511 // $('#data-table-services').append(`<div class="alert-box alert-info">Ø§Ø·ÙØ§Ø¹Ø§ØªÛ Ø¨Ø±Ø§Û ÙÙ Ø§ÛØ´ ÙØ¬Ùد ÙØ¯Ø§Ø±Ø¯!</div>`); 512 513 // Hiding buy form 514 $('[name^=buy-form]').hide(); 515 } 516 }); 517 } 518 519 // ? ========== Handle Show Tab Services ========== 520 function handleShowTabServices(elements, data, bg_header, check_link) { 521 let services = ''; 522 $('.service-categories .btn') 523 .click(function () { 524 let len = 0; 525 let that = $(this); 526 527 $(services).find('[data-service-content]').remove(); 528 $(services).html(''); 529 $(services).slick('unslick'); 530 531 services = elements; 532 533 $('[data-service-tab]').removeClass('active'); 534 $(that).addClass('active'); 535 536 $('[data-service-tab]').attr('disabled', false); 537 $(that).attr('disabled', true); 538 539 $(data).each(function (i, element) { 540 // Push data to template 541 let data = servicesTemplate.apply(element); 542 $('#box-services .elementor-widget-wrap').append(data); 543 544 services = $('#box-services .elementor-widget-wrap'); 545 }); 546 547 $(services) 548 .find('[data-service-content]') 549 .each(function (i, element) { 550 if ($(element).attr('data-service-content') == $(that).attr('data-service-tab')) { 551 len += 1; 552 } else { 553 $(element).remove(); 554 } 555 }); 556 557 // $('#box-services .elementor-widget-wrap').not('.slick-initialized').slick() 558 // let current_service = $('[data-service-tab]').css('display') == 'block'; 559 // console.log(current_service); 560 // console.log($('#box-services .elementor-widget-wrap').not('.slick-initialized').slick());; 561 562 if (len >= 2) { 563 handleSlider('#box-services .elementor-widget-wrap', len); 564 len = 0; 565 } 566 567 // Change background -> services header 568 $('.box-services .pricing-table-header').css('background', `${bg_header}`); 569 570 // Change border color 571 let current_color = $('.pricing-table-header:first-child').css('background-color') 572 $('body.game-services .box-pricing-table').css('border', `4px solid ${current_color}`) 573 574 575 // Append btn discount 576 $('.elementor-col-66').append(` 577 <div class="discount-box"> 578 <button type="button" class="discount-btn">اع٠اÙ</button> 579 </div> 580 `); 581 582 // Append btn check link 583 $('.elementor-col-40').append(` 584 <div class="check-link-box"> 585 <button type="button" class="btn-check-link d-none">Ø¨Ø±Ø±Ø³Û ÙÛÙÚ©</button> 586 </div> 587 `); 588 589 // Submit order form 590 handleFormSubmit(check_link); 591 }) 592 .eq(0) 593 .trigger('click'); 594 } 595 596 // ? ========== Handle File Attachment ========== 597 function handleFileAttachment(group_services) { 598 let voice_title, voice_description, quality_title, quality_description 599 600 $(group_services).each(function (index, service) { 601 if (service['attachment'].length > 0) { 602
602 $(service['attachment']).each(function (index, file) { 603 // let mime_type = file['mime_type'].substr(0, file['mime_type'].indexOf('/')); 604 let mime_type = file['mime_type'].substr(0, file['mime_type'].lastIndexOf('/')); 605 606 if (mime_type == 'audio' || mime_type == 'video') { 607 $('.container-voice').addClass('show'); 608 voice_title = `ÙØ¸Ø±Ø§Øª Ú©Ø§Ø±Ø¨Ø±Ø§Ù ÙØ³Ø¨Øª ب٠سرÙÛØ³ ÙØ§Û ${service['name']}`; 609 voice_description = `در اÛ٠بخش ش٠ا Ù Û ØªÙØ§ÙÛØ¯ ÙØ¸Ø±Ø§Øª کاربرا٠سرÙÛØ³ ÙØ§Û <b>${service['name']}</b> را Ù Ø´Ø§ÙØ¯Ù Ú©ÙÛØ¯`; 610 611 voice_source.push({ 612 attachment: file['attachment'], 613 mime_type: file['mime_type'], 614 title: file['title'], 615 }); 616 } else if (mime_type == 'image') { 617 $('.container-quality').addClass('show'); 618 quality_title = `Ú©ÛÙÛØª سرÙÛØ³ ÙØ§Û ${service['name']}`; 619 quality_description = `در اÛ٠بخش ش٠ا Ù Û ØªÙØ§ÙÛØ¯ Ú©ÛÙÛØª سرÙÛØ³ ÙØ§Û <b>${service['name']}</b> را Ù Ø´Ø§ÙØ¯Ù Ú©ÙÛØ¯`; 620 621 quality_source.push({ 622 attachment: file['attachment'], 623 mime_type: file['mime_type'], 624 title: file['title'], 625 }); 626 } 627 }); 628 } 629 }) 630 631 // Handle voice list 632 handleVoiceList(voice_title, voice_description, voice_source); 633 634 // Handle quality of services
635 handleQualityOfServices(quality_title, quality_description, quality_source); 636 637 // Quality of services slider 638 if (quality_source.length >= 2) { 639 handleSlider($('.box-quality'), quality_source.length); 640 } 641 } 642 643 // ? ========== Form Buy Services Page ========== 644 function handleFormSubmit(check_link, serviceType) { 645 // ! ---------- Variables ---------- 646 let discount_code = ''; 647 let qtyBox = $('.qty-box .qty'); 648 let priceOriginalBox = $('.prices-old'); 649 let priceDiscountBox = $('.prices-discount'); 650 var finalPriceBox = $('.final-price').parent(); // Step 1 651 let finalAmountBox = $('.final-amount').parent(); // Step 2 652 var btnDiscount = $('.discount-btn'); 653 var btnCheckLink = $('.btn-check-link'); 654 let serviceCode = ''; 655 let PRICE = 0; 656 let checkDiscount = false; 657 658 // ? ========== Handle show service data box ========== 659 function handleShowServiceDataBox(display) { 660 $('.data-box .price-box').css('display', display); 661 $('.buy-form-alert-box').parent().css('display', display); 662 $('.buy-form-service-description').parent().css('display', display); 663 // $('.block-go-comments').css('display', display); 664 } 665 666 handleShowServiceDataBox('none'); 667 668 // ? ========== Handle show final price ========== 669 function handleShowFinalPrice(display) { 670 finalPriceBox.css('display', display); 671 } 672 673 // ? ========== Handle change discount button value ========== 674 function handleValueDiscountBtn(color, value) { 675 btnDiscount.css('background', color); 676 btnDiscount.text(value); 677 } 678 679 handleValueDiscountBtn('#0097a7', 'اع٠اÙ'); 680 681 // ? ========== Handle Reset button value discount & Hide final price box & Change priceDiscountBox to PRICE ========== 682 $('#form-field-discount').on('input', function () { 683 handleShowFinalPrice('none'); 684 handleValueDiscountBtn('#0097a7', 'اع٠اÙ'); 685 PRICE = priceDiscountBox.text().replaceAll(',', ''); 686 }); 687 688 // ? ========== Fill form filed ========== 689 $('.btn-buy').click(function () { 690 // Showing box buy form 691 $('.box-buy-form').show() 692 693 $('#btn-close-buy-form').click(function () { 694 $('.box-buy-form').hide() 695 }) 696 697 698 // Declare variables -> Get services data 699 let parent = $(this).parents('.box-pricing-table'); 700 let service_name = parent.find('.service-name').text(); 701 let service_qty = parent.find('.service-qty').data('qty'); 702 let service_original_price = parent.find('.original-price').text(); 703 let service_discount_price = parent.find('.discount-price').text(); 704 let service_code = parent.find('.service-code').text(); 705 let service_description = parent.find('.service-description').html(); 706 707 $('.form-service-name').html(`<b>${service_name}</b>`) 708 709 // Scroll to services 710 jQuery('html, body').animate({scrollTop: jQuery('#buy-form').offset().top - 100}, 400); 711 712 qtyBox.text(service_qty); 713 priceOriginalBox.text(service_original_price); 714 priceDiscountBox.text(service_discount_price); 715 serviceCode = service_code; 716 PRICE = priceDiscountBox.text().replaceAll(',', ''); 717 718 // Reset discount button & hide final price box 719 if (PRICE >= 0) { 720 handleShowFinalPrice('none'); 721 handleValueDiscountBtn('#0097a7', 'اع٠اÙ'); 722 } 723 724 // Show description in form buy 725 $('.buy-form-service-description').html(service_description); 726 727 // Handle show service data box 728 handleShowServiceDataBox('block'); 729 730 // Show go to comments link 731 // $('.block-go-comments .go-comments-servic-name').text(`${service_qty} ${service_name}`); 732 733 // Show toast message 734 if ($.Toast()) { 735 $('.toast-item-wrapper').remove(); 736 $.Toast( 737 'راÙÙ٠ا', 738 `سرÙÛØ³ <b>${service_qty} ${service_name}</b> با Ù ÙÙÙÛØª Ø§ÙØ²Ùد٠شد. Ø¨Ø±Ø§Û Ø§Ø¯Ø§Ù Ù ÙØ±Ø§ÛÙØ¯ Ø®Ø±ÛØ¯ ÙØ±Ù Ø²ÛØ± را تک٠ÛÙ Ú©ÙÛØ¯`, 739 'notice' 740 ); 741 } 742 }); 743 744 // ? ========== Check Link ========== 745 // Check link template 746 function CheckLinkTemplate() { 747 let {src} = this; 748 let output = ` 749 <div class="block-check-link"> 750 <div class="block-check-link-img"> 751 <iframe src=${src} frameborder="0" width="500px" height='700px'></iframe> 752 </div> 753 <button type="button" class="btn btn-ok">درستÙ!</button> 754 </div>`; 755 return output; 756 } 757 758 // Check link button 759 if (check_link == 1) { 760 $('#form-field-link').on('input', function () { 761 if ($(this).val() !== '' && $(this).val().trim() !== '') btnCheckLink.removeClass('d-none'); 762 else btnCheckLink.addClass('d-none'); 763 }); 764 } 765 766 // Check link click handler 767 btnCheckLink.click(function () { 768 // Handle btn loading 769 handleBtnLoading(btnCheckLink, 10); 770 771 // ! ========== Handle get instagram embed request ========== 772 getInstagramEmbedAPI($('#form-field-link').val(), async (isOk, res) => { 773 // Handle btn loading 774 handleBtnLoading(btnCheckLink, 0); 775 776 // ? ---------- Handle Response ---------- 777 if (isOk) { 778 let data = res['data']['message']['link']; 779 780 // Show modal 781 showModal('show', 'ÙÙ Ø§ÛØ´ ÙÛÙÚ©'); 782 783 // Push data to template 784 modalBody.append(CheckLinkTemplate.apply({src: data})); 785 786 // Handle close modal check link 787 $('.btn-ok').click(function () { 788 closeModal(); 789 }); 790 // ? ---------- Handle Error ---------- 791 } else { 792 // Show message 793 if ($.Toast()) { 794 $('.toast-item-wrapper').remove(); 795 $.Toast('خطا', ' Ù ØªØ§Ø³ÙØ§ÙÙ Ù Ø´Ú©ÙÛ Ù¾ÛØ´ آ٠د ÙØ·Ùا Ø¯ÙØ§ÛÙÛ Ø¯Ûگر ٠جدد Ø§Ù ØªØØ§Ù Ú©ÙÛØ¯', 'error'); 796 } 797 } 798 }); 799 }); 800 801 // ? ========== Discount Button Click Handler ========== 802 btnDiscount.click(function () { 803 // Declare variables 804 discount_code = $('#form-field-discount').val(); 805 let price = priceDiscountBox.text().replaceAll(',', ''); 806 let discount_status = ''; 807 let discount_percent = 0; 808 let discount_description = ''; 809 let discount_price = 0; 810 let email_field = $('#form-field-email').val(); 811 let mobile_field = $('#form-field-phone').val(); 812 813 // Check validate input discount code 814 if (discount_code.trim() !== '') { 815 // Check exist services 816 if (price > 0) { 817 // Check mobile is empty 818 if (mobile_field.trim() != '') { 819 // Handle btn loading 820 handleBtnLoading(btnDiscount, 10); 821 822 // ! ========== Handle discount check request ========== 823 discountCheckAPI(discount_code, price, mobile_field, async (isOk, res) => { 824 // Handle btn loading 825 handleBtnLoading(btnDiscount, 0); 826 827 // ? ---------- Handle Response ---------- 828 if (isOk) { 829 res = res['data']['message']['discount']; 830 831 // Fill variable 832 discount_status = res['status']; 833
834 // Check status discount 835 if (discount_status == 'valid') { 836 checkDiscount = true; 837 838 // Fill variables 839 discount_percent = res['percent']; 840 discount_description = res['description']; 841 discount_price = res['new_price']; 842 843 // Show final price 844 handleShowFinalPrice('block'); 845 846 // Change discount_price value to PRICE 847 PRICE = discount_price; 848 849 // Handle discount button value 850 handleValueDiscountBtn('#5EB466', 'اع٠اÙ'); 851 852 // Change content final price box 853 finalPriceBox.html(` 854 <div class="final-price"> 855 <span> Ù Ø¨ÙØº ÙÙØ§ÛÛ: </span> 856 <span class="final-price-number">${separate(PRICE)}</span> 857 <span class="final-price-currency">تÙ٠اÙ</span> 858 </div> 859 `); 860 861 // Show message 862 if ($.Toast()) { 863 $('.toast-item-wrapper').remove(); 864 $.Toast( 865 'Ù ÙÙÙÛØª Ø¢Ù ÛØ²', 866 `<b>${discount_percent}%</b> <b>${discount_description}</b>`, 867 'success' 868 ); 869 } 870 } else if (discount_status == 'invalid') { 871 checkDiscount = false; 872 // Hide final price 873 handleShowFinalPrice('none'); 874 875 // Handle discount button value 876 handleValueDiscountBtn('#F44336', 'Ø§Ø¹Ù Ø§Ù ÙØ´Ø¯!'); 877 878 // Show message 879 if ($.Toast()) { 880 $('.toast-item-wrapper').remove(); 881 $.Toast('خطا', 'Ù ØªØ§Ø³ÙØ§Ù٠کد تخÙÛ٠تعرÛÙ ÙØ´Ø¯Ù ÛØ§ Ù ÙÙØ¶Û شد٠است', 'error'); 882 } 883 } 884 // ? ---------- Handle Error ---------- 885 } else { 886 // Show message 887 if ($.Toast()) { 888 $('.toast-item-wrapper').remove(); 889 $.Toast('خطا', 'Ù ØªØ§Ø³ÙØ§ÙÙ Ù Ø´Ú©ÙÛ Ù¾ÛØ´ آ٠د! ÙØ·Ùا Ø¯ÙØ§ÛÙÛ Ø¯Ûگر ٠جددا Ø§Ù ØªØØ§Ù Ú©ÙÛØ¯', 'error'); 890 } 891 } 892 }); 893 } else { 894 // Focusing mobile input 895 $('#form-field-phone').focus(); 896 897 // Show message 898 if ($.Toast()) { 899 $('.toast-item-wrapper').remove(); 900 $.Toast('ÙØ´Ø¯Ø§Ø±', 'ÙØ·Ùا ÙÛÙØ¯ ش٠ار٠تÙÙ٠را پر Ú©ÙÛØ¯ ٠٠جدد Ø§Ù ØªØØ§Ù Ú©ÙÛØ¯', 'warning'); 901 } 902 } 903 } else { 904 // Show message 905 if ($.Toast()) { 906 $('.toast-item-wrapper').remove(); 907 $.Toast('ÙØ´Ø¯Ø§Ø±', 'ÙØ·Ùا ÛÚ© سرÙÛØ³ را از بخش سرÙÛØ³ ÙØ§ Ø§ÙØªØ®Ø§Ø¨ ٠٠جدد Ø§Ù ØªØØ§Ù Ú©ÙÛØ¯', 'warning'); 908 } 909 910 // Scroll to services 911 $('html, body').animate({scrollTop: $('#services-block').offset().top}, 1000); 912 } 913 } else { 914 // Focusing discount code input 915 $('#form-field-discount').focus(); 916 917 // Show message 918 if ($.Toast()) { 919 $('.toast-item-wrapper').remove(); 920 $.Toast('ÙØ´Ø¯Ø§Ø±', 'ÙØ·Ùا ÙÛÙØ¯ کد تخÙÛ٠را پر Ú©ÙÛØ¯', 'warning'); 921 } 922 } 923 }); 924 925 // ? ========== Submit Data & Go To Payment ========== 926 // Check form next step 927 $('.e-form__buttons__wrapper__button-next').click(function () { 928 // Show final amount price 929 finalAmountBox.html(` 930 <div class="final-amount"> 931 <span>Ù Ø¨ÙØº ÙØ§Ø¨Ù پرداخت:</span> 932 <span class="final-amount-number">${separate(PRICE)}</span> 933 <span class="final-amount-currency">تÙ٠اÙ</span> 934 </div> 935 `); 936 finalAmountBox.css('display', 'block'); 937 // finalAmountBox.show() 938 939 // If price smaller than 0 940 if ( 941 PRICE <= 0 && 942 Number(priceDiscountBox.text().replaceAll(',', '')) <= 0 && 943 Number(qtyBox.text().replaceAll(',', '')) <= 0 944 ) { 945 $('.elementor-field-type-step.elementor-field-group-step1.e-form__step').removeClass('elementor-hidden'); 946 $('.elementor-field-type-step.elementor-field-group-step2.e-form__step').addClass('elementor-hidden'); 947 $('.elementor-field-type-step.elementor-field-group-step2.e-form__step') 948 .find('input') 949 .removeAttr('required') 950 .trigger('blur'); 951 952 // Show message 953 if ($.Toast()) { 954 $('.toast-item-wrapper').remove(); 955 $.Toast('ÙØ´Ø¯Ø§Ø±', 'ÙØ·Ùا ÛÚ© سرÙÛØ³ را از بخش سرÙÛØ³ ÙØ§ Ø§ÙØªØ®Ø§Ø¨ ٠٠جدد Ø§Ù ØªØØ§Ù Ú©ÙÛØ¯', 'warning'); 956 } 957 958 // Scroll to services 959 $('html, body').animate({scrollTop: $('#services-block').offset().top}, 1000); 960 } 961 962 // If price greater than 0 963 if ( 964 PRICE > 0 && 965 Number(priceDiscountBox.text().replaceAll(',', '')) > 0 && 966 Number(qtyBox.text().replaceAll(',', '')) > 0 && 967 $('#form-field-link').val() != '' 968 ) { 969 $('.elementor-field-type-step.elementor-field-group-step1.e-form__step').addClass('elementor-hidden'); 970 $('.elementor-field-type-step.elementor-field-group-step2.e-form__step').removeClass('elementor-hidden'); 971 $('.elementor-field-type-step.elementor-field-group-step2.e-form__step').find('input').first().focus(); 972 $('#form-field-phone').val(localStorage.getItem('mobile')); // Phone Deleted 973 $('#form-field-email').val(localStorage.getItem('email')); 974 } 975 }); 976 977 // Reset 'Enter' event 978 $('form input').keydown(function (e) { 979 if (e.keyCode == 13) { 980 e.preventDefault(); 981 return false;
982 } 983 }); 984 985 // Checkout click handler 986 $('#checkout').on('click', function () { 987 // let serviceType = null; 988 let link_field = $('#form-field-link').val(); 989 let additionalLink = null 990 let phone_field = $('#form-field-phone').val(); 991 let email_field = $('#form-field-email').val(); 992 let timer = 3; 993 let formData = {}; 994 995 if (serviceType == 2 || serviceType == 3) { 996 additionalLink = $('#form-field-additional-link').val(); 997 } 998 999 1000 // Validation phon_field & email_field & link_field 1001 if (phone_field.trim() != '' && email_field.trim() != '' && link_field.trim() != '') { 1002 if (regExpPhone.test(phone_field) && regExpEmail.test(email_field)) { 1003 // Form data object 1004 formData = { 1005 serviceType: serviceType, 1006 mobile: phone_field, 1007 serviceCode, 1008 qty: Number(qtyBox.text().replaceAll(',', '')), 1009 link: link_field, 1010 additionalLink: additionalLink, 1011 price: PRICE, 1012 discountCode: checkDiscount === true ? discount_code : null, 1013 email: email_field, 1014 buy_link: window.location.href, 1015 }; 1016 1017 console.log(formData) 1018 1019 // Set mobile & email to localStorage 1020 localStorage.setItem('mobile', phone_field); 1021 localStorage.setItem('email', email_field); 1022 1023 // ? ========== Handle Order ========== 1024 handleOrder(formData, timer); 1025 } else { 1026 if ($.Toast()) { 1027 $('.toast-item-wrapper').remove(); 1028 $.Toast('ÙØ´Ø¯Ø§Ø±', 'ÙØ·Ùا ÙÛÙØ¯ ش٠ار٠تÙÙÙ ÛØ§ اÛÙ Û٠را Ø¨Ù Ø¯Ø±Ø³ØªÛ Ù¾Ø± Ú©ÙÛØ¯', 'warning'); 1029 } 1030 return false; 1031 } 1032 } else { 1033 if ($.Toast()) { 1034 $('.toast-item-wrapper').remove(); 1035 $.Toast('ÙØ´Ø¯Ø§Ø±', 'ÙØ·Ùا ÙÛÙØ¯ ÙØ§ را پر Ú©ÙÛØ¯', 'warning'); 1036 } 1037 return false; 1038 } 1039 }); 1040 } 1041 1042 // ? ========== Handle Order ========== 1043 function handleOrder(formData, timer = 3) { 1044 // ! ========== Handle order request ========== 1045 orderAPI(formData, async (isOk, res) => { 1046 // ? ---------- Handle Response ---------- 1047 if (isOk) { 1048 if (res['status']) { 1049 1050 // Show modal 1051 showModal('show', 'Ø¯Ø±ØØ§Ù Ø§ÙØªÙاÙ...'); 1052 $('.block-go-to-payment').css('display', 'd-block'); 1053 modalBody.append($('.block-go-to-payment').html()); 1054 1055 // Timer 1056 $('.timer-counter').text(timer); 1057 var myInterval = setInterval(function () { 1058 $('.timer-counter').text(--timer); 1059 if (timer <= 1) clearInterval(myInterval); 1060 }, 1000); 1061 1062 // Go to payment 1063 setTimeout(function () { 1064 window.open(res.link, '_self'); 1065 }, 2000); 1066 } else if (res['code'] == -1) { 1067 // ! ========== Handle Active Mobile request ========== 1068 handleActiveMobile(() => { 1069 handleOrder(formData, timer); 1070 }); 1071 } else if (res['code'] == -19) { 1072 // Show message 1073 if ($.Toast()) { 1074 $('.toast-item-wrapper').remove(); 1075 $.Toast( 1076 'خطا', 1077 'Ù ØªØ§Ø³ÙØ§ÙÙ Ø³ÙØ§Ø±Ø´ ش٠ا ثبت ÙØ´Ø¯! ÙØ·Ùا ÙÛÙÚ© Ø®ÙØ¯ را Ø¨Ù Ø¯Ø±Ø³ØªÛ Ø«Ø¨Øª Ú©ÙÛØ¯', 1078 'error' 1079 ); 1080 } 1081 } 1082 // ? ---------- Handle Error ---------- 1083 } else { 1084 // Show message 1085 if ($.Toast()) { 1086 $('.toast-item-wrapper').remove(); 1087 $.Toast( 1088 'خطا', 1089 'Ù ØªØ§Ø³ÙØ§Ù٠در Ø§ÙØªÙا٠ب٠درگا٠پرداخت Ù Ø´Ú©ÙÛ Ù¾ÛØ´ آ٠د! ÙØ·Ùا Ø¯ÙØ§ÛÙÛ Ø¯Ûگر ٠جدد Ø§Ù ØªØØ§Ù Ú©ÙÛØ¯', 1090 'error' 1091 ); 1092 } 1093 } 1094 }); 1095 } 1096 1097 // ? ========== Clone Comment Rating To Box Buy Form ========== 1098 // $('#wpd-post-rating').clone().prependTo('.box-total-star'); 1099});
1100*/
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.