dev #1
@ -56,18 +56,24 @@ class TableRemoteDataSource {
|
|||||||
Future<Either<String, TableResponseModel>> getTable({
|
Future<Either<String, TableResponseModel>> getTable({
|
||||||
int page = 1,
|
int page = 1,
|
||||||
int limit = 10,
|
int limit = 10,
|
||||||
|
String? status,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
final authData = await AuthLocalDataSource().getAuthData();
|
final authData = await AuthLocalDataSource().getAuthData();
|
||||||
final url = '${Variables.baseUrl}/api/v1/tables';
|
final url = '${Variables.baseUrl}/api/v1/tables';
|
||||||
|
|
||||||
final response = await dio.get(
|
Map<String, dynamic> queryParameters = {
|
||||||
url,
|
|
||||||
queryParameters: {
|
|
||||||
'page': page,
|
'page': page,
|
||||||
'limit': limit,
|
'limit': limit,
|
||||||
'outlet_id': authData.user?.outletId,
|
};
|
||||||
},
|
|
||||||
|
if (status != null) {
|
||||||
|
queryParameters['status'] = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
final response = await dio.get(
|
||||||
|
url,
|
||||||
|
queryParameters: queryParameters,
|
||||||
options: Options(
|
options: Options(
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer ${authData.token}',
|
'Authorization': 'Bearer ${authData.token}',
|
||||||
|
|||||||
@ -167,7 +167,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
LastOrderTableBloc(ProductLocalDatasource.instance),
|
LastOrderTableBloc(ProductLocalDatasource.instance),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => GetTableStatusBloc(),
|
create: (context) => GetTableStatusBloc(TableRemoteDataSource()),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => AddProductBloc(ProductRemoteDatasource()),
|
create: (context) => AddProductBloc(ProductRemoteDatasource()),
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
import 'package:enaklo_pos/data/datasources/table_remote_datasource.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
|
||||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
@ -9,12 +9,17 @@ part 'get_table_status_bloc.freezed.dart';
|
|||||||
|
|
||||||
class GetTableStatusBloc
|
class GetTableStatusBloc
|
||||||
extends Bloc<GetTableStatusEvent, GetTableStatusState> {
|
extends Bloc<GetTableStatusEvent, GetTableStatusState> {
|
||||||
GetTableStatusBloc() : super(_Initial()) {
|
final TableRemoteDataSource _tableRemoteDataSource;
|
||||||
|
GetTableStatusBloc(this._tableRemoteDataSource) : super(_Initial()) {
|
||||||
on<_GetTablesStatus>((event, emit) async {
|
on<_GetTablesStatus>((event, emit) async {
|
||||||
emit(_Loading());
|
emit(_Loading());
|
||||||
final tables =
|
final tables =
|
||||||
await ProductLocalDatasource.instance.getTableByStatus(event.status);
|
await _tableRemoteDataSource.getTable(status: event.status);
|
||||||
emit(_Success(tables));
|
|
||||||
|
tables.fold(
|
||||||
|
(failure) => emit(_Error(failure)),
|
||||||
|
(tableResponse) => emit(_Success(tableResponse.data!.tables!)),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -330,6 +330,7 @@ mixin _$GetTableStatusState {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
|
required TResult Function(String message) error,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -337,6 +338,7 @@ mixin _$GetTableStatusState {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
|
TResult? Function(String message)? error,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -344,6 +346,7 @@ mixin _$GetTableStatusState {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
|
TResult Function(String message)? error,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -352,6 +355,7 @@ mixin _$GetTableStatusState {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
|
required TResult Function(_Error value) error,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -359,6 +363,7 @@ mixin _$GetTableStatusState {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
|
TResult? Function(_Error value)? error,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
@ -366,6 +371,7 @@ mixin _$GetTableStatusState {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
|
TResult Function(_Error value)? error,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -436,6 +442,7 @@ class _$InitialImpl implements _Initial {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
|
required TResult Function(String message) error,
|
||||||
}) {
|
}) {
|
||||||
return initial();
|
return initial();
|
||||||
}
|
}
|
||||||
@ -446,6 +453,7 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
|
TResult? Function(String message)? error,
|
||||||
}) {
|
}) {
|
||||||
return initial?.call();
|
return initial?.call();
|
||||||
}
|
}
|
||||||
@ -456,6 +464,7 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
|
TResult Function(String message)? error,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -470,6 +479,7 @@ class _$InitialImpl implements _Initial {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
|
required TResult Function(_Error value) error,
|
||||||
}) {
|
}) {
|
||||||
return initial(this);
|
return initial(this);
|
||||||
}
|
}
|
||||||
@ -480,6 +490,7 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
|
TResult? Function(_Error value)? error,
|
||||||
}) {
|
}) {
|
||||||
return initial?.call(this);
|
return initial?.call(this);
|
||||||
}
|
}
|
||||||
@ -490,6 +501,7 @@ class _$InitialImpl implements _Initial {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
|
TResult Function(_Error value)? error,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -547,6 +559,7 @@ class _$LoadingImpl implements _Loading {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
|
required TResult Function(String message) error,
|
||||||
}) {
|
}) {
|
||||||
return loading();
|
return loading();
|
||||||
}
|
}
|
||||||
@ -557,6 +570,7 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
|
TResult? Function(String message)? error,
|
||||||
}) {
|
}) {
|
||||||
return loading?.call();
|
return loading?.call();
|
||||||
}
|
}
|
||||||
@ -567,6 +581,7 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
|
TResult Function(String message)? error,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (loading != null) {
|
if (loading != null) {
|
||||||
@ -581,6 +596,7 @@ class _$LoadingImpl implements _Loading {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
|
required TResult Function(_Error value) error,
|
||||||
}) {
|
}) {
|
||||||
return loading(this);
|
return loading(this);
|
||||||
}
|
}
|
||||||
@ -591,6 +607,7 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
|
TResult? Function(_Error value)? error,
|
||||||
}) {
|
}) {
|
||||||
return loading?.call(this);
|
return loading?.call(this);
|
||||||
}
|
}
|
||||||
@ -601,6 +618,7 @@ class _$LoadingImpl implements _Loading {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
|
TResult Function(_Error value)? error,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (loading != null) {
|
if (loading != null) {
|
||||||
@ -691,6 +709,7 @@ class _$SuccessImpl implements _Success {
|
|||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() loading,
|
required TResult Function() loading,
|
||||||
required TResult Function(List<TableModel> tables) success,
|
required TResult Function(List<TableModel> tables) success,
|
||||||
|
required TResult Function(String message) error,
|
||||||
}) {
|
}) {
|
||||||
return success(tables);
|
return success(tables);
|
||||||
}
|
}
|
||||||
@ -701,6 +720,7 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult? Function()? initial,
|
TResult? Function()? initial,
|
||||||
TResult? Function()? loading,
|
TResult? Function()? loading,
|
||||||
TResult? Function(List<TableModel> tables)? success,
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
|
TResult? Function(String message)? error,
|
||||||
}) {
|
}) {
|
||||||
return success?.call(tables);
|
return success?.call(tables);
|
||||||
}
|
}
|
||||||
@ -711,6 +731,7 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? loading,
|
TResult Function()? loading,
|
||||||
TResult Function(List<TableModel> tables)? success,
|
TResult Function(List<TableModel> tables)? success,
|
||||||
|
TResult Function(String message)? error,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (success != null) {
|
if (success != null) {
|
||||||
@ -725,6 +746,7 @@ class _$SuccessImpl implements _Success {
|
|||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(_Initial value) initial,
|
||||||
required TResult Function(_Loading value) loading,
|
required TResult Function(_Loading value) loading,
|
||||||
required TResult Function(_Success value) success,
|
required TResult Function(_Success value) success,
|
||||||
|
required TResult Function(_Error value) error,
|
||||||
}) {
|
}) {
|
||||||
return success(this);
|
return success(this);
|
||||||
}
|
}
|
||||||
@ -735,6 +757,7 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult? Function(_Initial value)? initial,
|
TResult? Function(_Initial value)? initial,
|
||||||
TResult? Function(_Loading value)? loading,
|
TResult? Function(_Loading value)? loading,
|
||||||
TResult? Function(_Success value)? success,
|
TResult? Function(_Success value)? success,
|
||||||
|
TResult? Function(_Error value)? error,
|
||||||
}) {
|
}) {
|
||||||
return success?.call(this);
|
return success?.call(this);
|
||||||
}
|
}
|
||||||
@ -745,6 +768,7 @@ class _$SuccessImpl implements _Success {
|
|||||||
TResult Function(_Initial value)? initial,
|
TResult Function(_Initial value)? initial,
|
||||||
TResult Function(_Loading value)? loading,
|
TResult Function(_Loading value)? loading,
|
||||||
TResult Function(_Success value)? success,
|
TResult Function(_Success value)? success,
|
||||||
|
TResult Function(_Error value)? error,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (success != null) {
|
if (success != null) {
|
||||||
@ -765,3 +789,155 @@ abstract class _Success implements GetTableStatusState {
|
|||||||
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ErrorImplCopyWith<$Res> {
|
||||||
|
factory _$$ErrorImplCopyWith(
|
||||||
|
_$ErrorImpl value, $Res Function(_$ErrorImpl) then) =
|
||||||
|
__$$ErrorImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String message});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ErrorImplCopyWithImpl<$Res>
|
||||||
|
extends _$GetTableStatusStateCopyWithImpl<$Res, _$ErrorImpl>
|
||||||
|
implements _$$ErrorImplCopyWith<$Res> {
|
||||||
|
__$$ErrorImplCopyWithImpl(
|
||||||
|
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of GetTableStatusState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? message = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$ErrorImpl(
|
||||||
|
null == message
|
||||||
|
? _value.message
|
||||||
|
: message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ErrorImpl implements _Error {
|
||||||
|
const _$ErrorImpl(this.message);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String message;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetTableStatusState.error(message: $message)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ErrorImpl &&
|
||||||
|
(identical(other.message, message) || other.message == message));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, message);
|
||||||
|
|
||||||
|
/// Create a copy of GetTableStatusState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
||||||
|
__$$ErrorImplCopyWithImpl<_$ErrorImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function() initial,
|
||||||
|
required TResult Function() loading,
|
||||||
|
required TResult Function(List<TableModel> tables) success,
|
||||||
|
required TResult Function(String message) error,
|
||||||
|
}) {
|
||||||
|
return error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function()? initial,
|
||||||
|
TResult? Function()? loading,
|
||||||
|
TResult? Function(List<TableModel> tables)? success,
|
||||||
|
TResult? Function(String message)? error,
|
||||||
|
}) {
|
||||||
|
return error?.call(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function()? initial,
|
||||||
|
TResult Function()? loading,
|
||||||
|
TResult Function(List<TableModel> tables)? success,
|
||||||
|
TResult Function(String message)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (error != null) {
|
||||||
|
return error(message);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_Initial value) initial,
|
||||||
|
required TResult Function(_Loading value) loading,
|
||||||
|
required TResult Function(_Success value) success,
|
||||||
|
required TResult Function(_Error value) error,
|
||||||
|
}) {
|
||||||
|
return error(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_Initial value)? initial,
|
||||||
|
TResult? Function(_Loading value)? loading,
|
||||||
|
TResult? Function(_Success value)? success,
|
||||||
|
TResult? Function(_Error value)? error,
|
||||||
|
}) {
|
||||||
|
return error?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_Initial value)? initial,
|
||||||
|
TResult Function(_Loading value)? loading,
|
||||||
|
TResult Function(_Success value)? success,
|
||||||
|
TResult Function(_Error value)? error,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (error != null) {
|
||||||
|
return error(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Error implements GetTableStatusState {
|
||||||
|
const factory _Error(final String message) = _$ErrorImpl;
|
||||||
|
|
||||||
|
String get message;
|
||||||
|
|
||||||
|
/// Create a copy of GetTableStatusState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|||||||
@ -5,4 +5,5 @@ class GetTableStatusState with _$GetTableStatusState {
|
|||||||
const factory GetTableStatusState.initial() = _Initial;
|
const factory GetTableStatusState.initial() = _Initial;
|
||||||
const factory GetTableStatusState.loading() = _Loading;
|
const factory GetTableStatusState.loading() = _Loading;
|
||||||
const factory GetTableStatusState.success(List<TableModel> tables) = _Success;
|
const factory GetTableStatusState.success(List<TableModel> tables) = _Success;
|
||||||
|
const factory GetTableStatusState.error(String message) = _Error;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:enaklo_pos/data/datasources/auth_local_datasource.dart';
|
|||||||
import 'package:enaklo_pos/data/datasources/order_remote_datasource.dart';
|
import 'package:enaklo_pos/data/datasources/order_remote_datasource.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/order_response_model.dart';
|
import 'package:enaklo_pos/data/models/response/order_response_model.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart';
|
import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart';
|
||||||
|
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/models/order_request.dart';
|
import 'package:enaklo_pos/presentation/home/models/order_request.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/models/order_type.dart';
|
import 'package:enaklo_pos/presentation/home/models/order_type.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/models/product_quantity.dart';
|
import 'package:enaklo_pos/presentation/home/models/product_quantity.dart';
|
||||||
@ -33,7 +34,8 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
|||||||
customerName: event.customerName,
|
customerName: event.customerName,
|
||||||
notes: '',
|
notes: '',
|
||||||
orderType: event.orderType.name,
|
orderType: event.orderType.name,
|
||||||
tableNumber: event.tableNumber.toString(),
|
tableId: event.table.id,
|
||||||
|
tableNumber: event.table.tableName,
|
||||||
outletId: userData.user?.outletId,
|
outletId: userData.user?.outletId,
|
||||||
userId: userData.user?.id,
|
userId: userData.user?.id,
|
||||||
orderItems: event.items
|
orderItems: event.items
|
||||||
@ -73,7 +75,8 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
|||||||
customerName: event.customerName,
|
customerName: event.customerName,
|
||||||
notes: '',
|
notes: '',
|
||||||
orderType: event.orderType.name,
|
orderType: event.orderType.name,
|
||||||
tableNumber: event.tableNumber.toString(),
|
tableId: event.table.id,
|
||||||
|
tableNumber: event.table.tableName,
|
||||||
outletId: userData.user?.outletId,
|
outletId: userData.user?.outletId,
|
||||||
userId: userData.user?.id,
|
userId: userData.user?.id,
|
||||||
orderItems: event.items
|
orderItems: event.items
|
||||||
|
|||||||
@ -20,14 +20,10 @@ mixin _$OrderFormEvent {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)
|
OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
@ -38,14 +34,10 @@ mixin _$OrderFormEvent {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -56,14 +48,10 @@ mixin _$OrderFormEvent {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -195,14 +183,10 @@ class _$StartedImpl implements _Started {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)
|
OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
@ -216,14 +200,10 @@ class _$StartedImpl implements _Started {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -237,14 +217,10 @@ class _$StartedImpl implements _Started {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -323,7 +299,7 @@ abstract class _$$CreateImplCopyWith<$Res> {
|
|||||||
{List<ProductQuantity> items,
|
{List<ProductQuantity> items,
|
||||||
String customerName,
|
String customerName,
|
||||||
OrderType orderType,
|
OrderType orderType,
|
||||||
String tableNumber});
|
TableModel table});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -342,7 +318,7 @@ class __$$CreateImplCopyWithImpl<$Res>
|
|||||||
Object? items = null,
|
Object? items = null,
|
||||||
Object? customerName = null,
|
Object? customerName = null,
|
||||||
Object? orderType = null,
|
Object? orderType = null,
|
||||||
Object? tableNumber = null,
|
Object? table = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$CreateImpl(
|
return _then(_$CreateImpl(
|
||||||
items: null == items
|
items: null == items
|
||||||
@ -357,10 +333,10 @@ class __$$CreateImplCopyWithImpl<$Res>
|
|||||||
? _value.orderType
|
? _value.orderType
|
||||||
: orderType // ignore: cast_nullable_to_non_nullable
|
: orderType // ignore: cast_nullable_to_non_nullable
|
||||||
as OrderType,
|
as OrderType,
|
||||||
tableNumber: null == tableNumber
|
table: freezed == table
|
||||||
? _value.tableNumber
|
? _value.table
|
||||||
: tableNumber // ignore: cast_nullable_to_non_nullable
|
: table // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as TableModel,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -372,7 +348,7 @@ class _$CreateImpl implements _Create {
|
|||||||
{required final List<ProductQuantity> items,
|
{required final List<ProductQuantity> items,
|
||||||
required this.customerName,
|
required this.customerName,
|
||||||
required this.orderType,
|
required this.orderType,
|
||||||
required this.tableNumber})
|
required this.table})
|
||||||
: _items = items;
|
: _items = items;
|
||||||
|
|
||||||
final List<ProductQuantity> _items;
|
final List<ProductQuantity> _items;
|
||||||
@ -388,11 +364,11 @@ class _$CreateImpl implements _Create {
|
|||||||
@override
|
@override
|
||||||
final OrderType orderType;
|
final OrderType orderType;
|
||||||
@override
|
@override
|
||||||
final String tableNumber;
|
final TableModel table;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'OrderFormEvent.create(items: $items, customerName: $customerName, orderType: $orderType, tableNumber: $tableNumber)';
|
return 'OrderFormEvent.create(items: $items, customerName: $customerName, orderType: $orderType, table: $table)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -405,8 +381,7 @@ class _$CreateImpl implements _Create {
|
|||||||
other.customerName == customerName) &&
|
other.customerName == customerName) &&
|
||||||
(identical(other.orderType, orderType) ||
|
(identical(other.orderType, orderType) ||
|
||||||
other.orderType == orderType) &&
|
other.orderType == orderType) &&
|
||||||
(identical(other.tableNumber, tableNumber) ||
|
const DeepCollectionEquality().equals(other.table, table));
|
||||||
other.tableNumber == tableNumber));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -415,7 +390,7 @@ class _$CreateImpl implements _Create {
|
|||||||
const DeepCollectionEquality().hash(_items),
|
const DeepCollectionEquality().hash(_items),
|
||||||
customerName,
|
customerName,
|
||||||
orderType,
|
orderType,
|
||||||
tableNumber);
|
const DeepCollectionEquality().hash(table));
|
||||||
|
|
||||||
/// Create a copy of OrderFormEvent
|
/// Create a copy of OrderFormEvent
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -430,20 +405,16 @@ class _$CreateImpl implements _Create {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)
|
OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
required TResult Function() refund,
|
required TResult Function() refund,
|
||||||
}) {
|
}) {
|
||||||
return create(items, customerName, orderType, tableNumber);
|
return create(items, customerName, orderType, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -451,20 +422,16 @@ class _$CreateImpl implements _Create {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
TResult? Function()? refund,
|
TResult? Function()? refund,
|
||||||
}) {
|
}) {
|
||||||
return create?.call(items, customerName, orderType, tableNumber);
|
return create?.call(items, customerName, orderType, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -472,14 +439,10 @@ class _$CreateImpl implements _Create {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -487,7 +450,7 @@ class _$CreateImpl implements _Create {
|
|||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (create != null) {
|
if (create != null) {
|
||||||
return create(items, customerName, orderType, tableNumber);
|
return create(items, customerName, orderType, table);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
@ -541,12 +504,12 @@ abstract class _Create implements OrderFormEvent {
|
|||||||
{required final List<ProductQuantity> items,
|
{required final List<ProductQuantity> items,
|
||||||
required final String customerName,
|
required final String customerName,
|
||||||
required final OrderType orderType,
|
required final OrderType orderType,
|
||||||
required final String tableNumber}) = _$CreateImpl;
|
required final TableModel table}) = _$CreateImpl;
|
||||||
|
|
||||||
List<ProductQuantity> get items;
|
List<ProductQuantity> get items;
|
||||||
String get customerName;
|
String get customerName;
|
||||||
OrderType get orderType;
|
OrderType get orderType;
|
||||||
String get tableNumber;
|
TableModel get table;
|
||||||
|
|
||||||
/// Create a copy of OrderFormEvent
|
/// Create a copy of OrderFormEvent
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -566,7 +529,7 @@ abstract class _$$CreateWithPaymentMethodImplCopyWith<$Res> {
|
|||||||
{List<ProductQuantity> items,
|
{List<ProductQuantity> items,
|
||||||
String customerName,
|
String customerName,
|
||||||
OrderType orderType,
|
OrderType orderType,
|
||||||
String tableNumber,
|
TableModel table,
|
||||||
PaymentMethod paymentMethod});
|
PaymentMethod paymentMethod});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,7 +550,7 @@ class __$$CreateWithPaymentMethodImplCopyWithImpl<$Res>
|
|||||||
Object? items = null,
|
Object? items = null,
|
||||||
Object? customerName = null,
|
Object? customerName = null,
|
||||||
Object? orderType = null,
|
Object? orderType = null,
|
||||||
Object? tableNumber = null,
|
Object? table = freezed,
|
||||||
Object? paymentMethod = null,
|
Object? paymentMethod = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$CreateWithPaymentMethodImpl(
|
return _then(_$CreateWithPaymentMethodImpl(
|
||||||
@ -603,10 +566,10 @@ class __$$CreateWithPaymentMethodImplCopyWithImpl<$Res>
|
|||||||
? _value.orderType
|
? _value.orderType
|
||||||
: orderType // ignore: cast_nullable_to_non_nullable
|
: orderType // ignore: cast_nullable_to_non_nullable
|
||||||
as OrderType,
|
as OrderType,
|
||||||
tableNumber: null == tableNumber
|
table: freezed == table
|
||||||
? _value.tableNumber
|
? _value.table
|
||||||
: tableNumber // ignore: cast_nullable_to_non_nullable
|
: table // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as TableModel,
|
||||||
paymentMethod: null == paymentMethod
|
paymentMethod: null == paymentMethod
|
||||||
? _value.paymentMethod
|
? _value.paymentMethod
|
||||||
: paymentMethod // ignore: cast_nullable_to_non_nullable
|
: paymentMethod // ignore: cast_nullable_to_non_nullable
|
||||||
@ -622,7 +585,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
{required final List<ProductQuantity> items,
|
{required final List<ProductQuantity> items,
|
||||||
required this.customerName,
|
required this.customerName,
|
||||||
required this.orderType,
|
required this.orderType,
|
||||||
required this.tableNumber,
|
required this.table,
|
||||||
required this.paymentMethod})
|
required this.paymentMethod})
|
||||||
: _items = items;
|
: _items = items;
|
||||||
|
|
||||||
@ -639,13 +602,13 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
@override
|
@override
|
||||||
final OrderType orderType;
|
final OrderType orderType;
|
||||||
@override
|
@override
|
||||||
final String tableNumber;
|
final TableModel table;
|
||||||
@override
|
@override
|
||||||
final PaymentMethod paymentMethod;
|
final PaymentMethod paymentMethod;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'OrderFormEvent.createWithPayment(items: $items, customerName: $customerName, orderType: $orderType, tableNumber: $tableNumber, paymentMethod: $paymentMethod)';
|
return 'OrderFormEvent.createWithPayment(items: $items, customerName: $customerName, orderType: $orderType, table: $table, paymentMethod: $paymentMethod)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -658,8 +621,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
other.customerName == customerName) &&
|
other.customerName == customerName) &&
|
||||||
(identical(other.orderType, orderType) ||
|
(identical(other.orderType, orderType) ||
|
||||||
other.orderType == orderType) &&
|
other.orderType == orderType) &&
|
||||||
(identical(other.tableNumber, tableNumber) ||
|
const DeepCollectionEquality().equals(other.table, table) &&
|
||||||
other.tableNumber == tableNumber) &&
|
|
||||||
(identical(other.paymentMethod, paymentMethod) ||
|
(identical(other.paymentMethod, paymentMethod) ||
|
||||||
other.paymentMethod == paymentMethod));
|
other.paymentMethod == paymentMethod));
|
||||||
}
|
}
|
||||||
@ -670,7 +632,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
const DeepCollectionEquality().hash(_items),
|
const DeepCollectionEquality().hash(_items),
|
||||||
customerName,
|
customerName,
|
||||||
orderType,
|
orderType,
|
||||||
tableNumber,
|
const DeepCollectionEquality().hash(table),
|
||||||
paymentMethod);
|
paymentMethod);
|
||||||
|
|
||||||
/// Create a copy of OrderFormEvent
|
/// Create a copy of OrderFormEvent
|
||||||
@ -687,21 +649,17 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)
|
OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
required TResult Function() refund,
|
required TResult Function() refund,
|
||||||
}) {
|
}) {
|
||||||
return createWithPayment(
|
return createWithPayment(
|
||||||
items, customerName, orderType, tableNumber, paymentMethod);
|
items, customerName, orderType, table, paymentMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -709,21 +667,17 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
TResult? Function()? refund,
|
TResult? Function()? refund,
|
||||||
}) {
|
}) {
|
||||||
return createWithPayment?.call(
|
return createWithPayment?.call(
|
||||||
items, customerName, orderType, tableNumber, paymentMethod);
|
items, customerName, orderType, table, paymentMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -731,14 +685,10 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -747,7 +697,7 @@ class _$CreateWithPaymentMethodImpl implements _CreateWithPaymentMethod {
|
|||||||
}) {
|
}) {
|
||||||
if (createWithPayment != null) {
|
if (createWithPayment != null) {
|
||||||
return createWithPayment(
|
return createWithPayment(
|
||||||
items, customerName, orderType, tableNumber, paymentMethod);
|
items, customerName, orderType, table, paymentMethod);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
@ -801,14 +751,14 @@ abstract class _CreateWithPaymentMethod implements OrderFormEvent {
|
|||||||
{required final List<ProductQuantity> items,
|
{required final List<ProductQuantity> items,
|
||||||
required final String customerName,
|
required final String customerName,
|
||||||
required final OrderType orderType,
|
required final OrderType orderType,
|
||||||
required final String tableNumber,
|
required final TableModel table,
|
||||||
required final PaymentMethod paymentMethod}) =
|
required final PaymentMethod paymentMethod}) =
|
||||||
_$CreateWithPaymentMethodImpl;
|
_$CreateWithPaymentMethodImpl;
|
||||||
|
|
||||||
List<ProductQuantity> get items;
|
List<ProductQuantity> get items;
|
||||||
String get customerName;
|
String get customerName;
|
||||||
OrderType get orderType;
|
OrderType get orderType;
|
||||||
String get tableNumber;
|
TableModel get table;
|
||||||
PaymentMethod get paymentMethod;
|
PaymentMethod get paymentMethod;
|
||||||
|
|
||||||
/// Create a copy of OrderFormEvent
|
/// Create a copy of OrderFormEvent
|
||||||
@ -888,14 +838,10 @@ class _$ToggleItemImpl implements _ToggleItem {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)
|
OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
@ -909,14 +855,10 @@ class _$ToggleItemImpl implements _ToggleItem {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -930,14 +872,10 @@ class _$ToggleItemImpl implements _ToggleItem {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -1078,14 +1016,10 @@ class _$ToggleSelectAllImpl implements _ToggleSelectAll {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)
|
OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
@ -1099,14 +1033,10 @@ class _$ToggleSelectAllImpl implements _ToggleSelectAll {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -1120,14 +1050,10 @@ class _$ToggleSelectAllImpl implements _ToggleSelectAll {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -1239,14 +1165,10 @@ class _$RefundImpl implements _Refund {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(Order order) started,
|
required TResult Function(Order order) started,
|
||||||
required TResult Function(List<ProductQuantity> items, String customerName,
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)
|
OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
required TResult Function(OrderItem item) toggleItem,
|
required TResult Function(OrderItem item) toggleItem,
|
||||||
required TResult Function(bool selectAll) toggleSelectAll,
|
required TResult Function(bool selectAll) toggleSelectAll,
|
||||||
@ -1260,14 +1182,10 @@ class _$RefundImpl implements _Refund {
|
|||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(Order order)? started,
|
TResult? Function(Order order)? started,
|
||||||
TResult? Function(List<ProductQuantity> items, String customerName,
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult? Function(OrderItem item)? toggleItem,
|
TResult? Function(OrderItem item)? toggleItem,
|
||||||
TResult? Function(bool selectAll)? toggleSelectAll,
|
TResult? Function(bool selectAll)? toggleSelectAll,
|
||||||
@ -1281,14 +1199,10 @@ class _$RefundImpl implements _Refund {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(Order order)? started,
|
TResult Function(Order order)? started,
|
||||||
TResult Function(List<ProductQuantity> items, String customerName,
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
OrderType orderType, String tableNumber)?
|
OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(List<ProductQuantity> items, String customerName,
|
||||||
List<ProductQuantity> items,
|
OrderType orderType, TableModel table, PaymentMethod paymentMethod)?
|
||||||
String customerName,
|
|
||||||
OrderType orderType,
|
|
||||||
String tableNumber,
|
|
||||||
PaymentMethod paymentMethod)?
|
|
||||||
createWithPayment,
|
createWithPayment,
|
||||||
TResult Function(OrderItem item)? toggleItem,
|
TResult Function(OrderItem item)? toggleItem,
|
||||||
TResult Function(bool selectAll)? toggleSelectAll,
|
TResult Function(bool selectAll)? toggleSelectAll,
|
||||||
|
|||||||
@ -7,13 +7,13 @@ class OrderFormEvent with _$OrderFormEvent {
|
|||||||
required List<ProductQuantity> items,
|
required List<ProductQuantity> items,
|
||||||
required String customerName,
|
required String customerName,
|
||||||
required OrderType orderType,
|
required OrderType orderType,
|
||||||
required String tableNumber,
|
required TableModel table,
|
||||||
}) = _Create;
|
}) = _Create;
|
||||||
const factory OrderFormEvent.createWithPayment({
|
const factory OrderFormEvent.createWithPayment({
|
||||||
required List<ProductQuantity> items,
|
required List<ProductQuantity> items,
|
||||||
required String customerName,
|
required String customerName,
|
||||||
required OrderType orderType,
|
required OrderType orderType,
|
||||||
required String tableNumber,
|
required TableModel table,
|
||||||
required PaymentMethod paymentMethod,
|
required PaymentMethod paymentMethod,
|
||||||
}) = _CreateWithPaymentMethod;
|
}) = _CreateWithPaymentMethod;
|
||||||
const factory OrderFormEvent.toggleItem(OrderItem item) = _ToggleItem;
|
const factory OrderFormEvent.toggleItem(OrderItem item) = _ToggleItem;
|
||||||
|
|||||||
@ -35,6 +35,9 @@ class _PaymentSaveDialogState extends State<PaymentSaveDialog> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
context
|
||||||
|
.read<GetTableStatusBloc>()
|
||||||
|
.add(GetTableStatusEvent.getTablesStatus('available'));
|
||||||
if (widget.selectedTable != null) {
|
if (widget.selectedTable != null) {
|
||||||
selectTable = widget.selectedTable;
|
selectTable = widget.selectedTable;
|
||||||
}
|
}
|
||||||
@ -67,7 +70,10 @@ class _PaymentSaveDialogState extends State<PaymentSaveDialog> {
|
|||||||
BlocBuilder<GetTableStatusBloc, GetTableStatusState>(
|
BlocBuilder<GetTableStatusBloc, GetTableStatusState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return state.maybeWhen(
|
return state.maybeWhen(
|
||||||
orElse: () => const CircularProgressIndicator(),
|
orElse: () =>
|
||||||
|
Center(child: const CircularProgressIndicator()),
|
||||||
|
loading: () =>
|
||||||
|
Center(child: const CircularProgressIndicator()),
|
||||||
success: (tables) {
|
success: (tables) {
|
||||||
final availableTables = tables;
|
final availableTables = tables;
|
||||||
|
|
||||||
@ -106,7 +112,10 @@ class _PaymentSaveDialogState extends State<PaymentSaveDialog> {
|
|||||||
child: DropdownButtonHideUnderline(
|
child: DropdownButtonHideUnderline(
|
||||||
child: DropdownButton<TableModel>(
|
child: DropdownButton<TableModel>(
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
value: selectTable,
|
value: availableTables.firstWhere(
|
||||||
|
(t) => t.id == selectTable?.id,
|
||||||
|
orElse: () => availableTables.first,
|
||||||
|
),
|
||||||
onChanged: (TableModel? newValue) {
|
onChanged: (TableModel? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectTable = newValue;
|
selectTable = newValue;
|
||||||
@ -152,7 +161,7 @@ class _PaymentSaveDialogState extends State<PaymentSaveDialog> {
|
|||||||
items: widget.items,
|
items: widget.items,
|
||||||
customerName: widget.customerName,
|
customerName: widget.customerName,
|
||||||
orderType: widget.orderType,
|
orderType: widget.orderType,
|
||||||
tableNumber: selectTable!.tableName.toString(),
|
table: selectTable!,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -4,6 +4,7 @@ class OrderRequestModel {
|
|||||||
final String? outletId;
|
final String? outletId;
|
||||||
final String? userId;
|
final String? userId;
|
||||||
final String? tableNumber;
|
final String? tableNumber;
|
||||||
|
final String? tableId;
|
||||||
final String? orderType;
|
final String? orderType;
|
||||||
final String? notes;
|
final String? notes;
|
||||||
final List<OrderItemRequest>? orderItems;
|
final List<OrderItemRequest>? orderItems;
|
||||||
@ -13,6 +14,7 @@ class OrderRequestModel {
|
|||||||
this.outletId,
|
this.outletId,
|
||||||
this.userId,
|
this.userId,
|
||||||
this.tableNumber,
|
this.tableNumber,
|
||||||
|
this.tableId,
|
||||||
this.orderType,
|
this.orderType,
|
||||||
this.notes,
|
this.notes,
|
||||||
this.orderItems,
|
this.orderItems,
|
||||||
@ -29,6 +31,7 @@ class OrderRequestModel {
|
|||||||
outletId: json["outlet_id"],
|
outletId: json["outlet_id"],
|
||||||
userId: json["user_id"],
|
userId: json["user_id"],
|
||||||
tableNumber: json["table_number"],
|
tableNumber: json["table_number"],
|
||||||
|
tableId: json["table_id"],
|
||||||
orderType: json["order_type"],
|
orderType: json["order_type"],
|
||||||
notes: json["notes"],
|
notes: json["notes"],
|
||||||
orderItems: json["order_items"] == null
|
orderItems: json["order_items"] == null
|
||||||
@ -42,6 +45,7 @@ class OrderRequestModel {
|
|||||||
"outlet_id": outletId,
|
"outlet_id": outletId,
|
||||||
"user_id": userId,
|
"user_id": userId,
|
||||||
"table_number": tableNumber,
|
"table_number": tableNumber,
|
||||||
|
"table_id": tableId,
|
||||||
"order_type": orderType,
|
"order_type": orderType,
|
||||||
"notes": notes,
|
"notes": notes,
|
||||||
"order_items": orderItems == null
|
"order_items": orderItems == null
|
||||||
|
|||||||
@ -16,7 +16,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:enaklo_pos/core/extensions/int_ext.dart';
|
import 'package:enaklo_pos/core/extensions/int_ext.dart';
|
||||||
import 'package:enaklo_pos/core/extensions/string_ext.dart';
|
import 'package:enaklo_pos/core/extensions/string_ext.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/bloc/get_table_status/get_table_status_bloc.dart';
|
|
||||||
import 'package:enaklo_pos/presentation/home/bloc/payment_methods/payment_methods_bloc.dart';
|
import 'package:enaklo_pos/presentation/home/bloc/payment_methods/payment_methods_bloc.dart';
|
||||||
import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart';
|
import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart';
|
||||||
|
|
||||||
@ -62,9 +61,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// Fetch available tables by default
|
// Fetch available tables by default
|
||||||
context
|
|
||||||
.read<GetTableStatusBloc>()
|
|
||||||
.add(GetTableStatusEvent.getTablesStatus('available'));
|
|
||||||
context
|
context
|
||||||
.read<PaymentMethodsBloc>()
|
.read<PaymentMethodsBloc>()
|
||||||
.add(PaymentMethodsEvent.fetchPaymentMethods());
|
.add(PaymentMethodsEvent.fetchPaymentMethods());
|
||||||
@ -928,9 +925,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
customerController
|
customerController
|
||||||
.text,
|
.text,
|
||||||
orderType: orderType,
|
orderType: orderType,
|
||||||
tableNumber: widget.table
|
table: widget.table!,
|
||||||
?.tableName ??
|
|
||||||
'',
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -134,7 +134,7 @@ class HomeRightTitle extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
label: table == null ? 'Pilih Meja' : '${table!.id}',
|
label: table == null ? 'Pilih Meja' : '${table!.tableName}',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -152,8 +152,7 @@ class SuccessSaveOrderPage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Button.outlined(
|
child: Button.outlined(
|
||||||
onPressed: () =>
|
onPressed: () => context.push(DashboardPage()),
|
||||||
context.pushReplacement(DashboardPage()),
|
|
||||||
label: 'Kembali',
|
label: 'Kembali',
|
||||||
height: 44,
|
height: 44,
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user