<div class="card">
  <div class="card-body">

    <h3 class="card-title">{lang key='domaindnssectabname'}</h3>

    {include file="$template/includes/alert.tpl" type="info" msg="{lang key='domaindnssecexp'}"}
    {if $dnssectype}
      {include file="$template/includes/alert.tpl" type="info" msg="{lang key='domaindnssecexp1'}"}
    {else}
      {include file="$template/includes/alert.tpl" type="info" msg="{lang key='domaindnssecexp2'}"}
    {/if}


    {if $updatesuccess}
      {include file="$template/includes/alert.tpl" type="success" msg="{lang key='netim_request_success_dnssec'}"
      textcenter=true}
    {elseif $updateerror}
      {include file="$template/includes/alert.tpl" type="error" msg="{lang key='netim_request_error_dnssec'}"
      textcenter=true}
    {elseif $updatepending}
      {include file="$template/includes/alert.tpl" type="success" msg={lang key='netim_request_pending_client_change'}
      textcenter=true}
    {/if}
    {if $loaderror}
      {include file="$template/includes/alert.tpl" type="error" msg="{lang key='netim_request_error_dnssec_get'}"
      textcenter=true}
    {elseif $netim_dnssec_pending}
      {include file="$template/includes/alert.tpl" type="warning" msg="<i class='fas fa-exclamation-triangle fa-fw'></i>  {lang key='netim_request_pending_client'}"
      textcenter=true}
    {/if}

    <br />
    <table class="table table-striped">
      <thead>
        {if $dnssectype}
          <tr>
            <th>{lang key='domaindnssecflags'}</th>
            <th>{lang key='domaindnssecprotocol'}</th>
            <th>{lang key='domaindnssecalg'}</th>
            <th>{lang key='domaindnssecpubkey'}</th>
            <th>{lang key='domaindnssecdelete'}</th>
          </tr>
        {else}
          <tr>
            <th>{lang key='domaindnsseckeytag'}</th>
            <th>{lang key='domaindnssecalg'}</th>
            <th>{lang key='domaindnssecdigesttype'}</th>
            <th>{lang key='domaindnssecdigest'}</th>
            <th>{lang key='domaindnssecdelete'}</th>
          </tr>
        {/if}
      </thead>
      <tbody>
        {if empty($dnssec)}
          <td colspan="5" class="text-center">{lang key='domaindnssecnorecords'}</td>
        {else}
          {if $dnssectype}
            <tr>
              <form method="post" action="{$smarty.server.PHP_SELF}?action=domaindetails">
                <input type="hidden" name="id" value="{$domainid}">
                <input type="hidden" name="modop" value="custom" />
                <input type="hidden" name="a" value="clientManageDNSSEC" />
                <td><input type="text" name="flags" class="form-control" value="{$dnssec.flags}" readonly /></td>
                <td><input type="text" name="protocol" class="form-control" value="{$dnssec.protocol}" readonly />
                <td><input type="text" name="alg" class="form-control" value="{$dnssec.algo}" readonly /></td>
                </td>
                <td><input type="text" name="pubkey" class="form-control" value="{$dnssec.pubKey}" readonly /></td>
                <td><button type="submit" class="btn btn-danger customDeleteButton" name="deletednssec"
                    id="deletednssec">{lang key='dotsoftepp.delete'}</button>
                </td>
              </form>
            </tr>
          {else}
            {foreach $dnssec as $dnssecparcours}
              <tr>
                <form method="post" action="{$smarty.server.PHP_SELF}?action=domaindetails">
                  <input type="hidden" name="id" value="{$domainid}">
                  <input type="hidden" name="modop" value="custom" />
                  <input type="hidden" name="a" value="clientManageDNSSEC" />
                  <input type="hidden" name="id" value="{$domainid}">
                  <input type="hidden" name="modop" value="custom" />
                  <input type="hidden" name="a" value="clientManageDNSSEC" />
                  <td><input type="text" name="keytag" class="form-control" value="{$dnssecparcours.key}" readonly /></td>
                  <td><input type="text" name="alg" class="form-control" value="{$dnssecparcours.algo}" readonly /></td>
                  <td><input type="text" name="digesttype" class="form-control" value="{$dnssecparcours.type}" readonly />
                  </td>
                  <td><input type="text" name="digest" class="form-control" value="{$dnssecparcours.digest}" readonly />
                  </td>
                  <td><button type="submit" class="btn btn-danger customDeleteButton" name="deletednssec"
                      id="deletednssec">{lang key='dotsoftepp.delete'}</button>
                  </td>
                </form>
              </tr>
            {/foreach}
          {/if}
        {/if}
      </tbody>
    </table>
    <hr />
    <br />

    <h4 class="card-title">{lang key='domaindnssecadd'}</h4>
    {if $dnssectype}
      <form method="post" action="{$smarty.server.PHP_SELF}?action=domaindetails">
        <input type="hidden" name="id" value="{$domainid}">
        <input type="hidden" name="modop" value="custom" />
        <input type="hidden" name="a" value="clientManageDNSSEC" />
        <table class="table table-striped">
          <thead>
            <tr>
              <th>{lang key='domaindnssecflags'}</th>
              <th>{lang key='domaindnssecprotocol'}</th>
              <th>{lang key='domaindnssecalg'}</th>
              <th>{lang key='domaindnssecpubkey'}</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td><input type="text" name="flags" class="form-control" required /></td>
              <td><input type="text" name="protocol" class="form-control" required /></td>
              <td><input type="text" name="alg" class="form-control" required /></td>
              <td><input type="text" name="pubkey" class="form-control" /></td>
            </tr>
          </tbody>
        </table>
        {if empty($dnssec)}
          <p class="text-center"> <button type="submit" class="btn btn-lg btn-success" name="actionadd"
              id="actionadd">{lang key='domaindnssecadd'}</button>
          </p>
        {else}
          <p class="text-center"> <button type="submit" class="btn btn-lg btn-success" name="actionadd"
              id="actionadd">{lang key='domaindnssecedit'}</button>
          </p>
        {/if}
      </form>
    {else}
      <form method="post" action="{$smarty.server.PHP_SELF}?action=domaindetails">
        <input type="hidden" name="id" value="{$domainid}">
        <input type="hidden" name="modop" value="custom" />
        <input type="hidden" name="a" value="clientManageDNSSEC" />
        <table class="table table-striped">
          <thead>
            <tr>
              <th>{lang key='domaindnsseckeytag'}</th>
              <th>{lang key='domaindnssecalg'}</th>
              <th>{lang key='domaindnssecdigesttype'}</th>
              <th>{lang key='domaindnssecdigest'}</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td><input type="text" name="keytag" class="form-control" required /></td>
              <td><input type="text" name="alg" class="form-control" required /></td>
              <td><input type="text" name="digesttype" class="form-control" required /></td>
              <td><input type="text" name="digest" class="form-control" required /></td>
            </tr>
          </tbody>
        </table>
        <p class="text-center"> <button type="submit" class="btn btn-lg btn-success" name="actionadd"
            id="actionadd">{lang key='domaindnssecadd'}</button>
        </p>
      </form>
    {/if}
  </div>
</div>