added settings page with ability to update password, delete user and CRUD and share abilities for associated children
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* @param {boolean} options.includeFeedings - Whether to include Feedings menu item
|
||||
* @param {boolean} options.includeDiapers - Whether to include Diapers menu item
|
||||
* @param {boolean} options.includeSleep - Whether to include Sleep menu item
|
||||
* @param {boolean} options.includeSettings - Whether to include Settings menu item
|
||||
*/
|
||||
function initBurgerMenu(options = {}) {
|
||||
const {
|
||||
@@ -12,6 +13,7 @@ function initBurgerMenu(options = {}) {
|
||||
includeFeedings = true,
|
||||
includeDiapers = true,
|
||||
includeSleep = true,
|
||||
includeSettings = true,
|
||||
} = options;
|
||||
|
||||
// Create burger menu HTML
|
||||
@@ -29,7 +31,7 @@ function initBurgerMenu(options = {}) {
|
||||
${includeDiapers ? '<div class="menu-item" id="menuDiapers">🧷 Diapers</div>' : ""}
|
||||
${includeFeedings ? '<div class="menu-item" id="menuFeedings">🍼 Feedings</div>' : ""}
|
||||
${includeSleep ? '<div class="menu-item" id="menuSleep">😴 Sleep</div>' : ""}
|
||||
<div class="menu-item" id="menuAddChild">👶 Add Child</div>
|
||||
${includeSettings ? '<div class="menu-item" id="menuSettings">⚙️ Settings</div>' : ""}
|
||||
<div class="menu-item logout" id="menuLogout">🚪 Logout</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -65,10 +67,6 @@ function initBurgerMenu(options = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById("menuAddChild").addEventListener("click", () => {
|
||||
window.location.href = "/add-child.html";
|
||||
});
|
||||
|
||||
if (includeFeedings) {
|
||||
document.getElementById("menuFeedings")?.addEventListener("click", () => {
|
||||
window.location.href = "/feedings.html";
|
||||
@@ -87,6 +85,12 @@ function initBurgerMenu(options = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
if (includeSettings) {
|
||||
document.getElementById("menuSettings")?.addEventListener("click", () => {
|
||||
window.location.href = "/settings.html";
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById("menuLogout").addEventListener("click", () => {
|
||||
closeMenu();
|
||||
// Call the page's logout function if it exists, otherwise use default
|
||||
|
||||
Reference in New Issue
Block a user