Compare commits
No commits in common. "092e68615cc1142cc7eb9d2031ea8f536dd37547" and "d7cd6ce4f25d44d0d31af9f132693796468196ea" have entirely different histories.
092e68615c
...
d7cd6ce4f2
@ -15,7 +15,6 @@ import 'package:enaklo_pos/data/models/response/summary_response_model.dart';
|
|||||||
import 'package:enaklo_pos/presentation/home/models/order_model.dart';
|
import 'package:enaklo_pos/presentation/home/models/order_model.dart';
|
||||||
import 'package:enaklo_pos/presentation/home/models/order_request.dart';
|
import 'package:enaklo_pos/presentation/home/models/order_request.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
|
|
||||||
class OrderRemoteDatasource {
|
class OrderRemoteDatasource {
|
||||||
final Dio dio = DioClient.instance;
|
final Dio dio = DioClient.instance;
|
||||||
@ -196,8 +195,7 @@ class OrderRemoteDatasource {
|
|||||||
|
|
||||||
// New Api
|
// New Api
|
||||||
Future<Either<String, OrderDetailResponseModel>> createOrder(
|
Future<Either<String, OrderDetailResponseModel>> createOrder(
|
||||||
OrderRequestModel orderModel,
|
OrderRequestModel orderModel) async {
|
||||||
) async {
|
|
||||||
final authData = await AuthLocalDataSource().getAuthData();
|
final authData = await AuthLocalDataSource().getAuthData();
|
||||||
final url = '${Variables.baseUrl}/api/v1/orders';
|
final url = '${Variables.baseUrl}/api/v1/orders';
|
||||||
|
|
||||||
@ -264,13 +262,10 @@ class OrderRemoteDatasource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Either<String, OrderResponseModel>> getOrder({
|
Future<Either<String, OrderResponseModel>> getOrder(
|
||||||
int page = 1,
|
{int page = 1,
|
||||||
int limit = Variables.defaultLimit,
|
int limit = Variables.defaultLimit,
|
||||||
String status = 'completed',
|
String status = 'completed'}) async {
|
||||||
required DateTime dateFrom,
|
|
||||||
required DateTime dateTo,
|
|
||||||
}) async {
|
|
||||||
try {
|
try {
|
||||||
final authData = await AuthLocalDataSource().getAuthData();
|
final authData = await AuthLocalDataSource().getAuthData();
|
||||||
final response = await dio.get(
|
final response = await dio.get(
|
||||||
@ -279,8 +274,7 @@ class OrderRemoteDatasource {
|
|||||||
'page': page,
|
'page': page,
|
||||||
'limit': limit,
|
'limit': limit,
|
||||||
'status': status,
|
'status': status,
|
||||||
'date_from': DateFormat('dd-MM-yyyy').format(dateFrom),
|
'outlet_id': authData.user?.outletId,
|
||||||
'date_to': DateFormat('dd-MM-yyyy').format(dateTo),
|
|
||||||
},
|
},
|
||||||
options: Options(
|
options: Options(
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@ -35,8 +35,8 @@ class OrderFormBloc extends Bloc<OrderFormEvent, OrderFormState> {
|
|||||||
customerName: event.customerName,
|
customerName: event.customerName,
|
||||||
notes: '',
|
notes: '',
|
||||||
orderType: event.orderType.name,
|
orderType: event.orderType.name,
|
||||||
tableId: event.table?.id,
|
tableId: event.table.id,
|
||||||
tableNumber: event.table?.tableName,
|
tableNumber: event.table.tableName,
|
||||||
outletId: userData.user?.outletId,
|
outletId: userData.user?.outletId,
|
||||||
customerId: event.customer?.id ?? '',
|
customerId: event.customer?.id ?? '',
|
||||||
orderItems: event.items
|
orderItems: event.items
|
||||||
|
|||||||
@ -20,7 +20,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)
|
Customer? customer, OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -46,7 +46,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -69,7 +69,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -219,7 +219,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)
|
Customer? customer, OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -248,7 +248,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -274,7 +274,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -372,7 +372,7 @@ abstract class _$$CreateImplCopyWith<$Res> {
|
|||||||
String customerName,
|
String customerName,
|
||||||
Customer? customer,
|
Customer? customer,
|
||||||
OrderType orderType,
|
OrderType orderType,
|
||||||
TableModel? table});
|
TableModel table});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -392,7 +392,7 @@ class __$$CreateImplCopyWithImpl<$Res>
|
|||||||
Object? customerName = null,
|
Object? customerName = null,
|
||||||
Object? customer = freezed,
|
Object? customer = freezed,
|
||||||
Object? orderType = null,
|
Object? orderType = null,
|
||||||
Object? table = freezed,
|
Object? table = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$CreateImpl(
|
return _then(_$CreateImpl(
|
||||||
items: null == items
|
items: null == items
|
||||||
@ -411,10 +411,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,
|
||||||
table: freezed == table
|
table: null == table
|
||||||
? _value.table
|
? _value.table
|
||||||
: table // ignore: cast_nullable_to_non_nullable
|
: table // ignore: cast_nullable_to_non_nullable
|
||||||
as TableModel?,
|
as TableModel,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -445,7 +445,7 @@ class _$CreateImpl implements _Create {
|
|||||||
@override
|
@override
|
||||||
final OrderType orderType;
|
final OrderType orderType;
|
||||||
@override
|
@override
|
||||||
final TableModel? table;
|
final TableModel table;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
@ -489,7 +489,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)
|
Customer? customer, OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -518,7 +518,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -544,7 +544,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -625,13 +625,13 @@ abstract class _Create implements OrderFormEvent {
|
|||||||
required final String customerName,
|
required final String customerName,
|
||||||
required final Customer? customer,
|
required final Customer? customer,
|
||||||
required final OrderType orderType,
|
required final OrderType orderType,
|
||||||
required final TableModel? table}) = _$CreateImpl;
|
required final TableModel table}) = _$CreateImpl;
|
||||||
|
|
||||||
List<ProductQuantity> get items;
|
List<ProductQuantity> get items;
|
||||||
String get customerName;
|
String get customerName;
|
||||||
Customer? get customer;
|
Customer? get customer;
|
||||||
OrderType get orderType;
|
OrderType get orderType;
|
||||||
TableModel? get table;
|
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.
|
||||||
@ -783,7 +783,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)
|
Customer? customer, OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -813,7 +813,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -840,7 +840,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1027,7 +1027,7 @@ class _$AddToOrderImpl implements _AddToOrder {
|
|||||||
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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)
|
Customer? customer, OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1056,7 +1056,7 @@ class _$AddToOrderImpl implements _AddToOrder {
|
|||||||
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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1082,7 +1082,7 @@ class _$AddToOrderImpl implements _AddToOrder {
|
|||||||
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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1269,7 +1269,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)
|
Customer? customer, OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1298,7 +1298,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1324,7 +1324,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1513,7 +1513,7 @@ class _$VoidOrderImpl implements _VoidOrder {
|
|||||||
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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)
|
Customer? customer, OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1542,7 +1542,7 @@ class _$VoidOrderImpl implements _VoidOrder {
|
|||||||
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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1568,7 +1568,7 @@ class _$VoidOrderImpl implements _VoidOrder {
|
|||||||
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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1730,7 +1730,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)
|
Customer? customer, OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1759,7 +1759,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1785,7 +1785,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1944,7 +1944,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)
|
Customer? customer, OrderType orderType, TableModel table)
|
||||||
create,
|
create,
|
||||||
required TResult Function(
|
required TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1973,7 +1973,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult? Function(
|
TResult? Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
@ -1999,7 +1999,7 @@ 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,
|
||||||
Customer? customer, OrderType orderType, TableModel? table)?
|
Customer? customer, OrderType orderType, TableModel table)?
|
||||||
create,
|
create,
|
||||||
TResult Function(
|
TResult Function(
|
||||||
List<ProductQuantity> items,
|
List<ProductQuantity> items,
|
||||||
|
|||||||
@ -8,7 +8,7 @@ class OrderFormEvent with _$OrderFormEvent {
|
|||||||
required String customerName,
|
required String customerName,
|
||||||
required Customer? customer,
|
required Customer? customer,
|
||||||
required OrderType orderType,
|
required OrderType orderType,
|
||||||
required TableModel? table,
|
required TableModel table,
|
||||||
}) = _Create;
|
}) = _Create;
|
||||||
const factory OrderFormEvent.createWithPayment({
|
const factory OrderFormEvent.createWithPayment({
|
||||||
required List<ProductQuantity> items,
|
required List<ProductQuantity> items,
|
||||||
|
|||||||
@ -26,13 +26,9 @@ class _PaymentAddOrderDialogState extends State<PaymentAddOrderDialog> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
context.read<OrderLoaderBloc>().add(
|
context
|
||||||
OrderLoaderEvent.getByStatus(
|
.read<OrderLoaderBloc>()
|
||||||
'pending',
|
.add(OrderLoaderEvent.getByStatus('pending'));
|
||||||
dateFrom: DateTime.now(),
|
|
||||||
dateTo: DateTime.now(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class OrderRequestModel {
|
|||||||
"customer_name": customerName,
|
"customer_name": customerName,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (customerId != null && customerId != "") {
|
if (customerId != null || customerId != "") {
|
||||||
data["customer_id"] = customerId;
|
data["customer_id"] = customerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -921,7 +921,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|||||||
customerController
|
customerController
|
||||||
.text,
|
.text,
|
||||||
orderType: orderType,
|
orderType: orderType,
|
||||||
table: widget.table,
|
table: widget.table!,
|
||||||
customer:
|
customer:
|
||||||
selectedCustomer,
|
selectedCustomer,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -14,11 +14,7 @@ class OrderLoaderBloc extends Bloc<OrderLoaderEvent, OrderLoaderState> {
|
|||||||
on<_GetByStatus>((event, emit) async {
|
on<_GetByStatus>((event, emit) async {
|
||||||
emit(const _Loading());
|
emit(const _Loading());
|
||||||
final result = await _orderRemoteDatasource.getOrder(
|
final result = await _orderRemoteDatasource.getOrder(
|
||||||
status: event.status,
|
status: event.status, limit: 20);
|
||||||
limit: 20,
|
|
||||||
dateFrom: event.dateFrom,
|
|
||||||
dateTo: event.dateTo,
|
|
||||||
);
|
|
||||||
result.fold(
|
result.fold(
|
||||||
(l) => emit(_Error(l)),
|
(l) => emit(_Error(l)),
|
||||||
(r) => emit(_Loaded(
|
(r) => emit(_Loaded(
|
||||||
|
|||||||
@ -18,22 +18,19 @@ final _privateConstructorUsedError = UnsupportedError(
|
|||||||
mixin _$OrderLoaderEvent {
|
mixin _$OrderLoaderEvent {
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(String status, DateTime dateFrom, DateTime dateTo)
|
required TResult Function(String status) getByStatus,
|
||||||
getByStatus,
|
|
||||||
required TResult Function(String id) getById,
|
required TResult Function(String id) getById,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(String status, DateTime dateFrom, DateTime dateTo)?
|
TResult? Function(String status)? getByStatus,
|
||||||
getByStatus,
|
|
||||||
TResult? Function(String id)? getById,
|
TResult? Function(String id)? getById,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(String status, DateTime dateFrom, DateTime dateTo)?
|
TResult Function(String status)? getByStatus,
|
||||||
getByStatus,
|
|
||||||
TResult Function(String id)? getById,
|
TResult Function(String id)? getById,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
@ -86,7 +83,7 @@ abstract class _$$GetByStatusImplCopyWith<$Res> {
|
|||||||
_$GetByStatusImpl value, $Res Function(_$GetByStatusImpl) then) =
|
_$GetByStatusImpl value, $Res Function(_$GetByStatusImpl) then) =
|
||||||
__$$GetByStatusImplCopyWithImpl<$Res>;
|
__$$GetByStatusImplCopyWithImpl<$Res>;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({String status, DateTime dateFrom, DateTime dateTo});
|
$Res call({String status});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -103,22 +100,12 @@ class __$$GetByStatusImplCopyWithImpl<$Res>
|
|||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? status = null,
|
Object? status = null,
|
||||||
Object? dateFrom = null,
|
|
||||||
Object? dateTo = null,
|
|
||||||
}) {
|
}) {
|
||||||
return _then(_$GetByStatusImpl(
|
return _then(_$GetByStatusImpl(
|
||||||
null == status
|
null == status
|
||||||
? _value.status
|
? _value.status
|
||||||
: status // ignore: cast_nullable_to_non_nullable
|
: status // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
dateFrom: null == dateFrom
|
|
||||||
? _value.dateFrom
|
|
||||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime,
|
|
||||||
dateTo: null == dateTo
|
|
||||||
? _value.dateTo
|
|
||||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
|
||||||
as DateTime,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,19 +113,14 @@ class __$$GetByStatusImplCopyWithImpl<$Res>
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
||||||
class _$GetByStatusImpl implements _GetByStatus {
|
class _$GetByStatusImpl implements _GetByStatus {
|
||||||
const _$GetByStatusImpl(this.status,
|
const _$GetByStatusImpl(this.status);
|
||||||
{required this.dateFrom, required this.dateTo});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String status;
|
final String status;
|
||||||
@override
|
|
||||||
final DateTime dateFrom;
|
|
||||||
@override
|
|
||||||
final DateTime dateTo;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'OrderLoaderEvent.getByStatus(status: $status, dateFrom: $dateFrom, dateTo: $dateTo)';
|
return 'OrderLoaderEvent.getByStatus(status: $status)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -146,14 +128,11 @@ class _$GetByStatusImpl implements _GetByStatus {
|
|||||||
return identical(this, other) ||
|
return identical(this, other) ||
|
||||||
(other.runtimeType == runtimeType &&
|
(other.runtimeType == runtimeType &&
|
||||||
other is _$GetByStatusImpl &&
|
other is _$GetByStatusImpl &&
|
||||||
(identical(other.status, status) || other.status == status) &&
|
(identical(other.status, status) || other.status == status));
|
||||||
(identical(other.dateFrom, dateFrom) ||
|
|
||||||
other.dateFrom == dateFrom) &&
|
|
||||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType, status, dateFrom, dateTo);
|
int get hashCode => Object.hash(runtimeType, status);
|
||||||
|
|
||||||
/// Create a copy of OrderLoaderEvent
|
/// Create a copy of OrderLoaderEvent
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -166,33 +145,30 @@ class _$GetByStatusImpl implements _GetByStatus {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(String status, DateTime dateFrom, DateTime dateTo)
|
required TResult Function(String status) getByStatus,
|
||||||
getByStatus,
|
|
||||||
required TResult Function(String id) getById,
|
required TResult Function(String id) getById,
|
||||||
}) {
|
}) {
|
||||||
return getByStatus(status, dateFrom, dateTo);
|
return getByStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(String status, DateTime dateFrom, DateTime dateTo)?
|
TResult? Function(String status)? getByStatus,
|
||||||
getByStatus,
|
|
||||||
TResult? Function(String id)? getById,
|
TResult? Function(String id)? getById,
|
||||||
}) {
|
}) {
|
||||||
return getByStatus?.call(status, dateFrom, dateTo);
|
return getByStatus?.call(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(String status, DateTime dateFrom, DateTime dateTo)?
|
TResult Function(String status)? getByStatus,
|
||||||
getByStatus,
|
|
||||||
TResult Function(String id)? getById,
|
TResult Function(String id)? getById,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (getByStatus != null) {
|
if (getByStatus != null) {
|
||||||
return getByStatus(status, dateFrom, dateTo);
|
return getByStatus(status);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
@ -230,13 +206,9 @@ class _$GetByStatusImpl implements _GetByStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class _GetByStatus implements OrderLoaderEvent {
|
abstract class _GetByStatus implements OrderLoaderEvent {
|
||||||
const factory _GetByStatus(final String status,
|
const factory _GetByStatus(final String status) = _$GetByStatusImpl;
|
||||||
{required final DateTime dateFrom,
|
|
||||||
required final DateTime dateTo}) = _$GetByStatusImpl;
|
|
||||||
|
|
||||||
String get status;
|
String get status;
|
||||||
DateTime get dateFrom;
|
|
||||||
DateTime get dateTo;
|
|
||||||
|
|
||||||
/// Create a copy of OrderLoaderEvent
|
/// Create a copy of OrderLoaderEvent
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -313,8 +285,7 @@ class _$GetByIdImpl implements _GetById {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(String status, DateTime dateFrom, DateTime dateTo)
|
required TResult Function(String status) getByStatus,
|
||||||
getByStatus,
|
|
||||||
required TResult Function(String id) getById,
|
required TResult Function(String id) getById,
|
||||||
}) {
|
}) {
|
||||||
return getById(id);
|
return getById(id);
|
||||||
@ -323,8 +294,7 @@ class _$GetByIdImpl implements _GetById {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
TResult? Function(String status, DateTime dateFrom, DateTime dateTo)?
|
TResult? Function(String status)? getByStatus,
|
||||||
getByStatus,
|
|
||||||
TResult? Function(String id)? getById,
|
TResult? Function(String id)? getById,
|
||||||
}) {
|
}) {
|
||||||
return getById?.call(id);
|
return getById?.call(id);
|
||||||
@ -333,8 +303,7 @@ class _$GetByIdImpl implements _GetById {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(String status, DateTime dateFrom, DateTime dateTo)?
|
TResult Function(String status)? getByStatus,
|
||||||
getByStatus,
|
|
||||||
TResult Function(String id)? getById,
|
TResult Function(String id)? getById,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@ -2,10 +2,6 @@ part of 'order_loader_bloc.dart';
|
|||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class OrderLoaderEvent with _$OrderLoaderEvent {
|
class OrderLoaderEvent with _$OrderLoaderEvent {
|
||||||
const factory OrderLoaderEvent.getByStatus(
|
const factory OrderLoaderEvent.getByStatus(String status) = _GetByStatus;
|
||||||
String status, {
|
|
||||||
required DateTime dateFrom,
|
|
||||||
required DateTime dateTo,
|
|
||||||
}) = _GetByStatus;
|
|
||||||
const factory OrderLoaderEvent.getById(String id) = _GetById;
|
const factory OrderLoaderEvent.getById(String id) = _GetById;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,13 +125,9 @@ class _RefundDialogState extends State<RefundDialog> {
|
|||||||
successMsg: () {
|
successMsg: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
AppFlushbar.showSuccess(context, 'Refund Berhasil!');
|
AppFlushbar.showSuccess(context, 'Refund Berhasil!');
|
||||||
context.read<OrderLoaderBloc>().add(
|
context
|
||||||
OrderLoaderEvent.getByStatus(
|
.read<OrderLoaderBloc>()
|
||||||
'completed',
|
.add(OrderLoaderEvent.getByStatus('completed'));
|
||||||
dateFrom: DateTime.now(),
|
|
||||||
dateTo: DateTime.now(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
error: (msg) {
|
error: (msg) {
|
||||||
AppFlushbar.showError(context, msg);
|
AppFlushbar.showError(context, msg);
|
||||||
|
|||||||
@ -125,13 +125,9 @@ class _VoidDialogState extends State<VoidDialog> {
|
|||||||
successMsg: () {
|
successMsg: () {
|
||||||
context.pop();
|
context.pop();
|
||||||
AppFlushbar.showSuccess(context, 'Void berhasil!');
|
AppFlushbar.showSuccess(context, 'Void berhasil!');
|
||||||
context.read<OrderLoaderBloc>().add(
|
context
|
||||||
OrderLoaderEvent.getByStatus(
|
.read<OrderLoaderBloc>()
|
||||||
'pending',
|
.add(OrderLoaderEvent.getByStatus('pending'));
|
||||||
dateFrom: DateTime.now(),
|
|
||||||
dateTo: DateTime.now(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
error: (msg) {
|
error: (msg) {
|
||||||
AppFlushbar.showError(context, msg);
|
AppFlushbar.showError(context, msg);
|
||||||
|
|||||||
@ -37,10 +37,9 @@ class _SalesPageState extends State<SalesPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
context.read<OrderLoaderBloc>().add(OrderLoaderEvent.getByStatus(
|
context
|
||||||
widget.status,
|
.read<OrderLoaderBloc>()
|
||||||
dateFrom: startDate,
|
.add(OrderLoaderEvent.getByStatus(widget.status));
|
||||||
dateTo: endDate));
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,9 +85,9 @@ class _SalesPageState extends State<SalesPage> {
|
|||||||
endDate = end;
|
endDate = end;
|
||||||
});
|
});
|
||||||
|
|
||||||
context.read<OrderLoaderBloc>().add(
|
context.read<DaySalesBloc>().add(
|
||||||
OrderLoaderEvent.getByStatus(widget.status,
|
DaySalesEvent.getRangeDateSales(
|
||||||
dateFrom: startDate, dateTo: endDate));
|
startDate, endDate));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user