<!--

    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="firmwares.$resolved">
    <div ng-include src="'partials/common-html/loading.html'"></div>
  </div>

  <div ng-if="firmwares.$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-5">

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'GATEWAY' | translate }}</label>
            <div class="col-sm-5">
              <select class="form-control" pf-select ng-model="node.gateway.id" ng-disabled="node.id" required >
                <option value="" ng-hide="true"></option>
                <option ng-repeat="gateway in gateways | orderBy:'displayName'" ng-bind-html="gateway.displayName | mcResourceRepresentation" value="{{gateway.id}}"  ng-selected="gateway.id == node.gateway.id"></option>
              </select>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'TYPE' | translate }}</label>
            <div class="col-sm-5">
              <select class="form-control" pf-select ng-options="nodeType.id as nodeType.displayName for nodeType in nodeTypes  | orderBy:'displayName'" ng-model="node.type">
                <option value="" ng-hide="true"></option>
              </select>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'SMART_SLEEP_ENABLED' | translate }}</label>
            <div class="col-sm-10">
             <input class="bootstrap-switch" id="bootstrap-switch-state" type="checkbox" ng-model="node.smartSleepEnabled" >
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'NAME' | translate }}</label>
            <div class="col-sm-10">
              <input class="form-control" ng-model="node.name" placeholder="{{ 'NODE_NAME' | translate }}"/>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'REGISTRATION_STATUS' | translate }}</label>
            <div class="col-sm-5">
              <select class="form-control" pf-select ng-options="nodeRstatus.id as nodeRstatus.displayName for nodeRstatus in nodeRstatuses  | orderBy:'displayName'" ng-model="node.registrationState">
                <option value="" ng-hide="true"></option>
              </select>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'EUI' | translate }}</label>
            <div class="col-sm-10">
              <input class="form-control" ng-model="node.eui" placeholder="{{ 'EUI' | translate }}" required />
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'VERSION' | translate }}</label>
            <div class="col-sm-10">
              <input class="form-control" ng-model="node.version" placeholder="{{ 'VERSION' | translate }}"/>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'LIBRARY_VERSION' | translate }}</label>
            <div class="col-sm-10">
              <input class="form-control" ng-model="node.libVersion" placeholder="{{ 'LIBRARY_VERSION' | translate }}"/>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'FIRMWARE' | translate }}</label>
            <div class="col-sm-10">
              <select class="form-control" pf-select data-live-search="true" ng-options="firmware.id as firmware.displayName for firmware in firmwares | orderBy:'displayName'" ng-model="node.firmware.id">
                <option value="" ng-hide="false">{{ 'NOTHING_SELECTED' | translate }}</option>
              </select>
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-2 control-label">{{ 'PROPERTIES' | translate }}</label>
            <div class="col-sm-10">
              <input class="form-control" placeholder="{{ 'PROPERTIES' | translate }}" ng-model="node.altproperties" pf-validation="cs.isJsonString(input)" required />
              <span class="help-block">{{ 'SYNTAX_ERROR' | translate }}</span>
            </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 -->
