1/*! codeigniter-sketch - v1.0.0 - 2018-08-22 */ 2 3function delete_confirm_(t) { 4 5 swal({ 6 7 title: "Are you sure that you want to delete this record?", 8 9 text: "You will not be able to recover this imaginary file!", 10 11 type: "warning", 12 13 showCancelButton: !0, 14 15 confirmButtonClass: "btn-danger", 16 17 confirmButtonText: "Yes, delete it!", 18 19 cancelButtonText: "No, cancel plx!", 20 21 closeOnConfirm: !1, 22 23 closeOnCancel: !1 24 25 }, function (e) { 26 27 e ? (swal("Deleted!", "Your imaginary file has been deleted.", "success"), location.href = $(t).attr("data-href")) : swal("Cancelled", "Your imaginary file is safe :)", "error") 28 29 }) 30 31} 32 33window.setTimeout(function () { 34 35 $(".alert_message").hide(); 36 37}, 4e3), $(".reset").click(function () { 38 39 window.history.back() 40 41}), $(".confirm_model").click(function () { 42 43 alert() 44 45}), $(function () { 46 47 $(document).on("change", ":file", function () { 48 49 var e = $(this), 50 51 t = e.get(0).files ? e.get(0).files.length : 1, 52 53 n = e.val().replace(/\\/g, "/").replace(/.*\//, ""); 54 55 e.trigger("fileselect", [t, n]) 56 57 }), $(document).ready(function () { 58 59 $(":file").on("fileselect", function (e, t, n) { 60 61 console.log($(this).get(0).files); 62 63 var i = $(this).parents(".input-group").find(":text"), 64 65 l = 1 < t ? t + " files selected" : n; 66 67 i.length && i.val(l) 68 69 }) 70 71 }), $(":file").change(function () { 72 73 ! function (e) { 74 75 if (e.files && e.files[0]) { 76 77 var t = new FileReader; 78 79 t.onload = function (e) { 80 81 $(".preview").attr("src", e.target.result) 82 83 }, t.readAsDataURL(e.files[0]) 84 85 } 86 87 }(this) 88 89 }) 90 91}); 92 93 94 95function delete_confirm(t) { 96 97 var url = $(t).data("href"); 98 99 var rediret_url = $(t).data("rediret-url"); 100 101 var error_msg = $(t).data("error-msg"); 102 103 var table = $(t).data("table"); 104 105 var cat_count = $(t).data('count'); 106 107 Swal.fire({ 108 109 title: "Are you sure that you want to delete this record ?", 110 111 text: "You will not be able to recover record!", 112 113 icon: "warning", 114 115 showCancelButton: true, 116 117 confirmButtonColor: "#28D094", 118 119 confirmButtonText: "Confirm", 120 121 cancelButtonText: "Cancel", 122 123 }).then((result) => { 124 if(cat_count > 0 && table == "doctor_category") { 125 swal("Error", "Please delete all doctors of this category then you can delete this category", "error"); 126 return false; 127 } 128 if(cat_count > 0 && table == "qualification") { 129 swal("Error", "Please delete all doctors of this category then you can delete this qualification", "error"); 130 return false; 131 } 132 133 if (table == "setting") { 134 135 result.value ? (Swal.fire("Deleted!", "Your record has been deleted.", "success"), location.href = $(t).attr("data-href")) : Swal.fire("Cancelled", "Your record is safe :)", "error"); 136 137 } else { 138 139 if (result.value) { 140 141 if (window.XMLHttpRequest) { 142 143 xmlhttp = new XMLHttpRequest(); 144 145 } else { 146 147 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 148 149 } 150 151 xmlhttp.onreadystatechange = function () { 152 153 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 154 155 if (xmlhttp.responseText == 1) { 156 157 Swal.fire("Deleted!", "Your record has been deleted.", "success"); 158 159 $(t).closest('tr').remove(); 160 161 // location.href = rediret_url; 162 163 } else if (xmlhttp.responseText == 0) { 164 165 Swal.fire("Cancelled", "You can not delete this record due to " + error_msg + " :)", "error"); 166 167 } 168 169 } 170 171 }; 172 173 xmlhttp.open("GET", url, true); 174 175 xmlhttp.send(); 176 177 } else { 178 179 // swal.close(); 180
181 Swal.fire("Cancelled", "Your record is safe :)", "error"); 182 183 } 184 185 } 186 187 }); 188 189} 190 191function delete_confirm_new(t) { 192 193 var url = $(t).data("href"); 194 195 var rediret_url = $(t).data("rediret-url"); 196 197 var error_msg = $(t).data("error-msg"); 198 199 var table = $(t).data("table"); 200 201 var app_count = $(t).data("rows"); 202 203 console.log(app_count); 204 205 Swal.fire({ 206 207 title: "Are you sure that you want to delete this record ?", 208 209 text: "You will not be able to recover record!", 210 211 icon: "warning", 212 213 showCancelButton: true, 214 215 confirmButtonColor: "#28D094", 216 217 confirmButtonText: "Confirm", 218 219 cancelButtonText: "Cancel", 220 221 }).then((result) => { 222 223 if (table == "setting") { 224 225 result.value ? (Swal.fire("Deleted!", "Your record has been deleted.", "success"), location.href = $(t).attr("data-href")) : Swal.fire("Cancelled", "Your record is safe :)", "error"); 226 227 } else { 228 229 230 231 if (result.value) { 232 233 if (app_count > 0) { 234 Swal.fire("Info !", "Sorry! You cannot delete this doctor as it is associated with the appointment.", "error"); 235 } else { 236 if (window.XMLHttpRequest) { 237 238 xmlhttp = new XMLHttpRequest(); 239 240 } else { 241 242 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 243 244 } 245 246 xmlhttp.onreadystatechange = function () { 247 248 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 249 250 if (xmlhttp.responseText == 1) { 251 252 Swal.fire("Deleted!", "Your record has been deleted.", "success"); 253 254 $(t).closest('tr').remove(); 255 256 // location.href = rediret_url; 257 258 } else if (xmlhttp.responseText == 0) { 259 260 Swal.fire("Cancelled", "You can not delete this record due to " + error_msg + " :)", "error"); 261 262 } 263 264 } 265 266 }; 267 268 xmlhttp.open("GET", url, true); 269 270 xmlhttp.send(); 271 } 272 273 274 275 } else { 276 277 Swal.fire("Cancelled", "Your record is safe :)", "error"); 278 279 } 280 281 } 282 283 }); 284 285} 286 287function delete_confirm_new_user(t) { 288 289 var url = $(t).data("href"); 290 291 var rediret_url = $(t).data("rediret-url"); 292 293 var error_msg = $(t).data("error-msg"); 294 295 var table = $(t).data("table"); 296 297 var app_count = $(t).data("rows"); 298 299 console.log(app_count); 300 301 Swal.fire({ 302 303 title: "Are you sure that you want to delete this record ?", 304 305 text: "You will not be able to recover record!", 306 307 icon: "warning", 308 309 showCancelButton: true, 310 311 confirmButtonColor: "#28D094", 312 313 confirmButtonText: "Confirm", 314 315 cancelButtonText: "Cancel", 316 317 }).then((result) => { 318 319 if (table == "setting") { 320 321 result.value ? (Swal.fire("Deleted!", "Your record has been deleted.", "success"), location.href = $(t).attr("data-href")) : Swal.fire("Cancelled", "Your record is safe :)", "error"); 322 323 } else { 324 325 326 327 if (result.value) { 328 329 if (app_count > 0) { 330 Swal.fire("Info !", "Sorry! You cannot delete this customer as it is associated with the appointment.", "error"); 331 } else { 332 if (window.XMLHttpRequest) { 333 334 xmlhttp = new XMLHttpRequest(); 335 336 } else { 337 338 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 339 340 } 341 342 xmlhttp.onreadystatechange = function () { 343 344 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 345 346 if (xmlhttp.responseText == 1) { 347 348 Swal.fire("Deleted!", "Your record has been deleted.", "success"); 349 350 $(t).closest('tr').remove(); 351 352 // location.href = rediret_url; 353 354 } else if (xmlhttp.responseText == 0) { 355 356 Swal.fire("Cancelled", "You can not delete this record due to " + error_msg + " :)", "error"); 357 358 } 359 360 } 361 362 }; 363 364 xmlhttp.open("GET", url, true); 365 366 xmlhttp.send(); 367 } 368 369 370 371 } else { 372
373 Swal.fire("Cancelled", "Your record is safe :)", "error"); 374 375 } 376 377 } 378 379 }); 380 381} 382 383function delete_confirm_new_category(t) { 384 385 var url = $(t).data("href"); 386 387 var rediret_url = $(t).data("rediret-url"); 388 389 var error_msg = $(t).data("error-msg"); 390 391 var table = $(t).data("table"); 392 393 var app_count = $(t).data("rows"); 394 395 console.log(app_count); 396 397 Swal.fire({ 398 399 title: "Are you sure that you want to delete this record ?", 400 401 text: "You will not be able to recover record!", 402 403 icon: "warning", 404 405 showCancelButton: true, 406 407 confirmButtonColor: "#28D094", 408 409 confirmButtonText: "Confirm", 410 411 cancelButtonText: "Cancel", 412 413 }).then((result) => { 414 415 if (table == "setting") { 416 417 result.value ? (Swal.fire("Deleted!", "Your record has been deleted.", "success"), location.href = $(t).attr("data-href")) : Swal.fire("Cancelled", "Your record is safe :)", "error"); 418 419 } else { 420 421 422 423 if (result.value) { 424 425 if (app_count > 0) { 426 Swal.fire("Info !", "Please delete all products of this category then you can delete this category", "error"); 427 } else { 428 if (window.XMLHttpRequest) { 429 430 xmlhttp = new XMLHttpRequest(); 431 432 } else { 433 434 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 435 436 } 437 438 xmlhttp.onreadystatechange = function () { 439 440 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 441 442 if (xmlhttp.responseText == 1) { 443 444 Swal.fire("Deleted!", "Your record has been deleted.", "success"); 445 446 $(t).closest('tr').remove(); 447 448 // location.href = rediret_url; 449 450 } else if (xmlhttp.responseText == 0) { 451 452 Swal.fire("Cancelled", "You can not delete this record due to " + error_msg + " :)", "error"); 453 454 } 455 456 } 457 458 }; 459 460 xmlhttp.open("GET", url, true); 461 462 xmlhttp.send(); 463 } 464 465 466 467 } else { 468 469 Swal.fire("Cancelled", "Your record is safe :)", "error"); 470 471 } 472 473 } 474 475 }); 476 477} 478 479$('.change_status').click(function () { 480 481 alert(); 482 483}); 484 485function fun_change_state(e) { 486 487 var table = $(e).data('table'); 488 var id = $(e).data('id'); 489 var cat_count = $(e).data('count'); 490 console.log("table : " + table); 491 console.log("id :" + id); 492 console.log("count :" + cat_count); 493 494 swal({ 495 title: "Are you sure that you want to change status of this record?", 496 text: "", 497 type: "warning", 498 showCancelButton: true, 499 confirmButtonClass: "btn-danger", 500 confirmButtonText: "Confirm", 501 cancelButtonText: "Cancel", 502 closeOnConfirm: false, 503 closeOnCancel: false 504 }).then(function (result) { 505 var isConfirm = result.value; 506 // alert(isConfirm); 507 if (isConfirm) { 508 if(cat_count > 0 && table == "doctor_category") { 509 swal("Error", "Please inactivate all doctors of this category then you can inactive this category", "error"); 510 return false; 511 } 512 if(cat_count > 0 && table == "qualification") { 513 swal("Error", "Please inactivate all doctors of this category then you can inactive this qualification", "error"); 514 return false; 515 } 516 517 if (window.XMLHttpRequest) { 518 xmlhttp = new XMLHttpRequest(); 519 } else { 520 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 521 } 522 xmlhttp.onreadystatechange = function () { 523 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 524 525 if (xmlhttp.responseText == 1) { 526 swal("Status changed!", "status has been changed.", "success"); 527 $('.status_' + id).html('Active'); 528 529 $('.status_' + id).removeClass('badge-danger'); 530 531 $('.status_' + id).addClass('badge-success'); 532 533 } else if (xmlhttp.responseText == 0) { 534 swal("Status changed!", "status has been changed.", "success"); 535 $('.status_' + id).html('Inactive'); 536 537 $('.status_' + id).addClass('badge-danger'); 538 539 $('.status_' + id).removeClass('badge-success'); 540 541 } 542 543 } 544 545 }; 546 547 xmlhttp.open("GET", BASE_URL + 'admin/change/status/' + table + '/' + id, true); 548 549 xmlhttp.send(); 550 551 } else { 552
553 swal("Cancelled", "No changes were made to the " + table + " record.", "error"); 554 555 } 556 557 }); 558 559} 560 561function fun_change_state_new(e) { 562 563 var table = $(e).data('table'); 564 var id = $(e).data('id'); 565 var app_count = $(e).data('rows'); 566 console.log("table : " + table); 567 console.log("id :" + id); 568 console.log("Appointment Count :", app_count); 569 swal({ 570 title: "Are you sure that you want to change status of this record?", 571 text: "", 572 type: "warning", 573 showCancelButton: true, 574 confirmButtonClass: "btn-danger", 575 confirmButtonText: "Confirm", 576 cancelButtonText: "Cancel", 577 closeOnConfirm: false, 578 closeOnCancel: false 579 }).then(function (result) { 580 var isConfirm = result.value; 581 // alert(isConfirm); 582 if (isConfirm) { 583 if (app_count > 0) { 584 swal("Info !", "Sorry! You cannot inactive this doctor as it is associated with the appointment.", "error"); 585 586 } else { 587 588 swal("Status changed!", "status has been changed.", "success"); 589 590 if (window.XMLHttpRequest) { 591 xmlhttp = new XMLHttpRequest(); 592 } else { 593 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 594 } 595 xmlhttp.onreadystatechange = function () { 596 597 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 598 599 if (xmlhttp.responseText == 1) { 600 601 $('.status_' + id).html('Active'); 602 603 $('.status_' + id).removeClass('badge-danger'); 604 605 $('.status_' + id).addClass('badge-success'); 606 607 } else if (xmlhttp.responseText == 0) { 608 609 $('.status_' + id).html('Inactive'); 610 611 $('.status_' + id).addClass('badge-danger'); 612 613 $('.status_' + id).removeClass('badge-success'); 614 615 } 616 617 } 618 619 }; 620 621 xmlhttp.open("GET", BASE_URL + 'admin/change/status/' + table + '/' + id, true); 622 623 xmlhttp.send(); 624 } 625 626 627 628 } else { 629 630 swal("Cancelled", "No changes were made to the " + table + " record.", "error"); 631 632 } 633 634 }); 635 636} 637 638function fun_change_state_new_user(e) { 639 640 var table = $(e).data('table'); 641 var id = $(e).data('id'); 642 var app_count = $(e).data('rows'); 643 console.log("table : " + table); 644 console.log("id :" + id); 645 console.log("Appointment Count :", app_count); 646 swal({ 647 title: "Are you sure that you want to change status of this record?", 648 text: "", 649 type: "warning", 650 showCancelButton: true, 651 confirmButtonClass: "btn-danger", 652 confirmButtonText: "Confirm", 653 cancelButtonText: "Cancel", 654 closeOnConfirm: false, 655 closeOnCancel: false 656 }).then(function (result) { 657 var isConfirm = result.value; 658 // alert(isConfirm); 659 if (isConfirm) { 660 if (app_count > 0) { 661 swal("Info !", "Sorry! You cannot inactive this Customer as it is associated with the appointment.", "error"); 662 663 } else { 664 665 swal("Status changed!", "status has been changed.", "success"); 666 667 if (window.XMLHttpRequest) { 668 xmlhttp = new XMLHttpRequest(); 669 } else { 670 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 671 } 672 xmlhttp.onreadystatechange = function () { 673 674 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 675 676 if (xmlhttp.responseText == 1) { 677 678 $('.status_' + id).html('Active'); 679 680 $('.status_' + id).removeClass('badge-danger'); 681 682 $('.status_' + id).addClass('badge-success'); 683 684 } else if (xmlhttp.responseText == 0) { 685 686 $('.status_' + id).html('Inactive'); 687 688 $('.status_' + id).addClass('badge-danger'); 689 690 $('.status_' + id).removeClass('badge-success'); 691 692 } 693 694 } 695 696 }; 697 698 xmlhttp.open("GET", BASE_URL + 'admin/change/status/' + table + '/' + id, true); 699 700 xmlhttp.send(); 701 } 702 703 704 705 } else { 706
707 swal("Cancelled", "No changes were made to the " + table + " record.", "error"); 708 709 } 710 711 }); 712 713} 714 715function fun_change_state_new_category(e) { 716 717 var table = $(e).data('table'); 718 var id = $(e).data('id'); 719 var app_count = $(e).data('rows'); 720 console.log("table : " + table); 721 console.log("id :" + id); 722 console.log("Category Count :", app_count); 723 swal({ 724 title: "Are you sure that you want to change status of this record?", 725 text: "", 726 type: "warning", 727 showCancelButton: true, 728 confirmButtonClass: "btn-danger", 729 confirmButtonText: "Confirm", 730 cancelButtonText: "Cancel", 731 closeOnConfirm: false, 732 closeOnCancel: false 733 }).then(function (result) { 734 var isConfirm = result.value; 735 // alert(isConfirm); 736 if (isConfirm) { 737 if (app_count > 0) { 738 swal("Info !", "Please inactivate all products of this category then you can inactive this category", "error"); 739 740 } else { 741 742 swal("Status changed!", "status has been changed.", "success"); 743 744 if (window.XMLHttpRequest) { 745 xmlhttp = new XMLHttpRequest(); 746 } else { 747 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 748 } 749 xmlhttp.onreadystatechange = function () { 750 751 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 752 753 if (xmlhttp.responseText == 1) { 754 755 $('.status_' + id).html('Active'); 756 757 $('.status_' + id).removeClass('badge-danger'); 758 759 $('.status_' + id).addClass('badge-success'); 760 761 } else if (xmlhttp.responseText == 0) { 762 763 $('.status_' + id).html('Inactive'); 764 765 $('.status_' + id).addClass('badge-danger'); 766 767 $('.status_' + id).removeClass('badge-success'); 768 769 } 770 771 } 772 773 }; 774 775 xmlhttp.open("GET", BASE_URL + 'admin/change/status/' + table + '/' + id, true); 776 777 xmlhttp.send(); 778 } 779 780 781 782 } else { 783 784 swal("Cancelled", "No changes were made to the " + table + " record.", "error"); 785 786 } 787 788 }); 789 790} 791//========================IMAGE=================================== 792 793var imagesPreview = function (input, previewId) { 794 795 if (input.files) { 796 797 var filesAmount = input.files.length; 798 799 var preview; 800 801 console.log(previewId); 802 803 $('#' + previewId).html(''); 804 805 for (i = 0; i < filesAmount; i++) { 806 807 var reader = new FileReader(); 808 809 reader.onload = function (event) { 810 811 $('.view_' + previewId).removeClass('d-block'); 812 813 $('.view_' + previewId).addClass('d-none'); 814 815 816 817 preview = '<div style="margin-right:10px;margin-bottom:10px;"><img style="height: 110px;width: 110; border-radius: 6px;" src="' + event.target.result + '" ></div>'; 818 819 $('#' + previewId).append(preview); 820 821 } 822 823 reader.readAsDataURL(input.files[i]); 824 825 } 826 827 } 828 829}; 830 831 832// var blogImagesPreview = function (input, previewId) { 833 834// if (input.files) { 835 836// var filesAmount = input.files.length; 837 838// var preview; 839 840// console.log(previewId); 841 842// $('#' + previewId).html(''); 843 844// for (i = 0; i < filesAmount; i++) { 845 846// var reader = new FileReader(); 847 848// reader.onload = function (event) { 849 850// var img = new Image(); 851// img.src = event.target.result; 852 853// img.onload = function () { 854 855// var width = img.width; 856// var height = img.height; 857 858// // console.log("width",width +' --- height ----'+height) 859 860// if(width >= 740 && height >= 490){ 861// $('.view_' + previewId).removeClass('d-block'); 862 863// $('.view_' + previewId).addClass('d-none'); 864 865// preview = '<div style="margin-right:10px;margin-bottom:10px;"><img style="height: 110px;width: 110; border-radius: 6px;" src="' + event.target.result + '" ></div>'; 866 867// $('#' + previewId).append(preview); 868// }else{ 869// $("#blog_image").val(''); 870// $("#blog_image_preview").html('<p class="text-danger">Invalid image resolution. Please upload an image with a resolution of 740 x 490 pixels (Width x Height).</p>'); 871// } 872// } 873// }
874// reader.readAsDataURL(input.files[i]); 875 876// } 877 878// } 879 880// }; 881 882$('.category_image').on('change', function () { 883 884 console.log("category_image"); 885 886 imagesPreview(this, 'category_image_preview'); 887 888}); 889 890$('.blog_image').on('change', function () { 891 892 imagesPreview(this, 'blog_image_preview'); 893 894}); 895 896$('.product_image').on('change', function () { 897 imagesPreview(this, 'product_image_preview'); 898}); 899 900$('.product_images').on('change', function () { 901 902 imagesPreview(this, 'product_images_preview'); 903}); 904 905$('.subcategory_image').on('change', function () { 906 907 console.log("subcategory_image"); 908 909 imagesPreview(this, 'subcategory_image_preview'); 910 911}); 912 913 914$('.service_image').on('change', function () { 915 916 console.log("service_image"); 917 918 imagesPreview(this, 'service_image_preview'); 919 920}); 921 922 923 924$('.advertisement_image').on('change', function () { 925 926 console.log("advertisement_image"); 927 928 imagesPreview(this, 'advertisement_image_preview'); 929 930}); 931 932$('.promocode_image').on('change', function () { 933 934 console.log("promocode_image"); 935 936 imagesPreview(this, 'promocode_image_preview'); 937 938}); 939 940//========================IMAGE=================================== 941 942 943 944//========================PROMOCODE=================================== 945 946$(document).ready(function () { 947 948 $('#promocode').parsley(); 949 950 var old_value = $("#old_name").val(); 951 952 var table_name = 'promocode'; 953 954 var field_name = 'code'; 955 956 957 958 window.ParsleyValidator.addValidator('promocode', { 959 960 validateString: function (value) { 961 962 return $.ajax({ 963 964 url: BASE_URL + "check-duplicate-data", 965 966 method: "POST", 967 968 data: { 969 970 new_value: value, 971 972 old_value: old_value, 973 974 table_name: table_name, 975 976 field_name: field_name 977 978 }, 979 980 dataType: "json", 981 982 success: function (data) { 983 984 return true; 985 986 } 987 988 }); 989 990 } 991 992 }); 993 994}); 995 996//========================PROMOCODE=================================== 997 998 999//========================MRP=================================== 1000 1001$(document).ready(function () { 1002 1003 $('#mrp').parsley(); 1004 1005 window.ParsleyValidator.addValidator('checkmrp', { 1006 1007 validateString: function (value) { 1008 console.log(value); 1009 var price = $("#price").val(); 1010 if (parseFloat(value) > parseFloat(price)) { 1011 return true; 1012 } else { 1013 return false; 1014 } 1015 1016 } 1017 1018 }); 1019 1020}); 1021 1022//========================MRP=================================== 1023 1024 1025//========================NUMBER========================================== 1026 1027$(document).ready(function () { 1028 1029 //called when key is pressed in textbox 1030 1031 $(".number").keypress(function (e) { 1032 1033 //if the letter is not digit then display error and don't type anything 1034 1035 if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) 1036 1037 1038 1039 return false; 1040 1041 return true; 1042 1043 1044 1045 }); 1046 1047}); 1048 1049//========================NUMBER========================================== 1050 1051 1052 1053//========================NUMBER ( . )========================================== 1054 1055$(document).ready(function () { 1056 1057 //called when key is pressed in textbox 1058 1059 $(".number_pnt").keypress(function (evt) { 1060 1061 console.log('number_pnt'); 1062 1063 //if the letter is not digit then display error and don't type anything 1064 1065 var iKeyCode = (evt.which) ? evt.which : evt.keyCode 1066 1067 if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57)) 1068 1069 return false; 1070 1071 return true; 1072 1073 }); 1074 1075}); 1076 1077//========================NUMBER ( . )========================================== 1078 1079 1080 1081//========================Service IMAGE========================================== 1082 1083 1084 1085$('.remove_product_more_image').on("click", function () { 1086 1087 var this_tr = $(this).attr('id'); 1088 1089 console.log("this_tr: " + this_tr); 1090 1091 var img_id = $(this).attr('id'); 1092 1093 console.log("img_id: " + img_id); 1094 1095 $.ajax({ 1096 1097 url: BASE_URL + "admin/product/remove-image", 1098 1099 type: "POST", 1100 1101 data: { 1102 1103 img_id: img_id 1104 1105 }, 1106 1107 success: function (returnData) { 1108 1109 $('.remove_product_more_image_' + img_id).hide(); 1110 1111 // window.setTimeout(function(){location.reload()},800) 1112 1113 1114 1115 if (typeof returnData != "undefined") { } 1116 1117 }, 1118 1119 error: function (xhr, ajaxOptions, thrownError) { 1120 1121 console.log('error'); 1122 1123 } 1124 1125 }); 1126 1127}); 1128 1129 1130function change_profile_request_verify(e) { 1131 var table = $(e).data('table'); 1132 var id = $(e).data('id'); 1133 1134 Swal.fire({ 1135 title: 'Are you sure you want to accept this account request?', 1136 1137 text: "", 1138 1139 type: "warning", 1140 1141 showCancelButton: true, 1142 1143 confirmButtonClass: "btn-danger", 1144 1145 confirmButtonText: 'Accept', 1146 1147 cancelButtonText: 'Cancel' 1148 }).then((result) => { 1149 console.log(result.value); 1150 if (result.value) { 1151 Swal.fire("Request accepted!", "Doctor request has been accepted.", "success"); 1152 1153 var xmlhttp; 1154 if (window.XMLHttpRequest) { 1155 xmlhttp = new XMLHttpRequest(); 1156 } else { 1157 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 1158 } 1159 1160 xmlhttp.onreadystatechange = function() { 1161 1162 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 1163 1164 if(xmlhttp.responseText == 1) 1165 1166 { 1167 1168 $('.status_'+id).html('Verify'); 1169 1170 $('.status_'+id).removeClass('badge-danger'); 1171 1172 $('.status_'+id).addClass('badge-success'); 1173 1174 location.reload(); 1175 1176 } 1177 } 1178 1179 }; 1180 1181 xmlhttp.open("GET",BASE_URL+'change/change_profile_verify/'+table
1181+'/'+id,true); 1182 xmlhttp.send(); 1183 } else { 1184 Swal.close(); 1185 } 1186 }); 1187} 1188 1189 1190function change_profile_request_reject(e) { 1191 var table = $(e).data('table'); 1192 var id = $(e).data('id'); 1193 1194 Swal.fire({ 1195 title: 'Are you sure you want to reject this account request?', 1196 1197 text: "", 1198 1199 type: "warning", 1200 1201 showCancelButton: true, 1202 1203 confirmButtonClass: "btn btn-danger", 1204 1205 confirmButtonText: 'Reject', 1206 1207 cancelButtonText: 'Cancel' 1208 }).then((result) => { 1209 console.log(result.value); 1210 if (result.value) { 1211 Swal.fire("Reject Request!", "Doctor request has been rejected.", "success"); 1212 1213 var xmlhttp; 1214 if (window.XMLHttpRequest) { 1215 xmlhttp = new XMLHttpRequest(); 1216 } else { 1217 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 1218 } 1219 1220 xmlhttp.onreadystatechange = function () { 1221 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 1222 if (xmlhttp.responseText == 2) { 1223 $('.status_' + id).html('Reject'); 1224 $('.status_' + id).removeClass('badge-danger'); 1225 $('.status_' + id).addClass('badge-success'); 1226 location.reload(); 1227 } 1228 } 1229 }; 1230 1231 xmlhttp.open("GET", BASE_URL + 'change/change_profile_reject/' + table + '/' + id, true); 1232 xmlhttp.send(); 1233 } else { 1234 Swal.close(); 1235 } 1236 }); 1237} 1238 1239 1240//========================Service IMAGE========================================== 1241 1242//======================== Sub Category========================================== 1243 1244$('#category_list').on('select2:select', function (e) { 1245 var category_id = $(this).val(); 1246 console.log(category_id); 1247 if (category_id != '') { 1248 $.ajax({ 1249 type: "POST", 1250 url: BASE_URL + 'admin/service/get-subcategories', 1251 data: { 1252 'category_id': category_id 1253 }, 1254 dataType: "json", 1255 success: function (response) { 1256 var subcategory_list = JSON.parse(JSON.stringify(response)); 1257 if (subcategory_list.length !== 0) { 1258 var subcategory_data = '<option value="">Select Sub Category</option>'; 1259 $(subcategory_list).each(function (mainkey, mainval) { 1260 $(mainval).each(function (key, val) { 1261 subcategory_data += '<option value="' + val.id + '">' + val.name + '</option>'; 1262 }) 1263 }); 1264 $('#subcategory_list').empty(); 1265 $('#subcategory_list').append(subcategory_data); 1266 } else { 1267 $('#subcategory_list').empty(); 1268 var subcategory_data = '<option value="">Select subcategory</option>'; 1269 $('#subcategory_list').append(subcategory_data); 1270 } 1271 }, 1272 error: function (error) { } 1273 }); 1274 } else { 1275 $('#subcategory_list').empty(); 1276 var subcategory_data = '<option value="">Select subcategory</option>'; 1277 $('#subcategory_list').append(subcategory_data); 1278 } 1279 1280}); 1281//======================== Sub Category========================================== 1282 1283//======================== Change Order Status========================================== 1284 1285$(document).on("change", ".change_order_status", function () { 1286 var closest = $(this).closest("tr"); 1287 $(this).prop("disabled", true); 1288 closest.find(".loader").show(); 1289 var status = $(this).val(); 1290 var id = $(this).data("id"); 1291 if (status != "5" && status != "6") { 1292 1293 $.ajax({ 1294 type: "POST", 1295 url: BASE_URL + 'admin/orders/update-status', 1296 data: { 1297 'status': status, 1298 'id': id, 1299 }, 1300 dataType: "json", 1301 success: function (response) { 1302 closest.find(".loader").hide(); 1303 $("#filter_form").submit(); 1304 Swal.fire("Status changed!", "status has been changed.", "success"); 1305 }, 1306 error: function (error) { } 1307 }); 1308 } else { 1309 if (status == "5") { 1310 $("#order_id").val(id); 1311 $("#cancelled_reason_modal").modal("show"); 1312 } else { 1313 $("#app_order_id").val(id); 1314 $("#appointment_modal").modal("show"); 1315 } 1316 } 1317}); 1318 1319$(document).on("click", ".view_contact_detail", function () { 1320 var id = $(this).data("id"); 1321 $.ajax({ 1322 type: "POST", 1323 url: BASE_URL + 'admin/contact/viewDetail', 1324 data: { 1325 'id': id, 1326 }, 1327 dataType: "json", 1328 success: function (response) { 1329 $(".contact_name").html(response.row.name); 1330 $(".contact_email").html(response.row.email); 1331 $(".contact_subject").html(response.row.subject); 1332 $(".contact_comment").html(response.row.comment); 1333 $("#inquiryModal").modal("show"); 1334 }, 1335 error: function (error) { } 1336 }); 1337 1338}); 1339 1340$(document).on("click", ".view_product_inquiry_detail", function () { 1341 var id = $(this).data("id"); 1342 $.ajax({ 1343 type: "POST", 1344 url: BASE_URL + 'admin/product-inquiry/viewDetail', 1345 data: { 1346 'id': id, 1347 }, 1348 dataType: "json", 1349 success: function (response) { 1350 $(".contact_name").html(response.row.name); 1351 $(".contact_email").html(response.row.email); 1352 $(".contact_subject").html(response.row.product_name); 1353 $(".contact_comment").html(response.row.product_detail); 1354 $("#inquiryModal").modal("show"); 1355 }, 1356 error: function (error) { } 1357 }); 1358 1359}); 1360 1361function notify(message, status) { 1362 1363 $.notify({ 1364 // options 1365 message: message, 1366 style: 'bootstrap', 1367 className: "notify_class", 1368 autoHide: true, 1369 autoHideDelay: 1000, 1370 }, {
1371 // settings 1372 type: status, 1373 z_index: 99999, 1374 style: 'bootstrap', 1375 className: "notify_class", 1376 autoHide: true, 1377 autoHideDelay: 1000, 1378 }); 1379} 1380//======================== Change Order Status==========================================
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.