diff --git a/backend/models/falukant/data/production.js b/backend/models/falukant/data/production.js index 8785ee7..d991755 100644 --- a/backend/models/falukant/data/production.js +++ b/backend/models/falukant/data/production.js @@ -22,7 +22,12 @@ Production.init({ startTimestamp: { type: DataTypes.DATE, allowNull: false, - defaultValue: sequelize.literal('CURRENT_TIMESTAMP')} + defaultValue: sequelize.literal('CURRENT_TIMESTAMP')}, + sleep: { + type: DataTypes.BOOLEAN, + allowNull: false, + defaultValue: false, + comment: 'Produktion ist zurückgestellt'} }, { sequelize, modelName: 'Production', diff --git a/backend/services/falukantService.js b/backend/services/falukantService.js index ce22f86..cd90b6a 100644 --- a/backend/services/falukantService.js +++ b/backend/services/falukantService.js @@ -838,7 +838,7 @@ class FalukantService extends BaseService { { model: Production, as: 'productions', - attributes: ['quantity', 'startTimestamp'], + attributes: ['quantity', 'startTimestamp', 'sleep'], include: [{ model: ProductType, as: 'productType', attributes: ['id', 'category', 'labelTr', 'sellCost', 'productionTime'] }] } ], diff --git a/frontend/src/components/falukant/MessagesDialog.vue b/frontend/src/components/falukant/MessagesDialog.vue index 2d973bc..6db2b64 100644 --- a/frontend/src/components/falukant/MessagesDialog.vue +++ b/frontend/src/components/falukant/MessagesDialog.vue @@ -50,18 +50,32 @@ export default { page: 1, size: 10, total: 0, - pageInput: 1, + pageInput: 1, + branches: [], // Cache für Branch-Namen }; }, methods: { async open() { this.page = 1; - this.pageInput = 1; + this.pageInput = 1; + await this.loadBranches(); // Branches laden für Branch-Namen await this.load(); this.$refs.dlg.open(); // mark unread as shown try { await apiClient.post('/api/falukant/notifications/mark-shown'); } catch {} }, + async loadBranches() { + try { + const result = await apiClient.get('/api/falukant/branches'); + this.branches = result.data.map(branch => ({ + id: branch.id, + cityName: branch.region.name, + })); + } catch (error) { + console.error('Error loading branches:', error); + this.branches = []; + } + }, async markAll() { try { await apiClient.post('/api/falukant/notifications/mark-shown'); @@ -268,9 +282,14 @@ export default { formatted.value = Number(params.value); } - // Filiale-Information + // Filiale-Information mit Branch-Namen if (params.branch_id !== undefined && params.branch_id !== null) { - formatted.branch_info = ` (Filiale #${params.branch_id})`; + const branch = this.branches.find(b => b.id === params.branch_id); + if (branch && branch.cityName) { + formatted.branch_info = ` (${branch.cityName})`; + } else { + formatted.branch_info = ` (Filiale #${params.branch_id})`; + } } else { formatted.branch_info = ''; } diff --git a/frontend/src/components/falukant/ProductionSection.vue b/frontend/src/components/falukant/ProductionSection.vue index 5d159c0..6c4ca68 100644 --- a/frontend/src/components/falukant/ProductionSection.vue +++ b/frontend/src/components/falukant/ProductionSection.vue @@ -9,6 +9,7 @@