Refactor feedback handling across components: Replace alert and confirm calls with centralized feedback functions for improved user experience. Update various components to utilize showError, showSuccess, and confirmAction for consistent messaging and confirmation dialogs. Enhance UI responsiveness and maintainability by streamlining feedback logic.

This commit is contained in:
Torsten Schulz (local)
2026-03-19 16:18:51 +01:00
parent ebfc2d8508
commit 78eba6b1fb
35 changed files with 1097 additions and 1017 deletions

View File

@@ -1,6 +1,5 @@
<template>
<div class="contenthidden">
<div class="contentscroll">
<div class="admin-taxi-tools-view">
<div class="admin-header">
<h1>{{ $t('admin.taxiTools.title') }}</h1>
<p>{{ $t('admin.taxiTools.description') }}</p>
@@ -367,8 +366,7 @@
</form>
</div>
</div>
</div>
<!-- Message Dialog -->
<MessageDialog ref="messageDialog" />
</div>
@@ -378,6 +376,7 @@
import SimpleTabs from '../../components/SimpleTabs.vue';
import MessageDialog from '../../dialogues/standard/MessageDialog.vue';
import apiClient from '../../utils/axios.js';
import { confirmAction, showError, showSuccess } from '@/utils/feedback.js';
// Matrix: erlaubte Haus-Tür-Richtungen je Tile-Typ und Ecke
// Richtungen: bottom, right, top, left
@@ -1216,10 +1215,10 @@ export default {
// Erfolgsmeldung anzeigen
const message = isUpdate ? 'admin.taxiTools.mapEditor.updateSuccess' : 'admin.taxiTools.mapEditor.createSuccess';
this.$refs.messageDialog.open(`tr:${message}`);
showSuccess(this, `tr:${message}`);
} catch (error) {
console.error('Fehler beim Speichern der Map:', error);
alert('Fehler beim Speichern der Map');
showError(this, 'Fehler beim Speichern der Map');
}
},
@@ -1247,16 +1246,20 @@ export default {
},
async deleteMap(mapId) {
if (confirm('Möchtest du diese Map wirklich löschen?')) {
try {
await apiClient.delete(`/api/taxi-maps/maps/${mapId}`);
this.loadMaps();
// Erfolgsmeldung anzeigen
this.$refs.messageDialog.open('tr:admin.taxiTools.mapEditor.deleteSuccess');
} catch (error) {
console.error('Fehler beim Löschen der Map:', error);
}
const confirmed = await confirmAction(this, {
title: 'Map löschen',
message: 'Möchtest du diese Map wirklich löschen?'
});
if (!confirmed) {
return;
}
try {
await apiClient.delete(`/api/taxi-maps/maps/${mapId}`);
this.loadMaps();
showSuccess(this, 'tr:admin.taxiTools.mapEditor.deleteSuccess');
} catch (error) {
console.error('Fehler beim Löschen der Map:', error);
showError(this, 'Fehler beim Löschen der Map');
}
}
}
@@ -1692,4 +1695,4 @@ export default {
height: 40px;
}
}
</style>
</style>