handelled the requested button
This commit is contained in:
parent
a026242319
commit
35b16dc8ed
@ -507,6 +507,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
|
|||||||
DataCell(
|
DataCell(
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: (log.activity == 5 ||
|
onPressed: (log.activity == 5 ||
|
||||||
|
log.activity == 2 || // Add this condition for activity 2
|
||||||
(log.activity == 4 &&
|
(log.activity == 4 &&
|
||||||
!(log.checkOut != null &&
|
!(log.checkOut != null &&
|
||||||
log.checkIn != null &&
|
log.checkIn != null &&
|
||||||
@ -525,7 +526,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
|
|||||||
|
|
||||||
int updatedAction;
|
int updatedAction;
|
||||||
String actionText;
|
String actionText;
|
||||||
|
bool imageCapture = true;
|
||||||
if (log.activity == 0) {
|
if (log.activity == 0) {
|
||||||
updatedAction = 0;
|
updatedAction = 0;
|
||||||
actionText = "Check In";
|
actionText = "Check In";
|
||||||
@ -539,6 +540,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
|
|||||||
log.checkIn!.isBefore(twoDaysAgo)) {
|
log.checkIn!.isBefore(twoDaysAgo)) {
|
||||||
updatedAction = 2;
|
updatedAction = 2;
|
||||||
actionText = "Request Regularize";
|
actionText = "Request Regularize";
|
||||||
|
imageCapture = false;
|
||||||
} else if (log.checkOut != null &&
|
} else if (log.checkOut != null &&
|
||||||
log.checkOut!.isBefore(twoDaysAgo)) {
|
log.checkOut!.isBefore(twoDaysAgo)) {
|
||||||
updatedAction = 2;
|
updatedAction = 2;
|
||||||
@ -568,6 +570,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
|
|||||||
int.parse(attendanceController.selectedProjectId!),
|
int.parse(attendanceController.selectedProjectId!),
|
||||||
comment: actionText,
|
comment: actionText,
|
||||||
action: updatedAction,
|
action: updatedAction,
|
||||||
|
imageCapture: imageCapture,
|
||||||
);
|
);
|
||||||
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
@ -611,6 +614,8 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
|
|||||||
log.checkIn != null &&
|
log.checkIn != null &&
|
||||||
DateTime.now().difference(log.checkIn!).inDays <= 2)
|
DateTime.now().difference(log.checkIn!).inDays <= 2)
|
||||||
? ButtonActions.checkIn
|
? ButtonActions.checkIn
|
||||||
|
: (log.activity == 2) // Change text when activity is 2
|
||||||
|
? "Requested"
|
||||||
: (log.activity == 4)
|
: (log.activity == 4)
|
||||||
? ButtonActions.approved
|
? ButtonActions.approved
|
||||||
: (log.activity == 0)
|
: (log.activity == 0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user