<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<div ng-switch="isCompleted()">

    <div ng-switch-when="true" ng-switch="hasErrors">

        <div class="message message-error" ng-switch-when="true">
            <span class="message-text">
                <strong>Completed!</strong> You need to resolve these issues to continue.
            </span>
        </div>

        <div class="message message-success" ng-switch-default>
            <span class="message-text">
                <strong>Completed!</strong> You can now move on to the next step.
            </span>
        </div>

    </div>

    <div class="message message-spinner" ng-switch-default>
        <span class="spinner">
            <span></span><span></span><span></span><span></span>
            <span></span><span></span><span></span><span></span>
        </span>
        <span class="message-text">{{wordingOfReadinessCheckAction()}}.</span>
    </div>

</div>

<div id="updater-application" class="readiness-check-item" ng-show="updater.visible">
    <div ng-hide="updater.processed">
        <span class="spinner side">
            <span></span><span></span><span></span><span></span>
            <span></span><span></span><span></span><span></span>
        </span>
        <h3 class="readiness-check-title">Checking Updater Application Availability...</h3>
    </div>

    <div ng-show="updater.processed" ng-switch="updater.responseType">

        <div ng-switch-when="success" ng-init="updateOnSuccess(version)">

            <span class="readiness-check-icon icon-success-round"></span>

            <div class="readiness-check-content">
                <h3 class="readiness-check-title">Check Updater Application Availability</h3>
                <p>
                    Updater application is available.
                </p>
            </div>

        </div>

        <div class="readiness-check-item" ng-switch-default ng-init="updateOnError(updater)">

            <span class="readiness-check-icon icon-failed-round"></span>

            <div class="readiness-check-content">
                <h3 class="readiness-check-title">Check Updater Application Availability</h3>
                <p>
                    Updater application is not available.
                    <a href="#updater-application" ng-click="updateOnExpand(updater)">
                        <span ng-hide="updater.expanded">Show detail</span>
                        <span ng-show="updater.expanded">Hide detail</span>
                    </a>
                </p>
                <p ng-show="updater.expanded">
                    Download and install the updater.
                </p>
                <p ng-show="updater.expanded">For additional assistance, see
                    <a href="http://devdocs.magento.com/guides/v2.0/comp-mgr/trouble/cman/updater.html"
                       target="_blank">updater application help</a>.
                </p>
            </div>

        </div>

    </div>

</div>

<div id="cron-script" class="readiness-check-item" ng-show="cronScript.visible">
    <div ng-hide="cronScript.processed">
        <span class="spinner side">
            <span></span><span></span><span></span><span></span>
            <span></span><span></span><span></span><span></span>
        </span>
        <h3 class="readiness-check-title">Checking Cron Scripts...</h3>
    </div>

    <div ng-show="cronScript.processed" ng-switch="cronScript.responseType">
        <div ng-switch-when="success" ng-init="updateOnSuccess(cronScript)">
            <span class="readiness-check-icon icon-success-round"></span>
            <div class="readiness-check-content">
                <h3 class="readiness-check-title">Check Cron Scripts</h3>
                <p>
                    Cron script readiness check passed.
                </p>
                <p ng-show="cronScript.notice" ng-bind-html="cronScript.setupNoticeMessage">
                </p>
                <p ng-show="cronScript.notice" ng-bind-html="cronScript.updaterNoticeMessage">
                </p>
            </div>
        </div>

        <div class="readiness-check-item" ng-switch-default ng-init="updateOnError(cronScript)">
            <span class="readiness-check-icon icon-failed-round"></span>
            <div class="readiness-check-content">
                <h3 class="readiness-check-title">Check Cron Scripts</h3>
                <p>
                    Cron script readiness check failed.
                    <a href="#cron-script" ng-click="updateOnExpand(cronScript)">
                        <span ng-hide="cronScript.expanded">Show detail</span>
                        <span ng-show="cronScript.expanded">Hide detail</span>
                    </a>
                </p>
                <p ng-show="cronScript.expanded" ng-bind-html="cronScript.setupErrorMessage">
                </p>
                <p ng-show="cronScript.expanded" ng-bind-html="cronScript.updaterErrorMessage">
                </p>
                <p ng-show="cronScript.expanded">For additional assistance, see
                    <a href="http://devdocs.magento.com/guides/v2.0/comp-mgr/trouble/cman/cron.html"
                       target="_blank">cron scripts help</a>.
                </p>
            </div>
        </div>
    </div>
</div>

<div id="component-dependency" class="readiness-check-item" ng-show="componentDependency.visible">
    <div ng-hide="componentDependency.processed">
        <span class="spinner side">
            <span></span><span></span><span></span><span></span>
            <span></span><span></span><span></span><span></span>
        </span>
        <h3 class="readiness-check-title">Checking Component Dependency...</h3>
    </div>

    <div ng-show="componentDependency.processed" ng-switch="componentDependency.responseType">
        <div ng-switch-when="success" ng-init="updateOnSuccess(componentDependency)">
            <span class="readiness-check-icon icon-success-round"></span>
            <div class="readiness-check-content">
                <h3 class="readiness-check-title">Check Component Dependency</h3>
                <p>
                    Component dependency is correct.
                </p>
            </div>
        </div>

        <div class="readiness-check-item" ng-switch-default ng-init="updateOnError(componentDependency)">
            <span class="readiness-check-icon icon-failed-round"></span>
            <div class="readiness-check-content">
                <h3 class="readiness-check-title">Check Component Dependency</h3>
                <p>
                    We found conflicting component dependencies.
                    <a href="#component-dependency" ng-click="updateOnExpand(componentDependency)">
                        <span ng-hide="componentDependency.expanded">Show detail</span>
                        <span ng-show="componentDependency.expanded">Hide detail</span>
                    </a>
                </p>
                <p ng-show="componentDependency.expanded" ng-bind-html="componentDependency.errorMessage">
                </p>
                <p ng-show="componentDependency.expanded">For additional assistance, see
                    <a href="http://devdocs.magento.com/guides/v2.0/comp-mgr/trouble/cman/component-depend.html"
                       target="_blank">component dependency help
                    </a>.
                </p>
            </div>
        </div>
    </div>
</div>

<div id="php-version" class="readiness-check-item" ng-show="version.visible">
    <div ng-hide="version.processed">
        <span class="spinner side">
            <span></span><span></span><span></span><span></span>
            <span></span><span></span><span></span><span></span>
        </span>
        <h3 class="readiness-check-title">Checking PHP Version...</h3>
    </div>

    <div ng-show="version.processed" ng-switch="version.responseType">

        <div ng-switch-when="success" ng-init="updateOnSuccess(version)">

            <span class="readiness-check-icon icon-success-round"></span>

            <div class="readiness-check-content">
                <h3 class="readiness-check-title">PHP Version Check</h3>
                <p>
                    Your PHP version is correct ({{version.data.current}}).
                </p>
            </div>

        </div>

        <div class="readiness-check-item" ng-switch-default ng-init="updateOnError(version)">

            <div class="readiness-check-side">
                <p class="side-title">Need Help?</p>
                <a href="http://www.php.net/docs.php" target="_blank">PHP Documentation</a>
            </div>

            <span class="readiness-check-icon icon-failed-round"></span>

            <div class="readiness-check-content">
                <h3 class="readiness-check-title">PHP Version Check</h3>
                <div ng-show="version.isRequestError">
                    <p>Server failed to respond. Please try again.</p>
                </div>
                <div ng-hide="version.isRequestError">
                    <p>
                        Your PHP version is {{version.data.current}}. The required PHP version is {{version.data.required}}.
                        <a href="#php-version" ng-click="updateOnExpand(version)">
                            <span ng-hide="version.expanded">Show detail</span>
                            <span ng-show="version.expanded">Hide detail</span>
                        </a>
                    </p>
                    <p ng-show="version.expanded">
                        Download and install PHP from <a href="http://www.php.net" target="_blank">www.php.net</a> using this <a href="http://www.php.net/docs.php" target="_blank">PHP Documentation</a>.
                    </p>
                    <p ng-show="version.expanded">For additional assistance, contact your hosting provider.</p>
                </div>
            </div>

        </div>

    </div>

</div>

<div id="php-settings" class="readiness-check-item" ng-show="settings.visible">
    <div ng-hide="settings.processed">
        <span class="spinner side">
            <span></span><span></span><span></span><span></span>
            <span></span><span></span><span></span><span></span>
        </span>
        <h3 class="readiness-check-title">Checking PHP Settings....</h3>
    </div>

    <div ng-show="settings.processed" ng-switch="settings.responseType">

        <div ng-switch-when="success" ng-init="updateOnSuccess(settings)">

            <span class="readiness-check-icon icon-success-round"></span>

            <div class="readiness-check-content">
                <h3 class="readiness-check-title">PHP Settings Check</h3>
                <p>
                    Your PHP settings are correct.
                </p>
            </div>

        </div>

        <div class="readiness-check-item" ng-switch-default ng-init="updateOnError(settings)">

            <span class="readiness-check-icon icon-failed-round"></span>
            <div class="readiness-check-content">
                <h3 class="readiness-check-title">PHP Settings Check</h3>

                <div ng-show="settings.isRequestError">
                    <p>Server failed to respond. Please try again.</p>
                </div>
                <div ng-hide="settings.isRequestError" ng-repeat="setting in settings.data">
                    <div ng-show="setting.error && setting.helpUrl" class="readiness-check-side">
                        <p class="side-title">Need Help?</p>
                        <a href="{{setting.helpUrl}}" target="_blank">PHP Documentation</a>
                    </div>
                    <div ng-show="setting.error">
                        <p>
                            {{setting.message}}
                        </p>
                    </div>
                </div>

                <p ng-show="componentDependency.expanded">For additional assistance, see
                    <a href="http://devdocs.magento.com/guides/v2.0/install-gde/trouble/php/tshoot_php-set.html"
                       target="_blank">PHP settings check help
                    </a>.
                </p>

            </div>
        </div>

    </div>

</div>

<div id="php-extensions" class="readiness-check-item" ng-show="extensions.visible">
    <div ng-hide="extensions.processed">
        <span class="spinner side">
            <span></span><span></span><span></span><span></span>
            <span></span><span></span><span></span><span></span>
        </span>
        <h3 class="readiness-check-title">Checking PHP Extensions...</h3>
    </div>
    <div ng-show="extensions.processed" ng-switch="extensions.responseType">

        <div ng-switch-when="success" ng-init="updateOnSuccess(extensions)">

            <span class="readiness-check-icon icon-success-round"></span>

            <div class="readiness-check-content">
                <h3 class="readiness-check-title">PHP Extensions Check</h3>
                <p>
                    You meet {{extensions.length}} out of {{extensions.length}} PHP extensions requirements.
                    <a href="#php-extensions" ng-click="updateOnExpand(extensions)">
                        <span ng-hide="extensions.expanded">Show detail</span>
                        <span ng-show="extensions.expanded">Hide detail</span>
                    </a>
                </p>
                <ul class="list" ng-show="extensions.expanded">
                    <li class="list-item-success"
                        ng-repeat="name in extensions.data.required"
                        >PHP Extension {{name}}.</li>
                </ul>
            </div>

        </div>

        <div ng-switch-default ng-init="updateOnError(extensions)">

            <div ng-switch="extensions.data.error">

                <div ng-switch-when="phpExtensionError" class="message message-error">
                    <span class="message-text">
                        {{extensions.data.message}}
                    </span>
                </div>

                <div class="readiness-check-side">
                    <p class="side-title">Need Help?</p>
                    <a href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html" target="_blank">PHP Extension Help</a>
                </div>

                <span class="readiness-check-icon icon-failed-round"></span>

                <div class="readiness-check-content">
                    <h3 class="readiness-check-title">PHP Extensions Check</h3>
                    <div ng-show="extensions.isRequestError">
                        <p>Server failed to respond. Please try again.</p>
                    </div>
                    <div ng-hide="extensions.isRequestError">
                        <p>
                            {{extensions.data.missing.length}} missing PHP extensions.
                            <a href="#php-extensions" ng-click="updateOnExpand(extensions)">
                                <span ng-hide="extensions.expanded">Show detail</span>
                                <span ng-show="extensions.expanded">Hide detail</span>
                            </a>
                        </p>
                        <p>
                            The best way to resolve this is to install the correct missing extensions. The exact fix depends on our server, your host, and other system variables.
                            <br>
                            Our <a href="http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements.html" target="_blank">PHP extension help</a> can get you started.
                        </p>
                        <p>
                            For additional assistance, contact your hosting provider.
                        </p>
                        <ul class="list" ng-show="extensions.expanded">
                            <li
                                class="list-item-icon"
                                ng-repeat="name in extensions.data.required"
                                ng-switch="extensions.data.missing.indexOf(name) >= 0"
                                >
                                <span ng-switch-when="true" class="icon-failed"></span>
                                <span ng-switch-default class="icon-success"></span>
                                PHP Extension {{name}}.
                            </li>
                        </ul>
                    </div>
                </div>

            </div>

        </div>

    </div>

</div>

<div class="readiness-check-item" id="php-permissions" ng-show="permissions.visible">
    <div ng-hide="permissions.processed">
        <span class="spinner side">
            <span></span><span></span><span></span><span></span>
            <span></span><span></span><span></span><span></span>
        </span>
        <h3 class="readiness-check-title">Checking File Permissions...</h3>
    </div>

    <div ng-show="permissions.processed" ng-switch="permissions.responseType">

        <div ng-switch-when="success" ng-init="updateOnSuccess(permissions)">

            <span class="readiness-check-icon icon-success-round"></span>

            <div class="readiness-check-content">
                <h3 class="readiness-check-title">File Permission Check</h3>
                <p>
                    You meet {{permissions.data.current.length}} out of {{permissions.data.required.length}} writable file permission requirements.
                    <a href="#php-permissions" ng-click="updateOnExpand(permissions)">
                        <span ng-hide="permissions.expanded">Show detail</span>
                        <span ng-show="permissions.expanded">Hide detail</span>
                    </a>
                </p>
                <ul class="list" ng-show="permissions.expanded">
                    <li class="list-item-success" ng-repeat="name in permissions.data.required">
                        "{{name}}" writable directory permission.
                    </li>
                </ul>
            </div>

        </div>

        <div ng-switch-default ng-init="updateOnError(permissions)">

            <div class="readiness-check-side">
                <p class="side-title">Need Help?</p>
                <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/file-system-perms.html" target="_blank">File Permission Help</a>
            </div>

            <span class="readiness-check-icon icon-failed-round"></span>

            <div class="readiness-check-content">

                <h3 class="readiness-check-title">File Permission Check</h3>
                <div ng-show="permissions.isRequestError">
                    <p>Server failed to respond. Please try again.</p>
                </div>
                <div ng-hide="permissions.isRequestError">
                    <p>
                        {{permissions.data.required.length - permissions.data.current.length}} file permission not met.
                        <a href="#php-permissions" ng-click="updateOnExpand(permissions)">
                            <span ng-hide="permissions.expanded">Show detail</span>
                            <span ng-show="permissions.expanded">Hide detail</span>
                        </a>
                    </p>
                    <p>
                        The best way to resolve this is to allow write permissions for the following Magento
                        directories and their sub-directories. The exact fix depends on your server, your host,
                        and other system variables.
                        <br>
                        Our <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/file-system-perms.html" target="_blank">File Permission Help</a> can get you started.
                    </p>
                    <p>
                        If you need more help, please call your hosting provider.
                    </p>

                    <ul class="list" ng-show="permissions.expanded">
                        <li
                            class="list-item-icon"
                            ng-repeat="name in permissions.data.required"
                            ng-switch="hasItem(permissions.data.current, name)">
                            <span ng-switch-when="true" class="icon-success"></span>
                            <span ng-switch-default class="icon-failed"></span>
                            <span>"{{name}}" writable directory permission.</span>
                        </li>
                    </ul>


                </div>

            </div>

        </div>

    </div>

</div>
