Added programmer role and fixed snackbar not showing

This commit is contained in:
2026-03-16 07:23:20 +08:00
parent 9f7791e56f
commit 81853c4367
23 changed files with 362 additions and 65 deletions
+1
View File
@@ -31,6 +31,7 @@ final attendanceLogsProvider = StreamProvider<List<AttendanceLog>>((ref) {
final hasFullAccess =
profile.role == 'admin' ||
profile.role == 'programmer' ||
profile.role == 'dispatcher' ||
profile.role == 'it_staff';
+1
View File
@@ -23,6 +23,7 @@ final leavesProvider = StreamProvider<List<LeaveOfAbsence>>((ref) {
final hasFullAccess =
profile.role == 'admin' ||
profile.role == 'programmer' ||
profile.role == 'dispatcher' ||
profile.role == 'it_staff';
+3 -2
View File
@@ -16,9 +16,10 @@ final passSlipsProvider = StreamProvider<List<PassSlip>>((ref) {
if (profile == null) return Stream.value(const <PassSlip>[]);
final isAdmin = profile.role == 'admin' || profile.role == 'dispatcher';
final hasFullAccess = isAdmin || profile.role == 'programmer';
final wrapper = StreamRecoveryWrapper<PassSlip>(
stream: isAdmin
stream: hasFullAccess
? client
.from('pass_slips')
.stream(primaryKey: ['id'])
@@ -30,7 +31,7 @@ final passSlipsProvider = StreamProvider<List<PassSlip>>((ref) {
.order('requested_at', ascending: false),
onPollData: () async {
final query = client.from('pass_slips').select();
final data = isAdmin
final data = hasFullAccess
? await query.order('requested_at', ascending: false)
: await query
.eq('user_id', profile.id)
+2 -1
View File
@@ -156,7 +156,8 @@ class ProfileController {
final isAdminProvider = Provider<bool>((ref) {
final profileAsync = ref.watch(currentProfileProvider);
return profileAsync.maybeWhen(
data: (profile) => profile?.role == 'admin',
data: (profile) =>
profile?.role == 'admin' || profile?.role == 'programmer',
orElse: () => false,
);
});
+1
View File
@@ -266,6 +266,7 @@ final tasksProvider = StreamProvider<List<Task>>((ref) {
final isGlobal =
profile.role == 'admin' ||
profile.role == 'programmer' ||
profile.role == 'dispatcher' ||
profile.role == 'it_staff';
+1
View File
@@ -176,6 +176,7 @@ final ticketsProvider = StreamProvider<List<Ticket>>((ref) {
final isGlobal =
profile.role == 'admin' ||
profile.role == 'programmer' ||
profile.role == 'dispatcher' ||
profile.role == 'it_staff';
+4 -1
View File
@@ -101,7 +101,10 @@ final swapRequestsProvider = StreamProvider<List<SwapRequest>>((ref) {
return Stream.value(const <SwapRequest>[]);
}
final isAdmin = profile.role == 'admin' || profile.role == 'dispatcher';
final isAdmin =
profile.role == 'admin' ||
profile.role == 'programmer' ||
profile.role == 'dispatcher';
final wrapper = StreamRecoveryWrapper<SwapRequest>(
stream: isAdmin