From 8d801e52d9fff44eed93811858aa7446ab2fc79b Mon Sep 17 00:00:00 2001 From: Efril Date: Tue, 23 Jun 2026 23:18:22 +0700 Subject: [PATCH] feat: update sales ui --- .../category_analytic_loader_bloc.dart | 7 +- ...category_analytic_loader_bloc.freezed.dart | 228 ++++- .../category_analytic_loader_event.dart | 4 + .../category_analytic_loader_state.dart | 4 + .../payment_method_analytic_loader_bloc.dart | 7 +- ...t_method_analytic_loader_bloc.freezed.dart | 231 ++++- .../payment_method_analytic_loader_event.dart | 4 + .../payment_method_analytic_loader_state.dart | 4 + .../product_analytic_loader_state.dart | 2 +- .../sales_loader/sales_loader_state.dart | 2 +- lib/common/theme/theme.dart | 8 +- lib/common/url/api_path.dart | 2 +- lib/domain/analytic/analytic.freezed.dart | 419 ++++++++- .../entities/category_analytic_entity.dart | 2 + .../entities/dashboard_analytic_entity.dart | 8 + .../entities/exclusive_summary_entity.dart | 13 +- .../payment_method_analytic_entity.dart | 2 + .../entities/product_analytic_entity.dart | 20 + .../entities/sales_analytic_entity.dart | 2 + .../analytic/analytic_dtos.freezed.dart | 474 +++++++++- .../analytic/analytic_dtos.g.dart | 37 + .../analytic/dto/category_analytic_dto.dart | 2 + .../analytic/dto/dashboard_analytic_dto.dart | 8 + .../analytic/dto/exclusive_summary_dto.dart | 2 + .../dto/payment_method_analytic_dto.dart | 2 + .../analytic/dto/product_analytic_dto.dart | 20 + .../analytic/dto/sales_analytic_dto.dart | 2 + .../components/assets/assets.gen.dart | 6 +- .../bottom_sheet/date_range_bottom_sheet.dart | 85 +- lib/presentation/pages/sales/sales_page.dart | 825 +++--------------- .../widgets/product_detail_bottom_sheet.dart | 227 +++++ .../sales/widgets/sales_category_card.dart | 274 ++++++ .../pages/sales/widgets/sales_header.dart | 315 +++++++ .../widgets/sales_payment_method_card.dart | 265 ++++++ .../sales/widgets/sales_rincian_card.dart | 165 ++++ .../widgets/sales_top_products_card.dart | 288 ++++++ .../pages/sales/widgets/summary_card.dart | 101 --- 37 files changed, 3234 insertions(+), 833 deletions(-) create mode 100644 lib/presentation/pages/sales/widgets/product_detail_bottom_sheet.dart create mode 100644 lib/presentation/pages/sales/widgets/sales_category_card.dart create mode 100644 lib/presentation/pages/sales/widgets/sales_header.dart create mode 100644 lib/presentation/pages/sales/widgets/sales_payment_method_card.dart create mode 100644 lib/presentation/pages/sales/widgets/sales_rincian_card.dart create mode 100644 lib/presentation/pages/sales/widgets/sales_top_products_card.dart delete mode 100644 lib/presentation/pages/sales/widgets/summary_card.dart diff --git a/lib/application/analytic/category_analytic_loader/category_analytic_loader_bloc.dart b/lib/application/analytic/category_analytic_loader/category_analytic_loader_bloc.dart index eb99bfd..176f62b 100644 --- a/lib/application/analytic/category_analytic_loader/category_analytic_loader_bloc.dart +++ b/lib/application/analytic/category_analytic_loader/category_analytic_loader_bloc.dart @@ -25,6 +25,9 @@ class CategoryAnalyticLoaderBloc Emitter emit, ) { return event.map( + rangeDateChanged: (e) async { + emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo)); + }, fetched: (e) async { emit( state.copyWith( @@ -34,8 +37,8 @@ class CategoryAnalyticLoaderBloc ); final result = await _repository.getCategory( - dateFrom: DateTime.now().subtract(const Duration(days: 30)), - dateTo: DateTime.now(), + dateFrom: state.dateFrom, + dateTo: state.dateTo, ); var data = result.fold( diff --git a/lib/application/analytic/category_analytic_loader/category_analytic_loader_bloc.freezed.dart b/lib/application/analytic/category_analytic_loader/category_analytic_loader_bloc.freezed.dart index 41a5c79..d5530b9 100644 --- a/lib/application/analytic/category_analytic_loader/category_analytic_loader_bloc.freezed.dart +++ b/lib/application/analytic/category_analytic_loader/category_analytic_loader_bloc.freezed.dart @@ -19,27 +19,34 @@ final _privateConstructorUsedError = UnsupportedError( mixin _$CategoryAnalyticLoaderEvent { @optionalTypeArgs TResult when({ + required TResult Function(DateTime dateFrom, DateTime dateTo) + rangeDateChanged, required TResult Function() fetched, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ + TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged, TResult? Function()? fetched, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ + TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged, TResult Function()? fetched, required TResult orElse(), }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult map({ + required TResult Function(_RangeDateChanged value) rangeDateChanged, required TResult Function(_Fetched value) fetched, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull({ + TResult? Function(_RangeDateChanged value)? rangeDateChanged, TResult? Function(_Fetched value)? fetched, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap({ + TResult Function(_RangeDateChanged value)? rangeDateChanged, TResult Function(_Fetched value)? fetched, required TResult orElse(), }) => throw _privateConstructorUsedError; @@ -74,6 +81,165 @@ class _$CategoryAnalyticLoaderEventCopyWithImpl< /// 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 + _$CategoryAnalyticLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl> + implements _$$RangeDateChangedImplCopyWith<$Res> { + __$$RangeDateChangedImplCopyWithImpl( + _$RangeDateChangedImpl _value, + $Res Function(_$RangeDateChangedImpl) _then, + ) : super(_value, _then); + + /// Create a copy of CategoryAnalyticLoaderEvent + /// 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 'CategoryAnalyticLoaderEvent.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 CategoryAnalyticLoaderEvent + /// 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({ + required TResult Function(DateTime dateFrom, DateTime dateTo) + rangeDateChanged, + required TResult Function() fetched, + }) { + return rangeDateChanged(dateFrom, dateTo); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged, + TResult? Function()? fetched, + }) { + return rangeDateChanged?.call(dateFrom, dateTo); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + 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({ + required TResult Function(_RangeDateChanged value) rangeDateChanged, + required TResult Function(_Fetched value) fetched, + }) { + return rangeDateChanged(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(_RangeDateChanged value)? rangeDateChanged, + TResult? Function(_Fetched value)? fetched, + }) { + return rangeDateChanged?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + 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 CategoryAnalyticLoaderEvent { + const factory _RangeDateChanged( + final DateTime dateFrom, + final DateTime dateTo, + ) = _$RangeDateChangedImpl; + + DateTime get dateFrom; + DateTime get dateTo; + + /// Create a copy of CategoryAnalyticLoaderEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith => + throw _privateConstructorUsedError; +} + /// @nodoc abstract class _$$FetchedImplCopyWith<$Res> { factory _$$FetchedImplCopyWith( @@ -116,19 +282,27 @@ class _$FetchedImpl implements _Fetched { @override @optionalTypeArgs - TResult when({required TResult Function() fetched}) { + TResult when({ + required TResult Function(DateTime dateFrom, DateTime dateTo) + rangeDateChanged, + required TResult Function() fetched, + }) { return fetched(); } @override @optionalTypeArgs - TResult? whenOrNull({TResult? Function()? fetched}) { + TResult? whenOrNull({ + TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged, + TResult? Function()? fetched, + }) { return fetched?.call(); } @override @optionalTypeArgs TResult maybeWhen({ + TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged, TResult Function()? fetched, required TResult orElse(), }) { @@ -141,6 +315,7 @@ class _$FetchedImpl implements _Fetched { @override @optionalTypeArgs TResult map({ + required TResult Function(_RangeDateChanged value) rangeDateChanged, required TResult Function(_Fetched value) fetched, }) { return fetched(this); @@ -149,6 +324,7 @@ class _$FetchedImpl implements _Fetched { @override @optionalTypeArgs TResult? mapOrNull({ + TResult? Function(_RangeDateChanged value)? rangeDateChanged, TResult? Function(_Fetched value)? fetched, }) { return fetched?.call(this); @@ -157,6 +333,7 @@ class _$FetchedImpl implements _Fetched { @override @optionalTypeArgs TResult maybeMap({ + TResult Function(_RangeDateChanged value)? rangeDateChanged, TResult Function(_Fetched value)? fetched, required TResult orElse(), }) { @@ -177,6 +354,8 @@ mixin _$CategoryAnalyticLoaderState { Option get failureOptionCategoryAnalytic => throw _privateConstructorUsedError; bool get isFetching => throw _privateConstructorUsedError; + DateTime get dateFrom => throw _privateConstructorUsedError; + DateTime get dateTo => throw _privateConstructorUsedError; /// Create a copy of CategoryAnalyticLoaderState /// with the given fields replaced by the non-null parameter values. @@ -200,6 +379,8 @@ abstract class $CategoryAnalyticLoaderStateCopyWith<$Res> { CategoryAnalytic categoryAnalytic, Option failureOptionCategoryAnalytic, bool isFetching, + DateTime dateFrom, + DateTime dateTo, }); $CategoryAnalyticCopyWith<$Res> get categoryAnalytic; @@ -226,6 +407,8 @@ class _$CategoryAnalyticLoaderStateCopyWithImpl< Object? categoryAnalytic = null, Object? failureOptionCategoryAnalytic = null, Object? isFetching = null, + Object? dateFrom = null, + Object? dateTo = null, }) { return _then( _value.copyWith( @@ -241,6 +424,14 @@ class _$CategoryAnalyticLoaderStateCopyWithImpl< ? _value.isFetching : isFetching // ignore: cast_nullable_to_non_nullable 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, ); @@ -270,6 +461,8 @@ abstract class _$$CategoryAnalyticLoaderStateImplCopyWith<$Res> CategoryAnalytic categoryAnalytic, Option failureOptionCategoryAnalytic, bool isFetching, + DateTime dateFrom, + DateTime dateTo, }); @override @@ -297,6 +490,8 @@ class __$$CategoryAnalyticLoaderStateImplCopyWithImpl<$Res> Object? categoryAnalytic = null, Object? failureOptionCategoryAnalytic = null, Object? isFetching = null, + Object? dateFrom = null, + Object? dateTo = null, }) { return _then( _$CategoryAnalyticLoaderStateImpl( @@ -312,6 +507,14 @@ class __$$CategoryAnalyticLoaderStateImplCopyWithImpl<$Res> ? _value.isFetching : isFetching // ignore: cast_nullable_to_non_nullable 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, ), ); } @@ -325,6 +528,8 @@ class _$CategoryAnalyticLoaderStateImpl required this.categoryAnalytic, required this.failureOptionCategoryAnalytic, this.isFetching = false, + required this.dateFrom, + required this.dateTo, }); @override @@ -334,10 +539,14 @@ class _$CategoryAnalyticLoaderStateImpl @override @JsonKey() final bool isFetching; + @override + final DateTime dateFrom; + @override + final DateTime dateTo; @override String toString() { - return 'CategoryAnalyticLoaderState(categoryAnalytic: $categoryAnalytic, failureOptionCategoryAnalytic: $failureOptionCategoryAnalytic, isFetching: $isFetching)'; + return 'CategoryAnalyticLoaderState(categoryAnalytic: $categoryAnalytic, failureOptionCategoryAnalytic: $failureOptionCategoryAnalytic, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)'; } @override @@ -354,7 +563,10 @@ class _$CategoryAnalyticLoaderStateImpl other.failureOptionCategoryAnalytic == failureOptionCategoryAnalytic) && (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 @@ -363,6 +575,8 @@ class _$CategoryAnalyticLoaderStateImpl categoryAnalytic, failureOptionCategoryAnalytic, isFetching, + dateFrom, + dateTo, ); /// Create a copy of CategoryAnalyticLoaderState @@ -383,6 +597,8 @@ abstract class _CategoryAnalyticLoaderState required final CategoryAnalytic categoryAnalytic, required final Option failureOptionCategoryAnalytic, final bool isFetching, + required final DateTime dateFrom, + required final DateTime dateTo, }) = _$CategoryAnalyticLoaderStateImpl; @override @@ -391,6 +607,10 @@ abstract class _CategoryAnalyticLoaderState Option get failureOptionCategoryAnalytic; @override bool get isFetching; + @override + DateTime get dateFrom; + @override + DateTime get dateTo; /// Create a copy of CategoryAnalyticLoaderState /// with the given fields replaced by the non-null parameter values. diff --git a/lib/application/analytic/category_analytic_loader/category_analytic_loader_event.dart b/lib/application/analytic/category_analytic_loader/category_analytic_loader_event.dart index 87c2994..0f34d65 100644 --- a/lib/application/analytic/category_analytic_loader/category_analytic_loader_event.dart +++ b/lib/application/analytic/category_analytic_loader/category_analytic_loader_event.dart @@ -2,5 +2,9 @@ part of 'category_analytic_loader_bloc.dart'; @freezed class CategoryAnalyticLoaderEvent with _$CategoryAnalyticLoaderEvent { + const factory CategoryAnalyticLoaderEvent.rangeDateChanged( + DateTime dateFrom, + DateTime dateTo, + ) = _RangeDateChanged; const factory CategoryAnalyticLoaderEvent.fetched() = _Fetched; } diff --git a/lib/application/analytic/category_analytic_loader/category_analytic_loader_state.dart b/lib/application/analytic/category_analytic_loader/category_analytic_loader_state.dart index 0754233..0398ca2 100644 --- a/lib/application/analytic/category_analytic_loader/category_analytic_loader_state.dart +++ b/lib/application/analytic/category_analytic_loader/category_analytic_loader_state.dart @@ -6,10 +6,14 @@ class CategoryAnalyticLoaderState with _$CategoryAnalyticLoaderState { required CategoryAnalytic categoryAnalytic, required Option failureOptionCategoryAnalytic, @Default(false) bool isFetching, + required DateTime dateFrom, + required DateTime dateTo, }) = _CategoryAnalyticLoaderState; factory CategoryAnalyticLoaderState.initial() => CategoryAnalyticLoaderState( categoryAnalytic: CategoryAnalytic.empty(), failureOptionCategoryAnalytic: none(), + dateFrom: DateTime.now(), + dateTo: DateTime.now(), ); } diff --git a/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.dart b/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.dart index ff03c25..31a1448 100644 --- a/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.dart +++ b/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.dart @@ -28,6 +28,9 @@ class PaymentMethodAnalyticLoaderBloc Emitter emit, ) { return event.map( + rangeDateChanged: (e) async { + emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo)); + }, fetched: (e) async { emit( state.copyWith( @@ -37,8 +40,8 @@ class PaymentMethodAnalyticLoaderBloc ); final result = await _repository.getPaymentMethod( - dateFrom: DateTime.now().subtract(const Duration(days: 30)), - dateTo: DateTime.now(), + dateFrom: state.dateFrom, + dateTo: state.dateTo, ); var data = result.fold( diff --git a/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.freezed.dart b/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.freezed.dart index 376f974..c562166 100644 --- a/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.freezed.dart +++ b/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.freezed.dart @@ -19,27 +19,34 @@ final _privateConstructorUsedError = UnsupportedError( mixin _$PaymentMethodAnalyticLoaderEvent { @optionalTypeArgs TResult when({ + required TResult Function(DateTime dateFrom, DateTime dateTo) + rangeDateChanged, required TResult Function() fetched, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ + TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged, TResult? Function()? fetched, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ + TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged, TResult Function()? fetched, required TResult orElse(), }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult map({ + required TResult Function(_RangeDateChanged value) rangeDateChanged, required TResult Function(_Fetched value) fetched, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull({ + TResult? Function(_RangeDateChanged value)? rangeDateChanged, TResult? Function(_Fetched value)? fetched, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap({ + TResult Function(_RangeDateChanged value)? rangeDateChanged, TResult Function(_Fetched value)? fetched, required TResult orElse(), }) => throw _privateConstructorUsedError; @@ -74,6 +81,168 @@ class _$PaymentMethodAnalyticLoaderEventCopyWithImpl< /// 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 + _$PaymentMethodAnalyticLoaderEventCopyWithImpl< + $Res, + _$RangeDateChangedImpl + > + implements _$$RangeDateChangedImplCopyWith<$Res> { + __$$RangeDateChangedImplCopyWithImpl( + _$RangeDateChangedImpl _value, + $Res Function(_$RangeDateChangedImpl) _then, + ) : super(_value, _then); + + /// Create a copy of PaymentMethodAnalyticLoaderEvent + /// 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 'PaymentMethodAnalyticLoaderEvent.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 PaymentMethodAnalyticLoaderEvent + /// 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({ + required TResult Function(DateTime dateFrom, DateTime dateTo) + rangeDateChanged, + required TResult Function() fetched, + }) { + return rangeDateChanged(dateFrom, dateTo); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged, + TResult? Function()? fetched, + }) { + return rangeDateChanged?.call(dateFrom, dateTo); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + 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({ + required TResult Function(_RangeDateChanged value) rangeDateChanged, + required TResult Function(_Fetched value) fetched, + }) { + return rangeDateChanged(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(_RangeDateChanged value)? rangeDateChanged, + TResult? Function(_Fetched value)? fetched, + }) { + return rangeDateChanged?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + 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 PaymentMethodAnalyticLoaderEvent { + const factory _RangeDateChanged( + final DateTime dateFrom, + final DateTime dateTo, + ) = _$RangeDateChangedImpl; + + DateTime get dateFrom; + DateTime get dateTo; + + /// Create a copy of PaymentMethodAnalyticLoaderEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith => + throw _privateConstructorUsedError; +} + /// @nodoc abstract class _$$FetchedImplCopyWith<$Res> { factory _$$FetchedImplCopyWith( @@ -116,19 +285,27 @@ class _$FetchedImpl implements _Fetched { @override @optionalTypeArgs - TResult when({required TResult Function() fetched}) { + TResult when({ + required TResult Function(DateTime dateFrom, DateTime dateTo) + rangeDateChanged, + required TResult Function() fetched, + }) { return fetched(); } @override @optionalTypeArgs - TResult? whenOrNull({TResult? Function()? fetched}) { + TResult? whenOrNull({ + TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged, + TResult? Function()? fetched, + }) { return fetched?.call(); } @override @optionalTypeArgs TResult maybeWhen({ + TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged, TResult Function()? fetched, required TResult orElse(), }) { @@ -141,6 +318,7 @@ class _$FetchedImpl implements _Fetched { @override @optionalTypeArgs TResult map({ + required TResult Function(_RangeDateChanged value) rangeDateChanged, required TResult Function(_Fetched value) fetched, }) { return fetched(this); @@ -149,6 +327,7 @@ class _$FetchedImpl implements _Fetched { @override @optionalTypeArgs TResult? mapOrNull({ + TResult? Function(_RangeDateChanged value)? rangeDateChanged, TResult? Function(_Fetched value)? fetched, }) { return fetched?.call(this); @@ -157,6 +336,7 @@ class _$FetchedImpl implements _Fetched { @override @optionalTypeArgs TResult maybeMap({ + TResult Function(_RangeDateChanged value)? rangeDateChanged, TResult Function(_Fetched value)? fetched, required TResult orElse(), }) { @@ -178,6 +358,8 @@ mixin _$PaymentMethodAnalyticLoaderState { Option get failureOptionPaymentMethodAnalytic => throw _privateConstructorUsedError; bool get isFetching => throw _privateConstructorUsedError; + DateTime get dateFrom => throw _privateConstructorUsedError; + DateTime get dateTo => throw _privateConstructorUsedError; /// Create a copy of PaymentMethodAnalyticLoaderState /// with the given fields replaced by the non-null parameter values. @@ -201,6 +383,8 @@ abstract class $PaymentMethodAnalyticLoaderStateCopyWith<$Res> { PaymentMethodAnalytic paymentMethodAnalytic, Option failureOptionPaymentMethodAnalytic, bool isFetching, + DateTime dateFrom, + DateTime dateTo, }); $PaymentMethodAnalyticCopyWith<$Res> get paymentMethodAnalytic; @@ -227,6 +411,8 @@ class _$PaymentMethodAnalyticLoaderStateCopyWithImpl< Object? paymentMethodAnalytic = null, Object? failureOptionPaymentMethodAnalytic = null, Object? isFetching = null, + Object? dateFrom = null, + Object? dateTo = null, }) { return _then( _value.copyWith( @@ -243,6 +429,14 @@ class _$PaymentMethodAnalyticLoaderStateCopyWithImpl< ? _value.isFetching : isFetching // ignore: cast_nullable_to_non_nullable 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, ); @@ -274,6 +468,8 @@ abstract class _$$PaymentMethodAnalyticLoaderStateImplCopyWith<$Res> PaymentMethodAnalytic paymentMethodAnalytic, Option failureOptionPaymentMethodAnalytic, bool isFetching, + DateTime dateFrom, + DateTime dateTo, }); @override @@ -301,6 +497,8 @@ class __$$PaymentMethodAnalyticLoaderStateImplCopyWithImpl<$Res> Object? paymentMethodAnalytic = null, Object? failureOptionPaymentMethodAnalytic = null, Object? isFetching = null, + Object? dateFrom = null, + Object? dateTo = null, }) { return _then( _$PaymentMethodAnalyticLoaderStateImpl( @@ -317,6 +515,14 @@ class __$$PaymentMethodAnalyticLoaderStateImplCopyWithImpl<$Res> ? _value.isFetching : isFetching // ignore: cast_nullable_to_non_nullable 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, ), ); } @@ -330,6 +536,8 @@ class _$PaymentMethodAnalyticLoaderStateImpl required this.paymentMethodAnalytic, required this.failureOptionPaymentMethodAnalytic, this.isFetching = false, + required this.dateFrom, + required this.dateTo, }); @override @@ -339,10 +547,14 @@ class _$PaymentMethodAnalyticLoaderStateImpl @override @JsonKey() final bool isFetching; + @override + final DateTime dateFrom; + @override + final DateTime dateTo; @override String toString() { - return 'PaymentMethodAnalyticLoaderState(paymentMethodAnalytic: $paymentMethodAnalytic, failureOptionPaymentMethodAnalytic: $failureOptionPaymentMethodAnalytic, isFetching: $isFetching)'; + return 'PaymentMethodAnalyticLoaderState(paymentMethodAnalytic: $paymentMethodAnalytic, failureOptionPaymentMethodAnalytic: $failureOptionPaymentMethodAnalytic, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)'; } @override @@ -359,7 +571,10 @@ class _$PaymentMethodAnalyticLoaderStateImpl other.failureOptionPaymentMethodAnalytic == failureOptionPaymentMethodAnalytic) && (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 @@ -368,6 +583,8 @@ class _$PaymentMethodAnalyticLoaderStateImpl paymentMethodAnalytic, failureOptionPaymentMethodAnalytic, isFetching, + dateFrom, + dateTo, ); /// Create a copy of PaymentMethodAnalyticLoaderState @@ -390,6 +607,8 @@ abstract class _PaymentMethodAnalyticLoaderState required final PaymentMethodAnalytic paymentMethodAnalytic, required final Option failureOptionPaymentMethodAnalytic, final bool isFetching, + required final DateTime dateFrom, + required final DateTime dateTo, }) = _$PaymentMethodAnalyticLoaderStateImpl; @override @@ -398,6 +617,10 @@ abstract class _PaymentMethodAnalyticLoaderState Option get failureOptionPaymentMethodAnalytic; @override bool get isFetching; + @override + DateTime get dateFrom; + @override + DateTime get dateTo; /// Create a copy of PaymentMethodAnalyticLoaderState /// with the given fields replaced by the non-null parameter values. diff --git a/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_event.dart b/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_event.dart index 04e5543..6ba5341 100644 --- a/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_event.dart +++ b/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_event.dart @@ -2,5 +2,9 @@ part of 'payment_method_analytic_loader_bloc.dart'; @freezed class PaymentMethodAnalyticLoaderEvent with _$PaymentMethodAnalyticLoaderEvent { + const factory PaymentMethodAnalyticLoaderEvent.rangeDateChanged( + DateTime dateFrom, + DateTime dateTo, + ) = _RangeDateChanged; const factory PaymentMethodAnalyticLoaderEvent.fetched() = _Fetched; } diff --git a/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_state.dart b/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_state.dart index 62cb5cd..5652b83 100644 --- a/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_state.dart +++ b/lib/application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_state.dart @@ -6,11 +6,15 @@ class PaymentMethodAnalyticLoaderState with _$PaymentMethodAnalyticLoaderState { required PaymentMethodAnalytic paymentMethodAnalytic, required Option failureOptionPaymentMethodAnalytic, @Default(false) bool isFetching, + required DateTime dateFrom, + required DateTime dateTo, }) = _PaymentMethodAnalyticLoaderState; factory PaymentMethodAnalyticLoaderState.initial() => PaymentMethodAnalyticLoaderState( paymentMethodAnalytic: PaymentMethodAnalytic.empty(), failureOptionPaymentMethodAnalytic: none(), + dateFrom: DateTime.now(), + dateTo: DateTime.now(), ); } diff --git a/lib/application/analytic/product_analytic_loader/product_analytic_loader_state.dart b/lib/application/analytic/product_analytic_loader/product_analytic_loader_state.dart index 94b349a..ad4916d 100644 --- a/lib/application/analytic/product_analytic_loader/product_analytic_loader_state.dart +++ b/lib/application/analytic/product_analytic_loader/product_analytic_loader_state.dart @@ -13,7 +13,7 @@ class ProductAnalyticLoaderState with _$ProductAnalyticLoaderState { factory ProductAnalyticLoaderState.initial() => ProductAnalyticLoaderState( productAnalytic: ProductAnalytic.empty(), failureOptionProductAnalytic: none(), - dateFrom: DateTime.now().subtract(const Duration(days: 30)), + dateFrom: DateTime.now(), dateTo: DateTime.now(), ); } diff --git a/lib/application/analytic/sales_loader/sales_loader_state.dart b/lib/application/analytic/sales_loader/sales_loader_state.dart index 7cbe4f3..25d6ae0 100644 --- a/lib/application/analytic/sales_loader/sales_loader_state.dart +++ b/lib/application/analytic/sales_loader/sales_loader_state.dart @@ -13,7 +13,7 @@ class SalesLoaderState with _$SalesLoaderState { factory SalesLoaderState.initial() => SalesLoaderState( sales: SalesAnalytic.empty(), failureOptionSales: none(), - dateFrom: DateTime.now().subtract(const Duration(days: 30)), + dateFrom: DateTime.now(), dateTo: DateTime.now(), ); } diff --git a/lib/common/theme/theme.dart b/lib/common/theme/theme.dart index e964171..d26e070 100644 --- a/lib/common/theme/theme.dart +++ b/lib/common/theme/theme.dart @@ -9,6 +9,11 @@ part 'app_value.dart'; class ThemeApp { static ThemeData get theme => ThemeData( useMaterial3: true, + colorScheme: ColorScheme.fromSeed( + seedColor: AppColor.primary, + primary: AppColor.primary, + brightness: Brightness.light, + ), scaffoldBackgroundColor: AppColor.background, fontFamily: FontFamily.quicksand, inputDecorationTheme: InputDecorationTheme( @@ -67,6 +72,7 @@ class ThemeApp { ), bottomSheetTheme: BottomSheetThemeData( backgroundColor: AppColor.white, - ) + surfaceTintColor: Colors.transparent, + ), ); } diff --git a/lib/common/url/api_path.dart b/lib/common/url/api_path.dart index a16fba3..4785298 100644 --- a/lib/common/url/api_path.dart +++ b/lib/common/url/api_path.dart @@ -10,7 +10,7 @@ class ApiPath { static const String dashboardAnalytic = '/api/v1/analytics/dashboard'; static const String productAnalytic = '/api/v1/analytics/products'; static const String paymentMethodAnalytic = - '/api/v1/analytics/paymentMethods'; + '/api/v1/analytics/payment-methods'; static const String purchasingAnalytic = '/api/v1/analytics/purchasing'; static const String exclusiveSummaryAnalytic = '/api/v1/analytics/exclusive-summary/period'; diff --git a/lib/domain/analytic/analytic.freezed.dart b/lib/domain/analytic/analytic.freezed.dart index 03e03e0..933f11d 100644 --- a/lib/domain/analytic/analytic.freezed.dart +++ b/lib/domain/analytic/analytic.freezed.dart @@ -19,6 +19,7 @@ final _privateConstructorUsedError = UnsupportedError( mixin _$SalesAnalytic { String get organizationId => throw _privateConstructorUsedError; String get outletId => throw _privateConstructorUsedError; + String get outletName => throw _privateConstructorUsedError; DateTime get dateFrom => throw _privateConstructorUsedError; DateTime get dateTo => throw _privateConstructorUsedError; String get groupBy => throw _privateConstructorUsedError; @@ -42,6 +43,7 @@ abstract class $SalesAnalyticCopyWith<$Res> { $Res call({ String organizationId, String outletId, + String outletName, DateTime dateFrom, DateTime dateTo, String groupBy, @@ -69,6 +71,7 @@ class _$SalesAnalyticCopyWithImpl<$Res, $Val extends SalesAnalytic> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? dateFrom = null, Object? dateTo = null, Object? groupBy = null, @@ -85,6 +88,10 @@ class _$SalesAnalyticCopyWithImpl<$Res, $Val extends SalesAnalytic> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, dateFrom: null == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -133,6 +140,7 @@ abstract class _$$SalesAnalyticImplCopyWith<$Res> $Res call({ String organizationId, String outletId, + String outletName, DateTime dateFrom, DateTime dateTo, String groupBy, @@ -160,6 +168,7 @@ class __$$SalesAnalyticImplCopyWithImpl<$Res> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? dateFrom = null, Object? dateTo = null, Object? groupBy = null, @@ -176,6 +185,10 @@ class __$$SalesAnalyticImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, dateFrom: null == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -207,6 +220,7 @@ class _$SalesAnalyticImpl implements _SalesAnalytic { const _$SalesAnalyticImpl({ required this.organizationId, required this.outletId, + required this.outletName, required this.dateFrom, required this.dateTo, required this.groupBy, @@ -219,6 +233,8 @@ class _$SalesAnalyticImpl implements _SalesAnalytic { @override final String outletId; @override + final String outletName; + @override final DateTime dateFrom; @override final DateTime dateTo; @@ -236,7 +252,7 @@ class _$SalesAnalyticImpl implements _SalesAnalytic { @override String toString() { - return 'SalesAnalytic(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, groupBy: $groupBy, summary: $summary, data: $data)'; + return 'SalesAnalytic(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, dateFrom: $dateFrom, dateTo: $dateTo, groupBy: $groupBy, summary: $summary, data: $data)'; } @override @@ -248,6 +264,8 @@ class _$SalesAnalyticImpl implements _SalesAnalytic { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.dateFrom, dateFrom) || other.dateFrom == dateFrom) && (identical(other.dateTo, dateTo) || other.dateTo == dateTo) && @@ -261,6 +279,7 @@ class _$SalesAnalyticImpl implements _SalesAnalytic { runtimeType, organizationId, outletId, + outletName, dateFrom, dateTo, groupBy, @@ -281,6 +300,7 @@ abstract class _SalesAnalytic implements SalesAnalytic { const factory _SalesAnalytic({ required final String organizationId, required final String outletId, + required final String outletName, required final DateTime dateFrom, required final DateTime dateTo, required final String groupBy, @@ -293,6 +313,8 @@ abstract class _SalesAnalytic implements SalesAnalytic { @override String get outletId; @override + String get outletName; + @override DateTime get dateFrom; @override DateTime get dateTo; @@ -2300,6 +2322,7 @@ abstract class _ProfitLossProductData implements ProfitLossProductData { mixin _$CategoryAnalytic { String get organizationId => throw _privateConstructorUsedError; String get outletId => throw _privateConstructorUsedError; + String get outletName => throw _privateConstructorUsedError; String get dateFrom => throw _privateConstructorUsedError; String get dateTo => throw _privateConstructorUsedError; List get data => throw _privateConstructorUsedError; @@ -2321,6 +2344,7 @@ abstract class $CategoryAnalyticCopyWith<$Res> { $Res call({ String organizationId, String outletId, + String outletName, String dateFrom, String dateTo, List data, @@ -2344,6 +2368,7 @@ class _$CategoryAnalyticCopyWithImpl<$Res, $Val extends CategoryAnalytic> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? dateFrom = null, Object? dateTo = null, Object? data = null, @@ -2358,6 +2383,10 @@ class _$CategoryAnalyticCopyWithImpl<$Res, $Val extends CategoryAnalytic> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, dateFrom: null == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -2388,6 +2417,7 @@ abstract class _$$CategoryAnalyticImplCopyWith<$Res> $Res call({ String organizationId, String outletId, + String outletName, String dateFrom, String dateTo, List data, @@ -2410,6 +2440,7 @@ class __$$CategoryAnalyticImplCopyWithImpl<$Res> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? dateFrom = null, Object? dateTo = null, Object? data = null, @@ -2424,6 +2455,10 @@ class __$$CategoryAnalyticImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, dateFrom: null == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -2447,6 +2482,7 @@ class _$CategoryAnalyticImpl implements _CategoryAnalytic { const _$CategoryAnalyticImpl({ required this.organizationId, required this.outletId, + required this.outletName, required this.dateFrom, required this.dateTo, required final List data, @@ -2457,6 +2493,8 @@ class _$CategoryAnalyticImpl implements _CategoryAnalytic { @override final String outletId; @override + final String outletName; + @override final String dateFrom; @override final String dateTo; @@ -2470,7 +2508,7 @@ class _$CategoryAnalyticImpl implements _CategoryAnalytic { @override String toString() { - return 'CategoryAnalytic(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, data: $data)'; + return 'CategoryAnalytic(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, dateFrom: $dateFrom, dateTo: $dateTo, data: $data)'; } @override @@ -2482,6 +2520,8 @@ class _$CategoryAnalyticImpl implements _CategoryAnalytic { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.dateFrom, dateFrom) || other.dateFrom == dateFrom) && (identical(other.dateTo, dateTo) || other.dateTo == dateTo) && @@ -2493,6 +2533,7 @@ class _$CategoryAnalyticImpl implements _CategoryAnalytic { runtimeType, organizationId, outletId, + outletName, dateFrom, dateTo, const DeepCollectionEquality().hash(_data), @@ -2514,6 +2555,7 @@ abstract class _CategoryAnalytic implements CategoryAnalytic { const factory _CategoryAnalytic({ required final String organizationId, required final String outletId, + required final String outletName, required final String dateFrom, required final String dateTo, required final List data, @@ -2524,6 +2566,8 @@ abstract class _CategoryAnalytic implements CategoryAnalytic { @override String get outletId; @override + String get outletName; + @override String get dateFrom; @override String get dateTo; @@ -4249,6 +4293,7 @@ abstract class _InventoryIngredient implements InventoryIngredient { mixin _$DashboardAnalytic { String get organizationId => throw _privateConstructorUsedError; String get outletId => throw _privateConstructorUsedError; + String get outletName => throw _privateConstructorUsedError; String get dateFrom => throw _privateConstructorUsedError; String get dateTo => throw _privateConstructorUsedError; DashboardOverview get overview => throw _privateConstructorUsedError; @@ -4276,6 +4321,7 @@ abstract class $DashboardAnalyticCopyWith<$Res> { $Res call({ String organizationId, String outletId, + String outletName, String dateFrom, String dateTo, DashboardOverview overview, @@ -4304,6 +4350,7 @@ class _$DashboardAnalyticCopyWithImpl<$Res, $Val extends DashboardAnalytic> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? dateFrom = null, Object? dateTo = null, Object? overview = null, @@ -4321,6 +4368,10 @@ class _$DashboardAnalyticCopyWithImpl<$Res, $Val extends DashboardAnalytic> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, dateFrom: null == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -4373,6 +4424,7 @@ abstract class _$$DashboardAnalyticImplCopyWith<$Res> $Res call({ String organizationId, String outletId, + String outletName, String dateFrom, String dateTo, DashboardOverview overview, @@ -4401,6 +4453,7 @@ class __$$DashboardAnalyticImplCopyWithImpl<$Res> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? dateFrom = null, Object? dateTo = null, Object? overview = null, @@ -4418,6 +4471,10 @@ class __$$DashboardAnalyticImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, dateFrom: null == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -4453,6 +4510,7 @@ class _$DashboardAnalyticImpl implements _DashboardAnalytic { const _$DashboardAnalyticImpl({ required this.organizationId, required this.outletId, + required this.outletName, required this.dateFrom, required this.dateTo, required this.overview, @@ -4468,6 +4526,8 @@ class _$DashboardAnalyticImpl implements _DashboardAnalytic { @override final String outletId; @override + final String outletName; + @override final String dateFrom; @override final String dateTo; @@ -4499,7 +4559,7 @@ class _$DashboardAnalyticImpl implements _DashboardAnalytic { @override String toString() { - return 'DashboardAnalytic(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, overview: $overview, topProducts: $topProducts, paymentMethods: $paymentMethods, recentSales: $recentSales)'; + return 'DashboardAnalytic(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, dateFrom: $dateFrom, dateTo: $dateTo, overview: $overview, topProducts: $topProducts, paymentMethods: $paymentMethods, recentSales: $recentSales)'; } @override @@ -4511,6 +4571,8 @@ class _$DashboardAnalyticImpl implements _DashboardAnalytic { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.dateFrom, dateFrom) || other.dateFrom == dateFrom) && (identical(other.dateTo, dateTo) || other.dateTo == dateTo) && @@ -4535,6 +4597,7 @@ class _$DashboardAnalyticImpl implements _DashboardAnalytic { runtimeType, organizationId, outletId, + outletName, dateFrom, dateTo, overview, @@ -4559,6 +4622,7 @@ abstract class _DashboardAnalytic implements DashboardAnalytic { const factory _DashboardAnalytic({ required final String organizationId, required final String outletId, + required final String outletName, required final String dateFrom, required final String dateTo, required final DashboardOverview overview, @@ -4572,6 +4636,8 @@ abstract class _DashboardAnalytic implements DashboardAnalytic { @override String get outletId; @override + String get outletName; + @override String get dateFrom; @override String get dateTo; @@ -4600,6 +4666,9 @@ mixin _$DashboardOverview { int get totalCustomers => throw _privateConstructorUsedError; int get voidedOrders => throw _privateConstructorUsedError; int get refundedOrders => throw _privateConstructorUsedError; + int get totalItemSold => throw _privateConstructorUsedError; + int get totalLowStock => throw _privateConstructorUsedError; + int get totalProductActive => throw _privateConstructorUsedError; /// Create a copy of DashboardOverview /// with the given fields replaced by the non-null parameter values. @@ -4622,6 +4691,9 @@ abstract class $DashboardOverviewCopyWith<$Res> { int totalCustomers, int voidedOrders, int refundedOrders, + int totalItemSold, + int totalLowStock, + int totalProductActive, }); } @@ -4646,6 +4718,9 @@ class _$DashboardOverviewCopyWithImpl<$Res, $Val extends DashboardOverview> Object? totalCustomers = null, Object? voidedOrders = null, Object? refundedOrders = null, + Object? totalItemSold = null, + Object? totalLowStock = null, + Object? totalProductActive = null, }) { return _then( _value.copyWith( @@ -4673,6 +4748,18 @@ class _$DashboardOverviewCopyWithImpl<$Res, $Val extends DashboardOverview> ? _value.refundedOrders : refundedOrders // ignore: cast_nullable_to_non_nullable as int, + totalItemSold: null == totalItemSold + ? _value.totalItemSold + : totalItemSold // ignore: cast_nullable_to_non_nullable + as int, + totalLowStock: null == totalLowStock + ? _value.totalLowStock + : totalLowStock // ignore: cast_nullable_to_non_nullable + as int, + totalProductActive: null == totalProductActive + ? _value.totalProductActive + : totalProductActive // ignore: cast_nullable_to_non_nullable + as int, ) as $Val, ); @@ -4695,6 +4782,9 @@ abstract class _$$DashboardOverviewImplCopyWith<$Res> int totalCustomers, int voidedOrders, int refundedOrders, + int totalItemSold, + int totalLowStock, + int totalProductActive, }); } @@ -4718,6 +4808,9 @@ class __$$DashboardOverviewImplCopyWithImpl<$Res> Object? totalCustomers = null, Object? voidedOrders = null, Object? refundedOrders = null, + Object? totalItemSold = null, + Object? totalLowStock = null, + Object? totalProductActive = null, }) { return _then( _$DashboardOverviewImpl( @@ -4745,6 +4838,18 @@ class __$$DashboardOverviewImplCopyWithImpl<$Res> ? _value.refundedOrders : refundedOrders // ignore: cast_nullable_to_non_nullable as int, + totalItemSold: null == totalItemSold + ? _value.totalItemSold + : totalItemSold // ignore: cast_nullable_to_non_nullable + as int, + totalLowStock: null == totalLowStock + ? _value.totalLowStock + : totalLowStock // ignore: cast_nullable_to_non_nullable + as int, + totalProductActive: null == totalProductActive + ? _value.totalProductActive + : totalProductActive // ignore: cast_nullable_to_non_nullable + as int, ), ); } @@ -4760,6 +4865,9 @@ class _$DashboardOverviewImpl implements _DashboardOverview { required this.totalCustomers, required this.voidedOrders, required this.refundedOrders, + required this.totalItemSold, + required this.totalLowStock, + required this.totalProductActive, }); @override @@ -4774,10 +4882,16 @@ class _$DashboardOverviewImpl implements _DashboardOverview { final int voidedOrders; @override final int refundedOrders; + @override + final int totalItemSold; + @override + final int totalLowStock; + @override + final int totalProductActive; @override String toString() { - return 'DashboardOverview(totalSales: $totalSales, totalOrders: $totalOrders, averageOrderValue: $averageOrderValue, totalCustomers: $totalCustomers, voidedOrders: $voidedOrders, refundedOrders: $refundedOrders)'; + return 'DashboardOverview(totalSales: $totalSales, totalOrders: $totalOrders, averageOrderValue: $averageOrderValue, totalCustomers: $totalCustomers, voidedOrders: $voidedOrders, refundedOrders: $refundedOrders, totalItemSold: $totalItemSold, totalLowStock: $totalLowStock, totalProductActive: $totalProductActive)'; } @override @@ -4796,7 +4910,13 @@ class _$DashboardOverviewImpl implements _DashboardOverview { (identical(other.voidedOrders, voidedOrders) || other.voidedOrders == voidedOrders) && (identical(other.refundedOrders, refundedOrders) || - other.refundedOrders == refundedOrders)); + other.refundedOrders == refundedOrders) && + (identical(other.totalItemSold, totalItemSold) || + other.totalItemSold == totalItemSold) && + (identical(other.totalLowStock, totalLowStock) || + other.totalLowStock == totalLowStock) && + (identical(other.totalProductActive, totalProductActive) || + other.totalProductActive == totalProductActive)); } @override @@ -4808,6 +4928,9 @@ class _$DashboardOverviewImpl implements _DashboardOverview { totalCustomers, voidedOrders, refundedOrders, + totalItemSold, + totalLowStock, + totalProductActive, ); /// Create a copy of DashboardOverview @@ -4830,6 +4953,9 @@ abstract class _DashboardOverview implements DashboardOverview { required final int totalCustomers, required final int voidedOrders, required final int refundedOrders, + required final int totalItemSold, + required final int totalLowStock, + required final int totalProductActive, }) = _$DashboardOverviewImpl; @override @@ -4844,6 +4970,12 @@ abstract class _DashboardOverview implements DashboardOverview { int get voidedOrders; @override int get refundedOrders; + @override + int get totalItemSold; + @override + int get totalLowStock; + @override + int get totalProductActive; /// Create a copy of DashboardOverview /// with the given fields replaced by the non-null parameter values. @@ -5727,6 +5859,7 @@ abstract class _DashboardRecentSale implements DashboardRecentSale { mixin _$ProductAnalytic { String get organizationId => throw _privateConstructorUsedError; String get outletId => throw _privateConstructorUsedError; + String get outletName => throw _privateConstructorUsedError; String get dateFrom => throw _privateConstructorUsedError; String get dateTo => throw _privateConstructorUsedError; List get data => throw _privateConstructorUsedError; @@ -5748,6 +5881,7 @@ abstract class $ProductAnalyticCopyWith<$Res> { $Res call({ String organizationId, String outletId, + String outletName, String dateFrom, String dateTo, List data, @@ -5771,6 +5905,7 @@ class _$ProductAnalyticCopyWithImpl<$Res, $Val extends ProductAnalytic> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? dateFrom = null, Object? dateTo = null, Object? data = null, @@ -5785,6 +5920,10 @@ class _$ProductAnalyticCopyWithImpl<$Res, $Val extends ProductAnalytic> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, dateFrom: null == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -5815,6 +5954,7 @@ abstract class _$$ProductAnalyticImplCopyWith<$Res> $Res call({ String organizationId, String outletId, + String outletName, String dateFrom, String dateTo, List data, @@ -5837,6 +5977,7 @@ class __$$ProductAnalyticImplCopyWithImpl<$Res> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? dateFrom = null, Object? dateTo = null, Object? data = null, @@ -5851,6 +5992,10 @@ class __$$ProductAnalyticImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, dateFrom: null == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -5874,6 +6019,7 @@ class _$ProductAnalyticImpl implements _ProductAnalytic { const _$ProductAnalyticImpl({ required this.organizationId, required this.outletId, + required this.outletName, required this.dateFrom, required this.dateTo, required final List data, @@ -5884,6 +6030,8 @@ class _$ProductAnalyticImpl implements _ProductAnalytic { @override final String outletId; @override + final String outletName; + @override final String dateFrom; @override final String dateTo; @@ -5897,7 +6045,7 @@ class _$ProductAnalyticImpl implements _ProductAnalytic { @override String toString() { - return 'ProductAnalytic(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, data: $data)'; + return 'ProductAnalytic(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, dateFrom: $dateFrom, dateTo: $dateTo, data: $data)'; } @override @@ -5909,6 +6057,8 @@ class _$ProductAnalyticImpl implements _ProductAnalytic { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.dateFrom, dateFrom) || other.dateFrom == dateFrom) && (identical(other.dateTo, dateTo) || other.dateTo == dateTo) && @@ -5920,6 +6070,7 @@ class _$ProductAnalyticImpl implements _ProductAnalytic { runtimeType, organizationId, outletId, + outletName, dateFrom, dateTo, const DeepCollectionEquality().hash(_data), @@ -5941,6 +6092,7 @@ abstract class _ProductAnalytic implements ProductAnalytic { const factory _ProductAnalytic({ required final String organizationId, required final String outletId, + required final String outletName, required final String dateFrom, required final String dateTo, required final List data, @@ -5951,6 +6103,8 @@ abstract class _ProductAnalytic implements ProductAnalytic { @override String get outletId; @override + String get outletName; + @override String get dateFrom; @override String get dateTo; @@ -5969,12 +6123,21 @@ abstract class _ProductAnalytic implements ProductAnalytic { mixin _$ProductAnalyticData { String get productId => throw _privateConstructorUsedError; String get productName => throw _privateConstructorUsedError; + String get productSku => throw _privateConstructorUsedError; + int get productPrice => throw _privateConstructorUsedError; String get categoryId => throw _privateConstructorUsedError; String get categoryName => throw _privateConstructorUsedError; + int get categoryOrder => throw _privateConstructorUsedError; int get quantitySold => throw _privateConstructorUsedError; int get revenue => throw _privateConstructorUsedError; double get averagePrice => throw _privateConstructorUsedError; int get orderCount => throw _privateConstructorUsedError; + int get standardHppPerUnit => throw _privateConstructorUsedError; + int get standardHppTotal => throw _privateConstructorUsedError; + int get fifoHppPerUnit => throw _privateConstructorUsedError; + int get fifoHppTotal => throw _privateConstructorUsedError; + int get movingAverageHppPerUnit => throw _privateConstructorUsedError; + int get movingAverageHppTotal => throw _privateConstructorUsedError; /// Create a copy of ProductAnalyticData /// with the given fields replaced by the non-null parameter values. @@ -5993,12 +6156,21 @@ abstract class $ProductAnalyticDataCopyWith<$Res> { $Res call({ String productId, String productName, + String productSku, + int productPrice, String categoryId, String categoryName, + int categoryOrder, int quantitySold, int revenue, double averagePrice, int orderCount, + int standardHppPerUnit, + int standardHppTotal, + int fifoHppPerUnit, + int fifoHppTotal, + int movingAverageHppPerUnit, + int movingAverageHppTotal, }); } @@ -6019,12 +6191,21 @@ class _$ProductAnalyticDataCopyWithImpl<$Res, $Val extends ProductAnalyticData> $Res call({ Object? productId = null, Object? productName = null, + Object? productSku = null, + Object? productPrice = null, Object? categoryId = null, Object? categoryName = null, + Object? categoryOrder = null, Object? quantitySold = null, Object? revenue = null, Object? averagePrice = null, Object? orderCount = null, + Object? standardHppPerUnit = null, + Object? standardHppTotal = null, + Object? fifoHppPerUnit = null, + Object? fifoHppTotal = null, + Object? movingAverageHppPerUnit = null, + Object? movingAverageHppTotal = null, }) { return _then( _value.copyWith( @@ -6036,6 +6217,14 @@ class _$ProductAnalyticDataCopyWithImpl<$Res, $Val extends ProductAnalyticData> ? _value.productName : productName // ignore: cast_nullable_to_non_nullable as String, + productSku: null == productSku + ? _value.productSku + : productSku // ignore: cast_nullable_to_non_nullable + as String, + productPrice: null == productPrice + ? _value.productPrice + : productPrice // ignore: cast_nullable_to_non_nullable + as int, categoryId: null == categoryId ? _value.categoryId : categoryId // ignore: cast_nullable_to_non_nullable @@ -6044,6 +6233,10 @@ class _$ProductAnalyticDataCopyWithImpl<$Res, $Val extends ProductAnalyticData> ? _value.categoryName : categoryName // ignore: cast_nullable_to_non_nullable as String, + categoryOrder: null == categoryOrder + ? _value.categoryOrder + : categoryOrder // ignore: cast_nullable_to_non_nullable + as int, quantitySold: null == quantitySold ? _value.quantitySold : quantitySold // ignore: cast_nullable_to_non_nullable @@ -6060,6 +6253,30 @@ class _$ProductAnalyticDataCopyWithImpl<$Res, $Val extends ProductAnalyticData> ? _value.orderCount : orderCount // ignore: cast_nullable_to_non_nullable as int, + standardHppPerUnit: null == standardHppPerUnit + ? _value.standardHppPerUnit + : standardHppPerUnit // ignore: cast_nullable_to_non_nullable + as int, + standardHppTotal: null == standardHppTotal + ? _value.standardHppTotal + : standardHppTotal // ignore: cast_nullable_to_non_nullable + as int, + fifoHppPerUnit: null == fifoHppPerUnit + ? _value.fifoHppPerUnit + : fifoHppPerUnit // ignore: cast_nullable_to_non_nullable + as int, + fifoHppTotal: null == fifoHppTotal + ? _value.fifoHppTotal + : fifoHppTotal // ignore: cast_nullable_to_non_nullable + as int, + movingAverageHppPerUnit: null == movingAverageHppPerUnit + ? _value.movingAverageHppPerUnit + : movingAverageHppPerUnit // ignore: cast_nullable_to_non_nullable + as int, + movingAverageHppTotal: null == movingAverageHppTotal + ? _value.movingAverageHppTotal + : movingAverageHppTotal // ignore: cast_nullable_to_non_nullable + as int, ) as $Val, ); @@ -6078,12 +6295,21 @@ abstract class _$$ProductAnalyticDataImplCopyWith<$Res> $Res call({ String productId, String productName, + String productSku, + int productPrice, String categoryId, String categoryName, + int categoryOrder, int quantitySold, int revenue, double averagePrice, int orderCount, + int standardHppPerUnit, + int standardHppTotal, + int fifoHppPerUnit, + int fifoHppTotal, + int movingAverageHppPerUnit, + int movingAverageHppTotal, }); } @@ -6103,12 +6329,21 @@ class __$$ProductAnalyticDataImplCopyWithImpl<$Res> $Res call({ Object? productId = null, Object? productName = null, + Object? productSku = null, + Object? productPrice = null, Object? categoryId = null, Object? categoryName = null, + Object? categoryOrder = null, Object? quantitySold = null, Object? revenue = null, Object? averagePrice = null, Object? orderCount = null, + Object? standardHppPerUnit = null, + Object? standardHppTotal = null, + Object? fifoHppPerUnit = null, + Object? fifoHppTotal = null, + Object? movingAverageHppPerUnit = null, + Object? movingAverageHppTotal = null, }) { return _then( _$ProductAnalyticDataImpl( @@ -6120,6 +6355,14 @@ class __$$ProductAnalyticDataImplCopyWithImpl<$Res> ? _value.productName : productName // ignore: cast_nullable_to_non_nullable as String, + productSku: null == productSku + ? _value.productSku + : productSku // ignore: cast_nullable_to_non_nullable + as String, + productPrice: null == productPrice + ? _value.productPrice + : productPrice // ignore: cast_nullable_to_non_nullable + as int, categoryId: null == categoryId ? _value.categoryId : categoryId // ignore: cast_nullable_to_non_nullable @@ -6128,6 +6371,10 @@ class __$$ProductAnalyticDataImplCopyWithImpl<$Res> ? _value.categoryName : categoryName // ignore: cast_nullable_to_non_nullable as String, + categoryOrder: null == categoryOrder + ? _value.categoryOrder + : categoryOrder // ignore: cast_nullable_to_non_nullable + as int, quantitySold: null == quantitySold ? _value.quantitySold : quantitySold // ignore: cast_nullable_to_non_nullable @@ -6144,6 +6391,30 @@ class __$$ProductAnalyticDataImplCopyWithImpl<$Res> ? _value.orderCount : orderCount // ignore: cast_nullable_to_non_nullable as int, + standardHppPerUnit: null == standardHppPerUnit + ? _value.standardHppPerUnit + : standardHppPerUnit // ignore: cast_nullable_to_non_nullable + as int, + standardHppTotal: null == standardHppTotal + ? _value.standardHppTotal + : standardHppTotal // ignore: cast_nullable_to_non_nullable + as int, + fifoHppPerUnit: null == fifoHppPerUnit + ? _value.fifoHppPerUnit + : fifoHppPerUnit // ignore: cast_nullable_to_non_nullable + as int, + fifoHppTotal: null == fifoHppTotal + ? _value.fifoHppTotal + : fifoHppTotal // ignore: cast_nullable_to_non_nullable + as int, + movingAverageHppPerUnit: null == movingAverageHppPerUnit + ? _value.movingAverageHppPerUnit + : movingAverageHppPerUnit // ignore: cast_nullable_to_non_nullable + as int, + movingAverageHppTotal: null == movingAverageHppTotal + ? _value.movingAverageHppTotal + : movingAverageHppTotal // ignore: cast_nullable_to_non_nullable + as int, ), ); } @@ -6155,12 +6426,21 @@ class _$ProductAnalyticDataImpl implements _ProductAnalyticData { const _$ProductAnalyticDataImpl({ required this.productId, required this.productName, + required this.productSku, + required this.productPrice, required this.categoryId, required this.categoryName, + required this.categoryOrder, required this.quantitySold, required this.revenue, required this.averagePrice, required this.orderCount, + required this.standardHppPerUnit, + required this.standardHppTotal, + required this.fifoHppPerUnit, + required this.fifoHppTotal, + required this.movingAverageHppPerUnit, + required this.movingAverageHppTotal, }); @override @@ -6168,10 +6448,16 @@ class _$ProductAnalyticDataImpl implements _ProductAnalyticData { @override final String productName; @override + final String productSku; + @override + final int productPrice; + @override final String categoryId; @override final String categoryName; @override + final int categoryOrder; + @override final int quantitySold; @override final int revenue; @@ -6179,10 +6465,22 @@ class _$ProductAnalyticDataImpl implements _ProductAnalyticData { final double averagePrice; @override final int orderCount; + @override + final int standardHppPerUnit; + @override + final int standardHppTotal; + @override + final int fifoHppPerUnit; + @override + final int fifoHppTotal; + @override + final int movingAverageHppPerUnit; + @override + final int movingAverageHppTotal; @override String toString() { - return 'ProductAnalyticData(productId: $productId, productName: $productName, categoryId: $categoryId, categoryName: $categoryName, quantitySold: $quantitySold, revenue: $revenue, averagePrice: $averagePrice, orderCount: $orderCount)'; + return 'ProductAnalyticData(productId: $productId, productName: $productName, productSku: $productSku, productPrice: $productPrice, categoryId: $categoryId, categoryName: $categoryName, categoryOrder: $categoryOrder, quantitySold: $quantitySold, revenue: $revenue, averagePrice: $averagePrice, orderCount: $orderCount, standardHppPerUnit: $standardHppPerUnit, standardHppTotal: $standardHppTotal, fifoHppPerUnit: $fifoHppPerUnit, fifoHppTotal: $fifoHppTotal, movingAverageHppPerUnit: $movingAverageHppPerUnit, movingAverageHppTotal: $movingAverageHppTotal)'; } @override @@ -6194,17 +6492,38 @@ class _$ProductAnalyticDataImpl implements _ProductAnalyticData { other.productId == productId) && (identical(other.productName, productName) || other.productName == productName) && + (identical(other.productSku, productSku) || + other.productSku == productSku) && + (identical(other.productPrice, productPrice) || + other.productPrice == productPrice) && (identical(other.categoryId, categoryId) || other.categoryId == categoryId) && (identical(other.categoryName, categoryName) || other.categoryName == categoryName) && + (identical(other.categoryOrder, categoryOrder) || + other.categoryOrder == categoryOrder) && (identical(other.quantitySold, quantitySold) || other.quantitySold == quantitySold) && (identical(other.revenue, revenue) || other.revenue == revenue) && (identical(other.averagePrice, averagePrice) || other.averagePrice == averagePrice) && (identical(other.orderCount, orderCount) || - other.orderCount == orderCount)); + other.orderCount == orderCount) && + (identical(other.standardHppPerUnit, standardHppPerUnit) || + other.standardHppPerUnit == standardHppPerUnit) && + (identical(other.standardHppTotal, standardHppTotal) || + other.standardHppTotal == standardHppTotal) && + (identical(other.fifoHppPerUnit, fifoHppPerUnit) || + other.fifoHppPerUnit == fifoHppPerUnit) && + (identical(other.fifoHppTotal, fifoHppTotal) || + other.fifoHppTotal == fifoHppTotal) && + (identical( + other.movingAverageHppPerUnit, + movingAverageHppPerUnit, + ) || + other.movingAverageHppPerUnit == movingAverageHppPerUnit) && + (identical(other.movingAverageHppTotal, movingAverageHppTotal) || + other.movingAverageHppTotal == movingAverageHppTotal)); } @override @@ -6212,12 +6531,21 @@ class _$ProductAnalyticDataImpl implements _ProductAnalyticData { runtimeType, productId, productName, + productSku, + productPrice, categoryId, categoryName, + categoryOrder, quantitySold, revenue, averagePrice, orderCount, + standardHppPerUnit, + standardHppTotal, + fifoHppPerUnit, + fifoHppTotal, + movingAverageHppPerUnit, + movingAverageHppTotal, ); /// Create a copy of ProductAnalyticData @@ -6236,12 +6564,21 @@ abstract class _ProductAnalyticData implements ProductAnalyticData { const factory _ProductAnalyticData({ required final String productId, required final String productName, + required final String productSku, + required final int productPrice, required final String categoryId, required final String categoryName, + required final int categoryOrder, required final int quantitySold, required final int revenue, required final double averagePrice, required final int orderCount, + required final int standardHppPerUnit, + required final int standardHppTotal, + required final int fifoHppPerUnit, + required final int fifoHppTotal, + required final int movingAverageHppPerUnit, + required final int movingAverageHppTotal, }) = _$ProductAnalyticDataImpl; @override @@ -6249,10 +6586,16 @@ abstract class _ProductAnalyticData implements ProductAnalyticData { @override String get productName; @override + String get productSku; + @override + int get productPrice; + @override String get categoryId; @override String get categoryName; @override + int get categoryOrder; + @override int get quantitySold; @override int get revenue; @@ -6260,6 +6603,18 @@ abstract class _ProductAnalyticData implements ProductAnalyticData { double get averagePrice; @override int get orderCount; + @override + int get standardHppPerUnit; + @override + int get standardHppTotal; + @override + int get fifoHppPerUnit; + @override + int get fifoHppTotal; + @override + int get movingAverageHppPerUnit; + @override + int get movingAverageHppTotal; /// Create a copy of ProductAnalyticData /// with the given fields replaced by the non-null parameter values. @@ -6273,6 +6628,7 @@ abstract class _ProductAnalyticData implements ProductAnalyticData { mixin _$PaymentMethodAnalytic { String get organizationId => throw _privateConstructorUsedError; String get outletId => throw _privateConstructorUsedError; + String get outletName => throw _privateConstructorUsedError; String get dateFrom => throw _privateConstructorUsedError; String get dateTo => throw _privateConstructorUsedError; String get groupBy => throw _privateConstructorUsedError; @@ -6296,6 +6652,7 @@ abstract class $PaymentMethodAnalyticCopyWith<$Res> { $Res call({ String organizationId, String outletId, + String outletName, String dateFrom, String dateTo, String groupBy, @@ -6326,6 +6683,7 @@ class _$PaymentMethodAnalyticCopyWithImpl< $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? dateFrom = null, Object? dateTo = null, Object? groupBy = null, @@ -6342,6 +6700,10 @@ class _$PaymentMethodAnalyticCopyWithImpl< ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, dateFrom: null == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -6390,6 +6752,7 @@ abstract class _$$PaymentMethodAnalyticImplCopyWith<$Res> $Res call({ String organizationId, String outletId, + String outletName, String dateFrom, String dateTo, String groupBy, @@ -6418,6 +6781,7 @@ class __$$PaymentMethodAnalyticImplCopyWithImpl<$Res> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? dateFrom = null, Object? dateTo = null, Object? groupBy = null, @@ -6434,6 +6798,10 @@ class __$$PaymentMethodAnalyticImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, dateFrom: null == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -6465,6 +6833,7 @@ class _$PaymentMethodAnalyticImpl implements _PaymentMethodAnalytic { const _$PaymentMethodAnalyticImpl({ required this.organizationId, required this.outletId, + required this.outletName, required this.dateFrom, required this.dateTo, required this.groupBy, @@ -6477,6 +6846,8 @@ class _$PaymentMethodAnalyticImpl implements _PaymentMethodAnalytic { @override final String outletId; @override + final String outletName; + @override final String dateFrom; @override final String dateTo; @@ -6494,7 +6865,7 @@ class _$PaymentMethodAnalyticImpl implements _PaymentMethodAnalytic { @override String toString() { - return 'PaymentMethodAnalytic(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, groupBy: $groupBy, summary: $summary, data: $data)'; + return 'PaymentMethodAnalytic(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, dateFrom: $dateFrom, dateTo: $dateTo, groupBy: $groupBy, summary: $summary, data: $data)'; } @override @@ -6506,6 +6877,8 @@ class _$PaymentMethodAnalyticImpl implements _PaymentMethodAnalytic { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.dateFrom, dateFrom) || other.dateFrom == dateFrom) && (identical(other.dateTo, dateTo) || other.dateTo == dateTo) && @@ -6519,6 +6892,7 @@ class _$PaymentMethodAnalyticImpl implements _PaymentMethodAnalytic { runtimeType, organizationId, outletId, + outletName, dateFrom, dateTo, groupBy, @@ -6543,6 +6917,7 @@ abstract class _PaymentMethodAnalytic implements PaymentMethodAnalytic { const factory _PaymentMethodAnalytic({ required final String organizationId, required final String outletId, + required final String outletName, required final String dateFrom, required final String dateTo, required final String groupBy, @@ -6555,6 +6930,8 @@ abstract class _PaymentMethodAnalytic implements PaymentMethodAnalytic { @override String get outletId; @override + String get outletName; + @override String get dateFrom; @override String get dateTo; @@ -8716,6 +9093,7 @@ abstract class _PurchasingVendorData implements PurchasingVendorData { mixin _$ExclusiveSummary { String get organizationId => throw _privateConstructorUsedError; String get outletId => throw _privateConstructorUsedError; + String get outletName => throw _privateConstructorUsedError; ExclusiveSummaryPeriod get period => throw _privateConstructorUsedError; ExclusiveSummarySummary get summary => throw _privateConstructorUsedError; ExclusiveSummaryReimburse get reimburse => throw _privateConstructorUsedError; @@ -8745,6 +9123,7 @@ abstract class $ExclusiveSummaryCopyWith<$Res> { $Res call({ String organizationId, String outletId, + String outletName, ExclusiveSummaryPeriod period, ExclusiveSummarySummary summary, ExclusiveSummaryReimburse reimburse, @@ -8776,6 +9155,7 @@ class _$ExclusiveSummaryCopyWithImpl<$Res, $Val extends ExclusiveSummary> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? period = null, Object? summary = null, Object? reimburse = null, @@ -8794,6 +9174,10 @@ class _$ExclusiveSummaryCopyWithImpl<$Res, $Val extends ExclusiveSummary> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, period: null == period ? _value.period : period // ignore: cast_nullable_to_non_nullable @@ -8870,6 +9254,7 @@ abstract class _$$ExclusiveSummaryImplCopyWith<$Res> $Res call({ String organizationId, String outletId, + String outletName, ExclusiveSummaryPeriod period, ExclusiveSummarySummary summary, ExclusiveSummaryReimburse reimburse, @@ -8903,6 +9288,7 @@ class __$$ExclusiveSummaryImplCopyWithImpl<$Res> $Res call({ Object? organizationId = null, Object? outletId = null, + Object? outletName = null, Object? period = null, Object? summary = null, Object? reimburse = null, @@ -8921,6 +9307,10 @@ class __$$ExclusiveSummaryImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String, + outletName: null == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String, period: null == period ? _value.period : period // ignore: cast_nullable_to_non_nullable @@ -8960,6 +9350,7 @@ class _$ExclusiveSummaryImpl implements _ExclusiveSummary { const _$ExclusiveSummaryImpl({ required this.organizationId, required this.outletId, + required this.outletName, required this.period, required this.summary, required this.reimburse, @@ -8977,6 +9368,8 @@ class _$ExclusiveSummaryImpl implements _ExclusiveSummary { @override final String outletId; @override + final String outletName; + @override final ExclusiveSummaryPeriod period; @override final ExclusiveSummarySummary summary; @@ -9018,7 +9411,7 @@ class _$ExclusiveSummaryImpl implements _ExclusiveSummary { @override String toString() { - return 'ExclusiveSummary(organizationId: $organizationId, outletId: $outletId, period: $period, summary: $summary, reimburse: $reimburse, hppBreakdown: $hppBreakdown, operationalExpenseBreakdown: $operationalExpenseBreakdown, dailySummary: $dailySummary, dailyTransactions: $dailyTransactions)'; + return 'ExclusiveSummary(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, period: $period, summary: $summary, reimburse: $reimburse, hppBreakdown: $hppBreakdown, operationalExpenseBreakdown: $operationalExpenseBreakdown, dailySummary: $dailySummary, dailyTransactions: $dailyTransactions)'; } @override @@ -9030,6 +9423,8 @@ class _$ExclusiveSummaryImpl implements _ExclusiveSummary { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.period, period) || other.period == period) && (identical(other.summary, summary) || other.summary == summary) && (identical(other.reimburse, reimburse) || @@ -9057,6 +9452,7 @@ class _$ExclusiveSummaryImpl implements _ExclusiveSummary { runtimeType, organizationId, outletId, + outletName, period, summary, reimburse, @@ -9082,6 +9478,7 @@ abstract class _ExclusiveSummary implements ExclusiveSummary { const factory _ExclusiveSummary({ required final String organizationId, required final String outletId, + required final String outletName, required final ExclusiveSummaryPeriod period, required final ExclusiveSummarySummary summary, required final ExclusiveSummaryReimburse reimburse, @@ -9096,6 +9493,8 @@ abstract class _ExclusiveSummary implements ExclusiveSummary { @override String get outletId; @override + String get outletName; + @override ExclusiveSummaryPeriod get period; @override ExclusiveSummarySummary get summary; diff --git a/lib/domain/analytic/entities/category_analytic_entity.dart b/lib/domain/analytic/entities/category_analytic_entity.dart index 56d8f29..3f79272 100644 --- a/lib/domain/analytic/entities/category_analytic_entity.dart +++ b/lib/domain/analytic/entities/category_analytic_entity.dart @@ -5,6 +5,7 @@ class CategoryAnalytic with _$CategoryAnalytic { const factory CategoryAnalytic({ required String organizationId, required String outletId, + required String outletName, required String dateFrom, required String dateTo, required List data, @@ -13,6 +14,7 @@ class CategoryAnalytic with _$CategoryAnalytic { factory CategoryAnalytic.empty() => const CategoryAnalytic( organizationId: "", outletId: "", + outletName: "", dateFrom: "", dateTo: "", data: [], diff --git a/lib/domain/analytic/entities/dashboard_analytic_entity.dart b/lib/domain/analytic/entities/dashboard_analytic_entity.dart index 204c85b..6e8c843 100644 --- a/lib/domain/analytic/entities/dashboard_analytic_entity.dart +++ b/lib/domain/analytic/entities/dashboard_analytic_entity.dart @@ -5,6 +5,7 @@ class DashboardAnalytic with _$DashboardAnalytic { const factory DashboardAnalytic({ required String organizationId, required String outletId, + required String outletName, required String dateFrom, required String dateTo, required DashboardOverview overview, @@ -16,6 +17,7 @@ class DashboardAnalytic with _$DashboardAnalytic { factory DashboardAnalytic.empty() => DashboardAnalytic( organizationId: '', outletId: '', + outletName: '', dateFrom: '', dateTo: '', overview: DashboardOverview.empty(), @@ -34,6 +36,9 @@ class DashboardOverview with _$DashboardOverview { required int totalCustomers, required int voidedOrders, required int refundedOrders, + required int totalItemSold, + required int totalLowStock, + required int totalProductActive, }) = _DashboardOverview; factory DashboardOverview.empty() => const DashboardOverview( @@ -43,6 +48,9 @@ class DashboardOverview with _$DashboardOverview { totalCustomers: 0, voidedOrders: 0, refundedOrders: 0, + totalItemSold: 0, + totalLowStock: 0, + totalProductActive: 0, ); } diff --git a/lib/domain/analytic/entities/exclusive_summary_entity.dart b/lib/domain/analytic/entities/exclusive_summary_entity.dart index e0cf1b6..1eade19 100644 --- a/lib/domain/analytic/entities/exclusive_summary_entity.dart +++ b/lib/domain/analytic/entities/exclusive_summary_entity.dart @@ -5,6 +5,7 @@ class ExclusiveSummary with _$ExclusiveSummary { const factory ExclusiveSummary({ required String organizationId, required String outletId, + required String outletName, required ExclusiveSummaryPeriod period, required ExclusiveSummarySummary summary, required ExclusiveSummaryReimburse reimburse, @@ -17,6 +18,7 @@ class ExclusiveSummary with _$ExclusiveSummary { factory ExclusiveSummary.empty() => ExclusiveSummary( organizationId: '', outletId: '', + outletName: '', period: ExclusiveSummaryPeriod.empty(), summary: ExclusiveSummarySummary.empty(), reimburse: ExclusiveSummaryReimburse.empty(), @@ -79,12 +81,11 @@ class ExclusiveSummaryReimburse with _$ExclusiveSummaryReimburse { required int totalReimburse, }) = _ExclusiveSummaryReimburse; - factory ExclusiveSummaryReimburse.empty() => - const ExclusiveSummaryReimburse( - totalCost: 0, - excludedSalaryStaff: 0, - totalReimburse: 0, - ); + factory ExclusiveSummaryReimburse.empty() => const ExclusiveSummaryReimburse( + totalCost: 0, + excludedSalaryStaff: 0, + totalReimburse: 0, + ); } @freezed diff --git a/lib/domain/analytic/entities/payment_method_analytic_entity.dart b/lib/domain/analytic/entities/payment_method_analytic_entity.dart index 859e06d..29b09a5 100644 --- a/lib/domain/analytic/entities/payment_method_analytic_entity.dart +++ b/lib/domain/analytic/entities/payment_method_analytic_entity.dart @@ -5,6 +5,7 @@ class PaymentMethodAnalytic with _$PaymentMethodAnalytic { const factory PaymentMethodAnalytic({ required String organizationId, required String outletId, + required String outletName, required String dateFrom, required String dateTo, required String groupBy, @@ -15,6 +16,7 @@ class PaymentMethodAnalytic with _$PaymentMethodAnalytic { factory PaymentMethodAnalytic.empty() => PaymentMethodAnalytic( organizationId: '', outletId: '', + outletName: '', dateFrom: '', dateTo: '', groupBy: '', diff --git a/lib/domain/analytic/entities/product_analytic_entity.dart b/lib/domain/analytic/entities/product_analytic_entity.dart index 33b8c3a..dedeed2 100644 --- a/lib/domain/analytic/entities/product_analytic_entity.dart +++ b/lib/domain/analytic/entities/product_analytic_entity.dart @@ -5,6 +5,7 @@ class ProductAnalytic with _$ProductAnalytic { const factory ProductAnalytic({ required String organizationId, required String outletId, + required String outletName, required String dateFrom, required String dateTo, required List data, @@ -13,6 +14,7 @@ class ProductAnalytic with _$ProductAnalytic { factory ProductAnalytic.empty() => const ProductAnalytic( organizationId: '', outletId: '', + outletName: '', dateFrom: '', dateTo: '', data: [], @@ -24,22 +26,40 @@ class ProductAnalyticData with _$ProductAnalyticData { const factory ProductAnalyticData({ required String productId, required String productName, + required String productSku, + required int productPrice, required String categoryId, required String categoryName, + required int categoryOrder, required int quantitySold, required int revenue, required double averagePrice, required int orderCount, + required int standardHppPerUnit, + required int standardHppTotal, + required int fifoHppPerUnit, + required int fifoHppTotal, + required int movingAverageHppPerUnit, + required int movingAverageHppTotal, }) = _ProductAnalyticData; factory ProductAnalyticData.empty() => const ProductAnalyticData( productId: '', productName: '', + productSku: '', + productPrice: 0, categoryId: '', categoryName: '', + categoryOrder: 0, quantitySold: 0, revenue: 0, averagePrice: 0.0, orderCount: 0, + standardHppPerUnit: 0, + standardHppTotal: 0, + fifoHppPerUnit: 0, + fifoHppTotal: 0, + movingAverageHppPerUnit: 0, + movingAverageHppTotal: 0, ); } diff --git a/lib/domain/analytic/entities/sales_analytic_entity.dart b/lib/domain/analytic/entities/sales_analytic_entity.dart index e53d57f..cb6c8f4 100644 --- a/lib/domain/analytic/entities/sales_analytic_entity.dart +++ b/lib/domain/analytic/entities/sales_analytic_entity.dart @@ -5,6 +5,7 @@ class SalesAnalytic with _$SalesAnalytic { const factory SalesAnalytic({ required String organizationId, required String outletId, + required String outletName, required DateTime dateFrom, required DateTime dateTo, required String groupBy, @@ -15,6 +16,7 @@ class SalesAnalytic with _$SalesAnalytic { factory SalesAnalytic.empty() => SalesAnalytic( organizationId: '', outletId: '', + outletName: '', dateFrom: DateTime.fromMillisecondsSinceEpoch(0), dateTo: DateTime.fromMillisecondsSinceEpoch(0), groupBy: '', diff --git a/lib/infrastructure/analytic/analytic_dtos.freezed.dart b/lib/infrastructure/analytic/analytic_dtos.freezed.dart index 83dfd1e..0002fe9 100644 --- a/lib/infrastructure/analytic/analytic_dtos.freezed.dart +++ b/lib/infrastructure/analytic/analytic_dtos.freezed.dart @@ -25,6 +25,8 @@ mixin _$SalesAnalyticDto { String? get organizationId => throw _privateConstructorUsedError; @JsonKey(name: 'outlet_id') String? get outletId => throw _privateConstructorUsedError; + @JsonKey(name: 'outlet_name') + String? get outletName => throw _privateConstructorUsedError; @JsonKey(name: 'date_from') DateTime? get dateFrom => throw _privateConstructorUsedError; @JsonKey(name: 'date_to') @@ -56,6 +58,7 @@ abstract class $SalesAnalyticDtoCopyWith<$Res> { $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') DateTime? dateFrom, @JsonKey(name: 'date_to') DateTime? dateTo, @JsonKey(name: 'group_by') String? groupBy, @@ -83,6 +86,7 @@ class _$SalesAnalyticDtoCopyWithImpl<$Res, $Val extends SalesAnalyticDto> $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? dateFrom = freezed, Object? dateTo = freezed, Object? groupBy = freezed, @@ -99,6 +103,10 @@ class _$SalesAnalyticDtoCopyWithImpl<$Res, $Val extends SalesAnalyticDto> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, dateFrom: freezed == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -151,6 +159,7 @@ abstract class _$$SalesAnalyticDtoImplCopyWith<$Res> $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') DateTime? dateFrom, @JsonKey(name: 'date_to') DateTime? dateTo, @JsonKey(name: 'group_by') String? groupBy, @@ -178,6 +187,7 @@ class __$$SalesAnalyticDtoImplCopyWithImpl<$Res> $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? dateFrom = freezed, Object? dateTo = freezed, Object? groupBy = freezed, @@ -194,6 +204,10 @@ class __$$SalesAnalyticDtoImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, dateFrom: freezed == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -225,6 +239,7 @@ class _$SalesAnalyticDtoImpl extends _SalesAnalyticDto { const _$SalesAnalyticDtoImpl({ @JsonKey(name: 'organization_id') this.organizationId, @JsonKey(name: 'outlet_id') this.outletId, + @JsonKey(name: 'outlet_name') this.outletName, @JsonKey(name: 'date_from') this.dateFrom, @JsonKey(name: 'date_to') this.dateTo, @JsonKey(name: 'group_by') this.groupBy, @@ -243,6 +258,9 @@ class _$SalesAnalyticDtoImpl extends _SalesAnalyticDto { @JsonKey(name: 'outlet_id') final String? outletId; @override + @JsonKey(name: 'outlet_name') + final String? outletName; + @override @JsonKey(name: 'date_from') final DateTime? dateFrom; @override @@ -267,7 +285,7 @@ class _$SalesAnalyticDtoImpl extends _SalesAnalyticDto { @override String toString() { - return 'SalesAnalyticDto(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, groupBy: $groupBy, summary: $summary, data: $data)'; + return 'SalesAnalyticDto(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, dateFrom: $dateFrom, dateTo: $dateTo, groupBy: $groupBy, summary: $summary, data: $data)'; } @override @@ -279,6 +297,8 @@ class _$SalesAnalyticDtoImpl extends _SalesAnalyticDto { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.dateFrom, dateFrom) || other.dateFrom == dateFrom) && (identical(other.dateTo, dateTo) || other.dateTo == dateTo) && @@ -293,6 +313,7 @@ class _$SalesAnalyticDtoImpl extends _SalesAnalyticDto { runtimeType, organizationId, outletId, + outletName, dateFrom, dateTo, groupBy, @@ -321,6 +342,7 @@ abstract class _SalesAnalyticDto extends SalesAnalyticDto { const factory _SalesAnalyticDto({ @JsonKey(name: 'organization_id') final String? organizationId, @JsonKey(name: 'outlet_id') final String? outletId, + @JsonKey(name: 'outlet_name') final String? outletName, @JsonKey(name: 'date_from') final DateTime? dateFrom, @JsonKey(name: 'date_to') final DateTime? dateTo, @JsonKey(name: 'group_by') final String? groupBy, @@ -339,6 +361,9 @@ abstract class _SalesAnalyticDto extends SalesAnalyticDto { @JsonKey(name: 'outlet_id') String? get outletId; @override + @JsonKey(name: 'outlet_name') + String? get outletName; + @override @JsonKey(name: 'date_from') DateTime? get dateFrom; @override @@ -2681,6 +2706,8 @@ mixin _$CategoryAnalyticDto { String? get organizationId => throw _privateConstructorUsedError; @JsonKey(name: 'outlet_id') String? get outletId => throw _privateConstructorUsedError; + @JsonKey(name: 'outlet_name') + String? get outletName => throw _privateConstructorUsedError; @JsonKey(name: 'date_from') String? get dateFrom => throw _privateConstructorUsedError; @JsonKey(name: 'date_to') @@ -2708,6 +2735,7 @@ abstract class $CategoryAnalyticDtoCopyWith<$Res> { $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'data') List? data, @@ -2731,6 +2759,7 @@ class _$CategoryAnalyticDtoCopyWithImpl<$Res, $Val extends CategoryAnalyticDto> $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? dateFrom = freezed, Object? dateTo = freezed, Object? data = freezed, @@ -2745,6 +2774,10 @@ class _$CategoryAnalyticDtoCopyWithImpl<$Res, $Val extends CategoryAnalyticDto> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, dateFrom: freezed == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -2775,6 +2808,7 @@ abstract class _$$CategoryAnalyticDtoImplCopyWith<$Res> $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'data') List? data, @@ -2797,6 +2831,7 @@ class __$$CategoryAnalyticDtoImplCopyWithImpl<$Res> $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? dateFrom = freezed, Object? dateTo = freezed, Object? data = freezed, @@ -2811,6 +2846,10 @@ class __$$CategoryAnalyticDtoImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, dateFrom: freezed == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -2834,6 +2873,7 @@ class _$CategoryAnalyticDtoImpl extends _CategoryAnalyticDto { const _$CategoryAnalyticDtoImpl({ @JsonKey(name: 'organization_id') this.organizationId, @JsonKey(name: 'outlet_id') this.outletId, + @JsonKey(name: 'outlet_name') this.outletName, @JsonKey(name: 'date_from') this.dateFrom, @JsonKey(name: 'date_to') this.dateTo, @JsonKey(name: 'data') final List? data, @@ -2850,6 +2890,9 @@ class _$CategoryAnalyticDtoImpl extends _CategoryAnalyticDto { @JsonKey(name: 'outlet_id') final String? outletId; @override + @JsonKey(name: 'outlet_name') + final String? outletName; + @override @JsonKey(name: 'date_from') final String? dateFrom; @override @@ -2868,7 +2911,7 @@ class _$CategoryAnalyticDtoImpl extends _CategoryAnalyticDto { @override String toString() { - return 'CategoryAnalyticDto(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, data: $data)'; + return 'CategoryAnalyticDto(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, dateFrom: $dateFrom, dateTo: $dateTo, data: $data)'; } @override @@ -2880,6 +2923,8 @@ class _$CategoryAnalyticDtoImpl extends _CategoryAnalyticDto { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.dateFrom, dateFrom) || other.dateFrom == dateFrom) && (identical(other.dateTo, dateTo) || other.dateTo == dateTo) && @@ -2892,6 +2937,7 @@ class _$CategoryAnalyticDtoImpl extends _CategoryAnalyticDto { runtimeType, organizationId, outletId, + outletName, dateFrom, dateTo, const DeepCollectionEquality().hash(_data), @@ -2918,6 +2964,7 @@ abstract class _CategoryAnalyticDto extends CategoryAnalyticDto { const factory _CategoryAnalyticDto({ @JsonKey(name: 'organization_id') final String? organizationId, @JsonKey(name: 'outlet_id') final String? outletId, + @JsonKey(name: 'outlet_name') final String? outletName, @JsonKey(name: 'date_from') final String? dateFrom, @JsonKey(name: 'date_to') final String? dateTo, @JsonKey(name: 'data') final List? data, @@ -2934,6 +2981,9 @@ abstract class _CategoryAnalyticDto extends CategoryAnalyticDto { @JsonKey(name: 'outlet_id') String? get outletId; @override + @JsonKey(name: 'outlet_name') + String? get outletName; + @override @JsonKey(name: 'date_from') String? get dateFrom; @override @@ -4933,6 +4983,8 @@ mixin _$DashboardAnalyticDto { String? get organizationId => throw _privateConstructorUsedError; @JsonKey(name: 'outlet_id') String? get outletId => throw _privateConstructorUsedError; + @JsonKey(name: 'outlet_name') + String? get outletName => throw _privateConstructorUsedError; @JsonKey(name: 'date_from') String? get dateFrom => throw _privateConstructorUsedError; @JsonKey(name: 'date_to') @@ -4969,6 +5021,7 @@ abstract class $DashboardAnalyticDtoCopyWith<$Res> { $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'overview') DashboardOverviewDto? overview, @@ -5001,6 +5054,7 @@ class _$DashboardAnalyticDtoCopyWithImpl< $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? dateFrom = freezed, Object? dateTo = freezed, Object? overview = freezed, @@ -5018,6 +5072,10 @@ class _$DashboardAnalyticDtoCopyWithImpl< ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, dateFrom: freezed == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -5074,6 +5132,7 @@ abstract class _$$DashboardAnalyticDtoImplCopyWith<$Res> $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'overview') DashboardOverviewDto? overview, @@ -5103,6 +5162,7 @@ class __$$DashboardAnalyticDtoImplCopyWithImpl<$Res> $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? dateFrom = freezed, Object? dateTo = freezed, Object? overview = freezed, @@ -5120,6 +5180,10 @@ class __$$DashboardAnalyticDtoImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, dateFrom: freezed == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -5155,6 +5219,7 @@ class _$DashboardAnalyticDtoImpl extends _DashboardAnalyticDto { const _$DashboardAnalyticDtoImpl({ @JsonKey(name: 'organization_id') this.organizationId, @JsonKey(name: 'outlet_id') this.outletId, + @JsonKey(name: 'outlet_name') this.outletName, @JsonKey(name: 'date_from') this.dateFrom, @JsonKey(name: 'date_to') this.dateTo, @JsonKey(name: 'overview') this.overview, @@ -5179,6 +5244,9 @@ class _$DashboardAnalyticDtoImpl extends _DashboardAnalyticDto { @JsonKey(name: 'outlet_id') final String? outletId; @override + @JsonKey(name: 'outlet_name') + final String? outletName; + @override @JsonKey(name: 'date_from') final String? dateFrom; @override @@ -5222,7 +5290,7 @@ class _$DashboardAnalyticDtoImpl extends _DashboardAnalyticDto { @override String toString() { - return 'DashboardAnalyticDto(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, overview: $overview, topProducts: $topProducts, paymentMethods: $paymentMethods, recentSales: $recentSales)'; + return 'DashboardAnalyticDto(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, dateFrom: $dateFrom, dateTo: $dateTo, overview: $overview, topProducts: $topProducts, paymentMethods: $paymentMethods, recentSales: $recentSales)'; } @override @@ -5234,6 +5302,8 @@ class _$DashboardAnalyticDtoImpl extends _DashboardAnalyticDto { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.dateFrom, dateFrom) || other.dateFrom == dateFrom) && (identical(other.dateTo, dateTo) || other.dateTo == dateTo) && @@ -5259,6 +5329,7 @@ class _$DashboardAnalyticDtoImpl extends _DashboardAnalyticDto { runtimeType, organizationId, outletId, + outletName, dateFrom, dateTo, overview, @@ -5289,6 +5360,7 @@ abstract class _DashboardAnalyticDto extends DashboardAnalyticDto { const factory _DashboardAnalyticDto({ @JsonKey(name: 'organization_id') final String? organizationId, @JsonKey(name: 'outlet_id') final String? outletId, + @JsonKey(name: 'outlet_name') final String? outletName, @JsonKey(name: 'date_from') final String? dateFrom, @JsonKey(name: 'date_to') final String? dateTo, @JsonKey(name: 'overview') final DashboardOverviewDto? overview, @@ -5311,6 +5383,9 @@ abstract class _DashboardAnalyticDto extends DashboardAnalyticDto { @JsonKey(name: 'outlet_id') String? get outletId; @override + @JsonKey(name: 'outlet_name') + String? get outletName; + @override @JsonKey(name: 'date_from') String? get dateFrom; @override @@ -5355,6 +5430,12 @@ mixin _$DashboardOverviewDto { int? get voidedOrders => throw _privateConstructorUsedError; @JsonKey(name: 'refunded_orders') int? get refundedOrders => throw _privateConstructorUsedError; + @JsonKey(name: 'total_item_sold') + int? get totalItemSold => throw _privateConstructorUsedError; + @JsonKey(name: 'total_low_stock') + int? get totalLowStock => throw _privateConstructorUsedError; + @JsonKey(name: 'total_product_active') + int? get totalProductActive => throw _privateConstructorUsedError; /// Serializes this DashboardOverviewDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; @@ -5380,6 +5461,9 @@ abstract class $DashboardOverviewDtoCopyWith<$Res> { @JsonKey(name: 'total_customers') int? totalCustomers, @JsonKey(name: 'voided_orders') int? voidedOrders, @JsonKey(name: 'refunded_orders') int? refundedOrders, + @JsonKey(name: 'total_item_sold') int? totalItemSold, + @JsonKey(name: 'total_low_stock') int? totalLowStock, + @JsonKey(name: 'total_product_active') int? totalProductActive, }); } @@ -5407,6 +5491,9 @@ class _$DashboardOverviewDtoCopyWithImpl< Object? totalCustomers = freezed, Object? voidedOrders = freezed, Object? refundedOrders = freezed, + Object? totalItemSold = freezed, + Object? totalLowStock = freezed, + Object? totalProductActive = freezed, }) { return _then( _value.copyWith( @@ -5434,6 +5521,18 @@ class _$DashboardOverviewDtoCopyWithImpl< ? _value.refundedOrders : refundedOrders // ignore: cast_nullable_to_non_nullable as int?, + totalItemSold: freezed == totalItemSold + ? _value.totalItemSold + : totalItemSold // ignore: cast_nullable_to_non_nullable + as int?, + totalLowStock: freezed == totalLowStock + ? _value.totalLowStock + : totalLowStock // ignore: cast_nullable_to_non_nullable + as int?, + totalProductActive: freezed == totalProductActive + ? _value.totalProductActive + : totalProductActive // ignore: cast_nullable_to_non_nullable + as int?, ) as $Val, ); @@ -5456,6 +5555,9 @@ abstract class _$$DashboardOverviewDtoImplCopyWith<$Res> @JsonKey(name: 'total_customers') int? totalCustomers, @JsonKey(name: 'voided_orders') int? voidedOrders, @JsonKey(name: 'refunded_orders') int? refundedOrders, + @JsonKey(name: 'total_item_sold') int? totalItemSold, + @JsonKey(name: 'total_low_stock') int? totalLowStock, + @JsonKey(name: 'total_product_active') int? totalProductActive, }); } @@ -5479,6 +5581,9 @@ class __$$DashboardOverviewDtoImplCopyWithImpl<$Res> Object? totalCustomers = freezed, Object? voidedOrders = freezed, Object? refundedOrders = freezed, + Object? totalItemSold = freezed, + Object? totalLowStock = freezed, + Object? totalProductActive = freezed, }) { return _then( _$DashboardOverviewDtoImpl( @@ -5506,6 +5611,18 @@ class __$$DashboardOverviewDtoImplCopyWithImpl<$Res> ? _value.refundedOrders : refundedOrders // ignore: cast_nullable_to_non_nullable as int?, + totalItemSold: freezed == totalItemSold + ? _value.totalItemSold + : totalItemSold // ignore: cast_nullable_to_non_nullable + as int?, + totalLowStock: freezed == totalLowStock + ? _value.totalLowStock + : totalLowStock // ignore: cast_nullable_to_non_nullable + as int?, + totalProductActive: freezed == totalProductActive + ? _value.totalProductActive + : totalProductActive // ignore: cast_nullable_to_non_nullable + as int?, ), ); } @@ -5521,6 +5638,9 @@ class _$DashboardOverviewDtoImpl extends _DashboardOverviewDto { @JsonKey(name: 'total_customers') this.totalCustomers, @JsonKey(name: 'voided_orders') this.voidedOrders, @JsonKey(name: 'refunded_orders') this.refundedOrders, + @JsonKey(name: 'total_item_sold') this.totalItemSold, + @JsonKey(name: 'total_low_stock') this.totalLowStock, + @JsonKey(name: 'total_product_active') this.totalProductActive, }) : super._(); factory _$DashboardOverviewDtoImpl.fromJson(Map json) => @@ -5544,10 +5664,19 @@ class _$DashboardOverviewDtoImpl extends _DashboardOverviewDto { @override @JsonKey(name: 'refunded_orders') final int? refundedOrders; + @override + @JsonKey(name: 'total_item_sold') + final int? totalItemSold; + @override + @JsonKey(name: 'total_low_stock') + final int? totalLowStock; + @override + @JsonKey(name: 'total_product_active') + final int? totalProductActive; @override String toString() { - return 'DashboardOverviewDto(totalSales: $totalSales, totalOrders: $totalOrders, averageOrderValue: $averageOrderValue, totalCustomers: $totalCustomers, voidedOrders: $voidedOrders, refundedOrders: $refundedOrders)'; + return 'DashboardOverviewDto(totalSales: $totalSales, totalOrders: $totalOrders, averageOrderValue: $averageOrderValue, totalCustomers: $totalCustomers, voidedOrders: $voidedOrders, refundedOrders: $refundedOrders, totalItemSold: $totalItemSold, totalLowStock: $totalLowStock, totalProductActive: $totalProductActive)'; } @override @@ -5566,7 +5695,13 @@ class _$DashboardOverviewDtoImpl extends _DashboardOverviewDto { (identical(other.voidedOrders, voidedOrders) || other.voidedOrders == voidedOrders) && (identical(other.refundedOrders, refundedOrders) || - other.refundedOrders == refundedOrders)); + other.refundedOrders == refundedOrders) && + (identical(other.totalItemSold, totalItemSold) || + other.totalItemSold == totalItemSold) && + (identical(other.totalLowStock, totalLowStock) || + other.totalLowStock == totalLowStock) && + (identical(other.totalProductActive, totalProductActive) || + other.totalProductActive == totalProductActive)); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -5579,6 +5714,9 @@ class _$DashboardOverviewDtoImpl extends _DashboardOverviewDto { totalCustomers, voidedOrders, refundedOrders, + totalItemSold, + totalLowStock, + totalProductActive, ); /// Create a copy of DashboardOverviewDto @@ -5607,6 +5745,9 @@ abstract class _DashboardOverviewDto extends DashboardOverviewDto { @JsonKey(name: 'total_customers') final int? totalCustomers, @JsonKey(name: 'voided_orders') final int? voidedOrders, @JsonKey(name: 'refunded_orders') final int? refundedOrders, + @JsonKey(name: 'total_item_sold') final int? totalItemSold, + @JsonKey(name: 'total_low_stock') final int? totalLowStock, + @JsonKey(name: 'total_product_active') final int? totalProductActive, }) = _$DashboardOverviewDtoImpl; const _DashboardOverviewDto._() : super._(); @@ -5631,6 +5772,15 @@ abstract class _DashboardOverviewDto extends DashboardOverviewDto { @override @JsonKey(name: 'refunded_orders') int? get refundedOrders; + @override + @JsonKey(name: 'total_item_sold') + int? get totalItemSold; + @override + @JsonKey(name: 'total_low_stock') + int? get totalLowStock; + @override + @JsonKey(name: 'total_product_active') + int? get totalProductActive; /// Create a copy of DashboardOverviewDto /// with the given fields replaced by the non-null parameter values. @@ -6664,6 +6814,8 @@ mixin _$ProductAnalyticDto { String? get organizationId => throw _privateConstructorUsedError; @JsonKey(name: 'outlet_id') String? get outletId => throw _privateConstructorUsedError; + @JsonKey(name: 'outlet_name') + String? get outletName => throw _privateConstructorUsedError; @JsonKey(name: 'date_from') String? get dateFrom => throw _privateConstructorUsedError; @JsonKey(name: 'date_to') @@ -6691,6 +6843,7 @@ abstract class $ProductAnalyticDtoCopyWith<$Res> { $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'data') List? data, @@ -6714,6 +6867,7 @@ class _$ProductAnalyticDtoCopyWithImpl<$Res, $Val extends ProductAnalyticDto> $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? dateFrom = freezed, Object? dateTo = freezed, Object? data = freezed, @@ -6728,6 +6882,10 @@ class _$ProductAnalyticDtoCopyWithImpl<$Res, $Val extends ProductAnalyticDto> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, dateFrom: freezed == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -6758,6 +6916,7 @@ abstract class _$$ProductAnalyticDtoImplCopyWith<$Res> $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'data') List? data, @@ -6780,6 +6939,7 @@ class __$$ProductAnalyticDtoImplCopyWithImpl<$Res> $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? dateFrom = freezed, Object? dateTo = freezed, Object? data = freezed, @@ -6794,6 +6954,10 @@ class __$$ProductAnalyticDtoImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, dateFrom: freezed == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -6817,6 +6981,7 @@ class _$ProductAnalyticDtoImpl extends _ProductAnalyticDto { const _$ProductAnalyticDtoImpl({ @JsonKey(name: 'organization_id') this.organizationId, @JsonKey(name: 'outlet_id') this.outletId, + @JsonKey(name: 'outlet_name') this.outletName, @JsonKey(name: 'date_from') this.dateFrom, @JsonKey(name: 'date_to') this.dateTo, @JsonKey(name: 'data') final List? data, @@ -6833,6 +6998,9 @@ class _$ProductAnalyticDtoImpl extends _ProductAnalyticDto { @JsonKey(name: 'outlet_id') final String? outletId; @override + @JsonKey(name: 'outlet_name') + final String? outletName; + @override @JsonKey(name: 'date_from') final String? dateFrom; @override @@ -6851,7 +7019,7 @@ class _$ProductAnalyticDtoImpl extends _ProductAnalyticDto { @override String toString() { - return 'ProductAnalyticDto(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, data: $data)'; + return 'ProductAnalyticDto(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, dateFrom: $dateFrom, dateTo: $dateTo, data: $data)'; } @override @@ -6863,6 +7031,8 @@ class _$ProductAnalyticDtoImpl extends _ProductAnalyticDto { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.dateFrom, dateFrom) || other.dateFrom == dateFrom) && (identical(other.dateTo, dateTo) || other.dateTo == dateTo) && @@ -6875,6 +7045,7 @@ class _$ProductAnalyticDtoImpl extends _ProductAnalyticDto { runtimeType, organizationId, outletId, + outletName, dateFrom, dateTo, const DeepCollectionEquality().hash(_data), @@ -6901,6 +7072,7 @@ abstract class _ProductAnalyticDto extends ProductAnalyticDto { const factory _ProductAnalyticDto({ @JsonKey(name: 'organization_id') final String? organizationId, @JsonKey(name: 'outlet_id') final String? outletId, + @JsonKey(name: 'outlet_name') final String? outletName, @JsonKey(name: 'date_from') final String? dateFrom, @JsonKey(name: 'date_to') final String? dateTo, @JsonKey(name: 'data') final List? data, @@ -6917,6 +7089,9 @@ abstract class _ProductAnalyticDto extends ProductAnalyticDto { @JsonKey(name: 'outlet_id') String? get outletId; @override + @JsonKey(name: 'outlet_name') + String? get outletName; + @override @JsonKey(name: 'date_from') String? get dateFrom; @override @@ -6946,10 +7121,16 @@ mixin _$ProductAnalyticDataDto { String? get productId => throw _privateConstructorUsedError; @JsonKey(name: 'product_name') String? get productName => throw _privateConstructorUsedError; + @JsonKey(name: 'product_sku') + String? get productSku => throw _privateConstructorUsedError; + @JsonKey(name: 'product_price') + int? get productPrice => throw _privateConstructorUsedError; @JsonKey(name: 'category_id') String? get categoryId => throw _privateConstructorUsedError; @JsonKey(name: 'category_name') String? get categoryName => throw _privateConstructorUsedError; + @JsonKey(name: 'category_order') + int? get categoryOrder => throw _privateConstructorUsedError; @JsonKey(name: 'quantity_sold') int? get quantitySold => throw _privateConstructorUsedError; @JsonKey(name: 'revenue') @@ -6958,6 +7139,18 @@ mixin _$ProductAnalyticDataDto { double? get averagePrice => throw _privateConstructorUsedError; @JsonKey(name: 'order_count') int? get orderCount => throw _privateConstructorUsedError; + @JsonKey(name: 'standard_hpp_per_unit') + int? get standardHppPerUnit => throw _privateConstructorUsedError; + @JsonKey(name: 'standard_hpp_total') + int? get standardHppTotal => throw _privateConstructorUsedError; + @JsonKey(name: 'fifo_hpp_per_unit') + int? get fifoHppPerUnit => throw _privateConstructorUsedError; + @JsonKey(name: 'fifo_hpp_total') + int? get fifoHppTotal => throw _privateConstructorUsedError; + @JsonKey(name: 'moving_average_hpp_per_unit') + int? get movingAverageHppPerUnit => throw _privateConstructorUsedError; + @JsonKey(name: 'moving_average_hpp_total') + int? get movingAverageHppTotal => throw _privateConstructorUsedError; /// Serializes this ProductAnalyticDataDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; @@ -6979,12 +7172,21 @@ abstract class $ProductAnalyticDataDtoCopyWith<$Res> { $Res call({ @JsonKey(name: 'product_id') String? productId, @JsonKey(name: 'product_name') String? productName, + @JsonKey(name: 'product_sku') String? productSku, + @JsonKey(name: 'product_price') int? productPrice, @JsonKey(name: 'category_id') String? categoryId, @JsonKey(name: 'category_name') String? categoryName, + @JsonKey(name: 'category_order') int? categoryOrder, @JsonKey(name: 'quantity_sold') int? quantitySold, @JsonKey(name: 'revenue') int? revenue, @JsonKey(name: 'average_price') double? averagePrice, @JsonKey(name: 'order_count') int? orderCount, + @JsonKey(name: 'standard_hpp_per_unit') int? standardHppPerUnit, + @JsonKey(name: 'standard_hpp_total') int? standardHppTotal, + @JsonKey(name: 'fifo_hpp_per_unit') int? fifoHppPerUnit, + @JsonKey(name: 'fifo_hpp_total') int? fifoHppTotal, + @JsonKey(name: 'moving_average_hpp_per_unit') int? movingAverageHppPerUnit, + @JsonKey(name: 'moving_average_hpp_total') int? movingAverageHppTotal, }); } @@ -7008,12 +7210,21 @@ class _$ProductAnalyticDataDtoCopyWithImpl< $Res call({ Object? productId = freezed, Object? productName = freezed, + Object? productSku = freezed, + Object? productPrice = freezed, Object? categoryId = freezed, Object? categoryName = freezed, + Object? categoryOrder = freezed, Object? quantitySold = freezed, Object? revenue = freezed, Object? averagePrice = freezed, Object? orderCount = freezed, + Object? standardHppPerUnit = freezed, + Object? standardHppTotal = freezed, + Object? fifoHppPerUnit = freezed, + Object? fifoHppTotal = freezed, + Object? movingAverageHppPerUnit = freezed, + Object? movingAverageHppTotal = freezed, }) { return _then( _value.copyWith( @@ -7025,6 +7236,14 @@ class _$ProductAnalyticDataDtoCopyWithImpl< ? _value.productName : productName // ignore: cast_nullable_to_non_nullable as String?, + productSku: freezed == productSku + ? _value.productSku + : productSku // ignore: cast_nullable_to_non_nullable + as String?, + productPrice: freezed == productPrice + ? _value.productPrice + : productPrice // ignore: cast_nullable_to_non_nullable + as int?, categoryId: freezed == categoryId ? _value.categoryId : categoryId // ignore: cast_nullable_to_non_nullable @@ -7033,6 +7252,10 @@ class _$ProductAnalyticDataDtoCopyWithImpl< ? _value.categoryName : categoryName // ignore: cast_nullable_to_non_nullable as String?, + categoryOrder: freezed == categoryOrder + ? _value.categoryOrder + : categoryOrder // ignore: cast_nullable_to_non_nullable + as int?, quantitySold: freezed == quantitySold ? _value.quantitySold : quantitySold // ignore: cast_nullable_to_non_nullable @@ -7049,6 +7272,30 @@ class _$ProductAnalyticDataDtoCopyWithImpl< ? _value.orderCount : orderCount // ignore: cast_nullable_to_non_nullable as int?, + standardHppPerUnit: freezed == standardHppPerUnit + ? _value.standardHppPerUnit + : standardHppPerUnit // ignore: cast_nullable_to_non_nullable + as int?, + standardHppTotal: freezed == standardHppTotal + ? _value.standardHppTotal + : standardHppTotal // ignore: cast_nullable_to_non_nullable + as int?, + fifoHppPerUnit: freezed == fifoHppPerUnit + ? _value.fifoHppPerUnit + : fifoHppPerUnit // ignore: cast_nullable_to_non_nullable + as int?, + fifoHppTotal: freezed == fifoHppTotal + ? _value.fifoHppTotal + : fifoHppTotal // ignore: cast_nullable_to_non_nullable + as int?, + movingAverageHppPerUnit: freezed == movingAverageHppPerUnit + ? _value.movingAverageHppPerUnit + : movingAverageHppPerUnit // ignore: cast_nullable_to_non_nullable + as int?, + movingAverageHppTotal: freezed == movingAverageHppTotal + ? _value.movingAverageHppTotal + : movingAverageHppTotal // ignore: cast_nullable_to_non_nullable + as int?, ) as $Val, ); @@ -7067,12 +7314,21 @@ abstract class _$$ProductAnalyticDataDtoImplCopyWith<$Res> $Res call({ @JsonKey(name: 'product_id') String? productId, @JsonKey(name: 'product_name') String? productName, + @JsonKey(name: 'product_sku') String? productSku, + @JsonKey(name: 'product_price') int? productPrice, @JsonKey(name: 'category_id') String? categoryId, @JsonKey(name: 'category_name') String? categoryName, + @JsonKey(name: 'category_order') int? categoryOrder, @JsonKey(name: 'quantity_sold') int? quantitySold, @JsonKey(name: 'revenue') int? revenue, @JsonKey(name: 'average_price') double? averagePrice, @JsonKey(name: 'order_count') int? orderCount, + @JsonKey(name: 'standard_hpp_per_unit') int? standardHppPerUnit, + @JsonKey(name: 'standard_hpp_total') int? standardHppTotal, + @JsonKey(name: 'fifo_hpp_per_unit') int? fifoHppPerUnit, + @JsonKey(name: 'fifo_hpp_total') int? fifoHppTotal, + @JsonKey(name: 'moving_average_hpp_per_unit') int? movingAverageHppPerUnit, + @JsonKey(name: 'moving_average_hpp_total') int? movingAverageHppTotal, }); } @@ -7093,12 +7349,21 @@ class __$$ProductAnalyticDataDtoImplCopyWithImpl<$Res> $Res call({ Object? productId = freezed, Object? productName = freezed, + Object? productSku = freezed, + Object? productPrice = freezed, Object? categoryId = freezed, Object? categoryName = freezed, + Object? categoryOrder = freezed, Object? quantitySold = freezed, Object? revenue = freezed, Object? averagePrice = freezed, Object? orderCount = freezed, + Object? standardHppPerUnit = freezed, + Object? standardHppTotal = freezed, + Object? fifoHppPerUnit = freezed, + Object? fifoHppTotal = freezed, + Object? movingAverageHppPerUnit = freezed, + Object? movingAverageHppTotal = freezed, }) { return _then( _$ProductAnalyticDataDtoImpl( @@ -7110,6 +7375,14 @@ class __$$ProductAnalyticDataDtoImplCopyWithImpl<$Res> ? _value.productName : productName // ignore: cast_nullable_to_non_nullable as String?, + productSku: freezed == productSku + ? _value.productSku + : productSku // ignore: cast_nullable_to_non_nullable + as String?, + productPrice: freezed == productPrice + ? _value.productPrice + : productPrice // ignore: cast_nullable_to_non_nullable + as int?, categoryId: freezed == categoryId ? _value.categoryId : categoryId // ignore: cast_nullable_to_non_nullable @@ -7118,6 +7391,10 @@ class __$$ProductAnalyticDataDtoImplCopyWithImpl<$Res> ? _value.categoryName : categoryName // ignore: cast_nullable_to_non_nullable as String?, + categoryOrder: freezed == categoryOrder + ? _value.categoryOrder + : categoryOrder // ignore: cast_nullable_to_non_nullable + as int?, quantitySold: freezed == quantitySold ? _value.quantitySold : quantitySold // ignore: cast_nullable_to_non_nullable @@ -7134,6 +7411,30 @@ class __$$ProductAnalyticDataDtoImplCopyWithImpl<$Res> ? _value.orderCount : orderCount // ignore: cast_nullable_to_non_nullable as int?, + standardHppPerUnit: freezed == standardHppPerUnit + ? _value.standardHppPerUnit + : standardHppPerUnit // ignore: cast_nullable_to_non_nullable + as int?, + standardHppTotal: freezed == standardHppTotal + ? _value.standardHppTotal + : standardHppTotal // ignore: cast_nullable_to_non_nullable + as int?, + fifoHppPerUnit: freezed == fifoHppPerUnit + ? _value.fifoHppPerUnit + : fifoHppPerUnit // ignore: cast_nullable_to_non_nullable + as int?, + fifoHppTotal: freezed == fifoHppTotal + ? _value.fifoHppTotal + : fifoHppTotal // ignore: cast_nullable_to_non_nullable + as int?, + movingAverageHppPerUnit: freezed == movingAverageHppPerUnit + ? _value.movingAverageHppPerUnit + : movingAverageHppPerUnit // ignore: cast_nullable_to_non_nullable + as int?, + movingAverageHppTotal: freezed == movingAverageHppTotal + ? _value.movingAverageHppTotal + : movingAverageHppTotal // ignore: cast_nullable_to_non_nullable + as int?, ), ); } @@ -7145,12 +7446,21 @@ class _$ProductAnalyticDataDtoImpl extends _ProductAnalyticDataDto { const _$ProductAnalyticDataDtoImpl({ @JsonKey(name: 'product_id') this.productId, @JsonKey(name: 'product_name') this.productName, + @JsonKey(name: 'product_sku') this.productSku, + @JsonKey(name: 'product_price') this.productPrice, @JsonKey(name: 'category_id') this.categoryId, @JsonKey(name: 'category_name') this.categoryName, + @JsonKey(name: 'category_order') this.categoryOrder, @JsonKey(name: 'quantity_sold') this.quantitySold, @JsonKey(name: 'revenue') this.revenue, @JsonKey(name: 'average_price') this.averagePrice, @JsonKey(name: 'order_count') this.orderCount, + @JsonKey(name: 'standard_hpp_per_unit') this.standardHppPerUnit, + @JsonKey(name: 'standard_hpp_total') this.standardHppTotal, + @JsonKey(name: 'fifo_hpp_per_unit') this.fifoHppPerUnit, + @JsonKey(name: 'fifo_hpp_total') this.fifoHppTotal, + @JsonKey(name: 'moving_average_hpp_per_unit') this.movingAverageHppPerUnit, + @JsonKey(name: 'moving_average_hpp_total') this.movingAverageHppTotal, }) : super._(); factory _$ProductAnalyticDataDtoImpl.fromJson(Map json) => @@ -7163,12 +7473,21 @@ class _$ProductAnalyticDataDtoImpl extends _ProductAnalyticDataDto { @JsonKey(name: 'product_name') final String? productName; @override + @JsonKey(name: 'product_sku') + final String? productSku; + @override + @JsonKey(name: 'product_price') + final int? productPrice; + @override @JsonKey(name: 'category_id') final String? categoryId; @override @JsonKey(name: 'category_name') final String? categoryName; @override + @JsonKey(name: 'category_order') + final int? categoryOrder; + @override @JsonKey(name: 'quantity_sold') final int? quantitySold; @override @@ -7180,10 +7499,28 @@ class _$ProductAnalyticDataDtoImpl extends _ProductAnalyticDataDto { @override @JsonKey(name: 'order_count') final int? orderCount; + @override + @JsonKey(name: 'standard_hpp_per_unit') + final int? standardHppPerUnit; + @override + @JsonKey(name: 'standard_hpp_total') + final int? standardHppTotal; + @override + @JsonKey(name: 'fifo_hpp_per_unit') + final int? fifoHppPerUnit; + @override + @JsonKey(name: 'fifo_hpp_total') + final int? fifoHppTotal; + @override + @JsonKey(name: 'moving_average_hpp_per_unit') + final int? movingAverageHppPerUnit; + @override + @JsonKey(name: 'moving_average_hpp_total') + final int? movingAverageHppTotal; @override String toString() { - return 'ProductAnalyticDataDto(productId: $productId, productName: $productName, categoryId: $categoryId, categoryName: $categoryName, quantitySold: $quantitySold, revenue: $revenue, averagePrice: $averagePrice, orderCount: $orderCount)'; + return 'ProductAnalyticDataDto(productId: $productId, productName: $productName, productSku: $productSku, productPrice: $productPrice, categoryId: $categoryId, categoryName: $categoryName, categoryOrder: $categoryOrder, quantitySold: $quantitySold, revenue: $revenue, averagePrice: $averagePrice, orderCount: $orderCount, standardHppPerUnit: $standardHppPerUnit, standardHppTotal: $standardHppTotal, fifoHppPerUnit: $fifoHppPerUnit, fifoHppTotal: $fifoHppTotal, movingAverageHppPerUnit: $movingAverageHppPerUnit, movingAverageHppTotal: $movingAverageHppTotal)'; } @override @@ -7195,17 +7532,38 @@ class _$ProductAnalyticDataDtoImpl extends _ProductAnalyticDataDto { other.productId == productId) && (identical(other.productName, productName) || other.productName == productName) && + (identical(other.productSku, productSku) || + other.productSku == productSku) && + (identical(other.productPrice, productPrice) || + other.productPrice == productPrice) && (identical(other.categoryId, categoryId) || other.categoryId == categoryId) && (identical(other.categoryName, categoryName) || other.categoryName == categoryName) && + (identical(other.categoryOrder, categoryOrder) || + other.categoryOrder == categoryOrder) && (identical(other.quantitySold, quantitySold) || other.quantitySold == quantitySold) && (identical(other.revenue, revenue) || other.revenue == revenue) && (identical(other.averagePrice, averagePrice) || other.averagePrice == averagePrice) && (identical(other.orderCount, orderCount) || - other.orderCount == orderCount)); + other.orderCount == orderCount) && + (identical(other.standardHppPerUnit, standardHppPerUnit) || + other.standardHppPerUnit == standardHppPerUnit) && + (identical(other.standardHppTotal, standardHppTotal) || + other.standardHppTotal == standardHppTotal) && + (identical(other.fifoHppPerUnit, fifoHppPerUnit) || + other.fifoHppPerUnit == fifoHppPerUnit) && + (identical(other.fifoHppTotal, fifoHppTotal) || + other.fifoHppTotal == fifoHppTotal) && + (identical( + other.movingAverageHppPerUnit, + movingAverageHppPerUnit, + ) || + other.movingAverageHppPerUnit == movingAverageHppPerUnit) && + (identical(other.movingAverageHppTotal, movingAverageHppTotal) || + other.movingAverageHppTotal == movingAverageHppTotal)); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -7214,12 +7572,21 @@ class _$ProductAnalyticDataDtoImpl extends _ProductAnalyticDataDto { runtimeType, productId, productName, + productSku, + productPrice, categoryId, categoryName, + categoryOrder, quantitySold, revenue, averagePrice, orderCount, + standardHppPerUnit, + standardHppTotal, + fifoHppPerUnit, + fifoHppTotal, + movingAverageHppPerUnit, + movingAverageHppTotal, ); /// Create a copy of ProductAnalyticDataDto @@ -7244,12 +7611,22 @@ abstract class _ProductAnalyticDataDto extends ProductAnalyticDataDto { const factory _ProductAnalyticDataDto({ @JsonKey(name: 'product_id') final String? productId, @JsonKey(name: 'product_name') final String? productName, + @JsonKey(name: 'product_sku') final String? productSku, + @JsonKey(name: 'product_price') final int? productPrice, @JsonKey(name: 'category_id') final String? categoryId, @JsonKey(name: 'category_name') final String? categoryName, + @JsonKey(name: 'category_order') final int? categoryOrder, @JsonKey(name: 'quantity_sold') final int? quantitySold, @JsonKey(name: 'revenue') final int? revenue, @JsonKey(name: 'average_price') final double? averagePrice, @JsonKey(name: 'order_count') final int? orderCount, + @JsonKey(name: 'standard_hpp_per_unit') final int? standardHppPerUnit, + @JsonKey(name: 'standard_hpp_total') final int? standardHppTotal, + @JsonKey(name: 'fifo_hpp_per_unit') final int? fifoHppPerUnit, + @JsonKey(name: 'fifo_hpp_total') final int? fifoHppTotal, + @JsonKey(name: 'moving_average_hpp_per_unit') + final int? movingAverageHppPerUnit, + @JsonKey(name: 'moving_average_hpp_total') final int? movingAverageHppTotal, }) = _$ProductAnalyticDataDtoImpl; const _ProductAnalyticDataDto._() : super._(); @@ -7263,12 +7640,21 @@ abstract class _ProductAnalyticDataDto extends ProductAnalyticDataDto { @JsonKey(name: 'product_name') String? get productName; @override + @JsonKey(name: 'product_sku') + String? get productSku; + @override + @JsonKey(name: 'product_price') + int? get productPrice; + @override @JsonKey(name: 'category_id') String? get categoryId; @override @JsonKey(name: 'category_name') String? get categoryName; @override + @JsonKey(name: 'category_order') + int? get categoryOrder; + @override @JsonKey(name: 'quantity_sold') int? get quantitySold; @override @@ -7280,6 +7666,24 @@ abstract class _ProductAnalyticDataDto extends ProductAnalyticDataDto { @override @JsonKey(name: 'order_count') int? get orderCount; + @override + @JsonKey(name: 'standard_hpp_per_unit') + int? get standardHppPerUnit; + @override + @JsonKey(name: 'standard_hpp_total') + int? get standardHppTotal; + @override + @JsonKey(name: 'fifo_hpp_per_unit') + int? get fifoHppPerUnit; + @override + @JsonKey(name: 'fifo_hpp_total') + int? get fifoHppTotal; + @override + @JsonKey(name: 'moving_average_hpp_per_unit') + int? get movingAverageHppPerUnit; + @override + @JsonKey(name: 'moving_average_hpp_total') + int? get movingAverageHppTotal; /// Create a copy of ProductAnalyticDataDto /// with the given fields replaced by the non-null parameter values. @@ -7301,6 +7705,8 @@ mixin _$PaymentMethodAnalyticDto { String? get organizationId => throw _privateConstructorUsedError; @JsonKey(name: 'outlet_id') String? get outletId => throw _privateConstructorUsedError; + @JsonKey(name: 'outlet_name') + String? get outletName => throw _privateConstructorUsedError; @JsonKey(name: 'date_from') String? get dateFrom => throw _privateConstructorUsedError; @JsonKey(name: 'date_to') @@ -7332,6 +7738,7 @@ abstract class $PaymentMethodAnalyticDtoCopyWith<$Res> { $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'group_by') String? groupBy, @@ -7362,6 +7769,7 @@ class _$PaymentMethodAnalyticDtoCopyWithImpl< $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? dateFrom = freezed, Object? dateTo = freezed, Object? groupBy = freezed, @@ -7378,6 +7786,10 @@ class _$PaymentMethodAnalyticDtoCopyWithImpl< ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, dateFrom: freezed == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -7430,6 +7842,7 @@ abstract class _$$PaymentMethodAnalyticDtoImplCopyWith<$Res> $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'group_by') String? groupBy, @@ -7461,6 +7874,7 @@ class __$$PaymentMethodAnalyticDtoImplCopyWithImpl<$Res> $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? dateFrom = freezed, Object? dateTo = freezed, Object? groupBy = freezed, @@ -7477,6 +7891,10 @@ class __$$PaymentMethodAnalyticDtoImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, dateFrom: freezed == dateFrom ? _value.dateFrom : dateFrom // ignore: cast_nullable_to_non_nullable @@ -7508,6 +7926,7 @@ class _$PaymentMethodAnalyticDtoImpl extends _PaymentMethodAnalyticDto { const _$PaymentMethodAnalyticDtoImpl({ @JsonKey(name: 'organization_id') this.organizationId, @JsonKey(name: 'outlet_id') this.outletId, + @JsonKey(name: 'outlet_name') this.outletName, @JsonKey(name: 'date_from') this.dateFrom, @JsonKey(name: 'date_to') this.dateTo, @JsonKey(name: 'group_by') this.groupBy, @@ -7526,6 +7945,9 @@ class _$PaymentMethodAnalyticDtoImpl extends _PaymentMethodAnalyticDto { @JsonKey(name: 'outlet_id') final String? outletId; @override + @JsonKey(name: 'outlet_name') + final String? outletName; + @override @JsonKey(name: 'date_from') final String? dateFrom; @override @@ -7550,7 +7972,7 @@ class _$PaymentMethodAnalyticDtoImpl extends _PaymentMethodAnalyticDto { @override String toString() { - return 'PaymentMethodAnalyticDto(organizationId: $organizationId, outletId: $outletId, dateFrom: $dateFrom, dateTo: $dateTo, groupBy: $groupBy, summary: $summary, data: $data)'; + return 'PaymentMethodAnalyticDto(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, dateFrom: $dateFrom, dateTo: $dateTo, groupBy: $groupBy, summary: $summary, data: $data)'; } @override @@ -7562,6 +7984,8 @@ class _$PaymentMethodAnalyticDtoImpl extends _PaymentMethodAnalyticDto { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.dateFrom, dateFrom) || other.dateFrom == dateFrom) && (identical(other.dateTo, dateTo) || other.dateTo == dateTo) && @@ -7576,6 +8000,7 @@ class _$PaymentMethodAnalyticDtoImpl extends _PaymentMethodAnalyticDto { runtimeType, organizationId, outletId, + outletName, dateFrom, dateTo, groupBy, @@ -7604,6 +8029,7 @@ abstract class _PaymentMethodAnalyticDto extends PaymentMethodAnalyticDto { const factory _PaymentMethodAnalyticDto({ @JsonKey(name: 'organization_id') final String? organizationId, @JsonKey(name: 'outlet_id') final String? outletId, + @JsonKey(name: 'outlet_name') final String? outletName, @JsonKey(name: 'date_from') final String? dateFrom, @JsonKey(name: 'date_to') final String? dateTo, @JsonKey(name: 'group_by') final String? groupBy, @@ -7622,6 +8048,9 @@ abstract class _PaymentMethodAnalyticDto extends PaymentMethodAnalyticDto { @JsonKey(name: 'outlet_id') String? get outletId; @override + @JsonKey(name: 'outlet_name') + String? get outletName; + @override @JsonKey(name: 'date_from') String? get dateFrom; @override @@ -10171,6 +10600,8 @@ mixin _$ExclusiveSummaryDto { String? get organizationId => throw _privateConstructorUsedError; @JsonKey(name: 'outlet_id') String? get outletId => throw _privateConstructorUsedError; + @JsonKey(name: 'outlet_name') + String? get outletName => throw _privateConstructorUsedError; @JsonKey(name: 'period') ExclusiveSummaryPeriodDto? get period => throw _privateConstructorUsedError; @JsonKey(name: 'summary') @@ -10211,6 +10642,7 @@ abstract class $ExclusiveSummaryDtoCopyWith<$Res> { $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'period') ExclusiveSummaryPeriodDto? period, @JsonKey(name: 'summary') ExclusiveSummarySummaryDto? summary, @JsonKey(name: 'reimburse') ExclusiveSummaryReimburseDto? reimburse, @@ -10246,6 +10678,7 @@ class _$ExclusiveSummaryDtoCopyWithImpl<$Res, $Val extends ExclusiveSummaryDto> $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? period = freezed, Object? summary = freezed, Object? reimburse = freezed, @@ -10264,6 +10697,10 @@ class _$ExclusiveSummaryDtoCopyWithImpl<$Res, $Val extends ExclusiveSummaryDto> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, period: freezed == period ? _value.period : period // ignore: cast_nullable_to_non_nullable @@ -10354,6 +10791,7 @@ abstract class _$$ExclusiveSummaryDtoImplCopyWith<$Res> $Res call({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'period') ExclusiveSummaryPeriodDto? period, @JsonKey(name: 'summary') ExclusiveSummarySummaryDto? summary, @JsonKey(name: 'reimburse') ExclusiveSummaryReimburseDto? reimburse, @@ -10391,6 +10829,7 @@ class __$$ExclusiveSummaryDtoImplCopyWithImpl<$Res> $Res call({ Object? organizationId = freezed, Object? outletId = freezed, + Object? outletName = freezed, Object? period = freezed, Object? summary = freezed, Object? reimburse = freezed, @@ -10409,6 +10848,10 @@ class __$$ExclusiveSummaryDtoImplCopyWithImpl<$Res> ? _value.outletId : outletId // ignore: cast_nullable_to_non_nullable as String?, + outletName: freezed == outletName + ? _value.outletName + : outletName // ignore: cast_nullable_to_non_nullable + as String?, period: freezed == period ? _value.period : period // ignore: cast_nullable_to_non_nullable @@ -10448,6 +10891,7 @@ class _$ExclusiveSummaryDtoImpl extends _ExclusiveSummaryDto { const _$ExclusiveSummaryDtoImpl({ @JsonKey(name: 'organization_id') this.organizationId, @JsonKey(name: 'outlet_id') this.outletId, + @JsonKey(name: 'outlet_name') this.outletName, @JsonKey(name: 'period') this.period, @JsonKey(name: 'summary') this.summary, @JsonKey(name: 'reimburse') this.reimburse, @@ -10475,6 +10919,9 @@ class _$ExclusiveSummaryDtoImpl extends _ExclusiveSummaryDto { @JsonKey(name: 'outlet_id') final String? outletId; @override + @JsonKey(name: 'outlet_name') + final String? outletName; + @override @JsonKey(name: 'period') final ExclusiveSummaryPeriodDto? period; @override @@ -10531,7 +10978,7 @@ class _$ExclusiveSummaryDtoImpl extends _ExclusiveSummaryDto { @override String toString() { - return 'ExclusiveSummaryDto(organizationId: $organizationId, outletId: $outletId, period: $period, summary: $summary, reimburse: $reimburse, hppBreakdown: $hppBreakdown, operationalExpenseBreakdown: $operationalExpenseBreakdown, dailySummary: $dailySummary, dailyTransactions: $dailyTransactions)'; + return 'ExclusiveSummaryDto(organizationId: $organizationId, outletId: $outletId, outletName: $outletName, period: $period, summary: $summary, reimburse: $reimburse, hppBreakdown: $hppBreakdown, operationalExpenseBreakdown: $operationalExpenseBreakdown, dailySummary: $dailySummary, dailyTransactions: $dailyTransactions)'; } @override @@ -10543,6 +10990,8 @@ class _$ExclusiveSummaryDtoImpl extends _ExclusiveSummaryDto { other.organizationId == organizationId) && (identical(other.outletId, outletId) || other.outletId == outletId) && + (identical(other.outletName, outletName) || + other.outletName == outletName) && (identical(other.period, period) || other.period == period) && (identical(other.summary, summary) || other.summary == summary) && (identical(other.reimburse, reimburse) || @@ -10571,6 +11020,7 @@ class _$ExclusiveSummaryDtoImpl extends _ExclusiveSummaryDto { runtimeType, organizationId, outletId, + outletName, period, summary, reimburse, @@ -10601,6 +11051,7 @@ abstract class _ExclusiveSummaryDto extends ExclusiveSummaryDto { const factory _ExclusiveSummaryDto({ @JsonKey(name: 'organization_id') final String? organizationId, @JsonKey(name: 'outlet_id') final String? outletId, + @JsonKey(name: 'outlet_name') final String? outletName, @JsonKey(name: 'period') final ExclusiveSummaryPeriodDto? period, @JsonKey(name: 'summary') final ExclusiveSummarySummaryDto? summary, @JsonKey(name: 'reimburse') final ExclusiveSummaryReimburseDto? reimburse, @@ -10625,6 +11076,9 @@ abstract class _ExclusiveSummaryDto extends ExclusiveSummaryDto { @JsonKey(name: 'outlet_id') String? get outletId; @override + @JsonKey(name: 'outlet_name') + String? get outletName; + @override @JsonKey(name: 'period') ExclusiveSummaryPeriodDto? get period; @override diff --git a/lib/infrastructure/analytic/analytic_dtos.g.dart b/lib/infrastructure/analytic/analytic_dtos.g.dart index abd100e..8dad8b2 100644 --- a/lib/infrastructure/analytic/analytic_dtos.g.dart +++ b/lib/infrastructure/analytic/analytic_dtos.g.dart @@ -11,6 +11,7 @@ _$SalesAnalyticDtoImpl _$$SalesAnalyticDtoImplFromJson( ) => _$SalesAnalyticDtoImpl( organizationId: json['organization_id'] as String?, outletId: json['outlet_id'] as String?, + outletName: json['outlet_name'] as String?, dateFrom: json['date_from'] == null ? null : DateTime.parse(json['date_from'] as String), @@ -33,6 +34,7 @@ Map _$$SalesAnalyticDtoImplToJson( ) => { 'organization_id': instance.organizationId, 'outlet_id': instance.outletId, + 'outlet_name': instance.outletName, 'date_from': instance.dateFrom?.toIso8601String(), 'date_to': instance.dateTo?.toIso8601String(), 'group_by': instance.groupBy, @@ -219,6 +221,7 @@ _$CategoryAnalyticDtoImpl _$$CategoryAnalyticDtoImplFromJson( ) => _$CategoryAnalyticDtoImpl( organizationId: json['organization_id'] as String?, outletId: json['outlet_id'] as String?, + outletName: json['outlet_name'] as String?, dateFrom: json['date_from'] as String?, dateTo: json['date_to'] as String?, data: (json['data'] as List?) @@ -231,6 +234,7 @@ Map _$$CategoryAnalyticDtoImplToJson( ) => { 'organization_id': instance.organizationId, 'outlet_id': instance.outletId, + 'outlet_name': instance.outletName, 'date_from': instance.dateFrom, 'date_to': instance.dateTo, 'data': instance.data, @@ -391,6 +395,7 @@ _$DashboardAnalyticDtoImpl _$$DashboardAnalyticDtoImplFromJson( ) => _$DashboardAnalyticDtoImpl( organizationId: json['organization_id'] as String?, outletId: json['outlet_id'] as String?, + outletName: json['outlet_name'] as String?, dateFrom: json['date_from'] as String?, dateTo: json['date_to'] as String?, overview: json['overview'] == null @@ -414,6 +419,7 @@ Map _$$DashboardAnalyticDtoImplToJson( ) => { 'organization_id': instance.organizationId, 'outlet_id': instance.outletId, + 'outlet_name': instance.outletName, 'date_from': instance.dateFrom, 'date_to': instance.dateTo, 'overview': instance.overview, @@ -431,6 +437,9 @@ _$DashboardOverviewDtoImpl _$$DashboardOverviewDtoImplFromJson( totalCustomers: (json['total_customers'] as num?)?.toInt(), voidedOrders: (json['voided_orders'] as num?)?.toInt(), refundedOrders: (json['refunded_orders'] as num?)?.toInt(), + totalItemSold: (json['total_item_sold'] as num?)?.toInt(), + totalLowStock: (json['total_low_stock'] as num?)?.toInt(), + totalProductActive: (json['total_product_active'] as num?)?.toInt(), ); Map _$$DashboardOverviewDtoImplToJson( @@ -442,6 +451,9 @@ Map _$$DashboardOverviewDtoImplToJson( 'total_customers': instance.totalCustomers, 'voided_orders': instance.voidedOrders, 'refunded_orders': instance.refundedOrders, + 'total_item_sold': instance.totalItemSold, + 'total_low_stock': instance.totalLowStock, + 'total_product_active': instance.totalProductActive, }; _$DashboardTopProductDtoImpl _$$DashboardTopProductDtoImplFromJson( @@ -523,6 +535,7 @@ _$ProductAnalyticDtoImpl _$$ProductAnalyticDtoImplFromJson( ) => _$ProductAnalyticDtoImpl( organizationId: json['organization_id'] as String?, outletId: json['outlet_id'] as String?, + outletName: json['outlet_name'] as String?, dateFrom: json['date_from'] as String?, dateTo: json['date_to'] as String?, data: (json['data'] as List?) @@ -535,6 +548,7 @@ Map _$$ProductAnalyticDtoImplToJson( ) => { 'organization_id': instance.organizationId, 'outlet_id': instance.outletId, + 'outlet_name': instance.outletName, 'date_from': instance.dateFrom, 'date_to': instance.dateTo, 'data': instance.data, @@ -545,12 +559,22 @@ _$ProductAnalyticDataDtoImpl _$$ProductAnalyticDataDtoImplFromJson( ) => _$ProductAnalyticDataDtoImpl( productId: json['product_id'] as String?, productName: json['product_name'] as String?, + productSku: json['product_sku'] as String?, + productPrice: (json['product_price'] as num?)?.toInt(), categoryId: json['category_id'] as String?, categoryName: json['category_name'] as String?, + categoryOrder: (json['category_order'] as num?)?.toInt(), quantitySold: (json['quantity_sold'] as num?)?.toInt(), revenue: (json['revenue'] as num?)?.toInt(), averagePrice: (json['average_price'] as num?)?.toDouble(), orderCount: (json['order_count'] as num?)?.toInt(), + standardHppPerUnit: (json['standard_hpp_per_unit'] as num?)?.toInt(), + standardHppTotal: (json['standard_hpp_total'] as num?)?.toInt(), + fifoHppPerUnit: (json['fifo_hpp_per_unit'] as num?)?.toInt(), + fifoHppTotal: (json['fifo_hpp_total'] as num?)?.toInt(), + movingAverageHppPerUnit: (json['moving_average_hpp_per_unit'] as num?) + ?.toInt(), + movingAverageHppTotal: (json['moving_average_hpp_total'] as num?)?.toInt(), ); Map _$$ProductAnalyticDataDtoImplToJson( @@ -558,12 +582,21 @@ Map _$$ProductAnalyticDataDtoImplToJson( ) => { 'product_id': instance.productId, 'product_name': instance.productName, + 'product_sku': instance.productSku, + 'product_price': instance.productPrice, 'category_id': instance.categoryId, 'category_name': instance.categoryName, + 'category_order': instance.categoryOrder, 'quantity_sold': instance.quantitySold, 'revenue': instance.revenue, 'average_price': instance.averagePrice, 'order_count': instance.orderCount, + 'standard_hpp_per_unit': instance.standardHppPerUnit, + 'standard_hpp_total': instance.standardHppTotal, + 'fifo_hpp_per_unit': instance.fifoHppPerUnit, + 'fifo_hpp_total': instance.fifoHppTotal, + 'moving_average_hpp_per_unit': instance.movingAverageHppPerUnit, + 'moving_average_hpp_total': instance.movingAverageHppTotal, }; _$PaymentMethodAnalyticDtoImpl _$$PaymentMethodAnalyticDtoImplFromJson( @@ -571,6 +604,7 @@ _$PaymentMethodAnalyticDtoImpl _$$PaymentMethodAnalyticDtoImplFromJson( ) => _$PaymentMethodAnalyticDtoImpl( organizationId: json['organization_id'] as String?, outletId: json['outlet_id'] as String?, + outletName: json['outlet_name'] as String?, dateFrom: json['date_from'] as String?, dateTo: json['date_to'] as String?, groupBy: json['group_by'] as String?, @@ -589,6 +623,7 @@ Map _$$PaymentMethodAnalyticDtoImplToJson( ) => { 'organization_id': instance.organizationId, 'outlet_id': instance.outletId, + 'outlet_name': instance.outletName, 'date_from': instance.dateFrom, 'date_to': instance.dateTo, 'group_by': instance.groupBy, @@ -795,6 +830,7 @@ _$ExclusiveSummaryDtoImpl _$$ExclusiveSummaryDtoImplFromJson( ) => _$ExclusiveSummaryDtoImpl( organizationId: json['organization_id'] as String?, outletId: json['outlet_id'] as String?, + outletName: json['outlet_name'] as String?, period: json['period'] == null ? null : ExclusiveSummaryPeriodDto.fromJson( @@ -839,6 +875,7 @@ Map _$$ExclusiveSummaryDtoImplToJson( ) => { 'organization_id': instance.organizationId, 'outlet_id': instance.outletId, + 'outlet_name': instance.outletName, 'period': instance.period, 'summary': instance.summary, 'reimburse': instance.reimburse, diff --git a/lib/infrastructure/analytic/dto/category_analytic_dto.dart b/lib/infrastructure/analytic/dto/category_analytic_dto.dart index 55c43ce..901834a 100644 --- a/lib/infrastructure/analytic/dto/category_analytic_dto.dart +++ b/lib/infrastructure/analytic/dto/category_analytic_dto.dart @@ -7,6 +7,7 @@ class CategoryAnalyticDto with _$CategoryAnalyticDto { const factory CategoryAnalyticDto({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'data') List? data, @@ -18,6 +19,7 @@ class CategoryAnalyticDto with _$CategoryAnalyticDto { CategoryAnalytic toDomain() => CategoryAnalytic( organizationId: organizationId ?? "", outletId: outletId ?? "", + outletName: outletName ?? "", dateFrom: dateFrom ?? "", dateTo: dateTo ?? "", data: data?.map((e) => e.toDomain()).toList() ?? [], diff --git a/lib/infrastructure/analytic/dto/dashboard_analytic_dto.dart b/lib/infrastructure/analytic/dto/dashboard_analytic_dto.dart index f17bfe5..943f4c7 100644 --- a/lib/infrastructure/analytic/dto/dashboard_analytic_dto.dart +++ b/lib/infrastructure/analytic/dto/dashboard_analytic_dto.dart @@ -7,6 +7,7 @@ class DashboardAnalyticDto with _$DashboardAnalyticDto { const factory DashboardAnalyticDto({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'overview') DashboardOverviewDto? overview, @@ -22,6 +23,7 @@ class DashboardAnalyticDto with _$DashboardAnalyticDto { DashboardAnalytic toDomain() => DashboardAnalytic( organizationId: organizationId ?? '', outletId: outletId ?? '', + outletName: outletName ?? '', dateFrom: dateFrom ?? '', dateTo: dateTo ?? '', overview: overview?.toDomain() ?? DashboardOverview.empty(), @@ -42,6 +44,9 @@ class DashboardOverviewDto with _$DashboardOverviewDto { @JsonKey(name: 'total_customers') int? totalCustomers, @JsonKey(name: 'voided_orders') int? voidedOrders, @JsonKey(name: 'refunded_orders') int? refundedOrders, + @JsonKey(name: 'total_item_sold') int? totalItemSold, + @JsonKey(name: 'total_low_stock') int? totalLowStock, + @JsonKey(name: 'total_product_active') int? totalProductActive, }) = _DashboardOverviewDto; factory DashboardOverviewDto.fromJson(Map json) => @@ -54,6 +59,9 @@ class DashboardOverviewDto with _$DashboardOverviewDto { totalCustomers: totalCustomers ?? 0, voidedOrders: voidedOrders ?? 0, refundedOrders: refundedOrders ?? 0, + totalItemSold: totalItemSold ?? 0, + totalLowStock: totalLowStock ?? 0, + totalProductActive: totalProductActive ?? 0, ); } diff --git a/lib/infrastructure/analytic/dto/exclusive_summary_dto.dart b/lib/infrastructure/analytic/dto/exclusive_summary_dto.dart index ceeac54..e16a4ce 100644 --- a/lib/infrastructure/analytic/dto/exclusive_summary_dto.dart +++ b/lib/infrastructure/analytic/dto/exclusive_summary_dto.dart @@ -7,6 +7,7 @@ class ExclusiveSummaryDto with _$ExclusiveSummaryDto { const factory ExclusiveSummaryDto({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'period') ExclusiveSummaryPeriodDto? period, @JsonKey(name: 'summary') ExclusiveSummarySummaryDto? summary, @JsonKey(name: 'reimburse') ExclusiveSummaryReimburseDto? reimburse, @@ -26,6 +27,7 @@ class ExclusiveSummaryDto with _$ExclusiveSummaryDto { ExclusiveSummary toDomain() => ExclusiveSummary( organizationId: organizationId ?? '', outletId: outletId ?? '', + outletName: outletName ?? '', period: period?.toDomain() ?? ExclusiveSummaryPeriod.empty(), summary: summary?.toDomain() ?? ExclusiveSummarySummary.empty(), reimburse: reimburse?.toDomain() ?? ExclusiveSummaryReimburse.empty(), diff --git a/lib/infrastructure/analytic/dto/payment_method_analytic_dto.dart b/lib/infrastructure/analytic/dto/payment_method_analytic_dto.dart index b29f877..1e07200 100644 --- a/lib/infrastructure/analytic/dto/payment_method_analytic_dto.dart +++ b/lib/infrastructure/analytic/dto/payment_method_analytic_dto.dart @@ -7,6 +7,7 @@ class PaymentMethodAnalyticDto with _$PaymentMethodAnalyticDto { const factory PaymentMethodAnalyticDto({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'group_by') String? groupBy, @@ -21,6 +22,7 @@ class PaymentMethodAnalyticDto with _$PaymentMethodAnalyticDto { return PaymentMethodAnalytic( organizationId: organizationId ?? '', outletId: outletId ?? '', + outletName: outletName ?? '', dateFrom: dateFrom ?? '', dateTo: dateTo ?? '', groupBy: groupBy ?? '', diff --git a/lib/infrastructure/analytic/dto/product_analytic_dto.dart b/lib/infrastructure/analytic/dto/product_analytic_dto.dart index b143e1e..6288258 100644 --- a/lib/infrastructure/analytic/dto/product_analytic_dto.dart +++ b/lib/infrastructure/analytic/dto/product_analytic_dto.dart @@ -7,6 +7,7 @@ class ProductAnalyticDto with _$ProductAnalyticDto { const factory ProductAnalyticDto({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') String? dateFrom, @JsonKey(name: 'date_to') String? dateTo, @JsonKey(name: 'data') List? data, @@ -18,6 +19,7 @@ class ProductAnalyticDto with _$ProductAnalyticDto { ProductAnalytic toDomain() => ProductAnalytic( organizationId: organizationId ?? "", outletId: outletId ?? "", + outletName: outletName ?? "", dateFrom: dateFrom ?? "", dateTo: dateTo ?? "", data: data?.map((e) => e.toDomain()).toList() ?? [], @@ -31,12 +33,21 @@ class ProductAnalyticDataDto with _$ProductAnalyticDataDto { const factory ProductAnalyticDataDto({ @JsonKey(name: 'product_id') String? productId, @JsonKey(name: 'product_name') String? productName, + @JsonKey(name: 'product_sku') String? productSku, + @JsonKey(name: 'product_price') int? productPrice, @JsonKey(name: 'category_id') String? categoryId, @JsonKey(name: 'category_name') String? categoryName, + @JsonKey(name: 'category_order') int? categoryOrder, @JsonKey(name: 'quantity_sold') int? quantitySold, @JsonKey(name: 'revenue') int? revenue, @JsonKey(name: 'average_price') double? averagePrice, @JsonKey(name: 'order_count') int? orderCount, + @JsonKey(name: 'standard_hpp_per_unit') int? standardHppPerUnit, + @JsonKey(name: 'standard_hpp_total') int? standardHppTotal, + @JsonKey(name: 'fifo_hpp_per_unit') int? fifoHppPerUnit, + @JsonKey(name: 'fifo_hpp_total') int? fifoHppTotal, + @JsonKey(name: 'moving_average_hpp_per_unit') int? movingAverageHppPerUnit, + @JsonKey(name: 'moving_average_hpp_total') int? movingAverageHppTotal, }) = _ProductAnalyticDataDto; factory ProductAnalyticDataDto.fromJson(Map json) => @@ -45,11 +56,20 @@ class ProductAnalyticDataDto with _$ProductAnalyticDataDto { ProductAnalyticData toDomain() => ProductAnalyticData( productId: productId ?? "", productName: productName ?? "", + productSku: productSku ?? "", + productPrice: productPrice ?? 0, categoryId: categoryId ?? "", categoryName: categoryName ?? "", + categoryOrder: categoryOrder ?? 0, quantitySold: quantitySold ?? 0, revenue: revenue ?? 0, averagePrice: averagePrice ?? 0, orderCount: orderCount ?? 0, + standardHppPerUnit: standardHppPerUnit ?? 0, + standardHppTotal: standardHppTotal ?? 0, + fifoHppPerUnit: fifoHppPerUnit ?? 0, + fifoHppTotal: fifoHppTotal ?? 0, + movingAverageHppPerUnit: movingAverageHppPerUnit ?? 0, + movingAverageHppTotal: movingAverageHppTotal ?? 0, ); } diff --git a/lib/infrastructure/analytic/dto/sales_analytic_dto.dart b/lib/infrastructure/analytic/dto/sales_analytic_dto.dart index c4453c9..e41ebbe 100644 --- a/lib/infrastructure/analytic/dto/sales_analytic_dto.dart +++ b/lib/infrastructure/analytic/dto/sales_analytic_dto.dart @@ -7,6 +7,7 @@ class SalesAnalyticDto with _$SalesAnalyticDto { const factory SalesAnalyticDto({ @JsonKey(name: 'organization_id') String? organizationId, @JsonKey(name: 'outlet_id') String? outletId, + @JsonKey(name: 'outlet_name') String? outletName, @JsonKey(name: 'date_from') DateTime? dateFrom, @JsonKey(name: 'date_to') DateTime? dateTo, @JsonKey(name: 'group_by') String? groupBy, @@ -20,6 +21,7 @@ class SalesAnalyticDto with _$SalesAnalyticDto { SalesAnalytic toDomain() => SalesAnalytic( organizationId: organizationId ?? '', outletId: outletId ?? '', + outletName: outletName ?? '', dateFrom: dateFrom ?? DateTime.fromMillisecondsSinceEpoch(0), dateTo: dateTo ?? DateTime.fromMillisecondsSinceEpoch(0), groupBy: groupBy ?? '', diff --git a/lib/presentation/components/assets/assets.gen.dart b/lib/presentation/components/assets/assets.gen.dart index 9e9480a..781f3ad 100644 --- a/lib/presentation/components/assets/assets.gen.dart +++ b/lib/presentation/components/assets/assets.gen.dart @@ -52,6 +52,10 @@ class $AssetsIconsGen { class $AssetsImagesGen { const $AssetsImagesGen(); + /// File path: assets/images/ic_launcher.png + AssetGenImage get icLauncher => + const AssetGenImage('assets/images/ic_launcher.png'); + /// File path: assets/images/ic_notification.png AssetGenImage get icNotification => const AssetGenImage('assets/images/ic_notification.png'); @@ -60,7 +64,7 @@ class $AssetsImagesGen { AssetGenImage get logo => const AssetGenImage('assets/images/logo.png'); /// List of all assets - List get values => [icNotification, logo]; + List get values => [icLauncher, icNotification, logo]; } class Assets { diff --git a/lib/presentation/components/bottom_sheet/date_range_bottom_sheet.dart b/lib/presentation/components/bottom_sheet/date_range_bottom_sheet.dart index 4db02b2..a3e3a28 100644 --- a/lib/presentation/components/bottom_sheet/date_range_bottom_sheet.dart +++ b/lib/presentation/components/bottom_sheet/date_range_bottom_sheet.dart @@ -13,13 +13,14 @@ class DateRangePickerBottomSheet { DateTime? maxDate, String? confirmText, String? cancelText, - Color primaryColor = Colors.blue, + Color primaryColor = const Color(0xFFD90000), Function(DateTime? startDate, DateTime? endDate)? onChanged, }) async { return await showModalBottomSheet( context: context, isScrollControlled: true, backgroundColor: Colors.transparent, + barrierColor: Colors.transparent, isDismissible: false, enableDrag: false, builder: (BuildContext context) => _DateRangePickerBottomSheet( @@ -71,6 +72,8 @@ class _DateRangePickerBottomSheetState DateRangePickerSelectionChangedArgs? _selectionChangedArgs; late AnimationController _animationController; late Animation _slideAnimation; + final DateRangePickerController _pickerController = + DateRangePickerController(); @override void initState() { @@ -88,6 +91,7 @@ class _DateRangePickerBottomSheetState @override void dispose() { _animationController.dispose(); + _pickerController.dispose(); super.dispose(); } @@ -135,10 +139,75 @@ class _DateRangePickerBottomSheetState return false; } + void _applyQuickFilter(DateTime start, DateTime end) { + final range = PickerDateRange(start, end); + _pickerController.selectedRange = range; + setState(() { + _selectionChangedArgs = DateRangePickerSelectionChangedArgs(range); + }); + } + + Widget _buildQuickFilters() { + final now = DateTime.now(); + final todayStart = DateTime(now.year, now.month, now.day); + + // This week (Monday to today) + final weekday = now.weekday; // 1=Mon, 7=Sun + final weekStart = todayStart.subtract(Duration(days: weekday - 1)); + + // This month (1st to today) + final monthStart = DateTime(now.year, now.month, 1); + + return Wrap( + spacing: 8, + runSpacing: 8, + children: [ + _buildFilterChip( + context.lang.today, + () => _applyQuickFilter(todayStart, todayStart), + ), + _buildFilterChip( + 'Minggu ini', + () => _applyQuickFilter(weekStart, todayStart), + ), + _buildFilterChip( + 'Bulan ini', + () => _applyQuickFilter(monthStart, todayStart), + ), + _buildFilterChip( + 'MTD', + () => _applyQuickFilter(monthStart, todayStart), + ), + ], + ); + } + + Widget _buildFilterChip(String label, VoidCallback onTap) { + return GestureDetector( + onTap: onTap, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), + decoration: BoxDecoration( + color: widget.primaryColor.withOpacity(0.08), + borderRadius: BorderRadius.circular(20), + border: Border.all(color: widget.primaryColor.withOpacity(0.3)), + ), + child: Text( + label, + style: TextStyle( + color: widget.primaryColor, + fontWeight: FontWeight.w600, + fontSize: 13, + ), + ), + ), + ); + } + @override Widget build(BuildContext context) { final screenHeight = MediaQuery.of(context).size.height; - final bottomSheetHeight = screenHeight * 0.75; + final bottomSheetHeight = screenHeight * 0.85; return AnimatedBuilder( animation: _animationController, @@ -209,7 +278,12 @@ class _DateRangePickerBottomSheetState ), ), - const SizedBox(height: 20), + const SizedBox(height: 16), + + // Quick filter chips + _buildQuickFilters(), + + const SizedBox(height: 16), // Date Picker Container( @@ -221,8 +295,10 @@ class _DateRangePickerBottomSheetState ), ), child: SfDateRangePicker( + controller: _pickerController, onSelectionChanged: _onSelectionChanged, selectionMode: DateRangePickerSelectionMode.range, + backgroundColor: Colors.white, initialSelectedRange: (widget.initialStartDate != null && widget.initialEndDate != null) @@ -233,6 +309,7 @@ class _DateRangePickerBottomSheetState : null, minDate: widget.minDate, maxDate: widget.maxDate, + selectionColor: widget.primaryColor, startRangeSelectionColor: widget.primaryColor, endRangeSelectionColor: widget.primaryColor, rangeSelectionColor: widget.primaryColor @@ -249,7 +326,7 @@ class _DateRangePickerBottomSheetState ), monthViewSettings: DateRangePickerMonthViewSettings( viewHeaderStyle: DateRangePickerViewHeaderStyle( - backgroundColor: Colors.grey.withOpacity(0.1), + backgroundColor: Colors.white, textStyle: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, diff --git a/lib/presentation/pages/sales/sales_page.dart b/lib/presentation/pages/sales/sales_page.dart index d5eed33..feeae84 100644 --- a/lib/presentation/pages/sales/sales_page.dart +++ b/lib/presentation/pages/sales/sales_page.dart @@ -1,18 +1,19 @@ import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:shimmer/shimmer.dart'; -import 'dart:math' as math; +import '../../../application/analytic/category_analytic_loader/category_analytic_loader_bloc.dart'; +import '../../../application/analytic/payment_method_analytic_loader/payment_method_analytic_loader_bloc.dart'; +import '../../../application/analytic/product_analytic_loader/product_analytic_loader_bloc.dart'; import '../../../application/analytic/sales_loader/sales_loader_bloc.dart'; -import '../../../common/extension/extension.dart'; import '../../../common/theme/theme.dart'; -import '../../../domain/analytic/analytic.dart'; import '../../../injection.dart'; -import '../../components/appbar/appbar.dart'; -import '../../components/field/date_range_picker_field.dart'; import '../../components/spacer/spacer.dart'; -import 'widgets/summary_card.dart'; +import 'widgets/sales_category_card.dart'; +import 'widgets/sales_header.dart'; +import 'widgets/sales_payment_method_card.dart'; +import 'widgets/sales_rincian_card.dart'; +import 'widgets/sales_top_products_card.dart'; @RoutePage() class SalesPage extends StatefulWidget implements AutoRouteWrapper { @@ -22,57 +23,58 @@ class SalesPage extends StatefulWidget implements AutoRouteWrapper { State createState() => _SalesPageState(); @override - Widget wrappedRoute(BuildContext context) => BlocProvider( - create: (context) => - getIt()..add(SalesLoaderEvent.fectched()), + Widget wrappedRoute(BuildContext context) => MultiBlocProvider( + providers: [ + BlocProvider( + create: (context) => + getIt()..add(SalesLoaderEvent.fectched()), + ), + BlocProvider( + create: (context) => + getIt() + ..add(const PaymentMethodAnalyticLoaderEvent.fetched()), + ), + BlocProvider( + create: (context) => + getIt() + ..add(const CategoryAnalyticLoaderEvent.fetched()), + ), + BlocProvider( + create: (context) => + getIt() + ..add(const ProductAnalyticLoaderEvent.fetched()), + ), + ], child: this, ); } -class _SalesPageState extends State with TickerProviderStateMixin { - late AnimationController slideAnimationController; - late Animation slideAnimation; - - late AnimationController fadeAnimationController; - late Animation fadeAnimation; +class _SalesPageState extends State + with SingleTickerProviderStateMixin { + late AnimationController _fadeController; + late Animation _fadeAnimation; @override void initState() { super.initState(); - // Slide Animation - slideAnimationController = AnimationController( - duration: const Duration(milliseconds: 800), - vsync: this, - ); - slideAnimation = - Tween(begin: const Offset(0, 0.3), end: Offset.zero).animate( - CurvedAnimation( - parent: slideAnimationController, - curve: Curves.easeOutCubic, - ), - ); - - // Fade Animation - fadeAnimationController = AnimationController( + _fadeController = AnimationController( duration: const Duration(milliseconds: 600), vsync: this, ); - fadeAnimation = Tween(begin: 0.0, end: 1.0).animate( - CurvedAnimation(parent: fadeAnimationController, curve: Curves.easeOut), + _fadeAnimation = CurvedAnimation( + parent: _fadeController, + curve: Curves.easeOut, ); - // Start animations Future.delayed(const Duration(milliseconds: 300), () { - slideAnimationController.forward(); - fadeAnimationController.forward(); + _fadeController.forward(); }); } @override void dispose() { - slideAnimationController.dispose(); - fadeAnimationController.dispose(); + _fadeController.dispose(); super.dispose(); } @@ -80,679 +82,132 @@ class _SalesPageState extends State with TickerProviderStateMixin { Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColor.background, - body: BlocListener( - listenWhen: (previous, current) => - previous.dateFrom != current.dateFrom || - previous.dateTo != current.dateTo, - listener: (context, state) { - context.read().add(SalesLoaderEvent.fectched()); - }, - child: BlocBuilder( - builder: (context, state) { - return CustomScrollView( - slivers: [ - // App Bar - SliverAppBar( - expandedHeight: 120, - floating: false, - pinned: true, - backgroundColor: AppColor.primary, - flexibleSpace: CustomAppBar(title: context.lang.sales), + body: BlocBuilder( + builder: (context, salesState) { + return CustomScrollView( + slivers: [ + // Header + SliverToBoxAdapter( + child: SalesHeader( + state: salesState, + onDateRangeChanged: (startDate, endDate) { + _onDateRangeChanged(context, startDate, endDate); + }, ), + ), - // Date Range Header - SliverToBoxAdapter( - 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().add( - SalesLoaderEvent.rangeDateChanged( - startDate!, - endDate!, - ), + // Rincian Penjualan + SliverToBoxAdapter( + child: FadeTransition( + opacity: _fadeAnimation, + child: Padding( + padding: const EdgeInsets.all(16), + child: SalesRincianCard(state: salesState), + ), + ), + ), + + // Metode Pembayaran + SliverToBoxAdapter( + child: FadeTransition( + opacity: _fadeAnimation, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: + BlocBuilder< + PaymentMethodAnalyticLoaderBloc, + PaymentMethodAnalyticLoaderState + >( + builder: (context, paymentState) { + return SalesPaymentMethodCard( + paymentMethodAnalytic: + paymentState.paymentMethodAnalytic, + isFetching: paymentState.isFetching, ); }, ), - ), - ), ), ), + ), - // Summary Cards - SliverToBoxAdapter( - child: SlideTransition( - position: slideAnimation, - child: FadeTransition( - opacity: fadeAnimation, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.lang.summary, - style: AppStyle.xxl.copyWith( - fontWeight: FontWeight.bold, - color: AppColor.textPrimary, - ), - ), - const SpaceHeight(16), - state.isFetching - ? _buildSummaryShimmer() - : _buildSummaryCards(state), - ], + // Penjualan per Kategori + SliverToBoxAdapter( + child: FadeTransition( + opacity: _fadeAnimation, + child: Padding( + padding: const EdgeInsets.all(16), + child: + BlocBuilder< + CategoryAnalyticLoaderBloc, + CategoryAnalyticLoaderState + >( + builder: (context, categoryState) { + return SalesCategoryCard( + categoryAnalytic: categoryState.categoryAnalytic, + isFetching: categoryState.isFetching, + ); + }, ), - ), - ), ), ), + ), - // Net Sales Card - SliverToBoxAdapter( - child: SlideTransition( - position: slideAnimation, - child: FadeTransition( - opacity: fadeAnimation, - child: state.isFetching - ? _buildNetSalesShimmer() - : _buildNetSalesCard(state), - ), - ), - ), - - // Daily Sales Section Header - SliverToBoxAdapter( - child: SlideTransition( - position: slideAnimation, - child: FadeTransition( - opacity: fadeAnimation, - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), - child: Text( - context.lang.daily_breakdown, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: AppColor.textPrimary, - ), + // Produk Terlaris + SliverToBoxAdapter( + child: FadeTransition( + opacity: _fadeAnimation, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: + BlocBuilder< + ProductAnalyticLoaderBloc, + ProductAnalyticLoaderState + >( + builder: (context, productState) { + return SalesTopProductsCard( + productAnalytic: productState.productAnalytic, + isFetching: productState.isFetching, + ); + }, ), - ), - ), ), ), - - // Daily Sales List - state.isFetching - ? _buildDailySalesShimmer() - : _buildDailySalesList(state), - - // Bottom Padding - const SliverToBoxAdapter(child: SpaceHeight(32)), - ], - ); - }, - ), - ), - ); - } - - Widget _buildSummaryShimmer() { - return Column( - children: [ - Row( - children: [ - Expanded(child: _buildSummaryCardShimmer()), - SpaceWidth(12), - Expanded(child: _buildSummaryCardShimmer()), - ], - ), - const SpaceHeight(12), - Row( - children: [ - Expanded(child: _buildSummaryCardShimmer()), - SpaceWidth(12), - Expanded(child: _buildSummaryCardShimmer()), - ], - ), - ], - ); - } - - Widget _buildSummaryCardShimmer() { - return Shimmer.fromColors( - baseColor: Colors.grey[300]!, - highlightColor: Colors.grey[100]!, - child: Container( - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - width: 24, - height: 24, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(6), - ), - ), - SpaceWidth(8), - Container( - width: 60, - height: 14, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4), - ), - ), - ], - ), - const SpaceHeight(8), - Container( - width: double.infinity, - height: 20, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4), ), - ), - ], - ), - ), - ); - } - Widget _buildNetSalesShimmer() { - return Container( - margin: const EdgeInsets.all(16), - child: Shimmer.fromColors( - baseColor: Colors.grey[300]!, - highlightColor: Colors.grey[100]!, - child: Container( - padding: const EdgeInsets.all(20), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Row( - children: [ - Container( - width: 52, - height: 52, - decoration: BoxDecoration( - color: Colors.grey[400], - borderRadius: BorderRadius.circular(12), - ), - ), - SpaceWidth(16), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 80, - height: 14, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4), - ), - ), - const SpaceHeight(8), - Container( - width: 150, - height: 24, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4), - ), - ), - ], - ), - ), + // Bottom Padding + const SliverToBoxAdapter(child: SpaceHeight(32)), ], - ), - ), - ), - ); - } - - Widget _buildDailySalesShimmer() { - return SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - return Container( - margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), - child: Shimmer.fromColors( - baseColor: Colors.grey[300]!, - highlightColor: Colors.grey[100]!, - child: Container( - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - ), - child: Row( - children: [ - Container( - width: 40, - height: 40, - decoration: BoxDecoration( - color: Colors.grey[400], - borderRadius: BorderRadius.circular(10), - ), - ), - SpaceWidth(12), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 100, - height: 16, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4), - ), - ), - const SpaceHeight(4), - Container( - width: 80, - height: 14, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4), - ), - ), - ], - ), - ), - Container( - width: 60, - height: 24, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - ), - ), - ], - ), - ), - ), ); }, - childCount: 8, // Show 8 shimmer items while loading ), ); } - Widget _buildSummaryCards(SalesLoaderState state) { - return Column( - children: [ - TweenAnimationBuilder( - tween: Tween(begin: 0.0, end: 1.0), - duration: const Duration(milliseconds: 800), - curve: Curves.elasticOut, - builder: (context, value, child) { - return Transform.scale( - scale: value, - child: Row( - children: [ - Expanded( - child: _buildSummaryCard( - context.lang.total_sales, - state.sales.summary.totalSales.currencyFormatRp, - Icons.trending_up, - AppColor.success, - 0, - ), - ), - SpaceWidth(12), - Expanded( - child: _buildSummaryCard( - context.lang.total_orders, - state.sales.summary.totalOrders.toString(), - Icons.shopping_cart, - AppColor.info, - 100, - ), - ), - ], - ), - ); - }, - ), - const SpaceHeight(12), - TweenAnimationBuilder( - tween: Tween(begin: 0.0, end: 1.0), - duration: const Duration(milliseconds: 1000), - curve: Curves.elasticOut, - builder: (context, value, child) { - return Transform.scale( - scale: value, - child: Row( - children: [ - Expanded( - child: _buildSummaryCard( - context.lang.average_price, - state.sales.summary.averageOrderValue - .round() - .currencyFormatRp, - Icons.attach_money, - AppColor.warning, - 200, - ), - ), - SpaceWidth(12), - Expanded( - child: _buildSummaryCard( - context.lang.total_items, - state.sales.summary.totalItems.toString(), - Icons.inventory, - AppColor.primary, - 300, - ), - ), - ], - ), - ); - }, - ), - ], - ); - } - - Widget _buildNetSalesCard(SalesLoaderState state) { - return TweenAnimationBuilder( - tween: Tween(begin: 0.0, end: 1.0), - duration: const Duration(milliseconds: 1200), - curve: Curves.bounceOut, - builder: (context, value, child) { - return Transform.scale( - scale: value, - child: Container( - margin: const EdgeInsets.all(16), - padding: const EdgeInsets.all(20), - decoration: BoxDecoration( - gradient: const LinearGradient( - colors: AppColor.successGradient, - begin: Alignment.topLeft, - end: Alignment.bottomRight, - ), - borderRadius: BorderRadius.circular(16), - boxShadow: [ - BoxShadow( - color: AppColor.success.withOpacity(0.3), - blurRadius: 15, - offset: const Offset(0, 5), - ), - ], - ), - child: Row( - children: [ - TweenAnimationBuilder( - tween: Tween(begin: 0.0, end: 1.0), - duration: const Duration(milliseconds: 1500), - curve: Curves.elasticOut, - builder: (context, iconValue, child) { - return Transform.rotate( - angle: iconValue * 0.1, - child: Container( - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: Colors.white.withOpacity(0.2), - borderRadius: BorderRadius.circular(12), - ), - child: const Icon( - Icons.account_balance_wallet, - color: AppColor.textWhite, - size: 28, - ), - ), - ); - }, - ), - SpaceWidth(16), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.lang.net_sales, - style: TextStyle( - color: AppColor.textWhite.withOpacity(0.9), - fontSize: 14, - fontWeight: FontWeight.w500, - ), - ), - const SpaceHeight(4), - TweenAnimationBuilder( - tween: Tween( - begin: 0.0, - end: state.sales.summary.netSales.toDouble(), - ), - duration: const Duration(milliseconds: 2000), - curve: Curves.easeOutCubic, - builder: (context, countValue, child) { - return Text( - state.sales.summary.netSales.currencyFormatRp, - style: const TextStyle( - color: AppColor.textWhite, - fontSize: 24, - fontWeight: FontWeight.bold, - ), - ); - }, - ), - ], - ), - ), - ], - ), - ), - ); - }, - ); - } - - Widget _buildDailySalesList(SalesLoaderState state) { - return SliverList( - delegate: SliverChildBuilderDelegate((context, index) { - // Calculate intervals ensuring they don't exceed 1.0 - final slideStart = math.min(0.2 + (index * 0.05), 0.7); - final slideEnd = math.min(slideStart + 0.3, 1.0); - final fadeStart = math.min(0.3 + (index * 0.05), 0.8); - final fadeEnd = math.min(fadeStart + 0.2, 1.0); - - return SlideTransition( - position: - Tween( - begin: Offset(index.isEven ? -1.0 : 1.0, 0), - end: Offset.zero, - ).animate( - CurvedAnimation( - parent: slideAnimationController, - curve: Interval( - slideStart, - slideEnd, - curve: Curves.easeOutBack, - ), - ), - ), - child: FadeTransition( - opacity: Tween(begin: 0.0, end: 1.0).animate( - CurvedAnimation( - parent: fadeAnimationController, - curve: Interval(fadeStart, fadeEnd, curve: Curves.easeOut), - ), - ), - child: Container( - margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), - decoration: BoxDecoration( - color: AppColor.surface, - borderRadius: BorderRadius.circular(12), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.05), - blurRadius: 8, - offset: const Offset(0, 2), - ), - ], - ), - child: _buildDailySalesItem(state.sales.data[index]), - ), - ), - ); - }, childCount: state.sales.data.length), - ); - } - - Widget _buildSummaryCard( - String title, - String value, - IconData icon, - Color color, - int delay, + void _onDateRangeChanged( + BuildContext context, + DateTime startDate, + DateTime endDate, ) { - return SalesSummaryCard( - fadeAnimation: fadeAnimation, - title: title, - value: value, - icon: icon, - color: color, - delay: delay, - ); - } + // Update sales + context.read() + ..add(SalesLoaderEvent.rangeDateChanged(startDate, endDate)) + ..add(SalesLoaderEvent.fectched()); - Widget _buildDailySalesItem(SalesAnalyticData dailySale) { - return ExpansionTile( - leading: Container( - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - color: AppColor.primary.withOpacity(0.1), - borderRadius: BorderRadius.circular(10), - ), - child: Icon(Icons.calendar_today, color: AppColor.primary, size: 20), - ), - title: Text( - '${dailySale.date.day}/${dailySale.date.month}/${dailySale.date.year}', - style: const TextStyle( - fontWeight: FontWeight.bold, - color: AppColor.textPrimary, - ), - ), - subtitle: Text( - dailySale.sales.currencyFormatRp, - style: TextStyle( - color: AppColor.success, - fontWeight: FontWeight.w600, - fontSize: 16, - ), - ), - trailing: Container( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), - decoration: BoxDecoration( - color: AppColor.info.withOpacity(0.1), - borderRadius: BorderRadius.circular(20), - ), - child: Text( - '${dailySale.orders} ${context.lang.orders}', - style: TextStyle( - color: AppColor.info, - fontWeight: FontWeight.w500, - fontSize: 12, - ), - ), - ), - children: [ - Padding( - padding: const EdgeInsets.all(16), - child: Row( - children: [ - Expanded( - child: _buildDetailItem( - context.lang.items, - '${dailySale.items}', - Icons.inventory_2, - ), - ), - Expanded( - child: _buildDetailItem( - context.lang.tax, - dailySale.tax.currencyFormatRp, - Icons.receipt, - ), - ), - Expanded( - child: _buildDetailItem( - context.lang.discount, - dailySale.discount.currencyFormatRp, - Icons.local_offer, - ), - ), - ], - ), - ), - ], - ); - } + // Update payment method + context.read() + ..add( + PaymentMethodAnalyticLoaderEvent.rangeDateChanged(startDate, endDate), + ) + ..add(const PaymentMethodAnalyticLoaderEvent.fetched()); - Widget _buildDetailItem(String label, String value, IconData icon) { - return TweenAnimationBuilder( - tween: Tween(begin: 0.0, end: 1.0), - duration: const Duration(milliseconds: 600), - curve: Curves.bounceOut, - builder: (context, animValue, child) { - return Transform.scale( - scale: animValue, - child: Column( - children: [ - TweenAnimationBuilder( - tween: Tween(begin: 0.0, end: 1.0), - duration: const Duration(milliseconds: 800), - curve: Curves.elasticOut, - builder: (context, iconValue, child) { - return Transform.rotate( - angle: iconValue * 0.1, - child: Icon(icon, color: AppColor.textSecondary, size: 20), - ); - }, - ), - const SpaceHeight(4), - Text( - label, - style: TextStyle(color: AppColor.textSecondary, fontSize: 12), - ), - const SpaceHeight(2), - AnimatedBuilder( - animation: fadeAnimation, - builder: (context, child) { - return Text( - value, - style: TextStyle( - color: AppColor.textPrimary, - fontWeight: FontWeight.w600, - fontSize: 14, - ), - ); - }, - ), - ], - ), - ); - }, - ); + // Update category + context.read() + ..add(CategoryAnalyticLoaderEvent.rangeDateChanged(startDate, endDate)) + ..add(const CategoryAnalyticLoaderEvent.fetched()); + + // Update product + context.read() + ..add(ProductAnalyticLoaderEvent.rangeDateChanged(startDate, endDate)) + ..add(const ProductAnalyticLoaderEvent.fetched()); } } diff --git a/lib/presentation/pages/sales/widgets/product_detail_bottom_sheet.dart b/lib/presentation/pages/sales/widgets/product_detail_bottom_sheet.dart new file mode 100644 index 0000000..7446d08 --- /dev/null +++ b/lib/presentation/pages/sales/widgets/product_detail_bottom_sheet.dart @@ -0,0 +1,227 @@ +import 'package:flutter/material.dart'; + +import '../../../../common/extension/extension.dart'; +import '../../../../common/theme/theme.dart'; +import '../../../../domain/analytic/analytic.dart'; +import '../../../components/spacer/spacer.dart'; + +class ProductDetailBottomSheet { + static void show({ + required BuildContext context, + required ProductAnalyticData product, + required int totalRevenue, + }) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + barrierColor: Colors.transparent, + builder: (context) => + _ProductDetailContent(product: product, totalRevenue: totalRevenue), + ); + } +} + +class _ProductDetailContent extends StatelessWidget { + final ProductAnalyticData product; + final int totalRevenue; + + const _ProductDetailContent({ + required this.product, + required this.totalRevenue, + }); + + @override + Widget build(BuildContext context) { + final contribution = totalRevenue > 0 + ? (product.revenue / totalRevenue * 100) + : 0.0; + + final hppPercentage = product.revenue > 0 + ? (product.standardHppTotal / product.revenue * 100) + : 0.0; + + final marginStatus = _getMarginStatus(hppPercentage); + + return Container( + constraints: BoxConstraints( + maxHeight: MediaQuery.of(context).size.height * 0.6, + ), + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(24), + topRight: Radius.circular(24), + ), + ), + child: SingleChildScrollView( + padding: const EdgeInsets.all(24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + // Drag handle + Center( + child: Container( + width: 40, + height: 4, + margin: const EdgeInsets.only(bottom: 20), + decoration: BoxDecoration( + color: Colors.grey.shade300, + borderRadius: BorderRadius.circular(2), + ), + ), + ), + + // Product name + Text( + product.productName.toUpperCase(), + style: AppStyle.xl.copyWith( + fontWeight: FontWeight.bold, + color: AppColor.textPrimary, + fontSize: 20, + ), + ), + const SpaceHeight(4), + + // Category + Text( + product.categoryName, + style: AppStyle.md.copyWith( + color: AppColor.primary, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + ), + + const SpaceHeight(20), + + // Details + _buildRow(context, 'Kategori', product.categoryName), + _buildDivider(), + _buildRow( + context, + 'Qty ${context.lang.sold.toLowerCase()}', + '${product.quantitySold} porsi', + ), + _buildDivider(), + _buildRow( + context, + context.lang.revenue, + product.revenue.currencyFormatRp, + ), + _buildDivider(), + _buildRow( + context, + 'Kontribusi omzet', + '${contribution.toStringAsFixed(1)}%', + ), + _buildDivider(), + _buildRow( + context, + '% ${context.lang.hpp} (real)', + '${hppPercentage.toStringAsFixed(1)}%', + ), + _buildDivider(), + _buildRowWithBadge( + context, + 'Status margin', + marginStatus.label, + marginStatus.color, + ), + + const SpaceHeight(16), + ], + ), + ), + ); + } + + Widget _buildRow(BuildContext context, String label, String value) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 14), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + label, + style: AppStyle.md.copyWith( + color: AppColor.textSecondary, + fontWeight: FontWeight.w500, + fontSize: 14, + ), + ), + Text( + value, + style: AppStyle.md.copyWith( + color: AppColor.textPrimary, + fontWeight: FontWeight.w700, + fontSize: 14, + ), + ), + ], + ), + ); + } + + Widget _buildRowWithBadge( + BuildContext context, + String label, + String badgeText, + Color badgeColor, + ) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 14), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + label, + style: AppStyle.md.copyWith( + color: AppColor.textSecondary, + fontWeight: FontWeight.w500, + fontSize: 14, + ), + ), + Container( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), + decoration: BoxDecoration( + color: badgeColor.withOpacity(0.15), + borderRadius: BorderRadius.circular(12), + ), + child: Text( + badgeText, + style: AppStyle.sm.copyWith( + color: badgeColor, + fontWeight: FontWeight.w700, + fontSize: 12, + ), + ), + ), + ], + ), + ); + } + + Widget _buildDivider() { + return Divider( + height: 1, + thickness: 0.5, + color: AppColor.border.withOpacity(0.5), + ); + } + + _MarginStatus _getMarginStatus(double hppPercentage) { + if (hppPercentage <= 50) { + return _MarginStatus('Sehat', AppColor.success); + } else { + return _MarginStatus('Tidak sehat', AppColor.error); + } + } +} + +class _MarginStatus { + final String label; + final Color color; + _MarginStatus(this.label, this.color); +} diff --git a/lib/presentation/pages/sales/widgets/sales_category_card.dart b/lib/presentation/pages/sales/widgets/sales_category_card.dart new file mode 100644 index 0000000..55da50f --- /dev/null +++ b/lib/presentation/pages/sales/widgets/sales_category_card.dart @@ -0,0 +1,274 @@ +import 'package:flutter/material.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../../common/extension/extension.dart'; +import '../../../../common/theme/theme.dart'; +import '../../../../domain/analytic/analytic.dart'; +import '../../../components/spacer/spacer.dart'; + +class SalesCategoryCard extends StatelessWidget { + final CategoryAnalytic categoryAnalytic; + final bool isFetching; + + const SalesCategoryCard({ + super.key, + required this.categoryAnalytic, + required this.isFetching, + }); + + @override + Widget build(BuildContext context) { + if (isFetching) return _buildShimmer(); + + final data = categoryAnalytic.data; + final totalItems = data.fold(0, (sum, e) => sum + e.totalQuantity); + final totalRevenue = data.fold(0, (sum, e) => sum + e.totalRevenue); + + return Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: AppColor.surface, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.04), + blurRadius: 10, + offset: const Offset(0, 2), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title row + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + context.lang.sales_category, + style: AppStyle.xl.copyWith( + fontWeight: FontWeight.bold, + color: AppColor.textPrimary, + fontSize: 18, + ), + ), + Text( + '$totalItems ${context.lang.item.toLowerCase()}', + style: AppStyle.sm.copyWith( + color: AppColor.textSecondary, + fontWeight: FontWeight.w500, + fontSize: 13, + ), + ), + ], + ), + const SpaceHeight(16), + + // Category items + if (data.isEmpty) + Center( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 20), + child: Text( + context.lang.category_no_data, + style: AppStyle.md.copyWith(color: AppColor.textSecondary), + ), + ), + ) + else + ...data.asMap().entries.map((entry) { + final index = entry.key; + final item = entry.value; + final percentage = totalRevenue > 0 + ? (item.totalRevenue / totalRevenue * 100) + : 0.0; + return Column( + children: [ + _buildCategoryItem(item, percentage, index), + if (index < data.length - 1) const SpaceHeight(16), + ], + ); + }), + ], + ), + ); + } + + Widget _buildCategoryItem( + CategoryAnalyticItem item, + double percentage, + int index, + ) { + final colors = [ + AppColor.primary, + const Color(0xFF00BCD4), + const Color(0xFFFF9800), + const Color(0xFF9E9E9E), + AppColor.success, + AppColor.info, + ]; + final color = colors[index % colors.length]; + + return Column( + children: [ + // Name + count + amount + percentage + Row( + children: [ + Expanded( + child: Row( + children: [ + Flexible( + child: Text( + item.categoryName, + style: AppStyle.md.copyWith( + color: AppColor.textPrimary, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + overflow: TextOverflow.ellipsis, + ), + ), + const SpaceWidth(8), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 2, + ), + decoration: BoxDecoration( + color: AppColor.textSecondary.withOpacity(0.1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + '${item.totalQuantity}x', + style: AppStyle.xs.copyWith( + color: AppColor.textSecondary, + fontWeight: FontWeight.w600, + fontSize: 12, + ), + ), + ), + ], + ), + ), + Text( + item.totalRevenue.currencyFormatRp, + style: AppStyle.md.copyWith( + color: AppColor.textPrimary, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + ), + const SpaceWidth(6), + Text( + '${percentage.toStringAsFixed(1)}%', + style: AppStyle.xs.copyWith( + color: AppColor.textSecondary, + fontWeight: FontWeight.w500, + fontSize: 12, + ), + ), + ], + ), + const SpaceHeight(8), + // Progress bar + ClipRRect( + borderRadius: BorderRadius.circular(4), + child: LinearProgressIndicator( + value: percentage / 100, + minHeight: 6, + backgroundColor: AppColor.border.withOpacity(0.3), + valueColor: AlwaysStoppedAnimation(color), + ), + ), + ], + ); + } + + Widget _buildShimmer() { + return Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: AppColor.surface, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.04), + blurRadius: 10, + offset: const Offset(0, 2), + ), + ], + ), + child: Shimmer.fromColors( + baseColor: Colors.grey[300]!, + highlightColor: Colors.grey[100]!, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 160, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + Container( + width: 60, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + ], + ), + const SpaceHeight(20), + ...List.generate( + 4, + (index) => Padding( + padding: const EdgeInsets.only(bottom: 16), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 120, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + Container( + width: 90, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + ], + ), + const SpaceHeight(8), + Container( + width: double.infinity, + height: 6, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/presentation/pages/sales/widgets/sales_header.dart b/lib/presentation/pages/sales/widgets/sales_header.dart new file mode 100644 index 0000000..ffdef5a --- /dev/null +++ b/lib/presentation/pages/sales/widgets/sales_header.dart @@ -0,0 +1,315 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:flutter/material.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../../application/analytic/sales_loader/sales_loader_bloc.dart'; +import '../../../../common/extension/extension.dart'; +import '../../../../common/painter/wave_painter.dart'; +import '../../../../common/theme/theme.dart'; +import '../../../components/bottom_sheet/date_range_bottom_sheet.dart'; +import '../../../components/spacer/spacer.dart'; + +class SalesHeader extends StatelessWidget { + final SalesLoaderState state; + final void Function(DateTime startDate, DateTime endDate)? onDateRangeChanged; + + const SalesHeader({super.key, required this.state, this.onDateRangeChanged}); + + @override + Widget build(BuildContext context) { + final dateLabel = _formatDateRange(state.dateFrom, state.dateTo, context); + final outletLabel = state.sales.outletName.isNotEmpty + ? state.sales.outletName + : 'Semua Outlet'; + + return Container( + decoration: const BoxDecoration( + gradient: LinearGradient( + colors: AppColor.primaryGradient, + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(24), + bottomRight: Radius.circular(24), + ), + ), + child: Stack( + children: [ + // Decorative circles + Positioned( + top: -20, + right: -30, + child: Container( + width: 120, + height: 120, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: AppColor.textWhite.withOpacity(0.08), + ), + ), + ), + Positioned( + top: 30, + right: 20, + child: Container( + width: 60, + height: 60, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: AppColor.textWhite.withOpacity(0.05), + ), + ), + ), + Positioned( + top: 10, + left: -20, + child: Container( + width: 80, + height: 80, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: AppColor.textWhite.withOpacity(0.04), + ), + ), + ), + + // Wave pattern + Positioned.fill( + child: CustomPaint( + painter: WavePainter( + animation: 0.0, + color: AppColor.textWhite.withOpacity(0.1), + ), + ), + ), + + // Content + SafeArea( + bottom: false, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Back button + Title row + Calendar button + Row( + children: [ + GestureDetector( + onTap: () => context.router.maybePop(), + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: AppColor.textWhite.withOpacity(0.15), + borderRadius: BorderRadius.circular(12), + ), + child: const Icon( + Icons.chevron_left_rounded, + color: AppColor.textWhite, + size: 24, + ), + ), + ), + const SpaceWidth(12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.lang.sales, + style: AppStyle.xl.copyWith( + color: AppColor.textWhite, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ), + const SizedBox(height: 2), + Text( + '$dateLabel · $outletLabel', + style: AppStyle.sm.copyWith( + color: AppColor.textWhite.withOpacity(0.75), + fontWeight: FontWeight.w400, + fontSize: 12, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + const SpaceWidth(8), + // Date filter button + GestureDetector( + onTap: () => _showDatePicker(context), + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: AppColor.textWhite.withOpacity(0.15), + borderRadius: BorderRadius.circular(12), + ), + child: const Icon( + Icons.calendar_month_rounded, + color: AppColor.textWhite, + size: 20, + ), + ), + ), + ], + ), + + const SpaceHeight(24), + + // Total Penjualan label + Text( + context.lang.total_sales_label, + style: AppStyle.sm.copyWith( + color: AppColor.textWhite.withOpacity(0.75), + fontWeight: FontWeight.w400, + fontSize: 13, + ), + ), + + const SpaceHeight(4), + + // Big value + state.isFetching + ? _buildHeaderValueShimmer() + : Text( + state.sales.summary.totalSales.currencyFormatRp, + style: AppStyle.h1.copyWith( + color: AppColor.textWhite, + fontWeight: FontWeight.w900, + fontSize: 32, + ), + ), + + const SpaceHeight(16), + + // Chips row + state.isFetching + ? _buildHeaderChipsShimmer() + : _buildHeaderChips(context), + ], + ), + ), + ), + ], + ), + ); + } + + void _showDatePicker(BuildContext context) { + DateRangePickerBottomSheet.show( + context: context, + primaryColor: AppColor.primary, + initialStartDate: state.dateFrom, + initialEndDate: state.dateTo, + maxDate: DateTime.now(), + onChanged: (startDate, endDate) { + if (startDate != null && endDate != null) { + onDateRangeChanged?.call(startDate, endDate); + } + }, + ); + } + + Widget _buildHeaderValueShimmer() { + return Shimmer.fromColors( + baseColor: AppColor.textWhite.withOpacity(0.3), + highlightColor: AppColor.textWhite.withOpacity(0.6), + child: Container( + width: 200, + height: 36, + decoration: BoxDecoration( + color: AppColor.textWhite.withOpacity(0.3), + borderRadius: BorderRadius.circular(8), + ), + ), + ); + } + + Widget _buildHeaderChipsShimmer() { + return Row( + children: List.generate( + 3, + (index) => Padding( + padding: const EdgeInsets.only(right: 8), + child: Shimmer.fromColors( + baseColor: AppColor.textWhite.withOpacity(0.15), + highlightColor: AppColor.textWhite.withOpacity(0.3), + child: Container( + width: 90, + height: 32, + decoration: BoxDecoration( + color: AppColor.textWhite.withOpacity(0.15), + borderRadius: BorderRadius.circular(20), + ), + ), + ), + ), + ), + ); + } + + Widget _buildHeaderChips(BuildContext context) { + final summary = state.sales.summary; + final avgPerInvoice = summary.totalOrders > 0 + ? (summary.totalSales / summary.totalOrders).round() + : 0; + + return Wrap( + spacing: 8, + runSpacing: 8, + children: [ + _buildChip('${summary.totalOrders} invoice'), + _buildChip( + '${summary.totalItems} ${context.lang.items_sold.toLowerCase()}', + ), + _buildChip('≈ ${avgPerInvoice.currencyFormatRp}/invoice'), + ], + ); + } + + Widget _buildChip(String label) { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), + decoration: BoxDecoration( + color: AppColor.textWhite.withOpacity(0.15), + borderRadius: BorderRadius.circular(20), + border: Border.all(color: AppColor.textWhite.withOpacity(0.25)), + ), + child: Text( + label, + style: AppStyle.sm.copyWith( + color: AppColor.textWhite, + fontWeight: FontWeight.w600, + fontSize: 12, + ), + ), + ); + } + + String _formatDateRange(DateTime from, DateTime to, BuildContext context) { + const months = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'Mei', + 'Jun', + 'Jul', + 'Agu', + 'Sep', + 'Okt', + 'Nov', + 'Des', + ]; + + if (from.year == to.year && from.month == to.month && from.day == to.day) { + return '${context.lang.report} ${from.day} ${months[from.month - 1]} ${from.year}'; + } + return '${context.lang.report} ${from.day} ${months[from.month - 1]} - ${to.day} ${months[to.month - 1]} ${to.year}'; + } +} diff --git a/lib/presentation/pages/sales/widgets/sales_payment_method_card.dart b/lib/presentation/pages/sales/widgets/sales_payment_method_card.dart new file mode 100644 index 0000000..82ed155 --- /dev/null +++ b/lib/presentation/pages/sales/widgets/sales_payment_method_card.dart @@ -0,0 +1,265 @@ +import 'package:flutter/material.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../../common/extension/extension.dart'; +import '../../../../common/theme/theme.dart'; +import '../../../../domain/analytic/analytic.dart'; +import '../../../components/spacer/spacer.dart'; + +class SalesPaymentMethodCard extends StatelessWidget { + final PaymentMethodAnalytic paymentMethodAnalytic; + final bool isFetching; + + const SalesPaymentMethodCard({ + super.key, + required this.paymentMethodAnalytic, + required this.isFetching, + }); + + @override + Widget build(BuildContext context) { + if (isFetching) return _buildShimmer(); + + final data = paymentMethodAnalytic.data; + final totalTransactions = paymentMethodAnalytic.summary.totalOrders; + + return Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: AppColor.surface, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.04), + blurRadius: 10, + offset: const Offset(0, 2), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title row + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + context.lang.payment_methods, + style: AppStyle.xl.copyWith( + fontWeight: FontWeight.bold, + color: AppColor.textPrimary, + fontSize: 18, + ), + ), + Text( + '$totalTransactions ${context.lang.transactions.toLowerCase()}', + style: AppStyle.sm.copyWith( + color: AppColor.textSecondary, + fontWeight: FontWeight.w500, + fontSize: 13, + ), + ), + ], + ), + const SpaceHeight(16), + + // Payment method items + if (data.isEmpty) + Center( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 20), + child: Text( + context.lang.no_data_available, + style: AppStyle.md.copyWith(color: AppColor.textSecondary), + ), + ), + ) + else + ...data.asMap().entries.map((entry) { + final index = entry.key; + final item = entry.value; + return Column( + children: [ + _buildPaymentMethodItem(item, index), + if (index < data.length - 1) const SpaceHeight(16), + ], + ); + }), + ], + ), + ); + } + + Widget _buildPaymentMethodItem(PaymentMethodItem item, int index) { + final colors = [ + AppColor.primary, + const Color(0xFF00BCD4), + const Color(0xFFFF9800), + AppColor.success, + AppColor.info, + ]; + final color = colors[index % colors.length]; + + return Column( + children: [ + // Name + count + amount + percentage + Row( + children: [ + // Name + Expanded( + child: Row( + children: [ + Text( + item.paymentMethodName, + style: AppStyle.md.copyWith( + color: AppColor.textPrimary, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + ), + const SpaceWidth(8), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 2, + ), + decoration: BoxDecoration( + color: AppColor.textSecondary.withOpacity(0.1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + '${item.paymentCount}x', + style: AppStyle.xs.copyWith( + color: AppColor.textSecondary, + fontWeight: FontWeight.w600, + fontSize: 12, + ), + ), + ), + ], + ), + ), + // Amount + Text( + item.totalAmount.toInt().currencyFormatRp, + style: AppStyle.md.copyWith( + color: AppColor.textPrimary, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + ), + const SpaceWidth(6), + // Percentage + Text( + '${item.percentage.toStringAsFixed(1)}%', + style: AppStyle.xs.copyWith( + color: AppColor.textSecondary, + fontWeight: FontWeight.w500, + fontSize: 12, + ), + ), + ], + ), + const SpaceHeight(8), + // Progress bar + ClipRRect( + borderRadius: BorderRadius.circular(4), + child: LinearProgressIndicator( + value: item.percentage / 100, + minHeight: 6, + backgroundColor: AppColor.border.withOpacity(0.3), + valueColor: AlwaysStoppedAnimation(color), + ), + ), + ], + ); + } + + Widget _buildShimmer() { + return Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: AppColor.surface, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.04), + blurRadius: 10, + offset: const Offset(0, 2), + ), + ], + ), + child: Shimmer.fromColors( + baseColor: Colors.grey[300]!, + highlightColor: Colors.grey[100]!, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 150, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + Container( + width: 80, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + ], + ), + const SpaceHeight(20), + ...List.generate( + 3, + (index) => Padding( + padding: const EdgeInsets.only(bottom: 16), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 120, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + Container( + width: 90, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + ], + ), + const SpaceHeight(8), + Container( + width: double.infinity, + height: 6, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/presentation/pages/sales/widgets/sales_rincian_card.dart b/lib/presentation/pages/sales/widgets/sales_rincian_card.dart new file mode 100644 index 0000000..38d72f8 --- /dev/null +++ b/lib/presentation/pages/sales/widgets/sales_rincian_card.dart @@ -0,0 +1,165 @@ +import 'package:flutter/material.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../../application/analytic/sales_loader/sales_loader_bloc.dart'; +import '../../../../common/extension/extension.dart'; +import '../../../../common/theme/theme.dart'; +import '../../../components/spacer/spacer.dart'; + +class SalesRincianCard extends StatelessWidget { + final SalesLoaderState state; + + const SalesRincianCard({super.key, required this.state}); + + @override + Widget build(BuildContext context) { + if (state.isFetching) return _buildShimmer(); + + final summary = state.sales.summary; + + return Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: AppColor.surface, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.04), + blurRadius: 10, + offset: const Offset(0, 2), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.lang.daily_breakdown, + style: AppStyle.xl.copyWith( + fontWeight: FontWeight.bold, + color: AppColor.textPrimary, + fontSize: 18, + ), + ), + const SpaceHeight(16), + _buildRow( + context.lang.gross_sales, + summary.totalSales.currencyFormatRp, + ), + _buildDivider(), + _buildRow( + context.lang.discount, + summary.totalDiscount.currencyFormatRp, + ), + _buildDivider(), + _buildRow(context.lang.tax, summary.totalTax.currencyFormatRp), + _buildDivider(), + _buildRow('Biaya layanan', 0.currencyFormatRp), + _buildDivider(), + _buildRow( + context.lang.net_sales, + summary.netSales.currencyFormatRp, + isBold: true, + ), + ], + ), + ); + } + + Widget _buildRow(String label, String value, {bool isBold = false}) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 14), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + label, + style: AppStyle.md.copyWith( + color: isBold ? AppColor.textPrimary : AppColor.textSecondary, + fontWeight: isBold ? FontWeight.w700 : FontWeight.w500, + fontSize: 14, + ), + ), + Text( + value, + style: AppStyle.md.copyWith( + color: AppColor.textPrimary, + fontWeight: isBold ? FontWeight.w700 : FontWeight.w600, + fontSize: 14, + ), + ), + ], + ), + ); + } + + Widget _buildDivider() { + return Divider( + height: 1, + thickness: 1, + color: AppColor.border.withOpacity(0.5), + ); + } + + Widget _buildShimmer() { + return Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: AppColor.surface, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.04), + blurRadius: 10, + offset: const Offset(0, 2), + ), + ], + ), + child: Shimmer.fromColors( + baseColor: Colors.grey[300]!, + highlightColor: Colors.grey[100]!, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 140, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + const SpaceHeight(20), + ...List.generate( + 5, + (index) => Padding( + padding: const EdgeInsets.only(bottom: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 100, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + Container( + width: 80, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/presentation/pages/sales/widgets/sales_top_products_card.dart b/lib/presentation/pages/sales/widgets/sales_top_products_card.dart new file mode 100644 index 0000000..88cc8bf --- /dev/null +++ b/lib/presentation/pages/sales/widgets/sales_top_products_card.dart @@ -0,0 +1,288 @@ +import 'package:flutter/material.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../../../common/extension/extension.dart'; +import '../../../../common/theme/theme.dart'; +import '../../../../domain/analytic/analytic.dart'; +import '../../../components/spacer/spacer.dart'; +import 'product_detail_bottom_sheet.dart'; + +class SalesTopProductsCard extends StatelessWidget { + final ProductAnalytic productAnalytic; + final bool isFetching; + + const SalesTopProductsCard({ + super.key, + required this.productAnalytic, + required this.isFetching, + }); + + @override + Widget build(BuildContext context) { + if (isFetching) return _buildShimmer(); + + final data = productAnalytic.data; + + return Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: AppColor.surface, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.04), + blurRadius: 10, + offset: const Offset(0, 2), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title row + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + context.lang.best_selling_products, + style: AppStyle.xl.copyWith( + fontWeight: FontWeight.bold, + color: AppColor.textPrimary, + fontSize: 18, + ), + ), + Text( + '${data.length} ${context.lang.product.toLowerCase()}', + style: AppStyle.sm.copyWith( + color: AppColor.textSecondary, + fontWeight: FontWeight.w500, + fontSize: 13, + ), + ), + ], + ), + const SpaceHeight(16), + + // Product list + if (data.isEmpty) + Center( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 20), + child: Text( + context.lang.no_data_available, + style: AppStyle.md.copyWith(color: AppColor.textSecondary), + ), + ), + ) + else + ...data.asMap().entries.map((entry) { + final index = entry.key; + final item = entry.value; + return Column( + children: [ + _buildProductItem(context, item, index + 1), + if (index < data.length - 1) + const Divider(height: 1, thickness: 0.5), + ], + ); + }), + ], + ), + ); + } + + Widget _buildProductItem( + BuildContext context, + ProductAnalyticData item, + int rank, + ) { + final isTopThree = rank <= 3; + final totalRevenue = productAnalytic.data.fold( + 0, + (sum, e) => sum + e.revenue, + ); + + return GestureDetector( + onTap: () => ProductDetailBottomSheet.show( + context: context, + product: item, + totalRevenue: totalRevenue, + ), + behavior: HitTestBehavior.opaque, + child: _buildProductItemContent(context, item, rank, isTopThree), + ); + } + + Widget _buildProductItemContent( + BuildContext context, + ProductAnalyticData item, + int rank, + bool isTopThree, + ) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: Row( + children: [ + // Rank badge + Container( + width: 36, + height: 36, + decoration: BoxDecoration( + color: isTopThree + ? AppColor.primary.withOpacity(0.1) + : AppColor.textSecondary.withOpacity(0.08), + shape: BoxShape.circle, + ), + alignment: Alignment.center, + child: Text( + '$rank', + style: AppStyle.md.copyWith( + color: isTopThree ? AppColor.primary : AppColor.textSecondary, + fontWeight: FontWeight.w700, + fontSize: 14, + ), + ), + ), + const SpaceWidth(12), + + // Product name + sold count + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + item.productName.toUpperCase(), + style: AppStyle.md.copyWith( + color: AppColor.textPrimary, + fontWeight: FontWeight.w700, + fontSize: 14, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + const SizedBox(height: 2), + Text( + '${item.quantitySold} ${context.lang.sold.toLowerCase()}', + style: AppStyle.sm.copyWith( + color: AppColor.textSecondary, + fontWeight: FontWeight.w400, + fontSize: 12, + ), + ), + ], + ), + ), + + // Revenue + Text( + item.revenue.currencyFormatRp, + style: AppStyle.md.copyWith( + color: AppColor.textPrimary, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + ), + ], + ), + ); + } + + Widget _buildShimmer() { + return Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + color: AppColor.surface, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.04), + blurRadius: 10, + offset: const Offset(0, 2), + ), + ], + ), + child: Shimmer.fromColors( + baseColor: Colors.grey[300]!, + highlightColor: Colors.grey[100]!, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 140, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + Container( + width: 70, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + ], + ), + const SpaceHeight(20), + ...List.generate( + 6, + (index) => Padding( + padding: const EdgeInsets.only(bottom: 16), + child: Row( + children: [ + Container( + width: 36, + height: 36, + decoration: const BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + ), + ), + const SpaceWidth(12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 150, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + const SizedBox(height: 4), + Container( + width: 60, + height: 12, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + ], + ), + ), + Container( + width: 80, + height: 14, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/presentation/pages/sales/widgets/summary_card.dart b/lib/presentation/pages/sales/widgets/summary_card.dart deleted file mode 100644 index f8908ce..0000000 --- a/lib/presentation/pages/sales/widgets/summary_card.dart +++ /dev/null @@ -1,101 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../../../../common/theme/theme.dart'; - -class SalesSummaryCard extends StatelessWidget { - const SalesSummaryCard({ - super.key, - required this.fadeAnimation, - required this.title, - required this.value, - required this.icon, - required this.color, - required this.delay, - }); - - final Animation fadeAnimation; - final String title; - final String value; - final IconData icon; - final Color color; - final int delay; - - @override - Widget build(BuildContext context) { - return TweenAnimationBuilder( - tween: Tween(begin: 0.0, end: 1.0), - duration: Duration(milliseconds: 800 + delay), - curve: Curves.easeOutBack, - builder: (context, animValue, child) { - return Transform.scale( - scale: animValue, - child: Container( - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: AppColor.surface, - borderRadius: BorderRadius.circular(12), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.05), - blurRadius: 8, - offset: const Offset(0, 2), - ), - ], - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - TweenAnimationBuilder( - tween: Tween(begin: 0.0, end: 1.0), - duration: Duration(milliseconds: 1000 + delay), - curve: Curves.bounceOut, - builder: (context, iconValue, child) { - return Transform.scale( - scale: iconValue, - child: Container( - padding: const EdgeInsets.all(8), - decoration: BoxDecoration( - color: color.withOpacity(0.1), - borderRadius: BorderRadius.circular(8), - ), - child: Icon(icon, color: color, size: 20), - ), - ); - }, - ), - const Spacer(), - ], - ), - const SizedBox(height: 12), - Text( - title, - style: AppStyle.sm.copyWith( - color: AppColor.textSecondary, - fontSize: 12, - fontWeight: FontWeight.w500, - ), - ), - const SizedBox(height: 4), - AnimatedBuilder( - animation: fadeAnimation, - builder: (context, child) { - return Text( - value, - style: AppStyle.xl.copyWith( - color: AppColor.textPrimary, - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ); - }, - ), - ], - ), - ), - ); - }, - ); - } -}