Код IT Загрузка примера кода…

HTML main.html
<!DOCTYPE html>
<html lang="ru" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title th:text="${formTitle + ' — Simple CRM'}">Форма — Simple CRM</title>
    <link rel="stylesheet" th:href="@{/css/style.css}">
</head>
<body>
<header class="header">
    <div class="container header-inner">
        <a class="logo" th:href="@{/customers}">Simple CRM</a>
        <nav class="nav">
            <a th:href="@{/customers}">Клиенты</a>
            <a th:href="@{/customers/new}" class="btn btn-primary btn-sm">+ Добавить</a>
        </nav>
    </div>
</header>

<main class="container main">
    <div class="page-header">
        <h1 th:text="${formTitle}">Форма</h1>
        <a th:href="@{/customers}" class="link-back">← Назад к списку</a>
    </div>

    <div class="card form-card">
        <form th:action="${formAction}" th:object="${customer}" method="post">
            <input type="hidden" th:field="*{id}">

            <div class="form-group">
                <label for="name">Имя *</label>
                <input id="name" type="text" th:field="*{name}" class="form-control" autofocus>
                <span class="error" th:if="${#fields.hasErrors('name')}" th:errors="*{name}"></span>
            </div>

            <div class="form-row">
                <div class="form-group">
                    <label for="email">Email</label>
                    <input id="email" type="email" th:field="*{email}" class="form-control">
                    <span class="error" th:if="${#fields.hasErrors('email')}" th:errors="*{email}"></span>
                </div>
                <div class="form-group">
                    <label for="phone">Телефон</label>
                    <input id="phone" type="text" th:field="*{phone}" class="form-control">
                </div>
            </div>

            <div class="form-group">
                <label for="company">Компания</label>
                <input id="company" type="text" th:field="*{company}" class="form-control">
            </div>

            <div class="form-group">
                <label for="notes">Заметки</label>
                <textarea id="notes" th:field="*{notes}" class="form-control" rows="4"></textarea>
            </div>

            <div class="form-actions">
                <button type="submit" class="btn btn-primary">Сохранить</button>
                <a th:href="@{/customers}" class="btn btn-secondary">Отмена</a>
            </div>
        </form>
    </div>
</main>

<footer class="footer">
    <div class="container">
        REST API: <code>/api/customers</code>
    </div>
</footer>
</body>
</html>
<!DOCTYPE html>
<html lang="ru" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title th:text="${formTitle + ' — Simple CRM'}">Форма — Simple CRM</title>
    <link rel="stylesheet" th:href="@{/css/style.css}">
</head>
<body>
<header class="header">
    <div class="container header-inner">
        <a class="logo" th:href="@{/customers}">Simple CRM</a>
        <nav class="nav">
            <a th:href="@{/customers}">Клиенты</a>
            <a th:href="@{/customers/new}" class="btn btn-primary btn-sm">+ Добавить</a>
        </nav>
    </div>
</header>

<main class="container main">
    <div class="page-header">
        <h1 th:text="${formTitle}">Форма</h1>
        <a th:href="@{/customers}" class="link-back">← Назад к списку</a>
    </div>

    <div class="card form-card">
        <form th:action="${formAction}" th:object="${customer}" method="post">
            <input type="hidden" th:field="*{id}">

            <div class="form-group">
                <label for="name">Имя *</label>
                <input id="name" type="text" th:field="*{name}" class="form-control" autofocus>
                <span class="error" th:if="${#fields.hasErrors('name')}" th:errors="*{name}"></span>
            </div>

            <div class="form-row">
                <div class="form-group">
                    <label for="email">Email</label>
                    <input id="email" type="email" th:field="*{email}" class="form-control">
                    <span class="error" th:if="${#fields.hasErrors('email')}" th:errors="*{email}"></span>
                </div>
                <div class="form-group">
                    <label for="phone">Телефон</label>
                    <input id="phone" type="text" th:field="*{phone}" class="form-control">
                </div>
            </div>

            <div class="form-group">
                <label for="company">Компания</label>
                <input id="company" type="text" th:field="*{company}" class="form-control">
            </div>

            <div class="form-group">
                <label for="notes">Заметки</label>
                <textarea id="notes" th:field="*{notes}" class="form-control" rows="4"></textarea>
            </div>

            <div class="form-actions">
                <button type="submit" class="btn btn-primary">Сохранить</button>
                <a th:href="@{/customers}" class="btn btn-secondary">Отмена</a>
            </div>
        </form>
    </div>
</main>

<footer class="footer">
    <div class="container">
        REST API: <code>/api/customers</code>
    </div>
</footer>
</body>
</html>