Files
agentbox-test/templates/dashboard.html
T
2026-08-01 06:00:29 +00:00

115 lines
5.5 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ t('Dashboard — Meal Tracker') }}{% endblock %}
{% block content %}
<div class="dashboard-header">
<h2>
{% if history_mode %}{{ t('History — {date}', date=viewing_date.isoformat()) }}{% else %}{{ t("Today's Meals") }}{% endif %}
</h2>
<div class="date-nav">
<a class="btn btn-sm" href="?date={{ prev_date.isoformat() }}">{{ t('◀ Prev') }}</a>
<span class="date-display">{{ viewing_date.isoformat() }}</span>
<a class="btn btn-sm" href="?date={{ next_date.isoformat() }}">{{ t('Next ▶') }}</a>
{% if viewing_date != today %}
<a class="btn btn-sm" href="{{ url_for('meals.dashboard') }}">{{ t('Today') }}</a>
{% endif %}
</div>
</div>
{% if not dashboard.users %}
<p class="empty-state">{{ t('No registered users yet. Ask household members to register!') }}</p>
{% else %}
<div class="table-wrapper">
<table class="meal-table">
<thead>
<tr>
<th>{{ t('User') }}</th>
{% for period in dashboard.periods %}
<th class="meal-col">{{ t(period.meal_type|capitalize) }}</th>
{% endfor %}
{% if is_admin %}
<th class="action-col"></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for user in dashboard.users %}
{% set is_me = user.id == current_user_id %}
<tr>
<td class="user-cell">
{{ user.username }}
{% if user.is_admin %}<span class="admin-tag">{{ t('admin') }}</span>{% endif %}
{% if is_me %}<span class="you-tag">{{ t('you') }}</span>{% endif %}
</td>
{% for period in dashboard.periods %}
{% set resp = user.responses[period.meal_type] %}
<td class="response-cell status-{{ resp.status }}{% if resp.changed_at %} changed-mind{% endif %}">
{% if is_me and viewing_date >= today %}
<form method="POST" action="{{ url_for('meals.respond') }}" class="respond-form">
<input type="hidden" name="date" value="{{ viewing_date.isoformat() }}">
<input type="hidden" name="meal_type" value="{{ period.meal_type }}">
<div class="btn-row">
<button name="status" value="yes"
class="chip chip-yes {% if resp.status == 'yes' %}active{% endif %}"
>{{ t('Home') }}</button>
<button name="status" value="no"
class="chip chip-no {% if resp.status == 'no' %}active{% endif %}"
>{{ t('Out') }}</button>
</div>
</form>
{% if resp.changed_at %}
<div class="changed-badge" title="{{ t('Changed mind at {time}', time=resp.changed_at) }}">↻ {{ resp.changed_at[11:16] }}</div>
{% endif %}
{% else %}
<span class="badge badge-{{ resp.status }}">{{ t('Home') if resp.status == 'yes' else (t('Out') if resp.status == 'no' else t('—')) }}</span>
{% endif %}
</td>
{% endfor %}
{% if is_admin and not is_me and not user.is_admin %}
<td class="action-cell">
<form method="POST" action="{{ url_for('meals.admin_remove_user', user_id=user.id) }}"
onsubmit="return confirm(this.dataset.confirmMsg);"
data-confirm-msg="{{ t('Remove {name} from this household?', name=user.username) }}">
<button class="btn btn-sm btn-danger">{{ t('Remove') }}</button>
</form>
</td>
{% elif is_admin %}
<td class="action-cell"></td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
<div class="manage-section">
<details class="manage-details">
<summary>{{ t('⚙ Account Settings') }}</summary>
<div class="manage-forms">
<form method="POST" action="{{ url_for('meals.delete_account') }}"
onsubmit="return confirm(this.dataset.confirmMsg);"
data-confirm-msg="{{ t('Delete YOUR account? This cannot be undone.') }}"
class="manage-form">
<h4>{{ t('Delete My Account') }}</h4>
<input type="password" name="password" placeholder="{{ t('Enter your password to confirm') }}" required>
<button class="btn btn-danger">{{ t('Delete My Account') }}</button>
</form>
{% if is_admin %}
<form method="POST" action="{{ url_for('meals.admin_delete_household') }}"
onsubmit="return confirm(this.dataset.confirmMsg);"
data-confirm-msg="{{ t('Delete the ENTIRE household and ALL members? This cannot be undone.') }}"
class="manage-form">
<h4>{{ t('Delete Household') }}</h4>
<p class="hint">{{ t('This will remove all users and all data in this household.') }}</p>
<input type="password" name="password" placeholder="{{ t('Enter your password to confirm') }}" required>
<button class="btn btn-danger">{{ t('Delete Household') }}</button>
</form>
{% endif %}
</div>
</details>
</div>
{% endblock %}