feat : new changes from back

This commit is contained in:
2025-10-12 12:05:02 +03:30
parent 9a29b0ea58
commit 60dd806f7c
23 changed files with 472 additions and 233 deletions

View File

@@ -104,11 +104,17 @@ abstract class ChickenRemoteDatasource {
required CreateStewardFreeBar body, required CreateStewardFreeBar body,
}); });
Future<void> editStewardPurchasesOutSideOfTheProvince({ Future<void> deleteStewardPurchasesOutSideOfTheProvince({
required String token, required String token,
Map<String, dynamic>? queryParameters, Map<String, dynamic>? queryParameters,
}); });
Future<CreateStewardFreeBar?> editStewardPurchasesOutSideOfTheProvince({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<PaginationModel<OutProvinceCarcassesBuyer>?> getOutProvinceCarcassesBuyer({ Future<PaginationModel<OutProvinceCarcassesBuyer>?> getOutProvinceCarcassesBuyer({
required String token, required String token,
Map<String, dynamic>? queryParameters, Map<String, dynamic>? queryParameters,
@@ -138,6 +144,13 @@ abstract class ChickenRemoteDatasource {
required StewardFreeSaleBarRequest body, required StewardFreeSaleBarRequest body,
}); });
Future<void> deleteOutProvinceStewardFreeBar({
required String token,
required String key
});
Future<UserProfile?> getUserProfile({required String token}); Future<UserProfile?> getUserProfile({required String token});
Future<void> updateUserProfile({required String token, required UserProfile userProfile}); Future<void> updateUserProfile({required String token, required UserProfile userProfile});

View File

@@ -236,7 +236,7 @@ class ChickenRemoteDatasourceImp implements ChickenRemoteDatasource {
await _httpClient.put( await _httpClient.put(
'/steward-allocation/0/', '/steward-allocation/0/',
headers: {'Authorization': 'Bearer $token'}, headers: {'Authorization': 'Bearer $token'},
queryParameters: request.toJson(), data: request.toJson(),
); );
} }
@@ -318,16 +318,29 @@ class ChickenRemoteDatasourceImp implements ChickenRemoteDatasource {
); );
} }
//todo fix this
@override @override
Future<void> editStewardPurchasesOutSideOfTheProvince({ Future<CreateStewardFreeBar?> editStewardPurchasesOutSideOfTheProvince({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var data = await _httpClient.put(
'/steward_free_bar/0/',
headers: {'Authorization': 'Bearer $token'},
data: queryParameters,
fromJson: CreateStewardFreeBar.fromJson,
);
return data.data;
}
@override
Future<void> deleteStewardPurchasesOutSideOfTheProvince({
required String token, required String token,
Map<String, dynamic>? queryParameters, Map<String, dynamic>? queryParameters,
}) async { }) async {
await _httpClient.delete( await _httpClient.delete(
'/steward_free_bar/0/', '/steward_free_bar/0/',
headers: {'Authorization': 'Bearer $token'}, headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters queryParameters: queryParameters,
); );
} }
@@ -403,6 +416,15 @@ class ChickenRemoteDatasourceImp implements ChickenRemoteDatasource {
); );
} }
@override
Future<void> deleteOutProvinceStewardFreeBar({required String token, required String key}) async {
await _httpClient.delete(
'/steward_free_sale_bar/0/',
queryParameters: {'key': key},
headers: {'Authorization': 'Bearer $token'},
);
}
@override @override
Future<UserProfile?> getUserProfile({required String token}) async { Future<UserProfile?> getUserProfile({required String token}) async {
var res = await _httpClient.get( var res = await _httpClient.get(

View File

@@ -6,16 +6,18 @@ part 'create_steward_free_bar.g.dart';
@freezed @freezed
abstract class CreateStewardFreeBar with _$CreateStewardFreeBar { abstract class CreateStewardFreeBar with _$CreateStewardFreeBar {
const factory CreateStewardFreeBar({ const factory CreateStewardFreeBar({
String? productKey, String? productKey,
String? killHouseName, String? key,
String? killHouseMobile, String? killHouseName,
String? killHouseMobile,
String? province, String? province,
String? city, String? city,
int? weightOfCarcasses, int? weightOfCarcasses,
int? numberOfCarcasses,
String? date, String? date,
String? barImage, String? barImage,
}) = _CreateStewardFreeBar; }) = _CreateStewardFreeBar;
factory CreateStewardFreeBar.fromJson(Map<String, dynamic> json) => factory CreateStewardFreeBar.fromJson(Map<String, dynamic> json) =>
_$CreateStewardFreeBarFromJson(json); _$CreateStewardFreeBarFromJson(json);
} }

View File

@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$CreateStewardFreeBar { mixin _$CreateStewardFreeBar {
String? get productKey; String? get killHouseName; String? get killHouseMobile; String? get province; String? get city; int? get weightOfCarcasses; String? get date; String? get barImage; String? get productKey; String? get key; String? get killHouseName; String? get killHouseMobile; String? get province; String? get city; int? get weightOfCarcasses; int? get numberOfCarcasses; String? get date; String? get barImage;
/// Create a copy of CreateStewardFreeBar /// Create a copy of CreateStewardFreeBar
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $CreateStewardFreeBarCopyWith<CreateStewardFreeBar> get copyWith => _$CreateStew
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is CreateStewardFreeBar&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.killHouseName, killHouseName) || other.killHouseName == killHouseName)&&(identical(other.killHouseMobile, killHouseMobile) || other.killHouseMobile == killHouseMobile)&&(identical(other.province, province) || other.province == province)&&(identical(other.city, city) || other.city == city)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.barImage, barImage) || other.barImage == barImage)); return identical(this, other) || (other.runtimeType == runtimeType&&other is CreateStewardFreeBar&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.key, key) || other.key == key)&&(identical(other.killHouseName, killHouseName) || other.killHouseName == killHouseName)&&(identical(other.killHouseMobile, killHouseMobile) || other.killHouseMobile == killHouseMobile)&&(identical(other.province, province) || other.province == province)&&(identical(other.city, city) || other.city == city)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.barImage, barImage) || other.barImage == barImage));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,productKey,killHouseName,killHouseMobile,province,city,weightOfCarcasses,date,barImage); int get hashCode => Object.hash(runtimeType,productKey,key,killHouseName,killHouseMobile,province,city,weightOfCarcasses,numberOfCarcasses,date,barImage);
@override @override
String toString() { String toString() {
return 'CreateStewardFreeBar(productKey: $productKey, killHouseName: $killHouseName, killHouseMobile: $killHouseMobile, province: $province, city: $city, weightOfCarcasses: $weightOfCarcasses, date: $date, barImage: $barImage)'; return 'CreateStewardFreeBar(productKey: $productKey, key: $key, killHouseName: $killHouseName, killHouseMobile: $killHouseMobile, province: $province, city: $city, weightOfCarcasses: $weightOfCarcasses, numberOfCarcasses: $numberOfCarcasses, date: $date, barImage: $barImage)';
} }
@@ -48,7 +48,7 @@ abstract mixin class $CreateStewardFreeBarCopyWith<$Res> {
factory $CreateStewardFreeBarCopyWith(CreateStewardFreeBar value, $Res Function(CreateStewardFreeBar) _then) = _$CreateStewardFreeBarCopyWithImpl; factory $CreateStewardFreeBarCopyWith(CreateStewardFreeBar value, $Res Function(CreateStewardFreeBar) _then) = _$CreateStewardFreeBarCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String? productKey, String? killHouseName, String? killHouseMobile, String? province, String? city, int? weightOfCarcasses, String? date, String? barImage String? productKey, String? key, String? killHouseName, String? killHouseMobile, String? province, String? city, int? weightOfCarcasses, int? numberOfCarcasses, String? date, String? barImage
}); });
@@ -65,14 +65,16 @@ class _$CreateStewardFreeBarCopyWithImpl<$Res>
/// Create a copy of CreateStewardFreeBar /// Create a copy of CreateStewardFreeBar
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? productKey = freezed,Object? killHouseName = freezed,Object? killHouseMobile = freezed,Object? province = freezed,Object? city = freezed,Object? weightOfCarcasses = freezed,Object? date = freezed,Object? barImage = freezed,}) { @pragma('vm:prefer-inline') @override $Res call({Object? productKey = freezed,Object? key = freezed,Object? killHouseName = freezed,Object? killHouseMobile = freezed,Object? province = freezed,Object? city = freezed,Object? weightOfCarcasses = freezed,Object? numberOfCarcasses = freezed,Object? date = freezed,Object? barImage = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable
as String?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,killHouseName: freezed == killHouseName ? _self.killHouseName : killHouseName // ignore: cast_nullable_to_non_nullable as String?,killHouseName: freezed == killHouseName ? _self.killHouseName : killHouseName // ignore: cast_nullable_to_non_nullable
as String?,killHouseMobile: freezed == killHouseMobile ? _self.killHouseMobile : killHouseMobile // ignore: cast_nullable_to_non_nullable as String?,killHouseMobile: freezed == killHouseMobile ? _self.killHouseMobile : killHouseMobile // ignore: cast_nullable_to_non_nullable
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,weightOfCarcasses: freezed == weightOfCarcasses ? _self.weightOfCarcasses : weightOfCarcasses // ignore: cast_nullable_to_non_nullable as String?,weightOfCarcasses: freezed == weightOfCarcasses ? _self.weightOfCarcasses : weightOfCarcasses // ignore: cast_nullable_to_non_nullable
as int?,numberOfCarcasses: freezed == numberOfCarcasses ? _self.numberOfCarcasses : numberOfCarcasses // ignore: cast_nullable_to_non_nullable
as int?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable as int?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable
as String?,barImage: freezed == barImage ? _self.barImage : barImage // ignore: cast_nullable_to_non_nullable as String?,barImage: freezed == barImage ? _self.barImage : barImage // ignore: cast_nullable_to_non_nullable
as String?, as String?,
@@ -160,10 +162,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? productKey, String? killHouseName, String? killHouseMobile, String? province, String? city, int? weightOfCarcasses, String? date, String? barImage)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? productKey, String? key, String? killHouseName, String? killHouseMobile, String? province, String? city, int? weightOfCarcasses, int? numberOfCarcasses, String? date, String? barImage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _CreateStewardFreeBar() when $default != null: case _CreateStewardFreeBar() when $default != null:
return $default(_that.productKey,_that.killHouseName,_that.killHouseMobile,_that.province,_that.city,_that.weightOfCarcasses,_that.date,_that.barImage);case _: return $default(_that.productKey,_that.key,_that.killHouseName,_that.killHouseMobile,_that.province,_that.city,_that.weightOfCarcasses,_that.numberOfCarcasses,_that.date,_that.barImage);case _:
return orElse(); return orElse();
} }
@@ -181,10 +183,10 @@ return $default(_that.productKey,_that.killHouseName,_that.killHouseMobile,_that
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? productKey, String? killHouseName, String? killHouseMobile, String? province, String? city, int? weightOfCarcasses, String? date, String? barImage) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? productKey, String? key, String? killHouseName, String? killHouseMobile, String? province, String? city, int? weightOfCarcasses, int? numberOfCarcasses, String? date, String? barImage) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _CreateStewardFreeBar(): case _CreateStewardFreeBar():
return $default(_that.productKey,_that.killHouseName,_that.killHouseMobile,_that.province,_that.city,_that.weightOfCarcasses,_that.date,_that.barImage);case _: return $default(_that.productKey,_that.key,_that.killHouseName,_that.killHouseMobile,_that.province,_that.city,_that.weightOfCarcasses,_that.numberOfCarcasses,_that.date,_that.barImage);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -201,10 +203,10 @@ return $default(_that.productKey,_that.killHouseName,_that.killHouseMobile,_that
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? productKey, String? killHouseName, String? killHouseMobile, String? province, String? city, int? weightOfCarcasses, String? date, String? barImage)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? productKey, String? key, String? killHouseName, String? killHouseMobile, String? province, String? city, int? weightOfCarcasses, int? numberOfCarcasses, String? date, String? barImage)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _CreateStewardFreeBar() when $default != null: case _CreateStewardFreeBar() when $default != null:
return $default(_that.productKey,_that.killHouseName,_that.killHouseMobile,_that.province,_that.city,_that.weightOfCarcasses,_that.date,_that.barImage);case _: return $default(_that.productKey,_that.key,_that.killHouseName,_that.killHouseMobile,_that.province,_that.city,_that.weightOfCarcasses,_that.numberOfCarcasses,_that.date,_that.barImage);case _:
return null; return null;
} }
@@ -216,15 +218,17 @@ return $default(_that.productKey,_that.killHouseName,_that.killHouseMobile,_that
@JsonSerializable() @JsonSerializable()
class _CreateStewardFreeBar implements CreateStewardFreeBar { class _CreateStewardFreeBar implements CreateStewardFreeBar {
const _CreateStewardFreeBar({this.productKey, this.killHouseName, this.killHouseMobile, this.province, this.city, this.weightOfCarcasses, this.date, this.barImage}); const _CreateStewardFreeBar({this.productKey, this.key, this.killHouseName, this.killHouseMobile, this.province, this.city, this.weightOfCarcasses, this.numberOfCarcasses, this.date, this.barImage});
factory _CreateStewardFreeBar.fromJson(Map<String, dynamic> json) => _$CreateStewardFreeBarFromJson(json); factory _CreateStewardFreeBar.fromJson(Map<String, dynamic> json) => _$CreateStewardFreeBarFromJson(json);
@override final String? productKey; @override final String? productKey;
@override final String? key;
@override final String? killHouseName; @override final String? killHouseName;
@override final String? killHouseMobile; @override final String? killHouseMobile;
@override final String? province; @override final String? province;
@override final String? city; @override final String? city;
@override final int? weightOfCarcasses; @override final int? weightOfCarcasses;
@override final int? numberOfCarcasses;
@override final String? date; @override final String? date;
@override final String? barImage; @override final String? barImage;
@@ -241,16 +245,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CreateStewardFreeBar&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.killHouseName, killHouseName) || other.killHouseName == killHouseName)&&(identical(other.killHouseMobile, killHouseMobile) || other.killHouseMobile == killHouseMobile)&&(identical(other.province, province) || other.province == province)&&(identical(other.city, city) || other.city == city)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.barImage, barImage) || other.barImage == barImage)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _CreateStewardFreeBar&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.key, key) || other.key == key)&&(identical(other.killHouseName, killHouseName) || other.killHouseName == killHouseName)&&(identical(other.killHouseMobile, killHouseMobile) || other.killHouseMobile == killHouseMobile)&&(identical(other.province, province) || other.province == province)&&(identical(other.city, city) || other.city == city)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.barImage, barImage) || other.barImage == barImage));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,productKey,killHouseName,killHouseMobile,province,city,weightOfCarcasses,date,barImage); int get hashCode => Object.hash(runtimeType,productKey,key,killHouseName,killHouseMobile,province,city,weightOfCarcasses,numberOfCarcasses,date,barImage);
@override @override
String toString() { String toString() {
return 'CreateStewardFreeBar(productKey: $productKey, killHouseName: $killHouseName, killHouseMobile: $killHouseMobile, province: $province, city: $city, weightOfCarcasses: $weightOfCarcasses, date: $date, barImage: $barImage)'; return 'CreateStewardFreeBar(productKey: $productKey, key: $key, killHouseName: $killHouseName, killHouseMobile: $killHouseMobile, province: $province, city: $city, weightOfCarcasses: $weightOfCarcasses, numberOfCarcasses: $numberOfCarcasses, date: $date, barImage: $barImage)';
} }
@@ -261,7 +265,7 @@ abstract mixin class _$CreateStewardFreeBarCopyWith<$Res> implements $CreateStew
factory _$CreateStewardFreeBarCopyWith(_CreateStewardFreeBar value, $Res Function(_CreateStewardFreeBar) _then) = __$CreateStewardFreeBarCopyWithImpl; factory _$CreateStewardFreeBarCopyWith(_CreateStewardFreeBar value, $Res Function(_CreateStewardFreeBar) _then) = __$CreateStewardFreeBarCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String? productKey, String? killHouseName, String? killHouseMobile, String? province, String? city, int? weightOfCarcasses, String? date, String? barImage String? productKey, String? key, String? killHouseName, String? killHouseMobile, String? province, String? city, int? weightOfCarcasses, int? numberOfCarcasses, String? date, String? barImage
}); });
@@ -278,14 +282,16 @@ class __$CreateStewardFreeBarCopyWithImpl<$Res>
/// Create a copy of CreateStewardFreeBar /// Create a copy of CreateStewardFreeBar
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? productKey = freezed,Object? killHouseName = freezed,Object? killHouseMobile = freezed,Object? province = freezed,Object? city = freezed,Object? weightOfCarcasses = freezed,Object? date = freezed,Object? barImage = freezed,}) { @override @pragma('vm:prefer-inline') $Res call({Object? productKey = freezed,Object? key = freezed,Object? killHouseName = freezed,Object? killHouseMobile = freezed,Object? province = freezed,Object? city = freezed,Object? weightOfCarcasses = freezed,Object? numberOfCarcasses = freezed,Object? date = freezed,Object? barImage = freezed,}) {
return _then(_CreateStewardFreeBar( return _then(_CreateStewardFreeBar(
productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable
as String?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,killHouseName: freezed == killHouseName ? _self.killHouseName : killHouseName // ignore: cast_nullable_to_non_nullable as String?,killHouseName: freezed == killHouseName ? _self.killHouseName : killHouseName // ignore: cast_nullable_to_non_nullable
as String?,killHouseMobile: freezed == killHouseMobile ? _self.killHouseMobile : killHouseMobile // ignore: cast_nullable_to_non_nullable as String?,killHouseMobile: freezed == killHouseMobile ? _self.killHouseMobile : killHouseMobile // ignore: cast_nullable_to_non_nullable
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,weightOfCarcasses: freezed == weightOfCarcasses ? _self.weightOfCarcasses : weightOfCarcasses // ignore: cast_nullable_to_non_nullable as String?,weightOfCarcasses: freezed == weightOfCarcasses ? _self.weightOfCarcasses : weightOfCarcasses // ignore: cast_nullable_to_non_nullable
as int?,numberOfCarcasses: freezed == numberOfCarcasses ? _self.numberOfCarcasses : numberOfCarcasses // ignore: cast_nullable_to_non_nullable
as int?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable as int?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable
as String?,barImage: freezed == barImage ? _self.barImage : barImage // ignore: cast_nullable_to_non_nullable as String?,barImage: freezed == barImage ? _self.barImage : barImage // ignore: cast_nullable_to_non_nullable
as String?, as String?,

View File

@@ -10,11 +10,13 @@ _CreateStewardFreeBar _$CreateStewardFreeBarFromJson(
Map<String, dynamic> json, Map<String, dynamic> json,
) => _CreateStewardFreeBar( ) => _CreateStewardFreeBar(
productKey: json['product_key'] as String?, productKey: json['product_key'] as String?,
key: json['key'] as String?,
killHouseName: json['kill_house_name'] as String?, killHouseName: json['kill_house_name'] as String?,
killHouseMobile: json['kill_house_mobile'] as String?, killHouseMobile: json['kill_house_mobile'] as String?,
province: json['province'] as String?, province: json['province'] as String?,
city: json['city'] as String?, city: json['city'] as String?,
weightOfCarcasses: (json['weight_of_carcasses'] as num?)?.toInt(), weightOfCarcasses: (json['weight_of_carcasses'] as num?)?.toInt(),
numberOfCarcasses: (json['number_of_carcasses'] as num?)?.toInt(),
date: json['date'] as String?, date: json['date'] as String?,
barImage: json['bar_image'] as String?, barImage: json['bar_image'] as String?,
); );
@@ -23,11 +25,13 @@ Map<String, dynamic> _$CreateStewardFreeBarToJson(
_CreateStewardFreeBar instance, _CreateStewardFreeBar instance,
) => <String, dynamic>{ ) => <String, dynamic>{
'product_key': instance.productKey, 'product_key': instance.productKey,
'key': instance.key,
'kill_house_name': instance.killHouseName, 'kill_house_name': instance.killHouseName,
'kill_house_mobile': instance.killHouseMobile, 'kill_house_mobile': instance.killHouseMobile,
'province': instance.province, 'province': instance.province,
'city': instance.city, 'city': instance.city,
'weight_of_carcasses': instance.weightOfCarcasses, 'weight_of_carcasses': instance.weightOfCarcasses,
'number_of_carcasses': instance.numberOfCarcasses,
'date': instance.date, 'date': instance.date,
'bar_image': instance.barImage, 'bar_image': instance.barImage,
}; };

View File

@@ -13,6 +13,9 @@ abstract class StewardFreeSaleBarRequest with _$StewardFreeSaleBarRequest {
String? clearanceCode, String? clearanceCode,
String? productKey, String? productKey,
String? key, String? key,
String? quota,
String? saleType,
}) = _StewardFreeSaleBarRequest; }) = _StewardFreeSaleBarRequest;
factory StewardFreeSaleBarRequest.fromJson(Map<String, dynamic> json) => factory StewardFreeSaleBarRequest.fromJson(Map<String, dynamic> json) =>

View File

@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$StewardFreeSaleBarRequest { mixin _$StewardFreeSaleBarRequest {
String? get buyerKey; int? get numberOfCarcasses; int? get weightOfCarcasses; String? get date; String? get clearanceCode; String? get productKey; String? get key; String? get buyerKey; int? get numberOfCarcasses; int? get weightOfCarcasses; String? get date; String? get clearanceCode; String? get productKey; String? get key; String? get quota; String? get saleType;
/// Create a copy of StewardFreeSaleBarRequest /// Create a copy of StewardFreeSaleBarRequest
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $StewardFreeSaleBarRequestCopyWith<StewardFreeSaleBarRequest> get copyWith => _$
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is StewardFreeSaleBarRequest&&(identical(other.buyerKey, buyerKey) || other.buyerKey == buyerKey)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.clearanceCode, clearanceCode) || other.clearanceCode == clearanceCode)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.key, key) || other.key == key)); return identical(this, other) || (other.runtimeType == runtimeType&&other is StewardFreeSaleBarRequest&&(identical(other.buyerKey, buyerKey) || other.buyerKey == buyerKey)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.clearanceCode, clearanceCode) || other.clearanceCode == clearanceCode)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.key, key) || other.key == key)&&(identical(other.quota, quota) || other.quota == quota)&&(identical(other.saleType, saleType) || other.saleType == saleType));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,buyerKey,numberOfCarcasses,weightOfCarcasses,date,clearanceCode,productKey,key); int get hashCode => Object.hash(runtimeType,buyerKey,numberOfCarcasses,weightOfCarcasses,date,clearanceCode,productKey,key,quota,saleType);
@override @override
String toString() { String toString() {
return 'StewardFreeSaleBarRequest(buyerKey: $buyerKey, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, date: $date, clearanceCode: $clearanceCode, productKey: $productKey, key: $key)'; return 'StewardFreeSaleBarRequest(buyerKey: $buyerKey, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, date: $date, clearanceCode: $clearanceCode, productKey: $productKey, key: $key, quota: $quota, saleType: $saleType)';
} }
@@ -48,7 +48,7 @@ abstract mixin class $StewardFreeSaleBarRequestCopyWith<$Res> {
factory $StewardFreeSaleBarRequestCopyWith(StewardFreeSaleBarRequest value, $Res Function(StewardFreeSaleBarRequest) _then) = _$StewardFreeSaleBarRequestCopyWithImpl; factory $StewardFreeSaleBarRequestCopyWith(StewardFreeSaleBarRequest value, $Res Function(StewardFreeSaleBarRequest) _then) = _$StewardFreeSaleBarRequestCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key, String? quota, String? saleType
}); });
@@ -65,7 +65,7 @@ class _$StewardFreeSaleBarRequestCopyWithImpl<$Res>
/// Create a copy of StewardFreeSaleBarRequest /// Create a copy of StewardFreeSaleBarRequest
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? buyerKey = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? date = freezed,Object? clearanceCode = freezed,Object? productKey = freezed,Object? key = freezed,}) { @pragma('vm:prefer-inline') @override $Res call({Object? buyerKey = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? date = freezed,Object? clearanceCode = freezed,Object? productKey = freezed,Object? key = freezed,Object? quota = freezed,Object? saleType = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
buyerKey: freezed == buyerKey ? _self.buyerKey : buyerKey // ignore: cast_nullable_to_non_nullable buyerKey: freezed == buyerKey ? _self.buyerKey : buyerKey // ignore: cast_nullable_to_non_nullable
as String?,numberOfCarcasses: freezed == numberOfCarcasses ? _self.numberOfCarcasses : numberOfCarcasses // ignore: cast_nullable_to_non_nullable as String?,numberOfCarcasses: freezed == numberOfCarcasses ? _self.numberOfCarcasses : numberOfCarcasses // ignore: cast_nullable_to_non_nullable
@@ -74,6 +74,8 @@ as int?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_no
as String?,clearanceCode: freezed == clearanceCode ? _self.clearanceCode : clearanceCode // ignore: cast_nullable_to_non_nullable as String?,clearanceCode: freezed == clearanceCode ? _self.clearanceCode : clearanceCode // ignore: cast_nullable_to_non_nullable
as String?,productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable as String?,productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable
as String?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable as String?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,quota: freezed == quota ? _self.quota : quota // ignore: cast_nullable_to_non_nullable
as String?,saleType: freezed == saleType ? _self.saleType : saleType // ignore: cast_nullable_to_non_nullable
as String?, as String?,
)); ));
} }
@@ -159,10 +161,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key, String? quota, String? saleType)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _StewardFreeSaleBarRequest() when $default != null: case _StewardFreeSaleBarRequest() when $default != null:
return $default(_that.buyerKey,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.clearanceCode,_that.productKey,_that.key);case _: return $default(_that.buyerKey,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.clearanceCode,_that.productKey,_that.key,_that.quota,_that.saleType);case _:
return orElse(); return orElse();
} }
@@ -180,10 +182,10 @@ return $default(_that.buyerKey,_that.numberOfCarcasses,_that.weightOfCarcasses,_
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key, String? quota, String? saleType) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _StewardFreeSaleBarRequest(): case _StewardFreeSaleBarRequest():
return $default(_that.buyerKey,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.clearanceCode,_that.productKey,_that.key);case _: return $default(_that.buyerKey,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.clearanceCode,_that.productKey,_that.key,_that.quota,_that.saleType);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -200,10 +202,10 @@ return $default(_that.buyerKey,_that.numberOfCarcasses,_that.weightOfCarcasses,_
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key, String? quota, String? saleType)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _StewardFreeSaleBarRequest() when $default != null: case _StewardFreeSaleBarRequest() when $default != null:
return $default(_that.buyerKey,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.clearanceCode,_that.productKey,_that.key);case _: return $default(_that.buyerKey,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.clearanceCode,_that.productKey,_that.key,_that.quota,_that.saleType);case _:
return null; return null;
} }
@@ -215,7 +217,7 @@ return $default(_that.buyerKey,_that.numberOfCarcasses,_that.weightOfCarcasses,_
@JsonSerializable() @JsonSerializable()
class _StewardFreeSaleBarRequest implements StewardFreeSaleBarRequest { class _StewardFreeSaleBarRequest implements StewardFreeSaleBarRequest {
const _StewardFreeSaleBarRequest({this.buyerKey, this.numberOfCarcasses, this.weightOfCarcasses, this.date, this.clearanceCode, this.productKey, this.key}); const _StewardFreeSaleBarRequest({this.buyerKey, this.numberOfCarcasses, this.weightOfCarcasses, this.date, this.clearanceCode, this.productKey, this.key, this.quota, this.saleType});
factory _StewardFreeSaleBarRequest.fromJson(Map<String, dynamic> json) => _$StewardFreeSaleBarRequestFromJson(json); factory _StewardFreeSaleBarRequest.fromJson(Map<String, dynamic> json) => _$StewardFreeSaleBarRequestFromJson(json);
@override final String? buyerKey; @override final String? buyerKey;
@@ -225,6 +227,8 @@ class _StewardFreeSaleBarRequest implements StewardFreeSaleBarRequest {
@override final String? clearanceCode; @override final String? clearanceCode;
@override final String? productKey; @override final String? productKey;
@override final String? key; @override final String? key;
@override final String? quota;
@override final String? saleType;
/// Create a copy of StewardFreeSaleBarRequest /// Create a copy of StewardFreeSaleBarRequest
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@@ -239,16 +243,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _StewardFreeSaleBarRequest&&(identical(other.buyerKey, buyerKey) || other.buyerKey == buyerKey)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.clearanceCode, clearanceCode) || other.clearanceCode == clearanceCode)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.key, key) || other.key == key)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _StewardFreeSaleBarRequest&&(identical(other.buyerKey, buyerKey) || other.buyerKey == buyerKey)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.clearanceCode, clearanceCode) || other.clearanceCode == clearanceCode)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.key, key) || other.key == key)&&(identical(other.quota, quota) || other.quota == quota)&&(identical(other.saleType, saleType) || other.saleType == saleType));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,buyerKey,numberOfCarcasses,weightOfCarcasses,date,clearanceCode,productKey,key); int get hashCode => Object.hash(runtimeType,buyerKey,numberOfCarcasses,weightOfCarcasses,date,clearanceCode,productKey,key,quota,saleType);
@override @override
String toString() { String toString() {
return 'StewardFreeSaleBarRequest(buyerKey: $buyerKey, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, date: $date, clearanceCode: $clearanceCode, productKey: $productKey, key: $key)'; return 'StewardFreeSaleBarRequest(buyerKey: $buyerKey, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, date: $date, clearanceCode: $clearanceCode, productKey: $productKey, key: $key, quota: $quota, saleType: $saleType)';
} }
@@ -259,7 +263,7 @@ abstract mixin class _$StewardFreeSaleBarRequestCopyWith<$Res> implements $Stewa
factory _$StewardFreeSaleBarRequestCopyWith(_StewardFreeSaleBarRequest value, $Res Function(_StewardFreeSaleBarRequest) _then) = __$StewardFreeSaleBarRequestCopyWithImpl; factory _$StewardFreeSaleBarRequestCopyWith(_StewardFreeSaleBarRequest value, $Res Function(_StewardFreeSaleBarRequest) _then) = __$StewardFreeSaleBarRequestCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key, String? quota, String? saleType
}); });
@@ -276,7 +280,7 @@ class __$StewardFreeSaleBarRequestCopyWithImpl<$Res>
/// Create a copy of StewardFreeSaleBarRequest /// Create a copy of StewardFreeSaleBarRequest
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? buyerKey = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? date = freezed,Object? clearanceCode = freezed,Object? productKey = freezed,Object? key = freezed,}) { @override @pragma('vm:prefer-inline') $Res call({Object? buyerKey = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? date = freezed,Object? clearanceCode = freezed,Object? productKey = freezed,Object? key = freezed,Object? quota = freezed,Object? saleType = freezed,}) {
return _then(_StewardFreeSaleBarRequest( return _then(_StewardFreeSaleBarRequest(
buyerKey: freezed == buyerKey ? _self.buyerKey : buyerKey // ignore: cast_nullable_to_non_nullable buyerKey: freezed == buyerKey ? _self.buyerKey : buyerKey // ignore: cast_nullable_to_non_nullable
as String?,numberOfCarcasses: freezed == numberOfCarcasses ? _self.numberOfCarcasses : numberOfCarcasses // ignore: cast_nullable_to_non_nullable as String?,numberOfCarcasses: freezed == numberOfCarcasses ? _self.numberOfCarcasses : numberOfCarcasses // ignore: cast_nullable_to_non_nullable
@@ -285,6 +289,8 @@ as int?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_no
as String?,clearanceCode: freezed == clearanceCode ? _self.clearanceCode : clearanceCode // ignore: cast_nullable_to_non_nullable as String?,clearanceCode: freezed == clearanceCode ? _self.clearanceCode : clearanceCode // ignore: cast_nullable_to_non_nullable
as String?,productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable as String?,productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable
as String?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable as String?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,quota: freezed == quota ? _self.quota : quota // ignore: cast_nullable_to_non_nullable
as String?,saleType: freezed == saleType ? _self.saleType : saleType // ignore: cast_nullable_to_non_nullable
as String?, as String?,
)); ));
} }

View File

@@ -16,6 +16,8 @@ _StewardFreeSaleBarRequest _$StewardFreeSaleBarRequestFromJson(
clearanceCode: json['clearance_code'] as String?, clearanceCode: json['clearance_code'] as String?,
productKey: json['product_key'] as String?, productKey: json['product_key'] as String?,
key: json['key'] as String?, key: json['key'] as String?,
quota: json['quota'] as String?,
saleType: json['sale_type'] as String?,
); );
Map<String, dynamic> _$StewardFreeSaleBarRequestToJson( Map<String, dynamic> _$StewardFreeSaleBarRequestToJson(
@@ -28,4 +30,6 @@ Map<String, dynamic> _$StewardFreeSaleBarRequestToJson(
'clearance_code': instance.clearanceCode, 'clearance_code': instance.clearanceCode,
'product_key': instance.productKey, 'product_key': instance.productKey,
'key': instance.key, 'key': instance.key,
'quota': instance.quota,
'sale_type': instance.saleType,
}; };

View File

@@ -28,6 +28,8 @@ abstract class StewardFreeSaleBar with _$StewardFreeSaleBar {
bool? temporaryDeleted, bool? temporaryDeleted,
String? createdBy, String? createdBy,
String? modifiedBy, String? modifiedBy,
String? quota,
String? saleType,
dynamic steward, dynamic steward,
dynamic guild, dynamic guild,
dynamic product, dynamic product,

View File

@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$StewardFreeSaleBar { mixin _$StewardFreeSaleBar {
int? get id; Buyer? get buyer; String? get key; String? get createDate; String? get modifyDate; bool? get trash; String? get buyerName; String? get buyerMobile; String? get province; String? get city; String? get driverName; String? get driverMobile; String? get typeCar; String? get pelak; String? get clearanceCode; int? get numberOfCarcasses; double? get weightOfCarcasses; String? get date; bool? get temporaryTrash; bool? get temporaryDeleted; String? get createdBy; String? get modifiedBy; dynamic get steward; dynamic get guild; dynamic get product; int? get id; Buyer? get buyer; String? get key; String? get createDate; String? get modifyDate; bool? get trash; String? get buyerName; String? get buyerMobile; String? get province; String? get city; String? get driverName; String? get driverMobile; String? get typeCar; String? get pelak; String? get clearanceCode; int? get numberOfCarcasses; double? get weightOfCarcasses; String? get date; bool? get temporaryTrash; bool? get temporaryDeleted; String? get createdBy; String? get modifiedBy; String? get quota; String? get saleType; dynamic get steward; dynamic get guild; dynamic get product;
/// Create a copy of StewardFreeSaleBar /// Create a copy of StewardFreeSaleBar
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $StewardFreeSaleBarCopyWith<StewardFreeSaleBar> get copyWith => _$StewardFreeSal
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is StewardFreeSaleBar&&(identical(other.id, id) || other.id == id)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.key, key) || other.key == key)&&(identical(other.createDate, createDate) || other.createDate == createDate)&&(identical(other.modifyDate, modifyDate) || other.modifyDate == modifyDate)&&(identical(other.trash, trash) || other.trash == trash)&&(identical(other.buyerName, buyerName) || other.buyerName == buyerName)&&(identical(other.buyerMobile, buyerMobile) || other.buyerMobile == buyerMobile)&&(identical(other.province, province) || other.province == province)&&(identical(other.city, city) || other.city == city)&&(identical(other.driverName, driverName) || other.driverName == driverName)&&(identical(other.driverMobile, driverMobile) || other.driverMobile == driverMobile)&&(identical(other.typeCar, typeCar) || other.typeCar == typeCar)&&(identical(other.pelak, pelak) || other.pelak == pelak)&&(identical(other.clearanceCode, clearanceCode) || other.clearanceCode == clearanceCode)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.temporaryTrash, temporaryTrash) || other.temporaryTrash == temporaryTrash)&&(identical(other.temporaryDeleted, temporaryDeleted) || other.temporaryDeleted == temporaryDeleted)&&(identical(other.createdBy, createdBy) || other.createdBy == createdBy)&&(identical(other.modifiedBy, modifiedBy) || other.modifiedBy == modifiedBy)&&const DeepCollectionEquality().equals(other.steward, steward)&&const DeepCollectionEquality().equals(other.guild, guild)&&const DeepCollectionEquality().equals(other.product, product)); return identical(this, other) || (other.runtimeType == runtimeType&&other is StewardFreeSaleBar&&(identical(other.id, id) || other.id == id)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.key, key) || other.key == key)&&(identical(other.createDate, createDate) || other.createDate == createDate)&&(identical(other.modifyDate, modifyDate) || other.modifyDate == modifyDate)&&(identical(other.trash, trash) || other.trash == trash)&&(identical(other.buyerName, buyerName) || other.buyerName == buyerName)&&(identical(other.buyerMobile, buyerMobile) || other.buyerMobile == buyerMobile)&&(identical(other.province, province) || other.province == province)&&(identical(other.city, city) || other.city == city)&&(identical(other.driverName, driverName) || other.driverName == driverName)&&(identical(other.driverMobile, driverMobile) || other.driverMobile == driverMobile)&&(identical(other.typeCar, typeCar) || other.typeCar == typeCar)&&(identical(other.pelak, pelak) || other.pelak == pelak)&&(identical(other.clearanceCode, clearanceCode) || other.clearanceCode == clearanceCode)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.temporaryTrash, temporaryTrash) || other.temporaryTrash == temporaryTrash)&&(identical(other.temporaryDeleted, temporaryDeleted) || other.temporaryDeleted == temporaryDeleted)&&(identical(other.createdBy, createdBy) || other.createdBy == createdBy)&&(identical(other.modifiedBy, modifiedBy) || other.modifiedBy == modifiedBy)&&(identical(other.quota, quota) || other.quota == quota)&&(identical(other.saleType, saleType) || other.saleType == saleType)&&const DeepCollectionEquality().equals(other.steward, steward)&&const DeepCollectionEquality().equals(other.guild, guild)&&const DeepCollectionEquality().equals(other.product, product));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hashAll([runtimeType,id,buyer,key,createDate,modifyDate,trash,buyerName,buyerMobile,province,city,driverName,driverMobile,typeCar,pelak,clearanceCode,numberOfCarcasses,weightOfCarcasses,date,temporaryTrash,temporaryDeleted,createdBy,modifiedBy,const DeepCollectionEquality().hash(steward),const DeepCollectionEquality().hash(guild),const DeepCollectionEquality().hash(product)]); int get hashCode => Object.hashAll([runtimeType,id,buyer,key,createDate,modifyDate,trash,buyerName,buyerMobile,province,city,driverName,driverMobile,typeCar,pelak,clearanceCode,numberOfCarcasses,weightOfCarcasses,date,temporaryTrash,temporaryDeleted,createdBy,modifiedBy,quota,saleType,const DeepCollectionEquality().hash(steward),const DeepCollectionEquality().hash(guild),const DeepCollectionEquality().hash(product)]);
@override @override
String toString() { String toString() {
return 'StewardFreeSaleBar(id: $id, buyer: $buyer, key: $key, createDate: $createDate, modifyDate: $modifyDate, trash: $trash, buyerName: $buyerName, buyerMobile: $buyerMobile, province: $province, city: $city, driverName: $driverName, driverMobile: $driverMobile, typeCar: $typeCar, pelak: $pelak, clearanceCode: $clearanceCode, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, date: $date, temporaryTrash: $temporaryTrash, temporaryDeleted: $temporaryDeleted, createdBy: $createdBy, modifiedBy: $modifiedBy, steward: $steward, guild: $guild, product: $product)'; return 'StewardFreeSaleBar(id: $id, buyer: $buyer, key: $key, createDate: $createDate, modifyDate: $modifyDate, trash: $trash, buyerName: $buyerName, buyerMobile: $buyerMobile, province: $province, city: $city, driverName: $driverName, driverMobile: $driverMobile, typeCar: $typeCar, pelak: $pelak, clearanceCode: $clearanceCode, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, date: $date, temporaryTrash: $temporaryTrash, temporaryDeleted: $temporaryDeleted, createdBy: $createdBy, modifiedBy: $modifiedBy, quota: $quota, saleType: $saleType, steward: $steward, guild: $guild, product: $product)';
} }
@@ -48,7 +48,7 @@ abstract mixin class $StewardFreeSaleBarCopyWith<$Res> {
factory $StewardFreeSaleBarCopyWith(StewardFreeSaleBar value, $Res Function(StewardFreeSaleBar) _then) = _$StewardFreeSaleBarCopyWithImpl; factory $StewardFreeSaleBarCopyWith(StewardFreeSaleBar value, $Res Function(StewardFreeSaleBar) _then) = _$StewardFreeSaleBarCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
int? id, Buyer? buyer, String? key, String? createDate, String? modifyDate, bool? trash, String? buyerName, String? buyerMobile, String? province, String? city, String? driverName, String? driverMobile, String? typeCar, String? pelak, String? clearanceCode, int? numberOfCarcasses, double? weightOfCarcasses, String? date, bool? temporaryTrash, bool? temporaryDeleted, String? createdBy, String? modifiedBy, dynamic steward, dynamic guild, dynamic product int? id, Buyer? buyer, String? key, String? createDate, String? modifyDate, bool? trash, String? buyerName, String? buyerMobile, String? province, String? city, String? driverName, String? driverMobile, String? typeCar, String? pelak, String? clearanceCode, int? numberOfCarcasses, double? weightOfCarcasses, String? date, bool? temporaryTrash, bool? temporaryDeleted, String? createdBy, String? modifiedBy, String? quota, String? saleType, dynamic steward, dynamic guild, dynamic product
}); });
@@ -65,7 +65,7 @@ class _$StewardFreeSaleBarCopyWithImpl<$Res>
/// Create a copy of StewardFreeSaleBar /// Create a copy of StewardFreeSaleBar
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? buyer = freezed,Object? key = freezed,Object? createDate = freezed,Object? modifyDate = freezed,Object? trash = freezed,Object? buyerName = freezed,Object? buyerMobile = freezed,Object? province = freezed,Object? city = freezed,Object? driverName = freezed,Object? driverMobile = freezed,Object? typeCar = freezed,Object? pelak = freezed,Object? clearanceCode = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? date = freezed,Object? temporaryTrash = freezed,Object? temporaryDeleted = freezed,Object? createdBy = freezed,Object? modifiedBy = freezed,Object? steward = freezed,Object? guild = freezed,Object? product = freezed,}) { @pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? buyer = freezed,Object? key = freezed,Object? createDate = freezed,Object? modifyDate = freezed,Object? trash = freezed,Object? buyerName = freezed,Object? buyerMobile = freezed,Object? province = freezed,Object? city = freezed,Object? driverName = freezed,Object? driverMobile = freezed,Object? typeCar = freezed,Object? pelak = freezed,Object? clearanceCode = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? date = freezed,Object? temporaryTrash = freezed,Object? temporaryDeleted = freezed,Object? createdBy = freezed,Object? modifiedBy = freezed,Object? quota = freezed,Object? saleType = freezed,Object? steward = freezed,Object? guild = freezed,Object? product = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as int?,buyer: freezed == buyer ? _self.buyer : buyer // ignore: cast_nullable_to_non_nullable as int?,buyer: freezed == buyer ? _self.buyer : buyer // ignore: cast_nullable_to_non_nullable
@@ -89,6 +89,8 @@ as String?,temporaryTrash: freezed == temporaryTrash ? _self.temporaryTrash : te
as bool?,temporaryDeleted: freezed == temporaryDeleted ? _self.temporaryDeleted : temporaryDeleted // ignore: cast_nullable_to_non_nullable as bool?,temporaryDeleted: freezed == temporaryDeleted ? _self.temporaryDeleted : temporaryDeleted // ignore: cast_nullable_to_non_nullable
as bool?,createdBy: freezed == createdBy ? _self.createdBy : createdBy // ignore: cast_nullable_to_non_nullable as bool?,createdBy: freezed == createdBy ? _self.createdBy : createdBy // ignore: cast_nullable_to_non_nullable
as String?,modifiedBy: freezed == modifiedBy ? _self.modifiedBy : modifiedBy // ignore: cast_nullable_to_non_nullable as String?,modifiedBy: freezed == modifiedBy ? _self.modifiedBy : modifiedBy // ignore: cast_nullable_to_non_nullable
as String?,quota: freezed == quota ? _self.quota : quota // ignore: cast_nullable_to_non_nullable
as String?,saleType: freezed == saleType ? _self.saleType : saleType // ignore: cast_nullable_to_non_nullable
as String?,steward: freezed == steward ? _self.steward : steward // ignore: cast_nullable_to_non_nullable as String?,steward: freezed == steward ? _self.steward : steward // ignore: cast_nullable_to_non_nullable
as dynamic,guild: freezed == guild ? _self.guild : guild // ignore: cast_nullable_to_non_nullable as dynamic,guild: freezed == guild ? _self.guild : guild // ignore: cast_nullable_to_non_nullable
as dynamic,product: freezed == product ? _self.product : product // ignore: cast_nullable_to_non_nullable as dynamic,product: freezed == product ? _self.product : product // ignore: cast_nullable_to_non_nullable
@@ -189,10 +191,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int? id, Buyer? buyer, String? key, String? createDate, String? modifyDate, bool? trash, String? buyerName, String? buyerMobile, String? province, String? city, String? driverName, String? driverMobile, String? typeCar, String? pelak, String? clearanceCode, int? numberOfCarcasses, double? weightOfCarcasses, String? date, bool? temporaryTrash, bool? temporaryDeleted, String? createdBy, String? modifiedBy, dynamic steward, dynamic guild, dynamic product)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int? id, Buyer? buyer, String? key, String? createDate, String? modifyDate, bool? trash, String? buyerName, String? buyerMobile, String? province, String? city, String? driverName, String? driverMobile, String? typeCar, String? pelak, String? clearanceCode, int? numberOfCarcasses, double? weightOfCarcasses, String? date, bool? temporaryTrash, bool? temporaryDeleted, String? createdBy, String? modifiedBy, String? quota, String? saleType, dynamic steward, dynamic guild, dynamic product)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _StewardFreeSaleBar() when $default != null: case _StewardFreeSaleBar() when $default != null:
return $default(_that.id,_that.buyer,_that.key,_that.createDate,_that.modifyDate,_that.trash,_that.buyerName,_that.buyerMobile,_that.province,_that.city,_that.driverName,_that.driverMobile,_that.typeCar,_that.pelak,_that.clearanceCode,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.temporaryTrash,_that.temporaryDeleted,_that.createdBy,_that.modifiedBy,_that.steward,_that.guild,_that.product);case _: return $default(_that.id,_that.buyer,_that.key,_that.createDate,_that.modifyDate,_that.trash,_that.buyerName,_that.buyerMobile,_that.province,_that.city,_that.driverName,_that.driverMobile,_that.typeCar,_that.pelak,_that.clearanceCode,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.temporaryTrash,_that.temporaryDeleted,_that.createdBy,_that.modifiedBy,_that.quota,_that.saleType,_that.steward,_that.guild,_that.product);case _:
return orElse(); return orElse();
} }
@@ -210,10 +212,10 @@ return $default(_that.id,_that.buyer,_that.key,_that.createDate,_that.modifyDate
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int? id, Buyer? buyer, String? key, String? createDate, String? modifyDate, bool? trash, String? buyerName, String? buyerMobile, String? province, String? city, String? driverName, String? driverMobile, String? typeCar, String? pelak, String? clearanceCode, int? numberOfCarcasses, double? weightOfCarcasses, String? date, bool? temporaryTrash, bool? temporaryDeleted, String? createdBy, String? modifiedBy, dynamic steward, dynamic guild, dynamic product) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int? id, Buyer? buyer, String? key, String? createDate, String? modifyDate, bool? trash, String? buyerName, String? buyerMobile, String? province, String? city, String? driverName, String? driverMobile, String? typeCar, String? pelak, String? clearanceCode, int? numberOfCarcasses, double? weightOfCarcasses, String? date, bool? temporaryTrash, bool? temporaryDeleted, String? createdBy, String? modifiedBy, String? quota, String? saleType, dynamic steward, dynamic guild, dynamic product) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _StewardFreeSaleBar(): case _StewardFreeSaleBar():
return $default(_that.id,_that.buyer,_that.key,_that.createDate,_that.modifyDate,_that.trash,_that.buyerName,_that.buyerMobile,_that.province,_that.city,_that.driverName,_that.driverMobile,_that.typeCar,_that.pelak,_that.clearanceCode,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.temporaryTrash,_that.temporaryDeleted,_that.createdBy,_that.modifiedBy,_that.steward,_that.guild,_that.product);case _: return $default(_that.id,_that.buyer,_that.key,_that.createDate,_that.modifyDate,_that.trash,_that.buyerName,_that.buyerMobile,_that.province,_that.city,_that.driverName,_that.driverMobile,_that.typeCar,_that.pelak,_that.clearanceCode,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.temporaryTrash,_that.temporaryDeleted,_that.createdBy,_that.modifiedBy,_that.quota,_that.saleType,_that.steward,_that.guild,_that.product);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -230,10 +232,10 @@ return $default(_that.id,_that.buyer,_that.key,_that.createDate,_that.modifyDate
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int? id, Buyer? buyer, String? key, String? createDate, String? modifyDate, bool? trash, String? buyerName, String? buyerMobile, String? province, String? city, String? driverName, String? driverMobile, String? typeCar, String? pelak, String? clearanceCode, int? numberOfCarcasses, double? weightOfCarcasses, String? date, bool? temporaryTrash, bool? temporaryDeleted, String? createdBy, String? modifiedBy, dynamic steward, dynamic guild, dynamic product)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int? id, Buyer? buyer, String? key, String? createDate, String? modifyDate, bool? trash, String? buyerName, String? buyerMobile, String? province, String? city, String? driverName, String? driverMobile, String? typeCar, String? pelak, String? clearanceCode, int? numberOfCarcasses, double? weightOfCarcasses, String? date, bool? temporaryTrash, bool? temporaryDeleted, String? createdBy, String? modifiedBy, String? quota, String? saleType, dynamic steward, dynamic guild, dynamic product)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _StewardFreeSaleBar() when $default != null: case _StewardFreeSaleBar() when $default != null:
return $default(_that.id,_that.buyer,_that.key,_that.createDate,_that.modifyDate,_that.trash,_that.buyerName,_that.buyerMobile,_that.province,_that.city,_that.driverName,_that.driverMobile,_that.typeCar,_that.pelak,_that.clearanceCode,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.temporaryTrash,_that.temporaryDeleted,_that.createdBy,_that.modifiedBy,_that.steward,_that.guild,_that.product);case _: return $default(_that.id,_that.buyer,_that.key,_that.createDate,_that.modifyDate,_that.trash,_that.buyerName,_that.buyerMobile,_that.province,_that.city,_that.driverName,_that.driverMobile,_that.typeCar,_that.pelak,_that.clearanceCode,_that.numberOfCarcasses,_that.weightOfCarcasses,_that.date,_that.temporaryTrash,_that.temporaryDeleted,_that.createdBy,_that.modifiedBy,_that.quota,_that.saleType,_that.steward,_that.guild,_that.product);case _:
return null; return null;
} }
@@ -245,7 +247,7 @@ return $default(_that.id,_that.buyer,_that.key,_that.createDate,_that.modifyDate
@JsonSerializable() @JsonSerializable()
class _StewardFreeSaleBar implements StewardFreeSaleBar { class _StewardFreeSaleBar implements StewardFreeSaleBar {
const _StewardFreeSaleBar({this.id, this.buyer, this.key, this.createDate, this.modifyDate, this.trash, this.buyerName, this.buyerMobile, this.province, this.city, this.driverName, this.driverMobile, this.typeCar, this.pelak, this.clearanceCode, this.numberOfCarcasses, this.weightOfCarcasses, this.date, this.temporaryTrash, this.temporaryDeleted, this.createdBy, this.modifiedBy, this.steward, this.guild, this.product}); const _StewardFreeSaleBar({this.id, this.buyer, this.key, this.createDate, this.modifyDate, this.trash, this.buyerName, this.buyerMobile, this.province, this.city, this.driverName, this.driverMobile, this.typeCar, this.pelak, this.clearanceCode, this.numberOfCarcasses, this.weightOfCarcasses, this.date, this.temporaryTrash, this.temporaryDeleted, this.createdBy, this.modifiedBy, this.quota, this.saleType, this.steward, this.guild, this.product});
factory _StewardFreeSaleBar.fromJson(Map<String, dynamic> json) => _$StewardFreeSaleBarFromJson(json); factory _StewardFreeSaleBar.fromJson(Map<String, dynamic> json) => _$StewardFreeSaleBarFromJson(json);
@override final int? id; @override final int? id;
@@ -270,6 +272,8 @@ class _StewardFreeSaleBar implements StewardFreeSaleBar {
@override final bool? temporaryDeleted; @override final bool? temporaryDeleted;
@override final String? createdBy; @override final String? createdBy;
@override final String? modifiedBy; @override final String? modifiedBy;
@override final String? quota;
@override final String? saleType;
@override final dynamic steward; @override final dynamic steward;
@override final dynamic guild; @override final dynamic guild;
@override final dynamic product; @override final dynamic product;
@@ -287,16 +291,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _StewardFreeSaleBar&&(identical(other.id, id) || other.id == id)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.key, key) || other.key == key)&&(identical(other.createDate, createDate) || other.createDate == createDate)&&(identical(other.modifyDate, modifyDate) || other.modifyDate == modifyDate)&&(identical(other.trash, trash) || other.trash == trash)&&(identical(other.buyerName, buyerName) || other.buyerName == buyerName)&&(identical(other.buyerMobile, buyerMobile) || other.buyerMobile == buyerMobile)&&(identical(other.province, province) || other.province == province)&&(identical(other.city, city) || other.city == city)&&(identical(other.driverName, driverName) || other.driverName == driverName)&&(identical(other.driverMobile, driverMobile) || other.driverMobile == driverMobile)&&(identical(other.typeCar, typeCar) || other.typeCar == typeCar)&&(identical(other.pelak, pelak) || other.pelak == pelak)&&(identical(other.clearanceCode, clearanceCode) || other.clearanceCode == clearanceCode)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.temporaryTrash, temporaryTrash) || other.temporaryTrash == temporaryTrash)&&(identical(other.temporaryDeleted, temporaryDeleted) || other.temporaryDeleted == temporaryDeleted)&&(identical(other.createdBy, createdBy) || other.createdBy == createdBy)&&(identical(other.modifiedBy, modifiedBy) || other.modifiedBy == modifiedBy)&&const DeepCollectionEquality().equals(other.steward, steward)&&const DeepCollectionEquality().equals(other.guild, guild)&&const DeepCollectionEquality().equals(other.product, product)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _StewardFreeSaleBar&&(identical(other.id, id) || other.id == id)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.key, key) || other.key == key)&&(identical(other.createDate, createDate) || other.createDate == createDate)&&(identical(other.modifyDate, modifyDate) || other.modifyDate == modifyDate)&&(identical(other.trash, trash) || other.trash == trash)&&(identical(other.buyerName, buyerName) || other.buyerName == buyerName)&&(identical(other.buyerMobile, buyerMobile) || other.buyerMobile == buyerMobile)&&(identical(other.province, province) || other.province == province)&&(identical(other.city, city) || other.city == city)&&(identical(other.driverName, driverName) || other.driverName == driverName)&&(identical(other.driverMobile, driverMobile) || other.driverMobile == driverMobile)&&(identical(other.typeCar, typeCar) || other.typeCar == typeCar)&&(identical(other.pelak, pelak) || other.pelak == pelak)&&(identical(other.clearanceCode, clearanceCode) || other.clearanceCode == clearanceCode)&&(identical(other.numberOfCarcasses, numberOfCarcasses) || other.numberOfCarcasses == numberOfCarcasses)&&(identical(other.weightOfCarcasses, weightOfCarcasses) || other.weightOfCarcasses == weightOfCarcasses)&&(identical(other.date, date) || other.date == date)&&(identical(other.temporaryTrash, temporaryTrash) || other.temporaryTrash == temporaryTrash)&&(identical(other.temporaryDeleted, temporaryDeleted) || other.temporaryDeleted == temporaryDeleted)&&(identical(other.createdBy, createdBy) || other.createdBy == createdBy)&&(identical(other.modifiedBy, modifiedBy) || other.modifiedBy == modifiedBy)&&(identical(other.quota, quota) || other.quota == quota)&&(identical(other.saleType, saleType) || other.saleType == saleType)&&const DeepCollectionEquality().equals(other.steward, steward)&&const DeepCollectionEquality().equals(other.guild, guild)&&const DeepCollectionEquality().equals(other.product, product));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hashAll([runtimeType,id,buyer,key,createDate,modifyDate,trash,buyerName,buyerMobile,province,city,driverName,driverMobile,typeCar,pelak,clearanceCode,numberOfCarcasses,weightOfCarcasses,date,temporaryTrash,temporaryDeleted,createdBy,modifiedBy,const DeepCollectionEquality().hash(steward),const DeepCollectionEquality().hash(guild),const DeepCollectionEquality().hash(product)]); int get hashCode => Object.hashAll([runtimeType,id,buyer,key,createDate,modifyDate,trash,buyerName,buyerMobile,province,city,driverName,driverMobile,typeCar,pelak,clearanceCode,numberOfCarcasses,weightOfCarcasses,date,temporaryTrash,temporaryDeleted,createdBy,modifiedBy,quota,saleType,const DeepCollectionEquality().hash(steward),const DeepCollectionEquality().hash(guild),const DeepCollectionEquality().hash(product)]);
@override @override
String toString() { String toString() {
return 'StewardFreeSaleBar(id: $id, buyer: $buyer, key: $key, createDate: $createDate, modifyDate: $modifyDate, trash: $trash, buyerName: $buyerName, buyerMobile: $buyerMobile, province: $province, city: $city, driverName: $driverName, driverMobile: $driverMobile, typeCar: $typeCar, pelak: $pelak, clearanceCode: $clearanceCode, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, date: $date, temporaryTrash: $temporaryTrash, temporaryDeleted: $temporaryDeleted, createdBy: $createdBy, modifiedBy: $modifiedBy, steward: $steward, guild: $guild, product: $product)'; return 'StewardFreeSaleBar(id: $id, buyer: $buyer, key: $key, createDate: $createDate, modifyDate: $modifyDate, trash: $trash, buyerName: $buyerName, buyerMobile: $buyerMobile, province: $province, city: $city, driverName: $driverName, driverMobile: $driverMobile, typeCar: $typeCar, pelak: $pelak, clearanceCode: $clearanceCode, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, date: $date, temporaryTrash: $temporaryTrash, temporaryDeleted: $temporaryDeleted, createdBy: $createdBy, modifiedBy: $modifiedBy, quota: $quota, saleType: $saleType, steward: $steward, guild: $guild, product: $product)';
} }
@@ -307,7 +311,7 @@ abstract mixin class _$StewardFreeSaleBarCopyWith<$Res> implements $StewardFreeS
factory _$StewardFreeSaleBarCopyWith(_StewardFreeSaleBar value, $Res Function(_StewardFreeSaleBar) _then) = __$StewardFreeSaleBarCopyWithImpl; factory _$StewardFreeSaleBarCopyWith(_StewardFreeSaleBar value, $Res Function(_StewardFreeSaleBar) _then) = __$StewardFreeSaleBarCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
int? id, Buyer? buyer, String? key, String? createDate, String? modifyDate, bool? trash, String? buyerName, String? buyerMobile, String? province, String? city, String? driverName, String? driverMobile, String? typeCar, String? pelak, String? clearanceCode, int? numberOfCarcasses, double? weightOfCarcasses, String? date, bool? temporaryTrash, bool? temporaryDeleted, String? createdBy, String? modifiedBy, dynamic steward, dynamic guild, dynamic product int? id, Buyer? buyer, String? key, String? createDate, String? modifyDate, bool? trash, String? buyerName, String? buyerMobile, String? province, String? city, String? driverName, String? driverMobile, String? typeCar, String? pelak, String? clearanceCode, int? numberOfCarcasses, double? weightOfCarcasses, String? date, bool? temporaryTrash, bool? temporaryDeleted, String? createdBy, String? modifiedBy, String? quota, String? saleType, dynamic steward, dynamic guild, dynamic product
}); });
@@ -324,7 +328,7 @@ class __$StewardFreeSaleBarCopyWithImpl<$Res>
/// Create a copy of StewardFreeSaleBar /// Create a copy of StewardFreeSaleBar
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? buyer = freezed,Object? key = freezed,Object? createDate = freezed,Object? modifyDate = freezed,Object? trash = freezed,Object? buyerName = freezed,Object? buyerMobile = freezed,Object? province = freezed,Object? city = freezed,Object? driverName = freezed,Object? driverMobile = freezed,Object? typeCar = freezed,Object? pelak = freezed,Object? clearanceCode = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? date = freezed,Object? temporaryTrash = freezed,Object? temporaryDeleted = freezed,Object? createdBy = freezed,Object? modifiedBy = freezed,Object? steward = freezed,Object? guild = freezed,Object? product = freezed,}) { @override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? buyer = freezed,Object? key = freezed,Object? createDate = freezed,Object? modifyDate = freezed,Object? trash = freezed,Object? buyerName = freezed,Object? buyerMobile = freezed,Object? province = freezed,Object? city = freezed,Object? driverName = freezed,Object? driverMobile = freezed,Object? typeCar = freezed,Object? pelak = freezed,Object? clearanceCode = freezed,Object? numberOfCarcasses = freezed,Object? weightOfCarcasses = freezed,Object? date = freezed,Object? temporaryTrash = freezed,Object? temporaryDeleted = freezed,Object? createdBy = freezed,Object? modifiedBy = freezed,Object? quota = freezed,Object? saleType = freezed,Object? steward = freezed,Object? guild = freezed,Object? product = freezed,}) {
return _then(_StewardFreeSaleBar( return _then(_StewardFreeSaleBar(
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as int?,buyer: freezed == buyer ? _self.buyer : buyer // ignore: cast_nullable_to_non_nullable as int?,buyer: freezed == buyer ? _self.buyer : buyer // ignore: cast_nullable_to_non_nullable
@@ -348,6 +352,8 @@ as String?,temporaryTrash: freezed == temporaryTrash ? _self.temporaryTrash : te
as bool?,temporaryDeleted: freezed == temporaryDeleted ? _self.temporaryDeleted : temporaryDeleted // ignore: cast_nullable_to_non_nullable as bool?,temporaryDeleted: freezed == temporaryDeleted ? _self.temporaryDeleted : temporaryDeleted // ignore: cast_nullable_to_non_nullable
as bool?,createdBy: freezed == createdBy ? _self.createdBy : createdBy // ignore: cast_nullable_to_non_nullable as bool?,createdBy: freezed == createdBy ? _self.createdBy : createdBy // ignore: cast_nullable_to_non_nullable
as String?,modifiedBy: freezed == modifiedBy ? _self.modifiedBy : modifiedBy // ignore: cast_nullable_to_non_nullable as String?,modifiedBy: freezed == modifiedBy ? _self.modifiedBy : modifiedBy // ignore: cast_nullable_to_non_nullable
as String?,quota: freezed == quota ? _self.quota : quota // ignore: cast_nullable_to_non_nullable
as String?,saleType: freezed == saleType ? _self.saleType : saleType // ignore: cast_nullable_to_non_nullable
as String?,steward: freezed == steward ? _self.steward : steward // ignore: cast_nullable_to_non_nullable as String?,steward: freezed == steward ? _self.steward : steward // ignore: cast_nullable_to_non_nullable
as dynamic,guild: freezed == guild ? _self.guild : guild // ignore: cast_nullable_to_non_nullable as dynamic,guild: freezed == guild ? _self.guild : guild // ignore: cast_nullable_to_non_nullable
as dynamic,product: freezed == product ? _self.product : product // ignore: cast_nullable_to_non_nullable as dynamic,product: freezed == product ? _self.product : product // ignore: cast_nullable_to_non_nullable

View File

@@ -32,6 +32,8 @@ _StewardFreeSaleBar _$StewardFreeSaleBarFromJson(Map<String, dynamic> json) =>
temporaryDeleted: json['temporary_deleted'] as bool?, temporaryDeleted: json['temporary_deleted'] as bool?,
createdBy: json['created_by'] as String?, createdBy: json['created_by'] as String?,
modifiedBy: json['modified_by'] as String?, modifiedBy: json['modified_by'] as String?,
quota: json['quota'] as String?,
saleType: json['sale_type'] as String?,
steward: json['steward'], steward: json['steward'],
guild: json['guild'], guild: json['guild'],
product: json['product'], product: json['product'],
@@ -61,6 +63,8 @@ Map<String, dynamic> _$StewardFreeSaleBarToJson(_StewardFreeSaleBar instance) =>
'temporary_deleted': instance.temporaryDeleted, 'temporary_deleted': instance.temporaryDeleted,
'created_by': instance.createdBy, 'created_by': instance.createdBy,
'modified_by': instance.modifiedBy, 'modified_by': instance.modifiedBy,
'quota': instance.quota,
'sale_type': instance.saleType,
'steward': instance.steward, 'steward': instance.steward,
'guild': instance.guild, 'guild': instance.guild,
'product': instance.product, 'product': instance.product,

View File

@@ -109,7 +109,15 @@ abstract class ChickenRepository {
required CreateStewardFreeBar body, required CreateStewardFreeBar body,
}); });
Future<void> editStewardPurchasesOutSideOfTheProvince({
Future<CreateStewardFreeBar?> editStewardPurchasesOutSideOfTheProvince({
required String token,
required CreateStewardFreeBar body,
});
Future<void> deleteStewardPurchasesOutSideOfTheProvince({
required String token, required String token,
Map<String, dynamic>? queryParameters, Map<String, dynamic>? queryParameters,
}); });
@@ -143,6 +151,13 @@ abstract class ChickenRepository {
required StewardFreeSaleBarRequest body, required StewardFreeSaleBarRequest body,
}); });
Future<void> deleteOutProvinceStewardFreeBar({
required String token,
required String key
});
Future<UserProfile?> getUserProfile({required String token}); Future<UserProfile?> getUserProfile({required String token});
Future<void> updateUserProfile({required String token, required UserProfile userProfile}); Future<void> updateUserProfile({required String token, required UserProfile userProfile});

View File

@@ -223,13 +223,24 @@ class ChickenRepositoryImp implements ChickenRepository {
} }
@override @override
Future<void> editStewardPurchasesOutSideOfTheProvince({ Future<CreateStewardFreeBar?> editStewardPurchasesOutSideOfTheProvince({
required String token,
required CreateStewardFreeBar body,
}) async {
return await remote.editStewardPurchasesOutSideOfTheProvince(
token: token,
queryParameters: body.toJson()..removeWhere((key, value) => value == null),
);
}
@override
Future<void> deleteStewardPurchasesOutSideOfTheProvince({
required String token, required String token,
Map<String, dynamic>? queryParameters, Map<String, dynamic>? queryParameters,
}) async { }) async {
await remote.editStewardPurchasesOutSideOfTheProvince( await remote.deleteStewardPurchasesOutSideOfTheProvince(
token: token, token: token,
queryParameters: queryParameters queryParameters: queryParameters,
); );
} }
@@ -278,6 +289,11 @@ class ChickenRepositoryImp implements ChickenRepository {
await remote.updateOutProvinceStewardFreeBar(token: token, body: body); await remote.updateOutProvinceStewardFreeBar(token: token, body: body);
} }
@override
Future<void> deleteOutProvinceStewardFreeBar({required String token, required String key}) async {
await remote.deleteOutProvinceStewardFreeBar(token: token, key: key);
}
@override @override
Future<UserProfile?> getUserProfile({required String token}) async { Future<UserProfile?> getUserProfile({required String token}) async {
var res = await remote.getUserProfile(token: token); var res = await remote.getUserProfile(token: token);

View File

@@ -31,6 +31,7 @@ class BuyOutOfProvinceLogic extends GetxController {
Rxn<XFile> selectedImage = Rxn<XFile>(); Rxn<XFile> selectedImage = Rxn<XFile>();
RxnString _base64Image = RxnString(); RxnString _base64Image = RxnString();
RxnString editImageUrl = RxnString(); RxnString editImageUrl = RxnString();
RxnString editFreeBarKey = RxnString();
StewardRootLogic rootLogic = Get.find<StewardRootLogic>(); StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
@@ -172,7 +173,7 @@ class BuyOutOfProvinceLogic extends GetxController {
selectedProvince.value != null && selectedProvince.value != null &&
selectedCity.value != null && selectedCity.value != null &&
selectedProduct.value != null && selectedProduct.value != null &&
selectedImage.value != null; (selectedImage.value != null || editImageUrl.value != null);
if (isSubmitButtonEnabled.value) { if (isSubmitButtonEnabled.value) {
isOnLoadingSubmitOrEdit.value = false; isOnLoadingSubmitOrEdit.value = false;
@@ -196,6 +197,7 @@ class BuyOutOfProvinceLogic extends GetxController {
province: selectedProvince.value!.name, province: selectedProvince.value!.name,
city: selectedCity.value!.name, city: selectedCity.value!.name,
weightOfCarcasses: int.parse(carcassWeightController.text.clearComma), weightOfCarcasses: int.parse(carcassWeightController.text.clearComma),
numberOfCarcasses: int.parse(carcassCountController.text.clearComma),
barImage: _base64Image.value, barImage: _base64Image.value,
date: DateTime.now().formattedYHMS, date: DateTime.now().formattedYHMS,
); );
@@ -228,42 +230,56 @@ class BuyOutOfProvinceLogic extends GetxController {
isSubmitButtonEnabled.value = false; isSubmitButtonEnabled.value = false;
} }
void setEditData(StewardFreeBar item) { void setEditData(StewardFreeBar item) async {
editImageUrl.value = item.barImage; editImageUrl.value = item.barImage;
sellerNameController.text = item.killHouseName ?? ''; sellerNameController.text = item.killHouseName ?? '';
sellerPhoneController.text = item.killHouseMobile ?? ''; sellerPhoneController.text = item.killHouseMobile ?? '';
carcassWeightController.text = item.weightOfCarcasses?.toInt().toString() ?? ''; carcassWeightController.text = item.weightOfCarcasses.separatedByComma;
carcassCountController.text = item.numberOfCarcasses.separatedByComma;
editFreeBarKey.value = item.key;
selectedProvince.value = IranProvinceCityModel(name: item.province); selectedProvince.value = IranProvinceCityModel(name: item.province);
selectedCity.value = IranProvinceCityModel(name: item.city); selectedCity.value = IranProvinceCityModel(name: item.city);
selectedProduct.value = rootLogic.rolesProductsModel.firstWhere( selectedProduct.value = rootLogic.rolesProductsModel.firstWhere(
(element) => element.key == item.product!.key, (element) => element.key == item.product!.key,
); );
isSubmitButtonEnabled.value = true; isSubmitButtonEnabled.value = true;
} }
Future<void> editStewardPurchaseOutOfProvince(StewardFreeBar item) async { Future<void> editStewardPurchaseOutOfProvince() async {
CreateStewardFreeBar edit = CreateStewardFreeBar( CreateStewardFreeBar edit = CreateStewardFreeBar(
productKey: selectedProduct.value!.key, productKey: selectedProduct.value!.key,
key: editFreeBarKey.value,
killHouseName: sellerNameController.text, killHouseName: sellerNameController.text,
killHouseMobile: sellerPhoneController.text, killHouseMobile: sellerPhoneController.text,
province: selectedProvince.value!.name, province: selectedProvince.value!.name,
city: selectedCity.value!.name, city: selectedCity.value!.name,
weightOfCarcasses: int.parse(carcassWeightController.text.clearComma), weightOfCarcasses: int.parse(carcassWeightController.text.clearComma),
barImage: _base64Image.value, numberOfCarcasses: int.parse(carcassCountController.text.clearComma),
date: DateTime.now().formattedYHMS, date: DateTime.now().formattedYHMS,
); );
if (_base64Image.value != null) {
edit = edit.copyWith(barImage: _base64Image.value);
}
await safeCall( await safeCall(
showError: true,
call: () => rootLogic.chickenRepository.editStewardPurchasesOutSideOfTheProvince( call: () => rootLogic.chickenRepository.editStewardPurchasesOutSideOfTheProvince(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildRawQueryParams(queryParams: {'key': key}), body: edit,
), ),
onSuccess: (result) {
onRefresh();
rootLogic.onRefresh();
toggleExpansion();
},
); );
} }
Future<void> deleteStewardPurchaseOutOfProvince(String key) async { Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
await safeCall( await safeCall(
call: () => rootLogic.chickenRepository.editStewardPurchasesOutSideOfTheProvince( call: () => rootLogic.chickenRepository.deleteStewardPurchasesOutSideOfTheProvince(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildRawQueryParams(queryParams: {'key': key}), queryParameters: buildRawQueryParams(queryParams: {'key': key}),
), ),
@@ -278,9 +294,9 @@ class BuyOutOfProvinceLogic extends GetxController {
void toggleExpansion({int? index}) { void toggleExpansion({int? index}) {
if (expandedListIndex.value == index || index == null) { if (expandedListIndex.value == index || index == null) {
expandedListIndex.value = -1; // Collapse if the same index is tapped expandedListIndex.value = -1;
} else { } else {
expandedListIndex.value = index; // Expand the new index expandedListIndex.value = index;
} }
} }
} }

View File

@@ -218,10 +218,12 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
onPressed: () { onPressed: () {
buildDeleteDialog( buildDeleteDialog(
onConfirm: () => controller.deleteStewardPurchaseOutOfProvince(item.key!), onConfirm: () => controller.deleteStewardPurchaseOutOfProvince(item.key!),
onRefresh: () => controller.getStewardPurchaseOutOfProvince(), onRefresh: () async {
).then((value) { controller.rootLogic.onRefresh();
controller.onRefresh(); controller.onRefresh();
}); controller.toggleExpansion();
},
);
}, },
borderColor: AppColor.redNormal, borderColor: AppColor.redNormal,
), ),
@@ -409,14 +411,18 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
width: Get.width, width: Get.width,
backgroundColor: AppColor.greenNormal, backgroundColor: AppColor.greenNormal,
isLoading: controller.isOnLoadingSubmitOrEdit.value, isLoading: controller.isOnLoadingSubmitOrEdit.value,
onPressed: controller.isSubmitButtonEnabled.value enabled: controller.isSubmitButtonEnabled.value,
onPressed: isOnEdit
? () async { ? () async {
var res = await controller.editStewardPurchaseOutOfProvince();
Get.back();
}
: () async {
var res = await controller.createStewardPurchaseOutOfProvince(); var res = await controller.createStewardPurchaseOutOfProvince();
if (res) { if (res) {
Get.back(); Get.back();
} }
} },
: null,
height: 40, height: 40,
); );
}); });

View File

@@ -18,7 +18,7 @@ class SalesInProvinceLogic extends GetxController {
StewardRootLogic rootLogic = Get.find<StewardRootLogic>(); StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
SaleLogic saleLogic = Get.find<SaleLogic>(); SaleLogic saleLogic = Get.find<SaleLogic>();
RxnString searchedValue = RxnString(); RxnString searchedValue = RxnString();
RxList<int> isExpandedList = <int>[].obs; RxInt expandedListIndex = (-1).obs;
RxList<String> routesName = RxList(); RxList<String> routesName = RxList();
Rx<Color> bgConfirmAllColor = AppColor.blueNormal.obs; Rx<Color> bgConfirmAllColor = AppColor.blueNormal.obs;
final RxBool isLoadingMoreAllocationsMade = false.obs; final RxBool isLoadingMoreAllocationsMade = false.obs;
@@ -33,12 +33,8 @@ class SalesInProvinceLogic extends GetxController {
GlobalKey<FormState> formKey = GlobalKey<FormState>(); GlobalKey<FormState> formKey = GlobalKey<FormState>();
Rx<Jalali> fromDateFilter = Jalali Rx<Jalali> fromDateFilter = Jalali.now().obs;
.now() Rx<Jalali> toDateFilter = Jalali.now().obs;
.obs;
Rx<Jalali> toDateFilter = Jalali
.now()
.obs;
Rxn<ProductModel> selectedProductModel = Rxn<ProductModel>(); Rxn<ProductModel> selectedProductModel = Rxn<ProductModel>();
Rxn<GuildModel> selectedGuildModel = Rxn<GuildModel>(); Rxn<GuildModel> selectedGuildModel = Rxn<GuildModel>();
Rxn<GuildProfile> guildProfile = Rxn<GuildProfile>(); Rxn<GuildProfile> guildProfile = Rxn<GuildProfile>();
@@ -84,16 +80,14 @@ class SalesInProvinceLogic extends GetxController {
}); });
totalCost.listen((data) { totalCost.listen((data) {
totalCostController.text = data totalCostController.text = data.toString().separatedByComma;
.toString()
.separatedByComma;
isValid.value = isValid.value =
weight.value > 0 && weight.value > 0 &&
pricePerKilo.value > 0 && pricePerKilo.value > 0 &&
totalCost.value > 0 && totalCost.value > 0 &&
selectedProductModel.value != null && selectedProductModel.value != null &&
selectedGuildModel.value != null; selectedGuildModel.value != null;
}); });
everAll([ everAll([
totalCost, totalCost,
@@ -114,7 +108,7 @@ class SalesInProvinceLogic extends GetxController {
debounce( debounce(
searchedValue, searchedValue,
(callback) => getAllocatedMade(), (callback) => getAllocatedMade(),
time: Duration(milliseconds: timeDebounce), time: Duration(milliseconds: timeDebounce),
); );
} }
@@ -133,8 +127,7 @@ class SalesInProvinceLogic extends GetxController {
} }
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.getAllocatedMade(
await rootLogic.chickenRepository.getAllocatedMade(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams( queryParameters: buildQueryParams(
page: currentPage.value, page: currentPage.value,
@@ -176,16 +169,15 @@ class SalesInProvinceLogic extends GetxController {
void checkVerification() { void checkVerification() {
isValid.value = isValid.value =
weight.value > 0 && weight.value > 0 &&
pricePerKilo.value > 0 && pricePerKilo.value > 0 &&
totalCost.value > 0 && totalCost.value > 0 &&
selectedProductModel.value != null && selectedProductModel.value != null &&
selectedGuildModel.value != null; selectedGuildModel.value != null;
} }
void confirmAllocation(ConformAllocation allocation) { void confirmAllocation(ConformAllocation allocation) {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.confirmAllocation(
await rootLogic.chickenRepository.confirmAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
allocation: allocation.toJson(), allocation: allocation.toJson(),
), ),
@@ -198,8 +190,7 @@ class SalesInProvinceLogic extends GetxController {
void denyAllocation(String token) { void denyAllocation(String token) {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.denyAllocation(
await rootLogic.chickenRepository.denyAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
allocationToken: token, allocationToken: token,
), ),
@@ -212,8 +203,7 @@ class SalesInProvinceLogic extends GetxController {
Future<void> confirmAllAllocations() async { Future<void> confirmAllAllocations() async {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.confirmAllAllocation(
await rootLogic.chickenRepository.confirmAllAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
allocationTokens: allocatedList.value.data?.results?.map((e) => e.key!).toList() ?? [], allocationTokens: allocatedList.value.data?.results?.map((e) => e.key!).toList() ?? [],
), ),
@@ -226,8 +216,7 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getRolesProducts() async { Future<void> getRolesProducts() async {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.getRolesProducts(
await rootLogic.chickenRepository.getRolesProducts(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
), ),
onSuccess: (result) { onSuccess: (result) {
@@ -242,8 +231,7 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getGuilds() async { Future<void> getGuilds() async {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.getGuilds(
await rootLogic.chickenRepository.getGuilds(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams( queryParameters: buildQueryParams(
queryParams: {'free': saleType.value == 2 ? true : false}, queryParams: {'free': saleType.value == 2 ? true : false},
@@ -274,8 +262,7 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getGuildProfile() async { Future<void> getGuildProfile() async {
await safeCall( await safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.getProfile(
await rootLogic.chickenRepository.getProfile(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
), ),
onError: (error, stackTrace) {}, onError: (error, stackTrace) {},
@@ -289,8 +276,7 @@ class SalesInProvinceLogic extends GetxController {
tmpStewardAllocation = SubmitStewardAllocation( tmpStewardAllocation = SubmitStewardAllocation(
approvedPriceStatus: broadcastPrice.value?.active ?? false, approvedPriceStatus: broadcastPrice.value?.active ?? false,
allocationType: allocationType:
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value '${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}',
?.steward == true ? "steward" : "guild"}',
sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild", sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild",
buyerType: selectedGuildModel.value?.steward == true ? "Steward" : "Guild", buyerType: selectedGuildModel.value?.steward == true ? "Steward" : "Guild",
amount: pricePerKilo.value, amount: pricePerKilo.value,
@@ -301,23 +287,25 @@ class SalesInProvinceLogic extends GetxController {
quota: quotaType.value == 1 ? 'governmental' : 'free', quota: quotaType.value == 1 ? 'governmental' : 'free',
guildKey: selectedGuildModel.value?.key, guildKey: selectedGuildModel.value?.key,
productKey: selectedProductModel.value?.key, productKey: selectedProductModel.value?.key,
date: DateTime date: DateTime.now().formattedDashedGregorian,
.now()
.formattedDashedGregorian,
type: "manual", type: "manual",
); );
} }
Future<void> submitAllocation() async { Future<void> submitAllocation() async {
setSubmitData();
safeCall( safeCall(
call: () async => showError: true,
await rootLogic.chickenRepository.postSubmitStewardAllocation( call: () async => await rootLogic.chickenRepository.postSubmitStewardAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
request: tmpStewardAllocation!, request: tmpStewardAllocation!,
), ),
onSuccess: (result) { onSuccess: (result) {
getAllocatedMade(); clearForm();
onRefresh();
rootLogic.onRefresh();
}, },
onError: (error, stackTrace) {}, onError: (error, stackTrace) {},
); );
@@ -325,8 +313,7 @@ class SalesInProvinceLogic extends GetxController {
Future<void> deleteAllocation(AllocatedMadeModel model) async { Future<void> deleteAllocation(AllocatedMadeModel model) async {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.deleteStewardAllocation(
await rootLogic.chickenRepository.deleteStewardAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
queryParameters: {'steward_allocation_key': model.key}, queryParameters: {'steward_allocation_key': model.key},
), ),
@@ -352,15 +339,9 @@ class SalesInProvinceLogic extends GetxController {
weight.value = item.weightOfCarcasses ?? 0; weight.value = item.weightOfCarcasses ?? 0;
pricePerKilo.value = item.amount ?? 0; pricePerKilo.value = item.amount ?? 0;
totalCost.value = item.totalAmount ?? 0; totalCost.value = item.totalAmount ?? 0;
weightController.text = weight.value weightController.text = weight.value.toString().separatedByComma;
.toString() pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
.separatedByComma; totalCostController.text = totalCost.value.toString().separatedByComma;
pricePerKiloController.text = pricePerKilo.value
.toString()
.separatedByComma;
totalCostController.text = totalCost.value
.toString()
.separatedByComma;
isValid.value = true; isValid.value = true;
} }
@@ -389,14 +370,16 @@ class SalesInProvinceLogic extends GetxController {
); );
safeCall( safeCall(
call: () async => showError: true,
await rootLogic.chickenRepository.updateStewardAllocation( call: () async => await rootLogic.chickenRepository.updateStewardAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
request: updatedAllocationModel, request: updatedAllocationModel,
), ),
onSuccess: (result) { onSuccess: (result) {
getAllocatedMade(); clearForm();
onRefresh();
rootLogic.onRefresh();
}, },
onError: (error, stackTrace) {}, onError: (error, stackTrace) {},
); );
@@ -434,17 +417,14 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getBroadcastPrice() async { Future<void> getBroadcastPrice() async {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.getBroadcastPrice(
await rootLogic.chickenRepository.getBroadcastPrice(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
), ),
onSuccess: (result) { onSuccess: (result) {
broadcastPrice.value = result; broadcastPrice.value = result;
if (broadcastPrice.value?.active == true) { if (broadcastPrice.value?.active == true) {
pricePerKilo.value = broadcastPrice.value?.stewardPrice ?? 0; pricePerKilo.value = broadcastPrice.value?.stewardPrice ?? 0;
pricePerKiloController.text = pricePerKilo.value pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
.toString()
.separatedByComma;
} }
}, },
onError: (error, stacktrace) {}, onError: (error, stacktrace) {},
@@ -452,9 +432,17 @@ class SalesInProvinceLogic extends GetxController {
} }
Future<void> onRefresh() async { Future<void> onRefresh() async {
toggleExpansion();
currentPage.value = 1; currentPage.value = 1;
hasMoreDataAllocationsMade.value = true; hasMoreDataAllocationsMade.value = true;
await rootLogic.onRefresh(); await Future.wait([getAllocatedMade(), rootLogic.onRefresh()]);
await Future.wait([getAllocatedMade()]); }
void toggleExpansion({int? index}) {
if (expandedListIndex.value == index || index == null) {
expandedListIndex.value = -1;
} else {
expandedListIndex.value = index;
}
} }
} }

View File

@@ -47,8 +47,8 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
var item = data.value.data!.results![index]; var item = data.value.data!.results![index];
return ObxValue((val) { return ObxValue((val) {
return ExpandableListItem2( return ExpandableListItem2(
selected: val.contains(index), selected: val.value == index,
onTap: () => controller.isExpandedList.toggle(index), onTap: () => controller.toggleExpansion(index: index),
index: index, index: index,
child: itemListWidget(item), child: itemListWidget(item),
secondChild: itemListExpandedWidget(item, index), secondChild: itemListExpandedWidget(item, index),
@@ -58,7 +58,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
? AppColor.darkGreyDark ? AppColor.darkGreyDark
: AppColor.error, : AppColor.error,
); );
}, controller.isExpandedList); }, controller.expandedListIndex);
}, },
itemCount: data.value.data?.results?.length ?? 0, itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h), separatorBuilder: (context, index) => SizedBox(height: 8.h),
@@ -353,7 +353,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
onPressed: () { onPressed: () {
buildDeleteDialog( buildDeleteDialog(
onConfirm: () async { onConfirm: () async {
controller.isExpandedList.remove(index); controller.toggleExpansion(index: index);
await controller.deleteAllocation(item); await controller.deleteAllocation(item);
}, },
@@ -372,7 +372,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
Widget addOrEditBottomSheet([bool isEditMode = false]) { Widget addOrEditBottomSheet([bool isEditMode = false]) {
return BaseBottomSheet( return BaseBottomSheet(
height: Get.height * (isEditMode ? 0.45 : 0.75), height: Get.height * (isEditMode ? 0.55 : 0.75),
child: Form( child: Form(
key: controller.formKey, key: controller.formKey,
child: Column( child: Column(
@@ -526,7 +526,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
SizedBox(width: 30.w), SizedBox(width: 30.w),
Radio(value: 2), Radio(value: 2),
Text('فروش آزاد', style: AppFonts.yekan14), Text('انبار آزاد', style: AppFonts.yekan14),
], ],
), ),
); );
@@ -576,22 +576,16 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
textStyle: AppFonts.yekan16.copyWith(color: Colors.white), textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
backgroundColor: AppColor.greenNormal, backgroundColor: AppColor.greenNormal,
height: 40, height: 40,
onPressed: data.value enabled: data.value,
onPressed: isEditMode
? () async { ? () async {
if (isEditMode) { await controller.updateAllocation();
await controller.updateAllocation(); Get.back();
controller.clearForm();
controller.getAllocatedMade();
controller.rootLogic.getInventory();
Get.back();
} else {
if (controller.formKey.currentState?.validate() ?? false) {
controller.setSubmitData();
await Get.bottomSheet(show2StepAddBottomSheet());
}
}
} }
: null, : () async {
await controller.submitAllocation();
Get.back();
},
); );
}, controller.isValid), }, controller.isValid),
], ],

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart'; import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.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/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';
@@ -13,21 +12,18 @@ import 'package:rasadyar_chicken/presentation/utils/utils.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
class SalesOutOfProvinceLogic extends GetxController { class SalesOutOfProvinceLogic extends GetxController {
StewardRootLogic rootLogic = Get.find<StewardRootLogic>(); StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
SaleLogic saleLogic = Get.find<SaleLogic>(); SaleLogic saleLogic = Get.find<SaleLogic>();
SalesOutOfProvinceSalesListLogic saleListLogic = Get.find<SalesOutOfProvinceSalesListLogic>();
SalesOutOfProvinceBuyersLogic buyerLogic = Get.find<SalesOutOfProvinceBuyersLogic>();
SalesOutOfProvinceSalesListLogic get saleListLogic =>
Get.find<SalesOutOfProvinceSalesListLogic>();
SalesOutOfProvinceBuyersLogic buyerLogic = Get.find<SalesOutOfProvinceBuyersLogic>();
RxBool isExpanded = false.obs; RxBool isExpanded = false.obs;
RxInt currentPage = 1.obs; RxInt currentPage = 1.obs;
RxBool isSaleSubmitButtonEnabled = false.obs; RxBool isSaleSubmitButtonEnabled = false.obs;
RxList<int> isExpandedList = <int>[].obs; RxInt expandedListIndex = (-1).obs;
Rx<Jalali> fromDateFilter = Jalali.now().obs; Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs; Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString(); RxnString searchedValue = RxnString();
@@ -35,10 +31,10 @@ class SalesOutOfProvinceLogic extends GetxController {
RxBool isLoadingMoreAllocationsMade = false.obs; RxBool isLoadingMoreAllocationsMade = false.obs;
Rxn<IranProvinceCityModel> selectedCity = Rxn(); Rxn<IranProvinceCityModel> selectedCity = Rxn();
GlobalKey<FormState> formKey = GlobalKey<FormState>(); GlobalKey<FormState> formKey = GlobalKey<FormState>();
TextEditingController quarantineCodeController = TextEditingController(); TextEditingController quarantineCodeController = TextEditingController();
TextEditingController saleWeightController = TextEditingController(); TextEditingController saleWeightController = TextEditingController();
TextEditingController saleCountController = TextEditingController();
Rx<Jalali> saleDate = Jalali.now().obs; Rx<Jalali> saleDate = Jalali.now().obs;
String? key; String? key;
@@ -48,6 +44,9 @@ class SalesOutOfProvinceLogic extends GetxController {
Rxn<ProductModel> selectedProduct = Rxn(); Rxn<ProductModel> selectedProduct = Rxn();
Rxn<OutProvinceCarcassesBuyer> selectedBuyer = Rxn(); Rxn<OutProvinceCarcassesBuyer> selectedBuyer = Rxn();
RxInt saleType = 2.obs;
RxInt quotaType = 1.obs;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
@@ -119,6 +118,12 @@ class SalesOutOfProvinceLogic extends GetxController {
void setupListeners() { void setupListeners() {
saleWeightController.addListener(checkSalesFormValid); saleWeightController.addListener(checkSalesFormValid);
quarantineCodeController.addListener(checkSalesFormValid); quarantineCodeController.addListener(checkSalesFormValid);
saleWeightController.addListener(() {
checkSalesFormValid();
var weight = int.parse(saleWeightController.text.clearComma);
var res = (weight / selectedProduct.value!.weightAverage!.toInt()).round();
saleCountController.text = res.separatedByComma;
});
ever(selectedBuyer, (_) => checkSalesFormValid); ever(selectedBuyer, (_) => checkSalesFormValid);
ever(selectedProduct, (_) => checkSalesFormValid); ever(selectedProduct, (_) => checkSalesFormValid);
ever(saleDate, (_) => checkSalesFormValid()); ever(saleDate, (_) => checkSalesFormValid());
@@ -143,14 +148,16 @@ class SalesOutOfProvinceLogic extends GetxController {
); );
selectedProduct.value = rootLogic.rolesProductsModel.first; selectedProduct.value = rootLogic.rolesProductsModel.first;
key = item.key; key = item.key;
saleType.value = item.saleType == 'free' ? 2 : 1;
quotaType.value = item.quota == 'governmental' ? 1 : 2;
isSaleSubmitButtonEnabled.value = true; isSaleSubmitButtonEnabled.value = true;
} }
Future<void> deleteStewardPurchaseOutOfProvince(String key) async { Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
await safeCall( await safeCall(
call: () => rootLogic.chickenRepository.editStewardPurchasesOutSideOfTheProvince( call: () => rootLogic.chickenRepository.deleteOutProvinceStewardFreeBar(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
stewardFreeBarKey: key, key: key,
), ),
); );
} }
@@ -159,19 +166,24 @@ class SalesOutOfProvinceLogic extends GetxController {
bool res = false; bool res = false;
StewardFreeSaleBarRequest requestBody = StewardFreeSaleBarRequest( StewardFreeSaleBarRequest requestBody = StewardFreeSaleBarRequest(
buyerKey: selectedBuyer.value?.key, buyerKey: selectedBuyer.value?.key,
numberOfCarcasses: 0, numberOfCarcasses: int.tryParse(saleCountController.text.clearComma),
weightOfCarcasses: int.tryParse(saleWeightController.text.clearComma), weightOfCarcasses: int.tryParse(saleWeightController.text.clearComma),
date: saleDate.value.toDateTime().formattedDashedGregorian, date: saleDate.value.toDateTime().formattedDashedGregorian,
clearanceCode: quarantineCodeController.text, clearanceCode: quarantineCodeController.text,
productKey: selectedProduct.value?.key, productKey: selectedProduct.value?.key,
saleType: saleType.value == 2 ? 'free' : 'exclusive',
quota: quotaType.value == 1 ? 'governmental' : 'free',
); );
await safeCall( await safeCall(
showError: true,
call: () => rootLogic.chickenRepository.createOutProvinceStewardFreeBar( call: () => rootLogic.chickenRepository.createOutProvinceStewardFreeBar(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
body: requestBody, body: requestBody,
), ),
onSuccess: (_) { onSuccess: (_) {
res = true; res = true;
onRefresh();
rootLogic.onRefresh();
}, },
); );
return res; return res;
@@ -181,8 +193,9 @@ class SalesOutOfProvinceLogic extends GetxController {
quarantineCodeController.clear(); quarantineCodeController.clear();
saleWeightController.clear(); saleWeightController.clear();
saleDate.value = Jalali.now(); saleDate.value = Jalali.now();
saleType.value = 2;
quotaType.value = 1;
selectedBuyer.value = null; selectedBuyer.value = null;
selectedProduct.value = null;
} }
Future<bool> editSale() async { Future<bool> editSale() async {
@@ -192,6 +205,8 @@ class SalesOutOfProvinceLogic extends GetxController {
weightOfCarcasses: int.tryParse(saleWeightController.text.clearComma), weightOfCarcasses: int.tryParse(saleWeightController.text.clearComma),
date: saleDate.value.toDateTime().formattedDashedGregorian, date: saleDate.value.toDateTime().formattedDashedGregorian,
clearanceCode: quarantineCodeController.text, clearanceCode: quarantineCodeController.text,
saleType: saleType.value == 2 ? 'free' : 'exclusive',
quota: quotaType.value == 1 ? 'governmental' : 'free',
key: key, key: key,
); );
await safeCall( await safeCall(
@@ -201,6 +216,7 @@ class SalesOutOfProvinceLogic extends GetxController {
), ),
onSuccess: (_) { onSuccess: (_) {
res = true; res = true;
onRefresh();
}, },
); );
return res; return res;
@@ -208,16 +224,23 @@ class SalesOutOfProvinceLogic extends GetxController {
void resetSubmitForm() { void resetSubmitForm() {
selectedCity.value = null; selectedCity.value = null;
selectedProduct.value = null;
key = null; key = null;
} }
Future<void> onRefresh() async { Future<void> onRefresh() async {
currentPage.value = 1; currentPage.value = 1;
resetSubmitForm();
clearSaleForm();
await rootLogic.onRefresh(); await rootLogic.onRefresh();
await getOutProvinceSales(); await getOutProvinceSales();
}
void toggleExpansion({int? index}) {
if (expandedListIndex.value == index || index == null) {
expandedListIndex.value = -1;
} else {
expandedListIndex.value = index;
}
} }
} }

View File

@@ -44,15 +44,15 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
var item = data.value.data!.results![index]; var item = data.value.data!.results![index];
return ObxValue((val) { return ObxValue((val) {
return ExpandableListItem2( return ExpandableListItem2(
selected: val.contains(index), selected: val.value == index,
onTap: () => controller.isExpandedList.toggle(index), onTap: () => controller.toggleExpansion(index: index),
index: index, index: index,
child: itemListWidget(item), child: itemListWidget(item),
secondChild: itemListExpandedWidget(item, index), secondChild: itemListExpandedWidget(item, index),
labelColor: AppColor.blueLight, labelColor: AppColor.blueLight,
labelIcon: Assets.vec.timerSvg.path, labelIcon: Assets.vec.timerSvg.path,
); );
}, controller.isExpandedList); }, controller.expandedListIndex);
}, },
itemCount: data.value.data?.results?.length ?? 0, itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h), separatorBuilder: (context, index) => SizedBox(height: 8.h),
@@ -69,7 +69,11 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
children: [ children: [
RFab.add( RFab.add(
onPressed: () { onPressed: () {
Get.bottomSheet(addOrEditSaleBottomSheet(), isScrollControlled: true); Get.bottomSheet(addOrEditSaleBottomSheet(), isScrollControlled: true).then((
value,
) {
controller.clearSaleForm();
});
}, },
), ),
Spacer(), Spacer(),
@@ -245,9 +249,13 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'N/A'), buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'N/A'),
buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'N/A'), buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'N/A'),
buildRow( buildRow(
title: 'وزن لاشه (ريال)', title: 'وزن لاشه (کیلوگرم)',
value: '${item.weightOfCarcasses?.separatedByCommaFa}', value: '${item.weightOfCarcasses?.separatedByCommaFa}',
), ),
buildRow(
title: 'حجم تقریبی لاشه (قطعه)',
value: '${item.numberOfCarcasses?.separatedByCommaFa}',
),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@@ -277,10 +285,12 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
onPressed: () { onPressed: () {
buildDeleteDialog( buildDeleteDialog(
onConfirm: () async { onConfirm: () async {
controller.isExpandedList.remove(index); controller.toggleExpansion();
controller.deleteStewardPurchaseOutOfProvince(item.key!); controller.deleteStewardPurchaseOutOfProvince(item.key!);
}, },
onRefresh: () => controller.onRefresh(), onRefresh: () async {
controller.onRefresh();
},
); );
}, },
borderColor: AppColor.redNormal, borderColor: AppColor.redNormal,
@@ -294,7 +304,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
Widget addOrEditSaleBottomSheet([bool isOnEdit = false]) { Widget addOrEditSaleBottomSheet([bool isOnEdit = false]) {
return BaseBottomSheet( return BaseBottomSheet(
height: 500.h, height: 600.h,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Form( child: Form(
key: controller.formKey, key: controller.formKey,
@@ -331,7 +341,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
_buyerWidget(), _buyerWidget(),
RTextField( RTextField(
controller: controller.saleWeightController, controller: controller.saleWeightController,
label: 'وزن لاشه', label: 'وزن لاشه (کیلوگرم)',
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
borderColor: AppColor.darkGreyLight, borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight, filledColor: AppColor.bgLight,
@@ -348,6 +358,28 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
return null; return null;
}, },
), ),
RTextField(
controller: controller.saleCountController,
label: 'حجم تقریبی(قطعه)',
keyboardType: TextInputType.number,
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
variant: RTextFieldVariant.noBorder,
filled: true,
enabled: false,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
SeparatorInputFormatter(),
],
validator: (value) {
if (value == null) {
return 'لطفاً قطعه لاشه را وارد کنید';
}
return null;
},
),
RTextField( RTextField(
controller: controller.quarantineCodeController, controller: controller.quarantineCodeController,
label: 'کد قرنطینه', label: 'کد قرنطینه',
@@ -361,10 +393,54 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
return null; return null;
}, },
), ),
submitButtonWidget(isOnEdit),
SizedBox(
height: 40,
child: ObxValue((data) {
return RadioGroup(
onChanged: (value) {
controller.saleType.value = value ?? 0;
},
groupValue: controller.saleType.value,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Radio(value: 1, enabled: false),
Text('فروش دولتی', style: AppFonts.yekan14),
SizedBox(width: 12),
Radio(value: 2, enabled: isOnEdit ? false : true),
Text('فروش آزاد', style: AppFonts.yekan14),
],
),
);
}, controller.saleType),
),
SizedBox(
height: 40,
child: ObxValue((data) {
return RadioGroup(
onChanged: (value) {
controller.quotaType.value = value ?? 0;
},
groupValue: controller.quotaType.value,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Radio(value: 1, enabled: isOnEdit ? false : true),
Text('انبار دولتی', style: AppFonts.yekan14),
SizedBox(width: 12),
Radio(value: 2, enabled: isOnEdit ? false : true),
Text('انبار آزاد', style: AppFonts.yekan14),
],
),
);
}, controller.saleType),
),
], ],
), ),
), ),
submitButtonWidget(isOnEdit),
SizedBox(), SizedBox(),
], ],
), ),
@@ -383,8 +459,6 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
? () async { ? () async {
var res = isOnEdit ? await controller.editSale() : await controller.createSale(); var res = isOnEdit ? await controller.editSale() : await controller.createSale();
if (res) { if (res) {
controller.getOutProvinceSales();
controller.clearSaleForm();
Get.back(); Get.back();
} }
} }

View File

@@ -16,7 +16,7 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
SalesOutOfProvinceLogic get saleOutOfProvince => Get.find<SalesOutOfProvinceLogic>(); SalesOutOfProvinceLogic get saleOutOfProvince => Get.find<SalesOutOfProvinceLogic>();
RxInt currentPage = 1.obs; RxInt currentPage = 1.obs;
RxList<int> isExpandedList = <int>[].obs; RxInt expandedListIndex = (-1).obs;
Rx<Jalali> fromDateFilter = Jalali.now().obs; Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs; Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString(); RxnString searchedValue = RxnString();
@@ -70,7 +70,7 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
buyerUnitNameController.dispose(); buyerUnitNameController.dispose();
selectedCity.value = null; selectedCity.value = null;
selectedProvince.value = null; selectedProvince.value = null;
isExpandedList.clear();
super.onClose(); super.onClose();
} }
@@ -215,4 +215,11 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
await rootLogic.onRefresh(); await rootLogic.onRefresh();
await getOutProvinceCarcassesBuyer(); await getOutProvinceCarcassesBuyer();
} }
void toggleExpansion({int? index}) {
if (expandedListIndex.value == index || index == null) {
expandedListIndex.value = -1;
} else {
expandedListIndex.value = index;
}
}
} }

View File

@@ -52,15 +52,15 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
var item = data.value.data!.results![index]; var item = data.value.data!.results![index];
return ObxValue((val) { return ObxValue((val) {
return ExpandableListItem2( return ExpandableListItem2(
selected: val.contains(index), selected: val.value == index,
onTap: () => controller.isExpandedList.toggle(index), onTap: () => controller.toggleExpansion(),
index: index, index: index,
child: itemListWidget(item), child: itemListWidget(item),
secondChild: itemListExpandedWidget(item), secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight, labelColor: AppColor.blueLight,
labelIcon: Assets.vec.userRaduisSvg.path, labelIcon: Assets.vec.userRaduisSvg.path,
); );
}, controller.isExpandedList); }, controller.expandedListIndex);
}, },
itemCount: data.value.data?.results?.length ?? 0, itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h), separatorBuilder: (context, index) => SizedBox(height: 8.h),

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart'; import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.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/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';
@@ -12,18 +11,17 @@ import 'package:rasadyar_chicken/presentation/utils/utils.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
class SalesOutOfProvinceSalesListLogic extends GetxController { class SalesOutOfProvinceSalesListLogic extends GetxController {
StewardRootLogic rootLogic = Get.find<StewardRootLogic>(); StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
SaleLogic get saleLogic => Get.find<SaleLogic>(); SaleLogic saleLogic = Get.find<SaleLogic>();
SalesOutOfProvinceBuyersLogic get buyerLogic => SalesOutOfProvinceBuyersLogic buyerLogic = Get.find<SalesOutOfProvinceBuyersLogic>();
Get.find<SalesOutOfProvinceBuyersLogic>();
RxInt selectedSegmentIndex = 0.obs; RxInt selectedSegmentIndex = 0.obs;
RxBool isExpanded = false.obs; RxBool isExpanded = false.obs;
RxInt currentPage = 1.obs; RxInt currentPage = 1.obs;
RxBool isSaleSubmitButtonEnabled = false.obs; RxBool isSaleSubmitButtonEnabled = false.obs;
RxList<int> isExpandedList = <int>[].obs; RxInt expandedListIndex = (-1).obs;
Rx<Jalali> fromDateFilter = Jalali.now().obs; Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs; Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString(); RxnString searchedValue = RxnString();
@@ -34,9 +32,16 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
//TODO add this to Di //TODO add this to Di
ImagePicker imagePicker = ImagePicker(); ImagePicker imagePicker = ImagePicker();
RxInt saleType = 1.obs;
RxInt quotaType = 1.obs;
GlobalKey<FormState> formKey = GlobalKey<FormState>(); GlobalKey<FormState> formKey = GlobalKey<FormState>();
TextEditingController quarantineCodeController = TextEditingController(); TextEditingController quarantineCodeController = TextEditingController();
TextEditingController saleWeightController = TextEditingController(); TextEditingController saleWeightController = TextEditingController();
TextEditingController saleCountController = TextEditingController();
Rx<Jalali> saleDate = Jalali.now().obs; Rx<Jalali> saleDate = Jalali.now().obs;
String? key; String? key;
@@ -92,21 +97,16 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
), ),
onSuccess: (res) { onSuccess: (res) {
if ((res?.count ?? 0) == 0) { if ((res?.count ?? 0) == 0) {
salesList.value = salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.empty();
Resource<PaginationModel<StewardFreeSaleBar>>.empty();
} else { } else {
salesList.value = salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.success(
Resource<PaginationModel<StewardFreeSaleBar>>.success( PaginationModel<StewardFreeSaleBar>(
PaginationModel<StewardFreeSaleBar>( count: res?.count ?? 0,
count: res?.count ?? 0, next: res?.next,
next: res?.next, previous: res?.previous,
previous: res?.previous, results: [...(salesList.value.data?.results ?? []), ...(res?.results ?? [])],
results: [ ),
...(salesList.value.data?.results ?? []), );
...(res?.results ?? []),
],
),
);
isLoadingMoreAllocationsMade.value = false; isLoadingMoreAllocationsMade.value = false;
} }
@@ -115,7 +115,7 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
} }
void setupListeners() { void setupListeners() {
saleWeightController.addListener(checkSalesFormValid);
quarantineCodeController.addListener(checkSalesFormValid); quarantineCodeController.addListener(checkSalesFormValid);
ever(selectedBuyer, (_) => checkSalesFormValid); ever(selectedBuyer, (_) => checkSalesFormValid);
ever(selectedProduct, (_) => checkSalesFormValid); ever(selectedProduct, (_) => checkSalesFormValid);
@@ -133,8 +133,7 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
void setEditDataSales(StewardFreeSaleBar item) { void setEditDataSales(StewardFreeSaleBar item) {
quarantineCodeController.text = item.clearanceCode ?? ''; quarantineCodeController.text = item.clearanceCode ?? '';
saleWeightController.text = saleWeightController.text = item.weightOfCarcasses?.toInt().toString() ?? '';
item.weightOfCarcasses?.toInt().toString() ?? '';
saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!)); saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!));
selectedCity.value = IranProvinceCityModel(name: item.city); selectedCity.value = IranProvinceCityModel(name: item.city);
selectedBuyer.value = buyerLogic.buyerList.value.data?.results?.firstWhere( selectedBuyer.value = buyerLogic.buyerList.value.data?.results?.firstWhere(
@@ -146,21 +145,25 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
} }
Future<void> deleteStewardPurchaseOutOfProvince(String key) async { Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
await safeCall( //todo
/* await safeCall(
call: () => rootLogic.chickenRepository call: () => rootLogic.chickenRepository
.editStewardPurchasesOutSideOfTheProvince( .editStewardPurchasesOutSideOfTheProvince(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
stewardFreeBarKey: key, stewardFreeBarKey: key,
), ),
); );*/
} }
Future<bool> createSale() async { Future<bool> createSale() async {
bool res = false; bool res = false;
var tmpWight = int.tryParse(saleWeightController.text.clearComma);
var tmpCount = (tmpWight! / selectedProduct.value!.weightAverage!).round();
StewardFreeSaleBarRequest requestBody = StewardFreeSaleBarRequest( StewardFreeSaleBarRequest requestBody = StewardFreeSaleBarRequest(
buyerKey: selectedBuyer.value?.key, buyerKey: selectedBuyer.value?.key,
numberOfCarcasses: 0, numberOfCarcasses: tmpCount,
weightOfCarcasses: int.tryParse(saleWeightController.text.clearComma), weightOfCarcasses: tmpWight,
date: saleDate.value.toDateTime().formattedDashedGregorian, date: saleDate.value.toDateTime().formattedDashedGregorian,
clearanceCode: quarantineCodeController.text, clearanceCode: quarantineCodeController.text,
productKey: selectedProduct.value?.key, productKey: selectedProduct.value?.key,
@@ -211,4 +214,11 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
selectedProduct.value = null; selectedProduct.value = null;
key = null; key = null;
} }
void toggleExpansion({int? index}) {
if (expandedListIndex.value == index || index == null) {
expandedListIndex.value = -1;
} else {
expandedListIndex.value = index;
}
}
} }

View File

@@ -5,8 +5,6 @@ import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buy
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/presentation/routes/routes.dart'; import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart' hide ListItem2;
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
import 'logic.dart'; import 'logic.dart';
@@ -29,15 +27,15 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
var item = data.value.data!.results![index]; var item = data.value.data!.results![index];
return ObxValue((val) { return ObxValue((val) {
return ExpandableListItem2( return ExpandableListItem2(
selected: val.contains(index), selected: val.value == index,
onTap: () => controller.isExpandedList.toggle(index), onTap: () => controller.toggleExpansion(),
index: index, index: index,
child: itemListWidget(item), child: itemListWidget(item),
secondChild: itemListExpandedWidget(item, index), secondChild: itemListExpandedWidget(item, index),
labelColor: AppColor.blueLight, labelColor: AppColor.blueLight,
labelIcon: Assets.vec.timerSvg.path, labelIcon: Assets.vec.timerSvg.path,
); );
}, controller.isExpandedList); }, controller.expandedListIndex);
}, },
itemCount: data.value.data?.results?.length ?? 0, itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h), separatorBuilder: (context, index) => SizedBox(height: 8.h),
@@ -227,7 +225,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
onPressed: () { onPressed: () {
buildDeleteDialog( buildDeleteDialog(
onConfirm: () async { onConfirm: () async {
controller.isExpandedList.remove(index); controller.toggleExpansion();
controller.deleteStewardPurchaseOutOfProvince(item.key!); controller.deleteStewardPurchaseOutOfProvince(item.key!);
}, },
onRefresh: () => controller.getOutProvinceSales(), onRefresh: () => controller.getOutProvinceSales(),
@@ -298,6 +296,26 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
return null; return null;
}, },
), ),
RTextField(
controller: controller.saleCountController,
label: 'حجم تقریبی(قطعه)',
keyboardType: TextInputType.number,
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
filled: true,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
SeparatorInputFormatter(),
],
validator: (value) {
if (value == null) {
return 'لطفاً وزن لاشه را وارد کنید';
}
return null;
},
),
RTextField( RTextField(
controller: controller.quarantineCodeController, controller: controller.quarantineCodeController,
label: 'کد قرنطینه', label: 'کد قرنطینه',