<!-- Search Bar -->
<!-- <div class="search-bar">
    <div class="search-icon">
        <i class="material-icons">search</i>
    </div>
    <input type="text" placeholder="START TYPING...">
    <div class="close-search">
        <i class="material-icons">close</i>
    </div>
</div> -->
<!-- #END# Search Bar -->
<!-- Top Bar -->
<%if !request.path_info.include?('second_display') %>
<nav class="navbar">
    <div class="container-fluid">
        <div class="navbar-header">
            <!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> -->
            <%if current_login_employee.role !="waiter" %>
                <a href="javascript:void(0);" class="bars"></a>
                <% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "account" %>
                    <a class="navbar-brand mbl_view" href="<%=dashboard_path%>" style="margin-left: 20px;">
                <% elsif current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %>
                 <a class="navbar-brand mbl_view" href="<%=origami_dashboard_path%>" style="margin-left: 20px;">
                <%else%>
                    <a class="navbar-brand mbl_view" href="" style="margin-left: 20px;">
                <% end %>
            <% else %>
                <a class="navbar-brand m-0 mbl_view" href="<%= origami_dashboard_path%>">
            <%end%>
                <img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
                <span class="navbar-brand-txt">SX Restaurant</span>
            </a>

            <span class="navbar-brand m-0">
                <span id="others_payment"></span>
            </span>
        </div>
        <!-- Start Shop Info -->
        <div class="navbar-right m-auto">
            <span class="navbar-brand navbar-brand-txt"><%= shop_detail.name %></span>
        </div>
        <!-- End Shop Info -->

        <div class="navbar-right m-auto">
            <% if order_reservation %>
                <div class="online_order">
                    <span class="navbar-brand navbar-brand-txt header-default-color">
                      <% if request.user_agent.include? "Mobile" %>
                        <img src="/assets/online_order_icon.png" alt="<%= t :order_reservation %>" />
                      <% else %>
                        <%= t :order_reservation %>
                      <% end %>
                      </span>
                    <span class="order_no"></span>
                </div>
            <% end %>
        </div>

        <!-- Start Quick Access for Cashier -->
        <!-- <div class="navbar-right m-auto">
            <a href="#" class="dropdown-toggle waves-block col-white" data-toggle="dropdown" aria-haspopup="true" aria-expanded="flase">
                <span><%= t :cashier %></span>
            </a>
            <ul class="dropdown-menu">
                <li>
                    <p class="waves-effect waves-block p-l-20 m-b-5">
                        <a href="<%= origami_root_path %>" style="text-decoration: none;">
                            <i class="material-icons font-7 logout_icon shopinfo">monetization_on</i>
                            <span class="font-15 shopinfo dinein" ><%= t :dine_in %></span>
                        </a>
                    </p>
                </li>
                <li>
                    <p class="waves-effect waves-block p-l-20 m-b-5">
                        <a href="<%= origami_quick_service_path %>" style="text-decoration: none;">
                            <i class="material-icons font-7 logout_icon shopinfo">restaurant_menu</i>
                            <span class="font-15 shopinfo quick_service" ><%= t :quick_service %></span>
                        </a>
                    </p>
                </li>
                <% if order_reservation %>
                <li>
                    <p class="waves-effect waves-block p-l-20 m-b-5">
                        <a href="<%= origami_order_reservation_index_path %>" style="text-decoration: none;">
                            <i class="material-icons font-7 logout_icon shopinfo">room_service</i>
                            <span class="font-15 col-black online_order" ><%= t :order_reservation %></span>
                            <span class="order_no"></span>
                        </a>
                    </p>
                </li>
                <% end %>
                <li>
                    <p class="waves-effect waves-block p-l-20 m-b-5">
                        <a href="<%= origami_reservation_index_path %>" style="text-decoration: none;">
                            <i class="material-icons font-7 logout_icon shopinfo">book</i>
                            <span class="font-15 col-black reservation" ><%= t :reservation %></span>
                        </a>
                    </p>
                </li>
                <li>
                    <p class="waves-effect waves-block p-l-20 m-b-5">
                        <a href="<%= origami_food_court_path %>" style="text-decoration: none;">
                            <i class="material-icons font-7 logout_icon shopinfo">restaurant</i>
                            <span class="font-15 col-black foodcourt" ><%= t :foodcourt %></span>
                        </a>
                    </p>
                </li>
            </ul>
        </div> -->
        <!-- End Quick Access for Cashier -->

        <!-- Start Delete confirrm text !-->
        <div class="navbar-right toggle_mbl">
            <a href="javascript:void(0);" class="dropdown-toggle waves-block" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                <% if current_login_employee %>
                   <span>
                     <% if request.user_agent.include? "Mobile" %>
                       <img src="/assets/user_icon.png" alt="<%= current_login_employee.name %>" />
                     <% else %>
                       <%= current_login_employee.name %>
                     <% end %>
                   </span>
                <% end %>
            </a>
            <ul class="dropdown-menu">
                <%if current_login_employee.role =="administrator" %>
                <li>
                    <p class="waves-effect waves-block p-l-30 m-b-5">
                        <a href="<%= settings_shops_path %>" style="text-decoration: none;">
                            <i class="material-icons font-7 logout_icon shopinfo">info</i>
                            <span class="font-15 shopinfo" >Shop Info</span>
                        </a>
                    </p>
                </li>
                <% end %>
                <li>
                    <p class="waves-effect waves-block p-l-30 m-b-5 team_viewer">
                       <i class="material-icons font-7 logout_icon shopinfo">touch_app</i>
                        <span class="font-15 shopinfo" >Team Viewer</span>
                    </p>
                </li>
                <%if current_login_employee.role =="cashier" %>
                <li>
                    <p class="waves-effect waves-block p-l-30 m-b-5">
                        <a href="/origami/second_display" onclick="window.open('/origami/second_display', 'newwindow', 'width=700,height=500'); return false;" style="text-decoration: none;">
                            <i class="material-icons font-7 logout_icon shopinfo">info</i>
                            <span class="font-15 shopinfo" >Second Display</span>
                        </a>
                    </p>
                </li>
                <% end %>
                    <!-- <p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
                        <i class="material-icons font-10 logout_icon">exit_to_app</i>
                        <span class="font-18">Logout</span>
                    </p> -->
                    <p class="delete waves-effect waves-block p-l-30 m-b-5 logout" data-ref="<%= logout_path %>" data-method="delete">
                        <i class="material-icons font-7 logout_icon">exit_to_app</i>
                        <span class="font-15">Logout</span>
                    </p>
                     <span class="hidden" id="delete_text">
                        <h6>Are you sure you want to Logout ?</h6>
                        <!-- <h6>This action can't be undo. </h6> -->
                    </span>
                </li>
            </ul>
            <!-- NO Need for color Change
            <a href="javascript:void(0);" class="js-right-sidebar" data-close="true">
                <i class="material-icons">more_vert</i>
            </a> -->
        </div>
    </div>
</nav>
<%end%>
<script type="text/javascript">
    $(function(){
        $('.delete').click(function(){
            var method    = $(this).attr('data-method');
            var url       = $(this).attr('data-ref');
            var html_text = $(this).siblings( "#delete_text" ).html();
            //var page = url.substring(url.lastIndexOf('/') + 1);
            swal({
                title: "Confirmation",
                text: html_text,
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                html: true
            }, function (isConfirm) {
                if (isConfirm) {
                  $.ajax({
                    type: method,
                    url: url ,
                    success: function(data) {
                        location.href = data.url;
                    }
                 });
                } else {
                    swal("Cancelled", "Your imaginary file is safe :)", "error");
                }
            });
        });

        $('.online_order').on('click',function(){
            window.location.href = '/origami/order_reservation';
        });

        if(parseInt(getOnlineOrderCount()) > 0){
            $('.order_no').addClass("order-badge");
            $('.order_no').html(parseInt(getOnlineOrderCount()));
        }

        $(".team_viewer").on('click',function(){
            // /opt/teamviewer/tv_bin/script/teamviewer
            $.ajax({
                type: "POST",
                data: {},
                dataType: 'json',
                url: "/run_teamviewer",
                success: function(data){
                    if(!data.status){
                        window.open('https://www.teamviewer.com', '_blank');
                        return false;
                    }
                }
            });
        });

    });
</script>
