{% extends 'base.html' %}

{% block content %}
<div class="container-fluid mt-0">
  <h1>{{ _("Edit Maintenance") }}</h1>
  <form method="POST" action="{{ url_for('edit_maintenance', maintenance_id=maintenance.maintenance_id) }}">
    <input type="hidden" name="maintenance_id" value="{{ maintenance.maintenance_id }}" />
    <div class="mb-3">
      <label for="description" class="form-label">{{ _("Description") }}:</label>
      <input type="text" id="description" name="description" class="form-control" value="{{ maintenance.description }}"
        required />
    </div>
    <div class="mb-3">
      <label for="lcd_message" class="form-label">{{ _("LCD Message") }}:</label>
      <input type="text" id="lcd_message" name="lcd_message" class="form-control" value="{{ maintenance.lcd_message }}"
        required maxlength="16" />
    </div>  
    <div class="mb-3">
      <label for="hours_between" class="form-label">{{ _("Hours Between") }}:</label>
      <input type="number" id="hours_between" name="hours_between" class="form-control"
        value="{{ maintenance.hours_between }}" required />
    </div>
    <div class="mb-3">
      <label for="instructions_url" class="form-label">{{ _("URL for instructions") }}:</label>
      <input type="text" id="instructions_url" name="instructions_url" class="form-control" value="{{ maintenance.instructions_url }}"
        required />
    </div>
    <div class="mb-3">
      <label for="machine_id" class="form-label">{{ _("Machine") }}:</label>
      <select id="machine_id" name="machine_id" class="form-control" required>
        {% for machine in machines %}
        <option value="{{ machine.machine_id }}" {% if machine.machine_id==maintenance.machine_id %}selected{% endif %}>
          {{ machine.machine_name }}</option>
        {% endfor %}
      </select>
    </div>
    <input type="submit" value="{{ _("Update Maintenance") }}" class="btn btn-primary" />
  </form>
</div>
{% endblock %}