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 # Basic Usage
```dart ```dart
ExampleConnector.instance.CreateCertificate(createCertificateVariables).execute(); ExampleConnector.instance.listAccounts().execute();
ExampleConnector.instance.UpdateCertificate(updateCertificateVariables).execute(); ExampleConnector.instance.getAccountById(getAccountByIdVariables).execute();
ExampleConnector.instance.DeleteCertificate(deleteCertificateVariables).execute(); ExampleConnector.instance.getAccountsByOwnerId(getAccountsByOwnerIdVariables).execute();
ExampleConnector.instance.listOrders(listOrdersVariables).execute(); ExampleConnector.instance.filterAccounts(filterAccountsVariables).execute();
ExampleConnector.instance.getOrderById(getOrderByIdVariables).execute(); ExampleConnector.instance.createApplication(createApplicationVariables).execute();
ExampleConnector.instance.getOrdersByBusinessId(getOrdersByBusinessIdVariables).execute(); ExampleConnector.instance.updateApplicationStatus(updateApplicationStatusVariables).execute();
ExampleConnector.instance.getOrdersByVendorId(getOrdersByVendorIdVariables).execute(); ExampleConnector.instance.deleteApplication(deleteApplicationVariables).execute();
ExampleConnector.instance.getOrdersByStatus(getOrdersByStatusVariables).execute(); ExampleConnector.instance.CreateAssignment(createAssignmentVariables).execute();
ExampleConnector.instance.getOrdersByDateRange(getOrdersByDateRangeVariables).execute(); ExampleConnector.instance.UpdateAssignment(updateAssignmentVariables).execute();
ExampleConnector.instance.getRapidOrders(getRapidOrdersVariables).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: This is an example of a mutation with an optional field:
```dart ```dart
await ExampleConnector.instance.listTeamHubsByOwnerId({ ... }) await ExampleConnector.instance.filterStaffAvailabilityStats({ ... })
.offset(...) .needWorkIndexMin(...)
.execute(); .execute();
``` ```

View File

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

View File

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

View File

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

View File

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

View File

@@ -41,6 +41,14 @@ class OneTimeOrderHubChanged extends OneTimeOrderEvent {
List<Object?> get props => <Object?>[hub]; 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 { class OneTimeOrderDateChanged extends OneTimeOrderEvent {
const OneTimeOrderDateChanged(this.date); const OneTimeOrderDateChanged(this.date);
final DateTime date; final DateTime date;

View File

@@ -7,6 +7,7 @@ class OneTimeOrderState extends Equatable {
const OneTimeOrderState({ const OneTimeOrderState({
required this.date, required this.date,
required this.location, required this.location,
required this.eventName,
required this.positions, required this.positions,
this.status = OneTimeOrderStatus.initial, this.status = OneTimeOrderStatus.initial,
this.errorMessage, this.errorMessage,
@@ -21,6 +22,7 @@ class OneTimeOrderState extends Equatable {
return OneTimeOrderState( return OneTimeOrderState(
date: DateTime.now(), date: DateTime.now(),
location: '', location: '',
eventName: '',
positions: const <OneTimeOrderPosition>[ positions: const <OneTimeOrderPosition>[
OneTimeOrderPosition(role: '', count: 1, startTime: '', endTime: ''), OneTimeOrderPosition(role: '', count: 1, startTime: '', endTime: ''),
], ],
@@ -31,6 +33,7 @@ class OneTimeOrderState extends Equatable {
} }
final DateTime date; final DateTime date;
final String location; final String location;
final String eventName;
final List<OneTimeOrderPosition> positions; final List<OneTimeOrderPosition> positions;
final OneTimeOrderStatus status; final OneTimeOrderStatus status;
final String? errorMessage; final String? errorMessage;
@@ -43,6 +46,7 @@ class OneTimeOrderState extends Equatable {
OneTimeOrderState copyWith({ OneTimeOrderState copyWith({
DateTime? date, DateTime? date,
String? location, String? location,
String? eventName,
List<OneTimeOrderPosition>? positions, List<OneTimeOrderPosition>? positions,
OneTimeOrderStatus? status, OneTimeOrderStatus? status,
String? errorMessage, String? errorMessage,
@@ -55,6 +59,7 @@ class OneTimeOrderState extends Equatable {
return OneTimeOrderState( return OneTimeOrderState(
date: date ?? this.date, date: date ?? this.date,
location: location ?? this.location, location: location ?? this.location,
eventName: eventName ?? this.eventName,
positions: positions ?? this.positions, positions: positions ?? this.positions,
status: status ?? this.status, status: status ?? this.status,
errorMessage: errorMessage ?? this.errorMessage, errorMessage: errorMessage ?? this.errorMessage,
@@ -70,6 +75,7 @@ class OneTimeOrderState extends Equatable {
List<Object?> get props => <Object?>[ List<Object?> get props => <Object?>[
date, date,
location, location,
eventName,
positions, positions,
status, status,
errorMessage, 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_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_event_name_input.dart';
import 'one_time_order_header.dart'; import 'one_time_order_header.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';
@@ -133,6 +134,15 @@ class _OneTimeOrderForm extends StatelessWidget {
), ),
const SizedBox(height: UiConstants.space4), 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 // Vendor Selection
Text('SELECT VENDOR', style: UiTypography.footnote2r.textSecondary), Text('SELECT VENDOR', style: UiTypography.footnote2r.textSecondary),
const SizedBox(height: 8), const SizedBox(height: 8),

View File

@@ -53,6 +53,7 @@ class ShiftOrderFormSheet extends StatefulWidget {
class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> { class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
late TextEditingController _dateController; late TextEditingController _dateController;
late TextEditingController _globalLocationController; late TextEditingController _globalLocationController;
late TextEditingController _orderNameController;
late List<Map<String, dynamic>> _positions; late List<Map<String, dynamic>> _positions;
@@ -80,6 +81,9 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
widget.initialData?['locationAddress'] ?? widget.initialData?['locationAddress'] ??
'', '',
); );
_orderNameController = TextEditingController(
text: widget.initialData?['eventName']?.toString() ?? '',
);
// Initialize positions // Initialize positions
_positions = <Map<String, dynamic>>[ _positions = <Map<String, dynamic>>[
@@ -109,6 +113,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
void dispose() { void dispose() {
_dateController.dispose(); _dateController.dispose();
_globalLocationController.dispose(); _globalLocationController.dispose();
_orderNameController.dispose();
super.dispose(); super.dispose();
} }
@@ -212,6 +217,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
teamHubId: selectedHub.id, teamHubId: selectedHub.id,
) )
.vendorId(_selectedVendorId) .vendorId(_selectedVendorId)
.eventName(_orderNameController.text)
.status(dc.OrderStatus.POSTED) .status(dc.OrderStatus.POSTED)
.date(orderTimestamp) .date(orderTimestamp)
.execute(); .execute();
@@ -416,6 +422,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
hubName: teamHub?.hubName, hubName: teamHub?.hubName,
address: teamHub?.address, address: teamHub?.address,
); );
_orderNameController.text = firstShift.order.eventName ?? '';
final String? vendorId = firstShift.order.vendorId; final String? vendorId = firstShift.order.vendorId;
if (mounted) { if (mounted) {
@@ -676,6 +683,10 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
_buildVendorDropdown(), _buildVendorDropdown(),
const SizedBox(height: UiConstants.space4), const SizedBox(height: UiConstants.space4),
_buildSectionHeader('ORDER NAME'),
_buildOrderNameField(),
const SizedBox(height: UiConstants.space4),
_buildSectionHeader('DATE'), _buildSectionHeader('DATE'),
_buildDateField(), _buildDateField(),
const SizedBox(height: UiConstants.space4), 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) { Widget _buildPositionCard(int index, Map<String, dynamic> pos) {
return Container( return Container(
margin: const EdgeInsets.only(bottom: UiConstants.space3), margin: const EdgeInsets.only(bottom: UiConstants.space3),

View File

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

View File

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