Massprice/templates/dashboard.html
Barely Removable 63e2296d1c
All checks were successful
Deploy / deploy (push) Successful in 25s
Add an All Days button to the schedule editor
Selects all 7 day toggles in one click instead of clicking each one.
Scoped selectors to .day-toggle[data-day] throughout so the new button
(which has no data-day) can't accidentally get read as a day or toggled
by the generic day-button click handler.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H6TgffxTvYhqxykAbVQg2v
2026-08-31 20:29:19 -07:00

76 lines
2.7 KiB
HTML

{% extends "_shell.html" %}
{% block title %}Dashboard &middot; MassPrice Scheduler{% endblock %}
{% block content %}
<div class="page-header">
<h1>Rules</h1>
<div class="page-header-meta">
{% if rules_updated_at %}<span class="muted">Rules last synced {{ rules_updated_at }}</span>{% endif %}
<button id="refresh-rules" class="btn btn-secondary">Refresh Rules</button>
</div>
</div>
{% if session_warning %}
<div class="banner banner-warn">
Your MassPrice login session has expired or was never captured — scheduled runs and rule
refreshes will fail until you log in again. <a href="{{ url_for('session_page') }}">Go to the Session page</a>.
</div>
{% endif %}
{% if not rules %}
<p class="empty-state">No rules loaded yet. Click "Refresh Rules" to pull the current rule list from MassPrice.</p>
{% endif %}
<div class="rule-grid">
{% for rule in rules %}
<div class="rule-card" data-rule-id="{{ rule.id }}">
<div class="rule-card-header">
<h2>{{ rule.name }}</h2>
<label class="switch" title="Enabled">
<input type="checkbox" class="rule-enabled" {{ 'checked' if rule.enabled else '' }}>
<span class="slider"></span>
</label>
</div>
<div class="rule-last-run">
{% if rule.last_run %}
<span class="status-dot status-{{ rule.last_run.status }}"></span>
Last run {{ rule.last_run.timestamp }} &mdash; {{ rule.last_run.status }}
{% if rule.last_run.status == 'failure' %}<div class="muted small">{{ rule.last_run.message }}</div>{% endif %}
{% else %}
<span class="muted">No runs yet</span>
{% endif %}
</div>
<ul class="schedule-list">
{% for entry in rule.schedules %}
<li class="schedule-chip">
<span class="chip-time">{{ entry.time }}</span>
<span class="chip-days">{{ entry.days | join(' ') }}</span>
<button type="button" class="chip-remove" title="Remove">&times;</button>
</li>
{% endfor %}
</ul>
<div class="schedule-add">
<div class="schedule-add-row">
<input type="time" class="new-time" value="06:00">
<button type="button" class="btn btn-small add-schedule">Add Time</button>
</div>
<div class="day-toggles">
{% for d in days %}
<button type="button" class="day-toggle" data-day="{{ d }}">{{ day_labels[d] }}</button>
{% endfor %}
<button type="button" class="day-toggle day-toggle-all">All Days</button>
</div>
</div>
<div class="rule-actions">
<button type="button" class="btn btn-primary run-now">Run Now</button>
</div>
</div>
{% endfor %}
</div>
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static', filename='js/app.js') }}"></script>
{% endblock %}