| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- /**
- * App eCommerce Customer Detail - delete customer Script
- */
- 'use strict';
-
- document.addEventListener('DOMContentLoaded', function (e) {
- const deleteCustomer = document.querySelector('.delete-customer');
-
- // Suspend User javascript
- if (deleteCustomer) {
- deleteCustomer.onclick = function () {
- Swal.fire({
- title: 'Are you sure?',
- text: "You won't be able to revert customer!",
- icon: 'warning',
- showCancelButton: true,
- confirmButtonText: 'Yes, Delete customer!',
- customClass: {
- confirmButton: 'btn btn-primary me-2',
- cancelButton: 'btn btn-label-secondary'
- },
- buttonsStyling: false
- }).then(function (result) {
- if (result.value) {
- Swal.fire({
- icon: 'success',
- title: 'Deleted!',
- text: 'Customer has been removed.',
- customClass: {
- confirmButton: 'btn btn-success'
- }
- });
- } else if (result.dismiss === Swal.DismissReason.cancel) {
- Swal.fire({
- title: 'Cancelled',
- text: 'Cancelled Delete :)',
- icon: 'error',
- customClass: {
- confirmButton: 'btn btn-success'
- }
- });
- }
- });
- };
- }
-
- //? Billing page have multiple buttons
- // Cancel Subscription alert
- // Cancel Subscription alert
- const cancelSubscription = document.querySelectorAll('.cancel-subscription');
-
- // Alert With Functional Confirm Button
- if (cancelSubscription) {
- cancelSubscription.forEach(btnCancle => {
- btnCancle.onclick = function () {
- Swal.fire({
- text: 'Are you sure you would like to cancel your subscription?',
- icon: 'warning',
- showCancelButton: true,
- confirmButtonText: 'Yes',
- customClass: {
- confirmButton: 'btn btn-primary me-2',
- cancelButton: 'btn btn-label-secondary'
- },
- buttonsStyling: false
- }).then(function (result) {
- if (result.value) {
- Swal.fire({
- icon: 'success',
- title: 'Unsubscribed!',
- text: 'Your subscription cancelled successfully.',
- customClass: {
- confirmButton: 'btn btn-success'
- }
- });
- } else if (result.dismiss === Swal.DismissReason.cancel) {
- Swal.fire({
- title: 'Cancelled',
- text: 'Unsubscription Cancelled!!',
- icon: 'error',
- customClass: {
- confirmButton: 'btn btn-success'
- }
- });
- }
- });
- };
- });
- }
- });
|