feat: subscriptions have personalized notification times (#334)

This commit is contained in:
Miguel Ribeiro
2024-05-20 13:07:40 +02:00
committed by GitHub
parent f1815d7335
commit c7146dfd08
25 changed files with 105 additions and 28 deletions

View File

@@ -11,6 +11,12 @@ function toggleSortOptions() {
isSortOptionsOpen = !isSortOptionsOpen;
}
function toggleNotificationDays() {
const notifyCheckbox = document.querySelector("#notifications");
const notifyDaysBefore = document.querySelector("#notify_days_before");
notifyDaysBefore.disabled = !notifyCheckbox.checked;
}
function resetForm() {
const id = document.querySelector("#id");
id.value = "";
@@ -25,6 +31,8 @@ function resetForm() {
logoSearchButton.classList.add("disabled");
const submitButton = document.querySelector("#save-button");
submitButton.disabled = false;
const notifyDaysBefore = document.querySelector("#notify_days_before");
notifyDaysBefore.disabled = true;
const form = document.querySelector("#subs-form");
form.reset();
closeLogoSearch();
@@ -77,6 +85,12 @@ function fillEditFormFields(subscription) {
notifications.checked = subscription.notify;
}
const notifyDaysBefore = document.querySelector("#notify_days_before");
notifyDaysBefore.value = subscription.notify_days_before;
if (subscription.notify === 1) {
notifyDaysBefore.disabled = false;
}
const deleteButton = document.querySelector("#deletesub");
deleteButton.style = 'display: block';
deleteButton.setAttribute("onClick", `deleteSubscription(${subscription.id})`);