1// document.addEventListener('DOMContentLoaded', function () { 2// var meetingLinkBox = document.querySelector('.form-meeting'); 3// var statusDropdown = document.getElementById('booking_status'); 4 5 6// if (statusDropdown.value !== 'Approved') { 7// meetingLinkBox.style.display = 'none'; 8// } 9 10 11// statusDropdown.addEventListener('change', function () { 12// if (this.value === 'Approved') { 13// meetingLinkBox.style.display = 'block'; 14// } else { 15 16// meetingLinkBox.style.display = 'none'; 17// } 18// }); 19// }); 20(function ($) { 21 "use strict"; 22 var ajax_url = $("input#dwt_listing_ajax_url").val(); 23 var yes_rtl; 24 if ($("#is_rtl").val() !== "" && $("#is_rtl").val() === "1") { 25 yes_rtl = true; 26 } else { 27 yes_rtl = false; 28 } 29 30 if ($(".admin-panel-scroll").length > 0) { 31 $(".admin-panel-scroll .panel-body").slimScroll({ 32 height: "800px", 33 wheelStep: 12, 34 }); 35 } 36 37 if ($("#sidebar-nav .sidebar-scroll").length > 0) { 38 $("#sidebar-nav .sidebar-scroll").slimScroll({ 39 height: "auto", 40 wheelStep: 10, 41 color: "#ccc", 42 }); 43 } 44 45 $(".collaspe-btn-admin").on("click", function () { 46 $(this).find(".lnr").toggleClass("lnr-menu lnr-cross"); 47 48 if ($(window).innerWidth() < 1025) { 49 if (!$("body").hasClass("admin-sidebar-active")) { 50 $("body").addClass("admin-sidebar-active"); 51 } else { 52 $("body").removeClass("admin-sidebar-active"); 53 } 54 } 55 }); 56 57 var readURL = function (input) { 58 if (input.files && input.files[0]) { 59 var fd = new FormData(); 60 var files_data = $(".profile-file-upload"); 61 $.each($(files_data), function (i, obj) { 62 $.each(obj.files, function (j, file) { 63 fd.append("my_file_upload[" + j + "]", file); 64 }); 65 }); 66 // Add the nonce to the FormData object 67 fd.append("profile-file-upload_nonce", $("input[name='profile-file-upload_nonce']").val()); 68 fd.append("action", "upload_user_pic"); 69 $.ajax({
70 type: "POST", 71 url: ajax_url, 72 data: fd, 73 contentType: false, 74 processData: false, 75 success: function (res) { 76 var res_arr = res.split("|"); 77 if ($.trim(res_arr[0]) === "1") { 78 $(".profile-pic").attr("src", res_arr[1]); 79 $(".resize").attr("src", res_arr[1]); 80 $("#img-upload-success").show(); 81 } else if ($.trim(res_arr[0]) === "0") { 82 $("#max-img-size").show(); 83 } else if ($.trim(res_arr[0]) === "3") { 84 $.alert({ 85 title: get_strings.whoops, 86 closeIcon: true, 87 rtl: yes_rtl, 88 icon: "fa fa-frown-o", 89 theme: "modern", 90 animation: "scale", 91 type: "red", 92 content: get_strings.unable_perform, 93 backgroundDismiss: true, 94 buttons: { okay: { btnClass: "btn-blue" } }, 95 }); 96 } else { 97 $("#error-messages").show(); 98 } 99 }, 100 }); 101 } 102 }; 103 $(".profile-file-upload").on("change", function () { 104 readURL(this); 105 }); 106 107 $(".profile-upload-button").on("click", function () { 108 $(".profile-file-upload").click(); 109 }); 110 111 /*--- Reset Password ---*/ 112 $("#resetPassword") 113 .validator() 114 .on("submit", function (e) { 115 if (e.isDefaultPrevented()) { 116 return false; 117 } else { 118 $(".sonu-button-reset").button("loading"); 119 $.post(ajax_url, { 120 action: "dwt_listing_resetmy", 121 collect_data: $("form#resetPassword").serialize(), 122 }).done(function (response) { 123 $(".sonu-button-reset").button("reset"); 124 if ($.trim(response) === "1") { 125 $("#password-success").show(); 126 window.setTimeout(function () { 127 window.location.reload(true); 128 }, 1000); 129 } else if ($.trim(response) === "3") { 130 $.alert({ 131 title: get_strings.whoops, 132 backgroundDismiss: true, 133 rtl: yes_rtl, 134 icon: "fa fa-frown-o", 135 theme: "modern", 136 animation: "scale", 137 type: "red", 138 content: get_strings.unable_perform, 139 buttons: { okay: { btnClass: "btn-blue" } }, 140 }); 141 window.setTimeout(function () { 142 window.location.reload(true); 143 }, 1000); 144 } else { 145 $.alert({ 146 title: get_strings.whoops, 147 backgroundDismiss: true, 148 rtl: yes_rtl, 149 icon: "fa fa-frown-o", 150 theme: "modern", 151 animation: "scale", 152 type: "red", 153 content: response, 154 buttons: { okay: { btnClass: "btn-blue" } }, 155 }); 156 window.setTimeout(function () { 157 window.location.reload(true); 158 }, 1000); 159 } 160 }); 161 } 162 return false; 163 }); 164 165 /*--- Registration Form Action ---*/ 166 $("#profile-update") 167 .validator() 168 .on("submit", function (e) { 169 if (e.isDefaultPrevented()) { 170 return false; 171 } else { 172 $(".update_profile").button("loading"); 173 $.post(ajax_url, { 174 action: "dwt_listing_profile_update", 175 collect_data: $("form#profile-update").serialize(), 176 }).done(function (response) { 177 $(".update_profile").button("reset"); 178 if ($.trim(response) === "1") { 179 $("#p_up").hide(); 180 $("#success-messages").show(); 181 window.setTimeout(function () { 182 window.location.reload(true); 183 }, 1000); 184 } else if ($.trim(response) === "3") { 185 $.alert({ 186 title: get_strings.whoops, 187 closeIcon: true, 188 rtl: yes_rtl, 189 icon: "fa fa-frown-o", 190 theme: "modern", 191 animation: "scale", 192 type: "red", 193 content: get_strings.unable_perform, 194 backgroundDismiss: true, 195 buttons: { okay: { btnClass: "btn-blue" } }, 196 }); 197 } else { 198 $.alert({ 199 title: get_strings.whoops, 200 backgroundDismiss: true, 201 rtl: yes_rtl, 202 icon: "fa fa-frown-o", 203 theme: "modern", 204 animation: "scale", 205 type: "red", 206 content: response, 207 buttons: { okay: { btnClass: "btn-blue" } }, 208 }); 209 } 210 }); 211 /*--- stop submitting ---*/ 212 return false; 213 } 214 });
215 216 /*--- Events ---*/ 217 function dwt_listing_eventz_zone() { 218 Dropzone.autoDiscover = false; 219 var acceptedFileTypes = "image/*"; 220 var fileList = new Array(); 221 var i = 0; 222 $("#event_dropzone").dropzone({ 223 addRemoveLinks: true, 224 paramName: "my_file_upload", 225 maxFiles: $("#event_upload_limit").val(), 226 gallery_limit: $("#event_img_size").val(), 227 acceptedFiles: ".jpeg,.jpg,.png", 228 dictMaxFilesExceeded: $("#max_upload_reach").val(), 229 url: 230 ajax_url + 231 "?action=upload_dwt_listing_events_images&is_update=" + 232 $("#is_update").val(), 233 parallelUploads: 1, 234 dictDefaultMessage: $("#dictDefaultMessage").val(), 235 dictFallbackMessage: $("#dictFallbackMessage").val(), 236 dictFallbackText: $("#dictFallbackText").val(), 237 dictFileTooBig: $("#dictFileTooBig").val(), 238 dictInvalidFileType: $("#dictInvalidFileType").val(), 239 dictResponseError: $("#dictResponseError").val(), 240 dictCancelUpload: $("#dictCancelUpload").val(), 241 dictCancelUploadConfirmation: $("#dictCancelUploadConfirmation").val(), 242 dictRemoveFile: $("#dictRemoveFile").val(), 243 dictRemoveFileConfirmation: null, 244 init: function () { 245 var thisDropzone = this; 246 let url = 247 ajax_url + 248 "?action=upload_dwt_listing_events_images&is_update=" + 249 $("#is_update").val(); 250 251 console.log("URLS: ", url); 252 $.post(ajax_url, { 253 action: "get_event_images", 254 is_update: $("#is_update").val(), 255 }).done(function (data) { 256 if (data != 0) { 257 $.each(data, function (key, value) { 258 var mockFile = { name: value.dispaly_name, size: value.size }; 259 260 thisDropzone.options.addedfile.call(thisDropzone, mockFile); 261 262 thisDropzone.options.thumbnail.call( 263 thisDropzone, 264 mockFile, 265 value.name 266 ); 267 $("a.dz-remove:eq(" + i + ")").attr("data-dz-remove", value.id); 268 i++; 269 $(".dz-progress").remove(); 270 }); 271 } 272 if (i > 0) $(".dz-message").hide(); 273 else $(".dz-message").show(); 274 }); 275 276 this.on("addedfile", function (file) { 277 $(".dz-message").hide(); 278 }); 279 this.on("success", function (file, responseText) { 280 var res_arr = responseText.split("|"); 281 if ($.trim(res_arr[0]) != "0") { 282 $("a.dz-remove:eq(" + i + ")").attr("data-dz-remove", responseText); 283 i++; 284 $(".dz-message").hide(); 285 } else { 286 if (i == 0) $(".dz-message").show(); 287 this.removeFile(file); 288 $("#listing_msgz").show(); 289 $("#listing_msgz .custom-alert__content").text(res_arr[1]); 290 } 291 }); 292 this.on("removedfile", function (file) { 293 var img_id = file._removeLink.attributes[2].value; 294 if (img_id != "") { 295 i--; 296 if (i == 0) $(".dz-message").show(); 297 $.post(ajax_url, { 298 action: "delete_event_image", 299 img: img_id, 300 is_update: $("#is_update").val(), 301 }).done(function (response) { 302 if ($.trim(response) == "1") { 303 $("#listing_msgz").hide(); 304 /*this.removeFile(file);*/ 305 } 306 }); 307 } 308 }); 309 }, 310 }); 311 } 312 dwt_listing_eventz_zone(); 313 /*--- speakers ---*/ 314 function dwt_listing_speakers_zone() { 315 Dropzone.autoDiscover = false; 316 var acceptedFileTypes = "image/*"; 317 var fileList = new Array(); 318 var i = 0; 319 $("#speaker_dropzone").dropzone({ 320 addRemoveLinks: true, 321 paramName: "my_file_upload", 322 maxFiles: $("#speaker_upload_limit").val(), 323 gallery_limit: $("#speaker_img_size").val(), 324 acceptedFiles: ".jpeg,.jpg,.png", 325 dictMaxFilesExceeded: $("#max_upload_reach").val(), 326 url: 327 ajax_url + 328 "?action=upload_dwt_listing_speaker_images&is_update=" + 329 $("#is_update").val(), 330 parallelUploads: 1, 331 dictDefaultMessage: $("#dictDefaultMessage").val(), 332 dictFallbackMessage: $("#dictFallbackMessage").val(), 333 dictFallbackText: $("#dictFallbackText").val(), 334 dictFileTooBig: $("#dictFileTooBig").val(), 335 dictInvalidFileType: $("#dictInvalidFileType").val(), 336 dictResponseError: $("#dictResponseError").val(), 337 dictCancelUpload: $("#dictCancelUpload").val(), 338 dictCancelUploadConfirmation: $("#dictCancelUploadConfirmation").val(), 339 dictRemoveFile: $("#dictRemoveFile").val(), 340 dictRemoveFileConfirmation: null, 341 init: function () { 342 var thisDropzone = this; 343 let url = 344 ajax_url + 345 "?action=upload_dwt_listing_events_images&is_update=" + 346 $("#is_update").val(); 347 348 $.post(ajax_url, { 349 action: "get_speaker_images", 350 is_update: $("#is_update").val(), 351 }).done(function (data) { 352 if (data != 0) { 353 $.each(data, function (key, value) { 354 var mockFile = { name: value.dispaly_name, size: value.size }; 355 356 thisDropzone.options.addedfile.call(thisDropzone, mockFile); 357 358 thisDropzone.options.thumbnail.call( 359 thisDropzone, 360 mockFile, 361 value.name 362 ); 363 $("a.dz-remove:eq(" + i + ")").attr("data-dz-remove", value.id); 364 i++; 365 $(".dz-progress").remove(); 366 }); 367 } 368 if (i > 0) $(".dz-message").hide(); 369 else $(".dz-message").show(); 370 }); 371 372 this.on("addedfile", function (file) { 373 $(".dz-message").hide(); 374 }); 375 this.on("success", function (file, responseText) { 376 var res_arr = responseText.split("|"); 377 if ($.trim(res_arr[0]) != "0") { 378 $("a.dz-remove:eq(" + i + ")").attr("data-dz-remove", responseText); 379 i++; 380 $(".dz-message").hide(); 381 } else { 382 if (i == 0) $(".dz-message").show(); 383 this.removeFile(file); 384 $("#listing_msgz").show(); 385 $("#listing_msgz .custom-alert__content").text(res_arr[1]); 386 } 387 }); 388 this.on("removedfile", function (file) { 389 var img_id = file._removeLink.attributes[2].value; 390 if (img_id != "") { 391 i--; 392 if (i == 0) $(".dz-message").show(); 393 $.post(ajax_url, { 394 action: "delete_speaker_image", 395 img: img_id, 396 is_update: $("#is_update").val(), 397 }).done(function (response) { 398 if ($.trim(response) == "1") { 399 $("#listing_msgz").hide(); 400 /*this.removeFile(file);*/ 401 } 402 }); 403 } 404 }); 405 }, 406 });
407 } 408 dwt_listing_speakers_zone(); 409 410 /*Create Event*/ 411 $("#event_title").on("blur", function () { 412 $(".loader-field").css("display", "block"); 413 $.post(ajax_url, { 414 action: "create_new_event", 415 event_title: $("#event_title").val(), 416 is_update: $("#is_update").val(), 417 }).done(function (response) { 418 $(".loader-field").css("display", "none"); 419 }); 420 }); 421 422 /*Create speaker by title*/ 423 $("#speaker_name").on("blur", function () { 424 $(".loader-field").css("display", "block"); 425 $.post(ajax_url, { 426 action: "create_new_speaker_by_title", 427 speaker_title: $("#speaker_name").val(), 428 is_update: $("#is_update").val(), 429 }).done(function (response) { 430 $(".loader-field").css("display", "none"); 431 }); 432 }); 433 434 /*--- Registration Form Action ---*/ 435 $("#my-events") 436 .validator() 437 .on("submit", function (e) { 438 if (e.isDefaultPrevented()) { 439 return false; 440 } else { 441 var is_update = $("#is_update").val(); 442 var curent_lang = $("#lang").val(); 443 var link = $('#webinar_link_input').val(); 444 var check = $('#share_webinar_link_checkbox').val(); 445 var save_event_nonce = $('#save_event_nonce').val(); 446 console.log('link: ', link); 447 console.log('check: ', check); 448 $(".sonu-button").button("loading"); 449 $.post(ajax_url, { 450 action: "my_new_event", 451 lang: curent_lang, 452 collect_data: $("form#my-events").serialize(), 453 is_update: $("#is_update").val(), 454 nonce: save_event_nonce, 455 }).done(function (response) { 456 // console.log(response); 457 458 $(".sonu-button").button("reset"); 459 if (is_update) { 460 $.alert({ 461 title: get_strings.congratulations, 462 backgroundDismiss: true, 463 rtl: yes_rtl, 464 icon: "fa fa-smile-o", 465 theme: "modern", 466 animation: "scale", 467 type: "green", 468 content: profile_strings.updated, 469 buttons: { 470 'Show Event': function () { 471 window.open(response); 472 }, 473 Cancel: function () { }, 474 }, 475 }); 476 } else if (response === '3') { 477 $.alert({ 478 title: get_strings.whoops, 479 closeIcon: true, 480 rtl: yes_rtl, 481 icon: "fa fa-frown-o", 482 theme: "modern", 483 animation: "scale", 484 type: "red", 485 content: get_strings.unable_perform, 486 backgroundDismiss: true, 487 buttons: { okay: { btnClass: "btn-blue" } }, 488 }); 489 } else { 490 $.alert({ 491 title: get_strings.congratulations, 492 rtl: yes_rtl, 493 icon: "fa fa-smile-o", 494 theme: "modern", 495 animation: "scale", 496 type: "green", 497 content: profile_strings.created, 498 buttons: { 499 ShowEvent: function () { 500 window.open(response); 501 }, 502 Cancel: function () { }, 503 }, 504 }); 505 } 506 }); 507 /*--- stop submitting ---*/ 508 return false; 509 } 510 }); 511 512 // Create Speaker 513 $("#create-speaker").validator().on('submit', function (e) { 514 e.preventDefault(); 515 var is_update = $("#is_update").val(); 516 var current_lang = $("#lang").val(); 517 var speaker_nonce = $('#save_speaker_nonce').val(); 518 519 $(".sonu-button").button("loading"); 520 521 $.post(ajax_url, { 522 action: "create_new_speaker", 523 lang: current_lang, 524 collect_data: $("form#create-speaker").serialize(), 525 is_update: is_update, 526 nonce: speaker_nonce, 527 }).done(function (response) { 528 console.log(response); 529 $(".sonu-button").button("reset"); 530 if (response.success) { 531 if (is_update) { 532 $.alert({ 533 title: get_strings.congratulations, 534 closeIcon: true, 535 rtl: yes_rtl, 536 icon: "fa fa-smile-o", 537 theme: "modern", 538 animation: "scale", 539 type: "green", 540 content: profile_strings.speaker_update_success, 541 }); 542 } else { 543 $.alert({ 544 title: get_strings.congratulations, 545 closeIcon: true, 546 rtl: yes_rtl, 547 icon: "fa fa-smile-o", 548 theme: "modern", 549 animation: "scale", 550 type: "green", 551 content: profile_strings.speaker_creation_success, 552 }); 553 } 554 } else if (!response.success) { 555 if (response === "3") { 556 $.alert({ 557 title: get_strings.whoops, 558 closeIcon: true, 559 rtl: yes_rtl, 560 icon: "fa fa-frown-o", 561 theme: "modern", 562 animation: "scale", 563 type: "red", 564 content: get_strings.unable_perform, 565 backgroundDismiss: true, 566 buttons: { okay: { btnClass: "btn-blue" } }, 567 }); 568 } else { 569 $.alert({ 570 title: get_strings.whoops, 571 closeIcon: true, 572 rtl: yes_rtl, 573 icon: "fa fa-frown-o", 574 theme: "modern", 575 animation: "scale", 576 type: "red", 577 content: response.data, 578 }); 579 } 580 } 581 }).fail(function (jqXHR, textStatus, errorThrown) { 582 console.error("Error:", textStatus, errorThrown); 583 $(".sonu-button").button("reset"); 584 });
585 }); 586 // Create Speaker 587 588 // ============Zoom Settings ================= 589 $('#zoom-settings').validator().on('submit', function (e) { 590 e.preventDefault(); 591 $(".sonu-button").button("loading"); 592 var tncCheckbox = $('#zoomTermsAndCondition'); 593 var zoom_email = $('#zoom_email').val(); 594 var client_id = $('#zoom_client_id').val(); 595 var client_secret = $('#zoom_client_secret').val(); 596 var zoomEmailError = $('#zoomEmailError').hide(); 597 var zoomClientIdError = $('#zoomClientIdError').hide(); 598 var zoomClientSecretError = $('#zoomClientSecretError').hide(); 599 var tncCheckboxError = $('#zoomTermsAndConditionError').hide(); 600 var validationErrors = []; 601 602 if (zoom_email === '') { 603 validationErrors.push(zoomEmailError); 604 } 605 if (client_id === '') { 606 validationErrors.push(zoomClientIdError); 607 } 608 if (client_secret === '') { 609 validationErrors.push(zoomClientSecretError); 610 } 611 612 if (validationErrors.length === 0) { 613 if (tncCheckbox.is(":checked")) { 614 $.post(ajax_url, { 615 action: "dwt_save_zoom_settings", 616 form_data: $("form#zoom-settings").serialize(), 617 }).done(function (res) { 618 $(".sonu-button").button("reset"); 619 if (res.success) { 620 $.alert({ 621 title: get_strings.congratulations, 622 closeIcon: true, 623 rtl: yes_rtl, 624 icon: "fa fa-smile-o", 625 theme: "modern", 626 animation: "scale", 627 type: "green", 628 content: res.data, 629 }); 630 } else { 631 $.alert({ 632 title: get_strings.whoops, 633 closeIcon: true, 634 rtl: yes_rtl, 635 icon: "fa fa-smile-o", 636 theme: "modern", 637 animation: "scale", 638 type: "green", 639 content: res.data, 640 }); 641 } 642 }).fail(function (jqXHR, textStatus, errorThrown) { 643 console.error("Error:", textStatus, errorThrown); 644 $(".sonu-button").button("reset"); 645 }); 646 } else { 647 $(".sonu-button").button("reset"); 648 tncCheckboxError.show(); 649 } 650 } else { 651 $(".sonu-button").button("reset"); 652 validationErrors.forEach(function (error) { 653 error.show(); 654 }); 655 } 656 }); 657 658 659 $('#zoomTermsAndCondition').change(function () { 660 if ($(this).is(":checked")) { 661 $('#zoomTermsAndConditionError').hide(); 662 } 663 }); 664 // ============Zoom Settings ================= 665 666 // =========== Zoom Auth ===================== 667 $('.meeting_authorization').click(function () { 668 var reservationId = $(this).closest('.meeting-container').find('.reservation_id_listing').val(); 669 var $button = $(this); 670 $button.button("loading"); 671 $.post(ajax_url, { 672 action: 'dwt_zoom_auth_user', 673 }).done(function (response) { 674 $button.button("reset"); 675 var zoom_auth_window = window.open(response, 676 '', 'scrollbars=no,menubar=no,resizable=yes,toolbar=no,status=no,width=800, height=400'); 677 678 var auth_window_timer = setInterval(function () { 679 console.log("Checking if window is closed..."); 680 if (zoom_auth_window.closed) { 681 clearInterval(auth_window_timer); 682 683 $.post(ajax_url, { 684 reservation_id: reservationId, 685 action: 'dwt_load_zoom_meeting_form_func', 686 }).done(function (response) { 687 $("#zoom_meeting_container").html(response); 688 $('.zoom-meeting-popup').modal('show'); 689 $("#meeting_authorization").attr("disabled", false); 690 }).fail(function (xhr, status, error) { 691 console.error("Error:", error); 692 }); 693 } 694 }, 500); 695 696 $(".meeting_authorization").attr("disabled", false); 697 }); 698 }); 699 // =========== Zoom Auth ===================== 700 701 // =========== Zoom Refresh Access Token ===================== 702 $('#refresh_zoom_token').click(function () { 703 $(".refresh-token-button").button("loading"); 704 $.post(ajax_url, { 705 action: 'dwt_refresh_zoom_access_token' 706 }).done(function (response) { 707 $(".refresh-token-button").button("reset"); 708 if (response.success) { 709 $.alert({ 710 title: get_strings.congratulations, 711 closeIcon: true, 712 rtl: yes_rtl, 713 icon: "fa fa-smile-o", 714 theme: "modern", 715 animation: "scale", 716 type: "green", 717 content: response.data.message, 718 }); 719 } else { 720 $.alert({ 721 title: get_strings.whoops, 722 closeIcon: true, 723 rtl: yes_rtl, 724 icon: "fa fa-smile-o", 725 theme: "modern", 726 animation: "scale", 727 type: "red", 728 content: response.data.message, 729 }); 730 } 731 }) 732 return; 733 }) 734 // =========== Zoom Refresh Access Token ===================== 735 736 // =========== Copy Meeting Link =========== 737 $(".copy_meeting_url").click(function () { 738 var meetingUrl = $(this).attr('data-meeting-url'); 739 var tempInput = $("<input>"); 740 $("body").append(tempInput); 741 tempInput.val(meetingUrl).select(); 742 document.execCommand("copy"); 743 tempInput.remove(); 744 $.alert({ 745 title: get_strings.congratulations, 746 closeIcon: true, 747 rtl: yes_rtl, 748 icon: "fa fa-smile-o", 749 theme: "modern", 750 animation: "scale", 751 type: "green", 752 content: 'Link Copied to Clipboard', 753 });
754 }); 755 // =========== Copy Meeting Link =========== 756 757 // =================Create Meeting ================== 758 $(document).on('submit', '.zoom-meeting-form', function (e) { 759 e.preventDefault(); 760 var $button = $('#btn_update_meeting'); 761 $button.button("loading"); 762 var this_value = $(this); 763 var meetID = $(this).find("input[name=current_meeting_id]").val(); 764 var freelancer_id = $(this).find("input[name=current_author]").val(); 765 var reservation_id = $(this).find("input[name=current_job]").val(); 766 767 this_value.find('span.bubbles').addClass('view'); 768 $(".zoom-metting-form-btn").attr("disabled", true); 769 770 $.post(ajax_url, { 771 reservation_id: reservation_id, 772 meetID: meetID, 773 form_data: $(this).serialize(), 774 action: 'dwt_setup_zoom_meeting', 775 }).done(function (response) { 776 $button.button("reset"); 777 if (response.success) { 778 $.alert({ 779 title: get_strings.congratulations, 780 closeIcon: true, 781 rtl: yes_rtl, 782 icon: "fa fa-smile-o", 783 theme: "modern", 784 animation: "scale", 785 type: "green", 786 content: response.data.msg, 787 }); 788 window.location.reload(true); 789 } else { 790 $.alert({ 791 title: get_strings.whoops, 792 closeIcon: true, 793 rtl: yes_rtl, 794 icon: "fa fa-smile-o", 795 theme: "modern", 796 animation: "scale", 797 type: "red", 798 content: response.data.msg, 799 }); 800 } 801 }); 802 }); 803 // =================Create Meeting ================== 804 805 // =================Delete Meeting ================== 806 $(".delete_zoom_meeting").on("click", function (e) { 807 var $button = $(this); 808 $button.button("loading"); 809 e.preventDefault(); 810 var reservation_id = $(this).attr('data-res-id'); 811 var meeting_id = $(this).attr('data-meetid'); 812 813 $.post(ajax_url, { 814 reservation_id: reservation_id, 815 meeting_id: meeting_id, 816 form_data: $(this).serialize(), 817 818 action: 'dwt_zoom_delete_meet', 819 }).done(function (response) { 820 $button.button("reset"); 821 if (response.success) { 822 $.alert({ 823 title: get_strings.congratulations, 824 closeIcon: true, 825 rtl: yes_rtl, 826 icon: "fa fa-smile-o", 827 theme: "modern", 828 animation: "scale", 829 type: "green", 830 content: response.data.msg, 831 }); 832 window.location.reload(true); 833 } else { 834 $.alert({ 835 title: get_strings.whoops, 836 closeIcon: true, 837 rtl: yes_rtl, 838 icon: "fa fa-smile-o", 839 theme: "modern", 840 animation: "scale", 841 type: "red", 842 content: response.data.msg, 843 }); 844 } 845 }); 846 }); 847 // =================Delete Meeting ================== 848 849 /* Delete My Events */ 850 $(".delete-my-events").on("click", function () { 851 var event_id = $(this).attr("data-myevent-id"); 852 var del_my_event = $('#delete-my-events_nonce').val(); 853 $.confirm({ 854 title: get_strings.confirmation, 855 icon: "fa fa-question-circle", 856 theme: "supervan", 857 animation: "scale", 858 content: get_strings.content, 859 closeAnimation: "scale", 860 type: "red", 861 buttons: { 862 confirm: { 863 text: get_strings.ok, 864 action: function () { 865 $.post(ajax_url, { 866 action: "remove_my_events", 867 event_id: event_id, 868 nonce: del_my_event, 869 }).done(function (response) { 870 var get_r = response.split("|"); 871 if ($.trim(get_r[0]) === "1") { 872 $.alert({ 873 title: get_strings.congratulations, 874 backgroundDismiss: true, 875 rtl: yes_rtl, 876 icon: "fa fa-smile-o", 877 theme: "modern", 878 animation: "scale", 879 type: "green", 880 content: get_r[1], 881 buttons: { okay: { btnClass: "btn-blue" } }, 882 }); 883 window.setTimeout(function () { 884 location.reload(); 885 }, 1500); 886 } else if ($.trim(get_r[0]) === "3") { 887 $.alert({ 888 title: get_strings.whoops, 889 closeIcon: true, 890 rtl: yes_rtl, 891 icon: "fa fa-frown-o", 892 theme: "modern", 893 animation: "scale", 894 type: "red", 895 content: get_strings.unable_perform, 896 backgroundDismiss: true, 897 buttons: { okay: { btnClass: "btn-blue" } }, 898 }); 899 } else { 900 $.alert({ 901 title: get_strings.whoops, 902 rtl: yes_rtl, 903 icon: "fa fa-frown-o", 904 theme: "modern", 905 animation: "scale", 906 type: "red", 907 closeIcon: true, 908 backgroundDismiss: true, 909 content: get_r[1], 910 buttons: { okay: { btnClass: "btn-blue" } }, 911 }); 912 } 913 }); 914 }, 915 }, 916 cancle: { 917 text: get_strings.cancle, 918 }, 919 }, 920 });
921 return false; 922 }); 923 924 /* Delete Speaker */ 925 $(".delete-my-speaker").on("click", function () { 926 var speaker_id = $(this).attr("data-speaker-id"); 927 var del_my_speaker = $('#delete-my-speaker_nonce').val(); 928 $.confirm({ 929 title: get_strings.confirmation, 930 icon: "fa fa-question-circle", 931 theme: "supervan", 932 animation: "scale", 933 content: get_strings.content, 934 closeAnimation: "scale", 935 type: "red", 936 buttons: { 937 confirm: { 938 text: get_strings.ok, 939 action: function () { 940 $.post(ajax_url, { 941 action: "remove_speaker_by_id", 942 speaker_id: speaker_id, 943 nonce: del_my_speaker, 944 }).done(function (response) { 945 var get_r = response.split("|"); 946 if ($.trim(get_r[0]) === "1") { 947 $.alert({ 948 title: get_strings.congratulations, 949 backgroundDismiss: true, 950 rtl: yes_rtl, 951 icon: "fa fa-smile-o", 952 theme: "modern", 953 animation: "scale", 954 type: "green", 955 content: get_r[1], 956 buttons: { okay: { btnClass: "btn-blue" } }, 957 }); 958 window.setTimeout(function () { 959 location.reload(); 960 }, 1500); 961 } else if ($.trim(get_r[0]) === "3") { 962 $.alert({ 963 title: get_strings.whoops, 964 closeIcon: true, 965 rtl: yes_rtl, 966 icon: "fa fa-frown-o", 967 theme: "modern", 968 animation: "scale", 969 type: "red", 970 content: get_strings.unable_perform, 971 backgroundDismiss: true, 972 buttons: { okay: { btnClass: "btn-blue" } }, 973 }); 974 } else { 975 $.alert({ 976 title: get_strings.whoops, 977 rtl: yes_rtl, 978 icon: "fa fa-frown-o", 979 theme: "modern", 980 animation: "scale", 981 type: "red", 982 closeIcon: true, 983 backgroundDismiss: true, 984 content: get_r[1], 985 buttons: { okay: { btnClass: "btn-blue" } }, 986 }); 987 } 988 }); 989 }, 990 }, 991 cancle: { 992 text: get_strings.cancle, 993 }, 994 }, 995 }); 996 return false; 997 }); 998 999 $('#dwt_cat_parent').on('change', function () { 1000 var cat_parent = $(this).val(); 1001 $('#dwt_listing_loading').show(); 1002 $.post(ajax_url, { action: 'check_acf_active'}).done(function(responce) { 1003 var res = responce.split("|"); 1004 if(res[0] === '0') { 1005 $.post(ajax_url, { 1006 action: 'exertio_get_custom_fields', cat_parent: cat_parent 1007 }).done(function (response) { 1008 console.log(response); 1009 if (response.success) { 1010 $('#dwt_listing_loading').hide(); 1011 $('.additional-fields').css("display", "block"); 1012 // $('.additional-fields').css("display", "flex"); 1013 $('.additional-fields-container').html(response.data.fields); 1014 1015 if ($(".custom-range-slider").length > 0) { $(".custom-range-slider").ionRangeSlider({ skin: "round" }); } 1016 } 1017 else { 1018 $('#dwt_listing_loading').hide(); 1019 $('.additional-fields').css("display", "none"); 1020 } 1021 }); 1022 } else { 1023 $('#dwt_listing_loading').hide(); 1024 $('.additional-fields-search').css("display", "none"); 1025 } 1026 }); 1027 1028 }); 1029 1030 /* verify user number */ 1031 $(document).on('click', '#sb_verification_ph,#resend_now', function () { 1032 var ph_number = $('#sb_ph_number').val(); 1033 $('#sb_verification_ph_code').hide(); 1034 $('#sb_verification_ph').hide(); 1035 $('#sb_verification_ph_back').show(); 1036 $.post(ajax_url, { action: 'dwt_verification_system', sb_phone_numer: ph_number, }).done(function (response) { 1037 var res_arr = response.split("|"); 1038 console.log(res_arr); 1039 if ($.trim(res_arr[0]) != "0") { 1040 $('#sb_verification_ph_back').hide(); 1041 $('.sb_ver_ph_div').hide(); 1042 $('.sb_ver_ph_code_div').show(); 1043 $('#sb_verification_ph_code').show(); 1044 $.alert({ 1045 title: get_strings.congratulations, 1046 backgroundDismiss: true, 1047 rtl: yes_rtl, 1048 icon: "fa fa-smile-o", 1049 theme: "modern", 1050 animation: "scale", 1051 type: "green", 1052 content: res_arr[1], 1053 buttons: { okay: { btnClass: "btn-blue" } }, 1054 }); 1055 // toastr.success(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1056 } else { 1057 $('#sb_verification_ph').show(); 1058 $('#sb_verification_ph_back').hide(); 1059 $.alert({ 1060 title: get_strings.whoops, 1061 backgroundDismiss: true, 1062 rtl: yes_rtl, 1063 icon: "fa fa-frown-o", 1064 theme: "modern", 1065 animation: "scale", 1066 type: "red", 1067 content: res_arr[1], 1068 buttons: { okay: { btnClass: "btn-blue" } }, 1069 }); 1070 // toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1071 } 1072 });
1073 }); 1074 1075 // verify number code 1076 $(document).on('click', '#sb_verification_ph_code', function () { 1077 var ph_code = $('#sb_ph_number_code').val(); 1078 $('#sb_verification_ph_code').hide(); 1079 $('#sb_verification_ph_back').show(); 1080 $.post(ajax_url, { action: 'dwt_verification_code', sb_code: ph_code, }).done(function (response) { 1081 var res_arr = response.split("|"); 1082 if ($.trim(res_arr[0]) != "0") { 1083 $.alert({ 1084 title: get_strings.congratulations, 1085 backgroundDismiss: true, 1086 rtl: yes_rtl, 1087 icon: "fa fa-smile-o", 1088 theme: "modern", 1089 animation: "scale", 1090 type: "green", 1091 content: res_arr[1], 1092 buttons: { okay: { btnClass: "btn-blue" } }, 1093 }); 1094 // toastr.success(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1095 location.reload(); 1096 } else { 1097 $('#sb_verification_ph_code').show(); 1098 $('#sb_verification_ph_back').hide(); 1099 $.alert({ 1100 title: get_strings.whoops, 1101 backgroundDismiss: true, 1102 rtl: yes_rtl, 1103 icon: "fa fa-frown-o", 1104 theme: "modern", 1105 animation: "scale", 1106 type: "red", 1107 content: res_arr[1], 1108 buttons: { okay: { btnClass: "btn-blue" } }, 1109 }); 1110 // toastr.error(res_arr[1], '', {timeOut: 4000, "closeButton": true, "positionClass": "toast-top-right"}); 1111 } 1112 }); 1113 }); 1114 1115 // $("#make_payment_button").on("click", function () { 1116 // alert("proceeding"); 1117 // var listing_id = $(this).attr("data-listing-id"); 1118 // const price = document.getElementById("price_of_table").value; 1119 // const apoint_id = document.getElementById("Appointment_id").value; 1120 // console.log(price); 1121 // console.log(apoint_id); 1122 // $.post(ajax_url, { 1123 // action: "book_listing_paid", 1124 // listing_id: listing_id, 1125 // price: price, 1126 // apoint_id: apoint_id, 1127 // }).done(function (response) { 1128 // var res_arr = response.toString().split("|"); 1129 1130 // if ($.trim(res_arr[0]) == "1") { 1131 // $.alert({ 1132 // title: get_strings.congratulations, 1133 // closeIcon: true, 1134 // rtl: yes_rtl, 1135 // icon: "fa fa-smile-o", 1136 // theme: "modern", 1137 // animation: "scale", 1138 // type: "green", 1139 // content: get_strings.redirecting_success, 1140 // backgroundDismiss: true, 1141 // buttons: { okay: { btnClass: "btn-blue" } }, 1142 // }); 1143 1144 // location.replace(res_arr[2]); 1145 // } else { 1146 // $.alert({ 1147 // title: get_strings.whoops, 1148 // closeIcon: true, 1149 // rtl: yes_rtl, 1150 // icon: "fa fa-frown-o", 1151 // theme: "modern", 1152 // animation: "scale", 1153 // type: "red", 1154 // content: res_arr[1], 1155 // backgroundDismiss: true, 1156 // }); 1157 // } 1158 // }); 1159 // }); 1160 1161 $("#make_payment_button").on("click", function () { 1162 alert("proceeding"); 1163 var listing_id = $(this).attr("data-listing-id"); 1164 const price = document.getElementById("price_of_table").value; 1165 const apoint_id = document.getElementById("Appointment_id").value; 1166 1167 // Calculate 10% of the payment amount 1168 // const walletAmount = parseFloat(price) * 0.1; 1169 // const authorAmount = parseFloat(price) - walletAmount; 1170 // console.log(walletAmount); 1171 // console.log(authorAmount); 1172 // Make the AJAX call to process the payment 1173 $.post(ajax_url, { 1174 action: "book_listing_paid", 1175 listing_id: listing_id, 1176 price: price, 1177 apoint_id: apoint_id, 1178 // walletAmount: walletAmount, 1179 // authorAmount: authorAmount 1180 }).done(function (response) { 1181 var res_arr = response.toString().split("|"); 1182 1183 if ($.trim(res_arr[0]) == "1") { 1184 $.alert({ 1185 title: get_strings.congratulations, 1186 closeIcon: true, 1187 rtl: yes_rtl, 1188 icon: "fa fa-smile-o", 1189 theme: "modern", 1190 animation: "scale", 1191 type: "green", 1192 content: get_strings.redirecting_success, 1193 backgroundDismiss: true, 1194 buttons: { okay: { btnClass: "btn-blue" } }, 1195 }); 1196 1197 location.replace(res_arr[2]); 1198 1199 // Update wallet amount display 1200 var currentWalletAmount = parseFloat($(".amount_in_wallet h3").text().replace(currency_symbol, "")); 1201 var newWalletAmount = currentWalletAmount + walletAmount; 1202 $(".amount_in_wallet h3").text(currency_symbol + newWalletAmount); 1203 } else { 1204 $.alert({ 1205 title: get_strings.whoops, 1206 closeIcon: true, 1207 rtl: yes_rtl, 1208 icon: "fa fa-frown-o", 1209 theme: "modern", 1210 animation: "scale", 1211 type: "red", 1212 content: res_arr[1], 1213 backgroundDismiss: true, 1214 }); 1215 } 1216 });
1217 }); 1218 1219 /* Expire My Listing */ 1220 $(".expire-my-events").on("click", function () { 1221 var event_id = $(this).attr("data-myevent-id"); 1222 var exp_my_event = $('#expire-my-events_nonce').val(); 1223 $.confirm({ 1224 title: get_strings.confirmation, 1225 icon: "fa fa-question-circle", 1226 theme: "supervan", 1227 animation: "scale", 1228 content: get_strings.event_expiry, 1229 closeAnimation: "scale", 1230 type: "red", 1231 buttons: { 1232 confirm: { 1233 text: get_strings.ok, 1234 action: function () { 1235 $.post(ajax_url, { 1236 action: "expire_my_events", 1237 event_id: event_id, 1238 nonce: exp_my_event, 1239 }).done(function (response) { 1240 var get_r = response.split("|"); 1241 if ($.trim(get_r[0]) === "1") { 1242 $.alert({ 1243 title: get_strings.congratulations, 1244 rtl: yes_rtl, 1245 icon: "fa fa-smile-o", 1246 theme: "modern", 1247 animation: "scale", 1248 type: "green", 1249 content: get_r[1], 1250 buttons: { okay: { btnClass: "btn-blue" } }, 1251 }); 1252 window.setTimeout(function () { 1253 location.reload(); 1254 }, 1500); 1255 } else if ($.trim(get_r[0]) === "3") { 1256 $.alert({ 1257 title: get_strings.whoops, 1258 closeIcon: true, 1259 rtl: yes_rtl, 1260 icon: "fa fa-frown-o", 1261 theme: "modern", 1262 animation: "scale", 1263 type: "red", 1264 content: get_strings.unable_perform, 1265 backgroundDismiss: true, 1266 buttons: { okay: { btnClass: "btn-blue" } }, 1267 }); 1268 } else { 1269 $.alert({ 1270 title: get_strings.whoops, 1271 rtl: yes_rtl, 1272 icon: "fa fa-frown-o", 1273 theme: "modern", 1274 animation: "scale", 1275 type: "red", 1276 closeIcon: true, 1277 backgroundDismiss: true, 1278 content: get_r[1], 1279 buttons: { okay: { btnClass: "btn-blue" } }, 1280 }); 1281 } 1282 }); 1283 }, 1284 }, 1285 cancle: { 1286 text: get_strings.cancle, 1287 }, 1288 }, 1289 }); 1290 return false; 1291 }); 1292 1293 /* Expire My Listing */ 1294 $(".reactive-my-events").on("click", function () { 1295 var event_id = $(this).attr("data-myevent-id"); 1296 var re_active_my_event = $('#reactive-my-events_nonce').val(); 1297 $.confirm({ 1298 title: get_strings.confirmation, 1299 icon: "fa fa-question-circle", 1300 theme: "supervan", 1301 animation: "scale", 1302 content: get_strings.event_reactive, 1303 closeAnimation: "scale", 1304 type: "red", 1305 buttons: { 1306 confirm: { 1307 text: get_strings.ok, 1308 action: function () { 1309 $.post(ajax_url, { 1310 action: "reactive_my_events", 1311 event_id: event_id, 1312 nonce: re_active_my_event, 1313 }).done(function (response) { 1314 var get_r = response.split("|"); 1315 if ($.trim(get_r[0]) === "1") { 1316 $.alert({ 1317 title: get_strings.congratulations, 1318 rtl: yes_rtl, 1319 icon: "fa fa-smile-o", 1320 theme: "modern", 1321 animation: "scale", 1322 type: "green", 1323 content: get_r[1], 1324 buttons: { okay: { btnClass: "btn-blue" } }, 1325 }); 1326 window.setTimeout(function () { 1327 location.reload(); 1328 }, 1500); 1329 } else if ($.trim(get_r[0]) === "3") { 1330 $.alert({ 1331 title: get_strings.whoops, 1332 closeIcon: true, 1333 rtl: yes_rtl, 1334 icon: "fa fa-frown-o", 1335 theme: "modern", 1336 animation: "scale", 1337 type: "red", 1338 content: get_strings.unable_perform, 1339 backgroundDismiss: true, 1340 buttons: { okay: { btnClass: "btn-blue" } }, 1341 }); 1342 } else { 1343 $.alert({ 1344 title: get_strings.whoops, 1345 rtl: yes_rtl, 1346 icon: "fa fa-frown-o", 1347 theme: "modern", 1348 animation: "scale", 1349 type: "red", 1350 closeIcon: true, 1351 backgroundDismiss: true, 1352 content: get_r[1], 1353 buttons: { okay: { btnClass: "btn-blue" } }, 1354 }); 1355 } 1356 }); 1357 }, 1358 }, 1359 cancle: { 1360 text: get_strings.cancle, 1361 }, 1362 }, 1363 });
1364 return false; 1365 }); 1366 1367 $("#food_menu") 1368 .validator() 1369 .on("submit", function (e) { 1370 if (e.isDefaultPrevented()) { 1371 return false; 1372 } else { 1373 $(".sonu-button").button("loading"); 1374 $.post(ajax_url, { 1375 action: "my_new_menu", 1376 collect_data: $("form#food_menu").serialize(), 1377 }).done(function (response) { 1378 $(".sonu-button").button("reset"); 1379 }); 1380 } 1381 return false; 1382 }); 1383 1384 //======================== On Change Event Type ========================// 1385 $('#event_type').on('change', function () { 1386 var locationInput = $('#address_location'); 1387 var latInput = $('#d_latt'); 1388 var longInput = $('#d_long'); 1389 var webinarLinkRadio = $('#webinar_link_radio_wrapper'); 1390 var asteriskSpan = $('#location_asterisk'); 1391 var latCont = $('.latitude_input_container') 1392 var longCont = $('.longitude_input_container') 1393 var locCont = $('.location_input_container') 1394 var mapCont = $('.map_view_container') 1395 1396 if ($(this).val() === 'webinar') { 1397 locationInput.prop('disabled', true); 1398 latInput.prop('disabled', true); 1399 longInput.prop('disabled', true); 1400 locationInput.removeAttr('required'); 1401 webinarLinkRadio.show(); 1402 asteriskSpan.hide(); 1403 longCont.hide(); 1404 latCont.hide(); 1405 locCont.hide(); 1406 mapCont.hide(); 1407 } else { 1408 locationInput.prop('disabled', false); 1409 latInput.prop('disabled', false); 1410 longInput.prop('disabled', false); 1411 locationInput.attr('required', 'required'); 1412 webinarLinkRadio.hide(); 1413 $('#webinar_link_input_wrapper').hide(); 1414 asteriskSpan.show(); 1415 longCont.show(); 1416 latCont.show(); 1417 locCont.show(); 1418 mapCont.show(); 1419 } 1420 }); 1421 1422 $('input[name="share_webinar_link"]').on('change', function () { 1423 if ($(this).val() === 'yes') { 1424 $('#webinar_link_input_wrapper').show(); 1425 $('#webinar_link_input').attr('required', 'required'); 1426 } else { 1427 $('#webinar_link_input_wrapper').hide(); 1428 $('#webinar_link_input').removeAttr('required'); 1429 } 1430 }); 1431 //======================== On Change Event Type ========================// 1432 1433 //======================== Copy Webinar Link ========================// 1434 $("#copy_webinar_link").click(function () { 1435 var meetingUrl = $(this).attr('data-webinar-link'); 1436 var tempInput = $("<input>"); 1437 $("body").append(tempInput); 1438 tempInput.val(meetingUrl).select(); 1439 document.execCommand("copy"); 1440 tempInput.remove(); 1441 $.alert({ 1442 title: get_strings.congratulations, 1443 closeIcon: true, 1444 rtl: yes_rtl, 1445 icon: "fa fa-smile-o", 1446 theme: "modern", 1447 animation: "scale", 1448 type: "green", 1449 content: 'Link Copied to Clipboard', 1450 }); 1451 }); 1452 //======================== Copy Webinar Link ========================// 1453 1454 // On page reload check if the event type is webinar and the radio is checked to show or hide the input fot webinar meeting link// 1455 $(document).ready(function () { 1456 var eventType = $('#event_type').val(); 1457 var shareWebinarLink = $('input[name="share_webinar_link"]:checked').val(); 1458 1459 function showHideWebinarLinkInput() { 1460 if (shareWebinarLink === 'yes') { 1461 $('#webinar_link_input_wrapper').show(); 1462 $('#webinar_link_input').attr('required', 'required'); 1463 } else { 1464 $('#webinar_link_input_wrapper').hide(); 1465 $('#webinar_link_input').removeAttr('required'); 1466 } 1467 } 1468 1469 function handleEventTypeChange() { 1470 var locationInput = $('#address_location'); 1471 var latInput = $('#d_latt'); 1472 var longInput = $('#d_long'); 1473 var webinarLinkRadio = $('#webinar_link_radio_wrapper'); 1474 var asteriskSpan = $('#location_asterisk'); 1475 var longCont = $('.longitude_input_container'); 1476 var latCont = $('.latitude_input_container') 1477 var locCont = $('.location_input_container') 1478 var mapCont = $('.map_view_container') 1479 1480 if (eventType === 'webinar') { 1481 locationInput.prop('disabled', true); 1482 latInput.prop('disabled', true); 1483 longInput.prop('disabled', true); 1484 locationInput.removeAttr('required'); 1485 webinarLinkRadio.show(); 1486 showHideWebinarLinkInput(); 1487 asteriskSpan.hide(); 1488 longCont.hide(); 1489 latCont.hide(); 1490 locCont.hide(); 1491 mapCont.hide(); 1492 } else { 1493 locationInput.prop('disabled', false); 1494 latInput.prop('disabled', false); 1495 longInput.prop('disabled', false); 1496 locationInput.attr('required', 'required'); 1497 webinarLinkRadio.hide(); 1498 $('#webinar_link_input_wrapper').hide(); 1499 asteriskSpan.show(); 1500 longCont.show(); 1501 latCont.show(); 1502 locCont.show(); 1503 mapCont.show(); 1504 } 1505 } 1506 1507 if (eventType === 'webinar') { 1508 handleEventTypeChange(); 1509 } 1510 1511 $('#event_type').on('change', function () { 1512 eventType = $(this).val(); 1513 handleEventTypeChange(); 1514 });
1515 1516 $('input[name="share_webinar_link"]').on('change', function () { 1517 shareWebinarLink = $(this).val(); 1518 showHideWebinarLinkInput(); 1519 }); 1520 }); 1521 // On page reload check if the event type is webinar and the radio is checked to show or hide the input fot webinar meeting link// 1522 1523 $("#dwt_create_menu") 1524 .validator() 1525 .on("submit", function (e) { 1526 if (e.isDefaultPrevented()) { 1527 return false; 1528 } else { 1529 $(".sonu-button").button("loading"); 1530 var listing_id = $("#menu_parent_listingz").val(); 1531 $.post(ajax_url, { 1532 action: "dwt_create_menutype", 1533 collect_data: $("form#dwt_create_menu").serialize(), 1534 listing_id: listing_id, 1535 }).done(function (response) { 1536 $("#dwt_create_menu")[0].reset(); 1537 $(".sonu-button").button("reset"); 1538 $(".menu_modalz").modal("hide"); 1539 $("#append_result").html(response); 1540 }); 1541 return false; 1542 } 1543 }); 1544 1545 /*--- edit menu ---*/ 1546 $(document).on("click", ".edit-lmenu", function () { 1547 var listing_id = $(this).attr("data-id"); 1548 var key = $(this).attr("data-key"); 1549 $(".edit-button-" + key).button("loading"); 1550 var trid = $(this).closest("tr").attr("id"); 1551 $.post(ajax_url, { 1552 action: "dwt_edit_menutype", 1553 listing_id: listing_id, 1554 key: key, 1555 trid: trid, 1556 }).done(function (response) { 1557 $(".edit-button-" + key).button("reset"); 1558 $(".edit_modal_menu").html(response); 1559 $(".menu_modalz1").modal("show"); 1560 $("#dwt_update_menu").validator(); 1561 }); 1562 return false; 1563 }); 1564 1565 $(document).on("submit", "#dwt_update_menu", function (e) { 1566 if (e.isDefaultPrevented()) { 1567 return false; 1568 } else { 1569 $(".sonu-button").button("loading"); 1570 $.post(ajax_url, { 1571 action: "dwt_update_menutype", 1572 collect_data: $("form#dwt_update_menu").serialize(), 1573 }).done(function (response) { 1574 $(".sonu-button").button("reset"); 1575 $(".menu_modalz1").modal("hide"); 1576 var res = response.split("|"); 1577 $("#" + res[1] + " span.menu_name").html(res[0]); 1578 }); 1579 return false; 1580 } 1581 }); 1582 1583 /*--- Add new items in menu ---*/ 1584 $(document).on("click", ".menu_items_addition", function () { 1585 $(".menu_modalz_itemz").modal("show"); 1586 var k_ref = $(this).attr("data-key-ref"); 1587 var k_list = $(this).attr("data-key-id"); 1588 $("input#reference_key").val(k_ref); 1589 $("input#reference_listing").val(k_list); 1590 return false; 1591 }); 1592 1593 /*--- Inserting menu items ---*/ 1594 $("#ad_menu_listz") 1595 .validator() 1596 .on("submit", function (e) { 1597 if (e.isDefaultPrevented()) { 1598 return false; 1599 } else { 1600 $(".sonu-button").button("loading"); 1601 $.post(ajax_url, { 1602 action: "dwt_ad_new_menu_listz", 1603 collect_data: $("form#ad_menu_listz").serialize(), 1604 }).done(function (response) { 1605 $("#ad_menu_listz")[0].reset(); 1606 $(".sonu-button").button("reset"); 1607 $(".menu_modalz_itemz").modal("hide"); 1608 $(".show_inner_menuz").html(response); 1609 $(".menu_item_historyz").modal("show"); 1610 }); 1611 return false; 1612 } 1613 }); 1614 1615 /*--- edit inner menu type ---*/ 1616 $(document).on("click", ".inner-menu-edit", function () { 1617 var listing_id = $(this).attr("data-listing_id"); 1618 var key = $(this).attr("data-refer_key"); 1619 $(".lmenu-edit-" + key).button("loading"); 1620 var trid = $(this).closest("tr").attr("id"); 1621 $.post(ajax_url, { 1622 action: "dwt_edit_inner_menugroup", 1623 listing_id: listing_id, 1624 key: key, 1625 trid: trid, 1626 }).done(function (response) { 1627 $(".lmenu-edit-" + key).button("reset"); 1628 $(".show_updated_modal").html(response); 1629 $(".fetch_inner_form").modal("show"); 1630 $("#update_inner_itemz_menu").validator(); 1631 }); 1632 return false; 1633 }); 1634 1635 /*--- update menu ---*/ 1636 $(document).on("submit", "#update_inner_itemz_menu", function (e) { 1637 if (e.isDefaultPrevented()) { 1638 return false; 1639 } else { 1640 $(".sonu-button").button("loading"); 1641 $.post(ajax_url, { 1642 action: "dwt_update_current_menu", 1643 collect_data: $("form#update_inner_itemz_menu").serialize(), 1644 }).done(function (response) { 1645 $(".sonu-button").button("reset"); 1646 $(".fetch_inner_form").modal("hide"); 1647 var res = response.split("|"); 1648 $("#" + res[1] + " span.menu_name").html(res[0]); 1649 $("#" + res[1] + " span.menu_price").html(res[2]); 1650 }); 1651 return false; 1652 } 1653 }); 1654 1655 /*--- View All menu Items ---*/ 1656 $(document).on("click", ".l_view_collection", function () { 1657 var listing_id = $(this).attr("data-id"); 1658 var key = $(this).attr("data-key"); 1659 $(".view-button-" + key).button("loading"); 1660 $.post(ajax_url, { 1661 action: "dwt_fetch_inner_menugroupz", 1662 listing_id: listing_id, 1663 key: key, 1664 }).done(function (response) { 1665 $(".view-button-" + key).button("reset"); 1666 $(".show_inner_menuz").html(response); 1667 $(".menu_item_historyz").modal("show"); 1668 });
1669 return false; 1670 }); 1671 1672 $("#menu_parent_listingz").on("change", function () { 1673 $(".menu-btn").show(); 1674 }); 1675 1676 var m_id = $("#conditional_id").val(); 1677 if (typeof m_id != "undefined") { 1678 $(".sk-circle").show(); 1679 //$("#menu_parent_listingz").trigger("change"); 1680 $(".menu-btn").show(); 1681 $.post(ajax_url, { 1682 action: "dwt_fetchmenu_against_listing", 1683 listing_id: m_id, 1684 }).done(function (response) { 1685 $(".sk-circle").hide(); 1686 $("#append_result").html(response); 1687 }); 1688 return false; 1689 } 1690 1691 /*--- Update profile settings ---*/ 1692 $("#profile-settings") 1693 .validator() 1694 .on("submit", function (e) { 1695 if (e.isDefaultPrevented()) { 1696 return false; 1697 } else { 1698 $(".sonu-button").button("loading"); 1699 $.post(ajax_url, { 1700 action: "save_profile_settings", 1701 collect_data: $("form#profile-settings").serialize(), 1702 }).done(function (response) { 1703 $(".sonu-button").button("reset"); 1704 if ($.trim(response) != "") { 1705 $.alert({ 1706 title: get_strings.congratulations, 1707 rtl: yes_rtl, 1708 icon: "fa fa-smile-o", 1709 theme: "modern", 1710 animation: "scale", 1711 type: "green", 1712 content: response, 1713 buttons: { okay: { btnClass: "btn-blue" } }, 1714 }); 1715 window.setTimeout(function () { 1716 location.reload(); 1717 }, 1500); 1718 } else { 1719 $.alert({ 1720 title: get_strings.whoops, 1721 closeIcon: true, 1722 rtl: yes_rtl, 1723 backgroundDismiss: true, 1724 icon: "fa fa-frown-o", 1725 theme: "modern", 1726 animation: "scale", 1727 type: "red", 1728 content: response, 1729 buttons: { okay: { btnClass: "btn-blue" } }, 1730 }); 1731 } 1732 }); 1733 } 1734 return false; 1735 }); 1736 1737 1738 //ajax for calendar form 1739 1740 $("#reservation_information") 1741 .validator() 1742 .on("submit", function (e) { 1743 if (e.isDefaultPrevented()) { 1744 return false; 1745 } else { 1746 Appointment_id; 1747 var is_update = $("#is_update").val(); 1748 var curent_lang = $("#lang").val(); 1749 var type_of_ads = $("#type_of_ads").val(); 1750 var price = $("#table_price").text().trim() || $("#table_price").html().trim() || $("input[name='table_price']").val(); 1751 var Appointment_id = $("#Appointment_id").val(); 1752 var meetingType; 1753 1754 1755 // Check if the select element is visible, if yes, get its value 1756 if ($("#appointment_reservationType").is(":visible")) { 1757 meetingType = $("#appointment_reservationType").val(); 1758 } else { 1759 // Otherwise, get the value from the hidden input 1760 meetingType = $("#listing_app_meeting_type").val(); 1761 } 1762 1763 $(".sonu-button").button("loading"); 1764 $.post(dwt_ajax_obj.ajax_url, { 1765 action: 'my_new_reservation', 1766 nonce: dwt_ajax_obj.nonce, 1767 lang: curent_lang, 1768 type_of_ads: type_of_ads, 1769 price: price, 1770 Appointment_id: Appointment_id, 1771 collect_data: $("form#reservation_information").serialize(), 1772 is_update: $("#is_update").val(), 1773 meeting_type: meetingType 1774 }).done(function (response) { 1775 var res_arr = response.toString().split("|"); 1776 if ($.trim(res_arr[0]) == "1") { 1777 $.alert({ 1778 title: get_strings.congratulations, 1779 closeIcon: true, 1780 rtl: yes_rtl, 1781 icon: "fa fa-smile-o", 1782 theme: "modern", 1783 animation: "scale", 1784 type: "green", 1785 content: get_strings.redirecting_success, 1786 backgroundDismiss: true, 1787 buttons: { okay: { btnClass: "btn-blue" } }, 1788 }); 1789 1790 1791 location.replace(res_arr[2]); 1792 } else { 1793 $.alert({ 1794 title: get_strings.whoops, 1795 closeIcon: true, 1796 rtl: yes_rtl, 1797 icon: "fa fa-frown-o", 1798 theme: "modern", 1799 animation: "scale", 1800 type: "red", 1801 content: response.data.message, 1802 backgroundDismiss: true, 1803 }); 1804 } 1805 }); 1806 1807 1808 /*--- stop submitting ---*/ 1809 return false; 1810 } 1811 });
1812 1813 $(document).ready(function () { 1814 var today = new Date(); 1815 today.setHours(0, 0, 0, 0); 1816 1817 1818 // Handle form submission for reservations 1819 $("#reservations").on("submit", function (e) { 1820 if (e.isDefaultPrevented()) { 1821 return false; 1822 } else { 1823 $(".sonu-button").button("loading"); 1824 var booked_days = $("#disabled_dates").datepicker().val(); 1825 var ads_type = $("#subscription").val(); 1826 var price_of_table = $("#table_price").val(); 1827 var listing_id = $("#menu_parent_listingz").val(); 1828 var table_slot_duration = $("#table_slot_duration").val(); 1829 var selectedValue = $("#reservationType").val(); 1830 1831 $.post(ajax_url, { 1832 action: "my_reservations", 1833 collect_data: $("form#reservations").serialize(), 1834 restricted_days: booked_days, 1835 table_price: price_of_table, 1836 listing_id: listing_id, 1837 ads_type: ads_type, 1838 table_slot_duration: table_slot_duration, 1839 res_type: selectedValue, 1840 }).done(function (response) { 1841 var res_arr = response.toString().split("|"); 1842 1843 if ($.trim(res_arr[0]) == "1") { 1844 $.alert({ 1845 rtl: yes_rtl, 1846 icon: "fa fa-smile-o", 1847 theme: "modern", 1848 animation: "scale", 1849 type: "green", 1850 title: get_strings.reservation_created, 1851 content: res_arr[1], 1852 backgroundDismiss: true, 1853 }); 1854 1855 location.reload(); 1856 } else { 1857 $.alert({ 1858 rtl: yes_rtl, 1859 icon: "fa fa-frown-o", 1860 theme: "modern", 1861 animation: "scale", 1862 type: "red", 1863 title: get_strings.no_business_hrs, 1864 backgroundDismiss: true, 1865 content: res_arr[1], 1866 }); 1867 } 1868 }); 1869 } 1870 return false; 1871 }); 1872}); 1873 1874 //for listing appointment meeting type 1875 $("#appointment_reservationType").on("change", function () { 1876 var selectedType = $(this).val(); 1877 var selectedID = $("#listing_id").val(); 1878 { 1879 1880 $.ajax({
1881 type: 'POST', 1882 url: ajax_url, 1883 data: { 1884 action: 'store_meeting_type', 1885 meetingType: selectedType, 1886 postID: selectedID 1887 }, 1888 success: function (response) { 1889 console.log('Meeting type stored successfully.'); 1890 console.log('Response from the server: ', response); 1891 }, 1892 error: function (xhr, status, error) { 1893 console.error('Error storing meeting type:', error); 1894 } 1895 }); 1896 } 1897 }); 1898 1899 1900 1901 //for post status 1902 1903 $(".booking_status").on("change", function () { 1904 var booking_status = $(this).val(); 1905 var booking_id = $(this).attr("data-id"); 1906 var booking_type = $(this).attr("data-type"); 1907 var meeting = $(this).attr("data-meeting"); 1908 1909 console.log("MEETING", meeting); 1910 var link_field = $(".form-meeting") 1911 if (booking_status === "rejected" || meeting === 'physical_meeting') { 1912 link_field.css("display", "none"); 1913 $("#link-text").prop("required", false); 1914 } else if (meeting === 'virtual_meeting') { 1915 link_field.css("display", "block"); 1916 $("#link-text").prop("required", true); 1917 } 1918 1919 // var link_text = $(this).val(); 1920 $("#current_booking_id").val(booking_id); 1921 $("#current_booking_status").val(booking_status); 1922 // $("#link-text").val(link_text); 1923 if (booking_type === '' || booking_type === "paid") { 1924 $("#exampleModal").modal({ 1925 show: true, 1926 }); 1927 } 1928 }); 1929 1930 $(".form_booking_email").on("submit", function (e) { 1931 e.preventDefault(); 1932 var booking_id = $("#current_booking_id").val(); 1933 var booking_status = $("#current_booking_status").val(); 1934 var listing_id = $('#listing_id').val(); 1935 var message_text = $("#message-text").val(); 1936 var link_text = $("#link-text").val(); 1937 console.log(message_text); 1938 console.log(link_text); 1939 $.post(ajax_url, { 1940 action: "booked_listing_status", 1941 staus: booking_status, 1942 booking_id: booking_id, 1943 listing_id: listing_id, 1944 message_text: message_text, 1945 link_text: link_text, 1946 // collect_data: $("form#event_attendies").serialize(), 1947 1948 }).done(function (response) { 1949 console.log(response.success); 1950 if (response.success == true) { 1951 $.alert({ 1952 title: get_strings.congratulations, 1953 backgroundDismiss: true, 1954 rtl: yes_rtl, 1955 icon: "fa fa-smile-o", 1956 theme: "modern", 1957 animation: "scale", 1958 type: "green", 1959 content: response.data.message, 1960 buttons: { okay: { btnClass: "btn-blue" } }, 1961 }); 1962 window.setTimeout(function () { 1963 location.reload(); 1964 }, 2000); 1965 } else { 1966 $.alert({ 1967 title: get_strings.whoops, 1968 closeIcon: true, 1969 rtl: yes_rtl, 1970 backgroundDismiss: true, 1971 icon: "fa fa-frown-o", 1972 theme: "modern", 1973 animation: "scale", 1974 type: "red", 1975 content: response.data.message, 1976 buttons: { okay: { btnClass: "btn-blue" } }, 1977 }); 1978 window.setTimeout(function () { 1979 location.reload(); 1980 }, 2000); 1981 } 1982 // $('.sonu-button').button('reset'); 1983 // return false; 1984 }); 1985 }); 1986 1987 //for tickets status 1988 1989 $(".ticket_status").on("change", function () { 1990 var tickets_status = $(this).val(); 1991 var tickets_id = $(this).attr("data-event-id"); 1992 $("#current_tickets_id").val(tickets_id); 1993 $("#current_tickets_status").val(tickets_status); 1994 $("#exampleModals").modal({ 1995 show: true, 1996 }); 1997 }); 1998 1999 $(".form_ticket_booking_email").on("submit", function (e) { 2000 e.preventDefault(); 2001 var tickets_id = $("#current_tickets_id").val(); 2002 var tickets_status = $("#current_tickets_status").val(); 2003 var messages_text = $("#messages-text").val(); 2004 $.post(ajax_url, { 2005 action: "booked_tickets_status", 2006 staus: tickets_status, 2007 tickets_id: tickets_id, 2008 message_text: messages_text, 2009 }).done(function (response) { 2010 $(".sonu-button").button("reset"); 2011 return false; 2012 });
2013 }); 2014 2015 //adding event attendees 2016 $("#attending_event").on("click", function () { 2017 var event_id = $("#attending_event").attr("event-data-id"); 2018 $.post(ajax_url, { 2019 action: "event_attendees_status", 2020 event_id: event_id, 2021 }).done(function (response) { 2022 location.reload(); 2023 }); 2024 }); 2025 2026 //deleting meta of not attending event 2027 2028 $("#cancel_attendance").on("click", function () { 2029 var event_id = $("#cancel_attendance").attr("event-data-delete-id"); 2030 2031 $.post(ajax_url, { 2032 action: "dwt_delete_event_attendance", 2033 event_id: event_id, 2034 }).done(function (response) { 2035 location.reload(); 2036 }); 2037 }); 2038 2039 //ajax for Payouts 2040 2041 $("#payout_form") 2042 .validator() 2043 .on("submit", function (e) { 2044 if (e.isDefaultPrevented()) { 2045 return false; 2046 } else { 2047 var is_update = $("#is_update").val(); 2048 var curent_lang = $("#lang").val(); 2049 $(".sonu-button").button("loading"); 2050 $.post(ajax_url, { 2051 action: "my_event_payouts", 2052 lang: curent_lang, 2053 collect_data: $("form#payout_form").serialize(), 2054 is_update: $("#is_update").val(), 2055 }).done(function (response) { 2056 $(".sonu-button").button("reset"); 2057 2058 if (response.success == true) { 2059 $.alert({ 2060 title: get_strings.payout_sent, 2061 rtl: yes_rtl, 2062 icon: "fa fa-smile-o", 2063 theme: "modern", 2064 animation: "scale", 2065 type: "green", 2066 content: profile_strings, 2067 buttons: { 2068 Close: function () { 2069 location.reload(); 2070 }, 2071 }, 2072 }); 2073 } else { 2074 $.alert({ 2075 title: get_strings.amount_is_greater, 2076 rtl: yes_rtl, 2077 icon: "fa fa-frown-o", 2078 theme: "modern", 2079 animation: "scale", 2080 type: "red", 2081 content: profile_strings, 2082 buttons: { 2083 Close: function () { }, 2084 }, 2085 }); 2086 } 2087 }); 2088 /*--- stop submitting ---*/ 2089 return false; 2090 } 2091 }); 2092 2093 function togglePriceField() { 2094 var selectedOption = $("#subscription").val(); 2095 var priceField = $(".table_reservation_price"); 2096 2097 if (selectedOption === "paid") { 2098 priceField.show(); 2099 } else { 2100 priceField.hide(); 2101 } 2102 } 2103 2104 // Run function on page load 2105 togglePriceField(); 2106 2107 // Run function on change event 2108 $("#subscription").change(function () { 2109 togglePriceField(); 2110 }); 2111 2112 2113})(jQuery);
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.