update pesanan

This commit is contained in:
Efril
2026-05-14 14:55:49 +07:00
parent 9f2097a268
commit c4618bbc1b
7 changed files with 719 additions and 207 deletions
@@ -30,6 +30,9 @@ class OrderLoaderBloc extends Bloc<OrderLoaderEvent, OrderLoaderState> {
searchChanged: (e) async {
emit(state.copyWith(search: e.search));
},
outletChanged: (e) async {
emit(state.copyWith(outletId: e.outletId));
},
fetched: (e) async {
var newState = state;
@@ -69,6 +72,7 @@ class OrderLoaderBloc extends Bloc<OrderLoaderEvent, OrderLoaderState> {
status: state.status == 'all' ? null : state.status,
page: state.page,
search: state.search,
outletId: state.outletId,
dateFrom: state.dateFrom,
dateTo: state.dateTo,
);
@@ -23,6 +23,7 @@ mixin _$OrderLoaderEvent {
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -30,6 +31,7 @@ mixin _$OrderLoaderEvent {
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -37,6 +39,7 @@ mixin _$OrderLoaderEvent {
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@@ -45,6 +48,7 @@ mixin _$OrderLoaderEvent {
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -52,6 +56,7 @@ mixin _$OrderLoaderEvent {
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -59,6 +64,7 @@ mixin _$OrderLoaderEvent {
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@@ -171,6 +177,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return rangeDateChanged(dateFrom, dateTo);
@@ -182,6 +189,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return rangeDateChanged?.call(dateFrom, dateTo);
@@ -193,6 +201,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
@@ -208,6 +217,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) {
return rangeDateChanged(this);
@@ -219,6 +229,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return rangeDateChanged?.call(this);
@@ -230,6 +241,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
@@ -330,6 +342,7 @@ class _$StatusChangedImpl implements _StatusChanged {
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return statusChanged(status);
@@ -341,6 +354,7 @@ class _$StatusChangedImpl implements _StatusChanged {
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return statusChanged?.call(status);
@@ -352,6 +366,7 @@ class _$StatusChangedImpl implements _StatusChanged {
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
@@ -367,6 +382,7 @@ class _$StatusChangedImpl implements _StatusChanged {
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) {
return statusChanged(this);
@@ -378,6 +394,7 @@ class _$StatusChangedImpl implements _StatusChanged {
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return statusChanged?.call(this);
@@ -389,6 +406,7 @@ class _$StatusChangedImpl implements _StatusChanged {
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
@@ -485,6 +503,7 @@ class _$SearchChangedImpl implements _SearchChanged {
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return searchChanged(search);
@@ -496,6 +515,7 @@ class _$SearchChangedImpl implements _SearchChanged {
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return searchChanged?.call(search);
@@ -507,6 +527,7 @@ class _$SearchChangedImpl implements _SearchChanged {
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
@@ -522,6 +543,7 @@ class _$SearchChangedImpl implements _SearchChanged {
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) {
return searchChanged(this);
@@ -533,6 +555,7 @@ class _$SearchChangedImpl implements _SearchChanged {
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return searchChanged?.call(this);
@@ -544,6 +567,7 @@ class _$SearchChangedImpl implements _SearchChanged {
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
@@ -566,6 +590,168 @@ abstract class _SearchChanged implements OrderLoaderEvent {
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$OutletChangedImplCopyWith<$Res> {
factory _$$OutletChangedImplCopyWith(
_$OutletChangedImpl value,
$Res Function(_$OutletChangedImpl) then,
) = __$$OutletChangedImplCopyWithImpl<$Res>;
@useResult
$Res call({String? outletId});
}
/// @nodoc
class __$$OutletChangedImplCopyWithImpl<$Res>
extends _$OrderLoaderEventCopyWithImpl<$Res, _$OutletChangedImpl>
implements _$$OutletChangedImplCopyWith<$Res> {
__$$OutletChangedImplCopyWithImpl(
_$OutletChangedImpl _value,
$Res Function(_$OutletChangedImpl) _then,
) : super(_value, _then);
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? outletId = freezed}) {
return _then(
_$OutletChangedImpl(
freezed == outletId
? _value.outletId
: outletId // ignore: cast_nullable_to_non_nullable
as String?,
),
);
}
}
/// @nodoc
class _$OutletChangedImpl implements _OutletChanged {
const _$OutletChangedImpl(this.outletId);
@override
final String? outletId;
@override
String toString() {
return 'OrderLoaderEvent.outletChanged(outletId: $outletId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OutletChangedImpl &&
(identical(other.outletId, outletId) ||
other.outletId == outletId));
}
@override
int get hashCode => Object.hash(runtimeType, outletId);
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$OutletChangedImplCopyWith<_$OutletChangedImpl> get copyWith =>
__$$OutletChangedImplCopyWithImpl<_$OutletChangedImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(DateTime dateFrom, DateTime dateTo)
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return outletChanged(outletId);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return outletChanged?.call(outletId);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
if (outletChanged != null) {
return outletChanged(outletId);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) {
return outletChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return outletChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
if (outletChanged != null) {
return outletChanged(this);
}
return orElse();
}
}
abstract class _OutletChanged implements OrderLoaderEvent {
const factory _OutletChanged(final String? outletId) = _$OutletChangedImpl;
String? get outletId;
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$OutletChangedImplCopyWith<_$OutletChangedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$FetchedImplCopyWith<$Res> {
factory _$$FetchedImplCopyWith(
@@ -642,6 +828,7 @@ class _$FetchedImpl implements _Fetched {
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return fetched(isRefresh);
@@ -653,6 +840,7 @@ class _$FetchedImpl implements _Fetched {
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return fetched?.call(isRefresh);
@@ -664,6 +852,7 @@ class _$FetchedImpl implements _Fetched {
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
@@ -679,6 +868,7 @@ class _$FetchedImpl implements _Fetched {
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) {
return fetched(this);
@@ -690,6 +880,7 @@ class _$FetchedImpl implements _Fetched {
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return fetched?.call(this);
@@ -701,6 +892,7 @@ class _$FetchedImpl implements _Fetched {
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
@@ -730,6 +922,7 @@ mixin _$OrderLoaderState {
throw _privateConstructorUsedError;
String get status => throw _privateConstructorUsedError;
String? get search => throw _privateConstructorUsedError;
String? get outletId => throw _privateConstructorUsedError;
bool get isFetching => throw _privateConstructorUsedError;
bool get hasReachedMax => throw _privateConstructorUsedError;
int get page => throw _privateConstructorUsedError;
@@ -755,6 +948,7 @@ abstract class $OrderLoaderStateCopyWith<$Res> {
Option<OrderFailure> failureOptionOrder,
String status,
String? search,
String? outletId,
bool isFetching,
bool hasReachedMax,
int page,
@@ -782,6 +976,7 @@ class _$OrderLoaderStateCopyWithImpl<$Res, $Val extends OrderLoaderState>
Object? failureOptionOrder = null,
Object? status = null,
Object? search = freezed,
Object? outletId = freezed,
Object? isFetching = null,
Object? hasReachedMax = null,
Object? page = null,
@@ -806,6 +1001,10 @@ class _$OrderLoaderStateCopyWithImpl<$Res, $Val extends OrderLoaderState>
? _value.search
: search // ignore: cast_nullable_to_non_nullable
as String?,
outletId: freezed == outletId
? _value.outletId
: outletId // ignore: cast_nullable_to_non_nullable
as String?,
isFetching: null == isFetching
? _value.isFetching
: isFetching // ignore: cast_nullable_to_non_nullable
@@ -846,6 +1045,7 @@ abstract class _$$OrderLoaderStateImplCopyWith<$Res>
Option<OrderFailure> failureOptionOrder,
String status,
String? search,
String? outletId,
bool isFetching,
bool hasReachedMax,
int page,
@@ -872,6 +1072,7 @@ class __$$OrderLoaderStateImplCopyWithImpl<$Res>
Object? failureOptionOrder = null,
Object? status = null,
Object? search = freezed,
Object? outletId = freezed,
Object? isFetching = null,
Object? hasReachedMax = null,
Object? page = null,
@@ -896,6 +1097,10 @@ class __$$OrderLoaderStateImplCopyWithImpl<$Res>
? _value.search
: search // ignore: cast_nullable_to_non_nullable
as String?,
outletId: freezed == outletId
? _value.outletId
: outletId // ignore: cast_nullable_to_non_nullable
as String?,
isFetching: null == isFetching
? _value.isFetching
: isFetching // ignore: cast_nullable_to_non_nullable
@@ -929,6 +1134,7 @@ class _$OrderLoaderStateImpl implements _OrderLoaderState {
required this.failureOptionOrder,
required this.status,
this.search,
this.outletId,
this.isFetching = false,
this.hasReachedMax = false,
this.page = 1,
@@ -951,6 +1157,8 @@ class _$OrderLoaderStateImpl implements _OrderLoaderState {
@override
final String? search;
@override
final String? outletId;
@override
@JsonKey()
final bool isFetching;
@override
@@ -966,7 +1174,7 @@ class _$OrderLoaderStateImpl implements _OrderLoaderState {
@override
String toString() {
return 'OrderLoaderState(orders: $orders, failureOptionOrder: $failureOptionOrder, status: $status, search: $search, isFetching: $isFetching, hasReachedMax: $hasReachedMax, page: $page, dateFrom: $dateFrom, dateTo: $dateTo)';
return 'OrderLoaderState(orders: $orders, failureOptionOrder: $failureOptionOrder, status: $status, search: $search, outletId: $outletId, isFetching: $isFetching, hasReachedMax: $hasReachedMax, page: $page, dateFrom: $dateFrom, dateTo: $dateTo)';
}
@override
@@ -979,6 +1187,8 @@ class _$OrderLoaderStateImpl implements _OrderLoaderState {
other.failureOptionOrder == failureOptionOrder) &&
(identical(other.status, status) || other.status == status) &&
(identical(other.search, search) || other.search == search) &&
(identical(other.outletId, outletId) ||
other.outletId == outletId) &&
(identical(other.isFetching, isFetching) ||
other.isFetching == isFetching) &&
(identical(other.hasReachedMax, hasReachedMax) ||
@@ -996,6 +1206,7 @@ class _$OrderLoaderStateImpl implements _OrderLoaderState {
failureOptionOrder,
status,
search,
outletId,
isFetching,
hasReachedMax,
page,
@@ -1021,6 +1232,7 @@ abstract class _OrderLoaderState implements OrderLoaderState {
required final Option<OrderFailure> failureOptionOrder,
required final String status,
final String? search,
final String? outletId,
final bool isFetching,
final bool hasReachedMax,
final int page,
@@ -1037,6 +1249,8 @@ abstract class _OrderLoaderState implements OrderLoaderState {
@override
String? get search;
@override
String? get outletId;
@override
bool get isFetching;
@override
bool get hasReachedMax;
@@ -8,6 +8,8 @@ class OrderLoaderEvent with _$OrderLoaderEvent {
) = _RangeDateChanged;
const factory OrderLoaderEvent.statusChanged(String status) = _StatusChanged;
const factory OrderLoaderEvent.searchChanged(String search) = _SearchChanged;
const factory OrderLoaderEvent.outletChanged(String? outletId) =
_OutletChanged;
const factory OrderLoaderEvent.fetched({@Default(false) bool isRefresh}) =
_Fetched;
}
@@ -7,6 +7,7 @@ class OrderLoaderState with _$OrderLoaderState {
required Option<OrderFailure> failureOptionOrder,
required String status,
String? search,
String? outletId,
@Default(false) bool isFetching,
@Default(false) bool hasReachedMax,
@Default(1) int page,