streamlined logging workflow
This commit is contained in:
@@ -510,7 +510,7 @@
|
||||
</button>
|
||||
`
|
||||
: `
|
||||
<button class="feeding-button" onclick="showStartFeedingModal()">
|
||||
<button class="feeding-button" onclick="window.location.href='/log-feeding.html'">
|
||||
🍼 Started Feeding
|
||||
</button>
|
||||
`;
|
||||
@@ -802,42 +802,7 @@
|
||||
}
|
||||
|
||||
function showStartSleepModal() {
|
||||
const modal = document.getElementById("startSleepModal");
|
||||
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");
|
||||
window.location.href = "/log-sleep.html";
|
||||
}
|
||||
|
||||
function closeStartSleepModal() {
|
||||
|
||||
Reference in New Issue
Block a user