/
ilyaBu
/
WebSpringJava
Обзор
Документация
Войти
/
ilyaBu
/
WebSpringJava
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/main/resources/templates/fragments.html
930 строк
52 KB
IliaBu
Update code
06 июл 2024, 20:18
06 июл 2024, 20:18
7f8ee14
Код
Авторство
О чём код?
<!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity6" lang="ru"> <head th:fragment="head"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0"/> <title th:text="${title}">Title</title> <link rel="stylesheet" th:href="@{/webjars/bootstrap/css/bootstrap.min.css}"/> <link rel="stylesheet" href="/css/style.css" th:href="@{/css/style.css}"/> <link rel="stylesheet" th:href="@{/webjars/font-awesome/6.5.2/css/all.min.css}"/> <script type="text/javascript" th:src="@{/webjars/bootstrap/js/bootstrap.bundle.min.js}"></script> <script type="text/javascript" th:src="@{/webjars/jquery/jquery.min.js}"></script> </head> <header th:fragment="header" class="fixed-top"> <nav class="navbar navbar-expand-md bg-dark navbar-dark"> <a class="navbar-brand" th:href="@{/home}"> <img src="/img/logo.svg" th:src="@{/img/logo.svg}" class="icon" width="40" height="32" alt=""> </a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" id="toggleMobileNav" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse navbar-mobile" id="navbarSupportedContent"> <ul class="navbar-nav"> <li class="nav-item"> <a class="nav-link active" aria-current="page" th:href="@{/home}">Главная</a> </li> <li class="nav-item"> <a class="nav-link active" aria-current="page" th:href="@{/list-parts}">Список отобранных запчастей</a> </li> </ul> <ul class="navbar-nav col d-flex justify-content-end align-items-end"> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false" aria-current="page" th:text="${userfirstname}"></a> <ul class="dropdown-menu dropdown-menu-end dropdown-menu-dark"> <li sec:authorize="hasRole('ADMIN')" class="nav-item"> <a class="dropdown-item" aria-current="page" th:href="@{/upload-files}">Обновление файлов базы данных</a> </li> <li sec:authorize="hasRole('ADMIN')" class="nav-item"> <a class="dropdown-item" aria-current="page" th:href="@{/home-admin}">Список пользователей</a> </li> <li> <a class="dropdown-item" aria-current="page" th:href="@{/logout}">Выйти</a> </li> </ul> </li> </ul> </div> </nav> </header> <div th:fragment="error-message" th:if="${error}"> <div class="card p-3"> <div class="col alert alert-danger alert-dismissible fade show" role="alert"> <strong th:text="${error}"></strong> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Закрыть"></button> </div> </div> </div> <div th:fragment="login"> <section class="h-100"> <div class="container h-100"> <div class="row justify-content-sm-center h-100"> <div class="col-xxl-4 col-xl-5 col-lg-5 col-md-7 col-sm-9"> <div class="text-center my-3"> <img th:src="@{/img/logo.svg}" class="icon" alt="logo" width="200"> </div> <div class="card shadow-lg"> <div class="card-body p-5"> <h1 class="fs-4 card-title fw-bold mb-4">Авторизация</h1> <form method="POST" class="was-validated" th:action="@{/login}" autocomplete="off"> <div th:if="${param.error}" class="alert alert-danger" role="alert"> Неправильное имя пользователя или пароль. </div> <div th:if="${param.logout}" class="alert alert-success" role="alert"> Вы вышли из системы. </div> <div th:if="${param.success}" class="alert alert-success" role="alert"> Вы успешно зарегистрировались в приложении! </div> <div class="mb-3"> <i class="fa fa-envelope fa-fw"></i> <label class="mb-2 text-muted" for="username">E-mail адрес</label> <input id="username" type="email" class="form-control is-invalid" name="username" value="" required aria-required="true" autofocus> </div> <div class="mb-3"> <i class="fa fa-key fa-fw"></i> <label class="mb-2 text-muted" for="password">Пароль</label> <input id="password" type="password" class="form-control is-invalid" name="password" required aria-required="true"> </div> <div class="d-flex align-items-center"> <button type="submit" class="btn btn-primary ms-auto"> Войти </button> </div> </form> </div> <div class="card-footer py-3 border-0"> <div class="text-center"> Не зарегистрированы? <a class="text-dark" th:href="@{/register}">Зарегистрироваться</a> </div> </div> </div> </div> </div> </div> </section> </div> <div th:fragment="content" class="row p-5 py-5 justify-content-center"> <div class="container h-100"> <div class="message float-end"> <div th:if="${message != null}" class="alert alert-info alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert"></button> <strong>[[${message}]]</strong> </div> <div th:if="${messageError != null}" class="alert alert-danger alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert"></button> <strong>[[${messageError}]]</strong> </div> </div> </div> <div class="card py-3"> <h2 class="text-center">Прайс-лист</h2> <hr> <nav class="navbar"> <div class="container-fluid"> <form class="d-flex" role="search" th:action="@{/home}" th:object="${searchFormText}" id="searchForm"> <i class="fa fa-search py-2 me-1"></i> <input class="form-control me-1" type="search" placeholder="Введите слово для поиска" aria-label="Найти" id="keyword" name="keyword" th:value="${keyword}" required> <button class="btn btn-outline-primary" type="submit">Найти</button> </form> <form class="d-flex" th:action="@{/clear}" method="post"> <button class="btn btn-info" type="submit">Очистить</button> </form> </div> </nav> <div th:if="${priceLists.size() > 0}"> <div class="table-responsive"> <table class="table table-striped table-hover"> <thead class="thead-light"> <tr> <th scope="col">Артикул</th> <th scope="col">Наименование</th> <th scope="col">Кратность заказа</th> <th scope="col">Остаток в Москве, шт.</th> <th scope="col">Цена VOR без НДС, евро</th> <th scope="col">Цена STOCK без НДС, евро</th> <th scope="col">Остаток VOR, шт.</th> <th scope="col">Остаток STOCK, шт.</th> <th scope="col">Длина, мм</th> <th scope="col">Ширина, мм</th> <th scope="col">Высота, мм</th> <th scope="col">Вес, г</th> <th scope="col"></th> </tr> </thead> <tbody> <tr th:each="item : ${priceLists}"> <form class="d-flex" th:action="@{'/add/'+${item.getArticul()}}" method="get"> <input type="hidden" name="pageSize" id="outPageSize" th:value="${pageSize}"/> <th scope="row">[[${item.articul}]]</th> <td>[[${item.naimenovanie}]]</td> <td>[[${item.minparty}]]</td> <td>[[${item.ostatokm}]]</td> <td>[[${item.inputpricevor}]]</td> <td>[[${item.inputpricestock}]]</td> <td>[[${item.availabilitykompanyvor}]]</td> <td>[[${item.availabilitykompanystock}]]</td> <td>[[${item.length}]]</td> <td>[[${item.width}]]</td> <td>[[${item.height}]]</td> <td>[[${item.weight}]]</td> <td> <button class="link-offset-2 link-underline link-underline-opacity-0 fa-regular fa-plus icon-dark" type="submit"></button> </td> </form> </tr> </tbody> </table> </div> </div> <div th:if="${priceLists.size() == 0}" class="p-4 py-5"> <h2>Записей не найдено!</h2> </div> <div class="navbar"> <div class="container-fluid"> <div class="d-flex"> <div class="text-info">Всего записей: [[${totalItems}]]</div> </div> <div class="d-flex"> <div class="text-success">Добавлено в список: [[${totalItems2}]]</div> </div> <div class="d-flex"> <div class="text-primary">Показано записей: <select form="searchForm" name="size" th:value="${pageSize}" onchange="changePageSize()" class="form-control me-1" id="pageSize"> <option th:each="s : ${pageSizeOptions}" th:value="${s}" th:text="${s}" th:selected="${s == pageSize}"></option> </select> </div> </div> <div class="d-flex mt-4"> <nav aria-label="Pagination" th:if="${totalPages > 0}"> <ul class="pagination justify-content-center"> <li class="page-item" th:classappend="${currentPage == 1} ? 'disabled': ''"> <a class="page-link" th:href="@{'/home?' + ${keyword!=null && keyword!=''? 'keyword=' + keyword + '&' : ''} + 'page=' + 1 + '&size=' + ${pageSize}}" th:title="'В начало'" rel="tooltip">↑</a> </li> <li class="page-item font-weight-bold" th:classappend="${currentPage == 1} ? 'disabled': ''"> <a class="page-link" th:href="@{'/home?' + ${keyword!=null && keyword!=''? 'keyword=' + keyword + '&' : ''} + 'page=' + ${currentPage - 1} + '&size=' + ${pageSize}}" th:title="'Назад'" rel="tooltip">Предыдущая страница</a> </li> <li class="page-item disabled" th:if="${currentPage - 2 > 1}"> <a class="page-link" href="#">...</a> </li> <li class="page-item" th:classappend="${page == currentPage} ? 'active': ''" th:each="page : ${#numbers.sequence(currentPage > 2 ? currentPage - 2 : 1, currentPage + 2 < totalPages ? currentPage + 2 : totalPages)}"> <a class="page-link" th:href="@{'/home?' + ${keyword!=null && keyword!=''? 'keyword=' + keyword + '&' : ''} + 'page=' + ${page} + '&size=' + ${pageSize}}" th:title="'Страница ' + ${page}" rel="tooltip"><span th:text="${page}"></span></a> </li> <li class="page-item disabled" th:if="${currentPage + 2 < totalPages}"> <a class="page-link" href="#">...</a> </li> <li class="page-item font-weight-bold" th:classappend="${currentPage == totalPages} ? 'disabled'"> <a class="page-link" th:href="@{'/home?' + ${keyword!=null && keyword!=''? 'keyword=' + keyword + '&' : ''} + 'page=' + ${currentPage + 1} + '&size=' + ${pageSize}}" th:title="'Далее'" rel="tooltip">Следующая страница</a> </li> <li class="page-item" th:classappend="${currentPage == totalPages} ? 'disabled': ''"> <a class="page-link" th:href="@{'/home?' + ${keyword!=null && keyword!=''? 'keyword=' + keyword + '&' : ''} + 'page=' + ${totalPages} + '&size=' + ${pageSize}}" th:title="'В конец'" rel="tooltip">↓</a> </li> </ul> </nav> </div> </div> </div> </div> <script type="text/javascript"> function changePageSize() { $("#searchForm").submit(); } </script> </div> <div th:fragment="list-parts" class="row py-5 justify-content-center"> <div class="container h-100"> <div class="message float-end"> <div th:if="${message != null}" class="alert alert-info alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert"></button> <strong>[[${message}]]</strong> </div> <div th:if="${messageSuccess != null}" class="alert alert-success alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert"></button> <strong>[[${messageSuccess}]]</strong> </div> <div th:if="${messageError != null}" class="alert alert-danger alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert"></button> <strong>[[${messageError}]]</strong> </div> </div> </div> <div class="card p-3"> <h2 class="text-center">Список отобранных запчастей</h2> <hr> <nav class="navbar"> <div class="container-fluid"> <div class="input-group"> <form class="d-flex flex-fill" th:action="@{/loadcounterparty}" method="post"> <input type="hidden" id="outmarkup" name="markup" th:value="${markup}"> <span class="input-group-text">ИНН</span> <input type="number" id="ininn" name="inn" th:value="${inn}" class="form-control me-1" placeholder="Введите Номер ИНН" required aria-required="true"> <button class="btn btn-primary me-2" type="submit">Найти</button> <span class="input-group-text">Контрагент</span> <textarea id="incounterparty" class="form-control me-2" name="counterparty" aria-label="">[[${counterparty}]]</textarea> </form> <form class="d-flex me-2" th:action="@{/savevaluesall}" method="get"> <span class="input-group-text">Текущий курс евро</span> <input type="number" class="form-control me-1" min="1.0000" step="0.1000" th:name="loadReceivingEuroExchangeRateCurrentDate" th:value="${loadReceivingEuroExchangeRateCurrentDate}"> <input type="hidden" name="inn" id="outinn" th:value="${inn}"> <input type="hidden" name="counterparty" id="outcounterparty" th:value="${counterparty}"> <span class="input-group-text">Наценка, %</span> <input id="inmarkup" type="number" aria-label="" class="form-control me-1" name="markup" th:value="${markup}" required aria-required="true"> <button class="btn btn-success" type="submit">Сохранить</button> </form> <div class="d-flex"> <button class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#deleteRowsTableModal"> Очистить </button> </div> </div> <div class="modal fade" id="deleteRowsTableModal" tabindex="-1" aria-labelledby="basicModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="basicModalLabel">[[${pageTitleDel}]]</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <form class="d-flex" th:action="@{/deleteall}" method="get"> <input type="hidden" name="inn" id="outinndeletetableall" th:value="${inn}"> <input type="hidden" name="counterparty" id="outcounterpartydeletetableall" th:value="${counterparty}"> <input type="hidden" name="markup" id="outmarkupdeletetableall" th:value="${markup}"> <div class="modal-body">Вы действительно хотите удалить все записи?</div> <div class="modal-footer"> <button type="submit" class="btn btn-success">Да</button> <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Нет</button> </div> </form> </div> </div> </div> </div> </nav> <div th:if="${listSelectedParts.size() > 0}"> <div class="table-responsive"> <table class="table table-striped table-hover"> <thead class="thead-light"> <tr> <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">Вход цена VOR без НДС, евро</th> <th scope="col">Вход цена STOCK без НДС, евро</th> <th scope="col">Выход цена VOR с НДС</th> <th scope="col">Выход цена STOCK с НДС</th> <th scope="col">Итого цена VOR с НДС</th> <th scope="col">Итого цена STOCK с НДС</th> <th scope="col">Остаток VOR, шт.</th> <th scope="col">Остаток STOCK, шт.</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> <tr th:each="item : ${listSelectedParts}"> <form class="d-flex" th:action="@{'/update/'+${item.getArticul()}}" method="get"> <input type="hidden" name="inn" id="outinntable" th:value="${inn}"> <input type="hidden" name="counterparty" id="outcounterpartytable" th:value="${counterparty}"> <input type="hidden" name="markup" id="outmarkuptable" th:value="${markup}"> <td>[[${item.id}]]</td> <td>[[${item.articul}]]</td> <td>[[${item.naimenovanie}]]</td> <td><input class="form-control" th:name="quantity" th:value="${item.quantity}"></td> <td>[[${item.minparty}]]</td> <td>[[${item.ostatokm}]]</td> <td>[[${item.inputpricevor}]]</td> <td>[[${item.inputpricestock}]]</td> <td>[[${item.outputpricevor}]]</td> <td>[[${item.outputpricestock}]]</td> <td>[[${item.totalcostvor}]]</td> <td>[[${item.totalcoststock}]]</td> <td>[[${item.availabilitykompanyvor}]]</td> <td>[[${item.availabilitykompanystock}]]</td> <td>[[${item.weight}]]</td> <td>[[${item.length}]]</td> <td>[[${item.width}]]</td> <td>[[${item.height}]]</td> <td>[[${item.volume}]]</td> <td> <button class="link-offset-2 link-underline link-underline-opacity-0 fa fa-refresh icon-dark" type="submit"></button> </td> </form> <form class="d-flex" th:action="@{'/delete/'+${item.getArticul()}}" method="get"> <td> <input type="hidden" name="inn" id="outinndeletetable" th:value="${inn}"> <input type="hidden" name="counterparty" id="outcounterpartydeletetable" th:value="${counterparty}"> <input type="hidden" name="markup" id="outmarkupdeletetable" th:value="${markup}"> <button class="link-offset-2 link-underline link-underline-opacity-0 fa-regular fa-trash-can icon-dark" type="submit"></button> </td> </form> </tr> </tbody> </table> </div> </div> <div th:if="${listSelectedParts.size() == 0}" class="p-4 py-5"> <h2>Записей не найдено!</h2> </div> <div class="input-group mb-3"> <span class="input-group-text me-2">Всего записей: <b> [[${totalItems2}]]</b></span> <span class="input-group-text me-2">Итого VOR с НДС: <b> [[${totalVOR}]]</b></span> <span class="input-group-text me-2">Итого STOCK с НДС: <b> [[${totalSTOCK}]]</b></span> <span class="input-group-text me-2">Общий вес: <b> [[${totalWeight}]]</b></span> <span class="input-group-text me-2">Общий объём: <b> [[${totalVolume}]]</b></span> </div> <div class="input-group mb-3"> <form class="d-flex" th:action="@{'/csv-list-parts'}" method="get"> <button class="btn btn-success me-1" type="submit" id="saveCSV">Сохранить в CSV...</button> </form> <form class="d-flex" th:action="@{'/pdf'}" method="get"> <input type="hidden" name="counterparty" id="outcounterpartypdf" th:value="${counterparty}"> <button class="btn btn-primary me-1" type="submit" id="commercialProposal">Коммерческое предложение </button> </form> </div> <div class="input-group mb-3"> <div class="d-flex" th:each="list : ${list}"> <span class="me-2">Файл: [[${list}]]</span> <a th:href="@{http://localhost:9000/download/{name}(name=${list})}"> <button type="button" class="btn btn-success btn-sm me-1">Загрузить</button> </a> <form class="d-flex" method="POST" th:action="@{'/deletePDF'}"> <input name="name" type="hidden" th:value="${list}"/> <button type="submit" class="btn btn-danger btn-sm"> Удалить </button> </form> </div> </div> </div> <script type="text/javascript"> const ininn = document.getElementById('ininn'); const incounterparty = document.getElementById('incounterparty'); const inmarkup = document.getElementById('inmarkup'); const outinn = document.getElementById('outinn'); const outcounterparty = document.getElementById('outcounterparty'); const outmarkup = document.getElementById('outmarkup'); const outinntable = document.getElementById('outinntable'); const outcounterpartytable = document.getElementById('outcounterpartytable'); const outmarkuptable = document.getElementById('outmarkuptable'); const outinndeletetable = document.getElementById('outinndeletetable'); const outcounterpartydeletetable = document.getElementById('outcounterpartydeletetable'); const outmarkupdeletetable = document.getElementById('outmarkupdeletetable'); const outinndeletetableall = document.getElementById('outinndeletetableall'); const outcounterpartydeletetableall = document.getElementById('outcounterpartydeletetableall'); const outmarkupdeletetableall = document.getElementById('outmarkupdeletetableall'); const outcounterpartypdf = document.getElementById('outcounterpartypdf'); ininn.addEventListener('change', function () { outinn.value = this.value; outinntable.value = this.value; outinndeletetable.value = this.value; outinndeletetableall.value = this.value; }); incounterparty.addEventListener('change', function () { outcounterparty.value = this.value; outcounterpartytable.value = this.value; outcounterpartydeletetable.value = this.value; outcounterpartydeletetableall.value = this.value; outcounterpartypdf.value = this.value; }); inmarkup.addEventListener('change', function () { outmarkup.value = this.value; outmarkuptable.value = this.value; outmarkupdeletetable.value = this.value; outmarkupdeletetableall.value = this.value; }); </script> </div> <div th:fragment="upload-files" class="row py-5 justify-content-center"> <div class="card p-3"> <div class="container h-100"> <div class="message float-end"> <div th:if="${message != null}" class="alert alert-info alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert"></button> <strong>[[${message}]]</strong> </div> <div th:if="${messageSuccess != null}" class="alert alert-success alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert"></button> <strong>[[${messageSuccess}]]</strong> </div> <div th:if="${messageError != null}" class="alert alert-danger alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert"></button> <strong>[[${messageError}]]</strong> </div> </div> </div> <div class="container h-100"> <div class="row justify-content-sm-center h-100"> <div class="card-text"> <h2 class="text-center">Обновление файлов базы данных</h2> </div> <hr> <h6>Файл прайс-листа</h6> <form class="input-group mb-5 need-validated" method="POST" th:action="@{/upload-1}" enctype="multipart/form-data"> <input type="file" class="form-control" aria-describedby="loadFile1" aria-label="Загрузить" name="file" accept=".csv" required aria-required="true"> <button class="btn btn-primary" type="submit">Загрузить</button> </form> <h6>Файл с кодами скидок</h6> <form class="input-group mb-5 need-validated" method="POST" th:action="@{/upload-2}" enctype="multipart/form-data"> <input type="file" class="form-control" aria-describedby="loadFile2" aria-label="Загрузить" name="file" accept=".csv" required aria-required="true"> <button class="btn btn-primary" type="submit">Загрузить</button> </form> <h6>Файл остатков з/ч склада в Москве</h6> <form class="input-group mb-5 need-validated" method="POST" th:action="@{/upload-3}" enctype="multipart/form-data"> <input type="file" class="form-control" aria-describedby="loadFile3" aria-label="Загрузить" name="file" accept=".csv" required aria-required="true"> <button class="btn btn-primary" type="submit">Загрузить</button> </form> <h6>Файл остатков склада компании</h6> <form class="input-group mb-5 need-validated" method="POST" th:action="@{/upload-4}" enctype="multipart/form-data"> <input type="file" class="form-control" aria-describedby="loadFile4" aria-label="Загрузить" name="file" accept=".csv" required aria-required="true"> <button class="btn btn-primary" type="submit">Загрузить</button> </form> <h6>Файл с габаритными размерами и весом з/ч</h6> <form class="input-group mb-5 need-validated" method="POST" th:action="@{/upload-5}" enctype="multipart/form-data"> <input type="file" class="form-control" aria-describedby="loadFile5" aria-label="Загрузить" name="file" accept=".csv" required aria-required="true"> <button class="btn btn-primary" type="submit">Загрузить</button> </form> <h6>Файл 1-й дисконтной программы</h6> <form class="input-group mb-5 need-validated" method="POST" th:action="@{/upload-6}" enctype="multipart/form-data"> <input type="file" class="form-control" aria-describedby="loadFile6" aria-label="Загрузить" name="file" accept=".csv" required aria-required="true"> <button class="btn btn-primary" type="submit">Загрузить</button> </form> <h6>Файл 2-й дисконтной программы</h6> <form class="input-group mb-5 need-validated" method="POST" th:action="@{/upload-7}" enctype="multipart/form-data"> <input type="file" class="form-control" aria-describedby="loadFile7" aria-label="Загрузить" name="file" accept=".csv" required aria-required="true"> <button class="btn btn-primary" type="submit">Загрузить</button> </form> <form class="input-group mb-5 need-validated" method="POST" th:action="@{/upload-all}" enctype="multipart/form-data"> <button class="btn btn-success" type="submit">Собрать прайс-лист</button> </form> </div> </div> </div> </div> <div th:fragment="register-user"> <section class="h-100"> <div class="container h-100"> <div class="row justify-content-sm-center h-100"> <div class="col-xxl-4 col-xl-5 col-lg-5 col-md-7 col-sm-9"> <div class="text-center my-3"> <img th:src="@{/img/logo.svg}" class="icon" alt="logo" width="200"> </div> <div class="card shadow-lg"> <div class="card-body p-5"> <h1 class="fs-4 card-title fw-bold mb-4">Регистрация</h1> <form method="POST" th:action="@{/register/save}" th:object="${user}" class="was-validated" autocomplete="off"> <div class="mb-3"> <label class="mb-2 text-muted">Введите имя</label> <input class="form-control is-invalid" id="firstName" name="firstName" th:field="*{firstName}" type="text" required aria-required="true" /> <p th:errors="*{firstName}" class="text-danger" th:if="${#fields.hasErrors('firstName')}"> </p> </div> <div class="mb-3"> <label class="mb-2 text-muted">Введите фамилию</label> <input class="form-control is-invalid" id="lastName" name="lastName" th:field="*{lastName}" type="text" required aria-required="true" /> <p th:errors="*{lastName}" class="text-danger" th:if="${#fields.hasErrors('lastName')}"> </p> </div> <div class="mb-3"> <i class="fa fa-envelope fa-fw"></i> <label class="mb-2 text-muted">Введите email адрес</label> <input class="form-control is-invalid" id="email" name="email" th:field="*{email}" type="email" required aria-required="true" /> <p th:errors="*{email}" class="text-danger" th:if="${#fields.hasErrors('email')}"> </p> </div> <div class="mb-3"> <i class="fa fa-key fa-fw"></i> <label class="mb-2 text-muted">Введите пароль</label> <input class="form-control is-invalid" id="password" name="password" th:field="*{password}" type="password" required aria-required="true" /> <p th:errors="*{password}" class="text-danger" th:if="${#fields.hasErrors('password')}"> </p> </div> <div class="align-items-center d-flex"> <button type="submit" class="btn btn-primary ms-auto">Зарегистрироваться</button> </div> </form> </div> <div class="card-footer py-3 border-0"> <div class="text-center"> Уже есть аккаунт? <a th:href="@{/login}" class="text-dark">Войти</a> </div> </div> </div> </div> </div> </div> </section> </div> <div th:fragment="register-user-for-admin" class="row py-5 justify-content-center"> <div class="container h-100"> <div class="row col-md-8 offset-md-2"> <div class="card"> <div th:if="${param.success}"> <div class="alert alert-info">Вы успешно зарегистрировались в приложении! </div> </div> <div class="card-text"> <h2 class="text-center">Регистрация</h2> </div> <hr> <div class="card-body"> <form method="post" role="form" th:action="@{/register-admin/save}" th:object="${user}" class="was-validated"> <div class="form-group mb-3"> <label class="form-label">First Name</label> <input class="form-control is-invalid" id="firstName" name="firstName" placeholder="Введите имя" th:field="*{firstName}" type="text" required aria-required="true" /> <p th:errors="*{firstName}" class="text-danger" th:if="${#fields.hasErrors('firstName')}"> </p> </div> <div class="form-group mb-3"> <label class="form-label">Last Name</label> <input class="form-control is-invalid" id="lastName" name="lastName" placeholder="Введите фамилию" th:field="*{lastName}" type="text" required aria-required="true" /> <p th:errors="*{lastName}" class="text-danger" th:if="${#fields.hasErrors('lastName')}"> </p> </div> <div class="form-group mb-3"> <label class="form-label">Email</label> <input class="form-control is-invalid" id="email" name="email" placeholder="Введите email адрес" th:field="*{email}" type="email" required aria-required="true" /> <p th:errors="*{email}" class="text-danger" th:if="${#fields.hasErrors('email')}"> </p> </div> <div class="form-group mb-3"> <label class="form-label">Password</label> <input class="form-control is-invalid" id="password" name="password" placeholder="Enter password" th:field="*{password}" type="password" required aria-required="true" /> <p th:errors="*{password}" class="text-danger" th:if="${#fields.hasErrors('password')}"> </p> </div> <div class="form-group row"> <label class="col-form-label col-sm-4">Роли: </label> <div class="col-sm-8 text-left"> <th:block th:each="role : ${listRoles}"> <div> <input class="m-2" th:text="${role.name}" th:value="${role.id}" th:field="*{roles}" type="checkbox" /> </div> </th:block> </div> <p th:errors="*{roles}" class="text-danger" th:if="${#fields.hasErrors('roles')}"> </p> </div> <div class="form-group mb-3"> <button class="btn btn-primary" type="submit">Зарегистрировать</button> <button class="btn btn-danger" onclick="history.back();">Отмена</button> </div> </form> </div> </div> </div> </div> </div> <div th:fragment="users" class="row py-5 justify-content-center"> <div th:if="${message != null}" class="alert alert-secondary alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert"></button> <strong>[[${message}]]</strong> </div> <div class="card p-3"> <div th:switch="${users}"> <h2 th:case="null">Пользователи не найдены!</h2> <div th:case="*"> <div class="card-text"> <h2 class="text-center">Зарегистрированные пользователи</h2> </div> <hr> <div class="table-responsive"> <table class="table table-striped table-hover table-bordered border-primary"> <thead> <tr> <th scope="col">N</th> <th scope="col">Имя</th> <th scope="col">Фамилия</th> <th scope="col">Email</th> <th scope="col">Пароль</th> <th scope="col">Роль</th> <th scope="col">Действие</th> </tr> </thead> <tbody> <tr th:each="user: ${users}"> <th scope="row" th:text="${user.id}"></th> <td th:text="${user.firstName}"></td> <td th:text="${user.lastName}"></td> <td th:text="${user.email}"></td> <td th:text="${user.password}"></td> <td th:text="${user.roles}"></td> <td><a th:href="@{'/user-update/'+${user.getId()}}" class="link-offset-2 link-underline link-underline-opacity-0 fa-regular fa-pen-to-square icon-dark"></a> <a th:href="@{'/user-delete/'+${user.getId()}}" class="link-offset-2 link-underline link-underline-opacity-0 fa-regular fa-trash-can icon-dark"></a> </td> </tr> </tbody> </table> </div> </div> <p> <a class="btn btn-primary" th:href="@{/register-admin}">Добавить пользователя</a> </p> </div> </div> </div> <div th:fragment="user-update" class="row py-5 justify-content-center"> <div class="container"> <div class="row col-md-8 offset-md-2"> <div class="card"> <div th:if="${param.success}"> <div class="alert alert-info">Вы успешно зарегистрировались!</div> </div> <div class="card-text"> <h2 class="text-center">Обновить пользователя c id: <span th:text="*{id}"></span></h2> </div> <form method="post" role="form" th:action="@{/user-update/save}" th:object="${user}" class="was-validated"> <input type="hidden" th:field="*{id}"/> <div class="form-group mb-3"> <label class="form-label">First Name</label> <input class="form-control is-invalid" id="firstName" name="firstName" placeholder="Введите имя" th:field="*{firstName}" type="text" required aria-required="true" /> <p th:errors="*{firstName}" class="text-danger" th:if="${#fields.hasErrors('firstName')}"> </p> </div> <div class="form-group mb-3"> <label class="form-label">Last Name</label> <input class="form-control is-invalid" id="lastName" name="lastName" placeholder="Введите фамилию" th:field="*{lastName}" type="text" required aria-required="true" /> <p th:errors="*{lastName}" class="text-danger" th:if="${#fields.hasErrors('lastName')}"> </p> </div> <div class="form-group mb-3"> <label class="form-label">Email</label> <input class="form-control is-invalid" id="email" name="email" placeholder="Введите email адрес" th:field="*{email}" type="email" required aria-required="true" /> <p th:errors="*{email}" class="text-danger" th:if="${#fields.hasErrors('email')}"> </p> </div> <div class="form-group mb-3"> <label class="form-label">Password</label> <input class="form-control is-invalid" id="password" name="password" placeholder="Enter password" th:field="*{password}" type="password" required aria-required="true" /> <p th:errors="*{password}" class="text-danger" th:if="${#fields.hasErrors('password')}"> </p> </div> <div class="form-group row"> <label class="col-form-label col-sm-4">Роли: </label> <div class="col-sm-8 text-left"> <th:block th:each="role : ${listRoles}"> <div> <input class="m-2" th:text="${role.name}" th:value="${role.id}" th:field="*{roles}" type="checkbox" /> </div> </th:block> </div> <p th:errors="*{roles}" class="text-danger" th:if="${#fields.hasErrors('roles')}"> </p> </div> <div class="form-group mb-3"> <button class="btn btn-primary" type="submit">Записать изменения</button> <button class="btn btn-danger" onclick="history.back();">Отмена</button> </div> </form> </div> </div> </div> </div> <footer th:fragment="footer"> <div class="card fixed-bottom"> <div class="text-center p-3 text-muted">ООО "Компания", 2024</div> </div> </footer> </html>