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) {
|
if (u.certificate == null) {
|
||||||
u.setDataValue('certificate', 1);
|
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
|
// Load UserHouse and HouseType in separate queries to avoid EagerLoadingError
|
||||||
let userHouse = null;
|
let userHouse = null;
|
||||||
if (u.id != null) {
|
if (u.id != null) {
|
||||||
|
|||||||
@@ -256,6 +256,10 @@
|
|||||||
},
|
},
|
||||||
"branches": {
|
"branches": {
|
||||||
"title": "Mga branch",
|
"title": "Mga branch",
|
||||||
|
"director": {
|
||||||
|
"assigned": "Adunay gitudlong direktor",
|
||||||
|
"unassigned": "Walay gitudlong direktor"
|
||||||
|
},
|
||||||
"level": {
|
"level": {
|
||||||
"city": "Siyudad",
|
"city": "Siyudad",
|
||||||
"production": "Produksyon",
|
"production": "Produksyon",
|
||||||
|
|||||||
@@ -278,6 +278,10 @@
|
|||||||
},
|
},
|
||||||
"branches": {
|
"branches": {
|
||||||
"title": "Filialen",
|
"title": "Filialen",
|
||||||
|
"director": {
|
||||||
|
"assigned": "Direktor zugeordnet",
|
||||||
|
"unassigned": "Kein Direktor zugeordnet"
|
||||||
|
},
|
||||||
"level": {
|
"level": {
|
||||||
"production": "Produktion",
|
"production": "Produktion",
|
||||||
"store": "Verkauf",
|
"store": "Verkauf",
|
||||||
|
|||||||
@@ -263,6 +263,24 @@
|
|||||||
"description": "Residence and everyday status as its own work area.",
|
"description": "Residence and everyday status as its own work area.",
|
||||||
"cta": "Go to house"
|
"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": {
|
"health": {
|
||||||
|
|||||||
@@ -265,6 +265,10 @@
|
|||||||
},
|
},
|
||||||
"branches": {
|
"branches": {
|
||||||
"title": "Sucursales",
|
"title": "Sucursales",
|
||||||
|
"director": {
|
||||||
|
"assigned": "Director asignado",
|
||||||
|
"unassigned": "Sin director asignado"
|
||||||
|
},
|
||||||
"level": {
|
"level": {
|
||||||
"production": "Producción",
|
"production": "Producción",
|
||||||
"store": "Venta",
|
"store": "Venta",
|
||||||
|
|||||||
@@ -271,6 +271,10 @@
|
|||||||
},
|
},
|
||||||
"branches": {
|
"branches": {
|
||||||
"title": "succursales",
|
"title": "succursales",
|
||||||
|
"director": {
|
||||||
|
"assigned": "Directeur attribué",
|
||||||
|
"unassigned": "Aucun directeur attribué"
|
||||||
|
},
|
||||||
"level": {
|
"level": {
|
||||||
"production": "production",
|
"production": "production",
|
||||||
"store": "vente",
|
"store": "vente",
|
||||||
|
|||||||
@@ -346,6 +346,12 @@
|
|||||||
<strong>{{ branch.region.name }}</strong>
|
<strong>{{ branch.region.name }}</strong>
|
||||||
<div class="overview-entry-card__meta">
|
<div class="overview-entry-card__meta">
|
||||||
<span>{{ $t(`falukant.overview.branches.level.${branch.branchType.labelTr}`) }}</span>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="button-secondary" @click="openBranch(branch.id)">{{ $t('falukant.overview.summary.open') }}</button>
|
<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("children_update");
|
||||||
this.socket.off("falukantBranchUpdate");
|
this.socket.off("falukantBranchUpdate");
|
||||||
this.socket.off("stock_change");
|
this.socket.off("stock_change");
|
||||||
|
this.socket.off("directorchanged");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -661,6 +668,9 @@ export default {
|
|||||||
this.socket.on("stock_change", (data) => {
|
this.socket.on("stock_change", (data) => {
|
||||||
this.handleEvent({ event: 'stock_change', ...data });
|
this.handleEvent({ event: 'stock_change', ...data });
|
||||||
});
|
});
|
||||||
|
this.socket.on("directorchanged", (data) => {
|
||||||
|
this.handleEvent({ event: 'directorchanged', ...(data || {}) });
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// Versuche es nach kurzer Verzögerung erneut
|
// Versuche es nach kurzer Verzögerung erneut
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -723,6 +733,7 @@ export default {
|
|||||||
case 'falukantUpdateProductionCertificate':
|
case 'falukantUpdateProductionCertificate':
|
||||||
case 'children_update':
|
case 'children_update':
|
||||||
case 'falukantBranchUpdate':
|
case 'falukantBranchUpdate':
|
||||||
|
case 'directorchanged':
|
||||||
this.queueOverviewRefresh();
|
this.queueOverviewRefresh();
|
||||||
break;
|
break;
|
||||||
case 'production_ready':
|
case 'production_ready':
|
||||||
@@ -1256,6 +1267,14 @@ export default {
|
|||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.branch-director-status {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.branch-director-status--assigned {
|
||||||
|
color: var(--color-success, #218838);
|
||||||
|
}
|
||||||
|
|
||||||
.overview-entry-card--action {
|
.overview-entry-card--action {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user