Files
fitguide/app/templates/admin/_attachment_point_row_edit.html

61 lines
2.8 KiB
HTML

{% if ap.iso_thread_id %}{% set current_type = "iso_thread" %}
{% elif ap.unc_thread_id %}{% set current_type = "unc_thread" %}
{% elif ap.clamp_connection_id %}{% set current_type = "clamp_connection" %}
{% elif ap.static_connection_id %}{% set current_type = "static_connection" %}
{% else %}{% set current_type = "manual" %}{% endif %}
<tr id="attachment-point-{{ ap.id }}">
<td colspan="6">
<form hx-post="/admin/attachment-points/{{ ap.id }}"
hx-target="#attachment-point-{{ ap.id }}"
hx-swap="outerHTML"
class="inline-edit">
<span class="muted">#{{ ap.id }}</span>
<label>Part
<select name="augmented_part_id" required>
{% for part in augmented_parts %}
<option value="{{ part.id }}"
{% if part.id == ap.augmented_part_id %}selected{% endif %}>
{{ part.description | truncate(50) }}
</option>
{% endfor %}
</select>
</label>
<label>Point Name
<select name="attachment_point_name_id" required>
{% for apn in attachment_point_names %}
<option value="{{ apn.id }}"
{% if apn.id == ap.attachment_point_name_id %}selected{% endif %}>
{{ apn.name }}
</option>
{% endfor %}
</select>
</label>
<label>Connection Type
<select name="connection_type" required
hx-get="/admin/attachment-points/connection-options"
hx-target="#edit-connection-options-{{ ap.id }}"
hx-trigger="change"
hx-include="[name='connection_type']">
<option value="">— select type —</option>
<option value="iso_thread" {% if current_type == "iso_thread" %}selected{% endif %}>ISO Thread</option>
<option value="unc_thread" {% if current_type == "unc_thread" %}selected{% endif %}>UNC Thread</option>
<option value="clamp_connection" {% if current_type == "clamp_connection" %}selected{% endif %}>Clamp Connection</option>
<option value="static_connection" {% if current_type == "static_connection" %}selected{% endif %}>Static Connection</option>
<option value="manual" {% if current_type == "manual" %}selected{% endif %}>Manual</option>
</select>
</label>
{# Render the current connection select pre-filled #}
<div id="edit-connection-options-{{ ap.id }}">
{% include "admin/_attachment_point_connection_select.html" %}
</div>
<div class="row-actions">
<button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-ghost"
hx-get="/admin/attachment-points/{{ ap.id }}/row"
hx-target="#attachment-point-{{ ap.id }}"
hx-swap="outerHTML">Cancel</button>
</div>
</form>
</td>
</tr>