{{ promotion }}
<fieldset>
  <legend>{{ heading_title }}</legend>
  <div class="alert alert-info"><i class="fa-solid fa-info-circle"></i> {{ text_layout }}</div>
  <div class="table-responsive">
    <table class="table table-bordered table-hover">
      <thead>
        <tr>
          <th>{{ column_name }}</th>
          <th class="text-center">{{ column_status }}</th>
          <th class="text-end">{{ column_action }}</th>
        </tr>
      </thead>
      <tbody>
        {% if extensions %}

          {% for extension in extensions %}

            {% if not extension.add %}
              <tr{% if not extension.status %} class="table-disabled"{% endif %}>
                <td><b>{{ extension.name }}</b></td>
                <td class="text-center">{% if extension.status %}
                    <span class="badge bg-success">{{ text_enabled }}</span>
                  {% else %}
                    <span class="badge bg-danger">{{ text_disabled }}</span>
                  {% endif %}</td>
                <td class="text-end text-nowrap">
                  {% if extension.installed %}
                    <a href="{{ extension.edit }}" title="{{ button_edit }}" class="btn btn-primary"><i class="fa-solid fa-pencil"></i></a>
                    <a href="{{ extension.uninstall }}" title="{{ button_uninstall }}" class="btn btn-danger"><i class="fa-solid fa-minus-circle"></i></a>
                  {% else %}
                    <button type="button" class="btn btn-primary disabled"><i class="fa-solid fa-pencil"></i></button>
                    <a href="{{ extension.install }}" title="{{ button_install }}" class="btn btn-success"><i class="fa-solid fa-plus-circle"></i></a>
                  {% endif %}</td>
              </tr>
            {% else %}

              <tr{% if not extension.installed %} class="table-disabled"{% endif %}>
                <td><b>{{ extension.name }}</b></td>
                <td class="text-center">{% if extension.status %}
                    <span class="badge bg-success">{{ text_enabled }}</span>
                  {% else %}
                    <span class="badge bg-danger">{{ text_disabled }}</span>
                  {% endif %}</td>
                <td class="text-end text-nowrap">
                  {% if not extension.installed %}
                    <a href="{{ extension.install }}" title="{{ button_install }}" class="btn btn-success"><i class="fa-solid fa-plus-circle"></i></a>
                  {% else %}
                    <a href="{{ extension.uninstall }}" title="{{ button_uninstall }}" class="btn btn-danger"><i class="fa-solid fa-minus-circle"></i></a>
                  {% endif %}</td>
              </tr>

              {% for module in extension.module %}
                <tr{% if not module.status %} class="table-disabled"{% endif %}>
                  <td><i class="fa-solid fa-folder-open"></i>&nbsp;&nbsp;&nbsp;{{ module.name }}</td>
                  <td class="text-center">{% if module.status %}
                      <span class="badge bg-success">{{ text_enabled }}</span>
                    {% else %}
                      <span class="badge bg-danger">{{ text_disabled }}</span>
                    {% endif %}</td>
                  <td class="text-end text-nowrap">
                    <a href="{{ module.edit }}" title="{{ button_edit }}" class="btn btn-outline-primary"><i class="fa-solid fa-pencil"></i></a>
                    <a href="{{ module.delete }}" title="{{ button_delete }}" class="btn btn-outline-danger"><i class="fa-regular fa-trash-can"></i></a>
                  </td>
                </tr>
              {% endfor %}

              {% if extension.installed %}

                <tr>
                  <td colspan="2"></td>
                  <td class="text-end"><a href="{{ extension.add }}" title="{{ button_add }}" class="btn btn-primary"><i class="fa-solid fa-plus-circle"></i></a></td>
                </tr>

              {% endif %}

            {% endif %}
          {% endfor %}

        {% else %}
          <tr>
            <td class="text-center" colspan="3">{{ text_no_results }}</td>
          </tr>
        {% endif %}
      </tbody>
    </table>
  </div>
</fieldset>
