massive update

This commit is contained in:
2019-01-08 16:09:15 +05:00
parent ad71e72294
commit 39916fa5fb
22 changed files with 1260 additions and 70 deletions

View File

@ -29,15 +29,48 @@
<a class="nav-link" href="{{ url_for('hello_world') }}">Главная</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="{{ url_for('list_activities') }}" id="navbarDropdown" role="button" data-toggle="dropdown"
<a class="nav-link dropdown-toggle" href="{{ url_for('list_activities') }}" id="navbarDropdownAct" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Виды деятельности
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<div class="dropdown-menu" aria-labelledby="navbarDropdownAct">
<a class="dropdown-item" href="{{ url_for('list_activities') }}">Список</a>
<a class="dropdown-item" href="{{ url_for('add_activity') }}">Добавить</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="{{ url_for('list_activities') }}" id="navbarDropdownEnt" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Предприятия
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownEnt">
<a class="dropdown-item" href="{{ url_for('enterprise_list') }}">Список</a>
<a class="dropdown-item" href="{{ url_for('add_enterprise') }}">Добавить</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('add_division') }}">Добавить отдел</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('add_head') }}">Добавить руководителя</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('add_phone') }}">Добавить телефон</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('add_location') }}">Добавить местоположение</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="{{ url_for('list_activities') }}" id="navbarDropdownEnt" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Запросы
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownEnt">
<a class="dropdown-item" href="{{ url_for('no_email_query') }}">Список без email</a>
<a class="dropdown-item" href="{{ url_for('phones_on_date_of_ent') }}">Телефоны на заданную даты</a>
<a class="dropdown-item" href="{{ url_for('max_heads_change') }}">Максимальная смена руководителей</a>
</div>
</li>
</ul>
</div>
</nav>

View File

@ -0,0 +1,40 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<h3>Добавить главу</h3>
<form method="post">
<div class="form-group">
<label for="con_id">Руководит</label>
<select class="form-control" id="con_id" name="con_id" required>
{% for item in enterprises %}
<option value="{{ item.contact_info.id }}">Предприятие "{{ item.contact_info.name }}"</option>
{% endfor %}
{% for item in divisions %}
<option value="{{ item.contact_info.id }}">Подразделение "{{ item.contact_info.name }}"</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="last_name">Фамилия</label>
<input class="form-control" id="last_name" name="last_name" required type="text">
</div>
<div class="form-group">
<label for="first_name">Имя</label>
<input class="form-control" id="first_name" name="first_name" required type="text">
</div>
<div class="form-group">
<label for="second_name">Отчество</label>
<input class="form-control" id="second_name" name="second_name" type="text">
</div>
<div class="form-group">
<label for="date_start">Дата вступления</label>
<input class="form-control" id="date_start" name="date_start" required type="date">
</div>
<div class="form-group">
<label for="date_end">Дата снятия</label>
<input class="form-control" id="date_end" name="date_end" type="date">
</div>
<button type="submit" class="btn btn-primary">Отправить</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,48 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<h3>Добавить главу</h3>
<form method="post">
<div class="form-group">
<label for="con_id">Руководит</label>
<select class="form-control" id="con_id" name="con_id" required>
{% for item in enterprises %}
<option value="{{ item.contact_info.id }}">Предприятие "{{ item.contact_info.name }}"</option>
{% endfor %}
{% for item in divisions %}
<option value="{{ item.contact_info.id }}">Подразделение "{{ item.contact_info.name }}"</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="country">Страна</label>
<input class="form-control" id="country" name="country" required type="text">
</div>
<div class="form-group">
<label for="city">Город</label>
<input class="form-control" id="city" name="city" required type="text">
</div>
<div class="form-group">
<label for="street">Улица</label>
<input class="form-control" id="street" name="street" required type="text">
</div>
<div class="form-group">
<label for="house">Здание</label>
<input class="form-control" id="house" name="house" required type="text">
</div>
<div class="form-group">
<label for="room">Комната</label>
<input class="form-control" id="room" name="room" required type="text">
</div>
<div class="form-group">
<label for="date_start">Дата начала</label>
<input class="form-control" id="date_start" name="date_start" required type="date">
</div>
<div class="form-group">
<label for="date_end">Дата конца</label>
<input class="form-control" id="date_end" name="date_end" type="date">
</div>
<button type="submit" class="btn btn-primary">Отправить</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,32 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<h3>Добавить телефон</h3>
<form method="post">
<div class="form-group">
<label for="con_id">Телефон для</label>
<select class="form-control" id="con_id" name="con_id" required>
{% for item in enterprises %}
<option value="{{ item.contact_info.id }}">Предприятие "{{ item.contact_info.name }}"</option>
{% endfor %}
{% for item in divisions %}
<option value="{{ item.contact_info.id }}">Подразделение "{{ item.contact_info.name }}"</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="phone">Телефон</label>
<input class="form-control" id="phone" name="phone" required type="text">
</div>
<div class="form-group">
<label for="date_start">Дата назначения</label>
<input class="form-control" id="date_start" name="date_start" required type="date">
</div>
<div class="form-group">
<label for="date_end">Дата снятия</label>
<input class="form-control" id="date_end" name="date_end" type="date">
</div>
<button type="submit" class="btn btn-primary">Отправить</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,41 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<h3>Добавить подразделение</h3>
<form method="post">
<div class="form-group">
<label for="code">Код</label>
<input class="form-control" id="code" name="code" required type="text">
</div>
<div class="form-group">
<label for="ent_id">Предприятие</label>
<select class="form-control" id="ent_id" name="ent_id" required>
{% for item in enterpises %}
<option value="{{ item.id }}">{{ item.contact_info.name }}</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="name">Название подразделения</label>
<input class="form-control" id="name" name="name" required type="text">
</div>
<div class="form-group">
<label for="short_name">Краткое название</label>
<input class="form-control" id="short_name" name="short_name" required type="text">
</div>
<div class="form-group">
<label for="email">Email</label>
<input class="form-control" id="email" name="email" type="email">
</div>
<div class="form-group">
<label for="activities">Виды деятельности</label>
<select class="form-control" id="activities" name="activities" required multiple>
{% for activity in activities %}
<option value="{{ activity.id }}">{{ activity.name }}</option>
{% endfor %}
</select>
</div>
<button type="submit" class="btn btn-primary">Отправить</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,213 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-4">Код</div>
<div class="col-8">{{ div.contact_info.code }}</div>
</div>
<div class="row">
<div class="col-4">Имя</div>
<div class="col-8">{{ div.contact_info.code }}</div>
</div>
<div class="row">
<div class="col-4">Краткое имя</div>
<div class="col-8">{{ div.contact_info.short_name }}</div>
</div>
<div class="row">
<div class="col-4">Email</div>
<div class="col-8">{{ div.contact_info.email }}</div>
</div>
<div class="row">
<h6>Руководители</h6>
<table class="table">
<thead>
<tr>
<th scope="col">
Id
</th>
<th scope="col">
Фамилия
</th>
<th scope="col">
Имя
</th>
<th scope="col">
Отчество
</th>
<th scope="col">
Дата заступления
</th>
<th scope="col">
Дата снятия
</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody>
{% for item in div.contact_info.head %}
<tr>
<th scope="row">
{{ item.id }}
</th>
<td>
{{ item.last_name }}
</td>
<td>
{{ item.first_name }}
</td>
<td>
{{ item.second_name }}
</td>
<td>
{{ item.date_of_start }}
</td>
<td>
{% if not item.date_of_end %}
---
{% else %}
{{ item.date_of_end }}
{% endif %}
</td>
<td>
{% if not item.date_of_end %}
<b>Активен</b>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="row">
<h6>Телефоны</h6>
<table class="table">
<thead>
<tr>
<th scope="col">
Id
</th>
<th scope="col">
Номер
</th>
<th scope="col">
Дата заступления
</th>
<th scope="col">
Дата снятия
</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody>
{% for item in div.contact_info.phone_numbers %}
<tr>
<th scope="row">
{{ item.id }}
</th>
<td>
{{ item.number }}
</td>
<td>
{{ item.date_of_start }}
</td>
<td>
{% if not item.date_of_end %}
---
{% else %}
{{ item.date_of_end }}
{% endif %}
</td>
<td>
{% if not item.date_of_end %}
<b>Активен</b>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="row">
<h6>Местоположения</h6>
<table class="table">
<thead>
<tr>
<th scope="col">
Id
</th>
<th scope="col">
Страна
</th>
<th scope="col">
Город
</th>
<th scope="col">
Улица
</th>
<th scope="col">
Здание
</th>
<th scope="col">
Комната
</th>
<th scope="col">
Дата заступления
</th>
<th scope="col">
Дата снятия
</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody>
{% for item in div.contact_info.locations %}
<tr>
<th scope="row">
{{ item.id }}
</th>
<td>
{{ item.country }}
</td>
<td>
{{ item.city }}
</td>
<td>
{{ item.street }}
</td>
<td>
{{ item.house }}
</td>
<td>
{{ item.room }}
</td>
<td>
{{ item.date_of_start }}
</td>
<td>
{% if not item.date_of_end %}
---
{% else %}
{{ item.date_of_end }}
{% endif %}
</td>
<td>
{% if not item.date_of_end %}
<b>Активен</b>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,46 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<table class="table">
<thead>
<tr>
<th scope="col">
Id
</th>
<th scope="col">
Имя
</th>
<th scope="col">
Краткое имя
</th>
<th scope="col">
Email
</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody>
{% for item in data %}
<tr>
<th scope="row">
{{ item.id }}
</th>
<td>
{{ item.name }}
</td>
<td>
{{ item.short_name }}
</td>
<td>
{{ item.contact_info.email }}
</td>
<td>
<a href="{{ url_for('enterprise_details', ent_id=item.id) }}">Детали</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View File

@ -0,0 +1,33 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<h3>Добавить предприятие</h3>
<form method="post" action="{{ url_for('add_enterprise_post') }}">
<div class="form-group">
<label for="code">Код</label>
<input class="form-control" id="code" name="code" required type="text">
</div>
<div class="form-group">
<label for="name">Название предприятия</label>
<input class="form-control" id="name" name="name" required type="text">
</div>
<div class="form-group">
<label for="short_name">Краткое название</label>
<input class="form-control" id="short_name" name="short_name" required type="text">
</div>
<div class="form-group">
<label for="email">Email</label>
<input class="form-control" id="email" name="email" type="email">
</div>
<div class="form-group">
<label for="activities">Виды деятельности</label>
<select class="form-control" id="activities" name="activities" required multiple>
{% for activity in activities %}
<option value="{{ activity.id }}">{{ activity.name }}</option>
{% endfor %}
</select>
</div>
<button type="submit" class="btn btn-primary">Отправить</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,266 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-4">Код</div>
<div class="col-8">{{ ent.contact_info.code }}</div>
</div>
<div class="row">
<div class="col-4">Имя</div>
<div class="col-8">{{ ent.contact_info.code }}</div>
</div>
<div class="row">
<div class="col-4">Краткое имя</div>
<div class="col-8">{{ ent.contact_info.short_name }}</div>
</div>
<div class="row">
<div class="col-4">Email</div>
<div class="col-8">{{ ent.contact_info.email }}</div>
</div>
<div class="row">
<h6>Отделы</h6>
<table class="table">
<thead>
<tr>
<th scope="col">
Id
</th>
<th scope="col">
Код
</th>
<th scope="col">
Имя
</th>
<th scope="col">
Краткое имя
</th>
<th scope="col">
Email
</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody>
{% for item in ent.divisions %}
<tr>
<th scope="row">
{{ item.id }}
</th>
<td>
{{ item.contact_info.code }}
</td>
<td>
{{ item.contact_info.name }}
</td>
<td>
{{ item.contact_info.short_name }}
</td>
<td>
{{ item.contact_info.email }}
</td>
<td>
<a href="{{ url_for('division_details', div_id=item.id) }}">Детали</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="row">
<h6>Руководители</h6>
<table class="table">
<thead>
<tr>
<th scope="col">
Id
</th>
<th scope="col">
Фамилия
</th>
<th scope="col">
Имя
</th>
<th scope="col">
Отчество
</th>
<th scope="col">
Дата заступления
</th>
<th scope="col">
Дата снятия
</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody>
{% for item in ent.contact_info.head %}
<tr>
<th scope="row">
{{ item.id }}
</th>
<td>
{{ item.last_name }}
</td>
<td>
{{ item.first_name }}
</td>
<td>
{{ item.second_name }}
</td>
<td>
{{ item.date_of_start }}
</td>
<td>
{% if not item.date_of_end %}
---
{% else %}
{{ item.date_of_end }}
{% endif %}
</td>
<td>
{% if not item.date_of_end %}
<b>Активен</b>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="row">
<h6>Телефоны</h6>
<table class="table">
<thead>
<tr>
<th scope="col">
Id
</th>
<th scope="col">
Номер
</th>
<th scope="col">
Дата заступления
</th>
<th scope="col">
Дата снятия
</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody>
{% for item in ent.contact_info.phone_numbers %}
<tr>
<th scope="row">
{{ item.id }}
</th>
<td>
{{ item.number }}
</td>
<td>
{{ item.date_of_start }}
</td>
<td>
{% if not item.date_of_end %}
---
{% else %}
{{ item.date_of_end }}
{% endif %}
</td>
<td>
{% if not item.date_of_end %}
<b>Активен</b>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="row">
<h6>Местоположения</h6>
<table class="table">
<thead>
<tr>
<th scope="col">
Id
</th>
<th scope="col">
Страна
</th>
<th scope="col">
Город
</th>
<th scope="col">
Улица
</th>
<th scope="col">
Здание
</th>
<th scope="col">
Комната
</th>
<th scope="col">
Дата заступления
</th>
<th scope="col">
Дата снятия
</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody>
{% for item in ent.contact_info.locations %}
<tr>
<th scope="row">
{{ item.id }}
</th>
<td>
{{ item.country }}
</td>
<td>
{{ item.city }}
</td>
<td>
{{ item.street }}
</td>
<td>
{{ item.house }}
</td>
<td>
{{ item.room }}
</td>
<td>
{{ item.date_of_start }}
</td>
<td>
{% if not item.date_of_end %}
---
{% else %}
{{ item.date_of_end }}
{% endif %}
</td>
<td>
{% if not item.date_of_end %}
<b>Активен</b>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,52 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<table class="table">
<thead>
<tr>
<th scope="col">
Id
</th>
<th scope="col">
Код
</th>
<th scope="col">
Имя
</th>
<th scope="col">
Краткое имя
</th>
<th scope="col">
Email
</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody>
{% for item in data %}
<tr>
<th scope="row">
{{ item.id }}
</th>
<td>
{{ item.contact_info.code }}
</td>
<td>
{{ item.contact_info.name }}
</td>
<td>
{{ item.contact_info.short_name }}
</td>
<td>
{{ item.contact_info.email }}
</td>
<td>
<a href="{{ url_for('enterprise_details', ent_id=item.id) }}">Детали</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View File

@ -0,0 +1,6 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<div>Количество подразделений без электронной почты: {{ email_count }}</div>
</div>
{% endblock %}

View File

@ -0,0 +1,20 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<h3>Добавить телефон</h3>
<form method="get">
<div class="form-group">
<label for="date_start">Начало</label>
<input class="form-control" id="date_start" name="date_start" required type="date">
</div>
<div class="form-group">
<label for="date_end">Конец</label>
<input class="form-control" id="date_end" name="date_end" required type="date">
</div>
<button type="submit" class="btn btn-primary">Отправить</button>
</form>
{% if res %}
<div>Подразделение {{ res }}</div>
{% endif %}
</div>
{% endblock %}

View File

@ -0,0 +1,47 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<h3>Добавить телефон</h3>
<form method="get">
<div class="form-group">
<label for="ent_id">Телефон для</label>
<select class="form-control" id="ent_id" name="ent_id" required>
{% for item in enterprises %}
<option value="{{ item.id }}">Предприятие "{{ item.contact_info.name }}"</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="date">На дату</label>
<input class="form-control" id="date" name="date" required type="date">
</div>
<button type="submit" class="btn btn-primary">Отправить</button>
</form>
{% if res %}
<table class="table">
<thead>
<tr>
<th scope="col">
Имя
</th>
<th scope="col">
Телефон
</th>
</tr>
</thead>
<tbody>
{% for item in res %}
<tr>
<th scope="row">
{{ item[0] }}
</th>
<td>
{{ item[1] }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
{% endblock %}