feat: product analytic range date
This commit is contained in:
parent
ac8c2c0f54
commit
a61b19e45c
@ -24,6 +24,9 @@ class ProductAnalyticLoaderBloc
|
|||||||
Emitter<ProductAnalyticLoaderState> emit,
|
Emitter<ProductAnalyticLoaderState> emit,
|
||||||
) {
|
) {
|
||||||
return event.map(
|
return event.map(
|
||||||
|
rangeDateChanged: (e) async {
|
||||||
|
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||||
|
},
|
||||||
fetched: (e) async {
|
fetched: (e) async {
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
@ -33,8 +36,8 @@ class ProductAnalyticLoaderBloc
|
|||||||
);
|
);
|
||||||
|
|
||||||
final result = await _repository.getProduct(
|
final result = await _repository.getProduct(
|
||||||
dateFrom: DateTime.now().subtract(const Duration(days: 30)),
|
dateFrom: state.dateFrom,
|
||||||
dateTo: DateTime.now(),
|
dateTo: state.dateTo,
|
||||||
);
|
);
|
||||||
|
|
||||||
var data = result.fold(
|
var data = result.fold(
|
||||||
|
|||||||
@ -19,27 +19,34 @@ final _privateConstructorUsedError = UnsupportedError(
|
|||||||
mixin _$ProductAnalyticLoaderEvent {
|
mixin _$ProductAnalyticLoaderEvent {
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
required TResult Function() fetched,
|
required TResult Function() fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
TResult? Function()? fetched,
|
TResult? Function()? fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
TResult Function()? fetched,
|
TResult Function()? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult map<TResult extends Object?>({
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
required TResult Function(_Fetched value) fetched,
|
required TResult Function(_Fetched value) fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult? Function(_Fetched value)? fetched,
|
TResult? Function(_Fetched value)? fetched,
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult Function(_Fetched value)? fetched,
|
TResult Function(_Fetched value)? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) => throw _privateConstructorUsedError;
|
}) => throw _privateConstructorUsedError;
|
||||||
@ -74,6 +81,165 @@ class _$ProductAnalyticLoaderEventCopyWithImpl<
|
|||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||||
|
factory _$$RangeDateChangedImplCopyWith(
|
||||||
|
_$RangeDateChangedImpl value,
|
||||||
|
$Res Function(_$RangeDateChangedImpl) then,
|
||||||
|
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||||
|
@useResult
|
||||||
|
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||||
|
extends
|
||||||
|
_$ProductAnalyticLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl>
|
||||||
|
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||||
|
__$$RangeDateChangedImplCopyWithImpl(
|
||||||
|
_$RangeDateChangedImpl _value,
|
||||||
|
$Res Function(_$RangeDateChangedImpl) _then,
|
||||||
|
) : super(_value, _then);
|
||||||
|
|
||||||
|
/// Create a copy of ProductAnalyticLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||||
|
return _then(
|
||||||
|
_$RangeDateChangedImpl(
|
||||||
|
null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||||
|
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProductAnalyticLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$RangeDateChangedImpl &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||||
|
|
||||||
|
/// Create a copy of ProductAnalyticLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||||
|
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||||
|
this,
|
||||||
|
_$identity,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult Function()? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (rangeDateChanged != null) {
|
||||||
|
return rangeDateChanged(dateFrom, dateTo);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
|
required TResult Function(_Fetched value) fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult? Function(_Fetched value)? fetched,
|
||||||
|
}) {
|
||||||
|
return rangeDateChanged?.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@optionalTypeArgs
|
||||||
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
|
TResult Function(_Fetched value)? fetched,
|
||||||
|
required TResult orElse(),
|
||||||
|
}) {
|
||||||
|
if (rangeDateChanged != null) {
|
||||||
|
return rangeDateChanged(this);
|
||||||
|
}
|
||||||
|
return orElse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _RangeDateChanged implements ProductAnalyticLoaderEvent {
|
||||||
|
const factory _RangeDateChanged(
|
||||||
|
final DateTime dateFrom,
|
||||||
|
final DateTime dateTo,
|
||||||
|
) = _$RangeDateChangedImpl;
|
||||||
|
|
||||||
|
DateTime get dateFrom;
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
|
/// Create a copy of ProductAnalyticLoaderEvent
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||||
factory _$$FetchedImplCopyWith(
|
factory _$$FetchedImplCopyWith(
|
||||||
@ -116,19 +282,27 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({required TResult Function() fetched}) {
|
TResult when<TResult extends Object?>({
|
||||||
|
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||||
|
rangeDateChanged,
|
||||||
|
required TResult Function() fetched,
|
||||||
|
}) {
|
||||||
return fetched();
|
return fetched();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? whenOrNull<TResult extends Object?>({TResult? Function()? fetched}) {
|
TResult? whenOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
|
TResult? Function()? fetched,
|
||||||
|
}) {
|
||||||
return fetched?.call();
|
return fetched?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
|
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||||
TResult Function()? fetched,
|
TResult Function()? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@ -141,6 +315,7 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult map<TResult extends Object?>({
|
TResult map<TResult extends Object?>({
|
||||||
|
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||||
required TResult Function(_Fetched value) fetched,
|
required TResult Function(_Fetched value) fetched,
|
||||||
}) {
|
}) {
|
||||||
return fetched(this);
|
return fetched(this);
|
||||||
@ -149,6 +324,7 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
TResult? mapOrNull<TResult extends Object?>({
|
||||||
|
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult? Function(_Fetched value)? fetched,
|
TResult? Function(_Fetched value)? fetched,
|
||||||
}) {
|
}) {
|
||||||
return fetched?.call(this);
|
return fetched?.call(this);
|
||||||
@ -157,6 +333,7 @@ class _$FetchedImpl implements _Fetched {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
|
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||||
TResult Function(_Fetched value)? fetched,
|
TResult Function(_Fetched value)? fetched,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@ -177,6 +354,8 @@ mixin _$ProductAnalyticLoaderState {
|
|||||||
Option<AnalyticFailure> get failureOptionProductAnalytic =>
|
Option<AnalyticFailure> get failureOptionProductAnalytic =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
bool get isFetching => throw _privateConstructorUsedError;
|
bool get isFetching => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||||
|
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Create a copy of ProductAnalyticLoaderState
|
/// Create a copy of ProductAnalyticLoaderState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -200,6 +379,8 @@ abstract class $ProductAnalyticLoaderStateCopyWith<$Res> {
|
|||||||
ProductAnalytic productAnalytic,
|
ProductAnalytic productAnalytic,
|
||||||
Option<AnalyticFailure> failureOptionProductAnalytic,
|
Option<AnalyticFailure> failureOptionProductAnalytic,
|
||||||
bool isFetching,
|
bool isFetching,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
});
|
});
|
||||||
|
|
||||||
$ProductAnalyticCopyWith<$Res> get productAnalytic;
|
$ProductAnalyticCopyWith<$Res> get productAnalytic;
|
||||||
@ -226,6 +407,8 @@ class _$ProductAnalyticLoaderStateCopyWithImpl<
|
|||||||
Object? productAnalytic = null,
|
Object? productAnalytic = null,
|
||||||
Object? failureOptionProductAnalytic = null,
|
Object? failureOptionProductAnalytic = null,
|
||||||
Object? isFetching = null,
|
Object? isFetching = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_value.copyWith(
|
_value.copyWith(
|
||||||
@ -241,6 +424,14 @@ class _$ProductAnalyticLoaderStateCopyWithImpl<
|
|||||||
? _value.isFetching
|
? _value.isFetching
|
||||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
)
|
)
|
||||||
as $Val,
|
as $Val,
|
||||||
);
|
);
|
||||||
@ -270,6 +461,8 @@ abstract class _$$ProductAnalyticLoaderStateImplCopyWith<$Res>
|
|||||||
ProductAnalytic productAnalytic,
|
ProductAnalytic productAnalytic,
|
||||||
Option<AnalyticFailure> failureOptionProductAnalytic,
|
Option<AnalyticFailure> failureOptionProductAnalytic,
|
||||||
bool isFetching,
|
bool isFetching,
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -297,6 +490,8 @@ class __$$ProductAnalyticLoaderStateImplCopyWithImpl<$Res>
|
|||||||
Object? productAnalytic = null,
|
Object? productAnalytic = null,
|
||||||
Object? failureOptionProductAnalytic = null,
|
Object? failureOptionProductAnalytic = null,
|
||||||
Object? isFetching = null,
|
Object? isFetching = null,
|
||||||
|
Object? dateFrom = null,
|
||||||
|
Object? dateTo = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_$ProductAnalyticLoaderStateImpl(
|
_$ProductAnalyticLoaderStateImpl(
|
||||||
@ -312,6 +507,14 @@ class __$$ProductAnalyticLoaderStateImplCopyWithImpl<$Res>
|
|||||||
? _value.isFetching
|
? _value.isFetching
|
||||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
dateFrom: null == dateFrom
|
||||||
|
? _value.dateFrom
|
||||||
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
|
dateTo: null == dateTo
|
||||||
|
? _value.dateTo
|
||||||
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
|
as DateTime,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -324,6 +527,8 @@ class _$ProductAnalyticLoaderStateImpl implements _ProductAnalyticLoaderState {
|
|||||||
required this.productAnalytic,
|
required this.productAnalytic,
|
||||||
required this.failureOptionProductAnalytic,
|
required this.failureOptionProductAnalytic,
|
||||||
this.isFetching = false,
|
this.isFetching = false,
|
||||||
|
required this.dateFrom,
|
||||||
|
required this.dateTo,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -333,10 +538,14 @@ class _$ProductAnalyticLoaderStateImpl implements _ProductAnalyticLoaderState {
|
|||||||
@override
|
@override
|
||||||
@JsonKey()
|
@JsonKey()
|
||||||
final bool isFetching;
|
final bool isFetching;
|
||||||
|
@override
|
||||||
|
final DateTime dateFrom;
|
||||||
|
@override
|
||||||
|
final DateTime dateTo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ProductAnalyticLoaderState(productAnalytic: $productAnalytic, failureOptionProductAnalytic: $failureOptionProductAnalytic, isFetching: $isFetching)';
|
return 'ProductAnalyticLoaderState(productAnalytic: $productAnalytic, failureOptionProductAnalytic: $failureOptionProductAnalytic, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -353,7 +562,10 @@ class _$ProductAnalyticLoaderStateImpl implements _ProductAnalyticLoaderState {
|
|||||||
other.failureOptionProductAnalytic ==
|
other.failureOptionProductAnalytic ==
|
||||||
failureOptionProductAnalytic) &&
|
failureOptionProductAnalytic) &&
|
||||||
(identical(other.isFetching, isFetching) ||
|
(identical(other.isFetching, isFetching) ||
|
||||||
other.isFetching == isFetching));
|
other.isFetching == isFetching) &&
|
||||||
|
(identical(other.dateFrom, dateFrom) ||
|
||||||
|
other.dateFrom == dateFrom) &&
|
||||||
|
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -362,6 +574,8 @@ class _$ProductAnalyticLoaderStateImpl implements _ProductAnalyticLoaderState {
|
|||||||
productAnalytic,
|
productAnalytic,
|
||||||
failureOptionProductAnalytic,
|
failureOptionProductAnalytic,
|
||||||
isFetching,
|
isFetching,
|
||||||
|
dateFrom,
|
||||||
|
dateTo,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Create a copy of ProductAnalyticLoaderState
|
/// Create a copy of ProductAnalyticLoaderState
|
||||||
@ -382,6 +596,8 @@ abstract class _ProductAnalyticLoaderState
|
|||||||
required final ProductAnalytic productAnalytic,
|
required final ProductAnalytic productAnalytic,
|
||||||
required final Option<AnalyticFailure> failureOptionProductAnalytic,
|
required final Option<AnalyticFailure> failureOptionProductAnalytic,
|
||||||
final bool isFetching,
|
final bool isFetching,
|
||||||
|
required final DateTime dateFrom,
|
||||||
|
required final DateTime dateTo,
|
||||||
}) = _$ProductAnalyticLoaderStateImpl;
|
}) = _$ProductAnalyticLoaderStateImpl;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -390,6 +606,10 @@ abstract class _ProductAnalyticLoaderState
|
|||||||
Option<AnalyticFailure> get failureOptionProductAnalytic;
|
Option<AnalyticFailure> get failureOptionProductAnalytic;
|
||||||
@override
|
@override
|
||||||
bool get isFetching;
|
bool get isFetching;
|
||||||
|
@override
|
||||||
|
DateTime get dateFrom;
|
||||||
|
@override
|
||||||
|
DateTime get dateTo;
|
||||||
|
|
||||||
/// Create a copy of ProductAnalyticLoaderState
|
/// Create a copy of ProductAnalyticLoaderState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|||||||
@ -2,5 +2,9 @@ part of 'product_analytic_loader_bloc.dart';
|
|||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class ProductAnalyticLoaderEvent with _$ProductAnalyticLoaderEvent {
|
class ProductAnalyticLoaderEvent with _$ProductAnalyticLoaderEvent {
|
||||||
|
const factory ProductAnalyticLoaderEvent.rangeDateChanged(
|
||||||
|
DateTime dateFrom,
|
||||||
|
DateTime dateTo,
|
||||||
|
) = _RangeDateChanged;
|
||||||
const factory ProductAnalyticLoaderEvent.fetched() = _Fetched;
|
const factory ProductAnalyticLoaderEvent.fetched() = _Fetched;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,10 +6,14 @@ class ProductAnalyticLoaderState with _$ProductAnalyticLoaderState {
|
|||||||
required ProductAnalytic productAnalytic,
|
required ProductAnalytic productAnalytic,
|
||||||
required Option<AnalyticFailure> failureOptionProductAnalytic,
|
required Option<AnalyticFailure> failureOptionProductAnalytic,
|
||||||
@Default(false) bool isFetching,
|
@Default(false) bool isFetching,
|
||||||
|
required DateTime dateFrom,
|
||||||
|
required DateTime dateTo,
|
||||||
}) = _ProductAnalyticLoaderState;
|
}) = _ProductAnalyticLoaderState;
|
||||||
|
|
||||||
factory ProductAnalyticLoaderState.initial() => ProductAnalyticLoaderState(
|
factory ProductAnalyticLoaderState.initial() => ProductAnalyticLoaderState(
|
||||||
productAnalytic: ProductAnalytic.empty(),
|
productAnalytic: ProductAnalytic.empty(),
|
||||||
failureOptionProductAnalytic: none(),
|
failureOptionProductAnalytic: none(),
|
||||||
|
dateFrom: DateTime.now().subtract(const Duration(days: 30)),
|
||||||
|
dateTo: DateTime.now(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5972,7 +5972,7 @@ mixin _$ProductAnalyticData {
|
|||||||
String get categoryId => throw _privateConstructorUsedError;
|
String get categoryId => throw _privateConstructorUsedError;
|
||||||
String get categoryName => throw _privateConstructorUsedError;
|
String get categoryName => throw _privateConstructorUsedError;
|
||||||
int get quantitySold => throw _privateConstructorUsedError;
|
int get quantitySold => throw _privateConstructorUsedError;
|
||||||
double get revenue => throw _privateConstructorUsedError;
|
int get revenue => throw _privateConstructorUsedError;
|
||||||
double get averagePrice => throw _privateConstructorUsedError;
|
double get averagePrice => throw _privateConstructorUsedError;
|
||||||
int get orderCount => throw _privateConstructorUsedError;
|
int get orderCount => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
@ -5996,7 +5996,7 @@ abstract class $ProductAnalyticDataCopyWith<$Res> {
|
|||||||
String categoryId,
|
String categoryId,
|
||||||
String categoryName,
|
String categoryName,
|
||||||
int quantitySold,
|
int quantitySold,
|
||||||
double revenue,
|
int revenue,
|
||||||
double averagePrice,
|
double averagePrice,
|
||||||
int orderCount,
|
int orderCount,
|
||||||
});
|
});
|
||||||
@ -6051,7 +6051,7 @@ class _$ProductAnalyticDataCopyWithImpl<$Res, $Val extends ProductAnalyticData>
|
|||||||
revenue: null == revenue
|
revenue: null == revenue
|
||||||
? _value.revenue
|
? _value.revenue
|
||||||
: revenue // ignore: cast_nullable_to_non_nullable
|
: revenue // ignore: cast_nullable_to_non_nullable
|
||||||
as double,
|
as int,
|
||||||
averagePrice: null == averagePrice
|
averagePrice: null == averagePrice
|
||||||
? _value.averagePrice
|
? _value.averagePrice
|
||||||
: averagePrice // ignore: cast_nullable_to_non_nullable
|
: averagePrice // ignore: cast_nullable_to_non_nullable
|
||||||
@ -6081,7 +6081,7 @@ abstract class _$$ProductAnalyticDataImplCopyWith<$Res>
|
|||||||
String categoryId,
|
String categoryId,
|
||||||
String categoryName,
|
String categoryName,
|
||||||
int quantitySold,
|
int quantitySold,
|
||||||
double revenue,
|
int revenue,
|
||||||
double averagePrice,
|
double averagePrice,
|
||||||
int orderCount,
|
int orderCount,
|
||||||
});
|
});
|
||||||
@ -6135,7 +6135,7 @@ class __$$ProductAnalyticDataImplCopyWithImpl<$Res>
|
|||||||
revenue: null == revenue
|
revenue: null == revenue
|
||||||
? _value.revenue
|
? _value.revenue
|
||||||
: revenue // ignore: cast_nullable_to_non_nullable
|
: revenue // ignore: cast_nullable_to_non_nullable
|
||||||
as double,
|
as int,
|
||||||
averagePrice: null == averagePrice
|
averagePrice: null == averagePrice
|
||||||
? _value.averagePrice
|
? _value.averagePrice
|
||||||
: averagePrice // ignore: cast_nullable_to_non_nullable
|
: averagePrice // ignore: cast_nullable_to_non_nullable
|
||||||
@ -6174,7 +6174,7 @@ class _$ProductAnalyticDataImpl implements _ProductAnalyticData {
|
|||||||
@override
|
@override
|
||||||
final int quantitySold;
|
final int quantitySold;
|
||||||
@override
|
@override
|
||||||
final double revenue;
|
final int revenue;
|
||||||
@override
|
@override
|
||||||
final double averagePrice;
|
final double averagePrice;
|
||||||
@override
|
@override
|
||||||
@ -6239,7 +6239,7 @@ abstract class _ProductAnalyticData implements ProductAnalyticData {
|
|||||||
required final String categoryId,
|
required final String categoryId,
|
||||||
required final String categoryName,
|
required final String categoryName,
|
||||||
required final int quantitySold,
|
required final int quantitySold,
|
||||||
required final double revenue,
|
required final int revenue,
|
||||||
required final double averagePrice,
|
required final double averagePrice,
|
||||||
required final int orderCount,
|
required final int orderCount,
|
||||||
}) = _$ProductAnalyticDataImpl;
|
}) = _$ProductAnalyticDataImpl;
|
||||||
@ -6255,7 +6255,7 @@ abstract class _ProductAnalyticData implements ProductAnalyticData {
|
|||||||
@override
|
@override
|
||||||
int get quantitySold;
|
int get quantitySold;
|
||||||
@override
|
@override
|
||||||
double get revenue;
|
int get revenue;
|
||||||
@override
|
@override
|
||||||
double get averagePrice;
|
double get averagePrice;
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class ProductAnalyticData with _$ProductAnalyticData {
|
|||||||
required String categoryId,
|
required String categoryId,
|
||||||
required String categoryName,
|
required String categoryName,
|
||||||
required int quantitySold,
|
required int quantitySold,
|
||||||
required double revenue,
|
required int revenue,
|
||||||
required double averagePrice,
|
required double averagePrice,
|
||||||
required int orderCount,
|
required int orderCount,
|
||||||
}) = _ProductAnalyticData;
|
}) = _ProductAnalyticData;
|
||||||
@ -38,7 +38,7 @@ class ProductAnalyticData with _$ProductAnalyticData {
|
|||||||
categoryId: '',
|
categoryId: '',
|
||||||
categoryName: '',
|
categoryName: '',
|
||||||
quantitySold: 0,
|
quantitySold: 0,
|
||||||
revenue: 0.0,
|
revenue: 0,
|
||||||
averagePrice: 0.0,
|
averagePrice: 0.0,
|
||||||
orderCount: 0,
|
orderCount: 0,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6661,14 +6661,15 @@ ProductAnalyticDto _$ProductAnalyticDtoFromJson(Map<String, dynamic> json) {
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$ProductAnalyticDto {
|
mixin _$ProductAnalyticDto {
|
||||||
@JsonKey(name: 'organization_id')
|
@JsonKey(name: 'organization_id')
|
||||||
String get organizationId => throw _privateConstructorUsedError;
|
String? get organizationId => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'outlet_id')
|
@JsonKey(name: 'outlet_id')
|
||||||
String get outletId => throw _privateConstructorUsedError;
|
String? get outletId => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'date_from')
|
@JsonKey(name: 'date_from')
|
||||||
String get dateFrom => throw _privateConstructorUsedError;
|
String? get dateFrom => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'date_to')
|
@JsonKey(name: 'date_to')
|
||||||
String get dateTo => throw _privateConstructorUsedError;
|
String? get dateTo => throw _privateConstructorUsedError;
|
||||||
List<ProductAnalyticDataDto> get data => throw _privateConstructorUsedError;
|
@JsonKey(name: 'data')
|
||||||
|
List<ProductAnalyticDataDto>? get data => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Serializes this ProductAnalyticDto to a JSON map.
|
/// Serializes this ProductAnalyticDto to a JSON map.
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
@ -6688,11 +6689,11 @@ abstract class $ProductAnalyticDtoCopyWith<$Res> {
|
|||||||
) = _$ProductAnalyticDtoCopyWithImpl<$Res, ProductAnalyticDto>;
|
) = _$ProductAnalyticDtoCopyWithImpl<$Res, ProductAnalyticDto>;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
@JsonKey(name: 'organization_id') String organizationId,
|
@JsonKey(name: 'organization_id') String? organizationId,
|
||||||
@JsonKey(name: 'outlet_id') String outletId,
|
@JsonKey(name: 'outlet_id') String? outletId,
|
||||||
@JsonKey(name: 'date_from') String dateFrom,
|
@JsonKey(name: 'date_from') String? dateFrom,
|
||||||
@JsonKey(name: 'date_to') String dateTo,
|
@JsonKey(name: 'date_to') String? dateTo,
|
||||||
List<ProductAnalyticDataDto> data,
|
@JsonKey(name: 'data') List<ProductAnalyticDataDto>? data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6711,34 +6712,34 @@ class _$ProductAnalyticDtoCopyWithImpl<$Res, $Val extends ProductAnalyticDto>
|
|||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? organizationId = null,
|
Object? organizationId = freezed,
|
||||||
Object? outletId = null,
|
Object? outletId = freezed,
|
||||||
Object? dateFrom = null,
|
Object? dateFrom = freezed,
|
||||||
Object? dateTo = null,
|
Object? dateTo = freezed,
|
||||||
Object? data = null,
|
Object? data = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_value.copyWith(
|
_value.copyWith(
|
||||||
organizationId: null == organizationId
|
organizationId: freezed == organizationId
|
||||||
? _value.organizationId
|
? _value.organizationId
|
||||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
outletId: null == outletId
|
outletId: freezed == outletId
|
||||||
? _value.outletId
|
? _value.outletId
|
||||||
: outletId // ignore: cast_nullable_to_non_nullable
|
: outletId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
dateFrom: null == dateFrom
|
dateFrom: freezed == dateFrom
|
||||||
? _value.dateFrom
|
? _value.dateFrom
|
||||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
dateTo: null == dateTo
|
dateTo: freezed == dateTo
|
||||||
? _value.dateTo
|
? _value.dateTo
|
||||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
data: null == data
|
data: freezed == data
|
||||||
? _value.data
|
? _value.data
|
||||||
: data // ignore: cast_nullable_to_non_nullable
|
: data // ignore: cast_nullable_to_non_nullable
|
||||||
as List<ProductAnalyticDataDto>,
|
as List<ProductAnalyticDataDto>?,
|
||||||
)
|
)
|
||||||
as $Val,
|
as $Val,
|
||||||
);
|
);
|
||||||
@ -6755,11 +6756,11 @@ abstract class _$$ProductAnalyticDtoImplCopyWith<$Res>
|
|||||||
@override
|
@override
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
@JsonKey(name: 'organization_id') String organizationId,
|
@JsonKey(name: 'organization_id') String? organizationId,
|
||||||
@JsonKey(name: 'outlet_id') String outletId,
|
@JsonKey(name: 'outlet_id') String? outletId,
|
||||||
@JsonKey(name: 'date_from') String dateFrom,
|
@JsonKey(name: 'date_from') String? dateFrom,
|
||||||
@JsonKey(name: 'date_to') String dateTo,
|
@JsonKey(name: 'date_to') String? dateTo,
|
||||||
List<ProductAnalyticDataDto> data,
|
@JsonKey(name: 'data') List<ProductAnalyticDataDto>? data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6777,34 +6778,34 @@ class __$$ProductAnalyticDtoImplCopyWithImpl<$Res>
|
|||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? organizationId = null,
|
Object? organizationId = freezed,
|
||||||
Object? outletId = null,
|
Object? outletId = freezed,
|
||||||
Object? dateFrom = null,
|
Object? dateFrom = freezed,
|
||||||
Object? dateTo = null,
|
Object? dateTo = freezed,
|
||||||
Object? data = null,
|
Object? data = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_$ProductAnalyticDtoImpl(
|
_$ProductAnalyticDtoImpl(
|
||||||
organizationId: null == organizationId
|
organizationId: freezed == organizationId
|
||||||
? _value.organizationId
|
? _value.organizationId
|
||||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
outletId: null == outletId
|
outletId: freezed == outletId
|
||||||
? _value.outletId
|
? _value.outletId
|
||||||
: outletId // ignore: cast_nullable_to_non_nullable
|
: outletId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
dateFrom: null == dateFrom
|
dateFrom: freezed == dateFrom
|
||||||
? _value.dateFrom
|
? _value.dateFrom
|
||||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
dateTo: null == dateTo
|
dateTo: freezed == dateTo
|
||||||
? _value.dateTo
|
? _value.dateTo
|
||||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
data: null == data
|
data: freezed == data
|
||||||
? _value._data
|
? _value._data
|
||||||
: data // ignore: cast_nullable_to_non_nullable
|
: data // ignore: cast_nullable_to_non_nullable
|
||||||
as List<ProductAnalyticDataDto>,
|
as List<ProductAnalyticDataDto>?,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -6814,11 +6815,11 @@ class __$$ProductAnalyticDtoImplCopyWithImpl<$Res>
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class _$ProductAnalyticDtoImpl extends _ProductAnalyticDto {
|
class _$ProductAnalyticDtoImpl extends _ProductAnalyticDto {
|
||||||
const _$ProductAnalyticDtoImpl({
|
const _$ProductAnalyticDtoImpl({
|
||||||
@JsonKey(name: 'organization_id') required this.organizationId,
|
@JsonKey(name: 'organization_id') this.organizationId,
|
||||||
@JsonKey(name: 'outlet_id') required this.outletId,
|
@JsonKey(name: 'outlet_id') this.outletId,
|
||||||
@JsonKey(name: 'date_from') required this.dateFrom,
|
@JsonKey(name: 'date_from') this.dateFrom,
|
||||||
@JsonKey(name: 'date_to') required this.dateTo,
|
@JsonKey(name: 'date_to') this.dateTo,
|
||||||
required final List<ProductAnalyticDataDto> data,
|
@JsonKey(name: 'data') final List<ProductAnalyticDataDto>? data,
|
||||||
}) : _data = data,
|
}) : _data = data,
|
||||||
super._();
|
super._();
|
||||||
|
|
||||||
@ -6827,22 +6828,25 @@ class _$ProductAnalyticDtoImpl extends _ProductAnalyticDto {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'organization_id')
|
@JsonKey(name: 'organization_id')
|
||||||
final String organizationId;
|
final String? organizationId;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'outlet_id')
|
@JsonKey(name: 'outlet_id')
|
||||||
final String outletId;
|
final String? outletId;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'date_from')
|
@JsonKey(name: 'date_from')
|
||||||
final String dateFrom;
|
final String? dateFrom;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'date_to')
|
@JsonKey(name: 'date_to')
|
||||||
final String dateTo;
|
final String? dateTo;
|
||||||
final List<ProductAnalyticDataDto> _data;
|
final List<ProductAnalyticDataDto>? _data;
|
||||||
@override
|
@override
|
||||||
List<ProductAnalyticDataDto> get data {
|
@JsonKey(name: 'data')
|
||||||
|
List<ProductAnalyticDataDto>? get data {
|
||||||
|
final value = _data;
|
||||||
|
if (value == null) return null;
|
||||||
if (_data is EqualUnmodifiableListView) return _data;
|
if (_data is EqualUnmodifiableListView) return _data;
|
||||||
// ignore: implicit_dynamic_type
|
// ignore: implicit_dynamic_type
|
||||||
return EqualUnmodifiableListView(_data);
|
return EqualUnmodifiableListView(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -6895,11 +6899,11 @@ class _$ProductAnalyticDtoImpl extends _ProductAnalyticDto {
|
|||||||
|
|
||||||
abstract class _ProductAnalyticDto extends ProductAnalyticDto {
|
abstract class _ProductAnalyticDto extends ProductAnalyticDto {
|
||||||
const factory _ProductAnalyticDto({
|
const factory _ProductAnalyticDto({
|
||||||
@JsonKey(name: 'organization_id') required final String organizationId,
|
@JsonKey(name: 'organization_id') final String? organizationId,
|
||||||
@JsonKey(name: 'outlet_id') required final String outletId,
|
@JsonKey(name: 'outlet_id') final String? outletId,
|
||||||
@JsonKey(name: 'date_from') required final String dateFrom,
|
@JsonKey(name: 'date_from') final String? dateFrom,
|
||||||
@JsonKey(name: 'date_to') required final String dateTo,
|
@JsonKey(name: 'date_to') final String? dateTo,
|
||||||
required final List<ProductAnalyticDataDto> data,
|
@JsonKey(name: 'data') final List<ProductAnalyticDataDto>? data,
|
||||||
}) = _$ProductAnalyticDtoImpl;
|
}) = _$ProductAnalyticDtoImpl;
|
||||||
const _ProductAnalyticDto._() : super._();
|
const _ProductAnalyticDto._() : super._();
|
||||||
|
|
||||||
@ -6908,18 +6912,19 @@ abstract class _ProductAnalyticDto extends ProductAnalyticDto {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'organization_id')
|
@JsonKey(name: 'organization_id')
|
||||||
String get organizationId;
|
String? get organizationId;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'outlet_id')
|
@JsonKey(name: 'outlet_id')
|
||||||
String get outletId;
|
String? get outletId;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'date_from')
|
@JsonKey(name: 'date_from')
|
||||||
String get dateFrom;
|
String? get dateFrom;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'date_to')
|
@JsonKey(name: 'date_to')
|
||||||
String get dateTo;
|
String? get dateTo;
|
||||||
@override
|
@override
|
||||||
List<ProductAnalyticDataDto> get data;
|
@JsonKey(name: 'data')
|
||||||
|
List<ProductAnalyticDataDto>? get data;
|
||||||
|
|
||||||
/// Create a copy of ProductAnalyticDto
|
/// Create a copy of ProductAnalyticDto
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -6938,20 +6943,21 @@ ProductAnalyticDataDto _$ProductAnalyticDataDtoFromJson(
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$ProductAnalyticDataDto {
|
mixin _$ProductAnalyticDataDto {
|
||||||
@JsonKey(name: 'product_id')
|
@JsonKey(name: 'product_id')
|
||||||
String get productId => throw _privateConstructorUsedError;
|
String? get productId => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'product_name')
|
@JsonKey(name: 'product_name')
|
||||||
String get productName => throw _privateConstructorUsedError;
|
String? get productName => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'category_id')
|
@JsonKey(name: 'category_id')
|
||||||
String get categoryId => throw _privateConstructorUsedError;
|
String? get categoryId => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'category_name')
|
@JsonKey(name: 'category_name')
|
||||||
String get categoryName => throw _privateConstructorUsedError;
|
String? get categoryName => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'quantity_sold')
|
@JsonKey(name: 'quantity_sold')
|
||||||
int get quantitySold => throw _privateConstructorUsedError;
|
int? get quantitySold => throw _privateConstructorUsedError;
|
||||||
double get revenue => throw _privateConstructorUsedError;
|
@JsonKey(name: 'revenue')
|
||||||
|
int? get revenue => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'average_price')
|
@JsonKey(name: 'average_price')
|
||||||
double get averagePrice => throw _privateConstructorUsedError;
|
double? get averagePrice => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: 'order_count')
|
@JsonKey(name: 'order_count')
|
||||||
int get orderCount => throw _privateConstructorUsedError;
|
int? get orderCount => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Serializes this ProductAnalyticDataDto to a JSON map.
|
/// Serializes this ProductAnalyticDataDto to a JSON map.
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
@ -6971,14 +6977,14 @@ abstract class $ProductAnalyticDataDtoCopyWith<$Res> {
|
|||||||
) = _$ProductAnalyticDataDtoCopyWithImpl<$Res, ProductAnalyticDataDto>;
|
) = _$ProductAnalyticDataDtoCopyWithImpl<$Res, ProductAnalyticDataDto>;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
@JsonKey(name: 'product_id') String productId,
|
@JsonKey(name: 'product_id') String? productId,
|
||||||
@JsonKey(name: 'product_name') String productName,
|
@JsonKey(name: 'product_name') String? productName,
|
||||||
@JsonKey(name: 'category_id') String categoryId,
|
@JsonKey(name: 'category_id') String? categoryId,
|
||||||
@JsonKey(name: 'category_name') String categoryName,
|
@JsonKey(name: 'category_name') String? categoryName,
|
||||||
@JsonKey(name: 'quantity_sold') int quantitySold,
|
@JsonKey(name: 'quantity_sold') int? quantitySold,
|
||||||
double revenue,
|
@JsonKey(name: 'revenue') int? revenue,
|
||||||
@JsonKey(name: 'average_price') double averagePrice,
|
@JsonKey(name: 'average_price') double? averagePrice,
|
||||||
@JsonKey(name: 'order_count') int orderCount,
|
@JsonKey(name: 'order_count') int? orderCount,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7000,49 +7006,49 @@ class _$ProductAnalyticDataDtoCopyWithImpl<
|
|||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? productId = null,
|
Object? productId = freezed,
|
||||||
Object? productName = null,
|
Object? productName = freezed,
|
||||||
Object? categoryId = null,
|
Object? categoryId = freezed,
|
||||||
Object? categoryName = null,
|
Object? categoryName = freezed,
|
||||||
Object? quantitySold = null,
|
Object? quantitySold = freezed,
|
||||||
Object? revenue = null,
|
Object? revenue = freezed,
|
||||||
Object? averagePrice = null,
|
Object? averagePrice = freezed,
|
||||||
Object? orderCount = null,
|
Object? orderCount = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_value.copyWith(
|
_value.copyWith(
|
||||||
productId: null == productId
|
productId: freezed == productId
|
||||||
? _value.productId
|
? _value.productId
|
||||||
: productId // ignore: cast_nullable_to_non_nullable
|
: productId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
productName: null == productName
|
productName: freezed == productName
|
||||||
? _value.productName
|
? _value.productName
|
||||||
: productName // ignore: cast_nullable_to_non_nullable
|
: productName // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
categoryId: null == categoryId
|
categoryId: freezed == categoryId
|
||||||
? _value.categoryId
|
? _value.categoryId
|
||||||
: categoryId // ignore: cast_nullable_to_non_nullable
|
: categoryId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
categoryName: null == categoryName
|
categoryName: freezed == categoryName
|
||||||
? _value.categoryName
|
? _value.categoryName
|
||||||
: categoryName // ignore: cast_nullable_to_non_nullable
|
: categoryName // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
quantitySold: null == quantitySold
|
quantitySold: freezed == quantitySold
|
||||||
? _value.quantitySold
|
? _value.quantitySold
|
||||||
: quantitySold // ignore: cast_nullable_to_non_nullable
|
: quantitySold // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as int?,
|
||||||
revenue: null == revenue
|
revenue: freezed == revenue
|
||||||
? _value.revenue
|
? _value.revenue
|
||||||
: revenue // ignore: cast_nullable_to_non_nullable
|
: revenue // ignore: cast_nullable_to_non_nullable
|
||||||
as double,
|
as int?,
|
||||||
averagePrice: null == averagePrice
|
averagePrice: freezed == averagePrice
|
||||||
? _value.averagePrice
|
? _value.averagePrice
|
||||||
: averagePrice // ignore: cast_nullable_to_non_nullable
|
: averagePrice // ignore: cast_nullable_to_non_nullable
|
||||||
as double,
|
as double?,
|
||||||
orderCount: null == orderCount
|
orderCount: freezed == orderCount
|
||||||
? _value.orderCount
|
? _value.orderCount
|
||||||
: orderCount // ignore: cast_nullable_to_non_nullable
|
: orderCount // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as int?,
|
||||||
)
|
)
|
||||||
as $Val,
|
as $Val,
|
||||||
);
|
);
|
||||||
@ -7059,14 +7065,14 @@ abstract class _$$ProductAnalyticDataDtoImplCopyWith<$Res>
|
|||||||
@override
|
@override
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
@JsonKey(name: 'product_id') String productId,
|
@JsonKey(name: 'product_id') String? productId,
|
||||||
@JsonKey(name: 'product_name') String productName,
|
@JsonKey(name: 'product_name') String? productName,
|
||||||
@JsonKey(name: 'category_id') String categoryId,
|
@JsonKey(name: 'category_id') String? categoryId,
|
||||||
@JsonKey(name: 'category_name') String categoryName,
|
@JsonKey(name: 'category_name') String? categoryName,
|
||||||
@JsonKey(name: 'quantity_sold') int quantitySold,
|
@JsonKey(name: 'quantity_sold') int? quantitySold,
|
||||||
double revenue,
|
@JsonKey(name: 'revenue') int? revenue,
|
||||||
@JsonKey(name: 'average_price') double averagePrice,
|
@JsonKey(name: 'average_price') double? averagePrice,
|
||||||
@JsonKey(name: 'order_count') int orderCount,
|
@JsonKey(name: 'order_count') int? orderCount,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7085,49 +7091,49 @@ class __$$ProductAnalyticDataDtoImplCopyWithImpl<$Res>
|
|||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? productId = null,
|
Object? productId = freezed,
|
||||||
Object? productName = null,
|
Object? productName = freezed,
|
||||||
Object? categoryId = null,
|
Object? categoryId = freezed,
|
||||||
Object? categoryName = null,
|
Object? categoryName = freezed,
|
||||||
Object? quantitySold = null,
|
Object? quantitySold = freezed,
|
||||||
Object? revenue = null,
|
Object? revenue = freezed,
|
||||||
Object? averagePrice = null,
|
Object? averagePrice = freezed,
|
||||||
Object? orderCount = null,
|
Object? orderCount = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(
|
return _then(
|
||||||
_$ProductAnalyticDataDtoImpl(
|
_$ProductAnalyticDataDtoImpl(
|
||||||
productId: null == productId
|
productId: freezed == productId
|
||||||
? _value.productId
|
? _value.productId
|
||||||
: productId // ignore: cast_nullable_to_non_nullable
|
: productId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
productName: null == productName
|
productName: freezed == productName
|
||||||
? _value.productName
|
? _value.productName
|
||||||
: productName // ignore: cast_nullable_to_non_nullable
|
: productName // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
categoryId: null == categoryId
|
categoryId: freezed == categoryId
|
||||||
? _value.categoryId
|
? _value.categoryId
|
||||||
: categoryId // ignore: cast_nullable_to_non_nullable
|
: categoryId // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
categoryName: null == categoryName
|
categoryName: freezed == categoryName
|
||||||
? _value.categoryName
|
? _value.categoryName
|
||||||
: categoryName // ignore: cast_nullable_to_non_nullable
|
: categoryName // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String?,
|
||||||
quantitySold: null == quantitySold
|
quantitySold: freezed == quantitySold
|
||||||
? _value.quantitySold
|
? _value.quantitySold
|
||||||
: quantitySold // ignore: cast_nullable_to_non_nullable
|
: quantitySold // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as int?,
|
||||||
revenue: null == revenue
|
revenue: freezed == revenue
|
||||||
? _value.revenue
|
? _value.revenue
|
||||||
: revenue // ignore: cast_nullable_to_non_nullable
|
: revenue // ignore: cast_nullable_to_non_nullable
|
||||||
as double,
|
as int?,
|
||||||
averagePrice: null == averagePrice
|
averagePrice: freezed == averagePrice
|
||||||
? _value.averagePrice
|
? _value.averagePrice
|
||||||
: averagePrice // ignore: cast_nullable_to_non_nullable
|
: averagePrice // ignore: cast_nullable_to_non_nullable
|
||||||
as double,
|
as double?,
|
||||||
orderCount: null == orderCount
|
orderCount: freezed == orderCount
|
||||||
? _value.orderCount
|
? _value.orderCount
|
||||||
: orderCount // ignore: cast_nullable_to_non_nullable
|
: orderCount // ignore: cast_nullable_to_non_nullable
|
||||||
as int,
|
as int?,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -7137,14 +7143,14 @@ class __$$ProductAnalyticDataDtoImplCopyWithImpl<$Res>
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class _$ProductAnalyticDataDtoImpl extends _ProductAnalyticDataDto {
|
class _$ProductAnalyticDataDtoImpl extends _ProductAnalyticDataDto {
|
||||||
const _$ProductAnalyticDataDtoImpl({
|
const _$ProductAnalyticDataDtoImpl({
|
||||||
@JsonKey(name: 'product_id') required this.productId,
|
@JsonKey(name: 'product_id') this.productId,
|
||||||
@JsonKey(name: 'product_name') required this.productName,
|
@JsonKey(name: 'product_name') this.productName,
|
||||||
@JsonKey(name: 'category_id') required this.categoryId,
|
@JsonKey(name: 'category_id') this.categoryId,
|
||||||
@JsonKey(name: 'category_name') required this.categoryName,
|
@JsonKey(name: 'category_name') this.categoryName,
|
||||||
@JsonKey(name: 'quantity_sold') required this.quantitySold,
|
@JsonKey(name: 'quantity_sold') this.quantitySold,
|
||||||
required this.revenue,
|
@JsonKey(name: 'revenue') this.revenue,
|
||||||
@JsonKey(name: 'average_price') required this.averagePrice,
|
@JsonKey(name: 'average_price') this.averagePrice,
|
||||||
@JsonKey(name: 'order_count') required this.orderCount,
|
@JsonKey(name: 'order_count') this.orderCount,
|
||||||
}) : super._();
|
}) : super._();
|
||||||
|
|
||||||
factory _$ProductAnalyticDataDtoImpl.fromJson(Map<String, dynamic> json) =>
|
factory _$ProductAnalyticDataDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
@ -7152,27 +7158,28 @@ class _$ProductAnalyticDataDtoImpl extends _ProductAnalyticDataDto {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'product_id')
|
@JsonKey(name: 'product_id')
|
||||||
final String productId;
|
final String? productId;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'product_name')
|
@JsonKey(name: 'product_name')
|
||||||
final String productName;
|
final String? productName;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'category_id')
|
@JsonKey(name: 'category_id')
|
||||||
final String categoryId;
|
final String? categoryId;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'category_name')
|
@JsonKey(name: 'category_name')
|
||||||
final String categoryName;
|
final String? categoryName;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'quantity_sold')
|
@JsonKey(name: 'quantity_sold')
|
||||||
final int quantitySold;
|
final int? quantitySold;
|
||||||
@override
|
@override
|
||||||
final double revenue;
|
@JsonKey(name: 'revenue')
|
||||||
|
final int? revenue;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'average_price')
|
@JsonKey(name: 'average_price')
|
||||||
final double averagePrice;
|
final double? averagePrice;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'order_count')
|
@JsonKey(name: 'order_count')
|
||||||
final int orderCount;
|
final int? orderCount;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
@ -7235,14 +7242,14 @@ class _$ProductAnalyticDataDtoImpl extends _ProductAnalyticDataDto {
|
|||||||
|
|
||||||
abstract class _ProductAnalyticDataDto extends ProductAnalyticDataDto {
|
abstract class _ProductAnalyticDataDto extends ProductAnalyticDataDto {
|
||||||
const factory _ProductAnalyticDataDto({
|
const factory _ProductAnalyticDataDto({
|
||||||
@JsonKey(name: 'product_id') required final String productId,
|
@JsonKey(name: 'product_id') final String? productId,
|
||||||
@JsonKey(name: 'product_name') required final String productName,
|
@JsonKey(name: 'product_name') final String? productName,
|
||||||
@JsonKey(name: 'category_id') required final String categoryId,
|
@JsonKey(name: 'category_id') final String? categoryId,
|
||||||
@JsonKey(name: 'category_name') required final String categoryName,
|
@JsonKey(name: 'category_name') final String? categoryName,
|
||||||
@JsonKey(name: 'quantity_sold') required final int quantitySold,
|
@JsonKey(name: 'quantity_sold') final int? quantitySold,
|
||||||
required final double revenue,
|
@JsonKey(name: 'revenue') final int? revenue,
|
||||||
@JsonKey(name: 'average_price') required final double averagePrice,
|
@JsonKey(name: 'average_price') final double? averagePrice,
|
||||||
@JsonKey(name: 'order_count') required final int orderCount,
|
@JsonKey(name: 'order_count') final int? orderCount,
|
||||||
}) = _$ProductAnalyticDataDtoImpl;
|
}) = _$ProductAnalyticDataDtoImpl;
|
||||||
const _ProductAnalyticDataDto._() : super._();
|
const _ProductAnalyticDataDto._() : super._();
|
||||||
|
|
||||||
@ -7251,27 +7258,28 @@ abstract class _ProductAnalyticDataDto extends ProductAnalyticDataDto {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'product_id')
|
@JsonKey(name: 'product_id')
|
||||||
String get productId;
|
String? get productId;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'product_name')
|
@JsonKey(name: 'product_name')
|
||||||
String get productName;
|
String? get productName;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'category_id')
|
@JsonKey(name: 'category_id')
|
||||||
String get categoryId;
|
String? get categoryId;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'category_name')
|
@JsonKey(name: 'category_name')
|
||||||
String get categoryName;
|
String? get categoryName;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'quantity_sold')
|
@JsonKey(name: 'quantity_sold')
|
||||||
int get quantitySold;
|
int? get quantitySold;
|
||||||
@override
|
@override
|
||||||
double get revenue;
|
@JsonKey(name: 'revenue')
|
||||||
|
int? get revenue;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'average_price')
|
@JsonKey(name: 'average_price')
|
||||||
double get averagePrice;
|
double? get averagePrice;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: 'order_count')
|
@JsonKey(name: 'order_count')
|
||||||
int get orderCount;
|
int? get orderCount;
|
||||||
|
|
||||||
/// Create a copy of ProductAnalyticDataDto
|
/// Create a copy of ProductAnalyticDataDto
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|||||||
@ -521,12 +521,12 @@ Map<String, dynamic> _$$DashboardRecentSaleDtoImplToJson(
|
|||||||
_$ProductAnalyticDtoImpl _$$ProductAnalyticDtoImplFromJson(
|
_$ProductAnalyticDtoImpl _$$ProductAnalyticDtoImplFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _$ProductAnalyticDtoImpl(
|
) => _$ProductAnalyticDtoImpl(
|
||||||
organizationId: json['organization_id'] as String,
|
organizationId: json['organization_id'] as String?,
|
||||||
outletId: json['outlet_id'] as String,
|
outletId: json['outlet_id'] as String?,
|
||||||
dateFrom: json['date_from'] as String,
|
dateFrom: json['date_from'] as String?,
|
||||||
dateTo: json['date_to'] as String,
|
dateTo: json['date_to'] as String?,
|
||||||
data: (json['data'] as List<dynamic>)
|
data: (json['data'] as List<dynamic>?)
|
||||||
.map((e) => ProductAnalyticDataDto.fromJson(e as Map<String, dynamic>))
|
?.map((e) => ProductAnalyticDataDto.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -543,14 +543,14 @@ Map<String, dynamic> _$$ProductAnalyticDtoImplToJson(
|
|||||||
_$ProductAnalyticDataDtoImpl _$$ProductAnalyticDataDtoImplFromJson(
|
_$ProductAnalyticDataDtoImpl _$$ProductAnalyticDataDtoImplFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _$ProductAnalyticDataDtoImpl(
|
) => _$ProductAnalyticDataDtoImpl(
|
||||||
productId: json['product_id'] as String,
|
productId: json['product_id'] as String?,
|
||||||
productName: json['product_name'] as String,
|
productName: json['product_name'] as String?,
|
||||||
categoryId: json['category_id'] as String,
|
categoryId: json['category_id'] as String?,
|
||||||
categoryName: json['category_name'] as String,
|
categoryName: json['category_name'] as String?,
|
||||||
quantitySold: (json['quantity_sold'] as num).toInt(),
|
quantitySold: (json['quantity_sold'] as num?)?.toInt(),
|
||||||
revenue: (json['revenue'] as num).toDouble(),
|
revenue: (json['revenue'] as num?)?.toInt(),
|
||||||
averagePrice: (json['average_price'] as num).toDouble(),
|
averagePrice: (json['average_price'] as num?)?.toDouble(),
|
||||||
orderCount: (json['order_count'] as num).toInt(),
|
orderCount: (json['order_count'] as num?)?.toInt(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$ProductAnalyticDataDtoImplToJson(
|
Map<String, dynamic> _$$ProductAnalyticDataDtoImplToJson(
|
||||||
|
|||||||
@ -5,22 +5,22 @@ class ProductAnalyticDto with _$ProductAnalyticDto {
|
|||||||
const ProductAnalyticDto._();
|
const ProductAnalyticDto._();
|
||||||
|
|
||||||
const factory ProductAnalyticDto({
|
const factory ProductAnalyticDto({
|
||||||
@JsonKey(name: 'organization_id') required String organizationId,
|
@JsonKey(name: 'organization_id') String? organizationId,
|
||||||
@JsonKey(name: 'outlet_id') required String outletId,
|
@JsonKey(name: 'outlet_id') String? outletId,
|
||||||
@JsonKey(name: 'date_from') required String dateFrom,
|
@JsonKey(name: 'date_from') String? dateFrom,
|
||||||
@JsonKey(name: 'date_to') required String dateTo,
|
@JsonKey(name: 'date_to') String? dateTo,
|
||||||
required List<ProductAnalyticDataDto> data,
|
@JsonKey(name: 'data') List<ProductAnalyticDataDto>? data,
|
||||||
}) = _ProductAnalyticDto;
|
}) = _ProductAnalyticDto;
|
||||||
|
|
||||||
factory ProductAnalyticDto.fromJson(Map<String, dynamic> json) =>
|
factory ProductAnalyticDto.fromJson(Map<String, dynamic> json) =>
|
||||||
_$ProductAnalyticDtoFromJson(json);
|
_$ProductAnalyticDtoFromJson(json);
|
||||||
|
|
||||||
ProductAnalytic toDomain() => ProductAnalytic(
|
ProductAnalytic toDomain() => ProductAnalytic(
|
||||||
organizationId: organizationId,
|
organizationId: organizationId ?? "",
|
||||||
outletId: outletId,
|
outletId: outletId ?? "",
|
||||||
dateFrom: dateFrom,
|
dateFrom: dateFrom ?? "",
|
||||||
dateTo: dateTo,
|
dateTo: dateTo ?? "",
|
||||||
data: data.map((e) => e.toDomain()).toList(),
|
data: data?.map((e) => e.toDomain()).toList() ?? [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,27 +29,27 @@ class ProductAnalyticDataDto with _$ProductAnalyticDataDto {
|
|||||||
const ProductAnalyticDataDto._();
|
const ProductAnalyticDataDto._();
|
||||||
|
|
||||||
const factory ProductAnalyticDataDto({
|
const factory ProductAnalyticDataDto({
|
||||||
@JsonKey(name: 'product_id') required String productId,
|
@JsonKey(name: 'product_id') String? productId,
|
||||||
@JsonKey(name: 'product_name') required String productName,
|
@JsonKey(name: 'product_name') String? productName,
|
||||||
@JsonKey(name: 'category_id') required String categoryId,
|
@JsonKey(name: 'category_id') String? categoryId,
|
||||||
@JsonKey(name: 'category_name') required String categoryName,
|
@JsonKey(name: 'category_name') String? categoryName,
|
||||||
@JsonKey(name: 'quantity_sold') required int quantitySold,
|
@JsonKey(name: 'quantity_sold') int? quantitySold,
|
||||||
required double revenue,
|
@JsonKey(name: 'revenue') int? revenue,
|
||||||
@JsonKey(name: 'average_price') required double averagePrice,
|
@JsonKey(name: 'average_price') double? averagePrice,
|
||||||
@JsonKey(name: 'order_count') required int orderCount,
|
@JsonKey(name: 'order_count') int? orderCount,
|
||||||
}) = _ProductAnalyticDataDto;
|
}) = _ProductAnalyticDataDto;
|
||||||
|
|
||||||
factory ProductAnalyticDataDto.fromJson(Map<String, dynamic> json) =>
|
factory ProductAnalyticDataDto.fromJson(Map<String, dynamic> json) =>
|
||||||
_$ProductAnalyticDataDtoFromJson(json);
|
_$ProductAnalyticDataDtoFromJson(json);
|
||||||
|
|
||||||
ProductAnalyticData toDomain() => ProductAnalyticData(
|
ProductAnalyticData toDomain() => ProductAnalyticData(
|
||||||
productId: productId,
|
productId: productId ?? "",
|
||||||
productName: productName,
|
productName: productName ?? "",
|
||||||
categoryId: categoryId,
|
categoryId: categoryId ?? "",
|
||||||
categoryName: categoryName,
|
categoryName: categoryName ?? "",
|
||||||
quantitySold: quantitySold,
|
quantitySold: quantitySold ?? 0,
|
||||||
revenue: revenue,
|
revenue: revenue ?? 0,
|
||||||
averagePrice: averagePrice,
|
averagePrice: averagePrice ?? 0,
|
||||||
orderCount: orderCount,
|
orderCount: orderCount ?? 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,28 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
|
import '../../../../application/analytic/product_analytic_loader/product_analytic_loader_bloc.dart';
|
||||||
import '../../../../common/theme/theme.dart';
|
import '../../../../common/theme/theme.dart';
|
||||||
import '../../../../domain/analytic/analytic.dart';
|
import '../../../../domain/analytic/analytic.dart';
|
||||||
|
import '../../../../injection.dart';
|
||||||
import '../../../components/appbar/appbar.dart';
|
import '../../../components/appbar/appbar.dart';
|
||||||
|
import '../../../components/field/date_range_picker_field.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
class ProductAnalyticPage extends StatefulWidget {
|
class ProductAnalyticPage extends StatefulWidget implements AutoRouteWrapper {
|
||||||
const ProductAnalyticPage({super.key});
|
const ProductAnalyticPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ProductAnalyticPage> createState() => _ProductAnalyticPageState();
|
State<ProductAnalyticPage> createState() => _ProductAnalyticPageState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget wrappedRoute(BuildContext context) => BlocProvider(
|
||||||
|
create: (context) =>
|
||||||
|
getIt<ProductAnalyticLoaderBloc>()
|
||||||
|
..add(ProductAnalyticLoaderEvent.fetched()),
|
||||||
|
child: this,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
||||||
@ -20,66 +32,6 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
late Animation<double> _fadeAnimation;
|
late Animation<double> _fadeAnimation;
|
||||||
late Animation<Offset> _slideAnimation;
|
late Animation<Offset> _slideAnimation;
|
||||||
|
|
||||||
// Sample data untuk demo
|
|
||||||
final ProductAnalytic sampleData = ProductAnalytic(
|
|
||||||
organizationId: "org_123",
|
|
||||||
outletId: "outlet_456",
|
|
||||||
dateFrom: "2024-01-01",
|
|
||||||
dateTo: "2024-01-31",
|
|
||||||
data: [
|
|
||||||
ProductAnalyticData(
|
|
||||||
productId: "prod_1",
|
|
||||||
productName: "Nasi Goreng Spesial",
|
|
||||||
categoryId: "cat_1",
|
|
||||||
categoryName: "Makanan Utama",
|
|
||||||
quantitySold: 145,
|
|
||||||
revenue: 2175000.0,
|
|
||||||
averagePrice: 15000.0,
|
|
||||||
orderCount: 98,
|
|
||||||
),
|
|
||||||
ProductAnalyticData(
|
|
||||||
productId: "prod_2",
|
|
||||||
productName: "Es Teh Manis",
|
|
||||||
categoryId: "cat_2",
|
|
||||||
categoryName: "Minuman",
|
|
||||||
quantitySold: 230,
|
|
||||||
revenue: 1150000.0,
|
|
||||||
averagePrice: 5000.0,
|
|
||||||
orderCount: 180,
|
|
||||||
),
|
|
||||||
ProductAnalyticData(
|
|
||||||
productId: "prod_3",
|
|
||||||
productName: "Ayam Bakar",
|
|
||||||
categoryId: "cat_1",
|
|
||||||
categoryName: "Makanan Utama",
|
|
||||||
quantitySold: 89,
|
|
||||||
revenue: 2225000.0,
|
|
||||||
averagePrice: 25000.0,
|
|
||||||
orderCount: 75,
|
|
||||||
),
|
|
||||||
ProductAnalyticData(
|
|
||||||
productId: "prod_4",
|
|
||||||
productName: "Cappuccino",
|
|
||||||
categoryId: "cat_2",
|
|
||||||
categoryName: "Minuman",
|
|
||||||
quantitySold: 67,
|
|
||||||
revenue: 1005000.0,
|
|
||||||
averagePrice: 15000.0,
|
|
||||||
orderCount: 52,
|
|
||||||
),
|
|
||||||
ProductAnalyticData(
|
|
||||||
productId: "prod_5",
|
|
||||||
productName: "Pisang Goreng",
|
|
||||||
categoryId: "cat_3",
|
|
||||||
categoryName: "Snack",
|
|
||||||
quantitySold: 156,
|
|
||||||
revenue: 780000.0,
|
|
||||||
averagePrice: 5000.0,
|
|
||||||
orderCount: 134,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -126,13 +78,52 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColor.background,
|
backgroundColor: AppColor.background,
|
||||||
body: CustomScrollView(
|
body: BlocListener<ProductAnalyticLoaderBloc, ProductAnalyticLoaderState>(
|
||||||
|
listenWhen: (previous, current) =>
|
||||||
|
previous.dateFrom != current.dateFrom ||
|
||||||
|
previous.dateTo != current.dateTo,
|
||||||
|
listener: (context, state) {
|
||||||
|
context.read<ProductAnalyticLoaderBloc>().add(
|
||||||
|
ProductAnalyticLoaderEvent.fetched(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child:
|
||||||
|
BlocBuilder<ProductAnalyticLoaderBloc, ProductAnalyticLoaderState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
return CustomScrollView(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
slivers: [
|
slivers: [
|
||||||
_buildSliverAppBar(),
|
_buildSliverAppBar(),
|
||||||
_buildSummarySection(),
|
SliverToBoxAdapter(
|
||||||
_buildProductsList(),
|
child: SlideTransition(
|
||||||
|
position: _slideAnimation,
|
||||||
|
child: FadeTransition(
|
||||||
|
opacity: _fadeAnimation,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: DateRangePickerField(
|
||||||
|
maxDate: DateTime.now(),
|
||||||
|
startDate: state.dateFrom,
|
||||||
|
endDate: state.dateTo,
|
||||||
|
onChanged: (startDate, endDate) {
|
||||||
|
context.read<ProductAnalyticLoaderBloc>().add(
|
||||||
|
ProductAnalyticLoaderEvent.rangeDateChanged(
|
||||||
|
startDate!,
|
||||||
|
endDate!,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
_buildSummarySection(state.productAnalytic),
|
||||||
|
_buildProductsList(state.productAnalytic),
|
||||||
],
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -161,7 +152,7 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SUMMARY SECTION
|
// SUMMARY SECTION
|
||||||
Widget _buildSummarySection() {
|
Widget _buildSummarySection(ProductAnalytic productAnalytic) {
|
||||||
return SliverToBoxAdapter(
|
return SliverToBoxAdapter(
|
||||||
child: FadeTransition(
|
child: FadeTransition(
|
||||||
opacity: _fadeAnimation,
|
opacity: _fadeAnimation,
|
||||||
@ -169,7 +160,7 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
position: _slideAnimation,
|
position: _slideAnimation,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.all(16),
|
margin: const EdgeInsets.all(16),
|
||||||
child: _buildSummaryCards(sampleData.data),
|
child: _buildSummaryCards(productAnalytic.data),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -177,7 +168,7 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PRODUCTS LIST
|
// PRODUCTS LIST
|
||||||
Widget _buildProductsList() {
|
Widget _buildProductsList(ProductAnalytic productAnalytic) {
|
||||||
return SliverPadding(
|
return SliverPadding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
sliver: SliverList(
|
sliver: SliverList(
|
||||||
@ -198,12 +189,16 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
offset: Offset(0, 50 * (1 - animValue)),
|
offset: Offset(0, 50 * (1 - animValue)),
|
||||||
child: Opacity(
|
child: Opacity(
|
||||||
opacity: animValue,
|
opacity: animValue,
|
||||||
child: _buildProductCard(sampleData.data[index], index),
|
child: _buildProductCard(
|
||||||
|
productAnalytic,
|
||||||
|
productAnalytic.data[index],
|
||||||
|
index,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}, childCount: sampleData.data.length),
|
}, childCount: productAnalytic.data.length),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -330,7 +325,11 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PRODUCT CARD - NEW CLEAN LAYOUT
|
// PRODUCT CARD - NEW CLEAN LAYOUT
|
||||||
Widget _buildProductCard(ProductAnalyticData product, int index) {
|
Widget _buildProductCard(
|
||||||
|
ProductAnalytic productAnalytic,
|
||||||
|
ProductAnalyticData product,
|
||||||
|
int index,
|
||||||
|
) {
|
||||||
return TweenAnimationBuilder<double>(
|
return TweenAnimationBuilder<double>(
|
||||||
tween: Tween<double>(begin: 0.0, end: 1.0),
|
tween: Tween<double>(begin: 0.0, end: 1.0),
|
||||||
duration: Duration(milliseconds: 600 + (index * 100)),
|
duration: Duration(milliseconds: 600 + (index * 100)),
|
||||||
@ -344,9 +343,9 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
opacity: clampedValue,
|
opacity: clampedValue,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(
|
margin: EdgeInsets.only(
|
||||||
bottom: index == sampleData.data.length - 1 ? 0 : 16,
|
bottom: index == productAnalytic.data.length - 1 ? 0 : 16,
|
||||||
),
|
),
|
||||||
child: _buildCardContent(product, index),
|
child: _buildCardContent(productAnalytic, product, index),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -354,7 +353,11 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCardContent(ProductAnalyticData product, int index) {
|
Widget _buildCardContent(
|
||||||
|
ProductAnalytic productAnalytic,
|
||||||
|
ProductAnalyticData product,
|
||||||
|
int index,
|
||||||
|
) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColor.white,
|
color: AppColor.white,
|
||||||
@ -383,7 +386,7 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildCardHeader(product, index),
|
_buildCardHeader(product, index),
|
||||||
_buildCardBody(product),
|
_buildCardBody(productAnalytic, product),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -410,8 +413,11 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCardBody(ProductAnalyticData product) {
|
Widget _buildCardBody(
|
||||||
final index = sampleData.data.indexOf(product);
|
ProductAnalytic productAnalytic,
|
||||||
|
ProductAnalyticData product,
|
||||||
|
) {
|
||||||
|
final index = productAnalytic.data.indexOf(product);
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.all(24),
|
||||||
@ -546,7 +552,7 @@ class _ProductAnalyticPageState extends State<ProductAnalyticPage>
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
_formatCurrency(product.revenue),
|
_formatCurrency(product.revenue.toDouble()),
|
||||||
style: _getTextStyle(
|
style: _getTextStyle(
|
||||||
AppStyle.xl,
|
AppStyle.xl,
|
||||||
color: AppColor.success,
|
color: AppColor.success,
|
||||||
|
|||||||
@ -321,7 +321,7 @@ class ProductAnalyticRoute extends _i20.PageRouteInfo<void> {
|
|||||||
static _i20.PageInfo page = _i20.PageInfo(
|
static _i20.PageInfo page = _i20.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i12.ProductAnalyticPage();
|
return _i20.WrappedRoute(child: const _i12.ProductAnalyticPage());
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user