feat(branches): add director assignment status and update overview view
Some checks failed
Deploy to production / deploy (push) Failing after 1m18s
Some checks failed
Deploy to production / deploy (push) Failing after 1m18s
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -256,6 +256,10 @@
|
||||
},
|
||||
"branches": {
|
||||
"title": "Mga branch",
|
||||
"director": {
|
||||
"assigned": "Adunay gitudlong direktor",
|
||||
"unassigned": "Walay gitudlong direktor"
|
||||
},
|
||||
"level": {
|
||||
"city": "Siyudad",
|
||||
"production": "Produksyon",
|
||||
|
||||
@@ -278,6 +278,10 @@
|
||||
},
|
||||
"branches": {
|
||||
"title": "Filialen",
|
||||
"director": {
|
||||
"assigned": "Direktor zugeordnet",
|
||||
"unassigned": "Kein Direktor zugeordnet"
|
||||
},
|
||||
"level": {
|
||||
"production": "Produktion",
|
||||
"store": "Verkauf",
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -265,6 +265,10 @@
|
||||
},
|
||||
"branches": {
|
||||
"title": "Sucursales",
|
||||
"director": {
|
||||
"assigned": "Director asignado",
|
||||
"unassigned": "Sin director asignado"
|
||||
},
|
||||
"level": {
|
||||
"production": "Producción",
|
||||
"store": "Venta",
|
||||
|
||||
@@ -271,6 +271,10 @@
|
||||
},
|
||||
"branches": {
|
||||
"title": "succursales",
|
||||
"director": {
|
||||
"assigned": "Directeur attribué",
|
||||
"unassigned": "Aucun directeur attribué"
|
||||
},
|
||||
"level": {
|
||||
"production": "production",
|
||||
"store": "vente",
|
||||
|
||||
@@ -346,6 +346,12 @@
|
||||
<strong>{{ branch.region.name }}</strong>
|
||||
<div class="overview-entry-card__meta">
|
||||
<span>{{ $t(`falukant.overview.branches.level.${branch.branchType.labelTr}`) }}</span>
|
||||
<span
|
||||
class="branch-director-status"
|
||||
:class="{ 'branch-director-status--assigned': branch.hasDirector }"
|
||||
>
|
||||
{{ $t(`falukant.overview.branches.director.${branch.hasDirector ? 'assigned' : 'unassigned'}`) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="button-secondary" @click="openBranch(branch.id)">{{ $t('falukant.overview.summary.open') }}</button>
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user