@model LanguageSearchModel

@{
    //page title
    ViewBag.PageTitle = T("Admin.Configuration.Languages").Text;
    //active menu item (system name)
    NopHtml.SetActiveMenuItemSystemName("Languages");
}


<div class="content-header clearfix">
    <h1 class="float-left">
        @T("Admin.Configuration.Languages")
    </h1>
    <div class="float-right">
        <a asp-action="Create" class="btn btn-primary">
            <i class="fas fa-square-plus"></i>
            @T("Admin.Common.AddNew")
        </a>
        @await Component.InvokeAsync(typeof(AdminWidgetViewComponent), new { widgetZone = AdminWidgetZones.LanguageListButtons, additionalData = Model })
    </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">
                        <nop-doc-reference asp-string-resource="@T("Admin.Documentation.Reference.Localization", Docs.Localization + Utm.OnAdmin)" />

                        @await Html.PartialAsync("Table", new DataTablesModel
                        {
                            Name = "languages-grid",
                            RowIdBasedOnField = nameof(LanguageModel.Name),
                            UrlRead = new DataUrl("List", "Language", null),
                            Length = Model.PageSize,
                            LengthMenu = Model.AvailablePageSizes,
                            ColumnCollection = new List<ColumnProperty>
                            {
                                new ColumnProperty(nameof(LanguageModel.Name))
                                {
                                    Title = T("Admin.Configuration.Languages.Fields.Name").Text
                                },
                                new ColumnProperty(nameof(LanguageModel.FlagImageFileName))
                                {
                                    Title = T("Admin.Configuration.Languages.Fields.FlagImage").Text,
                                    Width = "100",
                                    ClassName =  NopColumnClassDefaults.CenterAll,
                                    Render = new RenderPicture(Url.Content("~/images/flags/"))
                                },
                                new ColumnProperty(nameof(LanguageModel.LanguageCulture))
                                {
                                    Title = T("Admin.Configuration.Languages.Fields.LanguageCulture").Text,
                                    Width = "200"
                                },
                                new ColumnProperty(nameof(LanguageModel.DisplayOrder))
                                {
                                    Title = T("Admin.Configuration.Languages.Fields.DisplayOrder").Text,
                                    Width = "150",
                                    ClassName =  NopColumnClassDefaults.CenterAll
                                },
                                new ColumnProperty(nameof(LanguageModel.Published))
                                {
                                    Title = T("Admin.Configuration.Languages.Fields.Published").Text,
                                    Width = "150",
                                    ClassName =  NopColumnClassDefaults.CenterAll,
                                    Render = new RenderBoolean()
                                },
                                new ColumnProperty(nameof(LanguageModel.Id))
                                {
                                    Title = T("Admin.Common.Edit").Text,
                                    Width = "100",
                                    ClassName =  NopColumnClassDefaults.Button,
                                    Render = new RenderButtonEdit(new DataUrl("~/Admin/Language/Edit"))
                                }
                            }
                        })
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>