Adding fits

This commit is contained in:
Ian Roddis committed 2026-07-14 15:24:05 -03:00
1 parent 8185f1f8b3
commit ab39191af5
19 files changed
+1253 -1

No files matched your search

@@ -0,0 +1,49 @@
<div id="ap-{{ augmented_part_id }}-fits" class="ap-inline-section">
<h3>Fits</h3>
{% if message %}<p class="alert alert-success">{{ message }}</p>{% endif %}
{% if error %}<p class="alert alert-error">{{ error }}</p>{% endif %}
{% for view in fit_views %}
{% with fit=view.fit, own_ap=view.own_ap, other_ap=view.other_ap, other_part=view.other_part %}
{% include "admin/_augmented_part_fit_row.html" %}
{% endwith %}
{% else %}
<p class="muted" style="font-size:0.85rem;margin:0 0 0.5rem">No fits recorded yet.</p>
{% endfor %}
<div class="row-actions" style="margin:0.5rem 0">
<form hx-post="/admin/augmented-parts/{{ augmented_part_id }}/fits/recompute"
hx-target="#ap-{{ augmented_part_id }}-fits" hx-swap="outerHTML">
<button type="submit" class="btn btn-ghost">Recompute possible fits</button>
</form>
</div>
<form hx-post="/admin/augmented-parts/{{ augmented_part_id }}/fits"
hx-target="#ap-{{ augmented_part_id }}-fits"
hx-swap="outerHTML"
class="inline-edit" style="margin-top:0.5rem">
<label>This part's point
<select name="own_attachment_point_id" required>
<option value="">— select —</option>
{% for p in own_points %}
<option value="{{ p.id }}">{{ p.attachment_point_name.name }}</option>
{% endfor %}
</select>
</label>
<label>Fits with part
<select name="other_augmented_part_id" required
hx-get="/admin/augmented-parts/{{ augmented_part_id }}/fits/other-points"
hx-target="#ap-{{ augmented_part_id }}-fit-other-points"
hx-trigger="change"
hx-include="[name='other_augmented_part_id']">
<option value="">— select —</option>
{% for p in other_parts %}
<option value="{{ p.id }}">{{ p.description | truncate(40) }}</option>
{% endfor %}
</select>
</label>
<div id="ap-{{ augmented_part_id }}-fit-other-points"></div>
<button type="submit" class="btn btn-primary">Add fit</button>
</form>
</div>