Merge pull request #392 from Oloodi/386-refactor-streamline-applicationstatus-enum-in-data-connect-and-ui
386 refactor streamline applicationstatus enum in data connect and UI
This commit is contained in:
@@ -41,7 +41,6 @@ class TimeCardAdapter {
|
|||||||
case 'DISPUTED':
|
case 'DISPUTED':
|
||||||
return TimeCardStatus.disputed;
|
return TimeCardStatus.disputed;
|
||||||
case 'CHECKED_IN':
|
case 'CHECKED_IN':
|
||||||
case 'ACCEPTED':
|
|
||||||
case 'CONFIRMED':
|
case 'CONFIRMED':
|
||||||
default:
|
default:
|
||||||
return TimeCardStatus.pending;
|
return TimeCardStatus.pending;
|
||||||
|
|||||||
@@ -177,8 +177,6 @@ class CoverageRepositoryImpl implements CoverageRepository {
|
|||||||
switch (status.value) {
|
switch (status.value) {
|
||||||
case dc.ApplicationStatus.PENDING:
|
case dc.ApplicationStatus.PENDING:
|
||||||
return CoverageWorkerStatus.pending;
|
return CoverageWorkerStatus.pending;
|
||||||
case dc.ApplicationStatus.ACCEPTED:
|
|
||||||
return CoverageWorkerStatus.confirmed;
|
|
||||||
case dc.ApplicationStatus.REJECTED:
|
case dc.ApplicationStatus.REJECTED:
|
||||||
return CoverageWorkerStatus.rejected;
|
return CoverageWorkerStatus.rejected;
|
||||||
case dc.ApplicationStatus.CONFIRMED:
|
case dc.ApplicationStatus.CONFIRMED:
|
||||||
|
|||||||
@@ -46,10 +46,8 @@ class HomeRepositoryImpl
|
|||||||
.dayEnd(_toTimestamp(end))
|
.dayEnd(_toTimestamp(end))
|
||||||
.execute());
|
.execute());
|
||||||
|
|
||||||
// Filter for ACCEPTED applications (same logic as shifts_repository_impl)
|
// Filter for CONFIRMED applications (same logic as shifts_repository_impl)
|
||||||
final apps = response.data.applications.where((app) =>
|
final apps = response.data.applications.where((app) =>
|
||||||
(app.status is Known &&
|
|
||||||
(app.status as Known).value == ApplicationStatus.ACCEPTED) ||
|
|
||||||
(app.status is Known &&
|
(app.status is Known &&
|
||||||
(app.status as Known).value == ApplicationStatus.CONFIRMED));
|
(app.status as Known).value == ApplicationStatus.CONFIRMED));
|
||||||
|
|
||||||
@@ -145,4 +143,3 @@ class HomeRepositoryImpl
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class ShiftsRepositoryImpl
|
|||||||
final DateTime? endDt = _toDateTime(app.shiftRole.endTime);
|
final DateTime? endDt = _toDateTime(app.shiftRole.endTime);
|
||||||
final DateTime? createdDt = _toDateTime(app.createdAt);
|
final DateTime? createdDt = _toDateTime(app.createdAt);
|
||||||
|
|
||||||
// Override status to reflect the application state (e.g., CHECKED_OUT, ACCEPTED)
|
// Override status to reflect the application state (e.g., CHECKED_OUT, CONFIRMED)
|
||||||
final bool hasCheckIn = app.checkInTime != null;
|
final bool hasCheckIn = app.checkInTime != null;
|
||||||
final bool hasCheckOut = app.checkOutTime != null;
|
final bool hasCheckOut = app.checkOutTime != null;
|
||||||
dc.ApplicationStatus? appStatus;
|
dc.ApplicationStatus? appStatus;
|
||||||
@@ -187,7 +187,7 @@ class ShiftsRepositoryImpl
|
|||||||
? 'completed'
|
? 'completed'
|
||||||
: hasCheckIn
|
: hasCheckIn
|
||||||
? 'checked_in'
|
? 'checked_in'
|
||||||
: _mapStatus(appStatus ?? dc.ApplicationStatus.ACCEPTED);
|
: _mapStatus(appStatus ?? dc.ApplicationStatus.CONFIRMED);
|
||||||
shifts.add(
|
shifts.add(
|
||||||
Shift(
|
Shift(
|
||||||
id: app.shift.id,
|
id: app.shift.id,
|
||||||
@@ -223,7 +223,6 @@ class ShiftsRepositoryImpl
|
|||||||
|
|
||||||
String _mapStatus(dc.ApplicationStatus status) {
|
String _mapStatus(dc.ApplicationStatus status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case dc.ApplicationStatus.ACCEPTED:
|
|
||||||
case dc.ApplicationStatus.CONFIRMED:
|
case dc.ApplicationStatus.CONFIRMED:
|
||||||
return 'confirmed';
|
return 'confirmed';
|
||||||
case dc.ApplicationStatus.PENDING:
|
case dc.ApplicationStatus.PENDING:
|
||||||
@@ -477,7 +476,7 @@ class ShiftsRepositoryImpl
|
|||||||
shiftId: shiftId,
|
shiftId: shiftId,
|
||||||
staffId: staffId,
|
staffId: staffId,
|
||||||
roleId: targetRoleId,
|
roleId: targetRoleId,
|
||||||
status: dc.ApplicationStatus.ACCEPTED,
|
status: dc.ApplicationStatus.CONFIRMED,
|
||||||
origin: dc.ApplicationOrigin.STAFF,
|
origin: dc.ApplicationOrigin.STAFF,
|
||||||
)
|
)
|
||||||
// TODO: this should be PENDING so a vendor can accept it.
|
// TODO: this should be PENDING so a vendor can accept it.
|
||||||
@@ -518,7 +517,7 @@ class ShiftsRepositoryImpl
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> acceptShift(String shiftId) async {
|
Future<void> acceptShift(String shiftId) async {
|
||||||
await _updateApplicationStatus(shiftId, dc.ApplicationStatus.ACCEPTED);
|
await _updateApplicationStatus(shiftId, dc.ApplicationStatus.CONFIRMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ query getApplicationsByStaffId(
|
|||||||
applications(
|
applications(
|
||||||
where: {
|
where: {
|
||||||
staffId: { eq: $staffId }
|
staffId: { eq: $staffId }
|
||||||
status: { in: [ACCEPTED, CONFIRMED, CHECKED_IN, CHECKED_OUT, LATE] }
|
status: { in: [ CONFIRMED, CHECKED_IN, CHECKED_OUT, LATE] }
|
||||||
shift: {
|
shift: {
|
||||||
date: { ge: $dayStart, le: $dayEnd }
|
date: { ge: $dayStart, le: $dayEnd }
|
||||||
}
|
}
|
||||||
@@ -516,7 +516,7 @@ query getApplicationByStaffShiftAndRole(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#getting staffs of an shiftrole ACCEPTED for orders view client
|
#getting staffs of an shiftrole CONFIRMED for orders view client
|
||||||
query listAcceptedApplicationsByShiftRoleKey(
|
query listAcceptedApplicationsByShiftRoleKey(
|
||||||
$shiftId: UUID!
|
$shiftId: UUID!
|
||||||
$roleId: UUID!
|
$roleId: UUID!
|
||||||
@@ -527,7 +527,7 @@ query listAcceptedApplicationsByShiftRoleKey(
|
|||||||
where: {
|
where: {
|
||||||
shiftId: { eq: $shiftId }
|
shiftId: { eq: $shiftId }
|
||||||
roleId: { eq: $roleId }
|
roleId: { eq: $roleId }
|
||||||
status: { eq: ACCEPTED }
|
status: { eq: CONFIRMED }
|
||||||
}
|
}
|
||||||
offset: $offset
|
offset: $offset
|
||||||
limit: $limit
|
limit: $limit
|
||||||
@@ -540,7 +540,7 @@ query listAcceptedApplicationsByShiftRoleKey(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#getting staffs of an shiftrole ACCEPTED for orders of the day view client
|
#getting staffs of an shiftrole status for orders of the day view client
|
||||||
query listAcceptedApplicationsByBusinessForDay(
|
query listAcceptedApplicationsByBusinessForDay(
|
||||||
$businessId: UUID!
|
$businessId: UUID!
|
||||||
$dayStart: Timestamp!
|
$dayStart: Timestamp!
|
||||||
@@ -550,8 +550,7 @@ query listAcceptedApplicationsByBusinessForDay(
|
|||||||
) @auth(level: USER) {
|
) @auth(level: USER) {
|
||||||
applications(
|
applications(
|
||||||
where: {
|
where: {
|
||||||
#status: { eq: ACCEPTED }
|
status: { in: [ CONFIRMED, CHECKED_IN, CHECKED_OUT, LATE] }
|
||||||
status: { in: [ACCEPTED, CONFIRMED, CHECKED_IN, CHECKED_OUT, LATE] }
|
|
||||||
shift: {
|
shift: {
|
||||||
date: { ge: $dayStart, le: $dayEnd }
|
date: { ge: $dayStart, le: $dayEnd }
|
||||||
order: { businessId: { eq: $businessId } }
|
order: { businessId: { eq: $businessId } }
|
||||||
@@ -581,11 +580,10 @@ query listStaffsApplicationsByBusinessForDay(
|
|||||||
) @auth(level: USER) {
|
) @auth(level: USER) {
|
||||||
applications(
|
applications(
|
||||||
where: {
|
where: {
|
||||||
status: {in: [ACCEPTED, CONFIRMED, CHECKED_IN, CHECKED_OUT, LATE]}
|
status: {in: [ CONFIRMED, CHECKED_IN, CHECKED_OUT, LATE]}
|
||||||
shift: {
|
shift: {
|
||||||
date: { ge: $dayStart, le: $dayEnd }
|
date: { ge: $dayStart, le: $dayEnd }
|
||||||
order: { businessId: { eq: $businessId } }
|
order: { businessId: { eq: $businessId } }
|
||||||
#status: { eq: ACCEPTED }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset: $offset
|
offset: $offset
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
enum ApplicationStatus {
|
enum ApplicationStatus {
|
||||||
PENDING
|
PENDING
|
||||||
ACCEPTED
|
|
||||||
REJECTED
|
REJECTED
|
||||||
CONFIRMED
|
CONFIRMED
|
||||||
CHECKED_IN
|
CHECKED_IN
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user