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

@@ -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 @@
</h3>
<div class="flex flex-wrap items-center gap-3">
<button
@click="toggleVerification()"
@click="showToggleVerificationModal = true"
:disabled="saving"
class="flex items-center px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 rounded-lg focus:outline-none focus:shadow-outline-purple disabled:opacity-50"
:class="{ 'bg-orange-600 hover:bg-orange-700': merchant && merchant.is_verified, 'bg-green-600 hover:bg-green-700': merchant && !merchant.is_verified }">
@@ -33,7 +34,7 @@
</button>
<button
@click="toggleActive()"
@click="showToggleActiveModal = true"
:disabled="saving"
class="flex items-center px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 rounded-lg focus:outline-none focus:shadow-outline-purple disabled:opacity-50"
:class="{ 'bg-red-600 hover:bg-red-700': merchant && merchant.is_active, 'bg-green-600 hover:bg-green-700': merchant && !merchant.is_active }">
@@ -290,7 +291,7 @@
<!-- Delete Merchant Button -->
<button
@click="deleteMerchant()"
@click="promptDeleteMerchant()"
:disabled="saving || (merchant?.store_count > 0)"
class="inline-flex items-center px-4 py-2 text-sm font-medium text-white transition-colors duration-150 bg-red-600 border border-transparent rounded-lg hover:bg-red-700 focus:outline-none focus:shadow-outline-red disabled:opacity-50"
:title="merchant?.store_count > 0 ? 'Cannot delete merchant with stores' : 'Delete this merchant'"
@@ -308,6 +309,50 @@
</p>
</div>
{{ 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 #}
<!-- Transfer Ownership Modal -->
<div