Initial commit

This commit is contained in:
2025-09-04 11:27:16 +03:00
commit c1a75f783a
29 changed files with 2153 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
{% extends "layout.html" %}
{% block content %}
<h2 class="mb-4">Вопросы категории: <span class="text-primary">{{ product.name }}</span></h2>
<form method="post" class="mb-4">
<div class="row g-2">
<div class="col-md-10">
<textarea name="question_text" class="form-control" placeholder="Текст вопроса" rows="1" required></textarea>
</div>
<div class="col-md-2 d-grid">
<button type="submit" class="btn btn-success"> Добавить</button>
</div>
</div>
</form>
<ul class="list-group shadow-sm">
{% for feature in features %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<strong>{{ feature.name }}</strong><br>
<small class="text-muted">{{ feature.question_text }}</small>
</div>
<form method="post" action="{{ url_for('delete_feature', feature_id=feature.id, product_id=product.id) }}"
onsubmit="return confirm('Удалить вопрос «{{ feature.name }}»?');">
<button class="btn btn-sm btn-outline-danger">🗑 Удалить</button>
</form>
</li>
{% else %}
<li class="list-group-item text-center text-muted">Нет добавленных вопросов</li>
{% endfor %}
</ul>
<a href="{{ url_for('manage_products', survey_id=product.survey_type.id) }}" class="btn btn-link mt-4">← Назад к категориям</a>
{% endblock %}

View File

@@ -0,0 +1,33 @@
{% extends "layout.html" %}
{% block content %}
<h2 class="mb-4">Платформы опроса: {{ survey.name }}</h2>
<form method="post" class="mb-4">
<div class="input-group shadow-sm">
<input type="text" name="name" class="form-control" placeholder="Название платформы" required>
<button type="submit" class="btn btn-success"> Добавить</button>
</div>
</form>
<div class="list-group shadow-sm">
{% for platform in platforms %}
<div class="list-group-item d-flex justify-content-between align-items-center">
<strong>{{ platform.name }}</strong>
<form method="post"
action="{{ url_for('delete_platform_by_survey', survey_id=survey.id, platform_id=platform.id) }}"
onsubmit="return confirm('Удалить платформу «{{ platform.name }}»?');">
<button type="submit" class="btn btn-sm btn-outline-danger">🗑</button>
</form>
</div>
{% else %}
<div class="list-group-item text-muted text-center">Платформ пока нет</div>
{% endfor %}
</div>
<div class="mt-4 d-flex justify-content-between">
<a href="{{ url_for('manage_support_by_survey', survey_id=survey.id) }}" class="btn btn-outline-secondary">
⚙ Управление поддержкой функциональности
</a>
<a href="{{ url_for('manage_surveys') }}" class="btn btn-link">← Назад к опросам</a>
</div>
{% endblock %}

View File

@@ -0,0 +1,32 @@
{% extends "layout.html" %}
{% block content %}
<h2 class="mb-4">Категории опроса: <span class="text-primary">{{ survey.name }}</span></h2>
<form method="post" class="mb-4">
<div class="input-group shadow-sm">
<input type="text" name="name" class="form-control" placeholder="Название категории (например: Базовые возможности)" required>
<button type="submit" class="btn btn-success"> Добавить</button>
</div>
</form>
<div class="list-group shadow-sm">
{% for product in products %}
<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<strong>{{ product.name }}</strong>
</div>
<div class="d-flex gap-2">
<a href="{{ url_for('manage_features', product_id=product.id) }}" class="btn btn-sm btn-outline-primary">Вопросы</a>
<form method="post" action="{{ url_for('delete_product', product_id=product.id, survey_id=survey.id) }}"
onsubmit="return confirm('Удалить категорию «{{ product.name }}»?');">
<button class="btn btn-sm btn-outline-danger">🗑</button>
</form>
</div>
</div>
{% else %}
<div class="list-group-item text-muted text-center">Нет категорий</div>
{% endfor %}
</div>
<a href="{{ url_for('manage_surveys') }}" class="btn btn-link mt-4">← Назад к опросникам</a>
{% endblock %}

View File

@@ -0,0 +1,37 @@
{% extends "layout.html" %}
{% block content %}
<h2 class="mb-4">Матрица поддержки: {{ survey.name }}</h2>
<form method="post">
<table class="table table-bordered table-sm align-middle">
<thead class="table-light">
<tr>
<th>Функция</th>
{% for platform in platforms %}
<th class="text-center">{{ platform.name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for feature in features %}
<tr>
<td>
<strong>{{ feature.name }}</strong><br>
<small>{{ feature.question_text }}</small>
</td>
{% for platform in platforms %}
<td class="text-center">
<input type="checkbox"
name="support_{{ platform.id }}_{{ feature.id }}"
{% if support[platform.id][feature.id] %}checked{% endif %}>
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
<button type="submit" class="btn btn-success mt-3">Сохранить</button>
</form>
<a href="{{ url_for('manage_platforms_by_survey', survey_id=survey.id) }}" class="btn btn-link mt-4">← Назад к платформам</a>
{% endblock %}

View File

@@ -0,0 +1,48 @@
{% extends "layout.html" %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
<h2 class="mb-0">Матрица поддержки: {{ survey.name }}</h2>
<a href="{{ url_for('manage_platforms_by_survey', survey_id=survey.id) }}" class="btn btn-outline-secondary">← Назад к платформам</a>
</div>
<form method="post">
<div class="table-responsive">
<table class="table table-bordered table-hover align-middle">
<thead class="table-dark text-center">
<tr>
<th class="text-start">Функция</th>
{% for platform in platforms %}
<th>{{ platform.name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for feature in features %}
<tr>
<td>
<strong>{{ feature.question_text }}</strong><br>
<!-- <span class="text-muted small">{{ feature.question_text }}</span>-->
</td>
{% for platform in platforms %}
<td class="text-center">
<div class="form-check form-switch d-flex justify-content-center">
<input class="form-check-input"
type="checkbox"
role="switch"
name="support_{{ platform.id }}_{{ feature.id }}"
{% if support[platform.id][feature.id] %}checked{% endif %}>
</div>
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="d-flex justify-content-between mt-4">
<button type="submit" class="btn btn-primary">💾 Сохранить</button>
<a href="{{ url_for('choose_survey') }}" class="btn btn-link">На главную</a>
</div>
</form>
{% endblock %}

BIN
templates/admin/survey.db Normal file

Binary file not shown.

View File

@@ -0,0 +1,51 @@
{% extends "layout.html" %}
{% block content %}
<h2 class="mb-4">Опросники</h2>
<form method="post" class="mb-4">
<div class="input-group">
<input type="text" name="name" class="form-control" placeholder="Название опроса" required>
<button type="submit" class="btn btn-primary">Создать</button>
</div>
</form>
{% for survey in surveys %}
<div class="card mb-4 p-3">
<h5>{{ survey.name }}</h5>
<!-- Старая админская панель -->
<div class="btn-group mb-3">
<a href="{{ url_for('manage_products', survey_id=survey.id) }}" class="btn btn-sm btn-outline-secondary">Категории и вопросы</a>
<a href="{{ url_for('manage_platforms_by_survey', survey_id=survey.id) }}" class="btn btn-sm btn-outline-primary">Продукты</a>
<a href="{{ url_for('manage_support_by_survey', survey_id=survey.id) }}" class="btn btn-sm btn-outline-success">Матрица</a>
<form method="post" action="{{ url_for('delete_survey', survey_id=survey.id) }}" onsubmit="return confirm('Удалить опрос {{ survey.name }}?')">
<button type="submit" class="btn btn-sm btn-danger">Удалить</button>
</form>
</div>
<!-- Назначения пользователям -->
{% if current_user.is_admin %}
<!-- Назначения пользователям (только для админа) -->
<form method="POST" action="{{ url_for('assign_bulk_surveys') }}">
<input type="hidden" name="survey_id" value="{{ survey.id }}">
<div class="row row-cols-2 row-cols-md-3 row-cols-lg-4 g-2">
{% for user in users %}
<div class="form-check col">
<input class="form-check-input" type="checkbox" name="user_ids" value="{{ user.id }}"
id="user{{ user.id }}_survey{{ survey.id }}"
{% if user.id in assignments[survey.id] %}checked{% endif %}>
<label class="form-check-label" for="user{{ user.id }}_survey{{ survey.id }}">
{{ user.username }} ({{ user.full_name or "без ФИО" }})
</label>
</div>
{% endfor %}
</div>
<div class="mt-2">
<button class="btn btn-sm btn-primary">Сохранить назначения</button>
</div>
</form>
{% endif %}
</div>
{% endfor %}
{% endblock %}