{% extends 'base.html' %}

{% block content %}
<div class="container-fluid mt-0">
    <h1>{{ _("Edit Machine Type") }}</h1>
    <form method="POST">
        <div class="mb-3">
            <label class="form-label">{{ _("Type Name") }}</label>
            <input type="text" class="form-control" name="type_name" value="{{ machine_type.type_name }}" required>
        </div>
        <div class="mb-3 ">
            <label class="form-label">{{ _("Auto-logoff delay") }}</label>
            <div class="input-group-prepend">
                <div class="input-group-text">{{ _("(minutes)") }}</div>
              </div>
            <input type="number" class="form-control" name="type_timeout_min" value="{{ machine_type.type_timeout_min }}" required>
        </div>
        <div class="mb-3 ">
            <label class="form-label">{{ _("Power-off grace period") }}</label>
            <div class="input-group-prepend">
                <div class="input-group-text">{{ _("(minutes)") }}</div>
              </div>
            <input type="number" class="form-control" name="grace_period_min" value="{{ machine_type.grace_period_min }}" required>
        </div>
        <div class="mb-3 ">
            <label class="form-label">{{ _("Access control") }}</label>
            <select class="form-select" name="access_control" required>
                <option value="{{ machine_type.MANAGEMENT_WITH_AUTHORIZATION }}" {% if machine_type.access_management == machine_type.MANAGEMENT_WITH_AUTHORIZATION %} selected {% endif %}>{{ _("Machines need to be authorized for user") }}</option>
                <option value="{{ machine_type.MANAGEMENT_WITHOUT_AUTHORIZATION }}" {% if machine_type.access_management == machine_type.MANAGEMENT_WITHOUT_AUTHORIZATION %} selected {% endif %}>{{ _("No authorization required for machines") }}</option>
            </select>
        </div>
        <button type="submit" class="btn btn-primary">{{ _("Submit") }}</button>
    </form>
</div>
{% endblock %}
