Initial Commit: Duty Schedule and Attendance Logbook
This commit is contained in:
@@ -35,11 +35,19 @@ class _UserManagementScreenState extends ConsumerState<UserManagementScreen> {
|
||||
'admin',
|
||||
];
|
||||
|
||||
static const List<String> _religions = [
|
||||
'catholic',
|
||||
'islam',
|
||||
'protestant',
|
||||
'other',
|
||||
];
|
||||
|
||||
final _fullNameController = TextEditingController();
|
||||
final _searchController = TextEditingController();
|
||||
|
||||
String? _selectedUserId;
|
||||
String? _selectedRole;
|
||||
String _selectedReligion = 'catholic';
|
||||
final Set<String> _selectedOfficeIds = {};
|
||||
bool _isSaving = false;
|
||||
|
||||
@@ -299,6 +307,7 @@ class _UserManagementScreenState extends ConsumerState<UserManagementScreen> {
|
||||
setState(() {
|
||||
_selectedUserId = profile.id;
|
||||
_selectedRole = profile.role;
|
||||
_selectedReligion = profile.religion;
|
||||
_fullNameController.text = profile.fullName;
|
||||
_selectedOfficeIds
|
||||
..clear()
|
||||
@@ -345,6 +354,7 @@ class _UserManagementScreenState extends ConsumerState<UserManagementScreen> {
|
||||
setState(() {
|
||||
_selectedUserId = null;
|
||||
_selectedRole = null;
|
||||
_selectedReligion = 'catholic';
|
||||
_selectedOfficeIds.clear();
|
||||
_fullNameController.clear();
|
||||
});
|
||||
@@ -377,6 +387,22 @@ class _UserManagementScreenState extends ConsumerState<UserManagementScreen> {
|
||||
decoration: const InputDecoration(labelText: 'Role'),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
DropdownButtonFormField<String>(
|
||||
key: ValueKey('religion_${_selectedUserId ?? 'none'}'),
|
||||
initialValue: _selectedReligion,
|
||||
items: _religions
|
||||
.map(
|
||||
(r) => DropdownMenuItem(
|
||||
value: r,
|
||||
child: Text(r[0].toUpperCase() + r.substring(1)),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (value) =>
|
||||
setDialogState(() => _selectedReligion = value ?? 'catholic'),
|
||||
decoration: const InputDecoration(labelText: 'Religion'),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Email and lock status are retrieved from auth via Edge Function / admin API.
|
||||
Consumer(
|
||||
@@ -529,7 +555,12 @@ class _UserManagementScreenState extends ConsumerState<UserManagementScreen> {
|
||||
try {
|
||||
await ref
|
||||
.read(adminUserControllerProvider)
|
||||
.updateProfile(userId: profile.id, fullName: fullName, role: role);
|
||||
.updateProfile(
|
||||
userId: profile.id,
|
||||
fullName: fullName,
|
||||
role: role,
|
||||
religion: _selectedReligion,
|
||||
);
|
||||
|
||||
final toAdd = _selectedOfficeIds.difference(currentOfficeIds);
|
||||
final toRemove = currentOfficeIds.difference(_selectedOfficeIds);
|
||||
|
||||
Reference in New Issue
Block a user