Merge branch '208-p0-auth-05-get-started-screen' of https://github.com/Oloodi/krow-workforce into 208-p0-auth-05-get-started-screen

This commit is contained in:
Achintha Isuru
2026-01-23 16:25:54 -05:00
41 changed files with 17996 additions and 17687 deletions

View File

@@ -1,16 +1,16 @@
# Basic Usage
```dart
ExampleConnector.instance.createTeamHudDepartment(createTeamHudDepartmentVariables).execute();
ExampleConnector.instance.updateTeamHudDepartment(updateTeamHudDepartmentVariables).execute();
ExampleConnector.instance.deleteTeamHudDepartment(deleteTeamHudDepartmentVariables).execute();
ExampleConnector.instance.listAssignments(listAssignmentsVariables).execute();
ExampleConnector.instance.getAssignmentById(getAssignmentByIdVariables).execute();
ExampleConnector.instance.listAssignmentsByWorkforceId(listAssignmentsByWorkforceIdVariables).execute();
ExampleConnector.instance.listAssignmentsByWorkforceIds(listAssignmentsByWorkforceIdsVariables).execute();
ExampleConnector.instance.listAssignmentsByShiftRole(listAssignmentsByShiftRoleVariables).execute();
ExampleConnector.instance.filterAssignments(filterAssignmentsVariables).execute();
ExampleConnector.instance.CreateCertificate(createCertificateVariables).execute();
ExampleConnector.instance.createAccount(createAccountVariables).execute();
ExampleConnector.instance.updateAccount(updateAccountVariables).execute();
ExampleConnector.instance.deleteAccount(deleteAccountVariables).execute();
ExampleConnector.instance.listBenefitsData(listBenefitsDataVariables).execute();
ExampleConnector.instance.getBenefitsDataByKey(getBenefitsDataByKeyVariables).execute();
ExampleConnector.instance.listBenefitsDataByStaffId(listBenefitsDataByStaffIdVariables).execute();
ExampleConnector.instance.listBenefitsDataByVendorBenefitPlanId(listBenefitsDataByVendorBenefitPlanIdVariables).execute();
ExampleConnector.instance.listBenefitsDataByVendorBenefitPlanIds(listBenefitsDataByVendorBenefitPlanIdsVariables).execute();
ExampleConnector.instance.createConversation(createConversationVariables).execute();
ExampleConnector.instance.updateConversation(updateConversationVariables).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.updateShift({ ... })
.title(...)
await ExampleConnector.instance.filterVendorBenefitPlans({ ... })
.vendorId(...)
.execute();
```

View File

@@ -1,7 +1,7 @@
part of 'generated.dart';
class CreateOrderVariablesBuilder {
String vendorId;
Optional<String> _vendorId = Optional.optional(nativeFromJson, nativeToJson);
String businessId;
OrderType orderType;
Optional<String> _location = Optional.optional(nativeFromJson, nativeToJson);
@@ -24,7 +24,12 @@ class CreateOrderVariablesBuilder {
Optional<AnyValue> _detectedConflicts = Optional.optional(AnyValue.fromJson, defaultSerializer);
Optional<String> _poReference = Optional.optional(nativeFromJson, nativeToJson);
final FirebaseDataConnect _dataConnect; CreateOrderVariablesBuilder location(String? t) {
final FirebaseDataConnect _dataConnect;
CreateOrderVariablesBuilder vendorId(String? t) {
_vendorId.value = t;
return this;
}
CreateOrderVariablesBuilder location(String? t) {
_location.value = t;
return this;
}
@@ -101,7 +106,7 @@ class CreateOrderVariablesBuilder {
return this;
}
CreateOrderVariablesBuilder(this._dataConnect, {required this.vendorId,required this.businessId,required this.orderType,});
CreateOrderVariablesBuilder(this._dataConnect, {required this.businessId,required this.orderType,});
Deserializer<CreateOrderData> dataDeserializer = (dynamic json) => CreateOrderData.fromJson(jsonDecode(json));
Serializer<CreateOrderVariables> varsSerializer = (CreateOrderVariables vars) => jsonEncode(vars.toJson());
Future<OperationResult<CreateOrderData, CreateOrderVariables>> execute() {
@@ -109,7 +114,7 @@ class CreateOrderVariablesBuilder {
}
MutationRef<CreateOrderData, CreateOrderVariables> ref() {
CreateOrderVariables vars= CreateOrderVariables(vendorId: vendorId,businessId: businessId,orderType: orderType,location: _location,status: _status,date: _date,startDate: _startDate,endDate: _endDate,duration: _duration,lunchBreak: _lunchBreak,total: _total,eventName: _eventName,assignedStaff: _assignedStaff,shifts: _shifts,requested: _requested,hub: _hub,recurringDays: _recurringDays,permanentStartDate: _permanentStartDate,permanentDays: _permanentDays,notes: _notes,detectedConflicts: _detectedConflicts,poReference: _poReference,);
CreateOrderVariables vars= CreateOrderVariables(vendorId: _vendorId,businessId: businessId,orderType: orderType,location: _location,status: _status,date: _date,startDate: _startDate,endDate: _endDate,duration: _duration,lunchBreak: _lunchBreak,total: _total,eventName: _eventName,assignedStaff: _assignedStaff,shifts: _shifts,requested: _requested,hub: _hub,recurringDays: _recurringDays,permanentStartDate: _permanentStartDate,permanentDays: _permanentDays,notes: _notes,detectedConflicts: _detectedConflicts,poReference: _poReference,);
return _dataConnect.mutation("createOrder", dataDeserializer, varsSerializer, vars);
}
}
@@ -184,7 +189,7 @@ class CreateOrderData {
@immutable
class CreateOrderVariables {
final String vendorId;
late final Optional<String>vendorId;
final String businessId;
final OrderType orderType;
late final Optional<String>location;
@@ -209,11 +214,13 @@ class CreateOrderVariables {
@Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
CreateOrderVariables.fromJson(Map<String, dynamic> json):
vendorId = nativeFromJson<String>(json['vendorId']),
businessId = nativeFromJson<String>(json['businessId']),
orderType = OrderType.values.byName(json['orderType']) {
vendorId = Optional.optional(nativeFromJson, nativeToJson);
vendorId.value = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']);
@@ -333,7 +340,9 @@ class CreateOrderVariables {
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {};
json['vendorId'] = nativeToJson<String>(vendorId);
if(vendorId.state == OptionalState.set) {
json['vendorId'] = vendorId.toJson();
}
json['businessId'] = nativeToJson<String>(businessId);
json['orderType'] =
orderType.name

View File

@@ -240,9 +240,9 @@ class FilterShiftsShiftsOrder {
final EnumValue<OrderStatus> status;
final EnumValue<OrderType> orderType;
final String businessId;
final String vendorId;
final String? vendorId;
final FilterShiftsShiftsOrderBusiness business;
final FilterShiftsShiftsOrderVendor vendor;
final FilterShiftsShiftsOrderVendor? vendor;
FilterShiftsShiftsOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
@@ -250,9 +250,9 @@ class FilterShiftsShiftsOrder {
status = orderStatusDeserializer(json['status']),
orderType = orderTypeDeserializer(json['orderType']),
businessId = nativeFromJson<String>(json['businessId']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
business = FilterShiftsShiftsOrderBusiness.fromJson(json['business']),
vendor = FilterShiftsShiftsOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : FilterShiftsShiftsOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -290,9 +290,13 @@ class FilterShiftsShiftsOrder {
orderTypeSerializer(orderType)
;
json['businessId'] = nativeToJson<String>(businessId);
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -302,9 +306,9 @@ class FilterShiftsShiftsOrder {
required this.status,
required this.orderType,
required this.businessId,
required this.vendorId,
this.vendorId,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -200,14 +200,14 @@ class GetApplicationByIdApplicationShiftOrder {
final String? eventName;
final String? location;
final GetApplicationByIdApplicationShiftOrderBusiness business;
final GetApplicationByIdApplicationShiftOrderVendor vendor;
final GetApplicationByIdApplicationShiftOrderVendor? vendor;
GetApplicationByIdApplicationShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
business = GetApplicationByIdApplicationShiftOrderBusiness.fromJson(json['business']),
vendor = GetApplicationByIdApplicationShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetApplicationByIdApplicationShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -239,7 +239,9 @@ class GetApplicationByIdApplicationShiftOrder {
json['location'] = nativeToJson<String?>(location);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -248,7 +250,7 @@ class GetApplicationByIdApplicationShiftOrder {
this.eventName,
this.location,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -200,14 +200,14 @@ class GetApplicationsByShiftIdApplicationsShiftOrder {
final String? eventName;
final String? location;
final GetApplicationsByShiftIdApplicationsShiftOrderBusiness business;
final GetApplicationsByShiftIdApplicationsShiftOrderVendor vendor;
final GetApplicationsByShiftIdApplicationsShiftOrderVendor? vendor;
GetApplicationsByShiftIdApplicationsShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
business = GetApplicationsByShiftIdApplicationsShiftOrderBusiness.fromJson(json['business']),
vendor = GetApplicationsByShiftIdApplicationsShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetApplicationsByShiftIdApplicationsShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -239,7 +239,9 @@ class GetApplicationsByShiftIdApplicationsShiftOrder {
json['location'] = nativeToJson<String?>(location);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -248,7 +250,7 @@ class GetApplicationsByShiftIdApplicationsShiftOrder {
this.eventName,
this.location,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -211,14 +211,14 @@ class GetApplicationsByShiftIdAndStatusApplicationsShiftOrder {
final String? eventName;
final String? location;
final GetApplicationsByShiftIdAndStatusApplicationsShiftOrderBusiness business;
final GetApplicationsByShiftIdAndStatusApplicationsShiftOrderVendor vendor;
final GetApplicationsByShiftIdAndStatusApplicationsShiftOrderVendor? vendor;
GetApplicationsByShiftIdAndStatusApplicationsShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
business = GetApplicationsByShiftIdAndStatusApplicationsShiftOrderBusiness.fromJson(json['business']),
vendor = GetApplicationsByShiftIdAndStatusApplicationsShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetApplicationsByShiftIdAndStatusApplicationsShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -250,7 +250,9 @@ class GetApplicationsByShiftIdAndStatusApplicationsShiftOrder {
json['location'] = nativeToJson<String?>(location);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -259,7 +261,7 @@ class GetApplicationsByShiftIdAndStatusApplicationsShiftOrder {
this.eventName,
this.location,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -210,14 +210,14 @@ class GetApplicationsByStaffIdApplicationsShiftOrder {
final String? eventName;
final String? location;
final GetApplicationsByStaffIdApplicationsShiftOrderBusiness business;
final GetApplicationsByStaffIdApplicationsShiftOrderVendor vendor;
final GetApplicationsByStaffIdApplicationsShiftOrderVendor? vendor;
GetApplicationsByStaffIdApplicationsShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
business = GetApplicationsByStaffIdApplicationsShiftOrderBusiness.fromJson(json['business']),
vendor = GetApplicationsByStaffIdApplicationsShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetApplicationsByStaffIdApplicationsShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -249,7 +249,9 @@ class GetApplicationsByStaffIdApplicationsShiftOrder {
json['location'] = nativeToJson<String?>(location);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -258,7 +260,7 @@ class GetApplicationsByStaffIdApplicationsShiftOrder {
this.eventName,
this.location,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -490,14 +490,14 @@ class GetAssignmentByIdAssignmentShiftRoleShiftOrder {
final String? eventName;
final EnumValue<OrderType> orderType;
final GetAssignmentByIdAssignmentShiftRoleShiftOrderBusiness business;
final GetAssignmentByIdAssignmentShiftRoleShiftOrderVendor vendor;
final GetAssignmentByIdAssignmentShiftRoleShiftOrderVendor? vendor;
GetAssignmentByIdAssignmentShiftRoleShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
orderType = orderTypeDeserializer(json['orderType']),
business = GetAssignmentByIdAssignmentShiftRoleShiftOrderBusiness.fromJson(json['business']),
vendor = GetAssignmentByIdAssignmentShiftRoleShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetAssignmentByIdAssignmentShiftRoleShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -529,7 +529,9 @@ class GetAssignmentByIdAssignmentShiftRoleShiftOrder {
orderTypeSerializer(orderType)
;
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -538,7 +540,7 @@ class GetAssignmentByIdAssignmentShiftRoleShiftOrder {
this.eventName,
required this.orderType,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -21,7 +21,7 @@ class GetOrderByIdVariablesBuilder {
class GetOrderByIdOrder {
final String id;
final String? eventName;
final String vendorId;
final String? vendorId;
final String businessId;
final EnumValue<OrderType> orderType;
final String? location;
@@ -43,12 +43,12 @@ class GetOrderByIdOrder {
final String? notes;
final Timestamp? createdAt;
final GetOrderByIdOrderBusiness business;
final GetOrderByIdOrderVendor vendor;
final GetOrderByIdOrderVendor? vendor;
GetOrderByIdOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
businessId = nativeFromJson<String>(json['businessId']),
orderType = orderTypeDeserializer(json['orderType']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
@@ -70,7 +70,7 @@ class GetOrderByIdOrder {
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
business = GetOrderByIdOrderBusiness.fromJson(json['business']),
vendor = GetOrderByIdOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetOrderByIdOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -118,7 +118,9 @@ class GetOrderByIdOrder {
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['businessId'] = nativeToJson<String>(businessId);
json['orderType'] =
orderTypeSerializer(orderType)
@@ -180,14 +182,16 @@ class GetOrderByIdOrder {
json['createdAt'] = createdAt!.toJson();
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
GetOrderByIdOrder({
required this.id,
this.eventName,
required this.vendorId,
this.vendorId,
required this.businessId,
required this.orderType,
this.location,
@@ -209,7 +213,7 @@ class GetOrderByIdOrder {
this.notes,
this.createdAt,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -31,7 +31,7 @@ class GetOrdersByBusinessIdVariablesBuilder {
class GetOrdersByBusinessIdOrders {
final String id;
final String? eventName;
final String vendorId;
final String? vendorId;
final String businessId;
final EnumValue<OrderType> orderType;
final String? location;
@@ -53,12 +53,12 @@ class GetOrdersByBusinessIdOrders {
final String? notes;
final Timestamp? createdAt;
final GetOrdersByBusinessIdOrdersBusiness business;
final GetOrdersByBusinessIdOrdersVendor vendor;
final GetOrdersByBusinessIdOrdersVendor? vendor;
GetOrdersByBusinessIdOrders.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
businessId = nativeFromJson<String>(json['businessId']),
orderType = orderTypeDeserializer(json['orderType']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
@@ -80,7 +80,7 @@ class GetOrdersByBusinessIdOrders {
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
business = GetOrdersByBusinessIdOrdersBusiness.fromJson(json['business']),
vendor = GetOrdersByBusinessIdOrdersVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetOrdersByBusinessIdOrdersVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -128,7 +128,9 @@ class GetOrdersByBusinessIdOrders {
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['businessId'] = nativeToJson<String>(businessId);
json['orderType'] =
orderTypeSerializer(orderType)
@@ -190,14 +192,16 @@ class GetOrdersByBusinessIdOrders {
json['createdAt'] = createdAt!.toJson();
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
GetOrdersByBusinessIdOrders({
required this.id,
this.eventName,
required this.vendorId,
this.vendorId,
required this.businessId,
required this.orderType,
this.location,
@@ -219,7 +223,7 @@ class GetOrdersByBusinessIdOrders {
this.notes,
this.createdAt,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -32,7 +32,7 @@ class GetOrdersByDateRangeVariablesBuilder {
class GetOrdersByDateRangeOrders {
final String id;
final String? eventName;
final String vendorId;
final String? vendorId;
final String businessId;
final EnumValue<OrderType> orderType;
final String? location;
@@ -54,12 +54,12 @@ class GetOrdersByDateRangeOrders {
final String? notes;
final Timestamp? createdAt;
final GetOrdersByDateRangeOrdersBusiness business;
final GetOrdersByDateRangeOrdersVendor vendor;
final GetOrdersByDateRangeOrdersVendor? vendor;
GetOrdersByDateRangeOrders.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
businessId = nativeFromJson<String>(json['businessId']),
orderType = orderTypeDeserializer(json['orderType']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
@@ -81,7 +81,7 @@ class GetOrdersByDateRangeOrders {
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
business = GetOrdersByDateRangeOrdersBusiness.fromJson(json['business']),
vendor = GetOrdersByDateRangeOrdersVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetOrdersByDateRangeOrdersVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -129,7 +129,9 @@ class GetOrdersByDateRangeOrders {
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['businessId'] = nativeToJson<String>(businessId);
json['orderType'] =
orderTypeSerializer(orderType)
@@ -191,14 +193,16 @@ class GetOrdersByDateRangeOrders {
json['createdAt'] = createdAt!.toJson();
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
GetOrdersByDateRangeOrders({
required this.id,
this.eventName,
required this.vendorId,
this.vendorId,
required this.businessId,
required this.orderType,
this.location,
@@ -220,7 +224,7 @@ class GetOrdersByDateRangeOrders {
this.notes,
this.createdAt,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -31,7 +31,7 @@ class GetOrdersByStatusVariablesBuilder {
class GetOrdersByStatusOrders {
final String id;
final String? eventName;
final String vendorId;
final String? vendorId;
final String businessId;
final EnumValue<OrderType> orderType;
final String? location;
@@ -53,12 +53,12 @@ class GetOrdersByStatusOrders {
final String? notes;
final Timestamp? createdAt;
final GetOrdersByStatusOrdersBusiness business;
final GetOrdersByStatusOrdersVendor vendor;
final GetOrdersByStatusOrdersVendor? vendor;
GetOrdersByStatusOrders.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
businessId = nativeFromJson<String>(json['businessId']),
orderType = orderTypeDeserializer(json['orderType']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
@@ -80,7 +80,7 @@ class GetOrdersByStatusOrders {
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
business = GetOrdersByStatusOrdersBusiness.fromJson(json['business']),
vendor = GetOrdersByStatusOrdersVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetOrdersByStatusOrdersVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -128,7 +128,9 @@ class GetOrdersByStatusOrders {
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['businessId'] = nativeToJson<String>(businessId);
json['orderType'] =
orderTypeSerializer(orderType)
@@ -190,14 +192,16 @@ class GetOrdersByStatusOrders {
json['createdAt'] = createdAt!.toJson();
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
GetOrdersByStatusOrders({
required this.id,
this.eventName,
required this.vendorId,
this.vendorId,
required this.businessId,
required this.orderType,
this.location,
@@ -219,7 +223,7 @@ class GetOrdersByStatusOrders {
this.notes,
this.createdAt,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -31,7 +31,7 @@ class GetOrdersByVendorIdVariablesBuilder {
class GetOrdersByVendorIdOrders {
final String id;
final String? eventName;
final String vendorId;
final String? vendorId;
final String businessId;
final EnumValue<OrderType> orderType;
final String? location;
@@ -53,12 +53,12 @@ class GetOrdersByVendorIdOrders {
final String? notes;
final Timestamp? createdAt;
final GetOrdersByVendorIdOrdersBusiness business;
final GetOrdersByVendorIdOrdersVendor vendor;
final GetOrdersByVendorIdOrdersVendor? vendor;
GetOrdersByVendorIdOrders.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
businessId = nativeFromJson<String>(json['businessId']),
orderType = orderTypeDeserializer(json['orderType']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
@@ -80,7 +80,7 @@ class GetOrdersByVendorIdOrders {
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
business = GetOrdersByVendorIdOrdersBusiness.fromJson(json['business']),
vendor = GetOrdersByVendorIdOrdersVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetOrdersByVendorIdOrdersVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -128,7 +128,9 @@ class GetOrdersByVendorIdOrders {
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['businessId'] = nativeToJson<String>(businessId);
json['orderType'] =
orderTypeSerializer(orderType)
@@ -190,14 +192,16 @@ class GetOrdersByVendorIdOrders {
json['createdAt'] = createdAt!.toJson();
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
GetOrdersByVendorIdOrders({
required this.id,
this.eventName,
required this.vendorId,
this.vendorId,
required this.businessId,
required this.orderType,
this.location,
@@ -219,7 +223,7 @@ class GetOrdersByVendorIdOrders {
this.notes,
this.createdAt,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -31,7 +31,7 @@ class GetRapidOrdersVariablesBuilder {
class GetRapidOrdersOrders {
final String id;
final String? eventName;
final String vendorId;
final String? vendorId;
final String businessId;
final EnumValue<OrderType> orderType;
final String? location;
@@ -53,12 +53,12 @@ class GetRapidOrdersOrders {
final String? notes;
final Timestamp? createdAt;
final GetRapidOrdersOrdersBusiness business;
final GetRapidOrdersOrdersVendor vendor;
final GetRapidOrdersOrdersVendor? vendor;
GetRapidOrdersOrders.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
businessId = nativeFromJson<String>(json['businessId']),
orderType = orderTypeDeserializer(json['orderType']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
@@ -80,7 +80,7 @@ class GetRapidOrdersOrders {
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
business = GetRapidOrdersOrdersBusiness.fromJson(json['business']),
vendor = GetRapidOrdersOrdersVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetRapidOrdersOrdersVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -128,7 +128,9 @@ class GetRapidOrdersOrders {
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['businessId'] = nativeToJson<String>(businessId);
json['orderType'] =
orderTypeSerializer(orderType)
@@ -190,14 +192,16 @@ class GetRapidOrdersOrders {
json['createdAt'] = createdAt!.toJson();
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
GetRapidOrdersOrders({
required this.id,
this.eventName,
required this.vendorId,
this.vendorId,
required this.businessId,
required this.orderType,
this.location,
@@ -219,7 +223,7 @@ class GetRapidOrdersOrders {
this.notes,
this.createdAt,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -210,9 +210,9 @@ class GetShiftByIdShiftOrder {
final EnumValue<OrderStatus> status;
final EnumValue<OrderType> orderType;
final String businessId;
final String vendorId;
final String? vendorId;
final GetShiftByIdShiftOrderBusiness business;
final GetShiftByIdShiftOrderVendor vendor;
final GetShiftByIdShiftOrderVendor? vendor;
GetShiftByIdShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
@@ -220,9 +220,9 @@ class GetShiftByIdShiftOrder {
status = orderStatusDeserializer(json['status']),
orderType = orderTypeDeserializer(json['orderType']),
businessId = nativeFromJson<String>(json['businessId']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
business = GetShiftByIdShiftOrderBusiness.fromJson(json['business']),
vendor = GetShiftByIdShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetShiftByIdShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -260,9 +260,13 @@ class GetShiftByIdShiftOrder {
orderTypeSerializer(orderType)
;
json['businessId'] = nativeToJson<String>(businessId);
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -272,9 +276,9 @@ class GetShiftByIdShiftOrder {
required this.status,
required this.orderType,
required this.businessId,
required this.vendorId,
this.vendorId,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -252,14 +252,14 @@ class GetShiftRoleByIdShiftRoleShiftOrder {
final AnyValue? permanentDays;
final String? notes;
final GetShiftRoleByIdShiftRoleShiftOrderBusiness business;
final GetShiftRoleByIdShiftRoleShiftOrderVendor vendor;
final GetShiftRoleByIdShiftRoleShiftOrderVendor? vendor;
GetShiftRoleByIdShiftRoleShiftOrder.fromJson(dynamic json):
recurringDays = json['recurringDays'] == null ? null : AnyValue.fromJson(json['recurringDays']),
permanentDays = json['permanentDays'] == null ? null : AnyValue.fromJson(json['permanentDays']),
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
business = GetShiftRoleByIdShiftRoleShiftOrderBusiness.fromJson(json['business']),
vendor = GetShiftRoleByIdShiftRoleShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetShiftRoleByIdShiftRoleShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -293,7 +293,9 @@ class GetShiftRoleByIdShiftRoleShiftOrder {
json['notes'] = nativeToJson<String?>(notes);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -302,7 +304,7 @@ class GetShiftRoleByIdShiftRoleShiftOrder {
this.permanentDays,
this.notes,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -230,9 +230,9 @@ class GetShiftsByBusinessIdShiftsOrder {
final EnumValue<OrderStatus> status;
final EnumValue<OrderType> orderType;
final String businessId;
final String vendorId;
final String? vendorId;
final GetShiftsByBusinessIdShiftsOrderBusiness business;
final GetShiftsByBusinessIdShiftsOrderVendor vendor;
final GetShiftsByBusinessIdShiftsOrderVendor? vendor;
GetShiftsByBusinessIdShiftsOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
@@ -240,9 +240,9 @@ class GetShiftsByBusinessIdShiftsOrder {
status = orderStatusDeserializer(json['status']),
orderType = orderTypeDeserializer(json['orderType']),
businessId = nativeFromJson<String>(json['businessId']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
business = GetShiftsByBusinessIdShiftsOrderBusiness.fromJson(json['business']),
vendor = GetShiftsByBusinessIdShiftsOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetShiftsByBusinessIdShiftsOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -280,9 +280,13 @@ class GetShiftsByBusinessIdShiftsOrder {
orderTypeSerializer(orderType)
;
json['businessId'] = nativeToJson<String>(businessId);
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -292,9 +296,9 @@ class GetShiftsByBusinessIdShiftsOrder {
required this.status,
required this.orderType,
required this.businessId,
required this.vendorId,
this.vendorId,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -230,9 +230,9 @@ class GetShiftsByVendorIdShiftsOrder {
final EnumValue<OrderStatus> status;
final EnumValue<OrderType> orderType;
final String businessId;
final String vendorId;
final String? vendorId;
final GetShiftsByVendorIdShiftsOrderBusiness business;
final GetShiftsByVendorIdShiftsOrderVendor vendor;
final GetShiftsByVendorIdShiftsOrderVendor? vendor;
GetShiftsByVendorIdShiftsOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
@@ -240,9 +240,9 @@ class GetShiftsByVendorIdShiftsOrder {
status = orderStatusDeserializer(json['status']),
orderType = orderTypeDeserializer(json['orderType']),
businessId = nativeFromJson<String>(json['businessId']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
business = GetShiftsByVendorIdShiftsOrderBusiness.fromJson(json['business']),
vendor = GetShiftsByVendorIdShiftsOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : GetShiftsByVendorIdShiftsOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -280,9 +280,13 @@ class GetShiftsByVendorIdShiftsOrder {
orderTypeSerializer(orderType)
;
json['businessId'] = nativeToJson<String>(businessId);
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -292,9 +296,9 @@ class GetShiftsByVendorIdShiftsOrder {
required this.status,
required this.orderType,
required this.businessId,
required this.vendorId,
this.vendorId,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -199,14 +199,14 @@ class ListApplicationsApplicationsShiftOrder {
final String? eventName;
final String? location;
final ListApplicationsApplicationsShiftOrderBusiness business;
final ListApplicationsApplicationsShiftOrderVendor vendor;
final ListApplicationsApplicationsShiftOrderVendor? vendor;
ListApplicationsApplicationsShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
business = ListApplicationsApplicationsShiftOrderBusiness.fromJson(json['business']),
vendor = ListApplicationsApplicationsShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : ListApplicationsApplicationsShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -238,7 +238,9 @@ class ListApplicationsApplicationsShiftOrder {
json['location'] = nativeToJson<String?>(location);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -247,7 +249,7 @@ class ListApplicationsApplicationsShiftOrder {
this.eventName,
this.location,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -398,13 +398,13 @@ class ListAssignmentsAssignmentsShiftRoleShiftOrder {
final String id;
final String? eventName;
final ListAssignmentsAssignmentsShiftRoleShiftOrderBusiness business;
final ListAssignmentsAssignmentsShiftRoleShiftOrderVendor vendor;
final ListAssignmentsAssignmentsShiftRoleShiftOrderVendor? vendor;
ListAssignmentsAssignmentsShiftRoleShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
business = ListAssignmentsAssignmentsShiftRoleShiftOrderBusiness.fromJson(json['business']),
vendor = ListAssignmentsAssignmentsShiftRoleShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : ListAssignmentsAssignmentsShiftRoleShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -432,7 +432,9 @@ class ListAssignmentsAssignmentsShiftRoleShiftOrder {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -440,7 +442,7 @@ class ListAssignmentsAssignmentsShiftRoleShiftOrder {
required this.id,
this.eventName,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -365,13 +365,13 @@ class ListAssignmentsByWorkforceIdAssignmentsShiftRoleShiftOrder {
final String id;
final String? eventName;
final ListAssignmentsByWorkforceIdAssignmentsShiftRoleShiftOrderBusiness business;
final ListAssignmentsByWorkforceIdAssignmentsShiftRoleShiftOrderVendor vendor;
final ListAssignmentsByWorkforceIdAssignmentsShiftRoleShiftOrderVendor? vendor;
ListAssignmentsByWorkforceIdAssignmentsShiftRoleShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
business = ListAssignmentsByWorkforceIdAssignmentsShiftRoleShiftOrderBusiness.fromJson(json['business']),
vendor = ListAssignmentsByWorkforceIdAssignmentsShiftRoleShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : ListAssignmentsByWorkforceIdAssignmentsShiftRoleShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -399,7 +399,9 @@ class ListAssignmentsByWorkforceIdAssignmentsShiftRoleShiftOrder {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -407,7 +409,7 @@ class ListAssignmentsByWorkforceIdAssignmentsShiftRoleShiftOrder {
required this.id,
this.eventName,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -316,13 +316,13 @@ class ListAssignmentsByWorkforceIdsAssignmentsShiftRoleShiftOrder {
final String id;
final String? eventName;
final ListAssignmentsByWorkforceIdsAssignmentsShiftRoleShiftOrderBusiness business;
final ListAssignmentsByWorkforceIdsAssignmentsShiftRoleShiftOrderVendor vendor;
final ListAssignmentsByWorkforceIdsAssignmentsShiftRoleShiftOrderVendor? vendor;
ListAssignmentsByWorkforceIdsAssignmentsShiftRoleShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
business = ListAssignmentsByWorkforceIdsAssignmentsShiftRoleShiftOrderBusiness.fromJson(json['business']),
vendor = ListAssignmentsByWorkforceIdsAssignmentsShiftRoleShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : ListAssignmentsByWorkforceIdsAssignmentsShiftRoleShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -350,7 +350,9 @@ class ListAssignmentsByWorkforceIdsAssignmentsShiftRoleShiftOrder {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -358,7 +360,7 @@ class ListAssignmentsByWorkforceIdsAssignmentsShiftRoleShiftOrder {
required this.id,
this.eventName,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -31,7 +31,7 @@ class ListOrdersVariablesBuilder {
class ListOrdersOrders {
final String id;
final String? eventName;
final String vendorId;
final String? vendorId;
final String businessId;
final EnumValue<OrderType> orderType;
final String? location;
@@ -53,12 +53,12 @@ class ListOrdersOrders {
final String? notes;
final Timestamp? createdAt;
final ListOrdersOrdersBusiness business;
final ListOrdersOrdersVendor vendor;
final ListOrdersOrdersVendor? vendor;
ListOrdersOrders.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
businessId = nativeFromJson<String>(json['businessId']),
orderType = orderTypeDeserializer(json['orderType']),
location = json['location'] == null ? null : nativeFromJson<String>(json['location']),
@@ -80,7 +80,7 @@ class ListOrdersOrders {
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
business = ListOrdersOrdersBusiness.fromJson(json['business']),
vendor = ListOrdersOrdersVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : ListOrdersOrdersVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -128,7 +128,9 @@ class ListOrdersOrders {
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['businessId'] = nativeToJson<String>(businessId);
json['orderType'] =
orderTypeSerializer(orderType)
@@ -190,14 +192,16 @@ class ListOrdersOrders {
json['createdAt'] = createdAt!.toJson();
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
ListOrdersOrders({
required this.id,
this.eventName,
required this.vendorId,
this.vendorId,
required this.businessId,
required this.orderType,
this.location,
@@ -219,7 +223,7 @@ class ListOrdersOrders {
this.notes,
this.createdAt,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -261,14 +261,14 @@ class ListShiftRolesByRoleIdShiftRolesShiftOrder {
final AnyValue? permanentDays;
final String? notes;
final ListShiftRolesByRoleIdShiftRolesShiftOrderBusiness business;
final ListShiftRolesByRoleIdShiftRolesShiftOrderVendor vendor;
final ListShiftRolesByRoleIdShiftRolesShiftOrderVendor? vendor;
ListShiftRolesByRoleIdShiftRolesShiftOrder.fromJson(dynamic json):
recurringDays = json['recurringDays'] == null ? null : AnyValue.fromJson(json['recurringDays']),
permanentDays = json['permanentDays'] == null ? null : AnyValue.fromJson(json['permanentDays']),
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
business = ListShiftRolesByRoleIdShiftRolesShiftOrderBusiness.fromJson(json['business']),
vendor = ListShiftRolesByRoleIdShiftRolesShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : ListShiftRolesByRoleIdShiftRolesShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -302,7 +302,9 @@ class ListShiftRolesByRoleIdShiftRolesShiftOrder {
json['notes'] = nativeToJson<String?>(notes);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -311,7 +313,7 @@ class ListShiftRolesByRoleIdShiftRolesShiftOrder {
this.permanentDays,
this.notes,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -261,14 +261,14 @@ class ListShiftRolesByShiftIdShiftRolesShiftOrder {
final AnyValue? permanentDays;
final String? notes;
final ListShiftRolesByShiftIdShiftRolesShiftOrderBusiness business;
final ListShiftRolesByShiftIdShiftRolesShiftOrderVendor vendor;
final ListShiftRolesByShiftIdShiftRolesShiftOrderVendor? vendor;
ListShiftRolesByShiftIdShiftRolesShiftOrder.fromJson(dynamic json):
recurringDays = json['recurringDays'] == null ? null : AnyValue.fromJson(json['recurringDays']),
permanentDays = json['permanentDays'] == null ? null : AnyValue.fromJson(json['permanentDays']),
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
business = ListShiftRolesByShiftIdShiftRolesShiftOrderBusiness.fromJson(json['business']),
vendor = ListShiftRolesByShiftIdShiftRolesShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : ListShiftRolesByShiftIdShiftRolesShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -302,7 +302,9 @@ class ListShiftRolesByShiftIdShiftRolesShiftOrder {
json['notes'] = nativeToJson<String?>(notes);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -311,7 +313,7 @@ class ListShiftRolesByShiftIdShiftRolesShiftOrder {
this.permanentDays,
this.notes,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -263,14 +263,14 @@ class ListShiftRolesByShiftIdAndTimeRangeShiftRolesShiftOrder {
final AnyValue? permanentDays;
final String? notes;
final ListShiftRolesByShiftIdAndTimeRangeShiftRolesShiftOrderBusiness business;
final ListShiftRolesByShiftIdAndTimeRangeShiftRolesShiftOrderVendor vendor;
final ListShiftRolesByShiftIdAndTimeRangeShiftRolesShiftOrderVendor? vendor;
ListShiftRolesByShiftIdAndTimeRangeShiftRolesShiftOrder.fromJson(dynamic json):
recurringDays = json['recurringDays'] == null ? null : AnyValue.fromJson(json['recurringDays']),
permanentDays = json['permanentDays'] == null ? null : AnyValue.fromJson(json['permanentDays']),
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
business = ListShiftRolesByShiftIdAndTimeRangeShiftRolesShiftOrderBusiness.fromJson(json['business']),
vendor = ListShiftRolesByShiftIdAndTimeRangeShiftRolesShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : ListShiftRolesByShiftIdAndTimeRangeShiftRolesShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -304,7 +304,9 @@ class ListShiftRolesByShiftIdAndTimeRangeShiftRolesShiftOrder {
json['notes'] = nativeToJson<String?>(notes);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -313,7 +315,7 @@ class ListShiftRolesByShiftIdAndTimeRangeShiftRolesShiftOrder {
this.permanentDays,
this.notes,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -276,7 +276,7 @@ class ListShiftRolesByVendorIdShiftRolesShift {
class ListShiftRolesByVendorIdShiftRolesShiftOrder {
final String id;
final String? eventName;
final String vendorId;
final String? vendorId;
final String businessId;
final EnumValue<OrderType> orderType;
final EnumValue<OrderStatus> status;
@@ -285,12 +285,12 @@ class ListShiftRolesByVendorIdShiftRolesShiftOrder {
final AnyValue? permanentDays;
final String? notes;
final ListShiftRolesByVendorIdShiftRolesShiftOrderBusiness business;
final ListShiftRolesByVendorIdShiftRolesShiftOrderVendor vendor;
final ListShiftRolesByVendorIdShiftRolesShiftOrderVendor? vendor;
ListShiftRolesByVendorIdShiftRolesShiftOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
businessId = nativeFromJson<String>(json['businessId']),
orderType = orderTypeDeserializer(json['orderType']),
status = orderStatusDeserializer(json['status']),
@@ -299,7 +299,7 @@ class ListShiftRolesByVendorIdShiftRolesShiftOrder {
permanentDays = json['permanentDays'] == null ? null : AnyValue.fromJson(json['permanentDays']),
notes = json['notes'] == null ? null : nativeFromJson<String>(json['notes']),
business = ListShiftRolesByVendorIdShiftRolesShiftOrderBusiness.fromJson(json['business']),
vendor = ListShiftRolesByVendorIdShiftRolesShiftOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : ListShiftRolesByVendorIdShiftRolesShiftOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -334,7 +334,9 @@ class ListShiftRolesByVendorIdShiftRolesShiftOrder {
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['businessId'] = nativeToJson<String>(businessId);
json['orderType'] =
orderTypeSerializer(orderType)
@@ -355,14 +357,16 @@ class ListShiftRolesByVendorIdShiftRolesShiftOrder {
json['notes'] = nativeToJson<String?>(notes);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
ListShiftRolesByVendorIdShiftRolesShiftOrder({
required this.id,
this.eventName,
required this.vendorId,
this.vendorId,
required this.businessId,
required this.orderType,
required this.status,
@@ -371,7 +375,7 @@ class ListShiftRolesByVendorIdShiftRolesShiftOrder {
this.permanentDays,
this.notes,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -220,9 +220,9 @@ class ListShiftsShiftsOrder {
final EnumValue<OrderStatus> status;
final EnumValue<OrderType> orderType;
final String businessId;
final String vendorId;
final String? vendorId;
final ListShiftsShiftsOrderBusiness business;
final ListShiftsShiftsOrderVendor vendor;
final ListShiftsShiftsOrderVendor? vendor;
ListShiftsShiftsOrder.fromJson(dynamic json):
id = nativeFromJson<String>(json['id']),
@@ -230,9 +230,9 @@ class ListShiftsShiftsOrder {
status = orderStatusDeserializer(json['status']),
orderType = orderTypeDeserializer(json['orderType']),
businessId = nativeFromJson<String>(json['businessId']),
vendorId = nativeFromJson<String>(json['vendorId']),
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
business = ListShiftsShiftsOrderBusiness.fromJson(json['business']),
vendor = ListShiftsShiftsOrderVendor.fromJson(json['vendor']);
vendor = json['vendor'] == null ? null : ListShiftsShiftsOrderVendor.fromJson(json['vendor']);
@override
bool operator ==(Object other) {
if(identical(this, other)) {
@@ -270,9 +270,13 @@ class ListShiftsShiftsOrder {
orderTypeSerializer(orderType)
;
json['businessId'] = nativeToJson<String>(businessId);
json['vendorId'] = nativeToJson<String>(vendorId);
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
json['business'] = business.toJson();
json['vendor'] = vendor.toJson();
if (vendor != null) {
json['vendor'] = vendor!.toJson();
}
return json;
}
@@ -282,9 +286,9 @@ class ListShiftsShiftsOrder {
required this.status,
required this.orderType,
required this.businessId,
required this.vendorId,
this.vendorId,
required this.business,
required this.vendor,
this.vendor,
});
}

View File

@@ -10,6 +10,8 @@ class OneTimeOrder extends Equatable {
required this.date,
required this.location,
required this.positions,
this.vendorId,
this.roleRates = const <String, double>{},
});
/// The specific date for the shift or event.
final DateTime date;
@@ -20,6 +22,18 @@ class OneTimeOrder extends Equatable {
/// The list of positions and headcounts required for this order.
final List<OneTimeOrderPosition> positions;
/// Selected vendor id for this order.
final String? vendorId;
/// Role hourly rates keyed by role id.
final Map<String, double> roleRates;
@override
List<Object?> get props => <Object?>[date, location, positions];
List<Object?> get props => <Object?>[
date,
location,
positions,
vendorId,
roleRates,
];
}

View File

@@ -1,6 +1,7 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_data_connect/krow_data_connect.dart';
import 'package:firebase_auth/firebase_auth.dart' as firebase;
import 'data/repositories_impl/client_create_order_repository_impl.dart';
import 'domain/repositories/client_create_order_repository_interface.dart';
import 'domain/usecases/create_one_time_order_usecase.dart';
@@ -29,7 +30,8 @@ class ClientCreateOrderModule extends Module {
// Repositories
i.addLazySingleton<ClientCreateOrderRepositoryInterface>(
() => ClientCreateOrderRepositoryImpl(
orderMock: i.get<OrderRepositoryMock>(),
firebaseAuth: firebase.FirebaseAuth.instance,
dataConnect: ExampleConnector.instance,
),
);
@@ -41,7 +43,12 @@ class ClientCreateOrderModule extends Module {
// BLoCs
i.addSingleton<ClientCreateOrderBloc>(ClientCreateOrderBloc.new);
i.add<RapidOrderBloc>(RapidOrderBloc.new);
i.add<OneTimeOrderBloc>(OneTimeOrderBloc.new);
i.add<OneTimeOrderBloc>(
() => OneTimeOrderBloc(
i.get<CreateOneTimeOrderUseCase>(),
ExampleConnector.instance,
),
);
}
@override

View File

@@ -1,5 +1,8 @@
import 'package:krow_data_connect/krow_data_connect.dart' hide OrderType;
import 'package:krow_domain/krow_domain.dart';
import 'package:firebase_auth/firebase_auth.dart' as firebase;
import 'package:firebase_data_connect/firebase_data_connect.dart' as fdc;
import 'package:intl/intl.dart';
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
import 'package:krow_domain/krow_domain.dart' as domain;
import '../../domain/repositories/client_create_order_repository_interface.dart';
/// Implementation of [ClientCreateOrderRepositoryInterface].
@@ -12,29 +15,171 @@ import '../../domain/repositories/client_create_order_repository_interface.dart'
/// on delegation and data mapping, without business logic.
class ClientCreateOrderRepositoryImpl
implements ClientCreateOrderRepositoryInterface {
/// Creates a [ClientCreateOrderRepositoryImpl].
///
/// Requires the [OrderRepositoryMock] from the shared Data Connect package.
/// TODO: Inject and use ExampleConnector when real mutations are available.
ClientCreateOrderRepositoryImpl({required OrderRepositoryMock orderMock})
: _orderMock = orderMock;
final OrderRepositoryMock _orderMock;
ClientCreateOrderRepositoryImpl({
required firebase.FirebaseAuth firebaseAuth,
required dc.ExampleConnector dataConnect,
}) : _firebaseAuth = firebaseAuth,
_dataConnect = dataConnect;
final firebase.FirebaseAuth _firebaseAuth;
final dc.ExampleConnector _dataConnect;
@override
Future<List<OrderType>> getOrderTypes() {
// Delegates to Data Connect layer
return _orderMock.getOrderTypes();
Future<List<domain.OrderType>> getOrderTypes() {
return Future.value(const <domain.OrderType>[
domain.OrderType(
id: 'rapid',
titleKey: 'client_create_order.types.rapid',
descriptionKey: 'client_create_order.types.rapid_desc',
),
domain.OrderType(
id: 'one-time',
titleKey: 'client_create_order.types.one_time',
descriptionKey: 'client_create_order.types.one_time_desc',
),
domain.OrderType(
id: 'recurring',
titleKey: 'client_create_order.types.recurring',
descriptionKey: 'client_create_order.types.recurring_desc',
),
domain.OrderType(
id: 'permanent',
titleKey: 'client_create_order.types.permanent',
descriptionKey: 'client_create_order.types.permanent_desc',
),
]);
}
@override
Future<void> createOneTimeOrder(OneTimeOrder order) {
// Delegates to Data Connect layer
return _orderMock.createOneTimeOrder(order);
Future<void> createOneTimeOrder(domain.OneTimeOrder order) async {
final businessId = dc.ClientSessionStore.instance.session?.business?.id;
if (businessId == null || businessId.isEmpty) {
await _firebaseAuth.signOut();
throw Exception('Business is missing. Please sign in again.');
}
final vendorId = order.vendorId;
if (vendorId == null || vendorId.isEmpty) {
throw Exception('Vendor is missing.');
}
final orderTimestamp = _toTimestamp(order.date);
final orderResult = await _dataConnect
.createOrder(businessId: businessId, orderType: dc.OrderType.ONE_TIME)
.vendorId(vendorId)
.location(order.location)
.status(dc.OrderStatus.POSTED)
.date(orderTimestamp)
.execute();
final orderId = orderResult.data?.order_insert.id;
if (orderId == null) {
throw Exception('Order creation failed.');
}
final workersNeeded = order.positions.fold<int>(
0,
(sum, position) => sum + position.count,
);
final shiftTitle = 'Shift 1 ${_formatDate(order.date)}';
final shiftCost = _calculateShiftCost(order);
final shiftResult = await _dataConnect
.createShift(title: shiftTitle, orderId: orderId)
.date(orderTimestamp)
.location(order.location)
.locationAddress(order.location)
.status(dc.ShiftStatus.PENDING)
.workersNeeded(workersNeeded)
.filled(0)
.durationDays(1)
.cost(shiftCost)
.execute();
final shiftId = shiftResult.data?.shift_insert.id;
if (shiftId == null) {
throw Exception('Shift creation failed.');
}
for (final position in order.positions) {
final start = _parseTime(order.date, position.startTime);
final end = _parseTime(order.date, position.endTime);
final normalizedEnd =
end.isBefore(start) ? end.add(const Duration(days: 1)) : end;
final hours = normalizedEnd.difference(start).inMinutes / 60.0;
final rate = order.roleRates[position.role] ?? 0;
final totalValue = rate * hours;
await _dataConnect
.createShiftRole(
shiftId: shiftId,
roleId: position.role,
count: position.count,
)
.startTime(_toTimestamp(start))
.endTime(_toTimestamp(normalizedEnd))
.hours(hours)
.totalValue(totalValue)
.execute();
}
await _dataConnect
.updateOrder(id: orderId)
.shifts(fdc.AnyValue(<String>[shiftId]))
.execute();
}
@override
Future<void> createRapidOrder(String description) {
// Delegates to Data Connect layer
return _orderMock.createRapidOrder(description);
Future<void> createRapidOrder(String description) async {
// TO-DO: connect IA and return array with the information.
throw UnimplementedError('Rapid order IA is not connected yet.');
}
double _calculateShiftCost(domain.OneTimeOrder order) {
double total = 0;
for (final position in order.positions) {
final start = _parseTime(order.date, position.startTime);
final end = _parseTime(order.date, position.endTime);
final normalizedEnd =
end.isBefore(start) ? end.add(const Duration(days: 1)) : end;
final hours = normalizedEnd.difference(start).inMinutes / 60.0;
final rate = order.roleRates[position.role] ?? 0;
total += rate * hours;
}
return total;
}
DateTime _parseTime(DateTime date, String time) {
if (time.trim().isEmpty) {
throw Exception('Shift time is missing.');
}
DateTime parsed;
try {
parsed = DateFormat.jm().parse(time);
} catch (_) {
parsed = DateFormat.Hm().parse(time);
}
return DateTime(
date.year,
date.month,
date.day,
parsed.hour,
parsed.minute,
);
}
fdc.Timestamp _toTimestamp(DateTime dateTime) {
final utc = dateTime.toUtc();
final seconds = utc.millisecondsSinceEpoch ~/ 1000;
final nanoseconds = (utc.microsecondsSinceEpoch % 1000000) * 1000;
return fdc.Timestamp(nanoseconds, seconds);
}
String _formatDate(DateTime dateTime) {
final year = dateTime.year.toString().padLeft(4, '0');
final month = dateTime.month.toString().padLeft(2, '0');
final day = dateTime.day.toString().padLeft(2, '0');
return '$year-$month-$day';
}
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
import 'package:krow_domain/krow_domain.dart';
import '../../domain/arguments/one_time_order_arguments.dart';
import '../../domain/usecases/create_one_time_order_usecase.dart';
@@ -7,7 +8,7 @@ import 'one_time_order_state.dart';
/// BLoC for managing the multi-step one-time order creation form.
class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
OneTimeOrderBloc(this._createOneTimeOrderUseCase)
OneTimeOrderBloc(this._createOneTimeOrderUseCase, this._dataConnect)
: super(OneTimeOrderState.initial()) {
on<OneTimeOrderVendorsLoaded>(_onVendorsLoaded);
on<OneTimeOrderVendorChanged>(_onVendorChanged);
@@ -18,52 +19,64 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
on<OneTimeOrderPositionUpdated>(_onPositionUpdated);
on<OneTimeOrderSubmitted>(_onSubmitted);
// Initial load of mock vendors
add(
const OneTimeOrderVendorsLoaded(<Vendor>[
Vendor(
id: 'v1',
name: 'Elite Staffing',
rates: <String, double>{
'Server': 25.0,
'Bartender': 30.0,
'Cook': 28.0,
'Busser': 18.0,
'Host': 20.0,
'Barista': 22.0,
'Dishwasher': 17.0,
'Event Staff': 19.0,
},
),
Vendor(
id: 'v2',
name: 'Premier Workforce',
rates: <String, double>{
'Server': 22.0,
'Bartender': 28.0,
'Cook': 25.0,
'Busser': 16.0,
'Host': 18.0,
'Barista': 20.0,
'Dishwasher': 15.0,
'Event Staff': 18.0,
},
),
]),
);
_loadVendors();
}
final CreateOneTimeOrderUseCase _createOneTimeOrderUseCase;
final dc.ExampleConnector _dataConnect;
Future<void> _loadVendors() async {
try {
final result = await _dataConnect.listVendors().execute();
final vendors = result.data.vendors
.map(
(vendor) => Vendor(
id: vendor.id,
name: vendor.companyName,
rates: const <String, double>{},
),
)
.toList();
add(OneTimeOrderVendorsLoaded(vendors));
} catch (_) {
add(const OneTimeOrderVendorsLoaded(<Vendor>[]));
}
}
Future<void> _loadRolesForVendor(String vendorId) async {
try {
final result = await _dataConnect.listRolesByVendorId(
vendorId: vendorId,
).execute();
final roles = result.data.roles
.map(
(role) => OneTimeOrderRoleOption(
id: role.id,
name: role.name,
costPerHour: role.costPerHour,
),
)
.toList();
emit(state.copyWith(roles: roles));
} catch (_) {
emit(state.copyWith(roles: const <OneTimeOrderRoleOption>[]));
}
}
void _onVendorsLoaded(
OneTimeOrderVendorsLoaded event,
Emitter<OneTimeOrderState> emit,
) {
final Vendor? selectedVendor =
event.vendors.isNotEmpty ? event.vendors.first : null;
emit(
state.copyWith(
vendors: event.vendors,
selectedVendor: event.vendors.isNotEmpty ? event.vendors.first : null,
selectedVendor: selectedVendor,
),
);
if (selectedVendor != null) {
_loadRolesForVendor(selectedVendor.id);
}
}
void _onVendorChanged(
@@ -71,6 +84,7 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
Emitter<OneTimeOrderState> emit,
) {
emit(state.copyWith(selectedVendor: event.vendor));
_loadRolesForVendor(event.vendor.id);
}
void _onDateChanged(
@@ -131,11 +145,15 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
) async {
emit(state.copyWith(status: OneTimeOrderStatus.loading));
try {
final Map<String, double> roleRates = <String, double>{
for (final role in state.roles) role.id: role.costPerHour,
};
final OneTimeOrder order = OneTimeOrder(
date: state.date,
location: state.location,
positions: state.positions,
// In a real app, we'd pass the vendorId here
vendorId: state.selectedVendor?.id,
roleRates: roleRates,
);
await _createOneTimeOrderUseCase(OneTimeOrderArguments(order: order));
emit(state.copyWith(status: OneTimeOrderStatus.success));

View File

@@ -12,6 +12,7 @@ class OneTimeOrderState extends Equatable {
this.errorMessage,
this.vendors = const <Vendor>[],
this.selectedVendor,
this.roles = const <OneTimeOrderRoleOption>[],
});
factory OneTimeOrderState.initial() {
@@ -22,6 +23,7 @@ class OneTimeOrderState extends Equatable {
OneTimeOrderPosition(role: '', count: 1, startTime: '', endTime: ''),
],
vendors: const <Vendor>[],
roles: const <OneTimeOrderRoleOption>[],
);
}
final DateTime date;
@@ -31,6 +33,7 @@ class OneTimeOrderState extends Equatable {
final String? errorMessage;
final List<Vendor> vendors;
final Vendor? selectedVendor;
final List<OneTimeOrderRoleOption> roles;
OneTimeOrderState copyWith({
DateTime? date,
@@ -40,6 +43,7 @@ class OneTimeOrderState extends Equatable {
String? errorMessage,
List<Vendor>? vendors,
Vendor? selectedVendor,
List<OneTimeOrderRoleOption>? roles,
}) {
return OneTimeOrderState(
date: date ?? this.date,
@@ -49,6 +53,7 @@ class OneTimeOrderState extends Equatable {
errorMessage: errorMessage ?? this.errorMessage,
vendors: vendors ?? this.vendors,
selectedVendor: selectedVendor ?? this.selectedVendor,
roles: roles ?? this.roles,
);
}
@@ -61,5 +66,21 @@ class OneTimeOrderState extends Equatable {
errorMessage,
vendors,
selectedVendor,
roles,
];
}
class OneTimeOrderRoleOption extends Equatable {
const OneTimeOrderRoleOption({
required this.id,
required this.name,
required this.costPerHour,
});
final String id;
final String name;
final double costPerHour;
@override
List<Object?> get props => <Object?>[id, name, costPerHour];
}

View File

@@ -64,14 +64,17 @@ class RapidOrderBloc extends Bloc<RapidOrderEvent, RapidOrderState> {
final RapidOrderState currentState = state;
if (currentState is RapidOrderInitial) {
final String message = currentState.message;
print('RapidOrder submit: message="$message"');
emit(const RapidOrderSubmitting());
try {
await _createRapidOrderUseCase(
RapidOrderArguments(description: message),
);
print('RapidOrder submit: success');
emit(const RapidOrderSuccess());
} catch (e) {
print('RapidOrder submit: error=$e');
emit(RapidOrderFailure(e.toString()));
}
}

View File

@@ -2,6 +2,7 @@ import 'package:core_localization/core_localization.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:krow_domain/krow_domain.dart';
import '../../blocs/one_time_order_state.dart';
/// A card widget for editing a specific position in a one-time order.
/// Matches the prototype layout while using design system tokens.
@@ -19,7 +20,7 @@ class OneTimeOrderPositionCard extends StatelessWidget {
required this.startLabel,
required this.endLabel,
required this.lunchLabel,
this.vendor,
required this.roles,
super.key,
});
@@ -56,8 +57,8 @@ class OneTimeOrderPositionCard extends StatelessWidget {
/// Label for the lunch break.
final String lunchLabel;
/// The current selected vendor to determine rates.
final Vendor? vendor;
/// Available roles for the selected vendor.
final List<OneTimeOrderRoleOption> roles;
@override
Widget build(BuildContext context) {
@@ -118,26 +119,7 @@ class OneTimeOrderPositionCard extends StatelessWidget {
onUpdated(position.copyWith(role: val));
}
},
items:
<String>{
...(vendor?.rates.keys ?? <String>[]),
if (position.role.isNotEmpty &&
!(vendor?.rates.keys.contains(position.role) ??
false))
position.role,
}.map((String role) {
final double? rate = vendor?.rates[role];
final String label = rate == null
? role
: '$role - \$${rate.toStringAsFixed(0)}/hr';
return DropdownMenuItem<String>(
value: role,
child: Text(
label,
style: UiTypography.body2r.textPrimary,
),
);
}).toList(),
items: _buildRoleItems(),
),
),
),
@@ -317,4 +299,33 @@ class OneTimeOrderPositionCard extends StatelessWidget {
],
);
}
List<DropdownMenuItem<String>> _buildRoleItems() {
final items = roles
.map(
(role) => DropdownMenuItem<String>(
value: role.id,
child: Text(
'${role.name} - \$${role.costPerHour.toStringAsFixed(0)}',
style: UiTypography.body2r.textPrimary,
),
),
)
.toList();
final hasSelected = roles.any((role) => role.id == position.role);
if (position.role.isNotEmpty && !hasSelected) {
items.add(
DropdownMenuItem<String>(
value: position.role,
child: Text(
position.role,
style: UiTypography.body2r.textPrimary,
),
),
);
}
return items;
}
}

View File

@@ -215,7 +215,7 @@ class _OneTimeOrderForm extends StatelessWidget {
startLabel: labels.start_label,
endLabel: labels.end_label,
lunchLabel: labels.lunch_break_label,
vendor: state.selectedVendor,
roles: state.roles,
onUpdated: (OneTimeOrderPosition updated) {
BlocProvider.of<OneTimeOrderBloc>(
context,

View File

@@ -288,9 +288,12 @@ class _RapidOrderActions extends StatelessWidget {
trailingIcon: UiIcons.arrowRight,
onPressed: isSubmitting || isMessageEmpty
? null
: () => BlocProvider.of<RapidOrderBloc>(
context,
).add(const RapidOrderSubmitted()),
: () {
print('RapidOrder send pressed');
BlocProvider.of<RapidOrderBloc>(
context,
).add(const RapidOrderSubmitted());
},
),
),
],