Bugfix: External spool

Improvement: Use fragments in templates
Features: Manual fill of empty tray
Bump version to 0.1.3
This commit is contained in:
Filip Bednárik
2024-12-22 23:32:58 +01:00
parent 5dd026479f
commit 96a85271c0
10 changed files with 203 additions and 252 deletions

View File

@ -9,7 +9,7 @@
</div>
<div class="card-body">
<h5 class="card-title">There is a mismatch between printer and SpoolMan</h5>
<p class="card-text">TODO: To fix the issue click on the tray with the red exclamation mark <i class="bi bi-exclamation-circle text-danger me-2"></i></p>
<p class="card-text">Fix issue by clicking "Fix this tray" on tray with <i class="bi bi-exclamation-circle text-danger me-2"></i></p>
</div>
</div>
{% endif %}
@ -22,42 +22,7 @@
<h5 class="mb-0">External Spool</h5>
</div>
<div class="card-body text-center">
<!-- Tray ID -->
<h6 class="text-uppercase mb-1">
{% if vt_tray_data.issue %}
<i class="bi bi-exclamation-circle text-danger me-2"></i>
{% endif %}
{% if not vt_tray_data.tray_type %}
Empty
{% endif %}
Tray {{ vt_tray_data.id }}
</h6>
<!-- Tray Sub-Brand and Type -->
<div class="small text-muted mb-2">
{{ vt_tray_data.tray_type }}
{% if vt_tray_data.tray_sub_brands %}
<br/>
{{ vt_tray_data.tray_sub_brands }}
{% endif %}
</div>
<!-- Badge with Dynamic Colors -->
<span class="badge d-inline-block p-2"
style="background-color: #{{ vt_tray_data.tray_color }};
color: {% if color_is_dark(vt_tray_data.tray_color) %}#FFFFFF{% else %}#000000{% endif %}">
#{{ vt_tray_data.tray_color | upper }}
</span>
<!-- Remaining Percentage -->
<div class="mt-2">
Remaining:
{% if AUTO_SPEND and vt_tray_data.matched %}
<span class="fw-bold">{{ vt_tray_data.remaining_weight|round }}g</span>
{% else %}
<span class="fw-bold">{{ vt_tray_data.remain }}%</span>
{% endif %}
</div>
{% with tray_data=vt_tray_data, ams_id=EXTERNAL_SPOOL_AMS_ID, pick_tray=False, tray_id=vt_tray_data.id %} {% include 'fragments/tray.html' %} {% endwith %}
</div>
</div>
</div>
@ -72,46 +37,7 @@
<div class="row">
{% for tray in ams.tray %}
<div class="col-6 mb-3">
<div class="border rounded p-2 text-center">
<!-- Tray ID -->
<h6 class="text-uppercase mb-1">
{% if tray.issue %}
<i class="bi bi-exclamation-circle text-danger me-2"></i>
{% endif %}
{% if not tray.tray_type %}
Empty
{% endif %}
Tray {{ tray.id }}
</h6>
<!-- Tray Sub-Brand and Type -->
<div class="small text-muted mb-2">
{{ tray.tray_type }}
{% if tray.tray_sub_brands %}
<br/>
{{ tray.tray_sub_brands }}
{% endif %}
</div>
{% if tray.tray_color %}
<!-- Badge with Dynamic Colors -->
<span class="badge d-inline-block p-2"
style="background-color: #{{ tray.tray_color }};
color: {% if color_is_dark(tray.tray_color) %}#FFFFFF{% else %}#000000{% endif %}">
#{{ tray.tray_color | upper }}
</span>
{% endif %}
<!-- Remaining Percentage -->
<div class="mt-2">
Remaining:
{% if AUTO_SPEND and tray.matched %}
<span class="fw-bold">{{ tray.remaining_weight|round }}g</span>
{% else %}
<span class="fw-bold">{{ tray.remain }}%</span>
{% endif %}
</div>
</div>
{% with tray_data=tray, ams_id=ams.id, pick_tray=False, tray_id=tray.id %} {% include 'fragments/tray.html' %} {% endwith %}
</div>
{% endfor %}
</div>