saving name of the orders

This commit is contained in:
José Salazar
2026-01-29 17:10:26 -05:00
parent 6592462e90
commit 02b0790ec3
14 changed files with 18224 additions and 18078 deletions

View File

@@ -1,16 +1,16 @@
# Basic Usage
```dart
ExampleConnector.instance.CreateCertificate(createCertificateVariables).execute();
ExampleConnector.instance.UpdateCertificate(updateCertificateVariables).execute();
ExampleConnector.instance.DeleteCertificate(deleteCertificateVariables).execute();
ExampleConnector.instance.listOrders(listOrdersVariables).execute();
ExampleConnector.instance.getOrderById(getOrderByIdVariables).execute();
ExampleConnector.instance.getOrdersByBusinessId(getOrdersByBusinessIdVariables).execute();
ExampleConnector.instance.getOrdersByVendorId(getOrdersByVendorIdVariables).execute();
ExampleConnector.instance.getOrdersByStatus(getOrdersByStatusVariables).execute();
ExampleConnector.instance.getOrdersByDateRange(getOrdersByDateRangeVariables).execute();
ExampleConnector.instance.getRapidOrders(getRapidOrdersVariables).execute();
ExampleConnector.instance.listAccounts().execute();
ExampleConnector.instance.getAccountById(getAccountByIdVariables).execute();
ExampleConnector.instance.getAccountsByOwnerId(getAccountsByOwnerIdVariables).execute();
ExampleConnector.instance.filterAccounts(filterAccountsVariables).execute();
ExampleConnector.instance.createApplication(createApplicationVariables).execute();
ExampleConnector.instance.updateApplicationStatus(updateApplicationStatusVariables).execute();
ExampleConnector.instance.deleteApplication(deleteApplicationVariables).execute();
ExampleConnector.instance.CreateAssignment(createAssignmentVariables).execute();
ExampleConnector.instance.UpdateAssignment(updateAssignmentVariables).execute();
ExampleConnector.instance.DeleteAssignment(deleteAssignmentVariables).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.listTeamHubsByOwnerId({ ... })
.offset(...)
await ExampleConnector.instance.filterStaffAvailabilityStats({ ... })
.needWorkIndexMin(...)
.execute();
```

View File

@@ -255,11 +255,13 @@ class ListShiftRolesByBusinessAndOrderShiftRolesShift {
@immutable
class ListShiftRolesByBusinessAndOrderShiftRolesShiftOrder {
final String? vendorId;
final String? eventName;
final Timestamp? date;
final ListShiftRolesByBusinessAndOrderShiftRolesShiftOrderTeamHub teamHub;
ListShiftRolesByBusinessAndOrderShiftRolesShiftOrder.fromJson(dynamic json):
vendorId = json['vendorId'] == null ? null : nativeFromJson<String>(json['vendorId']),
eventName = json['eventName'] == null ? null : nativeFromJson<String>(json['eventName']),
date = json['date'] == null ? null : Timestamp.fromJson(json['date']),
teamHub = ListShiftRolesByBusinessAndOrderShiftRolesShiftOrderTeamHub.fromJson(json['teamHub']);
@override
@@ -273,12 +275,13 @@ class ListShiftRolesByBusinessAndOrderShiftRolesShiftOrder {
final ListShiftRolesByBusinessAndOrderShiftRolesShiftOrder otherTyped = other as ListShiftRolesByBusinessAndOrderShiftRolesShiftOrder;
return vendorId == otherTyped.vendorId &&
eventName == otherTyped.eventName &&
date == otherTyped.date &&
teamHub == otherTyped.teamHub;
}
@override
int get hashCode => Object.hashAll([vendorId.hashCode, date.hashCode, teamHub.hashCode]);
int get hashCode => Object.hashAll([vendorId.hashCode, eventName.hashCode, date.hashCode, teamHub.hashCode]);
Map<String, dynamic> toJson() {
@@ -286,6 +289,9 @@ class ListShiftRolesByBusinessAndOrderShiftRolesShiftOrder {
if (vendorId != null) {
json['vendorId'] = nativeToJson<String?>(vendorId);
}
if (eventName != null) {
json['eventName'] = nativeToJson<String?>(eventName);
}
if (date != null) {
json['date'] = date!.toJson();
}
@@ -295,6 +301,7 @@ class ListShiftRolesByBusinessAndOrderShiftRolesShiftOrder {
ListShiftRolesByBusinessAndOrderShiftRolesShiftOrder({
this.vendorId,
this.eventName,
this.date,
required this.teamHub,
});

View File

@@ -11,6 +11,7 @@ class OneTimeOrder extends Equatable {
required this.location,
required this.positions,
this.hub,
this.eventName,
this.vendorId,
this.roleRates = const <String, double>{},
});
@@ -26,6 +27,9 @@ class OneTimeOrder extends Equatable {
/// Selected hub details for this order.
final OneTimeOrderHubDetails? hub;
/// Optional order name.
final String? eventName;
/// Selected vendor id for this order.
final String? vendorId;
@@ -38,6 +42,7 @@ class OneTimeOrder extends Equatable {
location,
positions,
hub,
eventName,
vendorId,
roleRates,
];

View File

@@ -79,6 +79,7 @@ class ClientCreateOrderRepositoryImpl
teamHubId: hub.id,
)
.vendorId(vendorId)
.eventName(order.eventName)
.status(dc.OrderStatus.POSTED)
.date(orderTimestamp)
.execute();

View File

@@ -15,6 +15,7 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
on<OneTimeOrderVendorChanged>(_onVendorChanged);
on<OneTimeOrderHubsLoaded>(_onHubsLoaded);
on<OneTimeOrderHubChanged>(_onHubChanged);
on<OneTimeOrderEventNameChanged>(_onEventNameChanged);
on<OneTimeOrderDateChanged>(_onDateChanged);
on<OneTimeOrderPositionAdded>(_onPositionAdded);
on<OneTimeOrderPositionRemoved>(_onPositionRemoved);
@@ -149,6 +150,13 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
);
}
void _onEventNameChanged(
OneTimeOrderEventNameChanged event,
Emitter<OneTimeOrderState> emit,
) {
emit(state.copyWith(eventName: event.eventName));
}
void _onDateChanged(
OneTimeOrderDateChanged event,
Emitter<OneTimeOrderState> emit,
@@ -224,6 +232,7 @@ class OneTimeOrderBloc extends Bloc<OneTimeOrderEvent, OneTimeOrderState> {
country: selectedHub.country,
zipCode: selectedHub.zipCode,
),
eventName: state.eventName,
vendorId: state.selectedVendor?.id,
roleRates: roleRates,
);

View File

@@ -41,6 +41,14 @@ class OneTimeOrderHubChanged extends OneTimeOrderEvent {
List<Object?> get props => <Object?>[hub];
}
class OneTimeOrderEventNameChanged extends OneTimeOrderEvent {
const OneTimeOrderEventNameChanged(this.eventName);
final String eventName;
@override
List<Object?> get props => <Object?>[eventName];
}
class OneTimeOrderDateChanged extends OneTimeOrderEvent {
const OneTimeOrderDateChanged(this.date);
final DateTime date;

View File

@@ -7,6 +7,7 @@ class OneTimeOrderState extends Equatable {
const OneTimeOrderState({
required this.date,
required this.location,
required this.eventName,
required this.positions,
this.status = OneTimeOrderStatus.initial,
this.errorMessage,
@@ -21,6 +22,7 @@ class OneTimeOrderState extends Equatable {
return OneTimeOrderState(
date: DateTime.now(),
location: '',
eventName: '',
positions: const <OneTimeOrderPosition>[
OneTimeOrderPosition(role: '', count: 1, startTime: '', endTime: ''),
],
@@ -31,6 +33,7 @@ class OneTimeOrderState extends Equatable {
}
final DateTime date;
final String location;
final String eventName;
final List<OneTimeOrderPosition> positions;
final OneTimeOrderStatus status;
final String? errorMessage;
@@ -43,6 +46,7 @@ class OneTimeOrderState extends Equatable {
OneTimeOrderState copyWith({
DateTime? date,
String? location,
String? eventName,
List<OneTimeOrderPosition>? positions,
OneTimeOrderStatus? status,
String? errorMessage,
@@ -55,6 +59,7 @@ class OneTimeOrderState extends Equatable {
return OneTimeOrderState(
date: date ?? this.date,
location: location ?? this.location,
eventName: eventName ?? this.eventName,
positions: positions ?? this.positions,
status: status ?? this.status,
errorMessage: errorMessage ?? this.errorMessage,
@@ -70,6 +75,7 @@ class OneTimeOrderState extends Equatable {
List<Object?> get props => <Object?>[
date,
location,
eventName,
positions,
status,
errorMessage,

View File

@@ -0,0 +1,56 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
/// A text input for the order name in the one-time order form.
class OneTimeOrderEventNameInput extends StatefulWidget {
const OneTimeOrderEventNameInput({
required this.label,
required this.value,
required this.onChanged,
super.key,
});
final String label;
final String value;
final ValueChanged<String> onChanged;
@override
State<OneTimeOrderEventNameInput> createState() =>
_OneTimeOrderEventNameInputState();
}
class _OneTimeOrderEventNameInputState
extends State<OneTimeOrderEventNameInput> {
late final TextEditingController _controller;
@override
void initState() {
super.initState();
_controller = TextEditingController(text: widget.value);
}
@override
void didUpdateWidget(OneTimeOrderEventNameInput oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.value != _controller.text) {
_controller.text = widget.value;
}
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return UiTextField(
label: widget.label,
controller: _controller,
onChanged: widget.onChanged,
hintText: 'Order name',
prefixIcon: UiIcons.briefcase,
);
}
}

View File

@@ -8,6 +8,7 @@ import '../../blocs/one_time_order_bloc.dart';
import '../../blocs/one_time_order_event.dart';
import '../../blocs/one_time_order_state.dart';
import 'one_time_order_date_picker.dart';
import 'one_time_order_event_name_input.dart';
import 'one_time_order_header.dart';
import 'one_time_order_position_card.dart';
import 'one_time_order_section_header.dart';
@@ -133,6 +134,15 @@ class _OneTimeOrderForm extends StatelessWidget {
),
const SizedBox(height: UiConstants.space4),
OneTimeOrderEventNameInput(
label: 'ORDER NAME',
value: state.eventName,
onChanged: (String value) => BlocProvider.of<OneTimeOrderBloc>(
context,
).add(OneTimeOrderEventNameChanged(value)),
),
const SizedBox(height: UiConstants.space4),
// Vendor Selection
Text('SELECT VENDOR', style: UiTypography.footnote2r.textSecondary),
const SizedBox(height: 8),

View File

@@ -53,6 +53,7 @@ class ShiftOrderFormSheet extends StatefulWidget {
class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
late TextEditingController _dateController;
late TextEditingController _globalLocationController;
late TextEditingController _orderNameController;
late List<Map<String, dynamic>> _positions;
@@ -80,6 +81,9 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
widget.initialData?['locationAddress'] ??
'',
);
_orderNameController = TextEditingController(
text: widget.initialData?['eventName']?.toString() ?? '',
);
// Initialize positions
_positions = <Map<String, dynamic>>[
@@ -109,6 +113,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
void dispose() {
_dateController.dispose();
_globalLocationController.dispose();
_orderNameController.dispose();
super.dispose();
}
@@ -212,6 +217,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
teamHubId: selectedHub.id,
)
.vendorId(_selectedVendorId)
.eventName(_orderNameController.text)
.status(dc.OrderStatus.POSTED)
.date(orderTimestamp)
.execute();
@@ -416,6 +422,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
hubName: teamHub?.hubName,
address: teamHub?.address,
);
_orderNameController.text = firstShift.order.eventName ?? '';
final String? vendorId = firstShift.order.vendorId;
if (mounted) {
@@ -676,6 +683,10 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
_buildVendorDropdown(),
const SizedBox(height: UiConstants.space4),
_buildSectionHeader('ORDER NAME'),
_buildOrderNameField(),
const SizedBox(height: UiConstants.space4),
_buildSectionHeader('DATE'),
_buildDateField(),
const SizedBox(height: UiConstants.space4),
@@ -952,6 +963,25 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
);
}
Widget _buildOrderNameField() {
return Container(
padding: const EdgeInsets.symmetric(horizontal: UiConstants.space3),
decoration: BoxDecoration(
color: UiColors.white,
borderRadius: UiConstants.radiusMd,
border: Border.all(color: UiColors.border),
),
child: TextField(
controller: _orderNameController,
decoration: const InputDecoration(
hintText: 'Order name',
border: InputBorder.none,
),
style: UiTypography.body2r.textPrimary,
),
);
}
Widget _buildPositionCard(int index, Map<String, dynamic> pos) {
return Container(
margin: const EdgeInsets.only(bottom: UiConstants.space3),

View File

@@ -655,6 +655,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
late TextEditingController _dateController;
late TextEditingController _globalLocationController;
late TextEditingController _orderNameController;
late List<Map<String, dynamic>> _positions;
@@ -677,6 +678,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
_globalLocationController = TextEditingController(
text: widget.order.locationAddress,
);
_orderNameController = TextEditingController();
_positions = <Map<String, dynamic>>[
<String, dynamic>{
@@ -699,6 +701,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
void dispose() {
_dateController.dispose();
_globalLocationController.dispose();
_orderNameController.dispose();
super.dispose();
}
@@ -744,6 +747,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
_dateController.text = dateText;
_globalLocationController.text = location;
_orderNameController.text = firstShift.order.eventName ?? '';
_shiftId = shiftRoles.first.shiftId;
final List<Map<String, dynamic>> positions =
@@ -1161,6 +1165,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
.updateOrder(id: widget.order.orderId, teamHubId: selectedHub.id)
.vendorId(_selectedVendor?.id)
.date(_toTimestamp(orderDateOnly))
.eventName(_orderNameController.text)
.execute();
await _dataConnect
@@ -1277,6 +1282,14 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
),
const SizedBox(height: UiConstants.space4),
_buildSectionHeader('ORDER NAME'),
UiTextField(
controller: _orderNameController,
hintText: 'Order name',
prefixIcon: UiIcons.briefcase,
),
const SizedBox(height: UiConstants.space4),
_buildSectionHeader('HUB'),
Container(
padding: const EdgeInsets.symmetric(

View File

@@ -378,6 +378,7 @@ query listShiftRolesByBusinessAndOrder(
order{
vendorId
eventName
date
#location