2026-04-14 18:42:34 +05:30

98 lines
4.2 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Register</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="<?= base_url('css/app.css') ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
</head>
<body class="app-body app-page--auth">
<?php $validationErrors = validation_errors(); ?>
<div class="card auth-card shadow">
<div class="card-body">
<h2 class="text-center mb-4 auth-title">Create account</h2>
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger app-alert"><?= esc(session()->getFlashdata('error')) ?></div>
<?php endif; ?>
<form method="post" action="<?= base_url('register') ?>" class="app-form" novalidate>
<?= csrf_field() ?>
<div class="mb-3">
<?php
echo view('components/name_field', [
'fieldName' => 'first_name',
'fieldLabel' => 'First name',
'fieldId' => 'first_name',
'fieldValue' => old('first_name', $first_name ?? ''),
'required' => true,
'validationErrors' => $validationErrors,
'placeholder' => 'Enter first name'
]);
?>
</div>
<div class="mb-3">
<?php
echo view('components/name_field', [
'fieldName' => 'last_name',
'fieldLabel' => 'Last name',
'fieldId' => 'last_name',
'fieldValue' => old('last_name', $last_name ?? ''),
'required' => true,
'validationErrors' => $validationErrors,
'placeholder' => 'Enter last name'
]);
?>
</div>
<div class="mb-3">
<label class="form-label" for="email">Email <span class="text-danger">*</span></label>
<input type="email" name="email" id="email" value="<?= esc(old('email')) ?>"
class="form-control <?= isset($validationErrors['email']) ? 'is-invalid' : '' ?>"
placeholder="Email address" autocomplete="email" required>
<?= validation_show_error('email') ?>
</div>
<div class="mb-3">
<label class="form-label" for="phone">
Phone <span class="text-danger">*</span>
</label>
<div class="input-group">
<span class="input-group-text">+91</span>
<input type="tel" name="phone" id="phone" pattern="[0-9]{10}" maxlength="10"
value="<?= esc(old('phone')) ?>"
class="form-control <?= isset($validationErrors['phone']) ? 'is-invalid' : '' ?>"
placeholder="Enter phone number"
autocomplete="tel"
required>
</div>
<?= validation_show_error('phone') ?>
</div>
<div class="mb-3">
<?= view('components/password_field', ['id' => 'password']) ?>
</div>
<p class="small text-muted mb-4">Register as a <strong>patient</strong> to book appointments.</p>
<button type="submit" class="btn btn-app-primary w-100">Register</button>
</form>
<div class="text-center mt-4">
<p class="auth-divider-text mb-2">Already have an account?</p>
<a href="<?= base_url('/') ?>" class="btn-app-secondary">Back to login</a>
</div>
</div>
</div>
</body>
</html>