| | | 1 | | @using OzonDomains.Models.AccessControl |
| | | 2 | | @model AccessProfile |
| | | 3 | | |
| | | 4 | | @{ |
| | 0 | 5 | | ViewData["Title"] = "Новый профиль доступа"; |
| | 0 | 6 | | Layout = "_AdminLayout"; |
| | 0 | 7 | | ViewData["Breadcrumb"] = new List<(string, string?)> |
| | 0 | 8 | | { |
| | 0 | 9 | | ("Администрирование", null), |
| | 0 | 10 | | ("Профили доступа", Url.Action("Index", "AccessProfiles", new { area = "Studio2" })), |
| | 0 | 11 | | ("Новый", null) |
| | 0 | 12 | | }; |
| | | 13 | | } |
| | | 14 | | |
| | | 15 | | <div class="row justify-content-center"> |
| | | 16 | | <div class="col-md-7"> |
| | | 17 | | <div class="card"> |
| | | 18 | | <div class="card-header"> |
| | | 19 | | <h3 class="card-title"><i class="ti ti-shield-plus me-2"></i>Создать профиль доступа</h3> |
| | | 20 | | </div> |
| | | 21 | | <div class="card-body"> |
| | | 22 | | <form asp-action="Create" method="post"> |
| | | 23 | | <div asp-validation-summary="ModelOnly" class="alert alert-danger mb-3"></div> |
| | | 24 | | |
| | | 25 | | <div class="mb-3"> |
| | | 26 | | <label asp-for="Name" class="form-label">Название профиля <span class="text-red">*</span></label |
| | | 27 | | <input asp-for="Name" class="form-control" placeholder="Например: Менеджер по продажам" autofocu |
| | | 28 | | <span asp-validation-for="Name" class="text-danger small"></span> |
| | | 29 | | </div> |
| | | 30 | | |
| | | 31 | | <div class="mb-4"> |
| | | 32 | | <label class="form-label"> |
| | | 33 | | Доступные столбцы таблицы заказов |
| | | 34 | | <span class="text-muted">(оставьте пустым — доступны все)</span> |
| | | 35 | | </label> |
| | | 36 | | <div id="columnsContainer"> |
| | 0 | 37 | | @if (Model.AvailableOrderColumns?.Any() == true) |
| | | 38 | | { |
| | 0 | 39 | | @for (var i = 0; i < Model.AvailableOrderColumns.Count; i++) |
| | | 40 | | { |
| | | 41 | | <div class="input-group mb-2"> |
| | | 42 | | <input type="text" name="AvailableOrderColumns" class="form-control" |
| | | 43 | | value="@Model.AvailableOrderColumns[i]" placeholder="Название столбца"/> |
| | | 44 | | <button type="button" class="btn btn-outline-danger" onclick="this.parentElement |
| | | 45 | | <i class="ti ti-x"></i> |
| | | 46 | | </button> |
| | | 47 | | </div> |
| | | 48 | | } |
| | | 49 | | } |
| | | 50 | | </div> |
| | | 51 | | <button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="addColumn()"> |
| | | 52 | | <i class="ti ti-plus me-1"></i>Добавить столбец |
| | | 53 | | </button> |
| | | 54 | | </div> |
| | | 55 | | |
| | | 56 | | <div class="d-flex gap-2"> |
| | | 57 | | <button type="submit" class="btn btn-primary"> |
| | | 58 | | <i class="ti ti-check me-1"></i>Создать |
| | | 59 | | </button> |
| | | 60 | | <a asp-action="Index" class="btn btn-outline-secondary">Отмена</a> |
| | | 61 | | </div> |
| | | 62 | | </form> |
| | | 63 | | </div> |
| | | 64 | | </div> |
| | | 65 | | </div> |
| | | 66 | | </div> |
| | | 67 | | |
| | | 68 | | @section Scripts { |
| | | 69 | | <script> |
| | | 70 | | function addColumn() { |
| | | 71 | | const div = document.createElement('div'); |
| | | 72 | | div.className = 'input-group mb-2'; |
| | | 73 | | div.innerHTML = `<input type="text" name="AvailableOrderColumns" class="form-control" placeholder="Название столбца" |
| | | 74 | | <button type="button" class="btn btn-outline-danger" onclick="this.parentElement.remove()"> |
| | | 75 | | <i class="ti ti-x"></i></button>`; |
| | | 76 | | document.getElementById('columnsContainer').appendChild(div); |
| | | 77 | | div.querySelector('input').focus(); |
| | | 78 | | } |
| | | 79 | | </script> |
| | | 80 | | } |