| | | 1 | | @using Newtonsoft.Json.Linq |
| | | 2 | | @model JObject |
| | | 3 | | @{ |
| | 0 | 4 | | ViewData["Title"] = "Редактирование конфигурации"; |
| | 0 | 5 | | Layout = null; |
| | | 6 | | } |
| | | 7 | | |
| | | 8 | | <!DOCTYPE html> |
| | | 9 | | <html lang="ru"> |
| | | 10 | | <head> |
| | | 11 | | <meta charset="utf-8" /> |
| | | 12 | | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| | 0 | 13 | | <title>@ViewData["Title"]</title> |
| | | 14 | | <!-- Bootstrap CSS --> |
| | | 15 | | <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"/> |
| | | 16 | | <!-- Bootstrap Icons --> |
| | | 17 | | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css"/> |
| | | 18 | | <style> |
| | | 19 | | .config-section { |
| | | 20 | | margin-bottom: 2rem; |
| | | 21 | | } |
| | | 22 | | .config-section h5 { |
| | | 23 | | color: #0d6efd; |
| | | 24 | | margin-bottom: 1.5rem; |
| | | 25 | | } |
| | | 26 | | .form-label { |
| | | 27 | | font-size: 0.875rem; |
| | | 28 | | color: #6c757d; |
| | | 29 | | transform-origin: 0 0; |
| | | 30 | | } |
| | | 31 | | .form-control:focus { |
| | | 32 | | box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); |
| | | 33 | | } |
| | | 34 | | .password-toggle { |
| | | 35 | | position: absolute; |
| | | 36 | | right: 10px; |
| | | 37 | | top: 10px; |
| | | 38 | | cursor: pointer; |
| | | 39 | | z-index: 3; |
| | | 40 | | } |
| | | 41 | | .input-group-password { |
| | | 42 | | position: relative; |
| | | 43 | | } |
| | | 44 | | </style> |
| | | 45 | | </head> |
| | | 46 | | <body> |
| | | 47 | | <main class="container py-4"> |
| | | 48 | | <div class="row justify-content-center"> |
| | | 49 | | <div class="col-12 col-lg-10"> |
| | | 50 | | <div class="card shadow-sm"> |
| | | 51 | | <div class="card-body"> |
| | | 52 | | <div class="d-flex justify-content-between align-items-center mb-4"> |
| | | 53 | | <h1 class="h4 mb-0">Редактирование конфигурации</h1> |
| | | 54 | | <a asp-controller="Home" asp-action="Index" class="btn btn-outline-secondary"> |
| | | 55 | | <i class="bi bi-arrow-left me-1"></i>Назад |
| | | 56 | | </a> |
| | | 57 | | </div> |
| | | 58 | | |
| | | 59 | | <hr class="my-3"> |
| | | 60 | | |
| | | 61 | | <form asp-area="Studio2" asp-controller="Config" asp-action="SaveConfig" method="post"> |
| | 0 | 62 | | @foreach (var configSection in Model.Properties()) |
| | | 63 | | { |
| | | 64 | | <div class="config-section"> |
| | 0 | 65 | | <h5 class="fw-semibold">@configSection.Name</h5> |
| | | 66 | | |
| | 0 | 67 | | @if (configSection.Value.Type == JTokenType.Object) |
| | | 68 | | { |
| | 0 | 69 | | var obj = (JObject)configSection.Value; |
| | 0 | 70 | | foreach (var subProp in obj.Properties()) |
| | | 71 | | { |
| | | 72 | | <div class="mb-3 input-group-password"> |
| | 0 | 73 | | <label class="form-label">@subProp.Name</label> |
| | | 74 | | <input type="password" |
| | | 75 | | name="@configSection.Name.@subProp.Name" |
| | | 76 | | value="@subProp.Value" |
| | | 77 | | class="form-control password-field" /> |
| | | 78 | | <i class="bi bi-eye-slash password-toggle"></i> |
| | | 79 | | </div> |
| | | 80 | | } |
| | | 81 | | } |
| | | 82 | | else |
| | | 83 | | { |
| | | 84 | | <div class="mb-3 input-group-password"> |
| | 0 | 85 | | <label class="form-label">@configSection.Name</label> |
| | | 86 | | <input type="password" |
| | | 87 | | name="@configSection.Name" |
| | | 88 | | value="@configSection.Value" |
| | | 89 | | class="form-control password-field" /> |
| | | 90 | | <i class="bi bi-eye-slash password-toggle"></i> |
| | | 91 | | </div> |
| | | 92 | | } |
| | | 93 | | </div> |
| | | 94 | | <hr class="my-3"> |
| | | 95 | | } |
| | | 96 | | |
| | | 97 | | <div class="d-flex justify-content-end mt-4"> |
| | | 98 | | <button type="submit" class="btn btn-primary"> |
| | | 99 | | <i class="bi bi-save me-1"></i>Сохранить |
| | | 100 | | </button> |
| | | 101 | | </div> |
| | | 102 | | </form> |
| | | 103 | | </div> |
| | | 104 | | </div> |
| | | 105 | | </div> |
| | | 106 | | </div> |
| | | 107 | | </main> |
| | | 108 | | |
| | | 109 | | <!-- Bootstrap JS Bundle with Popper --> |
| | | 110 | | <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> |
| | | 111 | | <script> |
| | | 112 | | document.addEventListener('DOMContentLoaded', function() { |
| | | 113 | | // Обработка переключения видимости пароля |
| | | 114 | | document.querySelectorAll('.password-toggle').forEach(function(toggle) { |
| | | 115 | | toggle.addEventListener('click', function() { |
| | | 116 | | const input = this.parentElement.querySelector('.password-field'); |
| | | 117 | | if (input.type === 'password') { |
| | | 118 | | input.type = 'text'; |
| | | 119 | | this.classList.remove('bi-eye-slash'); |
| | | 120 | | this.classList.add('bi-eye'); |
| | | 121 | | } else { |
| | | 122 | | input.type = 'password'; |
| | | 123 | | this.classList.remove('bi-eye'); |
| | | 124 | | this.classList.add('bi-eye-slash'); |
| | | 125 | | } |
| | | 126 | | }); |
| | | 127 | | }); |
| | | 128 | | }); |
| | | 129 | | </script> |
| | | 130 | | </body> |
| | | 131 | | </html> |