@model economy.Models.View<economy.Models.Product.List.Request, economy.Models.Product.List.Response>

@{
    ViewData["Title"] = "품목별 시세";
}

<div class="container">
    <h3>품목별 시세</h3>

     <div class="row mt-3">
        <div class="col align-self-center">
            @((Model?.Response?.Body?.TotalCount ?? 0).ToString("N0")) 개
        </div>
        <div class="col-auto">
            <select name="perPage" id="perPage" class="form-select" asp-for="SelectedListPerPage" asp-items="Model.ListPerPage" form="fSearch"></select>
        </div>
    </div>

    <div class="table-responsive">
        <table id="priceItemList" class="table table-bordered table-hover">
            <caption class="caption-top">
               
            </caption>
            <colgroup>
                <col width="10%"/>
                <col width="30%"/>
                <col width="*"/>
                <col width="20%"/>
            </colgroup>
            <thead>
                <tr>
                    <th>번호</th>
                    <th>품목코드</th>
                    <th>품목명</th>
                    <th>비고</th>
                </tr>
            </thead>
            <tbody>
                @if (Model.Response.Body != null)
                {
                    @foreach (var row in Model.Response.Body.Items.ItemList)
                    {
                        <tr>
                            <td>@row.Rn</td>
                            <td>@row.Ic</td>
                            <td>@row.In</td>
                            <td>
                                @Html.ActionLink("[가격 정보]", "Detail", "Price", new {id=@row.Ic})
                            </td>
                        </tr>
                    }
                }
                else
                {
                    <tr>
                        <td colspan="4">
                            No data.
                        </td>
                    </tr>   
                }
            </tbody>
        </table>
    </div>

    <form id="fSearch" method="get" accept-charset="UTF-8" rel="search" autocomplete="off" asp-controller="Price" asp-action="List">
        <input type="hidden" name="page" value="@Model.Request.PageNo" />
    </form>

    @await Html.PartialAsync("~/Views/Component/Pagination.cshtml", Model.Pagination)

</div>

@section Scripts {
    <script src="~/js/price.js" asp-append-version="true"></script>
}
@section Styles {
    <link href="~/css/style.css" rel="stylesheet" asp-append-version="true" />
}