|
| 1 | +{% extends "_base.html" %} |
| 2 | + |
| 3 | +{% load static %} |
| 4 | +{% load humanize %} |
| 5 | +{% block title %} |
| 6 | + {{cluster.code}} Members |
| 7 | +{% endblock title %} |
| 8 | + |
| 9 | +{% block breadcrumb_li %} |
| 10 | + <li class=""><a href="{% url 'clusters-home' cluster.code %}"> |
| 11 | + {{ request.resolver_match.kwargs.cluster|upper }}'s Home |
| 12 | + </a></li> |
| 13 | + <li class="current">Members</a> |
| 14 | +{% endblock %} |
| 15 | + |
| 16 | +{% block content %} |
| 17 | + <div class="container"> |
| 18 | + <div class="projects-options-panel"> |
| 19 | + <div class="holder"> |
| 20 | + <div class="input-holder"> |
| 21 | + <h2 class="text-red-be">{{ cluster.code|upper }}'s Members</h2> |
| 22 | + </div> |
| 23 | + </div> |
| 24 | + <p class="py-4 rounded flex items-center gap-2"> |
| 25 | + <span class="icon-info"></span> |
| 26 | + The below table list your organization's users. |
| 27 | + You can filter the users by their using the filter sidebar. |
| 28 | + The actions column in the table lets gives you ability to activate and deactivate users. |
| 29 | + </p> |
| 30 | + </div> |
| 31 | + |
| 32 | + <div class="tabs-nav-holder"> |
| 33 | + <ul class="tabs-nav"> |
| 34 | + <li class=" {% if not request.GET.is_active %}active{% endif %}"> |
| 35 | + <a href="{% url 'users-organization' %}">All Users |
| 36 | + ({{ users_count }}) |
| 37 | + </a> |
| 38 | + </li> |
| 39 | + <li class=" {% if request.GET.is_active == 'true' %}active{% endif %}"> |
| 40 | + <a href="{{ request.GET.url }}?is_active=true">Active Users |
| 41 | + ( |
| 42 | + {% if active_users_count %} |
| 43 | + {{ active_users_count }} |
| 44 | + {% else %} |
| 45 | + {{ active_users | length }} |
| 46 | + {% endif %} |
| 47 | + ) |
| 48 | + </a> |
| 49 | + </li> |
| 50 | + <li class=" {% if request.GET.is_active == 'false' %}active{% endif %}"> |
| 51 | + <a href="{{ request.GET.url }}?is_active=false">Deactivated Users |
| 52 | + ( |
| 53 | + {% if deactive_users_count %}{{ deactive_users_count }}{% endif %} |
| 54 | + ) |
| 55 | + </a> |
| 56 | + </li> |
| 57 | + </ul> |
| 58 | + </div> |
| 59 | + <div class=""> |
| 60 | + <div class="table-container"> |
| 61 | + {% comment %} Table Actions and filters {% endcomment %} |
| 62 | + <div class="page-top-panel bottom-border"> |
| 63 | + <!-- filter applied --> |
| 64 | + <div class="filter-container" id="filter-container"> |
| 65 | + {% for field in users_filter.form %} |
| 66 | + {% if forloop.first %}<span>Applied Filters:</span>{% endif %} |
| 67 | + {% if field.value and field.name != 'state' %} |
| 68 | + |
| 69 | + <span class="filter-item title" |
| 70 | + id="title">{{ field.name }}</span> |
| 71 | + {% if forloop.last %}<span class="close-alert-message">x</span>{% endif %} |
| 72 | + {% endif %} |
| 73 | + |
| 74 | + {% endfor %} |
| 75 | + </div> |
| 76 | + <!-- filter applied end --> |
| 77 | + |
| 78 | + <div class="actions-panel"> |
| 79 | + <a href="{% url 'export-cluster-users' cluster.code %}?{{request.GET.urlencode}}" |
| 80 | + class="btn btn-gray tooltip" onclick="return confirm('Are you sure you want to export {{cluster.code|upper}} users?')"> |
| 81 | + Export <span class="icon-download"></span> |
| 82 | + <span class="tooltip-text">Download your cluster users</span> |
| 83 | + </a> |
| 84 | + {% if users_filter %} |
| 85 | + {% include "components/_filter_drawer.html" with filter=users_filter %} |
| 86 | + {% endif %} |
| 87 | + </div> |
| 88 | + </div> |
| 89 | + |
| 90 | + {% comment %} Table {% endcomment %} |
| 91 | + {% if users %} |
| 92 | + <div class="table-wrapper-scrollable "> |
| 93 | + <table class="table all-projects-table " > |
| 94 | + <thead class="content-block "> |
| 95 | + <tr> |
| 96 | + <th></th> |
| 97 | + <th> |
| 98 | + <strong class="table-title">Name</strong> |
| 99 | + </th> |
| 100 | + <th class="description-col"> |
| 101 | + <strong class="table-title">Email</strong> |
| 102 | + </th> |
| 103 | + <th> |
| 104 | + <strong class="table-title">Clusters</strong> |
| 105 | + </th> |
| 106 | + <th> |
| 107 | + <strong class="table-title">Date Joined</strong> |
| 108 | + </th> |
| 109 | + <th> |
| 110 | + <strong class="table-title">Last Login</strong> |
| 111 | + </th> |
| 112 | + <th> |
| 113 | + <strong class="table-title">Status</strong> |
| 114 | + </th> |
| 115 | + <th> |
| 116 | + <strong class="table-title">Action</strong> |
| 117 | + </th> |
| 118 | + </tr> |
| 119 | + </thead> |
| 120 | + |
| 121 | + <tbody> |
| 122 | + {% for user in users %} |
| 123 | + <tr id="user-{{ user.id }}"> |
| 124 | + <td> |
| 125 | + {% for group in user.groups.all %} |
| 126 | + {% if group.name == "ORG_LEAD" %} |
| 127 | + <span class="completed">Admin</span> |
| 128 | + {% endif %} |
| 129 | + {% endfor %} |
| 130 | + </td> |
| 131 | + <td> |
| 132 | + <a href="{% url 'cluster-user-profile' user.username %}"> |
| 133 | + {{ user.first_name }} {{ user.last_name }} <em>({{ user.username }})</em> |
| 134 | + </a> |
| 135 | + </td> |
| 136 | + <td>{{ user.email }}</td> |
| 137 | + <td> |
| 138 | + {% for cluster in user.profile.clusters.all %} |
| 139 | + {{ cluster.title }} |
| 140 | + {% if not forloop.last %},{% endif %} |
| 141 | + {% endfor %} |
| 142 | + </td> |
| 143 | + <td>{{ user.date_joined|naturaltime }}</td> |
| 144 | + <td>{{ user.last_login|naturaltime }}</td> |
| 145 | + <td> |
| 146 | + {% if user.is_active %} |
| 147 | + <span class="in-progress">Active</span> |
| 148 | + {% else %} |
| 149 | + <span class="archive">Deactive</span> |
| 150 | + {% endif %} |
| 151 | + </td> |
| 152 | + <td> |
| 153 | + <div class="table-flex-holder"> |
| 154 | + <ul class="table-options-buttons"> |
| 155 | + {% if perms.rh.activate_deactivate_user %} |
| 156 | + <li> |
| 157 | + <button id="dectivate-button-{{ user.id }}" |
| 158 | + class="btn btn-gray" |
| 159 | + hx-patch="{% url 'users-toggle-status' user.id %}" |
| 160 | + hx-swap="outerHTML" |
| 161 | + hx-target="#user-{{ user.id }}" |
| 162 | + hx-disable-element="#dectivate-button-{{ user.id }}" |
| 163 | + hx-ext="disable-element"> |
| 164 | + {% if user.is_active %} |
| 165 | + <span class="project-detail icon-trashbin"></span> Deactivate |
| 166 | + {% else %} |
| 167 | + Activate |
| 168 | + {% endif %} |
| 169 | + <img class="htmx-indicator" |
| 170 | + id="spinner" |
| 171 | + alt="spinner" |
| 172 | + style="width: 1.2rem" |
| 173 | + src="{% static 'images/spinner.gif' %}" /> |
| 174 | + </button> |
| 175 | + </li> |
| 176 | + {% endif %} |
| 177 | + </ul> |
| 178 | + </div> |
| 179 | + </td> |
| 180 | + </tr> |
| 181 | + {% endfor %} |
| 182 | + </tbody> |
| 183 | + </table> |
| 184 | + </div> |
| 185 | + {% else %} |
| 186 | + <div class="view_nocontent"> |
| 187 | + <div class="nocontent_help"> |
| 188 | + <h4>No users found.</h4> |
| 189 | + <p>Ask your organizations members to register for a new account in ReportHub.</p> |
| 190 | + </div> |
| 191 | + </div> |
| 192 | + {% endif %} |
| 193 | + |
| 194 | + {% comment %} Pagination {% endcomment %} |
| 195 | + {% include "components/_pagination.html" with object_list=users %} |
| 196 | + </div> |
| 197 | + |
| 198 | + </div> |
| 199 | + |
| 200 | + </div> |
| 201 | +{% endblock content %} |
| 202 | + |
| 203 | +{% block scripts %} |
| 204 | +{% endblock scripts %} |
0 commit comments