
@{
    ViewBag.Title = "Index";
    var IsSecureConnection = Request.IsSecureConnection;
}

<script src="~/Apps/Pos/posapp.js"></script>
<script src="~/Apps/Pos/componentdefination.js"></script>
<script src="~/Apps/Pos/globalvariablespos.js"></script>
<div id="binding" class="index-page">
    @Html.Partial("_Header")
    <div style="margin-top:70px;"></div>
    <div data-bind="visible:!$root.loginInfo() && $root.Navigation() == screens.login" style="display:none;">
        @Html.Partial("_Login")
    </div>
    <div data-bind="visible:$root.loginInfo() && !$root.IsLoading()" style="display:none;">
        <div data-bind="visible:$root.Navigation() == screens.productList">
            @Html.Partial("_MenuItems")
            <div class="section">
                <div class="tim-container margin-bottom-55">
                    <!--ko foreach:$root.XmlToJsonData().filter(function(f){return f.valid() == true})-->
                    <div class="row" data-bind="attr:{'id':'menu'+ ($index() + 1)}" style="min-height:100vh;">
                        <div class="followTitleBg">
                            <span data-bind="text:$data.GADI"></span>
                        </div>
                        <!--ko foreach: $data.STOKLAR.STOK().filter(function(f){return f.valid() == true})-->
                        @Html.Partial("_ProductList")
                        <!--/ko-->
                    </div>
                    <!--/ko-->
                </div>
            </div>
            @Html.Partial("_Cart_Footer")
        </div>
        <div data-bind="visible: $root.Navigation() == 'search-view'" class="section">
            <div class="tim-container margin-bottom-55">
                <!--ko foreach:$root.SearchList-->
                <div data-bind="attr:{'id':'menu'+ ($index() + 1)}" class="tim-row" style="min-height:auto !important; padding-top:0px !important">
                    <div class="row" style="margin-bottom:25px">
                        <div class="followMeBar">
                            <div class="followTitleBg">
                                <span data-bind="text:$data.Name"></span>
                            </div>
                        </div>
                    </div>
                    <!--ko if:$data.STOKLAR-->
                    <!--ko foreach:$data.STOKLAR.STOK().filter(function(f){return f.valid() == true})-->
                    @Html.Partial("_ProductList")
                    <!--/ko-->
                    <!--/ko-->
                </div>
                <!--/ko-->
            </div>
            @Html.Partial("_Cart_Footer")
        </div>

        <div data-bind="visible:$root.Navigation() == screens.cart">
            @Html.Partial("_Cart")
        </div>
        <div data-bind="visible:$root.Navigation() == screens.tablesAfterCart">
            @Html.Partial("_Tables")
        </div>
        <div data-bind="visible:$root.Navigation() == screens.tablesBeforeAddition">
            @Html.Partial("_Tables")
        </div>
        <div data-bind="visible:$root.Navigation() == screens.addition">
            @Html.Partial("_Adisyon")
        </div>
        <div data-bind="visible:$root.Navigation() == screens.payment">
            @Html.Partial("_CCPayment")
        </div>
        <div data-bind="visible:$root.Navigation() == screens.identity">
            @Html.Partial("_Identity")
        </div>
        <div data-bind="visible:$root.Navigation() == screens.bakiye">
            @Html.Partial("_Bakiye")
        </div>

    </div>

    @Html.Partial("_Modals")

    @Html.Partial("_SignalrPartial")

    @*<div id="loader" data-bind="visible:$root.IsLoading()" style="display: flex;"><div id="loaderContent"></div></div>*@
    <div id="loader" data-bind="visible:$root.IsLoading()" style="display: flex;">
        <img src="~/Upload/icon/loading.gif" style="max-height:300px;max-width:300px" />
    </div>

</div>
<script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/bundles/afterBindings")"></script>
@{
    if (IsSecureConnection)
    {
        <script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/bundles/qrcode")"></script>
        <script>
            $(function () {
                view.IsSecureConnection(true);
            })
        </script>
    }
}

<script>
    $(function () {
        $('body').scrollspy({ target: "#myScrollspy", offset: 280 });
        var lastId,

            topMenu = $("#myScrollspy"),

            topMenuHeight = topMenu.outerHeight() + 70;

            menuItems = topMenu.find("a"),

            scrollItems = menuItems.map(function () {
                var item = $($(this).attr("href"));
                if (item.length) { return item; }
            });//  scroll eventi ile calışacak olan fn.

        // 300 ms içinde menu getir.
        menuItems.click(function (e) {
            var href = $(this).attr("href"),
                offsetTop = href === "#" ? 0 : $(href).offset().top - topMenuHeight + 1;
            $('html, body').stop().animate({
                scrollTop: offsetTop
            }, 300);
            e.preventDefault();
        });
    })
</script>
<script src="~/Scripts/jquery.signalR-2.2.3.min.js"></script>
<script src="~/signalr/hubs"></script>
<script src="~/Apps/appsignalr.js"></script>

