feat : search and filter in buyer out of the province

This commit is contained in:
MrM
2025-06-24 16:59:23 +03:30
parent d4f1e86295
commit 701e8e0fbe
16 changed files with 2217 additions and 100 deletions

View File

@@ -0,0 +1,20 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'steward_free_sale_bar_request.freezed.dart';
part 'steward_free_sale_bar_request.g.dart';
@freezed
abstract class StewardFreeSaleBarRequest with _$StewardFreeSaleBarRequest {
const factory StewardFreeSaleBarRequest({
String? buyerKey,
int? numberOfCarcasses,
int? weightOfCarcasses,
String? date,
String? clearanceCode,
String? productKey,
String? key,
}) = _StewardFreeSaleBarRequest;
factory StewardFreeSaleBarRequest.fromJson(Map<String, dynamic> json) =>
_$StewardFreeSaleBarRequestFromJson(json);
}

View File

@@ -0,0 +1,166 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'steward_free_sale_bar_request.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$StewardFreeSaleBarRequest {
String? get buyerKey; int? get numberOfCarcasses; int? get weightOfCarcasses; String? get date; String? get clearanceCode; String? get productKey; String? get key;
/// Create a copy of StewardFreeSaleBarRequest
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$StewardFreeSaleBarRequestCopyWith<StewardFreeSaleBarRequest> get copyWith => _$StewardFreeSaleBarRequestCopyWithImpl<StewardFreeSaleBarRequest>(this as StewardFreeSaleBarRequest, _$identity);
/// Serializes this StewardFreeSaleBarRequest to a JSON map.
Map<String, dynamic> toJson();
@override
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));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,buyerKey,numberOfCarcasses,weightOfCarcasses,date,clearanceCode,productKey,key);
@override
String toString() {
return 'StewardFreeSaleBarRequest(buyerKey: $buyerKey, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, date: $date, clearanceCode: $clearanceCode, productKey: $productKey, key: $key)';
}
}
/// @nodoc
abstract mixin class $StewardFreeSaleBarRequestCopyWith<$Res> {
factory $StewardFreeSaleBarRequestCopyWith(StewardFreeSaleBarRequest value, $Res Function(StewardFreeSaleBarRequest) _then) = _$StewardFreeSaleBarRequestCopyWithImpl;
@useResult
$Res call({
String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key
});
}
/// @nodoc
class _$StewardFreeSaleBarRequestCopyWithImpl<$Res>
implements $StewardFreeSaleBarRequestCopyWith<$Res> {
_$StewardFreeSaleBarRequestCopyWithImpl(this._self, this._then);
final StewardFreeSaleBarRequest _self;
final $Res Function(StewardFreeSaleBarRequest) _then;
/// Create a copy of StewardFreeSaleBarRequest
/// 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,}) {
return _then(_self.copyWith(
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 int?,weightOfCarcasses: freezed == weightOfCarcasses ? _self.weightOfCarcasses : weightOfCarcasses // ignore: cast_nullable_to_non_nullable
as int?,date: freezed == date ? _self.date : date // 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?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _StewardFreeSaleBarRequest implements StewardFreeSaleBarRequest {
const _StewardFreeSaleBarRequest({this.buyerKey, this.numberOfCarcasses, this.weightOfCarcasses, this.date, this.clearanceCode, this.productKey, this.key});
factory _StewardFreeSaleBarRequest.fromJson(Map<String, dynamic> json) => _$StewardFreeSaleBarRequestFromJson(json);
@override final String? buyerKey;
@override final int? numberOfCarcasses;
@override final int? weightOfCarcasses;
@override final String? date;
@override final String? clearanceCode;
@override final String? productKey;
@override final String? key;
/// Create a copy of StewardFreeSaleBarRequest
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$StewardFreeSaleBarRequestCopyWith<_StewardFreeSaleBarRequest> get copyWith => __$StewardFreeSaleBarRequestCopyWithImpl<_StewardFreeSaleBarRequest>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$StewardFreeSaleBarRequestToJson(this, );
}
@override
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));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,buyerKey,numberOfCarcasses,weightOfCarcasses,date,clearanceCode,productKey,key);
@override
String toString() {
return 'StewardFreeSaleBarRequest(buyerKey: $buyerKey, numberOfCarcasses: $numberOfCarcasses, weightOfCarcasses: $weightOfCarcasses, date: $date, clearanceCode: $clearanceCode, productKey: $productKey, key: $key)';
}
}
/// @nodoc
abstract mixin class _$StewardFreeSaleBarRequestCopyWith<$Res> implements $StewardFreeSaleBarRequestCopyWith<$Res> {
factory _$StewardFreeSaleBarRequestCopyWith(_StewardFreeSaleBarRequest value, $Res Function(_StewardFreeSaleBarRequest) _then) = __$StewardFreeSaleBarRequestCopyWithImpl;
@override @useResult
$Res call({
String? buyerKey, int? numberOfCarcasses, int? weightOfCarcasses, String? date, String? clearanceCode, String? productKey, String? key
});
}
/// @nodoc
class __$StewardFreeSaleBarRequestCopyWithImpl<$Res>
implements _$StewardFreeSaleBarRequestCopyWith<$Res> {
__$StewardFreeSaleBarRequestCopyWithImpl(this._self, this._then);
final _StewardFreeSaleBarRequest _self;
final $Res Function(_StewardFreeSaleBarRequest) _then;
/// Create a copy of StewardFreeSaleBarRequest
/// 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,}) {
return _then(_StewardFreeSaleBarRequest(
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 int?,weightOfCarcasses: freezed == weightOfCarcasses ? _self.weightOfCarcasses : weightOfCarcasses // ignore: cast_nullable_to_non_nullable
as int?,date: freezed == date ? _self.date : date // 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?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,31 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'steward_free_sale_bar_request.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_StewardFreeSaleBarRequest _$StewardFreeSaleBarRequestFromJson(
Map<String, dynamic> json,
) => _StewardFreeSaleBarRequest(
buyerKey: json['buyer_key'] as String?,
numberOfCarcasses: (json['number_of_carcasses'] as num?)?.toInt(),
weightOfCarcasses: (json['weight_of_carcasses'] as num?)?.toInt(),
date: json['date'] as String?,
clearanceCode: json['clearance_code'] as String?,
productKey: json['product_key'] as String?,
key: json['key'] as String?,
);
Map<String, dynamic> _$StewardFreeSaleBarRequestToJson(
_StewardFreeSaleBarRequest instance,
) => <String, dynamic>{
'buyer_key': instance.buyerKey,
'number_of_carcasses': instance.numberOfCarcasses,
'weight_of_carcasses': instance.weightOfCarcasses,
'date': instance.date,
'clearance_code': instance.clearanceCode,
'product_key': instance.productKey,
'key': instance.key,
};

View File

@@ -0,0 +1,87 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'steward_free_sale_bar.freezed.dart';
part 'steward_free_sale_bar.g.dart';
@freezed
abstract class StewardFreeSaleBar with _$StewardFreeSaleBar {
const factory StewardFreeSaleBar({
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,
}) = _StewardFreeSaleBar;
factory StewardFreeSaleBar.fromJson(Map<String, dynamic> json) =>
_$StewardFreeSaleBarFromJson(json);
}
@freezed
abstract class Buyer with _$Buyer {
const factory Buyer({
String? key,
String? fullname,
String? firstName,
String? lastName,
String? mobile,
String? unitName,
String? city,
String? province,
bool? active,
BuyerSteward? steward,
}) = _Buyer;
factory Buyer.fromJson(Map<String, dynamic> json) => _$BuyerFromJson(json);
}
@freezed
abstract class BuyerSteward with _$BuyerSteward {
const factory BuyerSteward({
String? key,
String? guildsName,
BuyerStewardUser? user,
String? typeActivity,
String? areaActivity,
}) = _BuyerSteward;
factory BuyerSteward.fromJson(Map<String, dynamic> json) =>
_$BuyerStewardFromJson(json);
}
@freezed
abstract class BuyerStewardUser with _$BuyerStewardUser {
const factory BuyerStewardUser({
String? fullname,
String? firstName,
String? lastName,
String? mobile,
String? nationalId,
String? provinceName,
String? cityName,
String? password,
}) = _BuyerStewardUser;
factory BuyerStewardUser.fromJson(Map<String, dynamic> json) =>
_$BuyerStewardUserFromJson(json);
}

View File

@@ -0,0 +1,751 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'steward_free_sale_bar.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
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;
/// Create a copy of StewardFreeSaleBar
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$StewardFreeSaleBarCopyWith<StewardFreeSaleBar> get copyWith => _$StewardFreeSaleBarCopyWithImpl<StewardFreeSaleBar>(this as StewardFreeSaleBar, _$identity);
/// Serializes this StewardFreeSaleBar to a JSON map.
Map<String, dynamic> toJson();
@override
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));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@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)]);
@override
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)';
}
}
/// @nodoc
abstract mixin class $StewardFreeSaleBarCopyWith<$Res> {
factory $StewardFreeSaleBarCopyWith(StewardFreeSaleBar value, $Res Function(StewardFreeSaleBar) _then) = _$StewardFreeSaleBarCopyWithImpl;
@useResult
$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
});
$BuyerCopyWith<$Res>? get buyer;
}
/// @nodoc
class _$StewardFreeSaleBarCopyWithImpl<$Res>
implements $StewardFreeSaleBarCopyWith<$Res> {
_$StewardFreeSaleBarCopyWithImpl(this._self, this._then);
final StewardFreeSaleBar _self;
final $Res Function(StewardFreeSaleBar) _then;
/// Create a copy of StewardFreeSaleBar
/// 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,}) {
return _then(_self.copyWith(
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 Buyer?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,createDate: freezed == createDate ? _self.createDate : createDate // ignore: cast_nullable_to_non_nullable
as String?,modifyDate: freezed == modifyDate ? _self.modifyDate : modifyDate // ignore: cast_nullable_to_non_nullable
as String?,trash: freezed == trash ? _self.trash : trash // ignore: cast_nullable_to_non_nullable
as bool?,buyerName: freezed == buyerName ? _self.buyerName : buyerName // ignore: cast_nullable_to_non_nullable
as String?,buyerMobile: freezed == buyerMobile ? _self.buyerMobile : buyerMobile // 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?,driverName: freezed == driverName ? _self.driverName : driverName // ignore: cast_nullable_to_non_nullable
as String?,driverMobile: freezed == driverMobile ? _self.driverMobile : driverMobile // ignore: cast_nullable_to_non_nullable
as String?,typeCar: freezed == typeCar ? _self.typeCar : typeCar // ignore: cast_nullable_to_non_nullable
as String?,pelak: freezed == pelak ? _self.pelak : pelak // ignore: cast_nullable_to_non_nullable
as String?,clearanceCode: freezed == clearanceCode ? _self.clearanceCode : clearanceCode // ignore: cast_nullable_to_non_nullable
as String?,numberOfCarcasses: freezed == numberOfCarcasses ? _self.numberOfCarcasses : numberOfCarcasses // ignore: cast_nullable_to_non_nullable
as int?,weightOfCarcasses: freezed == weightOfCarcasses ? _self.weightOfCarcasses : weightOfCarcasses // ignore: cast_nullable_to_non_nullable
as double?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable
as String?,temporaryTrash: freezed == temporaryTrash ? _self.temporaryTrash : temporaryTrash // 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 String?,modifiedBy: freezed == modifiedBy ? _self.modifiedBy : modifiedBy // 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,product: freezed == product ? _self.product : product // ignore: cast_nullable_to_non_nullable
as dynamic,
));
}
/// Create a copy of StewardFreeSaleBar
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$BuyerCopyWith<$Res>? get buyer {
if (_self.buyer == null) {
return null;
}
return $BuyerCopyWith<$Res>(_self.buyer!, (value) {
return _then(_self.copyWith(buyer: value));
});
}
}
/// @nodoc
@JsonSerializable()
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});
factory _StewardFreeSaleBar.fromJson(Map<String, dynamic> json) => _$StewardFreeSaleBarFromJson(json);
@override final int? id;
@override final Buyer? buyer;
@override final String? key;
@override final String? createDate;
@override final String? modifyDate;
@override final bool? trash;
@override final String? buyerName;
@override final String? buyerMobile;
@override final String? province;
@override final String? city;
@override final String? driverName;
@override final String? driverMobile;
@override final String? typeCar;
@override final String? pelak;
@override final String? clearanceCode;
@override final int? numberOfCarcasses;
@override final double? weightOfCarcasses;
@override final String? date;
@override final bool? temporaryTrash;
@override final bool? temporaryDeleted;
@override final String? createdBy;
@override final String? modifiedBy;
@override final dynamic steward;
@override final dynamic guild;
@override final dynamic product;
/// Create a copy of StewardFreeSaleBar
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$StewardFreeSaleBarCopyWith<_StewardFreeSaleBar> get copyWith => __$StewardFreeSaleBarCopyWithImpl<_StewardFreeSaleBar>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$StewardFreeSaleBarToJson(this, );
}
@override
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));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@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)]);
@override
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)';
}
}
/// @nodoc
abstract mixin class _$StewardFreeSaleBarCopyWith<$Res> implements $StewardFreeSaleBarCopyWith<$Res> {
factory _$StewardFreeSaleBarCopyWith(_StewardFreeSaleBar value, $Res Function(_StewardFreeSaleBar) _then) = __$StewardFreeSaleBarCopyWithImpl;
@override @useResult
$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
});
@override $BuyerCopyWith<$Res>? get buyer;
}
/// @nodoc
class __$StewardFreeSaleBarCopyWithImpl<$Res>
implements _$StewardFreeSaleBarCopyWith<$Res> {
__$StewardFreeSaleBarCopyWithImpl(this._self, this._then);
final _StewardFreeSaleBar _self;
final $Res Function(_StewardFreeSaleBar) _then;
/// Create a copy of StewardFreeSaleBar
/// 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,}) {
return _then(_StewardFreeSaleBar(
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 Buyer?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,createDate: freezed == createDate ? _self.createDate : createDate // ignore: cast_nullable_to_non_nullable
as String?,modifyDate: freezed == modifyDate ? _self.modifyDate : modifyDate // ignore: cast_nullable_to_non_nullable
as String?,trash: freezed == trash ? _self.trash : trash // ignore: cast_nullable_to_non_nullable
as bool?,buyerName: freezed == buyerName ? _self.buyerName : buyerName // ignore: cast_nullable_to_non_nullable
as String?,buyerMobile: freezed == buyerMobile ? _self.buyerMobile : buyerMobile // 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?,driverName: freezed == driverName ? _self.driverName : driverName // ignore: cast_nullable_to_non_nullable
as String?,driverMobile: freezed == driverMobile ? _self.driverMobile : driverMobile // ignore: cast_nullable_to_non_nullable
as String?,typeCar: freezed == typeCar ? _self.typeCar : typeCar // ignore: cast_nullable_to_non_nullable
as String?,pelak: freezed == pelak ? _self.pelak : pelak // ignore: cast_nullable_to_non_nullable
as String?,clearanceCode: freezed == clearanceCode ? _self.clearanceCode : clearanceCode // ignore: cast_nullable_to_non_nullable
as String?,numberOfCarcasses: freezed == numberOfCarcasses ? _self.numberOfCarcasses : numberOfCarcasses // ignore: cast_nullable_to_non_nullable
as int?,weightOfCarcasses: freezed == weightOfCarcasses ? _self.weightOfCarcasses : weightOfCarcasses // ignore: cast_nullable_to_non_nullable
as double?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable
as String?,temporaryTrash: freezed == temporaryTrash ? _self.temporaryTrash : temporaryTrash // 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 String?,modifiedBy: freezed == modifiedBy ? _self.modifiedBy : modifiedBy // 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,product: freezed == product ? _self.product : product // ignore: cast_nullable_to_non_nullable
as dynamic,
));
}
/// Create a copy of StewardFreeSaleBar
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$BuyerCopyWith<$Res>? get buyer {
if (_self.buyer == null) {
return null;
}
return $BuyerCopyWith<$Res>(_self.buyer!, (value) {
return _then(_self.copyWith(buyer: value));
});
}
}
/// @nodoc
mixin _$Buyer {
String? get key; String? get fullname; String? get firstName; String? get lastName; String? get mobile; String? get unitName; String? get city; String? get province; bool? get active; BuyerSteward? get steward;
/// Create a copy of Buyer
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$BuyerCopyWith<Buyer> get copyWith => _$BuyerCopyWithImpl<Buyer>(this as Buyer, _$identity);
/// Serializes this Buyer to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is Buyer&&(identical(other.key, key) || other.key == key)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.active, active) || other.active == active)&&(identical(other.steward, steward) || other.steward == steward));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,fullname,firstName,lastName,mobile,unitName,city,province,active,steward);
@override
String toString() {
return 'Buyer(key: $key, fullname: $fullname, firstName: $firstName, lastName: $lastName, mobile: $mobile, unitName: $unitName, city: $city, province: $province, active: $active, steward: $steward)';
}
}
/// @nodoc
abstract mixin class $BuyerCopyWith<$Res> {
factory $BuyerCopyWith(Buyer value, $Res Function(Buyer) _then) = _$BuyerCopyWithImpl;
@useResult
$Res call({
String? key, String? fullname, String? firstName, String? lastName, String? mobile, String? unitName, String? city, String? province, bool? active, BuyerSteward? steward
});
$BuyerStewardCopyWith<$Res>? get steward;
}
/// @nodoc
class _$BuyerCopyWithImpl<$Res>
implements $BuyerCopyWith<$Res> {
_$BuyerCopyWithImpl(this._self, this._then);
final Buyer _self;
final $Res Function(Buyer) _then;
/// Create a copy of Buyer
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? fullname = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? mobile = freezed,Object? unitName = freezed,Object? city = freezed,Object? province = freezed,Object? active = freezed,Object? steward = freezed,}) {
return _then(_self.copyWith(
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String?,active: freezed == active ? _self.active : active // ignore: cast_nullable_to_non_nullable
as bool?,steward: freezed == steward ? _self.steward : steward // ignore: cast_nullable_to_non_nullable
as BuyerSteward?,
));
}
/// Create a copy of Buyer
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$BuyerStewardCopyWith<$Res>? get steward {
if (_self.steward == null) {
return null;
}
return $BuyerStewardCopyWith<$Res>(_self.steward!, (value) {
return _then(_self.copyWith(steward: value));
});
}
}
/// @nodoc
@JsonSerializable()
class _Buyer implements Buyer {
const _Buyer({this.key, this.fullname, this.firstName, this.lastName, this.mobile, this.unitName, this.city, this.province, this.active, this.steward});
factory _Buyer.fromJson(Map<String, dynamic> json) => _$BuyerFromJson(json);
@override final String? key;
@override final String? fullname;
@override final String? firstName;
@override final String? lastName;
@override final String? mobile;
@override final String? unitName;
@override final String? city;
@override final String? province;
@override final bool? active;
@override final BuyerSteward? steward;
/// Create a copy of Buyer
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$BuyerCopyWith<_Buyer> get copyWith => __$BuyerCopyWithImpl<_Buyer>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$BuyerToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Buyer&&(identical(other.key, key) || other.key == key)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.unitName, unitName) || other.unitName == unitName)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.active, active) || other.active == active)&&(identical(other.steward, steward) || other.steward == steward));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,fullname,firstName,lastName,mobile,unitName,city,province,active,steward);
@override
String toString() {
return 'Buyer(key: $key, fullname: $fullname, firstName: $firstName, lastName: $lastName, mobile: $mobile, unitName: $unitName, city: $city, province: $province, active: $active, steward: $steward)';
}
}
/// @nodoc
abstract mixin class _$BuyerCopyWith<$Res> implements $BuyerCopyWith<$Res> {
factory _$BuyerCopyWith(_Buyer value, $Res Function(_Buyer) _then) = __$BuyerCopyWithImpl;
@override @useResult
$Res call({
String? key, String? fullname, String? firstName, String? lastName, String? mobile, String? unitName, String? city, String? province, bool? active, BuyerSteward? steward
});
@override $BuyerStewardCopyWith<$Res>? get steward;
}
/// @nodoc
class __$BuyerCopyWithImpl<$Res>
implements _$BuyerCopyWith<$Res> {
__$BuyerCopyWithImpl(this._self, this._then);
final _Buyer _self;
final $Res Function(_Buyer) _then;
/// Create a copy of Buyer
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? fullname = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? mobile = freezed,Object? unitName = freezed,Object? city = freezed,Object? province = freezed,Object? active = freezed,Object? steward = freezed,}) {
return _then(_Buyer(
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,unitName: freezed == unitName ? _self.unitName : unitName // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String?,active: freezed == active ? _self.active : active // ignore: cast_nullable_to_non_nullable
as bool?,steward: freezed == steward ? _self.steward : steward // ignore: cast_nullable_to_non_nullable
as BuyerSteward?,
));
}
/// Create a copy of Buyer
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$BuyerStewardCopyWith<$Res>? get steward {
if (_self.steward == null) {
return null;
}
return $BuyerStewardCopyWith<$Res>(_self.steward!, (value) {
return _then(_self.copyWith(steward: value));
});
}
}
/// @nodoc
mixin _$BuyerSteward {
String? get key; String? get guildsName; BuyerStewardUser? get user; String? get typeActivity; String? get areaActivity;
/// Create a copy of BuyerSteward
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$BuyerStewardCopyWith<BuyerSteward> get copyWith => _$BuyerStewardCopyWithImpl<BuyerSteward>(this as BuyerSteward, _$identity);
/// Serializes this BuyerSteward to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is BuyerSteward&&(identical(other.key, key) || other.key == key)&&(identical(other.guildsName, guildsName) || other.guildsName == guildsName)&&(identical(other.user, user) || other.user == user)&&(identical(other.typeActivity, typeActivity) || other.typeActivity == typeActivity)&&(identical(other.areaActivity, areaActivity) || other.areaActivity == areaActivity));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,guildsName,user,typeActivity,areaActivity);
@override
String toString() {
return 'BuyerSteward(key: $key, guildsName: $guildsName, user: $user, typeActivity: $typeActivity, areaActivity: $areaActivity)';
}
}
/// @nodoc
abstract mixin class $BuyerStewardCopyWith<$Res> {
factory $BuyerStewardCopyWith(BuyerSteward value, $Res Function(BuyerSteward) _then) = _$BuyerStewardCopyWithImpl;
@useResult
$Res call({
String? key, String? guildsName, BuyerStewardUser? user, String? typeActivity, String? areaActivity
});
$BuyerStewardUserCopyWith<$Res>? get user;
}
/// @nodoc
class _$BuyerStewardCopyWithImpl<$Res>
implements $BuyerStewardCopyWith<$Res> {
_$BuyerStewardCopyWithImpl(this._self, this._then);
final BuyerSteward _self;
final $Res Function(BuyerSteward) _then;
/// Create a copy of BuyerSteward
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? guildsName = freezed,Object? user = freezed,Object? typeActivity = freezed,Object? areaActivity = freezed,}) {
return _then(_self.copyWith(
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,guildsName: freezed == guildsName ? _self.guildsName : guildsName // ignore: cast_nullable_to_non_nullable
as String?,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
as BuyerStewardUser?,typeActivity: freezed == typeActivity ? _self.typeActivity : typeActivity // ignore: cast_nullable_to_non_nullable
as String?,areaActivity: freezed == areaActivity ? _self.areaActivity : areaActivity // ignore: cast_nullable_to_non_nullable
as String?,
));
}
/// Create a copy of BuyerSteward
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$BuyerStewardUserCopyWith<$Res>? get user {
if (_self.user == null) {
return null;
}
return $BuyerStewardUserCopyWith<$Res>(_self.user!, (value) {
return _then(_self.copyWith(user: value));
});
}
}
/// @nodoc
@JsonSerializable()
class _BuyerSteward implements BuyerSteward {
const _BuyerSteward({this.key, this.guildsName, this.user, this.typeActivity, this.areaActivity});
factory _BuyerSteward.fromJson(Map<String, dynamic> json) => _$BuyerStewardFromJson(json);
@override final String? key;
@override final String? guildsName;
@override final BuyerStewardUser? user;
@override final String? typeActivity;
@override final String? areaActivity;
/// Create a copy of BuyerSteward
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$BuyerStewardCopyWith<_BuyerSteward> get copyWith => __$BuyerStewardCopyWithImpl<_BuyerSteward>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$BuyerStewardToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _BuyerSteward&&(identical(other.key, key) || other.key == key)&&(identical(other.guildsName, guildsName) || other.guildsName == guildsName)&&(identical(other.user, user) || other.user == user)&&(identical(other.typeActivity, typeActivity) || other.typeActivity == typeActivity)&&(identical(other.areaActivity, areaActivity) || other.areaActivity == areaActivity));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,guildsName,user,typeActivity,areaActivity);
@override
String toString() {
return 'BuyerSteward(key: $key, guildsName: $guildsName, user: $user, typeActivity: $typeActivity, areaActivity: $areaActivity)';
}
}
/// @nodoc
abstract mixin class _$BuyerStewardCopyWith<$Res> implements $BuyerStewardCopyWith<$Res> {
factory _$BuyerStewardCopyWith(_BuyerSteward value, $Res Function(_BuyerSteward) _then) = __$BuyerStewardCopyWithImpl;
@override @useResult
$Res call({
String? key, String? guildsName, BuyerStewardUser? user, String? typeActivity, String? areaActivity
});
@override $BuyerStewardUserCopyWith<$Res>? get user;
}
/// @nodoc
class __$BuyerStewardCopyWithImpl<$Res>
implements _$BuyerStewardCopyWith<$Res> {
__$BuyerStewardCopyWithImpl(this._self, this._then);
final _BuyerSteward _self;
final $Res Function(_BuyerSteward) _then;
/// Create a copy of BuyerSteward
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? guildsName = freezed,Object? user = freezed,Object? typeActivity = freezed,Object? areaActivity = freezed,}) {
return _then(_BuyerSteward(
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,guildsName: freezed == guildsName ? _self.guildsName : guildsName // ignore: cast_nullable_to_non_nullable
as String?,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
as BuyerStewardUser?,typeActivity: freezed == typeActivity ? _self.typeActivity : typeActivity // ignore: cast_nullable_to_non_nullable
as String?,areaActivity: freezed == areaActivity ? _self.areaActivity : areaActivity // ignore: cast_nullable_to_non_nullable
as String?,
));
}
/// Create a copy of BuyerSteward
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$BuyerStewardUserCopyWith<$Res>? get user {
if (_self.user == null) {
return null;
}
return $BuyerStewardUserCopyWith<$Res>(_self.user!, (value) {
return _then(_self.copyWith(user: value));
});
}
}
/// @nodoc
mixin _$BuyerStewardUser {
String? get fullname; String? get firstName; String? get lastName; String? get mobile; String? get nationalId; String? get provinceName; String? get cityName; String? get password;
/// Create a copy of BuyerStewardUser
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$BuyerStewardUserCopyWith<BuyerStewardUser> get copyWith => _$BuyerStewardUserCopyWithImpl<BuyerStewardUser>(this as BuyerStewardUser, _$identity);
/// Serializes this BuyerStewardUser to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is BuyerStewardUser&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.provinceName, provinceName) || other.provinceName == provinceName)&&(identical(other.cityName, cityName) || other.cityName == cityName)&&(identical(other.password, password) || other.password == password));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,fullname,firstName,lastName,mobile,nationalId,provinceName,cityName,password);
@override
String toString() {
return 'BuyerStewardUser(fullname: $fullname, firstName: $firstName, lastName: $lastName, mobile: $mobile, nationalId: $nationalId, provinceName: $provinceName, cityName: $cityName, password: $password)';
}
}
/// @nodoc
abstract mixin class $BuyerStewardUserCopyWith<$Res> {
factory $BuyerStewardUserCopyWith(BuyerStewardUser value, $Res Function(BuyerStewardUser) _then) = _$BuyerStewardUserCopyWithImpl;
@useResult
$Res call({
String? fullname, String? firstName, String? lastName, String? mobile, String? nationalId, String? provinceName, String? cityName, String? password
});
}
/// @nodoc
class _$BuyerStewardUserCopyWithImpl<$Res>
implements $BuyerStewardUserCopyWith<$Res> {
_$BuyerStewardUserCopyWithImpl(this._self, this._then);
final BuyerStewardUser _self;
final $Res Function(BuyerStewardUser) _then;
/// Create a copy of BuyerStewardUser
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? fullname = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? mobile = freezed,Object? nationalId = freezed,Object? provinceName = freezed,Object? cityName = freezed,Object? password = freezed,}) {
return _then(_self.copyWith(
fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable
as String?,provinceName: freezed == provinceName ? _self.provinceName : provinceName // ignore: cast_nullable_to_non_nullable
as String?,cityName: freezed == cityName ? _self.cityName : cityName // ignore: cast_nullable_to_non_nullable
as String?,password: freezed == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _BuyerStewardUser implements BuyerStewardUser {
const _BuyerStewardUser({this.fullname, this.firstName, this.lastName, this.mobile, this.nationalId, this.provinceName, this.cityName, this.password});
factory _BuyerStewardUser.fromJson(Map<String, dynamic> json) => _$BuyerStewardUserFromJson(json);
@override final String? fullname;
@override final String? firstName;
@override final String? lastName;
@override final String? mobile;
@override final String? nationalId;
@override final String? provinceName;
@override final String? cityName;
@override final String? password;
/// Create a copy of BuyerStewardUser
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$BuyerStewardUserCopyWith<_BuyerStewardUser> get copyWith => __$BuyerStewardUserCopyWithImpl<_BuyerStewardUser>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$BuyerStewardUserToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _BuyerStewardUser&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.nationalId, nationalId) || other.nationalId == nationalId)&&(identical(other.provinceName, provinceName) || other.provinceName == provinceName)&&(identical(other.cityName, cityName) || other.cityName == cityName)&&(identical(other.password, password) || other.password == password));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,fullname,firstName,lastName,mobile,nationalId,provinceName,cityName,password);
@override
String toString() {
return 'BuyerStewardUser(fullname: $fullname, firstName: $firstName, lastName: $lastName, mobile: $mobile, nationalId: $nationalId, provinceName: $provinceName, cityName: $cityName, password: $password)';
}
}
/// @nodoc
abstract mixin class _$BuyerStewardUserCopyWith<$Res> implements $BuyerStewardUserCopyWith<$Res> {
factory _$BuyerStewardUserCopyWith(_BuyerStewardUser value, $Res Function(_BuyerStewardUser) _then) = __$BuyerStewardUserCopyWithImpl;
@override @useResult
$Res call({
String? fullname, String? firstName, String? lastName, String? mobile, String? nationalId, String? provinceName, String? cityName, String? password
});
}
/// @nodoc
class __$BuyerStewardUserCopyWithImpl<$Res>
implements _$BuyerStewardUserCopyWith<$Res> {
__$BuyerStewardUserCopyWithImpl(this._self, this._then);
final _BuyerStewardUser _self;
final $Res Function(_BuyerStewardUser) _then;
/// Create a copy of BuyerStewardUser
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? fullname = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? mobile = freezed,Object? nationalId = freezed,Object? provinceName = freezed,Object? cityName = freezed,Object? password = freezed,}) {
return _then(_BuyerStewardUser(
fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,nationalId: freezed == nationalId ? _self.nationalId : nationalId // ignore: cast_nullable_to_non_nullable
as String?,provinceName: freezed == provinceName ? _self.provinceName : provinceName // ignore: cast_nullable_to_non_nullable
as String?,cityName: freezed == cityName ? _self.cityName : cityName // ignore: cast_nullable_to_non_nullable
as String?,password: freezed == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,139 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'steward_free_sale_bar.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_StewardFreeSaleBar _$StewardFreeSaleBarFromJson(Map<String, dynamic> json) =>
_StewardFreeSaleBar(
id: (json['id'] as num?)?.toInt(),
buyer: json['buyer'] == null
? null
: Buyer.fromJson(json['buyer'] as Map<String, dynamic>),
key: json['key'] as String?,
createDate: json['create_date'] as String?,
modifyDate: json['modify_date'] as String?,
trash: json['trash'] as bool?,
buyerName: json['buyer_name'] as String?,
buyerMobile: json['buyer_mobile'] as String?,
province: json['province'] as String?,
city: json['city'] as String?,
driverName: json['driver_name'] as String?,
driverMobile: json['driver_mobile'] as String?,
typeCar: json['type_car'] as String?,
pelak: json['pelak'] as String?,
clearanceCode: json['clearance_code'] as String?,
numberOfCarcasses: (json['number_of_carcasses'] as num?)?.toInt(),
weightOfCarcasses: (json['weight_of_carcasses'] as num?)?.toDouble(),
date: json['date'] as String?,
temporaryTrash: json['temporary_trash'] as bool?,
temporaryDeleted: json['temporary_deleted'] as bool?,
createdBy: json['created_by'] as String?,
modifiedBy: json['modified_by'] as String?,
steward: json['steward'],
guild: json['guild'],
product: json['product'],
);
Map<String, dynamic> _$StewardFreeSaleBarToJson(_StewardFreeSaleBar instance) =>
<String, dynamic>{
'id': instance.id,
'buyer': instance.buyer,
'key': instance.key,
'create_date': instance.createDate,
'modify_date': instance.modifyDate,
'trash': instance.trash,
'buyer_name': instance.buyerName,
'buyer_mobile': instance.buyerMobile,
'province': instance.province,
'city': instance.city,
'driver_name': instance.driverName,
'driver_mobile': instance.driverMobile,
'type_car': instance.typeCar,
'pelak': instance.pelak,
'clearance_code': instance.clearanceCode,
'number_of_carcasses': instance.numberOfCarcasses,
'weight_of_carcasses': instance.weightOfCarcasses,
'date': instance.date,
'temporary_trash': instance.temporaryTrash,
'temporary_deleted': instance.temporaryDeleted,
'created_by': instance.createdBy,
'modified_by': instance.modifiedBy,
'steward': instance.steward,
'guild': instance.guild,
'product': instance.product,
};
_Buyer _$BuyerFromJson(Map<String, dynamic> json) => _Buyer(
key: json['key'] as String?,
fullname: json['fullname'] as String?,
firstName: json['first_name'] as String?,
lastName: json['last_name'] as String?,
mobile: json['mobile'] as String?,
unitName: json['unit_name'] as String?,
city: json['city'] as String?,
province: json['province'] as String?,
active: json['active'] as bool?,
steward: json['steward'] == null
? null
: BuyerSteward.fromJson(json['steward'] as Map<String, dynamic>),
);
Map<String, dynamic> _$BuyerToJson(_Buyer instance) => <String, dynamic>{
'key': instance.key,
'fullname': instance.fullname,
'first_name': instance.firstName,
'last_name': instance.lastName,
'mobile': instance.mobile,
'unit_name': instance.unitName,
'city': instance.city,
'province': instance.province,
'active': instance.active,
'steward': instance.steward,
};
_BuyerSteward _$BuyerStewardFromJson(Map<String, dynamic> json) =>
_BuyerSteward(
key: json['key'] as String?,
guildsName: json['guilds_name'] as String?,
user: json['user'] == null
? null
: BuyerStewardUser.fromJson(json['user'] as Map<String, dynamic>),
typeActivity: json['type_activity'] as String?,
areaActivity: json['area_activity'] as String?,
);
Map<String, dynamic> _$BuyerStewardToJson(_BuyerSteward instance) =>
<String, dynamic>{
'key': instance.key,
'guilds_name': instance.guildsName,
'user': instance.user,
'type_activity': instance.typeActivity,
'area_activity': instance.areaActivity,
};
_BuyerStewardUser _$BuyerStewardUserFromJson(Map<String, dynamic> json) =>
_BuyerStewardUser(
fullname: json['fullname'] as String?,
firstName: json['first_name'] as String?,
lastName: json['last_name'] as String?,
mobile: json['mobile'] as String?,
nationalId: json['national_id'] as String?,
provinceName: json['province_name'] as String?,
cityName: json['city_name'] as String?,
password: json['password'] as String?,
);
Map<String, dynamic> _$BuyerStewardUserToJson(_BuyerStewardUser instance) =>
<String, dynamic>{
'fullname': instance.fullname,
'first_name': instance.firstName,
'last_name': instance.lastName,
'mobile': instance.mobile,
'national_id': instance.nationalId,
'province_name': instance.provinceName,
'city_name': instance.cityName,
'password': instance.password,
};

View File

@@ -1,3 +1,4 @@
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart';
@@ -13,38 +14,72 @@ import 'package:rasadyar_chicken/data/models/response/pagination_model/paginatio
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart' hide ProductModel;
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
hide ProductModel;
import '../models/request/create_steward_free_bar/create_steward_free_bar.dart';
abstract class ChickenRepository {
Future<List<InventoryModel>?> getInventory({required String token});
Future<KillHouseDistributionInfo?> getKillHouseDistributionInfo({required String token});
Future<KillHouseDistributionInfo?> getKillHouseDistributionInfo({
required String token,
});
Future<BarInformation?> getGeneralBarInformation({required String token, Map<String, dynamic>? queryParameters});
Future<BarInformation?> getGeneralBarInformation({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<WaitingArrivalModel?> getWaitingArrivals({required String token, int? page});
Future<WaitingArrivalModel?> getWaitingArrivals({
required String token,
int? page,
});
Future<void> setSateForArrivals({required String token, required Map<String, dynamic> request});
Future<void> setSateForArrivals({
required String token,
required Map<String, dynamic> request,
});
Future<ImportedLoadsModel?> getImportedLoadsModel({required String token, required int page});
Future<ImportedLoadsModel?> getImportedLoadsModel({
required String token,
required int page,
});
Future<AllocatedMadeModel?> getAllocatedMade({required String token, required int page});
Future<AllocatedMadeModel?> getAllocatedMade({
required String token,
required int page,
});
Future<void> confirmAllocation({required String token, required Map<String, dynamic> allocation});
Future<void> confirmAllocation({
required String token,
required Map<String, dynamic> allocation,
});
Future<void> denyAllocation({required String token, required String allocationToken});
Future<void> denyAllocation({
required String token,
required String allocationToken,
});
Future<void> confirmAllAllocation({required String token, required List<String> allocationTokens});
Future<void> confirmAllAllocation({
required String token,
required List<String> allocationTokens,
});
Future<List<ProductModel>?> getRolesProducts({required String token});
Future<List<GuildModel>?> getGuilds({required String token, required bool isFree});
Future<List<GuildModel>?> getGuilds({
required String token,
required bool isFree,
});
Future<GuildProfile?> getProfile({required String token});
Future<void> postSubmitStewardAllocation({required String token, required SubmitStewardAllocation request});
Future<void> postSubmitStewardAllocation({
required String token,
required SubmitStewardAllocation request,
});
Future<StewardFreeBarDashboard?> getStewardDashboard({
required String token,
@@ -58,26 +93,50 @@ abstract class ChickenRepository {
required String endDate,
});
Future<PaginationModel<StewardFreeBar>?> getStewardPurchasesOutSideOfTheProvince({
Future<PaginationModel<StewardFreeBar>?>
getStewardPurchasesOutSideOfTheProvince({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> createStewardPurchasesOutSideOfTheProvince({
required String token,
required CreateStewardFreeBar body,
});
Future<void> createStewardPurchasesOutSideOfTheProvince({required String token, required CreateStewardFreeBar body});
Future<void> deleteStewardPurchasesOutSideOfTheProvince({
required String token,
required String stewardFreeBarKey,
});
Future<void> deleteStewardPurchasesOutSideOfTheProvince({required String token, required String stewardFreeBarKey});
Future<PaginationModel<OutProvinceCarcassesBuyer>?> getOutProvinceCarcassesBuyer({
Future<PaginationModel<OutProvinceCarcassesBuyer>?>
getOutProvinceCarcassesBuyer({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> createOutProvinceCarcassesBuyer({required String token, required OutProvinceCarcassesBuyer body});
Future<void> createOutProvinceCarcassesBuyer({
required String token,
required OutProvinceCarcassesBuyer body,
});
Future<List<IranProvinceCityModel>?> getProvince();
Future<List<IranProvinceCityModel>?> getCity({required String provinceName});
Future<PaginationModel<StewardFreeSaleBar>?> getStewardFreeSaleBar({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> createOutProvinceStewardFreeBar({
required String token,
required StewardFreeSaleBarRequest body,
});
Future<void> updateOutProvinceStewardFreeBar({
required String token,
required StewardFreeSaleBarRequest body,
});
}

View File

@@ -1,4 +1,5 @@
import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/create_steward_free_bar.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/submit_steward_allocation/submit_steward_allocation.dart';
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart';
@@ -14,7 +15,9 @@ import 'package:rasadyar_chicken/data/models/response/pagination_model/paginatio
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart' hide ProductModel;
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
hide ProductModel;
import 'package:rasadyar_core/core.dart';
import 'chicken_repository.dart';
@@ -29,14 +32,18 @@ class ChickenRepositoryImpl implements ChickenRepository {
var res = await _httpClient.get(
'/roles-products/?role=Steward',
headers: {'Authorization': 'Bearer $token'},
fromJsonList: (json) => (json).map((item) => InventoryModel.fromJson(item as Map<String, dynamic>)).toList(),
fromJsonList: (json) => (json)
.map((item) => InventoryModel.fromJson(item as Map<String, dynamic>))
.toList(),
);
return res.data;
}
@override
Future<KillHouseDistributionInfo?> getKillHouseDistributionInfo({required String token}) async {
Future<KillHouseDistributionInfo?> getKillHouseDistributionInfo({
required String token,
}) async {
var res = await _httpClient.get(
'/kill-house-distribution-info/?role=Steward',
headers: {'Authorization': 'Bearer $token'},
@@ -61,7 +68,10 @@ class ChickenRepositoryImpl implements ChickenRepository {
}
@override
Future<WaitingArrivalModel?> getWaitingArrivals({required String token, int? page}) async {
Future<WaitingArrivalModel?> getWaitingArrivals({
required String token,
int? page,
}) async {
var res = await _httpClient.get(
'/steward-allocation/?search=filter&value=&role=Steward&page=${page ?? 1}&page_size=10&type=not_entered',
headers: {'Authorization': 'Bearer $token'},
@@ -71,12 +81,22 @@ class ChickenRepositoryImpl implements ChickenRepository {
}
@override
Future<void> setSateForArrivals({required String token, required Map<String, dynamic> request}) async {
await _httpClient.put('/steward-allocation/0/', headers: {'Authorization': 'Bearer $token'}, data: request);
Future<void> setSateForArrivals({
required String token,
required Map<String, dynamic> request,
}) async {
await _httpClient.put(
'/steward-allocation/0/',
headers: {'Authorization': 'Bearer $token'},
data: request,
);
}
@override
Future<ImportedLoadsModel?> getImportedLoadsModel({required String token, required int page}) async {
Future<ImportedLoadsModel?> getImportedLoadsModel({
required String token,
required int page,
}) async {
var res = await _httpClient.get(
'/steward-allocation/?role=Steward&search=filter&page=$page&page_size=10&value=&type=entered',
headers: {'Authorization': 'Bearer $token'},
@@ -86,7 +106,10 @@ class ChickenRepositoryImpl implements ChickenRepository {
}
@override
Future<AllocatedMadeModel?> getAllocatedMade({required String token, required int page}) async {
Future<AllocatedMadeModel?> getAllocatedMade({
required String token,
required int page,
}) async {
var res = await _httpClient.get(
'/steward-allocation/?search=filter&value=&role=Steward&page=$page&page_size=100',
headers: {'Authorization': 'Bearer $token'},
@@ -96,7 +119,10 @@ class ChickenRepositoryImpl implements ChickenRepository {
}
@override
Future<void> confirmAllocation({required String token, required Map<String, dynamic> allocation}) async {
Future<void> confirmAllocation({
required String token,
required Map<String, dynamic> allocation,
}) async {
var res = await _httpClient.put(
'/steward-allocation/0/',
headers: {'Authorization': 'Bearer $token'},
@@ -105,7 +131,10 @@ class ChickenRepositoryImpl implements ChickenRepository {
}
@override
Future<void> denyAllocation({required String token, required String allocationToken}) async {
Future<void> denyAllocation({
required String token,
required String allocationToken,
}) async {
await _httpClient.delete(
'/steward-allocation/0/?steward_allocation_key=$allocationToken',
headers: {'Authorization': 'Bearer $token'},
@@ -113,7 +142,10 @@ class ChickenRepositoryImpl implements ChickenRepository {
}
@override
Future<void> confirmAllAllocation({required String token, required List<String> allocationTokens}) async {
Future<void> confirmAllAllocation({
required String token,
required List<String> allocationTokens,
}) async {
await _httpClient.put(
'/steward-allocation/0/',
headers: {'Authorization': 'Bearer $token'},
@@ -126,18 +158,25 @@ class ChickenRepositoryImpl implements ChickenRepository {
var res = await _httpClient.get(
'/roles-products/?role=Steward',
headers: {'Authorization': 'Bearer $token'},
fromJsonList: (json) => json.map((item) => ProductModel.fromJson(item as Map<String, dynamic>)).toList(),
fromJsonList: (json) => json
.map((item) => ProductModel.fromJson(item as Map<String, dynamic>))
.toList(),
);
return res.data;
}
@override
Future<List<GuildModel>?> getGuilds({required String token, required bool isFree}) async {
Future<List<GuildModel>?> getGuilds({
required String token,
required bool isFree,
}) async {
var res = await _httpClient.get(
'/guilds/?role=Steward&free=$isFree',
headers: {'Authorization': 'Bearer $token'},
fromJsonList: (json) => json.map((item) => GuildModel.fromJson(item as Map<String, dynamic>)).toList(),
fromJsonList: (json) => json
.map((item) => GuildModel.fromJson(item as Map<String, dynamic>))
.toList(),
);
return res.data;
}
@@ -153,8 +192,15 @@ class ChickenRepositoryImpl implements ChickenRepository {
}
@override
Future<void> postSubmitStewardAllocation({required String token, required SubmitStewardAllocation request}) async {
await _httpClient.post('/steward-allocation/', headers: {'Authorization': 'Bearer $token'}, data: request.toJson());
Future<void> postSubmitStewardAllocation({
required String token,
required SubmitStewardAllocation request,
}) async {
await _httpClient.post(
'/steward-allocation/',
headers: {'Authorization': 'Bearer $token'},
data: request.toJson(),
);
}
@override
@@ -186,7 +232,8 @@ class ChickenRepositoryImpl implements ChickenRepository {
}
@override
Future<PaginationModel<StewardFreeBar>?> getStewardPurchasesOutSideOfTheProvince({
Future<PaginationModel<StewardFreeBar>?>
getStewardPurchasesOutSideOfTheProvince({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
@@ -203,11 +250,18 @@ class ChickenRepositoryImpl implements ChickenRepository {
}
@override
Future<List<IranProvinceCityModel>?> getCity({required String provinceName}) async {
Future<List<IranProvinceCityModel>?> getCity({
required String provinceName,
}) async {
var res = await _httpClient.get(
'/iran_city/?',
queryParameters: {'name': provinceName},
fromJsonList: (json) => json.map((item) => IranProvinceCityModel.fromJson(item as Map<String, dynamic>)).toList(),
fromJsonList: (json) => json
.map(
(item) =>
IranProvinceCityModel.fromJson(item as Map<String, dynamic>),
)
.toList(),
);
return res.data;
}
@@ -216,7 +270,12 @@ class ChickenRepositoryImpl implements ChickenRepository {
Future<List<IranProvinceCityModel>?> getProvince() async {
var res = await _httpClient.get(
'/iran_province/',
fromJsonList: (json) => json.map((item) => IranProvinceCityModel.fromJson(item as Map<String, dynamic>)).toList(),
fromJsonList: (json) => json
.map(
(item) =>
IranProvinceCityModel.fromJson(item as Map<String, dynamic>),
)
.toList(),
);
return res.data;
}
@@ -246,7 +305,8 @@ class ChickenRepositoryImpl implements ChickenRepository {
}
@override
Future<PaginationModel<OutProvinceCarcassesBuyer>?> getOutProvinceCarcassesBuyer({
Future<PaginationModel<OutProvinceCarcassesBuyer>?>
getOutProvinceCarcassesBuyer({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
@@ -256,18 +316,68 @@ class ChickenRepositoryImpl implements ChickenRepository {
headers: {'Authorization': 'Bearer $token'},
fromJson: (json) => PaginationModel<OutProvinceCarcassesBuyer>.fromJson(
json,
(json) => OutProvinceCarcassesBuyer.fromJson(json as Map<String, dynamic>),
(json) =>
OutProvinceCarcassesBuyer.fromJson(json as Map<String, dynamic>),
),
);
return res.data;
}
@override
Future<void> createOutProvinceCarcassesBuyer({required String token, required OutProvinceCarcassesBuyer body}) async {
Future<void> createOutProvinceCarcassesBuyer({
required String token,
required OutProvinceCarcassesBuyer body,
}) async {
await _httpClient.post(
'/out-province-carcasses-buyer/',
data: body.toJson()..removeWhere((key, value) => value == null),
headers: {'Authorization': 'Bearer $token'},
);
}
@override
Future<PaginationModel<StewardFreeSaleBar>?> getStewardFreeSaleBar({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/steward_free_sale_bar/?',
queryParameters: queryParameters,
headers: {'Authorization': 'Bearer $token'},
fromJson: (json) => PaginationModel<StewardFreeSaleBar>.fromJson(
json,
(json) => StewardFreeSaleBar.fromJson(json as Map<String, dynamic>),
),
);
return res.data;
}
@override
Future<void> createOutProvinceStewardFreeBar({
required String token,
required StewardFreeSaleBarRequest body,
}) async {
await _httpClient.post(
'/steward_free_sale_bar/',
data: body.toJson()..removeWhere((key, value) => value == null),
headers: {'Authorization': 'Bearer $token'},
);
}
@override
Future<void> updateOutProvinceStewardFreeBar({
required String token,
required StewardFreeSaleBarRequest body,
}) async {
await _httpClient.put(
'/steward_free_sale_bar/0/',
data: body.toJson()
..removeWhere((key, value) => value == null)
..addAll({
'carcassWeight': body.weightOfCarcasses,
'carcassCount': body.numberOfCarcasses,
}),
headers: {'Authorization': 'Bearer $token'},
);
}
}

View File

@@ -468,8 +468,6 @@ class BuysOutOfProvincePage extends GetView<BuysOutOfProvinceLogic> {
}
Widget _productTypeWidget() {
tLog(controller.outOfTheProvinceLogic.rolesProductsModel);
iLog(controller.selectedProduct.value);
return Obx(() {
return OverlayDropdownWidget<ProductModel>(
items: controller.outOfTheProvinceLogic.rolesProductsModel,

View File

@@ -1,9 +1,11 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_auth/data/utils/safe_call.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/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
import 'package:rasadyar_chicken/presentation/pages/out_of_province/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/root/logic.dart';
import 'package:rasadyar_core/core.dart';
@@ -12,16 +14,21 @@ class SalesOutOfProvinceLogic extends GetxController {
RxInt currentIndex = 0.obs;
RxBool isExpanded = false.obs;
RxBool isSubmitButtonEnabled = false.obs;
RxBool isBuyerSubmitButtonEnabled = false.obs;
RxBool isSaleSubmitButtonEnabled = false.obs;
RxList<int> isExpandedList = <int>[].obs;
RxBool searchIsSelected = false.obs;
//TODO add this to Di
ImagePicker imagePicker = ImagePicker();
Rx<Resource<List<OutProvinceCarcassesBuyer>>> buyerList = Resource<List<OutProvinceCarcassesBuyer>>.loading().obs;
Rx<Resource<List<OutProvinceCarcassesBuyer>>> buyerList =
Resource<List<OutProvinceCarcassesBuyer>>.loading().obs;
Rx<Resource<List<StewardFreeSaleBar>>> salesList =
Resource<List<StewardFreeSaleBar>>.loading().obs;
Rxn<ProductModel> selectedProduct = Rxn();
Rxn<OutProvinceCarcassesBuyer> selectedBuyer = Rxn();
RxList<IranProvinceCityModel> cites = <IranProvinceCityModel>[].obs;
Rxn<IranProvinceCityModel> selectedProvince = Rxn();
@@ -29,7 +36,8 @@ class SalesOutOfProvinceLogic extends GetxController {
RootLogic get rootLogic => Get.find<RootLogic>();
OutOfProvinceLogic get outOfTheProvinceLogic => Get.find<OutOfProvinceLogic>();
OutOfProvinceLogic get outOfTheProvinceLogic =>
Get.find<OutOfProvinceLogic>();
GlobalKey<FormState> formKey = GlobalKey<FormState>();
TextEditingController buyerNameController = TextEditingController();
@@ -37,21 +45,39 @@ class SalesOutOfProvinceLogic extends GetxController {
TextEditingController buyerPhoneController = TextEditingController();
TextEditingController buyerUnitNameController = TextEditingController();
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
//Sale
TextEditingController quarantineCodeController = TextEditingController();
TextEditingController saleWeightController = TextEditingController();
Rx<Jalali> saleDate = Jalali
.now()
.obs;
String? key;
Rx<Jalali> fromDateFilter = Jalali
.now()
.obs;
Rx<Jalali> toDateFilter = Jalali
.now()
.obs;
RxnString searchedValue = RxnString();
@override
void onReady() {
super.onReady();
getOutProvinceCarcassesBuyer();
getOutProvinceSales();
selectedProvince.listen((p0) => getCites());
tLog(selectedProduct.value);
outOfTheProvinceLogic.rolesProductsModel.listen((lists) {
selectedProduct.value = lists.first;
});
setupListeners();
debounce(searchedValue, (callback) => getOutProvinceCarcassesBuyer(), time: Duration(milliseconds: 2000));
debounce(
searchedValue,
(callback) => getOutProvinceCarcassesBuyer(),
time: Duration(milliseconds: 2000),
);
ever(searchIsSelected, (data) {
if (data == false) {
searchedValue.value = null;
@@ -74,22 +100,53 @@ class SalesOutOfProvinceLogic extends GetxController {
Future<void> getOutProvinceCarcassesBuyer() async {
await safeCall(
call: () => rootLogic.chickenRepository.getOutProvinceCarcassesBuyer(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams(
pageSize: 10,
page: 1,
state: 'buyer-list',
search: 'filter',
role: 'Steward',
value: searchedValue.value ?? '',
),
),
call: () =>
rootLogic.chickenRepository.getOutProvinceCarcassesBuyer(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams(
pageSize: 10,
page: 1,
state: 'buyer-list',
search: 'filter',
role: 'Steward',
value: searchedValue.value ?? '',
),
),
onSuccess: (res) {
if ((res?.count ?? 0) == 0) {
buyerList.value = Resource<List<OutProvinceCarcassesBuyer>>.empty();
} else {
buyerList.value = Resource<List<OutProvinceCarcassesBuyer>>.success(res!.results!);
buyerList.value = Resource<List<OutProvinceCarcassesBuyer>>.success(
res!.results!,
);
}
},
);
}
Future<void> getOutProvinceSales() async {
await safeCall(
call: () =>
rootLogic.chickenRepository.getStewardFreeSaleBar(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams(
pageSize: 10,
page: 1,
state: 'buyer-list',
search: 'filter',
role: 'Steward',
value: searchedValue.value ?? '',
fromDate: fromDateFilter.value.toDateTime(),
toDate: toDateFilter.value.toDateTime(),
),
),
onSuccess: (res) {
if ((res?.count ?? 0) == 0) {
salesList.value = Resource<List<StewardFreeSaleBar>>.empty();
} else {
salesList.value = Resource<List<StewardFreeSaleBar>>.success(
res!.results!,
);
}
},
);
@@ -97,7 +154,10 @@ class SalesOutOfProvinceLogic extends GetxController {
Future<void> getCites() async {
await safeCall(
call: () => rootLogic.chickenRepository.getCity(provinceName: selectedProvince.value?.name ?? ''),
call: () =>
rootLogic.chickenRepository.getCity(
provinceName: selectedProvince.value?.name ?? '',
),
onSuccess: (result) {
if (result != null && result.isNotEmpty) {
cites.value = result;
@@ -107,25 +167,44 @@ class SalesOutOfProvinceLogic extends GetxController {
}
void setupListeners() {
buyerNameController.addListener(checkFormValid);
buyerLastNameController.addListener(checkFormValid);
buyerPhoneController.addListener(checkFormValid);
buyerUnitNameController.addListener(checkFormValid);
//buyer form listeners
buyerNameController.addListener(checkBuyerFormValid);
buyerLastNameController.addListener(checkBuyerFormValid);
buyerPhoneController.addListener(checkBuyerFormValid);
buyerUnitNameController.addListener(checkBuyerFormValid);
ever(selectedProvince, (_) => checkFormValid());
ever(selectedCity, (_) => checkFormValid());
ever(selectedProduct, (_) => checkFormValid());
ever(selectedProvince, (_) => checkBuyerFormValid());
ever(selectedCity, (_) => checkBuyerFormValid());
ever(selectedProduct, (_) => checkBuyerFormValid());
//sales form listeners
saleWeightController.addListener(checkSalesFormValid);
quarantineCodeController.addListener(checkSalesFormValid);
ever(selectedBuyer, (_) => checkSalesFormValid);
ever(selectedProduct, (_) => checkSalesFormValid);
ever(saleDate, (_) => checkSalesFormValid());
}
void checkFormValid() {
isSubmitButtonEnabled.value =
void checkBuyerFormValid() {
isBuyerSubmitButtonEnabled.value =
buyerNameController.text.isNotEmpty &&
buyerLastNameController.text.isNotEmpty &&
buyerPhoneController.text.isNotEmpty &&
buyerUnitNameController.text.isNotEmpty &&
selectedProvince.value != null &&
selectedCity.value != null &&
selectedProduct.value != null;
buyerLastNameController.text.isNotEmpty &&
buyerPhoneController.text.isNotEmpty &&
buyerUnitNameController.text.isNotEmpty &&
selectedProvince.value != null &&
selectedCity.value != null &&
selectedProduct.value != null;
}
void checkSalesFormValid() {
isSaleSubmitButtonEnabled.value =
saleDate.value
.toString()
.isNotEmpty &&
selectedProduct.value != null &&
selectedBuyer.value != null &&
saleWeightController.text.isNotEmpty &&
quarantineCodeController.text.isNotEmpty;
}
Future<bool> createBuyer() async {
@@ -144,7 +223,8 @@ class SalesOutOfProvinceLogic extends GetxController {
mobile: buyerPhoneController.text,
role: 'Steward',
);
final res = await rootLogic.chickenRepository.createOutProvinceCarcassesBuyer(
final res = await rootLogic.chickenRepository
.createOutProvinceCarcassesBuyer(
token: rootLogic.tokenService.accessToken.value!,
body: buyer,
);
@@ -166,26 +246,101 @@ class SalesOutOfProvinceLogic extends GetxController {
selectedProvince.value = null;
selectedCity.value = null;
selectedProduct.value = null;
isSubmitButtonEnabled.value = false;
key = null;
isBuyerSubmitButtonEnabled.value = false;
}
void setEditData(OutProvinceCarcassesBuyer item) {
void setEditDataBuyer(OutProvinceCarcassesBuyer item) {
buyerNameController.text = item.firstName ?? '';
buyerLastNameController.text = item.lastName ?? '';
buyerUnitNameController.text = item.unitName ?? '';
buyerPhoneController.text = item.mobile ?? '';
selectedProvince.value = IranProvinceCityModel(name: item.province);
selectedCity.value = IranProvinceCityModel(name: item.city);
isSubmitButtonEnabled.value = true;
isBuyerSubmitButtonEnabled.value = true;
}
void setEditDataSales(StewardFreeSaleBar item) {
quarantineCodeController.text = item.clearanceCode ?? '';
saleWeightController.text =
item.weightOfCarcasses?.toInt().toString() ?? '';
saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!));
selectedCity.value = IranProvinceCityModel(name: item.city);
selectedBuyer.value = buyerList.value.data?.firstWhere(
(element) => element.key == item.buyer?.key,
);
selectedProduct.value =
outOfTheProvinceLogic.rolesProductsModel.value.first;
key = item.key;
isSaleSubmitButtonEnabled.value = true;
}
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
await safeCall(
call: () => rootLogic.chickenRepository.deleteStewardPurchasesOutSideOfTheProvince(
token: rootLogic.tokenService.accessToken.value!,
stewardFreeBarKey: key,
),
call: () =>
rootLogic.chickenRepository
.deleteStewardPurchasesOutSideOfTheProvince(
token: rootLogic.tokenService.accessToken.value!,
stewardFreeBarKey: key,
),
);
}
Future<bool> createSale() async {
bool res = false;
StewardFreeSaleBarRequest requestBody = StewardFreeSaleBarRequest(
buyerKey: selectedBuyer.value?.key,
numberOfCarcasses: 0,
weightOfCarcasses: int.tryParse(saleWeightController.text.clearComma),
date: saleDate.value
.toDateTime()
.formattedDashedGregorian,
clearanceCode: quarantineCodeController.text,
productKey: selectedProduct.value?.key,
);
await safeCall(
call: () =>
rootLogic.chickenRepository.createOutProvinceStewardFreeBar(
token: rootLogic.tokenService.accessToken.value!,
body: requestBody,
),
onSuccess: (_) {
res = true;
},
);
return res;
}
void clearSaleForm() {
quarantineCodeController.clear();
saleWeightController.clear();
saleDate.value = Jalali.now();
selectedBuyer.value = null;
selectedProduct.value = null;
isBuyerSubmitButtonEnabled.value = false;
}
Future<bool> editSale() async {
bool res = false;
StewardFreeSaleBarRequest requestBody = StewardFreeSaleBarRequest(
numberOfCarcasses: 0,
weightOfCarcasses: int.tryParse(saleWeightController.text.clearComma),
date: saleDate.value
.toDateTime()
.formattedDashedGregorian,
clearanceCode: quarantineCodeController.text,
key:key
);
await safeCall(
call: () =>
rootLogic.chickenRepository.updateOutProvinceStewardFreeBar(
token: rootLogic.tokenService.accessToken.value!,
body: requestBody,
),
onSuccess: (_) {
res = true;
},
);
return res;
}
}

View File

@@ -6,7 +6,7 @@ import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/logic.
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/widgets/search_widget.dart';
import 'package:rasadyar_core/core.dart';
import 'empty_widget.dart';
import '../widgets/empty_widget.dart';
class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
const BuyersPage({super.key});
@@ -181,7 +181,7 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
children: [
GestureDetector(
onTap: () {
controller.setEditData(item);
controller.setEditDataBuyer(item);
Get.bottomSheet(
addOrEditBuyerBottomSheet(true),
isScrollControlled: true,
@@ -368,7 +368,7 @@ class BuyersPage extends GetView<SalesOutOfProvinceLogic> {
: null,
height: 40,
);
}, controller.isSubmitButtonEnabled);
}, controller.isBuyerSubmitButtonEnabled);
}
Widget _provinceWidget() {

View File

@@ -0,0 +1,596 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.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/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/presentation/pages/sales_out_of_province/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/widgets/empty_widget.dart';
import 'package:rasadyar_core/core.dart';
import '../widgets/search_widget.dart';
class SalesPage extends GetView<SalesOutOfProvinceLogic> {
const SalesPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
searchWidget(controller.searchIsSelected, (data) {
controller.searchedValue.value = data;
//TODO: Implement search functionality
controller.getOutProvinceSales();
}),
salesListWidget(),
],
),
floatingActionButton: RFab.add(
onPressed: () {
Get.bottomSheet(addOrEditSaleBottomSheet(), isScrollControlled: true);
},
),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
);
}
Widget salesListWidget() {
return ObxValue((data) {
switch (data.value.status) {
case Status.initial:
case Status.loading:
return Center(child: CupertinoActivityIndicator());
case Status.success:
return ListView.separated(
shrinkWrap: true,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.fromLTRB(8, 8, 18, 80),
itemBuilder: (context, index) {
return ObxValue(
(expandList) => salesListItem(
expandList: expandList,
index: index,
item: data.value.data![index],
),
controller.isExpandedList,
);
},
separatorBuilder: (context, index) => SizedBox(height: 8),
itemCount: data.value.data?.length ?? 0,
);
case Status.error:
return Center(
child: Text(
data.value.message ?? 'خطا در دریافت اطلاعات',
style: AppFonts.yekan16.copyWith(color: AppColor.error),
),
);
case Status.empty:
return emptyWidget();
}
}, controller.salesList);
}
GestureDetector salesListItem({
required RxList<int> expandList,
required int index,
required StewardFreeSaleBar item,
}) {
return GestureDetector(
onTap: () {
if (expandList.contains(index)) {
controller.isExpandedList.remove(index);
} else {
controller.isExpandedList.add(index);
}
},
child: AnimatedSize(
duration: Duration(milliseconds: 400),
alignment: Alignment.center,
child: Stack(
clipBehavior: Clip.none,
alignment: Alignment.centerRight,
children: [
AnimatedSize(
duration: Duration(milliseconds: 300),
child: Container(
width: Get.width - 30,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(8),
border: Border.all(
width: 0.5,
color: AppColor.darkGreyNormal,
),
),
child: AnimatedCrossFade(
alignment: Alignment.center,
firstChild: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(width: 12),
Expanded(
flex: 3,
child: Text(
item.date?.formattedJalaliDate ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(
color: AppColor.bgDark,
),
),
),
SizedBox(width: 4),
Expanded(
flex: 5,
child: Column(
children: [
Text(
item.buyer?.fullname ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
SizedBox(height: 2),
Text(
item.buyer?.mobile ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
),
),
],
),
),
SizedBox(width: 4),
Expanded(
flex: 4,
child: Column(
spacing: 8,
children: [
Text(
item.buyer?.unitName ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(
color: AppColor.bgDark,
),
),
Text(
'${item.weightOfCarcasses?.separatedByComma ?? 0}KG',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(
color: AppColor.bgDark,
),
),
],
),
),
Expanded(
flex: 2,
child: Text(
'${item.buyer?.province}\n${item.buyer?.city}',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(
color: AppColor.bgDark,
),
),
),
SizedBox(width: 8),
Icon(CupertinoIcons.chevron_down, size: 12),
SizedBox(width: 8),
],
),
),
secondChild: Container(
padding: EdgeInsets.fromLTRB(8, 12, 14, 12),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
controller.setEditDataSales(item);
Get.bottomSheet(
addOrEditSaleBottomSheet(true),
isScrollControlled: true,
).whenComplete(() {
controller.resetSubmitForm();
});
},
child: Assets.vec.editSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(
AppColor.blueNormal,
BlendMode.srcIn,
),
),
),
Text(
'${item.province}-${item.city}',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(
color: AppColor.greenDark,
),
),
GestureDetector(
onTap: () {
buildDeleteDialog(
onConfirm: () => controller
.deleteStewardPurchaseOutOfProvince(
item.key!,
),
);
},
child: Assets.vec.trashSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(
AppColor.error,
BlendMode.srcIn,
),
),
),
],
),
Container(
height: 32,
padding: EdgeInsets.symmetric(horizontal: 4),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(
width: 1,
color: AppColor.blueLightHover,
),
borderRadius: BorderRadius.circular(8),
),
),
child: buildRow(
'تاریخ',
item.date?.formattedJalaliDateYHMS ?? 'N/A',
),
),
buildRow(
'مشخصات خریدار',
item.buyer?.fullname ?? 'N/A',
),
buildRow('تلفن خریدار', item.buyer?.mobile ?? 'N/A'),
buildRow('نام واحد', item.buyer?.unitName ?? 'N/A'),
buildRow(
'وزن لاشه',
'${item.weightOfCarcasses?.separatedByComma}',
),
],
),
),
crossFadeState: expandList.contains(index)
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: Duration(milliseconds: 300),
),
),
),
Positioned(
right: -12,
child: Container(
width: index < 999 ? 24 : null,
height: index < 999 ? 24 : null,
padding: EdgeInsets.all(2),
decoration: BoxDecoration(
color: AppColor.greenLightHover,
borderRadius: BorderRadius.circular(4),
border: Border.all(
width: 0.50,
color: AppColor.greenDarkActive,
),
),
alignment: Alignment.center,
child: Text(
(index + 1).toString(),
style: AppFonts.yekan12.copyWith(color: Colors.black),
),
),
),
],
),
),
);
}
Widget buildRow(String title, String value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
flex: 2,
child: Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
Flexible(
flex: 2,
child: Text(
value,
textAlign: TextAlign.left,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
],
),
);
}
Widget addOrEditSaleBottomSheet([bool isOnEdit = false]) {
return BaseBottomSheet(
height: 600,
child: SingleChildScrollView(
child: Form(
key: controller.formKey,
child: Column(
spacing: 16,
children: [
Text(
isOnEdit ? 'ویرایش فروش' : 'افزودن فروش',
style: AppFonts.yekan16Bold.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
_productWidget(),
_buyerWidget(),
RTextField(
controller: controller.saleWeightController,
label: 'وزن لاشه',
keyboardType: TextInputType.number,
borderColor: AppColor.darkGreyLight,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
SeparatorInputFormatter(),
],
validator: (value) {
if (value == null) {
return 'لطفاً وزن لاشه را وارد کنید';
}
return null;
},
),
RTextField(
controller: controller.quarantineCodeController,
label: 'کد قرنطینه',
borderColor: AppColor.darkGreyLight,
validator: (value) {
if (value == null) {
return 'لطفاً کد قرنطینه را وارد کنید';
}
return null;
},
),
Row(
spacing: 8,
children: [
Expanded(
child: timeFilterWidget(
date: controller.saleDate,
onChanged: (jalali) => controller.saleDate.value = jalali,
),
),
],
),
submitButtonWidget(isOnEdit),
SizedBox(),
],
),
),
),
);
}
Widget submitButtonWidget(bool isOnEdit) {
return ObxValue((data) {
return RElevated(
text: isOnEdit ? 'ویرایش' : 'ثبت',
onPressed: data.value
? () async {
var res = isOnEdit
? await controller.editSale()
: await controller.createSale();
if (res) {
controller.getOutProvinceSales();
controller.clearSaleForm();
Get.back();
}
}
: null,
height: 40,
);
}, controller.isSaleSubmitButtonEnabled);
}
Widget _buyerWidget() {
return Obx(() {
return OverlayDropdownWidget<OutProvinceCarcassesBuyer>(
items: controller.buyerList.value.data ?? [],
onChanged: (value) {
controller.selectedBuyer.value = value;
},
selectedItem: controller.selectedBuyer.value,
itemBuilder: (item) => Text(item.buyer?.fullname ?? 'بدون نام'),
labelBuilder: (item) => Text(item?.buyer?.fullname ?? 'انتخاب خریدار'),
);
});
}
Widget _productWidget() {
return ObxValue((data) {
return OverlayDropdownWidget<ProductModel>(
items: controller.outOfTheProvinceLogic.rolesProductsModel,
onChanged: (value) {
controller.selectedProduct.value = value;
},
selectedItem: controller.selectedProduct.value,
initialValue: controller.selectedProduct.value,
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
labelBuilder: (item) => Text(item?.name ?? 'انتخاب محصول'),
);
}, controller.selectedProduct);
}
GestureDetector timeFilterWidget({
isFrom = true,
required Rx<Jalali> date,
required Function(Jalali jalali) onChanged,
}) {
return GestureDetector(
onTap: () {
Get.bottomSheet(modalDatePicker((value) => onChanged(value)));
},
child: Container(
height: 35,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.bgDark),
),
padding: EdgeInsets.symmetric(horizontal: 11, vertical: 4),
child: Row(
spacing: 8,
children: [
Assets.vec.calendarSvg.svg(
width: 24,
height: 24,
colorFilter: const ColorFilter.mode(
AppColor.bgDark,
BlendMode.srcIn,
),
),
Text(
'تاریخ',
style: AppFonts.yekan16.copyWith(color: AppColor.bgDark),
),
Expanded(
child: ObxValue((data) {
return Text(
date.value.formatCompactDate(),
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(
color: AppColor.darkGreyDark,
),
);
}, date),
),
],
),
),
);
}
Container modalDatePicker(ValueChanged<Jalali> onDateSelected) {
Jalali? tempPickedDate;
return Container(
height: 250,
color: Colors.white,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
child: Row(
children: [
SizedBox(width: 20),
RElevated(
height: 35,
width: 70,
textStyle: AppFonts.yekan14.copyWith(color: Colors.white),
onPressed: () {
onDateSelected(tempPickedDate ?? Jalali.now());
Get.back();
},
text: 'تایید',
),
Spacer(),
RElevated(
height: 35,
width: 70,
backgroundColor: AppColor.error,
textStyle: AppFonts.yekan14.copyWith(color: Colors.white),
onPressed: () {
onDateSelected(tempPickedDate ?? Jalali.now());
Get.back();
},
text: 'لغو',
),
SizedBox(width: 20),
],
),
),
Divider(height: 0, thickness: 1),
Expanded(
child: Container(
child: PersianCupertinoDatePicker(
initialDateTime: controller.saleDate.value,
mode: PersianCupertinoDatePickerMode.date,
onDateTimeChanged: (dateTime) {
tempPickedDate = dateTime;
},
),
),
),
],
),
);
}
Future<void> buildDeleteDialog({
required Future<void> Function() onConfirm,
}) async {
await Get.defaultDialog(
title: 'حذف',
middleText: 'آیا از حذف این مورد مطمئن هستید؟',
confirm: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: AppColor.error,
foregroundColor: Colors.white,
),
onPressed: () async {
await onConfirm();
Get.back();
},
child: Text('بله'),
),
cancel: ElevatedButton(
onPressed: () {
Get.back();
},
child: Text('خیر'),
),
).whenComplete(() => controller.getOutProvinceSales());
}
}

View File

@@ -5,7 +5,8 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/widgets/buyers_page.dart';
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/pages/buyers_page.dart';
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/pages/sales_page.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -56,7 +57,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
visible: controller.currentIndex.value==0,
child: GestureDetector(
onTap: () {
// Get.bottomSheet(filterBottomSheet());
Get.bottomSheet(filterBottomSheet());
},
child: Assets.vec.filterOutlineSvg.svg(
width: 20,
@@ -98,7 +99,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
Expanded(
child: TabBarView(
children: [
salePage(),
SalesPage(),
BuyersPage()
],
),
@@ -668,6 +669,8 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
).whenComplete(() => controller.getStewardPurchaseOutOfProvince());
}
*/
Widget filterBottomSheet() {
return BaseBottomSheet(
height: 250,
@@ -697,7 +700,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
RElevated(
text: 'اعمال فیلتر',
onPressed: () {
controller.getStewardPurchaseOutOfProvince();
controller.getOutProvinceSales();
Get.back();
},
height: 40,
@@ -706,7 +709,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
],
),
);
}*/
}
GestureDetector timeFilterWidget({
isFrom = true,

View File

@@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
Widget emptyWidget() {
return Center(
child: Text('داده ای دریافت نشد!', style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkHover)),
return Expanded(
child: Center(
child: Text('داده ای دریافت نشد!', style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkHover)),
),
);
}

View File

@@ -28,7 +28,7 @@ class ApiHandler {
}
typedef AppAsyncCallback<T> = Future<T> Function();
typedef ErrorCallback = void Function(dynamic error, StackTrace? stackTrace);
typedef ErrorCallback = Function(dynamic error, StackTrace? stackTrace);
typedef VoidCallback = void Function();
/// this is global safe call function

View File

@@ -1,7 +1,7 @@
import 'package:intl/intl.dart';
extension XString on String {
get separatedByComma {
String get separatedByComma {
final formatter = NumberFormat('#,###');
return formatter.format(this);
}