Adding part details page
This commit is contained in:
1 parent
2587ccbceb
commit
1b52ad04bc
7 files changed
+305
-9
No files matched your search
@@ -19,6 +19,7 @@
|
||||
<span class="fit-item-arrow">↔</span>
|
||||
<span class="fit-item-side">{{ other_part.description if other_part else "Unknown part" }} — <strong>{{ other_ap.attachment_point_name.name }}</strong> ({{ conn_desc(other_ap) }})</span>
|
||||
</div>
|
||||
{% if can_write %}
|
||||
<div class="row-actions">
|
||||
{% if fit.label.value != "exact" %}
|
||||
<button class="btn btn-ghost"
|
||||
@@ -44,6 +45,7 @@
|
||||
hx-swap="outerHTML"
|
||||
hx-confirm="Delete this fit?">Delete</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="fit-notes">
|
||||
{% for note in fit.notes %}
|
||||
@@ -52,11 +54,13 @@
|
||||
<p class="fit-note-body">{{ note.body }}</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if can_write %}
|
||||
<form hx-post="/admin/augmented-parts/{{ augmented_part_id }}/fits/{{ fit.id }}/notes"
|
||||
hx-target="#fit-{{ fit.id }}" hx-swap="outerHTML"
|
||||
class="inline-edit fit-note-form">
|
||||
<input type="text" name="body" placeholder="Add a note…" required>
|
||||
<button type="submit" class="btn btn-ghost">Add note</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -12,6 +12,7 @@
|
||||
<p class="muted" style="font-size:0.85rem;margin:0 0 0.5rem">No fits recorded yet.</p>
|
||||
{% endfor %}
|
||||
|
||||
{% if can_write %}
|
||||
<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">
|
||||
@@ -46,4 +47,5 @@
|
||||
<div id="ap-{{ augmented_part_id }}-fit-other-points"></div>
|
||||
<button type="submit" class="btn btn-primary">Add fit</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<tr id="augmented-part-{{ ap.id }}">
|
||||
<td>{{ ap.id }}</td>
|
||||
<td>{{ ap.sku or '—' }}</td>
|
||||
<td>{{ ap.description | truncate(60) }}</td>
|
||||
<td><a href="/admin/augmented-parts/{{ ap.id }}">{{ ap.description | truncate(60) }}</a></td>
|
||||
<td>{{ ap.colour.name }}</td>
|
||||
<td>{{ ap.manufacturer.name }}</td>
|
||||
<td>{{ ap.scope_model.name if ap.scope_model else '—' }}</td>
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}{{ ap.description | truncate(40) }} · {{ app_name }}{% endblock %}
|
||||
{% block body %}
|
||||
{% include "_nav.html" %}
|
||||
|
||||
{%- macro conn_desc(point) -%}
|
||||
{%- if point.iso_thread -%}
|
||||
ISO M{{ point.iso_thread.diameter_mm }}×{{ point.iso_thread.pitch_mm }}
|
||||
{%- elif point.unc_thread -%}
|
||||
UNC {{ point.unc_thread.diameter_fraction }}-{{ point.unc_thread.tpi }} {{ point.unc_thread.series.value }}
|
||||
{%- elif point.clamp_connection -%}
|
||||
Clamp {{ point.clamp_connection.min_mm if point.clamp_connection.min_mm is not none else point.clamp_connection.min_in }}–{{ point.clamp_connection.max_mm if point.clamp_connection.max_mm is not none else point.clamp_connection.max_in }}
|
||||
{%- elif point.static_connection -%}
|
||||
Static {{ point.static_connection.od_mm }} mm OD
|
||||
{%- else -%}
|
||||
—
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
<main class="container">
|
||||
<p><a href="/admin/augmented-parts" class="btn btn-ghost">← Augmented Parts</a></p>
|
||||
|
||||
<h1>{{ ap.description }}</h1>
|
||||
<p class="muted">
|
||||
<span class="tag">{{ ap.part_type.name }}</span>
|
||||
{% if ap.sub_part_type %}<span class="tag">{{ ap.sub_part_type.name }}</span>{% endif %}
|
||||
{% if ap.sku %}· SKU {{ ap.sku }}{% endif %}
|
||||
</p>
|
||||
|
||||
<div class="grid">
|
||||
<div class="card">
|
||||
<h2>Details</h2>
|
||||
<dl class="kv">
|
||||
<dt>SKU</dt><dd>{{ ap.sku or "—" }}</dd>
|
||||
<dt>Description</dt><dd>{{ ap.description }}</dd>
|
||||
<dt>Colour</dt><dd>{{ ap.colour.name if ap.colour else "—" }}</dd>
|
||||
<dt>Manufacturer</dt><dd>{{ ap.manufacturer.name if ap.manufacturer else "—" }}</dd>
|
||||
<dt>Type</dt><dd>{{ ap.part_type.name }}</dd>
|
||||
<dt>Sub type</dt><dd>{{ ap.sub_part_type.name if ap.sub_part_type else "—" }}</dd>
|
||||
<dt>Scope model</dt>
|
||||
<dd>
|
||||
{% if ap.scope_model %}
|
||||
{{ ap.scope_model.name }}
|
||||
{% if ap.scope_model.url %} · <a href="{{ ap.scope_model.url }}" target="_blank" rel="noopener">link</a>{% endif %}
|
||||
{% else %}—{% endif %}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
{% if scope_info %}
|
||||
<div class="card">
|
||||
<h2>Scope information</h2>
|
||||
<dl class="kv">
|
||||
<dt>Magnification</dt>
|
||||
<dd>
|
||||
{% if scope_info.magnification_min is not none or scope_info.magnification_max is not none %}
|
||||
{{ scope_info.magnification_min if scope_info.magnification_min is not none else "?" }}–{{ scope_info.magnification_max if scope_info.magnification_max is not none else "?" }}×
|
||||
{% else %}—{% endif %}
|
||||
</dd>
|
||||
<dt>Model suffix</dt><dd>{{ scope_info.model_suffix or "—" }}</dd>
|
||||
<dt>Objective thread</dt><dd>{{ scope_info.objective_thread_pitch or "—" }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card">
|
||||
<h2>Attachment points</h2>
|
||||
{% for point in attachment_points %}
|
||||
<div class="ap-item">
|
||||
<span class="ap-item-name">{{ point.attachment_point_name.name }}</span>
|
||||
<code class="ap-item-conn">{{ conn_desc(point) }}</code>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="muted">No attachment points recorded.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if can_read_fits %}
|
||||
<div class="card">
|
||||
{% include "admin/_augmented_part_fits.html" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</main>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user