diff --git a/android/local.properties b/android/local.properties index a2855e3..b5a07e1 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.22 -flutter.versionCode=19 \ No newline at end of file +flutter.buildMode=debug +flutter.versionName=1.3.24 +flutter.versionCode=21 \ No newline at end of file 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 76b2cbf..129ce05 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 @@ -314,7 +314,7 @@ class ChickenRemoteDatasourceImp implements ChickenRemoteDatasource { var res = await _httpClient.post( '/steward_free_bar/', headers: {'Authorization': 'Bearer $token'}, - data: body.toJson(), + data: body.toJson()..removeWhere((key, value) => value==null,), ); } diff --git a/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.dart b/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.dart index d041ddf..4bb9478 100644 --- a/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.dart +++ b/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.dart @@ -13,6 +13,7 @@ abstract class StewardAllocationRequest with _$StewardAllocationRequest { int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses, + bool? stewardCheckAllocation }) = _StewardAllocationRequest; factory StewardAllocationRequest.fromJson(Map json) => diff --git a/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.freezed.dart b/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.freezed.dart index 1ac5810..3a8eea3 100644 --- a/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.freezed.dart +++ b/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$StewardAllocationRequest { - bool? get checkAllocation; String? get allocationKey; String? get state; int? get registrationCode; int? get receiverRealNumberOfCarcasses; int? get receiverRealWeightOfCarcasses; int? get weightLossOfCarcasses; + bool? get checkAllocation; String? get allocationKey; String? get state; int? get registrationCode; int? get receiverRealNumberOfCarcasses; int? get receiverRealWeightOfCarcasses; int? get weightLossOfCarcasses; bool? get stewardCheckAllocation; /// Create a copy of StewardAllocationRequest /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -28,16 +28,16 @@ $StewardAllocationRequestCopyWith get copyWith => _$St @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is StewardAllocationRequest&&(identical(other.checkAllocation, checkAllocation) || other.checkAllocation == checkAllocation)&&(identical(other.allocationKey, allocationKey) || other.allocationKey == allocationKey)&&(identical(other.state, state) || other.state == state)&&(identical(other.registrationCode, registrationCode) || other.registrationCode == registrationCode)&&(identical(other.receiverRealNumberOfCarcasses, receiverRealNumberOfCarcasses) || other.receiverRealNumberOfCarcasses == receiverRealNumberOfCarcasses)&&(identical(other.receiverRealWeightOfCarcasses, receiverRealWeightOfCarcasses) || other.receiverRealWeightOfCarcasses == receiverRealWeightOfCarcasses)&&(identical(other.weightLossOfCarcasses, weightLossOfCarcasses) || other.weightLossOfCarcasses == weightLossOfCarcasses)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is StewardAllocationRequest&&(identical(other.checkAllocation, checkAllocation) || other.checkAllocation == checkAllocation)&&(identical(other.allocationKey, allocationKey) || other.allocationKey == allocationKey)&&(identical(other.state, state) || other.state == state)&&(identical(other.registrationCode, registrationCode) || other.registrationCode == registrationCode)&&(identical(other.receiverRealNumberOfCarcasses, receiverRealNumberOfCarcasses) || other.receiverRealNumberOfCarcasses == receiverRealNumberOfCarcasses)&&(identical(other.receiverRealWeightOfCarcasses, receiverRealWeightOfCarcasses) || other.receiverRealWeightOfCarcasses == receiverRealWeightOfCarcasses)&&(identical(other.weightLossOfCarcasses, weightLossOfCarcasses) || other.weightLossOfCarcasses == weightLossOfCarcasses)&&(identical(other.stewardCheckAllocation, stewardCheckAllocation) || other.stewardCheckAllocation == stewardCheckAllocation)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,checkAllocation,allocationKey,state,registrationCode,receiverRealNumberOfCarcasses,receiverRealWeightOfCarcasses,weightLossOfCarcasses); +int get hashCode => Object.hash(runtimeType,checkAllocation,allocationKey,state,registrationCode,receiverRealNumberOfCarcasses,receiverRealWeightOfCarcasses,weightLossOfCarcasses,stewardCheckAllocation); @override String toString() { - return 'StewardAllocationRequest(checkAllocation: $checkAllocation, allocationKey: $allocationKey, state: $state, registrationCode: $registrationCode, receiverRealNumberOfCarcasses: $receiverRealNumberOfCarcasses, receiverRealWeightOfCarcasses: $receiverRealWeightOfCarcasses, weightLossOfCarcasses: $weightLossOfCarcasses)'; + return 'StewardAllocationRequest(checkAllocation: $checkAllocation, allocationKey: $allocationKey, state: $state, registrationCode: $registrationCode, receiverRealNumberOfCarcasses: $receiverRealNumberOfCarcasses, receiverRealWeightOfCarcasses: $receiverRealWeightOfCarcasses, weightLossOfCarcasses: $weightLossOfCarcasses, stewardCheckAllocation: $stewardCheckAllocation)'; } @@ -48,7 +48,7 @@ abstract mixin class $StewardAllocationRequestCopyWith<$Res> { factory $StewardAllocationRequestCopyWith(StewardAllocationRequest value, $Res Function(StewardAllocationRequest) _then) = _$StewardAllocationRequestCopyWithImpl; @useResult $Res call({ - bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses + bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses, bool? stewardCheckAllocation }); @@ -65,7 +65,7 @@ class _$StewardAllocationRequestCopyWithImpl<$Res> /// Create a copy of StewardAllocationRequest /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? checkAllocation = freezed,Object? allocationKey = freezed,Object? state = freezed,Object? registrationCode = freezed,Object? receiverRealNumberOfCarcasses = freezed,Object? receiverRealWeightOfCarcasses = freezed,Object? weightLossOfCarcasses = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? checkAllocation = freezed,Object? allocationKey = freezed,Object? state = freezed,Object? registrationCode = freezed,Object? receiverRealNumberOfCarcasses = freezed,Object? receiverRealWeightOfCarcasses = freezed,Object? weightLossOfCarcasses = freezed,Object? stewardCheckAllocation = freezed,}) { return _then(_self.copyWith( checkAllocation: freezed == checkAllocation ? _self.checkAllocation : checkAllocation // ignore: cast_nullable_to_non_nullable as bool?,allocationKey: freezed == allocationKey ? _self.allocationKey : allocationKey // ignore: cast_nullable_to_non_nullable @@ -74,7 +74,8 @@ as String?,registrationCode: freezed == registrationCode ? _self.registrationCod as int?,receiverRealNumberOfCarcasses: freezed == receiverRealNumberOfCarcasses ? _self.receiverRealNumberOfCarcasses : receiverRealNumberOfCarcasses // ignore: cast_nullable_to_non_nullable as int?,receiverRealWeightOfCarcasses: freezed == receiverRealWeightOfCarcasses ? _self.receiverRealWeightOfCarcasses : receiverRealWeightOfCarcasses // ignore: cast_nullable_to_non_nullable as int?,weightLossOfCarcasses: freezed == weightLossOfCarcasses ? _self.weightLossOfCarcasses : weightLossOfCarcasses // ignore: cast_nullable_to_non_nullable -as int?, +as int?,stewardCheckAllocation: freezed == stewardCheckAllocation ? _self.stewardCheckAllocation : stewardCheckAllocation // ignore: cast_nullable_to_non_nullable +as bool?, )); } @@ -159,10 +160,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses, bool? stewardCheckAllocation)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _StewardAllocationRequest() when $default != null: -return $default(_that.checkAllocation,_that.allocationKey,_that.state,_that.registrationCode,_that.receiverRealNumberOfCarcasses,_that.receiverRealWeightOfCarcasses,_that.weightLossOfCarcasses);case _: +return $default(_that.checkAllocation,_that.allocationKey,_that.state,_that.registrationCode,_that.receiverRealNumberOfCarcasses,_that.receiverRealWeightOfCarcasses,_that.weightLossOfCarcasses,_that.stewardCheckAllocation);case _: return orElse(); } @@ -180,10 +181,10 @@ return $default(_that.checkAllocation,_that.allocationKey,_that.state,_that.regi /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses, bool? stewardCheckAllocation) $default,) {final _that = this; switch (_that) { case _StewardAllocationRequest(): -return $default(_that.checkAllocation,_that.allocationKey,_that.state,_that.registrationCode,_that.receiverRealNumberOfCarcasses,_that.receiverRealWeightOfCarcasses,_that.weightLossOfCarcasses);case _: +return $default(_that.checkAllocation,_that.allocationKey,_that.state,_that.registrationCode,_that.receiverRealNumberOfCarcasses,_that.receiverRealWeightOfCarcasses,_that.weightLossOfCarcasses,_that.stewardCheckAllocation);case _: throw StateError('Unexpected subclass'); } @@ -200,10 +201,10 @@ return $default(_that.checkAllocation,_that.allocationKey,_that.state,_that.regi /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses, bool? stewardCheckAllocation)? $default,) {final _that = this; switch (_that) { case _StewardAllocationRequest() when $default != null: -return $default(_that.checkAllocation,_that.allocationKey,_that.state,_that.registrationCode,_that.receiverRealNumberOfCarcasses,_that.receiverRealWeightOfCarcasses,_that.weightLossOfCarcasses);case _: +return $default(_that.checkAllocation,_that.allocationKey,_that.state,_that.registrationCode,_that.receiverRealNumberOfCarcasses,_that.receiverRealWeightOfCarcasses,_that.weightLossOfCarcasses,_that.stewardCheckAllocation);case _: return null; } @@ -215,7 +216,7 @@ return $default(_that.checkAllocation,_that.allocationKey,_that.state,_that.regi @JsonSerializable() class _StewardAllocationRequest implements StewardAllocationRequest { - const _StewardAllocationRequest({this.checkAllocation, this.allocationKey, this.state, this.registrationCode, this.receiverRealNumberOfCarcasses, this.receiverRealWeightOfCarcasses, this.weightLossOfCarcasses}); + const _StewardAllocationRequest({this.checkAllocation, this.allocationKey, this.state, this.registrationCode, this.receiverRealNumberOfCarcasses, this.receiverRealWeightOfCarcasses, this.weightLossOfCarcasses, this.stewardCheckAllocation}); factory _StewardAllocationRequest.fromJson(Map json) => _$StewardAllocationRequestFromJson(json); @override final bool? checkAllocation; @@ -225,6 +226,7 @@ class _StewardAllocationRequest implements StewardAllocationRequest { @override final int? receiverRealNumberOfCarcasses; @override final int? receiverRealWeightOfCarcasses; @override final int? weightLossOfCarcasses; +@override final bool? stewardCheckAllocation; /// Create a copy of StewardAllocationRequest /// with the given fields replaced by the non-null parameter values. @@ -239,16 +241,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _StewardAllocationRequest&&(identical(other.checkAllocation, checkAllocation) || other.checkAllocation == checkAllocation)&&(identical(other.allocationKey, allocationKey) || other.allocationKey == allocationKey)&&(identical(other.state, state) || other.state == state)&&(identical(other.registrationCode, registrationCode) || other.registrationCode == registrationCode)&&(identical(other.receiverRealNumberOfCarcasses, receiverRealNumberOfCarcasses) || other.receiverRealNumberOfCarcasses == receiverRealNumberOfCarcasses)&&(identical(other.receiverRealWeightOfCarcasses, receiverRealWeightOfCarcasses) || other.receiverRealWeightOfCarcasses == receiverRealWeightOfCarcasses)&&(identical(other.weightLossOfCarcasses, weightLossOfCarcasses) || other.weightLossOfCarcasses == weightLossOfCarcasses)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _StewardAllocationRequest&&(identical(other.checkAllocation, checkAllocation) || other.checkAllocation == checkAllocation)&&(identical(other.allocationKey, allocationKey) || other.allocationKey == allocationKey)&&(identical(other.state, state) || other.state == state)&&(identical(other.registrationCode, registrationCode) || other.registrationCode == registrationCode)&&(identical(other.receiverRealNumberOfCarcasses, receiverRealNumberOfCarcasses) || other.receiverRealNumberOfCarcasses == receiverRealNumberOfCarcasses)&&(identical(other.receiverRealWeightOfCarcasses, receiverRealWeightOfCarcasses) || other.receiverRealWeightOfCarcasses == receiverRealWeightOfCarcasses)&&(identical(other.weightLossOfCarcasses, weightLossOfCarcasses) || other.weightLossOfCarcasses == weightLossOfCarcasses)&&(identical(other.stewardCheckAllocation, stewardCheckAllocation) || other.stewardCheckAllocation == stewardCheckAllocation)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,checkAllocation,allocationKey,state,registrationCode,receiverRealNumberOfCarcasses,receiverRealWeightOfCarcasses,weightLossOfCarcasses); +int get hashCode => Object.hash(runtimeType,checkAllocation,allocationKey,state,registrationCode,receiverRealNumberOfCarcasses,receiverRealWeightOfCarcasses,weightLossOfCarcasses,stewardCheckAllocation); @override String toString() { - return 'StewardAllocationRequest(checkAllocation: $checkAllocation, allocationKey: $allocationKey, state: $state, registrationCode: $registrationCode, receiverRealNumberOfCarcasses: $receiverRealNumberOfCarcasses, receiverRealWeightOfCarcasses: $receiverRealWeightOfCarcasses, weightLossOfCarcasses: $weightLossOfCarcasses)'; + return 'StewardAllocationRequest(checkAllocation: $checkAllocation, allocationKey: $allocationKey, state: $state, registrationCode: $registrationCode, receiverRealNumberOfCarcasses: $receiverRealNumberOfCarcasses, receiverRealWeightOfCarcasses: $receiverRealWeightOfCarcasses, weightLossOfCarcasses: $weightLossOfCarcasses, stewardCheckAllocation: $stewardCheckAllocation)'; } @@ -259,7 +261,7 @@ abstract mixin class _$StewardAllocationRequestCopyWith<$Res> implements $Stewar factory _$StewardAllocationRequestCopyWith(_StewardAllocationRequest value, $Res Function(_StewardAllocationRequest) _then) = __$StewardAllocationRequestCopyWithImpl; @override @useResult $Res call({ - bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses + bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses, bool? stewardCheckAllocation }); @@ -276,7 +278,7 @@ class __$StewardAllocationRequestCopyWithImpl<$Res> /// Create a copy of StewardAllocationRequest /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? checkAllocation = freezed,Object? allocationKey = freezed,Object? state = freezed,Object? registrationCode = freezed,Object? receiverRealNumberOfCarcasses = freezed,Object? receiverRealWeightOfCarcasses = freezed,Object? weightLossOfCarcasses = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? checkAllocation = freezed,Object? allocationKey = freezed,Object? state = freezed,Object? registrationCode = freezed,Object? receiverRealNumberOfCarcasses = freezed,Object? receiverRealWeightOfCarcasses = freezed,Object? weightLossOfCarcasses = freezed,Object? stewardCheckAllocation = freezed,}) { return _then(_StewardAllocationRequest( checkAllocation: freezed == checkAllocation ? _self.checkAllocation : checkAllocation // ignore: cast_nullable_to_non_nullable as bool?,allocationKey: freezed == allocationKey ? _self.allocationKey : allocationKey // ignore: cast_nullable_to_non_nullable @@ -285,7 +287,8 @@ as String?,registrationCode: freezed == registrationCode ? _self.registrationCod as int?,receiverRealNumberOfCarcasses: freezed == receiverRealNumberOfCarcasses ? _self.receiverRealNumberOfCarcasses : receiverRealNumberOfCarcasses // ignore: cast_nullable_to_non_nullable as int?,receiverRealWeightOfCarcasses: freezed == receiverRealWeightOfCarcasses ? _self.receiverRealWeightOfCarcasses : receiverRealWeightOfCarcasses // ignore: cast_nullable_to_non_nullable as int?,weightLossOfCarcasses: freezed == weightLossOfCarcasses ? _self.weightLossOfCarcasses : weightLossOfCarcasses // ignore: cast_nullable_to_non_nullable -as int?, +as int?,stewardCheckAllocation: freezed == stewardCheckAllocation ? _self.stewardCheckAllocation : stewardCheckAllocation // ignore: cast_nullable_to_non_nullable +as bool?, )); } diff --git a/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.g.dart b/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.g.dart index d463989..6bef1b4 100644 --- a/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.g.dart +++ b/packages/chicken/lib/data/models/request/steward_allocation/steward_allocation_request.g.dart @@ -18,6 +18,7 @@ _StewardAllocationRequest _$StewardAllocationRequestFromJson( receiverRealWeightOfCarcasses: (json['receiver_real_weight_of_carcasses'] as num?)?.toInt(), weightLossOfCarcasses: (json['weight_loss_of_carcasses'] as num?)?.toInt(), + stewardCheckAllocation: json['steward_check_allocation'] as bool?, ); Map _$StewardAllocationRequestToJson( @@ -30,4 +31,5 @@ Map _$StewardAllocationRequestToJson( 'receiver_real_number_of_carcasses': instance.receiverRealNumberOfCarcasses, 'receiver_real_weight_of_carcasses': instance.receiverRealWeightOfCarcasses, 'weight_loss_of_carcasses': instance.weightLossOfCarcasses, + 'steward_check_allocation': instance.stewardCheckAllocation, }; diff --git a/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/logic.dart b/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/logic.dart index 64a0ee7..0ac0181 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/logic.dart @@ -35,6 +35,11 @@ class BuyInProvinceAllLogic extends GetxController { void onReady() { debounce(searchedValue, (callback) => getAllArrivals(), time: Duration(milliseconds: 2000)); super.onReady(); + ever(approvedWithOtpCode, (callback) { + if (callback == false) { + approvedWithOtpController.clear(); + } + }); } @override @@ -95,7 +100,9 @@ class BuyInProvinceAllLogic extends GetxController { state: 'accepted', receiverRealNumberOfCarcasses: model.realNumberOfCarcasses ?? 0, receiverRealWeightOfCarcasses: model.realWeightOfCarcasses?.toInt() ?? 0, - registrationCode: model.registrationCode, + registrationCode: approvedWithOtpCode.value + ? int.parse(approvedWithOtpController.text) + : null, weightLossOfCarcasses: model.weightLossOfCarcasses?.toInt() ?? 0, ).toJson(); request.removeWhere((key, value) => value == null); diff --git a/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/view.dart b/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/view.dart index 6c9d3c8..f865157 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_in_province_all/view.dart @@ -125,7 +125,7 @@ class BuyInProvinceAllPage extends GetView { mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - item.steward?.user?.fullname ?? 'N/A', + item.toSteward?.user?.fullname ?? 'N/A', textAlign: TextAlign.center, style: AppFonts.yekan16.copyWith(color: AppColor.greenDark), ), @@ -184,19 +184,27 @@ class BuyInProvinceAllPage extends GetView { ), ), - buildRow(title: 'مشخصات فروشنده', value: item.steward?.user?.fullname ?? 'N/A'), + buildRow(title: 'مشخصات فروشنده', value: item.toSteward?.user?.fullname ?? 'N/A'), buildRow( title: 'تلفن فروشنده', - value: item.steward?.user?.mobile ?? 'N/A', + value: item.toSteward?.user?.mobile ?? 'N/A', valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), ), buildRow(title: 'نوع تخصیص', value: item.allocationType?.faAllocationType ?? 'N/A'), + buildRow(title: ' سهمیه', value: item.quota?.faTitle ?? 'N/A'), buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'), buildRow( title: 'وزن خریداری شده', value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم', ), + buildRow( + title: 'قیمت هر کیلوگرم', + titleLabel:(item.approvedPriceStatus ?? false) ? 'مصوب' : 'آزاد' , + titleLabelStyle: AppFonts.yekan14Bold.copyWith(color: AppColor.greenNormal), + value: '${item.amount?.separatedByCommaFa} ریال', + ), buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByCommaFa} ریال'), + Visibility( visible: item.receiverState == 'pending', child: Row( @@ -210,12 +218,14 @@ class BuyInProvinceAllPage extends GetView { height: 40.h, isLoading: data[item.key!] ?? false, onPressed: () async { - Get.bottomSheet(conformationBottomSheet(item), isScrollControlled: true).then( - (value) { - Get.back(); - controller.clearApprovedController(); - }, - ); + await Get.bottomSheet( + conformationBottomSheet(item), + isScrollControlled: true, + ).then((value) { + + Get.back(); + controller.clearApprovedController(); + }); }, textStyle: AppFonts.yekan20.copyWith(color: Colors.white), backgroundColor: AppColor.greenNormal, diff --git a/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/logic.dart b/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/logic.dart index 1037e85..b537576 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/logic.dart @@ -17,6 +17,7 @@ class BuyInProvinceWaitingLogic extends GetxController { RxInt currentPage = 1.obs; final RxBool isLoadingMoreAllocationsMade = false.obs; StewardRootLogic rootLogic = Get.find(); + RxBool isButtonConfirm = false.obs; Rx>> waitingProduct = Resource>.loading().obs; @@ -42,6 +43,9 @@ class BuyInProvinceWaitingLogic extends GetxController { void onReady() { super.onReady(); getWaitingArrivals(); + approvedWithOtpController.addListener(() { + isButtonConfirm.value = approvedWithOtpController.text.trim().length > 4; + }); } @override @@ -106,13 +110,17 @@ class BuyInProvinceWaitingLogic extends GetxController { state: 'accepted', receiverRealNumberOfCarcasses: model.realNumberOfCarcasses ?? 0, receiverRealWeightOfCarcasses: model.realWeightOfCarcasses?.toInt() ?? 0, - registrationCode: model.registrationCode, + registrationCode: approvedWithOtpCode.value + ? int.parse(approvedWithOtpController.text.trim()) + : null, weightLossOfCarcasses: model.weightLossOfCarcasses?.toInt() ?? 0, + stewardCheckAllocation: true, ).toJson(); request.removeWhere((key, value) => value == null); safeCall( showError: true, + showSuccess: true, call: () async => await rootLogic.chickenRepository.setSateForArrivals( token: rootLogic.tokenService.accessToken.value!, request: request, @@ -125,7 +133,10 @@ class BuyInProvinceWaitingLogic extends GetxController { rootLogic.onRefresh(); clearApprovedController(); toggleExpansion(); - Get.back(); + Future.delayed(Duration(seconds: 3), () { + Get.back(); + Get.back(); + }); }, ); } diff --git a/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/view.dart b/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/view.dart index 7fed124..515c6eb 100644 --- a/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/buy_in_province_waiting/view.dart @@ -128,7 +128,7 @@ class BuyInProvinceWaitingPage extends GetView { mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - item.steward?.user?.fullname ?? 'N/A', + item.toSteward?.user?.fullname ?? 'N/A', textAlign: TextAlign.center, style: AppFonts.yekan16.copyWith(color: AppColor.greenDark), ), @@ -189,14 +189,20 @@ class BuyInProvinceWaitingPage extends GetView { value: item.toSteward?.user?.mobile ?? 'N/A', valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), ), - buildRow(title: 'نوع تخصیص', value: item.quota?.faTitle ?? 'N/A'), - buildRow(title: 'سهمیه', value: item.allocationType?.faAllocationType ?? 'N/A'), + buildRow(title: 'نوع تخصیص', value: item.allocationType?.faAllocationType ?? 'N/A'), + buildRow(title: ' سهمیه', value: item.quota?.faTitle ?? 'N/A'), buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'), buildRow( title: 'وزن خریداری شده', value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم', ), - buildRow(title: 'قیمت هر کیلو', value: '${item.amount?.separatedByCommaFa} ریال'), + buildRow( + title: 'قیمت هر کیلوگرم', + titleLabel: (item.approvedPriceStatus ?? false) ? 'مصوب' : 'آزاد', + titleLabelStyle: AppFonts.yekan14Bold.copyWith(color: AppColor.greenNormal), + value: '${item.amount?.separatedByCommaFa} ریال', + ), + buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByCommaFa} ریال'), Row( @@ -241,10 +247,11 @@ class BuyInProvinceWaitingPage extends GetView { Widget conformationBottomSheet(WaitingArrivalModel item) { controller.weightController.text = item.weightOfCarcasses.separatedByComma; return BaseBottomSheet( - height: 430.h, + height: 450.h, child: Column( mainAxisSize: MainAxisSize.min, children: [ + SizedBox(height: 10), RTextField( label: 'وزن(کیلوگرم)', controller: controller.weightController, @@ -301,6 +308,7 @@ class BuyInProvinceWaitingPage extends GetView { controller: controller.approvedWithOtpController, label: 'کد احراز', keyboardType: TextInputType.number, + maxLength: 5, ), visible: data.value, ), @@ -308,10 +316,10 @@ class BuyInProvinceWaitingPage extends GetView { ); }, controller.approvedWithOtpCode), SizedBox(height: 30.h), - ObxValue((data) { + Obx(() { return RElevated( enabled: controller.approvedWithOtpCode.value - ? controller.approvedWithOtpController.text.isNotEmpty + ? controller.isButtonConfirm.value : true, text: 'تایید', onPressed: () async { @@ -319,7 +327,7 @@ class BuyInProvinceWaitingPage extends GetView { }, isFullWidth: true, ); - }, controller.approvedWithOtpCode), + }), SizedBox(height: 20.h), ], ), 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 73ad0fe..52e0a59 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 @@ -221,6 +221,7 @@ class BuyOutOfProvinceLogic extends GetxController { sellerNameController.clear(); sellerPhoneController.clear(); carcassWeightController.clear(); + carcassCountController.clear(); selectedProvince.value = null; selectedCity.value = null; selectedImage.value = null; 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 8f2c37e..f6b9076 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 @@ -274,7 +274,7 @@ class SalesInProvinceLogic extends GetxController { void setSubmitData() { tmpStewardAllocation = SubmitStewardAllocation( - approvedPriceStatus: broadcastPrice.value?.active ?? false, + approvedPriceStatus: priceType.value==1, allocationType: '${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}', sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild", 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 2d26b0d..736b3d7 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 @@ -303,8 +303,9 @@ class SalesInProvincePage extends GetView { value: controller.getBuyerInformation(item)?.user?.mobile ?? 'N/A', valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), ), - buildRow(title: 'نوع فروش', value: item.sellType?.faItem ?? 'N/A'), buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'), + buildRow(title: 'نوع فروش', value: item.sellType?.faItem ?? 'N/A'), + buildRow(title: 'نوع تخصیص', value: item.allocationType?.faAllocationType ?? 'N/A'), buildRow( title: 'وزن خریداری شده', @@ -314,6 +315,12 @@ class SalesInProvincePage extends GetView { title: 'افت وزن(کیلوگرم)', value: item.weightLossOfCarcasses?.toInt().toString() ?? 'N/A', ), + buildRow( + title: 'قیمت هر کیلوگرم', + titleLabel: (item.approvedPriceStatus ?? false) ? 'مصوب' : 'آزاد', + titleLabelStyle: AppFonts.yekan14Bold.copyWith(color: AppColor.greenNormal), + value: '${item.amount?.separatedByCommaFa} ریال', + ), buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByCommaFa} ریال'), buildRow(title: 'کداحراز', value: item.registrationCode?.toString() ?? 'ندارد'), 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 9c10721..75bcba2 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 @@ -129,10 +129,23 @@ class SalesOutOfProvincePage extends GetView { SizedBox(width: 12), Expanded( flex: 3, - child: Text( - item.date?.formattedJalaliDate ?? 'N/A', - textAlign: TextAlign.center, - style: AppFonts.yekan12.copyWith(color: AppColor.bgDark), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + spacing: 4, + children: [ + Text( + item.date?.formattedJalaliDate ?? 'N/A', + textAlign: TextAlign.center, + style: AppFonts.yekan12.copyWith(color: AppColor.bgDark), + ), + + Text( + '${item.weightOfCarcasses?.separatedByCommaFa ?? 0}KG', + textAlign: TextAlign.center, + style: AppFonts.yekan12Bold.copyWith(color: AppColor.textColor), + ), + + ], ), ), SizedBox(width: 4), @@ -163,27 +176,22 @@ class SalesOutOfProvincePage extends GetView { mainAxisAlignment: MainAxisAlignment.center, spacing: 8, children: [ + + Text( - item.buyer?.unitName ?? 'N/A', + item.buyer?.province?? 'N/A', textAlign: TextAlign.center, style: AppFonts.yekan12.copyWith(color: AppColor.bgDark), ), Text( - '${item.weightOfCarcasses?.separatedByCommaFa ?? 0}KG', + item.buyer?.city?? 'N/A', textAlign: TextAlign.center, style: AppFonts.yekan12.copyWith(color: AppColor.bgDark), ), ], ), ), - Expanded( - flex: 2, - child: Text( - '${item.buyer?.province}\n${item.buyer?.city}', - textAlign: TextAlign.center, - style: AppFonts.yekan12.copyWith(color: AppColor.bgDark), - ), - ), + ], ); } diff --git a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/view.dart b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/view.dart index 8b96b83..d901948 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_out_of_province_sales_list/view.dart @@ -123,14 +123,7 @@ class SalesOutOfProvinceSalesListPage extends GetView { Widget addOrEditBottomSheet([bool isOnEdit = false]) { return BaseBottomSheet( - height: 500.h, + height: 550.h, child: SingleChildScrollView( child: Form( key: controller.formKey, diff --git a/packages/chicken/lib/presentation/widget/steward/inventory_widget.dart b/packages/chicken/lib/presentation/widget/steward/inventory_widget.dart index 8c864e5..f96f465 100644 --- a/packages/chicken/lib/presentation/widget/steward/inventory_widget.dart +++ b/packages/chicken/lib/presentation/widget/steward/inventory_widget.dart @@ -18,15 +18,16 @@ Widget inventoryWidget(StewardRootLogic rootLogic) { return _itemList( title: 'موجودی انبار', value: value ?? '', // در صورت نال بودن، رشته خالی نمایش داده شود + color: const Color(0xFFEAFBFC), ); }, rootLogic.inventoryModel), ObxValue((data) { final value = data.value?.totalGovernmentalRemainWeight?.separatedByCommaFa; - return _itemList(title: 'مانده دولتی', value: value ?? ''); + return _itemList(title: 'مانده دولتی', value: value ?? '',color: const Color(0xFFF5ECEE),); }, rootLogic.stewardSalesInfoDashboard), ObxValue((data) { final value = data.value?.totalFreeRemainWeight?.separatedByCommaFa; - return _itemList(title: 'مانده آزاد', value: value ?? ''); + return _itemList(title: 'مانده آزاد', value: value ?? '',color: const Color(0xFFF1E7FF)); }, rootLogic.stewardSalesInfoDashboard), ], ), @@ -34,13 +35,13 @@ Widget inventoryWidget(StewardRootLogic rootLogic) { ); } -Widget _itemList({required String title, required String? value, String? unit}) { +Widget _itemList({required String title, required String? value, String? unit,Color? color}) { return Container( width: 125.w, height: 50.h, clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( - color: Colors.white.withValues(alpha: 0.40), + color: color??Colors.white.withValues(alpha: 0.40), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), ), child: Column( diff --git a/packages/core/lib/presentation/widget/list_item/list_item2.dart b/packages/core/lib/presentation/widget/list_item/list_item2.dart index ce03b59..6361e01 100644 --- a/packages/core/lib/presentation/widget/list_item/list_item2.dart +++ b/packages/core/lib/presentation/widget/list_item/list_item2.dart @@ -49,7 +49,7 @@ class ExpandableListItem2 extends StatelessWidget { children: [ Expanded( child: Container( - height: 50.h, + height: 55.h, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( diff --git a/packages/core/lib/presentation/widget/list_row_item.dart b/packages/core/lib/presentation/widget/list_row_item.dart index 115862b..8798ff2 100644 --- a/packages/core/lib/presentation/widget/list_row_item.dart +++ b/packages/core/lib/presentation/widget/list_row_item.dart @@ -4,8 +4,12 @@ import 'package:rasadyar_core/core.dart'; Widget buildRow({ required String title, required String value, + String? titleLabel, + String? valueLabel, TextStyle? titleStyle, TextStyle? valueStyle, + TextStyle? titleLabelStyle, + TextStyle? valueLabelStyle, }) { return Padding( padding: const EdgeInsets.symmetric(vertical: 4.0), @@ -14,18 +18,44 @@ Widget buildRow({ children: [ Flexible( flex: 2, - child: Text( - title, - textAlign: TextAlign.right, - style: titleStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), + child: RichText( + text: TextSpan( + children: [ + TextSpan( + text: title, + style: titleStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), + ), + if (titleLabel != null) ...[ + TextSpan( + text: ' ($titleLabel)', + style: + titleLabelStyle ?? + AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkHover), + ), + ], + ], + ), ), ), Flexible( flex: 2, - child: Text( - value, - textAlign: TextAlign.left, - style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), + child: RichText( + text: TextSpan( + children: [ + TextSpan( + text: value, + style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), + ), + if (valueLabel != null) ...[ + TextSpan( + text: ' ($valueLabel)', + style: + valueLabelStyle ?? + AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkHover), + ), + ], + ], + ), ), ), ], @@ -109,7 +139,7 @@ Widget buildUnitRow({ style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), Visibility( - visible: value != null ||( value?.isNotEmpty ?? false), + visible: value != null || (value?.isNotEmpty ?? false), child: Text( unit, textAlign: TextAlign.left, diff --git a/packages/core/lib/utils/network/safe_call_utils.dart b/packages/core/lib/utils/network/safe_call_utils.dart index 06153a0..b2fd24e 100644 --- a/packages/core/lib/utils/network/safe_call_utils.dart +++ b/packages/core/lib/utils/network/safe_call_utils.dart @@ -153,13 +153,13 @@ void _defaultHideLoading() { void defaultShowSuccessMessage( String message, { - int durationInSeconds = 2, + int durationInSeconds = 1500, VoidCallback? onDismissed, }) { Get.snackbar( 'موفقیت', message, - duration: Duration(seconds: durationInSeconds), + duration: Duration(milliseconds: durationInSeconds), snackPosition: SnackPosition.TOP, backgroundColor: Colors.green, snackbarStatus: (status) { diff --git a/pubspec.yaml b/pubspec.yaml index 2106e6c..f1df7bc 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.22+19 +version: 1.3.24+21 environment: sdk: ^3.9.2