feat: Implement localization for excludeFromBilling label in diary components
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 44s

This commit is contained in:
Torsten Schulz (local)
2026-05-30 16:14:28 +02:00
parent 9d9481ac76
commit 359527eb5b
7 changed files with 46 additions and 6 deletions

View File

@@ -59,7 +59,7 @@
:checked="excludeFromBilling"
@change="$emit('update:exclude-from-billing', $event.target.checked)"
/>
<span>Nicht abrechnen</span>
<span>{{ $t('diary.excludeFromBilling') }}</span>
</label>
</div>
<button type="submit">{{ $t('diary.updateTimes') }}</button>

View File

@@ -668,6 +668,7 @@
"trainingDayChecklist": "Abschlusscheck",
"trainingStart": "Trainingsbeginn",
"trainingEnd": "Trainingsende",
"excludeFromBilling": "Nicht abrechnen",
"trainingWindow": "Trainingsfenster",
"trainingWindowUnset": "Noch nicht gesetzt",
"groupsLabel": "Gruppen",

View File

@@ -659,6 +659,7 @@
"trainingDayChecklist": "Completion checklist",
"trainingStart": "Training start",
"trainingEnd": "Training end",
"excludeFromBilling": "Exclude from billing",
"trainingWindow": "Training window",
"trainingWindowUnset": "Not set yet",
"groupsLabel": "Groups",

View File

@@ -660,6 +660,7 @@
"trainingDayChecklist": "Completion checklist",
"trainingStart": "Training start",
"trainingEnd": "Training end",
"excludeFromBilling": "Exclude from billing",
"trainingWindow": "Training window",
"trainingWindowUnset": "Not set yet",
"groupsLabel": "Groups",

View File

@@ -660,6 +660,7 @@
"trainingDayChecklist": "Completion checklist",
"trainingStart": "Training start",
"trainingEnd": "Training end",
"excludeFromBilling": "Exclude from billing",
"trainingWindow": "Training window",
"trainingWindowUnset": "Not set yet",
"groupsLabel": "Groups",

View File

@@ -71,7 +71,7 @@
<div>
<label for="excludeFromBilling" style="display: inline-flex; align-items: center; gap: 0.4rem;">
<input type="checkbox" id="excludeFromBilling" v-model="excludeFromBilling" />
<span>Nicht abrechnen</span>
<span>{{ $t('diary.excludeFromBilling') }}</span>
</label>
</div>
<button type="submit">{{ $t('diary.createDate') }}</button>
@@ -97,7 +97,7 @@
@update-training-times="updateTrainingTimes"
@update:training-start="trainingStart = $event"
@update:training-end="trainingEnd = $event"
@update:exclude-from-billing="excludeFromBilling = $event"
@update:exclude-from-billing="updateExcludeFromBillingImmediate"
@edit-group="editGroup"
@update-group-field="updateGroupField"
@save-group="saveGroup"
@@ -1880,6 +1880,26 @@ export default {
}
},
async updateExcludeFromBillingImmediate(nextValue) {
if (!this.date?.id) {
this.excludeFromBilling = Boolean(nextValue);
return;
}
const previousValue = Boolean(this.excludeFromBilling);
this.excludeFromBilling = Boolean(nextValue);
try {
await apiClient.put(`/diary/${this.currentClub}`, {
dateId: this.date.id,
trainingStart: this.trainingStart || null,
trainingEnd: this.trainingEnd || null,
excludeFromBilling: this.excludeFromBilling,
});
} catch (error) {
this.excludeFromBilling = previousValue;
this.showInfo(this.$t('messages.error'), this.$t('diary.errorOccurred'), '', 'error');
}
},
async loadMembers() {
const response = await apiClient.get(`/clubmembers/get/${this.currentClub}/false`);
// Erstelle ein neues Array, um Vue-Reaktivität sicherzustellen

View File

@@ -1932,7 +1932,7 @@ private fun DiaryListScreen(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
) {
Text("Nicht abrechnen")
Text(tr("diary.excludeFromBilling", "Nicht abrechnen"))
Switch(
checked = newDiaryExcludeFromBilling,
onCheckedChange = { newDiaryExcludeFromBilling = it },
@@ -2794,7 +2794,13 @@ private fun DiaryDetailScreen(
initialStart = entry.trainingStart.orEmpty(),
initialEnd = entry.trainingEnd.orEmpty(),
initialExcludeFromBilling = entry.excludeFromBilling,
excludeFromBillingLabel = tr("diary.excludeFromBilling", "Nicht abrechnen"),
submitLabel = tr("common.save", "Speichern"),
onExcludeFromBillingChange = { _, start, end, excludeFromBilling ->
dependencies.applicationScope.launch {
dependencies.diaryManager.updateTimes(clubId, entry.id, start, end, excludeFromBilling)
}
},
onSubmit = { _, start, end, excludeFromBilling ->
dependencies.applicationScope.launch {
dependencies.diaryManager.updateTimes(clubId, entry.id, start, end, excludeFromBilling)
@@ -6897,6 +6903,8 @@ private fun DeleteAccountDialog(
@Composable
private fun DiaryEditForm(
submitLabel: String,
excludeFromBillingLabel: String,
onExcludeFromBillingChange: ((date: String, trainingStart: String?, trainingEnd: String?, excludeFromBilling: Boolean) -> Unit)? = null,
onSubmit: (date: String, trainingStart: String?, trainingEnd: String?, excludeFromBilling: Boolean) -> Unit,
initialDate: String = "",
initialStart: String = "",
@@ -6921,10 +6929,18 @@ private fun DiaryEditForm(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
) {
Text("Nicht abrechnen")
Text(excludeFromBillingLabel)
Switch(
checked = excludeFromBilling,
onCheckedChange = { excludeFromBilling = it },
onCheckedChange = {
excludeFromBilling = it
onExcludeFromBillingChange?.invoke(
date,
start.takeIf { value -> value.isNotBlank() },
end.takeIf { value -> value.isNotBlank() },
excludeFromBilling,
)
},
)
}
ErrorText(error)