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 # Basic Usage
```dart ```dart
ExampleConnector.instance.createCustomRateCard(createCustomRateCardVariables).execute(); ExampleConnector.instance.createVendorBenefitPlan(createVendorBenefitPlanVariables).execute();
ExampleConnector.instance.updateCustomRateCard(updateCustomRateCardVariables).execute(); ExampleConnector.instance.updateVendorBenefitPlan(updateVendorBenefitPlanVariables).execute();
ExampleConnector.instance.deleteCustomRateCard(deleteCustomRateCardVariables).execute(); ExampleConnector.instance.deleteVendorBenefitPlan(deleteVendorBenefitPlanVariables).execute();
ExampleConnector.instance.listShiftsForCoverage(listShiftsForCoverageVariables).execute(); ExampleConnector.instance.createWorkforce(createWorkforceVariables).execute();
ExampleConnector.instance.listApplicationsForCoverage(listApplicationsForCoverageVariables).execute(); ExampleConnector.instance.updateWorkforce(updateWorkforceVariables).execute();
ExampleConnector.instance.listShiftsForDailyOpsByBusiness(listShiftsForDailyOpsByBusinessVariables).execute(); ExampleConnector.instance.deactivateWorkforce(deactivateWorkforceVariables).execute();
ExampleConnector.instance.listShiftsForDailyOpsByVendor(listShiftsForDailyOpsByVendorVariables).execute(); ExampleConnector.instance.createApplication(createApplicationVariables).execute();
ExampleConnector.instance.listApplicationsForDailyOps(listApplicationsForDailyOpsVariables).execute(); ExampleConnector.instance.updateApplicationStatus(updateApplicationStatusVariables).execute();
ExampleConnector.instance.listShiftsForForecastByBusiness(listShiftsForForecastByBusinessVariables).execute(); ExampleConnector.instance.deleteApplication(deleteApplicationVariables).execute();
ExampleConnector.instance.listShiftsForForecastByVendor(listShiftsForForecastByVendorVariables).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: This is an example of a mutation with an optional field:
```dart ```dart
await ExampleConnector.instance.UpdateUser({ ... }) await ExampleConnector.instance.updateStaffDocument({ ... })
.email(...) .status(...)
.execute(); .execute();
``` ```

View File

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

View File

@@ -42,11 +42,6 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
'Your Company'; 'Your Company';
return result.data.shiftRoles.map((dc.ListShiftRolesByBusinessAndDateRangeShiftRoles shiftRole) { 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 DateTime? shiftDate = shiftRole.shift.date?.toDateTime();
final String dateStr = shiftDate == null final String dateStr = shiftDate == null
? '' ? ''
@@ -58,7 +53,14 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository {
final double hours = shiftRole.hours ?? 0; final double hours = shiftRole.hours ?? 0;
final double totalValue = shiftRole.totalValue ?? 0; final double totalValue = shiftRole.totalValue ?? 0;
final double hourlyRate = _hourlyRate(shiftRole.totalValue, shiftRole.hours); 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( return domain.OrderItem(
id: _shiftRoleKey(shiftRole.shiftId, shiftRole.roleId), id: _shiftRoleKey(shiftRole.shiftId, shiftRole.roleId),

View File

@@ -192,16 +192,18 @@ class ViewOrdersCubit extends Cubit<ViewOrdersState> {
return ordersOnDate return ordersOnDate
.where( .where(
(OrderItem s) => (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(); .toList();
} else if (state.filterTab == 'active') { } else if (state.filterTab == 'active') {
return ordersOnDate return ordersOnDate
.where((OrderItem s) => s.status == 'in_progress') .where((OrderItem s) => s.status == 'IN_PROGRESS')
.toList(); .toList();
} else if (state.filterTab == 'completed') { } else if (state.filterTab == 'completed') {
return ordersOnDate return ordersOnDate
.where((OrderItem s) => s.status == 'completed') .where((OrderItem s) => s.status == 'COMPLETED')
.toList(); .toList();
} }
return <OrderItem>[]; return <OrderItem>[];
@@ -218,11 +220,11 @@ class ViewOrdersCubit extends Cubit<ViewOrdersState> {
if (category == 'active') { if (category == 'active') {
return ordersOnDate return ordersOnDate
.where((OrderItem s) => s.status == 'in_progress') .where((OrderItem s) => s.status == 'IN_PROGRESS')
.length; .length;
} else if (category == 'completed') { } else if (category == 'completed') {
return ordersOnDate return ordersOnDate
.where((OrderItem s) => s.status == 'completed') .where((OrderItem s) => s.status == 'COMPLETED')
.length; .length;
} }
return 0; return 0;
@@ -239,7 +241,9 @@ class ViewOrdersCubit extends Cubit<ViewOrdersState> {
return ordersOnDate return ordersOnDate
.where( .where(
(OrderItem s) => (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; .length;
} }

View File

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

View File

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