Add clamp connection

This commit is contained in:
Ian Roddis committed 2026-07-02 13:35:58 -03:00
1 parent 0168b023af
commit 59184124e7
14 files changed
+452 -2

No files matched your search

+3
View File
@@ -41,6 +41,9 @@
{% if user.is_superuser or "static_connections:read" in user.permissions %}
<a href="/admin/static-connections">Static Connections</a>
{% endif %}
{% if user.is_superuser or "clamp_connections:read" in user.permissions %}
<a href="/admin/clamp-connections">Clamp Connections</a>
{% endif %}
{% if user.is_superuser or "audit_log:read" in user.permissions %}
<a href="/admin/audit-log">Audit Log</a>
{% endif %}
@@ -0,0 +1,18 @@
<tr id="clamp-connection-{{ cc.id }}">
<td>{{ cc.id }}</td>
<td>{{ cc.min_mm if cc.min_mm is not none else '—' }}</td>
<td>{{ cc.max_mm if cc.max_mm is not none else '—' }}</td>
<td>{{ cc.min_in if cc.min_in is not none else '—' }}</td>
<td>{{ cc.max_in if cc.max_in is not none else '—' }}</td>
<td class="row-actions">
<button class="btn btn-ghost"
hx-get="/admin/clamp-connections/{{ cc.id }}/edit"
hx-target="#clamp-connection-{{ cc.id }}"
hx-swap="outerHTML">Edit</button>
<button class="btn btn-danger"
hx-delete="/admin/clamp-connections/{{ cc.id }}"
hx-target="#clamp-connection-{{ cc.id }}"
hx-swap="outerHTML"
hx-confirm="Delete clamp connection #{{ cc.id }}?">Delete</button>
</td>
</tr>
@@ -0,0 +1,29 @@
<tr id="clamp-connection-{{ cc.id }}">
<td colspan="6">
<form hx-post="/admin/clamp-connections/{{ cc.id }}"
hx-target="#clamp-connection-{{ cc.id }}"
hx-swap="outerHTML"
class="inline-edit">
<span class="muted">#{{ cc.id }}</span>
<label>Min (mm) <input type="number" name="min_mm" step="0.001" min="0"
value="{{ cc.min_mm if cc.min_mm is not none else '' }}"
placeholder="optional"></label>
<label>Max (mm) <input type="number" name="max_mm" step="0.001" min="0"
value="{{ cc.max_mm if cc.max_mm is not none else '' }}"
placeholder="optional"></label>
<label>Min (in) <input type="number" name="min_in" step="0.0001" min="0"
value="{{ cc.min_in if cc.min_in is not none else '' }}"
placeholder="optional"></label>
<label>Max (in) <input type="number" name="max_in" step="0.0001" min="0"
value="{{ cc.max_in if cc.max_in is not none else '' }}"
placeholder="optional"></label>
<div class="row-actions">
<button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-ghost"
hx-get="/admin/clamp-connections/{{ cc.id }}/row"
hx-target="#clamp-connection-{{ cc.id }}"
hx-swap="outerHTML">Cancel</button>
</div>
</form>
</td>
</tr>
@@ -0,0 +1,21 @@
<div id="clamp-connection-list" class="card">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Min (mm)</th>
<th>Max (mm)</th>
<th>Min (in)</th>
<th>Max (in)</th>
<th></th>
</tr>
</thead>
<tbody>
{% for cc in clamp_connections %}
{% include "admin/_clamp_connection_row.html" %}
{% else %}
<tr><td colspan="6" class="muted">No clamp connections recorded.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
@@ -0,0 +1,21 @@
{% extends "base.html" %}
{% block title %}Clamp Connections · {{ app_name }}{% endblock %}
{% block body %}
{% include "_nav.html" %}
<main class="container">
<h1>Clamp Connections</h1>
<div class="card">
<h2>Add connection</h2>
<form hx-post="/admin/clamp-connections" hx-target="#clamp-connection-list" hx-swap="outerHTML" class="form-grid">
<label>Min (mm) <input type="number" name="min_mm" step="0.001" min="0" placeholder="optional"></label>
<label>Max (mm) <input type="number" name="max_mm" step="0.001" min="0" placeholder="optional"></label>
<label>Min (in) <input type="number" name="min_in" step="0.0001" min="0" placeholder="optional"></label>
<label>Max (in) <input type="number" name="max_in" step="0.0001" min="0" placeholder="optional"></label>
<button type="submit" class="btn btn-primary">Add</button>
</form>
</div>
{% include "admin/_clamp_connections_table.html" %}
</main>
{% endblock %}