fix: replace all native confirm() dialogs with styled modal macros
Some checks failed
CI / ruff (push) Successful in 9s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

Migrated ~68 native browser confirm() calls across 74 files to use the
project's confirm_modal/confirm_modal_dynamic Jinja2 macros, providing
consistent styled confirmation dialogs instead of plain browser popups.

Modules updated: core, tenancy, cms, marketplace, messaging, billing,
customers, orders, cart. Uses danger/warning/info variants and
double-confirm pattern for destructive delete operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 16:56:25 +01:00
parent 182610283d
commit 167bb50f4f
74 changed files with 939 additions and 436 deletions

View File

@@ -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');
editLog.info('Store edit module loaded');