<div class="https-file-res">
  <div class="card card-default key mb-1">
    <div class="card-body clearfix">
      <span data-translate>Private Key</span>
      <span>(PEM)</span>
      <span class="float-right">
        <span class="file-upload" data-ng-if="!tls_config.files.key.set">
          <label id="keyUpload" file-input="postFile(file, file_resources.key)" file-input-label="Upload" class="file-upload btn btn-sm btn-primary"></label>
        </span>
        <button id="pkGen" class="btn btn-sm btn-primary" data-ng-if="!tls_config.files.key.set" data-ng-click="gen_key()">
            <i class="fa-solid fa-cog"></i>
          <span data-translate>Generate</span>
        </button>
        <span data-ng-if="tls_config.files.key.set">
          <button id="deleteKey" class="btn btn-sm btn-danger" data-ng-click="deleteFile(file_resources.key)">
            <i class="fa-solid fa-times"></i>
            <span data-translate>Delete</span>
          </button>
        </span>
      </span>
    </div>
  </div>

  <div data-ng-if="tls_config.files.key.set && !tls_config.acme" class="card card-default csr mb-1">
    <div class="card-body clearfix">
      <span data-translate>Certificate Signing Request</span>
      <span>(PEM)</span>
      <span data-ng-if="!tls_config.files.csr.set">
        <span class="float-right">
          <button id="csrGen" class="btn btn-sm btn-primary" data-ng-hide="csr_state.open" data-ng-click="csr_state.open = true">
            <i class="fa-solid fa-cog"></i>
            <span data-translate>Generate</span>
          </button>
          <button type="submit" class="close" data-ng-show="csr_state.open" data-ng-click="csr_state.open = false" aria-label="Close">&times;</button>
        </span>
        <div data-ng-show="csr_state.open">
          <hr />
          <div data-ng-include="'views/admin/network/https_csr_gen.html'"></div>
        </div>
      </span>
      <span data-ng-if="tls_config.files.csr.set" class="clearfix">
        <span class="float-right">
          <button id="downloadCsr" class="btn btn-sm btn-primary" data-ng-click="downloadFile(file_resources.csr)">
            <i class="fa-solid fa-file-export"></i>
            <span data-translate>Download</span>
          </button>
          <button id="deleteCsr" class="btn btn-sm btn-danger" data-ng-click="deleteFile(file_resources.csr)">
            <i class="fa-solid fa-times"></i>
            <span data-translate>Delete</span>
          </button>
        </span>
      </span>
    </div>
  </div>

  <div class="card card-default cert mb-1">
    <div class="card-body clearfix">
      <span data-translate>Certificate</span>
      <span>(PEM)</span>
      <span data-ng-show="tls_config.files.cert.set" class="badge badge-primary">
        <span data-translate>Valid until:</span> {{tls_config.files.cert.expiration_date | date:'dd-MM-yyyy HH:mm'}}
        <span data-translate>Issuer:</span> <b>{{tls_config.files.cert.issuer}}</b>
      </span>
      <span class="float-right">
        <span class="file-upload" data-ng-if="!tls_config.files.cert.set">
          <label id="certUpload" file-input="postFile(file, file_resources.cert)" file-input-label="Upload" class="file-upload btn btn-sm btn-primary"></label>
        </span>
        <span data-ng-if="tls_config.files.cert.set">
          <button id="deleteCert" class="btn btn-sm btn-danger" data-ng-click="deleteFile(file_resources.cert)">
            <i class="fa-solid fa-times"></i>
            <span data-translate>Delete</span>
          </button>
        </span>
      </span>
    </div>
  </div>

  <div class="card card-default chain mb-1">
    <div class="card-body clearfix">
      <span data-translate>Intermediate Certificates</span>
      <span>(PEM)</span>
      <span data-ng-show="tls_config.files.chain.set" class="badge badge-primary">
        <span data-translate>Valid until:</span> {{tls_config.files.chain.expiration_date | date:'dd-MM-yyyy HH:mm'}}
        <span data-translate>Issuer:</span> <b>{{tls_config.files.chain.issuer}}</b>
      </span>
      <div class="float-right">
        <span class="file-upload" data-ng-if="!tls_config.files.chain.set">
          <label id="chainUpload" file-input="postFile(file, file_resources.chain)" file-input-label="Upload" class="file-upload btn btn-sm btn-primary"></label>
        </span>
        <span data-ng-if="tls_config.files.chain.set">
          <button id="deleteChain" class="btn btn-sm btn-danger" data-ng-click="deleteFile(file_resources.chain)">
            <i class="fa-solid fa-times"></i>
            <span data-translate>Delete</span>
          </button>
        </span>
      </div>
    </div>
  </div>

  <button class="btn btn-primary" data-ng-if="state > 1" data-ng-click="toggleCfg()" data-translate>Enable</button>
  <button class="btn btn-danger" data-ng-click="resetCfg()" data-translate>Reset</button>
</div>
