diff --git a/backend/services/falukantService.js b/backend/services/falukantService.js index 42cb85b..f59f312 100755 --- a/backend/services/falukantService.js +++ b/backend/services/falukantService.js @@ -1055,6 +1055,20 @@ class FalukantService extends BaseService { if (u.certificate == null) { u.setDataValue('certificate', 1); } + const directors = await Director.findAll({ + where: { employerUserId: u.id }, + attributes: [], + include: [{ + model: FalukantCharacter, + as: 'character', + attributes: ['regionId'], + required: true, + }], + }); + const directorRegionIds = new Set(directors.map((director) => director.character.regionId)); + for (const branch of u.branches ?? []) { + branch.setDataValue('hasDirector', directorRegionIds.has(branch.regionId)); + } // Load UserHouse and HouseType in separate queries to avoid EagerLoadingError let userHouse = null; if (u.id != null) { diff --git a/frontend/src/i18n/locales/ceb/falukant.json b/frontend/src/i18n/locales/ceb/falukant.json index e2e8883..41ede09 100755 --- a/frontend/src/i18n/locales/ceb/falukant.json +++ b/frontend/src/i18n/locales/ceb/falukant.json @@ -256,6 +256,10 @@ }, "branches": { "title": "Mga branch", + "director": { + "assigned": "Adunay gitudlong direktor", + "unassigned": "Walay gitudlong direktor" + }, "level": { "city": "Siyudad", "production": "Produksyon", diff --git a/frontend/src/i18n/locales/de/falukant.json b/frontend/src/i18n/locales/de/falukant.json index 8486267..b1d0a68 100755 --- a/frontend/src/i18n/locales/de/falukant.json +++ b/frontend/src/i18n/locales/de/falukant.json @@ -278,6 +278,10 @@ }, "branches": { "title": "Filialen", + "director": { + "assigned": "Direktor zugeordnet", + "unassigned": "Kein Direktor zugeordnet" + }, "level": { "production": "Produktion", "store": "Verkauf", diff --git a/frontend/src/i18n/locales/en/falukant.json b/frontend/src/i18n/locales/en/falukant.json index 424ff91..f5e596f 100755 --- a/frontend/src/i18n/locales/en/falukant.json +++ b/frontend/src/i18n/locales/en/falukant.json @@ -263,6 +263,24 @@ "description": "Residence and everyday status as its own work area.", "cta": "Go to house" } + }, + "productions": { + "title": "Productions" + }, + "stock": { + "title": "Storage" + }, + "branches": { + "title": "Branches", + "director": { + "assigned": "Director assigned", + "unassigned": "No director assigned" + }, + "level": { + "production": "Production", + "store": "Sales", + "fullstack": "Production with sales" + } } }, "health": { diff --git a/frontend/src/i18n/locales/es/falukant.json b/frontend/src/i18n/locales/es/falukant.json index c66de7c..2b9265d 100755 --- a/frontend/src/i18n/locales/es/falukant.json +++ b/frontend/src/i18n/locales/es/falukant.json @@ -265,6 +265,10 @@ }, "branches": { "title": "Sucursales", + "director": { + "assigned": "Director asignado", + "unassigned": "Sin director asignado" + }, "level": { "production": "Producción", "store": "Venta", diff --git a/frontend/src/i18n/locales/fr/falukant.json b/frontend/src/i18n/locales/fr/falukant.json index 081ae9f..cdeaeaf 100755 --- a/frontend/src/i18n/locales/fr/falukant.json +++ b/frontend/src/i18n/locales/fr/falukant.json @@ -271,6 +271,10 @@ }, "branches": { "title": "succursales", + "director": { + "assigned": "Directeur attribué", + "unassigned": "Aucun directeur attribué" + }, "level": { "production": "production", "store": "vente", diff --git a/frontend/src/views/falukant/OverviewView.vue b/frontend/src/views/falukant/OverviewView.vue index 61b62e6..59cba38 100755 --- a/frontend/src/views/falukant/OverviewView.vue +++ b/frontend/src/views/falukant/OverviewView.vue @@ -346,6 +346,12 @@ {{ branch.region.name }}
{{ $t(`falukant.overview.branches.level.${branch.branchType.labelTr}`) }} + + {{ $t(`falukant.overview.branches.director.${branch.hasDirector ? 'assigned' : 'unassigned'}`) }} +
@@ -631,6 +637,7 @@ export default { this.socket.off("children_update"); this.socket.off("falukantBranchUpdate"); this.socket.off("stock_change"); + this.socket.off("directorchanged"); } }, methods: { @@ -661,6 +668,9 @@ export default { this.socket.on("stock_change", (data) => { this.handleEvent({ event: 'stock_change', ...data }); }); + this.socket.on("directorchanged", (data) => { + this.handleEvent({ event: 'directorchanged', ...(data || {}) }); + }); } else { // Versuche es nach kurzer Verzögerung erneut setTimeout(() => { @@ -723,6 +733,7 @@ export default { case 'falukantUpdateProductionCertificate': case 'children_update': case 'falukantBranchUpdate': + case 'directorchanged': this.queueOverviewRefresh(); break; case 'production_ready': @@ -1256,6 +1267,14 @@ export default { font-size: 0.9rem; } +.branch-director-status { + font-weight: 600; +} + +.branch-director-status--assigned { + color: var(--color-success, #218838); +} + .overview-entry-card--action { flex-direction: row; align-items: center;