fix : new ui changes

This commit is contained in:
2025-07-21 15:06:19 +03:30
parent e2300293a7
commit 99503a2d72
12 changed files with 66 additions and 29 deletions

View File

@@ -472,7 +472,7 @@ class ChickenRemoteDatasourceImp implements ChickenRemoteDatasource {
required String token,
required String key,
}) async {
var res = await _httpClient.delete(
var res = await _httpClient.delete<SegmentationModel?>(
'/app-segmentation/0/',
queryParameters: {'key': key},
headers: {'Authorization': 'Bearer $token'},

View File

@@ -10,6 +10,7 @@ abstract class SegmentationModel with _$SegmentationModel {
String? key,
String? productKey,
String? guildKey,
String? result,
int? weight,
Buyer? buyer,
DateTime? date,

View File

@@ -16,7 +16,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$SegmentationModel {
String? get key; String? get productKey; String? get guildKey; int? get weight; Buyer? get buyer; DateTime? get date; ToGuild? get toGuild;
String? get key; String? get productKey; String? get guildKey; String? get result; int? get weight; Buyer? get buyer; DateTime? get date; ToGuild? get toGuild;
/// Create a copy of SegmentationModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -29,16 +29,16 @@ $SegmentationModelCopyWith<SegmentationModel> get copyWith => _$SegmentationMode
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SegmentationModel&&(identical(other.key, key) || other.key == key)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.date, date) || other.date == date)&&(identical(other.toGuild, toGuild) || other.toGuild == toGuild));
return identical(this, other) || (other.runtimeType == runtimeType&&other is SegmentationModel&&(identical(other.key, key) || other.key == key)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.result, result) || other.result == result)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.date, date) || other.date == date)&&(identical(other.toGuild, toGuild) || other.toGuild == toGuild));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,productKey,guildKey,weight,buyer,date,toGuild);
int get hashCode => Object.hash(runtimeType,key,productKey,guildKey,result,weight,buyer,date,toGuild);
@override
String toString() {
return 'SegmentationModel(key: $key, productKey: $productKey, guildKey: $guildKey, weight: $weight, buyer: $buyer, date: $date, toGuild: $toGuild)';
return 'SegmentationModel(key: $key, productKey: $productKey, guildKey: $guildKey, result: $result, weight: $weight, buyer: $buyer, date: $date, toGuild: $toGuild)';
}
@@ -49,7 +49,7 @@ abstract mixin class $SegmentationModelCopyWith<$Res> {
factory $SegmentationModelCopyWith(SegmentationModel value, $Res Function(SegmentationModel) _then) = _$SegmentationModelCopyWithImpl;
@useResult
$Res call({
String? key, String? productKey, String? guildKey, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild
String? key, String? productKey, String? guildKey, String? result, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild
});
@@ -66,11 +66,12 @@ class _$SegmentationModelCopyWithImpl<$Res>
/// Create a copy of SegmentationModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? productKey = freezed,Object? guildKey = freezed,Object? weight = freezed,Object? buyer = freezed,Object? date = freezed,Object? toGuild = freezed,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? productKey = freezed,Object? guildKey = freezed,Object? result = freezed,Object? weight = freezed,Object? buyer = freezed,Object? date = freezed,Object? toGuild = freezed,}) {
return _then(_self.copyWith(
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable
as String?,guildKey: freezed == guildKey ? _self.guildKey : guildKey // ignore: cast_nullable_to_non_nullable
as String?,result: freezed == result ? _self.result : result // ignore: cast_nullable_to_non_nullable
as String?,weight: freezed == weight ? _self.weight : weight // ignore: cast_nullable_to_non_nullable
as int?,buyer: freezed == buyer ? _self.buyer : buyer // ignore: cast_nullable_to_non_nullable
as Buyer?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable
@@ -110,12 +111,13 @@ $ToGuildCopyWith<$Res>? get toGuild {
@JsonSerializable()
class _SegmentationModel implements SegmentationModel {
const _SegmentationModel({this.key, this.productKey, this.guildKey, this.weight, this.buyer, this.date, this.toGuild});
const _SegmentationModel({this.key, this.productKey, this.guildKey, this.result, this.weight, this.buyer, this.date, this.toGuild});
factory _SegmentationModel.fromJson(Map<String, dynamic> json) => _$SegmentationModelFromJson(json);
@override final String? key;
@override final String? productKey;
@override final String? guildKey;
@override final String? result;
@override final int? weight;
@override final Buyer? buyer;
@override final DateTime? date;
@@ -134,16 +136,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SegmentationModel&&(identical(other.key, key) || other.key == key)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.date, date) || other.date == date)&&(identical(other.toGuild, toGuild) || other.toGuild == toGuild));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SegmentationModel&&(identical(other.key, key) || other.key == key)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.result, result) || other.result == result)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.date, date) || other.date == date)&&(identical(other.toGuild, toGuild) || other.toGuild == toGuild));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,productKey,guildKey,weight,buyer,date,toGuild);
int get hashCode => Object.hash(runtimeType,key,productKey,guildKey,result,weight,buyer,date,toGuild);
@override
String toString() {
return 'SegmentationModel(key: $key, productKey: $productKey, guildKey: $guildKey, weight: $weight, buyer: $buyer, date: $date, toGuild: $toGuild)';
return 'SegmentationModel(key: $key, productKey: $productKey, guildKey: $guildKey, result: $result, weight: $weight, buyer: $buyer, date: $date, toGuild: $toGuild)';
}
@@ -154,7 +156,7 @@ abstract mixin class _$SegmentationModelCopyWith<$Res> implements $SegmentationM
factory _$SegmentationModelCopyWith(_SegmentationModel value, $Res Function(_SegmentationModel) _then) = __$SegmentationModelCopyWithImpl;
@override @useResult
$Res call({
String? key, String? productKey, String? guildKey, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild
String? key, String? productKey, String? guildKey, String? result, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild
});
@@ -171,11 +173,12 @@ class __$SegmentationModelCopyWithImpl<$Res>
/// Create a copy of SegmentationModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? productKey = freezed,Object? guildKey = freezed,Object? weight = freezed,Object? buyer = freezed,Object? date = freezed,Object? toGuild = freezed,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? productKey = freezed,Object? guildKey = freezed,Object? result = freezed,Object? weight = freezed,Object? buyer = freezed,Object? date = freezed,Object? toGuild = freezed,}) {
return _then(_SegmentationModel(
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable
as String?,guildKey: freezed == guildKey ? _self.guildKey : guildKey // ignore: cast_nullable_to_non_nullable
as String?,result: freezed == result ? _self.result : result // ignore: cast_nullable_to_non_nullable
as String?,weight: freezed == weight ? _self.weight : weight // ignore: cast_nullable_to_non_nullable
as int?,buyer: freezed == buyer ? _self.buyer : buyer // ignore: cast_nullable_to_non_nullable
as Buyer?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable

View File

@@ -11,6 +11,7 @@ _SegmentationModel _$SegmentationModelFromJson(Map<String, dynamic> json) =>
key: json['key'] as String?,
productKey: json['product_key'] as String?,
guildKey: json['guild_key'] as String?,
result: json['result'] as String?,
weight: (json['weight'] as num?)?.toInt(),
buyer: json['buyer'] == null
? null
@@ -28,6 +29,7 @@ Map<String, dynamic> _$SegmentationModelToJson(_SegmentationModel instance) =>
'key': instance.key,
'product_key': instance.productKey,
'guild_key': instance.guildKey,
'result': instance.result,
'weight': instance.weight,
'buyer': instance.buyer,
'date': instance.date?.toIso8601String(),

View File

@@ -74,6 +74,7 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
Expanded(
flex: 3,
child: Column(
spacing: 3,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -98,7 +99,11 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
],
),
SizedBox(height: 2),
Text(
item.steward?.guildsName ?? 'N/A',
textAlign: TextAlign.start,
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
),
],
),
),
@@ -186,7 +191,7 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
),
buildRow(
title: 'نام و نام خانوادگی فروشنده',
title: 'مشخصات فروشنده',
value: item.steward?.user?.fullname ?? 'N/A',
),
buildRow(
@@ -194,7 +199,10 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
value: item.steward?.user?.mobile ?? 'N/A',
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
buildRow(
title: 'نوع تخصیص',
value: item.allocationType?.faAllocationType ?? 'N/A',
),
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
buildRow(
title: 'وزن خریداری شده',

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_core/core.dart';
@@ -75,7 +76,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
spacing: 3,
children: [
Text(
item.toSteward?.user?.fullname ?? 'N/A',
item.steward?.user?.fullname ?? 'N/A',
textAlign: TextAlign.start,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
@@ -90,6 +91,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
Expanded(
flex: 3,
child: Column(
spacing: 3,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -114,7 +116,11 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
],
),
SizedBox(height: 2),
Text(
item.steward?.guildsName ?? 'N/A',
textAlign: TextAlign.start,
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
),
],
),
),
@@ -197,7 +203,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
),
buildRow(
title: 'نام و نام خانوادگی فروشنده',
title: 'مشخصات فروشنده',
value: item.steward?.user?.fullname ?? 'N/A',
),
buildRow(
@@ -205,7 +211,10 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
value: item.steward?.user?.mobile ?? 'N/A',
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
buildRow(
title: 'نوع تخصیص',
value: item.allocationType?.faAllocationType ?? 'N/A',
),
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
buildRow(
title: 'وزن خریداری شده',

View File

@@ -145,7 +145,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
spacing: 4,
children: [
Text(
item.steward?.user?.fullname ?? 'N/A',
controller.getBuyerInformation(item)?.user?.fullname ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
@@ -219,8 +219,10 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
item.steward?.user?.fullname ?? 'N/A',
controller.getBuyerInformation(item)?.user?.fullname ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
@@ -284,18 +286,22 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
),
),
buildRow(
title: 'نام و نام خانوادگی فروشنده',
/* buildRow(
title: 'مشخصات خریدار',
value: controller.getBuyerInformation(item)?.user?.fullname ?? 'N/A',
),
),*/
buildRow(
title: 'تلفن فروشنده',
title: 'تلفن خریدار',
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.allocationType?.faAllocationType ?? 'N/A',
),
buildRow(
title: 'وزن خریداری شده',
value: '${item.weightOfCarcasses?.separatedByComma} کیلوگرم',

View File

@@ -66,6 +66,7 @@ class SalesOutOfProvinceLogic extends GetxController {
(callback) => getOutProvinceSales(),
time: Duration(milliseconds: timeDebounce),
);
setupListeners();
}
void setSearchValue(String? value) {

View File

@@ -188,7 +188,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
'${item.province}-${item.city}',
'${item.province} - ${item.city}',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),

View File

@@ -144,7 +144,7 @@ class SegmentationLogic extends GetxController {
Future<void> deleteSegmentation(String key) async {
await safeCall(
showError: true,
showError: false,
call: () => rootLogic.chickenRepository.deleteSegmentation(
token: rootLogic.tokenService.accessToken.value!,
key: key,

View File

@@ -128,6 +128,12 @@ class DioRemote implements IHttpClient {
options: Options(headers: headers),
cancelToken: ApiHandler.globalCancelToken,
);
if (fromJson != null) {
final rawData = response.data;
final parsedData = rawData is Map<String, dynamic> ? fromJson(rawData) : null;
response.data = parsedData;
return DioResponse<T>(response);
}
return DioResponse<T>(response);
}

View File

@@ -60,6 +60,7 @@ Future<T?> gSafeCall<T>({
} catch (error, stackTrace) {
retryCount++;
eLog('Error in gSafeCall: $error, retryCount: $retryCount , stackTrace : $stackTrace ');
if (error is DioException && error.response?.statusCode == 401) {
if (showError) {
@@ -79,7 +80,7 @@ Future<T?> gSafeCall<T>({
return null;
}
// صبر قبل از retry
if (retryCount <= maxRetries) {
await Future.delayed(retryDelay);
}