<div ng-controller="Wizdom365UpgradeController">
    <div ng-show="isCloudDeployment && canSendUpdateRequest">
        <div class="lt-module-page__top lt-module-page-top">
            <div class="lt-module-page-top__title mr-auto">
                <h1>{{ (disableWizdomLicensePortal ? 'Wizdom upgrade' : 'Wizdom update request') | translate}}</h1>
            </div>
            <div ng-hide="isLatestVersion" class="lt-module-page-top__actions">
                <button ng-show="disableWizdomLicensePortal" class="btn btn-primary" ng-disabled="updatingWz || !sendMailTo || !iAccept" ng-click="doWizdomCloudUpgrade()">{{'Upgrade Wizdom' | translate}}</button>
                <button ng-show="!disableWizdomLicensePortal" class="btn btn-primary" ng-disabled="requesting || isLatestVersion || !(updateRequest.versionToUpdate && updateRequest.timeToUpdate && updateRequest.emailToNotify) || !iAccept" ng-click="requestWizdomUpdate()"> {{(requesting ? 'Requesting Update' : 'Schedule Update') | translate}}</button>
            </div>
        </div>

        <div class="panel lt-module-page__content-panel form-horizontal">
            <div class="alert alert-info" role="alert" ng-show="isLatestVersion">
                {{"You are already using the latest version of Wizdom!" | translate }} <br />
                {{"Your version is: " | translate }} {{ currentVersion }} <br />
                {{"The latest official Wizdom Release is: " | translate}} {{ latestWizdomVersion }} <br />
            </div>
            <div ng-hide="isLatestVersion">
                <div ng-show="disableWizdomLicensePortal">
                    <div class="form-group row">
                        <div class="col-sm-4">
                            <label class="control-label" for="sendMailTo">{{"Send info to this email when the installation process is finished." | translate}}</label>
                        </div>
                        <div class="col-sm-8">
                            <input type="text" ng-model="sendMailTo" id="sendMailTo" class="form-control" />
                        </div>
                    </div>
                </div>

                <div ng-show="!disableWizdomLicensePortal">
                    <div class="form-group row">
                        <div class="col-sm-4">
                            <label class="control-label">{{'Update to version' | translate}}</label>
                        </div>
                        <div class="col-sm-8">
                            <select class="form-control" ng-model="updateRequest.versionToUpdate" ng-options="version for version in updateVersions"></select>
                        </div>
                    </div>
                    <br />
                    <div class="form-group row">
                        <div class="col-sm-4">
                            <label class="control-label">{{'Time to update' | translate}}</label>
                        </div>
                        <div class="col-sm-8">
                            <div wizdom365-datetime-picker="" date="updateRequest.timeToUpdate" disable-weekends="false" show-date-picker="true" show-time-picker="true"></div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="col-sm-4">
                            <label class="control-label" for="emailToNotify">{{"Send info to this email when the installation process is finished." | translate}}</label>
                        </div>
                        <div class="col-sm-8">
                            <input type="email" id="emailToNotify" ng-model="updateRequest.emailToNotify" class="form-control" />
                        </div>
                    </div>
                </div>
                <div class="alert alert-info" role="alert" ng-show="updatingWz">
                    <span ng-if="requestSentMessage">{{requestSentMessage}}<br /></span>
                    {{"You will receive e-mail when the installation process is ready. The process should not take longer than 20 minutes. If you don't receive e-mail try again or contact Wizdom Support!" | translate }}
                </div>
                <br />
                
                <div class="alert alert-warning" role="alert">
                    {{"NOTE: The upgrade process will affect all files and folders included in the main Wizdom installation." | translate}}<br />
                    {{"This includes all the core files used to run Wizdom. It will not change/update customizations - please check these after the update is complete." | translate}}<br />
                    {{"All sitecollections with Wizdom installed will be affected and Wizdom will be unresponsive while being upgraded." | translate}}<br />
                    {{"You will receive a notification mail when the update is done. The upgrade process should not take longer than 20 minutes." | translate}}
                </div>
                <div class="form-group row">
                    <div class="col-sm-4">
                        <label for="iAcceptcheckbox">{{"I have read the note" | translate}}</label>
                    </div>
                    <div class="col-sm-8">
                        <input type="checkbox" ng-model="iAccept" id="iAcceptcheckbox" />
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div ng-hide="isCloudDeployment">
        <div class="lt-module-page__top lt-module-page-top">
            <div class="lt-module-page-top__title mr-auto">
                <h1>{{ 'Wizdom update' | translate}}</h1>
            </div>
        </div>
        <div class="panel lt-module-page__content-panel">
            {{ "Currently it is only available to upgrade Wizdom for websites hosted in Azure!" | translate }}
        </div>
    </div>

    <div ng-show="!canSendUpdateRequest && isCloudDeployment">
        <div class="lt-module-page__top lt-module-page-top">
            <div class="lt-module-page-top__title mr-auto">
                <h1>{{ 'Wizdom update' | translate}}</h1>
            </div>
        </div>
        <div class="panel lt-module-page__content-panel">
            {{ "We do not currently have a publishing profile for this license - updates cannot be applied remotely!" | translate }}
        </div>
    </div>
</div>
