/
Maxdev
/
Wbbstatstest
Обзор
Документация
Войти
/
Maxdev
/
Wbbstatstest
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
templates
dashboard.html
217 строк
12 KB
Maxdev
upload files
05 мар 2025, 03:09
05 мар 2025, 03:09
575f581
Код
Авторство
О чём код?
{% extends "base.html" %} {% block title %}Дашборд{% endblock %} {% block content %} <div class="row"> <div class="col-md-8 mx-auto"> <h1 class="display-4">Добро пожаловать, {{ username }}!</h1> <p class="lead">Это ваш личный кабинет.</p> {% extends "base.html" %} {% block title %}Дашборд{% endblock %} {% block content %} <div class="row"> <div class="col-md-8 mx-auto"> <h1 class="display-4">Добро пожаловать, {{ username }}!</h1> <p class="lead">Это ваш личный кабинет.</p> <!-- Форма для подключения кабинета Wildberries --> <div class="card mb-4"> <div class="card-body"> <h5 class="card-title">Подключить кабинет Wildberries</h5> <form method="POST" action="{{ url_for('add_wildberries_cabinet') }}"> <div class="mb-3"> <label for="api_key" class="form-label">API-ключ</label> <input type="password" class="form-control" id="api_key" name="api_key" required> </div> <div class="mb-3"> <label for="cabinet_name" class="form-label">Название кабинета</label> <input type="text" class="form-control" id="cabinet_name" name="cabinet_name" required> </div> <button type="submit" class="btn btn-primary">Подключить</button> </form> </div> </div> <!-- Список подключённых кабинетов --> <div class="card mb-4"> <div class="card-body"> <h5 class="card-title">Подключённые кабинеты</h5> {% if cabinets %} <ul class="list-group"> {% for cabinet in cabinets %} <li class="list-group-item"> <div class="d-flex justify-content-between align-items-center"> <div> <strong>{{ cabinet.cabinet_name }}</strong> <br> <small> API-ключ: <input type="password" value="{{ cabinet.api_key }}" id="api_key_{{ cabinet.id }}" readonly class="form-control-sm border-0 bg-transparent" style="width: 200px;"> <button type="button" class="btn btn-sm btn-outline-secondary" onclick="toggleApiKey('api_key_{{ cabinet.id }}')"> Показать </button> </small> </div> <form method="POST" action="{{ url_for('delete_wildberries_cabinet', cabinet_id=cabinet.id) }}" style="display: inline;"> <button type="submit" class="btn btn-danger btn-sm">Удалить</button> </form> </div> <!-- Форма для загрузки отчёта --> <form method="POST" action="{{ url_for('get_wildberries_report', cabinet_id=cabinet.id) }}" class="mt-3"> <div class="row"> <div class="col-md-4"> <label for="date_from_{{ cabinet.id }}" class="form-label">Дата начала (ГГГГ-ММ-ДД)</label> <input type="date" class="form-control" id="date_from_{{ cabinet.id }}" name="date_from" required> </div> <div class="col-md-4"> <label for="date_to_{{ cabinet.id }}" class="form-label">Дата окончания (ГГГГ-ММ-ДД)</label> <input type="date" class="form-control" id="date_to_{{ cabinet.id }}" name="date_to" required> </div> <div class="col-md-4 d-flex align-items-end"> <button type="submit" class="btn btn-primary">Загрузить отчёт</button> </div> </div> </form> <!-- Отображение отчёта --> {% if cabinet_reports and cabinet_reports[cabinet.id] %} <div class="mt-3"> <h6>Отчёт для {{ cabinet.cabinet_name }}</h6> {% if 'error' in cabinet_reports[cabinet.id] %} <div class="alert alert-danger" role="alert"> {{ cabinet_reports[cabinet.id].error }} </div> {% else %} <pre>{{ cabinet_reports[cabinet.id] }}</pre> {% endif %} </div> {% endif %} </li> {% endfor %} </ul> {% else %} <p>Нет подключённых кабинетов.</p> {% endif %} </div> </div> <a href="{{ url_for('logout') }}" class="btn btn-danger mt-3">Выйти</a> </div> </div> <!-- Скрипт для переключения видимости API-ключа --> <script> function toggleApiKey(inputId) { const input = document.getElementById(inputId); const button = input.nextElementSibling; if (input.type === "password") { input.type = "text"; button.textContent = "Скрыть"; } else { input.type = "password"; button.textContent = "Показать"; } } </script> {% endblock %} <!-- Форма для подключения кабинета Wildberries --> <div class="card mb-4"> <div class="card-body"> <h5 class="card-title">Подключить кабинет Wildberries</h5> <form method="POST" action="{{ url_for('add_wildberries_cabinet') }}"> <div class="mb-3"> <label for="api_key" class="form-label">API-ключ</label> <input type="password" class="form-control" id="api_key" name="api_key" required> </div> <div class="mb-3"> <label for="cabinet_name" class="form-label">Название кабинета</label> <input type="text" class="form-control" id="cabinet_name" name="cabinet_name" required> </div> <button type="submit" class="btn btn-primary">Подключить</button> </form> </div> </div> <!-- Список подключённых кабинетов --> <div class="card mb-4"> <div class="card-body"> <h5 class="card-title">Подключённые кабинеты</h5> {% if cabinets %} <ul class="list-group"> {% for cabinet in cabinets %} <li class="list-group-item"> <div class="d-flex justify-content-between align-items-center"> <div> <strong>{{ cabinet.cabinet_name }}</strong> <br> <small> API-ключ: <input type="password" value="{{ cabinet.api_key }}" id="api_key_{{ cabinet.id }}" readonly class="form-control-sm border-0 bg-transparent" style="width: 100px;"> <button type="button" class="btn btn-sm btn-outline-secondary" onclick="toggleApiKey('api_key_{{ cabinet.id }}')"> Показать </button> </small> </div> <form method="POST" action="{{ url_for('delete_wildberries_cabinet', cabinet_id=cabinet.id) }}" style="display: inline;"> <button type="submit" class="btn btn-danger btn-sm">Удалить</button> </form> </div> <!-- Форма для загрузки отчёта --> <form method="POST" action="{{ url_for('get_wildberries_report', cabinet_id=cabinet.id) }}" class="mt-3"> <div class="row"> <div class="col-md-4"> <label for="date_from_{{ cabinet.id }}" class="form-label">Дата начала (ГГГГ-ММ-ДД)</label> <input type="date" class="form-control" id="date_from_{{ cabinet.id }}" name="date_from" required> </div> <div class="col-md-4"> <label for="date_to_{{ cabinet.id }}" class="form-label">Дата окончания (ГГГГ-ММ-ДД)</label> <input type="date" class="form-control" id="date_to_{{ cabinet.id }}" name="date_to" required> </div> <div class="col-md-4 d-flex align-items-end"> <button type="submit" class="btn btn-primary">Загрузить отчёт</button> </div> </div> </form> <!-- Отображение отчёта --> {% if cabinet_reports and cabinet_reports[cabinet.id] %} <div class="mt-3"> <h6>Отчёт для {{ cabinet.cabinet_name }}</h6> {% if 'error' in cabinet_reports[cabinet.id] %} <div class="alert alert-danger" role="alert"> {{ cabinet_reports[cabinet.id].error }} </div> {% else %} <pre>{{ cabinet_reports[cabinet.id] }}</pre> {% endif %} </div> {% endif %} </li> {% endfor %} </ul> {% else %} <p>Нет подключённых кабинетов.</p> {% endif %} </div> </div> <a href="{{ url_for('logout') }}" class="btn btn-danger mt-3">Выйти</a> </div> </div> <!-- Скрипт для переключения видимости API-ключа --> <script> function toggleApiKey(inputId) { const input = document.getElementById(inputId); const button = input.nextElementSibling; if (input.type === "password") { input.type = "text"; button.textContent = "Скрыть"; } else { input.type = "password"; button.textContent = "Показать"; } } </script> {% endblock %}