| | | 1 | | @model OzonOrdersWeb.Areas.OneCFresh.ViewModels.ContractsViewModel |
| | | 2 | | @{ |
| | 0 | 3 | | ViewData["Title"] = "Договоры контрагентов"; |
| | 0 | 4 | | var totalPages = Model.TotalCount == 0 ? 1 : (int)Math.Ceiling(Model.TotalCount / (double)Model.PageSize); |
| | | 5 | | } |
| | | 6 | | |
| | | 7 | | <div class="d-flex align-items-center gap-2 mb-3"> |
| | | 8 | | <h5 class="mb-0 fw-semibold"> |
| | 0 | 9 | | <i class="bi bi-file-text me-2 text-primary"></i>@ViewData["Title"] |
| | | 10 | | </h5> |
| | 0 | 11 | | <span class="badge bg-secondary">@Model.TotalCount</span> |
| | 0 | 12 | | @if (Model.CounterpartyGuid.HasValue && Model.CounterpartyNames.TryGetValue(Model.CounterpartyGuid.Value, out var ct |
| | | 13 | | { |
| | 0 | 14 | | <span class="badge bg-info text-dark">@ctName</span> |
| | | 15 | | } |
| | | 16 | | </div> |
| | | 17 | | |
| | 0 | 18 | | @if (TempData["Error"] is string err) |
| | | 19 | | { |
| | 0 | 20 | | <div class="alert alert-danger py-2 small">@err</div> |
| | | 21 | | } |
| | | 22 | | |
| | | 23 | | <form method="get" asp-area="OneCFresh" asp-controller="Catalog" asp-action="Contracts" class="row g-2 align-items-end m |
| | | 24 | | <div class="col-12 col-md-4"> |
| | | 25 | | <label class="form-label form-label-sm mb-1 text-muted">Контрагент</label> |
| | | 26 | | <select name="counterpartyGuid" class="form-select form-select-sm" id="counterpartyFilter"> |
| | | 27 | | <option value="">— Все контрагенты —</option> |
| | 0 | 28 | | @foreach (var cp in Model.AllCounterparties) |
| | | 29 | | { |
| | 0 | 30 | | <option value="@cp.RefKey" selected="@(Model.CounterpartyGuid == cp.RefKey ? "selected" : null)">@cp.Des |
| | | 31 | | } |
| | | 32 | | </select> |
| | | 33 | | </div> |
| | | 34 | | <div class="col-12 col-md-4"> |
| | | 35 | | <label class="form-label form-label-sm mb-1 text-muted">Договор</label> |
| | | 36 | | <input class="form-control form-control-sm" name="search" value="@Model.Search" placeholder="Поиск по наименован |
| | | 37 | | </div> |
| | | 38 | | <div class="col-auto align-self-end"> |
| | | 39 | | <button type="submit" class="btn btn-primary btn-sm"><i class="bi bi-search me-1"></i>Найти</button> |
| | 0 | 40 | | @if (Model.CounterpartyGuid.HasValue || !string.IsNullOrWhiteSpace(Model.Search)) |
| | | 41 | | { |
| | | 42 | | <a asp-area="OneCFresh" asp-controller="Catalog" asp-action="Contracts" class="btn btn-outline-secondary btn |
| | | 43 | | <i class="bi bi-x-lg"></i> Сбросить |
| | | 44 | | </a> |
| | | 45 | | } |
| | | 46 | | </div> |
| | | 47 | | </form> |
| | | 48 | | |
| | | 49 | | <div class="table-responsive"> |
| | | 50 | | <table class="table table-sm table-hover onec-table border"> |
| | | 51 | | <thead class="table-light"> |
| | | 52 | | <tr> |
| | | 53 | | <th>Номер / Наименование</th> |
| | | 54 | | <th>Контрагент</th> |
| | | 55 | | <th>GUID</th> |
| | | 56 | | <th>Статус</th> |
| | | 57 | | </tr> |
| | | 58 | | </thead> |
| | | 59 | | <tbody> |
| | 0 | 60 | | @foreach (var item in Model.Items) |
| | | 61 | | { |
| | | 62 | | <tr class="@(item.DeletionMark ? "text-muted" : "")"> |
| | 0 | 63 | | <td class="fw-semibold">@item.Description</td> |
| | | 64 | | <td> |
| | 0 | 65 | | @if (Model.CounterpartyNames.TryGetValue(item.Owner, out var name)) |
| | | 66 | | { |
| | 0 | 67 | | <a asp-area="OneCFresh" asp-controller="Catalog" asp-action="Counterparties" asp-route-searc |
| | 0 | 68 | | @name |
| | | 69 | | </a> |
| | | 70 | | } |
| | | 71 | | else |
| | | 72 | | { |
| | 0 | 73 | | <span class="font-monospace text-muted" style="font-size:.75rem">@item.Owner.ToString().ToUp |
| | | 74 | | } |
| | | 75 | | </td> |
| | 0 | 76 | | <td class="font-monospace text-muted" style="font-size:.75rem">@item.RefKey.ToString().ToUpper()</td |
| | | 77 | | <td> |
| | 0 | 78 | | @if (item.DeletionMark) |
| | | 79 | | { |
| | | 80 | | <span class="badge badge-deleted">Удалён</span> |
| | | 81 | | } |
| | | 82 | | else |
| | | 83 | | { |
| | | 84 | | <span class="badge bg-success">Активен</span> |
| | | 85 | | } |
| | | 86 | | </td> |
| | | 87 | | </tr> |
| | 0 | 88 | | } |
| | 0 | 89 | | @if (!Model.Items.Any()) |
| | | 90 | | { |
| | | 91 | | <tr><td colspan="4" class="text-center text-muted py-3">Договора не найдены</td></tr> |
| | | 92 | | } |
| | | 93 | | </tbody> |
| | | 94 | | </table> |
| | | 95 | | </div> |
| | | 96 | | |
| | 0 | 97 | | @if (totalPages > 1) |
| | | 98 | | { |
| | | 99 | | <nav> |
| | | 100 | | <ul class="pagination pagination-sm"> |
| | 0 | 101 | | @for (var i = 1; i <= Math.Min(totalPages, 20); i++) |
| | | 102 | | { |
| | | 103 | | <li class="page-item @(i == Model.Page ? "active" : "")"> |
| | | 104 | | <a class="page-link" asp-area="OneCFresh" asp-controller="Catalog" asp-action="Contracts" |
| | 0 | 105 | | asp-route-search="@Model.Search" asp-route-counterpartyGuid="@Model.CounterpartyGuid" |
| | 0 | 106 | | asp-route-page="@i" asp-route-pageSize="@Model.PageSize">@i</a> |
| | | 107 | | </li> |
| | | 108 | | } |
| | | 109 | | </ul> |
| | | 110 | | </nav> |
| | | 111 | | } |