| | | 1 | | @using OzonDomains |
| | | 2 | | @using OzonDomains.Models |
| | | 3 | | @using OzonOrdersWeb.Areas.Studio2.ViewModels.Grid |
| | | 4 | | @model List<ClientStatus> |
| | | 5 | | @{ |
| | 0 | 6 | | ViewData["Title"] = $"Статусы клиентов ({Model.Count})"; |
| | 0 | 7 | | Layout = "~/Views/Shared/_Layout.cshtml"; |
| | 0 | 8 | | var rows = Model.Select(s => new |
| | 0 | 9 | | { |
| | 0 | 10 | | id = s.Id, |
| | 0 | 11 | | name = s.Name, |
| | 0 | 12 | | clientType = s.ClientType switch { ClientType.OZON => "Ozon", ClientType.YANDEX => "Yandex", _ => "" }, |
| | 0 | 13 | | isFinal = s.IsFinal, |
| | 0 | 14 | | color = s.StatusColor?.ColorCode |
| | 0 | 15 | | }); |
| | | 16 | | } |
| | | 17 | | |
| | 0 | 18 | | @await Html.PartialAsync("_BsxGridShell") |
| | | 19 | | |
| | | 20 | | <div class="container-fluid py-3 bsx-surface"> |
| | | 21 | | <div class="app-section-hero app-section-hero--import d-flex flex-wrap justify-content-between align-items-start gap |
| | | 22 | | <div> |
| | | 23 | | <h1><i class="fas fa-user-tag me-2 text-primary"></i>Статусы клиентов</h1> |
| | | 24 | | <div class="subtitle">Статусы отправлений в кабинетах Ozon и Yandex и их цвета</div> |
| | | 25 | | <div class="app-section-hero__quick-links"> |
| | | 26 | | <a asp-area="Studio2" asp-controller="OzonClients" asp-action="Index"><i class="fas fa-store"></i>Клиент |
| | | 27 | | <a asp-area="Studio2" asp-controller="AppStatus" asp-action="Index"><i class="fas fa-tags"></i>Статусы з |
| | | 28 | | <a asp-area="Studio2" asp-controller="SupplierStatus" asp-action="Index"><i class="fas fa-dolly"></i>Ста |
| | | 29 | | </div> |
| | | 30 | | </div> |
| | | 31 | | <div class="d-flex flex-wrap gap-2 align-items-center"> |
| | | 32 | | <div class="bsx-dir-stats"> |
| | 0 | 33 | | <span class="bsx-dir-stat">Всего <b>@Model.Count</b></span> |
| | 0 | 34 | | <span class="bsx-dir-stat">Ozon <b>@Model.Count(s => s.ClientType == ClientType.OZON)</b></span> |
| | 0 | 35 | | <span class="bsx-dir-stat">Yandex <b>@Model.Count(s => s.ClientType == ClientType.YANDEX)</b></span> |
| | | 36 | | </div> |
| | | 37 | | <a asp-action="Create" class="btn btn-primary btn-sm"><i class="fas fa-plus me-1"></i>Создать статус</a> |
| | | 38 | | </div> |
| | | 39 | | </div> |
| | | 40 | | |
| | 0 | 41 | | @await Html.PartialAsync("_BsxDirectoryGrid", new BsxDirectoryGridViewModel("clientStatus", "Статусы клиентов", "fa- |
| | 0 | 42 | | "Цвет сохраняется сразу. Двойной клик — страница изменения.")) |
| | | 43 | | </div> |
| | | 44 | | |
| | | 45 | | @section Scripts { |
| | | 46 | | <script src="~/js/Studio2/Grid/bsx-directory.js" asp-append-version="true"></script> |
| | | 47 | | <script> |
| | | 48 | | (function () { |
| | | 49 | | const D = window.BsxDirectory; |
| | 0 | 50 | | const editUrl = id => '@Url.Action("Edit", "ClientStatus", new { area = "Studio2" })/' + id; |
| | | 51 | | const TYPE_TONE = { Ozon: ['accent', 'fa-shopping-bag'], Yandex: ['danger', 'fa-shopping-cart'] }; |
| | | 52 | | |
| | | 53 | | D.grid({ |
| | | 54 | | key: 'dirClientStatus', |
| | | 55 | | prefix: 'clientStatus', |
| | 0 | 56 | | rows: @Json.Serialize(rows), |
| | | 57 | | rowUrl: r => editUrl(r.id), |
| | | 58 | | columnDefs: [ |
| | | 59 | | { field: 'name', headerName: 'Статус клиента', flex: 1, minWidth: 240, sort: 'asc', |
| | | 60 | | cellRenderer: p => D.colorPill(p.value, p.data.color, p.data.isFinal ? ' ' + D.tone('конечный', 'warni |
| | | 61 | | D.setCol({ field: 'clientType', headerName: 'Тип клиента', width: 160, filterParams: { labels: { '': 'Не |
| | | 62 | | cellRenderer: p => p.value ? D.tone(p.value, TYPE_TONE[p.value][0], TYPE_TONE[p.value][1]) : D.tone('Н |
| | | 63 | | D.boolCol({ field: 'isFinal', headerName: 'Конечный', width: 120 }), |
| | | 64 | | D.colorCol({ |
| | 0 | 65 | | updateUrl: '@Url.Action("UpdateStatusColor", "ClientStatus", new { area = "Studio2" })', |
| | 0 | 66 | | resetUrl: '@Url.Action("ResetStatusColor", "ClientStatus", new { area = "Studio2" })' |
| | | 67 | | }), |
| | | 68 | | D.actionsCol(r => [ |
| | | 69 | | { icon: 'fa-pencil-alt', title: 'Изменить статус', href: editUrl(r.id) }, |
| | 0 | 70 | | { icon: 'fa-trash', title: 'Удалить статус', kind: 'danger', href: '@Url.Action("Delete", "ClientSta |
| | | 71 | | confirm: 'Удалить статус «' + r.name + '»?' } |
| | | 72 | | ], { width: 100 }) |
| | | 73 | | ] |
| | | 74 | | }); |
| | | 75 | | })(); |
| | | 76 | | </script> |
| | | 77 | | } |