{% extends "whm/base.html" %}
{% block title %}My Users{% endblock title %}
{% block content %}


<div id="responseContainer" style="position: relative; display: none;"> <!-- Container for the response -->
        <nav aria-label="breadcrumb">
                  <ol class="breadcrumb breadcrumb-inverse">
                   
           <li class="breadcrumb-item active" aria-current="page" style="margin-top:10px">SSL Installing, please wait.....</li> 
			<li> <div class="sk-wave">
            <div class="rect1"></div>
            <div class="rect2"></div>
            <div class="rect3"></div>
            <div class="rect4"></div>
            <div class="rect5"></div>
          
        </div>
</li> 
       </ol>
                </nav>
    </div>
	
	

<div id="alertContainer" class="alert alert-success alert-dismissible fade show" role="alert" style="display: none;">
    <div id="message"></div>
    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                  <span aria-hidden="true">×</span>
                </button>
</div>	

 <div class="card card-default">
      <div class="card-header">
        <h2>List of users</h2>
		
        

      </div>
    
   <div class="card-body">
   <div class="row">
   <div class="col-xl-6">
   <a class="mb-1 btn btn-pill btn-success" href="{% url 'add_user_all' %}" role="button" style="text-transform: none;">+ Add user</a>
</div>
<div class="col-xl-6 d-flex justify-content-end">
    <form action="{% url 'user_list_all' %}" method="post" class="form-inline mb-3">
        <div class="form-group mr-2">
            <input type="text" id="search" name="search" class="form-control" placeholder="Search for user...">
        </div>
        {% csrf_token %}
        <button type="submit" class="btn btn-danger">Filter</button>
    </form>
	</div>
	</div>
<div class="table-responsive">
    <table class="table table-bordered">
        <thead class="thead-light">
            <tr>
                <th>Username</th>
				<th>
                  Login
    
                </th>
				<th>Domain</th>
                <th>Email</th>
                <th>Status</th>
				
				 <th>Quota</th>
                <th>Disk Used</th>
				<th>Package</th>
				<th>Action</th>
            </tr>
        </thead>
        <tbody id="domainTable">
            {% for myuser in users %}
            <tr>
                <td><b>{{ myuser.username }}</b></td>
				<td> {% if myuser.is_active %} <a href="{% url 'auto_login' myuser.id %}" class="btn btn-success btn-sm">Login</a>{% endif %}</td>
				<td><a href="http://{{ myuser.main_domain }}" target="_blank">{{ myuser.main_domain }}</a></td>
                <td>{{ myuser.email }}</td>
                <td><span id="domainPath_{{ forloop.counter }}">
    {% if myuser.is_active %}
        <span class="badge badge-success">Active</span>
    {% else %}
        <span class="badge badge-danger">Suspended</span>
    {% endif %}
	</span></td>
	
	
	<td>{% if myuser.quota == 0 %}unlimited{% else %}{{ myuser.quota }} MB{% endif %}</td>
<td>{{ myuser.total_usage }}</td>
	<td>{{ myuser.pkg }}</td>
                <td>
                    <a href="{% url 'update_user' myuser.id %}" class="btn btn-primary btn-sm">Manage</a>

                    
                </td>
            </tr>
            {% empty %}
            <tr>
                <td colspan="4" class="text-center">No domains found.</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
    <!-- No Results Message -->
    <div id="noResults" class="text-center text-danger" style="display:none;">No results found.</div>

</div>
</div>


{% endblock content %}

{% include "whm/footer.html" %}