<!--Content-->
<div class="modal-content">
    <div class="modal-header text-center">
        <button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()">
            <span aria-hidden="true">×</span>
        </button>
        <h4 class="modal-title w-100 font-weight-bold">Edit Provision</h4>
    </div>
    <div class="modal-body" style="max-height: 650px; overflow: auto;">
        <div *ngIf="provision._scenarioDoc && provision._scenarioDoc.isDivvyEnabled" style="background: #f0f0f0; padding: 15px 15px; margin: 7px 0px;">
            <div>
              <h5><mdb-icon far icon="clock"></mdb-icon> VMs Running schedule</h5>
            </div>
            <p [ngClass]="{'disabled': scheduleData.is24x7}" style="font-size: 12px;"><i>Everyday VMs for this scenario will startup and shutdown as scheduled bellow.</i></p>
            <div [ngClass]="{'disabled': scheduleData.is24x7}">
                Timezone is <b>{{getUTCTimes().timezone}}</b> <i>(times relative to this timezone)</i>
            </div>
            <div class="row" [ngClass]="{'disabled': scheduleData.is24x7}">
              <div class="col-sm-6">
                <section style="padding: 10px 0px;">
                  <mdb-checkbox [default]="true" [checked]="scheduleData.isStartupTimeEnable" (change)="checkOnchangeStartupTime($event)"><b>Startup time:</b></mdb-checkbox>
                </section>
                <div [ngClass]="{'disabled': !scheduleData.isStartupTimeEnable}"><ngb-timepicker readonly="true" style="font-size: 10px;" [(ngModel)]="scheduleData.startupTime" [meridian]="true" [minuteStep]="15" [disabled]="scheduleData.is24x7 || !scheduleData.isStartupTimeEnable"></ngb-timepicker></div>
                <div [ngClass]="{'disabled': !scheduleData.isStartupTimeEnable}" class="utc">
                  <i>UTC time: {{getUTCTimes().startupTime}}</i>
                </div>
              </div>
              <div class="col-sm-6">
                <section style="padding: 10px 0px;">
                  <mdb-checkbox [default]="true" [checked]="true" [disabled]="true"><b>Shutdown time:</b></mdb-checkbox>
                </section>
                <ngb-timepicker style="font-size: 10px;" [(ngModel)]="scheduleData.shutdownTime" [meridian]="true" [minuteStep]="15" [disabled]="scheduleData.is24x7"></ngb-timepicker>
                <div class="utc">
                  <i>UTC time: {{getUTCTimes().shutdownTime}}</i>
                </div>
              </div>
            </div>
            <hr>
            <section style="padding: 0px; margin: 0px 20px">
              <mdb-checkbox [default]="false" [checked]="scheduleData.is24x7" (change)="checkOnchangeSchedule($event)">Run 24x7 <i>(<mdb-icon fas icon="exclamation-triangle"></mdb-icon> requires permission from regional manager)</i></mdb-checkbox>
            </section>
            <div style="padding-left: 25px;font-size: 12px;">
              <mdb-icon fas icon="long-arrow-alt-right"></mdb-icon> VMs will run 24 hours during 7 days. Then, if 24x7 is not renewed, VMs will shutdown.
            </div>
        </div>
        <div *ngIf="currentUser && (currentUser.role === 'admin' || currentUser.role === 'superadmin')">
          <section style="padding: 20px 0px;">
              <label><mdb-icon fas icon="user"></mdb-icon> Change Owner (*):</label>
              <select class="browser-default custom-select custom-select-sm" [(ngModel)]="selectedUser">
                <option *ngFor="let item of users" [value]="item._id">{{item.displayName}}</option>
              </select>
          </section>
        </div>
    </div>
    
    <div class="modal-footer d-flex justify-content-center">
      <button style="margin-right: 100px;" *ngIf="sendData._id" mdbBtn color="danger" outline="true" class="waves-light" size="sm" mdbWavesEffect (click)="delete();">Delete</button>
      <button mdbBtn color="dark-green" size="sm" outline="true" class="waves-effect" mdbWavesEffect (click)="modalRef.hide()">Cancel</button>
      <button mdbBtn color="dark-green" class="waves-light" size="sm" mdbWavesEffect (click)="confirm();">Save</button>
    </div>
</div>
<!--/.Content-->