Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

app-user-view.js 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * App User View - Suspend User Script
  3. */
  4. 'use strict';
  5. document.addEventListener('DOMContentLoaded', function (e) {
  6. const suspendUser = document.querySelector('.suspend-user');
  7. // Suspend User javascript
  8. if (suspendUser) {
  9. suspendUser.onclick = function () {
  10. Swal.fire({
  11. title: 'Are you sure?',
  12. text: "You won't be able to revert user!",
  13. icon: 'warning',
  14. showCancelButton: true,
  15. confirmButtonText: 'Yes, Suspend user!',
  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: 'Suspended!',
  26. text: 'User has been suspended.',
  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 Suspension :)',
  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. const cancelSubscription = document.querySelectorAll('.cancel-subscription');
  47. // Alert With Functional Confirm Button
  48. if (cancelSubscription) {
  49. cancelSubscription.forEach(btnCancle => {
  50. btnCancle.onclick = function () {
  51. Swal.fire({
  52. text: 'Are you sure you would like to cancel your subscription?',
  53. icon: 'warning',
  54. showCancelButton: true,
  55. confirmButtonText: 'Yes',
  56. customClass: {
  57. confirmButton: 'btn btn-primary me-2',
  58. cancelButton: 'btn btn-label-secondary'
  59. },
  60. buttonsStyling: false
  61. }).then(function (result) {
  62. if (result.value) {
  63. Swal.fire({
  64. icon: 'success',
  65. title: 'Unsubscribed!',
  66. text: 'Your subscription cancelled successfully.',
  67. customClass: {
  68. confirmButton: 'btn btn-success'
  69. }
  70. });
  71. } else if (result.dismiss === Swal.DismissReason.cancel) {
  72. Swal.fire({
  73. title: 'Cancelled',
  74. text: 'Unsubscription Cancelled!!',
  75. icon: 'error',
  76. customClass: {
  77. confirmButton: 'btn btn-success'
  78. }
  79. });
  80. }
  81. });
  82. };
  83. });
  84. }
  85. });