From ecd09f3701f3bfc8fff0fbb2c621af2a55ebd09c Mon Sep 17 00:00:00 2001 From: Ross Date: Tue, 9 Dec 2025 20:58:00 +0000 Subject: [PATCH] add django templates --- .gitignore | 4 +- .../djangorota/templates/rota/index.html | 27 ++++ .../rota/partials/flatpickr_includes.html | 44 ++++++ .../partials/rota_option_modal_single.html | 52 +++++++ .../rota/partials/rota_options_display.html | 30 ++++ .../rota/partials/rota_options_modal.html | 57 +++++++ .../rota/partials/shift_confirm_delete.html | 21 +++ .../templates/rota/partials/shift_form.html | 10 ++ .../rota/partials/shift_form_modal.html | 28 ++++ .../templates/rota/partials/shift_list.html | 21 +++ .../rota/partials/worker_confirm_delete.html | 21 +++ .../rota/partials/worker_form_modal.html | 26 ++++ .../templates/rota/partials/worker_list.html | 16 ++ .../templates/rota/rota_detail.html | 144 ++++++++++++++++++ .../djangorota/templates/rota/rota_form.html | 81 ++++++++++ .../templates/rota/rota_run_detail.html | 47 ++++++ .../templates/rota/rota_run_export.html | 23 +++ .../templates/rota/worker_detail.html | 40 +++++ .../templates/rota/worker_form.html | 25 +++ 19 files changed, 715 insertions(+), 2 deletions(-) create mode 100644 djangorota/djangorota/templates/rota/index.html create mode 100644 djangorota/djangorota/templates/rota/partials/flatpickr_includes.html create mode 100644 djangorota/djangorota/templates/rota/partials/rota_option_modal_single.html create mode 100644 djangorota/djangorota/templates/rota/partials/rota_options_display.html create mode 100644 djangorota/djangorota/templates/rota/partials/rota_options_modal.html create mode 100644 djangorota/djangorota/templates/rota/partials/shift_confirm_delete.html create mode 100644 djangorota/djangorota/templates/rota/partials/shift_form.html create mode 100644 djangorota/djangorota/templates/rota/partials/shift_form_modal.html create mode 100644 djangorota/djangorota/templates/rota/partials/shift_list.html create mode 100644 djangorota/djangorota/templates/rota/partials/worker_confirm_delete.html create mode 100644 djangorota/djangorota/templates/rota/partials/worker_form_modal.html create mode 100644 djangorota/djangorota/templates/rota/partials/worker_list.html create mode 100644 djangorota/djangorota/templates/rota/rota_detail.html create mode 100644 djangorota/djangorota/templates/rota/rota_form.html create mode 100644 djangorota/djangorota/templates/rota/rota_run_detail.html create mode 100644 djangorota/djangorota/templates/rota/rota_run_export.html create mode 100644 djangorota/djangorota/templates/rota/worker_detail.html create mode 100644 djangorota/djangorota/templates/rota/worker_form.html diff --git a/.gitignore b/.gitignore index 2cf93b1..fc82acb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ sample.txt -*.html *.log *.pyc *.bak @@ -16,5 +15,6 @@ web/rota cons/ - +output/*.html +output/tests/*.html *.sqlite3 \ No newline at end of file diff --git a/djangorota/djangorota/templates/rota/index.html b/djangorota/djangorota/templates/rota/index.html new file mode 100644 index 0000000..6d33cd6 --- /dev/null +++ b/djangorota/djangorota/templates/rota/index.html @@ -0,0 +1,27 @@ +{% load static %} + + + Rotas + + + +
+
+

Rotas

+

+ Add worker + Create rota +

+
+
    + {% for rota in rotas %} +
  • {{ rota.name }} ({{ rota.start_date }} → {{ rota.end_date }})
  • + {% empty %} +
  • No rotas yet
  • + {% endfor %} +
+
+
+
+ + diff --git a/djangorota/djangorota/templates/rota/partials/flatpickr_includes.html b/djangorota/djangorota/templates/rota/partials/flatpickr_includes.html new file mode 100644 index 0000000..38b086a --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/flatpickr_includes.html @@ -0,0 +1,44 @@ + + + diff --git a/djangorota/djangorota/templates/rota/partials/rota_option_modal_single.html b/djangorota/djangorota/templates/rota/partials/rota_option_modal_single.html new file mode 100644 index 0000000..abd9ccf --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/rota_option_modal_single.html @@ -0,0 +1,52 @@ +{% load crispy_forms_tags %} + + diff --git a/djangorota/djangorota/templates/rota/partials/rota_options_display.html b/djangorota/djangorota/templates/rota/partials/rota_options_display.html new file mode 100644 index 0000000..2313275 --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/rota_options_display.html @@ -0,0 +1,30 @@ +
+
+ +
+ + + + {% if rota.options %} + {% for k,v in rota.options.items %} + + + + + + {% empty %} + + {% endfor %} + {% else %} + + {% endif %} + +
KeyValueActions
{{ k }}
{{ v|json_script:k }}
+ +
+ {% csrf_token %} + + +
+
No options set
No options set
+
diff --git a/djangorota/djangorota/templates/rota/partials/rota_options_modal.html b/djangorota/djangorota/templates/rota/partials/rota_options_modal.html new file mode 100644 index 0000000..3c99c6d --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/rota_options_modal.html @@ -0,0 +1,57 @@ +{% load crispy_forms_tags %} + + diff --git a/djangorota/djangorota/templates/rota/partials/shift_confirm_delete.html b/djangorota/djangorota/templates/rota/partials/shift_confirm_delete.html new file mode 100644 index 0000000..0357e3b --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/shift_confirm_delete.html @@ -0,0 +1,21 @@ + diff --git a/djangorota/djangorota/templates/rota/partials/shift_form.html b/djangorota/djangorota/templates/rota/partials/shift_form.html new file mode 100644 index 0000000..f79054f --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/shift_form.html @@ -0,0 +1,10 @@ +{% load crispy_forms_tags %} +
+ {% csrf_token %} + {{ form|crispy }} +
+
+ +
+
+
diff --git a/djangorota/djangorota/templates/rota/partials/shift_form_modal.html b/djangorota/djangorota/templates/rota/partials/shift_form_modal.html new file mode 100644 index 0000000..be99077 --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/shift_form_modal.html @@ -0,0 +1,28 @@ +{% load crispy_forms_tags %} + + diff --git a/djangorota/djangorota/templates/rota/partials/shift_list.html b/djangorota/djangorota/templates/rota/partials/shift_list.html new file mode 100644 index 0000000..e33bc38 --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/shift_list.html @@ -0,0 +1,21 @@ +
+

Shifts

+
+
    + {% for s in rota.shifts %} +
  • + {{ s.name }} — sites: {{ s.sites|join:", " }} — days: {{ s.days|join:", " }} — workers: {{ s.workers_required }} + {% if s.balance_offset is defined and s.balance_offset %} + — balance offset: {{ s.balance_offset }} + {% endif %} + + + + +
  • + {% empty %} +
  • No shifts defined yet.
  • + {% endfor %} +
+
+
diff --git a/djangorota/djangorota/templates/rota/partials/worker_confirm_delete.html b/djangorota/djangorota/templates/rota/partials/worker_confirm_delete.html new file mode 100644 index 0000000..e06a438 --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/worker_confirm_delete.html @@ -0,0 +1,21 @@ + diff --git a/djangorota/djangorota/templates/rota/partials/worker_form_modal.html b/djangorota/djangorota/templates/rota/partials/worker_form_modal.html new file mode 100644 index 0000000..b0dc5b9 --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/worker_form_modal.html @@ -0,0 +1,26 @@ +{% load crispy_forms_tags %} + diff --git a/djangorota/djangorota/templates/rota/partials/worker_list.html b/djangorota/djangorota/templates/rota/partials/worker_list.html new file mode 100644 index 0000000..4339b7a --- /dev/null +++ b/djangorota/djangorota/templates/rota/partials/worker_list.html @@ -0,0 +1,16 @@ +
+

Workers

+
+
    + {% for w in rota.workers.all %} +
  • + {{ w.name }} + + +
  • + {% empty %} +
  • No workers assigned
  • + {% endfor %} +
+
+
diff --git a/djangorota/djangorota/templates/rota/rota_detail.html b/djangorota/djangorota/templates/rota/rota_detail.html new file mode 100644 index 0000000..0dca94a --- /dev/null +++ b/djangorota/djangorota/templates/rota/rota_detail.html @@ -0,0 +1,144 @@ + + + Rota: {{ rota.name }} + + + {% include 'rota/partials/flatpickr_includes.html' %} + + +
+
+

{{ rota.name }}

+

+ Edit rota +

+

{{ rota.description }}

+

Period: {{ rota.start_date }} → {{ rota.end_date }}

+ +
+

+ +

+ {% include 'rota/partials/worker_list.html' %} +
+ +
+

Historic runs

+
+
+
+ {% csrf_token %} + +
+
+
    + {% for run in rota.runs.all %} +
  • + Run {{ run.id }} — + {{ run.get_status_display }} + {% if run.finished_at %} — finished {{ run.finished_at }}{% endif %} + + Export + +
  • + {% empty %} +
  • No previous runs
  • + {% endfor %} +
+
+
+ + + +
+

Rota Settings

+
+

View and edit the rota's `options` used by the builder. Click Edit to open a modal editor.

+
+ +
+
+ {% include 'rota/partials/rota_options_display.html' %} +
+
+

Available constraint keys

+
+ + + + + + + + + + + {% for key, info in available_constraints.items %} + + + + + + + {% empty %} + + {% endfor %} + +
KeyDefaultCurrentDescription
{{ key }}
{{ info.default|default:"" }}
{{ info.current|default:"" }}
+ {{ info.description|default:"" }} + {% comment %} Quick action: add default value if none set {% endcomment %} + {% if info.current is None or info.current == "" %} +
+ +
+ {% endif %} +
No constraint metadata available
+
+
+
+ +
+ {% csrf_token %} +
+
+ +
+
+ +
+
+ +
+
+
+ +
+ +
+

Edit shifts

+

+ +

+ +
+ {# Load form via HTMX when user clicks 'Add shift' - initial empty state #} +
+ + + + {% include 'rota/partials/shift_list.html' %} +
+
+
+ + diff --git a/djangorota/djangorota/templates/rota/rota_form.html b/djangorota/djangorota/templates/rota/rota_form.html new file mode 100644 index 0000000..ab16423 --- /dev/null +++ b/djangorota/djangorota/templates/rota/rota_form.html @@ -0,0 +1,81 @@ +{% load crispy_forms_tags %} + + + Create Rota + + +{% include 'rota/partials/flatpickr_includes.html' %} + +
+
+

{% if editing %}Edit Rota{% else %}Create Rota{% endif %}

+
+ {% csrf_token %} + {{ form|crispy }} + +
+
+ +
+
+
+
+
+ + diff --git a/djangorota/djangorota/templates/rota/rota_run_detail.html b/djangorota/djangorota/templates/rota/rota_run_detail.html new file mode 100644 index 0000000..b1167b6 --- /dev/null +++ b/djangorota/djangorota/templates/rota/rota_run_detail.html @@ -0,0 +1,47 @@ +{% load tz %} + + + + + Rota run {{ run.id }} + + + + +
+
+

Rota run for {{ run.rota.name }}

+

Status: {{ run.get_status_display }} ({{ run.status }})

+

Created: {{ run.created_at|localtime }} started: {{ run.started_at|localtime }} finished: {{ run.finished_at|localtime }}

+ +
+

Log

+
{{ run.log }}
+
+ +
+

Result

+
{{ run.result }}
+

+ {% if run.export_html %} + View Stored Export + Download Stored Export + {% else %} + No stored export + {% endif %} +

+ {% csrf_token %} + + +
+
+ {% csrf_token %} + + +
+

+
+
+
+ + diff --git a/djangorota/djangorota/templates/rota/rota_run_export.html b/djangorota/djangorota/templates/rota/rota_run_export.html new file mode 100644 index 0000000..e9ddb34 --- /dev/null +++ b/djangorota/djangorota/templates/rota/rota_run_export.html @@ -0,0 +1,23 @@ + + + + Rota Run Export - {{ run.rota.name }} + + + +
+
+

Run export for {{ run.rota.name }}

+

Status: {{ run.status }}{% if run.finished_at %} — finished {{ run.finished_at }}{% endif %}

+ +

Raw result

+
{{ run.result|safe }}
+ +

+ Download HTML + Back +

+
+
+ + diff --git a/djangorota/djangorota/templates/rota/worker_detail.html b/djangorota/djangorota/templates/rota/worker_detail.html new file mode 100644 index 0000000..80c8062 --- /dev/null +++ b/djangorota/djangorota/templates/rota/worker_detail.html @@ -0,0 +1,40 @@ +{% load crispy_forms_tags %} + + + {{ worker.name }} + +{% include 'rota/partials/flatpickr_includes.html' %} + + +
+
+

{{ worker.name }}

+

{{ worker.email }} - {{ worker.site }}

+ +
+

Request leave

+
+ {% csrf_token %} + {{ form|crispy }} +
+
+ +
+
+
+
+ +

Existing leave

+
+
    + {% for l in worker.leaves.all %} +
  • {{ l.start_date }} → {{ l.end_date }} {% if l.reason %}({{ l.reason }}){% endif %}
  • + {% empty %} +
  • No leave recorded
  • + {% endfor %} +
+
+
+
+ + diff --git a/djangorota/djangorota/templates/rota/worker_form.html b/djangorota/djangorota/templates/rota/worker_form.html new file mode 100644 index 0000000..75500b0 --- /dev/null +++ b/djangorota/djangorota/templates/rota/worker_form.html @@ -0,0 +1,25 @@ +{% load crispy_forms_tags %} + + + Add Worker + + +{% include 'rota/partials/flatpickr_includes.html' %} + + +
+
+

Add Worker

+
+ {% csrf_token %} + {{ form|crispy }} +
+
+ +
+
+
+
+
+ +