Enhance transport mode handling by adding localized labels and updating related components in MapRegionsView and BranchView

This commit is contained in:
Torsten Schulz (local)
2025-12-09 11:53:56 +01:00
parent 71c62cf5e8
commit 25d7c70058
4 changed files with 43 additions and 11 deletions

View File

@@ -199,7 +199,7 @@
<tr v-for="c in connections" :key="c.id">
<td>{{ regionName(c.sourceRegionId) }}</td>
<td>{{ regionName(c.targetRegionId) }}</td>
<td>{{ c.transportMode }}</td>
<td>{{ modeLabel(c.transportMode) }}</td>
<td>{{ c.distance }}</td>
<td>
<button class="btn btn-secondary" @click="deleteConnection(c.id)">
@@ -259,6 +259,14 @@ export default {
this.mapWidth = bounds.width;
this.mapHeight = bounds.height;
},
modeLabel(mode) {
if (!mode) return '';
const key = String(mode);
const tKey = `falukant.branch.transport.modes.${key}`;
const translated = this.$t(tKey);
if (!translated || translated === tKey) return mode;
return translated;
},
async loadRegions() {
try {
const { data } = await apiClient.get('/api/admin/falukant/regions');

View File

@@ -102,7 +102,7 @@
</td>
<td>{{ v.type.capacity }}</td>
<td>{{ conditionLabel(v.condition) }}</td>
<td>{{ v.type.transportMode }}</td>
<td>{{ transportModeLabel(v.type.transportMode) }}</td>
<td>{{ speedLabel(v.type.speed) }}</td>
<td>{{ formatDateTime(v.availableFrom) }}</td>
<td>
@@ -611,6 +611,15 @@ export default {
return translated;
},
transportModeLabel(mode) {
if (!mode) return '';
const key = String(mode);
const tKey = `falukant.branch.transport.modes.${key}`;
const translated = this.$t(tKey);
if (!translated || translated === tKey) return mode;
return translated;
},
async loadVehicles() {
if (!this.selectedBranch) return;
try {