<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/fontawesome/css/fontawesome.css" rel="stylesheet" />
    <link href="/fontawesome/css/solid.css" rel="stylesheet" />
    <title>Edit registration</title>
  </head>
  <body>
    {{ template "nav.html" . }}
    {{if .error}}
    <div class="container pt-5">
      <div class="alert alert-danger" role="alert">
        <h4 class="alert-heading">Oh no!</h4>
        <hr>
        <p class="mb-0">{{.error}}.</p>
      </div>
    </div>
    {{end}}
    {{if eq .remainingDays 0}}
    <div class="container pt-5">
      <div class="alert alert-danger" role="alert">
        <h4 class="alert-heading">Registration inactive!</h4>
        <hr>
        <p class="mb-0">Your registration is not yet active. Have you completed the payment yet?</p>
        <a class="btn btn-primary" href="/name/{{.label}}/buy">Complete registration for {{.extensionDaysCount}} days until <b>{{.extendedExpiration}}</b> for <b>{{.cost}}</b></a>            
      </div>
    </div>
    {{end}}
    <div class="container pt-5">
      <h1 class="mb-5">Manage registration for <i class="text-primary">{{.label}}</i></h1>
      <form action="/name/{{.label}}/edit" method="post" class="align-items-center mb-5">
        <div class="row">
          <div class="col-md-12 alert alert-light">
            <h4>Zone information</h4>
            <input type="hidden" value="{{.token}}" name="token">
            {{if ne .remainingDays 0}}
            <div class="form-floating mb-3">
              <input name="zkey" id="zkeyInput" class="form-control" value="{{.zkey}}" maxlength="63" type="text" placeholder="Enter your zone key here!" required autofocus>
              <label for="zkeyInput">Enter your PKEY or EDKEY here</label>
            </div>
            <input class="btn btn-primary" type="submit" value="Update zone key">
            {{else}}
            <div class="form-floating mb-3">
              <input name="zkey" id="zkeyInput" class="form-control" value="{{.zkey}}" readonly maxlength="63" type="text" placeholder="Enter your zone key here!" required autofocus>
              <label for="zkeyInput">Enter your PKEY or EDKEY here</label>
            </div>
            {{end}}
          </div>
        </div>
      </form>
      {{if ne .remainingDays 0}}
      <div class="row mt-1">
        <div class="col-md-12 alert alert-light">
          <h4>Extension</h4>
          <div class="form-floating mb-3">
            <input readonly id="expInput" class="form-control" value="{{.registeredUntil}}" type="text" required autofocus>
            <label for="expInput">Registration expires in {{.remainingDays}} days:</label>
          </div>
          <a class="btn btn-primary" href="/name/{{.label}}/buy">Extend registration for {{.extensionDaysCount}} days until <b>{{.extendedExpiration}}</b> for <b>{{.cost}}</b></a>            
        </div>
      </div>
    </div>
    {{end}}
    <hr/>
    <a class="btn btn-secondary" href="/">Back</a>
    {{ template "footer.html" . }}
  </body>
</html>
