No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app-ecommerce-customer-detail.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * App eCommerce Customer Detail - delete customer Script
  3. */
  4. 'use strict';
  5. document.addEventListener('DOMContentLoaded', function (e) {
  6. const deleteCustomer = document.querySelector('.delete-customer');
  7. // Suspend User javascript
  8. if (deleteCustomer) {
  9. deleteCustomer.onclick = function () {
  10. Swal.fire({
  11. title: 'Are you sure?',
  12. text: "You won't be able to revert customer!",
  13. icon: 'warning',
  14. showCancelButton: true,
  15. confirmButtonText: 'Yes, Delete customer!',
  16. customClass: {
  17. confirmButton: 'btn btn-primary me-2',
  18. cancelButton: 'btn btn-label-secondary'
  19. },
  20. buttonsStyling: false
  21. }).then(function (result) {
  22. if (result.value) {
  23. Swal.fire({
  24. icon: 'success',
  25. title: 'Deleted!',
  26. text: 'Customer has been removed.',
  27. customClass: {
  28. confirmButton: 'btn btn-success'
  29. }
  30. });
  31. } else if (result.dismiss === Swal.DismissReason.cancel) {
  32. Swal.fire({
  33. title: 'Cancelled',
  34. text: 'Cancelled Delete :)',
  35. icon: 'error',
  36. customClass: {
  37. confirmButton: 'btn btn-success'
  38. }
  39. });
  40. }
  41. });
  42. };
  43. }
  44. //? Billing page have multiple buttons
  45. // Cancel Subscription alert
  46. // Cancel Subscription alert
  47. const cancelSubscription = document.querySelectorAll('.cancel-subscription');
  48. // Alert With Functional Confirm Button
  49. if (cancelSubscription) {
  50. cancelSubscription.forEach(btnCancle => {
  51. btnCancle.onclick = function () {
  52. Swal.fire({
  53. text: 'Are you sure you would like to cancel your subscription?',
  54. icon: 'warning',
  55. showCancelButton: true,
  56. confirmButtonText: 'Yes',
  57. customClass: {
  58. confirmButton: 'btn btn-primary me-2',
  59. cancelButton: 'btn btn-label-secondary'
  60. },
  61. buttonsStyling: false
  62. }).then(function (result) {
  63. if (result.value) {
  64. Swal.fire({
  65. icon: 'success',
  66. title: 'Unsubscribed!',
  67. text: 'Your subscription cancelled successfully.',
  68. customClass: {
  69. confirmButton: 'btn btn-success'
  70. }
  71. });
  72. } else if (result.dismiss === Swal.DismissReason.cancel) {
  73. Swal.fire({
  74. title: 'Cancelled',
  75. text: 'Unsubscription Cancelled!!',
  76. icon: 'error',
  77. customClass: {
  78. confirmButton: 'btn btn-success'
  79. }
  80. });
  81. }
  82. });
  83. };
  84. });
  85. }
  86. });