feat: Add initial identifier field to user management and update related functions
This commit is contained in:
@@ -18,6 +18,7 @@ export default function EditUserPage() {
|
||||
username: "",
|
||||
role: "user",
|
||||
is_active: true,
|
||||
initial: "",
|
||||
password: ""
|
||||
});
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -65,6 +66,7 @@ export default function EditUserPage() {
|
||||
username: userData.username,
|
||||
role: userData.role,
|
||||
is_active: userData.is_active,
|
||||
initial: userData.initial || "",
|
||||
password: "" // Never populate password field
|
||||
});
|
||||
} catch (err) {
|
||||
@@ -86,7 +88,8 @@ export default function EditUserPage() {
|
||||
name: formData.name,
|
||||
username: formData.username,
|
||||
role: formData.role,
|
||||
is_active: formData.is_active
|
||||
is_active: formData.is_active,
|
||||
initial: formData.initial.trim() || null
|
||||
};
|
||||
|
||||
// Only include password if it's provided
|
||||
@@ -253,6 +256,23 @@ export default function EditUserPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Initial
|
||||
</label>
|
||||
<Input
|
||||
type="text"
|
||||
value={formData.initial}
|
||||
onChange={(e) => setFormData({ ...formData, initial: e.target.value })}
|
||||
placeholder="1-2 letter identifier"
|
||||
maxLength={2}
|
||||
className="w-full md:w-1/2"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-1">
|
||||
Optional 1-2 letter identifier for the user
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
|
||||
@@ -195,6 +195,9 @@ export default function UserManagementPage() {
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold text-gray-900">{user.name}</h3>
|
||||
<p className="text-sm text-gray-500">{user.username}</p>
|
||||
{user.initial && (
|
||||
<p className="text-xs text-blue-600 font-medium mt-1">Initial: {user.initial}</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
|
||||
Reference in New Issue
Block a user