@model PantheonRA.BackOffice.Models.BaseGridFilterModel
@{
    ViewBag.Title = Loc.Text;
    var userCanAccessDocTextsCud = PantheonRA.BackOffice.CurrentUser.CanAccess(PantheonRA.WebApi.Contracts.Enums.Permissions.CODELISTS_DOCUMENTTEXTS);
}

<div class="wrapper wrapper-content">
    <div class="tabs-container">
        @Html.Partial("~/Views/Products/_CodeListTabNavigation.cshtml")
        <div class="tab-content">
            <div class="row buttons-tabbed">
                @if (userCanAccessDocTextsCud)
                {
                    <a href="@Url.Action("Create", "DocumentText")" class="btn btn-primary btn-outline">
                        <i class="fa fa-plus" title="@Loc.CreateNewDocumentText"></i>
                        <span class="bold hidden-xs m-l-xs">@Loc.New</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>

            <div class="texts-list project-list">
                <div class="document-list document-list-no-footer">
                    <table id="mainGrid" data-grid-id="document-text" data-url="@Url.Action("DocumentTextsList", "DocumentText")" class="list-table">
                        <thead>
                            <tr>
                                <th width="5%">@Loc.Active</th>
                                <th data-url="@Url.Action("Edit", "DocumentText")?id=">@Loc.Code</th>
                                <th data-url="@Url.Action("Edit", "DocumentText")?id=">@Loc.Name</th>
                                <th>@Loc.Description</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<input type="hidden" id="userCanAccessDocTextsCud" value="@userCanAccessDocTextsCud.ToString()" />

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