<div class="modal-header">
  <button type="button" class="close" ng-click="cancel()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <h3 class="modal-title">Import certificate <span class="text-muted"><small>{{ pendingCertificate.name }}</small></span></h3>
</div>

<div class="modal-body">
  <form name="uploadForm" class="form-horizontal" role="form" novalidate>
    <div class="form-group"
         ng-class="{'has-error': uploadForm.publicCert.$invalid, 'has-success': !uploadForm.publicCert.$invalid&&uploadForm.publicCert.$dirty}">
      <label class="control-label col-sm-2">
        Public Certificate
      </label>
      <div class="col-sm-10">
                <textarea name="publicCert" ng-model="pendingCertificate.body" placeholder="PEM encoded string..."
                          class="form-control" ng-pattern="/^-----BEGIN CERTIFICATE-----/" required></textarea>
        <p ng-show="uploadForm.publicCert.$invalid && !uploadForm.publicCert.$pristine" class="help-block">Enter
          a valid certificate.</p>
      </div>
    </div>
    <div class="form-group"
         ng-class="{'has-error': uploadForm.owner.$invalid&&uploadform.intermediateCert.$dirty, 'has-success': !uploadForm.intermediateCert.$invalid&&uploadForm.intermediateCert.$dirty}">
      <label class="control-label col-sm-2">
        Intermediate Certificate
      </label>
      <div class="col-sm-10">
                <textarea name="intermediateCert" ng-model="pendingCertificate.chain"
                          placeholder="PEM encoded string..." class="form-control"
                          ng-pattern="/^-----BEGIN CERTIFICATE-----/"></textarea>
        <p ng-show="uploadForm.intermediateCert.$invalid && !uploadForm.intemediateCert.$pristine"
           class="help-block">Enter a valid certificate.</p>
      </div>
    </div>
  </form>
</div>
  <div class="modal-footer">
    <button type="submit" ng-click="save(pendingCertificate)" ng-disabled="uploadForm.$invalid" class="btn btn-success">
      Import
    </button>
    <button ng-click="cancel()" class="btn btn-danger">Cancel</button>
  </div>
</div>
