{{!
  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.
}}

{{unit "cdmf.unit.lib.qrcode"}}
{{unit "mdm.unit.device.qr-modal"}}
{{#zone "content"}}
    <div class="row ">
    {{#if permissions.LIST_DEVICES}}
            <div class="col-md-3 wr-stats-board">
                <div class="wr-stats-board-tile">
                    <div class="tile-name">Devices</div>
                    <div>
                        <div class="tile-icon"><i class="fw fw-mobile"></i></div>
                        <div class="tile-stats">
                            <span id="device-count" data-device-count="true">Loading...</span>
                            <span class="tile-stats-free">
                                <!--suppress HtmlUnknownTarget -->
                                <a id="device-count-view-btn" href="{{@app.context}}/devices">
                                    <span class="fw-stack">
                                        <i class="fw fw-ring fw-stack-2x"></i>
                                        <i class="fw fw-view fw-stack-1x"></i>
                                    </span>
                                    View
                                </a>
                                {{#if permissions.ENROLL_DEVICE}}
                                    <a href="javascript:toggleEnrollment()">
                                    <span class="fw-stack">
                                        <i class="fw fw-ring fw-stack-2x"></i>
                                        <i class="fw fw-add fw-stack-1x"></i>
                                    </span>
                                    Add
                                </a>
                                {{/if}}
                            </span>
                        </div>
                    </div>
                </div>
            </div>
    {{/if}}
    {{# if permissions.LIST_POLICIES}}
            <div class="col-md-3 wr-stats-board">
                <div class="wr-stats-board-tile">
                    <div class="tile-name">Policies</div>
                    <div>
                        <div class="tile-icon"><i class="fw fw-policy"></i></div>
                        <div class="tile-stats">
                            <span id="policy-count" data-policy-count="true">Loading...</span>
                            <span class="tile-stats-free">
                                <!--suppress HtmlUnknownTarget -->
                                <a id="policy-count-view-btn" href="{{@app.context}}/policies/">
                                    <span class="fw-stack">
                                        <i class="fw fw-ring fw-stack-2x"></i>
                                        <i class="fw fw-view fw-stack-1x"></i>
                                    </span>
                                    View
                                </a>
                                <!--suppress HtmlUnknownTarget -->
                                {{#if permissions.ADD_POLICY}}
                                    <a href="{{@app.context}}/policy/add">
                                        <span class="fw-stack">
                                            <i class="fw fw-ring fw-stack-2x"></i>
                                            <i class="fw fw-add fw-stack-1x"></i>
                                        </span>
                                        Add
                                    </a>
                                {{/if}}
                            </span>
                        </div>
                    </div>
                </div>
            </div>
    {{/if}}
    {{# if permissions.LIST_USERS}}
            <div class="col-md-3 wr-stats-board">
                <div class="wr-stats-board-tile">
                    <div class="tile-name">Users</div>
                    <div>
                        <div class="tile-icon"><i class="fw fw-user"></i></div>
                        <div class="tile-stats">
                            <span id="user-count" data-user-count="true">Loading...</span>
                            <span class="tile-stats-free">
                                <!--suppress HtmlUnknownTarget -->
                                <a id="user-count-view-btn" href="{{@app.context}}/users/">
                                    <span class="fw-stack">
                                        <i class="fw fw-ring fw-stack-2x"></i>
                                        <i class="fw fw-view fw-stack-1x"></i>
                                    </span>
                                    View
                                </a>
                                <!--suppress HtmlUnknownTarget -->
                                {{#if permissions.ADD_USER}}
                                    <a href="{{@app.context}}/user/add">
                                        <span class="fw-stack">
                                            <i class="fw fw-ring fw-stack-2x"></i>
                                            <i class="fw fw-add fw-stack-1x"></i>
                                        </span>
                                        Add
                                    </a>
                                {{/if}}
                            </span>
                        </div>
                    </div>
                </div>
            </div>
    {{/if}}
    {{# if permissions.LIST_ROLES}}
            <div class="col-md-3 wr-stats-board">
                <div class="wr-stats-board-tile">
                    <div class="tile-name">Roles</div>
                    <div>
                        <div class="tile-icon"><i class="fw fw-bookmark"></i></div>
                        <div class="tile-stats">
                            <span id="role-count" data-role-count="true">Loading...</span>
                            <span class="tile-stats-free">
                                <!--suppress HtmlUnknownTarget -->
                                <a id="device-count-view-btn" href="{{@app.context}}/roles">
                                    <span class="fw-stack">
                                        <i class="fw fw-ring fw-stack-2x"></i>
                                        <i class="fw fw-view fw-stack-1x"></i>
                                    </span>
                                    View
                                </a>
                                {{#if permissions.ADD_ROLE}}
                                    <!--suppress HtmlUnknownTarget -->
                                    <a href="{{@app.context}}/role/add">
                                        <span class="fw-stack">
                                            <i class="fw fw-ring fw-stack-2x"></i>
                                            <i class="fw fw-add fw-stack-1x"></i>
                                        </span>
                                        Add
                                    </a>
                                {{/if}}
                            </span>
                        </div>
                    </div>
                </div>
            </div>
    {{/if}}
    {{# if permissions.PERMITTED_NONE}}
        <h1 class="page-sub-title">
            Permitted None
        </h1>
        <br>
        You are not authorized to view any of the dashboard listed resources.
    {{/if}}
    </div>
{{/zone}}
{{#zone "bottomJs"}}
    {{js "js/dashboard.js"}}
{{/zone}}