<!-- Modal change avatar -->
<div class="modal fade" id="avatarChangeModal" tabindex="-1" role="dialog">
  <div class="modal-dialog">
      <div class="modal-content">
          <div class="modal-header">
              <h4 class="modal-title">{{ 'branding.changeLogo.title' | tr }}</h4>
          </div>
          <div class="modal-body branding-avatar-selector">
              <img id="previewAvatar" width="128" height="128" ng-src="{{ avatarChange.avatarUrl() }}"/>
              <input type="file" id="avatarFileInput" style="display: none" accept="image/*"/>

              <br/>
              <br/>

              <div class="grid">
                  <div class="item" ng-repeat="avatar in avatarChange.availableAvatars" style="background-image: url('{{avatar.data || avatar.url}}');" ng-click="avatarChange.setPreviewAvatar(avatar)"></div>
                  <div class="item add" ng-click="avatarChange.showCustomAvatarSelector()"></div>
              </div>
          </div>
          <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">{{ 'main.dialog.cancel' | tr }}</button>
              <button type="button" class="btn btn-success" ng-click="avatarChange.setAvatar()"> {{ 'main.dialog.save' | tr }}</button>
          </div>
      </div>
  </div>
</div>

<div class="content">

  <div class="text-left">
    <h1>{{ 'branding.title' | tr }}</h1>
  </div>

  <div class="card" style="margin-bottom: 15px;">

    <div class="row">
      <div class="col-md-12">
        <form role="form" name="aboutForm" ng-submit="about.submit()" autocomplete="off">
          <fieldset>
            <div class="form-group" ng-class="{ 'has-error': (aboutForm.name.$dirty && aboutForm.name.$invalid) }">
              <label class="control-label">{{ 'branding.cloudronName' | tr }}</label>
              <div class="control-label" ng-show="about.error.cloudronName">{{about.error.cloudronName}}</div>
              <input type="text" class="form-control" id="inputCloudronName" name="name" ng-model="about.cloudronName" maxlength="64">
            </div>

            <div class="form-group">
              <div>
                <label class="control-label">{{ 'branding.logo' | tr }}</label>
              </div>
              <div class="branding-avatar" ng-click="avatarChange.showChangeAvatar()">
                <img ng-src="{{ about.avatarUrl() }}"/>
                <div class="overlay"></div>
              </div>
            </div>

            <input class="ng-hide" type="submit" ng-disabled="(!about.avatar && !aboutForm.$dirty) || aboutForm.$invalid || about.busy"/>
          </fieldset>
        </form>
      </div>
    </div>

    <div class="row">
      <div class="col-md-12 text-right">
        <button class="btn btn-outline btn-primary pull-right" ng-click="about.submit()" ng-disabled="(!about.avatar && !aboutForm.$dirty) || aboutForm.$invalid || about.busy"><i class="fa fa-circle-notch fa-spin" ng-show="about.busy"></i> {{ 'main.dialog.save' | tr }}</button>
      </div>
    </div>

  </div>

  <div class="text-left">
    <h3>{{ 'branding.footer.title' | tr }}</h3>
  </div>

  <div class="card" ng-show="config.features.branding">
    <div class="row">
      <div class="col-md-12">
        <form role="form" name="footerForm" autocomplete="off">
          <p>{{ 'branding.footer.description' | tr }} <sup><a ng-href="https://docs.cloudron.io/branding/#footer" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup></p>
          <textarea name="footer" class="form-control" ng-model="footer.content" ng-disabled="footer.busy"></textarea>
        </form>
      </div>
    </div>
    <br/>
    <div class="row">
      <div class="col-md-12 text-right">
        <button class="btn btn-outline btn-primary pull-right" ng-click="footer.submit()" ng-disabled="!footerForm.$dirty || footerForm.$invalid || footer.busy"><i class="fa fa-circle-notch fa-spin" ng-show="footer.busy"></i> {{ 'main.dialog.save' | tr }}</button>
      </div>
    </div>
  </div>

  <div class="card" ng-hide="config.features.branding">
    <div class="row">
      <div class="col-md-12">
        {{ 'branding.footer.subscriptionRequired' | tr }} <a href="" class="pull-right" ng-click="openSubscriptionSetup()">{{ 'branding.footer.setupSubscriptionNow' | tr }}</a>
      </div>
    </div>
  </div>
</div>
