Show spool availability indicator per job on jobs list

- filamentdb.spool_counts(): builds (material, color_name) → roll count
  from cached stock report; counts rolls_in_stock + rolls_in_use (non-graveyard)
- Jobs list: coloured dot before material — green (2+), yellow (1), red (0)
- FILAMENTDB_URL added to .env

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martin Hohenberg
2026-06-18 22:22:32 +02:00
parent bc1769625e
commit 392acef28e
3 changed files with 27 additions and 2 deletions

View File

@@ -53,7 +53,17 @@
<td><a href="/jobs/{{ j.id }}" class="text-secondary text-decoration-none">{{ j.file_name or j.name or '—' }}</a></td>
<td class="text-secondary">{{ j.printer.name if j.printer else '—' }}</td>
<td class="text-secondary">
{% if j.job_material %}{{ j.job_material }}{% if j.job_color %} · {{ j.job_color }}{% endif %}{% else %}—{% endif %}
{% if j.job_material %}
{% set count = spool_map.get((j.job_material, j.job_color or ''), 0) %}
{% if count >= 2 %}
<span class="text-success me-1" title="{{ count }} rolls available"></span>
{% elif count == 1 %}
<span class="text-warning me-1" title="1 roll available"></span>
{% else %}
<span class="text-danger me-1" title="No rolls in stock"></span>
{% endif %}
{{ j.job_material }}{% if j.job_color %} · {{ j.job_color }}{% endif %}
{% else %}—{% endif %}
</td>
<td>
{% set s = j.status.value %}