< Summary

Information
Class: AspNetCoreGeneratedDocument.Areas_Studio2_Views_Transaction_Index
Assembly: OzonOrdersWeb
File(s): /home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/Areas/Studio2/Views/Transaction/Index.cshtml
Line coverage
0%
Covered lines: 0
Uncovered lines: 334
Coverable lines: 334
Total lines: 1695
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 1344
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/Areas/Studio2/Views/Transaction/Index.cshtml

#LineLine coverage
 1@using OzonDomains
 2@using OzonDomains.Models
 3@using OzonOrdersWeb.ViewModels.TransactionViewModels
 4@using OzonOrdersWeb.Areas.Studio2.ViewHelpers
 5@using Services.FiltersServices.FilterModels
 6@using Services.FiltersServices.SortModels
 7@using Services.TransactionCommentAi
 8
 9
 10
 11@model TransactionViewModel<Transaction, TransactionFilterModel>
 12@{
 013    var fieldMap = Model.OrderListFieldReadAccess;
 014    bool Col(string fieldName) => fieldMap == null || fieldMap.GetValueOrDefault(fieldName, true);
 15}
 16
 17
 18@{
 019    ViewData["Title"] = "Журнал документов";
 020    var clientStatusColors = ViewBag.ClientStatusColors as Dictionary<string, string> ?? new Dictionary<string, string>(
 21}
 22
 23<link rel="stylesheet" href="~/css/orderIndex.css" asp-append-version="true"/>
 24<link rel="stylesheet" href="~/css/table.css" asp-append-version="true"/>
 25<link rel="stylesheet" href="~/css/Studio2/Orders/TransactionsTable.css" asp-append-version="true"/>
 26<link rel="stylesheet" href="~/css/Studio2/Orders/productImageCell.css" asp-append-version="true"/>
 27<link rel="stylesheet" href="~/css/Studio2/Orders/transaction-journal.css" asp-append-version="true"/>
 28
 29<style>
 30    .custom-white { background-color: #fff; }
 31    .custom-gray { background-color: #585858; color: #fff; }
 32    .custom-gray:hover { color: #fff; }
 33    .custom-red { background-color: #DC143C; color: #fff; }
 34    .custom-red:hover { color: #fff; }
 35
 36    .product-popup { display: none; position: absolute; z-index: 1; }
 37    #shipmentTable.transaction-journal-table .product-cell {
 38        width: 100%;
 39        white-space: nowrap;
 40        overflow: hidden;
 41        text-overflow: ellipsis;
 42    }
 43    #shipmentTable.transaction-journal-table .product-cell:hover .product-popup { display: block; }
 44
 45    a { text-decoration: none; }
 46    .horizontal-line { border-top: 1px solid #ccc; margin: 20px 0; }
 47
 48    th.active { background-color: #f4f4f4; }
 49    .button-container { display: flex; gap: 10px; }
 50    .horizontal-inputs { display: flex; align-items: center; }
 51    .horizontal-inputs > div { margin-right: 10px; }
 52    .nowrap { white-space: nowrap; }
 53
 54    .clear-btn {
 55        display: none;
 56        position: absolute;
 57        left: 100%;
 58        transform: translateX(0) translateY(-50%);
 59        z-index: 10;
 60        top: 50%;
 61        opacity: 0;
 62        border: solid 1px;
 63    }
 64    .btn-container:hover .clear-btn,
 65    .clear-btn:hover {
 66        display: block;
 67        opacity: 1;
 68        border: solid 1px;
 69    }
 70    .btn-container { position: relative; display: inline-block; }
 71</style>
 72
 73<div class="transaction-journal-page">
 74
 075@if (ViewBag.ShipmentNumbersSearched != null)
 76{
 077    var searched = ViewBag.ShipmentNumbersSearched as List<string>;
 078    var found = ViewBag.ShipmentNumbersFound as List<string> ?? new List<string>();
 079    var notFound = ViewBag.ShipmentNumbersNotFound as List<string> ?? new List<string>();
 80    <div class="alert alert-info alert-dismissible py-2 mb-2" role="alert">
 81        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
 82        <i class="fas fa-search me-2"></i>
 83        <strong>Результат поиска по номерам заказов:</strong>
 084        найдено <strong>@found.Count</strong> из <strong>@(searched?.Count ?? 0)</strong>
 085        @if (notFound.Count > 0)
 86        {
 087            <span class="text-danger ms-2">не найдено: <strong>@notFound.Count</strong></span>
 88        }
 89        <a class="ms-2" data-bs-toggle="collapse" href="#shipmentSearchDetails" role="button" aria-expanded="false">
 90            <small>подробнее ▾</small>
 91        </a>
 92        <div class="collapse mt-2" id="shipmentSearchDetails">
 93            <div class="row g-2">
 094                @if (found.Count > 0)
 95                {
 96                    <div class="col-auto">
 097                        <strong class="text-success">Найдены (@found.Count):</strong><br/>
 098                        <small>@string.Join(", ", found)</small>
 99                    </div>
 100                }
 0101                @if (notFound.Count > 0)
 102                {
 103                    <div class="col-auto">
 0104                        <strong class="text-danger">Не найдены (@notFound.Count):</strong><br/>
 0105                        <small>@string.Join(", ", notFound)</small>
 106                    </div>
 107                }
 108            </div>
 109        </div>
 110    </div>
 111}
 112
 113<div id="filterEnterHint" class="filter-enter-hint" role="status" hidden>
 114    <i class="fas fa-keyboard" aria-hidden="true"></i>
 115    <span>Нажмите Enter для применения фильтра</span>
 116    <button type="button" class="filter-enter-hint-dismiss" aria-label="Закрыть">&times;</button>
 117</div>
 118
 119<div class="table-container table-edge-flush">
 120<table class="table orders-index-table transaction-table transaction-journal-table" id="shipmentTable">
 121    <colgroup id="tableColgroup"></colgroup>
 122    <form asp-area="Studio2" asp-controller="Transaction" id="filterForm" asp-action="Index" method="post">
 123    <input type="hidden" id="journalTypeFilterHidden" name="Type" value="@Model.FilterModel.Type" />
 124    <input type="hidden" id="journalCreateByFilterHidden" name="CreateBy" value="@Model.FilterModel.CreateBy" />
 125    <input type="hidden" id="journalCreatedDateTimeHidden" name="CreatedDateTime" value="@(Model.FilterModel.CreatedDate
 126    <thead>
 127        <tr>
 0128                @if (Col("ShipmentNumber"))
 129                {
 130                <th id="thShipmentNumber" data-column="shipmentNumber">
 131                    <div class="two-row-cell">
 132                    <div id="thShipmentNumberSort" class="cell-row">
 0133                        <a class="text-dark" asp-action="Index" asp-route-sortOrder="@ViewBag.ShipmentNumberSort">
 0134                            <small>@(ViewBag.ShipmentNumberSort == OrderSortState.ShipmentNumberAsc ? "Номер заказа↑" : 
 135                        </a>
 136                        <div class="shipment-drop-zone" title="Перетащите PDF/Excel с номерами отправлений">
 137                            <input asp-for="@Model.OrderFilterModel.ShipmentNumber" id="shipmentNumberFilter" name="Ship
 138                            <button type="button" id="shipmentAttachBtn" class="shipment-attach-btn" title="Загрузить PD
 139                                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewB
 140                                    <path d="M4.5 3a2.5 2.5 0 0 1 5 0v9a1.5 1.5 0 0 1-3 0V5a.5.5 0 0 1 1 0v7a.5.5 0 0 0 
 141                                </svg>
 142                            </button>
 143                        </div>
 144                    </div>
 145                    <div id="thDeliverySort" class="cell-row">
 0146                        <a class="text-muted" asp-action="Index" asp-route-sortOrder="@ViewBag.DeliverySort" title="Дост
 0147                            <small>@(ViewBag.DeliverySort == OrderSortState.DeliveryAsc ? "Доставка↑" : "Доставка↓")</sm
 148                        </a>
 149                        <div class="position-relative w-100">
 150                            <input asp-for="@Model.OrderFilterModel.Provider"
 151                                   id="deliveryFilter"
 152                                   name="Provider"
 153                                   class="form-control form-control-sm"
 154                                   autocomplete="off" readonly style="cursor:pointer"/>
 155                            <span class="filter-chevron">▾</span>
 156
 0157                            @if (ViewBag.Providers != null)
 158                            {
 159                                <ul id="deliveryDropdown" class="dropdown-menu filter-dropdown-list"
 160                                    style="display: none; position: fixed; z-index: 9999; min-width: 180px; max-height: 
 161                                    <li><a href="#" data-value="Все" style="font-weight: normal;">&nbsp;Все</a></li>
 0162                                    @foreach (var provider in ViewBag.Providers)
 163                                    {
 164                                        <li>
 0165                                            <a href="#" data-value="@provider.Text"
 0166                                               style="font-weight: normal;">&nbsp;@provider.Text</a>
 167                                        </li>
 168                                    }
 169                                </ul>
 170                            }
 171                        </div>
 172                    </div>
 173                    </div>
 174                </th>
 175                }
 176            <th data-column="client">
 177                <div class="two-row-cell">
 0178                    @if (Col("OzonClient"))
 179                    {
 180                    <div id="thOzonClient" class="cell-row">
 0181                        <a class="text-dark" asp-action="Index" asp-route-sortOrder="@ViewBag.OzonClient">
 0182                            <small>@(ViewBag.OzonClient == OrderSortState.OzonClientAsc ? "Клиент↑" : "Клиент↓")</small>
 183                        </a>
 184                        <div class="position-relative w-100">
 185                        <input asp-for="@Model.OrderFilterModel.OzonClient" id="ozonClientFilterInput" name="OzonClient"
 186                        <span class="filter-chevron">▾</span>
 187                        <ul id="ozonClientDropdown" class="dropdown-menu filter-dropdown-list" style="display: none; pos
 188                            <li><a href="#" data-value="Все" style="font-weight: normal;">&nbsp;Все</a></li>
 0189                                @foreach (var client in ViewBag.Clients)
 190                                {
 0191                                <li><a href="#" data-value="@client.Value" style="font-weight: normal;">&nbsp;@client.Te
 192                                }
 193                        </ul>
 194                        </div>
 195                    </div>
 196                    }
 0197                    @if (Col("DeliveryCity"))
 198                    {
 199                    <div id="thDeliveryCity" class="cell-row">
 0200                        <a class="text-muted" asp-action="Index" asp-route-sortOrder="@ViewBag.DeliveryCitySort">
 0201                            <small>@(ViewBag.DeliveryCitySort == OrderSortState.DeliveryCityAsc ? "Город доставки↑" : "Г
 202                        </a>
 203                    <input asp-for="@Model.OrderFilterModel.DeliveryCity" id="deliveryCityFilter" name="DeliveryCity" cl
 204                    </div>
 205                    }
 206                </div>
 207            </th>
 208            <th data-column="dates">
 209                <div class="two-row-cell">
 0210                    @if (Col("ProcessingDate"))
 211                    {
 212                    <div id="thProcessingDate" class="cell-row">
 0213                        <a class="text-dark" asp-action="Index" asp-route-sortOrder="@ViewBag.ProcessingDateSort">
 0214                            <small>@(ViewBag.ProcessingDateSort == OrderSortState.ProcessingDateAsc ? "Принят↑" : "Приня
 215                        </a>
 216                        <input asp-for="@Model.OrderFilterModel.ProcessingDate" id="processingDateFilter" name="Processi
 217                    </div>
 218                    }
 0219                    @if (Col("ShippingDate"))
 220                    {
 221                    <div id="thShippingDate" class="cell-row">
 0222                        <a class="text-muted" asp-action="Index" asp-route-sortOrder="@ViewBag.ShippingDateSort" title="
 0223                            <small>@(ViewBag.ShippingDateSort == OrderSortState.ShippingDateAsc ? "Дата отгр.↑" : "Дата 
 224                        </a>
 225                        <input asp-for="@Model.OrderFilterModel.ShippingDate" id="shippingDateFilter" name="ShippingDate
 226                    </div>
 227                    }
 228                </div>
 229            </th>
 230
 231            <th data-column="period">
 232                <div class="two-row-cell">
 0233                    @if (Col("DeliveryPeriod"))
 234                    {
 235                    <div id="thDeliveryPeriod" class="cell-row">
 0236                        <a class="text-dark" asp-action="Index" asp-route-sortOrder="@ViewBag.DeliveryPeriodSort" title=
 0237                            <small>@(ViewBag.DeliveryPeriodSort == OrderSortState.DeliveryPeriodAsc ? "Срок.↑" : "Срок.↓
 238                        </a>
 239                        <input asp-for="@Model.OrderFilterModel.DeliveryPeriod" name="DeliveryPeriod" id="deliveryPeriod
 240                        <script>
 241                            document.getElementById('deliveryPeriodInput').addEventListener('input', function (e) {
 242                                let input = e.target.value;
 243
 244                                // Проверка и добавление "д." после первой цифры и пробела
 245                                if (input.length > 0 && !input.includes('д.') && input.match(/^\d+ $/)) {
 246                                    e.target.value = input.trim() + ' д. ';
 247                                }
 248
 249                                // Проверка и добавление "ч." после второй цифры и пробела
 250                                const regexDay = /^\d+ д\. \d+ $/;
 251                                if (regexDay.test(input) && !input.includes('ч.')) {
 252                                    e.target.value = input.trim() + ' ч.';
 253                                }
 254
 255                                // Валидация формата
 256                                const pattern = /^\d+ д\. \d+ ч\.$/;
 257                                if (!pattern.test(e.target.value)) {
 258                                    e.target.setCustomValidity('Неверный формат. Используйте формат: X д. Y ч.');
 259                                } else {
 260                                    e.target.setCustomValidity('');
 261                                }
 262                            });
 263                        </script>
 264                    </div>
 265                    }
 0266                    @if (Col("DeliveryPeriod"))
 267                    {
 268                    <div id="thDeliveryPeriod" class="cell-row">
 0269                        <a class="text-muted" asp-action="Index" asp-route-sortOrder="@ViewBag.TimeLeftSort" title="Оста
 0270                            <small>@(ViewBag.TimeLeftSort == OrderSortState.TimeLeftDesc ? "Остал.↑" : "Остал.↓")</small
 271                        </a>
 272                        <input asp-for="@Model.OrderFilterModel.TimeLeftDay" name="TimeLeftDay" id="timeLeftDayInput" cl
 273                    </div>
 274                    }
 275                </div>
 276            </th>
 277
 278            <th class="orders-product-col" data-column="productInfo">
 279                <div class="two-row-cell w-100">
 280                    <div class="cell-row orders-product-head-row1">
 281                        <div id="thArticle" class="orders-product-pair">
 0282                                @if (Col("Article"))
 283                                {
 0284                                <a class="text-dark w-100" asp-action="Index" asp-route-sortOrder="@ViewBag.ArticleSort"
 0285                                    <small>@(ViewBag.ArticleSort == OrderSortState.ArticleAsc ? "Key↑" : "Key↓")</small>
 286                                </a>
 287                                <input asp-for="@Model.OrderFilterModel.Article" id="articleFilter" name="Article" class
 288                                }
 289                        </div>
 290                        <div id="thManufacturer" class="orders-product-pair orders-product-pair-center">
 0291                                @if (Col("Manufacturer"))
 292                                {
 0293                                <a class="text-dark w-100" asp-action="Index" asp-route-sortOrder="@ViewBag.Manufacturer
 0294                                    <small>@(ViewBag.ManufacturerSort == OrderSortState.ManufacturerAsc ? "Производитель
 295                                </a>
 296                                <input asp-for="@Model.OrderFilterModel.Manufacturer" id="manufacturerFilter" name="Manu
 297                                }
 298                        </div>
 299                        <div id="thArticle2" class="orders-product-pair orders-product-pair-end">
 0300                                @if (Col("Article"))
 301                                {
 0302                                <a class="text-dark w-100" asp-action="Index" asp-route-sortOrder="@ViewBag.ArticleSort"
 0303                                    <small>@(ViewBag.ArticleSort == OrderSortState.ArticleAsc ? "Код товара↑" : "Код тов
 304                                </a>
 305                                <input asp-for="@Model.OrderFilterModel.Article" id="articleFilter2" name="Article" clas
 306                                }
 307                        </div>
 308                    </div>
 309                    <div id="thProductName" class="cell-row">
 0310                                @if (Col("ProductName"))
 311                                {
 0312                                <a class="text-muted w-100" asp-action="Index" asp-route-sortOrder="@ViewBag.ProductName
 0313                                    <small>@(ViewBag.ProductNameSort == OrderSortState.ProductNameAsc ? "Наименование то
 314                                </a>
 315                                <input asp-for="@Model.OrderFilterModel.ProductName" id="productNameFilter" name="Produc
 316                                }
 317                    </div>
 318                </div>
 319            </th>
 320            <th data-column="journalActions" class="checkbox-actions-head">
 321                <div class="journal-actions-cell">
 322
 323                    <a asp-area="" asp-controller="Transaction" asp-action="Update" title="Обновить таблицу">
 324                                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" c
 325                                        <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 
 326                                        <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41
 327                                    </svg>
 328                    </a>
 329
 330                    <a href="@Url.Action("DelSortStateCookieForV2")" class="btn btn-link ml-2" title="Очисть поля сортир
 331                        <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-
 332                            <path fill-rule="evenodd" d="M10.082 5.629 9.664 7H8.598l1.789-5.332h1.234L13.402 7h-1.12l-.
 333                            <path d="M12.96 14H9.028v-.691l2.579-3.72v-.054H9.098v-.867h3.785v.691l-2.567 3.72v.054h2.64
 334                        </svg>
 335                        <span class="visually-hidden">Button</span>
 336                    </a>
 337
 338                    <div class="btn-container">
 339                        <button type="button" class="btn btn-link ml-2 hover-btn" onclick="clearForm()" title="Очисть по
 340                            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi
 341                                <path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a
 342                            </svg>
 343                            <span class="visually-hidden">Button</span>
 344                        </button>
 345                    </div>
 346                </div>
 347            </th>
 348
 349            <th class="status-column-head" data-column="status">
 350                <div class="two-row-cell">
 0351                    @if (Col("ClientStatus"))
 352                    {
 353                    <div id="thStatusOzon" class="cell-row">
 0354                        <a class="text-dark" asp-action="Index" asp-route-sortOrder="@ViewBag.StatusSort">
 0355                            <small>@(ViewBag.StatusSort == OrderSortState.StatusAsc ? "Статус клиента↑" : "Статус клиент
 356                        </a>
 357                        <div class="position-relative w-100">
 358                        <input asp-for="@Model.OrderFilterModel.Status" id="statusFilter" name="Status" class="form-cont
 359                        <span class="filter-chevron">▾</span>
 360                        <ul id="statusDropdown" class="dropdown-menu filter-dropdown-list" style="display: none; z-index
 361                            <li><a href="#" data-value="Все">&nbsp;Все</a></li>
 0362                                @foreach (var stat in ViewBag.Statuses)
 363                                {
 0364                                    var isFinal = ViewBag.StatusesIsFinal != null && ViewBag.StatusesIsFinal[stat.Value]
 0365                                    string? clientStatusColor = null;
 0366                                    clientStatusColors.TryGetValue(stat.Value, out clientStatusColor);
 367                                <li>
 368                                    <a href="#"
 0369                                       data-value="@stat.Value"
 0370                                       data-color="@clientStatusColor"
 371                                       class="@(isFinal ? "final-status-item" : "")"
 372                                       style="font-weight:@(isFinal ? "600" : "500");">
 0373                                        @if (isFinal)
 374                                        {
 375                                            <i class="fas fa-flag-checkered me-1 text-warning"></i>
 376                                        }
 0377                                        @stat.Text
 378                                    </a>
 379                                </li>
 380                                }
 381                        </ul>
 382                        </div>
 383                    </div>
 384                    }
 0385                    @if (Col("AppStatus"))
 386                    {
 387                    <div id="thStatus" class="cell-row">
 0388                        <a class="text-muted" asp-action="Index" asp-route-sortOrder="@ViewBag.AppStatusIdSort">
 0389                            <small>@(ViewBag.AppStatusIdSort == OrderSortState.AppStatusIdAsc ? "Статус↑" : "Статус↓")</
 390                        </a>
 391                        <div class="position-relative w-100">
 392                        <input asp-for="@Model.OrderFilterModel.AppStatus" id="appStatusFilterInput" name="AppStatus" cl
 393                        <span class="filter-chevron">▾</span>
 394                        <ul id="appStatusDropdown" class="dropdown-menu filter-dropdown-list" style="display: none; z-in
 395                            <li><a href="#" data-value="Все">&nbsp;Все</a></li>
 0396                                @foreach (var status in ViewBag.AppStatuses)
 397                                {
 0398                                    var appStatusColor = ViewBag.StatusColors != null && ViewBag.StatusColors.ContainsKe
 0399                                        ? ViewBag.StatusColors[status.Value] as string
 0400                                        : "#ffffff";
 0401                                    var isFinal = ViewBag.AppStatusIsFinal != null && ViewBag.AppStatusIsFinal[status.Va
 402                                    <li>
 403                                        <a href="#"
 0404                                           data-value="@status.Value"
 0405                                           data-color="@appStatusColor"
 406                                           class="@(isFinal ? "final-status-item" : "")"
 407                                           style="font-weight:@(isFinal ? "600" : "500");">
 0408                                            @if (isFinal)
 409                                            {
 410                                                <i class="fas fa-flag-checkered me-1 text-warning"></i>
 411                                            }
 0412                                            @status.Text
 413                                        </a>
 414                                    </li>
 415                                }
 416                        </ul>
 417                        </div>
 418                    </div>
 419                    }
 420                </div>
 421            </th>
 422
 423            <th data-column="warehouse">
 424                <div class="two-row-cell">
 0425                    @if (Col("ShipmentWarehouse"))
 426                    {
 427                    <div id="thShipmentWarehouse" class="cell-row">
 0428                        <a class="text-dark" asp-action="Index" asp-route-sortOrder="@ViewBag.ShipmentWarehouseSort">
 0429                            <small>@(ViewBag.ShipmentWarehouseSort == OrderSortState.ShipmentWarehouseIdAsc ? "Склад отг
 430                        </a>
 431                        <div class="position-relative w-100">
 432                        <input asp-for="@Model.OrderFilterModel.ShipmentWarehouse" id="shipmentWarehouseFilter" name="Sh
 433                        <span class="filter-chevron">▾</span>
 434                        <ul id="shipmentWarehouseDropdown" class="dropdown-menu filter-dropdown-list" style="display: no
 435                            <li><a href="#" data-value="Все" style="font-weight: normal;">&nbsp;Все</a></li>
 0436                                @foreach (var warehous in ViewBag.Warehouses)
 437                                {
 0438                                <li><a href="#" data-value="@warehous.Value" style="font-weight: normal;">&nbsp;@warehou
 439                                }
 440                        </ul>
 441                        </div>
 442                    </div>
 443                    }
 0444                    @if (Col("DeliveryPeriod"))
 445                    {
 446                    <div id="thDeliveryPeriod" class="cell-row">
 0447                        <a class="text-muted" asp-action="Index" asp-route-sortOrder="@ViewBag.LastStatusChangeDateSort"
 0448                            <small>@(ViewBag.LastStatusChangeDateSort == OrderSortState.LastStatusChangeDateAsc ? "Дата 
 449                        </a>
 450                        <input asp-for="@Model.OrderFilterModel.LastStatusChangeDate" id="lastStatusChangeDateFilter" na
 451                    </div>
 452                    }
 453                </div>
 454            </th>
 455            <th data-column="supplier">
 456                <div class="two-row-cell">
 0457                    @if (Col("Supplier"))
 458                    {
 459                    <div id="thSupplier" class="cell-row">
 0460                        <a class="text-info" asp-action="Index" asp-route-sortOrder="@ViewBag.SupplierSort">
 0461                            <small>@(ViewBag.SupplierSort == OrderSortState.SupplierAsc ? "Поставщик↑" : "Поставщик↓")</
 462                        </a>
 463                        <div class="position-relative w-100">
 464                        <input asp-for="@Model.OrderFilterModel.Supplier" id="supplierFilter" name="Supplier" class="for
 465                        <span class="filter-chevron">▾</span>
 466                        <ul id="supplierDropdown" class="dropdown-menu filter-dropdown-list" style="display: none; posit
 467                            <li><a href="#" data-value="Все" style="font-weight: normal;">&nbsp;Все</a></li>
 0468                                @foreach (var supplier in ViewBag.Suppliers)
 469                                {
 0470                                <li><a href="#" data-value="@supplier.Value" style="font-weight: normal;">&nbsp;@supplie
 471                                }
 472                        </ul>
 473                        </div>
 474
 475                    </div>
 476                    }
 0477                    @if (Col("SupplierOrderNumber"))
 478                    {
 479                    <div id="thOrderNumberToSupplierSort" class="cell-row">
 0480                        <a class="text-info" asp-action="Index" asp-route-sortOrder="@ViewBag.OrderNumberToSupplierSort"
 0481                            <small>@(ViewBag.OrderNumberToSupplierSort == OrderSortState.OrderNumberToSupplierAsc ? "Ном
 482                        </a>
 483                        <input asp-for="@Model.OrderFilterModel.OrderNumberToSupplier" id="orderNumberToSupplierFilter" 
 484                    </div>
 485                    }
 486                </div>
 487            </th>
 488            <th data-column="category">
 489                <div class="two-row-cell">
 0490                    @if (Col("Category"))
 491                    {
 492                    <div id="thCategory" class="cell-row">
 0493                        <a class="text-dark" asp-action="IndexV2" asp-route-sortOrder="@ViewBag.CategorySort">
 0494                            <small>@(ViewBag.CategorySort == OrderSortState.CategoryAsc ? "Категория↑" : "Категория↓")</
 495                        </a>
 496                        <input asp-for="@Model.OrderFilterModel.CommercialCategory" id="commercialCategoryFilter" name="
 497                    </div>
 498                    }
 0499                    @if (Col("VolumeWeight"))
 500                    {
 501                    <div id="thVolume" class="cell-row" title="Объемный вес">
 0502                        <a class="text-muted" asp-action="IndexV2" asp-route-sortOrder="@ViewBag.VolumeSort">
 0503                            <small>@(ViewBag.VolumeSort == OrderSortState.VolumeAsc ? "Вес V↑" : "Вес V↓")</small>
 504                        </a>
 505                        <input asp-for="@Model.OrderFilterModel.VolumetricWeight" id="volumetricWeightFilter" name="Volu
 506                    </div>
 507                    }
 508                </div>
 509            </th>
 510            <th data-column="sitePrice">
 511                <div class="two-row-cell">
 0512                    @if (Col("SitePrice"))
 513                    {
 514                    <div id="thPurchasePrice" class="cell-row">
 0515                        <a class="text-dark" asp-action="IndexV2" asp-route-sortOrder="@ViewBag.CurrentPriceSort" title=
 0516                            <small>@(ViewBag.CurrentPriceSort == OrderSortState.CurrentPriceAsc ? "Цена с.↑" : "Цена с.↓
 517                        </a>
 518                        <input asp-for="@Model.OrderFilterModel.CurrentPriceWithDiscount" id="currentPriceWithDiscountFi
 519                    </div>
 520                    }
 0521                    @if (Col("Quantity"))
 522                    {
 523                    <div id="thQuantity" class="cell-row">
 0524                        <a class="text-muted" asp-action="IndexV2" asp-route-sortOrder="@ViewBag.QuantitySort">
 0525                            <small>@(ViewBag.QuantitySort == OrderSortState.QuantityAsc ? "Кол.↑" : "Кол.↓")</small>
 526                        </a>
 527                        <input asp-for="@Model.OrderFilterModel.Quantity" id="quantityFilter" name="Quantity" class="for
 528                    </div>
 529                    }
 530                </div>
 531            </th>
 532            <th data-column="price">
 533                <div class="two-row-cell">
 0534                    @if (Col("Price"))
 535                    {
 536                    <div id="thPrice" class="cell-row">
 0537                        <a class="text-dark" asp-action="IndexV2" asp-route-sortOrder="@ViewBag.PriceSort">
 0538                            <small>@(ViewBag.PriceSort == OrderSortState.PriceAsc ? "Цена↑" : "Цена↓")</small>
 539                        </a>
 540                        <input asp-for="@Model.OrderFilterModel.Price" id="priceFilter" name="Price" class="form-control
 541                    </div>
 542                    }
 543
 0544                    @if (Col("ShipmentTotal"))
 545                    {
 546                    <div id="thShipmentAmount" class="cell-row">
 0547                        <a class="text-muted" asp-action="IndexV2" asp-route-sortOrder="@ViewBag.ShipmentAmountSort" tit
 0548                            <small>@(ViewBag.ShipmentAmountSort == OrderSortState.ShipmentAmountAsc ? "Сумма о.↑" : "Сум
 549                        </a>
 550                        <input asp-for="@Model.OrderFilterModel.ShipmentAmount" id="shipmentAmountFilter" name="Shipment
 551                    </div>
 552                    }
 553                </div>
 554            </th>
 555            <th data-column="purchasePrice">
 556                <div class="two-row-cell">
 0557                    @if (Col("PurchasePrice"))
 558                    {
 559                    <div id="thCurrentPrice" class="cell-row">
 0560                        <a class="text-info" asp-action="IndexV2" asp-route-sortOrder="@ViewBag.PurchasePriceSort" title
 0561                            <small>@(ViewBag.PurchasePriceSort == OrderSortState.PurchasePriceAsc ? "Цена зак.↑" : "Цена
 562                        </a>
 563                        <input asp-for="@Model.OrderFilterModel.PurchasePrice" id="purchasePriceFilter" name="PurchasePr
 564                    </div>
 565                    }
 0566                    @if (Col("Cost"))
 567                    {
 568                    <div id="thCostPriceсе" class="cell-row">
 0569                        <a class="text-muted" asp-action="IndexV2" asp-route-sortOrder="@ViewBag.CostPriceсеSort" title=
 0570                            <small>@(ViewBag.CostPriceсеSort == OrderSortState.CostPriceAsc ? "Себест.↑" : "Себес.↓")</s
 571                        </a>
 572                        <input asp-for="@Model.OrderFilterModel.CostPrice" id="costPriceFilter" name="CostPrice" class="
 573                    </div>
 574                    }
 575                </div>
 576            </th>
 0577                @if (Col("OzonCommission"))
 578                {
 579                <th id="thOzonCommission" data-column="commission" class="tx-metric-col">
 580                    <div class="two-row-cell">
 581                        <div class="cell-row">
 0582                            <a class="text-dark" asp-action="IndexV2" asp-route-sortOrder="@ViewBag.OzonCommissionSort" 
 0583                                <small>@(ViewBag.OzonCommissionSort == OrderSortState.MinOzonCommissionAsc ? "Комис.↑" :
 584                            </a>
 585                        </div>
 586                        <div class="cell-row">
 587                            <div class="tx-metric-hint text-muted d-flex gap-1">
 588                                <small>min</small><small>/</small><small>max</small>
 589                            </div>
 590                            <input asp-for="@Model.OrderFilterModel.OzonCommission" id="ozonCommissionFilter" name="Ozon
 591                        </div>
 592                    </div>
 593                </th>
 594                }
 0595                @if (Col("Profit"))
 596                {
 597                <th id="thProfit" data-column="profit" class="tx-metric-col">
 598                    <div class="two-row-cell">
 599                        <div class="cell-row">
 0600                            <a class="text-dark" asp-action="Index" asp-route-sortOrder="@ViewBag.ProfitSort" title="При
 0601                                <small>@(ViewBag.ProfitSort == OrderSortState.ProfitAsc ? "Приб.↑" : "Приб.↓")</small>
 602                            </a>
 603                            <button type="button" class="btn btn-link p-0 ms-1 tx-metric-filter-btn @((Model.OrderFilter
 604                                    data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false"
 605                                    title="Расширенный фильтр прибыли">
 606                                <i class="fas fa-filter"></i>
 607                            </button>
 608                            <div class="dropdown-menu p-2 shadow tx-metric-filter-menu" style="min-width: 170px; font-si
 609                                <div class="d-flex gap-1 mb-1">
 610                                    <button type="button"
 611                                            class="btn btn-xs px-1 py-0 @((Model.OrderFilterModel?.OnlyNegativeProfit ??
 612                                            style="font-size: 11px;"
 613                                            onclick="toggleProfitFilter('negative')" title="Только убыточные">
 614                                        Убыток
 615                                    </button>
 616                                    <button type="button"
 617                                            class="btn btn-xs px-1 py-0 @((Model.OrderFilterModel?.OnlyPositiveProfit ??
 618                                            style="font-size: 11px;"
 619                                            onclick="toggleProfitFilter('positive')" title="Только прибыльные">
 620                                        Прибыль
 621                                    </button>
 622                                </div>
 623                                <div class="input-group input-group-sm mb-1">
 624                                    <span class="input-group-text px-1" style="font-size: 11px;">&gt;</span>
 625                                    <input id="profitMinFilter" name="ProfitMin"
 626                                           value="@(Model.OrderFilterModel?.ProfitMin?.ToString())"
 627                                           class="form-control form-control-sm" placeholder="мин."
 628                                           onchange="document.getElementById('filterForm').submit()" />
 629                                </div>
 630                                <div class="input-group input-group-sm">
 631                                    <span class="input-group-text px-1" style="font-size: 11px;">&lt;</span>
 632                                    <input id="profitMaxFilter" name="ProfitMax"
 633                                           value="@(Model.OrderFilterModel?.ProfitMax?.ToString())"
 634                                           class="form-control form-control-sm" placeholder="макс."
 635                                           onchange="document.getElementById('filterForm').submit()" />
 636                                </div>
 637                            </div>
 638                        </div>
 639                        <div class="cell-row">
 640                            <div class="tx-metric-hint text-muted d-flex gap-1">
 641                                <small>min</small><small>/</small><small>max</small>
 642                            </div>
 643                            <input asp-for="OrderFilterModel.Profit" id="profitFilter" name="Profit" type="text" class="
 644                        </div>
 645                        <input type="hidden" id="onlyNegativeProfitHidden" name="OnlyNegativeProfit" value="@((Model.Ord
 646                        <input type="hidden" id="onlyPositiveProfitHidden" name="OnlyPositiveProfit" value="@((Model.Ord
 647                    </div>
 648                </th>
 649                }
 0650                @if (Col("MarkupPercent"))
 651                {
 652                <th id="thDiscount" data-column="markup" class="tx-metric-col">
 653                    <div class="two-row-cell">
 654                        <div class="cell-row">
 0655                            <a class="text-dark" asp-action="Index" asp-route-sortOrder="@ViewBag.DiscountSort" title="Н
 0656                                <small>@(ViewBag.DiscountSort == OrderSortState.DiscountAsc ? "Нацен.%↑" : "Нацен.%↓")</
 657                            </a>
 658                            <button type="button" class="btn btn-link p-0 ms-1 tx-metric-filter-btn @((Model.OrderFilter
 659                                    data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false"
 660                                    title="Расширенный фильтр наценки">
 661                                <i class="fas fa-filter"></i>
 662                            </button>
 663                            <div class="dropdown-menu p-2 shadow tx-metric-filter-menu" style="min-width: 170px; font-si
 664                                <div class="mb-1">
 665                                    <button type="button"
 666                                            class="btn btn-xs px-1 py-0 w-100 @((Model.OrderFilterModel?.OnlyNegativeDis
 667                                            style="font-size: 11px;"
 668                                            onclick="toggleDiscountFilter('negative')" title="Только отрицательная нацен
 669                                        Отрицательные
 670                                    </button>
 671                                </div>
 672                                <div class="input-group input-group-sm mb-1">
 673                                    <span class="input-group-text px-1" style="font-size: 11px;">&gt;%</span>
 674                                    <input id="discountMinFilter" name="DiscountMin"
 675                                           value="@(Model.OrderFilterModel?.DiscountMin?.ToString())"
 676                                           class="form-control form-control-sm" placeholder="мин."
 677                                           onchange="document.getElementById('filterForm').submit()" />
 678                                </div>
 679                                <div class="input-group input-group-sm">
 680                                    <span class="input-group-text px-1" style="font-size: 11px;">&lt;%</span>
 681                                    <input id="discountMaxFilter" name="DiscountMax"
 682                                           value="@(Model.OrderFilterModel?.DiscountMax?.ToString())"
 683                                           class="form-control form-control-sm" placeholder="макс."
 684                                           onchange="document.getElementById('filterForm').submit()" />
 685                                </div>
 686                            </div>
 687                        </div>
 688                        <div class="cell-row">
 689                            <div class="tx-metric-hint text-muted d-flex gap-1">
 690                                <small>min</small><small>/</small><small>max</small>
 691                            </div>
 692                            <input asp-for="OrderFilterModel.Discount" id="discountFilter" name="Discount" type="text" c
 693                        </div>
 694                        <input type="hidden" id="onlyNegativeDiscountHidden" name="OnlyNegativeDiscount" value="@((Model
 695                    </div>
 696                </th>
 697                }
 698
 699
 700        </tr>
 701        <tr class="tx-journal-filter-row">
 702            <form asp-area="Studio2" asp-controller="Transaction" id="filterTransactForm" asp-action="Index" method="pos
 703
 704            <td colspan="2">
 705                <div class="d-flex align-items-center">
 706                    <div class="btn-container">
 707                        <button type="button" class="btn btn-link ml-2 hover-btn" onclick="clearTransactForm()" title="О
 708                            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi
 709                                <path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a
 710                            </svg>
 711                            <span class="visually-hidden">Button</span>
 712                        </button>
 713                    </div>
 714                    <div class="position-relative w-100 flex-grow-1">
 0715                    <input asp-for="@Model.FilterModel.Type" id="typeFilterInput" value="@ViewData["DisplayName"]" class
 716                    <span class="filter-chevron">▾</span>
 717                    <input type="hidden" id="typeFilterValue" name="Type" value="@Model.FilterModel.Type" />
 718                    </div>
 719                </div>
 720
 721                <ul id="typeDropdown" class="dropdown-menu filter-dropdown-list" style="display: none; position: fixed; 
 722                    <li><a href="#" data-value="All">Все</a></li>
 0723                        @foreach (var tuple in Model.TransactionTypes)
 724                        {
 0725                            var transactionType = tuple.Item1;
 0726                            var displayName = tuple.Item2;
 0727                        <li><a href="#" data-value="@transactionType">@displayName</a></li>
 728                        }
 729                </ul>
 730            </td>
 731
 732
 733
 734                <td colspan="2">
 735                    <div class="position-relative w-100">
 736                    <input asp-for="@Model.FilterModel.CreateBy" id="createByFilterInput" name="CreateBy" class="form-co
 737                    <span class="filter-chevron">▾</span>
 738                    <ul id="createByDropdown" class="dropdown-menu filter-dropdown-list" style="display: none; position:
 739                            <li><a href="#" data-value="Все">Все</a></li>
 0740                                @foreach (var type in Model.UserNames)
 741                                {
 0742                                    <li><a href="#" data-value="@type">@type</a></li>
 743                                }
 744                        </ul>
 745                    </div>
 746                </td>
 747
 748                <td colspan="1">
 749                    <!-- Поле ввода для CreateBy -->
 750                    <input asp-for="@Model.FilterModel.CreatedDateTime" id="createdDateTimeFilter" class="form-control f
 751                </td>
 752
 753                <td colspan="11">
 754                <button type="submit" class="btn btn-primary" style="display: none;">Применить</button>
 755                </td>
 756            </form>
 757        </tr>
 758    </thead>
 759    <button type="submit" id="submitFilterButton" style="display:none;"></button>
 760    </form>
 761
 762    <tbody>
 0763        @foreach (var transaction in Model.Items)
 764        {
 765
 0766            @if(transaction.Orders.Count != 0)
 767            {
 768                <tr class="tx-journal-group-row">
 769                    <td colspan="2">
 0770                        <b>Тип:</b> <span class="@GetTransactionTypeColorClass(transaction.Type)">@GetTransactionTypeDis
 0771                        @if (!string.IsNullOrEmpty(transaction.Comment))
 772                        {
 773                            <b>Комментарий:</b>
 0774                            @if (TransactionCommentAiConstants.IsGeneratingPlaceholder(transaction.Comment))
 775                            {
 776                                <span class="text-muted fst-italic" title="@transaction.Comment">Комментарий генерируетс
 777                            }
 778                            else
 779                            {
 780                                <span title="@transaction.Comment">
 0781                                    @(transaction.Comment.Length > 30
 0782                                        ? transaction.Comment.Substring(0, 30) + "..."
 0783                                        : transaction.Comment)
 784                                </span>
 785                            }
 786                        }
 787                    </td>
 788
 789                    @{
 790                        string GetTransactionTypeDisplayName(TransactionType? type)
 791                        {
 0792                            return type switch
 0793                            {
 0794                                TransactionType.OrderedToSupplier => "Заказан поставщику",
 0795                                TransactionType.ShippedBySupplier => "Отгружен поставщиком",
 0796                                TransactionType.ShippedToSeller => "Отгружен реализатору",
 0797                                TransactionType.OrderedToSeller => "Заказан реализатору",
 0798                                TransactionType.ShippedToClient => "Отгружен клиенту",
 0799                                TransactionType.Percentage => "Проценён",
 0800                                TransactionType.ReceiptNote => "Приходная накладная",
 0801                                TransactionType.AcceptedToWarehouse => "Принят на складе",
 0802                                TransactionType.ToCancellation => "К отмене",
 0803                                TransactionType.Cancelled => "Отменен",
 0804                                TransactionType.CustomerReturn => "Возврат покупателя",
 0805                                TransactionType.WarehouseChange => "Изменение склада",
 0806                                TransactionType.ReturnToSupplier => "Возвращено поставщику",
 0807                                TransactionType.ReturnToWarehouse => "Возврат на склад",
 0808                                TransactionType.WarehouseTransfer => "Перемещен между складами",
 0809                                TransactionType.ShippedToCommissioner => "Отгружен комиссионеру",
 0810                                TransactionType.ReturnTransfer => "Перемещение",
 0811                                TransactionType.LostByCommissioner => "Утерян реализатором",
 0812                                TransactionType.All => "Все",
 0813                                _ => "Неизвестный тип транзакции",
 0814                            };
 815                        }
 816
 817                        string GetTransactionTypeColorClass(TransactionType? type)
 818                        {
 0819                            return type switch
 0820                            {
 0821                                TransactionType.OrderedToSupplier => "text-success fw-bold", // Зеленый
 0822                                TransactionType.ShippedBySupplier => "text-info fw-bold", // Голубой
 0823                                TransactionType.ShippedToSeller => "text-warning fw-bold", // Желтый/оранжевый
 0824                                TransactionType.OrderedToSeller => "text-secondary fw-bold", // Серый
 0825                                TransactionType.ShippedToClient => "text-success fw-bold", // Зеленый
 0826                                TransactionType.Percentage => "text-primary fw-bold", // Синий
 0827                                TransactionType.ReceiptNote => "text-info fw-bold", // Голубой
 0828                                TransactionType.AcceptedToWarehouse => "text-info fw-bold", // Голубой
 0829                                TransactionType.ToCancellation => "text-secondary fw-bold", // Серый
 0830                                TransactionType.Cancelled => "text-danger fw-bold", // Красный
 0831                                TransactionType.CustomerReturn => "text-warning fw-bold", // Желтый/оранжевый
 0832                                TransactionType.WarehouseChange => "text-primary fw-bold", // Синий
 0833                                TransactionType.ReturnToSupplier => "text-warning fw-bold", // Желтый/оранжевый
 0834                                TransactionType.ReturnToWarehouse => "text-info fw-bold", // Голубой
 0835                                TransactionType.WarehouseTransfer => "text-primary fw-bold", // Синий
 0836                                TransactionType.ShippedToCommissioner => "text-primary fw-bold", // Синий
 0837                                TransactionType.LostByCommissioner => "text-danger fw-bold", // Красный
 0838                                _ => "text-muted",
 0839                            };
 840                        }
 841                    }
 842
 843                    <td colspan="2">
 844                        <b>Пользователь:</b><br />
 0845                        @Html.Raw(transaction.CreateBy?.Trim())
 846                    </td>
 847
 848                    <td colspan="1">
 849                        <b>Дата и время:</b><br />
 0850                        @transaction.FormattedCreatedTimeDateTime
 851                    </td>
 852                    <td colspan="11">
 0853                        <a href="#" class="text-decoration-none st2-transaction-excel-export" data-transaction-id="@tran
 854                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi
 855                                <path d="M5.884 6.68a.5.5 0 1 0-.768.64L7.349 10l-2.233 2.68a.5.5 0 0 0 .768.64L8 10.781
 856                                <path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2M9.5 3A1.5 1.5
 857                            </svg>
 858                            Распечатать Excel
 859                        </a>
 860                        <a href="Studio2/Transaction/PrintTransactionToPdf?transactionId=@transaction.Id" class="text-de
 861                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi
 862                                <path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2M9.5 3A1.5 1.5
 863                                <path d="M4.603 14.087a.81.81 0 0 1-.438-.42c-.195-.388-.13-.776.08-1.102.198-.307.526-.
 864                            </svg>
 865                            Распечатать PDF
 866                        </a>
 867                    </td>
 868                </tr>
 0869                @foreach (var item in transaction.Orders)
 870                {
 871                    string rowClass;
 0872                    rowClass = item.AppStatus?.Name == "Заказан поставщику" ? "table-success" : "custom-white";
 0873                    rowClass = item.AppStatus?.Name == "Отгружен поставщиком" ? "table-info" : rowClass;
 0874                    rowClass = item.AppStatus?.Name == "Отгружен реализатору" ? "table-warning" : rowClass;
 0875                    rowClass = item.AppStatus?.Name == "Заказан реализатору" ? "table-secondary" : rowClass;
 0876                    rowClass = item.Status == "Отменен" ? "custom-gray" : rowClass;
 0877                    if (item.IsReturnable == true)
 878                    {
 0879                        rowClass = "custom-red";
 880                    }
 881
 882
 883
 884                    <tr class=@rowClass oncontextmenu="showInfoAtCursor('@item.Id', event); return false;">
 0885                        @if (Col("ShipmentNumber"))
 886                        {
 887                            <td data-column="shipmentNumber" class="@(item.UpdatedColumns != null && item.UpdatedColumns
 888                                <div class="orders-shipment-content d-flex flex-column" style="min-width: 0;">
 889                                    <div class="d-flex align-items-center">
 0890                                    @if (item.ExcelFileData != null)
 891                                    {
 892                                        <a href="@Url.Action("ViewFile", new { filePath = item.ExcelFileData.FolderName,
 893                                            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="current
 894                                                <path fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H
 895                                            </svg>
 896                                        </a>
 897                                    }
 898
 899                                    <span class="ml-2" onclick="copyArticle(this)" role="button">
 0900                                        @Html.DisplayFor(modelItem => item.ShipmentNumber)
 0901                                        @if (item.ShipmentNumber != null && item.ShipmentNumber != "" && Model.UniqueNum
 902                                        {
 0903                                            <a href="javascript:void(0);" onclick="setShipmentNumberFilter('@item.Shipme
 904                                        }
 905                                    </span>
 906                                    </div>
 0907                                    @if (!string.IsNullOrEmpty(item.Delivery?.Name))
 908                                    {
 909                                        <div class="orders-shipment-delivery-detail text-muted" style="white-space: nowr
 910                                            @{
 0911                                                var deliveryFullName = item.Delivery.Name;
 0912                                                if (deliveryFullName.Length > 30)
 913                                                {
 0914                                                    deliveryFullName = deliveryFullName.Substring(0, 30) + "...";
 915                                                }
 916                                            }
 0917                                            @deliveryFullName
 918                                        </div>
 919                                    }
 920                                </div>
 921                            </td>
 922
 923
 924                        }
 925                        <td>
 0926                            @if (Col("OzonClient"))
 927                            {
 928                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("OzonClient") 
 0929                                    @if (item.OzonClient != null)
 930                                    {
 0931                                        string ozonClient = item.OzonClient.Name;
 0932                                        if (ozonClient.Length > 18)
 933                                        {
 0934                                            ozonClient = ozonClient.Substring(0, 18) + "...";
 935                                        }
 0936                                        @ozonClient
 937                                    }
 938                                </div>
 939                            }
 0940                            @if (Col("DeliveryCity"))
 941                            {
 0942                                @if (item.DeliveryCity != null && item.DeliveryCity != "")
 943                                {
 944                                    <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("DeliveryC
 945                                        @{
 0946                                            string deliveryCity = item.DeliveryCity;
 0947                                            if (deliveryCity.Length > 11)
 948                                            {
 0949                                                deliveryCity = deliveryCity.Substring(0, 11) + "...";
 950                                            }
 0951                                            @deliveryCity
 952                                        }
 0953                                        @if (Model.UniqueDeliveryCitys.ContainsKey(item.DeliveryCity) && Model.UniqueDel
 954                                        {
 0955                                            <a href="javascript:void(0);" onclick="setDeliveryCityFilter('@item.Delivery
 956                                        }
 957                                    </div>
 958                                }
 959                            }
 0960                            @if (!string.IsNullOrEmpty(item.TrackingNumber))
 961                            {
 962                                <div class="text-muted" style="white-space: nowrap;" title="@item.TrackingNumber">
 0963                                    <small>@item.TrackingNumber</small>
 964                                </div>
 965                            }
 966                        </td>
 967
 968                        <td data-column="dates">
 0969                            @if (Col("ProcessingDate"))
 970                            {
 971                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("ProcessingDat
 0972                                    @OrderDateDisplay.FormatTableDateFull(item.ProcessingDate)
 973                                </div>
 974                            }
 975
 0976                            @if (Col("ShippingDate"))
 977                            {
 978                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("ShippingDate"
 0979                                    @OrderDateDisplay.FormatTableDateFull(item.ShippingDate)
 980                                </div>
 981                            }
 982                        </td>
 983
 984                        <td>
 0985                            @if (Col("DeliveryPeriod"))
 986                            {
 987                                <div style="white-space: nowrap; text-align: right;">
 0988                                    <div title="@Html.DisplayFor(modelItem => item.FormattedDeliveryDay) @Html.DisplayFo
 989                                </div>
 990                            }
 0991                            @if (Col("DeliveryPeriod"))
 992                            {
 993                                <div style="white-space: nowrap; text-align: right;" class="text-muted">
 0994                                    @Html.DisplayFor(modelItem => item.FormattedTimeLeftDay)
 995                                </div>
 996                            }
 997                        </td>
 998
 999                        <td class="orders-product-col" data-column="productInfo" style="padding-left: 2px; padding-right
 1000                            <div class="d-flex orders-product-cell">
 01001                                @if (!string.IsNullOrEmpty(item.ProductInfo?.ImageUrl))
 1002                                {
 1003                                    <img src="@item.ProductInfo.ImageUrl"
 1004                                         alt="@(item.ProductName ?? item.ProductKey)"
 1005                                         class="product-thumb flex-shrink-0"
 1006                                         onerror="this.style.display='none'"
 1007                                         loading="lazy" />
 1008                                }
 1009
 1010                                <div class="orders-product-text-grid">
 1011                                    <div class="orders-product-top-row">
 01012                                        @if (Col("Article"))
 1013                                        {
 1014                                            <div id="thArticle"
 1015                                                 class="product-key-cell d-flex align-items-center min-w-0 @(item.Update
 1016                                                 style="white-space: nowrap;"
 01017                                                 data-tooltip="@(item.ProductKey)">
 1018                                                <span class="custom-product-link">
 01019                                                    @item.ProductKey
 1020                                                </span>
 1021
 01022                                                @if (item.ProductKey != null && item.ProductKey != "" && @Model.UniqueAr
 1023                                                {
 01024                                                    <a href="javascript:void(0);" onclick="setArticleFilter('@item.Produ
 1025                                                }
 1026                                            </div>
 1027                                        }
 1028
 01029                                        @if (Col("Manufacturer"))
 1030                                        {
 1031                                            <div id="thManufacturer"
 1032                                                 class="product-manufacturer-cell d-flex flex-column nowrap text-center"
 1033                                                 style="padding: 0 2px;">
 01034                                                @(item.EtProducer?.Name ?? "")
 1035                                            </div>
 1036                                        }
 1037
 01038                                        @if (Col("Article"))
 1039                                        {
 1040                                            <div id="thArticle2"
 1041                                                 class="article-and-replacement-cell d-flex flex-column nowrap text-end 
 1042                                                 style="max-width: 100%;">
 1043                                                <div class="d-flex align-items-center">
 1044                                                    <div style="white-space: nowrap; overflow: hidden; text-overflow: cl
 01045                                                        @if (item.Article != null)
 1046                                                        {
 01047                                                            @Html.DisplayFor(modelItem => item.Article)
 1048                                                        }
 1049                                                    </div>
 1050                                                </div>
 1051                                            </div>
 1052                                        }
 1053                                    </div>
 1054
 01055                                    @if (Col("ProductName"))
 1056                                    {
 1057                                        <div id="thProductName"
 1058                                             class="text-muted"
 1059                                             style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; widt
 01060                                             data-tooltip="@Html.DisplayFor(modelItem => item.ProductName)">
 1061                                            <div class="product-cell"
 1062                                                 title="@Html.DisplayFor(modelItem => item.ProductName)"
 1063                                                 style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"
 01064                                                @Html.DisplayFor(modelItem => item.ProductName)
 1065                                            </div>
 1066                                        </div>
 1067                                    }
 1068                                </div>
 1069                            </div>
 1070                        </td>
 1071
 1072                        <td class="btn-col" data-column="journalActions">
 1073                        </td>
 1074
 1075                        <td>
 01076                            @if (Col("ClientStatus"))
 1077                            {
 1078                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("Status") ? "b
 01079                                    @if (item.Status != null)
 1080                                    {
 01081                                        string status = item.Status;
 01082                                        if (status.Length > 14)
 1083                                        {
 01084                                            status = status.Substring(0, 14) + "...";
 1085                                        }
 01086                                        @status
 1087                                    }
 1088                                    else
 1089                                    {
 1090                                        <br />
 1091                                    }
 1092
 1093                                </div>
 1094                            }
 1095
 01096                            @if (Col("AppStatus"))
 1097                            {
 1098                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("AppStatusId")
 1099                                    @{
 01100                                        string? appStatus = item.AppStatus?.Name;
 01101                                        if (appStatus != null && appStatus.Length > 14)
 1102                                        {
 01103                                            appStatus = appStatus.Substring(0, 14) + "...";
 1104                                        }
 1105
 01106                                        var bgAppStatusColor = item.AppStatus?.StatusColor?.ColorCode ?? "transparent";
 01107                                        var textColor = StatusColorContrast.GetTextColor(bgAppStatusColor);
 1108                                    }
 1109
 1110                                    <div class="nowrap status-color-badge"
 1111                                         style="font-size: 13px;
 1112                                             --status-badge-bg:@bgAppStatusColor;
 1113                                             --status-badge-fg:@textColor;
 1114                                             background-color:@bgAppStatusColor;
 1115                                         color:@textColor;
 1116                                         padding: 2px 5px;
 1117                                         border-radius: 4px;
 1118                                         font-weight: normal;
 1119                                         display: inline-block;">
 01120                                    @appStatus
 1121                                    </div>
 1122                                </div>
 1123                            }
 1124                        </td>
 1125
 1126                        <td>
 01127                            @if (Col("ShipmentWarehouse"))
 1128                            {
 1129                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("ShipmentWareh
 01130                                    @(item.ShipmentWarehouse?.Name)
 1131                                </div>
 1132                            }
 01133                            @if (Col("ShipmentWarehouse"))
 1134                            {
 1135                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("AppStatusId")
 01136                                    @Html.DisplayFor(modelItem => item.FormattedLastStatusChangeDate)
 1137                                </div>
 1138                            }
 1139                        </td>
 1140
 1141                        <td>
 01142                            @if (Col("Supplier"))
 1143                            {
 1144                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("SupplierId") 
 01145                                    @(item.Supplier?.Name ?? "")
 1146                                </div>
 1147                            }
 1148
 01149                            @if (Col("SupplierOrderNumber"))
 1150                            {
 1151                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("OrderNumberTo
 01152                                    @Html.DisplayFor(modelItem => item.OrderNumberToSupplier)
 1153                                </div>
 1154                            }
 1155                        </td>
 1156
 1157                        <td>
 01158                        @if (Col("Category"))
 1159                        {
 1160                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("ProductInfoId
 01161                                @if (!string.IsNullOrEmpty(item.ProductInfo?.CommercialCategory))
 1162                                {
 01163                                    string сommercialCategory = item.ProductInfo!.CommercialCategory;
 01164                                    if (сommercialCategory.Length > 10)
 1165                                    {
 01166                                        сommercialCategory = сommercialCategory.Substring(0, 10) + "...";
 1167                                    }
 01168                                    @сommercialCategory
 1169                                }
 1170
 1171                                </div>
 1172                        }
 1173
 01174                        @if (Col("VolumeWeight"))
 1175                        {
 1176                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("ProductInfoId
 01177                                @if (item.ProductInfo != null)
 1178                                {
 01179                                    @Html.DisplayFor(modelItem => item.ProductInfo.VolumetricWeight)
 1180                                }
 1181                                </div>
 1182                        }
 1183                        </td>
 1184
 1185                        <td>
 01186                        @if (Col("SitePrice"))
 1187                        {
 1188                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("ProductInfoId
 01189                                @if (item.ProductInfo?.CurrentPriceWithDiscount != null)
 1190                                {
 01191                                    @Html.Raw(string.Format("{0:N0}", item.ProductInfo.CurrentPriceWithDiscount).Replace
 1192                                }
 1193                                </div>
 1194                        }
 01195                        @if (Col("Quantity"))
 1196                        {
 1197                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("Quantity") ? 
 1198                                <span class="@(item.Quantity > 1 ? "qty-value--multi" : "")">
 01199                                    @Html.DisplayFor(modelItem => item.Quantity)
 1200                                </span>
 1201                                </div>
 1202                        }
 1203                        </td>
 1204
 1205                        <td>
 01206                        @if (Col("Price"))
 1207                        {
 1208                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("Price") ? "bg
 01209                                @Html.Raw(string.Format("{0:N0}", item.Price).Replace(",", " "))
 1210                                </div>
 1211                        }
 1212
 01213                        @if (Col("ShipmentTotal"))
 1214                        {
 1215                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("ShipmentAmoun
 01216                                @Html.Raw(string.Format("{0:N0}", item.ShipmentAmount).Replace(",", " "))
 1217                                </div>
 1218                        }
 1219                        </td>
 1220
 1221
 1222
 1223                        <td>
 01224                        @if (Col("PurchasePrice"))
 1225                        {
 1226                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("PurchasePrice
 1227                                    <p style="display: inline; white-space: nowrap; margin: 0;">
 01228                                    @Html.Raw(string.Format("{0:N0}", item.PurchasePrice).Replace(",", " "))
 1229                                    </p>
 01230                                @if (item.OriginalPurchasePrice != null)
 1231                                {
 1232                                        <div style="display: inline-block; white-space: nowrap; margin: 0; font-size: 10
 1233                                            <div>
 01234                                            @Html.Raw(string.Format("{0:N0}", item.OriginalPurchasePrice).Replace(",", "
 1235                                            </div>
 1236                                            <div>
 01237                                            @(item.Supplier?.CurrencyCode)
 1238                                            </div>
 1239                                        </div>
 1240
 1241
 1242                                }
 1243                                </div>
 1244                        }
 1245
 01246                        @if (Col("Cost"))
 1247                        {
 1248                                <div class="@(item.UpdatedColumns != null && item.UpdatedColumns.Contains("CostPrice") ?
 01249                                @Html.Raw(string.Format("{0:N0}", item.CostPrice).Replace(",", " "))
 1250                                </div>
 1251                        }
 1252
 1253                        </td>
 01254                        @if (Col("OzonCommission"))
 1255                        {
 1256                                <td data-column="commission">
 1257                                    <div class="two-row-cell @(item.UpdatedColumns != null && (item.UpdatedColumns.Conta
 1258                                        <div class="cell-row justify-content-end">
 01259                                            @Html.Raw(string.Format("{0:N0}", item.MinOzonCommission).Replace(",", " "))
 1260                                        </div>
 1261                                        <div class="cell-row justify-content-end">
 01262                                            @Html.Raw(string.Format("{0:N0}", item.MaxOzonCommission).Replace(",", " "))
 1263                                        </div>
 1264                                    </div>
 1265                                </td>
 1266                        }
 1267
 01268                        @if (Col("Profit"))
 1269                        {
 1270                            <td data-column="profit">
 1271                                <div class="two-row-cell @(item.UpdatedColumns != null && (item.UpdatedColumns.Contains(
 1272                                    <div class="cell-row justify-content-end">
 01273                                        @if (item.MaxProfit.HasValue)
 1274                                        {
 01275                                            if (item.MaxProfit < 0)
 1276                                            {
 01277                                                <span style="color:red">@Html.Raw(string.Format("{0:N0}", item.MaxProfit
 1278                                            }
 1279                                            else
 1280                                            {
 01281                                                @Html.Raw(string.Format("{0:N0}", item.MaxProfit.Value).Replace(",", " "
 1282                                            }
 1283                                        }
 1284                                        else
 1285                                        {
 1286                                            <text>0</text>
 1287                                        }
 1288                                    </div>
 1289                                    <div class="cell-row justify-content-end">
 01290                                        @if (item.MinProfit.HasValue)
 1291                                        {
 01292                                            if (item.MinProfit < 0)
 1293                                            {
 01294                                                <span style="color:red">@Html.Raw(string.Format("{0:N0}", item.MinProfit
 1295                                            }
 1296                                            else
 1297                                            {
 01298                                                @Html.Raw(string.Format("{0:N0}", item.MinProfit.Value).Replace(",", " "
 1299                                            }
 1300                                        }
 1301                                        else
 1302                                        {
 1303                                            <text>0</text>
 1304                                        }
 1305                                    </div>
 1306                                </div>
 01307                                @if (item.TargetShipmentProfit135.HasValue)
 1308                                {
 01309                                    var targetText = string.Format("{0:N0}", item.TargetShipmentProfit135.Value).Replace
 01310                                    var targetSlashPrefix = item.MaxProfit.HasValue && item.MaxProfit.Value != 0 ? "/ " 
 1311                                    <div class="orders-profit-target-detail text-muted"
 1312                                         title="Целевая прибыль 13,5% от суммы отправления"
 1313                                         style="white-space: nowrap; font-size: 0.75em;">
 01314                                        @targetSlashPrefix@targetText
 1315                                    </div>
 1316                                }
 1317                            </td>
 1318                        }
 1319
 01320                        @if (Col("MarkupPercent"))
 1321                        {
 1322                                <td data-column="markup">
 1323                                    <div class="two-row-cell @(item.UpdatedColumns != null && item.UpdatedColumns.Contai
 1324                                        <div class="cell-row justify-content-end">
 01325                                            @if (item.MaxDiscount < 0)
 1326                                            {
 01327                                                <span style="color:red">@Html.Raw(string.Format("{0:N0}", item.MaxDiscou
 1328                                            }
 1329                                            else
 1330                                            {
 01331                                                @Html.Raw(string.Format("{0:N0}", item.MaxDiscount).Replace(",", " "))
 1332                                            }
 1333                                        </div>
 1334                                        <div class="cell-row justify-content-end">
 01335                                            @if (item.MinDiscount < 0)
 1336                                            {
 01337                                                <span style="color:red">@Html.Raw(string.Format("{0:N0}", item.MinDiscou
 1338                                            }
 1339                                            else
 1340                                            {
 01341                                                @Html.Raw(string.Format("{0:N0}", item.MinDiscount).Replace(",", " "))
 1342                                            }
 1343                                        </div>
 1344                                    </div>
 1345                                </td>
 1346                        }
 1347                    </tr>
 1348                }
 1349            }
 1350            else
 1351            {
 1352                <tr>
 1353                    <td colspan="18">
 1354                        <h>Записи перенесены в другую сессию</h>
 1355                    </td>
 1356                </tr>
 1357            }
 1358        }
 1359    </tbody>
 1360</table>
 1361</div>
 1362
 1363<div class="pagination-wrapper d-flex justify-content-center">
 1364    <div class="pagination-controls">
 01365        @if (Model.TotalPages > 15)
 1366        {
 01367            if (Model.PageNumber <= 8)
 1368            {
 01369                @for (int i = 1; i <= 10; i++)
 1370                {
 01371                    <a asp-action="Index" asp-route-page="@(i)" class="btn btn-primary @(i == Model.PageNumber ? "active
 1372                }
 1373                <span>...</span>
 01374                <a asp-action="Index" asp-route-page="@Model.TotalPages" class="btn btn-primary">@(Model.TotalPages)</a>
 1375            }
 01376            else if (Model.PageNumber >= Model.TotalPages - 7)
 1377            {
 1378                <a asp-action="Index" asp-route-page="1" class="btn btn-primary">1</a>
 1379                <span>...</span>
 01380                @for (int i = Model.TotalPages - 9; i <= Model.TotalPages; i++)
 1381                {
 01382                    <a asp-action="Index" asp-route-page="@(i)" class="btn btn-primary @(i == Model.PageNumber ? "active
 1383                }
 1384            }
 1385            else
 1386            {
 1387                <a asp-action="Index" asp-route-page="1" class="btn btn-primary">1</a>
 1388                <span>...</span>
 01389                @for (int i = Model.PageNumber - 5; i <= Model.PageNumber + 5; i++)
 1390                {
 01391                    <a asp-action="Index" asp-route-page="@(i)" class="btn btn-primary @(i == Model.PageNumber ? "active
 1392                }
 1393                <span>...</span>
 01394                <a asp-action="Index" asp-route-page="@Model.TotalPages" class="btn btn-primary">@(Model.TotalPages)</a>
 1395            }
 1396        }
 1397        else
 1398        {
 01399            @for (int i = 1; i <= Model.TotalPages; i++)
 1400            {
 01401                <a asp-action="Index" asp-route-page="@(i)" class="btn btn-primary @(i == Model.PageNumber ? "active" : 
 1402            }
 1403            <span>...</span>
 1404        }
 1405    </div>
 1406</div>
 1407
 1408<script>
 01409    window.statusColors = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(ViewBag.StatusColors ?? new Dictionary<str
 01410    window.clientStatusColors = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(ViewBag.ClientStatusColors ?? new Di
 1411</script>
 1412
 1413<script src="~/js/clearForm.js" asp-append-version="true"></script>
 1414<script src="~/js/copyArticle.js" asp-append-version="true"></script>
 1415<script src="~/js/setFilters.js" asp-append-version="true"></script>
 1416<script src="~/js/Studio2/Transaction/journal-page.js" asp-append-version="true"></script>
 1417<script src="~/js/Studio2/Orders/orders-filter-dropdowns.js" asp-append-version="true"></script>
 1418
 1419<div class="modal fade" id="historyModal" tabindex="-1" aria-labelledby="historyModalLabel" aria-hidden="true">
 1420    <div class="modal-dialog modal-dialog-centered modal-fullscreen">
 1421        <div class="modal-content">
 1422            <div class="modal-header">
 1423                <h5 class="modal-title" id="historyModalLabel">История заказа</h5>
 1424                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
 1425            </div>
 1426            <div class="modal-body">
 1427                <div id="historyContent"></div>
 1428            </div>
 1429        </div>
 1430    </div>
 1431</div>
 1432
 1433
 1434<script>
 1435    function clearTransactForm() {
 1436        var form = document.getElementById('filterTransactForm');
 1437
 1438        var elements = form.elements;
 1439
 1440        for (var i = 0; i < elements.length; i++) {
 1441            var element = elements[i];
 1442            if (element.tagName === 'INPUT' || element.tagName === 'SELECT') {
 1443                element.value = '';
 1444            }
 1445        }
 1446        // Сбросить булевые флаги прибыли/наценки
 1447        var bools = ['onlyNegativeProfitHidden', 'onlyPositiveProfitHidden', 'onlyNegativeDiscountHidden'];
 1448        bools.forEach(function(id) {
 1449            var el = document.getElementById(id);
 1450            if (el) el.value = 'false';
 1451        });
 1452        // Сбросить числовые поля min/max
 1453        ['profitMinFilter', 'profitMaxFilter', 'discountMinFilter', 'discountMaxFilter'].forEach(function(id) {
 1454            var el = document.getElementById(id);
 1455            if (el) el.value = '';
 1456        });
 1457        form.submit();
 1458    }
 1459
 1460    function toggleProfitFilter(mode) {
 1461        var negHidden = document.getElementById('onlyNegativeProfitHidden');
 1462        var posHidden = document.getElementById('onlyPositiveProfitHidden');
 1463        var negBtn = document.querySelector('[onclick="toggleProfitFilter(\'negative\')"]');
 1464        var posBtn = document.querySelector('[onclick="toggleProfitFilter(\'positive\')"]');
 1465        if (!negHidden || !posHidden) return;
 1466        if (mode === 'negative') {
 1467            var newVal = negHidden.value !== 'true';
 1468            negHidden.value = newVal ? 'true' : 'false';
 1469            posHidden.value = 'false';
 1470            if (negBtn) negBtn.classList.toggle('active', newVal);
 1471            if (posBtn) posBtn.classList.remove('active');
 1472        } else {
 1473            var newVal = posHidden.value !== 'true';
 1474            posHidden.value = newVal ? 'true' : 'false';
 1475            negHidden.value = 'false';
 1476            if (posBtn) posBtn.classList.toggle('active', newVal);
 1477            if (negBtn) negBtn.classList.remove('active');
 1478        }
 1479        if (typeof window.markJournalFilterEdited === 'function') {
 1480            window.markJournalFilterEdited();
 1481        }
 1482    }
 1483
 1484    function toggleDiscountFilter(mode) {
 1485        var hidden = document.getElementById('onlyNegativeDiscountHidden');
 1486        var btn = document.querySelector('[onclick="toggleDiscountFilter(\'negative\')"]');
 1487        if (!hidden) return;
 1488        var newVal = hidden.value !== 'true';
 1489        hidden.value = newVal ? 'true' : 'false';
 1490        if (btn) btn.classList.toggle('active', newVal);
 1491        if (typeof window.markJournalFilterEdited === 'function') {
 1492            window.markJournalFilterEdited();
 1493        }
 1494    }
 1495</script>
 1496
 1497<div id="infoWindow"></div>
 1498
 1499<script>
 1500    // Функция для отображения окна с информацией по координатам курсора при нажатии на правую кнопку мыши
 1501    function showInfoAtCursor(itemId, event) {
 1502        console.log(itemId)
 1503        if (event.button === 2) { // Проверяем, что нажата правая кнопка мыши
 1504            // Создаем или получаем окно
 1505            var infoWindow = document.getElementById("infoWindow");
 1506            if (!infoWindow) return;
 1507
 1508            // Задаем позицию окна в соответствии с положением курсора
 1509            infoWindow.style.left = (event.clientX + 10) + "px"; // +10 для отступа от курсора по горизонтали
 1510            infoWindow.style.top = (event.clientY + 10) + "px"; // +10 для отступа от курсора по вертикали
 1511
 1512
 1513            // Заполняем окно информацией
 1514            infoWindow.innerHTML = '';
 1515            infoWindow.innerHTML += '<div class="context-menu-item"><a href="/Studio2/OrderHistory/GetOrderHistory?order
 01516            infoWindow.innerHTML += '<div class="context-menu-item"><a href="/Studio2/Orders/MultiplayEdit?ids=' + itemI
 1517
 1518            // Показываем окно
 1519            infoWindow.style.display = "block";
 1520
 1521            // Предотвращаем стандартное контекстное меню браузера
 1522            event.preventDefault();
 1523
 1524            // Скрытие окна при клике вне его
 1525            document.addEventListener("click", function (event) {
 1526                if (infoWindow && !infoWindow.contains(event.target)) {
 1527                    hideInfo();
 1528                }
 1529            });
 1530        }
 1531    }
 1532
 1533    // Функция для скрытия окна с информацией
 1534    function hideInfo() {
 1535        var infoWindow = document.getElementById("infoWindow");
 1536        if (infoWindow) {
 1537            infoWindow.style.display = "none";
 1538        }
 1539    }
 1540    document.addEventListener('DOMContentLoaded', function () {
 1541        // Чтение значения куки 'PageSize'
 1542        var pageSize = getCookie('PageSize');
 1543        var pageSizeEl = document.getElementById('pageSize');
 1544        if (pageSize && pageSizeEl) {
 1545            // Установка значения куки в поле ввода
 1546            pageSizeEl.value = parseInt(pageSize);
 1547        }
 1548    });
 1549
 1550    // Функция для чтения значения куки
 1551    function getCookie(name) {
 1552        var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
 1553        if (match) return match[2];
 1554    }
 1555</script>
 1556
 1557<script>
 1558    function formatHistoryTableDate(value) {
 1559        return window.OrderDateDisplay ? window.OrderDateDisplay.formatTableDate(value) : (value ? new Date(value).toLoc
 1560    }
 1561
 1562    function formatHistoryFullDateTime(value) {
 1563        return window.OrderDateDisplay ? window.OrderDateDisplay.formatFullDateTime(value) : (value ? new Date(value).to
 1564    }
 1565
 1566    function getHistory(orderId) {
 1567        // Отправка запроса на сервер для получения истории заказа
 1568        var historyContainer = document.getElementById('historyContent');
 1569        if (window.SkeletonLoader && historyContainer) {
 1570            SkeletonLoader.lines(historyContainer, { count: 8 });
 1571            $('#historyModal').modal('show');
 1572        }
 1573        $.ajax({
 1574            url: '/Orders/GetHistory/' + orderId,
 1575            type: 'GET',
 1576            success: function (data) {
 1577
 1578                if (window.SkeletonLoader && historyContainer) SkeletonLoader.finish(historyContainer);
 1579
 1580                var orderHistory = data.result;
 1581                // Заполнение таблицы модального окна полученной информацией
 1582                var historyContent = '<table class="table table-striped"><thead><tr><th>Номер заказа</th><th>Клиент</th>
 1583                for (var i = 0; i < orderHistory.length; i++) {
 1584                    var order = orderHistory[i].order;
 1585
 1586                    console.log(order)
 1587                    // Получаем даты создания и изменения
 1588                    var createdDate = formatHistoryFullDateTime(orderHistory[i].start);
 1589
 1590                    var modifiedDate = formatHistoryFullDateTime(orderHistory[i].end);
 1591
 1592                    var rowClass = order.isAccepted ? "table-success" : "table-active";
 1593
 1594                    // Добавляем даты создания и изменения на всю ширину строки
 1595                    historyContent += '<tr class="' + rowClass + '">'
 1596                    if (i == 0) {
 1597                        historyContent += '<td colspan="24">' + '<b>Новый</b>' + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Созда
 1598                    }
 1599                    else {
 1600                        historyContent += '<td colspan="24">' + '<b>Создан:</b>' + createdDate + '&nbsp;&nbsp;&nbsp;&nbs
 1601                        historyContent += '<button class="btn btn-primary" onclick="recoverOrder(' + order.id + ', \'' +
 1602                    }
 1603                    historyContent += '<tr class="' + rowClass + '">';
 1604                    // Добавляем информацию о заказе
 1605                    historyContent += '<tr>';
 1606                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("S
 1607                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("O
 1608                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("P
 1609                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("S
 1610                    historyContent += '<td>' + (order.formattedDeliveryPeriod != null ? order.formattedDeliveryPeriod : 
 1611                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("S
 1612                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("A
 1613                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("P
 1614                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("A
 1615                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("A
 1616                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("S
 1617                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("S
 1618                    historyContent += '<td style="text-align: right;" class="' + ((order.updatedColumns != null && order
 1619                    historyContent += '<td style="text-align: right;" class="' + ((order.updatedColumns != null && order
 1620                    historyContent += '<td style="text-align: center;" class="' + ((order.updatedColumns != null && orde
 1621                    historyContent += '<td style="text-align: right;" class="' + ((order.updatedColumns != null && order
 1622                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("P
 1623                    historyContent += '<td style="text-align: center;" class="' + ((order.updatedColumns != null && orde
 1624                    historyContent += '<td style="text-align: right;" class="' + ((order.updatedColumns != null && order
 1625                    historyContent += '<td style="text-align: right;" class="' + ((order.updatedColumns != null && (orde
 1626                    historyContent += '<td style="text-align: right;" class="' + ((order.updatedColumns != null && order
 1627                    historyContent += '<td style="text-align: right;" class="' + ((order.updatedColumns != null && order
 1628                    historyContent += '<td style="text-align: right;" class="' + ((order.updatedColumns != null && order
 1629                    historyContent += '<td class="' + ((order.updatedColumns != null && order.updatedColumns.includes("D
 1630                    historyContent += '</tr>';
 1631
 1632
 1633
 1634                }
 1635                historyContent += '</tbody></table>';
 1636                // Вставка таблицы в модальное окно
 1637                $('#historyContent').html(historyContent);
 1638                // Отображение модального окна
 1639                $('#historyModal').modal('show');
 1640            },
 1641            error: function () {
 1642                if (window.SkeletonLoader && historyContainer) {
 1643                    SkeletonLoader.finish(historyContainer);
 1644                    historyContainer.innerHTML = '<div class="alert alert-danger mb-0">Не удалось загрузить историю зака
 1645                    $('#historyModal').modal('show');
 1646                }
 1647                console.error('Ошибка при получении истории заказа');
 1648            }
 1649        });
 1650    }
 1651    function getCurrencyCode(currencyCode) {
 1652        switch (currencyCode) {
 1653            case 0:
 1654                return 'Нет';
 1655            case 1:
 1656                return 'USD';
 1657            case 2:
 1658                return 'EUR';
 1659            case 3:
 1660                return 'RUB';
 1661            case 4:
 1662                return 'BYN';
 1663            default:
 1664                return '';
 1665        }
 1666    }
 1667</script>
 1668
 01669@await Html.PartialAsync("~/Areas/Studio2/Views/Shared/_ChannelTaskModal.cshtml")
 1670<script src="~/js/st2-channel-task.js" asp-append-version="true"></script>
 1671<script>
 1672    document.addEventListener('click', async function (e) {
 1673        const btn = e.target.closest('.st2-transaction-excel-export');
 1674        if (!btn) return;
 1675        e.preventDefault();
 1676        if (!window.St2ChannelTask) return;
 1677        const txId = btn.getAttribute('data-transaction-id');
 1678        if (!txId) return;
 1679        const startUrl = `/Studio2/Transaction/StartTransactionExcelTask?transactionId=${encodeURIComponent(txId)}&table
 1680        try {
 1681            await St2ChannelTask.run({
 1682                startUrl,
 1683                startMethod: 'GET',
 1684                statusUrl: taskId => St2ChannelTask.channelStatusUrl(taskId),
 1685                downloadUrl: taskId => St2ChannelTask.channelDownloadUrl(taskId),
 1686                modalId: 'st2ChannelTaskModal',
 1687                triggerBtn: btn,
 1688                loadingHtml: '<span class="spinner-border spinner-border-sm"></span>',
 1689                resultKind: 'File'
 1690            });
 1691        } catch (_) { }
 1692    });
 1693</script>
 1694
 1695</div><!-- /.transaction-journal-page -->