Enhance worship import functionality: Add neighbor invitation and self-information fields in worshipController.js and WorshipManagement.vue. Implement logic to automatically set self-information based on neighbor invitation status, improving user experience and data handling during worship imports.
All checks were successful
Deploy miriamgemeinde / deploy (push) Successful in 6s

This commit is contained in:
Torsten Schulz (local)
2026-04-29 19:49:45 +02:00
parent 7835c2da1a
commit aeaf747445
2 changed files with 27 additions and 1 deletions

View File

@@ -1829,6 +1829,9 @@ exports.saveImportedWorships = async (req, res) => {
// Freigabe-Status aus Import-Dialog übernehmen (Checkbox in der UI).
// Fallback: wenn kein Wert gesetzt ist, bleibt es false.
worshipData.approved = !!worshipData.approved;
worshipData.neighborInvitation = !!worshipData.neighborInvitation;
// Regel: Nachbarschaftsraum => automatisch Selbstinformation.
worshipData.selfInformation = !!worshipData.selfInformation || worshipData.neighborInvitation;
worshipData.title = normalizeText(worshipData.title) || 'Gottesdienst';
const replaceExistingIds = Array.isArray(worshipData._replaceExistingIds)
@@ -1844,6 +1847,8 @@ exports.saveImportedWorships = async (req, res) => {
sacristanService: worshipData.sacristanService || '',
organPlaying: worshipData.organPlaying || '',
approved: worshipData.approved,
neighborInvitation: worshipData.neighborInvitation,
selfInformation: worshipData.selfInformation,
eventPlaceId: worshipData.eventPlaceId,
};

View File

@@ -174,6 +174,18 @@
Freigegeben
</label>
</div>
<div class="field-group">
<label>
<input type="checkbox" v-model="worship.neighborInvitation" @change="handleImportNeighborInvitationChange(worship)" />
Einladung zum Nachbarschaftsraum
</label>
</div>
<div class="field-group">
<label>
<input type="checkbox" v-model="worship.selfInformation" />
Selbstinformation
</label>
</div>
<button type="button" @click="removeWorship(index)" class="remove-button">Entfernen</button>
</div>
</div>
@@ -831,7 +843,9 @@ export default {
_hasDayPlaceConflict: w._hasDayPlaceConflict || false,
_conflictingWorships: w._conflictingWorships || [],
_replaceExistingIds: w._replaceExistingIds || [],
_importChoice: w._importChoice || (w._hasDayPlaceConflict ? 'keepExisting' : 'import')
_importChoice: w._importChoice || (w._hasDayPlaceConflict ? 'keepExisting' : 'import'),
neighborInvitation: !!w.neighborInvitation,
selfInformation: !!w.selfInformation
};
});
this.importErrors = response.data.errors || [];
@@ -859,6 +873,11 @@ export default {
removeWorship(index) {
this.importedWorships.splice(index, 1);
},
handleImportNeighborInvitationChange(worship) {
if (worship?.neighborInvitation) {
worship.selfInformation = true;
}
},
async saveImportedWorships() {
if (this.importedWorships.length === 0) {
alert('Keine Gottesdienste zum Speichern vorhanden.');
@@ -912,6 +931,8 @@ export default {
sacristanService: w.sacristanService,
organPlaying: w.organPlaying,
approved: w.approved || false,
neighborInvitation: !!w.neighborInvitation,
selfInformation: !!w.selfInformation || !!w.neighborInvitation,
eventPlaceId: w.eventPlace ? w.eventPlace.id : (w.eventPlaceId || null),
_importChoice: w._importChoice || 'import',
_replaceExistingIds: w._replaceExistingIds || [],