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

View File

@ -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,
);

View File

@ -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;

View File

@ -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;
}

View File

@ -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,

View File

@ -134,9 +134,9 @@ extension GetItInjectableX on _i174.GetIt {
final gh = _i526.GetItHelper(this, environment, environmentFilter);
final firebaseDi = _$FirebaseDi();
final sharedPreferencesDi = _$SharedPreferencesDi();
final dioDi = _$DioDi();
final autoRouteDi = _$AutoRouteDi();
final connectivityDi = _$ConnectivityDi();
final dioDi = _$DioDi();
final packageInfoDi = _$PackageInfoDi();
await gh.factoryAsync<_i982.FirebaseApp>(
() => firebaseDi.firebaseApp,
@ -146,9 +146,9 @@ extension GetItInjectableX on _i174.GetIt {
() => sharedPreferencesDi.prefs,
preResolve: true,
);
gh.lazySingleton<_i361.Dio>(() => dioDi.dio);
gh.lazySingleton<_i258.AppRouter>(() => autoRouteDi.appRouter);
gh.lazySingleton<_i895.Connectivity>(() => connectivityDi.connectivity);
gh.lazySingleton<_i361.Dio>(() => dioDi.dio);
await gh.lazySingletonAsync<_i655.PackageInfo>(
() => packageInfoDi.packageInfo,
preResolve: true,
@ -172,29 +172,29 @@ extension GetItInjectableX on _i174.GetIt {
() => _i115.ApiClient(gh<_i361.Dio>(), gh<_i6.Env>()),
);
gh.factory<_i6.Env>(() => _i6.ProdEnv(), registerFor: {_prod});
gh.factory<_i130.OrderRemoteDataProvider>(
() => _i130.OrderRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i333.CategoryRemoteDataProvider>(
() => _i333.CategoryRemoteDataProvider(gh<_i115.ApiClient>()),
gh.factory<_i866.AnalyticRemoteDataProvider>(
() => _i866.AnalyticRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i17.AuthRemoteDataProvider>(
() => _i17.AuthRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i785.UserRemoteDataProvider>(
() => _i785.UserRemoteDataProvider(gh<_i115.ApiClient>()),
gh.factory<_i333.CategoryRemoteDataProvider>(
() => _i333.CategoryRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i823.ProductRemoteDataProvider>(
() => _i823.ProductRemoteDataProvider(gh<_i115.ApiClient>()),
gh.factory<_i1006.CustomerRemoteDataProvider>(
() => _i1006.CustomerRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i130.OrderRemoteDataProvider>(
() => _i130.OrderRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i27.OutletRemoteDataProvider>(
() => _i27.OutletRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i866.AnalyticRemoteDataProvider>(
() => _i866.AnalyticRemoteDataProvider(gh<_i115.ApiClient>()),
gh.factory<_i823.ProductRemoteDataProvider>(
() => _i823.ProductRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i1006.CustomerRemoteDataProvider>(
() => _i1006.CustomerRemoteDataProvider(gh<_i115.ApiClient>()),
gh.factory<_i785.UserRemoteDataProvider>(
() => _i785.UserRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i48.ICustomerRepository>(
() => _i550.CustomerRepository(gh<_i1006.CustomerRemoteDataProvider>()),
@ -248,20 +248,23 @@ extension GetItInjectableX on _i174.GetIt {
gh<_i850.OutletLocalDataProvider>(),
),
);
gh.factory<_i473.HomeBloc>(
() => _i473.HomeBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i889.SalesLoaderBloc>(
() => _i889.SalesLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i473.HomeBloc>(
() => _i473.HomeBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i877.OutletListLoaderBloc>(
() => _i877.OutletListLoaderBloc(gh<_i197.IOutletRepository>()),
);
gh.factory<_i337.CurrentOutletLoaderBloc>(
() => _i337.CurrentOutletLoaderBloc(gh<_i197.IOutletRepository>()),
);
gh.factory<_i221.ProductAnalyticLoaderBloc>(
() => _i221.ProductAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
gh.factory<_i1038.CategoryAnalyticLoaderBloc>(
() => _i1038.CategoryAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i516.DashboardAnalyticLoaderBloc>(
() => _i516.DashboardAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i785.InventoryAnalyticLoaderBloc>(
() => _i785.InventoryAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
@ -271,15 +274,12 @@ extension GetItInjectableX on _i174.GetIt {
gh<_i477.IAnalyticRepository>(),
),
);
gh.factory<_i1038.CategoryAnalyticLoaderBloc>(
() => _i1038.CategoryAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
gh.factory<_i221.ProductAnalyticLoaderBloc>(
() => _i221.ProductAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i11.ProfitLossLoaderBloc>(
() => _i11.ProfitLossLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i516.DashboardAnalyticLoaderBloc>(
() => _i516.DashboardAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i945.AuthBloc>(
() => _i945.AuthBloc(gh<_i49.IAuthRepository>()),
);
@ -289,12 +289,12 @@ extension GetItInjectableX on _i174.GetIt {
gh.factory<_i1058.OrderLoaderBloc>(
() => _i1058.OrderLoaderBloc(gh<_i219.IOrderRepository>()),
);
gh.factory<_i147.UserEditFormBloc>(
() => _i147.UserEditFormBloc(gh<_i635.IUserRepository>()),
);
gh.factory<_i1030.ChangePasswordFormBloc>(
() => _i1030.ChangePasswordFormBloc(gh<_i635.IUserRepository>()),
);
gh.factory<_i147.UserEditFormBloc>(
() => _i147.UserEditFormBloc(gh<_i635.IUserRepository>()),
);
gh.factory<_i775.LoginFormBloc>(
() => _i775.LoginFormBloc(
gh<_i49.IAuthRepository>(),
@ -302,14 +302,14 @@ extension GetItInjectableX on _i174.GetIt {
gh<_i179.FcmService>(),
),
);
gh.factory<_i605.TransactionReportBloc>(
() => _i605.TransactionReportBloc(
gh.factory<_i346.InventoryReportBloc>(
() => _i346.InventoryReportBloc(
gh<_i477.IAnalyticRepository>(),
gh<_i197.IOutletRepository>(),
),
);
gh.factory<_i346.InventoryReportBloc>(
() => _i346.InventoryReportBloc(
gh.factory<_i605.TransactionReportBloc>(
() => _i605.TransactionReportBloc(
gh<_i477.IAnalyticRepository>(),
gh<_i197.IOutletRepository>(),
),
@ -322,10 +322,10 @@ class _$FirebaseDi extends _i73.FirebaseDi {}
class _$SharedPreferencesDi extends _i402.SharedPreferencesDi {}
class _$DioDi extends _i103.DioDi {}
class _$AutoRouteDi extends _i311.AutoRouteDi {}
class _$ConnectivityDi extends _i586.ConnectivityDi {}
class _$DioDi extends _i103.DioDi {}
class _$PackageInfoDi extends _i227.PackageInfoDi {}

View File

@ -6,6 +6,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:shimmer/shimmer.dart';
import '../../../../application/order/order_loader/order_loader_bloc.dart';
import '../../../../application/outlet/outlet_list_loader/outlet_list_loader_bloc.dart';
import '../../../../common/extension/extension.dart';
import '../../../../common/theme/theme.dart';
import '../../../../injection.dart';
@ -23,10 +24,19 @@ class OrderPage extends StatefulWidget implements AutoRouteWrapper {
State<OrderPage> createState() => _OrderPageState();
@override
Widget wrappedRoute(BuildContext context) => BlocProvider(
Widget wrappedRoute(BuildContext context) => MultiBlocProvider(
providers: [
BlocProvider(
create: (_) =>
getIt<OrderLoaderBloc>()
..add(OrderLoaderEvent.fetched(isRefresh: true)),
),
BlocProvider(
create: (_) =>
getIt<OutletListLoaderBloc>()
..add(const OutletListLoaderEvent.fetched()),
),
],
child: this,
);
}
@ -179,6 +189,14 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
backgroundColor: AppColor.background,
body: MultiBlocListener(
listeners: [
BlocListener<OrderLoaderBloc, OrderLoaderState>(
listenWhen: (p, c) => p.outletId != c.outletId,
listener: (context, state) {
context.read<OrderLoaderBloc>().add(
OrderLoaderEvent.fetched(isRefresh: true),
);
},
),
BlocListener<OrderLoaderBloc, OrderLoaderState>(
listenWhen: (p, c) => p.status != c.status,
listener: (context, state) {
@ -198,7 +216,9 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
},
),
],
child: BlocBuilder<OrderLoaderBloc, OrderLoaderState>(
child: BlocBuilder<OutletListLoaderBloc, OutletListLoaderState>(
builder: (context, outletListState) {
return BlocBuilder<OrderLoaderBloc, OrderLoaderState>(
builder: (context, state) {
return NotificationListener<ScrollNotification>(
onNotification: (notification) {
@ -243,6 +263,8 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
endDate: state.dateTo,
filterOptions: filterOptions,
selectedFilter: state.status,
selectedOutletId: state.outletId,
outletListState: outletListState,
onDateChanged: (startDate, endDate) {
if (startDate != null && endDate != null) {
log('Date changed');
@ -256,11 +278,15 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
},
onFilterChanged: (filter) {
final status = filter.toLowerCase();
context.read<OrderLoaderBloc>().add(
OrderLoaderEvent.statusChanged(status),
);
},
onOutletChanged: (outletId) {
context.read<OrderLoaderBloc>().add(
OrderLoaderEvent.outletChanged(outletId),
);
},
),
),
@ -276,9 +302,12 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
child: Column(
children: [
// Show filtered transaction count
if (state.status != 'all' && !state.isFetching)
if (state.status != 'all' &&
!state.isFetching)
Padding(
padding: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.only(
bottom: 16,
),
child: Row(
children: [
Text(
@ -298,7 +327,8 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
else if (state.orders.isEmpty)
EmptyWidget(
title: context.lang.order,
message: context.lang.no_order_with_status(
message:
context.lang.no_order_with_status(
state.status.toLowerCase(),
),
)
@ -331,6 +361,8 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
),
);
},
);
},
),
),
);

View File

@ -1,6 +1,9 @@
import 'package:flutter/material.dart';
import '../../../../../application/outlet/outlet_list_loader/outlet_list_loader_bloc.dart';
import '../../../../../common/extension/extension.dart';
import '../../../../../common/theme/theme.dart';
import '../../../../../domain/outlet/outlet.dart';
import '../../../../components/field/date_range_picker_field.dart';
import 'status_tile.dart';
@ -11,8 +14,11 @@ class FilterHeaderDelegate extends SliverPersistentHeaderDelegate {
final DateTime? endDate;
final List<String> filterOptions;
final String selectedFilter;
final String? selectedOutletId;
final OutletListLoaderState outletListState;
final Function(DateTime?, DateTime?) onDateChanged;
final Function(String) onFilterChanged;
final Function(String?) onOutletChanged;
FilterHeaderDelegate({
required this.backgroundColor,
@ -21,15 +27,18 @@ class FilterHeaderDelegate extends SliverPersistentHeaderDelegate {
required this.endDate,
required this.filterOptions,
required this.selectedFilter,
required this.selectedOutletId,
required this.outletListState,
required this.onDateChanged,
required this.onFilterChanged,
required this.onOutletChanged,
});
@override
double get minExtent => 130;
double get minExtent => 190;
@override
double get maxExtent => 130;
double get maxExtent => 190;
@override
Widget build(
@ -37,64 +46,314 @@ class FilterHeaderDelegate extends SliverPersistentHeaderDelegate {
double shrinkOffset,
bool overlapsContent,
) {
final selectedOutlet = outletListState.outlets
.where((o) => o.id == selectedOutletId)
.firstOrNull;
return Container(
color: backgroundColor,
padding: padding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: DateRangePickerField(
// Date range picker
DateRangePickerField(
maxDate: DateTime.now(),
startDate: startDate,
endDate: endDate,
onChanged: (start, end) {
onDateChanged(start, end);
},
onChanged: (start, end) => onDateChanged(start, end),
),
const SizedBox(height: 8),
// Outlet selector + status chips
_OutletSelectorField(
selectedOutlet: selectedOutlet,
isLoading: outletListState.isFetching,
onTap: () => _showOutletSheet(context),
),
Expanded(
child: SingleChildScrollView(
const SizedBox(height: 8),
// Status chips
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: filterOptions.asMap().entries.map((entry) {
final index = entry.key;
final option = entry.value;
return Padding(
padding: EdgeInsets.only(
right: index < filterOptions.length - 1 ? 8 : 0,
),
child: OrderStatusTile(
label: option == "All"
label: option == 'All'
? context.lang.all
: option == "Completed"
: option == 'Completed'
? context.lang.completed
: context.lang.pending,
isSelected: option == selectedFilter,
isSelected: option.toLowerCase() == selectedFilter,
onSelected: (isSelected) {
if (isSelected) {
onFilterChanged(option);
}
if (isSelected) onFilterChanged(option);
},
),
);
}).toList(),
),
),
),
],
),
);
}
void _showOutletSheet(BuildContext context) {
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
),
builder: (_) => _OutletBottomSheet(
outlets: outletListState.outlets,
selectedOutletId: selectedOutletId,
onSelected: (outletId) {
Navigator.pop(context);
onOutletChanged(outletId);
},
),
);
}
@override
bool shouldRebuild(covariant FilterHeaderDelegate oldDelegate) {
return oldDelegate.startDate != startDate ||
oldDelegate.endDate != endDate ||
oldDelegate.selectedFilter != selectedFilter ||
oldDelegate.selectedOutletId != selectedOutletId ||
oldDelegate.outletListState.outlets.length !=
outletListState.outlets.length ||
oldDelegate.outletListState.isFetching != outletListState.isFetching ||
oldDelegate.filterOptions.length != filterOptions.length ||
oldDelegate.backgroundColor != backgroundColor;
}
}
// Field outlet ikut style DateRangePickerField
class _OutletSelectorField extends StatefulWidget {
final Outlet? selectedOutlet;
final bool isLoading;
final VoidCallback onTap;
const _OutletSelectorField({
required this.selectedOutlet,
required this.isLoading,
required this.onTap,
});
@override
State<_OutletSelectorField> createState() => _OutletSelectorFieldState();
}
class _OutletSelectorFieldState extends State<_OutletSelectorField> {
bool _isPressed = false;
@override
Widget build(BuildContext context) {
final hasValue = widget.selectedOutlet != null;
final label = widget.selectedOutlet?.name ?? 'Semua Outlet';
return GestureDetector(
onTap: widget.isLoading ? null : widget.onTap,
onTapDown: (_) => setState(() => _isPressed = true),
onTapUp: (_) => setState(() => _isPressed = false),
onTapCancel: () => setState(() => _isPressed = false),
child: AnimatedContainer(
duration: const Duration(milliseconds: 150),
height: 52,
padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: _isPressed ? AppColor.backgroundLight : AppColor.white,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: _isPressed ? AppColor.primary : AppColor.border,
width: _isPressed ? 2 : 1,
),
boxShadow: _isPressed
? [
BoxShadow(
color: AppColor.primary.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 2),
),
]
: null,
),
child: Row(
children: [
Expanded(
child: Text(
label,
style: TextStyle(
fontSize: 15,
fontWeight: hasValue ? FontWeight.w500 : FontWeight.w400,
color: hasValue
? AppColor.textPrimary
: AppColor.textSecondary,
),
overflow: TextOverflow.ellipsis,
),
),
Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: AppColor.primary.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: widget.isLoading
? const SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
color: AppColor.primary,
),
)
: const Icon(
Icons.store_rounded,
size: 20,
color: AppColor.primary,
),
),
],
),
),
);
}
}
// Bottom sheet pilih outlet
class _OutletBottomSheet extends StatelessWidget {
final List<Outlet> outlets;
final String? selectedOutletId;
final Function(String?) onSelected;
const _OutletBottomSheet({
required this.outlets,
required this.selectedOutletId,
required this.onSelected,
});
@override
Widget build(BuildContext context) {
return SafeArea(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 16, 20, 20),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Container(
width: 40,
height: 4,
decoration: BoxDecoration(
color: Colors.grey.shade300,
borderRadius: BorderRadius.circular(2),
),
),
),
const SizedBox(height: 16),
Text(
'Pilih Outlet',
style: AppStyle.lg.copyWith(fontWeight: FontWeight.w700),
),
const SizedBox(height: 12),
_OutletItem(
label: 'Semua Outlet',
icon: Icons.store_rounded,
isSelected: selectedOutletId == null,
onTap: () => onSelected(null),
),
const Divider(height: 1),
...outlets.map(
(outlet) => Column(
children: [
_OutletItem(
label: outlet.name,
icon: Icons.storefront_rounded,
isSelected: selectedOutletId == outlet.id,
isActive: outlet.isActive,
onTap: () => onSelected(outlet.id),
),
if (outlet != outlets.last) const Divider(height: 1),
],
),
),
],
),
),
);
}
}
class _OutletItem extends StatelessWidget {
final String label;
final IconData icon;
final bool isSelected;
final bool? isActive;
final VoidCallback onTap;
const _OutletItem({
required this.label,
required this.icon,
required this.isSelected,
required this.onTap,
this.isActive,
});
@override
Widget build(BuildContext context) {
return ListTile(
onTap: onTap,
contentPadding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
leading: Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: isSelected
? AppColor.primary.withOpacity(0.1)
: AppColor.background,
borderRadius: BorderRadius.circular(10),
),
child: Icon(
icon,
size: 18,
color: isSelected ? AppColor.primary : AppColor.textSecondary,
),
),
title: Text(
label,
style: AppStyle.md.copyWith(
fontWeight: isSelected ? FontWeight.w700 : FontWeight.w500,
color: isSelected ? AppColor.primary : AppColor.textPrimary,
),
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (isActive != null)
Container(
width: 8,
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: isActive! ? AppColor.success : AppColor.error,
),
),
if (isActive != null) const SizedBox(width: 8),
if (isSelected)
const Icon(
Icons.check_rounded,
color: AppColor.primary,
size: 20,
),
],
),
);
}
}