<?php declare(strict_types=1); ?>

<?php $content = $viewModel->content(); ?>

<!-- Container -->
<div class="container">

<div class="row">
  <div class="col">
    <h1 class="page-title"><?php echo xss($viewModel->pageTitle()); ?></h1>
  </div>
</div>

    <form class="form-horizontal" action="<?php echo TFISH_ADMIN_USER_URL . 'edit/'; ?>" method="post"
      enctype="multipart/form-data" role="form" accept-charset="UTF-8">

      <!-- Email -->
      <div class="row justify-content-center">
        <div class="col-md-6 mb-3">
          <label for="adminEmail"><strong><?php echo TFISH_EMAIL; ?><span style="color:red">*</span></strong></label>
          <div class="form-group input-group">
            <input type="email" class="form-control" name="content[adminEmail]" id="adminEmail" required>
            <span class="input-group-text"><i class="fas fa-at"></i></span>
          </div>
        </div>
      </div>

      <!-- Password and login errors -->
      <div class="row justify-content-center">
        <div class="col-md-6 mb-3">
          <label for="password"><strong><?php echo TFISH_PASSWORD; ?><span style="color:red">*</span></strong></label>
            <div class="form-group input-group">
            <input type="password" class="form-control" name="content[password]" id="password" minlength="15"
              placeholder="<?php echo TFISH_MINIMUM_CHARACTERS; ?>" required>
            <input type="hidden" name="loginErrors" value="0">
            <span class="input-group-text" id="password-addon"><i class="fas fa-lock"></i></span>
          </div>
        </div>
      </div>

      <!-- Yubikey ID -->
      <div class="row justify-content-center">
          <div class="col-md-6 mb-3">
            <label for="yubikeyId"><strong><?php echo TFISH_USER_YUBIKEY_ID; ?></strong></label>
            <div class="form-group input-group">
              <input type="text" class="form-control" name="content[yubikeyId]" id="yubikeyId"
                pattern="[a-z]{12,12}" minlength="12" maxlength="12"
                placeholder="<?php echo TFISH_YUBIKEY_FIRST_12_CHARACTERS; ?>">
              <span class="input-group-text" id="password-addon"><i class="fas fa-key"></i></span>
            </div>
          </div>
      </div>

      <!-- Yubikey ID2 -->
      <div class="row justify-content-center">
        <div class="col-md-6 mb-3">
          <label for="yubikeyId2"><strong><?php echo TFISH_USER_YUBIKEY_ID . '2'; ?></strong></label>
          <div class="form-group input-group">
            <input type="text" class="form-control" name="content[yubikeyId2]" id="yubikeyId2"
              pattern="[a-z]{12,12}" minlength="12" maxlength="12"
              placeholder="<?php echo TFISH_YUBIKEY_FIRST_12_CHARACTERS; ?>">
            <span class="input-group-text" id="password-addon"><i class="fas fa-key"></i></span>
          </div>
        </div>
      </div>

      <!-- Yubikey ID3 -->
      <div class="row justify-content-center">
        <div class="col-md-6 mb-3">
          <label for="yubikeyId3"><strong><?php echo TFISH_USER_YUBIKEY_ID . '3'; ?></strong></label>
          <div class="form-group input-group">
            <input type="text" class="form-control" name="content[yubikeyId3]" id="yubikeyId3"
              pattern="[a-z]{12,12}" minlength="12" maxlength="12"
              placeholder="<?php echo TFISH_YUBIKEY_FIRST_12_CHARACTERS; ?>">
            <span class="input-group-text" id="password-addon"><i class="fas fa-key"></i></span>
          </div>
        </div>
      </div>

      <!-- Online status -->
      <div class="row justify-content-center">
        <div class="col-md-6 mb-3" id="onlineStatusContainer">
          <label for="onlineStatusContainer"><strong><?php echo TFISH_USER_PRIVILEGES; ?></strong></label>
          <div class="form-group input-group">
            <div class="form-check form-check-inline">
              <input class="form-check-input" type="radio" id="online" name="content[onlineStatus]" value="1">
              <label class="form-check-label" for="online"><?php echo TFISH_USER_ACTIVE; ?></label>
            </div>
            <div class="form-check form-check-inline">
              <input class="form-check-input" type="radio" id="offline" name="content[onlineStatus]" value="0" checked required>
              <label class="form-check-label" for="offline"><?php echo TFISH_USER_SUSPENDED; ?></label>
            </div>
          </div>
        </div>
      </div>

      <!-- Action buttons -->
      <div class="row justify-content-center">
        <div class="col-md-6 text-left">
            <input type="hidden" name="token" value="<?php echo xss($_SESSION['token']); ?>" />
            <button name="action" value="save" type="submit" class="btn btn-primary"><?php echo TFISH_SUBMIT; ?></button>
            <button name="action" value="cancel" type="submit" class="btn btn-primary" formnovalidate><?php echo TFISH_CANCEL; ?></button>
        </div>
      </div>

    </form>

</div>
