Replace combined filament dropdown with separate material + color dropdowns

- app/constants.py: MATERIALS and COLORS standard value lists
- Migration 0008: job_material + job_color columns on print_jobs
- Job creation (both /jobs and /brackets/{id}/jobs) stores these independently
  of the filament inventory
- All job tables updated to display job_material · job_color

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martin Hohenberg
2026-06-18 22:08:29 +02:00
parent dc73c9a8c1
commit 6868862d77
6 changed files with 79 additions and 24 deletions

View File

@@ -53,7 +53,7 @@
</td>
<td class="text-white">{{ j.file_name or j.name }}</td>
<td class="text-secondary">
{% if j.filament %}{{ j.filament.material.value }}{% if j.filament.color %} · {{ j.filament.color }}{% endif %}{% else %}—{% endif %}
{% if j.job_material %}{{ j.job_material }}{% if j.job_color %} · {{ j.job_color }}{% endif %}{% else %}—{% endif %}
</td>
<td class="text-secondary">{{ j.printer.name if j.printer else '—' }}</td>
<td>
@@ -127,16 +127,21 @@
</div>
<div class="row g-3">
<div class="col-md-6">
<label class="form-label text-secondary small">Material & Color</label>
<select name="filament_id" class="form-select bg-dark border-secondary text-white">
<div class="col-md-4">
<label class="form-label text-secondary small">Material</label>
<select name="job_material" class="form-select bg-dark border-secondary text-white">
<option value="">— none —</option>
{% for f in filaments %}
<option value="{{ f.id }}">{{ f.material.value }}{% if f.color %} · {{ f.color }}{% endif %}{% if f.brand %} ({{ f.brand }}){% endif %}</option>
{% endfor %}
{% for m in materials %}<option>{{ m }}</option>{% endfor %}
</select>
</div>
<div class="col-md-6">
<div class="col-md-4">
<label class="form-label text-secondary small">Color</label>
<select name="job_color" class="form-select bg-dark border-secondary text-white">
<option value="">— none —</option>
{% for c in colors %}<option>{{ c }}</option>{% endfor %}
</select>
</div>
<div class="col-md-4">
<label class="form-label text-secondary small">
Quantity
<span class="text-secondary fw-normal">(copies to create)</span>

View File

@@ -49,7 +49,7 @@
<td class="text-secondary">{{ j.file_name or '—' }}</td>
<td class="text-secondary">{{ j.printer.name if j.printer else '—' }}</td>
<td class="text-secondary">
{% if j.filament %}{{ j.filament.material.value }}{% if j.filament.color %} · {{ j.filament.color }}{% endif %}{% else %}—{% endif %}
{% if j.job_material %}{{ j.job_material }}{% if j.job_color %} · {{ j.job_color }}{% endif %}{% else %}—{% endif %}
</td>
<td>
{% set s = j.status.value %}
@@ -140,17 +140,21 @@
</div>
</div>
<div>
<label class="form-label text-secondary small">Material & Color</label>
<select name="filament_id" class="form-select bg-dark border-secondary text-white">
<option value="">— none —</option>
{% for f in filaments %}
<option value="{{ f.id }}">
{{ f.material.value }}{% if f.color %} · {{ f.color }}{% endif %}
{% if f.brand %} ({{ f.brand }}){% endif %}
</option>
{% endfor %}
</select>
<div class="row g-3">
<div class="col-md-6">
<label class="form-label text-secondary small">Material</label>
<select name="job_material" class="form-select bg-dark border-secondary text-white">
<option value="">— none —</option>
{% for m in materials %}<option>{{ m }}</option>{% endfor %}
</select>
</div>
<div class="col-md-6">
<label class="form-label text-secondary small">Color</label>
<select name="job_color" class="form-select bg-dark border-secondary text-white">
<option value="">— none —</option>
{% for c in colors %}<option>{{ c }}</option>{% endfor %}
</select>
</div>
</div>
<div class="row g-3">