modifications for hub in create one time order

This commit is contained in:
José Salazar
2026-01-29 16:08:44 -05:00
parent 7e17903942
commit 191ba40393
19 changed files with 18298 additions and 17645 deletions

View File

@@ -1,9 +1,9 @@
# Basic Usage # Basic Usage
```dart ```dart
ExampleConnector.instance.getMyTasks(getMyTasksVariables).execute(); ExampleConnector.instance.CreateCertificate(createCertificateVariables).execute();
ExampleConnector.instance.getMemberTaskByIdKey(getMemberTaskByIdKeyVariables).execute(); ExampleConnector.instance.UpdateCertificate(updateCertificateVariables).execute();
ExampleConnector.instance.getMemberTasksByTaskId(getMemberTasksByTaskIdVariables).execute(); ExampleConnector.instance.DeleteCertificate(deleteCertificateVariables).execute();
ExampleConnector.instance.listOrders(listOrdersVariables).execute(); ExampleConnector.instance.listOrders(listOrdersVariables).execute();
ExampleConnector.instance.getOrderById(getOrderByIdVariables).execute(); ExampleConnector.instance.getOrderById(getOrderByIdVariables).execute();
ExampleConnector.instance.getOrdersByBusinessId(getOrdersByBusinessIdVariables).execute(); ExampleConnector.instance.getOrdersByBusinessId(getOrdersByBusinessIdVariables).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.updateLevel({ ... }) await ExampleConnector.instance.listTeamHubsByOwnerId({ ... })
.name(...) .offset(...)
.execute(); .execute();
``` ```

View File

@@ -12,6 +12,11 @@ class CreateShiftVariablesBuilder {
Optional<String> _locationAddress = Optional.optional(nativeFromJson, nativeToJson); Optional<String> _locationAddress = Optional.optional(nativeFromJson, nativeToJson);
Optional<double> _latitude = Optional.optional(nativeFromJson, nativeToJson); Optional<double> _latitude = Optional.optional(nativeFromJson, nativeToJson);
Optional<double> _longitude = Optional.optional(nativeFromJson, nativeToJson); Optional<double> _longitude = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _placeId = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _city = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _state = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _street = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _country = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _description = Optional.optional(nativeFromJson, nativeToJson); Optional<String> _description = Optional.optional(nativeFromJson, nativeToJson);
Optional<ShiftStatus> _status = Optional.optional((data) => ShiftStatus.values.byName(data), enumSerializer); Optional<ShiftStatus> _status = Optional.optional((data) => ShiftStatus.values.byName(data), enumSerializer);
Optional<int> _workersNeeded = Optional.optional(nativeFromJson, nativeToJson); Optional<int> _workersNeeded = Optional.optional(nativeFromJson, nativeToJson);
@@ -57,6 +62,26 @@ class CreateShiftVariablesBuilder {
_longitude.value = t; _longitude.value = t;
return this; return this;
} }
CreateShiftVariablesBuilder placeId(String? t) {
_placeId.value = t;
return this;
}
CreateShiftVariablesBuilder city(String? t) {
_city.value = t;
return this;
}
CreateShiftVariablesBuilder state(String? t) {
_state.value = t;
return this;
}
CreateShiftVariablesBuilder street(String? t) {
_street.value = t;
return this;
}
CreateShiftVariablesBuilder country(String? t) {
_country.value = t;
return this;
}
CreateShiftVariablesBuilder description(String? t) { CreateShiftVariablesBuilder description(String? t) {
_description.value = t; _description.value = t;
return this; return this;
@@ -98,7 +123,7 @@ class CreateShiftVariablesBuilder {
} }
MutationRef<CreateShiftData, CreateShiftVariables> ref() { MutationRef<CreateShiftData, CreateShiftVariables> ref() {
CreateShiftVariables vars= CreateShiftVariables(title: title,orderId: orderId,date: _date,startTime: _startTime,endTime: _endTime,hours: _hours,cost: _cost,location: _location,locationAddress: _locationAddress,latitude: _latitude,longitude: _longitude,description: _description,status: _status,workersNeeded: _workersNeeded,filled: _filled,filledAt: _filledAt,managers: _managers,durationDays: _durationDays,createdBy: _createdBy,); CreateShiftVariables vars= CreateShiftVariables(title: title,orderId: orderId,date: _date,startTime: _startTime,endTime: _endTime,hours: _hours,cost: _cost,location: _location,locationAddress: _locationAddress,latitude: _latitude,longitude: _longitude,placeId: _placeId,city: _city,state: _state,street: _street,country: _country,description: _description,status: _status,workersNeeded: _workersNeeded,filled: _filled,filledAt: _filledAt,managers: _managers,durationDays: _durationDays,createdBy: _createdBy,);
return _dataConnect.mutation("createShift", dataDeserializer, varsSerializer, vars); return _dataConnect.mutation("createShift", dataDeserializer, varsSerializer, vars);
} }
} }
@@ -184,6 +209,11 @@ class CreateShiftVariables {
late final Optional<String>locationAddress; late final Optional<String>locationAddress;
late final Optional<double>latitude; late final Optional<double>latitude;
late final Optional<double>longitude; late final Optional<double>longitude;
late final Optional<String>placeId;
late final Optional<String>city;
late final Optional<String>state;
late final Optional<String>street;
late final Optional<String>country;
late final Optional<String>description; late final Optional<String>description;
late final Optional<ShiftStatus>status; late final Optional<ShiftStatus>status;
late final Optional<int>workersNeeded; late final Optional<int>workersNeeded;
@@ -237,6 +267,26 @@ class CreateShiftVariables {
longitude.value = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']); longitude.value = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']);
placeId = Optional.optional(nativeFromJson, nativeToJson);
placeId.value = json['placeId'] == null ? null : nativeFromJson<String>(json['placeId']);
city = Optional.optional(nativeFromJson, nativeToJson);
city.value = json['city'] == null ? null : nativeFromJson<String>(json['city']);
state = Optional.optional(nativeFromJson, nativeToJson);
state.value = json['state'] == null ? null : nativeFromJson<String>(json['state']);
street = Optional.optional(nativeFromJson, nativeToJson);
street.value = json['street'] == null ? null : nativeFromJson<String>(json['street']);
country = Optional.optional(nativeFromJson, nativeToJson);
country.value = json['country'] == null ? null : nativeFromJson<String>(json['country']);
description = Optional.optional(nativeFromJson, nativeToJson); description = Optional.optional(nativeFromJson, nativeToJson);
description.value = json['description'] == null ? null : nativeFromJson<String>(json['description']); description.value = json['description'] == null ? null : nativeFromJson<String>(json['description']);
@@ -292,6 +342,11 @@ class CreateShiftVariables {
locationAddress == otherTyped.locationAddress && locationAddress == otherTyped.locationAddress &&
latitude == otherTyped.latitude && latitude == otherTyped.latitude &&
longitude == otherTyped.longitude && longitude == otherTyped.longitude &&
placeId == otherTyped.placeId &&
city == otherTyped.city &&
state == otherTyped.state &&
street == otherTyped.street &&
country == otherTyped.country &&
description == otherTyped.description && description == otherTyped.description &&
status == otherTyped.status && status == otherTyped.status &&
workersNeeded == otherTyped.workersNeeded && workersNeeded == otherTyped.workersNeeded &&
@@ -303,7 +358,7 @@ class CreateShiftVariables {
} }
@override @override
int get hashCode => Object.hashAll([title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdBy.hashCode]); int get hashCode => Object.hashAll([title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, placeId.hashCode, city.hashCode, state.hashCode, street.hashCode, country.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdBy.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -337,6 +392,21 @@ class CreateShiftVariables {
if(longitude.state == OptionalState.set) { if(longitude.state == OptionalState.set) {
json['longitude'] = longitude.toJson(); json['longitude'] = longitude.toJson();
} }
if(placeId.state == OptionalState.set) {
json['placeId'] = placeId.toJson();
}
if(city.state == OptionalState.set) {
json['city'] = city.toJson();
}
if(state.state == OptionalState.set) {
json['state'] = state.toJson();
}
if(street.state == OptionalState.set) {
json['street'] = street.toJson();
}
if(country.state == OptionalState.set) {
json['country'] = country.toJson();
}
if(description.state == OptionalState.set) { if(description.state == OptionalState.set) {
json['description'] = description.toJson(); json['description'] = description.toJson();
} }
@@ -376,6 +446,11 @@ class CreateShiftVariables {
required this.locationAddress, required this.locationAddress,
required this.latitude, required this.latitude,
required this.longitude, required this.longitude,
required this.placeId,
required this.city,
required this.state,
required this.street,
required this.country,
required this.description, required this.description,
required this.status, required this.status,
required this.workersNeeded, required this.workersNeeded,

View File

@@ -61,6 +61,11 @@ class FilterShiftsShifts {
final String? locationAddress; final String? locationAddress;
final double? latitude; final double? latitude;
final double? longitude; final double? longitude;
final String? placeId;
final String? city;
final String? state;
final String? street;
final String? country;
final String? description; final String? description;
final EnumValue<ShiftStatus>? status; final EnumValue<ShiftStatus>? status;
final int? workersNeeded; final int? workersNeeded;
@@ -86,6 +91,11 @@ class FilterShiftsShifts {
locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']), locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']),
latitude = json['latitude'] == null ? null : nativeFromJson<double>(json['latitude']), latitude = json['latitude'] == null ? null : nativeFromJson<double>(json['latitude']),
longitude = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']), longitude = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']),
placeId = json['placeId'] == null ? null : nativeFromJson<String>(json['placeId']),
city = json['city'] == null ? null : nativeFromJson<String>(json['city']),
state = json['state'] == null ? null : nativeFromJson<String>(json['state']),
street = json['street'] == null ? null : nativeFromJson<String>(json['street']),
country = json['country'] == null ? null : nativeFromJson<String>(json['country']),
description = json['description'] == null ? null : nativeFromJson<String>(json['description']), description = json['description'] == null ? null : nativeFromJson<String>(json['description']),
status = json['status'] == null ? null : shiftStatusDeserializer(json['status']), status = json['status'] == null ? null : shiftStatusDeserializer(json['status']),
workersNeeded = json['workersNeeded'] == null ? null : nativeFromJson<int>(json['workersNeeded']), workersNeeded = json['workersNeeded'] == null ? null : nativeFromJson<int>(json['workersNeeded']),
@@ -121,6 +131,11 @@ class FilterShiftsShifts {
locationAddress == otherTyped.locationAddress && locationAddress == otherTyped.locationAddress &&
latitude == otherTyped.latitude && latitude == otherTyped.latitude &&
longitude == otherTyped.longitude && longitude == otherTyped.longitude &&
placeId == otherTyped.placeId &&
city == otherTyped.city &&
state == otherTyped.state &&
street == otherTyped.street &&
country == otherTyped.country &&
description == otherTyped.description && description == otherTyped.description &&
status == otherTyped.status && status == otherTyped.status &&
workersNeeded == otherTyped.workersNeeded && workersNeeded == otherTyped.workersNeeded &&
@@ -135,7 +150,7 @@ class FilterShiftsShifts {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, order.hashCode]); int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, placeId.hashCode, city.hashCode, state.hashCode, street.hashCode, country.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, order.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -170,6 +185,21 @@ class FilterShiftsShifts {
if (longitude != null) { if (longitude != null) {
json['longitude'] = nativeToJson<double?>(longitude); json['longitude'] = nativeToJson<double?>(longitude);
} }
if (placeId != null) {
json['placeId'] = nativeToJson<String?>(placeId);
}
if (city != null) {
json['city'] = nativeToJson<String?>(city);
}
if (state != null) {
json['state'] = nativeToJson<String?>(state);
}
if (street != null) {
json['street'] = nativeToJson<String?>(street);
}
if (country != null) {
json['country'] = nativeToJson<String?>(country);
}
if (description != null) { if (description != null) {
json['description'] = nativeToJson<String?>(description); json['description'] = nativeToJson<String?>(description);
} }
@@ -219,6 +249,11 @@ class FilterShiftsShifts {
this.locationAddress, this.locationAddress,
this.latitude, this.latitude,
this.longitude, this.longitude,
this.placeId,
this.city,
this.state,
this.street,
this.country,
this.description, this.description,
this.status, this.status,
this.workersNeeded, this.workersNeeded,

View File

@@ -31,6 +31,11 @@ class GetShiftByIdShift {
final String? locationAddress; final String? locationAddress;
final double? latitude; final double? latitude;
final double? longitude; final double? longitude;
final String? placeId;
final String? city;
final String? state;
final String? street;
final String? country;
final String? description; final String? description;
final EnumValue<ShiftStatus>? status; final EnumValue<ShiftStatus>? status;
final int? workersNeeded; final int? workersNeeded;
@@ -56,6 +61,11 @@ class GetShiftByIdShift {
locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']), locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']),
latitude = json['latitude'] == null ? null : nativeFromJson<double>(json['latitude']), latitude = json['latitude'] == null ? null : nativeFromJson<double>(json['latitude']),
longitude = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']), longitude = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']),
placeId = json['placeId'] == null ? null : nativeFromJson<String>(json['placeId']),
city = json['city'] == null ? null : nativeFromJson<String>(json['city']),
state = json['state'] == null ? null : nativeFromJson<String>(json['state']),
street = json['street'] == null ? null : nativeFromJson<String>(json['street']),
country = json['country'] == null ? null : nativeFromJson<String>(json['country']),
description = json['description'] == null ? null : nativeFromJson<String>(json['description']), description = json['description'] == null ? null : nativeFromJson<String>(json['description']),
status = json['status'] == null ? null : shiftStatusDeserializer(json['status']), status = json['status'] == null ? null : shiftStatusDeserializer(json['status']),
workersNeeded = json['workersNeeded'] == null ? null : nativeFromJson<int>(json['workersNeeded']), workersNeeded = json['workersNeeded'] == null ? null : nativeFromJson<int>(json['workersNeeded']),
@@ -91,6 +101,11 @@ class GetShiftByIdShift {
locationAddress == otherTyped.locationAddress && locationAddress == otherTyped.locationAddress &&
latitude == otherTyped.latitude && latitude == otherTyped.latitude &&
longitude == otherTyped.longitude && longitude == otherTyped.longitude &&
placeId == otherTyped.placeId &&
city == otherTyped.city &&
state == otherTyped.state &&
street == otherTyped.street &&
country == otherTyped.country &&
description == otherTyped.description && description == otherTyped.description &&
status == otherTyped.status && status == otherTyped.status &&
workersNeeded == otherTyped.workersNeeded && workersNeeded == otherTyped.workersNeeded &&
@@ -105,7 +120,7 @@ class GetShiftByIdShift {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, order.hashCode]); int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, placeId.hashCode, city.hashCode, state.hashCode, street.hashCode, country.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, order.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -140,6 +155,21 @@ class GetShiftByIdShift {
if (longitude != null) { if (longitude != null) {
json['longitude'] = nativeToJson<double?>(longitude); json['longitude'] = nativeToJson<double?>(longitude);
} }
if (placeId != null) {
json['placeId'] = nativeToJson<String?>(placeId);
}
if (city != null) {
json['city'] = nativeToJson<String?>(city);
}
if (state != null) {
json['state'] = nativeToJson<String?>(state);
}
if (street != null) {
json['street'] = nativeToJson<String?>(street);
}
if (country != null) {
json['country'] = nativeToJson<String?>(country);
}
if (description != null) { if (description != null) {
json['description'] = nativeToJson<String?>(description); json['description'] = nativeToJson<String?>(description);
} }
@@ -189,6 +219,11 @@ class GetShiftByIdShift {
this.locationAddress, this.locationAddress,
this.latitude, this.latitude,
this.longitude, this.longitude,
this.placeId,
this.city,
this.state,
this.street,
this.country,
this.description, this.description,
this.status, this.status,
this.workersNeeded, this.workersNeeded,

View File

@@ -51,6 +51,11 @@ class GetShiftsByBusinessIdShifts {
final String? locationAddress; final String? locationAddress;
final double? latitude; final double? latitude;
final double? longitude; final double? longitude;
final String? placeId;
final String? city;
final String? state;
final String? street;
final String? country;
final String? description; final String? description;
final EnumValue<ShiftStatus>? status; final EnumValue<ShiftStatus>? status;
final int? workersNeeded; final int? workersNeeded;
@@ -76,6 +81,11 @@ class GetShiftsByBusinessIdShifts {
locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']), locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']),
latitude = json['latitude'] == null ? null : nativeFromJson<double>(json['latitude']), latitude = json['latitude'] == null ? null : nativeFromJson<double>(json['latitude']),
longitude = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']), longitude = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']),
placeId = json['placeId'] == null ? null : nativeFromJson<String>(json['placeId']),
city = json['city'] == null ? null : nativeFromJson<String>(json['city']),
state = json['state'] == null ? null : nativeFromJson<String>(json['state']),
street = json['street'] == null ? null : nativeFromJson<String>(json['street']),
country = json['country'] == null ? null : nativeFromJson<String>(json['country']),
description = json['description'] == null ? null : nativeFromJson<String>(json['description']), description = json['description'] == null ? null : nativeFromJson<String>(json['description']),
status = json['status'] == null ? null : shiftStatusDeserializer(json['status']), status = json['status'] == null ? null : shiftStatusDeserializer(json['status']),
workersNeeded = json['workersNeeded'] == null ? null : nativeFromJson<int>(json['workersNeeded']), workersNeeded = json['workersNeeded'] == null ? null : nativeFromJson<int>(json['workersNeeded']),
@@ -111,6 +121,11 @@ class GetShiftsByBusinessIdShifts {
locationAddress == otherTyped.locationAddress && locationAddress == otherTyped.locationAddress &&
latitude == otherTyped.latitude && latitude == otherTyped.latitude &&
longitude == otherTyped.longitude && longitude == otherTyped.longitude &&
placeId == otherTyped.placeId &&
city == otherTyped.city &&
state == otherTyped.state &&
street == otherTyped.street &&
country == otherTyped.country &&
description == otherTyped.description && description == otherTyped.description &&
status == otherTyped.status && status == otherTyped.status &&
workersNeeded == otherTyped.workersNeeded && workersNeeded == otherTyped.workersNeeded &&
@@ -125,7 +140,7 @@ class GetShiftsByBusinessIdShifts {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, order.hashCode]); int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, placeId.hashCode, city.hashCode, state.hashCode, street.hashCode, country.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, order.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -160,6 +175,21 @@ class GetShiftsByBusinessIdShifts {
if (longitude != null) { if (longitude != null) {
json['longitude'] = nativeToJson<double?>(longitude); json['longitude'] = nativeToJson<double?>(longitude);
} }
if (placeId != null) {
json['placeId'] = nativeToJson<String?>(placeId);
}
if (city != null) {
json['city'] = nativeToJson<String?>(city);
}
if (state != null) {
json['state'] = nativeToJson<String?>(state);
}
if (street != null) {
json['street'] = nativeToJson<String?>(street);
}
if (country != null) {
json['country'] = nativeToJson<String?>(country);
}
if (description != null) { if (description != null) {
json['description'] = nativeToJson<String?>(description); json['description'] = nativeToJson<String?>(description);
} }
@@ -209,6 +239,11 @@ class GetShiftsByBusinessIdShifts {
this.locationAddress, this.locationAddress,
this.latitude, this.latitude,
this.longitude, this.longitude,
this.placeId,
this.city,
this.state,
this.street,
this.country,
this.description, this.description,
this.status, this.status,
this.workersNeeded, this.workersNeeded,

View File

@@ -51,6 +51,11 @@ class GetShiftsByVendorIdShifts {
final String? locationAddress; final String? locationAddress;
final double? latitude; final double? latitude;
final double? longitude; final double? longitude;
final String? placeId;
final String? city;
final String? state;
final String? street;
final String? country;
final String? description; final String? description;
final EnumValue<ShiftStatus>? status; final EnumValue<ShiftStatus>? status;
final int? workersNeeded; final int? workersNeeded;
@@ -76,6 +81,11 @@ class GetShiftsByVendorIdShifts {
locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']), locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']),
latitude = json['latitude'] == null ? null : nativeFromJson<double>(json['latitude']), latitude = json['latitude'] == null ? null : nativeFromJson<double>(json['latitude']),
longitude = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']), longitude = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']),
placeId = json['placeId'] == null ? null : nativeFromJson<String>(json['placeId']),
city = json['city'] == null ? null : nativeFromJson<String>(json['city']),
state = json['state'] == null ? null : nativeFromJson<String>(json['state']),
street = json['street'] == null ? null : nativeFromJson<String>(json['street']),
country = json['country'] == null ? null : nativeFromJson<String>(json['country']),
description = json['description'] == null ? null : nativeFromJson<String>(json['description']), description = json['description'] == null ? null : nativeFromJson<String>(json['description']),
status = json['status'] == null ? null : shiftStatusDeserializer(json['status']), status = json['status'] == null ? null : shiftStatusDeserializer(json['status']),
workersNeeded = json['workersNeeded'] == null ? null : nativeFromJson<int>(json['workersNeeded']), workersNeeded = json['workersNeeded'] == null ? null : nativeFromJson<int>(json['workersNeeded']),
@@ -111,6 +121,11 @@ class GetShiftsByVendorIdShifts {
locationAddress == otherTyped.locationAddress && locationAddress == otherTyped.locationAddress &&
latitude == otherTyped.latitude && latitude == otherTyped.latitude &&
longitude == otherTyped.longitude && longitude == otherTyped.longitude &&
placeId == otherTyped.placeId &&
city == otherTyped.city &&
state == otherTyped.state &&
street == otherTyped.street &&
country == otherTyped.country &&
description == otherTyped.description && description == otherTyped.description &&
status == otherTyped.status && status == otherTyped.status &&
workersNeeded == otherTyped.workersNeeded && workersNeeded == otherTyped.workersNeeded &&
@@ -125,7 +140,7 @@ class GetShiftsByVendorIdShifts {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, order.hashCode]); int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, placeId.hashCode, city.hashCode, state.hashCode, street.hashCode, country.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, order.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -160,6 +175,21 @@ class GetShiftsByVendorIdShifts {
if (longitude != null) { if (longitude != null) {
json['longitude'] = nativeToJson<double?>(longitude); json['longitude'] = nativeToJson<double?>(longitude);
} }
if (placeId != null) {
json['placeId'] = nativeToJson<String?>(placeId);
}
if (city != null) {
json['city'] = nativeToJson<String?>(city);
}
if (state != null) {
json['state'] = nativeToJson<String?>(state);
}
if (street != null) {
json['street'] = nativeToJson<String?>(street);
}
if (country != null) {
json['country'] = nativeToJson<String?>(country);
}
if (description != null) { if (description != null) {
json['description'] = nativeToJson<String?>(description); json['description'] = nativeToJson<String?>(description);
} }
@@ -209,6 +239,11 @@ class GetShiftsByVendorIdShifts {
this.locationAddress, this.locationAddress,
this.latitude, this.latitude,
this.longitude, this.longitude,
this.placeId,
this.city,
this.state,
this.street,
this.country,
this.description, this.description,
this.status, this.status,
this.workersNeeded, this.workersNeeded,

View File

@@ -41,6 +41,11 @@ class ListShiftsShifts {
final String? locationAddress; final String? locationAddress;
final double? latitude; final double? latitude;
final double? longitude; final double? longitude;
final String? placeId;
final String? city;
final String? state;
final String? street;
final String? country;
final String? description; final String? description;
final EnumValue<ShiftStatus>? status; final EnumValue<ShiftStatus>? status;
final int? workersNeeded; final int? workersNeeded;
@@ -66,6 +71,11 @@ class ListShiftsShifts {
locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']), locationAddress = json['locationAddress'] == null ? null : nativeFromJson<String>(json['locationAddress']),
latitude = json['latitude'] == null ? null : nativeFromJson<double>(json['latitude']), latitude = json['latitude'] == null ? null : nativeFromJson<double>(json['latitude']),
longitude = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']), longitude = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']),
placeId = json['placeId'] == null ? null : nativeFromJson<String>(json['placeId']),
city = json['city'] == null ? null : nativeFromJson<String>(json['city']),
state = json['state'] == null ? null : nativeFromJson<String>(json['state']),
street = json['street'] == null ? null : nativeFromJson<String>(json['street']),
country = json['country'] == null ? null : nativeFromJson<String>(json['country']),
description = json['description'] == null ? null : nativeFromJson<String>(json['description']), description = json['description'] == null ? null : nativeFromJson<String>(json['description']),
status = json['status'] == null ? null : shiftStatusDeserializer(json['status']), status = json['status'] == null ? null : shiftStatusDeserializer(json['status']),
workersNeeded = json['workersNeeded'] == null ? null : nativeFromJson<int>(json['workersNeeded']), workersNeeded = json['workersNeeded'] == null ? null : nativeFromJson<int>(json['workersNeeded']),
@@ -101,6 +111,11 @@ class ListShiftsShifts {
locationAddress == otherTyped.locationAddress && locationAddress == otherTyped.locationAddress &&
latitude == otherTyped.latitude && latitude == otherTyped.latitude &&
longitude == otherTyped.longitude && longitude == otherTyped.longitude &&
placeId == otherTyped.placeId &&
city == otherTyped.city &&
state == otherTyped.state &&
street == otherTyped.street &&
country == otherTyped.country &&
description == otherTyped.description && description == otherTyped.description &&
status == otherTyped.status && status == otherTyped.status &&
workersNeeded == otherTyped.workersNeeded && workersNeeded == otherTyped.workersNeeded &&
@@ -115,7 +130,7 @@ class ListShiftsShifts {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, order.hashCode]); int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, placeId.hashCode, city.hashCode, state.hashCode, street.hashCode, country.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode, createdAt.hashCode, updatedAt.hashCode, createdBy.hashCode, order.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -150,6 +165,21 @@ class ListShiftsShifts {
if (longitude != null) { if (longitude != null) {
json['longitude'] = nativeToJson<double?>(longitude); json['longitude'] = nativeToJson<double?>(longitude);
} }
if (placeId != null) {
json['placeId'] = nativeToJson<String?>(placeId);
}
if (city != null) {
json['city'] = nativeToJson<String?>(city);
}
if (state != null) {
json['state'] = nativeToJson<String?>(state);
}
if (street != null) {
json['street'] = nativeToJson<String?>(street);
}
if (country != null) {
json['country'] = nativeToJson<String?>(country);
}
if (description != null) { if (description != null) {
json['description'] = nativeToJson<String?>(description); json['description'] = nativeToJson<String?>(description);
} }
@@ -199,6 +229,11 @@ class ListShiftsShifts {
this.locationAddress, this.locationAddress,
this.latitude, this.latitude,
this.longitude, this.longitude,
this.placeId,
this.city,
this.state,
this.street,
this.country,
this.description, this.description,
this.status, this.status,
this.workersNeeded, this.workersNeeded,

View File

@@ -13,6 +13,11 @@ class UpdateShiftVariablesBuilder {
Optional<String> _locationAddress = Optional.optional(nativeFromJson, nativeToJson); Optional<String> _locationAddress = Optional.optional(nativeFromJson, nativeToJson);
Optional<double> _latitude = Optional.optional(nativeFromJson, nativeToJson); Optional<double> _latitude = Optional.optional(nativeFromJson, nativeToJson);
Optional<double> _longitude = Optional.optional(nativeFromJson, nativeToJson); Optional<double> _longitude = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _placeId = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _city = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _state = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _street = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _country = Optional.optional(nativeFromJson, nativeToJson);
Optional<String> _description = Optional.optional(nativeFromJson, nativeToJson); Optional<String> _description = Optional.optional(nativeFromJson, nativeToJson);
Optional<ShiftStatus> _status = Optional.optional((data) => ShiftStatus.values.byName(data), enumSerializer); Optional<ShiftStatus> _status = Optional.optional((data) => ShiftStatus.values.byName(data), enumSerializer);
Optional<int> _workersNeeded = Optional.optional(nativeFromJson, nativeToJson); Optional<int> _workersNeeded = Optional.optional(nativeFromJson, nativeToJson);
@@ -65,6 +70,26 @@ class UpdateShiftVariablesBuilder {
_longitude.value = t; _longitude.value = t;
return this; return this;
} }
UpdateShiftVariablesBuilder placeId(String? t) {
_placeId.value = t;
return this;
}
UpdateShiftVariablesBuilder city(String? t) {
_city.value = t;
return this;
}
UpdateShiftVariablesBuilder state(String? t) {
_state.value = t;
return this;
}
UpdateShiftVariablesBuilder street(String? t) {
_street.value = t;
return this;
}
UpdateShiftVariablesBuilder country(String? t) {
_country.value = t;
return this;
}
UpdateShiftVariablesBuilder description(String? t) { UpdateShiftVariablesBuilder description(String? t) {
_description.value = t; _description.value = t;
return this; return this;
@@ -102,7 +127,7 @@ class UpdateShiftVariablesBuilder {
} }
MutationRef<UpdateShiftData, UpdateShiftVariables> ref() { MutationRef<UpdateShiftData, UpdateShiftVariables> ref() {
UpdateShiftVariables vars= UpdateShiftVariables(id: id,title: _title,orderId: _orderId,date: _date,startTime: _startTime,endTime: _endTime,hours: _hours,cost: _cost,location: _location,locationAddress: _locationAddress,latitude: _latitude,longitude: _longitude,description: _description,status: _status,workersNeeded: _workersNeeded,filled: _filled,filledAt: _filledAt,managers: _managers,durationDays: _durationDays,); UpdateShiftVariables vars= UpdateShiftVariables(id: id,title: _title,orderId: _orderId,date: _date,startTime: _startTime,endTime: _endTime,hours: _hours,cost: _cost,location: _location,locationAddress: _locationAddress,latitude: _latitude,longitude: _longitude,placeId: _placeId,city: _city,state: _state,street: _street,country: _country,description: _description,status: _status,workersNeeded: _workersNeeded,filled: _filled,filledAt: _filledAt,managers: _managers,durationDays: _durationDays,);
return _dataConnect.mutation("updateShift", dataDeserializer, varsSerializer, vars); return _dataConnect.mutation("updateShift", dataDeserializer, varsSerializer, vars);
} }
} }
@@ -191,6 +216,11 @@ class UpdateShiftVariables {
late final Optional<String>locationAddress; late final Optional<String>locationAddress;
late final Optional<double>latitude; late final Optional<double>latitude;
late final Optional<double>longitude; late final Optional<double>longitude;
late final Optional<String>placeId;
late final Optional<String>city;
late final Optional<String>state;
late final Optional<String>street;
late final Optional<String>country;
late final Optional<String>description; late final Optional<String>description;
late final Optional<ShiftStatus>status; late final Optional<ShiftStatus>status;
late final Optional<int>workersNeeded; late final Optional<int>workersNeeded;
@@ -249,6 +279,26 @@ class UpdateShiftVariables {
longitude.value = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']); longitude.value = json['longitude'] == null ? null : nativeFromJson<double>(json['longitude']);
placeId = Optional.optional(nativeFromJson, nativeToJson);
placeId.value = json['placeId'] == null ? null : nativeFromJson<String>(json['placeId']);
city = Optional.optional(nativeFromJson, nativeToJson);
city.value = json['city'] == null ? null : nativeFromJson<String>(json['city']);
state = Optional.optional(nativeFromJson, nativeToJson);
state.value = json['state'] == null ? null : nativeFromJson<String>(json['state']);
street = Optional.optional(nativeFromJson, nativeToJson);
street.value = json['street'] == null ? null : nativeFromJson<String>(json['street']);
country = Optional.optional(nativeFromJson, nativeToJson);
country.value = json['country'] == null ? null : nativeFromJson<String>(json['country']);
description = Optional.optional(nativeFromJson, nativeToJson); description = Optional.optional(nativeFromJson, nativeToJson);
description.value = json['description'] == null ? null : nativeFromJson<String>(json['description']); description.value = json['description'] == null ? null : nativeFromJson<String>(json['description']);
@@ -301,6 +351,11 @@ class UpdateShiftVariables {
locationAddress == otherTyped.locationAddress && locationAddress == otherTyped.locationAddress &&
latitude == otherTyped.latitude && latitude == otherTyped.latitude &&
longitude == otherTyped.longitude && longitude == otherTyped.longitude &&
placeId == otherTyped.placeId &&
city == otherTyped.city &&
state == otherTyped.state &&
street == otherTyped.street &&
country == otherTyped.country &&
description == otherTyped.description && description == otherTyped.description &&
status == otherTyped.status && status == otherTyped.status &&
workersNeeded == otherTyped.workersNeeded && workersNeeded == otherTyped.workersNeeded &&
@@ -311,7 +366,7 @@ class UpdateShiftVariables {
} }
@override @override
int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode]); int get hashCode => Object.hashAll([id.hashCode, title.hashCode, orderId.hashCode, date.hashCode, startTime.hashCode, endTime.hashCode, hours.hashCode, cost.hashCode, location.hashCode, locationAddress.hashCode, latitude.hashCode, longitude.hashCode, placeId.hashCode, city.hashCode, state.hashCode, street.hashCode, country.hashCode, description.hashCode, status.hashCode, workersNeeded.hashCode, filled.hashCode, filledAt.hashCode, managers.hashCode, durationDays.hashCode]);
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -350,6 +405,21 @@ class UpdateShiftVariables {
if(longitude.state == OptionalState.set) { if(longitude.state == OptionalState.set) {
json['longitude'] = longitude.toJson(); json['longitude'] = longitude.toJson();
} }
if(placeId.state == OptionalState.set) {
json['placeId'] = placeId.toJson();
}
if(city.state == OptionalState.set) {
json['city'] = city.toJson();
}
if(state.state == OptionalState.set) {
json['state'] = state.toJson();
}
if(street.state == OptionalState.set) {
json['street'] = street.toJson();
}
if(country.state == OptionalState.set) {
json['country'] = country.toJson();
}
if(description.state == OptionalState.set) { if(description.state == OptionalState.set) {
json['description'] = description.toJson(); json['description'] = description.toJson();
} }
@@ -387,6 +457,11 @@ class UpdateShiftVariables {
required this.locationAddress, required this.locationAddress,
required this.latitude, required this.latitude,
required this.longitude, required this.longitude,
required this.placeId,
required this.city,
required this.state,
required this.street,
required this.country,
required this.description, required this.description,
required this.status, required this.status,
required this.workersNeeded, required this.workersNeeded,

View File

@@ -10,6 +10,7 @@ class OneTimeOrder extends Equatable {
required this.date, required this.date,
required this.location, required this.location,
required this.positions, required this.positions,
this.hub,
this.vendorId, this.vendorId,
this.roleRates = const <String, double>{}, this.roleRates = const <String, double>{},
}); });
@@ -22,6 +23,9 @@ class OneTimeOrder extends Equatable {
/// The list of positions and headcounts required for this order. /// The list of positions and headcounts required for this order.
final List<OneTimeOrderPosition> positions; final List<OneTimeOrderPosition> positions;
/// Selected hub details for this order.
final OneTimeOrderHubDetails? hub;
/// Selected vendor id for this order. /// Selected vendor id for this order.
final String? vendorId; final String? vendorId;
@@ -33,7 +37,52 @@ class OneTimeOrder extends Equatable {
date, date,
location, location,
positions, positions,
hub,
vendorId, vendorId,
roleRates, roleRates,
]; ];
} }
/// Minimal hub details used during order creation.
class OneTimeOrderHubDetails extends Equatable {
const OneTimeOrderHubDetails({
required this.id,
required this.name,
required this.address,
this.placeId,
this.latitude,
this.longitude,
this.city,
this.state,
this.street,
this.country,
this.zipCode,
});
final String id;
final String name;
final String address;
final String? placeId;
final double? latitude;
final double? longitude;
final String? city;
final String? state;
final String? street;
final String? country;
final String? zipCode;
@override
List<Object?> get props => <Object?>[
id,
name,
address,
placeId,
latitude,
longitude,
city,
state,
street,
country,
zipCode,
];
}

View File

@@ -61,6 +61,10 @@ class ClientCreateOrderRepositoryImpl
if (vendorId == null || vendorId.isEmpty) { if (vendorId == null || vendorId.isEmpty) {
throw Exception('Vendor is missing.'); throw Exception('Vendor is missing.');
} }
final domain.OneTimeOrderHubDetails? hub = order.hub;
if (hub == null || hub.id.isEmpty) {
throw Exception('Hub is missing.');
}
final DateTime orderDateOnly = DateTime( final DateTime orderDateOnly = DateTime(
order.date.year, order.date.year,
@@ -69,9 +73,12 @@ class ClientCreateOrderRepositoryImpl
); );
final fdc.Timestamp orderTimestamp = _toTimestamp(orderDateOnly); final fdc.Timestamp orderTimestamp = _toTimestamp(orderDateOnly);
final fdc.OperationResult<dc.CreateOrderData, dc.CreateOrderVariables> orderResult = await _dataConnect final fdc.OperationResult<dc.CreateOrderData, dc.CreateOrderVariables> orderResult = await _dataConnect
.createOrder(businessId: businessId, orderType: dc.OrderType.ONE_TIME) .createOrder(
businessId: businessId,
orderType: dc.OrderType.ONE_TIME,
teamHubId: hub.id,
)
.vendorId(vendorId) .vendorId(vendorId)
.location(order.location)
.status(dc.OrderStatus.POSTED) .status(dc.OrderStatus.POSTED)
.date(orderTimestamp) .date(orderTimestamp)
.execute(); .execute();
@@ -91,8 +98,15 @@ class ClientCreateOrderRepositoryImpl
final fdc.OperationResult<dc.CreateShiftData, dc.CreateShiftVariables> shiftResult = await _dataConnect final fdc.OperationResult<dc.CreateShiftData, dc.CreateShiftVariables> shiftResult = await _dataConnect
.createShift(title: shiftTitle, orderId: orderId) .createShift(title: shiftTitle, orderId: orderId)
.date(orderTimestamp) .date(orderTimestamp)
.location(order.location) .location(hub.name)
.locationAddress(order.location) .locationAddress(hub.address)
.latitude(hub.latitude)
.longitude(hub.longitude)
.placeId(hub.placeId)
.city(hub.city)
.state(hub.state)
.street(hub.street)
.country(hub.country)
.status(dc.ShiftStatus.PENDING) .status(dc.ShiftStatus.PENDING)
.workersNeeded(workersNeeded) .workersNeeded(workersNeeded)
.filled(0) .filled(0)

View File

@@ -13,14 +13,16 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
: super(OneTimeOrderState.initial()) { : super(OneTimeOrderState.initial()) {
on<OneTimeOrderVendorsLoaded>(_onVendorsLoaded); on<OneTimeOrderVendorsLoaded>(_onVendorsLoaded);
on<OneTimeOrderVendorChanged>(_onVendorChanged); on<OneTimeOrderVendorChanged>(_onVendorChanged);
on<OneTimeOrderHubsLoaded>(_onHubsLoaded);
on<OneTimeOrderHubChanged>(_onHubChanged);
on<OneTimeOrderDateChanged>(_onDateChanged); on<OneTimeOrderDateChanged>(_onDateChanged);
on<OneTimeOrderLocationChanged>(_onLocationChanged);
on<OneTimeOrderPositionAdded>(_onPositionAdded); on<OneTimeOrderPositionAdded>(_onPositionAdded);
on<OneTimeOrderPositionRemoved>(_onPositionRemoved); on<OneTimeOrderPositionRemoved>(_onPositionRemoved);
on<OneTimeOrderPositionUpdated>(_onPositionUpdated); on<OneTimeOrderPositionUpdated>(_onPositionUpdated);
on<OneTimeOrderSubmitted>(_onSubmitted); on<OneTimeOrderSubmitted>(_onSubmitted);
_loadVendors(); _loadVendors();
_loadHubs();
} }
final CreateOneTimeOrderUseCase _createOneTimeOrderUseCase; final CreateOneTimeOrderUseCase _createOneTimeOrderUseCase;
final dc.ExampleConnector _dataConnect; final dc.ExampleConnector _dataConnect;
@@ -63,6 +65,38 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
} }
} }
Future<void> _loadHubs() async {
try {
final String? businessId = dc.ClientSessionStore.instance.session?.business?.id;
if (businessId == null || businessId.isEmpty) {
add(const OneTimeOrderHubsLoaded(<OneTimeOrderHubOption>[]));
return;
}
final QueryResult<dc.ListTeamHubsByOwnerIdData, dc.ListTeamHubsByOwnerIdVariables>
result = await _dataConnect.listTeamHubsByOwnerId(ownerId: businessId).execute();
final List<OneTimeOrderHubOption> hubs = result.data.teamHubs
.map(
(dc.ListTeamHubsByOwnerIdTeamHubs hub) => OneTimeOrderHubOption(
id: hub.id,
name: hub.hubName,
address: hub.address,
placeId: hub.placeId,
latitude: hub.latitude,
longitude: hub.longitude,
city: hub.city,
state: hub.state,
street: hub.street,
country: hub.country,
zipCode: hub.zipCode,
),
)
.toList();
add(OneTimeOrderHubsLoaded(hubs));
} catch (_) {
add(const OneTimeOrderHubsLoaded(<OneTimeOrderHubOption>[]));
}
}
void _onVendorsLoaded( void _onVendorsLoaded(
OneTimeOrderVendorsLoaded event, OneTimeOrderVendorsLoaded event,
Emitter<OneTimeOrderState> emit, Emitter<OneTimeOrderState> emit,
@@ -88,6 +122,33 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
_loadRolesForVendor(event.vendor.id); _loadRolesForVendor(event.vendor.id);
} }
void _onHubsLoaded(
OneTimeOrderHubsLoaded event,
Emitter<OneTimeOrderState> emit,
) {
final OneTimeOrderHubOption? selectedHub =
event.hubs.isNotEmpty ? event.hubs.first : null;
emit(
state.copyWith(
hubs: event.hubs,
selectedHub: selectedHub,
location: selectedHub?.name ?? '',
),
);
}
void _onHubChanged(
OneTimeOrderHubChanged event,
Emitter<OneTimeOrderState> emit,
) {
emit(
state.copyWith(
selectedHub: event.hub,
location: event.hub.name,
),
);
}
void _onDateChanged( void _onDateChanged(
OneTimeOrderDateChanged event, OneTimeOrderDateChanged event,
Emitter<OneTimeOrderState> emit, Emitter<OneTimeOrderState> emit,
@@ -95,13 +156,6 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
emit(state.copyWith(date: event.date)); emit(state.copyWith(date: event.date));
} }
void _onLocationChanged(
OneTimeOrderLocationChanged event,
Emitter<OneTimeOrderState> emit,
) {
emit(state.copyWith(location: event.location));
}
void _onPositionAdded( void _onPositionAdded(
OneTimeOrderPositionAdded event, OneTimeOrderPositionAdded event,
Emitter<OneTimeOrderState> emit, Emitter<OneTimeOrderState> emit,
@@ -149,10 +203,27 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
final Map<String, double> roleRates = <String, double>{ final Map<String, double> roleRates = <String, double>{
for (final OneTimeOrderRoleOption role in state.roles) role.id: role.costPerHour, for (final OneTimeOrderRoleOption role in state.roles) role.id: role.costPerHour,
}; };
final OneTimeOrderHubOption? selectedHub = state.selectedHub;
if (selectedHub == null) {
throw Exception('Hub is missing.');
}
final OneTimeOrder order = OneTimeOrder( final OneTimeOrder order = OneTimeOrder(
date: state.date, date: state.date,
location: state.location, location: selectedHub.name,
positions: state.positions, positions: state.positions,
hub: OneTimeOrderHubDetails(
id: selectedHub.id,
name: selectedHub.name,
address: selectedHub.address,
placeId: selectedHub.placeId,
latitude: selectedHub.latitude,
longitude: selectedHub.longitude,
city: selectedHub.city,
state: selectedHub.state,
street: selectedHub.street,
country: selectedHub.country,
zipCode: selectedHub.zipCode,
),
vendorId: state.selectedVendor?.id, vendorId: state.selectedVendor?.id,
roleRates: roleRates, roleRates: roleRates,
); );

View File

@@ -1,5 +1,6 @@
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:krow_domain/krow_domain.dart'; import 'package:krow_domain/krow_domain.dart';
import 'one_time_order_state.dart';
abstract class OneTimeOrderEvent extends Equatable { abstract class OneTimeOrderEvent extends Equatable {
const OneTimeOrderEvent(); const OneTimeOrderEvent();
@@ -24,6 +25,22 @@ class OneTimeOrderVendorChanged extends OneTimeOrderEvent {
List<Object?> get props => <Object?>[vendor]; List<Object?> get props => <Object?>[vendor];
} }
class OneTimeOrderHubsLoaded extends OneTimeOrderEvent {
const OneTimeOrderHubsLoaded(this.hubs);
final List<OneTimeOrderHubOption> hubs;
@override
List<Object?> get props => <Object?>[hubs];
}
class OneTimeOrderHubChanged extends OneTimeOrderEvent {
const OneTimeOrderHubChanged(this.hub);
final OneTimeOrderHubOption hub;
@override
List<Object?> get props => <Object?>[hub];
}
class OneTimeOrderDateChanged extends OneTimeOrderEvent { class OneTimeOrderDateChanged extends OneTimeOrderEvent {
const OneTimeOrderDateChanged(this.date); const OneTimeOrderDateChanged(this.date);
final DateTime date; final DateTime date;
@@ -32,14 +49,6 @@ class OneTimeOrderDateChanged extends OneTimeOrderEvent {
List<Object?> get props => <Object?>[date]; List<Object?> get props => <Object?>[date];
} }
class OneTimeOrderLocationChanged extends OneTimeOrderEvent {
const OneTimeOrderLocationChanged(this.location);
final String location;
@override
List<Object?> get props => <Object?>[location];
}
class OneTimeOrderPositionAdded extends OneTimeOrderEvent { class OneTimeOrderPositionAdded extends OneTimeOrderEvent {
const OneTimeOrderPositionAdded(); const OneTimeOrderPositionAdded();
} }

View File

@@ -12,6 +12,8 @@ class OneTimeOrderState extends Equatable {
this.errorMessage, this.errorMessage,
this.vendors = const <Vendor>[], this.vendors = const <Vendor>[],
this.selectedVendor, this.selectedVendor,
this.hubs = const <OneTimeOrderHubOption>[],
this.selectedHub,
this.roles = const <OneTimeOrderRoleOption>[], this.roles = const <OneTimeOrderRoleOption>[],
}); });
@@ -23,6 +25,7 @@ class OneTimeOrderState extends Equatable {
OneTimeOrderPosition(role: '', count: 1, startTime: '', endTime: ''), OneTimeOrderPosition(role: '', count: 1, startTime: '', endTime: ''),
], ],
vendors: const <Vendor>[], vendors: const <Vendor>[],
hubs: const <OneTimeOrderHubOption>[],
roles: const <OneTimeOrderRoleOption>[], roles: const <OneTimeOrderRoleOption>[],
); );
} }
@@ -33,6 +36,8 @@ class OneTimeOrderState extends Equatable {
final String? errorMessage; final String? errorMessage;
final List<Vendor> vendors; final List<Vendor> vendors;
final Vendor? selectedVendor; final Vendor? selectedVendor;
final List<OneTimeOrderHubOption> hubs;
final OneTimeOrderHubOption? selectedHub;
final List<OneTimeOrderRoleOption> roles; final List<OneTimeOrderRoleOption> roles;
OneTimeOrderState copyWith({ OneTimeOrderState copyWith({
@@ -43,6 +48,8 @@ class OneTimeOrderState extends Equatable {
String? errorMessage, String? errorMessage,
List<Vendor>? vendors, List<Vendor>? vendors,
Vendor? selectedVendor, Vendor? selectedVendor,
List<OneTimeOrderHubOption>? hubs,
OneTimeOrderHubOption? selectedHub,
List<OneTimeOrderRoleOption>? roles, List<OneTimeOrderRoleOption>? roles,
}) { }) {
return OneTimeOrderState( return OneTimeOrderState(
@@ -53,6 +60,8 @@ class OneTimeOrderState extends Equatable {
errorMessage: errorMessage ?? this.errorMessage, errorMessage: errorMessage ?? this.errorMessage,
vendors: vendors ?? this.vendors, vendors: vendors ?? this.vendors,
selectedVendor: selectedVendor ?? this.selectedVendor, selectedVendor: selectedVendor ?? this.selectedVendor,
hubs: hubs ?? this.hubs,
selectedHub: selectedHub ?? this.selectedHub,
roles: roles ?? this.roles, roles: roles ?? this.roles,
); );
} }
@@ -66,10 +75,55 @@ class OneTimeOrderState extends Equatable {
errorMessage, errorMessage,
vendors, vendors,
selectedVendor, selectedVendor,
hubs,
selectedHub,
roles, roles,
]; ];
} }
class OneTimeOrderHubOption extends Equatable {
const OneTimeOrderHubOption({
required this.id,
required this.name,
required this.address,
this.placeId,
this.latitude,
this.longitude,
this.city,
this.state,
this.street,
this.country,
this.zipCode,
});
final String id;
final String name;
final String address;
final String? placeId;
final double? latitude;
final double? longitude;
final String? city;
final String? state;
final String? street;
final String? country;
final String? zipCode;
@override
List<Object?> get props => <Object?>[
id,
name,
address,
placeId,
latitude,
longitude,
city,
state,
street,
country,
zipCode,
];
}
class OneTimeOrderRoleOption extends Equatable { class OneTimeOrderRoleOption extends Equatable {
const OneTimeOrderRoleOption({ const OneTimeOrderRoleOption({
required this.id, required this.id,

View File

@@ -9,7 +9,6 @@ import '../../blocs/one_time_order_event.dart';
import '../../blocs/one_time_order_state.dart'; import '../../blocs/one_time_order_state.dart';
import 'one_time_order_date_picker.dart'; import 'one_time_order_date_picker.dart';
import 'one_time_order_header.dart'; import 'one_time_order_header.dart';
import 'one_time_order_location_input.dart';
import 'one_time_order_position_card.dart'; import 'one_time_order_position_card.dart';
import 'one_time_order_section_header.dart'; import 'one_time_order_section_header.dart';
import 'one_time_order_success_view.dart'; import 'one_time_order_success_view.dart';
@@ -184,12 +183,43 @@ class _OneTimeOrderForm extends StatelessWidget {
), ),
const SizedBox(height: UiConstants.space4), const SizedBox(height: UiConstants.space4),
OneTimeOrderLocationInput( Text('HUB', style: UiTypography.footnote2r.textSecondary),
label: labels.location_label, const SizedBox(height: 8),
value: state.location, Container(
onChanged: (String location) => BlocProvider.of<OneTimeOrderBloc>( padding: const EdgeInsets.symmetric(horizontal: UiConstants.space3),
context, height: 48,
).add(OneTimeOrderLocationChanged(location)), decoration: BoxDecoration(
color: UiColors.white,
borderRadius: UiConstants.radiusMd,
border: Border.all(color: UiColors.border),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<OneTimeOrderHubOption>(
isExpanded: true,
value: state.selectedHub,
icon: const Icon(
UiIcons.chevronDown,
size: 18,
color: UiColors.iconSecondary,
),
onChanged: (OneTimeOrderHubOption? hub) {
if (hub != null) {
BlocProvider.of<OneTimeOrderBloc>(
context,
).add(OneTimeOrderHubChanged(hub));
}
},
items: state.hubs.map((OneTimeOrderHubOption hub) {
return DropdownMenuItem<OneTimeOrderHubOption>(
value: hub,
child: Text(
hub.name,
style: UiTypography.body2m.textPrimary,
),
);
}).toList(),
),
),
), ),
const SizedBox(height: UiConstants.space6), const SizedBox(height: UiConstants.space6),

View File

@@ -13,6 +13,11 @@ mutation createShift(
$locationAddress: String $locationAddress: String
$latitude: Float $latitude: Float
$longitude: Float $longitude: Float
$placeId: String
$city: String
$state: String
$street: String
$country: String
$description: String $description: String
$status: ShiftStatus $status: ShiftStatus
@@ -40,6 +45,11 @@ mutation createShift(
locationAddress: $locationAddress locationAddress: $locationAddress
latitude: $latitude latitude: $latitude
longitude: $longitude longitude: $longitude
placeId: $placeId
city: $city
state: $state
street: $street
country: $country
description: $description description: $description
status: $status status: $status
@@ -68,6 +78,11 @@ mutation updateShift(
$locationAddress: String $locationAddress: String
$latitude: Float $latitude: Float
$longitude: Float $longitude: Float
$placeId: String
$city: String
$state: String
$street: String
$country: String
$description: String $description: String
$status: ShiftStatus $status: ShiftStatus
@@ -95,6 +110,11 @@ mutation updateShift(
locationAddress: $locationAddress locationAddress: $locationAddress
latitude: $latitude latitude: $latitude
longitude: $longitude longitude: $longitude
placeId: $placeId
city: $city
state: $state
street: $street
country: $country
description: $description description: $description
status: $status status: $status

View File

@@ -22,6 +22,11 @@ query listShifts(
locationAddress locationAddress
latitude latitude
longitude longitude
placeId
city
state
street
country
description description
status status
@@ -69,6 +74,11 @@ query getShiftById($id: UUID!) @auth(level: USER) {
locationAddress locationAddress
latitude latitude
longitude longitude
placeId
city
state
street
country
description description
status status
@@ -134,6 +144,11 @@ query filterShifts(
locationAddress locationAddress
latitude latitude
longitude longitude
placeId
city
state
street
country
description description
status status
@@ -194,6 +209,11 @@ query getShiftsByBusinessId(
locationAddress locationAddress
latitude latitude
longitude longitude
placeId
city
state
street
country
description description
status status
@@ -254,6 +274,11 @@ query getShiftsByVendorId(
locationAddress locationAddress
latitude latitude
longitude longitude
placeId
city
state
street
country
description description
status status

View File

@@ -28,6 +28,12 @@ type Shift @table(name: "shifts") {
locationAddress: String locationAddress: String
latitude: Float latitude: Float
longitude: Float longitude: Float
placeId: String
city: String
state: String
street: String
country: String
description: String description: String
status: ShiftStatus status: ShiftStatus