@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Web.Common;

@model IPagedList<Organization>

@{
    ViewData["Title"] = "Organisation";
}

<h1> Organisation</h1>

<hr />

<form asp-action="Index" method="get">
    <p>
        Suchen nach: <input type="text" name="SearchString" value="" />
        <input type="submit" value="suchen" />
    </p>
</form>



<div id="view-all">
    @await Html.PartialAsync("_ViewAll", Model)
</div>













@*





@using (Html.BeginForm("Index", "Organization", FormMethod.Post))
{
    <input type="hidden" name="selectedItems" id="selectedItems" />
    <input type="submit" value="submit" />
    <input type="text" value="" style="box-shadow:inset 0 0 4px #eee; width:120px; margin:0; padding:6px 12px; border-radius:4px; border:1px solid silver; font-size:1.1em;" id="search" placeholder="Search" />
}

<div id="jstree">
</div>

@section scripts{
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
    <script type="text/javascript">

        $(function () {
            var to = false;
            $('#search').keyup(function () {
                if (to) { clearTimeout(to); }
                to = setTimeout(function () {
                    var v = $('#search').val();
                    $('#jstree').jstree(true).search(v);
                }, 250);
            });
            $('#jstree').on('changed.jstree', function (e, data) {
                var i, j,
                postedItems = [];
                for (i = 0, j = data.selected.length; i < j; i++) {


                    postedItems.push({
                        text: data.instance.get_node(data.selected[i]).text,
                        id: data.selected [i],
                        parent: data.node.parents[0]
                    });
                }

                // Serialize the JSON Array an save in HiddenField
                $('#selectedItems').val(JSON.stringify(postedItems));

            }).jstree({
                "core": {
                    "multiple" : false,
                    "themes": {
                        "variant": "large"
                    },
                    "data": @Html.Raw(ViewBag.Json)
                        },
                "checkbox": {
                    "keep_selected_style": false
                },
                "plugins": ["wholerow", "checkbox", "search"],
            });
        });

    </script>
}
 *@