@model BatchSearchModel

@{
    Layout = "_AdminLayout";
    ViewBag.PageTitle = T("Plugins.Shipping.EasyPost.Batch").Text;
    NopHtml.SetActiveMenuItemSystemName("EasyPost Batches");
}

<div class="content-header clearfix">
    <h1 class="float-left">
        @T("Plugins.Shipping.EasyPost.Batch")
    </h1>
    <div class="float-right">
        <a href="@Url.Action("BatchCreate", "EasyPost")" class="btn btn-primary">
            <i class="fas fa-plus-square"></i>
            @T("Admin.Common.AddNew")
        </a>
    </div>
</div>

<section class="content">
    <div class="container-fluid">
        <div class="form-horizontal">
            <div class="cards-group">
                <div class="card card-default">
                    <div class="card-body">
                        <p>
                            Batch allows you to perform operations on multiple shipments at once. This includes scheduling a pickup, creating a manifest file and consolidating labels.<br />
                            A manifest file can be created to speed up and simplify the carrier pickup process. 
                            The manifest is one document that can be scanned to mark all included tracking codes as "Accepted for Shipment" by the carrier.
                        </p>
                    </div>
                </div>
                <div class="card card-default card-search">
                    <div class="card-body">
                        <div class="row search-row opened">
                            <div class="search-text">@T("Admin.Common.Search")</div>
                            <div class="icon-search"><i class="fas fa-search" aria-hidden="true"></i></div>
                        </div>
                        <div class="search-body">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group row">
                                        <div class="col-md-4">
                                            <nop-label asp-for="StatusId" />
                                        </div>
                                        <div class="col-md-8">
                                            <nop-select asp-for="StatusId" asp-items="Model.AvailableStatuses" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-8 offset-md-4">
                                    <button type="button" id="search-batches" class="btn btn-primary btn-search">
                                        <i class="fas fa-search"></i>
                                        @T("Admin.Common.Search")
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="card card-default">
                    <div class="card-body">
                        @await Html.PartialAsync("Table", new DataTablesModel
                        {
                            Name = "batch-grid",
                            UrlRead = new DataUrl("BatchList", "EasyPost", null),
                            SearchButtonId = "search-batches",
                            Length = Model.PageSize,
                            LengthMenu = Model.AvailablePageSizes,
                            Filters = new List<FilterParameter>
                            {
                                new FilterParameter(nameof(Model.StatusId))
                            },
                            ColumnCollection = new List<ColumnProperty>
                            {
                                new ColumnProperty(nameof(BatchModel.Id))
                                {
                                    Title = "#",
                                    Width = "60"
                                },
                                new ColumnProperty(nameof(BatchModel.Status))
                                {
                                    Title = T("Plugins.Shipping.EasyPost.Batch.Fields.Status").Text
                                },
                                new ColumnProperty(nameof(BatchModel.UpdatedOn))
                                {
                                    Title = T("Plugins.Shipping.EasyPost.Batch.Fields.UpdatedOn").Text,
                                    Width = "200",
                                    Render = new RenderDate()
                                },
                                new ColumnProperty(nameof(BatchModel.CreatedOn))
                                {
                                    Title = T("Plugins.Shipping.EasyPost.Batch.Fields.CreatedOn").Text,
                                    Width = "200",
                                    Render = new RenderDate()
                                },
                                new ColumnProperty(nameof(BatchModel.Id))
                                {
                                    Title = T("Admin.Common.Edit").Text,
                                    Width = "100",
                                    ClassName = NopColumnClassDefaults.Button,
                                    Render = new RenderButtonEdit(new DataUrl("~/Admin/EasyPost/BatchEdit/", false))
                                }
                            }
                        })
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>