Refactor BranchView component to replace JavaScript alerts with a message dialog for success and error notifications. This improves user experience by providing a more integrated feedback mechanism within the UI.
This commit is contained in:
@@ -1014,12 +1014,15 @@ export default {
|
|||||||
});
|
});
|
||||||
await this.loadVehicles();
|
await this.loadVehicles();
|
||||||
this.closeRepairAllVehiclesDialog();
|
this.closeRepairAllVehiclesDialog();
|
||||||
alert(this.$t('falukant.branch.transport.repairAllSuccess'));
|
// Statt JS-alert: Dialog schließen und MessageDialog anzeigen
|
||||||
|
this.$root.$refs.messageDialog?.open('tr:falukant.branch.transport.repairAllSuccess');
|
||||||
this.$refs.statusBar?.fetchStatus();
|
this.$refs.statusBar?.fetchStatus();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error repairing all vehicles:', error);
|
console.error('Error repairing all vehicles:', error);
|
||||||
const errorMessage = error.response?.data?.message || this.$t('falukant.branch.transport.repairAllError');
|
const errorMessage = error.response?.data?.message || this.$t('falukant.branch.transport.repairAllError');
|
||||||
alert(errorMessage);
|
// Bestätigungsdialog ebenfalls schließen und Fehler im MessageDialog anzeigen
|
||||||
|
this.closeRepairAllVehiclesDialog();
|
||||||
|
this.$root.$refs.messageDialog?.open(String(errorMessage), this.$t('error.title'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1076,12 +1079,15 @@ export default {
|
|||||||
await apiClient.post(`/api/falukant/vehicles/${this.repairVehicleDialog.vehicle.id}/repair`);
|
await apiClient.post(`/api/falukant/vehicles/${this.repairVehicleDialog.vehicle.id}/repair`);
|
||||||
await this.loadVehicles();
|
await this.loadVehicles();
|
||||||
this.closeRepairVehicleDialog();
|
this.closeRepairVehicleDialog();
|
||||||
alert(this.$t('falukant.branch.transport.repairSuccess'));
|
// Statt JS-alert: Dialog schließen und MessageDialog anzeigen
|
||||||
|
this.$root.$refs.messageDialog?.open('tr:falukant.branch.transport.repairSuccess');
|
||||||
this.$refs.statusBar?.fetchStatus();
|
this.$refs.statusBar?.fetchStatus();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error repairing vehicle:', error);
|
console.error('Error repairing vehicle:', error);
|
||||||
const errorMessage = error.response?.data?.message || this.$t('falukant.branch.transport.repairError');
|
const errorMessage = error.response?.data?.message || this.$t('falukant.branch.transport.repairError');
|
||||||
alert(errorMessage);
|
// Bestätigungsdialog ebenfalls schließen und Fehler im MessageDialog anzeigen
|
||||||
|
this.closeRepairVehicleDialog();
|
||||||
|
this.$root.$refs.messageDialog?.open(String(errorMessage), this.$t('error.title'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user