{% extends 'dashboard/admin_dashboard/main.html' %}
{% load static %}
{% block content %}


<h4 class="fw-bold py-3 mb-4"><span class="text-muted fw-light">Masters / Role /</span> All Role</h4>
<div style="padding: 10px;">
  {% if messages %}
    {% for message in messages %}
      <div class="alert {% if 'success' in message.tags %}alert-success{% elif 'danger' in message.tags %}alert-danger{% elif 'warning' in message.tags %}alert-warning{% elif 'info' in message.tags %}alert-info{% endif %} alert-dismissible" role="alert" id="success-alert">
        {{ message }}
        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
        </button>
      </div>
    {% endfor %}
  {% endif %}
</div>
<div class="row">
    <div class="col-lg-12 col-md-12">
      <div class="card">
        <div class="mt-3 d-flex justify-content-start">
        <a href="{% url 'admin_role_add' %}" class="btn btn-primary" style="margin: 10px;">
            Add Role</a>
        </div>
        <div class="table-responsive text-nowrap">
          <table class="table table-bordered table-striped" id="roles_table">
            <thead>
              <tr>
                <th>ID</th>
                <th>NAME</th>
                <th>ACTIONS</th>
              </tr>
            </thead>
            <tbody>
              {% for all_data in all_role %}
              <tr>
                <td>{{ all_data.id }}</td>
                <td>{{ all_data.name }}</td>
                <td>
                  {% if all_data.name != "Admin" and all_data.name != "admin" %}
                    <a href="{% url 'admin_role_edit' all_data.id %}" class="btn btn-primary">
                      <i class="bx bx-pencil"></i>
                    </a>
                    <button class="btn btn-danger delete-link" data-id="{{ all_data.id }}" id="delete" value="{% url 'admin_role_delete' all_data.id %}">
                      <i class="bx bx-trash"></i>
                    </button>
                  {% endif %}
                </td>
              </tr>
              {% endfor %}
            </tbody>
          </table>
          {% csrf_token %}
        </div>
      </div>
    </div>
</div>
<script src="{% static 'plugins/jQuery/jQuery-2.1.3.min.js' %}" type="text/javascript"></script>
<script src="{% static 'dist/js/pages/roles_delete.js' %}" type="text/javascript"></script>
{% endblock %}


