This commit is contained in:
Ross
2025-12-14 21:57:16 +00:00
parent f0ebc0d01a
commit 55df9da8cb
@@ -1,24 +1,4 @@
{% extends 'base.html' %} {% extends 'base.html' %}
<html>
<head>
<title>Rota: {{ rota.name }}</title>
<link href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css" rel="stylesheet">
<script src="https://unpkg.com/htmx.org@1.9.2"></script>
{% include 'rota/partials/flatpickr_includes.html' %}
</head>
<body>
<section class="section">
<div class="container">
<h1 class="title">{{ rota.name }}</h1>
<p>
<a class="button is-small" href="{% url 'rota:rota_edit' rota.id %}">Edit rota</a>
</p>
<p>Period: {{ rota.start_date }} → {{ rota.end_date }}</p>
<div class="mb-4">
<p>
<button class="button is-link" hx-get="{% url 'rota:worker_add' %}?rota_id={{ rota.id }}" hx-target="#modal" hx-swap="innerHTML">Add worker</button>
</p>
{% block head %} {% block head %}
<link href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css" rel="stylesheet">
{% include 'rota/partials/flatpickr_includes.html' %} {% include 'rota/partials/flatpickr_includes.html' %}
@@ -27,16 +7,12 @@
<section class="section"> <section class="section">
<div class="container"> <div class="container">
<h1 class="title">{{ rota.name }}</h1> <h1 class="title">{{ rota.name }}</h1>
<p> <p><a class="button is-small" href="{% url 'rota:rota_edit' rota.id %}">Edit rota</a></p>
<a class="button is-small" href="{% url 'rota:rota_edit' rota.id %}">Edit rota</a>
</p>
<p class="subtitle">{{ rota.description }}</p> <p class="subtitle">{{ rota.description }}</p>
<p>Period: {{ rota.start_date }} → {{ rota.end_date }}</p> <p>Period: {{ rota.start_date }} → {{ rota.end_date }}</p>
<div class="mb-4"> <div class="mb-4">
<p> <p><button class="button is-link" hx-get="{% url 'rota:worker_add' %}?rota_id={{ rota.id }}" hx-target="#modal" hx-swap="innerHTML">Add worker</button></p>
<button class="button is-link" hx-get="{% url 'rota:worker_add' %}?rota_id={{ rota.id }}" hx-target="#modal" hx-swap="innerHTML">Add worker</button>
</p>
{% include 'rota/partials/worker_list.html' %} {% include 'rota/partials/worker_list.html' %}
</div> </div>
@@ -52,12 +28,9 @@
<ul> <ul>
{% for run in rota.runs.all %} {% for run in rota.runs.all %}
<li> <li>
<a href="{% url 'rota:rota_run_detail' run.id %}">Run {{ run.id }}</a> <a href="{% url 'rota:rota_run_detail' run.id %}">Run {{ run.id }}</a> {{ run.get_status_display }}
{{ run.get_status_display }}
{% if run.finished_at %} — finished {{ run.finished_at }}{% endif %} {% if run.finished_at %} — finished {{ run.finished_at }}{% endif %}
<span class="ml-2"> <span class="ml-2"><a class="button is-small is-light" href="{% url 'rota:rota_run_export_html' run.id %}" target="_blank">Export</a></span>
<a class="button is-small is-light" href="{% url 'rota:rota_run_export_html' run.id %}" target="_blank">Export</a>
</span>
</li> </li>
{% empty %} {% empty %}
<li>No previous runs</li> <li>No previous runs</li>
@@ -70,17 +43,13 @@
<h2 class="subtitle">Constraint options</h2> <h2 class="subtitle">Constraint options</h2>
<div class="box"> <div class="box">
<p class="help">Configure typed rota constraint options. Click Edit to open the form showing typed fields and descriptions.</p> <p class="help">Configure typed rota constraint options. Click Edit to open the form showing typed fields and descriptions.</p>
<p> <p><button class="button is-link" hx-get="{% url 'rota:rota_options' rota.id %}" hx-target="#modal" hx-swap="innerHTML">Edit constraint options</button></p>
<button class="button is-link" hx-get="{% url 'rota:rota_options' rota.id %}" hx-target="#modal" hx-swap="innerHTML">Edit constraint options</button>
</p>
<hr /> <hr />
<h3 class="subtitle is-6">Configured constraint values</h3> <h3 class="subtitle is-6">Configured constraint values</h3>
<div style="max-height:200px; overflow:auto; margin-bottom:0.75em;"> <div style="max-height:200px; overflow:auto; margin-bottom:0.75em;">
{% if configured_constraints %} {% if configured_constraints %}
<table class="table is-fullwidth is-striped is-narrow"> <table class="table is-fullwidth is-striped is-narrow">
<thead> <thead><tr><th>Key</th><th>Value</th><th></th></tr></thead>
<tr><th>Key</th><th>Value</th><th></th></tr>
</thead>
<tbody> <tbody>
{% for key, info in configured_constraints.items %} {% for key, info in configured_constraints.items %}
<tr id="constraint-row-{{ key }}"> <tr id="constraint-row-{{ key }}">
@@ -103,42 +72,27 @@
<p class="help">No typed constraint options have been configured for this rota.</p> <p class="help">No typed constraint options have been configured for this rota.</p>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
<div class="field is-grouped is-grouped-multiline"> <div class="field is-grouped is-grouped-multiline">
<div class="control"> <div class="control"><label class="checkbox"><input type="checkbox" name="generate_builder" value="1"> Generate HTML export</label></div>
<label class="checkbox"> <div class="control"><label class="checkbox"><input type="checkbox" name="builder_solve" value="1"> Solve when exporting (may be slow)</label></div>
<input type="checkbox" name="generate_builder" value="1"> Generate HTML export <div class="control"><button class="button is-primary" type="submit">Run scheduler (background)</button></div>
</label>
</div>
<div class="control">
<label class="checkbox">
<input type="checkbox" name="builder_solve" value="1"> Solve when exporting (may be slow)
</label>
</div>
<div class="control">
<button class="button is-primary" type="submit">Run scheduler (background)</button>
</div>
</div> </div>
</form> </form>
<hr> <hr />
<div> <div>
<h2 class="subtitle">Edit shifts</h2> <h2 class="subtitle">Edit shifts</h2>
<p> <p><button class="button is-link" hx-get="{% url 'rota:shift_add' rota.id %}" hx-target="#shift-form" hx-swap="innerHTML">Add shift</button></p>
<button class="button is-link" hx-get="{% url 'rota:shift_add' rota.id %}" hx-target="#shift-form" hx-swap="innerHTML">Add shift</button> <div id="shift-form">{# Load form via HTMX when user clicks 'Add shift' - initial empty state #}</div>
</p>
<div id="shift-form">
{# Load form via HTMX when user clicks 'Add shift' - initial empty state #}
</div>
{% include 'rota/partials/shift_list.html' %} {% include 'rota/partials/shift_list.html' %}
</div> </div>
</div> </div>
</section>
{% endblock %} {% endblock %}