<div class="modal-header" ng-show="isSignUp">
    <button type="button" class="close closebtn" data-ng-click="signupForm.close()" aria-hidden="true">&times;</button>
    <h1 class="modal-title" ng-if="isSignUp && !isCancel">{{"Signup" | translate}}</h1>
    <h1 class="modal-title" ng-if="isSignUp && isCancel">{{"Cancel signup" | translate}}</h1>
    <h1 class="modal-title" ng-if="!isSignUp && !isCancel">{{"Sign up to waiting list" | translate}}</h1>
    <h1 class="modal-title" ng-if="!isSignUp && isCancel">{{"Remove from waiting list" | translate}}</h1>
</div>
<div class="modal-body signup-form" ng-show="isSignUp">
    <div wizdom365-spinner="" loading="signupForm.loading || signupForm.working"></div>
    <div class="w365cm" ng-hide="signupForm.loading">
        <form>
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <h2>{{course.title}}</h2>
                            <table class="course-info-table">
                                <tr>
                                    <td class="label-col"><label class="control-label">{{'Time' | translate}}:</label></td>
                                    <td>{{course.startdate | date:'short' }} - {{course.enddate | date: 'short' }}</td>
                                </tr>
                                <tr>
                                    <td><label class="control-label">{{'Number of free places' | translate}}:</label></td>
                                    <td>{{course.freeplaces}}</td>
                                </tr>
                            </table>
                        </div>
                        <div class="form-group message-to-teacher" ng-if="course.freeplaces > 0">
                            <label class="control-label">{{'Message to the teacher' | translate}}</label>
                            <textarea class="form-control" ng-model="signupForm.message" style="height:150px"
                                      validate="{between:'signupForm.validateByRegex($value, signupForm.validation.regex.between_text_only)'}"
                                      between-error-message="{{'The message must be a maximum of 1000 characters' | translate}}" />
                            <!--<textarea class="form-control" ui-tinymce="signupForm.tinyMceOptions" />-->
                        </div>
                        <div class="form-group" ng-if="!isCancel && course.freeplaces == 0">
                            {{'The course is fully booked.' | translate}}
                            <span ng-if="course.enableWaitingList">
                                {{'Would you like to be on waiting list?' | translate}}
                            </span>
                            <span ng-if="!course.enableWaitingList">
                                {{'You can subscribe to our newsletter to get latest updates' | translate}}
                            </span>

                        </div>
                        <div ng-if="isSignUp && isCancel">
                            {{'Are you sure you want to cancel your signup?'|translate}}
                            <div ng-if="course.enableWaitingList && course.freeplaces == 0 && dateNow < course.deadLine">{{'The available place would automatically be taken by next person on waiting list' | translate}}</div>
                        </div>
                        <div ng-if="!isSignUp && isCancel">
                            {{'Are you sure you want be removed from waiting list?'|translate}}
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<div class="modal-footer"  ng-show="isSignUp">
    <button ng-disabled="signupForm.working" ng-click="signupForm.close()" class="btn btn-default wiz-btn-padding">{{'Close' | translate}}</button>
    &nbsp;&nbsp;
    <button class="btn btn-success wiz-btn-padding" ng-disabled="signupForm.working || signupForm.invalid" ng-if="!isCancel && course.freeplaces > 0" ng-click="signupForm.signup()">{{'Signup' | translate}}</button>
    <button class="btn btn-success wiz-btn-padding" ng-disabled="signupForm.working || signupForm.invalid" ng-if="isSignUp && isCancel" ng-click="signupForm.cancelSignup()">{{'Cancel signup' | translate}}</button>
    <button class="btn btn-success wiz-btn-padding" ng-disabled="signupForm.working || signupForm.invalid" ng-if="!isCancel && course.freeplaces == 0 && course.enableWaitingList" ng-click="signupForm.addToWaitingList()">{{'Sign up to waiting list' | translate}}</button>
    <button class="btn btn-success wiz-btn-padding" ng-disabled="signupForm.working || signupForm.invalid" ng-if="!isSignUp && isCancel && course.enableWaitingList" ng-click="signupForm.removeFromWaitingList()">{{'Remove from waiting list' | translate}}</button>
</div>