adding part colour

This commit is contained in:
Ian Roddis committed 2026-07-02 12:34:33 -03:00
1 parent 422e217180
commit 2e7002b73b
14 files changed
+379 -2

No files matched your search

+3
View File
@@ -29,6 +29,9 @@
{% if user.is_superuser or "imported_parts:read" in user.permissions %}
<a href="/admin/imported-parts">Imported Parts</a>
{% endif %}
{% if user.is_superuser or "part_colours:read" in user.permissions %}
<a href="/admin/part-colours">Part Colours</a>
{% endif %}
{% if user.is_superuser or "static_connections:read" in user.permissions %}
<a href="/admin/static-connections">Static Connections</a>
{% endif %}
+15
View File
@@ -0,0 +1,15 @@
<tr id="part-colour-{{ pc.id }}">
<td>{{ pc.id }}</td>
<td>{{ pc.name }}</td>
<td class="row-actions">
<button class="btn btn-ghost"
hx-get="/admin/part-colours/{{ pc.id }}/edit"
hx-target="#part-colour-{{ pc.id }}"
hx-swap="outerHTML">Edit</button>
<button class="btn btn-danger"
hx-delete="/admin/part-colours/{{ pc.id }}"
hx-target="#part-colour-{{ pc.id }}"
hx-swap="outerHTML"
hx-confirm="Delete {{ pc.name }}?">Delete</button>
</td>
</tr>
@@ -0,0 +1,18 @@
<tr id="part-colour-{{ pc.id }}">
<td colspan="3">
<form hx-post="/admin/part-colours/{{ pc.id }}"
hx-target="#part-colour-{{ pc.id }}"
hx-swap="outerHTML"
class="inline-edit">
<span class="muted">#{{ pc.id }}</span>
<label>Name <input type="text" name="name" value="{{ pc.name }}" required></label>
<div class="row-actions">
<button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-ghost"
hx-get="/admin/part-colours/{{ pc.id }}/row"
hx-target="#part-colour-{{ pc.id }}"
hx-swap="outerHTML">Cancel</button>
</div>
</form>
</td>
</tr>
@@ -0,0 +1,18 @@
<div id="part-colour-list" class="card">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th></th>
</tr>
</thead>
<tbody>
{% for pc in part_colours %}
{% include "admin/_part_colour_row.html" %}
{% else %}
<tr><td colspan="3" class="muted">No part colours recorded.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
+18
View File
@@ -0,0 +1,18 @@
{% extends "base.html" %}
{% block title %}Part Colours · {{ app_name }}{% endblock %}
{% block body %}
{% include "_nav.html" %}
<main class="container">
<h1>Part Colours</h1>
<div class="card">
<h2>Add colour</h2>
<form hx-post="/admin/part-colours" hx-target="#part-colour-list" hx-swap="outerHTML" class="form-grid">
<label>Name <input type="text" name="name" required></label>
<button type="submit" class="btn btn-primary">Add</button>
</form>
</div>
{% include "admin/_part_colours_table.html" %}
</main>
{% endblock %}