< Summary

Information
Class: AspNetCoreGeneratedDocument.Areas_Studio2_Views_PriceHistory_Index
Assembly: OzonOrdersWeb
File(s): /home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/Areas/Studio2/Views/PriceHistory/Index.cshtml
Line coverage
0%
Covered lines: 0
Uncovered lines: 18
Coverable lines: 18
Total lines: 83
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 28
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ExecuteAsync()0%702260%
<ExecuteAsync()0%620%

File(s)

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

#LineLine coverage
 1@using OzonOrdersWeb.Areas.Studio2.ViewModels.Grid
 2@model List<OzonRepositories.Data.Bitrix.PriceHistory>
 3@{
 04    var article = ViewBag.Article as string;
 05    var lastLimit = (int)(ViewBag.LastLimit ?? 0);
 06    ViewData["Title"] = string.IsNullOrEmpty(article) ? "История цен" : $"История цен — {article}";
 07    Layout = "~/Views/Shared/_Layout.cshtml";
 08    var rows = Model.Select(p => new
 09    {
 010        id = p.Id, createDateTime = p.CreateDateTime, article = p.Article, bitrixId = p.BitrixId, priceValue = p.PriceVa
 011        registrationPrice = p.RegistrationPrice, currency = p.Currency, valueSource = p.ValueSource, author = p.Author
 012    });
 13}
 14
 015@await Html.PartialAsync("_BsxGridShell")
 16
 17<div class="container-fluid py-3 bsx-surface">
 18    <div class="app-section-hero app-section-hero--import d-flex flex-wrap justify-content-between align-items-start gap
 19        <div>
 20            <h1><i class="fas fa-chart-line me-2 text-primary"></i>История цен</h1>
 21            <div class="subtitle">
 022                @(string.IsNullOrEmpty(article) ? $"Последние {lastLimit} изменений цен Bitrix" : $"Все записи артикула 
 23            </div>
 24            <div class="app-section-hero__quick-links">
 25                <a asp-area="Studio2" asp-controller="Products" asp-action="Index"><i class="fas fa-box"></i>Товары</a>
 026                @if (!string.IsNullOrEmpty(article))
 27                {
 28                    <a asp-action="Index"><i class="fas fa-history"></i>Последние записи</a>
 29                }
 30            </div>
 31        </div>
 32        <div class="d-flex flex-wrap gap-2 align-items-center">
 33            <form asp-action="Index" method="get" class="d-flex gap-1 align-items-center">
 34                <input type="search" name="article" value="@article" class="form-control form-control-sm" placeholder="А
 35                <button type="submit" class="btn btn-sm btn-outline-primary text-nowrap"><i class="fas fa-search me-1"><
 36            </form>
 37            <a asp-action="Create" class="btn btn-primary btn-sm"><i class="fas fa-plus me-1"></i>Новая запись</a>
 38        </div>
 39    </div>
 40
 041    @if (TempData["SuccessMessage"] != null)
 42    {
 43        <div class="alert alert-success alert-dismissible fade show" role="alert">
 044            <i class="fas fa-check-circle me-2"></i>@TempData["SuccessMessage"]
 45            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
 46        </div>
 47    }
 48    <div asp-validation-summary="ModelOnly" class="text-danger"></div>
 49
 050    @await Html.PartialAsync("_BsxDirectoryGrid", new BsxDirectoryGridViewModel("priceHistory", "Записи", "fa-history", 
 051        "Поиск в таблице — по загруженным записям; вся история артикула — полем «Артикул» вверху. Двойной клик — карточк
 52</div>
 53
 54@section Scripts {
 55<script src="~/js/Studio2/Grid/bsx-directory.js" asp-append-version="true"></script>
 56<script>
 57    (function () {
 58        const D = window.BsxDirectory;
 059        const detailsUrl = id => '@Url.Action("Details", "PriceHistory", new { area = "Studio2" })/' + id;
 60        const money = p => p.value == null ? '—' : Number(p.value).toLocaleString('ru-RU', { minimumFractionDigits: 2, m
 61        D.grid({
 62            key: 'dirPriceHistory',
 63            prefix: 'priceHistory',
 064            rows: @Json.Serialize(rows),
 65            rowUrl: r => detailsUrl(r.id),
 66            columnDefs: [
 67                { field: 'createDateTime', headerName: 'Дата', width: 170, sort: 'desc', filter: 'agDateColumnFilter',
 68                  valueGetter: p => p.data.createDateTime ? new Date(p.data.createDateTime) : null,
 69                  valueFormatter: p => p.value ? p.value.toLocaleString('ru-RU', { day: '2-digit', month: '2-digit', yea
 70                { field: 'article', headerName: 'Артикул', width: 200, cellClass: 'fw-semibold',
 71                  cellRenderer: p => `<a href="?article=${encodeURIComponent(p.value)}" title="Вся история артикула">${B
 72                D.numCol({ field: 'bitrixId', headerName: 'Bitrix ID', width: 120 }),
 73                D.numCol({ field: 'priceValue', headerName: 'Цена', width: 130, cellClass: 'fw-semibold', valueFormatter
 74                D.numCol({ field: 'registrationPrice', headerName: 'Цена регистрации', width: 150, hide: true, valueForm
 75                D.setCol({ field: 'currency', headerName: 'Валюта', width: 110, filterParams: { labels: { '': '—' } }, v
 76                D.setCol({ field: 'valueSource', headerName: 'Источник', flex: 1, minWidth: 180, filterParams: { labels:
 77                D.setCol({ field: 'author', headerName: 'Автор', width: 180, filterParams: { labels: { '': '—' } }, valu
 78                D.actionsCol(r => [{ icon: 'fa-eye', title: 'Детали', kind: 'view', href: detailsUrl(r.id) }], { width: 
 79            ]
 80        });
 81    })();
 82</script>
 83}

Methods/Properties

ExecuteAsync()
<ExecuteAsync()