
<!-- Extend area where template is defined -->
<?= $this->extend('templates/adminlte/nomenu') ?>
<!-- .Extend -->

<!-- Title of the page -->
<?= $this->section('title') ?><?= lang('Auth.login') ?> <?= $this->endSection() ?>
<!-- .Title -->

<!-- CSS of the page -->
<?= $this->section('css') ?>
<!-- icheck bootstrap -->
<link rel="stylesheet" href="<?= base_url() ?>adminlte/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
<?= $this->endSection() ?>
<!-- .CSS -->

<!-- body attribute - class definition -->
<?= $this->section('bodyclass') ?>login-page<?= $this->endSection() ?>
<!-- .body attribute -->

<!-- Main content -->
<?= $this->section('main') ?>
<div class="login-box">
  <div class="login-logo">
    <a href="/"><p><b>Karat World</b> Login</p></a>
  </div>
  
  <div class="card">
    <div class="card-body login-card-body">

      <?php include('templates/adminlte/errormessage.php'); ?>

      <?php if (session('message') !== null) : ?>
      <div class="alert alert-success" role="alert"><?= session('message') ?></div>
      <?php endif ?>

      <p class="login-box-msg">Sign in to start your session</p>

      <form action="<?= url_to('login') ?>" method="post">
        <?= csrf_field() ?>

        <div class="input-group mb-3">
          <input type="text" class="form-control" id="floatingUsernameInput" name="username" inputmode="username" autocomplete="username" placeholder="<?= lang('Auth.username') ?>" value="<?= old('username') ?>" required>
          <div class="input-group-append">
            <div class="input-group-text">
              <span class="fas fa-user"></span>
            </div>
          </div>
        </div>
        <div class="input-group mb-3">
          <input type="password" class="form-control" id="floatingPasswordInput" name="password" inputmode="text" autocomplete="current-password" placeholder="<?= lang('Auth.password') ?>" required>
          <div class="input-group-append">
            <div class="input-group-text">
              <span class="fas fa-lock"></span>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col-8">
            <?php if (setting('Auth.sessionConfig')['allowRemembering']): ?>
              <div class="icheck-primary">
                <input type="checkbox" id="remember">
                <label for="remember" <?php if (old('remember')): ?> checked<?php endif ?>>
                  Remember Me
                </label>
              </div>
            <?php else: ?>
              &nbsp;
            <?php endif; ?>
          </div>
          <!-- /.col -->
          <div class="col-4">
            <button type="submit" class="btn btn-primary btn-block">Sign In</button>
          </div>
          <!-- /.col -->
        </div>
      </form>

      <?php if (setting('Auth.allowMagicLinkLogins')) : ?>
          <p class="text-left"><?= lang('Auth.forgotPassword') ?> <a href="<?= url_to('magic-link') ?>"><?= lang('Auth.useMagicLink') ?></a></p>
      <?php endif ?>

      <?php if (setting('Auth.allowRegistration') && setting('Auth.showRegistrationLink')) : ?>
          <p class="text-left"><?= lang('Auth.needAccount') ?> <a href="<?= url_to('register') ?>"><?= lang('Auth.register') ?></a></p>
      <?php endif ?>
    </div>
    <!-- /.login-card-body -->
  </div>
</div>
<!-- /.login-box -->
<?= $this->endSection() ?>
<!-- .Main content -->


<?= $this->section('main1') ?>

    <div class="container d-flex justify-content-center p-5">
        <div class="card col-12 col-md-5 shadow-sm">
            <div class="card-body">
                <h5 class="card-title mb-5"><?= lang('Auth.login') ?></h5>

                <?php include('templates/adminlte/errormessage.php'); ?>

                <form action="<?= url_to('login') ?>" method="post">
                    <?= csrf_field() ?>

                    <!-- Username -->
                    <div class="form-floating mb-3">
                        <input type="text" class="form-control" id="floatingUsernameInput" name="username" inputmode="username" autocomplete="username" placeholder="<?= lang('Auth.username') ?>" value="<?= old('email') ?>" required>
                        <label for="floatingUsernameInput"><?= lang('Auth.username') ?></label>
                    </div>

                    <!-- Email -->
                    <!-- <div class="form-floating mb-3">
                        <input type="email" class="form-control" id="floatingEmailInput" name="email" inputmode="email" autocomplete="email" placeholder="<?= lang('Auth.email') ?>" value="<?= old('email') ?>" required>
                        <label for="floatingEmailInput"><?= lang('Auth.email') ?></label>
                    </div> -->

                    <!-- Password -->
                    <div class="form-floating mb-3">
                        <input type="password" class="form-control" id="floatingPasswordInput" name="password" inputmode="text" autocomplete="current-password" placeholder="<?= lang('Auth.password') ?>" required>
                        <label for="floatingPasswordInput"><?= lang('Auth.password') ?></label>
                    </div>

                    <!-- Remember me -->
                    <?php if (setting('Auth.sessionConfig')['allowRemembering']): ?>
                        <div class="form-check">
                            <label class="form-check-label">
                                <input type="checkbox" name="remember" class="form-check-input" <?php if (old('remember')): ?> checked<?php endif ?>>
                                <?= lang('Auth.rememberMe') ?>
                            </label>
                        </div>
                    <?php endif; ?>

                    <div class="d-grid col-12 col-md-8 mx-auto m-3">
                        <button type="submit" class="btn btn-primary btn-block"><?= lang('Auth.login') ?></button>
                    </div>

                    <?php if (setting('Auth.allowMagicLinkLogins')) : ?>
                        <p class="text-center"><?= lang('Auth.forgotPassword') ?> <a href="<?= url_to('magic-link') ?>"><?= lang('Auth.useMagicLink') ?></a></p>
                    <?php endif ?>

                    <?php if (setting('Auth.allowRegistration')) : ?>
                        <p class="text-center"><?= lang('Auth.needAccount') ?> <a href="<?= url_to('register') ?>"><?= lang('Auth.register') ?></a></p>
                    <?php endif ?>

                </form>
            </div>
        </div>
    </div>

<?= $this->endSection() ?>
