<?php
$pageTitle = 'Create User';
require_once __DIR__ . '/../../app/includes/header.php';
require_admin();
?>
<div class="page-head"><div><h1>Create User</h1><p>Add a new account with a temporary strong password.</p></div></div>
<form class="card app-card p-4" method="post" action="<?= APP_BASE ?>/users/store.php">
<?= csrf_field() ?>
<div class="row g-3">
    <div class="col-md-6"><label class="form-label">Name</label><input class="form-control" name="name" required maxlength="120"></div>
    <div class="col-md-6"><label class="form-label">Email</label><input class="form-control" type="email" name="email" required maxlength="190"></div>
    <div class="col-md-6"><label class="form-label">Role</label><select class="form-select" name="role"><?php foreach (['admin','sales','engineer','viewer'] as $r): ?><option value="<?= e($r) ?>"><?= e(ucfirst($r)) ?></option><?php endforeach; ?></select></div>
    <div class="col-md-6"><label class="form-label">Status</label><select class="form-select" name="status"><option value="active">Active</option><option value="inactive">Inactive</option></select></div>
    <div class="col-md-6"><label class="form-label">Temporary Password</label><input class="form-control" type="password" name="password" required></div>
    <div class="col-md-6"><label class="form-label">Confirm Temporary Password</label><input class="form-control" type="password" name="confirm_password" required></div>
</div>
<button class="btn btn-primary mt-4" type="submit">Create User</button>
</form>
<?php require_once __DIR__ . '/../../app/includes/footer.php'; ?>
