<!--

    Copyright (C) 2015-2016 Jeeva Kandasamy (jkandasa@gmail.com)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div class="container-fluid"> <!-- Container-fluid -->

  <!-- Loading icon disaplay -->
  <div ng-hide="sensorVariable.$resolved">
    <div ng-include src="'partials/common-html/loading.html'"></div>
  </div>

  <div ng-show="sensorVariable.$resolved"> <!-- Main Message -->

    <!-- Page Header -->
    <div ng-include src="'partials/common-html/header-add-update.html'"></div>

    <div>
      <form class="form-horizontal" name="mcForm">
        <div class="col-md-6">

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'SENSOR' | translate }}</label>
            <div class="col-sm-10 mc-form-fixer-left">
              <label ng-bind-html="sensorVariable.resourceName | mcResourceRepresentation" ></label>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'TYPE' | translate }}</label>
            <div class="col-sm-10 mc-form-fixer-left">
              <span>{{ sensorVariable.type.locale}}</span>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'VALUE' | translate }}</label>
            <div class="col-sm-10 mc-form-fixer-left">
              <input class="form-control" placeholder="{{ 'PURGE_VALUE_RANGE_EXAMPLE' | translate }}" ng-model="item.value"/>
            </div>
          </div>

          <legend><small>{{ 'DATE_RANGE' | translate }}</small></legend>
          <!-- Validity -->
          <div class="form-group">
            <label class="col-sm-2 control-label"></label>

            <div class="col-sm-5 mc-form-fixer-left" uib-tooltip="{{ 'FROM' | translate}}" tooltip-placement="top">
              <div>
                <a class="dropdown-toggle" id="datetime1" role="button" data-toggle="dropdown" data-target="#" href="">
                  <div class="input-group">
                    <input type="text" class="form-control mc-show-disabled" data-ng-model="vFromString" ng-readonly="true">
                    <span class="input-group-addon">
                       <i class="fa fa-calendar fa-lg"></i>
                    </span>
                  </div>
                </a>
                <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                  <datetimepicker data-ng-model="purgeFrom" data-on-set-time="vFromString = getDateTimeDisplayFormat(newDate)" data-datetimepicker-config="{ dropdownSelector: '#datetime1', minuteStep:1 }"/>
                </ul>
              </div>
            </div>

            <div class="col-sm-5 mc-form-fixer" uib-tooltip="{{ 'TO' | translate}}" tooltip-placement="top">
              <div>
                <a class="dropdown-toggle" id="datetime2" role="button" data-toggle="dropdown" data-target="#" href="">
                  <div class="input-group">
                    <input type="text" class="form-control mc-show-disabled" data-ng-model="vToString" ng-readonly="true">
                    <span class="input-group-addon">
                       <i class="fa fa-calendar fa-lg"></i>
                    </span>
                  </div>
                </a>
                <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                  <datetimepicker data-ng-model="purgeTo" data-on-set-time="newDate.setSeconds(newDate.getSeconds() + 59); vToString = getDateTimeDisplayFormat(newDate)"
                    data-datetimepicker-config="{ dropdownSelector: '#datetime2', minuteStep:1 }"/>
                </ul>
              </div>
            </div>
          </div>

          <!-- Include save form buttons -->
          <div ng-include src="'partials/common-html/save-form.html'"></div>

        </div>
      </form>
    </div>

  </div> <!-- Main Message -->
</div> <!-- container -->
