feat: add monthly budget field and statistics (#329)

This commit is contained in:
Miguel Ribeiro
2024-05-17 23:14:17 +02:00
committed by GitHub
parent e21500a719
commit b622434ca0
24 changed files with 286 additions and 14 deletions
+29
View File
@@ -69,6 +69,35 @@ function deleteAvatar(path) {
});
}
function saveBudget() {
const button = document.getElementById("saveBudget");
button.disabled = true;
const budget = document.getElementById("budget").value;
fetch('endpoints/user/budget.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ budget: budget })
})
.then(response => response.json())
.then(data => {
if (data.success) {
showSuccessMessage(data.message);
} else {
showErrorMessage(data.message);
}
button.disabled = false;
})
.catch(error => {
showErrorMessage(translate('unknown_error'));
button.disabled = false;
});
}
function addMemberButton(memberId) {
document.getElementById("addMember").disabled = true;
const url = 'endpoints/household/household.php?action=add';