Adding sub-parts
This commit is contained in:
1 parent
45bc5bf8f6
commit
c8696e67b5
14 files changed
+436
-2
No files matched your search
@@ -0,0 +1,16 @@
|
||||
<tr id="sub-part-type-{{ spt.id }}">
|
||||
<td>{{ spt.id }}</td>
|
||||
<td>{{ spt.name }}</td>
|
||||
<td>{{ spt.part_type.name }}</td>
|
||||
<td class="row-actions">
|
||||
<button class="btn btn-ghost"
|
||||
hx-get="/admin/sub-part-types/{{ spt.id }}/edit"
|
||||
hx-target="#sub-part-type-{{ spt.id }}"
|
||||
hx-swap="outerHTML">Edit</button>
|
||||
<button class="btn btn-danger"
|
||||
hx-delete="/admin/sub-part-types/{{ spt.id }}"
|
||||
hx-target="#sub-part-type-{{ spt.id }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-confirm="Delete {{ spt.name }}?">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,25 @@
|
||||
<tr id="sub-part-type-{{ spt.id }}">
|
||||
<td colspan="4">
|
||||
<form hx-post="/admin/sub-part-types/{{ spt.id }}"
|
||||
hx-target="#sub-part-type-{{ spt.id }}"
|
||||
hx-swap="outerHTML"
|
||||
class="inline-edit">
|
||||
<span class="muted">#{{ spt.id }}</span>
|
||||
<label>Name <input type="text" name="name" value="{{ spt.name }}" required></label>
|
||||
<label>Parent Type
|
||||
<select name="part_type_id" required>
|
||||
{% for pt in part_types %}
|
||||
<option value="{{ pt.id }}" {% if pt.id == spt.part_type_id %}selected{% endif %}>{{ pt.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<div class="row-actions">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn btn-ghost"
|
||||
hx-get="/admin/sub-part-types/{{ spt.id }}/row"
|
||||
hx-target="#sub-part-type-{{ spt.id }}"
|
||||
hx-swap="outerHTML">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,16 @@
|
||||
<div id="sub-part-type-list" class="card">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th><th>Name</th><th>Parent Type</th><th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for spt in sub_part_types %}
|
||||
{% include "admin/_sub_part_type_row.html" %}
|
||||
{% else %}
|
||||
<tr><td colspan="4" class="muted">No sub part types recorded.</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Sub Part Types · {{ app_name }}{% endblock %}
|
||||
{% block body %}
|
||||
{% include "_nav.html" %}
|
||||
<main class="container">
|
||||
<h1>Sub Part Types</h1>
|
||||
|
||||
<div class="card">
|
||||
<h2>Add sub part type</h2>
|
||||
<form hx-post="/admin/sub-part-types" hx-target="#sub-part-type-list" hx-swap="outerHTML" class="form-grid">
|
||||
<label>Name <input type="text" name="name" required></label>
|
||||
<label>Parent Type
|
||||
<select name="part_type_id" required>
|
||||
<option value="">— select —</option>
|
||||
{% for pt in part_types %}
|
||||
<option value="{{ pt.id }}">{{ pt.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<button type="submit" class="btn btn-primary">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% include "admin/_sub_part_types_table.html" %}
|
||||
</main>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user