101 lines
4.6 KiB
PHP
101 lines
4.6 KiB
PHP
|
|
<?php
|
||
|
|
$title = 'Create User';
|
||
|
|
$pageTitle = 'Create User';
|
||
|
|
$pageDescription = 'Add a new user to the system';
|
||
|
|
$pageIcon = 'fas fa-user-plus';
|
||
|
|
ob_start();
|
||
|
|
?>
|
||
|
|
|
||
|
|
<form method="POST" action="/users/store" class="max-w-2xl">
|
||
|
|
<div class="bg-white rounded-lg border border-gray-200 overflow-hidden">
|
||
|
|
<div class="px-6 py-4 border-b border-gray-200 bg-gray-50">
|
||
|
|
<h3 class="text-lg font-semibold text-gray-900">User Information</h3>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="p-6 space-y-4">
|
||
|
|
<!-- Full Name -->
|
||
|
|
<div>
|
||
|
|
<label for="full_name" class="block text-sm font-medium text-gray-700 mb-2">
|
||
|
|
Full Name <span class="text-red-500">*</span>
|
||
|
|
</label>
|
||
|
|
<input type="text" id="full_name" name="full_name" required
|
||
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Username -->
|
||
|
|
<div>
|
||
|
|
<label for="username" class="block text-sm font-medium text-gray-700 mb-2">
|
||
|
|
Username <span class="text-red-500">*</span>
|
||
|
|
</label>
|
||
|
|
<input type="text" id="username" name="username" required pattern="[a-zA-Z0-9_]+"
|
||
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary">
|
||
|
|
<p class="text-xs text-gray-500 mt-1">Letters, numbers, and underscores only</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Email -->
|
||
|
|
<div>
|
||
|
|
<label for="email" class="block text-sm font-medium text-gray-700 mb-2">
|
||
|
|
Email Address <span class="text-red-500">*</span>
|
||
|
|
</label>
|
||
|
|
<input type="email" id="email" name="email" required
|
||
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Role -->
|
||
|
|
<div>
|
||
|
|
<label for="role" class="block text-sm font-medium text-gray-700 mb-2">
|
||
|
|
Role <span class="text-red-500">*</span>
|
||
|
|
</label>
|
||
|
|
<select id="role" name="role" required
|
||
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary">
|
||
|
|
<option value="user">User</option>
|
||
|
|
<option value="admin">Admin</option>
|
||
|
|
</select>
|
||
|
|
<p class="text-xs text-gray-500 mt-1">Admins have full system access</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Password -->
|
||
|
|
<div>
|
||
|
|
<label for="password" class="block text-sm font-medium text-gray-700 mb-2">
|
||
|
|
Password <span class="text-red-500">*</span>
|
||
|
|
</label>
|
||
|
|
<input type="password" id="password" name="password" required minlength="8"
|
||
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary">
|
||
|
|
<p class="text-xs text-gray-500 mt-1">Minimum 8 characters</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Confirm Password -->
|
||
|
|
<div>
|
||
|
|
<label for="password_confirm" class="block text-sm font-medium text-gray-700 mb-2">
|
||
|
|
Confirm Password <span class="text-red-500">*</span>
|
||
|
|
</label>
|
||
|
|
<input type="password" id="password_confirm" name="password_confirm" required minlength="8"
|
||
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="bg-blue-50 border border-blue-200 rounded-lg p-3">
|
||
|
|
<p class="text-xs text-blue-800">
|
||
|
|
<i class="fas fa-info-circle mr-1"></i>
|
||
|
|
<strong>Note:</strong> Admin-created users are automatically verified and can log in immediately.
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="px-6 py-4 border-t border-gray-200 bg-gray-50 flex items-center justify-between">
|
||
|
|
<a href="/users" class="text-gray-600 hover:text-gray-800 text-sm font-medium">
|
||
|
|
<i class="fas fa-arrow-left mr-1"></i> Cancel
|
||
|
|
</a>
|
||
|
|
<button type="submit" class="inline-flex items-center px-4 py-2.5 bg-primary text-white text-sm rounded-lg hover:bg-primary-dark transition-colors font-medium">
|
||
|
|
<i class="fas fa-save mr-2"></i>
|
||
|
|
Create User
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
|
||
|
|
<?php
|
||
|
|
$content = ob_get_clean();
|
||
|
|
require __DIR__ . '/../layout/base.php';
|
||
|
|
?>
|
||
|
|
|