| | | 1 | | @using OzonDomains.Models |
| | | 2 | | @using OzonDomains |
| | | 3 | | |
| | | 4 | | @model OzonDomains.Models.ClientStatus |
| | | 5 | | |
| | | 6 | | @{ |
| | 0 | 7 | | ViewData["Title"] = "Создание статуса клиента"; |
| | 0 | 8 | | Layout = "~/Views/Shared/_Layout.cshtml"; |
| | | 9 | | |
| | 0 | 10 | | string uploadResultPeriod = ViewData["StatusResult"] as string ?? ""; |
| | | 11 | | } |
| | | 12 | | |
| | | 13 | | <style> |
| | | 14 | | .card { |
| | | 15 | | border: none; |
| | | 16 | | box-shadow: 0 0.125rem 0.25rem rgba(var(--og-shadow-rgb), 0.075); |
| | | 17 | | border-radius: 0.5rem; |
| | | 18 | | } |
| | | 19 | | |
| | | 20 | | .card-header { |
| | | 21 | | background-color: var(--og-surface-2); |
| | | 22 | | border-bottom: 1px solid var(--og-surface-3); |
| | | 23 | | padding: 1.25rem 1.5rem; |
| | | 24 | | display: flex; |
| | | 25 | | justify-content: space-between; |
| | | 26 | | align-items: center; |
| | | 27 | | } |
| | | 28 | | |
| | | 29 | | .card-body { |
| | | 30 | | padding: 1.5rem; |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | .form-group { |
| | | 34 | | margin-bottom: 1.5rem; |
| | | 35 | | } |
| | | 36 | | |
| | | 37 | | .form-label { |
| | | 38 | | font-weight: 600; |
| | | 39 | | color: var(--og-text-2); |
| | | 40 | | margin-bottom: 0.5rem; |
| | | 41 | | } |
| | | 42 | | |
| | | 43 | | .alert-success { |
| | | 44 | | border-radius: 0.25rem; |
| | | 45 | | padding: 1rem; |
| | | 46 | | margin-bottom: 1.5rem; |
| | | 47 | | } |
| | | 48 | | |
| | | 49 | | .client-type-preview { |
| | | 50 | | margin-top: 0.5rem; |
| | | 51 | | display: inline-flex; |
| | | 52 | | align-items: center; |
| | | 53 | | gap: 0.5rem; |
| | | 54 | | } |
| | | 55 | | |
| | | 56 | | .client-type-badge { |
| | | 57 | | font-size: 0.75rem; |
| | | 58 | | padding: 0.25rem 0.5rem; |
| | | 59 | | } |
| | | 60 | | </style> |
| | | 61 | | |
| | 0 | 62 | | @await Html.PartialAsync("_BsxGridShell") |
| | | 63 | | |
| | | 64 | | <div class="container bsx-surface"> |
| | | 65 | | <div class="row"> |
| | | 66 | | <div> |
| | | 67 | | <div class="card"> |
| | | 68 | | <div class="card-header" style="display: flex; justify-content: space-between; align-items: center;"> |
| | | 69 | | <div> |
| | | 70 | | <h2>Создание нового статуса клиента</h2> |
| | | 71 | | <p class="mb-0 text-muted" style="font-size: 0.9rem;">Добавьте новый статус клиента в систему</p |
| | | 72 | | </div> |
| | | 73 | | </div> |
| | | 74 | | |
| | | 75 | | <div class="card-body"> |
| | 0 | 76 | | @if (!string.IsNullOrEmpty(uploadResultPeriod)) |
| | | 77 | | { |
| | | 78 | | <div class="alert alert-success alert-dismissible fade show" role="alert"> |
| | 0 | 79 | | @uploadResultPeriod |
| | | 80 | | <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> |
| | | 81 | | </div> |
| | | 82 | | } |
| | | 83 | | |
| | | 84 | | <div class="row justify-content-center"> |
| | | 85 | | <div class="col-md-8 col-lg-6"> |
| | | 86 | | <form asp-area="Studio2" asp-action="Create" asp-controller="ClientStatus" method="post"> |
| | | 87 | | <div asp-validation-summary="ModelOnly" class="alert alert-danger"></div> |
| | | 88 | | |
| | | 89 | | <div class="form-group"> |
| | | 90 | | <label asp-for="Name" class="form-label">Название статуса</label> |
| | | 91 | | <input asp-for="Name" class="form-control" |
| | | 92 | | placeholder="Введите название статуса"/> |
| | | 93 | | <span asp-validation-for="Name" class="text-danger small"></span> |
| | | 94 | | <small class="form-text text-muted">Например: Доставлен, Отменён, В обработке</small |
| | | 95 | | </div> |
| | | 96 | | |
| | | 97 | | <div class="form-group"> |
| | | 98 | | <label asp-for="ClientTypeId" class="form-label">Тип клиента</label> |
| | | 99 | | <select asp-for="ClientTypeId" class="form-control" id="ClientTypeSelect" onchange=" |
| | | 100 | | <option value="">Не указан</option> |
| | | 101 | | <option value="1">Ozon</option> |
| | | 102 | | <option value="2">Yandex</option> |
| | | 103 | | </select> |
| | | 104 | | <span asp-validation-for="ClientTypeId" class="text-danger small"></span> |
| | | 105 | | <div id="clientTypePreview" class="client-type-preview" style="display: none;"> |
| | | 106 | | <span>Выбранный тип:</span> |
| | | 107 | | <span id="clientTypeBadge" class="badge"></span> |
| | | 108 | | </div> |
| | | 109 | | </div> |
| | | 110 | | |
| | | 111 | | <div class="form-group mt-4"> |
| | | 112 | | <div class="d-flex gap-2"> |
| | | 113 | | <button type="submit" class="btn btn-primary"> |
| | | 114 | | <i class="fas fa-plus"></i> Создать статус |
| | | 115 | | </button> |
| | | 116 | | <a asp-area="Studio2" asp-controller="ClientStatus" asp-action="Index" |
| | | 117 | | class="btn btn-outline-secondary"> |
| | | 118 | | <i class="fas fa-times"></i> Отмена |
| | | 119 | | </a> |
| | | 120 | | </div> |
| | | 121 | | </div> |
| | | 122 | | </form> |
| | | 123 | | </div> |
| | | 124 | | </div> |
| | | 125 | | </div> |
| | | 126 | | </div> |
| | | 127 | | </div> |
| | | 128 | | </div> |
| | | 129 | | </div> |
| | | 130 | | |
| | | 131 | | @section Scripts { |
| | | 132 | | <script> |
| | | 133 | | function handleClientTypeChange() { |
| | | 134 | | var clientTypeSelect = document.getElementById("ClientTypeSelect"); |
| | | 135 | | var clientType = clientTypeSelect.value; |
| | | 136 | | var preview = document.getElementById("clientTypePreview"); |
| | | 137 | | var badge = document.getElementById("clientTypeBadge"); |
| | | 138 | | |
| | | 139 | | // Обновляем превью типа клиента |
| | | 140 | | if (clientType && clientType !== "") { |
| | | 141 | | preview.style.display = "inline-flex"; |
| | | 142 | | var selectedOption = clientTypeSelect.options[clientTypeSelect.selectedIndex]; |
| | | 143 | | var typeName = selectedOption.text; |
| | | 144 | | |
| | | 145 | | badge.textContent = typeName; |
| | | 146 | | badge.className = "badge client-type-badge"; |
| | | 147 | | |
| | | 148 | | if (clientType === "1") { |
| | | 149 | | badge.classList.add("bg-primary"); |
| | | 150 | | badge.innerHTML = '<i class="fas fa-shopping-bag me-1"></i>' + typeName; |
| | | 151 | | } else if (clientType === "2") { |
| | | 152 | | badge.classList.add("bg-danger"); |
| | | 153 | | badge.innerHTML = '<i class="fas fa-shopping-cart me-1"></i>' + typeName; |
| | | 154 | | } else if (clientType === "3") { |
| | | 155 | | badge.classList.add("bg-warning", "text-dark"); |
| | | 156 | | badge.innerHTML = '<i class="fas fa-box me-1"></i>' + typeName; |
| | | 157 | | } else { |
| | | 158 | | badge.classList.add("bg-secondary"); |
| | | 159 | | badge.innerHTML = '<i class="fas fa-question-circle me-1"></i>' + typeName; |
| | | 160 | | } |
| | | 161 | | } else { |
| | | 162 | | preview.style.display = "none"; |
| | | 163 | | } |
| | | 164 | | } |
| | | 165 | | |
| | | 166 | | // Инициализация при загрузке страницы |
| | | 167 | | document.addEventListener('DOMContentLoaded', function() { |
| | | 168 | | handleClientTypeChange(); |
| | | 169 | | }); |
| | | 170 | | </script> |
| | | 171 | | @{ |
| | 0 | 172 | | await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
| | | 173 | | } |
| | | 174 | | } |