Files
fitguide/app/templates/admin/_augmented_part_fit_row.html
T

72 lines
3.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% macro conn_desc(ap) -%}
{%- if ap.iso_thread -%}
ISO M{{ ap.iso_thread.diameter_mm }}×{{ ap.iso_thread.pitch_mm }}
{%- elif ap.unc_thread -%}
UNC {{ ap.unc_thread.diameter_fraction }}-{{ ap.unc_thread.tpi }} {{ ap.unc_thread.series.value }}
{%- elif ap.clamp_connection -%}
Clamp {{ ap.clamp_connection.min_mm if ap.clamp_connection.min_mm is not none else ap.clamp_connection.min_in }}–{{ ap.clamp_connection.max_mm if ap.clamp_connection.max_mm is not none else ap.clamp_connection.max_in }}
{%- elif ap.static_connection -%}
Static {{ ap.static_connection.od_mm }} mm OD
{%- else -%}
—
{%- endif -%}
{%- endmacro %}
<tr id="fit-{{ fit.id }}" class="fit-row">
<td><span class="fit-badge fit-badge-{{ fit.label.value }}">{{ fit.label.value | capitalize }}</span></td>
<td>
<strong>{{ own_ap.attachment_point_name.name }}</strong>
<div class="muted" style="font-size:0.8rem">{{ conn_desc(own_ap) }}</div>
</td>
<td class="fit-item-arrow">↔</td>
<td>
<a href="/admin/augmented-parts/{{ other_part.id }}" title="{{ other_part.description }}">{{ other_part.sku or other_part.description }}</a>
<div class="muted" style="font-size:0.8rem">{{ other_part.part_type.name }}</div>
</td>
<td class="fit-notes-cell">
{% for note in fit.notes %}
<div class="fit-note">
<span class="fit-note-meta">{{ note.username }} · {{ note.created_at.strftime("%Y-%m-%d %H:%M") }}</span>
<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 btn-sm">Add note</button>
</form>
{% endif %}
</td>
{% if can_write %}
<td>
<div class="row-actions">
{% if fit.label.value != "exact" %}
<button class="btn btn-ghost btn-sm"
hx-post="/admin/augmented-parts/{{ augmented_part_id }}/fits/{{ fit.id }}/label"
hx-vals='{"label": "exact"}'
hx-target="#fit-{{ fit.id }}" hx-swap="outerHTML">Mark Exact</button>
{% endif %}
{% if fit.label.value != "possible" %}
<button class="btn btn-ghost btn-sm"
hx-post="/admin/augmented-parts/{{ augmented_part_id }}/fits/{{ fit.id }}/label"
hx-vals='{"label": "possible"}'
hx-target="#fit-{{ fit.id }}" hx-swap="outerHTML">Mark Possible</button>
{% endif %}
{% if fit.label.value != "none" %}
<button class="btn btn-ghost btn-sm"
hx-post="/admin/augmented-parts/{{ augmented_part_id }}/fits/{{ fit.id }}/label"
hx-vals='{"label": "none"}'
hx-target="#fit-{{ fit.id }}" hx-swap="outerHTML">Mark Impossible</button>
{% endif %}
<button class="btn btn-danger btn-sm"
hx-delete="/admin/augmented-parts/{{ augmented_part_id }}/fits/{{ fit.id }}"
hx-target="#ap-{{ augmented_part_id }}-fits"
hx-swap="outerHTML"
hx-confirm="Delete this fit?">Delete</button>
</div>
</td>
{% endif %}
</tr>