fix(loyalty): use confirm modal for category deletion
Some checks failed
Some checks failed
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:
@@ -41,6 +41,8 @@ function adminLoyaltyMerchantDetail() {
|
||||
newCategoryTranslations: { fr: '', de: '', lb: '' },
|
||||
viewingCategoryId: null,
|
||||
editingCategoryId: null,
|
||||
showDeleteCategoryModal: false,
|
||||
categoryToDelete: null,
|
||||
editCategoryData: { name: '', translations: { fr: '', de: '', lb: '' } },
|
||||
|
||||
// State
|
||||
@@ -353,14 +355,17 @@ function adminLoyaltyMerchantDetail() {
|
||||
}
|
||||
},
|
||||
|
||||
async deleteCategory(catId) {
|
||||
if (!confirm('Delete this category?')) return;
|
||||
async confirmDeleteCategory() {
|
||||
if (!this.categoryToDelete) return;
|
||||
try {
|
||||
await apiClient.delete(`/admin/loyalty/stores/${this.selectedCategoryStoreId}/categories/${catId}`);
|
||||
await apiClient.delete(`/admin/loyalty/stores/${this.selectedCategoryStoreId}/categories/${this.categoryToDelete}`);
|
||||
await this.loadCategoriesForStore();
|
||||
Utils.showToast('Category deleted', 'success');
|
||||
} catch (error) {
|
||||
Utils.showToast(error.message || 'Failed to delete category', 'error');
|
||||
} finally {
|
||||
this.showDeleteCategoryModal = false;
|
||||
this.categoryToDelete = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user