mirror of
https://github.com/sstent/foodplanner.git
synced 2026-01-25 11:11:36 +00:00
updated the tracker to have more features
This commit is contained in:
@@ -37,9 +37,6 @@
|
||||
<button class="btn btn-primary" onclick="applyTemplate()">
|
||||
<i class="bi bi-upload"></i> Apply Template
|
||||
</button>
|
||||
<button class="btn btn-info text-white" onclick="addSingleFood()">
|
||||
<i class="bi bi-plus-circle"></i> Add Single Food
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Meal Times -->
|
||||
@@ -69,10 +66,10 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-sm btn-outline-secondary me-1" onclick="editTrackedMeal({{ tracked_meal.id }})" title="Edit Meal">
|
||||
<button class="btn btn-sm btn-outline-secondary me-1" onclick="editTrackedMeal('{{ tracked_meal.id }}')" title="Edit Meal">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-outline-danger" onclick="removeMeal({{ tracked_meal.id }})">
|
||||
<button class="btn btn-sm btn-outline-danger" onclick="removeMeal('{{ tracked_meal.id }}')">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -101,9 +98,14 @@
|
||||
</div>
|
||||
|
||||
<!-- Add Meal Button -->
|
||||
<button class="btn btn-sm btn-outline-success mt-2" onclick="addMealToTime('{{ meal_time }}')">
|
||||
<i class="bi bi-plus"></i> Add Meal
|
||||
</button>
|
||||
<div class="d-flex gap-2 mt-2">
|
||||
<button class="btn btn-sm btn-outline-success" onclick="addMealToTime('{{ meal_time }}')">
|
||||
<i class="bi bi-plus"></i> Add Meal
|
||||
</button>
|
||||
<button class="btn btn-sm btn-info text-white" onclick="addSingleFoodToTime('{{ meal_time }}')">
|
||||
<i class="bi bi-plus-circle"></i> Add Food
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
@@ -193,10 +195,6 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Quantity (multiplier)</label>
|
||||
<input type="number" step="0.1" class="form-control" name="quantity" value="1.0" min="0.1">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@@ -317,7 +315,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Quantity</label>
|
||||
<label class="form-label">Quantity (g)</label>
|
||||
<input type="number" step="0.1" class="form-control" name="quantity" value="1.0" min="0.1" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
@@ -637,12 +635,13 @@
|
||||
}).catch(error => console.error('Error updating quantity:', error));
|
||||
}
|
||||
});
|
||||
|
||||
// Show add single food modal
|
||||
function addSingleFood() {
|
||||
// Show add single food modal and pre-select meal time
|
||||
function addSingleFoodToTime(mealTime) {
|
||||
document.querySelector('#addSingleFoodModal select[name="meal_time"]').value = mealTime;
|
||||
new bootstrap.Modal(document.getElementById('addSingleFoodModal')).show();
|
||||
}
|
||||
|
||||
|
||||
// Submit add single food form
|
||||
async function submitAddSingleFood() {
|
||||
const form = document.getElementById('addSingleFoodForm');
|
||||
|
||||
Reference in New Issue
Block a user