From 791100f5a5e5c32713fa4636ac15536c0090983f Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 12 Jan 2026 08:07:50 +0100 Subject: [PATCH] Update BranchView to refresh active tab data on tab change and modify 3D model for female toddler character - Enhanced the activeTab watcher to refresh data only when the selected branch changes and the tab is switched. - Introduced a new refreshActiveTab method to load data for the currently active tab, improving data management and user experience. - Updated the female toddler 3D model file for better integration in the application. --- frontend/src/views/falukant/BranchView.vue | 48 +++++++++++++++++----- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/frontend/src/views/falukant/BranchView.vue b/frontend/src/views/falukant/BranchView.vue index 303e670..52b4ddf 100644 --- a/frontend/src/views/falukant/BranchView.vue +++ b/frontend/src/views/falukant/BranchView.vue @@ -468,10 +468,14 @@ export default { }, watch: { - activeTab(newVal) { - if (newVal === 'taxes') { - this.loadBranchTaxes(); - } + activeTab(newVal, oldVal) { + // Nur neu laden, wenn der Tab wirklich gewechselt wurde und ein Branch ausgewählt ist + if (!this.selectedBranch || newVal === oldVal) return; + + // Alle Tabs neu laden, wenn gewechselt wird + this.$nextTick(() => { + this.refreshActiveTab(); + }); }, selectedBranch: { handler(newBranch) { @@ -537,6 +541,33 @@ export default { } }, + refreshActiveTab() { + // Lade die Daten für den aktiven Tab neu + switch (this.activeTab) { + case 'director': + this.$refs.directorInfo?.refresh(); + break; + case 'inventory': + this.$refs.saleSection?.loadInventory(); + this.$refs.saleSection?.loadTransports(); + break; + case 'production': + this.$refs.productionSection?.loadProductions(); + this.$refs.productionSection?.loadStorage(); + this.$refs.revenueSection?.refresh && this.$refs.revenueSection.refresh(); + break; + case 'taxes': + this.loadBranchTaxes(); + break; + case 'storage': + this.$refs.storageSection?.loadStorageData(); + break; + case 'transport': + this.loadVehicles(); + break; + } + }, + async onBranchSelected(newBranch) { this.selectedBranch = newBranch; // Branches neu laden, um das Wetter zu aktualisieren @@ -549,13 +580,8 @@ export default { await this.loadVehicles(); await this.loadProductPricesForCurrentBranch(); this.$nextTick(() => { - this.$refs.directorInfo?.refresh(); - this.$refs.saleSection?.loadInventory(); - this.$refs.saleSection?.loadTransports(); - this.$refs.productionSection?.loadProductions(); - this.$refs.productionSection?.loadStorage(); - this.$refs.storageSection?.loadStorageData(); - this.$refs.revenueSection?.refresh && this.$refs.revenueSection.refresh(); + // Alle Tabs neu laden + this.refreshActiveTab(); }); // load tax info for this branch