+
+{{ confirm_modal(
+ 'resetEmailModal',
+ 'Reset Email Settings',
+ 'This will remove all database overrides and revert email configuration to .env defaults. Are you sure?',
+ 'resetEmailSettings()',
+ 'showResetEmailModal',
+ 'Reset to Defaults',
+ 'Cancel',
+ 'warning',
+ 'refresh'
+) }}
+
+{{ confirm_modal_dynamic(
+ 'cleanupLogsModal',
+ 'Cleanup Old Logs',
+ "'This will permanently delete all logs older than ' + logSettings.db_log_retention_days + ' days. This action cannot be undone.'",
+ 'cleanupOldLogs()',
+ 'showCleanupLogsModal',
+ 'Delete Old Logs',
+ 'Cancel',
+ 'danger'
+) }}
+
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/customers/static/admin/js/customers.js b/app/modules/customers/static/admin/js/customers.js
index 0c4f5aa1..4e7c482a 100644
--- a/app/modules/customers/static/admin/js/customers.js
+++ b/app/modules/customers/static/admin/js/customers.js
@@ -52,6 +52,10 @@ function adminCustomers() {
// Selected store (for prominent display and filtering)
selectedStore: null,
+ // Toggle status confirm state
+ showToggleStatusConfirm: false,
+ pendingToggleCustomer: null,
+
// Tom Select instance
storeSelectInstance: null,
@@ -351,11 +355,6 @@ function adminCustomers() {
* Toggle customer active status
*/
async toggleStatus(customer) {
- const action = customer.is_active ? 'deactivate' : 'activate';
- if (!confirm(`Are you sure you want to ${action} this customer?`)) {
- return;
- }
-
try {
const response = await apiClient.patch(`/admin/customers/${customer.id}/toggle-status`);
customer.is_active = response.is_active;
diff --git a/app/modules/customers/templates/customers/admin/customers.html b/app/modules/customers/templates/customers/admin/customers.html
index c6faefe6..6b643fce 100644
--- a/app/modules/customers/templates/customers/admin/customers.html
+++ b/app/modules/customers/templates/customers/admin/customers.html
@@ -4,6 +4,7 @@
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/tables.html' import table_wrapper, table_header %}
{% from 'shared/macros/pagination.html' import pagination %}
+{% from 'shared/macros/modals.html' import confirm_modal_dynamic %}
{% block title %}Customers{% endblock %}
@@ -278,7 +279,7 @@
+
+
+{{ confirm_modal('declineOrderModal', 'Decline Order', 'Are you sure you want to decline this order? This action cannot be undone.', 'declineOrder(orderToDecline)', 'showDeclineOrderModal', 'Decline', 'Cancel', 'danger') }}
+
+
+{{ confirm_modal('confirmAllItemsModal', 'Confirm All Items', 'Are you sure you want to confirm all items in this order?', 'confirmAllItems(selectedOrder)', 'showConfirmAllItemsModal', 'Confirm All', 'Cancel', 'info') }}
+
+
+{{ confirm_modal('declineAllItemsModal', 'Decline All Items', 'Are you sure you want to decline all items in this order? This action cannot be undone.', 'declineAllItems(selectedOrder)', 'showDeclineAllItemsModal', 'Decline All', 'Cancel', 'danger') }}
+
+
+{{ confirm_modal('deleteCredentialsModal', 'Remove Credentials', 'Are you sure you want to remove the Letzshop API credentials? This will disable order syncing for this store.', 'deleteCredentials()', 'showDeleteCredentialsModal', 'Remove', 'Cancel', 'danger') }}
+
+
+{{ confirm_modal('ignoreExceptionModal', 'Ignore Exception', 'Are you sure you want to ignore this exception? The unmatched product will not be resolved.', 'ignoreException(exceptionToIgnore)', 'showIgnoreExceptionModal', 'Ignore', 'Cancel', 'warning') }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-exceptions-tab.html b/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-exceptions-tab.html
index 6c16fd0c..18c8439e 100644
--- a/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-exceptions-tab.html
+++ b/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-exceptions-tab.html
@@ -186,7 +186,7 @@
diff --git a/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-orders-tab.html b/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-orders-tab.html
index 21ec7d9c..78fc1bd6 100644
--- a/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-orders-tab.html
+++ b/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-orders-tab.html
@@ -275,7 +275,7 @@
diff --git a/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-settings-tab.html b/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-settings-tab.html
index 3380fd2f..85affba3 100644
--- a/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-settings-tab.html
+++ b/app/modules/marketplace/templates/marketplace/admin/partials/letzshop-settings-tab.html
@@ -148,7 +148,7 @@
diff --git a/app/modules/marketplace/templates/marketplace/store/letzshop.html b/app/modules/marketplace/templates/marketplace/store/letzshop.html
index d35fccae..90230849 100644
--- a/app/modules/marketplace/templates/marketplace/store/letzshop.html
+++ b/app/modules/marketplace/templates/marketplace/store/letzshop.html
@@ -2,7 +2,7 @@
{% extends "store/base.html" %}
{% from 'shared/macros/headers.html' import page_header_flex %}
{% from 'shared/macros/tables.html' import table_wrapper, table_header %}
-{% from 'shared/macros/modals.html' import form_modal %}
+{% from 'shared/macros/modals.html' import form_modal, confirm_modal %}
{% block title %}Letzshop Orders{% endblock %}
@@ -217,7 +217,7 @@
@@ -225,7 +225,7 @@
@@ -551,7 +551,7 @@
@@ -683,4 +683,13 @@
+
+
+{{ confirm_modal('deleteCredentialsModal', 'Remove Credentials', 'Are you sure you want to remove your Letzshop API credentials? This will disable order syncing.', 'deleteCredentials()', 'showDeleteCredentialsModal', 'Remove', 'Cancel', 'danger') }}
+
+
+{{ confirm_modal('confirmOrderModal', 'Confirm Order', 'Are you sure you want to confirm this order? The order will be marked as accepted.', 'confirmOrder(orderToConfirm)', 'showConfirmOrderModal', 'Confirm', 'Cancel', 'info') }}
+
+
+{{ confirm_modal('rejectOrderModal', 'Reject Order', 'Are you sure you want to reject this order? This action cannot be undone.', 'rejectOrder(orderToReject)', 'showRejectOrderModal', 'Reject', 'Cancel', 'danger') }}
{% endblock %}
diff --git a/app/modules/messaging/static/admin/js/messages.js b/app/modules/messaging/static/admin/js/messages.js
index 8e2d0c7a..04e5f606 100644
--- a/app/modules/messaging/static/admin/js/messages.js
+++ b/app/modules/messaging/static/admin/js/messages.js
@@ -49,6 +49,9 @@ function adminMessages(initialConversationId = null) {
replyContent: '',
attachedFiles: [],
+ // Close conversation confirm state
+ showCloseConversationConfirm: false,
+
// Compose modal
showComposeModal: false,
compose: {
@@ -304,8 +307,6 @@ function adminMessages(initialConversationId = null) {
* Close conversation
*/
async closeConversation() {
- if (!confirm(I18n.t('messaging.confirmations.close_conversation_admin'))) return;
-
try {
await apiClient.post(`/admin/messages/${this.selectedConversationId}/close`);
diff --git a/app/modules/messaging/static/admin/js/notifications.js b/app/modules/messaging/static/admin/js/notifications.js
index d5825d69..11777f0e 100644
--- a/app/modules/messaging/static/admin/js/notifications.js
+++ b/app/modules/messaging/static/admin/js/notifications.js
@@ -67,6 +67,10 @@ function adminNotifications() {
resolvingAlert: null,
resolutionNotes: '',
+ // Delete notification confirm state
+ showDeleteNotificationConfirm: false,
+ pendingDeleteNotificationId: null,
+
/**
* Initialize component
*/
@@ -163,10 +167,6 @@ function adminNotifications() {
* Delete notification
*/
async deleteNotification(notificationId) {
- if (!confirm(I18n.t('messaging.confirmations.delete_notification'))) {
- return;
- }
-
try {
await apiClient.delete(`/admin/notifications/${notificationId}`);
diff --git a/app/modules/messaging/static/store/js/email-templates.js b/app/modules/messaging/static/store/js/email-templates.js
index 44a21146..ddc8b4ed 100644
--- a/app/modules/messaging/static/store/js/email-templates.js
+++ b/app/modules/messaging/static/store/js/email-templates.js
@@ -43,6 +43,9 @@ function storeEmailTemplates() {
},
reverting: false,
+ // Revert confirm state
+ showRevertConfirm: false,
+
// Preview Modal
showPreviewModal: false,
previewData: null,
@@ -184,10 +187,6 @@ function storeEmailTemplates() {
async revertToDefault() {
if (!this.editingTemplate) return;
- if (!confirm(I18n.t('messaging.confirmations.delete_customization'))) {
- return;
- }
-
this.reverting = true;
try {
diff --git a/app/modules/messaging/static/store/js/messages.js b/app/modules/messaging/static/store/js/messages.js
index f9332f86..0178abaa 100644
--- a/app/modules/messaging/static/store/js/messages.js
+++ b/app/modules/messaging/static/store/js/messages.js
@@ -46,6 +46,9 @@ function storeMessages(initialConversationId = null) {
// Reply form
replyContent: '',
+ // Close conversation confirm state
+ showCloseConversationConfirm: false,
+
// Compose modal
showComposeModal: false,
compose: {
@@ -279,8 +282,6 @@ function storeMessages(initialConversationId = null) {
* Close conversation
*/
async closeConversation() {
- if (!confirm(I18n.t('messaging.confirmations.close_conversation'))) return;
-
try {
await apiClient.post(`/store/messages/${this.selectedConversationId}/close`);
diff --git a/app/modules/messaging/static/store/js/notifications.js b/app/modules/messaging/static/store/js/notifications.js
index 025f323d..07f2df9c 100644
--- a/app/modules/messaging/static/store/js/notifications.js
+++ b/app/modules/messaging/static/store/js/notifications.js
@@ -42,6 +42,10 @@ function storeNotifications() {
is_read: ''
},
+ // Delete notification confirm state
+ showDeleteNotificationConfirm: false,
+ pendingDeleteNotificationId: null,
+
// Settings
settings: null,
showSettingsModal: false,
@@ -153,10 +157,6 @@ function storeNotifications() {
* Delete notification
*/
async deleteNotification(notificationId) {
- if (!confirm(I18n.t('messaging.confirmations.delete_notification'))) {
- return;
- }
-
try {
await apiClient.delete(`/store/notifications/${notificationId}`);
diff --git a/app/modules/messaging/templates/messaging/admin/messages.html b/app/modules/messaging/templates/messaging/admin/messages.html
index 8faf804e..311f7435 100644
--- a/app/modules/messaging/templates/messaging/admin/messages.html
+++ b/app/modules/messaging/templates/messaging/admin/messages.html
@@ -2,7 +2,7 @@
{% extends "admin/base.html" %}
{% from 'shared/macros/headers.html' import page_header_flex %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
-{% from 'shared/macros/modals.html' import form_modal %}
+{% from 'shared/macros/modals.html' import form_modal, confirm_modal %}
{% block title %}Messages{% endblock %}
@@ -157,7 +157,7 @@
-
Close
@@ -329,6 +329,9 @@
{% endcall %}
+
+
+{{ confirm_modal('closeConversationConfirm', 'Close Conversation', 'Are you sure you want to close this conversation? You can reopen it later if needed.', 'closeConversation()', 'showCloseConversationConfirm', 'Close Conversation', 'Cancel', 'warning') }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/messaging/templates/messaging/admin/notifications.html b/app/modules/messaging/templates/messaging/admin/notifications.html
index 4e0e6a39..8f648822 100644
--- a/app/modules/messaging/templates/messaging/admin/notifications.html
+++ b/app/modules/messaging/templates/messaging/admin/notifications.html
@@ -2,6 +2,7 @@
{% extends "admin/base.html" %}
{% from 'shared/macros/headers.html' import page_header %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
+{% from 'shared/macros/modals.html' import confirm_modal %}
{% block title %}Notifications{% endblock %}
@@ -213,7 +214,7 @@
Mark read
-
@@ -354,6 +355,9 @@
+
+
+{{ confirm_modal('deleteNotificationConfirm', 'Delete Notification', 'Are you sure you want to delete this notification? This action cannot be undone.', 'deleteNotification(pendingDeleteNotificationId)', 'showDeleteNotificationConfirm', 'Delete', 'Cancel', 'danger') }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/messaging/templates/messaging/store/email-templates.html b/app/modules/messaging/templates/messaging/store/email-templates.html
index 6c8100de..345f934a 100644
--- a/app/modules/messaging/templates/messaging/store/email-templates.html
+++ b/app/modules/messaging/templates/messaging/store/email-templates.html
@@ -2,7 +2,7 @@
{% extends "store/base.html" %}
{% from 'shared/macros/headers.html' import page_header_flex %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
-{% from 'shared/macros/modals.html' import modal_dialog %}
+{% from 'shared/macros/modals.html' import modal_dialog, confirm_modal %}
{% block title %}Email Templates{% endblock %}
@@ -212,7 +212,7 @@
@@ -323,6 +323,9 @@
{% endcall %}
+
+
+{{ confirm_modal('revertConfirm', 'Revert to Platform Default', 'Are you sure you want to delete your customization and revert to the platform default template? This action cannot be undone.', 'revertToDefault()', 'showRevertConfirm', 'Revert', 'Cancel', 'danger') }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/messaging/templates/messaging/store/messages.html b/app/modules/messaging/templates/messaging/store/messages.html
index f43bbb4c..db1cc559 100644
--- a/app/modules/messaging/templates/messaging/store/messages.html
+++ b/app/modules/messaging/templates/messaging/store/messages.html
@@ -2,7 +2,7 @@
{% extends "store/base.html" %}
{% from 'shared/macros/headers.html' import page_header %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
-{% from 'shared/macros/modals.html' import modal_simple %}
+{% from 'shared/macros/modals.html' import modal_simple, confirm_modal %}
{% block title %}Messages{% endblock %}
@@ -128,7 +128,7 @@
-
Close
@@ -272,6 +272,9 @@
{% endcall %}
+
+
+{{ confirm_modal('closeConversationConfirm', 'Close Conversation', 'Are you sure you want to close this conversation? You can reopen it later if needed.', 'closeConversation()', 'showCloseConversationConfirm', 'Close Conversation', 'Cancel', 'warning') }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/messaging/templates/messaging/store/notifications.html b/app/modules/messaging/templates/messaging/store/notifications.html
index 55d9ff68..ed6aabe5 100644
--- a/app/modules/messaging/templates/messaging/store/notifications.html
+++ b/app/modules/messaging/templates/messaging/store/notifications.html
@@ -3,7 +3,7 @@
{% from 'shared/macros/headers.html' import page_header_flex, refresh_button %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/pagination.html' import pagination_simple %}
-{% from 'shared/macros/modals.html' import modal_simple %}
+{% from 'shared/macros/modals.html' import modal_simple, confirm_modal %}
{% block title %}Notifications{% endblock %}
@@ -145,7 +145,7 @@
Mark read
-
@@ -223,6 +223,9 @@
{% endcall %}
+
+
+{{ confirm_modal('deleteNotificationConfirm', 'Delete Notification', 'Are you sure you want to delete this notification? This action cannot be undone.', 'deleteNotification(pendingDeleteNotificationId)', 'showDeleteNotificationConfirm', 'Delete', 'Cancel', 'danger') }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/orders/templates/orders/store/invoices.html b/app/modules/orders/templates/orders/store/invoices.html
index fc310879..45b2fdee 100644
--- a/app/modules/orders/templates/orders/store/invoices.html
+++ b/app/modules/orders/templates/orders/store/invoices.html
@@ -3,7 +3,7 @@
{% from 'shared/macros/headers.html' import page_header_flex, refresh_button %}
{% from 'shared/macros/tables.html' import table_wrapper, table_header, simple_pagination %}
-{% from 'shared/macros/modals.html' import form_modal %}
+{% from 'shared/macros/modals.html' import form_modal, confirm_modal_dynamic %}
{% block title %}Invoices{% endblock %}
@@ -219,7 +219,7 @@
@@ -227,7 +227,7 @@
@@ -235,7 +235,7 @@
@@ -467,6 +467,10 @@
+
+
+{{ confirm_modal_dynamic('updateStatusConfirm', 'Update Invoice Status', "'Are you sure you want to ' + ({'issued': 'mark as issued', 'paid': 'mark as paid', 'cancelled': 'cancel'}[pendingNewStatus] || pendingNewStatus) + ' this invoice?'", 'updateStatus(pendingStatusInvoice, pendingNewStatus)', 'showUpdateStatusConfirm', 'Confirm', 'Cancel', 'warning') }}
+
{% call form_modal('createInvoiceModal', 'Create Invoice', show_var='showCreateModal', submit_action='createInvoice()', submit_text='Create Invoice', loading_var='creatingInvoice', loading_text='Creating...', size='sm') %}
diff --git a/app/modules/tenancy/static/admin/js/admin-user-detail.js b/app/modules/tenancy/static/admin/js/admin-user-detail.js
index e7aa6efc..eaaa10bd 100644
--- a/app/modules/tenancy/static/admin/js/admin-user-detail.js
+++ b/app/modules/tenancy/static/admin/js/admin-user-detail.js
@@ -17,6 +17,9 @@ function adminUserDetailPage() {
error: null,
userId: null,
currentUserId: null,
+ showToggleStatusModal: false,
+ showDeleteModal: false,
+ showDeleteFinalModal: false,
// Initialize
async init() {
@@ -116,11 +119,6 @@ function adminUserDetailPage() {
return;
}
- if (!confirm(`Are you sure you want to ${action} "${this.adminUser.username}"?`)) {
- adminUserDetailLog.info('Status toggle cancelled by user');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/admin-users/${this.userId}/status`;
@@ -142,6 +140,12 @@ function adminUserDetailPage() {
}
},
+ // Intermediate step for double-confirm delete
+ confirmDeleteStep() {
+ adminUserDetailLog.info('First delete confirmation accepted, showing final confirmation');
+ this.showDeleteFinalModal = true;
+ },
+
// Delete admin user
async deleteAdminUser() {
adminUserDetailLog.info('Delete admin user requested:', this.userId);
@@ -152,17 +156,6 @@ function adminUserDetailPage() {
return;
}
- if (!confirm(`Are you sure you want to delete admin user "${this.adminUser.username}"?\n\nThis action cannot be undone.`)) {
- adminUserDetailLog.info('Delete cancelled by user');
- return;
- }
-
- // Second confirmation for safety
- if (!confirm(`FINAL CONFIRMATION\n\nAre you absolutely sure you want to delete "${this.adminUser.username}"?`)) {
- adminUserDetailLog.info('Delete cancelled by user (second confirmation)');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/admin-users/${this.userId}`;
diff --git a/app/modules/tenancy/static/admin/js/admin-user-edit.js b/app/modules/tenancy/static/admin/js/admin-user-edit.js
index ec1d00b1..b6fcd468 100644
--- a/app/modules/tenancy/static/admin/js/admin-user-edit.js
+++ b/app/modules/tenancy/static/admin/js/admin-user-edit.js
@@ -26,6 +26,10 @@ function adminUserEditPage() {
// Confirmation modal state
showRemovePlatformModal: false,
platformToRemove: null,
+ showToggleSuperAdminModal: false,
+ showToggleStatusModal: false,
+ showDeleteModal: false,
+ showDeleteFinalModal: false,
// Initialize
async init() {
@@ -149,11 +153,6 @@ function adminUserEditPage() {
return;
}
- if (!confirm(`Are you sure you want to ${action} super admin "${this.adminUser.username}"?`)) {
- adminUserEditLog.info('Super admin toggle cancelled by user');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/admin-users/${this.userId}/super-admin`;
@@ -192,11 +191,6 @@ function adminUserEditPage() {
return;
}
- if (!confirm(`Are you sure you want to ${action} "${this.adminUser.username}"?`)) {
- adminUserEditLog.info('Status toggle cancelled by user');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/admin-users/${this.userId}/status`;
@@ -298,6 +292,12 @@ function adminUserEditPage() {
this.selectedPlatformId = null;
},
+ // Intermediate step for double-confirm delete
+ confirmDeleteStep() {
+ adminUserEditLog.info('First delete confirmation accepted, showing final confirmation');
+ this.showDeleteFinalModal = true;
+ },
+
// Delete admin user
async deleteAdminUser() {
adminUserEditLog.info('Delete admin user requested:', this.userId);
@@ -308,17 +308,6 @@ function adminUserEditPage() {
return;
}
- if (!confirm(`Are you sure you want to delete admin user "${this.adminUser.username}"?\n\nThis action cannot be undone.`)) {
- adminUserEditLog.info('Delete cancelled by user');
- return;
- }
-
- // Second confirmation for safety
- if (!confirm(`FINAL CONFIRMATION\n\nAre you absolutely sure you want to delete "${this.adminUser.username}"?`)) {
- adminUserEditLog.info('Delete cancelled by user (second confirmation)');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/admin-users/${this.userId}`;
diff --git a/app/modules/tenancy/static/admin/js/admin-users.js b/app/modules/tenancy/static/admin/js/admin-users.js
index c4375fbd..e6497dac 100644
--- a/app/modules/tenancy/static/admin/js/admin-users.js
+++ b/app/modules/tenancy/static/admin/js/admin-users.js
@@ -17,6 +17,9 @@ function adminUsersPage() {
loading: false,
error: null,
currentUserId: null,
+ showDeleteModal: false,
+ showDeleteFinalModal: false,
+ adminToDelete: null,
filters: {
search: '',
is_super_admin: '',
@@ -286,6 +289,12 @@ function adminUsersPage() {
window.location.href = `/admin/admin-users/${admin.id}/edit`;
},
+ // Intermediate step for double-confirm delete
+ confirmDeleteStep() {
+ adminUsersLog.info('First delete confirmation accepted, showing final confirmation');
+ this.showDeleteFinalModal = true;
+ },
+
async deleteAdminUser(admin) {
adminUsersLog.warn('Delete admin user requested:', admin.username);
@@ -295,17 +304,6 @@ function adminUsersPage() {
return;
}
- if (!confirm(`Are you sure you want to delete admin user "${admin.username}"?\n\nThis action cannot be undone.`)) {
- adminUsersLog.info('Delete cancelled by user');
- return;
- }
-
- // Second confirmation for safety
- if (!confirm(`FINAL CONFIRMATION\n\nAre you absolutely sure you want to delete "${admin.username}"?`)) {
- adminUsersLog.info('Delete cancelled by user (second confirmation)');
- return;
- }
-
try {
const url = `/admin/admin-users/${admin.id}`;
window.LogConfig.logApiCall('DELETE', url, null, 'request');
diff --git a/app/modules/tenancy/static/admin/js/merchant-detail.js b/app/modules/tenancy/static/admin/js/merchant-detail.js
index e0b3fd8e..166c6b3b 100644
--- a/app/modules/tenancy/static/admin/js/merchant-detail.js
+++ b/app/modules/tenancy/static/admin/js/merchant-detail.js
@@ -16,6 +16,10 @@ function adminMerchantDetail() {
error: null,
merchantId: null,
+ // Modal state
+ showDeleteMerchantModal: false,
+ showDeleteMerchantFinalModal: false,
+
// Subscription state
platforms: [],
subscriptions: [],
@@ -239,8 +243,8 @@ function adminMerchantDetail() {
return formatted;
},
- // Delete merchant
- async deleteMerchant() {
+ // Prompt delete merchant (first step of double confirm)
+ promptDeleteMerchant() {
merchantDetailLog.info('Delete merchant requested:', this.merchantId);
if (this.merchant?.store_count > 0) {
@@ -248,17 +252,16 @@ function adminMerchantDetail() {
return;
}
- if (!confirm(`Are you sure you want to delete merchant "${this.merchant.name}"?\n\nThis action cannot be undone.`)) {
- merchantDetailLog.info('Delete cancelled by user');
- return;
- }
+ this.showDeleteMerchantModal = true;
+ },
- // Second confirmation for safety
- if (!confirm(`FINAL CONFIRMATION\n\nAre you absolutely sure you want to delete "${this.merchant.name}"?`)) {
- merchantDetailLog.info('Delete cancelled by user (second confirmation)');
- return;
- }
+ // Confirm first step, show final confirmation
+ confirmDeleteMerchantStep() {
+ this.showDeleteMerchantFinalModal = true;
+ },
+ // Delete merchant
+ async deleteMerchant() {
try {
const url = `/admin/merchants/${this.merchantId}?confirm=true`;
window.LogConfig.logApiCall('DELETE', url, null, 'request');
diff --git a/app/modules/tenancy/static/admin/js/merchant-edit.js b/app/modules/tenancy/static/admin/js/merchant-edit.js
index e4aa9891..65a5bfbd 100644
--- a/app/modules/tenancy/static/admin/js/merchant-edit.js
+++ b/app/modules/tenancy/static/admin/js/merchant-edit.js
@@ -18,6 +18,12 @@ function adminMerchantEdit() {
saving: false,
merchantId: null,
+ // Modal state
+ showToggleVerificationModal: false,
+ showToggleActiveModal: false,
+ showDeleteMerchantModal: false,
+ showDeleteMerchantFinalModal: false,
+
// Transfer ownership state
showTransferOwnershipModal: false,
transferring: false,
@@ -166,11 +172,6 @@ function adminMerchantEdit() {
const action = this.merchant.is_verified ? 'unverify' : 'verify';
merchantEditLog.info(`Toggle verification: ${action}`);
- if (!confirm(`Are you sure you want to ${action} this merchant?`)) {
- merchantEditLog.info('Verification toggle cancelled by user');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/merchants/${this.merchantId}/verification`;
@@ -199,11 +200,6 @@ function adminMerchantEdit() {
const action = this.merchant.is_active ? 'deactivate' : 'activate';
merchantEditLog.info(`Toggle active status: ${action}`);
- if (!confirm(`Are you sure you want to ${action} this merchant?\n\nThis will affect all stores under this merchant.`)) {
- merchantEditLog.info('Active status toggle cancelled by user');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/merchants/${this.merchantId}/status`;
@@ -343,8 +339,8 @@ function adminMerchantEdit() {
this.userSearchResults = [];
},
- // Delete merchant
- async deleteMerchant() {
+ // Prompt delete merchant (first step of double confirm)
+ promptDeleteMerchant() {
merchantEditLog.info('=== DELETING MERCHANT ===');
if (this.merchant.store_count > 0) {
@@ -352,16 +348,17 @@ function adminMerchantEdit() {
return;
}
- if (!confirm(`Are you sure you want to delete merchant "${this.merchant.name}"?\n\nThis action cannot be undone.`)) {
- merchantEditLog.info('Merchant deletion cancelled by user');
- return;
- }
+ this.showDeleteMerchantModal = true;
+ },
- // Double confirmation for critical action
- if (!confirm(`FINAL CONFIRMATION: Delete "${this.merchant.name}"?\n\nThis will permanently delete the merchant and all its data.`)) {
- merchantEditLog.info('Merchant deletion cancelled at final confirmation');
- return;
- }
+ // Confirm first step, show final confirmation
+ confirmDeleteMerchantStep() {
+ this.showDeleteMerchantFinalModal = true;
+ },
+
+ // Delete merchant
+ async deleteMerchant() {
+ merchantEditLog.info('=== DELETING MERCHANT (confirmed) ===');
this.saving = true;
try {
diff --git a/app/modules/tenancy/static/admin/js/merchant-user-detail.js b/app/modules/tenancy/static/admin/js/merchant-user-detail.js
index a44d727d..e22b7cda 100644
--- a/app/modules/tenancy/static/admin/js/merchant-user-detail.js
+++ b/app/modules/tenancy/static/admin/js/merchant-user-detail.js
@@ -16,6 +16,9 @@ function merchantUserDetailPage() {
saving: false,
error: null,
userId: null,
+ showToggleStatusModal: false,
+ showDeleteModal: false,
+ showDeleteFinalModal: false,
// Initialize
async init() {
@@ -100,11 +103,6 @@ function merchantUserDetailPage() {
const action = this.merchantUser.is_active ? 'deactivate' : 'activate';
merchantUserDetailLog.info(`Toggle status: ${action}`);
- if (!confirm(`Are you sure you want to ${action} "${this.merchantUser.full_name || this.merchantUser.username}"?`)) {
- merchantUserDetailLog.info('Status toggle cancelled by user');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/users/${this.userId}/status`;
@@ -126,21 +124,16 @@ function merchantUserDetailPage() {
}
},
+ // Intermediate step for double-confirm delete
+ confirmDeleteStep() {
+ merchantUserDetailLog.info('First delete confirmation accepted, showing final confirmation');
+ this.showDeleteFinalModal = true;
+ },
+
// Delete user
async deleteUser() {
merchantUserDetailLog.info('Delete user requested:', this.userId);
- if (!confirm(`Are you sure you want to delete "${this.merchantUser.full_name || this.merchantUser.username}"?\n\nThis action cannot be undone.`)) {
- merchantUserDetailLog.info('Delete cancelled by user');
- return;
- }
-
- // Second confirmation for safety
- if (!confirm(`FINAL CONFIRMATION\n\nAre you absolutely sure you want to delete "${this.merchantUser.full_name || this.merchantUser.username}"?`)) {
- merchantUserDetailLog.info('Delete cancelled by user (second confirmation)');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/users/${this.userId}`;
diff --git a/app/modules/tenancy/static/admin/js/merchant-users.js b/app/modules/tenancy/static/admin/js/merchant-users.js
index 58618b74..43c53058 100644
--- a/app/modules/tenancy/static/admin/js/merchant-users.js
+++ b/app/modules/tenancy/static/admin/js/merchant-users.js
@@ -16,6 +16,11 @@ function merchantUsersPage() {
merchantUsers: [],
loading: false,
error: null,
+ showToggleStatusModal: false,
+ showDeleteModal: false,
+ showDeleteFinalModal: false,
+ userToToggle: null,
+ userToDelete: null,
filters: {
search: '',
is_active: ''
@@ -230,11 +235,6 @@ function merchantUsersPage() {
const action = user.is_active ? 'deactivate' : 'activate';
merchantUsersLog.info(`Toggle status: ${action} for user`, user.username);
- if (!confirm(`Are you sure you want to ${action} "${user.full_name || user.username || user.email}"?`)) {
- merchantUsersLog.info('Status toggle cancelled by user');
- return;
- }
-
try {
const url = `/admin/users/${user.id}/status`;
window.LogConfig.logApiCall('PUT', url, null, 'request');
@@ -254,21 +254,16 @@ function merchantUsersPage() {
}
},
+ // Intermediate step for double-confirm delete
+ confirmDeleteStep() {
+ merchantUsersLog.info('First delete confirmation accepted, showing final confirmation');
+ this.showDeleteFinalModal = true;
+ },
+
// Delete user
async deleteUser(user) {
merchantUsersLog.warn('Delete user requested:', user.username);
- if (!confirm(`Are you sure you want to delete "${user.full_name || user.username || user.email}"?\n\nThis action cannot be undone.`)) {
- merchantUsersLog.info('Delete cancelled by user');
- return;
- }
-
- // Second confirmation for safety
- if (!confirm(`FINAL CONFIRMATION\n\nAre you absolutely sure you want to delete "${user.full_name || user.username || user.email}"?`)) {
- merchantUsersLog.info('Delete cancelled by user (second confirmation)');
- return;
- }
-
try {
const url = `/admin/users/${user.id}`;
window.LogConfig.logApiCall('DELETE', url, null, 'request');
diff --git a/app/modules/tenancy/static/admin/js/merchants.js b/app/modules/tenancy/static/admin/js/merchants.js
index 214eba88..bee2b710 100644
--- a/app/modules/tenancy/static/admin/js/merchants.js
+++ b/app/modules/tenancy/static/admin/js/merchants.js
@@ -26,6 +26,10 @@ function adminMerchants() {
loading: false,
error: null,
+ // Modal state
+ showDeleteMerchantModal: false,
+ merchantToDelete: null,
+
// Search and filters
filters: {
search: '',
@@ -192,23 +196,19 @@ function adminMerchants() {
window.location.href = `/admin/merchants/${merchantId}/edit`;
},
- // Delete merchant
- async deleteMerchant(merchant) {
+ // Prompt delete merchant modal
+ promptDeleteMerchant(merchant) {
if (merchant.store_count > 0) {
merchantsLog.warn('Cannot delete merchant with stores');
Utils.showToast(`Cannot delete "${merchant.name}" because it has ${merchant.store_count} store(s). Please delete or reassign the stores first.`, 'warning');
return;
}
+ this.merchantToDelete = merchant;
+ this.showDeleteMerchantModal = true;
+ },
- const confirmed = confirm(
- `Are you sure you want to delete "${merchant.name}"?\n\nThis action cannot be undone.`
- );
-
- if (!confirmed) {
- merchantsLog.info('Delete cancelled by user');
- return;
- }
-
+ // Delete merchant
+ async deleteMerchant(merchant) {
try {
merchantsLog.info('Deleting merchant:', merchant.id);
diff --git a/app/modules/tenancy/static/admin/js/platform-menu-config.js b/app/modules/tenancy/static/admin/js/platform-menu-config.js
index 2c3195dd..c84a7c05 100644
--- a/app/modules/tenancy/static/admin/js/platform-menu-config.js
+++ b/app/modules/tenancy/static/admin/js/platform-menu-config.js
@@ -18,6 +18,8 @@ function adminPlatformMenuConfig(platformCode) {
error: null,
successMessage: null,
saving: false,
+ showShowAllModal: false,
+ showHideAllModal: false,
// Data
platform: null,
@@ -160,10 +162,6 @@ function adminPlatformMenuConfig(platformCode) {
},
async showAll() {
- if (!confirm(I18n.t('tenancy.confirmations.show_all_menu_items'))) {
- return;
- }
-
this.saving = true;
this.error = null;
this.successMessage = null;
@@ -186,10 +184,6 @@ function adminPlatformMenuConfig(platformCode) {
},
async resetToDefaults() {
- if (!confirm(I18n.t('tenancy.confirmations.hide_all_menu_items'))) {
- return;
- }
-
this.saving = true;
this.error = null;
this.successMessage = null;
diff --git a/app/modules/tenancy/static/admin/js/platform-modules.js b/app/modules/tenancy/static/admin/js/platform-modules.js
index e876283c..5d082f2f 100644
--- a/app/modules/tenancy/static/admin/js/platform-modules.js
+++ b/app/modules/tenancy/static/admin/js/platform-modules.js
@@ -15,6 +15,8 @@ function adminPlatformModules(platformCode) {
error: null,
successMessage: null,
saving: false,
+ showEnableAllModal: false,
+ showDisableOptionalModal: false,
// Data
platform: null,
@@ -176,10 +178,6 @@ function adminPlatformModules(platformCode) {
},
async enableAll() {
- if (!confirm(I18n.t('tenancy.confirmations.enable_all_modules'))) {
- return;
- }
-
this.saving = true;
this.error = null;
this.successMessage = null;
@@ -207,10 +205,6 @@ function adminPlatformModules(platformCode) {
},
async disableOptional() {
- if (!confirm(I18n.t('tenancy.confirmations.disable_optional_modules'))) {
- return;
- }
-
this.saving = true;
this.error = null;
this.successMessage = null;
diff --git a/app/modules/tenancy/static/admin/js/store-detail.js b/app/modules/tenancy/static/admin/js/store-detail.js
index 9aad4fa3..d30ad8a3 100644
--- a/app/modules/tenancy/static/admin/js/store-detail.js
+++ b/app/modules/tenancy/static/admin/js/store-detail.js
@@ -17,6 +17,8 @@ function adminStoreDetail() {
loading: false,
error: null,
storeCode: null,
+ showDeleteStoreModal: false,
+ showDeleteStoreFinalModal: false,
// Initialize
async init() {
@@ -143,21 +145,20 @@ function adminStoreDetail() {
return 'bg-green-500';
},
+ // Prompt delete store (first step of double confirm)
+ promptDeleteStore() {
+ detailLog.info('Delete store requested:', this.storeCode);
+ this.showDeleteStoreModal = true;
+ },
+
+ // Confirm first step, show final confirmation
+ confirmDeleteStoreStep() {
+ detailLog.info('First delete confirmation accepted, showing final confirmation');
+ this.showDeleteStoreFinalModal = true;
+ },
+
// Delete store
async deleteStore() {
- detailLog.info('Delete store requested:', this.storeCode);
-
- if (!confirm(`Are you sure you want to delete store "${this.store.name}"?\n\nThis action cannot be undone and will delete:\n- All products\n- All orders\n- All customers\n- All team members`)) {
- detailLog.info('Delete cancelled by user');
- return;
- }
-
- // Second confirmation for safety
- if (!confirm(`FINAL CONFIRMATION\n\nType the store code to confirm: ${this.store.store_code}\n\nAre you absolutely sure?`)) {
- detailLog.info('Delete cancelled by user (second confirmation)');
- return;
- }
-
try {
const url = `/admin/stores/${this.storeCode}?confirm=true`;
window.LogConfig.logApiCall('DELETE', url, null, 'request');
@@ -189,4 +190,4 @@ function adminStoreDetail() {
};
}
-detailLog.info('Store detail module loaded');
\ No newline at end of file
+detailLog.info('Store detail module loaded');
diff --git a/app/modules/tenancy/static/admin/js/store-edit.js b/app/modules/tenancy/static/admin/js/store-edit.js
index 2647d381..5ea21781 100644
--- a/app/modules/tenancy/static/admin/js/store-edit.js
+++ b/app/modules/tenancy/static/admin/js/store-edit.js
@@ -18,6 +18,10 @@ function adminStoreEdit() {
loadingStore: false,
saving: false,
storeCode: null,
+ showToggleVerificationModal: false,
+ showToggleActiveModal: false,
+ showDeleteStoreModal: false,
+ showDeleteStoreFinalModal: false,
// Initialize
async init() {
@@ -166,11 +170,6 @@ function adminStoreEdit() {
const action = this.store.is_verified ? 'unverify' : 'verify';
editLog.info(`Toggle verification: ${action}`);
- if (!confirm(`Are you sure you want to ${action} this store?`)) {
- editLog.info('Verification toggle cancelled by user');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/stores/${this.storeCode}/verification`;
@@ -199,11 +198,6 @@ function adminStoreEdit() {
const action = this.store.is_active ? 'deactivate' : 'activate';
editLog.info(`Toggle active status: ${action}`);
- if (!confirm(`Are you sure you want to ${action} this store?\n\nThis will affect their operations.`)) {
- editLog.info('Active status toggle cancelled by user');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/stores/${this.storeCode}/status`;
@@ -227,22 +221,20 @@ function adminStoreEdit() {
}
},
+ // Prompt delete store (first step of double confirm)
+ promptDeleteStore() {
+ editLog.info('Delete store requested');
+ this.showDeleteStoreModal = true;
+ },
+
+ // Confirm first step, show final confirmation
+ confirmDeleteStoreStep() {
+ editLog.info('First delete confirmation accepted, showing final confirmation');
+ this.showDeleteStoreFinalModal = true;
+ },
+
// Delete store
async deleteStore() {
- editLog.info('Delete store requested');
-
- const storeName = this.store?.name || this.storeCode;
- if (!confirm(`Are you sure you want to delete "${storeName}"?\n\n⚠️ WARNING: This will permanently delete:\n• All products\n• All orders\n• All customers\n• All team members\n\nThis action cannot be undone!`)) {
- editLog.info('Delete cancelled by user');
- return;
- }
-
- // Double confirmation for safety
- if (!confirm(`FINAL CONFIRMATION\n\nType OK to permanently delete "${storeName}" and ALL associated data.`)) {
- editLog.info('Delete cancelled at final confirmation');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/stores/${this.storeCode}?confirm=true`;
@@ -311,4 +303,4 @@ function adminStoreEdit() {
};
}
-editLog.info('Store edit module loaded');
\ No newline at end of file
+editLog.info('Store edit module loaded');
diff --git a/app/modules/tenancy/static/admin/js/store-theme.js b/app/modules/tenancy/static/admin/js/store-theme.js
index a339df85..b9187838 100644
--- a/app/modules/tenancy/static/admin/js/store-theme.js
+++ b/app/modules/tenancy/static/admin/js/store-theme.js
@@ -31,6 +31,7 @@ function adminStoreTheme() {
loading: true,
saving: false,
error: null,
+ showResetThemeModal: false,
// Theme data structure matching StoreTheme model
themeData: {
@@ -272,10 +273,6 @@ function adminStoreTheme() {
},
async resetTheme() {
- if (!confirm(I18n.t('tenancy.confirmations.reset_theme'))) {
- return;
- }
-
themeLog.warn('Resetting theme to default');
this.saving = true;
@@ -332,4 +329,4 @@ function adminStoreTheme() {
// MODULE LOADED
// ============================================================================
-themeLog.info('Store theme editor module loaded');
\ No newline at end of file
+themeLog.info('Store theme editor module loaded');
diff --git a/app/modules/tenancy/static/admin/js/stores.js b/app/modules/tenancy/static/admin/js/stores.js
index eba34cf0..ce6c07d1 100644
--- a/app/modules/tenancy/static/admin/js/stores.js
+++ b/app/modules/tenancy/static/admin/js/stores.js
@@ -25,6 +25,8 @@ function adminStores() {
},
loading: false,
error: null,
+ showDeleteStoreModal: false,
+ storeToDelete: null,
// Search and filters
filters: {
@@ -283,15 +285,15 @@ function adminStores() {
window.location.href = url;
},
+ // Prompt delete store
+ promptDeleteStore(store) {
+ storesLog.info('Delete store requested:', store.store_code);
+ this.storeToDelete = store;
+ this.showDeleteStoreModal = true;
+ },
+
// Delete store
async deleteStore(store) {
- storesLog.info('Delete store requested:', store.store_code);
-
- if (!confirm(`Are you sure you want to delete store "${store.name}"?\n\nThis action cannot be undone.`)) {
- storesLog.info('Delete cancelled by user');
- return;
- }
-
try {
const url = `/admin/stores/${store.store_code}`;
window.LogConfig.logApiCall('DELETE', url, null, 'request');
@@ -329,4 +331,4 @@ function adminStores() {
};
}
-storesLog.info('Stores module loaded');
\ No newline at end of file
+storesLog.info('Stores module loaded');
diff --git a/app/modules/tenancy/static/admin/js/user-detail.js b/app/modules/tenancy/static/admin/js/user-detail.js
index d7862cf8..6d75f00b 100644
--- a/app/modules/tenancy/static/admin/js/user-detail.js
+++ b/app/modules/tenancy/static/admin/js/user-detail.js
@@ -16,6 +16,9 @@ function adminUserDetail() {
saving: false,
error: null,
userId: null,
+ showToggleStatusModal: false,
+ showDeleteModal: false,
+ showDeleteFinalModal: false,
// Initialize
async init() {
@@ -97,11 +100,6 @@ function adminUserDetail() {
const action = this.user.is_active ? 'deactivate' : 'activate';
userDetailLog.info(`Toggle status: ${action}`);
- if (!confirm(`Are you sure you want to ${action} ${this.user.username}?`)) {
- userDetailLog.info('Status toggle cancelled by user');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/users/${this.userId}/status`;
@@ -123,6 +121,12 @@ function adminUserDetail() {
}
},
+ // Intermediate step for double-confirm delete
+ confirmDeleteStep() {
+ userDetailLog.info('First delete confirmation accepted, showing final confirmation');
+ this.showDeleteFinalModal = true;
+ },
+
// Delete user
async deleteUser() {
userDetailLog.info('Delete user requested:', this.userId);
@@ -132,17 +136,6 @@ function adminUserDetail() {
return;
}
- if (!confirm(`Are you sure you want to delete "${this.user.username}"?\n\nThis action cannot be undone.`)) {
- userDetailLog.info('Delete cancelled by user');
- return;
- }
-
- // Second confirmation for safety
- if (!confirm(`FINAL CONFIRMATION\n\nAre you absolutely sure you want to delete "${this.user.username}"?`)) {
- userDetailLog.info('Delete cancelled by user (second confirmation)');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/users/${this.userId}`;
diff --git a/app/modules/tenancy/static/admin/js/user-edit.js b/app/modules/tenancy/static/admin/js/user-edit.js
index 244018d2..98050201 100644
--- a/app/modules/tenancy/static/admin/js/user-edit.js
+++ b/app/modules/tenancy/static/admin/js/user-edit.js
@@ -17,6 +17,9 @@ function adminUserEdit() {
loadingUser: false,
saving: false,
userId: null,
+ showToggleStatusModal: false,
+ showDeleteModal: false,
+ showDeleteFinalModal: false,
// Initialize
async init() {
@@ -154,11 +157,6 @@ function adminUserEdit() {
const action = this.user.is_active ? 'deactivate' : 'activate';
userEditLog.info(`Toggle status: ${action}`);
- if (!confirm(`Are you sure you want to ${action} ${this.user.username}?`)) {
- userEditLog.info('Status toggle cancelled by user');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/users/${this.userId}/status`;
@@ -180,6 +178,12 @@ function adminUserEdit() {
}
},
+ // Intermediate step for double-confirm delete
+ confirmDeleteStep() {
+ userEditLog.info('First delete confirmation accepted, showing final confirmation');
+ this.showDeleteFinalModal = true;
+ },
+
// Delete user
async deleteUser() {
userEditLog.info('=== DELETING USER ===');
@@ -189,17 +193,6 @@ function adminUserEdit() {
return;
}
- if (!confirm(`Are you sure you want to delete user "${this.user.username}"?\n\nThis action cannot be undone.`)) {
- userEditLog.info('User deletion cancelled by user');
- return;
- }
-
- // Double confirmation for critical action
- if (!confirm(`FINAL CONFIRMATION: Delete "${this.user.username}"?\n\nThis will permanently delete the user.`)) {
- userEditLog.info('User deletion cancelled at final confirmation');
- return;
- }
-
this.saving = true;
try {
const url = `/admin/users/${this.userId}`;
diff --git a/app/modules/tenancy/static/admin/js/users.js b/app/modules/tenancy/static/admin/js/users.js
index 9afe68c1..af2eefdc 100644
--- a/app/modules/tenancy/static/admin/js/users.js
+++ b/app/modules/tenancy/static/admin/js/users.js
@@ -16,6 +16,10 @@ function adminUsers() {
users: [],
loading: false,
error: null,
+ showToggleStatusModal: false,
+ showDeleteModal: false,
+ userToToggle: null,
+ userToDelete: null,
filters: {
search: '',
role: '',
@@ -171,15 +175,15 @@ function adminUsers() {
// Load statistics
async loadStats() {
usersLog.info('Loading user statistics...');
-
+
try {
const url = '/admin/users/stats';
window.LogConfig.logApiCall('GET', url, null, 'request');
-
+
const response = await apiClient.get(url); // ✅ Fixed: lowercase apiClient
-
+
window.LogConfig.logApiCall('GET', url, response, 'response');
-
+
if (response) {
this.stats = response;
usersLog.debug('Stats loaded:', this.stats);
@@ -242,23 +246,18 @@ function adminUsers() {
async toggleUserStatus(user) {
const action = user.is_active ? 'deactivate' : 'activate';
usersLog.info(`Toggle user status: ${action}`, user.username);
-
- if (!confirm(`Are you sure you want to ${action} ${user.username}?`)) {
- usersLog.info('Status toggle cancelled by user');
- return;
- }
try {
const url = `/admin/users/${user.id}/status`;
window.LogConfig.logApiCall('PUT', url, { is_active: !user.is_active }, 'request');
-
+
await apiClient.put(url, { // ✅ Fixed: lowercase apiClient
is_active: !user.is_active
});
-
+
Utils.showToast(`User ${action}d successfully`, 'success');
usersLog.info(`User ${action}d successfully`);
-
+
await this.loadUsers();
await this.loadStats();
} catch (error) {
@@ -269,21 +268,16 @@ function adminUsers() {
async deleteUser(user) {
usersLog.warn('Delete user requested:', user.username);
-
- if (!confirm(`Are you sure you want to delete ${user.username}? This action cannot be undone.`)) {
- usersLog.info('Delete cancelled by user');
- return;
- }
try {
const url = `/admin/users/${user.id}`;
window.LogConfig.logApiCall('DELETE', url, null, 'request');
-
+
await apiClient.delete(url); // ✅ Fixed: lowercase apiClient
-
+
Utils.showToast(I18n.t('tenancy.messages.user_deleted_successfully'), 'success');
usersLog.info('User deleted successfully');
-
+
await this.loadUsers();
await this.loadStats();
} catch (error) {
@@ -299,4 +293,4 @@ function adminUsers() {
};
}
-usersLog.info('Users module loaded');
\ No newline at end of file
+usersLog.info('Users module loaded');
diff --git a/app/modules/tenancy/templates/tenancy/admin/admin-user-detail.html b/app/modules/tenancy/templates/tenancy/admin/admin-user-detail.html
index b5a630a6..799cd0c7 100644
--- a/app/modules/tenancy/templates/tenancy/admin/admin-user-detail.html
+++ b/app/modules/tenancy/templates/tenancy/admin/admin-user-detail.html
@@ -2,6 +2,7 @@
{% extends "admin/base.html" %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/headers.html' import detail_page_header %}
+{% from 'shared/macros/modals.html' import confirm_modal_dynamic %}
{% block title %}Admin User Details{% endblock %}
@@ -33,7 +34,7 @@
Edit Admin User
@@ -231,6 +232,42 @@
+
+
+{{ confirm_modal_dynamic(
+ 'toggleStatusModal',
+ 'Toggle User Status',
+ "'Are you sure you want to ' + (adminUser?.is_active ? 'deactivate' : 'activate') + ' \"' + (adminUser?.username || '') + '\"?'",
+ 'toggleStatus()',
+ 'showToggleStatusModal',
+ 'Confirm',
+ 'Cancel',
+ 'warning'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'deleteAdminUserModal',
+ 'Delete Admin User',
+ "'Are you sure you want to delete admin user \"' + (adminUser?.username || '') + '\"? This action cannot be undone.'",
+ 'confirmDeleteStep()',
+ 'showDeleteModal',
+ 'Delete',
+ 'Cancel',
+ 'danger'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'deleteAdminUserFinalModal',
+ 'Final Confirmation',
+ "'FINAL CONFIRMATION: Are you absolutely sure you want to permanently delete \"' + (adminUser?.username || '') + '\"?'",
+ 'deleteAdminUser()',
+ 'showDeleteFinalModal',
+ 'Permanently Delete',
+ 'Cancel',
+ 'danger'
+) }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/admin-user-edit.html b/app/modules/tenancy/templates/tenancy/admin/admin-user-edit.html
index 6cfe6d03..ed4b4bf9 100644
--- a/app/modules/tenancy/templates/tenancy/admin/admin-user-edit.html
+++ b/app/modules/tenancy/templates/tenancy/admin/admin-user-edit.html
@@ -25,7 +25,7 @@
@@ -265,6 +265,54 @@
'Cancel',
'warning'
) }}
+
+
+{{ confirm_modal_dynamic(
+ 'toggleSuperAdminModal',
+ 'Toggle Super Admin',
+ "'Are you sure you want to ' + (adminUser?.is_super_admin ? 'demote' : 'promote') + ' \"' + (adminUser?.username || '') + '\" ' + (adminUser?.is_super_admin ? 'from' : 'to') + ' super admin?'",
+ 'toggleSuperAdmin()',
+ 'showToggleSuperAdminModal',
+ 'Confirm',
+ 'Cancel',
+ 'warning'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'toggleStatusModal',
+ 'Toggle User Status',
+ "'Are you sure you want to ' + (adminUser?.is_active ? 'deactivate' : 'activate') + ' \"' + (adminUser?.username || '') + '\"?'",
+ 'toggleStatus()',
+ 'showToggleStatusModal',
+ 'Confirm',
+ 'Cancel',
+ 'warning'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'deleteAdminUserModal',
+ 'Delete Admin User',
+ "'Are you sure you want to delete admin user \"' + (adminUser?.username || '') + '\"? This action cannot be undone.'",
+ 'confirmDeleteStep()',
+ 'showDeleteModal',
+ 'Delete',
+ 'Cancel',
+ 'danger'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'deleteAdminUserFinalModal',
+ 'Final Confirmation',
+ "'FINAL CONFIRMATION: Are you absolutely sure you want to permanently delete \"' + (adminUser?.username || '') + '\"?'",
+ 'deleteAdminUser()',
+ 'showDeleteFinalModal',
+ 'Permanently Delete',
+ 'Cancel',
+ 'danger'
+) }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/admin-users.html b/app/modules/tenancy/templates/tenancy/admin/admin-users.html
index a66e7003..6fb5d913 100644
--- a/app/modules/tenancy/templates/tenancy/admin/admin-users.html
+++ b/app/modules/tenancy/templates/tenancy/admin/admin-users.html
@@ -4,6 +4,7 @@
{% from 'shared/macros/headers.html' import page_header %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/tables.html' import table_wrapper, table_header %}
+{% from 'shared/macros/modals.html' import confirm_modal_dynamic %}
{% block title %}Admin Users{% endblock %}
@@ -239,7 +240,7 @@
+
+
+{{ confirm_modal_dynamic(
+ 'deleteAdminUserModal',
+ 'Delete Admin User',
+ "'Are you sure you want to delete admin user \"' + (adminToDelete?.username || '') + '\"? This action cannot be undone.'",
+ 'confirmDeleteStep()',
+ 'showDeleteModal',
+ 'Delete',
+ 'Cancel',
+ 'danger'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'deleteAdminUserFinalModal',
+ 'Final Confirmation',
+ "'FINAL CONFIRMATION: Are you absolutely sure you want to permanently delete \"' + (adminToDelete?.username || '') + '\"?'",
+ 'deleteAdminUser(adminToDelete)',
+ 'showDeleteFinalModal',
+ 'Permanently Delete',
+ 'Cancel',
+ 'danger'
+) }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/merchant-detail.html b/app/modules/tenancy/templates/tenancy/admin/merchant-detail.html
index c2dc184d..87bd179f 100644
--- a/app/modules/tenancy/templates/tenancy/admin/merchant-detail.html
+++ b/app/modules/tenancy/templates/tenancy/admin/merchant-detail.html
@@ -4,6 +4,7 @@
{% extends "admin/base.html" %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/headers.html' import detail_page_header %}
+{% from 'shared/macros/modals.html' import confirm_modal_dynamic %}
{% block title %}Merchant Details{% endblock %}
@@ -42,7 +43,7 @@
Create Subscription
@@ -456,6 +457,28 @@
Stores created will be associated with this merchant.
+
+ {{ confirm_modal_dynamic(
+ 'deleteMerchantModal',
+ 'Delete Merchant',
+ "'Are you sure you want to delete merchant \"' + (merchant?.name || '') + '\"? This action cannot be undone.'",
+ 'confirmDeleteMerchantStep()',
+ 'showDeleteMerchantModal',
+ 'Continue',
+ 'Cancel',
+ 'danger'
+ ) }}
+
+ {{ confirm_modal_dynamic(
+ 'deleteMerchantFinalModal',
+ 'Final Confirmation',
+ "'Are you absolutely sure you want to delete \"' + (merchant?.name || '') + '\"?'",
+ 'deleteMerchant()',
+ 'showDeleteMerchantFinalModal',
+ 'Delete Permanently',
+ 'Cancel',
+ 'danger'
+ ) }}
{% endblock %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/merchant-edit.html b/app/modules/tenancy/templates/tenancy/admin/merchant-edit.html
index 1ffa21b1..79247305 100644
--- a/app/modules/tenancy/templates/tenancy/admin/merchant-edit.html
+++ b/app/modules/tenancy/templates/tenancy/admin/merchant-edit.html
@@ -3,6 +3,7 @@
{% from 'shared/macros/alerts.html' import loading_state %}
{% from 'shared/macros/inputs.html' import search_autocomplete, selected_item_display %}
{% from 'shared/macros/headers.html' import edit_page_header %}
+{% from 'shared/macros/modals.html' import confirm_modal_dynamic %}
{% block title %}Edit Merchant{% endblock %}
@@ -24,7 +25,7 @@
@@ -33,7 +34,7 @@
@@ -290,7 +291,7 @@
+ {{ confirm_modal_dynamic(
+ 'toggleVerificationModal',
+ 'Toggle Verification',
+ "merchant?.is_verified ? 'Are you sure you want to unverify this merchant?' : 'Are you sure you want to verify this merchant?'",
+ 'toggleVerification()',
+ 'showToggleVerificationModal',
+ 'Confirm',
+ 'Cancel',
+ 'warning'
+ ) }}
+
+ {{ confirm_modal_dynamic(
+ 'toggleActiveModal',
+ 'Toggle Active Status',
+ "merchant?.is_active ? 'Are you sure you want to deactivate this merchant? This will affect all stores under this merchant.' : 'Are you sure you want to activate this merchant? This will affect all stores under this merchant.'",
+ 'toggleActive()',
+ 'showToggleActiveModal',
+ 'Confirm',
+ 'Cancel',
+ 'warning'
+ ) }}
+
+ {{ confirm_modal_dynamic(
+ 'deleteMerchantModal',
+ 'Delete Merchant',
+ "'Are you sure you want to delete merchant \"' + (merchant?.name || '') + '\"? This action cannot be undone.'",
+ 'confirmDeleteMerchantStep()',
+ 'showDeleteMerchantModal',
+ 'Continue',
+ 'Cancel',
+ 'danger'
+ ) }}
+
+ {{ confirm_modal_dynamic(
+ 'deleteMerchantFinalModal',
+ 'Final Confirmation',
+ "'FINAL CONFIRMATION: Delete \"' + (merchant?.name || '') + '\"? This will permanently delete the merchant and all its data.'",
+ 'deleteMerchant()',
+ 'showDeleteMerchantFinalModal',
+ 'Delete Permanently',
+ 'Cancel',
+ 'danger'
+ ) }}
+
{# noqa: FE-004 - Complex form modal with dynamic user search and transfer functionality #}
@@ -35,7 +36,7 @@
@@ -243,6 +244,39 @@
+
+ {{ confirm_modal_dynamic(
+ 'toggleStatusModal',
+ 'Toggle User Status',
+ "merchantUser?.is_active ? 'Are you sure you want to deactivate \"' + (merchantUser?.full_name || merchantUser?.username || '') + '\"?' : 'Are you sure you want to activate \"' + (merchantUser?.full_name || merchantUser?.username || '') + '\"?'",
+ 'toggleStatus()',
+ 'showToggleStatusModal',
+ 'Confirm',
+ 'Cancel',
+ 'warning'
+ ) }}
+
+ {{ confirm_modal_dynamic(
+ 'deleteUserModal',
+ 'Delete User',
+ "'Are you sure you want to delete \"' + (merchantUser?.full_name || merchantUser?.username || '') + '\"? This action cannot be undone.'",
+ 'confirmDeleteStep()',
+ 'showDeleteModal',
+ 'Continue',
+ 'Cancel',
+ 'danger'
+ ) }}
+
+ {{ confirm_modal_dynamic(
+ 'deleteUserFinalModal',
+ 'Final Confirmation',
+ "'Are you absolutely sure you want to delete \"' + (merchantUser?.full_name || merchantUser?.username || '') + '\"?'",
+ 'deleteUser()',
+ 'showDeleteFinalModal',
+ 'Delete Permanently',
+ 'Cancel',
+ 'danger'
+ ) }}
{% endblock %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/merchant-users.html b/app/modules/tenancy/templates/tenancy/admin/merchant-users.html
index 8e00f1f8..8012426f 100644
--- a/app/modules/tenancy/templates/tenancy/admin/merchant-users.html
+++ b/app/modules/tenancy/templates/tenancy/admin/merchant-users.html
@@ -4,6 +4,7 @@
{% from 'shared/macros/headers.html' import page_header %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/tables.html' import table_wrapper, table_header %}
+{% from 'shared/macros/modals.html' import confirm_modal, confirm_modal_dynamic %}
{% block title %}Merchant Users{% endblock %}
@@ -198,7 +199,7 @@
@@ -223,6 +224,42 @@
{{ pagination() }}
+
+
+{{ confirm_modal_dynamic(
+ 'toggleStatusModal',
+ 'Toggle User Status',
+ "'Are you sure you want to ' + (userToToggle?.is_active ? 'deactivate' : 'activate') + ' \"' + (userToToggle?.full_name || userToToggle?.username || userToToggle?.email || '') + '\"?'",
+ 'toggleUserStatus(userToToggle)',
+ 'showToggleStatusModal',
+ 'Confirm',
+ 'Cancel',
+ 'warning'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'deleteUserModal',
+ 'Delete User',
+ "'Are you sure you want to delete \"' + (userToDelete?.full_name || userToDelete?.username || userToDelete?.email || '') + '\"? This action cannot be undone.'",
+ 'confirmDeleteStep()',
+ 'showDeleteModal',
+ 'Delete',
+ 'Cancel',
+ 'danger'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'deleteUserFinalModal',
+ 'Final Confirmation',
+ "'FINAL CONFIRMATION: Are you absolutely sure you want to permanently delete \"' + (userToDelete?.full_name || userToDelete?.username || userToDelete?.email || '') + '\"?'",
+ 'deleteUser(userToDelete)',
+ 'showDeleteFinalModal',
+ 'Permanently Delete',
+ 'Cancel',
+ 'danger'
+) }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/merchants.html b/app/modules/tenancy/templates/tenancy/admin/merchants.html
index dec1bbc6..918d3626 100644
--- a/app/modules/tenancy/templates/tenancy/admin/merchants.html
+++ b/app/modules/tenancy/templates/tenancy/admin/merchants.html
@@ -4,6 +4,7 @@
{% from 'shared/macros/headers.html' import page_header %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/tables.html' import table_wrapper, table_header %}
+{% from 'shared/macros/modals.html' import confirm_modal_dynamic %}
{% block title %}Merchants{% endblock %}
@@ -225,7 +226,7 @@
+
+{{ confirm_modal_dynamic(
+ 'deleteMerchantModal',
+ 'Delete Merchant',
+ "'Are you sure you want to delete \"' + (merchantToDelete?.name || '') + '\"? This action cannot be undone.'",
+ 'deleteMerchant(merchantToDelete)',
+ 'showDeleteMerchantModal',
+ 'Delete',
+ 'Cancel',
+ 'danger'
+) }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/module-config.html b/app/modules/tenancy/templates/tenancy/admin/module-config.html
index d13e4b2b..de0e0096 100644
--- a/app/modules/tenancy/templates/tenancy/admin/module-config.html
+++ b/app/modules/tenancy/templates/tenancy/admin/module-config.html
@@ -2,6 +2,7 @@
{% extends "admin/base.html" %}
{% from 'shared/macros/alerts.html' import alert_dynamic, error_state %}
{% from 'shared/macros/headers.html' import page_header %}
+{% from 'shared/macros/modals.html' import confirm_modal %}
{% block title %}Module Configuration{% endblock %}
@@ -121,7 +122,7 @@
@@ -141,6 +142,9 @@
+
+{{ confirm_modal('resetConfirm', 'Reset Configuration', 'This will reset all configuration options to their default values. This action cannot be undone.', 'resetToDefaults()', 'showResetConfirm', 'Reset to Defaults', 'Cancel', 'warning') }}
+
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/platform-menu-config.html b/app/modules/tenancy/templates/tenancy/admin/platform-menu-config.html
index 3a7e00a4..3e31f079 100644
--- a/app/modules/tenancy/templates/tenancy/admin/platform-menu-config.html
+++ b/app/modules/tenancy/templates/tenancy/admin/platform-menu-config.html
@@ -2,6 +2,7 @@
{% extends "admin/base.html" %}
{% from 'shared/macros/alerts.html' import alert_dynamic, error_state %}
{% from 'shared/macros/headers.html' import page_header %}
+{% from 'shared/macros/modals.html' import confirm_modal %}
{% block title %}Menu Configuration{% endblock %}
@@ -94,7 +95,7 @@
@@ -102,7 +103,7 @@
Show All
@@ -193,6 +194,30 @@
+
+{{ confirm_modal(
+ 'showAllModal',
+ 'Show All Menu Items',
+ 'Are you sure you want to show all menu items? This will make all non-mandatory items visible.',
+ 'showAll()',
+ 'showShowAllModal',
+ 'Show All',
+ 'Cancel',
+ 'info'
+) }}
+
+
+{{ confirm_modal(
+ 'hideAllModal',
+ 'Hide All Menu Items',
+ 'Are you sure you want to hide all optional menu items? Only mandatory items will remain visible.',
+ 'resetToDefaults()',
+ 'showHideAllModal',
+ 'Hide All',
+ 'Cancel',
+ 'warning'
+) }}
+
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/platform-modules.html b/app/modules/tenancy/templates/tenancy/admin/platform-modules.html
index 4c4100dc..fe0a66e6 100644
--- a/app/modules/tenancy/templates/tenancy/admin/platform-modules.html
+++ b/app/modules/tenancy/templates/tenancy/admin/platform-modules.html
@@ -2,6 +2,7 @@
{% extends "admin/base.html" %}
{% from 'shared/macros/alerts.html' import alert_dynamic, error_state %}
{% from 'shared/macros/headers.html' import page_header %}
+{% from 'shared/macros/modals.html' import confirm_modal %}
{% block title %}Module Configuration{% endblock %}
@@ -76,7 +77,7 @@
@@ -84,7 +85,7 @@
Enable All
@@ -275,6 +276,30 @@
+
+{{ confirm_modal(
+ 'enableAllModal',
+ 'Enable All Modules',
+ 'Are you sure you want to enable all modules? This will activate all optional modules for this platform.',
+ 'enableAll()',
+ 'showEnableAllModal',
+ 'Enable All',
+ 'Cancel',
+ 'info'
+) }}
+
+
+{{ confirm_modal(
+ 'disableOptionalModal',
+ 'Disable Optional Modules',
+ 'Are you sure you want to disable all optional modules? Only core modules will remain enabled.',
+ 'disableOptional()',
+ 'showDisableOptionalModal',
+ 'Disable Optional',
+ 'Cancel',
+ 'warning'
+) }}
+
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/store-detail.html b/app/modules/tenancy/templates/tenancy/admin/store-detail.html
index e755ba5e..0fad2509 100644
--- a/app/modules/tenancy/templates/tenancy/admin/store-detail.html
+++ b/app/modules/tenancy/templates/tenancy/admin/store-detail.html
@@ -2,6 +2,7 @@
{% extends "admin/base.html" %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/headers.html' import detail_page_header %}
+{% from 'shared/macros/modals.html' import confirm_modal, confirm_modal_dynamic %}
{% block title %}Store Details{% endblock %}
@@ -33,7 +34,7 @@
Edit Store
Delete Store
@@ -385,6 +386,30 @@
Contact info and ownership are managed at the merchant level.
+
+
+ {{ confirm_modal_dynamic(
+ 'deleteStoreModal',
+ 'Delete Store',
+ "'Are you sure you want to delete \"' + (store?.name || '') + '\"? This will permanently delete all products, orders, customers, and team members. This action cannot be undone!'",
+ 'confirmDeleteStoreStep()',
+ 'showDeleteStoreModal',
+ 'Delete',
+ 'Cancel',
+ 'danger'
+ ) }}
+
+
+ {{ confirm_modal_dynamic(
+ 'deleteStoreFinalModal',
+ 'Final Confirmation',
+ "'FINAL CONFIRMATION: Are you absolutely sure you want to permanently delete \"' + (store?.name || '') + '\" and ALL associated data?'",
+ 'deleteStore()',
+ 'showDeleteStoreFinalModal',
+ 'Permanently Delete',
+ 'Cancel',
+ 'danger'
+ ) }}
{% endblock %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/store-edit.html b/app/modules/tenancy/templates/tenancy/admin/store-edit.html
index eba61ade..1653b281 100644
--- a/app/modules/tenancy/templates/tenancy/admin/store-edit.html
+++ b/app/modules/tenancy/templates/tenancy/admin/store-edit.html
@@ -2,6 +2,7 @@
{% extends "admin/base.html" %}
{% from 'shared/macros/alerts.html' import loading_state %}
{% from 'shared/macros/headers.html' import edit_page_header %}
+{% from 'shared/macros/modals.html' import confirm_modal, confirm_modal_dynamic %}
{% block title %}Edit Store{% endblock %}
@@ -25,7 +26,7 @@
@@ -34,7 +35,7 @@
@@ -425,6 +426,54 @@
+
+
+{{ confirm_modal_dynamic(
+ 'toggleVerificationModal',
+ 'Toggle Store Verification',
+ "store?.is_verified ? 'Are you sure you want to unverify this store?' : 'Are you sure you want to verify this store?'",
+ 'toggleVerification()',
+ 'showToggleVerificationModal',
+ 'Confirm',
+ 'Cancel',
+ 'warning'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'toggleActiveModal',
+ 'Toggle Store Status',
+ "store?.is_active ? 'Are you sure you want to deactivate this store? This will affect their operations.' : 'Are you sure you want to activate this store?'",
+ 'toggleActive()',
+ 'showToggleActiveModal',
+ 'Confirm',
+ 'Cancel',
+ 'warning'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'deleteStoreModal',
+ 'Delete Store',
+ "'Are you sure you want to delete \"' + (store?.name || '') + '\"? This will permanently delete all products, orders, customers, and team members. This action cannot be undone!'",
+ 'confirmDeleteStoreStep()',
+ 'showDeleteStoreModal',
+ 'Delete',
+ 'Cancel',
+ 'danger'
+) }}
+
+
+{{ confirm_modal_dynamic(
+ 'deleteStoreFinalModal',
+ 'Final Confirmation',
+ "'FINAL CONFIRMATION: Are you absolutely sure you want to permanently delete \"' + (store?.name || '') + '\" and ALL associated data?'",
+ 'deleteStore()',
+ 'showDeleteStoreFinalModal',
+ 'Permanently Delete',
+ 'Cancel',
+ 'danger'
+) }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/store-theme.html b/app/modules/tenancy/templates/tenancy/admin/store-theme.html
index 39f98249..f159e770 100644
--- a/app/modules/tenancy/templates/tenancy/admin/store-theme.html
+++ b/app/modules/tenancy/templates/tenancy/admin/store-theme.html
@@ -2,6 +2,7 @@
{% extends "admin/base.html" %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/headers.html' import page_header_flex %}
+{% from 'shared/macros/modals.html' import confirm_modal %}
{% block title %}Theme Editor - {{ store_code }}{% endblock %}
@@ -330,7 +331,7 @@
-
@@ -443,6 +444,18 @@
+
+
+{{ confirm_modal(
+ 'resetThemeModal',
+ 'Reset Theme',
+ 'Are you sure you want to reset the theme to default? All customizations will be lost.',
+ 'resetTheme()',
+ 'showResetThemeModal',
+ 'Reset',
+ 'Cancel',
+ 'warning'
+) }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/modules/tenancy/templates/tenancy/admin/stores.html b/app/modules/tenancy/templates/tenancy/admin/stores.html
index 165889d1..a72449ba 100644
--- a/app/modules/tenancy/templates/tenancy/admin/stores.html
+++ b/app/modules/tenancy/templates/tenancy/admin/stores.html
@@ -4,6 +4,7 @@
{% from 'shared/macros/headers.html' import page_header %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/tables.html' import table_wrapper, table_header %}
+{% from 'shared/macros/modals.html' import confirm_modal, confirm_modal_dynamic %}
{% block title %}Stores{% endblock %}
@@ -210,7 +211,7 @@
@@ -225,6 +226,18 @@
{{ pagination() }}
+
+
+{{ confirm_modal_dynamic(
+ 'deleteStoreModal',
+ 'Delete Store',
+ "'Are you sure you want to delete \"' + (storeToDelete?.name || '') + '\"? This action cannot be undone.'",
+ 'deleteStore(storeToDelete)',
+ 'showDeleteStoreModal',
+ 'Delete',
+ 'Cancel',
+ 'danger'
+) }}
{% endblock %}
{% block extra_scripts %}
diff --git a/app/templates/store/base.html b/app/templates/store/base.html
index fce27eb7..851a5628 100644
--- a/app/templates/store/base.html
+++ b/app/templates/store/base.html
@@ -1,4 +1,5 @@
{# app/templates/store/base.html #}
+{% from 'shared/macros/modals.html' import confirm_modal_dynamic %}
@@ -45,6 +46,9 @@
+
+ {{ confirm_modal_dynamic('limitReachedConfirm', 'Usage Limit Reached', '$store.upgrade.limitReachedMessage', '$store.upgrade.confirmUpgrade()', '$store.upgrade.showLimitReachedConfirm', 'Go to Billing', 'Dismiss', 'warning') }}
+
diff --git a/static/admin/js/module-config.js b/static/admin/js/module-config.js
index 5983882d..9a27cafe 100644
--- a/static/admin/js/module-config.js
+++ b/static/admin/js/module-config.js
@@ -17,6 +17,9 @@ function adminModuleConfig(platformCode, moduleCode) {
successMessage: null,
saving: false,
+ // Reset confirm state
+ showResetConfirm: false,
+
// Data
platformId: null,
platformName: '',
@@ -117,10 +120,6 @@ function adminModuleConfig(platformCode, moduleCode) {
},
async resetToDefaults() {
- if (!confirm('This will reset all configuration options to their default values. Continue?')) {
- return;
- }
-
this.saving = true;
this.error = null;
this.successMessage = null;
|