feat : new changes from back

This commit is contained in:
2025-10-12 17:05:40 +03:30
parent e67d3e8c04
commit 50a59e9a2e
20 changed files with 168 additions and 86 deletions

View File

@@ -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
flutter.buildMode=debug
flutter.versionName=1.3.24
flutter.versionCode=21

View File

@@ -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,),
);
}

View File

@@ -13,6 +13,7 @@ abstract class StewardAllocationRequest with _$StewardAllocationRequest {
int? receiverRealNumberOfCarcasses,
int? receiverRealWeightOfCarcasses,
int? weightLossOfCarcasses,
bool? stewardCheckAllocation
}) = _StewardAllocationRequest;
factory StewardAllocationRequest.fromJson(Map<String, dynamic> json) =>

View File

@@ -15,7 +15,7 @@ T _$identity<T>(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<StewardAllocationRequest> 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 extends Object?>(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 extends Object?>(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 extends Object?>(TResult Function( bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(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 extends Object?>(TResult? Function( bool? checkAllocation, String? allocationKey, String? state, int? registrationCode, int? receiverRealNumberOfCarcasses, int? receiverRealWeightOfCarcasses, int? weightLossOfCarcasses)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(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<String, dynamic> 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<String, dynamic> 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?,
));
}

View File

@@ -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<String, dynamic> _$StewardAllocationRequestToJson(
@@ -30,4 +31,5 @@ Map<String, dynamic> _$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,
};

View File

@@ -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);

View File

@@ -125,7 +125,7 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
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<BuyInProvinceAllLogic> {
),
),
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<BuyInProvinceAllLogic> {
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,

View File

@@ -17,6 +17,7 @@ class BuyInProvinceWaitingLogic extends GetxController {
RxInt currentPage = 1.obs;
final RxBool isLoadingMoreAllocationsMade = false.obs;
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
RxBool isButtonConfirm = false.obs;
Rx<Resource<PaginationModel<WaitingArrivalModel>>> waitingProduct =
Resource<PaginationModel<WaitingArrivalModel>>.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();
});
},
);
}

View File

@@ -128,7 +128,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
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<BuyInProvinceWaitingLogic> {
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<BuyInProvinceWaitingLogic> {
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<BuyInProvinceWaitingLogic> {
controller: controller.approvedWithOtpController,
label: 'کد احراز',
keyboardType: TextInputType.number,
maxLength: 5,
),
visible: data.value,
),
@@ -308,10 +316,10 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
);
}, 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<BuyInProvinceWaitingLogic> {
},
isFullWidth: true,
);
}, controller.approvedWithOtpCode),
}),
SizedBox(height: 20.h),
],
),

View File

@@ -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;

View File

@@ -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",

View File

@@ -303,8 +303,9 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
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<SalesInProvinceLogic> {
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() ?? 'ندارد'),

View File

@@ -129,10 +129,23 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
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<SalesOutOfProvinceLogic> {
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),
),
),
],
);
}

View File

@@ -123,14 +123,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
],
),
),
Expanded(
flex: 2,
child: Text(
'${item.buyer?.province}\n${item.buyer?.city}',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
),
),
],
);
}

View File

@@ -255,7 +255,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
Widget addOrEditBottomSheet([bool isOnEdit = false]) {
return BaseBottomSheet(
height: 500.h,
height: 550.h,
child: SingleChildScrollView(
child: Form(
key: controller.formKey,

View File

@@ -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(

View File

@@ -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(

View File

@@ -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,

View File

@@ -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) {

View File

@@ -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