| | | 1 | | @model UserCreatePageVm |
| | | 2 | | @{ |
| | 0 | 3 | | var q = Model.Query; |
| | | 4 | | } |
| | | 5 | | |
| | | 6 | | <section class="admin-hero"> |
| | | 7 | | <h1>Новый пользователь</h1> |
| | | 8 | | <p class="subtitle">Создание учётной записи и назначение ролей.</p> |
| | | 9 | | <p class="subtitle-help">Новый пользователь получает подтверждение и одобрение администратором по текущим правилам.< |
| | | 10 | | </section> |
| | | 11 | | |
| | | 12 | | <nav class="admin-quick-links"> |
| | | 13 | | <a asp-area="Admin" asp-controller="Users" asp-action="Index"><i class="bi bi-people"></i>К списку пользователей</a> |
| | | 14 | | <a asp-area="Admin" asp-controller="Roles" asp-action="Index"><i class="bi bi-person-badge"></i>Роли</a> |
| | | 15 | | <a asp-area="Admin" asp-controller="Home" asp-action="Index"><i class="bi bi-speedometer2"></i>Обзор</a> |
| | | 16 | | </nav> |
| | | 17 | | |
| | | 18 | | <div class="admin-help-grid"> |
| | | 19 | | <article class="admin-help-card"> |
| | | 20 | | <h6><i class="bi bi-person-plus me-1"></i>Что создаётся</h6> |
| | | 21 | | <p>Создаётся локальная учётная запись. Роли можно назначить сразу или позже в карточке пользователя.</p> |
| | | 22 | | </article> |
| | | 23 | | <article class="admin-help-card"> |
| | | 24 | | <h6><i class="bi bi-google me-1"></i>Google-вход</h6> |
| | | 25 | | <p>Если пользователь войдёт через Google с этим же email, профиль свяжется, а имя/аватар будут автоматически обн |
| | | 26 | | </article> |
| | | 27 | | <article class="admin-help-card"> |
| | | 28 | | <h6><i class="bi bi-shield-check me-1"></i>Доступ в систему</h6> |
| | | 29 | | <p>Для входа требуются: подтверждённый email и одобрение администратором. Это настраивается в карточке после соз |
| | | 30 | | </article> |
| | | 31 | | <article class="admin-help-card"> |
| | | 32 | | <h6><i class="bi bi-key me-1"></i>Пароль и безопасность</h6> |
| | | 33 | | <p>Пароль задаётся на старте и может быть обновлён администратором в любой момент в разделе редактирования польз |
| | | 34 | | </article> |
| | | 35 | | </div> |
| | | 36 | | |
| | | 37 | | <form asp-action="Create" method="post" novalidate> |
| | 0 | 38 | | @Html.AntiForgeryToken() |
| | | 39 | | <input type="hidden" name="q" value="@q" /> |
| | | 40 | | |
| | | 41 | | <div class="d-flex justify-content-between align-items-center mb-3"> |
| | | 42 | | <div> |
| | | 43 | | <h5 class="mb-0"><i class="bi bi-person-plus"></i> Новый пользователь</h5> |
| | | 44 | | <div class="text-muted small">Создание учетной записи с назначением ролей</div> |
| | | 45 | | </div> |
| | 0 | 46 | | <a asp-action="Index" asp-route-q="@q" class="btn btn-outline-secondary"> |
| | | 47 | | <i class="bi bi-arrow-left"></i> К списку |
| | | 48 | | </a> |
| | | 49 | | </div> |
| | | 50 | | |
| | | 51 | | <div asp-validation-summary="ModelOnly" class="alert alert-danger py-2 mb-3"></div> |
| | | 52 | | |
| | | 53 | | <div class="row g-3"> |
| | | 54 | | <div class="col-12 col-xl-8"> |
| | | 55 | | <div class="card h-100"> |
| | | 56 | | <div class="card-header"> |
| | | 57 | | <strong>Основные данные</strong> |
| | | 58 | | </div> |
| | | 59 | | <div class="card-body"> |
| | | 60 | | <div class="row g-3"> |
| | | 61 | | <div class="col-12 col-md-6"> |
| | | 62 | | <label asp-for="Create.UserName" class="form-label"></label> |
| | | 63 | | <input asp-for="Create.UserName" class="form-control" autocomplete="username" /> |
| | | 64 | | <span asp-validation-for="Create.UserName" class="text-danger small"></span> |
| | | 65 | | </div> |
| | | 66 | | <div class="col-12 col-md-6"> |
| | | 67 | | <label asp-for="Create.Email" class="form-label"></label> |
| | | 68 | | <input asp-for="Create.Email" class="form-control" autocomplete="email" /> |
| | | 69 | | <span asp-validation-for="Create.Email" class="text-danger small"></span> |
| | | 70 | | </div> |
| | | 71 | | <div class="col-12 col-md-6"> |
| | | 72 | | <label asp-for="Create.Password" class="form-label"></label> |
| | | 73 | | <input asp-for="Create.Password" class="form-control" autocomplete="new-password" /> |
| | | 74 | | <span asp-validation-for="Create.Password" class="text-danger small"></span> |
| | | 75 | | </div> |
| | | 76 | | <div class="col-12 col-md-6"> |
| | | 77 | | <label asp-for="Create.ConfirmPassword" class="form-label"></label> |
| | | 78 | | <input asp-for="Create.ConfirmPassword" class="form-control" autocomplete="new-password" /> |
| | | 79 | | <span asp-validation-for="Create.ConfirmPassword" class="text-danger small"></span> |
| | | 80 | | </div> |
| | | 81 | | </div> |
| | | 82 | | <div class="form-text mt-2">Пароль должен быть не короче 8 символов.</div> |
| | | 83 | | </div> |
| | | 84 | | </div> |
| | | 85 | | </div> |
| | | 86 | | |
| | | 87 | | <div class="col-12 col-xl-4"> |
| | | 88 | | <div class="card h-100 admin-form-card"> |
| | | 89 | | <div class="card-header d-flex justify-content-between align-items-center"> |
| | | 90 | | <strong>Роли (опционально)</strong> |
| | 0 | 91 | | <span class="bsx-tone bsx-tone--muted">@Model.AvailableRoles.Count</span> |
| | | 92 | | </div> |
| | | 93 | | <div class="card-body"> |
| | 0 | 94 | | @if (!Model.AvailableRoles.Any()) |
| | | 95 | | { |
| | | 96 | | <div class="alert alert-warning mb-0">Активные роли не найдены.</div> |
| | | 97 | | } |
| | | 98 | | else |
| | | 99 | | { |
| | | 100 | | <div class="d-flex flex-column gap-2 admin-scroll-list"> |
| | 0 | 101 | | @foreach (var role in Model.AvailableRoles) |
| | | 102 | | { |
| | 0 | 103 | | var isChecked = Model.Create.SelectedRoleIds.Contains(role.Id); |
| | | 104 | | <label class="role-option border rounded p-2 d-flex align-items-start gap-2"> |
| | | 105 | | <input class="form-check-input role-option-checkbox m-0 mt-1 flex-shrink-0" type="ch |
| | | 106 | | <span> |
| | 0 | 107 | | <strong>@role.DisplayName</strong> |
| | 0 | 108 | | <span class="d-block text-muted small">@role.Name</span> |
| | 0 | 109 | | @if (!string.IsNullOrWhiteSpace(role.Description)) |
| | | 110 | | { |
| | 0 | 111 | | <span class="d-block text-muted small">@role.Description</span> |
| | | 112 | | } |
| | | 113 | | </span> |
| | | 114 | | </label> |
| | | 115 | | } |
| | | 116 | | </div> |
| | | 117 | | } |
| | | 118 | | </div> |
| | | 119 | | </div> |
| | | 120 | | </div> |
| | | 121 | | </div> |
| | | 122 | | |
| | | 123 | | <div class="mt-3 d-flex flex-wrap gap-2"> |
| | | 124 | | <button type="submit" class="btn btn-primary"> |
| | | 125 | | <i class="bi bi-check2-circle"></i> Создать пользователя |
| | | 126 | | </button> |
| | | 127 | | <button type="reset" class="btn btn-outline-secondary"> |
| | | 128 | | <i class="bi bi-eraser"></i> Очистить |
| | | 129 | | </button> |
| | | 130 | | </div> |
| | | 131 | | </form> |
| | | 132 | | |
| | | 133 | | @section Scripts { |
| | | 134 | | <partial name="_ValidationScriptsPartial" /> |
| | | 135 | | } |