<!--

    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 mc-top-space-1x"> <!-- Container-fluid -->

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

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

    <!-- Email settings -->
    <div class="col-md-12">
      <div class="card-pf card-pf-accented">
        <div class="card-pf-heading"><h2 class="card-pf-title"><i class="pficon pficon-user fa-lg"></i> {{ 'PROFILE' | translate }}</h2></div>
        <div class="card-pf-body">
          <form class="form-horizontal">

            <div class="form-group">
              <label class="col-sm-2 control-label">{{ 'USERNAME' | translate }}</label>
              <div class="col-sm-7">
                <span>{{item.user.username}}</span>
              </div>
            </div>


            <div class="form-group">
              <label class="col-sm-2 control-label">{{ 'FULL_NAME' | translate }}</label>
              <div class="col-sm-7">
                <input ng-show="editEnable.profile" class="form-control" ng-model="item.user.fullName"/>
                <span ng-hide="editEnable.profile">{{item.user.fullName}}</span>
              </div>
            </div>

            <div class="form-group">
              <label class="col-sm-2 control-label">{{ 'EMAIL' | translate }}</label>
              <div class="col-sm-7">
                <input ng-show="editEnable.profile" class="form-control" ng-model="item.user.email"/>
                <span ng-hide="editEnable.profile">{{item.user.email}}</span>
              </div>
            </div>

            <div ng-show="editEnable.profile">
              <div class="form-group">
                <label class="col-sm-2 control-label">{{ 'CURRENT_PASSWORD' | translate }}</label>
                <div class="col-sm-7">
                  <input type="password" class="form-control" placeholder="{{ 'CURRENT_PASSWORD' | translate }}" ng-model="item.currentPassword"/>
                </div>
              </div>

              <div class="form-group">
                <label class="col-sm-2 control-label">{{ 'NEW_PASSWORD' | translate }}</label>
                <div class="col-sm-7">
                  <input type="password" class="form-control" placeholder="{{ 'NEW_PASSWORD' | translate }}" ng-model="item.user.password"/>
                </div>
              </div>
            </div>


          </form>

          <div class="form-actions text-right">
            <button type="button" class="btn btn-default" class="button" ng-hide="editEnable.profile" ng-click="editEnable.profile = true">{{ 'EDIT' | translate }}</button>
            <button type="button" class="btn btn-default" class="button" ng-show="editEnable.profile" ng-click="resetProfile();editEnable.profile = false">{{ 'CANCEL' | translate }}</button>
            <button type="button" class="btn btn-primary" ng-click="save()"  ng-show="editEnable.profile" ng-disabled="saveProgress">
              <div ng-show="saveProgress" class="spinner spinner-xs"></div>
              {{ 'SAVE' | translate }}
            </button>
          </div>
        </div>
      </div>
    </div>

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