E-Mail-Benachrichtigungs-Toggles mit Backend verbinden
Die Toggle-Switches im Lage-Modal (Anlegen/Bearbeiten) waren nicht mit den API-Endpunkten verbunden. Jetzt werden die Subscription- Einstellungen korrekt geladen, gespeichert und zurueckgesetzt. - api.js: getSubscription() und updateSubscription() hinzugefuegt - app.js: handleFormSubmit() speichert Subscription nach Create/Edit - app.js: handleEdit() laedt bestehende Subscription beim Oeffnen - app.js: openModal() setzt Checkboxen im Create-Modus zurueck
Dieser Commit ist enthalten in:
@@ -181,6 +181,17 @@ const API = {
|
|||||||
return this._request('PUT', '/notifications/mark-read', { notification_ids: ids });
|
return this._request('PUT', '/notifications/mark-read', { notification_ids: ids });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Subscriptions (E-Mail-Benachrichtigungen)
|
||||||
|
getSubscription(incidentId) {
|
||||||
|
return this._request('GET', '/incidents/' + incidentId + '/subscription');
|
||||||
|
},
|
||||||
|
|
||||||
|
updateSubscription(incidentId, data) {
|
||||||
|
return this._request('PUT', '/incidents/' + incidentId + '/subscription', data);
|
||||||
|
},
|
||||||
|
|
||||||
// Feedback
|
// Feedback
|
||||||
sendFeedback(data) {
|
sendFeedback(data) {
|
||||||
return this._request('POST', '/feedback', data);
|
return this._request('POST', '/feedback', data);
|
||||||
|
|||||||
@@ -1307,6 +1307,14 @@ const App = {
|
|||||||
// Edit-Modus: ID sichern bevor closeModal sie löscht
|
// Edit-Modus: ID sichern bevor closeModal sie löscht
|
||||||
const editId = this._editingIncidentId;
|
const editId = this._editingIncidentId;
|
||||||
await API.updateIncident(editId, data);
|
await API.updateIncident(editId, data);
|
||||||
|
|
||||||
|
// E-Mail-Subscription speichern
|
||||||
|
await API.updateSubscription(editId, {
|
||||||
|
notify_email_summary: document.getElementById('inc-notify-summary').checked,
|
||||||
|
notify_email_new_articles: document.getElementById('inc-notify-new-articles').checked,
|
||||||
|
notify_email_status_change: document.getElementById('inc-notify-status-change').checked,
|
||||||
|
});
|
||||||
|
|
||||||
closeModal('modal-new');
|
closeModal('modal-new');
|
||||||
await this.loadIncidents();
|
await this.loadIncidents();
|
||||||
await this.loadIncidentDetail(editId);
|
await this.loadIncidentDetail(editId);
|
||||||
@@ -1314,6 +1322,14 @@ const App = {
|
|||||||
} else {
|
} else {
|
||||||
// Create-Modus
|
// Create-Modus
|
||||||
const incident = await API.createIncident(data);
|
const incident = await API.createIncident(data);
|
||||||
|
|
||||||
|
// E-Mail-Subscription speichern
|
||||||
|
await API.updateSubscription(incident.id, {
|
||||||
|
notify_email_summary: document.getElementById('inc-notify-summary').checked,
|
||||||
|
notify_email_new_articles: document.getElementById('inc-notify-new-articles').checked,
|
||||||
|
notify_email_status_change: document.getElementById('inc-notify-status-change').checked,
|
||||||
|
});
|
||||||
|
|
||||||
closeModal('modal-new');
|
closeModal('modal-new');
|
||||||
|
|
||||||
await this.loadIncidents();
|
await this.loadIncidents();
|
||||||
@@ -1556,6 +1572,18 @@ const App = {
|
|||||||
document.getElementById('modal-new-title').textContent = 'Lage bearbeiten';
|
document.getElementById('modal-new-title').textContent = 'Lage bearbeiten';
|
||||||
document.getElementById('modal-new-submit').textContent = 'Speichern';
|
document.getElementById('modal-new-submit').textContent = 'Speichern';
|
||||||
|
|
||||||
|
// E-Mail-Subscription laden
|
||||||
|
try {
|
||||||
|
const sub = await API.getSubscription(this.currentIncidentId);
|
||||||
|
document.getElementById('inc-notify-summary').checked = !!sub.notify_email_summary;
|
||||||
|
document.getElementById('inc-notify-new-articles').checked = !!sub.notify_email_new_articles;
|
||||||
|
document.getElementById('inc-notify-status-change').checked = !!sub.notify_email_status_change;
|
||||||
|
} catch (e) {
|
||||||
|
document.getElementById('inc-notify-summary').checked = false;
|
||||||
|
document.getElementById('inc-notify-new-articles').checked = false;
|
||||||
|
document.getElementById('inc-notify-status-change').checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
openModal('modal-new');
|
openModal('modal-new');
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -2529,6 +2557,10 @@ function openModal(id) {
|
|||||||
document.getElementById('new-incident-form').reset();
|
document.getElementById('new-incident-form').reset();
|
||||||
document.getElementById('modal-new-title').textContent = 'Neue Lage anlegen';
|
document.getElementById('modal-new-title').textContent = 'Neue Lage anlegen';
|
||||||
document.getElementById('modal-new-submit').textContent = 'Lage anlegen';
|
document.getElementById('modal-new-submit').textContent = 'Lage anlegen';
|
||||||
|
// E-Mail-Checkboxen zuruecksetzen
|
||||||
|
document.getElementById('inc-notify-summary').checked = false;
|
||||||
|
document.getElementById('inc-notify-new-articles').checked = false;
|
||||||
|
document.getElementById('inc-notify-status-change').checked = false;
|
||||||
toggleTypeDefaults();
|
toggleTypeDefaults();
|
||||||
toggleRefreshInterval();
|
toggleRefreshInterval();
|
||||||
}
|
}
|
||||||
|
|||||||
In neuem Issue referenzieren
Einen Benutzer sperren