Recipes phase 4
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
{% extends 'planner/base.html' %}{% load static recipe_markdown %}
|
||||
{% block title %}Cook {{ recipe.title }} · Tasknest{% endblock %}
|
||||
{% block page_class %}recipes-page-content{% endblock %}
|
||||
{% block content %}
|
||||
<link rel="stylesheet" href="{% static 'recipes/recipes.css' %}?v=5">
|
||||
<div class="recipes-layout recipes-layout--form recipes-cooking" data-cooking>
|
||||
<header class="recipes-form-header"><a href="{% url 'recipes:detail' recipe.api_id %}">← Back to {{ recipe.title }}</a><h1>Cook {{ recipe.title }}</h1><p>{{ analysis.servings|floatformat:-2 }} servings · {{ recipe.total_minutes }} min total</p></header>
|
||||
{% if error %}<p class="recipes-form-error" role="alert">{{ error }}</p>{% endif %}
|
||||
<div class="recipes-cooking-grid">
|
||||
<section class="recipes-panel recipes-cooking-steps" aria-labelledby="cooking-steps-title">
|
||||
<div class="recipes-cooking-heading"><h2 id="cooking-steps-title">Instructions</h2><button type="button" class="recipes-outline-button" data-wake-lock hidden aria-pressed="false">Keep screen awake</button></div>
|
||||
{% if steps %}<p class="recipes-cooking-progress" data-step-status role="status" aria-live="polite">Step 1 of {{ steps|length }}</p><progress class="recipes-cooking-meter" data-step-progress value="1" max="{{ steps|length }}" aria-label="Cooking step progress"></progress><div class="recipes-cooking-step-list" data-step-list>{% for step in steps %}<article class="recipes-cooking-step" data-step><span class="recipes-cooking-number" aria-hidden="true">{{ forloop.counter }}</span><div class="recipes-markdown-source">{{ step|recipe_markdown }}</div></article>{% endfor %}</div><div class="recipes-cooking-navigation"><button type="button" class="recipes-outline-button" data-previous disabled>Previous step</button><button type="button" class="button" data-next>Next step</button></div>{% else %}<p class="recipes-muted">No instructions added yet. You can still review the ingredients and finish cooking.</p>{% endif %}
|
||||
{% if components %}<div class="recipes-cooking-components"><h3>Subrecipe instructions</h3>{% for component in components %}<details><summary>{{ component.title }} · {{ component.quantity|floatformat:-3 }} {{ component.unit }}</summary>{% for step in component.steps %}<div class="recipes-markdown-source"><strong>{{ forloop.counter }}.</strong> {{ step|recipe_markdown }}</div>{% empty %}<p>No instructions added to this subrecipe.</p>{% endfor %}</details>{% endfor %}</div>{% endif %}
|
||||
</section>
|
||||
<aside class="recipes-panel recipes-cooking-ingredients" aria-labelledby="cooking-ingredients-title"><h2 id="cooking-ingredients-title">Ingredients</h2><p class="recipes-muted">Check ingredients as you prepare them.</p><ul>{% for line in analysis.lines %}{% if line.status != 'optional' %}<li><label><input type="checkbox"><span>{{ line.name }}{% if line.source %}<small>From {{ line.source }}</small>{% endif %}</span><strong>{{ line.quantity|floatformat:-3 }} {{ line.unit }}</strong></label></li>{% endif %}{% empty %}<li>No ingredients added yet.</li>{% endfor %}</ul></aside>
|
||||
</div>
|
||||
<div class="recipes-cooking-footer"><p>Finishing does not automatically log a meal or use inventory.</p><a class="button" href="{% url 'recipes:cook-finish' recipe.api_id %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}">Finish cooking</a></div>
|
||||
</div>
|
||||
<script defer src="{% static 'recipes/cooking.js' %}?v=1"></script>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,18 @@
|
||||
{% extends 'planner/base.html' %}{% load static %}
|
||||
{% block title %}Finish {{ recipe.title }} · Tasknest{% endblock %}
|
||||
{% block page_class %}recipes-page-content{% endblock %}
|
||||
{% block content %}
|
||||
<link rel="stylesheet" href="{% static 'recipes/recipes.css' %}?v=5">
|
||||
<div class="recipes-layout recipes-layout--form recipes-cooking-finish">
|
||||
<header class="recipes-form-header"><a href="{% url 'recipes:cook' recipe.api_id %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}">← Back to cooking</a><h1>Finish cooking</h1><p>{{ recipe.title }} · {{ analysis.servings|floatformat:-2 }} servings prepared</p></header>
|
||||
{% if error %}<p class="recipes-form-error" role="alert">{{ error }}</p>{% endif %}
|
||||
<section class="recipes-panel"><h2>Nutrition for this recipe</h2><p class="recipes-muted">Your Food Diary receives a snapshot of the portion you log. Later recipe edits do not change it.</p><dl class="recipes-nutrition">{% for row in analysis.nutrition_rows %}<div><dt>{{ row.label }}</dt><dd>{% if row.per_serving is not None %}{{ row.per_serving|floatformat:1 }} {{ row.unit }} / serving{% if not row.complete %}<small>Incomplete estimate</small>{% endif %}{% else %}— <small>Data unavailable</small>{% endif %}</dd></div>{% endfor %}</dl></section>
|
||||
<section class="recipes-panel"><h2>Inventory preview</h2>{% for group in analysis.groups %}<div class="recipes-preview-group"><h3>{{ group.product.product_name }} <span class="recipes-stock-label recipes-stock-label--{{ group.status }}">{{ group.status|capfirst }}</span></h3><p>{{ group.stock_amount|floatformat:-3 }} {{ group.unit }} needed{% if group.plan %} · {{ group.plan.total|floatformat:-3 }} {{ group.unit }} available{% endif %}</p>{% if group.plan %}{% for deduction in group.plan.deductions %}<div class="recipes-package"><div class="recipes-package__heading"><strong>Package {{ deduction.package.api_id|stringformat:'s'|slice:':8' }}</strong><span>{{ deduction.before|floatformat:-3 }} → {{ deduction.after|floatformat:-3 }} {{ deduction.unit }}</span></div><small>Use {{ deduction.amount|floatformat:-3 }} {{ deduction.unit }}</small></div>{% endfor %}{% endif %}</div>{% empty %}<p class="recipes-muted">No matched ingredients for inventory use.</p>{% endfor %}{% if not analysis.stock_ready %}<p class="recipes-muted">Inventory use is unavailable until stock and product matches are resolved. Food logging is still available.</p><a href="{% url 'recipes:stock-preview' recipe.api_id %}?servings={{ analysis.servings }}">Review stock and substitutions</a>{% endif %}</section>
|
||||
{% if confirmation %}<form method="post" class="recipes-panel recipes-completion-form">{% csrf_token %}<input type="hidden" name="confirmation" value="{{ confirmation }}"><h2>Choose what to record</h2><p>These actions are separate. Cooking a recipe does not mean you ate every serving.</p>
|
||||
<label class="recipes-completion-choice"><input type="checkbox" name="log_food" value="1" checked><span><strong>Log a portion to Food Diary</strong><small>Choose how much you personally ate.</small></span></label>
|
||||
<div class="recipes-completion-fields"><label>Servings eaten<input type="number" name="consumed_servings" min="0.001" max="{{ analysis.servings }}" step="0.001" value="{{ analysis.servings|floatformat:-2 }}"></label><label>Meal<select name="meal">{% for value, label in meals %}<option value="{{ value }}"{% if value == 'dinner' %} selected{% endif %}>{{ label }}</option>{% endfor %}</select></label><label>Date<input type="date" name="date" value="{{ today|date:'Y-m-d' }}"></label></div>
|
||||
<label class="recipes-completion-choice"><input type="checkbox" name="deduct_stock" value="1"{% if not analysis.stock_ready %} disabled{% endif %}><span><strong>Deduct ingredients from Kitchen Inventory</strong><small>{% if analysis.stock_ready %}Use the package amounts previewed above.{% else %}Resolve inventory checks first.{% endif %}</small></span></label>
|
||||
<button class="button" type="submit">Confirm selected actions</button>
|
||||
</form>{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -40,6 +40,7 @@
|
||||
<div class="recipes-hero__copy"><p class="recipes-eyebrow">{% if selected.status == 'draft' %}Draft recipe{% else %}Recipe{% endif %}</p><h2>{{ selected.title }}</h2><p class="recipes-hero__meta">{{ selected.total_minutes }} min total · {{ selected.default_servings|floatformat:-2 }} servings</p><div class="recipes-chips">{% if selected.category %}<span>{{ selected.category }}</span>{% endif %}{% for value in selected.tags %}<span>{{ value }}</span>{% endfor %}</div>{% if selected.description %}<p class="recipes-hero__description">{{ selected.description }}</p>{% endif %}</div>
|
||||
</div>
|
||||
<form class="recipes-serving-form" method="get" action="{% url 'recipes:detail' selected.api_id %}"><label for="recipe-servings">Servings</label><input id="recipe-servings" type="number" name="servings" min="0.01" max="99999.99" step="0.01" value="{{ analysis.servings|floatformat:-2 }}"><label class="recipes-checkbox"><input type="checkbox" name="optional" value="1"{% if analysis.include_optional %} checked{% endif %}> Include optional ingredients</label><button type="submit" class="recipes-outline-button">Update</button></form>
|
||||
<p class="recipes-cook-entry"><a class="button" href="{% url 'recipes:cook' selected.api_id %}?servings={{ analysis.servings }}{% if analysis.include_optional %}&optional=1{% endif %}">Start cooking</a></p>
|
||||
{% if analysis_error %}<p class="recipes-form-error" role="alert">{{ analysis_error }}</p>{% endif %}
|
||||
<div class="recipes-content-grid">
|
||||
<section class="recipes-panel" aria-labelledby="recipe-ingredients-heading"><h3 id="recipe-ingredients-heading">Ingredients</h3><ul class="recipes-ingredient-list">{% for line in analysis.lines %}<li><span>{{ line.name }}{% if line.source %}<small>From {{ line.source }}</small>{% endif %}{% if line.ingredient.preparation_note %}<small>{{ line.ingredient.preparation_note }}</small>{% endif %}<small class="recipes-stock-label recipes-stock-label--{{ line.status }}">{{ line.status|capfirst }}{% if line.reason %}: {{ line.reason }}{% endif %}</small></span><strong>{{ line.quantity|floatformat:-3 }} {{ line.unit }}</strong>{% if line.optional %}<em>Optional{% if not analysis.include_optional %} · excluded{% endif %}</em>{% endif %}</li>{% empty %}<li class="recipes-muted">No ingredients added yet.</li>{% endfor %}</ul></section>
|
||||
|
||||
Reference in New Issue
Block a user