Enhance SaleSection component to improve UI responsiveness during sales. Reset selling state immediately after sell actions and update inventory handling to ensure user feedback is timely and accurate.
This commit is contained in:
@@ -344,7 +344,8 @@
|
||||
quantity: quantityToSell,
|
||||
quality: item.quality,
|
||||
});
|
||||
// Inventory neu laden nach erfolgreichem Verkauf
|
||||
// UI sofort freigeben (Label/Disabled zurücksetzen), dann Inventory refreshen
|
||||
this.sellingItemIndex = null;
|
||||
await this.loadInventory();
|
||||
} catch (error) {
|
||||
alert(this.$t('falukant.branch.sale.sellError'));
|
||||
@@ -361,6 +362,8 @@
|
||||
try {
|
||||
const response = await apiClient.post(`/api/falukant/sell/all`, { branchId: this.branchId });
|
||||
const revenue = response.data?.revenue || 0;
|
||||
// UI sofort freigeben + Status setzen, danach Inventory refreshen
|
||||
this.sellingAll = false;
|
||||
this.sellAllStatus = {
|
||||
type: 'success',
|
||||
message: this.$t('falukant.branch.sale.sellAllSuccess', { revenue: this.formatMoney(revenue) })
|
||||
@@ -368,11 +371,14 @@
|
||||
// Inventory neu laden nach erfolgreichem Verkauf
|
||||
await this.loadInventory();
|
||||
} catch (error) {
|
||||
// UI sofort freigeben + Fehlerstatus setzen
|
||||
this.sellingAll = false;
|
||||
this.sellAllStatus = {
|
||||
type: 'error',
|
||||
message: this.$t('falukant.branch.sale.sellAllError')
|
||||
};
|
||||
} finally {
|
||||
// Falls noch nicht freigegeben (z.B. wenn ein unerwarteter Fehler vor Response passiert)
|
||||
this.sellingAll = false;
|
||||
// Status nach 5 Sekunden löschen
|
||||
setTimeout(() => {
|
||||
@@ -648,4 +654,3 @@
|
||||
border: 1px solid #f5c6cb;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user