<?php
$cfg = app_config();
$appName = $cfg['app_name'] ?? app_zh('登录');
$assets = rtrim(asset_url(), '/');
$faviconUrl = public_file_url('favicon.ico');
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
  <title><?= e($title ?? $appName) ?></title>
  <link rel="icon" href="<?= e_url($faviconUrl) ?>" type="image/ico">
  <link href="<?= e_url($assets . '/css/bootstrap.min.css') ?>" rel="stylesheet">
  <link href="<?= e_url($assets . '/css/materialdesignicons.min.css') ?>" rel="stylesheet">
  <link href="<?= e_url($assets . '/css/style.min.css') ?>" rel="stylesheet">
  <link href="<?= e_url($assets . '/css/custom.css') ?>" rel="stylesheet">
</head>
<body class="auth-page">
<div class="lyear-wrapper">
  <section class="login-section">
    <div class="login-box">
      <?php if ($msg = flash('success')): ?>
        <div class="alert alert-success"><?= e($msg) ?></div>
      <?php endif; ?>
      <?php if ($msg = flash('error')): ?>
        <div class="alert alert-danger"><?= e($msg) ?></div>
      <?php endif; ?>
      <?php include __DIR__ . '/../' . $view . '.php'; ?>
    </div>
  </section>
</div>
<script src="<?= e_url($assets . '/js/jquery.min.js') ?>"></script>
<script src="<?= e_url($assets . '/js/bootstrap.min.js') ?>"></script>

<script>
(function () {
  document.querySelectorAll('form').forEach(function (form) {
    form.addEventListener('submit', function (event) {
      var submit = form.querySelector('button[type="submit"], input[type="submit"]');
      if (!submit) {
        return;
      }
      if (submit.dataset.submitting === '1') {
        event.preventDefault();
        return;
      }
      submit.dataset.submitting = '1';
      submit.disabled = true;
      submit.classList.add('is-submitting');
    });
  });
})();
</script>

</body>
</html>
