| | | 1 | | @using System.Security.Claims |
| | | 2 | | @using OzonOrdersWeb.WebServices.BitrixStock |
| | | 3 | | @inject OzonOrdersWeb.WebServices.Orders.Grid.IOrdersGridUserSettingsService BsxUserSettings |
| | | 4 | | @* |
| | | 5 | | Общая оболочка гридов AG Grid в Studio2 (BitrixStock, JobLogs, TransactionJobs…): стили гридов и слой токенов |
| | | 6 | | темы (.bsx-surface на корне страницы), ранняя установка темы (общий viewPrefs.theme со страницей заказов), |
| | | 7 | | настройки пользователя (bsx.*), antiforgery, локаль и BsxGrid. ag-grid-community подключён в _Layout. |
| | | 8 | | Страница дополняет window.bsxGridConfig своими URL до своих модулей. Правила — docs/frontend-ag-grid-migration.md. |
| | | 9 | | *@ |
| | | 10 | | @{ |
| | 0 | 11 | | var bsxUserId = User.FindFirstValue(ClaimTypes.NameIdentifier); |
| | 0 | 12 | | var bsxGridSettings = string.IsNullOrEmpty(bsxUserId) |
| | 0 | 13 | | ? new Dictionary<string, string>() |
| | 0 | 14 | | : (await BsxUserSettings.GetAllAsync(bsxUserId, Context.RequestAborted)) |
| | 0 | 15 | | .Where(kv => BitrixSyncGridSettings.IsAllowedKey(kv.Key)) |
| | 0 | 16 | | .ToDictionary(kv => kv.Key, kv => kv.Value); |
| | 0 | 17 | | var bsxViewPrefsJson = bsxGridSettings.TryGetValue("viewPrefs", out var bsxViewPrefsRaw) && !string.IsNullOrWhiteSpa |
| | | 18 | | } |
| | | 19 | | <link rel="stylesheet" href="~/css/Studio2/OrdersGrid/orders-grid.css" asp-append-version="true"/> |
| | | 20 | | <link rel="stylesheet" href="~/css/Studio2/Grid/bsx-grid.css" asp-append-version="true"/> |
| | | 21 | | <script> |
| | | 22 | | (function () { |
| | | 23 | | var mode = 'light'; |
| | 0 | 24 | | try { mode = (@Html.Raw(bsxViewPrefsJson) || {}).theme || 'light'; } catch (e) { /* ignore */ } |
| | | 25 | | if (mode === 'auto') mode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'da |
| | | 26 | | if (mode !== 'dark') mode = 'light'; |
| | | 27 | | document.documentElement.setAttribute('data-og-theme', mode); |
| | | 28 | | document.documentElement.setAttribute('data-ag-theme-mode', mode); |
| | | 29 | | })(); |
| | | 30 | | window.bsxGridConfig = { |
| | 0 | 31 | | userSettings: @Html.Raw(System.Text.Json.JsonSerializer.Serialize(bsxGridSettings)), |
| | 0 | 32 | | saveSettingUrl: @Html.Raw(System.Text.Json.JsonSerializer.Serialize(Url.Action("Save", "GridSettings", new { are |
| | | 33 | | }; |
| | | 34 | | </script> |
| | 0 | 35 | | <form id="bsxAf" method="post" hidden>@Html.AntiForgeryToken()</form> |
| | | 36 | | <script src="~/js/Studio2/OrdersGrid/orders-grid-locale.js" asp-append-version="true"></script> |
| | | 37 | | <script src="~/js/Studio2/Grid/bsx-grid-core.js" asp-append-version="true"></script> |