@model PantheonRA.BackOffice.Models.UsersGridFilterModel

@{
    ViewBag.Title = Loc.Users;
}

<div class="wrapper wrapper-content">
    <div class="tabs-container">
        @Html.Partial("~/Views/Company/_CompanySettingsTabNavigation.cshtml")
        <div class="row buttons-tabbed">
            <a href="@Url.Action("Create", "Users")" class="btn btn-primary btn-outline pull-right">
                <i class="fa fa-plus" title="@Loc.CreateNewUser"></i><span class="bold visible-lg-inline visible-md-inline m-l-xs">@Loc.NewUser</span>
            </a>
            <button id="documentDelete" type="button" onclick="updateGranules(this, '@Url.Action("UpdateGranules", "Users")')"
                    title="@Loc.UpdateGranulesAndLicences" class="btn btn-danger btn-outline pull-right">
                <i class="far fa-paper-plane m-r-xs"></i>
                <span class="visible-lg-inline visible-md-inline">@Loc.UpdateGranulesAndLicences</span>
            </button>
            <a href="@Loc.OrderGranulesUrl" target="_blank" class="btn btn-primary btn-outline pull-right">
                <i class="fas fa-shopping-basket" title="@Loc.OrderGranules"></i><span class="bold visible-lg-inline visible-md-inline m-l-xs">@Loc.OrderGranules</span>
            </a>
        </div>

        <div class="row document-head">
            <div class="col-md-3">
                <div class="form-group">
                    <label class="control-label">@Loc.SearchFilter</label>
                    @Html.TextBoxFor(model => model.Keywords, new { @id = "Keywords", @class = "form-control search-input", @placeholder = Loc.Search, autocomplete = "off" })
                </div>
            </div>
            <div class="col-md-2 col-sm-2">
                <div class="form-group">
                    <label class="control-label">@Loc.Granules</label>
                    @Html.HiddenFor(model => model.Granules)
                    @Html.DropDownListFor(model => model.Granules, GranulesHelper.GetGranulesSelectList(),
                        HtmlAttributesHelper.CreateInputAttributes("form-control selectpicker", "GranulesFilter", false, Loc.Granules, true,
                        new { @multiple = "multiple", @data_Actions_Box = "true", @data_select_All_Text = Loc.SelectAll, @title = Loc.Select }))
                </div>
            </div>
        </div>

        <div class="project-list">
            <div class="document-list">
                <table id="grid-data" data-grid-id="users" data-url="@Url.Action("UsersList", "Users")" class="list-table">
                    <thead>
                        <tr>
                            <th width="3%">@Loc.ActiveShort</th>
                            <th data-url="@Url.Action("Edit", "Users")?id=">@Loc.UserName</th>
                            <th>@Loc.Name</th>
                            <th>@Loc.Subject</th>
                            <th>@Loc.Oib</th>
                            <th>@Loc.Granules</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>

        <div class="row document-footer document-footer-sm">
            <div class="col-xs-12">
                <div class="form-group">
                    <span class="pull-left"><span>@Loc.UsersCount:</span> <b class="grid-data-total-items"></b></span>
                </div>
            </div>
        </div>
    </div>
</div>

<input type="hidden" id="changePasswordUrl" value="@Url.Action("ChangePassword", "Users")" />
<input type="hidden" id="changePasswordLoc" value="@Loc.ChangePassword" />

@section pageScripts{
    @Scripts.Render("~/bundles/admin")
    <script>
        $(document).ready(function () {
            initializeUsers();
        });
    </script>
}
