Enhance branch selection with weather information and localization updates
- Updated FalukantService to include weather data in branch retrieval, enhancing user context. - Modified BranchSelection component to display current weather for selected branches, improving user experience. - Added weather translations in both English and German localization files for better accessibility. - Improved styling for weather information display in the frontend.
This commit is contained in:
@@ -485,12 +485,30 @@ class FalukantService extends BaseService {
|
|||||||
where: { falukantUserId: u.id },
|
where: { falukantUserId: u.id },
|
||||||
include: [
|
include: [
|
||||||
{ model: BranchType, as: 'branchType', attributes: ['labelTr'] },
|
{ model: BranchType, as: 'branchType', attributes: ['labelTr'] },
|
||||||
{ model: RegionData, as: 'region', attributes: ['name'] }
|
{
|
||||||
|
model: RegionData,
|
||||||
|
as: 'region',
|
||||||
|
attributes: ['name'],
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
model: Weather,
|
||||||
|
as: 'weather',
|
||||||
|
include: [
|
||||||
|
{ model: WeatherType, as: 'weatherType', attributes: ['tr'] }
|
||||||
|
],
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
attributes: ['id', 'regionId'],
|
attributes: ['id', 'regionId'],
|
||||||
order: [['branchTypeId', 'ASC']]
|
order: [['branchTypeId', 'ASC']]
|
||||||
});
|
});
|
||||||
return bs.map(b => ({ ...b.toJSON(), isMainBranch: u.mainBranchRegionId === b.regionId }));
|
return bs.map(b => ({
|
||||||
|
...b.toJSON(),
|
||||||
|
isMainBranch: u.mainBranchRegionId === b.regionId,
|
||||||
|
weather: b.region?.weather?.weatherType?.tr || null
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
async createBranch(hashedUserId, cityId, branchTypeId) {
|
async createBranch(hashedUserId, cityId, branchTypeId) {
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="branch-selection">
|
<div class="branch-selection">
|
||||||
<h3>{{ $t('falukant.branch.selection.title') }}</h3>
|
<h3>{{ $t('falukant.branch.selection.title') }}</h3>
|
||||||
<div>
|
<div class="selection-row">
|
||||||
<FormattedDropdown
|
<div class="dropdown-wrapper">
|
||||||
:key="branchesKey"
|
<FormattedDropdown
|
||||||
:options="branches"
|
:key="branchesKey"
|
||||||
:columns="branchColumns"
|
:options="branches"
|
||||||
v-model="localSelectedBranch"
|
:columns="branchColumns"
|
||||||
:placeholder="$t('falukant.branch.selection.placeholder')"
|
v-model="localSelectedBranch"
|
||||||
@update:modelValue="updateSelectedBranch"
|
:placeholder="$t('falukant.branch.selection.placeholder')"
|
||||||
/>
|
@update:modelValue="updateSelectedBranch"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-if="selectedBranchWeather" class="weather-info">
|
||||||
|
<span class="weather-label">{{ $t('falukant.branch.selection.weather') }}:</span>
|
||||||
|
<span class="weather-value">{{ $t(`falukant.weather.${selectedBranchWeather}`) }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button @click="openCreateBranchDialog">
|
<button @click="openCreateBranchDialog">
|
||||||
@@ -60,6 +66,9 @@ export default {
|
|||||||
branchesKey() {
|
branchesKey() {
|
||||||
return this.branches.map(b => b.id).join('-');
|
return this.branches.map(b => b.id).join('-');
|
||||||
},
|
},
|
||||||
|
selectedBranchWeather() {
|
||||||
|
return this.localSelectedBranch?.weather || null;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectedBranch(newVal) {
|
selectedBranch(newVal) {
|
||||||
@@ -91,7 +100,35 @@ export default {
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selection-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-wrapper {
|
||||||
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.weather-info {
|
||||||
|
padding: 8px 12px;
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-label {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-value {
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
{
|
{
|
||||||
"falukant": {
|
"falukant": {
|
||||||
|
"weather": {
|
||||||
|
"sunny": "Sonnig",
|
||||||
|
"cloudy": "Bewölkt",
|
||||||
|
"rainy": "Regnerisch",
|
||||||
|
"stormy": "Stürmisch",
|
||||||
|
"snowy": "Schnee",
|
||||||
|
"foggy": "Neblig",
|
||||||
|
"windy": "Windig",
|
||||||
|
"clear": "Klar"
|
||||||
|
},
|
||||||
"statusbar": {
|
"statusbar": {
|
||||||
"age": "Alter",
|
"age": "Alter",
|
||||||
"wealth": "Vermögen",
|
"wealth": "Vermögen",
|
||||||
@@ -119,7 +129,8 @@
|
|||||||
"title": "Niederlassungsauswahl",
|
"title": "Niederlassungsauswahl",
|
||||||
"selected": "Ausgewählte Niederlassung",
|
"selected": "Ausgewählte Niederlassung",
|
||||||
"placeholder": "Noch keine Niederlassung ausgewählt",
|
"placeholder": "Noch keine Niederlassung ausgewählt",
|
||||||
"selectedcity": "Ausgewählte Stadt"
|
"selectedcity": "Ausgewählte Stadt",
|
||||||
|
"weather": "Aktuelles Wetter"
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"create": "Neue Niederlassung erstellen",
|
"create": "Neue Niederlassung erstellen",
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
{
|
{
|
||||||
"falukant": {
|
"falukant": {
|
||||||
|
"weather": {
|
||||||
|
"sunny": "Sunny",
|
||||||
|
"cloudy": "Cloudy",
|
||||||
|
"rainy": "Rainy",
|
||||||
|
"stormy": "Stormy",
|
||||||
|
"snowy": "Snowy",
|
||||||
|
"foggy": "Foggy",
|
||||||
|
"windy": "Windy",
|
||||||
|
"clear": "Clear"
|
||||||
|
},
|
||||||
"messages": {
|
"messages": {
|
||||||
"title": "Messages",
|
"title": "Messages",
|
||||||
"tooltip": "Messages",
|
"tooltip": "Messages",
|
||||||
@@ -79,6 +89,13 @@
|
|||||||
"noProposals": "No director candidates available."
|
"noProposals": "No director candidates available."
|
||||||
},
|
},
|
||||||
"branch": {
|
"branch": {
|
||||||
|
"selection": {
|
||||||
|
"title": "Branch Selection",
|
||||||
|
"selected": "Selected Branch",
|
||||||
|
"placeholder": "No branch selected yet",
|
||||||
|
"selectedcity": "Selected City",
|
||||||
|
"weather": "Current Weather"
|
||||||
|
},
|
||||||
"vehicles": {
|
"vehicles": {
|
||||||
"cargo_cart": "Cargo cart",
|
"cargo_cart": "Cargo cart",
|
||||||
"ox_cart": "Ox cart",
|
"ox_cart": "Ox cart",
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ export default {
|
|||||||
type: this.$t(`falukant.branch.types.${branch.branchType.labelTr}`),
|
type: this.$t(`falukant.branch.types.${branch.branchType.labelTr}`),
|
||||||
branchTypeLabelTr: branch.branchType.labelTr,
|
branchTypeLabelTr: branch.branchType.labelTr,
|
||||||
isMainBranch: branch.isMainBranch,
|
isMainBranch: branch.isMainBranch,
|
||||||
|
weather: branch.weather,
|
||||||
}));
|
}));
|
||||||
if (!this.selectedBranch) {
|
if (!this.selectedBranch) {
|
||||||
this.selectMainBranch();
|
this.selectMainBranch();
|
||||||
|
|||||||
Reference in New Issue
Block a user