adding pendind and solving problem with status of shifts

This commit is contained in:
José Salazar
2026-01-25 14:19:42 -05:00
parent bda0b441e9
commit 6e575a9ad0
8 changed files with 18935 additions and 18919 deletions

View File

@@ -1,16 +1,16 @@
# Basic Usage
```dart
ExampleConnector.instance.createCustomRateCard(createCustomRateCardVariables).execute();
ExampleConnector.instance.updateCustomRateCard(updateCustomRateCardVariables).execute();
ExampleConnector.instance.deleteCustomRateCard(deleteCustomRateCardVariables).execute();
ExampleConnector.instance.listShiftsForCoverage(listShiftsForCoverageVariables).execute();
ExampleConnector.instance.listApplicationsForCoverage(listApplicationsForCoverageVariables).execute();
ExampleConnector.instance.listShiftsForDailyOpsByBusiness(listShiftsForDailyOpsByBusinessVariables).execute();
ExampleConnector.instance.listShiftsForDailyOpsByVendor(listShiftsForDailyOpsByVendorVariables).execute();
ExampleConnector.instance.listApplicationsForDailyOps(listApplicationsForDailyOpsVariables).execute();
ExampleConnector.instance.listShiftsForForecastByBusiness(listShiftsForForecastByBusinessVariables).execute();
ExampleConnector.instance.listShiftsForForecastByVendor(listShiftsForForecastByVendorVariables).execute();
ExampleConnector.instance.createVendorBenefitPlan(createVendorBenefitPlanVariables).execute();
ExampleConnector.instance.updateVendorBenefitPlan(updateVendorBenefitPlanVariables).execute();
ExampleConnector.instance.deleteVendorBenefitPlan(deleteVendorBenefitPlanVariables).execute();
ExampleConnector.instance.createWorkforce(createWorkforceVariables).execute();
ExampleConnector.instance.updateWorkforce(updateWorkforceVariables).execute();
ExampleConnector.instance.deactivateWorkforce(deactivateWorkforceVariables).execute();
ExampleConnector.instance.createApplication(createApplicationVariables).execute();
ExampleConnector.instance.updateApplicationStatus(updateApplicationStatusVariables).execute();
ExampleConnector.instance.deleteApplication(deleteApplicationVariables).execute();
ExampleConnector.instance.listCertificates().execute();
```
@@ -23,8 +23,8 @@ Optional fields can be discovered based on classes that have `Optional` object t
This is an example of a mutation with an optional field:
```dart
await ExampleConnector.instance.UpdateUser({ ... })
.email(...)
await ExampleConnector.instance.updateStaffDocument({ ... })
.status(...)
.execute();
```

View File

@@ -164,6 +164,7 @@ class ListShiftRolesByBusinessAndDateRangeShiftRolesShift {
final String? location;
final String? locationAddress;
final String title;
final EnumValue<ShiftStatus>? status;
final ListShiftRolesByBusinessAndDateRangeShiftRolesShiftOrder order;
ListShiftRolesByBusinessAndDateRangeShiftRolesShift.fromJson(dynamic json):
@@ -172,6 +173,7 @@ class ListShiftRolesByBusinessAndDateRangeShiftRolesShift {
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']),
title = nativeFromJson<String>(json['title']),
status = json['status'] == null ? null : shiftStatusDeserializer(json['status']),
order = ListShiftRolesByBusinessAndDateRangeShiftRolesShiftOrder.fromJson(json['order']);
@override
bool operator ==(Object other) {
@@ -188,11 +190,12 @@ class ListShiftRolesByBusinessAndDateRangeShiftRolesShift {
location == otherTyped.location &&
locationAddress == otherTyped.locationAddress &&
title == otherTyped.title &&
status == otherTyped.status &&
order == otherTyped.order;
}
@override
int get hashCode => Object.hashAll([id.hashCode, date.hashCode, location.hashCode, locationAddress.hashCode, title.hashCode, order.hashCode]);
int get hashCode => Object.hashAll([id.hashCode, date.hashCode, location.hashCode, locationAddress.hashCode, title.hashCode, status.hashCode, order.hashCode]);
Map<String, dynamic> toJson() {
@@ -208,6 +211,11 @@ class ListShiftRolesByBusinessAndDateRangeShiftRolesShift {
json['locationAddress'] = nativeToJson<String?>(locationAddress);
}
json['title'] = nativeToJson<String>(title);
if (status != null) {
json['status'] =
shiftStatusSerializer(status!)
;
}
json['order'] = order.toJson();
return json;
}
@@ -218,6 +226,7 @@ class ListShiftRolesByBusinessAndDateRangeShiftRolesShift {
this.location,
this.locationAddress,
required this.title,
this.status,
required this.order,
});
}

View File

@@ -42,11 +42,6 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
'Your Company';
return result.data.shiftRoles.map((dc.ListShiftRolesByBusinessAndDateRangeShiftRoles shiftRole) {
print(
'ViewOrders shiftRole: shiftId=${shiftRole.shiftId} roleId=${shiftRole.roleId} '
'startTime=${shiftRole.startTime?.toJson()} endTime=${shiftRole.endTime?.toJson()} '
'hours=${shiftRole.hours} totalValue=${shiftRole.totalValue}',
);
final DateTime? shiftDate = shiftRole.shift.date?.toDateTime();
final String dateStr = shiftDate == null
? ''
@@ -58,7 +53,14 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
final double hours = shiftRole.hours ?? 0;
final double totalValue = shiftRole.totalValue ?? 0;
final double hourlyRate = _hourlyRate(shiftRole.totalValue, shiftRole.hours);
final String status = filled >= workersNeeded ? 'filled' : 'open';
// final String status = filled >= workersNeeded ? 'filled' : 'open';
final String status = shiftRole.shift.status?.stringValue ?? 'OPEN';
print(
'ViewOrders item: date=$dateStr status=$status shiftId=${shiftRole.shiftId} '
'roleId=${shiftRole.roleId} start=${shiftRole.startTime?.toJson()} '
'end=${shiftRole.endTime?.toJson()} hours=$hours totalValue=$totalValue',
);
return domain.OrderItem(
id: _shiftRoleKey(shiftRole.shiftId, shiftRole.roleId),

View File

@@ -192,16 +192,18 @@ class ViewOrdersCubit extends Cubit<ViewOrdersState> {
return ordersOnDate
.where(
(OrderItem s) =>
<String>['open', 'filled', 'confirmed'].contains(s.status),
// TODO(orders): move PENDING to its own tab once available.
<String>['OPEN', 'FILLED', 'CONFIRMED', 'PENDING']
.contains(s.status),
)
.toList();
} else if (state.filterTab == 'active') {
return ordersOnDate
.where((OrderItem s) => s.status == 'in_progress')
.where((OrderItem s) => s.status == 'IN_PROGRESS')
.toList();
} else if (state.filterTab == 'completed') {
return ordersOnDate
.where((OrderItem s) => s.status == 'completed')
.where((OrderItem s) => s.status == 'COMPLETED')
.toList();
}
return <OrderItem>[];
@@ -218,11 +220,11 @@ class ViewOrdersCubit extends Cubit<ViewOrdersState> {
if (category == 'active') {
return ordersOnDate
.where((OrderItem s) => s.status == 'in_progress')
.where((OrderItem s) => s.status == 'IN_PROGRESS')
.length;
} else if (category == 'completed') {
return ordersOnDate
.where((OrderItem s) => s.status == 'completed')
.where((OrderItem s) => s.status == 'COMPLETED')
.length;
}
return 0;
@@ -239,7 +241,9 @@ class ViewOrdersCubit extends Cubit<ViewOrdersState> {
return ordersOnDate
.where(
(OrderItem s) =>
<String>['open', 'filled', 'confirmed'].contains(s.status),
// TODO(orders): move PENDING to its own tab once available.
<String>['OPEN', 'FILLED', 'CONFIRMED', 'PENDING']
.contains(s.status),
)
.length;
}

View File

@@ -37,16 +37,16 @@ class _ViewOrderCardState extends State<ViewOrderCard> {
/// Returns the semantic color for the given status.
Color _getStatusColor({required String status}) {
switch (status) {
case 'open':
case 'OPEN':
return UiColors.primary;
case 'filled':
case 'confirmed':
case 'FILLED':
case 'CONFIRMED':
return UiColors.textSuccess;
case 'in_progress':
case 'IN_PROGRESS':
return UiColors.textWarning;
case 'completed':
case 'COMPLETED':
return UiColors.primary;
case 'cancelled':
case 'CANCELED':
return UiColors.destructive;
default:
return UiColors.textSecondary;
@@ -56,17 +56,17 @@ class _ViewOrderCardState extends State<ViewOrderCard> {
/// Returns the localized label for the given status.
String _getStatusLabel({required String status}) {
switch (status) {
case 'open':
case 'OPEN':
return t.client_view_orders.card.open;
case 'filled':
case 'FILLED':
return t.client_view_orders.card.filled;
case 'confirmed':
case 'CONFIRMED':
return t.client_view_orders.card.confirmed;
case 'in_progress':
case 'IN_PROGRESS':
return t.client_view_orders.card.in_progress;
case 'completed':
case 'COMPLETED':
return t.client_view_orders.card.completed;
case 'cancelled':
case 'CANCELED':
return t.client_view_orders.card.cancelled;
default:
return status.toUpperCase();

View File

@@ -328,6 +328,7 @@ query listShiftRolesByBusinessAndDateRange(
location
locationAddress
title
status
order { id }
}
}