Printer Local data and remove unused
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/models/response/delivery_response_model.dart';
|
||||
import 'package:enaklo_pos/data/models/response/discount_response_model.dart';
|
||||
import 'package:enaklo_pos/presentation/table/models/draft_order_item.dart';
|
||||
@@ -310,9 +309,9 @@ class CheckoutBloc extends Bloc<CheckoutEvent, CheckoutState> {
|
||||
DateFormat('yyyy-MM-dd HH:mm:ss').format(DateTime.now()),
|
||||
);
|
||||
log("draftOrder12: ${draftOrder.toMapForLocal()}");
|
||||
final orderDraftId =
|
||||
await ProductLocalDatasource.instance.saveDraftOrder(draftOrder);
|
||||
emit(_SavedDraftOrder(orderDraftId));
|
||||
// final orderDraftId =
|
||||
// await ProductLocalDatasource.instance.saveDraftOrder(draftOrder);
|
||||
emit(_SavedDraftOrder(0));
|
||||
});
|
||||
|
||||
//load draft order
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
|
||||
import '../../../../data/models/response/product_response_model.dart';
|
||||
|
||||
part 'local_product_bloc.freezed.dart';
|
||||
part 'local_product_event.dart';
|
||||
part 'local_product_state.dart';
|
||||
|
||||
class LocalProductBloc extends Bloc<LocalProductEvent, LocalProductState> {
|
||||
final ProductLocalDatasource productLocalDatasource;
|
||||
LocalProductBloc(
|
||||
this.productLocalDatasource,
|
||||
) : super(const _Initial()) {
|
||||
on<_GetLocalProduct>((event, emit) async {
|
||||
emit(const _Loading());
|
||||
final result = await productLocalDatasource.getProducts();
|
||||
log("Result: ${result.length}");
|
||||
emit(_Loaded(result));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,907 +0,0 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'local_product_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LocalProductEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() getLocalProduct,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? getLocalProduct,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? getLocalProduct,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_GetLocalProduct value) getLocalProduct,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_GetLocalProduct value)? getLocalProduct,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_GetLocalProduct value)? getLocalProduct,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LocalProductEventCopyWith<$Res> {
|
||||
factory $LocalProductEventCopyWith(
|
||||
LocalProductEvent value, $Res Function(LocalProductEvent) then) =
|
||||
_$LocalProductEventCopyWithImpl<$Res, LocalProductEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LocalProductEventCopyWithImpl<$Res, $Val extends LocalProductEvent>
|
||||
implements $LocalProductEventCopyWith<$Res> {
|
||||
_$LocalProductEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LocalProductEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$StartedImplCopyWith<$Res> {
|
||||
factory _$$StartedImplCopyWith(
|
||||
_$StartedImpl value, $Res Function(_$StartedImpl) then) =
|
||||
__$$StartedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$StartedImplCopyWithImpl<$Res>
|
||||
extends _$LocalProductEventCopyWithImpl<$Res, _$StartedImpl>
|
||||
implements _$$StartedImplCopyWith<$Res> {
|
||||
__$$StartedImplCopyWithImpl(
|
||||
_$StartedImpl _value, $Res Function(_$StartedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LocalProductEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$StartedImpl implements _Started {
|
||||
const _$StartedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LocalProductEvent.started()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$StartedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() getLocalProduct,
|
||||
}) {
|
||||
return started();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? getLocalProduct,
|
||||
}) {
|
||||
return started?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? getLocalProduct,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_GetLocalProduct value) getLocalProduct,
|
||||
}) {
|
||||
return started(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_GetLocalProduct value)? getLocalProduct,
|
||||
}) {
|
||||
return started?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_GetLocalProduct value)? getLocalProduct,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Started implements LocalProductEvent {
|
||||
const factory _Started() = _$StartedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$GetLocalProductImplCopyWith<$Res> {
|
||||
factory _$$GetLocalProductImplCopyWith(_$GetLocalProductImpl value,
|
||||
$Res Function(_$GetLocalProductImpl) then) =
|
||||
__$$GetLocalProductImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$GetLocalProductImplCopyWithImpl<$Res>
|
||||
extends _$LocalProductEventCopyWithImpl<$Res, _$GetLocalProductImpl>
|
||||
implements _$$GetLocalProductImplCopyWith<$Res> {
|
||||
__$$GetLocalProductImplCopyWithImpl(
|
||||
_$GetLocalProductImpl _value, $Res Function(_$GetLocalProductImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LocalProductEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$GetLocalProductImpl implements _GetLocalProduct {
|
||||
const _$GetLocalProductImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LocalProductEvent.getLocalProduct()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$GetLocalProductImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() getLocalProduct,
|
||||
}) {
|
||||
return getLocalProduct();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? getLocalProduct,
|
||||
}) {
|
||||
return getLocalProduct?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? getLocalProduct,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (getLocalProduct != null) {
|
||||
return getLocalProduct();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_GetLocalProduct value) getLocalProduct,
|
||||
}) {
|
||||
return getLocalProduct(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_GetLocalProduct value)? getLocalProduct,
|
||||
}) {
|
||||
return getLocalProduct?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_GetLocalProduct value)? getLocalProduct,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (getLocalProduct != null) {
|
||||
return getLocalProduct(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _GetLocalProduct implements LocalProductEvent {
|
||||
const factory _GetLocalProduct() = _$GetLocalProductImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LocalProductState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Product> products) loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Product> products)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Product> products)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LocalProductStateCopyWith<$Res> {
|
||||
factory $LocalProductStateCopyWith(
|
||||
LocalProductState value, $Res Function(LocalProductState) then) =
|
||||
_$LocalProductStateCopyWithImpl<$Res, LocalProductState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LocalProductStateCopyWithImpl<$Res, $Val extends LocalProductState>
|
||||
implements $LocalProductStateCopyWith<$Res> {
|
||||
_$LocalProductStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LocalProductState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InitialImplCopyWith<$Res> {
|
||||
factory _$$InitialImplCopyWith(
|
||||
_$InitialImpl value, $Res Function(_$InitialImpl) then) =
|
||||
__$$InitialImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InitialImplCopyWithImpl<$Res>
|
||||
extends _$LocalProductStateCopyWithImpl<$Res, _$InitialImpl>
|
||||
implements _$$InitialImplCopyWith<$Res> {
|
||||
__$$InitialImplCopyWithImpl(
|
||||
_$InitialImpl _value, $Res Function(_$InitialImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LocalProductState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InitialImpl implements _Initial {
|
||||
const _$InitialImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LocalProductState.initial()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$InitialImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Product> products) loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return initial();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Product> products)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return initial?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Product> products)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
}) {
|
||||
return initial(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
}) {
|
||||
return initial?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Initial implements LocalProductState {
|
||||
const factory _Initial() = _$InitialImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoadingImplCopyWith<$Res> {
|
||||
factory _$$LoadingImplCopyWith(
|
||||
_$LoadingImpl value, $Res Function(_$LoadingImpl) then) =
|
||||
__$$LoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoadingImplCopyWithImpl<$Res>
|
||||
extends _$LocalProductStateCopyWithImpl<$Res, _$LoadingImpl>
|
||||
implements _$$LoadingImplCopyWith<$Res> {
|
||||
__$$LoadingImplCopyWithImpl(
|
||||
_$LoadingImpl _value, $Res Function(_$LoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LocalProductState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadingImpl implements _Loading {
|
||||
const _$LoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LocalProductState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$LoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Product> products) loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Product> products)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Product> products)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Loading implements LocalProductState {
|
||||
const factory _Loading() = _$LoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoadedImplCopyWith<$Res> {
|
||||
factory _$$LoadedImplCopyWith(
|
||||
_$LoadedImpl value, $Res Function(_$LoadedImpl) then) =
|
||||
__$$LoadedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({List<Product> products});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoadedImplCopyWithImpl<$Res>
|
||||
extends _$LocalProductStateCopyWithImpl<$Res, _$LoadedImpl>
|
||||
implements _$$LoadedImplCopyWith<$Res> {
|
||||
__$$LoadedImplCopyWithImpl(
|
||||
_$LoadedImpl _value, $Res Function(_$LoadedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LocalProductState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? products = null,
|
||||
}) {
|
||||
return _then(_$LoadedImpl(
|
||||
null == products
|
||||
? _value._products
|
||||
: products // ignore: cast_nullable_to_non_nullable
|
||||
as List<Product>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadedImpl implements _Loaded {
|
||||
const _$LoadedImpl(final List<Product> products) : _products = products;
|
||||
|
||||
final List<Product> _products;
|
||||
@override
|
||||
List<Product> get products {
|
||||
if (_products is EqualUnmodifiableListView) return _products;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_products);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LocalProductState.loaded(products: $products)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoadedImpl &&
|
||||
const DeepCollectionEquality().equals(other._products, _products));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, const DeepCollectionEquality().hash(_products));
|
||||
|
||||
/// Create a copy of LocalProductState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
||||
__$$LoadedImplCopyWithImpl<_$LoadedImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<Product> products) loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return loaded(products);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<Product> products)? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return loaded?.call(products);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<Product> products)? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(products);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
}) {
|
||||
return loaded(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
}) {
|
||||
return loaded?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Loaded implements LocalProductState {
|
||||
const factory _Loaded(final List<Product> products) = _$LoadedImpl;
|
||||
|
||||
List<Product> get products;
|
||||
|
||||
/// Create a copy of LocalProductState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
||||
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 _$LocalProductStateCopyWithImpl<$Res, _$ErrorImpl>
|
||||
implements _$$ErrorImplCopyWith<$Res> {
|
||||
__$$ErrorImplCopyWithImpl(
|
||||
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LocalProductState
|
||||
/// 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 'LocalProductState.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 LocalProductState
|
||||
/// 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<Product> products) loaded,
|
||||
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<Product> products)? loaded,
|
||||
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<Product> products)? loaded,
|
||||
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(_Loaded value) loaded,
|
||||
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(_Loaded value)? loaded,
|
||||
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(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Error implements LocalProductState {
|
||||
const factory _Error(final String message) = _$ErrorImpl;
|
||||
|
||||
String get message;
|
||||
|
||||
/// Create a copy of LocalProductState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
part of 'local_product_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LocalProductEvent with _$LocalProductEvent {
|
||||
const factory LocalProductEvent.started() = _Started;
|
||||
const factory LocalProductEvent.getLocalProduct() = _GetLocalProduct;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
part of 'local_product_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LocalProductState with _$LocalProductState {
|
||||
const factory LocalProductState.initial() = _Initial;
|
||||
const factory LocalProductState.loading() = _Loading;
|
||||
const factory LocalProductState.loaded(List<Product> products) = _Loaded;
|
||||
const factory LocalProductState.error(String message) = _Error;
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
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/product_local_datasource.dart';
|
||||
|
||||
import '../../models/order_model.dart';
|
||||
import '../../models/product_quantity.dart';
|
||||
@@ -78,13 +77,13 @@ class OrderBloc extends Bloc<OrderEvent, OrderState> {
|
||||
value = false;
|
||||
}
|
||||
int id = 0;
|
||||
if (value) {
|
||||
id = await ProductLocalDatasource.instance
|
||||
.saveOrder(dataInput.copyWith(isSync: 1));
|
||||
} else {
|
||||
id = await ProductLocalDatasource.instance
|
||||
.saveOrder(dataInput.copyWith(isSync: 1));
|
||||
}
|
||||
// if (value) {
|
||||
// id = await ProductLocalDatasource.instance
|
||||
// .saveOrder(dataInput.copyWith(isSync: 1));
|
||||
// } else {
|
||||
// id = await ProductLocalDatasource.instance
|
||||
// .saveOrder(dataInput.copyWith(isSync: 1));
|
||||
// }
|
||||
|
||||
emit(_Loaded(
|
||||
dataInput,
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
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:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'status_table_event.dart';
|
||||
part 'status_table_state.dart';
|
||||
part 'status_table_bloc.freezed.dart';
|
||||
|
||||
class StatusTableBloc extends Bloc<StatusTableEvent, StatusTableState> {
|
||||
final ProductLocalDatasource datasource;
|
||||
StatusTableBloc(this.datasource) : super(StatusTableState.initial()) {
|
||||
on<_StatusTable>((event, emit) async {
|
||||
emit(_Loading());
|
||||
await datasource.updateStatusTable(event.table);
|
||||
emit(_Success());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,725 +0,0 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'status_table_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$StatusTableEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(TableModel table) statusTabel,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(TableModel table)? statusTabel,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(TableModel table)? statusTabel,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_StatusTable value) statusTabel,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_StatusTable value)? statusTabel,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_StatusTable value)? statusTabel,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $StatusTableEventCopyWith<$Res> {
|
||||
factory $StatusTableEventCopyWith(
|
||||
StatusTableEvent value, $Res Function(StatusTableEvent) then) =
|
||||
_$StatusTableEventCopyWithImpl<$Res, StatusTableEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$StatusTableEventCopyWithImpl<$Res, $Val extends StatusTableEvent>
|
||||
implements $StatusTableEventCopyWith<$Res> {
|
||||
_$StatusTableEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of StatusTableEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$StartedImplCopyWith<$Res> {
|
||||
factory _$$StartedImplCopyWith(
|
||||
_$StartedImpl value, $Res Function(_$StartedImpl) then) =
|
||||
__$$StartedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$StartedImplCopyWithImpl<$Res>
|
||||
extends _$StatusTableEventCopyWithImpl<$Res, _$StartedImpl>
|
||||
implements _$$StartedImplCopyWith<$Res> {
|
||||
__$$StartedImplCopyWithImpl(
|
||||
_$StartedImpl _value, $Res Function(_$StartedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of StatusTableEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$StartedImpl implements _Started {
|
||||
const _$StartedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'StatusTableEvent.started()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$StartedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(TableModel table) statusTabel,
|
||||
}) {
|
||||
return started();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(TableModel table)? statusTabel,
|
||||
}) {
|
||||
return started?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(TableModel table)? statusTabel,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_StatusTable value) statusTabel,
|
||||
}) {
|
||||
return started(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_StatusTable value)? statusTabel,
|
||||
}) {
|
||||
return started?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_StatusTable value)? statusTabel,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Started implements StatusTableEvent {
|
||||
const factory _Started() = _$StartedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$StatusTableImplCopyWith<$Res> {
|
||||
factory _$$StatusTableImplCopyWith(
|
||||
_$StatusTableImpl value, $Res Function(_$StatusTableImpl) then) =
|
||||
__$$StatusTableImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({TableModel table});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$StatusTableImplCopyWithImpl<$Res>
|
||||
extends _$StatusTableEventCopyWithImpl<$Res, _$StatusTableImpl>
|
||||
implements _$$StatusTableImplCopyWith<$Res> {
|
||||
__$$StatusTableImplCopyWithImpl(
|
||||
_$StatusTableImpl _value, $Res Function(_$StatusTableImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of StatusTableEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? table = null,
|
||||
}) {
|
||||
return _then(_$StatusTableImpl(
|
||||
null == table
|
||||
? _value.table
|
||||
: table // ignore: cast_nullable_to_non_nullable
|
||||
as TableModel,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$StatusTableImpl implements _StatusTable {
|
||||
const _$StatusTableImpl(this.table);
|
||||
|
||||
@override
|
||||
final TableModel table;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'StatusTableEvent.statusTabel(table: $table)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$StatusTableImpl &&
|
||||
(identical(other.table, table) || other.table == table));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, table);
|
||||
|
||||
/// Create a copy of StatusTableEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$StatusTableImplCopyWith<_$StatusTableImpl> get copyWith =>
|
||||
__$$StatusTableImplCopyWithImpl<_$StatusTableImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(TableModel table) statusTabel,
|
||||
}) {
|
||||
return statusTabel(table);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(TableModel table)? statusTabel,
|
||||
}) {
|
||||
return statusTabel?.call(table);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(TableModel table)? statusTabel,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (statusTabel != null) {
|
||||
return statusTabel(table);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_StatusTable value) statusTabel,
|
||||
}) {
|
||||
return statusTabel(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_StatusTable value)? statusTabel,
|
||||
}) {
|
||||
return statusTabel?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_StatusTable value)? statusTabel,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (statusTabel != null) {
|
||||
return statusTabel(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _StatusTable implements StatusTableEvent {
|
||||
const factory _StatusTable(final TableModel table) = _$StatusTableImpl;
|
||||
|
||||
TableModel get table;
|
||||
|
||||
/// Create a copy of StatusTableEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$StatusTableImplCopyWith<_$StatusTableImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$StatusTableState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function() success,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? success,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function()? success,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Success value) success,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Success value)? success,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Success value)? success,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $StatusTableStateCopyWith<$Res> {
|
||||
factory $StatusTableStateCopyWith(
|
||||
StatusTableState value, $Res Function(StatusTableState) then) =
|
||||
_$StatusTableStateCopyWithImpl<$Res, StatusTableState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$StatusTableStateCopyWithImpl<$Res, $Val extends StatusTableState>
|
||||
implements $StatusTableStateCopyWith<$Res> {
|
||||
_$StatusTableStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of StatusTableState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InitialImplCopyWith<$Res> {
|
||||
factory _$$InitialImplCopyWith(
|
||||
_$InitialImpl value, $Res Function(_$InitialImpl) then) =
|
||||
__$$InitialImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InitialImplCopyWithImpl<$Res>
|
||||
extends _$StatusTableStateCopyWithImpl<$Res, _$InitialImpl>
|
||||
implements _$$InitialImplCopyWith<$Res> {
|
||||
__$$InitialImplCopyWithImpl(
|
||||
_$InitialImpl _value, $Res Function(_$InitialImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of StatusTableState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InitialImpl implements _Initial {
|
||||
const _$InitialImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'StatusTableState.initial()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$InitialImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function() success,
|
||||
}) {
|
||||
return initial();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? success,
|
||||
}) {
|
||||
return initial?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function()? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial();
|
||||
}
|
||||
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,
|
||||
}) {
|
||||
return initial(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Success value)? success,
|
||||
}) {
|
||||
return initial?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Success value)? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Initial implements StatusTableState {
|
||||
const factory _Initial() = _$InitialImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoadingImplCopyWith<$Res> {
|
||||
factory _$$LoadingImplCopyWith(
|
||||
_$LoadingImpl value, $Res Function(_$LoadingImpl) then) =
|
||||
__$$LoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoadingImplCopyWithImpl<$Res>
|
||||
extends _$StatusTableStateCopyWithImpl<$Res, _$LoadingImpl>
|
||||
implements _$$LoadingImplCopyWith<$Res> {
|
||||
__$$LoadingImplCopyWithImpl(
|
||||
_$LoadingImpl _value, $Res Function(_$LoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of StatusTableState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadingImpl implements _Loading {
|
||||
const _$LoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'StatusTableState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$LoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function() success,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? success,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function()? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
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,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Success value)? success,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Success value)? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Loading implements StatusTableState {
|
||||
const factory _Loading() = _$LoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SuccessImplCopyWith<$Res> {
|
||||
factory _$$SuccessImplCopyWith(
|
||||
_$SuccessImpl value, $Res Function(_$SuccessImpl) then) =
|
||||
__$$SuccessImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SuccessImplCopyWithImpl<$Res>
|
||||
extends _$StatusTableStateCopyWithImpl<$Res, _$SuccessImpl>
|
||||
implements _$$SuccessImplCopyWith<$Res> {
|
||||
__$$SuccessImplCopyWithImpl(
|
||||
_$SuccessImpl _value, $Res Function(_$SuccessImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of StatusTableState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SuccessImpl implements _Success {
|
||||
const _$SuccessImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'StatusTableState.success()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SuccessImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function() success,
|
||||
}) {
|
||||
return success();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? success,
|
||||
}) {
|
||||
return success?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function()? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (success != null) {
|
||||
return success();
|
||||
}
|
||||
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,
|
||||
}) {
|
||||
return success(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Success value)? success,
|
||||
}) {
|
||||
return success?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Success value)? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (success != null) {
|
||||
return success(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Success implements StatusTableState {
|
||||
const factory _Success() = _$SuccessImpl;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
part of 'status_table_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class StatusTableEvent with _$StatusTableEvent {
|
||||
const factory StatusTableEvent.started() = _Started;
|
||||
const factory StatusTableEvent.statusTabel(
|
||||
TableModel table,
|
||||
) = _StatusTable;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'status_table_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class StatusTableState with _$StatusTableState {
|
||||
const factory StatusTableState.initial() = _Initial;
|
||||
const factory StatusTableState.loading() = _Loading;
|
||||
const factory StatusTableState.success() = _Success;
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:enaklo_pos/data/datasources/printer/printer_local_datasource.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:enaklo_pos/data/dataoutputs/print_dataoutputs.dart';
|
||||
import 'package:enaklo_pos/data/datasources/auth_local_datasource.dart';
|
||||
import 'package:enaklo_pos/presentation/home/models/product_quantity.dart';
|
||||
import 'package:enaklo_pos/presentation/home/models/order_type.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||
@@ -18,8 +18,6 @@ import 'package:enaklo_pos/core/utils/printer_service.dart';
|
||||
|
||||
import '../../../core/components/spaces.dart';
|
||||
import '../../../core/constants/colors.dart';
|
||||
import '../bloc/order/order_bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
|
||||
class PaymentQrisDialog extends StatefulWidget {
|
||||
final List<ProductQuantity> items;
|
||||
@@ -236,7 +234,7 @@ class _PaymentQrisDialogState extends State<PaymentQrisDialog> {
|
||||
widget.price, bytes!, int.parse(sizeReceipt));
|
||||
|
||||
// Get the receipt printer to print QRIS
|
||||
final receiptPrinter = await ProductLocalDatasource
|
||||
final receiptPrinter = await PrinterLocalDatasource
|
||||
.instance
|
||||
.getPrinterByCode('receipt');
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||
import 'package:enaklo_pos/data/datasources/auth_local_datasource.dart';
|
||||
import 'package:enaklo_pos/presentation/auth/login_page.dart';
|
||||
import 'package:enaklo_pos/presentation/report/pages/report_page.dart';
|
||||
import 'package:enaklo_pos/presentation/setting/bloc/sync_order/sync_order_bloc.dart';
|
||||
|
||||
import '../../../core/assets/assets.gen.dart';
|
||||
import '../../auth/bloc/logout/logout_bloc.dart';
|
||||
@@ -155,10 +154,6 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
),
|
||||
),
|
||||
online: () {
|
||||
log("🌐 Dashboard: Internet connection detected, triggering sync");
|
||||
context.read<SyncOrderBloc>().add(
|
||||
const SyncOrderEvent.syncOrder(),
|
||||
);
|
||||
return Container(
|
||||
width: 40,
|
||||
margin:
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/presentation/home/models/order_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'last_order_table_event.dart';
|
||||
part 'last_order_table_state.dart';
|
||||
part 'last_order_table_bloc.freezed.dart';
|
||||
|
||||
class LastOrderTableBloc
|
||||
extends Bloc<LastOrderTableEvent, LastOrderTableState> {
|
||||
final ProductLocalDatasource datasource;
|
||||
LastOrderTableBloc(this.datasource)
|
||||
: super(const LastOrderTableState.initial()) {
|
||||
on<_LastOrderTable>((event, emit) async {
|
||||
emit(_Loading());
|
||||
final order = await datasource.getLastOrderTable(event.tableNumber);
|
||||
|
||||
emit(_Success(order));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,762 +0,0 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'last_order_table_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LastOrderTableEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(int tableNumber) lastOrderTable,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(int tableNumber)? lastOrderTable,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(int tableNumber)? lastOrderTable,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_LastOrderTable value) lastOrderTable,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_LastOrderTable value)? lastOrderTable,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_LastOrderTable value)? lastOrderTable,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LastOrderTableEventCopyWith<$Res> {
|
||||
factory $LastOrderTableEventCopyWith(
|
||||
LastOrderTableEvent value, $Res Function(LastOrderTableEvent) then) =
|
||||
_$LastOrderTableEventCopyWithImpl<$Res, LastOrderTableEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LastOrderTableEventCopyWithImpl<$Res, $Val extends LastOrderTableEvent>
|
||||
implements $LastOrderTableEventCopyWith<$Res> {
|
||||
_$LastOrderTableEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LastOrderTableEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$StartedImplCopyWith<$Res> {
|
||||
factory _$$StartedImplCopyWith(
|
||||
_$StartedImpl value, $Res Function(_$StartedImpl) then) =
|
||||
__$$StartedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$StartedImplCopyWithImpl<$Res>
|
||||
extends _$LastOrderTableEventCopyWithImpl<$Res, _$StartedImpl>
|
||||
implements _$$StartedImplCopyWith<$Res> {
|
||||
__$$StartedImplCopyWithImpl(
|
||||
_$StartedImpl _value, $Res Function(_$StartedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LastOrderTableEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$StartedImpl implements _Started {
|
||||
const _$StartedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LastOrderTableEvent.started()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$StartedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(int tableNumber) lastOrderTable,
|
||||
}) {
|
||||
return started();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(int tableNumber)? lastOrderTable,
|
||||
}) {
|
||||
return started?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(int tableNumber)? lastOrderTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_LastOrderTable value) lastOrderTable,
|
||||
}) {
|
||||
return started(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_LastOrderTable value)? lastOrderTable,
|
||||
}) {
|
||||
return started?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_LastOrderTable value)? lastOrderTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Started implements LastOrderTableEvent {
|
||||
const factory _Started() = _$StartedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LastOrderTableImplCopyWith<$Res> {
|
||||
factory _$$LastOrderTableImplCopyWith(_$LastOrderTableImpl value,
|
||||
$Res Function(_$LastOrderTableImpl) then) =
|
||||
__$$LastOrderTableImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({int tableNumber});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LastOrderTableImplCopyWithImpl<$Res>
|
||||
extends _$LastOrderTableEventCopyWithImpl<$Res, _$LastOrderTableImpl>
|
||||
implements _$$LastOrderTableImplCopyWith<$Res> {
|
||||
__$$LastOrderTableImplCopyWithImpl(
|
||||
_$LastOrderTableImpl _value, $Res Function(_$LastOrderTableImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LastOrderTableEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? tableNumber = null,
|
||||
}) {
|
||||
return _then(_$LastOrderTableImpl(
|
||||
null == tableNumber
|
||||
? _value.tableNumber
|
||||
: tableNumber // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LastOrderTableImpl implements _LastOrderTable {
|
||||
const _$LastOrderTableImpl(this.tableNumber);
|
||||
|
||||
@override
|
||||
final int tableNumber;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LastOrderTableEvent.lastOrderTable(tableNumber: $tableNumber)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LastOrderTableImpl &&
|
||||
(identical(other.tableNumber, tableNumber) ||
|
||||
other.tableNumber == tableNumber));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, tableNumber);
|
||||
|
||||
/// Create a copy of LastOrderTableEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LastOrderTableImplCopyWith<_$LastOrderTableImpl> get copyWith =>
|
||||
__$$LastOrderTableImplCopyWithImpl<_$LastOrderTableImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(int tableNumber) lastOrderTable,
|
||||
}) {
|
||||
return lastOrderTable(tableNumber);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(int tableNumber)? lastOrderTable,
|
||||
}) {
|
||||
return lastOrderTable?.call(tableNumber);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(int tableNumber)? lastOrderTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (lastOrderTable != null) {
|
||||
return lastOrderTable(tableNumber);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_LastOrderTable value) lastOrderTable,
|
||||
}) {
|
||||
return lastOrderTable(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_LastOrderTable value)? lastOrderTable,
|
||||
}) {
|
||||
return lastOrderTable?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_LastOrderTable value)? lastOrderTable,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (lastOrderTable != null) {
|
||||
return lastOrderTable(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LastOrderTable implements LastOrderTableEvent {
|
||||
const factory _LastOrderTable(final int tableNumber) = _$LastOrderTableImpl;
|
||||
|
||||
int get tableNumber;
|
||||
|
||||
/// Create a copy of LastOrderTableEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LastOrderTableImplCopyWith<_$LastOrderTableImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LastOrderTableState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(OrderModel? order) success,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(OrderModel? order)? success,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(OrderModel? order)? success,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Success value) success,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Success value)? success,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Success value)? success,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LastOrderTableStateCopyWith<$Res> {
|
||||
factory $LastOrderTableStateCopyWith(
|
||||
LastOrderTableState value, $Res Function(LastOrderTableState) then) =
|
||||
_$LastOrderTableStateCopyWithImpl<$Res, LastOrderTableState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LastOrderTableStateCopyWithImpl<$Res, $Val extends LastOrderTableState>
|
||||
implements $LastOrderTableStateCopyWith<$Res> {
|
||||
_$LastOrderTableStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LastOrderTableState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InitialImplCopyWith<$Res> {
|
||||
factory _$$InitialImplCopyWith(
|
||||
_$InitialImpl value, $Res Function(_$InitialImpl) then) =
|
||||
__$$InitialImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InitialImplCopyWithImpl<$Res>
|
||||
extends _$LastOrderTableStateCopyWithImpl<$Res, _$InitialImpl>
|
||||
implements _$$InitialImplCopyWith<$Res> {
|
||||
__$$InitialImplCopyWithImpl(
|
||||
_$InitialImpl _value, $Res Function(_$InitialImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LastOrderTableState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InitialImpl implements _Initial {
|
||||
const _$InitialImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LastOrderTableState.initial()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$InitialImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(OrderModel? order) success,
|
||||
}) {
|
||||
return initial();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(OrderModel? order)? success,
|
||||
}) {
|
||||
return initial?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(OrderModel? order)? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial();
|
||||
}
|
||||
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,
|
||||
}) {
|
||||
return initial(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Success value)? success,
|
||||
}) {
|
||||
return initial?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Success value)? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Initial implements LastOrderTableState {
|
||||
const factory _Initial() = _$InitialImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoadingImplCopyWith<$Res> {
|
||||
factory _$$LoadingImplCopyWith(
|
||||
_$LoadingImpl value, $Res Function(_$LoadingImpl) then) =
|
||||
__$$LoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoadingImplCopyWithImpl<$Res>
|
||||
extends _$LastOrderTableStateCopyWithImpl<$Res, _$LoadingImpl>
|
||||
implements _$$LoadingImplCopyWith<$Res> {
|
||||
__$$LoadingImplCopyWithImpl(
|
||||
_$LoadingImpl _value, $Res Function(_$LoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LastOrderTableState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadingImpl implements _Loading {
|
||||
const _$LoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LastOrderTableState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$LoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(OrderModel? order) success,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(OrderModel? order)? success,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(OrderModel? order)? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
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,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Success value)? success,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Success value)? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Loading implements LastOrderTableState {
|
||||
const factory _Loading() = _$LoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SuccessImplCopyWith<$Res> {
|
||||
factory _$$SuccessImplCopyWith(
|
||||
_$SuccessImpl value, $Res Function(_$SuccessImpl) then) =
|
||||
__$$SuccessImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({OrderModel? order});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SuccessImplCopyWithImpl<$Res>
|
||||
extends _$LastOrderTableStateCopyWithImpl<$Res, _$SuccessImpl>
|
||||
implements _$$SuccessImplCopyWith<$Res> {
|
||||
__$$SuccessImplCopyWithImpl(
|
||||
_$SuccessImpl _value, $Res Function(_$SuccessImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LastOrderTableState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? order = freezed,
|
||||
}) {
|
||||
return _then(_$SuccessImpl(
|
||||
freezed == order
|
||||
? _value.order
|
||||
: order // ignore: cast_nullable_to_non_nullable
|
||||
as OrderModel?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SuccessImpl implements _Success {
|
||||
const _$SuccessImpl(this.order);
|
||||
|
||||
@override
|
||||
final OrderModel? order;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LastOrderTableState.success(order: $order)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SuccessImpl &&
|
||||
(identical(other.order, order) || other.order == order));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, order);
|
||||
|
||||
/// Create a copy of LastOrderTableState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
||||
__$$SuccessImplCopyWithImpl<_$SuccessImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(OrderModel? order) success,
|
||||
}) {
|
||||
return success(order);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(OrderModel? order)? success,
|
||||
}) {
|
||||
return success?.call(order);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(OrderModel? order)? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (success != null) {
|
||||
return success(order);
|
||||
}
|
||||
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,
|
||||
}) {
|
||||
return success(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Success value)? success,
|
||||
}) {
|
||||
return success?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Success value)? success,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (success != null) {
|
||||
return success(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Success implements LastOrderTableState {
|
||||
const factory _Success(final OrderModel? order) = _$SuccessImpl;
|
||||
|
||||
OrderModel? get order;
|
||||
|
||||
/// Create a copy of LastOrderTableState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$SuccessImplCopyWith<_$SuccessImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'last_order_table_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LastOrderTableEvent with _$LastOrderTableEvent {
|
||||
const factory LastOrderTableEvent.started() = _Started;
|
||||
const factory LastOrderTableEvent.lastOrderTable(int tableNumber) =
|
||||
_LastOrderTable;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'last_order_table_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LastOrderTableState with _$LastOrderTableState {
|
||||
const factory LastOrderTableState.initial() = _Initial;
|
||||
const factory LastOrderTableState.loading() = _Loading;
|
||||
const factory LastOrderTableState.success(OrderModel? order) = _Success;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/presentation/home/models/order_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'day_sales_event.dart';
|
||||
part 'day_sales_state.dart';
|
||||
part 'day_sales_bloc.freezed.dart';
|
||||
|
||||
class DaySalesBloc extends Bloc<DaySalesEvent, DaySalesState> {
|
||||
final ProductLocalDatasource datasource;
|
||||
DaySalesBloc(this.datasource) : super(const _Initial()) {
|
||||
on<_GetDaySales>((event, emit) async {
|
||||
emit(const _Loading());
|
||||
final result = await datasource.getAllOrder(event.date);
|
||||
emit(_Loaded(result));
|
||||
});
|
||||
on<_GetRangeDateSales>((event, emit) async {
|
||||
emit(const _Loading());
|
||||
final result =
|
||||
await datasource.getAllOrderByRange(event.startDate, event.endDate);
|
||||
emit(_Loaded(result));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,947 +0,0 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'day_sales_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$DaySalesEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(DateTime date) getDaySales,
|
||||
required TResult Function(DateTime startDate, DateTime endDate)
|
||||
getRangeDateSales,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(DateTime date)? getDaySales,
|
||||
TResult? Function(DateTime startDate, DateTime endDate)? getRangeDateSales,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(DateTime date)? getDaySales,
|
||||
TResult Function(DateTime startDate, DateTime endDate)? getRangeDateSales,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_GetDaySales value) getDaySales,
|
||||
required TResult Function(_GetRangeDateSales value) getRangeDateSales,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_GetDaySales value)? getDaySales,
|
||||
TResult? Function(_GetRangeDateSales value)? getRangeDateSales,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_GetDaySales value)? getDaySales,
|
||||
TResult Function(_GetRangeDateSales value)? getRangeDateSales,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $DaySalesEventCopyWith<$Res> {
|
||||
factory $DaySalesEventCopyWith(
|
||||
DaySalesEvent value, $Res Function(DaySalesEvent) then) =
|
||||
_$DaySalesEventCopyWithImpl<$Res, DaySalesEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$DaySalesEventCopyWithImpl<$Res, $Val extends DaySalesEvent>
|
||||
implements $DaySalesEventCopyWith<$Res> {
|
||||
_$DaySalesEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of DaySalesEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$StartedImplCopyWith<$Res> {
|
||||
factory _$$StartedImplCopyWith(
|
||||
_$StartedImpl value, $Res Function(_$StartedImpl) then) =
|
||||
__$$StartedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$StartedImplCopyWithImpl<$Res>
|
||||
extends _$DaySalesEventCopyWithImpl<$Res, _$StartedImpl>
|
||||
implements _$$StartedImplCopyWith<$Res> {
|
||||
__$$StartedImplCopyWithImpl(
|
||||
_$StartedImpl _value, $Res Function(_$StartedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DaySalesEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$StartedImpl implements _Started {
|
||||
const _$StartedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DaySalesEvent.started()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$StartedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(DateTime date) getDaySales,
|
||||
required TResult Function(DateTime startDate, DateTime endDate)
|
||||
getRangeDateSales,
|
||||
}) {
|
||||
return started();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(DateTime date)? getDaySales,
|
||||
TResult? Function(DateTime startDate, DateTime endDate)? getRangeDateSales,
|
||||
}) {
|
||||
return started?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(DateTime date)? getDaySales,
|
||||
TResult Function(DateTime startDate, DateTime endDate)? getRangeDateSales,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_GetDaySales value) getDaySales,
|
||||
required TResult Function(_GetRangeDateSales value) getRangeDateSales,
|
||||
}) {
|
||||
return started(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_GetDaySales value)? getDaySales,
|
||||
TResult? Function(_GetRangeDateSales value)? getRangeDateSales,
|
||||
}) {
|
||||
return started?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_GetDaySales value)? getDaySales,
|
||||
TResult Function(_GetRangeDateSales value)? getRangeDateSales,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Started implements DaySalesEvent {
|
||||
const factory _Started() = _$StartedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$GetDaySalesImplCopyWith<$Res> {
|
||||
factory _$$GetDaySalesImplCopyWith(
|
||||
_$GetDaySalesImpl value, $Res Function(_$GetDaySalesImpl) then) =
|
||||
__$$GetDaySalesImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({DateTime date});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$GetDaySalesImplCopyWithImpl<$Res>
|
||||
extends _$DaySalesEventCopyWithImpl<$Res, _$GetDaySalesImpl>
|
||||
implements _$$GetDaySalesImplCopyWith<$Res> {
|
||||
__$$GetDaySalesImplCopyWithImpl(
|
||||
_$GetDaySalesImpl _value, $Res Function(_$GetDaySalesImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DaySalesEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? date = null,
|
||||
}) {
|
||||
return _then(_$GetDaySalesImpl(
|
||||
null == date
|
||||
? _value.date
|
||||
: date // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$GetDaySalesImpl implements _GetDaySales {
|
||||
const _$GetDaySalesImpl(this.date);
|
||||
|
||||
@override
|
||||
final DateTime date;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DaySalesEvent.getDaySales(date: $date)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$GetDaySalesImpl &&
|
||||
(identical(other.date, date) || other.date == date));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, date);
|
||||
|
||||
/// Create a copy of DaySalesEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$GetDaySalesImplCopyWith<_$GetDaySalesImpl> get copyWith =>
|
||||
__$$GetDaySalesImplCopyWithImpl<_$GetDaySalesImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(DateTime date) getDaySales,
|
||||
required TResult Function(DateTime startDate, DateTime endDate)
|
||||
getRangeDateSales,
|
||||
}) {
|
||||
return getDaySales(date);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(DateTime date)? getDaySales,
|
||||
TResult? Function(DateTime startDate, DateTime endDate)? getRangeDateSales,
|
||||
}) {
|
||||
return getDaySales?.call(date);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(DateTime date)? getDaySales,
|
||||
TResult Function(DateTime startDate, DateTime endDate)? getRangeDateSales,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (getDaySales != null) {
|
||||
return getDaySales(date);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_GetDaySales value) getDaySales,
|
||||
required TResult Function(_GetRangeDateSales value) getRangeDateSales,
|
||||
}) {
|
||||
return getDaySales(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_GetDaySales value)? getDaySales,
|
||||
TResult? Function(_GetRangeDateSales value)? getRangeDateSales,
|
||||
}) {
|
||||
return getDaySales?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_GetDaySales value)? getDaySales,
|
||||
TResult Function(_GetRangeDateSales value)? getRangeDateSales,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (getDaySales != null) {
|
||||
return getDaySales(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _GetDaySales implements DaySalesEvent {
|
||||
const factory _GetDaySales(final DateTime date) = _$GetDaySalesImpl;
|
||||
|
||||
DateTime get date;
|
||||
|
||||
/// Create a copy of DaySalesEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$GetDaySalesImplCopyWith<_$GetDaySalesImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$GetRangeDateSalesImplCopyWith<$Res> {
|
||||
factory _$$GetRangeDateSalesImplCopyWith(_$GetRangeDateSalesImpl value,
|
||||
$Res Function(_$GetRangeDateSalesImpl) then) =
|
||||
__$$GetRangeDateSalesImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({DateTime startDate, DateTime endDate});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$GetRangeDateSalesImplCopyWithImpl<$Res>
|
||||
extends _$DaySalesEventCopyWithImpl<$Res, _$GetRangeDateSalesImpl>
|
||||
implements _$$GetRangeDateSalesImplCopyWith<$Res> {
|
||||
__$$GetRangeDateSalesImplCopyWithImpl(_$GetRangeDateSalesImpl _value,
|
||||
$Res Function(_$GetRangeDateSalesImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DaySalesEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? startDate = null,
|
||||
Object? endDate = null,
|
||||
}) {
|
||||
return _then(_$GetRangeDateSalesImpl(
|
||||
null == startDate
|
||||
? _value.startDate
|
||||
: startDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
null == endDate
|
||||
? _value.endDate
|
||||
: endDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$GetRangeDateSalesImpl implements _GetRangeDateSales {
|
||||
const _$GetRangeDateSalesImpl(this.startDate, this.endDate);
|
||||
|
||||
@override
|
||||
final DateTime startDate;
|
||||
@override
|
||||
final DateTime endDate;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DaySalesEvent.getRangeDateSales(startDate: $startDate, endDate: $endDate)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$GetRangeDateSalesImpl &&
|
||||
(identical(other.startDate, startDate) ||
|
||||
other.startDate == startDate) &&
|
||||
(identical(other.endDate, endDate) || other.endDate == endDate));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, startDate, endDate);
|
||||
|
||||
/// Create a copy of DaySalesEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$GetRangeDateSalesImplCopyWith<_$GetRangeDateSalesImpl> get copyWith =>
|
||||
__$$GetRangeDateSalesImplCopyWithImpl<_$GetRangeDateSalesImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function(DateTime date) getDaySales,
|
||||
required TResult Function(DateTime startDate, DateTime endDate)
|
||||
getRangeDateSales,
|
||||
}) {
|
||||
return getRangeDateSales(startDate, endDate);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function(DateTime date)? getDaySales,
|
||||
TResult? Function(DateTime startDate, DateTime endDate)? getRangeDateSales,
|
||||
}) {
|
||||
return getRangeDateSales?.call(startDate, endDate);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function(DateTime date)? getDaySales,
|
||||
TResult Function(DateTime startDate, DateTime endDate)? getRangeDateSales,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (getRangeDateSales != null) {
|
||||
return getRangeDateSales(startDate, endDate);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_GetDaySales value) getDaySales,
|
||||
required TResult Function(_GetRangeDateSales value) getRangeDateSales,
|
||||
}) {
|
||||
return getRangeDateSales(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_GetDaySales value)? getDaySales,
|
||||
TResult? Function(_GetRangeDateSales value)? getRangeDateSales,
|
||||
}) {
|
||||
return getRangeDateSales?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_GetDaySales value)? getDaySales,
|
||||
TResult Function(_GetRangeDateSales value)? getRangeDateSales,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (getRangeDateSales != null) {
|
||||
return getRangeDateSales(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _GetRangeDateSales implements DaySalesEvent {
|
||||
const factory _GetRangeDateSales(
|
||||
final DateTime startDate, final DateTime endDate) =
|
||||
_$GetRangeDateSalesImpl;
|
||||
|
||||
DateTime get startDate;
|
||||
DateTime get endDate;
|
||||
|
||||
/// Create a copy of DaySalesEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$GetRangeDateSalesImplCopyWith<_$GetRangeDateSalesImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$DaySalesState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<OrderModel> orders) loaded,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<OrderModel> orders)? loaded,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<OrderModel> orders)? loaded,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $DaySalesStateCopyWith<$Res> {
|
||||
factory $DaySalesStateCopyWith(
|
||||
DaySalesState value, $Res Function(DaySalesState) then) =
|
||||
_$DaySalesStateCopyWithImpl<$Res, DaySalesState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$DaySalesStateCopyWithImpl<$Res, $Val extends DaySalesState>
|
||||
implements $DaySalesStateCopyWith<$Res> {
|
||||
_$DaySalesStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of DaySalesState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InitialImplCopyWith<$Res> {
|
||||
factory _$$InitialImplCopyWith(
|
||||
_$InitialImpl value, $Res Function(_$InitialImpl) then) =
|
||||
__$$InitialImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InitialImplCopyWithImpl<$Res>
|
||||
extends _$DaySalesStateCopyWithImpl<$Res, _$InitialImpl>
|
||||
implements _$$InitialImplCopyWith<$Res> {
|
||||
__$$InitialImplCopyWithImpl(
|
||||
_$InitialImpl _value, $Res Function(_$InitialImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DaySalesState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InitialImpl implements _Initial {
|
||||
const _$InitialImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DaySalesState.initial()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$InitialImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<OrderModel> orders) loaded,
|
||||
}) {
|
||||
return initial();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<OrderModel> orders)? loaded,
|
||||
}) {
|
||||
return initial?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<OrderModel> orders)? loaded,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
}) {
|
||||
return initial(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
}) {
|
||||
return initial?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Initial implements DaySalesState {
|
||||
const factory _Initial() = _$InitialImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoadingImplCopyWith<$Res> {
|
||||
factory _$$LoadingImplCopyWith(
|
||||
_$LoadingImpl value, $Res Function(_$LoadingImpl) then) =
|
||||
__$$LoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoadingImplCopyWithImpl<$Res>
|
||||
extends _$DaySalesStateCopyWithImpl<$Res, _$LoadingImpl>
|
||||
implements _$$LoadingImplCopyWith<$Res> {
|
||||
__$$LoadingImplCopyWithImpl(
|
||||
_$LoadingImpl _value, $Res Function(_$LoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DaySalesState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadingImpl implements _Loading {
|
||||
const _$LoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DaySalesState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$LoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<OrderModel> orders) loaded,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<OrderModel> orders)? loaded,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<OrderModel> orders)? loaded,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Loading implements DaySalesState {
|
||||
const factory _Loading() = _$LoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoadedImplCopyWith<$Res> {
|
||||
factory _$$LoadedImplCopyWith(
|
||||
_$LoadedImpl value, $Res Function(_$LoadedImpl) then) =
|
||||
__$$LoadedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({List<OrderModel> orders});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoadedImplCopyWithImpl<$Res>
|
||||
extends _$DaySalesStateCopyWithImpl<$Res, _$LoadedImpl>
|
||||
implements _$$LoadedImplCopyWith<$Res> {
|
||||
__$$LoadedImplCopyWithImpl(
|
||||
_$LoadedImpl _value, $Res Function(_$LoadedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of DaySalesState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? orders = null,
|
||||
}) {
|
||||
return _then(_$LoadedImpl(
|
||||
null == orders
|
||||
? _value._orders
|
||||
: orders // ignore: cast_nullable_to_non_nullable
|
||||
as List<OrderModel>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadedImpl implements _Loaded {
|
||||
const _$LoadedImpl(final List<OrderModel> orders) : _orders = orders;
|
||||
|
||||
final List<OrderModel> _orders;
|
||||
@override
|
||||
List<OrderModel> get orders {
|
||||
if (_orders is EqualUnmodifiableListView) return _orders;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_orders);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DaySalesState.loaded(orders: $orders)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoadedImpl &&
|
||||
const DeepCollectionEquality().equals(other._orders, _orders));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, const DeepCollectionEquality().hash(_orders));
|
||||
|
||||
/// Create a copy of DaySalesState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
||||
__$$LoadedImplCopyWithImpl<_$LoadedImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function(List<OrderModel> orders) loaded,
|
||||
}) {
|
||||
return loaded(orders);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(List<OrderModel> orders)? loaded,
|
||||
}) {
|
||||
return loaded?.call(orders);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function(List<OrderModel> orders)? loaded,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(orders);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
}) {
|
||||
return loaded(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
}) {
|
||||
return loaded?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Loaded implements DaySalesState {
|
||||
const factory _Loaded(final List<OrderModel> orders) = _$LoadedImpl;
|
||||
|
||||
List<OrderModel> get orders;
|
||||
|
||||
/// Create a copy of DaySalesState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
part of 'day_sales_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class DaySalesEvent with _$DaySalesEvent {
|
||||
const factory DaySalesEvent.started() = _Started;
|
||||
const factory DaySalesEvent.getDaySales(
|
||||
DateTime date,
|
||||
) = _GetDaySales;
|
||||
const factory DaySalesEvent.getRangeDateSales(
|
||||
DateTime startDate,
|
||||
DateTime endDate,
|
||||
) = _GetRangeDateSales;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
part of 'day_sales_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class DaySalesState with _$DaySalesState {
|
||||
const factory DaySalesState.initial() = _Initial;
|
||||
const factory DaySalesState.loading() = _Loading;
|
||||
const factory DaySalesState.loaded(List<OrderModel> orders) = _Loaded;
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/datasources/printer/printer_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/models/response/print_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@@ -13,10 +11,10 @@ class CreatePrinterBloc extends Bloc<CreatePrinterEvent, CreatePrinterState> {
|
||||
CreatePrinterBloc() : super(_Initial()) {
|
||||
on<_CreatePrinter>((event, emit) async {
|
||||
emit(_Loading());
|
||||
await ProductLocalDatasource.instance.createPrinter(
|
||||
await PrinterLocalDatasource.instance.createPrinter(
|
||||
event.print,
|
||||
);
|
||||
emit(_Success('Create Table Success'));
|
||||
emit(_Success('Create Printer Success'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/datasources/printer/printer_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/models/response/print_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@@ -13,7 +12,7 @@ class GetPrinterBarBloc extends Bloc<GetPrinterBarEvent, GetPrinterBarState> {
|
||||
on<_Get>((event, emit) async {
|
||||
emit(_Loading());
|
||||
final result =
|
||||
await ProductLocalDatasource.instance.getPrinterByCode('bar');
|
||||
await PrinterLocalDatasource.instance.getPrinterByCode('bar');
|
||||
emit(_Success(result));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/printer/printer_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/models/response/print_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../../../data/datasources/product_local_datasource.dart';
|
||||
|
||||
part 'get_printer_checker_event.dart';
|
||||
part 'get_printer_checker_state.dart';
|
||||
part 'get_printer_checker_bloc.freezed.dart';
|
||||
@@ -14,7 +13,7 @@ class GetPrinterCheckerBloc
|
||||
on<_Get>((event, emit) async {
|
||||
emit(_Loading());
|
||||
final result =
|
||||
await ProductLocalDatasource.instance.getPrinterByCode('checker');
|
||||
await PrinterLocalDatasource.instance.getPrinterByCode('checker');
|
||||
emit(_Success(result));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/datasources/printer/printer_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/models/response/print_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@@ -13,7 +13,7 @@ class GetPrinterKitchenBloc
|
||||
on<_Get>((event, emit) async {
|
||||
emit(_Loading());
|
||||
final result =
|
||||
await ProductLocalDatasource.instance.getPrinterByCode('kitchen');
|
||||
await PrinterLocalDatasource.instance.getPrinterByCode('kitchen');
|
||||
emit(_Success(result));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/datasources/printer/printer_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/models/response/print_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@@ -13,7 +13,7 @@ class GetPrinterReceiptBloc
|
||||
on<_Get>((event, emit) async {
|
||||
emit(_Loading());
|
||||
final result =
|
||||
await ProductLocalDatasource.instance.getPrinterByCode('receipt');
|
||||
await PrinterLocalDatasource.instance.getPrinterByCode('receipt');
|
||||
emit(_Success(result));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/datasources/printer/printer_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/models/response/print_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@@ -13,7 +13,7 @@ class GetPrinterTicketBloc
|
||||
on<_Get>((event, emit) async {
|
||||
emit(_Loading());
|
||||
final result =
|
||||
await ProductLocalDatasource.instance.getPrinterByCode('ticket');
|
||||
await PrinterLocalDatasource.instance.getPrinterByCode('ticket');
|
||||
emit(_Success(result));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'package:enaklo_pos/data/datasources/order_remote_datasource.dart';
|
||||
|
||||
part 'sync_order_bloc.freezed.dart';
|
||||
part 'sync_order_event.dart';
|
||||
part 'sync_order_state.dart';
|
||||
|
||||
class SyncOrderBloc extends Bloc<SyncOrderEvent, SyncOrderState> {
|
||||
final OrderRemoteDatasource orderRemoteDatasource;
|
||||
SyncOrderBloc(
|
||||
this.orderRemoteDatasource,
|
||||
) : super(const _Initial()) {
|
||||
on<_SyncOrder>((event, emit) async {
|
||||
emit(const _Loading());
|
||||
log("🔄 SyncOrderBloc: Starting sync process");
|
||||
final dataOrderNotSynced =
|
||||
await ProductLocalDatasource.instance.getOrderByIsNotSync();
|
||||
log("🔄 SyncOrderBloc: Found ${dataOrderNotSynced.length} orders to sync");
|
||||
for (var order in dataOrderNotSynced) {
|
||||
final orderItem = await ProductLocalDatasource.instance
|
||||
.getOrderItemByOrderId(order.id!);
|
||||
|
||||
final newOrder = order.copyWith(orderItems: orderItem);
|
||||
log("🔄 SyncOrderBloc: Syncing order ${order.id} to API");
|
||||
log("Order: ${newOrder.toMap()}");
|
||||
final result = await orderRemoteDatasource.saveOrder(newOrder);
|
||||
if (result) {
|
||||
await ProductLocalDatasource.instance.updateOrderIsSync(order.id!);
|
||||
} else {
|
||||
emit(const _Error('Sync Order Failed'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
emit(const _Loaded());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,866 +0,0 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'sync_order_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SyncOrderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() syncOrder,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? syncOrder,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? syncOrder,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_SyncOrder value) syncOrder,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_SyncOrder value)? syncOrder,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_SyncOrder value)? syncOrder,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SyncOrderEventCopyWith<$Res> {
|
||||
factory $SyncOrderEventCopyWith(
|
||||
SyncOrderEvent value, $Res Function(SyncOrderEvent) then) =
|
||||
_$SyncOrderEventCopyWithImpl<$Res, SyncOrderEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SyncOrderEventCopyWithImpl<$Res, $Val extends SyncOrderEvent>
|
||||
implements $SyncOrderEventCopyWith<$Res> {
|
||||
_$SyncOrderEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of SyncOrderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$StartedImplCopyWith<$Res> {
|
||||
factory _$$StartedImplCopyWith(
|
||||
_$StartedImpl value, $Res Function(_$StartedImpl) then) =
|
||||
__$$StartedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$StartedImplCopyWithImpl<$Res>
|
||||
extends _$SyncOrderEventCopyWithImpl<$Res, _$StartedImpl>
|
||||
implements _$$StartedImplCopyWith<$Res> {
|
||||
__$$StartedImplCopyWithImpl(
|
||||
_$StartedImpl _value, $Res Function(_$StartedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SyncOrderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$StartedImpl implements _Started {
|
||||
const _$StartedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SyncOrderEvent.started()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$StartedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() syncOrder,
|
||||
}) {
|
||||
return started();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? syncOrder,
|
||||
}) {
|
||||
return started?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? syncOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_SyncOrder value) syncOrder,
|
||||
}) {
|
||||
return started(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_SyncOrder value)? syncOrder,
|
||||
}) {
|
||||
return started?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_SyncOrder value)? syncOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (started != null) {
|
||||
return started(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Started implements SyncOrderEvent {
|
||||
const factory _Started() = _$StartedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SyncOrderImplCopyWith<$Res> {
|
||||
factory _$$SyncOrderImplCopyWith(
|
||||
_$SyncOrderImpl value, $Res Function(_$SyncOrderImpl) then) =
|
||||
__$$SyncOrderImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SyncOrderImplCopyWithImpl<$Res>
|
||||
extends _$SyncOrderEventCopyWithImpl<$Res, _$SyncOrderImpl>
|
||||
implements _$$SyncOrderImplCopyWith<$Res> {
|
||||
__$$SyncOrderImplCopyWithImpl(
|
||||
_$SyncOrderImpl _value, $Res Function(_$SyncOrderImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SyncOrderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SyncOrderImpl implements _SyncOrder {
|
||||
const _$SyncOrderImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SyncOrderEvent.syncOrder()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SyncOrderImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() started,
|
||||
required TResult Function() syncOrder,
|
||||
}) {
|
||||
return syncOrder();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? started,
|
||||
TResult? Function()? syncOrder,
|
||||
}) {
|
||||
return syncOrder?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? started,
|
||||
TResult Function()? syncOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (syncOrder != null) {
|
||||
return syncOrder();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Started value) started,
|
||||
required TResult Function(_SyncOrder value) syncOrder,
|
||||
}) {
|
||||
return syncOrder(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Started value)? started,
|
||||
TResult? Function(_SyncOrder value)? syncOrder,
|
||||
}) {
|
||||
return syncOrder?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Started value)? started,
|
||||
TResult Function(_SyncOrder value)? syncOrder,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (syncOrder != null) {
|
||||
return syncOrder(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _SyncOrder implements SyncOrderEvent {
|
||||
const factory _SyncOrder() = _$SyncOrderImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SyncOrderState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function() loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function()? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SyncOrderStateCopyWith<$Res> {
|
||||
factory $SyncOrderStateCopyWith(
|
||||
SyncOrderState value, $Res Function(SyncOrderState) then) =
|
||||
_$SyncOrderStateCopyWithImpl<$Res, SyncOrderState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SyncOrderStateCopyWithImpl<$Res, $Val extends SyncOrderState>
|
||||
implements $SyncOrderStateCopyWith<$Res> {
|
||||
_$SyncOrderStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of SyncOrderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InitialImplCopyWith<$Res> {
|
||||
factory _$$InitialImplCopyWith(
|
||||
_$InitialImpl value, $Res Function(_$InitialImpl) then) =
|
||||
__$$InitialImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InitialImplCopyWithImpl<$Res>
|
||||
extends _$SyncOrderStateCopyWithImpl<$Res, _$InitialImpl>
|
||||
implements _$$InitialImplCopyWith<$Res> {
|
||||
__$$InitialImplCopyWithImpl(
|
||||
_$InitialImpl _value, $Res Function(_$InitialImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SyncOrderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InitialImpl implements _Initial {
|
||||
const _$InitialImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SyncOrderState.initial()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$InitialImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function() loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return initial();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return initial?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function()? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
}) {
|
||||
return initial(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
}) {
|
||||
return initial?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Initial implements SyncOrderState {
|
||||
const factory _Initial() = _$InitialImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoadingImplCopyWith<$Res> {
|
||||
factory _$$LoadingImplCopyWith(
|
||||
_$LoadingImpl value, $Res Function(_$LoadingImpl) then) =
|
||||
__$$LoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoadingImplCopyWithImpl<$Res>
|
||||
extends _$SyncOrderStateCopyWithImpl<$Res, _$LoadingImpl>
|
||||
implements _$$LoadingImplCopyWith<$Res> {
|
||||
__$$LoadingImplCopyWithImpl(
|
||||
_$LoadingImpl _value, $Res Function(_$LoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SyncOrderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadingImpl implements _Loading {
|
||||
const _$LoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SyncOrderState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$LoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function() loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function()? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Loading implements SyncOrderState {
|
||||
const factory _Loading() = _$LoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoadedImplCopyWith<$Res> {
|
||||
factory _$$LoadedImplCopyWith(
|
||||
_$LoadedImpl value, $Res Function(_$LoadedImpl) then) =
|
||||
__$$LoadedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoadedImplCopyWithImpl<$Res>
|
||||
extends _$SyncOrderStateCopyWithImpl<$Res, _$LoadedImpl>
|
||||
implements _$$LoadedImplCopyWith<$Res> {
|
||||
__$$LoadedImplCopyWithImpl(
|
||||
_$LoadedImpl _value, $Res Function(_$LoadedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SyncOrderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoadedImpl implements _Loaded {
|
||||
const _$LoadedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SyncOrderState.loaded()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$LoadedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() initial,
|
||||
required TResult Function() loading,
|
||||
required TResult Function() loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return loaded();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return loaded?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function()? loaded,
|
||||
TResult Function(String message)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Initial value) initial,
|
||||
required TResult Function(_Loading value) loading,
|
||||
required TResult Function(_Loaded value) loaded,
|
||||
required TResult Function(_Error value) error,
|
||||
}) {
|
||||
return loaded(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Initial value)? initial,
|
||||
TResult? Function(_Loading value)? loading,
|
||||
TResult? Function(_Loaded value)? loaded,
|
||||
TResult? Function(_Error value)? error,
|
||||
}) {
|
||||
return loaded?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Initial value)? initial,
|
||||
TResult Function(_Loading value)? loading,
|
||||
TResult Function(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Loaded implements SyncOrderState {
|
||||
const factory _Loaded() = _$LoadedImpl;
|
||||
}
|
||||
|
||||
/// @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 _$SyncOrderStateCopyWithImpl<$Res, _$ErrorImpl>
|
||||
implements _$$ErrorImplCopyWith<$Res> {
|
||||
__$$ErrorImplCopyWithImpl(
|
||||
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SyncOrderState
|
||||
/// 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 'SyncOrderState.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 SyncOrderState
|
||||
/// 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() loaded,
|
||||
required TResult Function(String message) error,
|
||||
}) {
|
||||
return error(message);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? initial,
|
||||
TResult? Function()? loading,
|
||||
TResult? Function()? loaded,
|
||||
TResult? Function(String message)? error,
|
||||
}) {
|
||||
return error?.call(message);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? initial,
|
||||
TResult Function()? loading,
|
||||
TResult Function()? loaded,
|
||||
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(_Loaded value) loaded,
|
||||
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(_Loaded value)? loaded,
|
||||
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(_Loaded value)? loaded,
|
||||
TResult Function(_Error value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Error implements SyncOrderState {
|
||||
const factory _Error(final String message) = _$ErrorImpl;
|
||||
|
||||
String get message;
|
||||
|
||||
/// Create a copy of SyncOrderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
part of 'sync_order_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class SyncOrderEvent with _$SyncOrderEvent {
|
||||
const factory SyncOrderEvent.started() = _Started;
|
||||
const factory SyncOrderEvent.syncOrder() = _SyncOrder;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
part of 'sync_order_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class SyncOrderState with _$SyncOrderState {
|
||||
const factory SyncOrderState.initial() = _Initial;
|
||||
const factory SyncOrderState.loading() = _Loading;
|
||||
const factory SyncOrderState.loaded() =
|
||||
_Loaded;
|
||||
const factory SyncOrderState.error(String message) = _Error;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/datasources/printer/printer_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/models/response/print_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@@ -11,7 +11,7 @@ class UpdatePrinterBloc extends Bloc<UpdatePrinterEvent, UpdatePrinterState> {
|
||||
UpdatePrinterBloc() : super(_Initial()) {
|
||||
on<_UpdatePrinter>((event, emit) async {
|
||||
emit(_Loading());
|
||||
await ProductLocalDatasource.instance.updatePrinter(
|
||||
await PrinterLocalDatasource.instance.updatePrinter(
|
||||
event.print,
|
||||
event.print.id!,
|
||||
);
|
||||
|
||||
@@ -17,15 +17,144 @@ enum PrinterType {
|
||||
}
|
||||
|
||||
class PrinterModel {
|
||||
final int? id;
|
||||
final String code;
|
||||
final String name;
|
||||
final String ipAddress;
|
||||
final String size;
|
||||
final PrinterType type;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
PrinterModel({
|
||||
this.id,
|
||||
required this.code,
|
||||
required this.name,
|
||||
required this.ipAddress,
|
||||
required this.size,
|
||||
required this.type,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
// Factory constructor to create PrinterModel from database map
|
||||
factory PrinterModel.fromMap(Map<String, dynamic> map) {
|
||||
return PrinterModel(
|
||||
id: map['id'] as int?,
|
||||
code: map['code'] as String,
|
||||
name: map['name'] as String,
|
||||
ipAddress: map['ip_address'] as String,
|
||||
size: map['size'] as String,
|
||||
type: PrinterType.fromValue(map['type'] as String),
|
||||
createdAt: map['created_at'] != null
|
||||
? DateTime.parse(map['created_at'] as String)
|
||||
: null,
|
||||
updatedAt: map['updated_at'] != null
|
||||
? DateTime.parse(map['updated_at'] as String)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
// Convert to map for database insertion (excluding id, including timestamps)
|
||||
Map<String, dynamic> toMapForInsert() {
|
||||
final now = DateTime.now().toIso8601String();
|
||||
return {
|
||||
'code': code,
|
||||
'name': name,
|
||||
'ip_address': ipAddress,
|
||||
'size': size,
|
||||
'type': type.value,
|
||||
'created_at': now,
|
||||
'updated_at': now,
|
||||
};
|
||||
}
|
||||
|
||||
// Convert to map for database update (excluding id and created_at)
|
||||
Map<String, dynamic> toMapForUpdate() {
|
||||
return {
|
||||
'code': code,
|
||||
'name': name,
|
||||
'ip_address': ipAddress,
|
||||
'size': size,
|
||||
'type': type.value,
|
||||
'updated_at': DateTime.now().toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
// Convert to complete map (including id)
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'code': code,
|
||||
'name': name,
|
||||
'ip_address': ipAddress,
|
||||
'size': size,
|
||||
'type': type.value,
|
||||
'created_at': createdAt?.toIso8601String(),
|
||||
'updated_at': updatedAt?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
// Copy with method for creating modified instances
|
||||
PrinterModel copyWith({
|
||||
int? id,
|
||||
String? code,
|
||||
String? name,
|
||||
String? ipAddress,
|
||||
String? size,
|
||||
PrinterType? type,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
}) {
|
||||
return PrinterModel(
|
||||
id: id ?? this.id,
|
||||
code: code ?? this.code,
|
||||
name: name ?? this.name,
|
||||
ipAddress: ipAddress ?? this.ipAddress,
|
||||
size: size ?? this.size,
|
||||
type: type ?? this.type,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
);
|
||||
}
|
||||
|
||||
// Equality and hashCode for comparing instances
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
return other is PrinterModel &&
|
||||
other.id == id &&
|
||||
other.code == code &&
|
||||
other.name == name &&
|
||||
other.ipAddress == ipAddress &&
|
||||
other.size == size &&
|
||||
other.type == type;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return Object.hash(id, code, name, ipAddress, size, type);
|
||||
}
|
||||
|
||||
// String representation for debugging
|
||||
@override
|
||||
String toString() {
|
||||
return 'PrinterModel(id: $id, code: $code, name: $name, ipAddress: $ipAddress, size: $size, type: ${type.value}, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
// Validation methods
|
||||
bool get isValid {
|
||||
return code.isNotEmpty &&
|
||||
name.isNotEmpty &&
|
||||
ipAddress.isNotEmpty &&
|
||||
size.isNotEmpty;
|
||||
}
|
||||
|
||||
String? get validationError {
|
||||
if (code.isEmpty) return 'Printer code cannot be empty';
|
||||
if (name.isEmpty) return 'Printer name cannot be empty';
|
||||
if (ipAddress.isEmpty) return 'IP address cannot be empty';
|
||||
if (size.isEmpty) return 'Printer size cannot be empty';
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import 'package:enaklo_pos/core/constants/colors.dart';
|
||||
import 'package:enaklo_pos/presentation/setting/widgets/settings_title.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/presentation/setting/bloc/sync_order/sync_order_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/setting/bloc/sync_product/sync_product_bloc.dart';
|
||||
|
||||
class SyncDataPage extends StatefulWidget {
|
||||
@@ -114,53 +112,53 @@ class _SyncDataPageState extends State<SyncDataPage> {
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
BlocConsumer<SyncOrderBloc, SyncOrderState>(
|
||||
listener: (context, state) {
|
||||
state.maybeWhen(
|
||||
orElse: () {},
|
||||
error: (message) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
},
|
||||
loaded: () {
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// const SnackBar(
|
||||
// content: Text('Sync Order Success'),
|
||||
// backgroundColor: Colors.green,
|
||||
// ),
|
||||
// );
|
||||
},
|
||||
);
|
||||
},
|
||||
builder: (context, state) {
|
||||
return state.maybeWhen(
|
||||
orElse: () {
|
||||
return Button.filled(
|
||||
width: 100,
|
||||
height: 40,
|
||||
onPressed: () {
|
||||
log("🔘 Sync Order button pressed");
|
||||
log("🔘 SyncOrderBloc instance: ${context.read<SyncOrderBloc>()}");
|
||||
context
|
||||
.read<SyncOrderBloc>()
|
||||
.add(const SyncOrderEvent.syncOrder());
|
||||
log("🔘 SyncOrderEvent.syncOrder dispatched");
|
||||
},
|
||||
label: 'Sinkronasikan',
|
||||
);
|
||||
},
|
||||
loading: () {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
// BlocConsumer<SyncOrderBloc, SyncOrderState>(
|
||||
// listener: (context, state) {
|
||||
// state.maybeWhen(
|
||||
// orElse: () {},
|
||||
// error: (message) {
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text(message),
|
||||
// backgroundColor: Colors.red,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// loaded: () {
|
||||
// // ScaffoldMessenger.of(context).showSnackBar(
|
||||
// // const SnackBar(
|
||||
// // content: Text('Sync Order Success'),
|
||||
// // backgroundColor: Colors.green,
|
||||
// // ),
|
||||
// // );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// builder: (context, state) {
|
||||
// return state.maybeWhen(
|
||||
// orElse: () {
|
||||
// return Button.filled(
|
||||
// width: 100,
|
||||
// height: 40,
|
||||
// onPressed: () {
|
||||
// log("🔘 Sync Order button pressed");
|
||||
// log("🔘 SyncOrderBloc instance: ${context.read<SyncOrderBloc>()}");
|
||||
// context
|
||||
// .read<SyncOrderBloc>()
|
||||
// .add(const SyncOrderEvent.syncOrder());
|
||||
// log("🔘 SyncOrderEvent.syncOrder dispatched");
|
||||
// },
|
||||
// label: 'Sinkronasikan',
|
||||
// );
|
||||
// },
|
||||
// loading: () {
|
||||
// return const Center(
|
||||
// child: CircularProgressIndicator(),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'generate_table_event.dart';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:enaklo_pos/data/datasources/table_remote_datasource.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:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:enaklo_pos/data/datasources/product_local_datasource.dart';
|
||||
import 'package:enaklo_pos/data/models/response/table_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@@ -13,9 +12,6 @@ class UpdateTableBloc extends Bloc<UpdateTableEvent, UpdateTableState> {
|
||||
UpdateTableBloc() : super(_Initial()) {
|
||||
on<_UpdateTable>((event, emit) async {
|
||||
emit(_Loading());
|
||||
await ProductLocalDatasource.instance.updateTable(
|
||||
event.table,
|
||||
);
|
||||
emit(_Success('Update Table Success'));
|
||||
});
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,95 +0,0 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:enaklo_pos/core/components/components.dart';
|
||||
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||
import 'package:enaklo_pos/presentation/table/blocs/get_table/get_table_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/table/dialogs/form_table_dialog.dart';
|
||||
import 'package:enaklo_pos/presentation/table/widgets/card_table_widget.dart';
|
||||
|
||||
class TablePage extends StatefulWidget {
|
||||
const TablePage({super.key});
|
||||
|
||||
@override
|
||||
State<TablePage> createState() => _TablePageState();
|
||||
}
|
||||
|
||||
class _TablePageState extends State<TablePage> {
|
||||
@override
|
||||
void initState() {
|
||||
context.read<GetTableBloc>().add(const GetTableEvent.getTables());
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: ListView(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Table Management",
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
Button.filled(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => FormTableDialog(),
|
||||
);
|
||||
},
|
||||
label: 'Generate Table',
|
||||
height: 48.0,
|
||||
width: 200.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
SpaceHeight(24.0),
|
||||
BlocBuilder<GetTableBloc, GetTableState>(
|
||||
builder: (context, state) {
|
||||
return state.maybeWhen(
|
||||
orElse: () {
|
||||
return SizedBox.shrink();
|
||||
},
|
||||
loading: () {
|
||||
return const CircularProgressIndicator();
|
||||
},
|
||||
success: (tables) {
|
||||
if (tables.isEmpty) {
|
||||
return const Center(
|
||||
child: Text('No table available'),
|
||||
);
|
||||
}
|
||||
return GridView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
childAspectRatio: 1.0,
|
||||
crossAxisCount: 4,
|
||||
mainAxisSpacing: 16,
|
||||
crossAxisSpacing: 16,
|
||||
),
|
||||
itemCount: tables.length,
|
||||
shrinkWrap: true,
|
||||
physics: const ScrollPhysics(),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return CardTableWidget(
|
||||
table: tables[index],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:enaklo_pos/presentation/home/models/product_quantity.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:enaklo_pos/core/components/components.dart';
|
||||
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||
import 'package:enaklo_pos/core/extensions/date_time_ext.dart';
|
||||
import 'package:enaklo_pos/core/extensions/int_ext.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/presentation/home/bloc/checkout/checkout_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/home/bloc/status_table/status_table_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/home/pages/home_page.dart';
|
||||
import 'package:enaklo_pos/presentation/table/blocs/get_table/get_table_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/table/models/draft_order_model.dart';
|
||||
import 'package:enaklo_pos/presentation/table/pages/payment_table_page.dart.old';
|
||||
|
||||
class CardTableWidget extends StatefulWidget {
|
||||
final TableModel table;
|
||||
final List<ProductQuantity> items;
|
||||
const CardTableWidget({
|
||||
super.key,
|
||||
required this.table,
|
||||
required this.items,
|
||||
});
|
||||
|
||||
@override
|
||||
State<CardTableWidget> createState() => _CardTableWidgetState();
|
||||
}
|
||||
|
||||
class _CardTableWidgetState extends State<CardTableWidget> {
|
||||
DraftOrderModel? data;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
loadData();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
loadData() async {
|
||||
if (widget.table.status != 'available') {
|
||||
// data = await ProductLocalDatasource.instance
|
||||
// .getDraftOrderById(widget.table.orderId);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
height: 200,
|
||||
width: 200,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: widget.table.status == 'available'
|
||||
? AppColors.primary
|
||||
: AppColors.red,
|
||||
width: 2),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Table ${widget.table.tableName}',
|
||||
style: TextStyle(
|
||||
color: AppColors.black,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
// widget.table.status == 'available'
|
||||
// ? widget.table.status
|
||||
// : "${widget.table.status} - ${DateTime.parse(widget.table.startTime).toFormattedTime()}",
|
||||
"",
|
||||
style: TextStyle(
|
||||
color: AppColors.black,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Button.filled(
|
||||
color: widget.table.status == 'available'
|
||||
? AppColors.primary
|
||||
: AppColors.red,
|
||||
onPressed: () async {
|
||||
if (widget.table.status == 'available') {
|
||||
context.push(HomePage(
|
||||
isTable: true,
|
||||
table: widget.table,
|
||||
items: widget.items,
|
||||
));
|
||||
} else {
|
||||
context.read<CheckoutBloc>().add(
|
||||
CheckoutEvent.loadDraftOrder(data!),
|
||||
);
|
||||
log("Data Draft Order: ${data!.toMap()}");
|
||||
context.push(PaymentTablePage(
|
||||
table: widget.table,
|
||||
draftOrder: data!,
|
||||
));
|
||||
}
|
||||
},
|
||||
label: widget.table.status == 'available' ? 'Open' : 'Close')
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,399 +0,0 @@
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:enaklo_pos/core/components/buttons.dart';
|
||||
import 'package:enaklo_pos/core/components/custom_text_field.dart';
|
||||
import 'package:enaklo_pos/core/components/spaces.dart';
|
||||
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||
import 'package:enaklo_pos/core/utils/date_formatter.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/presentation/home/bloc/checkout/checkout_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/home/bloc/status_table/status_table_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/home/pages/dashboard_page.dart';
|
||||
import 'package:enaklo_pos/presentation/table/blocs/create_table/create_table_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/table/blocs/get_table/get_table_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/table/blocs/update_table/update_table_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/table/models/draft_order_model.dart';
|
||||
|
||||
import '../pages/payment_table_page.dart';
|
||||
|
||||
class TableWidget extends StatefulWidget {
|
||||
final TableModel table;
|
||||
const TableWidget({
|
||||
super.key,
|
||||
required this.table,
|
||||
});
|
||||
|
||||
@override
|
||||
State<TableWidget> createState() => _TableWidgetState();
|
||||
}
|
||||
|
||||
class _TableWidgetState extends State<TableWidget> {
|
||||
TextEditingController? tableNameController;
|
||||
DraftOrderModel? data;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadData();
|
||||
tableNameController = TextEditingController(text: widget.table.tableName);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
tableNameController!.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
loadData() async {
|
||||
if (widget.table.status != 'available') {
|
||||
// data = await ProductLocalDatasource.instance
|
||||
// .getDraftOrderById(widget.table.orderId);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
if (widget.table.status == 'available') {
|
||||
context.push(DashboardPage(
|
||||
table: widget.table,
|
||||
));
|
||||
} else {
|
||||
// Handle occupied table click - load draft order and navigate to payment
|
||||
context.read<CheckoutBloc>().add(
|
||||
CheckoutEvent.loadDraftOrder(data!),
|
||||
);
|
||||
log("Data Draft Order: ${data!.toMap()}");
|
||||
context.push(PaymentTablePage(
|
||||
table: widget.table,
|
||||
draftOrder: data!,
|
||||
));
|
||||
}
|
||||
},
|
||||
onLongPress: () {
|
||||
// dialog info table
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16)),
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(Icons.table_bar, color: AppColors.primary),
|
||||
SizedBox(width: 8),
|
||||
Text('Table ${widget.table.tableName}'),
|
||||
Spacer(),
|
||||
BlocListener<UpdateTableBloc, UpdateTableState>(
|
||||
listener: (context, state) {
|
||||
state.maybeWhen(
|
||||
orElse: () {},
|
||||
success: (message) {
|
||||
context
|
||||
.read<GetTableBloc>()
|
||||
.add(const GetTableEvent.getTables());
|
||||
context.pop();
|
||||
});
|
||||
},
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
// show dialaog adn input table name
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text('Update Table'),
|
||||
content: SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: 180,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
CustomTextField(
|
||||
controller: tableNameController!,
|
||||
label: 'Table Name',
|
||||
),
|
||||
SpaceHeight(16),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Button.outlined(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
label: 'close',
|
||||
),
|
||||
),
|
||||
SpaceWidth(16),
|
||||
Expanded(
|
||||
child: Button.filled(
|
||||
onPressed: () {
|
||||
// final newData =
|
||||
// TableModel(
|
||||
// id: widget.table.id,
|
||||
// tableName:
|
||||
// tableNameController!
|
||||
// .text,
|
||||
// status:
|
||||
// widget.table.status,
|
||||
// startTime: widget
|
||||
// .table.startTime,
|
||||
// orderId: widget
|
||||
// .table.orderId,
|
||||
// paymentAmount: widget
|
||||
// .table
|
||||
// .paymentAmount,
|
||||
// position: widget
|
||||
// .table.position,
|
||||
// );
|
||||
// context
|
||||
// .read<
|
||||
// UpdateTableBloc>()
|
||||
// .add(
|
||||
// UpdateTableEvent
|
||||
// .updateTable(
|
||||
// newData,
|
||||
// ),
|
||||
// );
|
||||
context
|
||||
.pop(); // close dialog after adding
|
||||
},
|
||||
label: 'Update',
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
actions: []);
|
||||
});
|
||||
},
|
||||
icon: Icon(Icons.edit)),
|
||||
),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildInfoRow(
|
||||
'Status:',
|
||||
widget.table.status == 'available'
|
||||
? 'Available'
|
||||
: 'Occupied',
|
||||
color: widget.table.status == 'available'
|
||||
? Colors.green
|
||||
: Colors.red),
|
||||
// widget.table.status == 'available'
|
||||
// ? SizedBox.shrink()
|
||||
// : _buildInfoRow(
|
||||
// 'Start Time:',
|
||||
// DateFormatter.formatDateTime2(
|
||||
// widget.table.startTime)),
|
||||
// widget.table.status == 'available'
|
||||
// ? SizedBox.shrink()
|
||||
// : _buildInfoRow(
|
||||
// 'Order ID:', widget.table.orderId.toString()),
|
||||
widget.table.status == 'available'
|
||||
? SizedBox.shrink()
|
||||
: SpaceHeight(16),
|
||||
widget.table.status == 'available'
|
||||
? SizedBox.shrink()
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Button.outlined(
|
||||
onPressed: () {
|
||||
// Show void confirmation dialog
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(Icons.warning,
|
||||
color: AppColors.red),
|
||||
SizedBox(width: 8),
|
||||
Text('Void Order?'),
|
||||
],
|
||||
),
|
||||
content: Text(
|
||||
'Apakah anda yakin ingin membatalkan pesanan untuk meja ${widget.table.tableName}?\n\nPesanan akan dihapus secara permanen.'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
Navigator.pop(context),
|
||||
child: Text('Tidak',
|
||||
style: TextStyle(
|
||||
color: AppColors.primary)),
|
||||
),
|
||||
BlocListener<StatusTableBloc,
|
||||
StatusTableState>(
|
||||
listener: (context, state) {
|
||||
state.maybeWhen(
|
||||
orElse: () {},
|
||||
success: () {
|
||||
context
|
||||
.read<GetTableBloc>()
|
||||
.add(const GetTableEvent
|
||||
.getTables());
|
||||
Navigator.pop(
|
||||
context); // Close void dialog
|
||||
Navigator.pop(
|
||||
context); // Close table info dialog
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Pesanan berhasil dibatalkan'),
|
||||
backgroundColor:
|
||||
AppColors.primary,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.red,
|
||||
),
|
||||
onPressed: () {
|
||||
// // Void the order
|
||||
// final newTable = TableModel(
|
||||
// id: widget.table.id,
|
||||
// tableName:
|
||||
// widget.table.tableName,
|
||||
// status: 'available',
|
||||
// orderId: 0,
|
||||
// paymentAmount: 0,
|
||||
// startTime: DateTime.now()
|
||||
// .toIso8601String(),
|
||||
// position: widget.table.position,
|
||||
// );
|
||||
// context
|
||||
// .read<StatusTableBloc>()
|
||||
// .add(
|
||||
// StatusTableEvent
|
||||
// .statusTabel(newTable),
|
||||
// );
|
||||
// // Remove draft order from local storage
|
||||
// ProductLocalDatasource.instance
|
||||
// .removeDraftOrderById(
|
||||
// widget.table.orderId);
|
||||
// log("Voided order for table: ${widget.table.tableName}");
|
||||
},
|
||||
child: const Text(
|
||||
"Ya, Batalkan",
|
||||
style: TextStyle(
|
||||
color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
label: 'Void Order',
|
||||
color: AppColors.red,
|
||||
textColor: AppColors.red,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: BlocConsumer<StatusTableBloc,
|
||||
StatusTableState>(
|
||||
listener: (context, state) {
|
||||
state.maybeWhen(
|
||||
orElse: () {},
|
||||
success: () {
|
||||
context.read<GetTableBloc>().add(
|
||||
const GetTableEvent.getTables());
|
||||
context.pop();
|
||||
});
|
||||
},
|
||||
builder: (context, state) {
|
||||
return Button.filled(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
context.read<CheckoutBloc>().add(
|
||||
CheckoutEvent.loadDraftOrder(
|
||||
data!),
|
||||
);
|
||||
context.push(PaymentTablePage(
|
||||
table: widget.table,
|
||||
draftOrder: data!,
|
||||
));
|
||||
},
|
||||
label: 'Selesai');
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child:
|
||||
Text('Close', style: TextStyle(color: AppColors.primary)),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: widget.table.status == 'available'
|
||||
? AppColors.primary
|
||||
: AppColors.red,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text('${widget.table.tableName}',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoRow(String label, String value, {Color? color}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
color: color ?? Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user