diff --git a/android/local.properties b/android/local.properties index ece0184..e077d9b 100644 --- a/android/local.properties +++ b/android/local.properties @@ -1,5 +1,5 @@ sdk.dir=C:/Users/Housh11/AppData/Local/Android/Sdk flutter.sdk=C:\\src\\flutter flutter.buildMode=release -flutter.versionName=1.3.19 -flutter.versionCode=16 \ No newline at end of file +flutter.versionName=1.3.20 +flutter.versionCode=17 \ No newline at end of file diff --git a/assets/icons/cube_card_free.svg b/assets/icons/cube_card_free.svg index 1b83d9b..abbff61 100644 --- a/assets/icons/cube_card_free.svg +++ b/assets/icons/cube_card_free.svg @@ -1,5 +1,5 @@ - + - diff --git a/assets/vec/cube_card_free.svg.vec b/assets/vec/cube_card_free.svg.vec index 83a9b97..d633908 100644 Binary files a/assets/vec/cube_card_free.svg.vec and b/assets/vec/cube_card_free.svg.vec differ diff --git a/doc/inner_splash.webp b/doc/inner_splash.webp new file mode 100644 index 0000000..2744801 Binary files /dev/null and b/doc/inner_splash.webp differ diff --git a/packages/chicken/lib/data/data_source/remote/chicken/chicken_remote.dart b/packages/chicken/lib/data/data_source/remote/chicken/chicken_remote.dart index 142e638..d9f9260 100644 --- a/packages/chicken/lib/data/data_source/remote/chicken/chicken_remote.dart +++ b/packages/chicken/lib/data/data_source/remote/chicken/chicken_remote.dart @@ -19,6 +19,7 @@ import 'package:rasadyar_chicken/data/models/response/segmentation_model/segment import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart'; +import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart'; import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart'; import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart' hide ProductModel; @@ -156,4 +157,8 @@ abstract class ChickenRemoteDatasource { Future getBroadcastPrice({required String token}); + Future getStewardSalesInfoDashboard({ + required String token, + Map? queryParameters, + }); } diff --git a/packages/chicken/lib/data/data_source/remote/chicken/chicken_remote_imp.dart b/packages/chicken/lib/data/data_source/remote/chicken/chicken_remote_imp.dart index ab0acdd..3a2d7e3 100644 --- a/packages/chicken/lib/data/data_source/remote/chicken/chicken_remote_imp.dart +++ b/packages/chicken/lib/data/data_source/remote/chicken/chicken_remote_imp.dart @@ -19,6 +19,7 @@ import 'package:rasadyar_chicken/data/models/response/segmentation_model/segment import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart'; +import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart'; import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart'; import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart' hide ProductModel; @@ -494,4 +495,19 @@ class ChickenRemoteDatasourceImp implements ChickenRemoteDatasource { return res.data; } + + @override + Future getStewardSalesInfoDashboard({ + required String token, + Map? queryParameters, + }) async { + var res = await _httpClient.get( + '/steward-sales-info-dashboard/', + queryParameters: queryParameters, + headers: {'Authorization': 'Bearer $token'}, + fromJson: (json) => StewardSalesInfoDashboard.fromJson(json), + ); + + return res.data; + } } diff --git a/packages/chicken/lib/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart b/packages/chicken/lib/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart new file mode 100644 index 0000000..a428f7f --- /dev/null +++ b/packages/chicken/lib/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart @@ -0,0 +1,28 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'steward_sales_info_dashboard.freezed.dart'; +part 'steward_sales_info_dashboard.g.dart'; + +@freezed +abstract class StewardSalesInfoDashboard with _$StewardSalesInfoDashboard { + const factory StewardSalesInfoDashboard({ + double? totalGovernmentalInputWeight, + double? totalFreeInputWeight, + double? totalGovernmentalOutputWeight, + double? totalFreeOutputWeight, + double? totalGovernmentalRemainWeight, + double? totalFreeRemainWeight, + double? totalStewardFreeSaleBarCarcassesWeight, + double? totalStewardInProvinceAllocationsWeight, + double? segmentationsWeight, + double? totalSellingInProvinceGovernmentalWeight, + double? totalSellingInProvinceFreeWeight, + double? totalCommitmentSellingInProvinceGovernmentalWeight, + double? totalCommitmentSellingInProvinceGovernmentalRemainWeight, + double? totalCommitmentSellingInProvinceFreeWeight, + double? totalCommitmentSellingInProvinceFreeRemainWeight, + }) = _StewardSalesInfoDashboard; + + factory StewardSalesInfoDashboard.fromJson(Map json) => + _$StewardSalesInfoDashboardFromJson(json); +} diff --git a/packages/chicken/lib/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.freezed.dart b/packages/chicken/lib/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.freezed.dart new file mode 100644 index 0000000..5e4404e --- /dev/null +++ b/packages/chicken/lib/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.freezed.dart @@ -0,0 +1,319 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'steward_sales_info_dashboard.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$StewardSalesInfoDashboard { + + double? get totalGovernmentalInputWeight; double? get totalFreeInputWeight; double? get totalGovernmentalOutputWeight; double? get totalFreeOutputWeight; double? get totalGovernmentalRemainWeight; double? get totalFreeRemainWeight; double? get totalStewardFreeSaleBarCarcassesWeight; double? get totalStewardInProvinceAllocationsWeight; double? get segmentationsWeight; double? get totalSellingInProvinceGovernmentalWeight; double? get totalSellingInProvinceFreeWeight; double? get totalCommitmentSellingInProvinceGovernmentalWeight; double? get totalCommitmentSellingInProvinceGovernmentalRemainWeight; double? get totalCommitmentSellingInProvinceFreeWeight; double? get totalCommitmentSellingInProvinceFreeRemainWeight; +/// Create a copy of StewardSalesInfoDashboard +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$StewardSalesInfoDashboardCopyWith get copyWith => _$StewardSalesInfoDashboardCopyWithImpl(this as StewardSalesInfoDashboard, _$identity); + + /// Serializes this StewardSalesInfoDashboard to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is StewardSalesInfoDashboard&&(identical(other.totalGovernmentalInputWeight, totalGovernmentalInputWeight) || other.totalGovernmentalInputWeight == totalGovernmentalInputWeight)&&(identical(other.totalFreeInputWeight, totalFreeInputWeight) || other.totalFreeInputWeight == totalFreeInputWeight)&&(identical(other.totalGovernmentalOutputWeight, totalGovernmentalOutputWeight) || other.totalGovernmentalOutputWeight == totalGovernmentalOutputWeight)&&(identical(other.totalFreeOutputWeight, totalFreeOutputWeight) || other.totalFreeOutputWeight == totalFreeOutputWeight)&&(identical(other.totalGovernmentalRemainWeight, totalGovernmentalRemainWeight) || other.totalGovernmentalRemainWeight == totalGovernmentalRemainWeight)&&(identical(other.totalFreeRemainWeight, totalFreeRemainWeight) || other.totalFreeRemainWeight == totalFreeRemainWeight)&&(identical(other.totalStewardFreeSaleBarCarcassesWeight, totalStewardFreeSaleBarCarcassesWeight) || other.totalStewardFreeSaleBarCarcassesWeight == totalStewardFreeSaleBarCarcassesWeight)&&(identical(other.totalStewardInProvinceAllocationsWeight, totalStewardInProvinceAllocationsWeight) || other.totalStewardInProvinceAllocationsWeight == totalStewardInProvinceAllocationsWeight)&&(identical(other.segmentationsWeight, segmentationsWeight) || other.segmentationsWeight == segmentationsWeight)&&(identical(other.totalSellingInProvinceGovernmentalWeight, totalSellingInProvinceGovernmentalWeight) || other.totalSellingInProvinceGovernmentalWeight == totalSellingInProvinceGovernmentalWeight)&&(identical(other.totalSellingInProvinceFreeWeight, totalSellingInProvinceFreeWeight) || other.totalSellingInProvinceFreeWeight == totalSellingInProvinceFreeWeight)&&(identical(other.totalCommitmentSellingInProvinceGovernmentalWeight, totalCommitmentSellingInProvinceGovernmentalWeight) || other.totalCommitmentSellingInProvinceGovernmentalWeight == totalCommitmentSellingInProvinceGovernmentalWeight)&&(identical(other.totalCommitmentSellingInProvinceGovernmentalRemainWeight, totalCommitmentSellingInProvinceGovernmentalRemainWeight) || other.totalCommitmentSellingInProvinceGovernmentalRemainWeight == totalCommitmentSellingInProvinceGovernmentalRemainWeight)&&(identical(other.totalCommitmentSellingInProvinceFreeWeight, totalCommitmentSellingInProvinceFreeWeight) || other.totalCommitmentSellingInProvinceFreeWeight == totalCommitmentSellingInProvinceFreeWeight)&&(identical(other.totalCommitmentSellingInProvinceFreeRemainWeight, totalCommitmentSellingInProvinceFreeRemainWeight) || other.totalCommitmentSellingInProvinceFreeRemainWeight == totalCommitmentSellingInProvinceFreeRemainWeight)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,totalGovernmentalInputWeight,totalFreeInputWeight,totalGovernmentalOutputWeight,totalFreeOutputWeight,totalGovernmentalRemainWeight,totalFreeRemainWeight,totalStewardFreeSaleBarCarcassesWeight,totalStewardInProvinceAllocationsWeight,segmentationsWeight,totalSellingInProvinceGovernmentalWeight,totalSellingInProvinceFreeWeight,totalCommitmentSellingInProvinceGovernmentalWeight,totalCommitmentSellingInProvinceGovernmentalRemainWeight,totalCommitmentSellingInProvinceFreeWeight,totalCommitmentSellingInProvinceFreeRemainWeight); + +@override +String toString() { + return 'StewardSalesInfoDashboard(totalGovernmentalInputWeight: $totalGovernmentalInputWeight, totalFreeInputWeight: $totalFreeInputWeight, totalGovernmentalOutputWeight: $totalGovernmentalOutputWeight, totalFreeOutputWeight: $totalFreeOutputWeight, totalGovernmentalRemainWeight: $totalGovernmentalRemainWeight, totalFreeRemainWeight: $totalFreeRemainWeight, totalStewardFreeSaleBarCarcassesWeight: $totalStewardFreeSaleBarCarcassesWeight, totalStewardInProvinceAllocationsWeight: $totalStewardInProvinceAllocationsWeight, segmentationsWeight: $segmentationsWeight, totalSellingInProvinceGovernmentalWeight: $totalSellingInProvinceGovernmentalWeight, totalSellingInProvinceFreeWeight: $totalSellingInProvinceFreeWeight, totalCommitmentSellingInProvinceGovernmentalWeight: $totalCommitmentSellingInProvinceGovernmentalWeight, totalCommitmentSellingInProvinceGovernmentalRemainWeight: $totalCommitmentSellingInProvinceGovernmentalRemainWeight, totalCommitmentSellingInProvinceFreeWeight: $totalCommitmentSellingInProvinceFreeWeight, totalCommitmentSellingInProvinceFreeRemainWeight: $totalCommitmentSellingInProvinceFreeRemainWeight)'; +} + + +} + +/// @nodoc +abstract mixin class $StewardSalesInfoDashboardCopyWith<$Res> { + factory $StewardSalesInfoDashboardCopyWith(StewardSalesInfoDashboard value, $Res Function(StewardSalesInfoDashboard) _then) = _$StewardSalesInfoDashboardCopyWithImpl; +@useResult +$Res call({ + double? totalGovernmentalInputWeight, double? totalFreeInputWeight, double? totalGovernmentalOutputWeight, double? totalFreeOutputWeight, double? totalGovernmentalRemainWeight, double? totalFreeRemainWeight, double? totalStewardFreeSaleBarCarcassesWeight, double? totalStewardInProvinceAllocationsWeight, double? segmentationsWeight, double? totalSellingInProvinceGovernmentalWeight, double? totalSellingInProvinceFreeWeight, double? totalCommitmentSellingInProvinceGovernmentalWeight, double? totalCommitmentSellingInProvinceGovernmentalRemainWeight, double? totalCommitmentSellingInProvinceFreeWeight, double? totalCommitmentSellingInProvinceFreeRemainWeight +}); + + + + +} +/// @nodoc +class _$StewardSalesInfoDashboardCopyWithImpl<$Res> + implements $StewardSalesInfoDashboardCopyWith<$Res> { + _$StewardSalesInfoDashboardCopyWithImpl(this._self, this._then); + + final StewardSalesInfoDashboard _self; + final $Res Function(StewardSalesInfoDashboard) _then; + +/// Create a copy of StewardSalesInfoDashboard +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? totalGovernmentalInputWeight = freezed,Object? totalFreeInputWeight = freezed,Object? totalGovernmentalOutputWeight = freezed,Object? totalFreeOutputWeight = freezed,Object? totalGovernmentalRemainWeight = freezed,Object? totalFreeRemainWeight = freezed,Object? totalStewardFreeSaleBarCarcassesWeight = freezed,Object? totalStewardInProvinceAllocationsWeight = freezed,Object? segmentationsWeight = freezed,Object? totalSellingInProvinceGovernmentalWeight = freezed,Object? totalSellingInProvinceFreeWeight = freezed,Object? totalCommitmentSellingInProvinceGovernmentalWeight = freezed,Object? totalCommitmentSellingInProvinceGovernmentalRemainWeight = freezed,Object? totalCommitmentSellingInProvinceFreeWeight = freezed,Object? totalCommitmentSellingInProvinceFreeRemainWeight = freezed,}) { + return _then(_self.copyWith( +totalGovernmentalInputWeight: freezed == totalGovernmentalInputWeight ? _self.totalGovernmentalInputWeight : totalGovernmentalInputWeight // ignore: cast_nullable_to_non_nullable +as double?,totalFreeInputWeight: freezed == totalFreeInputWeight ? _self.totalFreeInputWeight : totalFreeInputWeight // ignore: cast_nullable_to_non_nullable +as double?,totalGovernmentalOutputWeight: freezed == totalGovernmentalOutputWeight ? _self.totalGovernmentalOutputWeight : totalGovernmentalOutputWeight // ignore: cast_nullable_to_non_nullable +as double?,totalFreeOutputWeight: freezed == totalFreeOutputWeight ? _self.totalFreeOutputWeight : totalFreeOutputWeight // ignore: cast_nullable_to_non_nullable +as double?,totalGovernmentalRemainWeight: freezed == totalGovernmentalRemainWeight ? _self.totalGovernmentalRemainWeight : totalGovernmentalRemainWeight // ignore: cast_nullable_to_non_nullable +as double?,totalFreeRemainWeight: freezed == totalFreeRemainWeight ? _self.totalFreeRemainWeight : totalFreeRemainWeight // ignore: cast_nullable_to_non_nullable +as double?,totalStewardFreeSaleBarCarcassesWeight: freezed == totalStewardFreeSaleBarCarcassesWeight ? _self.totalStewardFreeSaleBarCarcassesWeight : totalStewardFreeSaleBarCarcassesWeight // ignore: cast_nullable_to_non_nullable +as double?,totalStewardInProvinceAllocationsWeight: freezed == totalStewardInProvinceAllocationsWeight ? _self.totalStewardInProvinceAllocationsWeight : totalStewardInProvinceAllocationsWeight // ignore: cast_nullable_to_non_nullable +as double?,segmentationsWeight: freezed == segmentationsWeight ? _self.segmentationsWeight : segmentationsWeight // ignore: cast_nullable_to_non_nullable +as double?,totalSellingInProvinceGovernmentalWeight: freezed == totalSellingInProvinceGovernmentalWeight ? _self.totalSellingInProvinceGovernmentalWeight : totalSellingInProvinceGovernmentalWeight // ignore: cast_nullable_to_non_nullable +as double?,totalSellingInProvinceFreeWeight: freezed == totalSellingInProvinceFreeWeight ? _self.totalSellingInProvinceFreeWeight : totalSellingInProvinceFreeWeight // ignore: cast_nullable_to_non_nullable +as double?,totalCommitmentSellingInProvinceGovernmentalWeight: freezed == totalCommitmentSellingInProvinceGovernmentalWeight ? _self.totalCommitmentSellingInProvinceGovernmentalWeight : totalCommitmentSellingInProvinceGovernmentalWeight // ignore: cast_nullable_to_non_nullable +as double?,totalCommitmentSellingInProvinceGovernmentalRemainWeight: freezed == totalCommitmentSellingInProvinceGovernmentalRemainWeight ? _self.totalCommitmentSellingInProvinceGovernmentalRemainWeight : totalCommitmentSellingInProvinceGovernmentalRemainWeight // ignore: cast_nullable_to_non_nullable +as double?,totalCommitmentSellingInProvinceFreeWeight: freezed == totalCommitmentSellingInProvinceFreeWeight ? _self.totalCommitmentSellingInProvinceFreeWeight : totalCommitmentSellingInProvinceFreeWeight // ignore: cast_nullable_to_non_nullable +as double?,totalCommitmentSellingInProvinceFreeRemainWeight: freezed == totalCommitmentSellingInProvinceFreeRemainWeight ? _self.totalCommitmentSellingInProvinceFreeRemainWeight : totalCommitmentSellingInProvinceFreeRemainWeight // ignore: cast_nullable_to_non_nullable +as double?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [StewardSalesInfoDashboard]. +extension StewardSalesInfoDashboardPatterns on StewardSalesInfoDashboard { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _StewardSalesInfoDashboard value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _StewardSalesInfoDashboard() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _StewardSalesInfoDashboard value) $default,){ +final _that = this; +switch (_that) { +case _StewardSalesInfoDashboard(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _StewardSalesInfoDashboard value)? $default,){ +final _that = this; +switch (_that) { +case _StewardSalesInfoDashboard() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( double? totalGovernmentalInputWeight, double? totalFreeInputWeight, double? totalGovernmentalOutputWeight, double? totalFreeOutputWeight, double? totalGovernmentalRemainWeight, double? totalFreeRemainWeight, double? totalStewardFreeSaleBarCarcassesWeight, double? totalStewardInProvinceAllocationsWeight, double? segmentationsWeight, double? totalSellingInProvinceGovernmentalWeight, double? totalSellingInProvinceFreeWeight, double? totalCommitmentSellingInProvinceGovernmentalWeight, double? totalCommitmentSellingInProvinceGovernmentalRemainWeight, double? totalCommitmentSellingInProvinceFreeWeight, double? totalCommitmentSellingInProvinceFreeRemainWeight)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _StewardSalesInfoDashboard() when $default != null: +return $default(_that.totalGovernmentalInputWeight,_that.totalFreeInputWeight,_that.totalGovernmentalOutputWeight,_that.totalFreeOutputWeight,_that.totalGovernmentalRemainWeight,_that.totalFreeRemainWeight,_that.totalStewardFreeSaleBarCarcassesWeight,_that.totalStewardInProvinceAllocationsWeight,_that.segmentationsWeight,_that.totalSellingInProvinceGovernmentalWeight,_that.totalSellingInProvinceFreeWeight,_that.totalCommitmentSellingInProvinceGovernmentalWeight,_that.totalCommitmentSellingInProvinceGovernmentalRemainWeight,_that.totalCommitmentSellingInProvinceFreeWeight,_that.totalCommitmentSellingInProvinceFreeRemainWeight);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( double? totalGovernmentalInputWeight, double? totalFreeInputWeight, double? totalGovernmentalOutputWeight, double? totalFreeOutputWeight, double? totalGovernmentalRemainWeight, double? totalFreeRemainWeight, double? totalStewardFreeSaleBarCarcassesWeight, double? totalStewardInProvinceAllocationsWeight, double? segmentationsWeight, double? totalSellingInProvinceGovernmentalWeight, double? totalSellingInProvinceFreeWeight, double? totalCommitmentSellingInProvinceGovernmentalWeight, double? totalCommitmentSellingInProvinceGovernmentalRemainWeight, double? totalCommitmentSellingInProvinceFreeWeight, double? totalCommitmentSellingInProvinceFreeRemainWeight) $default,) {final _that = this; +switch (_that) { +case _StewardSalesInfoDashboard(): +return $default(_that.totalGovernmentalInputWeight,_that.totalFreeInputWeight,_that.totalGovernmentalOutputWeight,_that.totalFreeOutputWeight,_that.totalGovernmentalRemainWeight,_that.totalFreeRemainWeight,_that.totalStewardFreeSaleBarCarcassesWeight,_that.totalStewardInProvinceAllocationsWeight,_that.segmentationsWeight,_that.totalSellingInProvinceGovernmentalWeight,_that.totalSellingInProvinceFreeWeight,_that.totalCommitmentSellingInProvinceGovernmentalWeight,_that.totalCommitmentSellingInProvinceGovernmentalRemainWeight,_that.totalCommitmentSellingInProvinceFreeWeight,_that.totalCommitmentSellingInProvinceFreeRemainWeight);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( double? totalGovernmentalInputWeight, double? totalFreeInputWeight, double? totalGovernmentalOutputWeight, double? totalFreeOutputWeight, double? totalGovernmentalRemainWeight, double? totalFreeRemainWeight, double? totalStewardFreeSaleBarCarcassesWeight, double? totalStewardInProvinceAllocationsWeight, double? segmentationsWeight, double? totalSellingInProvinceGovernmentalWeight, double? totalSellingInProvinceFreeWeight, double? totalCommitmentSellingInProvinceGovernmentalWeight, double? totalCommitmentSellingInProvinceGovernmentalRemainWeight, double? totalCommitmentSellingInProvinceFreeWeight, double? totalCommitmentSellingInProvinceFreeRemainWeight)? $default,) {final _that = this; +switch (_that) { +case _StewardSalesInfoDashboard() when $default != null: +return $default(_that.totalGovernmentalInputWeight,_that.totalFreeInputWeight,_that.totalGovernmentalOutputWeight,_that.totalFreeOutputWeight,_that.totalGovernmentalRemainWeight,_that.totalFreeRemainWeight,_that.totalStewardFreeSaleBarCarcassesWeight,_that.totalStewardInProvinceAllocationsWeight,_that.segmentationsWeight,_that.totalSellingInProvinceGovernmentalWeight,_that.totalSellingInProvinceFreeWeight,_that.totalCommitmentSellingInProvinceGovernmentalWeight,_that.totalCommitmentSellingInProvinceGovernmentalRemainWeight,_that.totalCommitmentSellingInProvinceFreeWeight,_that.totalCommitmentSellingInProvinceFreeRemainWeight);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _StewardSalesInfoDashboard implements StewardSalesInfoDashboard { + const _StewardSalesInfoDashboard({this.totalGovernmentalInputWeight, this.totalFreeInputWeight, this.totalGovernmentalOutputWeight, this.totalFreeOutputWeight, this.totalGovernmentalRemainWeight, this.totalFreeRemainWeight, this.totalStewardFreeSaleBarCarcassesWeight, this.totalStewardInProvinceAllocationsWeight, this.segmentationsWeight, this.totalSellingInProvinceGovernmentalWeight, this.totalSellingInProvinceFreeWeight, this.totalCommitmentSellingInProvinceGovernmentalWeight, this.totalCommitmentSellingInProvinceGovernmentalRemainWeight, this.totalCommitmentSellingInProvinceFreeWeight, this.totalCommitmentSellingInProvinceFreeRemainWeight}); + factory _StewardSalesInfoDashboard.fromJson(Map json) => _$StewardSalesInfoDashboardFromJson(json); + +@override final double? totalGovernmentalInputWeight; +@override final double? totalFreeInputWeight; +@override final double? totalGovernmentalOutputWeight; +@override final double? totalFreeOutputWeight; +@override final double? totalGovernmentalRemainWeight; +@override final double? totalFreeRemainWeight; +@override final double? totalStewardFreeSaleBarCarcassesWeight; +@override final double? totalStewardInProvinceAllocationsWeight; +@override final double? segmentationsWeight; +@override final double? totalSellingInProvinceGovernmentalWeight; +@override final double? totalSellingInProvinceFreeWeight; +@override final double? totalCommitmentSellingInProvinceGovernmentalWeight; +@override final double? totalCommitmentSellingInProvinceGovernmentalRemainWeight; +@override final double? totalCommitmentSellingInProvinceFreeWeight; +@override final double? totalCommitmentSellingInProvinceFreeRemainWeight; + +/// Create a copy of StewardSalesInfoDashboard +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$StewardSalesInfoDashboardCopyWith<_StewardSalesInfoDashboard> get copyWith => __$StewardSalesInfoDashboardCopyWithImpl<_StewardSalesInfoDashboard>(this, _$identity); + +@override +Map toJson() { + return _$StewardSalesInfoDashboardToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _StewardSalesInfoDashboard&&(identical(other.totalGovernmentalInputWeight, totalGovernmentalInputWeight) || other.totalGovernmentalInputWeight == totalGovernmentalInputWeight)&&(identical(other.totalFreeInputWeight, totalFreeInputWeight) || other.totalFreeInputWeight == totalFreeInputWeight)&&(identical(other.totalGovernmentalOutputWeight, totalGovernmentalOutputWeight) || other.totalGovernmentalOutputWeight == totalGovernmentalOutputWeight)&&(identical(other.totalFreeOutputWeight, totalFreeOutputWeight) || other.totalFreeOutputWeight == totalFreeOutputWeight)&&(identical(other.totalGovernmentalRemainWeight, totalGovernmentalRemainWeight) || other.totalGovernmentalRemainWeight == totalGovernmentalRemainWeight)&&(identical(other.totalFreeRemainWeight, totalFreeRemainWeight) || other.totalFreeRemainWeight == totalFreeRemainWeight)&&(identical(other.totalStewardFreeSaleBarCarcassesWeight, totalStewardFreeSaleBarCarcassesWeight) || other.totalStewardFreeSaleBarCarcassesWeight == totalStewardFreeSaleBarCarcassesWeight)&&(identical(other.totalStewardInProvinceAllocationsWeight, totalStewardInProvinceAllocationsWeight) || other.totalStewardInProvinceAllocationsWeight == totalStewardInProvinceAllocationsWeight)&&(identical(other.segmentationsWeight, segmentationsWeight) || other.segmentationsWeight == segmentationsWeight)&&(identical(other.totalSellingInProvinceGovernmentalWeight, totalSellingInProvinceGovernmentalWeight) || other.totalSellingInProvinceGovernmentalWeight == totalSellingInProvinceGovernmentalWeight)&&(identical(other.totalSellingInProvinceFreeWeight, totalSellingInProvinceFreeWeight) || other.totalSellingInProvinceFreeWeight == totalSellingInProvinceFreeWeight)&&(identical(other.totalCommitmentSellingInProvinceGovernmentalWeight, totalCommitmentSellingInProvinceGovernmentalWeight) || other.totalCommitmentSellingInProvinceGovernmentalWeight == totalCommitmentSellingInProvinceGovernmentalWeight)&&(identical(other.totalCommitmentSellingInProvinceGovernmentalRemainWeight, totalCommitmentSellingInProvinceGovernmentalRemainWeight) || other.totalCommitmentSellingInProvinceGovernmentalRemainWeight == totalCommitmentSellingInProvinceGovernmentalRemainWeight)&&(identical(other.totalCommitmentSellingInProvinceFreeWeight, totalCommitmentSellingInProvinceFreeWeight) || other.totalCommitmentSellingInProvinceFreeWeight == totalCommitmentSellingInProvinceFreeWeight)&&(identical(other.totalCommitmentSellingInProvinceFreeRemainWeight, totalCommitmentSellingInProvinceFreeRemainWeight) || other.totalCommitmentSellingInProvinceFreeRemainWeight == totalCommitmentSellingInProvinceFreeRemainWeight)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,totalGovernmentalInputWeight,totalFreeInputWeight,totalGovernmentalOutputWeight,totalFreeOutputWeight,totalGovernmentalRemainWeight,totalFreeRemainWeight,totalStewardFreeSaleBarCarcassesWeight,totalStewardInProvinceAllocationsWeight,segmentationsWeight,totalSellingInProvinceGovernmentalWeight,totalSellingInProvinceFreeWeight,totalCommitmentSellingInProvinceGovernmentalWeight,totalCommitmentSellingInProvinceGovernmentalRemainWeight,totalCommitmentSellingInProvinceFreeWeight,totalCommitmentSellingInProvinceFreeRemainWeight); + +@override +String toString() { + return 'StewardSalesInfoDashboard(totalGovernmentalInputWeight: $totalGovernmentalInputWeight, totalFreeInputWeight: $totalFreeInputWeight, totalGovernmentalOutputWeight: $totalGovernmentalOutputWeight, totalFreeOutputWeight: $totalFreeOutputWeight, totalGovernmentalRemainWeight: $totalGovernmentalRemainWeight, totalFreeRemainWeight: $totalFreeRemainWeight, totalStewardFreeSaleBarCarcassesWeight: $totalStewardFreeSaleBarCarcassesWeight, totalStewardInProvinceAllocationsWeight: $totalStewardInProvinceAllocationsWeight, segmentationsWeight: $segmentationsWeight, totalSellingInProvinceGovernmentalWeight: $totalSellingInProvinceGovernmentalWeight, totalSellingInProvinceFreeWeight: $totalSellingInProvinceFreeWeight, totalCommitmentSellingInProvinceGovernmentalWeight: $totalCommitmentSellingInProvinceGovernmentalWeight, totalCommitmentSellingInProvinceGovernmentalRemainWeight: $totalCommitmentSellingInProvinceGovernmentalRemainWeight, totalCommitmentSellingInProvinceFreeWeight: $totalCommitmentSellingInProvinceFreeWeight, totalCommitmentSellingInProvinceFreeRemainWeight: $totalCommitmentSellingInProvinceFreeRemainWeight)'; +} + + +} + +/// @nodoc +abstract mixin class _$StewardSalesInfoDashboardCopyWith<$Res> implements $StewardSalesInfoDashboardCopyWith<$Res> { + factory _$StewardSalesInfoDashboardCopyWith(_StewardSalesInfoDashboard value, $Res Function(_StewardSalesInfoDashboard) _then) = __$StewardSalesInfoDashboardCopyWithImpl; +@override @useResult +$Res call({ + double? totalGovernmentalInputWeight, double? totalFreeInputWeight, double? totalGovernmentalOutputWeight, double? totalFreeOutputWeight, double? totalGovernmentalRemainWeight, double? totalFreeRemainWeight, double? totalStewardFreeSaleBarCarcassesWeight, double? totalStewardInProvinceAllocationsWeight, double? segmentationsWeight, double? totalSellingInProvinceGovernmentalWeight, double? totalSellingInProvinceFreeWeight, double? totalCommitmentSellingInProvinceGovernmentalWeight, double? totalCommitmentSellingInProvinceGovernmentalRemainWeight, double? totalCommitmentSellingInProvinceFreeWeight, double? totalCommitmentSellingInProvinceFreeRemainWeight +}); + + + + +} +/// @nodoc +class __$StewardSalesInfoDashboardCopyWithImpl<$Res> + implements _$StewardSalesInfoDashboardCopyWith<$Res> { + __$StewardSalesInfoDashboardCopyWithImpl(this._self, this._then); + + final _StewardSalesInfoDashboard _self; + final $Res Function(_StewardSalesInfoDashboard) _then; + +/// Create a copy of StewardSalesInfoDashboard +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? totalGovernmentalInputWeight = freezed,Object? totalFreeInputWeight = freezed,Object? totalGovernmentalOutputWeight = freezed,Object? totalFreeOutputWeight = freezed,Object? totalGovernmentalRemainWeight = freezed,Object? totalFreeRemainWeight = freezed,Object? totalStewardFreeSaleBarCarcassesWeight = freezed,Object? totalStewardInProvinceAllocationsWeight = freezed,Object? segmentationsWeight = freezed,Object? totalSellingInProvinceGovernmentalWeight = freezed,Object? totalSellingInProvinceFreeWeight = freezed,Object? totalCommitmentSellingInProvinceGovernmentalWeight = freezed,Object? totalCommitmentSellingInProvinceGovernmentalRemainWeight = freezed,Object? totalCommitmentSellingInProvinceFreeWeight = freezed,Object? totalCommitmentSellingInProvinceFreeRemainWeight = freezed,}) { + return _then(_StewardSalesInfoDashboard( +totalGovernmentalInputWeight: freezed == totalGovernmentalInputWeight ? _self.totalGovernmentalInputWeight : totalGovernmentalInputWeight // ignore: cast_nullable_to_non_nullable +as double?,totalFreeInputWeight: freezed == totalFreeInputWeight ? _self.totalFreeInputWeight : totalFreeInputWeight // ignore: cast_nullable_to_non_nullable +as double?,totalGovernmentalOutputWeight: freezed == totalGovernmentalOutputWeight ? _self.totalGovernmentalOutputWeight : totalGovernmentalOutputWeight // ignore: cast_nullable_to_non_nullable +as double?,totalFreeOutputWeight: freezed == totalFreeOutputWeight ? _self.totalFreeOutputWeight : totalFreeOutputWeight // ignore: cast_nullable_to_non_nullable +as double?,totalGovernmentalRemainWeight: freezed == totalGovernmentalRemainWeight ? _self.totalGovernmentalRemainWeight : totalGovernmentalRemainWeight // ignore: cast_nullable_to_non_nullable +as double?,totalFreeRemainWeight: freezed == totalFreeRemainWeight ? _self.totalFreeRemainWeight : totalFreeRemainWeight // ignore: cast_nullable_to_non_nullable +as double?,totalStewardFreeSaleBarCarcassesWeight: freezed == totalStewardFreeSaleBarCarcassesWeight ? _self.totalStewardFreeSaleBarCarcassesWeight : totalStewardFreeSaleBarCarcassesWeight // ignore: cast_nullable_to_non_nullable +as double?,totalStewardInProvinceAllocationsWeight: freezed == totalStewardInProvinceAllocationsWeight ? _self.totalStewardInProvinceAllocationsWeight : totalStewardInProvinceAllocationsWeight // ignore: cast_nullable_to_non_nullable +as double?,segmentationsWeight: freezed == segmentationsWeight ? _self.segmentationsWeight : segmentationsWeight // ignore: cast_nullable_to_non_nullable +as double?,totalSellingInProvinceGovernmentalWeight: freezed == totalSellingInProvinceGovernmentalWeight ? _self.totalSellingInProvinceGovernmentalWeight : totalSellingInProvinceGovernmentalWeight // ignore: cast_nullable_to_non_nullable +as double?,totalSellingInProvinceFreeWeight: freezed == totalSellingInProvinceFreeWeight ? _self.totalSellingInProvinceFreeWeight : totalSellingInProvinceFreeWeight // ignore: cast_nullable_to_non_nullable +as double?,totalCommitmentSellingInProvinceGovernmentalWeight: freezed == totalCommitmentSellingInProvinceGovernmentalWeight ? _self.totalCommitmentSellingInProvinceGovernmentalWeight : totalCommitmentSellingInProvinceGovernmentalWeight // ignore: cast_nullable_to_non_nullable +as double?,totalCommitmentSellingInProvinceGovernmentalRemainWeight: freezed == totalCommitmentSellingInProvinceGovernmentalRemainWeight ? _self.totalCommitmentSellingInProvinceGovernmentalRemainWeight : totalCommitmentSellingInProvinceGovernmentalRemainWeight // ignore: cast_nullable_to_non_nullable +as double?,totalCommitmentSellingInProvinceFreeWeight: freezed == totalCommitmentSellingInProvinceFreeWeight ? _self.totalCommitmentSellingInProvinceFreeWeight : totalCommitmentSellingInProvinceFreeWeight // ignore: cast_nullable_to_non_nullable +as double?,totalCommitmentSellingInProvinceFreeRemainWeight: freezed == totalCommitmentSellingInProvinceFreeRemainWeight ? _self.totalCommitmentSellingInProvinceFreeRemainWeight : totalCommitmentSellingInProvinceFreeRemainWeight // ignore: cast_nullable_to_non_nullable +as double?, + )); +} + + +} + +// dart format on diff --git a/packages/chicken/lib/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.g.dart b/packages/chicken/lib/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.g.dart new file mode 100644 index 0000000..6a43d91 --- /dev/null +++ b/packages/chicken/lib/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.g.dart @@ -0,0 +1,74 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'steward_sales_info_dashboard.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_StewardSalesInfoDashboard _$StewardSalesInfoDashboardFromJson( + Map json, +) => _StewardSalesInfoDashboard( + totalGovernmentalInputWeight: + (json['total_governmental_input_weight'] as num?)?.toDouble(), + totalFreeInputWeight: (json['total_free_input_weight'] as num?)?.toDouble(), + totalGovernmentalOutputWeight: + (json['total_governmental_output_weight'] as num?)?.toDouble(), + totalFreeOutputWeight: (json['total_free_output_weight'] as num?)?.toDouble(), + totalGovernmentalRemainWeight: + (json['total_governmental_remain_weight'] as num?)?.toDouble(), + totalFreeRemainWeight: (json['total_free_remain_weight'] as num?)?.toDouble(), + totalStewardFreeSaleBarCarcassesWeight: + (json['total_steward_free_sale_bar_carcasses_weight'] as num?) + ?.toDouble(), + totalStewardInProvinceAllocationsWeight: + (json['total_steward_in_province_allocations_weight'] as num?) + ?.toDouble(), + segmentationsWeight: (json['segmentations_weight'] as num?)?.toDouble(), + totalSellingInProvinceGovernmentalWeight: + (json['total_selling_in_province_governmental_weight'] as num?) + ?.toDouble(), + totalSellingInProvinceFreeWeight: + (json['total_selling_in_province_free_weight'] as num?)?.toDouble(), + totalCommitmentSellingInProvinceGovernmentalWeight: + (json['total_commitment_selling_in_province_governmental_weight'] as num?) + ?.toDouble(), + totalCommitmentSellingInProvinceGovernmentalRemainWeight: + (json['total_commitment_selling_in_province_governmental_remain_weight'] + as num?) + ?.toDouble(), + totalCommitmentSellingInProvinceFreeWeight: + (json['total_commitment_selling_in_province_free_weight'] as num?) + ?.toDouble(), + totalCommitmentSellingInProvinceFreeRemainWeight: + (json['total_commitment_selling_in_province_free_remain_weight'] as num?) + ?.toDouble(), +); + +Map _$StewardSalesInfoDashboardToJson( + _StewardSalesInfoDashboard instance, +) => { + 'total_governmental_input_weight': instance.totalGovernmentalInputWeight, + 'total_free_input_weight': instance.totalFreeInputWeight, + 'total_governmental_output_weight': instance.totalGovernmentalOutputWeight, + 'total_free_output_weight': instance.totalFreeOutputWeight, + 'total_governmental_remain_weight': instance.totalGovernmentalRemainWeight, + 'total_free_remain_weight': instance.totalFreeRemainWeight, + 'total_steward_free_sale_bar_carcasses_weight': + instance.totalStewardFreeSaleBarCarcassesWeight, + 'total_steward_in_province_allocations_weight': + instance.totalStewardInProvinceAllocationsWeight, + 'segmentations_weight': instance.segmentationsWeight, + 'total_selling_in_province_governmental_weight': + instance.totalSellingInProvinceGovernmentalWeight, + 'total_selling_in_province_free_weight': + instance.totalSellingInProvinceFreeWeight, + 'total_commitment_selling_in_province_governmental_weight': + instance.totalCommitmentSellingInProvinceGovernmentalWeight, + 'total_commitment_selling_in_province_governmental_remain_weight': + instance.totalCommitmentSellingInProvinceGovernmentalRemainWeight, + 'total_commitment_selling_in_province_free_weight': + instance.totalCommitmentSellingInProvinceFreeWeight, + 'total_commitment_selling_in_province_free_remain_weight': + instance.totalCommitmentSellingInProvinceFreeRemainWeight, +}; diff --git a/packages/chicken/lib/data/repositories/chicken/chicken_repository.dart b/packages/chicken/lib/data/repositories/chicken/chicken_repository.dart index d4d3ff9..eb2d935 100644 --- a/packages/chicken/lib/data/repositories/chicken/chicken_repository.dart +++ b/packages/chicken/lib/data/repositories/chicken/chicken_repository.dart @@ -19,6 +19,7 @@ import 'package:rasadyar_chicken/data/models/response/segmentation_model/segment import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart'; +import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart'; import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart'; import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart' hide ProductModel; @@ -160,6 +161,12 @@ abstract class ChickenRepository { Future deleteSegmentation({required String token, required String key}); Future getBroadcastPrice({required String token}); + + Future getStewardSalesInfoDashboard({ + required String token, + Map? queryParameters, + }); + //endregion diff --git a/packages/chicken/lib/data/repositories/chicken/chicken_repository_imp.dart b/packages/chicken/lib/data/repositories/chicken/chicken_repository_imp.dart index 8b053c2..03ee4ff 100644 --- a/packages/chicken/lib/data/repositories/chicken/chicken_repository_imp.dart +++ b/packages/chicken/lib/data/repositories/chicken/chicken_repository_imp.dart @@ -22,6 +22,7 @@ import 'package:rasadyar_chicken/data/models/response/segmentation_model/segment import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart'; +import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart'; import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart'; import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart' hide ProductModel; @@ -339,5 +340,16 @@ class ChickenRepositoryImp implements ChickenRepository { @override Future initWidleyUsed() async {} + @override + Future getStewardSalesInfoDashboard({ + required String token, + Map? queryParameters, + }) async { + return await remote.getStewardSalesInfoDashboard( + token: token, + queryParameters: queryParameters, + ); + } + //endregion } diff --git a/packages/chicken/lib/presentation/pages/steward/buy_in_province/logic.dart b/packages/chicken/lib/presentation/pages/steward/buy_in_province/logic.dart index a053f74..f3c64f9 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_in_province/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_in_province/logic.dart @@ -11,7 +11,7 @@ class BuyInProvinceLogic extends GetxController { Rx fromDateFilter = Jalali.now().obs; Rx toDateFilter = Jalali.now().obs; - StewardRootLogic get rootLogic => Get.find(); + StewardRootLogic rootLogic = Get.find(); BuyLogic get buyLogic => Get.find(); RxInt selectedSegmentIndex = 0.obs; @@ -84,6 +84,7 @@ class BuyInProvinceLogic extends GetxController { Future onRefresh() async { final isWaiting = selectedSegmentIndex.value == 0; + await rootLogic.onRefresh(); await Future.wait([buyWaitingLogic.getWaitingArrivals(), buyAllLogic.getAllArrivals()]); } } diff --git a/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/logic.dart b/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/logic.dart index 206e202..2aacbbf 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/logic.dart @@ -32,7 +32,7 @@ class BuyOutOfProvinceLogic extends GetxController { RxnString _base64Image = RxnString(); RxnString editImageUrl = RxnString(); - StewardRootLogic get rootLogic => Get.find(); + StewardRootLogic rootLogic = Get.find(); BuyLogic get buyLogic => Get.find(); @@ -51,6 +51,8 @@ class BuyOutOfProvinceLogic extends GetxController { void onInit() { super.onInit(); routesName = [...buyLogic.routesName, 'خارج استان'].toList(); + + fLog('BuyOutOfProvinceLogic ${rootLogic.stewardSalesInfoDashboard}'); } @override @@ -238,6 +240,7 @@ class BuyOutOfProvinceLogic extends GetxController { Future onRefresh() async { currentPage.value = 1; + await rootLogic.onRefresh(); await getStewardPurchaseOutOfProvince(); } } diff --git a/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/view.dart b/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/view.dart index cd659ad..4ce2701 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_out_of_province/view.dart @@ -219,7 +219,9 @@ class BuyOutOfProvincePage extends GetView { buildDeleteDialog( onConfirm: () => controller.deleteStewardPurchaseOutOfProvince(item.key!), onRefresh: () => controller.getStewardPurchaseOutOfProvince(), - ); + ).then((value) { + controller.onRefresh(); + }); }, borderColor: AppColor.redNormal, ), diff --git a/packages/chicken/lib/presentation/pages/steward/home/logic.dart b/packages/chicken/lib/presentation/pages/steward/home/logic.dart index 536ca94..d5864cd 100644 --- a/packages/chicken/lib/presentation/pages/steward/home/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/home/logic.dart @@ -1,5 +1,6 @@ import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart'; import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart'; +import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart'; import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart'; import 'package:rasadyar_core/core.dart'; @@ -9,16 +10,42 @@ class HomeLogic extends GetxController { Rxn killHouseDistributionInfo = Rxn(); Rxn barInformation = Rxn(); + RxList> inventoryItems = [ + {'خریدهای دولتی داخل استان': null}, + {'خریدهای آزاد داخل استان': null}, + {'وزن خریدهای خارج استان': null}, + {'کل ورودی به انبار': null}, + {'کل فروش': null}, + {'مانده انبار': null}, + ].obs; + + RxList> broadcastItems = [ + {'وزن دولتی': '2،225،256'}, + {'وزن آزاد': '2،225،256'}, + {'فروش دولتی': '2،225،256'}, + {'فروش آزاد': '2،225،256'}, + {'توزیع داخل استان': '2،225،256'}, + {'توزیع خارج استان': '2،225،256'}, + {'قطعه بندی': '2،225،256'}, + ].obs; + RxBool isExpanded = false.obs; @override void onReady() { super.onReady(); refreshData(); + } Future refreshData() async { - await Future.wait([getGeneralBarsInformation(), getTodayBars(), getDistributionInformation()]); + await Future.wait([ + getGeneralBarsInformation(), + getTodayBars(), + getDistributionInformation(), + rootLogic.getRolesProducts(), + rootLogic.getInventory(), + ]); } Future getGeneralBarsInformation() async { diff --git a/packages/chicken/lib/presentation/pages/steward/home/view.dart b/packages/chicken/lib/presentation/pages/steward/home/view.dart index 0bc658e..3899541 100644 --- a/packages/chicken/lib/presentation/pages/steward/home/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/home/view.dart @@ -17,14 +17,16 @@ class HomePage extends GetView { scrollable: true, isBase: true, onRefresh: controller.refreshData, - child: Column( - children: [ - SizedBox(height: 18.h), - mainInformation(), - SizedBox(height: 8.h), - WidelyUsedWidget(), - SizedBox(height: 20), - ], + child: SingleChildScrollView( + child: Column( + children: [ + SizedBox(height: 18.h), + mainInformation(), + SizedBox(height: 8.h), + WidelyUsedWidget(), + SizedBox(height: 20), + ], + ), ), ); } @@ -68,32 +70,13 @@ class HomePage extends GetView { ), SizedBox(height: 8), _todayShipmentWidget(), - //_todayShipmentWidget2(), + _todayShipmentWidget2(), _inventoryWidget(), - - Row( - children: [ - Text( - 'اطلاعات بارها', - textAlign: TextAlign.right, - style: AppFonts.yekan16, - ), - ], - ), - - _informationShipment(), - - Row( - children: [ - Text( - 'اطلاعات توزیع', - textAlign: TextAlign.right, - style: AppFonts.yekan16, - ), - ], - ), - - distributionInformationWidget(), + _inventoryListWidget(), + SizedBox(height: 8), + broadCastList(), + SizedBox(height: 8), + commitmentsList(), ], ), ) @@ -108,7 +91,7 @@ class HomePage extends GetView { children: [Icon(CupertinoIcons.chevron_down, size: 18)], ), _todayShipmentWidget(), - // _todayShipmentWidget2(), + _todayShipmentWidget2(), _inventoryWidget(), ], ), @@ -149,6 +132,93 @@ class HomePage extends GetView { ); } + //todo + Widget broadCastList() { + return ObxValue((data) { + return Column( + children: [ + Row( + children: [ + SizedBox(width: 5.w), + Text('اطلاعات پخش', textAlign: TextAlign.right, style: AppFonts.yekan16), + ], + ), + SizedBox(height: 8.h), + Row( + spacing: 8, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + child: broadcastItem( + title: 'وزن دولتی', + titleBgColor: const Color(0xFFB8E7DC), + valueBgColor: const Color(0xFFE6FAF5), + value: data.value?.totalGovernmentalInputWeight.separatedByComma, + ), + ), + Expanded( + child: broadcastItem( + title: 'وزن آزاد', + value: data.value?.totalFreeInputWeight.separatedByComma, + titleBgColor: const Color(0xFFDDE2F0), + valueBgColor: const Color(0xFFEAEFFF), + ), + ), + Expanded( + child: broadcastItem( + title: 'فروش دولتی', + value: data.value?.totalGovernmentalOutputWeight.separatedByComma, + titleBgColor: const Color(0xFFEBC4CE), + valueBgColor: const Color(0xFFEDDCE0), + ), + ), + Expanded( + child: broadcastItem( + title: 'فروش آزاد', + value: data.value?.totalFreeOutputWeight.separatedByComma, + titleBgColor: const Color(0xFFC2D3F2), + valueBgColor: const Color(0xFFECF2FF), + ), + ), + ], + ), + + SizedBox(height: 8.h), + Row( + spacing: 8, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + child: broadcastItem( + title: 'مانده دولتی', + value: data.value?.totalGovernmentalRemainWeight.separatedByComma, + titleBgColor: const Color(0xFFB8E7DC), + valueBgColor: const Color(0xFFE6FAF5), + ), + ), + Expanded( + child: broadcastItem( + title: 'مانده آزاد', + value: data.value?.totalFreeRemainWeight.separatedByComma, + titleBgColor: const Color(0xFFDDE2F0), + valueBgColor: const Color(0xFFEAEFFF), + ), + ), + Expanded( + child: broadcastItem( + title: 'فروش خارج استان', + value: data.value?.totalStewardFreeSaleBarCarcassesWeight.separatedByComma, + titleBgColor: const Color(0xFFEBC4CE), + valueBgColor: const Color(0xFFEDDCE0), + ), + ), + ], + ), + ], + ); + }, controller.rootLogic.stewardSalesInfoDashboard); + } + Widget distributionInformationWidget() { return Padding( padding: const EdgeInsets.fromLTRB(0, 8, 0, 13), @@ -247,9 +317,9 @@ class HomePage extends GetView { isLoading: data.value == null, description: data.value?.totalRemainWeight.separatedByCommaFa ?? '0', iconPath: Assets.vec.cubeSearchSvg.path, - iconColor: const Color(0xFF426060), - bgDescriptionColor: const Color(0xFFC7DFE0), - bgLabelColor: const Color(0xFFA5D1D2), + bgDescriptionColor: const Color(0xFFEAEFFF), + bgLabelColor: const Color(0xFFBDD4FF), + iconColor: AppColor.textColor, ), ), Expanded( @@ -279,16 +349,29 @@ class HomePage extends GetView { child: ObxValue( (data) => _informationLabelCard( title: 'بارهای امروز', - titleColor: AppColor.blueNormal, - borderColor: Color(0xFF77A6FF), + titleColor: AppColor.textColor, + borderColor: Color(0xFFFFAE00), isLoading: data.value == null, description: data.value?.separatedByCommaFa ?? '0', - iconPath: Assets.vec.cubeScanWithLabelSvg.path, + icon: Container( + width: 24.w, + height: 24.h, + padding: EdgeInsets.all(2), + decoration: BoxDecoration( + color: const Color(0xFFFFAE00), + borderRadius: BorderRadius.circular(8), + ), + child: Assets.vec.cubeScanSvg.svg( + width: 12.w, + height: 12.h, + colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn), + ), + ), bgDescriptionColor: Colors.white, gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, - colors: [AppColor.blueLight, Colors.white], + colors: [const Color(0xFFFFD883), const Color(0xFFFFFBF1)], ), ), controller.totalWeightTodayBars, @@ -298,18 +381,31 @@ class HomePage extends GetView { Expanded( child: ObxValue((data) { return _informationLabelCard( - title: 'درانتظار تایید', - borderColor: AppColor.greenNormal, + title: 'درانتظار', + borderColor: const Color(0xFF9758FF), isLoading: data.value == null, description: data.value?.totalNotEnteredBars.separatedByCommaFa ?? '0', unit: '(${data.value?.totalNotEnteredKillHouseRequestsWeight.separatedByCommaFa})\nکیلوگرم', - iconPath: Assets.vec.cubeCardSvg.path, + icon: Container( + width: 24.w, + height: 24.h, + padding: EdgeInsets.all(2), + decoration: BoxDecoration( + color: const Color(0xFF9758FF), + borderRadius: BorderRadius.circular(8), + ), + child: Assets.vec.cubeCardFreeSvg.svg( + width: 12.w, + height: 12.h, + colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn), + ), + ), bgDescriptionColor: Colors.white, gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, - colors: [const Color(0xFFD9F7F0), Colors.white], + colors: [const Color(0xFFD8C1FF), const Color(0xFFFBF9FF)], ), ); }, controller.barInformation), @@ -320,50 +416,103 @@ class HomePage extends GetView { } Widget _todayShipmentWidget2() { - return Padding( - padding: const EdgeInsets.fromLTRB(0, 10, 0, 13), - child: Row( - spacing: 8, - children: [ - Expanded( - child: ObxValue( - (data) => _informationLabelCard( + return ObxValue((data) { + return Padding( + padding: const EdgeInsets.fromLTRB(0, 10, 0, 13), + child: Row( + spacing: 8, + children: [ + Expanded( + child: _informationLabelCard( title: 'مانده دولتی', titleColor: AppColor.blueNormal, - borderColor: Color(0xFFFFAE00), isLoading: data.value == null, - description: data.value?.separatedByCommaFa ?? '0', + description: data.value?.totalGovernmentalRemainWeight?.separatedByCommaFa ?? '0', iconPath: Assets.vec.cubeCardGovermentSvg.path, - bgDescriptionColor: Colors.white, - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [Color(0xFFFFD47A), Colors.white], - ), + iconColor: AppColor.textColor, + bgDescriptionColor: const Color(0xFFF5ECEE), + bgLabelColor: const Color(0xFFDEC1C7), ), - controller.totalWeightTodayBars, ), - ), - - Expanded( - child: ObxValue((data) { - return _informationLabelCard( + Expanded( + child: _informationLabelCard( title: 'مانده آزاد', - borderColor: const Color(0xFF9758FF), isLoading: data.value == null, - description: data.value?.totalNotEnteredBars.separatedByCommaFa ?? '0', - unit: - '(${data.value?.totalNotEnteredKillHouseRequestsWeight.separatedByCommaFa})\nکیلوگرم', + description: data.value?.totalFreeRemainWeight.separatedByCommaFa ?? '0', + unit: 'کیلوگرم', iconPath: Assets.vec.cubeCardFreeSvg.path, - bgDescriptionColor: Colors.white, - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [const Color(0xFFD3B9FF), Colors.white], - ), - ); - }, controller.barInformation), + iconColor: AppColor.textColor, + bgDescriptionColor: const Color(0xFFD0ECED), + bgLabelColor: const Color(0xFFA5D1D2), + ), + ), + ], + ), + ); + }, controller.rootLogic.stewardSalesInfoDashboard); + } + + Widget _inventoryListWidget() { + return ObxValue((data) { + var model = data[0]; + return Container( + padding: EdgeInsets.fromLTRB(16.w, 0, 11.w, 0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: const Color(0xB2EDF1FF), + ), + alignment: Alignment.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + inventoryListItem( + title: 'خریدهای دولتی داخل استان', + value: model.receiveGovernmentalCarcassesWeight.separatedByComma, + ), + Divider(), + inventoryListItem( + title: 'خریدهای آزاد داخل استان', + value: model.receiveFreeCarcassesWeight?.separatedByComma, + ), + Divider(), + inventoryListItem( + title: 'وزن خریدهای خارج استان', + value: model.freeBuyingCarcassesWeight?.separatedByComma, + ), + Divider(), + inventoryListItem( + title: 'کل ورودی به انبار', + value: model.totalCarcassesWeight?.separatedByComma, + ), + Divider(), + + inventoryListItem(title: 'کل فروش', value: model.realAllocatedWeight?.separatedByComma), + Divider(), + inventoryListItem( + title: 'مانده انبار', + value: model.totalRemainWeight?.separatedByComma, + ), + ], + ), + ); + }, controller.rootLogic.rolesProductsModel); + } + + Widget inventoryListItem({required String title, required String? value}) { + return Container( + height: 45.h, + child: Row( + children: [ + Text( + title, + style: AppFonts.yekan14.copyWith(color: const Color(0xFF353535), height: 1.2), ), + Spacer(), + value == null + ? Center(child: CupertinoActivityIndicator()) + : Text(value, style: AppFonts.yekan14.copyWith(color: const Color(0xFF353535))), + SizedBox(width: 20.w), + Text('کیلوگرم', style: AppFonts.yekan10.copyWith(color: const Color(0xFF353535))), ], ), ); @@ -372,8 +521,9 @@ class HomePage extends GetView { Container _informationLabelCard({ required String title, required String description, - required String iconPath, required Color bgDescriptionColor, + String? iconPath, + Widget? icon, Color? borderColor, String unit = 'کیلوگرم', bool isLoading = false, @@ -383,7 +533,7 @@ class HomePage extends GetView { LinearGradient? gradient, }) { return Container( - height: 82, + height: 65.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), border: borderColor != null ? Border.all(width: 1, color: borderColor) : null, @@ -405,15 +555,16 @@ class HomePage extends GetView { ), child: Column( mainAxisAlignment: MainAxisAlignment.center, - spacing: 4, + spacing: 5, children: [ - SvgGenImage.vec(iconPath).svg( - width: 24, - height: 24, - colorFilter: iconColor != null - ? ColorFilter.mode(iconColor, BlendMode.srcIn) - : null, - ), + icon ?? + SvgGenImage.vec(iconPath!).svg( + width: 24.w, + height: 24.h, + colorFilter: iconColor != null + ? ColorFilter.mode(iconColor, BlendMode.srcIn) + : null, + ), Text( title, textAlign: TextAlign.right, @@ -639,6 +790,64 @@ class HomePage extends GetView { ); } + Widget broadcastItem({ + int? width, + int? height, + String? title, + String? value, + String? unit, + Color? titleBgColor, + Color? valueBgColor, + Color? unitBgColor, + TextStyle? titleStyle, + TextStyle? valueStyle, + TextStyle? unitStyle, + }) { + return Container( + height: height?.h ?? 73.h, + clipBehavior: Clip.hardEdge, + decoration: BoxDecoration(color: valueBgColor, borderRadius: BorderRadius.circular(8)), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + padding: EdgeInsets.symmetric(vertical: 4.h), + decoration: BoxDecoration(color: titleBgColor), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + title ?? 'بدون تیتر', + textAlign: TextAlign.center, + style: titleStyle ?? AppFonts.yekan12.copyWith(color: const Color(0xFF3E3E3E)), + ), + ], + ), + ), + SizedBox(height: 4), + + (value != null) + ? Padding( + padding: const EdgeInsets.symmetric(horizontal: 11.0), + child: Text( + value, + textAlign: TextAlign.right, + style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.textColor), + ), + ) + : Center(child: CupertinoActivityIndicator()), + + Text( + unit ?? 'کیلوگرم', + textAlign: TextAlign.center, + style: unitStyle ?? AppFonts.yekan10.copyWith(color: Color(0xFF717171)), + ), + SizedBox(height: 4.h), + ], + ), + ); + } + Widget cardWidget({ required String title, required String iconPath, @@ -674,4 +883,114 @@ class HomePage extends GetView { ), ); } + + Widget commitmentsList() { + return ObxValue((data) { + return Column( + spacing: 2.h, + children: [ + Row( + children: [ + SizedBox(width: 5.w), + Text('تعهدات', textAlign: TextAlign.right, style: AppFonts.yekan16), + ], + ), + + commitmentsItemList( + title: 'تعهد دولتی توزیع داخل استان', + value: data.value?.totalCommitmentSellingInProvinceGovernmentalWeight.separatedByComma, + labelColor: const Color(0xFFB9E8DC), + bgColor: const Color(0xFFF3F9F8), + ), + commitmentsItemList( + title: 'توزیع دولتی داخل استان', + value: data.value?.totalSellingInProvinceGovernmentalWeight.separatedByComma, + labelColor: const Color(0xFFC3D4F3), + bgColor: const Color(0xFFECF3FF), + ), + commitmentsItemList( + title: 'باقیمانده تعهد دولتی توزیع داخل استان', + value: data + .value + ?.totalCommitmentSellingInProvinceGovernmentalRemainWeight + .separatedByComma, + labelColor: const Color(0xFFEBC5CE), + bgColor: const Color(0xFFFFF1F4), + ), + commitmentsItemList( + title: 'تعهد آزاد توزیع داخل استان', + value: data.value?.totalCommitmentSellingInProvinceFreeWeight.separatedByComma, + labelColor: const Color(0xFFC7DADA), + bgColor: const Color(0xFFE5F7F7), + ), + commitmentsItemList( + title: 'توزیع آزاد داخل استان', + value: data.value?.totalSellingInProvinceFreeWeight.separatedByComma, + labelColor: const Color(0xFFE0D6ED), + bgColor: const Color(0xFFF5EDFF), + ), + commitmentsItemList( + title: 'باقیمانده تعهد آزاد توزیع داخل استان', + value: data.value?.totalCommitmentSellingInProvinceFreeRemainWeight.separatedByComma, + labelColor: const Color(0xFFEBC5CE), + bgColor: const Color(0xFFFFF1F4), + ), + ], + ); + }, controller.rootLogic.stewardSalesInfoDashboard); + } + + Container commitmentsItemList({ + required String title, + required String? value, + required Color labelColor, + required Color bgColor, + }) { + return Container( + width: Get.width, + child: Row( + children: [ + Container(height: 48.h, width: 4.w, color: labelColor), + Expanded( + child: Container( + height: 48.h, + padding: EdgeInsets.symmetric(horizontal: 14.w), + decoration: BoxDecoration( + color: bgColor, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + bottomLeft: Radius.circular(8), + ), + ), + child: Row( + children: [ + Text( + title, + textAlign: TextAlign.right, + style: AppFonts.yekan12.copyWith(color: AppColor.textColor), + ), + Spacer(), + + value == null + ? Center(child: CupertinoActivityIndicator()) + : Text( + value, + textAlign: TextAlign.right, + style: AppFonts.yekan16.copyWith(color: AppColor.textColor), + ), + SizedBox(width: 8.w), + + Text( + 'کیلوگرم', + textAlign: TextAlign.right, + style: AppFonts.yekan10.copyWith(color: AppColor.textColor), + ), + ], + ), + ), + ), + ], + ), + ); + } } diff --git a/packages/chicken/lib/presentation/pages/steward/root/logic.dart b/packages/chicken/lib/presentation/pages/steward/root/logic.dart index 6428f1d..b9a3a14 100644 --- a/packages/chicken/lib/presentation/pages/steward/root/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/root/logic.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:rasadyar_chicken/data/data_source/local/chicken_local.dart'; import 'package:rasadyar_chicken/data/di/chicken_di.dart'; @@ -8,6 +7,7 @@ import 'package:rasadyar_chicken/data/models/local/widely_used_local_model.dart' import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.dart'; import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart'; import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart'; +import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart'; import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart'; import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart'; import 'package:rasadyar_chicken/presentation/pages/steward/buy/view.dart'; @@ -29,6 +29,7 @@ class StewardRootLogic extends GetxController { final defaultRoutes = {0: ChickenRoutes.buySteward, 1: ChickenRoutes.saleSteward}; RxList rolesProductsModel = RxList(); Rxn widelyUsedList = Rxn(); + Rxn stewardSalesInfoDashboard = Rxn(); late DioRemote dioRemote; var tokenService = Get.find(); @@ -68,6 +69,7 @@ class StewardRootLogic extends GetxController { if (rolesProductsModel.isEmpty) { getRolesProducts(); } + getStewardSaleDashboard(); if (widelyUsedList.value?.hasInit != true) { //TODO @@ -83,6 +85,15 @@ class StewardRootLogic extends GetxController { super.onClose(); } + Future onRefresh() async { + await Future.wait([ + getInventory(), + getRolesProducts(), + getStewardSaleDashboard(), + getProvinces(), + ]); + } + void toggleExpanded(int index) { if (inventoryExpandedList.keys.contains(index)) { inventoryExpandedList.remove(index); @@ -158,6 +169,21 @@ class StewardRootLogic extends GetxController { ); } + Future getStewardSaleDashboard() async { + safeCall( + call: () async => await chickenRepository.getStewardSalesInfoDashboard( + token: tokenService.accessToken.value!, + queryParameters: buildRawQueryParams(role: 'Steward'), + ), + onSuccess: (result) { + if (result != null) { + stewardSalesInfoDashboard.value = result; + } + }, + onError: (error, stacktrace) {}, + ); + } + int getNestedKey() { switch (currentPage.value) { case 0: @@ -184,10 +210,9 @@ class StewardRootLogic extends GetxController { final currentRoute = currentNestedKey?.currentState; - fLog(Get.currentRoute); -/* + /* fLog("onPopScopTaped ==> ${currentNestedKey?.currentState?.canPop()}"); if (currentNestedKey?.currentState?.canPop() == true) { iLog(currentNestedKey?.currentState?.canPop()); diff --git a/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart b/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart index a78fbad..7609ddc 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart @@ -454,7 +454,7 @@ class SalesInProvinceLogic extends GetxController { Future onRefresh() async { currentPage.value = 1; hasMoreDataAllocationsMade.value = true; - + await rootLogic.onRefresh(); await Future.wait([getAllocatedMade()]); } } diff --git a/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart b/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart index 0c2d8b5..179773e 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart @@ -354,10 +354,10 @@ class SalesInProvincePage extends GetView { buildDeleteDialog( onConfirm: () async { controller.isExpandedList.remove(index); - // controller.denyAllocation(item.key ?? ''); - //await controller.deleteAllocation(item); + + await controller.deleteAllocation(item); }, - onRefresh: () => controller.getAllocatedMade(), + onRefresh: controller.onRefresh, ); }, borderColor: AppColor.redNormal, @@ -401,7 +401,7 @@ class SalesInProvincePage extends GetView { SizedBox( height: 40, child: ObxValue((data) { - return RadioGroup( + return RadioGroup( groupValue: controller.saleType.value, onChanged: (value) { controller.saleType.value = value!; diff --git a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/logic.dart b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/logic.dart index c5fddea..5206977 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/logic.dart @@ -13,7 +13,7 @@ import 'package:rasadyar_chicken/presentation/utils/utils.dart'; import 'package:rasadyar_core/core.dart'; class SalesOutOfProvinceLogic extends GetxController { - StewardRootLogic get rootLogic => Get.find(); + StewardRootLogic rootLogic = Get.find(); SaleLogic get saleLogic => Get.find(); @@ -215,6 +215,7 @@ class SalesOutOfProvinceLogic extends GetxController { Future onRefresh() async { currentPage.value = 1; + await rootLogic.onRefresh(); await getOutProvinceSales(); diff --git a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/view.dart b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/view.dart index b090df7..7852f44 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province/view.dart @@ -318,7 +318,7 @@ class SalesOutOfProvincePage extends GetView { controller.isExpandedList.remove(index); controller.deleteStewardPurchaseOutOfProvince(item.key!); }, - onRefresh: () => controller.getOutProvinceSales(), + onRefresh: () => controller.onRefresh(), ); }, borderColor: AppColor.redNormal, diff --git a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/logic.dart b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/logic.dart index 600b852..1888f0a 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_buyers/logic.dart @@ -9,7 +9,7 @@ import 'package:rasadyar_chicken/presentation/utils/utils.dart'; import 'package:rasadyar_core/core.dart'; class SalesOutOfProvinceBuyersLogic extends GetxController { - StewardRootLogic get rootLogic => Get.find(); + StewardRootLogic rootLogic = Get.find(); SaleLogic get saleLogic => Get.find(); @@ -212,6 +212,7 @@ class SalesOutOfProvinceBuyersLogic extends GetxController { Future onRefresh() async { currentPage.value = 1; + await rootLogic.onRefresh(); await getOutProvinceCarcassesBuyer(); } } diff --git a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/logic.dart b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/logic.dart index 0a10870..5bcb52e 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/logic.dart @@ -12,7 +12,7 @@ import 'package:rasadyar_chicken/presentation/utils/utils.dart'; import 'package:rasadyar_core/core.dart'; class SalesOutOfProvinceSalesListLogic extends GetxController { - StewardRootLogic get rootLogic => Get.find(); + StewardRootLogic rootLogic = Get.find(); SaleLogic get saleLogic => Get.find(); diff --git a/packages/chicken/lib/presentation/pages/steward/segmentation/logic.dart b/packages/chicken/lib/presentation/pages/steward/segmentation/logic.dart index a99ac7a..96ed846 100644 --- a/packages/chicken/lib/presentation/pages/steward/segmentation/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/segmentation/logic.dart @@ -196,7 +196,6 @@ class SegmentationLogic extends GetxController { onSuccess: (result) { res = true; isSubmitButtonEnabled.value = true; - }, onError: (error, stacktrace) { res = false; @@ -221,9 +220,9 @@ class SegmentationLogic extends GetxController { ); } - Future onRefresh() async { currentPage.value = 1; + await rootLogic.onRefresh(); await getAllSegmentation(); } } diff --git a/packages/chicken/lib/presentation/pages/steward/segmentation/view.dart b/packages/chicken/lib/presentation/pages/steward/segmentation/view.dart index 324d4e6..bed5b84 100644 --- a/packages/chicken/lib/presentation/pages/steward/segmentation/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/segmentation/view.dart @@ -242,7 +242,7 @@ class SegmentationPage extends GetView { controller.isExpandedList.remove(index); controller.deleteSegmentation(item.key!); }, - onRefresh: () => controller.getAllSegmentation(), + onRefresh: () => controller.onRefresh(), ); }, borderColor: AppColor.redNormal, diff --git a/packages/chicken/lib/presentation/widget/steward/inventory_widget.dart b/packages/chicken/lib/presentation/widget/steward/inventory_widget.dart index 6082232..8c864e5 100644 --- a/packages/chicken/lib/presentation/widget/steward/inventory_widget.dart +++ b/packages/chicken/lib/presentation/widget/steward/inventory_widget.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart'; import 'package:rasadyar_core/core.dart'; @@ -5,19 +6,74 @@ import 'package:rasadyar_core/core.dart'; Widget inventoryWidget(StewardRootLogic rootLogic) { return Container( width: Get.width, - height: 39, - margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4), - decoration: BoxDecoration( - color: AppColor.greenLight, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: AppColor.textColor, width: 0.5), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + padding: EdgeInsets.symmetric(horizontal: 8.w), + child: Row( + spacing: 8.w, + children: [ + ObxValue((data) { + // بررسی مقدار null بودن و نشان دادن ActivityIndicator + final value = data.value?.totalRemainWeight?.separatedByCommaFa; + return _itemList( + title: 'موجودی انبار', + value: value ?? '', // در صورت نال بودن، رشته خالی نمایش داده شود + ); + }, rootLogic.inventoryModel), + ObxValue((data) { + final value = data.value?.totalGovernmentalRemainWeight?.separatedByCommaFa; + return _itemList(title: 'مانده دولتی', value: value ?? ''); + }, rootLogic.stewardSalesInfoDashboard), + ObxValue((data) { + final value = data.value?.totalFreeRemainWeight?.separatedByCommaFa; + return _itemList(title: 'مانده آزاد', value: value ?? ''); + }, rootLogic.stewardSalesInfoDashboard), + ], + ), + ), + ); +} + +Widget _itemList({required String title, required String? value, String? unit}) { + return Container( + width: 125.w, + height: 50.h, + clipBehavior: Clip.antiAlias, + decoration: ShapeDecoration( + color: Colors.white.withValues(alpha: 0.40), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + child: Column( + children: [ + SizedBox(height: 4), + Text( + title, + textAlign: TextAlign.center, + style: AppFonts.yekan12.copyWith(color: const Color(0xFF5B5B5B)), + ), + SizedBox(height: 4), + value == null + ? Center(child: CupertinoActivityIndicator()) + : Padding( + padding: EdgeInsets.symmetric(horizontal: 4.w), + child: Row( + spacing: 8, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + value!, + textAlign: TextAlign.right, + style: AppFonts.yekan16.copyWith(color: const Color(0xFF5B5B5B)), + ), + Text( + unit ?? 'کیلوگرم', + textAlign: TextAlign.center, + style: AppFonts.yekan10.copyWith(color: const Color(0xFF5B5B5B)), + ), + ], + ), + ), + ], ), - alignment: Alignment.center, - child: ObxValue((data) { - return Text( - ' موجودی انبار: ${data.value?.totalRemainWeight?.toInt().separatedByCommaFa ?? '0'} کیلوگرم', - style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkHover), - ); - }, rootLogic.inventoryModel), ); } diff --git a/pubspec.yaml b/pubspec.yaml index 5628562..1a93ab8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: rasadyar_app description: "A new Flutter project." publish_to: 'none' -version: 1.3.19+16 +version: 1.3.20+17 environment: sdk: ^3.9.2