Files
yourpart3/frontend/src/components/TermineWidget.vue
Torsten Schulz (local) 6d9d69dc10
All checks were successful
Deploy to production / deploy (push) Successful in 3m0s
feat(localization): expand language support and enhance UI for user settings
- Added support for additional UI locales including Cebuano and Spanish, improving accessibility for a broader user base.
- Updated language selection components in the AppHeader and SettingsWidget to reflect new language options, enhancing user experience.
- Enhanced localization of various UI elements across components, ensuring consistent language representation and improved user engagement.
- Implemented logic to synchronize user language preferences with backend settings, providing a seamless experience when changing languages.
2026-04-02 07:54:44 +02:00

161 lines
3.2 KiB
Vue

<template>
<div class="termine-widget">
<h2>{{ $t('widgets.appointments.title') }}</h2>
<div v-if="loading" class="loading">{{ $t('widgets.appointments.loading') }}</div>
<div v-else-if="error" class="error">{{ error }}</div>
<div v-else-if="termine.length === 0" class="no-termine">
{{ $t('widgets.appointments.empty') }}
</div>
<div v-else class="termine-list">
<div v-for="termin in termine" :key="termin.datum + termin.titel" class="termin-item">
<div class="termin-datum">
{{ formatDatum(termin.datum) }}
</div>
<div class="termin-details">
<h3>{{ termin.titel }}</h3>
<p>{{ termin.beschreibung }}</p>
<div v-if="termin.ort" class="termin-ort">
📍 {{ termin.ort }}
</div>
<div v-if="termin.uhrzeit" class="termin-uhrzeit">
🕒 {{ termin.uhrzeit }}
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import apiClient from '@/utils/axios.js';
export default {
name: 'TermineWidget',
data() {
return {
termine: [],
loading: true,
error: null
};
},
async mounted() {
await this.loadTermine();
},
methods: {
async loadTermine() {
try {
this.loading = true;
this.error = null;
const response = await apiClient.get('/api/termine');
this.termine = response.data;
} catch (error) {
console.error('Error loading termine:', error);
this.error = this.$t('widgets.appointments.loadError');
} finally {
this.loading = false;
}
},
formatDatum(dateStr) {
if (!dateStr) return '';
const date = new Date(dateStr);
const options = {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
};
return date.toLocaleDateString(this.getDateLocale(), options);
},
getDateLocale() {
const locale = this.$i18n?.locale;
return {
de: 'de-DE',
en: 'en-GB',
es: 'es-ES',
ceb: 'fil-PH'
}[locale] || 'de-DE';
}
}
};
</script>
<style scoped>
.termine-widget {
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 8px;
padding: 20px;
margin: 20px 0;
}
.termine-widget h2 {
margin: 0 0 15px 0;
color: #333;
font-size: 1.5em;
}
.loading,
.error,
.no-termine {
text-align: center;
padding: 20px;
color: #666;
}
.error {
color: #dc3545;
}
.termine-list {
display: flex;
flex-direction: column;
gap: 15px;
}
.termin-item {
display: flex;
gap: 15px;
background: white;
border-left: 4px solid #007bff;
padding: 15px;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.termin-datum {
flex-shrink: 0;
text-align: center;
padding: 10px;
background: #007bff;
color: white;
border-radius: 4px;
min-width: 120px;
font-weight: bold;
font-size: 0.9em;
}
.termin-details {
flex: 1;
}
.termin-details h3 {
margin: 0 0 8px 0;
color: #333;
font-size: 1.1em;
}
.termin-details p {
margin: 0 0 8px 0;
color: #666;
line-height: 1.5;
}
.termin-ort,
.termin-uhrzeit {
font-size: 0.9em;
color: #666;
margin-top: 5px;
}
</style>