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

{{!-- defining controlled access parameters --}}
{{#zone "accessControl"}}
    {{
    unit "mdm.unit.enrollments.access-control"
    allowedPlatform = "iOS"
    currentPage = "download-agent"
    nextPage = "login-agent"
    }}
{{/zone}}
{{!-- Inputting content into defined zones in enrollment layout --}}
{{unit "mdm.unit.ui.title" pageTitle="iOS Enrollment | Download Agent"}}
{{#zone "headerTitle"}}
    iOS Enrollment
{{/zone}}
{{#zone "content"}}
    {{
    unit "mdm.unit.wizard-stepper"
    steps = stepsStr
    currentStep = "Download Agent"
    currentStepIndex = 1
    }}
    <div class="row">
        <div class="col-md-4 wr-text">
            <div class="wr-buttons">
                <a id="download-agent-button" href="{{agentDownloadURL}}"
                   class="btn-download-agent">Install {{companyName}} Agent</a>
            </div>
        </div>
    </div>
    {{#unless isCloud}}
        <div class="row">
            <div class="col-md-4 wr-text">
                <div class="wr-buttons text-center">
                    <br class="c-both"/>
                    <br/>
                    For evaluation purposes, you can skip the agent installation and proceed with enrollment.</br>
                    This results unavailability of operations, such as <b>Send Notification, Get Location, Ring and
                    Enterprise Wipe</b>.
                    <br/><br/>
                    <a href="login-agent" class="btn btn-secondary">Skip Agent Installer</a>
                </div>
            </div>
        </div>
    {{/unless}}

    <!-- modal -->
    <div class="modal fade" id="modalInfo" tabindex="-1" role="dialog" aria-labelledby="modalDemo">
        <div class="modal-dialog" role="document">
            <div class="modal-content clearfix">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
                            class="fw fw-cancel"></i></button>
                    <h3 class="modal-title" id="deleteModalLabel">The WSO2 iOS agent gets installed in the background.
                        To continue, follow the steps given below:</h3>
                </div>
                <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
                    <ul>
                        <li>Exit this safari browser and open the WSO2 device management application.</li>
                        <li>
                            When you open it for the first time, you may see the Untrusted Enterprise Developer message.
                            <ul>
                                <li>Tap Settings > General > Profiles or Profiles & Device Management.</li>
                                <li>Tap the WSO2 Inc profile that is under ENTERPRISE APP.</li>
                                <li>Tap Trust "WSO2 Inc”.</li>
                            </ul>
                        </li>
                        <li>Go back and open the application to start enrolling your iOS device
                            with {{companyName}}</li>
                    </ul>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
                </div>
            </div>
        </div>
    </div>
    <!-- /modal -->
{{/zone}}

{{#zone "bottomJs"}}
    <script>
        $('#download-agent-button').click(function () {
            $('#modalInfo').modal('show');
        });
    </script>
{{/zone}}