Added programmer role and fixed snackbar not showing
This commit is contained in:
@@ -241,9 +241,15 @@ class _ItServiceRequestDetailScreenState
|
||||
if (profile == null) return false;
|
||||
final request = ref.read(itServiceRequestByIdProvider(widget.requestId));
|
||||
if (request == null) return false;
|
||||
// Admin, dispatcher can always edit; IT Staff and creator can edit in certain statuses
|
||||
if (profile.role == 'admin' || profile.role == 'dispatcher') return true;
|
||||
if (profile.role == 'it_staff') return true;
|
||||
// Admin, programmer, dispatcher can always edit; IT Staff and creator can edit in certain statuses
|
||||
if (profile.role == 'admin' ||
|
||||
profile.role == 'programmer' ||
|
||||
profile.role == 'dispatcher') {
|
||||
return true;
|
||||
}
|
||||
if (profile.role == 'it_staff') {
|
||||
return true;
|
||||
}
|
||||
if (request.creatorId == profile.id &&
|
||||
(request.status == 'draft' || request.status == 'pending_approval')) {
|
||||
return true;
|
||||
@@ -259,7 +265,11 @@ class _ItServiceRequestDetailScreenState
|
||||
bool get _canChangeStatus {
|
||||
final profile = ref.read(currentProfileProvider).valueOrNull;
|
||||
if (profile == null) return false;
|
||||
if (profile.role == 'admin' || profile.role == 'dispatcher') return true;
|
||||
if (profile.role == 'admin' ||
|
||||
profile.role == 'programmer' ||
|
||||
profile.role == 'dispatcher') {
|
||||
return true;
|
||||
}
|
||||
// Assigned IT staff can change status
|
||||
final assignments =
|
||||
ref.read(itServiceRequestAssignmentsProvider).valueOrNull ?? [];
|
||||
|
||||
@@ -140,6 +140,7 @@ class _ItServiceRequestsListScreenState
|
||||
final isPrivileged =
|
||||
currentProfile != null &&
|
||||
(currentProfile.role == 'admin' ||
|
||||
currentProfile.role == 'programmer' ||
|
||||
currentProfile.role == 'dispatcher' ||
|
||||
currentProfile.role == 'it_staff');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user