<?xml version="1.0" standalone="yes"?>
<!DOCTYPE container>
<container
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:var="http://www.skyrix.com/od/binding"
    xmlns:const="http://www.skyrix.com/od/constant"
    xmlns:label="OGo:label"
    >
  <md-dialog flex="50" flex-sm="70" flex-xs="100">
    <form name="calendarPropertiesForm" ng-submit="properties.saveProperties(calendarPropertiesForm)">

      <md-toolbar>
        <div class="md-toolbar-tools">
          <!-- color -->
          <sg-color-picker ng-model="properties.calendar.color"><!-- color picker --></sg-color-picker>
          <!-- name -->
          <md-input-container class="md-block md-flex">
            <label><var:string label:value="Name"/></label>
            <input type="text"
                   class="md-title"
                   ng-model="properties.calendar.name"/>
          </md-input-container>
        </div>
      </md-toolbar>

      <md-dialog-content class="sg-has-form-sections">
        <div class="sg-form-section" layout="column">
          <md-checkbox
              ng-model="properties.calendar.includeInFreeBusy"
              ng-true-value="1"
              ng-false-value="0">
            <var:string label:value="Include in free-busy"/>
          </md-checkbox>
          <md-checkbox
              ng-model="properties.calendar.showCalendarAlarms"
              ng-true-value="1"
              ng-false-value="0">
            <var:string label:value="Show alarms"/>
          </md-checkbox>
          <md-checkbox
              ng-model="properties.calendar.showCalendarTasks"
              ng-true-value="1"
              ng-false-value="0">
            <var:string label:value="Show tasks"/>
          </md-checkbox>
          <var:if condition="isEasUIEnabled">
            <md-checkbox
                ng-model="properties.calendar.synchronize"
                ng-show="!properties.calendar.isWebCalendar"
                ng-disabled="properties.calendar.id == 'personal'"
                ng-true-value="1"
                ng-false-value="0">
              <var:string label:value="Synchronize"/> (Microsoft Enterprise ActiveSync)
            </md-checkbox>
          </var:if>
          <md-checkbox
              ng-model="properties.calendar.reloadOnLogin"
              ng-show="properties.calendar.isWebCalendar"
              ng-true-value="1"
              ng-false-value="0">
            <var:string label:value="Reload on login"/>
          </md-checkbox>
        </div>
        <div class="sg-form-section" ng-hide="properties.calendar.isWebCalendar || !properties.calendar.isOwned" layout="column">
          <md-checkbox
              ng-model="properties.calendar.notifications.notifyOnPersonalModifications"
              ng-true-value="1"
              ng-false-value="0">
            <var:string label:value="Receive a mail when I modify my calendar"/>
          </md-checkbox>
          <md-checkbox
              ng-model="properties.calendar.notifications.notifyOnExternalModifications"
              ng-true-value="1"
              ng-false-value="0">
            <var:string label:value="Receive a mail when someone else modifies my calendar"/>
          </md-checkbox>
          <md-checkbox
              ng-model="properties.calendar.notifications.notifyUserOnPersonalModifications"
              ng-true-value="1"
              ng-false-value="0">
            <var:string label:value="When I modify my calendar, send a mail to"/>
          </md-checkbox>
          <md-input-container flex-offset="5" md-no-float="md-no-float">
            <input type="text"
                   label:placeholder="Email Address"
                   ng-model="properties.calendar.notifiedUserOnPersonalModifications"
                   ng-pattern="properties.emailRE"
                   ng-required="properties.calendar.notifications.notifyUserOnPersonalModifications"
                   ng-disabled="!properties.calendar.notifications.notifyUserOnPersonalModifications"/>
          </md-input-container>
        </div>
      </md-dialog-content>

      <md-dialog-actions>
        <md-button type="button" ng-click="properties.close()"><var:string label:value="Cancel"/></md-button>
        <md-button type="submit" class="md-primary"
                   ng-disabled="calendarPropertiesForm.$invalid || calendarPropertiesForm.$submitted">
          <var:string label:value="Save"/>
        </md-button>
      </md-dialog-actions>

    </form>
  </md-dialog>
</container>
