@model CustomerBackInStockSubscriptionsModel
@using Nop.Core.Domain.Catalog
@{
    Layout = "_ColumnsTwo";

    //title
    NopHtml.AddTitleParts(T("PageTitle.BackInStockSubscriptions").Text);
    //page class
    NopHtml.AppendPageCssClassParts("html-account-page");
    NopHtml.AppendPageCssClassParts("html-back-in-stock-subscription-list-page");
}
@section left
{
    @await Component.InvokeAsync(typeof(CustomerNavigationViewComponent), new { selectedTabId = CustomerNavigationEnum.BackInStockSubscriptions })
}
<div class="page account-page back-in-stock-subscription-list-page">
    <div class="page-title panel-heading">
        <h1>@T("Account.MyAccount") - @T("Account.BackInStockSubscriptions")</h1>
    </div>
    <div class="page-body">
        @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.CustomerBackInStockSubscriptionsTop, additionalData = Model })
        @if (Model.Subscriptions.Count > 0)
        {
        <div class="description alert alert-info">
            @T("Account.BackInStockSubscriptions.Description")
        </div>
        <script asp-location="Footer">
            $(function() {
                $('#selectall').on('click', function () {
                    $('.subscription-list .rowcheckbox').prop('checked', $(this).is(':checked')).trigger('change');
                });

                $('.subscription-list .rowcheckbox').on('change', function (e) {
                    var numChkBoxes = $('.subscription-list .rowcheckbox').length;
                    var numChkBoxesChecked = $('.subscription-list .rowcheckbox:checked').length;
                    $('#selectall').prop('checked', numChkBoxes == numChkBoxesChecked && numChkBoxes > 0);
                });
            });
        </script>
        <form asp-route="CustomerBackInStockSubscriptions" method="post">
            <div class="subscription-list">
                <div class="panel panel-default">
                    <table class="table table table-bordered">
                        <colgroup>
                            <col width="1" />
                            <col />
                        </colgroup>
                        <thead>
                            <tr>
                                <th class="a-center select-boxes">
                                    <input type="checkbox" id="selectall" />
                                </th>
                                <th class="a-center product new-product-iteam">
                                    @T("Account.BackInStockSubscriptions.ProductColumn")
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            @for (var i = 0; i < Model.Subscriptions.Count; i++)
                                {
                                    var item = Model.Subscriptions[i];
                            <tr @(i % 2 == 0 ? Html.Raw(" class=\"odd\"") : Html.Raw(" class=\"even\""))>
                                <td class="a-center select-boxes">
                                    <input type="checkbox" name="biss@(item.Id)" class="rowcheckbox" />
                                </td>
                                <td class="a-left product new-product-iteam">
                                    <a href="@(Url.RouteUrl<Product>(new { SeName = item.SeName }))">@item.ProductName</a>
                                </td>
                            </tr>
                                }
                        </tbody>
                    </table>
                </div>
                @{
                         var pager = await Html.PagerAsync(Model.PagerModel);
                }
                @if (!string.IsNullOrEmpty(await pager.RenderHtmlContentAsync()))
                {
                    <div class="pager">
                        @pager
                    </div>
                }
                <div class="buttons">
                    <button type="submit" class="btn btn-primary delete-selected-biss-button">@T("Account.BackInStockSubscriptions.DeleteSelected")</button>
                </div>
            </div>
        </form>
        }
        else
        {
            <div class="no-data">
                @T("Account.BackInStockSubscriptions.NoSubscriptions")
            </div>
        }
        @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.CustomerBackInStockSubscriptionsBottom, additionalData = Model })
    </div>
</div>