Implement politics overview feature in FalukantService and update UI

- Added a new method `getPoliticsOverview` in FalukantService to retrieve currently held offices, including office holders and term end dates.
- Enhanced the PoliticsView component to display the term end dates for current offices.
- Updated localization files to include a new message for applying to selected positions.
- Improved the handling of already applied positions in the open politics section, pre-selecting checkboxes accordingly.
This commit is contained in:
Torsten Schulz (local)
2025-11-24 11:50:21 +01:00
parent 3b8736acd7
commit 4510aa3d14
3 changed files with 133 additions and 6 deletions

View File

@@ -640,7 +640,8 @@
"region": "Region",
"date": "Datum",
"candidacy": "Kandidatur",
"none": "Keine offenen Positionen."
"none": "Keine offenen Positionen.",
"apply": "Für ausgewählte Positionen kandidieren"
},
"upcoming": {
"office": "Amt",

View File

@@ -18,6 +18,7 @@
<th>{{ $t('falukant.politics.current.office') }}</th>
<th>{{ $t('falukant.politics.current.region') }}</th>
<th>{{ $t('falukant.politics.current.holder') }}</th>
<th>{{ $t('falukant.politics.current.termEnds') }}</th>
</tr>
</thead>
<tbody>
@@ -31,9 +32,15 @@
</span>
<span v-else></span>
</td>
<td>
<span v-if="pos.termEnds">
{{ formatDate(pos.termEnds) }}
</span>
<span v-else></span>
</td>
</tr>
<tr v-if="!currentPositions.length">
<td colspan="3">{{ $t('falukant.politics.current.none') }}</td>
<td colspan="4">{{ $t('falukant.politics.current.none') }}</td>
</tr>
</tbody>
</table>
@@ -60,8 +67,13 @@
<td>{{ formatDate(e.date) }}</td>
<!-- Checkbox ganz am Ende -->
<td>
<input type="checkbox" :id="`apply-${e.id}`" v-model="selectedApplications"
:value="e.id" />
<input
type="checkbox"
:id="`apply-${e.id}`"
v-model="selectedApplications"
:value="e.id"
:disabled="e.alreadyApplied"
/>
</td>
</tr>
<tr v-if="!openPolitics.length">
@@ -222,7 +234,11 @@ export default {
try {
const { data } = await apiClient.get('/api/falukant/politics/open');
this.openPolitics = data;
this.selectedApplications = [];
// Bereits beworbene Positionen vorselektieren, damit die Checkbox
// sichtbar markiert bleibt.
this.selectedApplications = data
.filter(e => e.alreadyApplied)
.map(e => e.id);
} catch (err) {
console.error('Error loading open politics', err);
} finally {