{% extends 'base.html' %}

{% block content %}
<h1 class="mb-4">Info</h1>
{% if issue %}
<div class="card border-warning shadow-sm mb-4">
  <div class="card-header bg-warning text-dark fw-bold">
    Warning
  </div>
  <div class="card-body">
    <h5 class="card-title">There is a mismatch between printer and SpoolMan</h5>
    <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 %}
<!-- AMS and External Spool Row -->
<div class="row">
  <!-- External Spool -->
  <div class="col-md-2 mb-4">
    <div class="card shadow-sm">
      <div class="card-header">
        <h5 class="mb-0">External Spool</h5>
      </div>
      <div class="card-body text-center">
        {% 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>
  {% for ams in ams_data %}
  <div class="col-md-4 mb-4">
    <div class="card shadow-sm">
      <div class="card-header d-flex justify-content-between align-items-center">
        <h5 class="mb-0">AMS {{ ams.id }}</h5>
        <span class="text-muted small">Humidity: {{ ams.humidity }}%, Temp: {{ ams.temp }}°C</span>
      </div>
      <div class="card-body">
        <div class="row">
          {% for tray in ams.tray %}
          <div class="col-6 mb-3">
            {% with tray_data=tray, ams_id=ams.id, pick_tray=False, tray_id=tray.id %} {% include 'fragments/tray.html' %} {% endwith %}
          </div>
          {% endfor %}
        </div>
      </div>
    </div>
  </div>
  {% endfor %}
</div>

<!-- Instruction Section -->
<div class="card shadow-sm mb-4">
  <div class="card-body">
    <h5 class="card-title mb-3">
      <i class="bi bi-info-circle text-info me-2"></i> Instructions
    </h5>
    <ul class="list-unstyled">
      <li>Assign NFC Tags to your spools
      </li>
      <li>Load the spool with NFC tag to your AMS and bring your phone close to the NFC tag, open the URL.</li>
      <li>Choose the tray you just put the spool in.</li>
    </ul>
  </div>
</div>
{% endblock %}
