feat: new date picker and new logic
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
sdk.dir=C:/Users/Housh11/AppData/Local/Android/Sdk
|
sdk.dir=C:/Users/Housh11/AppData/Local/Android/Sdk
|
||||||
flutter.sdk=C:\\src\\flutter
|
flutter.sdk=C:\\src\\flutter
|
||||||
flutter.buildMode=debug
|
flutter.buildMode=debug
|
||||||
flutter.versionName=1.3.28
|
flutter.versionName=1.3.29
|
||||||
flutter.versionCode=25
|
flutter.versionCode=26
|
||||||
@@ -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/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_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_free_sale_bar/steward_free_sale_bar.dart';
|
||||||
|
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.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/user_profile/user_profile.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
||||||
@@ -174,4 +175,6 @@ abstract class ChickenRemoteDatasource {
|
|||||||
required String token,
|
required String token,
|
||||||
Map<String, dynamic>? queryParameters,
|
Map<String, dynamic>? queryParameters,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Future<StewardRemainWeight?> getStewardRemainWeight({required String token});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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/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_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_free_sale_bar/steward_free_sale_bar.dart';
|
||||||
|
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.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/user_profile/user_profile.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
||||||
@@ -533,4 +534,15 @@ class ChickenRemoteDatasourceImp implements ChickenRemoteDatasource {
|
|||||||
|
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<StewardRemainWeight?> getStewardRemainWeight({required String token}) async {
|
||||||
|
var res = await _httpClient.get(
|
||||||
|
'/steward-remain-weight/',
|
||||||
|
headers: {'Authorization': 'Bearer $token'},
|
||||||
|
fromJson: StewardRemainWeight.fromJson,
|
||||||
|
);
|
||||||
|
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'steward_remain_weight.freezed.dart';
|
||||||
|
part 'steward_remain_weight.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class StewardRemainWeight with _$StewardRemainWeight {
|
||||||
|
const factory StewardRemainWeight({
|
||||||
|
List<RemainWeightDay>? governmental,
|
||||||
|
List<RemainWeightDay>? free,
|
||||||
|
}) = _StewardRemainWeight;
|
||||||
|
|
||||||
|
factory StewardRemainWeight.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$StewardRemainWeightFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class RemainWeightDay with _$RemainWeightDay {
|
||||||
|
const factory RemainWeightDay({
|
||||||
|
String? day,
|
||||||
|
double? amount,
|
||||||
|
}) = _RemainWeightDay;
|
||||||
|
|
||||||
|
factory RemainWeightDay.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$RemainWeightDayFromJson(json);
|
||||||
|
}
|
||||||
@@ -0,0 +1,562 @@
|
|||||||
|
// 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_remain_weight.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$StewardRemainWeight {
|
||||||
|
|
||||||
|
List<RemainWeightDay>? get governmental; List<RemainWeightDay>? get free;
|
||||||
|
/// Create a copy of StewardRemainWeight
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$StewardRemainWeightCopyWith<StewardRemainWeight> get copyWith => _$StewardRemainWeightCopyWithImpl<StewardRemainWeight>(this as StewardRemainWeight, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this StewardRemainWeight to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is StewardRemainWeight&&const DeepCollectionEquality().equals(other.governmental, governmental)&&const DeepCollectionEquality().equals(other.free, free));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(governmental),const DeepCollectionEquality().hash(free));
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StewardRemainWeight(governmental: $governmental, free: $free)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $StewardRemainWeightCopyWith<$Res> {
|
||||||
|
factory $StewardRemainWeightCopyWith(StewardRemainWeight value, $Res Function(StewardRemainWeight) _then) = _$StewardRemainWeightCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
List<RemainWeightDay>? governmental, List<RemainWeightDay>? free
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$StewardRemainWeightCopyWithImpl<$Res>
|
||||||
|
implements $StewardRemainWeightCopyWith<$Res> {
|
||||||
|
_$StewardRemainWeightCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final StewardRemainWeight _self;
|
||||||
|
final $Res Function(StewardRemainWeight) _then;
|
||||||
|
|
||||||
|
/// Create a copy of StewardRemainWeight
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? governmental = freezed,Object? free = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
governmental: freezed == governmental ? _self.governmental : governmental // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<RemainWeightDay>?,free: freezed == free ? _self.free : free // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<RemainWeightDay>?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [StewardRemainWeight].
|
||||||
|
extension StewardRemainWeightPatterns on StewardRemainWeight {
|
||||||
|
/// 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 extends Object?>(TResult Function( _StewardRemainWeight value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StewardRemainWeight() 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 extends Object?>(TResult Function( _StewardRemainWeight value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StewardRemainWeight():
|
||||||
|
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 extends Object?>(TResult? Function( _StewardRemainWeight value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StewardRemainWeight() 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 extends Object?>(TResult Function( List<RemainWeightDay>? governmental, List<RemainWeightDay>? free)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StewardRemainWeight() when $default != null:
|
||||||
|
return $default(_that.governmental,_that.free);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 extends Object?>(TResult Function( List<RemainWeightDay>? governmental, List<RemainWeightDay>? free) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StewardRemainWeight():
|
||||||
|
return $default(_that.governmental,_that.free);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 extends Object?>(TResult? Function( List<RemainWeightDay>? governmental, List<RemainWeightDay>? free)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StewardRemainWeight() when $default != null:
|
||||||
|
return $default(_that.governmental,_that.free);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _StewardRemainWeight implements StewardRemainWeight {
|
||||||
|
const _StewardRemainWeight({final List<RemainWeightDay>? governmental, final List<RemainWeightDay>? free}): _governmental = governmental,_free = free;
|
||||||
|
factory _StewardRemainWeight.fromJson(Map<String, dynamic> json) => _$StewardRemainWeightFromJson(json);
|
||||||
|
|
||||||
|
final List<RemainWeightDay>? _governmental;
|
||||||
|
@override List<RemainWeightDay>? get governmental {
|
||||||
|
final value = _governmental;
|
||||||
|
if (value == null) return null;
|
||||||
|
if (_governmental is EqualUnmodifiableListView) return _governmental;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<RemainWeightDay>? _free;
|
||||||
|
@override List<RemainWeightDay>? get free {
|
||||||
|
final value = _free;
|
||||||
|
if (value == null) return null;
|
||||||
|
if (_free is EqualUnmodifiableListView) return _free;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Create a copy of StewardRemainWeight
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$StewardRemainWeightCopyWith<_StewardRemainWeight> get copyWith => __$StewardRemainWeightCopyWithImpl<_StewardRemainWeight>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$StewardRemainWeightToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _StewardRemainWeight&&const DeepCollectionEquality().equals(other._governmental, _governmental)&&const DeepCollectionEquality().equals(other._free, _free));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_governmental),const DeepCollectionEquality().hash(_free));
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StewardRemainWeight(governmental: $governmental, free: $free)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$StewardRemainWeightCopyWith<$Res> implements $StewardRemainWeightCopyWith<$Res> {
|
||||||
|
factory _$StewardRemainWeightCopyWith(_StewardRemainWeight value, $Res Function(_StewardRemainWeight) _then) = __$StewardRemainWeightCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
List<RemainWeightDay>? governmental, List<RemainWeightDay>? free
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$StewardRemainWeightCopyWithImpl<$Res>
|
||||||
|
implements _$StewardRemainWeightCopyWith<$Res> {
|
||||||
|
__$StewardRemainWeightCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _StewardRemainWeight _self;
|
||||||
|
final $Res Function(_StewardRemainWeight) _then;
|
||||||
|
|
||||||
|
/// Create a copy of StewardRemainWeight
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? governmental = freezed,Object? free = freezed,}) {
|
||||||
|
return _then(_StewardRemainWeight(
|
||||||
|
governmental: freezed == governmental ? _self._governmental : governmental // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<RemainWeightDay>?,free: freezed == free ? _self._free : free // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<RemainWeightDay>?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$RemainWeightDay {
|
||||||
|
|
||||||
|
String? get day; double? get amount;
|
||||||
|
/// Create a copy of RemainWeightDay
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$RemainWeightDayCopyWith<RemainWeightDay> get copyWith => _$RemainWeightDayCopyWithImpl<RemainWeightDay>(this as RemainWeightDay, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this RemainWeightDay to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is RemainWeightDay&&(identical(other.day, day) || other.day == day)&&(identical(other.amount, amount) || other.amount == amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,day,amount);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'RemainWeightDay(day: $day, amount: $amount)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $RemainWeightDayCopyWith<$Res> {
|
||||||
|
factory $RemainWeightDayCopyWith(RemainWeightDay value, $Res Function(RemainWeightDay) _then) = _$RemainWeightDayCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String? day, double? amount
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$RemainWeightDayCopyWithImpl<$Res>
|
||||||
|
implements $RemainWeightDayCopyWith<$Res> {
|
||||||
|
_$RemainWeightDayCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final RemainWeightDay _self;
|
||||||
|
final $Res Function(RemainWeightDay) _then;
|
||||||
|
|
||||||
|
/// Create a copy of RemainWeightDay
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? day = freezed,Object? amount = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
day: freezed == day ? _self.day : day // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,amount: freezed == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable
|
||||||
|
as double?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [RemainWeightDay].
|
||||||
|
extension RemainWeightDayPatterns on RemainWeightDay {
|
||||||
|
/// 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 extends Object?>(TResult Function( _RemainWeightDay value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _RemainWeightDay() 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 extends Object?>(TResult Function( _RemainWeightDay value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _RemainWeightDay():
|
||||||
|
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 extends Object?>(TResult? Function( _RemainWeightDay value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _RemainWeightDay() 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 extends Object?>(TResult Function( String? day, double? amount)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _RemainWeightDay() when $default != null:
|
||||||
|
return $default(_that.day,_that.amount);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 extends Object?>(TResult Function( String? day, double? amount) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _RemainWeightDay():
|
||||||
|
return $default(_that.day,_that.amount);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 extends Object?>(TResult? Function( String? day, double? amount)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _RemainWeightDay() when $default != null:
|
||||||
|
return $default(_that.day,_that.amount);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _RemainWeightDay implements RemainWeightDay {
|
||||||
|
const _RemainWeightDay({this.day, this.amount});
|
||||||
|
factory _RemainWeightDay.fromJson(Map<String, dynamic> json) => _$RemainWeightDayFromJson(json);
|
||||||
|
|
||||||
|
@override final String? day;
|
||||||
|
@override final double? amount;
|
||||||
|
|
||||||
|
/// Create a copy of RemainWeightDay
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$RemainWeightDayCopyWith<_RemainWeightDay> get copyWith => __$RemainWeightDayCopyWithImpl<_RemainWeightDay>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$RemainWeightDayToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _RemainWeightDay&&(identical(other.day, day) || other.day == day)&&(identical(other.amount, amount) || other.amount == amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,day,amount);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'RemainWeightDay(day: $day, amount: $amount)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$RemainWeightDayCopyWith<$Res> implements $RemainWeightDayCopyWith<$Res> {
|
||||||
|
factory _$RemainWeightDayCopyWith(_RemainWeightDay value, $Res Function(_RemainWeightDay) _then) = __$RemainWeightDayCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String? day, double? amount
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$RemainWeightDayCopyWithImpl<$Res>
|
||||||
|
implements _$RemainWeightDayCopyWith<$Res> {
|
||||||
|
__$RemainWeightDayCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _RemainWeightDay _self;
|
||||||
|
final $Res Function(_RemainWeightDay) _then;
|
||||||
|
|
||||||
|
/// Create a copy of RemainWeightDay
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? day = freezed,Object? amount = freezed,}) {
|
||||||
|
return _then(_RemainWeightDay(
|
||||||
|
day: freezed == day ? _self.day : day // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,amount: freezed == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable
|
||||||
|
as double?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'steward_remain_weight.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_StewardRemainWeight _$StewardRemainWeightFromJson(Map<String, dynamic> json) =>
|
||||||
|
_StewardRemainWeight(
|
||||||
|
governmental: (json['governmental'] as List<dynamic>?)
|
||||||
|
?.map((e) => RemainWeightDay.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
free: (json['free'] as List<dynamic>?)
|
||||||
|
?.map((e) => RemainWeightDay.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$StewardRemainWeightToJson(
|
||||||
|
_StewardRemainWeight instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'governmental': instance.governmental,
|
||||||
|
'free': instance.free,
|
||||||
|
};
|
||||||
|
|
||||||
|
_RemainWeightDay _$RemainWeightDayFromJson(Map<String, dynamic> json) =>
|
||||||
|
_RemainWeightDay(
|
||||||
|
day: json['day'] as String?,
|
||||||
|
amount: (json['amount'] as num?)?.toDouble(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$RemainWeightDayToJson(_RemainWeightDay instance) =>
|
||||||
|
<String, dynamic>{'day': instance.day, 'amount': instance.amount};
|
||||||
@@ -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/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_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_free_sale_bar/steward_free_sale_bar.dart';
|
||||||
|
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.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/user_profile/user_profile.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
||||||
@@ -182,6 +183,8 @@ abstract class ChickenRepository {
|
|||||||
Map<String, dynamic>? queryParameters,
|
Map<String, dynamic>? queryParameters,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Future<StewardRemainWeight?> getStewardRemainWeight({required String token});
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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/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_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_free_sale_bar/steward_free_sale_bar.dart';
|
||||||
|
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.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/user_profile/user_profile.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
||||||
@@ -423,5 +424,10 @@ class ChickenRepositoryImp implements ChickenRepository {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<StewardRemainWeight?> getStewardRemainWeight({required String token}) async {
|
||||||
|
return await remote.getStewardRemainWeight(token: token);
|
||||||
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,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/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/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/roles_products/roles_products.dart';
|
||||||
|
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart';
|
import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
||||||
hide ProductModel;
|
hide ProductModel;
|
||||||
@@ -33,6 +34,7 @@ class StewardRootLogic extends GetxController {
|
|||||||
RxList<ProductModel> rolesProductsModel = RxList<ProductModel>();
|
RxList<ProductModel> rolesProductsModel = RxList<ProductModel>();
|
||||||
Rxn<WidelyUsedLocalModel> widelyUsedList = Rxn<WidelyUsedLocalModel>();
|
Rxn<WidelyUsedLocalModel> widelyUsedList = Rxn<WidelyUsedLocalModel>();
|
||||||
Rxn<StewardSalesInfoDashboard> stewardSalesInfoDashboard = Rxn<StewardSalesInfoDashboard>();
|
Rxn<StewardSalesInfoDashboard> stewardSalesInfoDashboard = Rxn<StewardSalesInfoDashboard>();
|
||||||
|
Rxn<StewardRemainWeight> stewardRemainWeight = Rxn<StewardRemainWeight>();
|
||||||
|
|
||||||
late DioRemote dioRemote;
|
late DioRemote dioRemote;
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
@@ -53,10 +55,6 @@ class StewardRootLogic extends GetxController {
|
|||||||
super.onInit();
|
super.onInit();
|
||||||
localDatasource = diChicken.get<ChickenLocalDataSource>();
|
localDatasource = diChicken.get<ChickenLocalDataSource>();
|
||||||
chickenRepository = diChicken.get<ChickenRepository>();
|
chickenRepository = diChicken.get<ChickenRepository>();
|
||||||
|
|
||||||
/*localDatasource.openBox().then((value) async {
|
|
||||||
widelyUsedList.value = localDatasource.getAllWidely();
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -73,6 +71,7 @@ class StewardRootLogic extends GetxController {
|
|||||||
getRolesProducts();
|
getRolesProducts();
|
||||||
}
|
}
|
||||||
getStewardSaleDashboard();
|
getStewardSaleDashboard();
|
||||||
|
getStewardRemainWeightData();
|
||||||
|
|
||||||
if (widelyUsedList.value?.hasInit != true) {
|
if (widelyUsedList.value?.hasInit != true) {
|
||||||
//TODO
|
//TODO
|
||||||
@@ -93,7 +92,9 @@ class StewardRootLogic extends GetxController {
|
|||||||
getInventory(),
|
getInventory(),
|
||||||
getRolesProducts(),
|
getRolesProducts(),
|
||||||
getStewardSaleDashboard(),
|
getStewardSaleDashboard(),
|
||||||
|
getStewardRemainWeightData(),
|
||||||
getProvinces(),
|
getProvinces(),
|
||||||
|
getStewardRemainWeightData(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,6 +188,19 @@ class StewardRootLogic extends GetxController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> getStewardRemainWeightData() async {
|
||||||
|
safeCall(
|
||||||
|
call: () async =>
|
||||||
|
await chickenRepository.getStewardRemainWeight(token: tokenService.accessToken.value!),
|
||||||
|
onSuccess: (result) {
|
||||||
|
if (result != null) {
|
||||||
|
stewardRemainWeight.value = result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onError: (error, stacktrace) {},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
int getNestedKey() {
|
int getNestedKey() {
|
||||||
switch (currentPage.value) {
|
switch (currentPage.value) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_
|
|||||||
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart';
|
import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||||
|
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/sale/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/sale/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
||||||
@@ -119,41 +120,29 @@ class SalesInProvinceLogic extends GetxController {
|
|||||||
|
|
||||||
_updateGovernmentalProductionDateData();
|
_updateGovernmentalProductionDateData();
|
||||||
_updateFreeProductionDateData();
|
_updateFreeProductionDateData();
|
||||||
ever(rootLogic.stewardSalesInfoDashboard, (callback) {
|
ever(rootLogic.stewardRemainWeight, (callback) {
|
||||||
_updateGovernmentalProductionDateData();
|
_updateGovernmentalProductionDateData();
|
||||||
_updateFreeProductionDateData();
|
_updateFreeProductionDateData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateGovernmentalProductionDateData() {
|
void _updateGovernmentalProductionDateData() {
|
||||||
var today = Jalali.now();
|
List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||||
governmentalProductionDateData = {
|
governmentalProductionDateData = {
|
||||||
today.formatCompactDate(): DayData(
|
for (var element in dates)
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalGovernmentalRemainWeight?.toInt(),
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
),
|
value: element.amount?.toInt(),
|
||||||
|
),
|
||||||
today.addDays(-1).formatCompactDate(): DayData(
|
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalGovernmentalRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
|
|
||||||
today.addDays(-2).formatCompactDate(): DayData(
|
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalGovernmentalRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateFreeProductionDateData() {
|
void _updateFreeProductionDateData() {
|
||||||
var today = Jalali.now();
|
var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
||||||
freeProductionDateData = {
|
freeProductionDateData = {
|
||||||
today.formatCompactDate(): DayData(
|
for (var element in dates)
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalFreeRemainWeight?.toInt(),
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
),
|
value: element.amount?.toInt(),
|
||||||
today.addDays(-1).formatCompactDate(): DayData(
|
),
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalFreeRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
today.addDays(-2).formatCompactDate(): DayData(
|
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalFreeRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
|||||||
spacing: 4,
|
spacing: 4,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
controller.getBuyerInformation(item)?.user?.fullname ?? 'نداردشششش',
|
controller.getBuyerInformation(item)?.user?.fullname ?? 'ندارد',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
),
|
),
|
||||||
@@ -528,18 +528,6 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
|||||||
label: 'وزن لاشه (کیلوگرم)',
|
label: 'وزن لاشه (کیلوگرم)',
|
||||||
),
|
),
|
||||||
|
|
||||||
Obx(() {
|
|
||||||
return MonthlyDataCalendar(
|
|
||||||
label: 'تاریخ تولید گوشت',
|
|
||||||
selectedDate: controller.productionDate.value?.formatCompactDate(),
|
|
||||||
onDateSelect: (value) {
|
|
||||||
controller.productionDate.value = value.date;
|
|
||||||
},
|
|
||||||
dayData: controller.quotaType.value == 1
|
|
||||||
? controller.governmentalProductionDateData
|
|
||||||
: controller.freeProductionDateData,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: isEditMode == false,
|
visible: isEditMode == false,
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -752,6 +740,18 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Obx(() {
|
||||||
|
return MonthlyDataCalendar(
|
||||||
|
label: 'تاریخ تولید گوشت',
|
||||||
|
selectedDate: controller.productionDate.value?.formatCompactDate(),
|
||||||
|
onDateSelect: (value) {
|
||||||
|
controller.productionDate.value = value.date;
|
||||||
|
},
|
||||||
|
dayData: controller.quotaType.value == 1
|
||||||
|
? controller.governmentalProductionDateData
|
||||||
|
: controller.freeProductionDateData,
|
||||||
|
);
|
||||||
|
}),
|
||||||
RTextField(
|
RTextField(
|
||||||
variant: RTextFieldVariant.noBorder,
|
variant: RTextFieldVariant.noBorder,
|
||||||
controller: controller.pricePerKiloController,
|
controller: controller.pricePerKiloController,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_pr
|
|||||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.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_free_sale_bar/steward_free_sale_bar.dart';
|
||||||
|
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/sale/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/sale/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/sales_out_of_province_buyers/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/sales_out_of_province_buyers/logic.dart';
|
||||||
@@ -72,42 +73,29 @@ class SalesOutOfProvinceLogic extends GetxController {
|
|||||||
|
|
||||||
_updateGovernmentalProductionDateData();
|
_updateGovernmentalProductionDateData();
|
||||||
_updateFreeProductionDateData();
|
_updateFreeProductionDateData();
|
||||||
ever(rootLogic.stewardSalesInfoDashboard, (callback) {
|
ever(rootLogic.stewardRemainWeight, (callback) {
|
||||||
_updateGovernmentalProductionDateData();
|
_updateGovernmentalProductionDateData();
|
||||||
_updateFreeProductionDateData();
|
_updateFreeProductionDateData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateGovernmentalProductionDateData() {
|
void _updateGovernmentalProductionDateData() {
|
||||||
var today = Jalali.now();
|
List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||||
|
|
||||||
governmentalProductionDateData = {
|
governmentalProductionDateData = {
|
||||||
today.formatCompactDate(): DayData(
|
for (var element in dates)
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalGovernmentalRemainWeight?.toInt(),
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
),
|
value: element.amount?.toInt(),
|
||||||
|
),
|
||||||
today.addDays(-1).formatCompactDate(): DayData(
|
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalGovernmentalRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
|
|
||||||
today.addDays(-2).formatCompactDate(): DayData(
|
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalGovernmentalRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateFreeProductionDateData() {
|
void _updateFreeProductionDateData() {
|
||||||
var today = Jalali.now();
|
var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
||||||
freeProductionDateData = {
|
freeProductionDateData = {
|
||||||
today.formatCompactDate(): DayData(
|
for (var element in dates)
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalFreeRemainWeight?.toInt(),
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
),
|
value: element.amount?.toInt(),
|
||||||
today.addDays(-1).formatCompactDate(): DayData(
|
),
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalFreeRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
today.addDays(-2).formatCompactDate(): DayData(
|
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalFreeRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -385,19 +385,6 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
spacing: 12,
|
spacing: 12,
|
||||||
children: [
|
children: [
|
||||||
Obx(() {
|
|
||||||
return MonthlyDataCalendar(
|
|
||||||
label: 'تاریخ تولید گوشت',
|
|
||||||
selectedDate: controller.productionDate.value?.formatCompactDate(),
|
|
||||||
onDateSelect: (value) {
|
|
||||||
controller.productionDate.value = value.date;
|
|
||||||
},
|
|
||||||
dayData: controller.quotaType.value == 1
|
|
||||||
? controller.governmentalProductionDateData
|
|
||||||
: controller.freeProductionDateData,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
|
|
||||||
Container(
|
Container(
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
@@ -604,6 +591,19 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
Obx(() {
|
||||||
|
return MonthlyDataCalendar(
|
||||||
|
label: 'تاریخ تولید گوشت',
|
||||||
|
selectedDate: controller.productionDate.value?.formatCompactDate(),
|
||||||
|
onDateSelect: (value) {
|
||||||
|
controller.productionDate.value = value.date;
|
||||||
|
},
|
||||||
|
dayData: controller.quotaType.value == 1
|
||||||
|
? controller.governmentalProductionDateData
|
||||||
|
: controller.freeProductionDateData,
|
||||||
|
);
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
|
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
|
||||||
|
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
@@ -51,42 +52,29 @@ class SegmentationLogic extends GetxController {
|
|||||||
|
|
||||||
_updateGovernmentalProductionDateData();
|
_updateGovernmentalProductionDateData();
|
||||||
_updateFreeProductionDateData();
|
_updateFreeProductionDateData();
|
||||||
|
ever(rootLogic.stewardRemainWeight, (callback) {
|
||||||
ever(rootLogic.stewardSalesInfoDashboard, (callback) {
|
|
||||||
_updateGovernmentalProductionDateData();
|
_updateGovernmentalProductionDateData();
|
||||||
_updateFreeProductionDateData();
|
_updateFreeProductionDateData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateGovernmentalProductionDateData() {
|
void _updateGovernmentalProductionDateData() {
|
||||||
var today = Jalali.now();
|
List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||||
governmentalProductionDateData = {
|
governmentalProductionDateData = {
|
||||||
today.formatCompactDate(): DayData(
|
for (var element in dates)
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalGovernmentalRemainWeight?.toInt(),
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
),
|
value: element.amount?.toInt(),
|
||||||
|
),
|
||||||
today.addDays(-1).formatCompactDate(): DayData(
|
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalGovernmentalRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
|
|
||||||
today.addDays(-2).formatCompactDate(): DayData(
|
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalGovernmentalRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateFreeProductionDateData() {
|
void _updateFreeProductionDateData() {
|
||||||
var today = Jalali.now();
|
var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
||||||
freeProductionDateData = {
|
freeProductionDateData = {
|
||||||
today.formatCompactDate(): DayData(
|
for (var element in dates)
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalFreeRemainWeight?.toInt(),
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
),
|
value: element.amount?.toInt(),
|
||||||
today.addDays(-1).formatCompactDate(): DayData(
|
),
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalFreeRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
today.addDays(-2).formatCompactDate(): DayData(
|
|
||||||
value: rootLogic.stewardSalesInfoDashboard.value?.totalFreeRemainWeight?.toInt(),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user