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,
|
quantity: quantityToSell,
|
||||||
quality: item.quality,
|
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();
|
await this.loadInventory();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert(this.$t('falukant.branch.sale.sellError'));
|
alert(this.$t('falukant.branch.sale.sellError'));
|
||||||
@@ -361,6 +362,8 @@
|
|||||||
try {
|
try {
|
||||||
const response = await apiClient.post(`/api/falukant/sell/all`, { branchId: this.branchId });
|
const response = await apiClient.post(`/api/falukant/sell/all`, { branchId: this.branchId });
|
||||||
const revenue = response.data?.revenue || 0;
|
const revenue = response.data?.revenue || 0;
|
||||||
|
// UI sofort freigeben + Status setzen, danach Inventory refreshen
|
||||||
|
this.sellingAll = false;
|
||||||
this.sellAllStatus = {
|
this.sellAllStatus = {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: this.$t('falukant.branch.sale.sellAllSuccess', { revenue: this.formatMoney(revenue) })
|
message: this.$t('falukant.branch.sale.sellAllSuccess', { revenue: this.formatMoney(revenue) })
|
||||||
@@ -368,11 +371,14 @@
|
|||||||
// Inventory neu laden nach erfolgreichem Verkauf
|
// Inventory neu laden nach erfolgreichem Verkauf
|
||||||
await this.loadInventory();
|
await this.loadInventory();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// UI sofort freigeben + Fehlerstatus setzen
|
||||||
|
this.sellingAll = false;
|
||||||
this.sellAllStatus = {
|
this.sellAllStatus = {
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: this.$t('falukant.branch.sale.sellAllError')
|
message: this.$t('falukant.branch.sale.sellAllError')
|
||||||
};
|
};
|
||||||
} finally {
|
} finally {
|
||||||
|
// Falls noch nicht freigegeben (z.B. wenn ein unerwarteter Fehler vor Response passiert)
|
||||||
this.sellingAll = false;
|
this.sellingAll = false;
|
||||||
// Status nach 5 Sekunden löschen
|
// Status nach 5 Sekunden löschen
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -648,4 +654,3 @@
|
|||||||
border: 1px solid #f5c6cb;
|
border: 1px solid #f5c6cb;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
Reference in New Issue
Block a user