{{!
  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-menu fw-stack-1x toggle-icon-down"></i>
    </span>
{{/zone}}

{{#zone "navMenu-items"}}
    <li>
        <a href="{{@app.context}}">
            <i class="fw fw-dashboard"></i>
            Resource Dashboard
        </a>
    </li>

    {{#if permissions.LIST_DEVICES}}
        <li>
            <!--suppress HtmlUnknownTarget -->
            <a href="{{@app.context}}/devices">
                <i class="fw fw-mobile"></i>
                Device Management
            </a>
        </li>
    {{/if}}

    {{#if permissions.USER_MGT_PERMITTED}}
        <li><a><i class="fw fw-user"></i>User Management</a>
            <ul>
                {{#if permissions.LIST_USERS}}
                    <li><!--suppress HtmlUnknownTarget -->
                        <a href="{{@app.context}}/users"><i class="fw fw-user"></i>Users</a></li>
                {{/if}}
                {{#if permissions.LIST_ROLES}}
                    <li><!--suppress HtmlUnknownTarget -->
                        <a href="{{@app.context}}/roles"><i class="fw fw-bookmark"></i>Roles</a></li>
                {{/if}}
            </ul>
        </li>
    {{/if}}
    {{#if permissions.LIST_POLICIES}}
        <li><!--suppress HtmlUnknownTarget -->
            <a href="{{@app.context}}/policies"><i class="fw fw-policy"></i>Policy Management</a></li>
    {{/if}}
    {{#if permissions.CONFIG_MGT_PERMITTED}}
        <li><a><i class="fw fw-settings"></i>Configuration Management</a>
            <ul>
                {{#if permissions.LIST_PLATFORM_CONFIGURATIONS}}
                    <li><!--suppress HtmlUnknownTarget -->
                        <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.LIST_CERTIFICATES}}
                    <li><!--suppress HtmlUnknownTarget -->
                        <a href="{{@app.context}}/certificates"><i class="fw fw-security-policy"></i>Certificate Configurations</a>
                    </li>
                {{/if}}
            </ul>
        </li>
    {{/if}}
{{/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 id="notification-bubble" class="badge notifications hidden"></span>
                <span id="notifications-icon" class="icon fw-stack hidden">
                    <i class="fw fw-notification fw-stack-1x"></i>
                </span>
                <span id="notifications-spacer" class="hidden">&nbsp;</span>
                <span class="text-capitalize">Notifications</span>
            </a>
        </li>
    </ul>
{{/zone}}
{{#zone "sidePanes"}}
    <!--suppress HtmlUnknownAttribute -->
    <div class="sidebar-wrapper" id="right-sidebar" is-authorized="{{permissions.LIST_NOTIFICATIONS}}"
        data-side="right" data-width="300" data-sidebar-fixed="true" data-fixed-offset="60" data-spy="affix"
        data-offset-top="80">
        <ul class="sidebar-messages"></ul>
        <br>
        <div class="text-center">
            <a href="{{@app.context}}/notification-listing" class="btn-operations btn-default">
                <span class="fw-stack">
                    <i class="fw fw-ring fw-stroke fw-stack-2x"></i>
                    <i class="fw fw-notification fw-stack-1x"></i>
                </span>
                &nbsp;&nbsp;View All Notifications
            </a>
        </div>
    </div>
{{/zone}}
{{#zone "bottomJs"}}
    <!--suppress HtmlUnknownTarget -->
    <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}}
