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:
@@ -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",
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user