Merge branch 'feature/periodic_upgrade' into 'develop'

Now the first column of table at control page is checkbox

See merge request 2020-2021/online/s101/group-02/access_controller!60
This commit is contained in:
Кравченко Артем
2021-04-19 10:22:54 +00:00
3 changed files with 41 additions and 36 deletions

View File

@@ -8,6 +8,7 @@
{% block extra_css %}
<link rel="stylesheet" href="{% static 'main/css/work.css' %}"/>
{% endblock %}
{% block extra_scripts %}
@@ -21,7 +22,7 @@
<div class="container-md">
<div class="new-section">
<p class="row page-description">Свободных Мест: {{ licences_remaining }}</p>
<p class="row page-description" id="licences_remaining">Свободных Мест:</p>
</div>
{% block form %}
@@ -37,10 +38,16 @@
<table class="table table-dark light-table">
<thead>
<th>
<input
type="checkbox"
class="form-check-input"
id="head-checkbox"
/>
</th>
<th>Name</th>
<th>Email</th>
<th>Role</th>
<th>Checked</th>
</thead>
<tbody id="tbody"></tbody>

View File

@@ -300,30 +300,6 @@ class AdminPageView(LoginRequiredMixin, PermissionRequiredMixin, SuccessMessageM
make_light_agent(user, self.request.user)
log(user, self.request.user.userprofile)
def get_context_data(self, **kwargs) -> dict:
"""
Функция формирования контента страницы администратора (с проверкой прав доступа)
"""
# context = super().get_context_data(**kwargs)
# context['licences_remaining'] = max(0, ZENDESK_MAX_AGENTS - context['engineers'])
# return context
context = setup_context(control_lit=True)
context.update(super().get_context_data(**kwargs))
users = get_list_or_404(
UserProfile, role='agent')
context['engineers'], context['light_agents'] = count_users(get_users_list())
context.update({
'users': users,
'ZENDESK_ROLES': ZENDESK_ROLES,
'engineers': context['engineers'],
'light_agents': context['light_agents'],
'licences_remaining': max(0, ZENDESK_MAX_AGENTS - context['engineers']),
})
return context # TODO: need to get profile page url
class CustomLoginView(LoginView):
"""
@@ -349,7 +325,8 @@ class UsersViewSet(viewsets.ReadOnlyModelViewSet):
'users': serializer.data,
'engineers': count[0],
'light_agents': count[1],
"zendesk_users": self.get_zendesk_users(self.choose_users(users.values, profiles))
'zendesk_users': self.get_zendesk_users(self.choose_users(users.values, profiles)),
'max_agents': ZENDESK_MAX_AGENTS
}
return Response(res)