history ready

This commit is contained in:
José Salazar
2026-02-02 07:26:07 +09:00
parent 761830b380
commit b7b7709386
10 changed files with 20296 additions and 19372 deletions

View File

@@ -1,16 +1,16 @@
# Basic Usage # Basic Usage
```dart ```dart
ExampleConnector.instance.listAssignments(listAssignmentsVariables).execute(); ExampleConnector.instance.getShiftRoleById(getShiftRoleByIdVariables).execute();
ExampleConnector.instance.getAssignmentById(getAssignmentByIdVariables).execute(); ExampleConnector.instance.listShiftRolesByShiftId(listShiftRolesByShiftIdVariables).execute();
ExampleConnector.instance.listAssignmentsByWorkforceId(listAssignmentsByWorkforceIdVariables).execute(); ExampleConnector.instance.listShiftRolesByRoleId(listShiftRolesByRoleIdVariables).execute();
ExampleConnector.instance.listAssignmentsByWorkforceIds(listAssignmentsByWorkforceIdsVariables).execute(); ExampleConnector.instance.listShiftRolesByShiftIdAndTimeRange(listShiftRolesByShiftIdAndTimeRangeVariables).execute();
ExampleConnector.instance.listAssignmentsByShiftRole(listAssignmentsByShiftRoleVariables).execute(); ExampleConnector.instance.listShiftRolesByVendorId(listShiftRolesByVendorIdVariables).execute();
ExampleConnector.instance.filterAssignments(filterAssignmentsVariables).execute(); ExampleConnector.instance.listShiftRolesByBusinessAndDateRange(listShiftRolesByBusinessAndDateRangeVariables).execute();
ExampleConnector.instance.createClientFeedback(createClientFeedbackVariables).execute(); ExampleConnector.instance.listShiftRolesByBusinessAndOrder(listShiftRolesByBusinessAndOrderVariables).execute();
ExampleConnector.instance.updateClientFeedback(updateClientFeedbackVariables).execute(); ExampleConnector.instance.listShiftRolesByBusinessDateRangeCompletedOrders(listShiftRolesByBusinessDateRangeCompletedOrdersVariables).execute();
ExampleConnector.instance.deleteClientFeedback(deleteClientFeedbackVariables).execute(); ExampleConnector.instance.listShiftRolesByBusinessAndDatesSummary(listShiftRolesByBusinessAndDatesSummaryVariables).execute();
ExampleConnector.instance.createCourse(createCourseVariables).execute(); ExampleConnector.instance.getCompletedShiftsByBusinessId(getCompletedShiftsByBusinessIdVariables).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.filterUsers({ ... }) await ExampleConnector.instance.updateRoleCategory({ ... })
.id(...) .roleName(...)
.execute(); .execute();
``` ```

View File

@@ -0,0 +1,645 @@
part of 'generated.dart';
class ListCompletedApplicationsByStaffIdVariablesBuilder {
String staffId;
Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);
final FirebaseDataConnect _dataConnect; ListCompletedApplicationsByStaffIdVariablesBuilder offset(int? t) {
_offset.value = t;
return this;
}
ListCompletedApplicationsByStaffIdVariablesBuilder limit(int? t) {
_limit.value = t;
return this;
}
ListCompletedApplicationsByStaffIdVariablesBuilder(this._dataConnect, {required this.staffId,});
Deserializer<ListCompletedApplicationsByStaffIdData> dataDeserializer = (dynamic json) => ListCompletedApplicationsByStaffIdData.fromJson(jsonDecode(json));
Serializer<ListCompletedApplicationsByStaffIdVariables> varsSerializer = (ListCompletedApplicationsByStaffIdVariables vars) => jsonEncode(vars.toJson());
Future<QueryResult<ListCompletedApplicationsByStaffIdData, ListCompletedApplicationsByStaffIdVariables>> execute() {
return ref().execute();
}
QueryRef<ListCompletedApplicationsByStaffIdData, ListCompletedApplicationsByStaffIdVariables> ref() {
ListCompletedApplicationsByStaffIdVariables vars= ListCompletedApplicationsByStaffIdVariables(staffId: staffId,offset: _offset,limit: _limit,);
return _dataConnect.query("listCompletedApplicationsByStaffId", dataDeserializer, varsSerializer, vars);
}
}
@immutable
class ListCompletedApplicationsByStaffIdApplications {
final String id;
final String shiftId;
final String staffId;
final EnumValue<ApplicationStatus> status;
final Timestamp? appliedAt;
final Timestamp? checkInTime;
final Timestamp? checkOutTime;
final EnumValue<ApplicationOrigin> origin;
final Timestamp? createdAt;
final ListCompletedApplicationsByStaffIdApplicationsShift shift;
final ListCompletedApplicationsByStaffIdApplicationsShiftRole shiftRole;
ListCompletedApplicationsByStaffIdApplications.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
shiftId = nativeFromJson<String>(json['shiftId']),
staffId = nativeFromJson<String>(json['staffId']),
status = applicationStatusDeserializer(json['status']),
appliedAt = json['appliedAt'] == null ? null : Timestamp.fromJson(json['appliedAt']),
checkInTime = json['checkInTime'] == null ? null : Timestamp.fromJson(json['checkInTime']),
checkOutTime = json['checkOutTime'] == null ? null : Timestamp.fromJson(json['checkOutTime']),
origin = applicationOriginDeserializer(json['origin']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
shift = ListCompletedApplicationsByStaffIdApplicationsShift.fromJson(json['shift']),
shiftRole = ListCompletedApplicationsByStaffIdApplicationsShiftRole.fromJson(json['shiftRole']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final ListCompletedApplicationsByStaffIdApplications otherTyped = other as ListCompletedApplicationsByStaffIdApplications;
return id == otherTyped.id &&
shiftId == otherTyped.shiftId &&
staffId == otherTyped.staffId &&
status == otherTyped.status &&
appliedAt == otherTyped.appliedAt &&
checkInTime == otherTyped.checkInTime &&
checkOutTime == otherTyped.checkOutTime &&
origin == otherTyped.origin &&
createdAt == otherTyped.createdAt &&
shift == otherTyped.shift &&
shiftRole == otherTyped.shiftRole;
}
@override
int get hashCode => Object.hashAll([id.hashCode, shiftId.hashCode, staffId.hashCode, status.hashCode, appliedAt.hashCode, checkInTime.hashCode, checkOutTime.hashCode, origin.hashCode, createdAt.hashCode, shift.hashCode, shiftRole.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['shiftId'] = nativeToJson<String>(shiftId);
json['staffId'] = nativeToJson<String>(staffId);
json['status'] =
applicationStatusSerializer(status)
;
if (appliedAt != null) {
json['appliedAt'] = appliedAt!.toJson();
}
if (checkInTime != null) {
json['checkInTime'] = checkInTime!.toJson();
}
if (checkOutTime != null) {
json['checkOutTime'] = checkOutTime!.toJson();
}
json['origin'] =
applicationOriginSerializer(origin)
;
if (createdAt != null) {
json['createdAt'] = createdAt!.toJson();
}
json['shift'] = shift.toJson();
json['shiftRole'] = shiftRole.toJson();
return json;
}
ListCompletedApplicationsByStaffIdApplications({
required this.id,
required this.shiftId,
required this.staffId,
required this.status,
this.appliedAt,
this.checkInTime,
this.checkOutTime,
required this.origin,
this.createdAt,
required this.shift,
required this.shiftRole,
});
}
@immutable
class ListCompletedApplicationsByStaffIdApplicationsShift {
final String id;
final String title;
final Timestamp? date;
final Timestamp? startTime;
final Timestamp? endTime;
final String? location;
final EnumValue<ShiftStatus>? status;
final String? description;
final int? durationDays;
final ListCompletedApplicationsByStaffIdApplicationsShiftOrder order;
ListCompletedApplicationsByStaffIdApplicationsShift.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
title = nativeFromJson<String>(json['title']),
date = json['date'] == null ? null : Timestamp.fromJson(json['date']),
startTime = json['startTime'] == null ? null : Timestamp.fromJson(json['startTime']),
endTime = json['endTime'] == null ? null : Timestamp.fromJson(json['endTime']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
status = json['status'] == null ? null : shiftStatusDeserializer(json['status']),
description = json['description'] == null ? null : nativeFromJson<String>(json['description']),
durationDays = json['durationDays'] == null ? null : nativeFromJson<int>(json['durationDays']),
order = ListCompletedApplicationsByStaffIdApplicationsShiftOrder.fromJson(json['order']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final ListCompletedApplicationsByStaffIdApplicationsShift otherTyped = other as ListCompletedApplicationsByStaffIdApplicationsShift;
return id == otherTyped.id &&
title == otherTyped.title &&
date == otherTyped.date &&
startTime == otherTyped.startTime &&
endTime == otherTyped.endTime &&
location == otherTyped.location &&
status == otherTyped.status &&
description == otherTyped.description &&
durationDays == otherTyped.durationDays &&
order == otherTyped.order;
}
@override
int get hashCode => Object.hashAll([id.hashCode, title.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, location.hashCode, status.hashCode, description.hashCode, durationDays.hashCode, order.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['title'] = nativeToJson<String>(title);
if (date != null) {
json['date'] = date!.toJson();
}
if (startTime != null) {
json['startTime'] = startTime!.toJson();
}
if (endTime != null) {
json['endTime'] = endTime!.toJson();
}
if (location != null) {
json['location'] = nativeToJson<String?>(location);
}
if (status != null) {
json['status'] =
shiftStatusSerializer(status!)
;
}
if (description != null) {
json['description'] = nativeToJson<String?>(description);
}
if (durationDays != null) {
json['durationDays'] = nativeToJson<int?>(durationDays);
}
json['order'] = order.toJson();
return json;
}
ListCompletedApplicationsByStaffIdApplicationsShift({
required this.id,
required this.title,
this.date,
this.startTime,
this.endTime,
this.location,
this.status,
this.description,
this.durationDays,
required this.order,
});
}
@immutable
class ListCompletedApplicationsByStaffIdApplicationsShiftOrder {
final String id;
final String? eventName;
final ListCompletedApplicationsByStaffIdApplicationsShiftOrderTeamHub teamHub;
final ListCompletedApplicationsByStaffIdApplicationsShiftOrderBusiness business;
final ListCompletedApplicationsByStaffIdApplicationsShiftOrderVendor? vendor;
ListCompletedApplicationsByStaffIdApplicationsShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
teamHub = ListCompletedApplicationsByStaffIdApplicationsShiftOrderTeamHub.fromJson(json['teamHub']),
business = ListCompletedApplicationsByStaffIdApplicationsShiftOrderBusiness.fromJson(json['business']),
vendor = json['vendor'] == null ? null : ListCompletedApplicationsByStaffIdApplicationsShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final ListCompletedApplicationsByStaffIdApplicationsShiftOrder otherTyped = other as ListCompletedApplicationsByStaffIdApplicationsShiftOrder;
return id == otherTyped.id &&
eventName == otherTyped.eventName &&
teamHub == otherTyped.teamHub &&
business == otherTyped.business &&
vendor == otherTyped.vendor;
}
@override
int get hashCode => Object.hashAll([id.hashCode, eventName.hashCode, teamHub.hashCode, business.hashCode, vendor.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['teamHub'] = teamHub.toJson();
json['business'] = business.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
ListCompletedApplicationsByStaffIdApplicationsShiftOrder({
required this.id,
this.eventName,
required this.teamHub,
required this.business,
this.vendor,
});
}
@immutable
class ListCompletedApplicationsByStaffIdApplicationsShiftOrderTeamHub {
final String address;
final String? placeId;
final String hubName;
ListCompletedApplicationsByStaffIdApplicationsShiftOrderTeamHub.fromJson(dynamic json):
address = nativeFromJson<String>(json['address']),
placeId = json['placeId'] == null ? null : nativeFromJson<String>(json['placeId']),
hubName = nativeFromJson<String>(json['hubName']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final ListCompletedApplicationsByStaffIdApplicationsShiftOrderTeamHub otherTyped = other as ListCompletedApplicationsByStaffIdApplicationsShiftOrderTeamHub;
return address == otherTyped.address &&
placeId == otherTyped.placeId &&
hubName == otherTyped.hubName;
}
@override
int get hashCode => Object.hashAll([address.hashCode, placeId.hashCode, hubName.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['address'] = nativeToJson<String>(address);
if (placeId != null) {
json['placeId'] = nativeToJson<String?>(placeId);
}
json['hubName'] = nativeToJson<String>(hubName);
return json;
}
ListCompletedApplicationsByStaffIdApplicationsShiftOrderTeamHub({
required this.address,
this.placeId,
required this.hubName,
});
}
@immutable
class ListCompletedApplicationsByStaffIdApplicationsShiftOrderBusiness {
final String id;
final String businessName;
final String? email;
final String? contactName;
final String? companyLogoUrl;
ListCompletedApplicationsByStaffIdApplicationsShiftOrderBusiness.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
businessName = nativeFromJson<String>(json['businessName']),
email = json['email'] == null ? null : nativeFromJson<String>(json['email']),
contactName = json['contactName'] == null ? null : nativeFromJson<String>(json['contactName']),
companyLogoUrl = json['companyLogoUrl'] == null ? null : nativeFromJson<String>(json['companyLogoUrl']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final ListCompletedApplicationsByStaffIdApplicationsShiftOrderBusiness otherTyped = other as ListCompletedApplicationsByStaffIdApplicationsShiftOrderBusiness;
return id == otherTyped.id &&
businessName == otherTyped.businessName &&
email == otherTyped.email &&
contactName == otherTyped.contactName &&
companyLogoUrl == otherTyped.companyLogoUrl;
}
@override
int get hashCode => Object.hashAll([id.hashCode, businessName.hashCode, email.hashCode, contactName.hashCode, companyLogoUrl.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['businessName'] = nativeToJson<String>(businessName);
if (email != null) {
json['email'] = nativeToJson<String?>(email);
}
if (contactName != null) {
json['contactName'] = nativeToJson<String?>(contactName);
}
if (companyLogoUrl != null) {
json['companyLogoUrl'] = nativeToJson<String?>(companyLogoUrl);
}
return json;
}
ListCompletedApplicationsByStaffIdApplicationsShiftOrderBusiness({
required this.id,
required this.businessName,
this.email,
this.contactName,
this.companyLogoUrl,
});
}
@immutable
class ListCompletedApplicationsByStaffIdApplicationsShiftOrderVendor {
final String id;
final String companyName;
ListCompletedApplicationsByStaffIdApplicationsShiftOrderVendor.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
companyName = nativeFromJson<String>(json['companyName']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final ListCompletedApplicationsByStaffIdApplicationsShiftOrderVendor otherTyped = other as ListCompletedApplicationsByStaffIdApplicationsShiftOrderVendor;
return id == otherTyped.id &&
companyName == otherTyped.companyName;
}
@override
int get hashCode => Object.hashAll([id.hashCode, companyName.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['companyName'] = nativeToJson<String>(companyName);
return json;
}
ListCompletedApplicationsByStaffIdApplicationsShiftOrderVendor({
required this.id,
required this.companyName,
});
}
@immutable
class ListCompletedApplicationsByStaffIdApplicationsShiftRole {
final String id;
final String roleId;
final int count;
final int? assigned;
final Timestamp? startTime;
final Timestamp? endTime;
final double? hours;
final double? totalValue;
final ListCompletedApplicationsByStaffIdApplicationsShiftRoleRole role;
ListCompletedApplicationsByStaffIdApplicationsShiftRole.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
roleId = nativeFromJson<String>(json['roleId']),
count = nativeFromJson<int>(json['count']),
assigned = json['assigned'] == null ? null : nativeFromJson<int>(json['assigned']),
startTime = json['startTime'] == null ? null : Timestamp.fromJson(json['startTime']),
endTime = json['endTime'] == null ? null : Timestamp.fromJson(json['endTime']),
hours = json['hours'] == null ? null : nativeFromJson<double>(json['hours']),
totalValue = json['totalValue'] == null ? null : nativeFromJson<double>(json['totalValue']),
role = ListCompletedApplicationsByStaffIdApplicationsShiftRoleRole.fromJson(json['role']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final ListCompletedApplicationsByStaffIdApplicationsShiftRole otherTyped = other as ListCompletedApplicationsByStaffIdApplicationsShiftRole;
return id == otherTyped.id &&
roleId == otherTyped.roleId &&
count == otherTyped.count &&
assigned == otherTyped.assigned &&
startTime == otherTyped.startTime &&
endTime == otherTyped.endTime &&
hours == otherTyped.hours &&
totalValue == otherTyped.totalValue &&
role == otherTyped.role;
}
@override
int get hashCode => Object.hashAll([id.hashCode, roleId.hashCode, count.hashCode, assigned.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, totalValue.hashCode, role.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['roleId'] = nativeToJson<String>(roleId);
json['count'] = nativeToJson<int>(count);
if (assigned != null) {
json['assigned'] = nativeToJson<int?>(assigned);
}
if (startTime != null) {
json['startTime'] = startTime!.toJson();
}
if (endTime != null) {
json['endTime'] = endTime!.toJson();
}
if (hours != null) {
json['hours'] = nativeToJson<double?>(hours);
}
if (totalValue != null) {
json['totalValue'] = nativeToJson<double?>(totalValue);
}
json['role'] = role.toJson();
return json;
}
ListCompletedApplicationsByStaffIdApplicationsShiftRole({
required this.id,
required this.roleId,
required this.count,
this.assigned,
this.startTime,
this.endTime,
this.hours,
this.totalValue,
required this.role,
});
}
@immutable
class ListCompletedApplicationsByStaffIdApplicationsShiftRoleRole {
final String id;
final String name;
final double costPerHour;
ListCompletedApplicationsByStaffIdApplicationsShiftRoleRole.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
name = nativeFromJson<String>(json['name']),
costPerHour = nativeFromJson<double>(json['costPerHour']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final ListCompletedApplicationsByStaffIdApplicationsShiftRoleRole otherTyped = other as ListCompletedApplicationsByStaffIdApplicationsShiftRoleRole;
return id == otherTyped.id &&
name == otherTyped.name &&
costPerHour == otherTyped.costPerHour;
}
@override
int get hashCode => Object.hashAll([id.hashCode, name.hashCode, costPerHour.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['id'] = nativeToJson<String>(id);
json['name'] = nativeToJson<String>(name);
json['costPerHour'] = nativeToJson<double>(costPerHour);
return json;
}
ListCompletedApplicationsByStaffIdApplicationsShiftRoleRole({
required this.id,
required this.name,
required this.costPerHour,
});
}
@immutable
class ListCompletedApplicationsByStaffIdData {
final List<ListCompletedApplicationsByStaffIdApplications> applications;
ListCompletedApplicationsByStaffIdData.fromJson(dynamic json):
applications = (json['applications'] as List<dynamic>)
.map((e) => ListCompletedApplicationsByStaffIdApplications.fromJson(e))
.toList();
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final ListCompletedApplicationsByStaffIdData otherTyped = other as ListCompletedApplicationsByStaffIdData;
return applications == otherTyped.applications;
}
@override
int get hashCode => applications.hashCode;
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['applications'] = applications.map((e) => e.toJson()).toList();
return json;
}
ListCompletedApplicationsByStaffIdData({
required this.applications,
});
}
@immutable
class ListCompletedApplicationsByStaffIdVariables {
final String staffId;
late final Optional<int>offset;
late final Optional<int>limit;
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
ListCompletedApplicationsByStaffIdVariables.fromJson(Map<String, dynamic> json):
staffId = nativeFromJson<String>(json['staffId']) {
offset = Optional.optional(nativeFromJson, nativeToJson);
offset.value = json['offset'] == null ? null : nativeFromJson<int>(json['offset']);
limit = Optional.optional(nativeFromJson, nativeToJson);
limit.value = json['limit'] == null ? null : nativeFromJson<int>(json['limit']);
}
@override
bool operator ==(Object other) {
if(identical(this, other)) {
return true;
}
if(other.runtimeType != runtimeType) {
return false;
}
final ListCompletedApplicationsByStaffIdVariables otherTyped = other as ListCompletedApplicationsByStaffIdVariables;
return staffId == otherTyped.staffId &&
offset == otherTyped.offset &&
limit == otherTyped.limit;
}
@override
int get hashCode => Object.hashAll([staffId.hashCode, offset.hashCode, limit.hashCode]);
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['staffId'] = nativeToJson<String>(staffId);
if(offset.state == OptionalState.set) {
json['offset'] = offset.toJson();
}
if(limit.state == OptionalState.set) {
json['limit'] = limit.toJson();
}
return json;
}
ListCompletedApplicationsByStaffIdVariables({
required this.staffId,
required this.offset,
required this.limit,
});
}

View File

@@ -101,7 +101,55 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
@override @override
Future<List<Shift>> getHistoryShifts() async { Future<List<Shift>> getHistoryShifts() async {
return _fetchApplications(dc.ApplicationStatus.CHECKED_OUT); try {
final staffId = await _getStaffId();
final response = await _dataConnect
.listCompletedApplicationsByStaffId(staffId: staffId)
.execute();
final List<Shift> shifts = [];
for (final app in response.data.applications) {
_shiftToAppIdMap[app.shift.id] = app.id;
_appToRoleIdMap[app.id] = app.shiftRole.id;
final String roleName = app.shiftRole.role.name;
final String orderName =
(app.shift.order.eventName ?? '').trim().isNotEmpty
? app.shift.order.eventName!
: app.shift.order.business.businessName;
final String title = '$roleName - $orderName';
final DateTime? shiftDate = _toDateTime(app.shift.date);
final DateTime? startDt = _toDateTime(app.shiftRole.startTime);
final DateTime? endDt = _toDateTime(app.shiftRole.endTime);
final DateTime? createdDt = _toDateTime(app.createdAt);
shifts.add(
Shift(
id: app.shift.id,
roleId: app.shiftRole.roleId,
title: title,
clientName: app.shift.order.business.businessName,
logoUrl: app.shift.order.business.companyLogoUrl,
hourlyRate: app.shiftRole.role.costPerHour,
location: app.shift.location ?? '',
locationAddress: app.shift.order.teamHub.hubName,
date: shiftDate?.toIso8601String() ?? '',
startTime: startDt != null ? DateFormat('HH:mm').format(startDt) : '',
endTime: endDt != null ? DateFormat('HH:mm').format(endDt) : '',
createdDate: createdDt?.toIso8601String() ?? '',
status: _mapStatus(dc.ApplicationStatus.CHECKED_OUT),
description: app.shift.description,
durationDays: app.shift.durationDays,
requiredSlots: app.shiftRole.count,
filledSlots: app.shiftRole.assigned ?? 0,
hasApplied: true,
),
);
}
return shifts;
} catch (e) {
return <Shift>[];
}
} }
Future<List<Shift>> _fetchApplications( Future<List<Shift>> _fetchApplications(

View File

@@ -29,6 +29,7 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
required this.getHistoryShifts, required this.getHistoryShifts,
}) : super(ShiftsInitial()) { }) : super(ShiftsInitial()) {
on<LoadShiftsEvent>(_onLoadShifts); on<LoadShiftsEvent>(_onLoadShifts);
on<LoadHistoryShiftsEvent>(_onLoadHistoryShifts);
on<LoadShiftsForRangeEvent>(_onLoadShiftsForRange); on<LoadShiftsForRangeEvent>(_onLoadShiftsForRange);
on<FilterAvailableShiftsEvent>(_onFilterAvailableShifts); on<FilterAvailableShiftsEvent>(_onFilterAvailableShifts);
} }
@@ -51,7 +52,6 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
); );
final pendingResult = await getPendingAssignments(); final pendingResult = await getPendingAssignments();
final cancelledResult = await getCancelledShifts(); final cancelledResult = await getCancelledShifts();
final historyResult = await getHistoryShifts();
// Initial available with defaults // Initial available with defaults
final availableResult = await getAvailableShifts(const GetAvailableShiftsArguments()); final availableResult = await getAvailableShifts(const GetAvailableShiftsArguments());
@@ -61,7 +61,9 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
pendingShifts: pendingResult, pendingShifts: pendingResult,
cancelledShifts: cancelledResult, cancelledShifts: cancelledResult,
availableShifts: _filterPastShifts(availableResult), availableShifts: _filterPastShifts(availableResult),
historyShifts: historyResult, historyShifts: const [],
historyLoading: false,
historyLoaded: false,
searchQuery: '', searchQuery: '',
jobType: 'all', jobType: 'all',
)); ));
@@ -70,6 +72,27 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
} }
} }
Future<void> _onLoadHistoryShifts(
LoadHistoryShiftsEvent event,
Emitter<ShiftsState> emit,
) async {
final currentState = state;
if (currentState is! ShiftsLoaded) return;
if (currentState.historyLoading || currentState.historyLoaded) return;
emit(currentState.copyWith(historyLoading: true));
try {
final historyResult = await getHistoryShifts();
emit(currentState.copyWith(
historyShifts: historyResult,
historyLoading: false,
historyLoaded: true,
));
} catch (_) {
emit(currentState.copyWith(historyLoading: false));
}
}
Future<void> _onLoadShiftsForRange( Future<void> _onLoadShiftsForRange(
LoadShiftsForRangeEvent event, LoadShiftsForRangeEvent event,
Emitter<ShiftsState> emit, Emitter<ShiftsState> emit,
@@ -87,7 +110,6 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
final pendingResult = await getPendingAssignments(); final pendingResult = await getPendingAssignments();
final cancelledResult = await getCancelledShifts(); final cancelledResult = await getCancelledShifts();
final historyResult = await getHistoryShifts();
final availableResult = final availableResult =
await getAvailableShifts(const GetAvailableShiftsArguments()); await getAvailableShifts(const GetAvailableShiftsArguments());
@@ -96,7 +118,9 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
pendingShifts: pendingResult, pendingShifts: pendingResult,
cancelledShifts: cancelledResult, cancelledShifts: cancelledResult,
availableShifts: _filterPastShifts(availableResult), availableShifts: _filterPastShifts(availableResult),
historyShifts: historyResult, historyShifts: const [],
historyLoading: false,
historyLoaded: false,
searchQuery: '', searchQuery: '',
jobType: 'all', jobType: 'all',
)); ));

View File

@@ -10,6 +10,8 @@ sealed class ShiftsEvent extends Equatable {
class LoadShiftsEvent extends ShiftsEvent {} class LoadShiftsEvent extends ShiftsEvent {}
class LoadHistoryShiftsEvent extends ShiftsEvent {}
class LoadShiftsForRangeEvent extends ShiftsEvent { class LoadShiftsForRangeEvent extends ShiftsEvent {
final DateTime start; final DateTime start;
final DateTime end; final DateTime end;

View File

@@ -18,6 +18,8 @@ class ShiftsLoaded extends ShiftsState {
final List<Shift> cancelledShifts; final List<Shift> cancelledShifts;
final List<Shift> availableShifts; final List<Shift> availableShifts;
final List<Shift> historyShifts; final List<Shift> historyShifts;
final bool historyLoading;
final bool historyLoaded;
final String searchQuery; final String searchQuery;
final String jobType; final String jobType;
@@ -27,6 +29,8 @@ class ShiftsLoaded extends ShiftsState {
required this.cancelledShifts, required this.cancelledShifts,
required this.availableShifts, required this.availableShifts,
required this.historyShifts, required this.historyShifts,
required this.historyLoading,
required this.historyLoaded,
required this.searchQuery, required this.searchQuery,
required this.jobType, required this.jobType,
}); });
@@ -37,6 +41,8 @@ class ShiftsLoaded extends ShiftsState {
List<Shift>? cancelledShifts, List<Shift>? cancelledShifts,
List<Shift>? availableShifts, List<Shift>? availableShifts,
List<Shift>? historyShifts, List<Shift>? historyShifts,
bool? historyLoading,
bool? historyLoaded,
String? searchQuery, String? searchQuery,
String? jobType, String? jobType,
}) { }) {
@@ -46,6 +52,8 @@ class ShiftsLoaded extends ShiftsState {
cancelledShifts: cancelledShifts ?? this.cancelledShifts, cancelledShifts: cancelledShifts ?? this.cancelledShifts,
availableShifts: availableShifts ?? this.availableShifts, availableShifts: availableShifts ?? this.availableShifts,
historyShifts: historyShifts ?? this.historyShifts, historyShifts: historyShifts ?? this.historyShifts,
historyLoading: historyLoading ?? this.historyLoading,
historyLoaded: historyLoaded ?? this.historyLoaded,
searchQuery: searchQuery ?? this.searchQuery, searchQuery: searchQuery ?? this.searchQuery,
jobType: jobType ?? this.jobType, jobType: jobType ?? this.jobType,
); );
@@ -58,6 +66,8 @@ class ShiftsLoaded extends ShiftsState {
cancelledShifts, cancelledShifts,
availableShifts, availableShifts,
historyShifts, historyShifts,
historyLoading,
historyLoaded,
searchQuery, searchQuery,
jobType, jobType,
]; ];

View File

@@ -29,6 +29,9 @@ class _ShiftsPageState extends State<ShiftsPage> {
_activeTab = widget.initialTab ?? 'myshifts'; _activeTab = widget.initialTab ?? 'myshifts';
_selectedDate = widget.selectedDate; _selectedDate = widget.selectedDate;
_bloc.add(LoadShiftsEvent()); _bloc.add(LoadShiftsEvent());
if (_activeTab == 'history') {
_bloc.add(LoadHistoryShiftsEvent());
}
} }
@override @override
@@ -67,6 +70,12 @@ class _ShiftsPageState extends State<ShiftsPage> {
final List<Shift> historyShifts = (state is ShiftsLoaded) final List<Shift> historyShifts = (state is ShiftsLoaded)
? state.historyShifts ? state.historyShifts
: []; : [];
final bool historyLoading = (state is ShiftsLoaded)
? state.historyLoading
: false;
final bool historyLoaded = (state is ShiftsLoaded)
? state.historyLoaded
: false;
// Note: "filteredJobs" logic moved to FindShiftsTab // Note: "filteredJobs" logic moved to FindShiftsTab
// Note: Calendar logic moved to MyShiftsTab // Note: Calendar logic moved to MyShiftsTab
@@ -120,6 +129,7 @@ class _ShiftsPageState extends State<ShiftsPage> {
"History", "History",
UiIcons.clock, UiIcons.clock,
historyShifts.length, historyShifts.length,
showCount: historyLoaded,
), ),
], ],
), ),
@@ -133,11 +143,12 @@ class _ShiftsPageState extends State<ShiftsPage> {
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: _buildTabContent( : _buildTabContent(
myShifts, myShifts,
pendingAssignments, pendingAssignments,
cancelledShifts, cancelledShifts,
availableJobs, availableJobs,
historyShifts, historyShifts,
), historyLoading,
),
), ),
], ],
), ),
@@ -153,6 +164,7 @@ class _ShiftsPageState extends State<ShiftsPage> {
List<Shift> cancelledShifts, List<Shift> cancelledShifts,
List<Shift> availableJobs, List<Shift> availableJobs,
List<Shift> historyShifts, List<Shift> historyShifts,
bool historyLoading,
) { ) {
switch (_activeTab) { switch (_activeTab) {
case 'myshifts': case 'myshifts':
@@ -165,17 +177,31 @@ class _ShiftsPageState extends State<ShiftsPage> {
case 'find': case 'find':
return FindShiftsTab(availableJobs: availableJobs); return FindShiftsTab(availableJobs: availableJobs);
case 'history': case 'history':
if (historyLoading) {
return const Center(child: CircularProgressIndicator());
}
return HistoryShiftsTab(historyShifts: historyShifts); return HistoryShiftsTab(historyShifts: historyShifts);
default: default:
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
} }
Widget _buildTab(String id, String label, IconData icon, int count) { Widget _buildTab(
String id,
String label,
IconData icon,
int count, {
bool showCount = true,
}) {
final isActive = _activeTab == id; final isActive = _activeTab == id;
return Expanded( return Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () => setState(() => _activeTab = id), onTap: () {
setState(() => _activeTab = id);
if (id == 'history') {
_bloc.add(LoadHistoryShiftsEvent());
}
},
child: Container( child: Container(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 8), padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 8),
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -205,27 +231,32 @@ class _ShiftsPageState extends State<ShiftsPage> {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),
const SizedBox(width: 4), if (showCount) ...[
Container( const SizedBox(width: 4),
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), Container(
constraints: const BoxConstraints(minWidth: 18), padding: const EdgeInsets.symmetric(
decoration: BoxDecoration( horizontal: 6,
color: isActive vertical: 2,
? AppColors.krowBlue.withAlpha((0.1 * 255).round()) ),
: Colors.white.withAlpha((0.2 * 255).round()), constraints: const BoxConstraints(minWidth: 18),
borderRadius: BorderRadius.circular(999), decoration: BoxDecoration(
), color: isActive
child: Center( ? AppColors.krowBlue.withAlpha((0.1 * 255).round())
child: Text( : Colors.white.withAlpha((0.2 * 255).round()),
"$count", borderRadius: BorderRadius.circular(999),
style: TextStyle( ),
fontSize: 10, child: Center(
fontWeight: FontWeight.bold, child: Text(
color: isActive ? AppColors.krowBlue : Colors.white, "$count",
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.bold,
color: isActive ? AppColors.krowBlue : Colors.white,
),
), ),
), ),
), ),
), ],
], ],
), ),
), ),

View File

@@ -613,4 +613,89 @@ query listStaffsApplicationsByBusinessForDay(
} }
staff { id fullName email phone photoUrl } staff { id fullName email phone photoUrl }
} }
} }
# ==========================================================
# COMPLETED APPLICATIONS BY STAFF (same payload as
# getApplicationByStaffShiftAndRole)
# ==========================================================
query listCompletedApplicationsByStaffId(
$staffId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
applications(
where: {
staffId: { eq: $staffId }
status: { eq: COMPLETED }
}
offset: $offset
limit: $limit
orderBy: { appliedAt: DESC }
) {
id
shiftId
staffId
status
appliedAt
checkInTime
checkOutTime
origin
createdAt
shift {
id
title
date
startTime
endTime
location
status
description
durationDays
order {
id
eventName
teamHub {
address
placeId
hubName
}
business {
id
businessName
email
contactName
companyLogoUrl
}
vendor {
id
companyName
}
}
}
shiftRole {
id
roleId
count
assigned
startTime
endTime
hours
totalValue
role {
id
name
costPerHour
}
}
}
}