Refactor navigation and enhance director information display

- Removed the directors section from the navigation menu for a cleaner interface.
- Updated the FalukantService to include additional attributes for directors, such as knowledges and region.
- Enhanced the DirectorInfo component to display detailed information, including knowledge and income management features.
- Implemented tab navigation in BranchView for better organization of director, inventory, production, and storage sections.
- Updated localization files to reflect changes in navigation and tab labels.
This commit is contained in:
Torsten Schulz (local)
2025-11-24 16:38:36 +01:00
parent 23725c20ee
commit 5ed27e5a6a
10 changed files with 298 additions and 64 deletions

View File

@@ -4,21 +4,54 @@
<div class="contentscroll">
<h2>{{ $t('falukant.branch.title') }}</h2>
<BranchSelection :branches="branches" :selectedBranch="selectedBranch" @branchSelected="onBranchSelected"
@createBranch="createBranch" @upgradeBranch="upgradeBranch" ref="branchSelection" />
<BranchSelection
:branches="branches"
:selectedBranch="selectedBranch"
@branchSelected="onBranchSelected"
@createBranch="createBranch"
@upgradeBranch="upgradeBranch"
ref="branchSelection"
/>
<DirectorInfo v-if="selectedBranch" :branchId="selectedBranch.id" ref="directorInfo" />
<!-- Tab-Navigation für Inhalte der ausgewählten Niederlassung -->
<SimpleTabs
v-if="selectedBranch"
v-model="activeTab"
:tabs="tabs"
/>
<SaleSection v-if="selectedBranch" :branchId="selectedBranch.id" ref="saleSection" />
<!-- Tab-Inhalte -->
<div v-if="selectedBranch" class="branch-tab-content">
<!-- Direktor -->
<div v-if="activeTab === 'director'" class="branch-tab-pane">
<DirectorInfo :branchId="selectedBranch.id" ref="directorInfo" />
</div>
<ProductionSection v-if="selectedBranch" :branchId="selectedBranch.id" :products="products"
ref="productionSection" />
<!-- Inventar / Verkauf -->
<div v-else-if="activeTab === 'inventory'" class="branch-tab-pane">
<SaleSection :branchId="selectedBranch.id" ref="saleSection" />
</div>
<StorageSection v-if="selectedBranch" :branchId="selectedBranch.id" ref="storageSection" />
<!-- Produktion + Produkt-Erträge -->
<div v-else-if="activeTab === 'production'" class="branch-tab-pane">
<ProductionSection
:branchId="selectedBranch.id"
:products="products"
ref="productionSection"
/>
<RevenueSection
:products="products"
:calculateProductRevenue="calculateProductRevenue"
:calculateProductProfit="calculateProductProfit"
ref="revenueSection"
/>
</div>
<RevenueSection v-if="selectedBranch" :products="products"
:calculateProductRevenue="calculateProductRevenue" :calculateProductProfit="calculateProductProfit"
ref="revenueSection" />
<!-- Lager -->
<div v-else-if="activeTab === 'storage'" class="branch-tab-pane">
<StorageSection :branchId="selectedBranch.id" ref="storageSection" />
</div>
</div>
</div>
</div>
</template>
@@ -26,6 +59,7 @@
<script>
import StatusBar from '@/components/falukant/StatusBar.vue';
import BranchSelection from '@/components/falukant/BranchSelection.vue';
import SimpleTabs from '@/components/SimpleTabs.vue';
import DirectorInfo from '@/components/falukant/DirectorInfo.vue';
import SaleSection from '@/components/falukant/SaleSection.vue';
import ProductionSection from '@/components/falukant/ProductionSection.vue';
@@ -39,6 +73,7 @@ export default {
components: {
StatusBar,
BranchSelection,
SimpleTabs,
DirectorInfo,
SaleSection,
ProductionSection,
@@ -51,6 +86,13 @@ export default {
branches: [],
selectedBranch: null,
products: [],
activeTab: 'production',
tabs: [
{ value: 'production', label: 'falukant.branch.tabs.production' },
{ value: 'inventory', label: 'falukant.branch.tabs.inventory' },
{ value: 'director', label: 'falukant.branch.tabs.director' },
{ value: 'storage', label: 'falukant.branch.tabs.storage' },
],
};
},
@@ -144,6 +186,11 @@ export default {
this.$refs.storageSection?.loadStorageData();
this.$refs.revenueSection?.refresh && this.$refs.revenueSection.refresh();
});
// Beim Initial-Laden sicherstellen, dass ein Tab-Inhalt sichtbar ist
if (this.selectedBranch && !this.activeTab) {
this.activeTab = 'director';
}
},
async createBranch() {
@@ -177,6 +224,9 @@ export default {
if (main && main !== this.selectedBranch) {
this.selectedBranch = main;
}
if (this.selectedBranch && !this.activeTab) {
this.activeTab = 'director';
}
},
calculateProductRevenue(product) {
@@ -256,7 +306,10 @@ export default {
break;
case 'knowledge_update':
this.loadProducts();
this.$refs.revenueSection.products = this.products;
if (this.$refs.revenueSection) {
this.$refs.revenueSection.products = this.products;
this.$refs.revenueSection.refresh && this.$refs.revenueSection.refresh();
}
break;
default:
console.log('Unhandled event:', eventData);