Files
ImpTune/imptune/templates/partials/printer_list.html
T
kawa 5bf152bcce feat(11-04): add client name links in printer_list.html and client_list.html
- printer_list.html: extract group_client_id from first printer in group;
  wrap client name in <a href="/clients/{id}"> when id present; Unassigned
  group renders as plain text (no dead link)
- client_list.html: wrap client name cell in <a href="/clients/{{ c.id }}">
2026-04-15 14:49:52 +02:00

56 lines
1.6 KiB
HTML

<div id="printer-list">
{% if not grouped %}
<p>No printers configured yet.</p>
{% else %}
{% for client_name, printers in grouped.items() %}
<section>
{% set group_client_id = printers[0].client_id if printers else None %}
{% if group_client_id %}
<h3><a href="/clients/{{ group_client_id }}">{{ client_name }}</a></h3>
{% else %}
<h3>{{ client_name }}</h3>
{% endif %}
<table>
<thead>
<tr>
<th>Name</th>
<th>IP Address</th>
<th>Port</th>
<th>Driver</th>
<th>Duplex</th>
<th>Color</th>
<th>Paper</th>
<th>Collate</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for p in printers %}
<tr>
<td><a href="/printers/{{ p.id }}">{{ p.name }}</a></td>
<td>{{ p.ip_address }}</td>
<td>{{ p.port_name }}</td>
<td>{{ p.driver.original_filename if p.driver_id else '—' }}</td>
<td>{{ p.duplex_mode }}</td>
<td>{{ 'Yes' if p.color_mode else 'No' }}</td>
<td>{{ p.paper_size }}</td>
<td>{{ 'Yes' if p.collate else 'No' }}</td>
<td>
{% include "partials/printer_edit_modal.html" %}
<button
hx-delete="/printers/{{ p.id }}"
hx-target="#printer-list"
hx-swap="outerHTML"
hx-confirm="Delete '{{ p.name }}'?">
Delete
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
{% endfor %}
{% endif %}
</div>