streamlined logging workflow

This commit is contained in:
Brian Bjarke Jensen
2025-12-03 19:20:56 +01:00
parent 320696c57c
commit 1bac464268
+2 -37
View File
@@ -510,7 +510,7 @@
</button> </button>
` `
: ` : `
<button class="feeding-button" onclick="showStartFeedingModal()"> <button class="feeding-button" onclick="window.location.href='/log-feeding.html'">
🍼 Started Feeding 🍼 Started Feeding
</button> </button>
`; `;
@@ -802,42 +802,7 @@
} }
function showStartSleepModal() { function showStartSleepModal() {
const modal = document.getElementById("startSleepModal"); window.location.href = "/log-sleep.html";
const childSelect = document.getElementById("modalSleepChildId");
// Clear and populate child select or show single child
if (userChildren.length === 1) {
// Single child: replace dropdown with text display
const child = userChildren[0];
const formGroup = childSelect.parentElement;
formGroup.innerHTML = `
<label for="modalSleepChildName">Child</label>
<input
type="text"
id="modalSleepChildName"
value="${child.name}"
readonly
style="background-color: #f5f5f5; cursor: default;"
/>
<input type="hidden" id="modalSleepChildId" value="${child.id}" />
`;
} else {
// Multiple children: show dropdown
childSelect.innerHTML = '<option value="">Select a child</option>';
userChildren.forEach((child) => {
const option = document.createElement("option");
option.value = child.id;
option.textContent = child.name;
childSelect.appendChild(option);
});
// Set default based on last sleep
if (lastSleep) {
childSelect.value = lastSleep.child_id;
}
}
modal.classList.add("show");
} }
function closeStartSleepModal() { function closeStartSleepModal() {