| | | 1 | | @using OzonDomains.Models |
| | | 2 | | @using OzonOrdersWeb.Areas.Studio2.ViewModels.Grid |
| | | 3 | | @model List<ColumnMapping> |
| | | 4 | | @{ |
| | 0 | 5 | | ViewData["Title"] = $"Сопоставления столбцов ({Model.Count} шт.)"; |
| | 0 | 6 | | Layout = "~/Views/Shared/_Layout.cshtml"; |
| | | 7 | | // Все поля записи: переименование в гриде отправляет их в Edit целиком, чтобы не сбросить остальные настройки. |
| | 0 | 8 | | var rows = Model.Select(m => new |
| | 0 | 9 | | { |
| | 0 | 10 | | id = m.Id, |
| | 0 | 11 | | mappingName = m.MappingName, |
| | 0 | 12 | | selectedClientId = m.SelectedClientId, |
| | 0 | 13 | | selectedStatus = m.SelectedStatus, |
| | 0 | 14 | | selectedManufacturerId = m.SelectedManufacturerId, |
| | 0 | 15 | | selectedWarehouseId = m.SelectedWarehouseId, |
| | 0 | 16 | | selectedSupplierId = m.SelectedSupplierId, |
| | 0 | 17 | | selectedCurrencyCode = m.SelectedCurrencyCode?.ToString(), |
| | 0 | 18 | | manufacturerFromArticle = m.ManufacturerFromArticle, |
| | 0 | 19 | | columnMappingsSerialized = m.ColumnMappingsSerialized, |
| | 0 | 20 | | columnsCount = m.ColumnMappings.Count |
| | 0 | 21 | | }); |
| | | 22 | | } |
| | | 23 | | |
| | 0 | 24 | | @await Html.PartialAsync("_BsxGridShell") |
| | | 25 | | |
| | | 26 | | <div class="container-fluid py-3 bsx-surface"> |
| | | 27 | | <div class="app-section-hero app-section-hero--import d-flex flex-wrap justify-content-between align-items-start gap |
| | | 28 | | <div> |
| | | 29 | | <h1><i class="fas fa-columns me-2 text-primary"></i>Сопоставления столбцов</h1> |
| | | 30 | | <div class="subtitle">Правила чтения Excel и CSV-файлов поставщиков</div> |
| | | 31 | | <div class="subtitle-help">Название правится прямо в таблице (клик по ячейке, затем «Сохранить» в строке); п |
| | | 32 | | <div class="app-section-hero__quick-links"> |
| | | 33 | | <a asp-area="Studio2" asp-controller="FileUploadRecords" asp-action="Index"><i class="fas fa-file-arrow- |
| | | 34 | | <a asp-area="Studio2" asp-controller="EmailRoutingRules" asp-action="Index"><i class="fas fa-envelope-op |
| | | 35 | | <a asp-area="Studio2" asp-controller="Orders" asp-action="UploadFile"><i class="fas fa-upload"></i>Загру |
| | | 36 | | </div> |
| | | 37 | | </div> |
| | 0 | 38 | | <div class="bsx-dir-stats"><span class="bsx-dir-stat">Всего <b>@Model.Count</b></span></div> |
| | | 39 | | </div> |
| | | 40 | | |
| | 0 | 41 | | @if (TempData["SuccessMessage"] != null) |
| | | 42 | | { |
| | | 43 | | <div class="alert alert-success alert-dismissible fade show" role="alert"> |
| | 0 | 44 | | <i class="fas fa-check-circle me-2"></i>@TempData["SuccessMessage"] |
| | | 45 | | <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> |
| | | 46 | | </div> |
| | | 47 | | } |
| | 0 | 48 | | @if (TempData["ErrorMessage"] != null) |
| | | 49 | | { |
| | | 50 | | <div class="alert alert-danger alert-dismissible fade show" role="alert"> |
| | 0 | 51 | | <i class="fas fa-exclamation-circle me-2"></i>@TempData["ErrorMessage"] |
| | | 52 | | <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> |
| | | 53 | | </div> |
| | | 54 | | } |
| | | 55 | | |
| | 0 | 56 | | @await Html.PartialAsync("_BsxDirectoryGrid", new BsxDirectoryGridViewModel("columnMapping", "Сопоставления", "fa-co |
| | 0 | 57 | | "Двойной клик — редактирование полей шаблона.")) |
| | | 58 | | </div> |
| | | 59 | | |
| | | 60 | | @section Scripts { |
| | | 61 | | <script src="~/js/Studio2/Grid/bsx-directory.js" asp-append-version="true"></script> |
| | | 62 | | <script> |
| | | 63 | | (function () { |
| | | 64 | | const D = window.BsxDirectory; |
| | 0 | 65 | | const editUrl = id => '@Url.Action("Edit", "ColumnMappings", new { area = "Studio2" })/' + id; |
| | | 66 | | D.grid({ |
| | | 67 | | key: 'dirColumnMapping', |
| | | 68 | | prefix: 'columnMapping', |
| | 0 | 69 | | rows: @Json.Serialize(rows), |
| | | 70 | | rowUrl: r => editUrl(r.id), |
| | | 71 | | onSave: r => D.submit(editUrl(r.id), { |
| | | 72 | | Id: r.id, MappingName: r.mappingName ?? '', SelectedClientId: r.selectedClientId ?? '', SelectedStatus: |
| | | 73 | | SelectedManufacturerId: r.selectedManufacturerId ?? '', SelectedWarehouseId: r.selectedWarehouseId ?? '' |
| | | 74 | | SelectedSupplierId: r.selectedSupplierId ?? '', SelectedCurrencyCode: r.selectedCurrencyCode ?? '', |
| | | 75 | | ManufacturerFromArticle: r.manufacturerFromArticle, ColumnMappingsSerialized: r.columnMappingsSerialized |
| | | 76 | | }), |
| | | 77 | | columnDefs: [ |
| | | 78 | | { field: 'mappingName', headerName: 'Название сопоставления', flex: 1, minWidth: 280, sort: 'asc', edita |
| | | 79 | | D.numCol({ field: 'columnsCount', headerName: 'Колонок', headerTooltip: 'Сопоставлено колонок файла', wi |
| | | 80 | | D.setCol({ field: 'selectedStatus', headerName: 'Статус', width: 180, filterParams: { labels: { '': '(не |
| | | 81 | | D.setCol({ field: 'selectedCurrencyCode', headerName: 'Валюта', width: 110, filterParams: { labels: { '' |
| | | 82 | | D.boolCol({ field: 'manufacturerFromArticle', headerName: 'Произв. из артикула', width: 160 }), |
| | | 83 | | D.numCol({ field: 'id', headerName: 'ID', width: 80 }), |
| | | 84 | | D.actionsCol(r => [ |
| | | 85 | | { icon: 'fa-pencil-alt', title: 'Редактировать сопоставление', href: editUrl(r.id) }, |
| | 0 | 86 | | { icon: 'fa-trash', title: 'Удалить', kind: 'danger', href: '@Url.Action("Delete", "ColumnMappings", |
| | | 87 | | confirm: 'Удалить сопоставление «' + r.mappingName + '»?' } |
| | | 88 | | ], { width: 160 }) |
| | | 89 | | ] |
| | | 90 | | }); |
| | | 91 | | })(); |
| | | 92 | | </script> |
| | | 93 | | } |