fix(loyalty): use confirm modal for category deletion
Some checks failed
CI / ruff (push) Successful in 17s
CI / pytest (push) Failing after 2h21m18s
CI / validate (push) Successful in 29s
CI / dependency-scanning (push) Successful in 33s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped

Replace browser confirm() dialog with the shared confirm_modal
macro for category deletion. Matches the existing program delete
pattern. Shows warning about impact on existing transactions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-25 14:40:29 +02:00
parent 255ac6525e
commit 56c94ac2f4
3 changed files with 23 additions and 5 deletions

View File

@@ -152,7 +152,7 @@
</div>
</div>
<!-- Delete Confirmation Modal -->
<!-- Delete Program Confirmation Modal -->
{{ confirm_modal(
'deleteProgramModal',
_('loyalty.admin.merchant_detail.delete_title'),
@@ -164,6 +164,18 @@
'danger'
) }}
<!-- Delete Category Confirmation Modal -->
{{ confirm_modal(
'deleteCategoryModal',
_('loyalty.common.delete'),
_('loyalty.admin.merchant_detail.delete_category_message'),
'confirmDeleteCategory()',
'showDeleteCategoryModal',
_('loyalty.common.delete'),
_('loyalty.common.cancel'),
'danger'
) }}
<!-- Location Breakdown -->
<div x-show="locations.length > 0" class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
<h3 class="mb-4 text-lg font-semibold text-gray-700 dark:text-gray-200">
@@ -287,7 +299,7 @@
class="text-sm" :class="cat.is_active ? 'text-orange-500 hover:text-orange-700' : 'text-green-500 hover:text-green-700'">
<span x-html="$icon(cat.is_active ? 'ban' : 'play', 'w-4 h-4')"></span>
</button>
<button @click="deleteCategory(cat.id)" type="button"
<button @click="categoryToDelete = cat.id; showDeleteCategoryModal = true" type="button"
aria-label="{{ _('loyalty.common.delete') }}"
class="text-red-500 hover:text-red-700">
<span x-html="$icon('trash', 'w-4 h-4')"></span>