Adding post-import adjustments

This commit is contained in:
Ian Roddis committed 2026-07-02 13:12:09 -03:00
1 parent c320595423
commit 87019ff2af
6 files changed
+170 -3

No files matched your search

@@ -0,0 +1,4 @@
<div id="augmented-parts-sections">
{% include "admin/_augmented_parts_table.html" %}
{% include "admin/_unlinked_parts_table.html" %}
</div>
@@ -0,0 +1,58 @@
<div id="unlinked-parts-list">
{% if unlinked_parts %}
<div class="card">
<h2>Skipped Imported Parts</h2>
<p class="muted">These parts were skipped during sync because no Part Type could be inferred from their description. Assign a type and click Sync to create the Augmented Part entry.</p>
{% if unlinked_sync_result %}<p class="alert alert-success">{{ unlinked_sync_result }}</p>{% endif %}
{% if unlinked_sync_error %}<p class="alert alert-error">{{ unlinked_sync_error }}</p>{% endif %}
<div style="overflow-x:auto">
<table class="table">
<thead>
<tr>
<th>Inventory ID</th>
<th>Description</th>
<th>Colour</th>
<th>Type</th>
<th>Sub Type</th>
<th></th>
</tr>
</thead>
<tbody>
{% for ip in unlinked_parts %}
<tr>
<td><code>{{ ip.InventoryID }}</code></td>
<td>{{ ip.Description | truncate(60) if ip.Description else '—' }}</td>
<td>{{ ip.TBXColour or '—' }}</td>
<td>
<select name="part_type_id" form="unlinked-sync-{{ loop.index }}" required>
<option value="">— select —</option>
{% for pt in part_types %}
<option value="{{ pt.id }}">{{ pt.name }}</option>
{% endfor %}
</select>
</td>
<td>
<select name="sub_part_type_id" form="unlinked-sync-{{ loop.index }}">
<option value="">— none —</option>
{% for spt in sub_part_types %}
<option value="{{ spt.id }}">{{ spt.name }} ({{ spt.part_type.name }})</option>
{% endfor %}
</select>
</td>
<td>
<form id="unlinked-sync-{{ loop.index }}"
hx-post="/admin/augmented-parts/unlinked"
hx-target="#augmented-parts-sections"
hx-swap="outerHTML">
<input type="hidden" name="inventory_id" value="{{ ip.InventoryID }}">
<button type="submit" class="btn btn-primary">Sync</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
</div>
+2 -2
View File
@@ -57,11 +57,11 @@
<div class="card">
<h2>Sync with Imported Parts</h2>
<p class="muted">Creates Augmented Part entries for new Imported Parts, and removes entries for deleted Imported Parts.</p>
<form hx-post="/admin/augmented-parts/sync" hx-target="#augmented-part-list" hx-swap="outerHTML">
<form hx-post="/admin/augmented-parts/sync" hx-target="#augmented-parts-sections" hx-swap="outerHTML">
<button type="submit" class="btn btn-primary">Sync now</button>
</form>
</div>
{% include "admin/_augmented_parts_table.html" %}
{% include "admin/_augmented_parts_sections.html" %}
</main>
{% endblock %}