Merge branch 'develop' into feature/statistic/backend

# Conflicts:
#	access_controller/urls.py
#	main/forms.py
#	main/views.py
This commit is contained in:
Sokurov Idar
2021-03-04 23:16:21 +03:00
15 changed files with 218 additions and 88 deletions

View File

@@ -11,6 +11,9 @@
{% if request.user.is_authenticated %}
<div class="btn-group" role="group" aria-label="Basic example">
<a class="btn btn-secondary" href="{% url 'profile' %}">Профиль</a>
{% if perms.main.has_control_access %}
<a class="btn btn-secondary" href="{% url 'control' %}">Управление</a>
{% endif %}
<a class="btn btn-secondary" href="{% url 'logout' %}">Выйти</a>
</div>
{% else %}

View File

@@ -2,7 +2,7 @@
{% load static %}
{% block title %}Управление{%endblock %}
{% block title %}Управление{% endblock %}
{% block heading %}Управление{% endblock %}
@@ -16,19 +16,24 @@
<p class="row page-description">Основная информация о странице</p>
</div>
{% block form %}
<form method="post">
{% csrf_token %}
<div class="row justify-content-center new-section">
{% block hidden_form %}
<div style="display: none">
{% for field in form.users %}
{{ field.tag }}
{% endfor %}
</div>
{% endblock %}
<div class="col-10">
<h6 class="table-title">Список сотрудников</h6>
{% block table %}
<table class="light-table">
<thead>
@@ -52,10 +57,12 @@
</tbody>
</table>
{% endblock%}
</div>
</div>
{% block count %}
<div class="row justify-content-center new-section">
<div class="col-5">
<div class="info">
@@ -91,19 +98,11 @@
</div>
</div>
{% endblock %}
</form>
{% endblock %}
</div>
<script>
"use strict";
let checkboxes = document.getElementsByName("users");
let fields = document.querySelectorAll(".checkbox_field");
if (checkboxes.length == fields.length) {
for (let i = 0; i < fields.length; ++i) {
let el = checkboxes[i].cloneNode(true);
fields[i].appendChild(el);
}
}
</script>
<script src="{% static 'main/js/control.js'%}"></script>
{% endblock %}

View File

@@ -10,17 +10,14 @@
{% block extra_css %}
<style>
.img{
<style>
.img {
width:auto;
height:auto;
max-width:100px!important;
max-height:100px!important;
}
</style>
</style>
{% endblock %}
{% block content %}
@@ -28,24 +25,24 @@
<div class="row">
<div class="col-auto">
<div class="container">
{% if image_url %}
<img src={{image_url}} class="img img-thumbnail" alt="Аватар">
{% else %}
<img src="{% static 'no_avatar.png' %}" class="img img-thumbnail" alt="Нет изображения">
{% endif %}
<img
src="{% if profile.image %}{{ profile.image }}{% else %}{% static 'no_avatar.png' %}{% endif %}"
class="img img-thumbnail"
alt="Нет изображения"
>
</div>
</div>
<div class="col">
<h5><span class="badge bg-secondary text-light">Имя пользователя</span> {{name}}</h5>
<h5><span class="badge bg-secondary text-light">Имя пользователя</span> {{ profile.name }}</h5>
<br>
<h5><span class="badge bg-secondary text-light">Электронная почта</span> {{email}}</h5>
<h5><span class="badge bg-secondary text-light">Электронная почта</span> {{ profile.user.email }}</h5>
<br>
<h5><span class="badge bg-secondary text-light">Текущая роль</span> {{role}}</h5>
<h5><span class="badge bg-secondary text-light">Текущая роль</span> {{ profile.role }}</h5>
</div>
</div>
<div align="center">
<form action="">
<a href="/work/{{ id }}" class="btn btn-primary"><big>Запросить права доступа</big></a>
<a href="{% url 'work' profile.user.id %}" class="btn btn-primary"><big>Запросить права доступа</big></a>
</form>
</div>
{% endblock %}