{{!
  Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.

  WSO2 Inc. licenses this file to you under the Apache License,
  Version 2.0 (the "License"); you may not use this file except
  in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied. See the License for the
  specific language governing permissions and limitations
  under the License.
}}
{{#zone "navMenu-icon"}}
    <span class="icon fw-stack">
        <i class="fw fw-tiles fw-stack-1x toggle-icon-up"></i>
    </span>
{{/zone}}

{{#zone "navMenu-items"}}
    {{#if permissions.VIEW_DASHBOARD}}
        <li>
            <a href="{{@app.context}}">
                <i class="fw fw-dashboard"></i>
                Admin Dashboard
            </a>
        </li>
    {{/if}}
    {{#if permissions.LIST_DEVICES_ADMIN}}
        <li>
            <a href="{{@app.context}}/devices">
                <i class="fw fw-mobile"></i>
                Device Management
            </a>
        </li>
    {{else}}
        {{#if permissions.LIST_OWN_DEVICES}}
            <li>
                <a href="{{@app.context}}/devices">
                    <i class="fw fw-mobile"></i>
                    Device Management
                </a>
            </li>
        {{/if}}
    {{/if}}
    {{#if permissions.LIST_GROUPS}}
        <li>
            <a href="{{@app.context}}/groups">
                <i class="fw fw-grouping"></i>
                Group Management
            </a>
        </li>
    {{/if}}
    <li><a><i class="fw fw-user"></i>User Management</a>
        <ul>
            {{#if permissions.LIST_USERS}}
                <li><a href="{{@app.context}}/users"><i class="fw fw-user"></i>Users</a></li>
            {{/if}}

            {{#if permissions.LIST_ROLES}}
                <li><a href="{{@app.context}}/roles"><i class="fw fw-bookmark"></i>Roles</a></li>
            {{/if}}
        </ul>
    </li>
    {{#if permissions.LIST_POLICIES}}
        <li><a href="{{@app.context}}/policies"><i class="fw fw-policy"></i>Policy Management</a></li>
    {{/if}}
    <li><a><i class="fw fw-settings"></i>Configuration Management</a>
        <ul>
            {{#if permissions.TENANT_CONFIGURATION}}
                <li><a href="{{@app.context}}/platform-configuration"><i class="fw fw-service"></i>Platform Configurations</a>
                </li>
            {{/if}}
            <!-- todo change the permission and get the related permission -->
            {{#if permissions.TENANT_CONFIGURATION}}
                <li><a href="{{@app.context}}/certificates"><i class="fw fw-security-policy"></i>Certificate Configurations</a>
                </li>
            {{/if}}
        </ul>
    </li>
{{/zone}}

{{#zone "navbarCollapsableRightItems"}}
    <ul id="notification-bubble-wrapper" class="nav navbar-nav navbar-right">
        <li class="visible-inline-block">
            <!--<a href="{{@app.context}}notification-listing" title="Failures of operations on the device side will be listed here">-->
            <a data-toggle="sidebar" data-target="#right-sidebar" data-container=".page-content"
               aria-expanded="false" rel="notifications-sidebar">
                                <span class="icon fw-stack">
                                    <i class="fw fw-notification fw-stack-1x"></i>
                                </span>
                <span class="hidden-xs">Notifications</span>
                <span class="badge notifications" id="notification-bubble"></span>
            </a>
        </li>
    </ul>
{{/zone}}
{{#zone "sidePanes"}}
    <div class="sidebar-wrapper" id="right-sidebar" is-authorized="{{isAuthorizedForNotifications}}"
         data-side="right" data-width="320" data-sidebar-fixed="true" data-fixed-offset="50" data-spy="affix"
         data-offset-top="80">
        <ul class="sidebar-messages">
        </ul>
        <h4 class="text-center"><a href="{{@app.context}}notification-listing" class="text-center">Show all notifications</a>
        </h4>
    </div>
{{/zone}}
{{#zone "bottomJs"}}
    <script id="notifications" data-current-user="{{@user.username}}"
            data-image-resource="{{@unit.publicUri}}/images/" src="{{@unit.publicUri}}/templates/notifications.hbs"
            type="text/x-handlebars-template"></script>
    {{js "js/nav-menu.js"}}
{{/zone}}
