refactor : rename files and update routes for poultry actions

feat : poultry kill registration and poultry OrderList

** Made With Nima **
This commit is contained in:
2025-09-16 15:47:35 +03:30
parent 87a0955697
commit e933d22f8f
81 changed files with 22780 additions and 192 deletions

View File

@@ -152,8 +152,7 @@ Map<String, String?> getFaUserRoleWithOnTap(String? role) {
case "Steward":
return {"مباشر": ChickenRoutes.initSteward};
case "PoultryScience":
return {"کارشناس طیور": ChickenRoutes.initPoultryScience
};
return {"کارشناس طیور": ChickenRoutes.initPoultryScience};
default:
return {"نامشخص": null};
}

View File

@@ -44,10 +44,7 @@ class ChickenLocalDataSourceImp implements ChickenLocalDataSource {
path: ChickenRoutes.buysInProvinceSteward,
),
];
await local.add(
boxName: boxName,
value: WidelyUsedLocalModel(hasInit: true, items: tmpList),
);
}
@override

View File

@@ -1,7 +1,16 @@
import 'package:rasadyar_chicken/data/models/poultry_export/poultry_export.dart';
import 'package:rasadyar_chicken/data/models/request/kill_registration/kill_registration.dart';
import 'package:rasadyar_chicken/data/models/response/all_poultry/all_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/approved_price/approved_price.dart';
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
import 'package:rasadyar_chicken/data/models/response/hatching_report/hatching_report.dart';
import 'package:rasadyar_chicken/data/models/response/poultry/poultry_farm.dart';
import 'package:rasadyar_chicken/data/models/response/kill_house_poultry/kill_house_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/kill_request_poultry/kill_request_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_hatching/poultry_hatching.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_science/home_poultry_science/home_poultry_science_model.dart';
import 'package:rasadyar_chicken/data/models/response/sell_for_freezing/sell_for_freezing.dart';
import 'package:rasadyar_core/core.dart';
abstract class PoultryScienceRemoteDatasource {
@@ -30,4 +39,51 @@ abstract class PoultryScienceRemoteDatasource {
required String token,
Map<String, dynamic>? queryParameters,
});
Future<ApprovedPrice?> getApprovedPrice({ required String token,
Map<String, dynamic>? queryParameters,});
Future<List<AllPoultry>?> getAllPoultry({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<SellForFreezing?> getSellForFreezing({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<PoultryExport?> getPoultryExport({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<List<KillRequestPoultry>?> getUserPoultry({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<List<PoultryHatching>?> getPoultryHatching({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<List<KillHousePoultry>?> getKillHouseList({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> submitKillRegistration({
required String token,
required KillRegistrationRequest request,
});
Future<PaginationModel<PoultryOrder>?> getPoultryOderList({
required String token,
Map<String, dynamic>? queryParameters,
});
}

View File

@@ -1,7 +1,16 @@
import 'package:rasadyar_chicken/data/models/poultry_export/poultry_export.dart';
import 'package:rasadyar_chicken/data/models/request/kill_registration/kill_registration.dart';
import 'package:rasadyar_chicken/data/models/response/all_poultry/all_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/approved_price/approved_price.dart';
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
import 'package:rasadyar_chicken/data/models/response/hatching_report/hatching_report.dart';
import 'package:rasadyar_chicken/data/models/response/poultry/poultry_farm.dart';
import 'package:rasadyar_chicken/data/models/response/kill_house_poultry/kill_house_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/kill_request_poultry/kill_request_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_hatching/poultry_hatching.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_science/home_poultry_science/home_poultry_science_model.dart';
import 'package:rasadyar_chicken/data/models/response/sell_for_freezing/sell_for_freezing.dart';
import 'package:rasadyar_core/core.dart';
import 'poultry_science_remote.dart';
@@ -78,7 +87,7 @@ class PoultryScienceRemoteDatasourceImp implements PoultryScienceRemoteDatasourc
Future<PaginationModel<PoultryFarm>?> getPoultryScienceFarmList({
required String token,
Map<String, dynamic>? queryParameters,
}) async{
}) async {
var res = await _httpClient.get(
'/poultry_and_hatching_for_poultry_science/',
headers: {'Authorization': 'Bearer $token'},
@@ -90,4 +99,138 @@ class PoultryScienceRemoteDatasourceImp implements PoultryScienceRemoteDatasourc
);
return res.data;
}
//region kill Registration
@override
Future<ApprovedPrice?> getApprovedPrice({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/approved-price/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters,
fromJson: (json) => ApprovedPrice.fromJson(json),
);
return res.data;
}
@override
Future<List<AllPoultry>?> getAllPoultry({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/get-all-poultry/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters,
fromJsonList: (json) =>
json.map((e) => AllPoultry.fromJson(e as Map<String, dynamic>)).toList(),
);
return res.data;
}
@override
Future<PoultryExport?> getPoultryExport({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/poultry-export/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters,
fromJson: (json) => PoultryExport.fromJson(json),
);
return res.data;
}
@override
Future<SellForFreezing?> getSellForFreezing({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/sell-for-freezing/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters,
fromJson: (json) => SellForFreezing.fromJson(json),
);
return res.data;
}
@override
Future<List<KillRequestPoultry>?> getUserPoultry({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/Poultry/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters,
fromJsonList: (json) => json.map((e) => KillRequestPoultry.fromJson(e)).toList(),
);
return res.data;
}
@override
Future<List<PoultryHatching>?> getPoultryHatching({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/poultry_hatching/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters,
fromJsonList: (json) => json.map((e) => PoultryHatching.fromJson(e)).toList(),
);
return res.data;
}
@override
Future<List<KillHousePoultry>?> getKillHouseList({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/kill_house_list/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters,
fromJsonList: (json) => json.map((e) => KillHousePoultry.fromJson(e)).toList(),
);
return res.data;
}
@override
Future<void> submitKillRegistration({
required String token,
required KillRegistrationRequest request,
}) async {
await _httpClient.post(
'/Poultry_Request/',
headers: {'Authorization': 'Bearer $token'},
data: request.toJson(),
);
}
@override
Future<PaginationModel<PoultryOrder>?> getPoultryOderList({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/Poultry_Request/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters,
fromJson: (json) => PaginationModel<PoultryOrder>.fromJson(
json,
(data) => PoultryOrder.fromJson(data as Map<String, dynamic>),
),
);
dLog(res.data.runtimeType);
return res.data;
}
//endregion
}

View File

@@ -0,0 +1,17 @@
import 'package:rasadyar_core/core.dart';
part 'poultry_export.freezed.dart';
part 'poultry_export.g.dart';
@freezed
abstract class PoultryExport with _$PoultryExport {
const factory PoultryExport({
String? key,
bool? allow,
bool? limitationStatus,
double? limitation,
}) = _PoultryExport;
factory PoultryExport.fromJson(Map<String, dynamic> json) =>
_$PoultryExportFromJson(json);
}

View File

@@ -0,0 +1,286 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'poultry_export.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$PoultryExport {
String? get key; bool? get allow; bool? get limitationStatus; double? get limitation;
/// Create a copy of PoultryExport
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$PoultryExportCopyWith<PoultryExport> get copyWith => _$PoultryExportCopyWithImpl<PoultryExport>(this as PoultryExport, _$identity);
/// Serializes this PoultryExport to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is PoultryExport&&(identical(other.key, key) || other.key == key)&&(identical(other.allow, allow) || other.allow == allow)&&(identical(other.limitationStatus, limitationStatus) || other.limitationStatus == limitationStatus)&&(identical(other.limitation, limitation) || other.limitation == limitation));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,allow,limitationStatus,limitation);
@override
String toString() {
return 'PoultryExport(key: $key, allow: $allow, limitationStatus: $limitationStatus, limitation: $limitation)';
}
}
/// @nodoc
abstract mixin class $PoultryExportCopyWith<$Res> {
factory $PoultryExportCopyWith(PoultryExport value, $Res Function(PoultryExport) _then) = _$PoultryExportCopyWithImpl;
@useResult
$Res call({
String? key, bool? allow, bool? limitationStatus, double? limitation
});
}
/// @nodoc
class _$PoultryExportCopyWithImpl<$Res>
implements $PoultryExportCopyWith<$Res> {
_$PoultryExportCopyWithImpl(this._self, this._then);
final PoultryExport _self;
final $Res Function(PoultryExport) _then;
/// Create a copy of PoultryExport
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? allow = freezed,Object? limitationStatus = freezed,Object? limitation = freezed,}) {
return _then(_self.copyWith(
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,allow: freezed == allow ? _self.allow : allow // ignore: cast_nullable_to_non_nullable
as bool?,limitationStatus: freezed == limitationStatus ? _self.limitationStatus : limitationStatus // ignore: cast_nullable_to_non_nullable
as bool?,limitation: freezed == limitation ? _self.limitation : limitation // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
/// Adds pattern-matching-related methods to [PoultryExport].
extension PoultryExportPatterns on PoultryExport {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _PoultryExport value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _PoultryExport() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _PoultryExport value) $default,){
final _that = this;
switch (_that) {
case _PoultryExport():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _PoultryExport value)? $default,){
final _that = this;
switch (_that) {
case _PoultryExport() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? key, bool? allow, bool? limitationStatus, double? limitation)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _PoultryExport() when $default != null:
return $default(_that.key,_that.allow,_that.limitationStatus,_that.limitation);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? key, bool? allow, bool? limitationStatus, double? limitation) $default,) {final _that = this;
switch (_that) {
case _PoultryExport():
return $default(_that.key,_that.allow,_that.limitationStatus,_that.limitation);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? key, bool? allow, bool? limitationStatus, double? limitation)? $default,) {final _that = this;
switch (_that) {
case _PoultryExport() when $default != null:
return $default(_that.key,_that.allow,_that.limitationStatus,_that.limitation);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _PoultryExport implements PoultryExport {
const _PoultryExport({this.key, this.allow, this.limitationStatus, this.limitation});
factory _PoultryExport.fromJson(Map<String, dynamic> json) => _$PoultryExportFromJson(json);
@override final String? key;
@override final bool? allow;
@override final bool? limitationStatus;
@override final double? limitation;
/// Create a copy of PoultryExport
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$PoultryExportCopyWith<_PoultryExport> get copyWith => __$PoultryExportCopyWithImpl<_PoultryExport>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$PoultryExportToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PoultryExport&&(identical(other.key, key) || other.key == key)&&(identical(other.allow, allow) || other.allow == allow)&&(identical(other.limitationStatus, limitationStatus) || other.limitationStatus == limitationStatus)&&(identical(other.limitation, limitation) || other.limitation == limitation));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,allow,limitationStatus,limitation);
@override
String toString() {
return 'PoultryExport(key: $key, allow: $allow, limitationStatus: $limitationStatus, limitation: $limitation)';
}
}
/// @nodoc
abstract mixin class _$PoultryExportCopyWith<$Res> implements $PoultryExportCopyWith<$Res> {
factory _$PoultryExportCopyWith(_PoultryExport value, $Res Function(_PoultryExport) _then) = __$PoultryExportCopyWithImpl;
@override @useResult
$Res call({
String? key, bool? allow, bool? limitationStatus, double? limitation
});
}
/// @nodoc
class __$PoultryExportCopyWithImpl<$Res>
implements _$PoultryExportCopyWith<$Res> {
__$PoultryExportCopyWithImpl(this._self, this._then);
final _PoultryExport _self;
final $Res Function(_PoultryExport) _then;
/// Create a copy of PoultryExport
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? allow = freezed,Object? limitationStatus = freezed,Object? limitation = freezed,}) {
return _then(_PoultryExport(
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,allow: freezed == allow ? _self.allow : allow // ignore: cast_nullable_to_non_nullable
as bool?,limitationStatus: freezed == limitationStatus ? _self.limitationStatus : limitationStatus // ignore: cast_nullable_to_non_nullable
as bool?,limitation: freezed == limitation ? _self.limitation : limitation // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
// dart format on

View File

@@ -0,0 +1,23 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'poultry_export.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_PoultryExport _$PoultryExportFromJson(Map<String, dynamic> json) =>
_PoultryExport(
key: json['key'] as String?,
allow: json['allow'] as bool?,
limitationStatus: json['limitation_status'] as bool?,
limitation: (json['limitation'] as num?)?.toDouble(),
);
Map<String, dynamic> _$PoultryExportToJson(_PoultryExport instance) =>
<String, dynamic>{
'key': instance.key,
'allow': instance.allow,
'limitation_status': instance.limitationStatus,
'limitation': instance.limitation,
};

View File

@@ -0,0 +1,35 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'kill_registration.freezed.dart';
part 'kill_registration.g.dart';
@freezed
abstract class KillRegistrationRequest with _$KillRegistrationRequest {
const factory KillRegistrationRequest({
bool? approvedPrice,
bool? market,
String? killReqKey,
String? operatorKey,
String? poultryHatchingKey,
int? quantity,
String? sendDate,
String? chickenBreed,
@JsonKey(name: "Index_weight") double? indexWeight,
String? losses,
List<dynamic>? auctionList,
bool? freezing,
bool? export,
bool? cash,
bool? credit,
List<dynamic>? killHouseList,
String? role,
String? poultryKey,
int? amount,
String? financialOperation,
bool? freeSaleInProvince,
String? confirmPoultryMobile,
}) = _KillRegistrationRequest;
factory KillRegistrationRequest.fromJson(Map<String, dynamic> json) =>
_$KillRegistrationRequestFromJson(json);
}

View File

@@ -0,0 +1,356 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'kill_registration.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$KillRegistrationRequest {
bool? get approvedPrice; bool? get market; String? get killReqKey; String? get operatorKey; String? get poultryHatchingKey; int? get quantity; String? get sendDate; String? get chickenBreed;@JsonKey(name: "Index_weight") double? get indexWeight; String? get losses; List<dynamic>? get auctionList; bool? get freezing; bool? get export; bool? get cash; bool? get credit; List<dynamic>? get killHouseList; String? get role; String? get poultryKey; int? get amount; String? get financialOperation; bool? get freeSaleInProvince; String? get confirmPoultryMobile;
/// Create a copy of KillRegistrationRequest
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$KillRegistrationRequestCopyWith<KillRegistrationRequest> get copyWith => _$KillRegistrationRequestCopyWithImpl<KillRegistrationRequest>(this as KillRegistrationRequest, _$identity);
/// Serializes this KillRegistrationRequest to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is KillRegistrationRequest&&(identical(other.approvedPrice, approvedPrice) || other.approvedPrice == approvedPrice)&&(identical(other.market, market) || other.market == market)&&(identical(other.killReqKey, killReqKey) || other.killReqKey == killReqKey)&&(identical(other.operatorKey, operatorKey) || other.operatorKey == operatorKey)&&(identical(other.poultryHatchingKey, poultryHatchingKey) || other.poultryHatchingKey == poultryHatchingKey)&&(identical(other.quantity, quantity) || other.quantity == quantity)&&(identical(other.sendDate, sendDate) || other.sendDate == sendDate)&&(identical(other.chickenBreed, chickenBreed) || other.chickenBreed == chickenBreed)&&(identical(other.indexWeight, indexWeight) || other.indexWeight == indexWeight)&&(identical(other.losses, losses) || other.losses == losses)&&const DeepCollectionEquality().equals(other.auctionList, auctionList)&&(identical(other.freezing, freezing) || other.freezing == freezing)&&(identical(other.export, export) || other.export == export)&&(identical(other.cash, cash) || other.cash == cash)&&(identical(other.credit, credit) || other.credit == credit)&&const DeepCollectionEquality().equals(other.killHouseList, killHouseList)&&(identical(other.role, role) || other.role == role)&&(identical(other.poultryKey, poultryKey) || other.poultryKey == poultryKey)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.financialOperation, financialOperation) || other.financialOperation == financialOperation)&&(identical(other.freeSaleInProvince, freeSaleInProvince) || other.freeSaleInProvince == freeSaleInProvince)&&(identical(other.confirmPoultryMobile, confirmPoultryMobile) || other.confirmPoultryMobile == confirmPoultryMobile));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([runtimeType,approvedPrice,market,killReqKey,operatorKey,poultryHatchingKey,quantity,sendDate,chickenBreed,indexWeight,losses,const DeepCollectionEquality().hash(auctionList),freezing,export,cash,credit,const DeepCollectionEquality().hash(killHouseList),role,poultryKey,amount,financialOperation,freeSaleInProvince,confirmPoultryMobile]);
@override
String toString() {
return 'KillRegistrationRequest(approvedPrice: $approvedPrice, market: $market, killReqKey: $killReqKey, operatorKey: $operatorKey, poultryHatchingKey: $poultryHatchingKey, quantity: $quantity, sendDate: $sendDate, chickenBreed: $chickenBreed, indexWeight: $indexWeight, losses: $losses, auctionList: $auctionList, freezing: $freezing, export: $export, cash: $cash, credit: $credit, killHouseList: $killHouseList, role: $role, poultryKey: $poultryKey, amount: $amount, financialOperation: $financialOperation, freeSaleInProvince: $freeSaleInProvince, confirmPoultryMobile: $confirmPoultryMobile)';
}
}
/// @nodoc
abstract mixin class $KillRegistrationRequestCopyWith<$Res> {
factory $KillRegistrationRequestCopyWith(KillRegistrationRequest value, $Res Function(KillRegistrationRequest) _then) = _$KillRegistrationRequestCopyWithImpl;
@useResult
$Res call({
bool? approvedPrice, bool? market, String? killReqKey, String? operatorKey, String? poultryHatchingKey, int? quantity, String? sendDate, String? chickenBreed,@JsonKey(name: "Index_weight") double? indexWeight, String? losses, List<dynamic>? auctionList, bool? freezing, bool? export, bool? cash, bool? credit, List<dynamic>? killHouseList, String? role, String? poultryKey, int? amount, String? financialOperation, bool? freeSaleInProvince, String? confirmPoultryMobile
});
}
/// @nodoc
class _$KillRegistrationRequestCopyWithImpl<$Res>
implements $KillRegistrationRequestCopyWith<$Res> {
_$KillRegistrationRequestCopyWithImpl(this._self, this._then);
final KillRegistrationRequest _self;
final $Res Function(KillRegistrationRequest) _then;
/// Create a copy of KillRegistrationRequest
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? approvedPrice = freezed,Object? market = freezed,Object? killReqKey = freezed,Object? operatorKey = freezed,Object? poultryHatchingKey = freezed,Object? quantity = freezed,Object? sendDate = freezed,Object? chickenBreed = freezed,Object? indexWeight = freezed,Object? losses = freezed,Object? auctionList = freezed,Object? freezing = freezed,Object? export = freezed,Object? cash = freezed,Object? credit = freezed,Object? killHouseList = freezed,Object? role = freezed,Object? poultryKey = freezed,Object? amount = freezed,Object? financialOperation = freezed,Object? freeSaleInProvince = freezed,Object? confirmPoultryMobile = freezed,}) {
return _then(_self.copyWith(
approvedPrice: freezed == approvedPrice ? _self.approvedPrice : approvedPrice // ignore: cast_nullable_to_non_nullable
as bool?,market: freezed == market ? _self.market : market // ignore: cast_nullable_to_non_nullable
as bool?,killReqKey: freezed == killReqKey ? _self.killReqKey : killReqKey // ignore: cast_nullable_to_non_nullable
as String?,operatorKey: freezed == operatorKey ? _self.operatorKey : operatorKey // ignore: cast_nullable_to_non_nullable
as String?,poultryHatchingKey: freezed == poultryHatchingKey ? _self.poultryHatchingKey : poultryHatchingKey // ignore: cast_nullable_to_non_nullable
as String?,quantity: freezed == quantity ? _self.quantity : quantity // ignore: cast_nullable_to_non_nullable
as int?,sendDate: freezed == sendDate ? _self.sendDate : sendDate // ignore: cast_nullable_to_non_nullable
as String?,chickenBreed: freezed == chickenBreed ? _self.chickenBreed : chickenBreed // ignore: cast_nullable_to_non_nullable
as String?,indexWeight: freezed == indexWeight ? _self.indexWeight : indexWeight // ignore: cast_nullable_to_non_nullable
as double?,losses: freezed == losses ? _self.losses : losses // ignore: cast_nullable_to_non_nullable
as String?,auctionList: freezed == auctionList ? _self.auctionList : auctionList // ignore: cast_nullable_to_non_nullable
as List<dynamic>?,freezing: freezed == freezing ? _self.freezing : freezing // ignore: cast_nullable_to_non_nullable
as bool?,export: freezed == export ? _self.export : export // ignore: cast_nullable_to_non_nullable
as bool?,cash: freezed == cash ? _self.cash : cash // ignore: cast_nullable_to_non_nullable
as bool?,credit: freezed == credit ? _self.credit : credit // ignore: cast_nullable_to_non_nullable
as bool?,killHouseList: freezed == killHouseList ? _self.killHouseList : killHouseList // ignore: cast_nullable_to_non_nullable
as List<dynamic>?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,poultryKey: freezed == poultryKey ? _self.poultryKey : poultryKey // ignore: cast_nullable_to_non_nullable
as String?,amount: freezed == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable
as int?,financialOperation: freezed == financialOperation ? _self.financialOperation : financialOperation // ignore: cast_nullable_to_non_nullable
as String?,freeSaleInProvince: freezed == freeSaleInProvince ? _self.freeSaleInProvince : freeSaleInProvince // ignore: cast_nullable_to_non_nullable
as bool?,confirmPoultryMobile: freezed == confirmPoultryMobile ? _self.confirmPoultryMobile : confirmPoultryMobile // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [KillRegistrationRequest].
extension KillRegistrationRequestPatterns on KillRegistrationRequest {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _KillRegistrationRequest value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _KillRegistrationRequest() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _KillRegistrationRequest value) $default,){
final _that = this;
switch (_that) {
case _KillRegistrationRequest():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _KillRegistrationRequest value)? $default,){
final _that = this;
switch (_that) {
case _KillRegistrationRequest() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool? approvedPrice, bool? market, String? killReqKey, String? operatorKey, String? poultryHatchingKey, int? quantity, String? sendDate, String? chickenBreed, @JsonKey(name: "Index_weight") double? indexWeight, String? losses, List<dynamic>? auctionList, bool? freezing, bool? export, bool? cash, bool? credit, List<dynamic>? killHouseList, String? role, String? poultryKey, int? amount, String? financialOperation, bool? freeSaleInProvince, String? confirmPoultryMobile)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _KillRegistrationRequest() when $default != null:
return $default(_that.approvedPrice,_that.market,_that.killReqKey,_that.operatorKey,_that.poultryHatchingKey,_that.quantity,_that.sendDate,_that.chickenBreed,_that.indexWeight,_that.losses,_that.auctionList,_that.freezing,_that.export,_that.cash,_that.credit,_that.killHouseList,_that.role,_that.poultryKey,_that.amount,_that.financialOperation,_that.freeSaleInProvince,_that.confirmPoultryMobile);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool? approvedPrice, bool? market, String? killReqKey, String? operatorKey, String? poultryHatchingKey, int? quantity, String? sendDate, String? chickenBreed, @JsonKey(name: "Index_weight") double? indexWeight, String? losses, List<dynamic>? auctionList, bool? freezing, bool? export, bool? cash, bool? credit, List<dynamic>? killHouseList, String? role, String? poultryKey, int? amount, String? financialOperation, bool? freeSaleInProvince, String? confirmPoultryMobile) $default,) {final _that = this;
switch (_that) {
case _KillRegistrationRequest():
return $default(_that.approvedPrice,_that.market,_that.killReqKey,_that.operatorKey,_that.poultryHatchingKey,_that.quantity,_that.sendDate,_that.chickenBreed,_that.indexWeight,_that.losses,_that.auctionList,_that.freezing,_that.export,_that.cash,_that.credit,_that.killHouseList,_that.role,_that.poultryKey,_that.amount,_that.financialOperation,_that.freeSaleInProvince,_that.confirmPoultryMobile);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool? approvedPrice, bool? market, String? killReqKey, String? operatorKey, String? poultryHatchingKey, int? quantity, String? sendDate, String? chickenBreed, @JsonKey(name: "Index_weight") double? indexWeight, String? losses, List<dynamic>? auctionList, bool? freezing, bool? export, bool? cash, bool? credit, List<dynamic>? killHouseList, String? role, String? poultryKey, int? amount, String? financialOperation, bool? freeSaleInProvince, String? confirmPoultryMobile)? $default,) {final _that = this;
switch (_that) {
case _KillRegistrationRequest() when $default != null:
return $default(_that.approvedPrice,_that.market,_that.killReqKey,_that.operatorKey,_that.poultryHatchingKey,_that.quantity,_that.sendDate,_that.chickenBreed,_that.indexWeight,_that.losses,_that.auctionList,_that.freezing,_that.export,_that.cash,_that.credit,_that.killHouseList,_that.role,_that.poultryKey,_that.amount,_that.financialOperation,_that.freeSaleInProvince,_that.confirmPoultryMobile);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _KillRegistrationRequest implements KillRegistrationRequest {
const _KillRegistrationRequest({this.approvedPrice, this.market, this.killReqKey, this.operatorKey, this.poultryHatchingKey, this.quantity, this.sendDate, this.chickenBreed, @JsonKey(name: "Index_weight") this.indexWeight, this.losses, final List<dynamic>? auctionList, this.freezing, this.export, this.cash, this.credit, final List<dynamic>? killHouseList, this.role, this.poultryKey, this.amount, this.financialOperation, this.freeSaleInProvince, this.confirmPoultryMobile}): _auctionList = auctionList,_killHouseList = killHouseList;
factory _KillRegistrationRequest.fromJson(Map<String, dynamic> json) => _$KillRegistrationRequestFromJson(json);
@override final bool? approvedPrice;
@override final bool? market;
@override final String? killReqKey;
@override final String? operatorKey;
@override final String? poultryHatchingKey;
@override final int? quantity;
@override final String? sendDate;
@override final String? chickenBreed;
@override@JsonKey(name: "Index_weight") final double? indexWeight;
@override final String? losses;
final List<dynamic>? _auctionList;
@override List<dynamic>? get auctionList {
final value = _auctionList;
if (value == null) return null;
if (_auctionList is EqualUnmodifiableListView) return _auctionList;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(value);
}
@override final bool? freezing;
@override final bool? export;
@override final bool? cash;
@override final bool? credit;
final List<dynamic>? _killHouseList;
@override List<dynamic>? get killHouseList {
final value = _killHouseList;
if (value == null) return null;
if (_killHouseList is EqualUnmodifiableListView) return _killHouseList;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(value);
}
@override final String? role;
@override final String? poultryKey;
@override final int? amount;
@override final String? financialOperation;
@override final bool? freeSaleInProvince;
@override final String? confirmPoultryMobile;
/// Create a copy of KillRegistrationRequest
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$KillRegistrationRequestCopyWith<_KillRegistrationRequest> get copyWith => __$KillRegistrationRequestCopyWithImpl<_KillRegistrationRequest>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$KillRegistrationRequestToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _KillRegistrationRequest&&(identical(other.approvedPrice, approvedPrice) || other.approvedPrice == approvedPrice)&&(identical(other.market, market) || other.market == market)&&(identical(other.killReqKey, killReqKey) || other.killReqKey == killReqKey)&&(identical(other.operatorKey, operatorKey) || other.operatorKey == operatorKey)&&(identical(other.poultryHatchingKey, poultryHatchingKey) || other.poultryHatchingKey == poultryHatchingKey)&&(identical(other.quantity, quantity) || other.quantity == quantity)&&(identical(other.sendDate, sendDate) || other.sendDate == sendDate)&&(identical(other.chickenBreed, chickenBreed) || other.chickenBreed == chickenBreed)&&(identical(other.indexWeight, indexWeight) || other.indexWeight == indexWeight)&&(identical(other.losses, losses) || other.losses == losses)&&const DeepCollectionEquality().equals(other._auctionList, _auctionList)&&(identical(other.freezing, freezing) || other.freezing == freezing)&&(identical(other.export, export) || other.export == export)&&(identical(other.cash, cash) || other.cash == cash)&&(identical(other.credit, credit) || other.credit == credit)&&const DeepCollectionEquality().equals(other._killHouseList, _killHouseList)&&(identical(other.role, role) || other.role == role)&&(identical(other.poultryKey, poultryKey) || other.poultryKey == poultryKey)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.financialOperation, financialOperation) || other.financialOperation == financialOperation)&&(identical(other.freeSaleInProvince, freeSaleInProvince) || other.freeSaleInProvince == freeSaleInProvince)&&(identical(other.confirmPoultryMobile, confirmPoultryMobile) || other.confirmPoultryMobile == confirmPoultryMobile));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([runtimeType,approvedPrice,market,killReqKey,operatorKey,poultryHatchingKey,quantity,sendDate,chickenBreed,indexWeight,losses,const DeepCollectionEquality().hash(_auctionList),freezing,export,cash,credit,const DeepCollectionEquality().hash(_killHouseList),role,poultryKey,amount,financialOperation,freeSaleInProvince,confirmPoultryMobile]);
@override
String toString() {
return 'KillRegistrationRequest(approvedPrice: $approvedPrice, market: $market, killReqKey: $killReqKey, operatorKey: $operatorKey, poultryHatchingKey: $poultryHatchingKey, quantity: $quantity, sendDate: $sendDate, chickenBreed: $chickenBreed, indexWeight: $indexWeight, losses: $losses, auctionList: $auctionList, freezing: $freezing, export: $export, cash: $cash, credit: $credit, killHouseList: $killHouseList, role: $role, poultryKey: $poultryKey, amount: $amount, financialOperation: $financialOperation, freeSaleInProvince: $freeSaleInProvince, confirmPoultryMobile: $confirmPoultryMobile)';
}
}
/// @nodoc
abstract mixin class _$KillRegistrationRequestCopyWith<$Res> implements $KillRegistrationRequestCopyWith<$Res> {
factory _$KillRegistrationRequestCopyWith(_KillRegistrationRequest value, $Res Function(_KillRegistrationRequest) _then) = __$KillRegistrationRequestCopyWithImpl;
@override @useResult
$Res call({
bool? approvedPrice, bool? market, String? killReqKey, String? operatorKey, String? poultryHatchingKey, int? quantity, String? sendDate, String? chickenBreed,@JsonKey(name: "Index_weight") double? indexWeight, String? losses, List<dynamic>? auctionList, bool? freezing, bool? export, bool? cash, bool? credit, List<dynamic>? killHouseList, String? role, String? poultryKey, int? amount, String? financialOperation, bool? freeSaleInProvince, String? confirmPoultryMobile
});
}
/// @nodoc
class __$KillRegistrationRequestCopyWithImpl<$Res>
implements _$KillRegistrationRequestCopyWith<$Res> {
__$KillRegistrationRequestCopyWithImpl(this._self, this._then);
final _KillRegistrationRequest _self;
final $Res Function(_KillRegistrationRequest) _then;
/// Create a copy of KillRegistrationRequest
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? approvedPrice = freezed,Object? market = freezed,Object? killReqKey = freezed,Object? operatorKey = freezed,Object? poultryHatchingKey = freezed,Object? quantity = freezed,Object? sendDate = freezed,Object? chickenBreed = freezed,Object? indexWeight = freezed,Object? losses = freezed,Object? auctionList = freezed,Object? freezing = freezed,Object? export = freezed,Object? cash = freezed,Object? credit = freezed,Object? killHouseList = freezed,Object? role = freezed,Object? poultryKey = freezed,Object? amount = freezed,Object? financialOperation = freezed,Object? freeSaleInProvince = freezed,Object? confirmPoultryMobile = freezed,}) {
return _then(_KillRegistrationRequest(
approvedPrice: freezed == approvedPrice ? _self.approvedPrice : approvedPrice // ignore: cast_nullable_to_non_nullable
as bool?,market: freezed == market ? _self.market : market // ignore: cast_nullable_to_non_nullable
as bool?,killReqKey: freezed == killReqKey ? _self.killReqKey : killReqKey // ignore: cast_nullable_to_non_nullable
as String?,operatorKey: freezed == operatorKey ? _self.operatorKey : operatorKey // ignore: cast_nullable_to_non_nullable
as String?,poultryHatchingKey: freezed == poultryHatchingKey ? _self.poultryHatchingKey : poultryHatchingKey // ignore: cast_nullable_to_non_nullable
as String?,quantity: freezed == quantity ? _self.quantity : quantity // ignore: cast_nullable_to_non_nullable
as int?,sendDate: freezed == sendDate ? _self.sendDate : sendDate // ignore: cast_nullable_to_non_nullable
as String?,chickenBreed: freezed == chickenBreed ? _self.chickenBreed : chickenBreed // ignore: cast_nullable_to_non_nullable
as String?,indexWeight: freezed == indexWeight ? _self.indexWeight : indexWeight // ignore: cast_nullable_to_non_nullable
as double?,losses: freezed == losses ? _self.losses : losses // ignore: cast_nullable_to_non_nullable
as String?,auctionList: freezed == auctionList ? _self._auctionList : auctionList // ignore: cast_nullable_to_non_nullable
as List<dynamic>?,freezing: freezed == freezing ? _self.freezing : freezing // ignore: cast_nullable_to_non_nullable
as bool?,export: freezed == export ? _self.export : export // ignore: cast_nullable_to_non_nullable
as bool?,cash: freezed == cash ? _self.cash : cash // ignore: cast_nullable_to_non_nullable
as bool?,credit: freezed == credit ? _self.credit : credit // ignore: cast_nullable_to_non_nullable
as bool?,killHouseList: freezed == killHouseList ? _self._killHouseList : killHouseList // ignore: cast_nullable_to_non_nullable
as List<dynamic>?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,poultryKey: freezed == poultryKey ? _self.poultryKey : poultryKey // ignore: cast_nullable_to_non_nullable
as String?,amount: freezed == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable
as int?,financialOperation: freezed == financialOperation ? _self.financialOperation : financialOperation // ignore: cast_nullable_to_non_nullable
as String?,freeSaleInProvince: freezed == freeSaleInProvince ? _self.freeSaleInProvince : freeSaleInProvince // ignore: cast_nullable_to_non_nullable
as bool?,confirmPoultryMobile: freezed == confirmPoultryMobile ? _self.confirmPoultryMobile : confirmPoultryMobile // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,61 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'kill_registration.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_KillRegistrationRequest _$KillRegistrationRequestFromJson(
Map<String, dynamic> json,
) => _KillRegistrationRequest(
approvedPrice: json['approved_price'] as bool?,
market: json['market'] as bool?,
killReqKey: json['kill_req_key'] as String?,
operatorKey: json['operator_key'] as String?,
poultryHatchingKey: json['poultry_hatching_key'] as String?,
quantity: (json['quantity'] as num?)?.toInt(),
sendDate: json['send_date'] as String?,
chickenBreed: json['chicken_breed'] as String?,
indexWeight: (json['Index_weight'] as num?)?.toDouble(),
losses: json['losses'] as String?,
auctionList: json['auction_list'] as List<dynamic>?,
freezing: json['freezing'] as bool?,
export: json['export'] as bool?,
cash: json['cash'] as bool?,
credit: json['credit'] as bool?,
killHouseList: json['kill_house_list'] as List<dynamic>?,
role: json['role'] as String?,
poultryKey: json['poultry_key'] as String?,
amount: (json['amount'] as num?)?.toInt(),
financialOperation: json['financial_operation'] as String?,
freeSaleInProvince: json['free_sale_in_province'] as bool?,
confirmPoultryMobile: json['confirm_poultry_mobile'] as String?,
);
Map<String, dynamic> _$KillRegistrationRequestToJson(
_KillRegistrationRequest instance,
) => <String, dynamic>{
'approved_price': instance.approvedPrice,
'market': instance.market,
'kill_req_key': instance.killReqKey,
'operator_key': instance.operatorKey,
'poultry_hatching_key': instance.poultryHatchingKey,
'quantity': instance.quantity,
'send_date': instance.sendDate,
'chicken_breed': instance.chickenBreed,
'Index_weight': instance.indexWeight,
'losses': instance.losses,
'auction_list': instance.auctionList,
'freezing': instance.freezing,
'export': instance.export,
'cash': instance.cash,
'credit': instance.credit,
'kill_house_list': instance.killHouseList,
'role': instance.role,
'poultry_key': instance.poultryKey,
'amount': instance.amount,
'financial_operation': instance.financialOperation,
'free_sale_in_province': instance.freeSaleInProvince,
'confirm_poultry_mobile': instance.confirmPoultryMobile,
};

View File

@@ -0,0 +1,60 @@
import 'package:rasadyar_core/core.dart';
part 'all_poultry.freezed.dart';
part 'all_poultry.g.dart';
@freezed
abstract class AllPoultry with _$AllPoultry {
const factory AllPoultry({
User? user,
String? key,
String? unitName,
Address? address,
int? lastHatchingRemainQuantity,
bool? provinceAllowSellFree,
ChainCompany? chainCompany,
}) = _AllPoultry;
factory AllPoultry.fromJson(Map<String, dynamic> json) =>
_$AllPoultryFromJson(json);
}
@freezed
abstract class User with _$User {
const factory User({
String? fullname,
String? mobile,
}) = _User;
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
}
@freezed
abstract class Address with _$Address {
const factory Address({
City? city,
}) = _Address;
factory Address.fromJson(Map<String, dynamic> json) =>
_$AddressFromJson(json);
}
@freezed
abstract class City with _$City {
const factory City({
String? name,
}) = _City;
factory City.fromJson(Map<String, dynamic> json) => _$CityFromJson(json);
}
@freezed
abstract class ChainCompany with _$ChainCompany {
const factory ChainCompany({
bool? chainCompany,
String? hatchingKey,
}) = _ChainCompany;
factory ChainCompany.fromJson(Map<String, dynamic> json) =>
_$ChainCompanyFromJson(json);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,74 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'all_poultry.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_AllPoultry _$AllPoultryFromJson(Map<String, dynamic> json) => _AllPoultry(
user: json['user'] == null
? null
: User.fromJson(json['user'] as Map<String, dynamic>),
key: json['key'] as String?,
unitName: json['unit_name'] as String?,
address: json['address'] == null
? null
: Address.fromJson(json['address'] as Map<String, dynamic>),
lastHatchingRemainQuantity: (json['last_hatching_remain_quantity'] as num?)
?.toInt(),
provinceAllowSellFree: json['province_allow_sell_free'] as bool?,
chainCompany: json['chain_company'] == null
? null
: ChainCompany.fromJson(json['chain_company'] as Map<String, dynamic>),
);
Map<String, dynamic> _$AllPoultryToJson(_AllPoultry instance) =>
<String, dynamic>{
'user': instance.user,
'key': instance.key,
'unit_name': instance.unitName,
'address': instance.address,
'last_hatching_remain_quantity': instance.lastHatchingRemainQuantity,
'province_allow_sell_free': instance.provinceAllowSellFree,
'chain_company': instance.chainCompany,
};
_User _$UserFromJson(Map<String, dynamic> json) => _User(
fullname: json['fullname'] as String?,
mobile: json['mobile'] as String?,
);
Map<String, dynamic> _$UserToJson(_User instance) => <String, dynamic>{
'fullname': instance.fullname,
'mobile': instance.mobile,
};
_Address _$AddressFromJson(Map<String, dynamic> json) => _Address(
city: json['city'] == null
? null
: City.fromJson(json['city'] as Map<String, dynamic>),
);
Map<String, dynamic> _$AddressToJson(_Address instance) => <String, dynamic>{
'city': instance.city,
};
_City _$CityFromJson(Map<String, dynamic> json) =>
_City(name: json['name'] as String?);
Map<String, dynamic> _$CityToJson(_City instance) => <String, dynamic>{
'name': instance.name,
};
_ChainCompany _$ChainCompanyFromJson(Map<String, dynamic> json) =>
_ChainCompany(
chainCompany: json['chain_company'] as bool?,
hatchingKey: json['hatching_key'] as String?,
);
Map<String, dynamic> _$ChainCompanyToJson(_ChainCompany instance) =>
<String, dynamic>{
'chain_company': instance.chainCompany,
'hatching_key': instance.hatchingKey,
};

View File

@@ -0,0 +1,18 @@
import 'package:rasadyar_core/core.dart';
part 'approved_price.freezed.dart';
part 'approved_price.g.dart';
@freezed
abstract class ApprovedPrice with _$ApprovedPrice {
const factory ApprovedPrice({
bool? approved,
double? lowestPrice,
double? highestPrice,
double? lowestWeight,
double? highestWeight,
}) = _ApprovedPrice;
factory ApprovedPrice.fromJson(Map<String, dynamic> json) =>
_$ApprovedPriceFromJson(json);
}

View File

@@ -0,0 +1,289 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'approved_price.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ApprovedPrice {
bool? get approved; double? get lowestPrice; double? get highestPrice; double? get lowestWeight; double? get highestWeight;
/// Create a copy of ApprovedPrice
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ApprovedPriceCopyWith<ApprovedPrice> get copyWith => _$ApprovedPriceCopyWithImpl<ApprovedPrice>(this as ApprovedPrice, _$identity);
/// Serializes this ApprovedPrice to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ApprovedPrice&&(identical(other.approved, approved) || other.approved == approved)&&(identical(other.lowestPrice, lowestPrice) || other.lowestPrice == lowestPrice)&&(identical(other.highestPrice, highestPrice) || other.highestPrice == highestPrice)&&(identical(other.lowestWeight, lowestWeight) || other.lowestWeight == lowestWeight)&&(identical(other.highestWeight, highestWeight) || other.highestWeight == highestWeight));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,approved,lowestPrice,highestPrice,lowestWeight,highestWeight);
@override
String toString() {
return 'ApprovedPrice(approved: $approved, lowestPrice: $lowestPrice, highestPrice: $highestPrice, lowestWeight: $lowestWeight, highestWeight: $highestWeight)';
}
}
/// @nodoc
abstract mixin class $ApprovedPriceCopyWith<$Res> {
factory $ApprovedPriceCopyWith(ApprovedPrice value, $Res Function(ApprovedPrice) _then) = _$ApprovedPriceCopyWithImpl;
@useResult
$Res call({
bool? approved, double? lowestPrice, double? highestPrice, double? lowestWeight, double? highestWeight
});
}
/// @nodoc
class _$ApprovedPriceCopyWithImpl<$Res>
implements $ApprovedPriceCopyWith<$Res> {
_$ApprovedPriceCopyWithImpl(this._self, this._then);
final ApprovedPrice _self;
final $Res Function(ApprovedPrice) _then;
/// Create a copy of ApprovedPrice
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? approved = freezed,Object? lowestPrice = freezed,Object? highestPrice = freezed,Object? lowestWeight = freezed,Object? highestWeight = freezed,}) {
return _then(_self.copyWith(
approved: freezed == approved ? _self.approved : approved // ignore: cast_nullable_to_non_nullable
as bool?,lowestPrice: freezed == lowestPrice ? _self.lowestPrice : lowestPrice // ignore: cast_nullable_to_non_nullable
as double?,highestPrice: freezed == highestPrice ? _self.highestPrice : highestPrice // ignore: cast_nullable_to_non_nullable
as double?,lowestWeight: freezed == lowestWeight ? _self.lowestWeight : lowestWeight // ignore: cast_nullable_to_non_nullable
as double?,highestWeight: freezed == highestWeight ? _self.highestWeight : highestWeight // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
/// Adds pattern-matching-related methods to [ApprovedPrice].
extension ApprovedPricePatterns on ApprovedPrice {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ApprovedPrice value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _ApprovedPrice() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ApprovedPrice value) $default,){
final _that = this;
switch (_that) {
case _ApprovedPrice():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ApprovedPrice value)? $default,){
final _that = this;
switch (_that) {
case _ApprovedPrice() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool? approved, double? lowestPrice, double? highestPrice, double? lowestWeight, double? highestWeight)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ApprovedPrice() when $default != null:
return $default(_that.approved,_that.lowestPrice,_that.highestPrice,_that.lowestWeight,_that.highestWeight);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool? approved, double? lowestPrice, double? highestPrice, double? lowestWeight, double? highestWeight) $default,) {final _that = this;
switch (_that) {
case _ApprovedPrice():
return $default(_that.approved,_that.lowestPrice,_that.highestPrice,_that.lowestWeight,_that.highestWeight);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool? approved, double? lowestPrice, double? highestPrice, double? lowestWeight, double? highestWeight)? $default,) {final _that = this;
switch (_that) {
case _ApprovedPrice() when $default != null:
return $default(_that.approved,_that.lowestPrice,_that.highestPrice,_that.lowestWeight,_that.highestWeight);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _ApprovedPrice implements ApprovedPrice {
const _ApprovedPrice({this.approved, this.lowestPrice, this.highestPrice, this.lowestWeight, this.highestWeight});
factory _ApprovedPrice.fromJson(Map<String, dynamic> json) => _$ApprovedPriceFromJson(json);
@override final bool? approved;
@override final double? lowestPrice;
@override final double? highestPrice;
@override final double? lowestWeight;
@override final double? highestWeight;
/// Create a copy of ApprovedPrice
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ApprovedPriceCopyWith<_ApprovedPrice> get copyWith => __$ApprovedPriceCopyWithImpl<_ApprovedPrice>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$ApprovedPriceToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ApprovedPrice&&(identical(other.approved, approved) || other.approved == approved)&&(identical(other.lowestPrice, lowestPrice) || other.lowestPrice == lowestPrice)&&(identical(other.highestPrice, highestPrice) || other.highestPrice == highestPrice)&&(identical(other.lowestWeight, lowestWeight) || other.lowestWeight == lowestWeight)&&(identical(other.highestWeight, highestWeight) || other.highestWeight == highestWeight));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,approved,lowestPrice,highestPrice,lowestWeight,highestWeight);
@override
String toString() {
return 'ApprovedPrice(approved: $approved, lowestPrice: $lowestPrice, highestPrice: $highestPrice, lowestWeight: $lowestWeight, highestWeight: $highestWeight)';
}
}
/// @nodoc
abstract mixin class _$ApprovedPriceCopyWith<$Res> implements $ApprovedPriceCopyWith<$Res> {
factory _$ApprovedPriceCopyWith(_ApprovedPrice value, $Res Function(_ApprovedPrice) _then) = __$ApprovedPriceCopyWithImpl;
@override @useResult
$Res call({
bool? approved, double? lowestPrice, double? highestPrice, double? lowestWeight, double? highestWeight
});
}
/// @nodoc
class __$ApprovedPriceCopyWithImpl<$Res>
implements _$ApprovedPriceCopyWith<$Res> {
__$ApprovedPriceCopyWithImpl(this._self, this._then);
final _ApprovedPrice _self;
final $Res Function(_ApprovedPrice) _then;
/// Create a copy of ApprovedPrice
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? approved = freezed,Object? lowestPrice = freezed,Object? highestPrice = freezed,Object? lowestWeight = freezed,Object? highestWeight = freezed,}) {
return _then(_ApprovedPrice(
approved: freezed == approved ? _self.approved : approved // ignore: cast_nullable_to_non_nullable
as bool?,lowestPrice: freezed == lowestPrice ? _self.lowestPrice : lowestPrice // ignore: cast_nullable_to_non_nullable
as double?,highestPrice: freezed == highestPrice ? _self.highestPrice : highestPrice // ignore: cast_nullable_to_non_nullable
as double?,lowestWeight: freezed == lowestWeight ? _self.lowestWeight : lowestWeight // ignore: cast_nullable_to_non_nullable
as double?,highestWeight: freezed == highestWeight ? _self.highestWeight : highestWeight // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
// dart format on

View File

@@ -0,0 +1,25 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'approved_price.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_ApprovedPrice _$ApprovedPriceFromJson(Map<String, dynamic> json) =>
_ApprovedPrice(
approved: json['approved'] as bool?,
lowestPrice: (json['lowest_price'] as num?)?.toDouble(),
highestPrice: (json['highest_price'] as num?)?.toDouble(),
lowestWeight: (json['lowest_weight'] as num?)?.toDouble(),
highestWeight: (json['highest_weight'] as num?)?.toDouble(),
);
Map<String, dynamic> _$ApprovedPriceToJson(_ApprovedPrice instance) =>
<String, dynamic>{
'approved': instance.approved,
'lowest_price': instance.lowestPrice,
'highest_price': instance.highestPrice,
'lowest_weight': instance.lowestWeight,
'highest_weight': instance.highestWeight,
};

View File

@@ -0,0 +1,20 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'kill_house_poultry.freezed.dart';
part 'kill_house_poultry.g.dart';
@freezed
abstract class KillHousePoultry with _$KillHousePoultry {
const factory KillHousePoultry({
String? name,
bool? killer,
String? fullname,
int? quantitySum,
int? firstQuantity,
int? poultryQuantitySum,
String? killReqKey,
}) = _KillHousePoultry;
factory KillHousePoultry.fromJson(Map<String, dynamic> json) =>
_$KillHousePoultryFromJson(json);
}

View File

@@ -0,0 +1,295 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'kill_house_poultry.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$KillHousePoultry {
String? get name; bool? get killer; String? get fullname; int? get quantitySum; int? get firstQuantity; int? get poultryQuantitySum; String? get killReqKey;
/// Create a copy of KillHousePoultry
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$KillHousePoultryCopyWith<KillHousePoultry> get copyWith => _$KillHousePoultryCopyWithImpl<KillHousePoultry>(this as KillHousePoultry, _$identity);
/// Serializes this KillHousePoultry to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is KillHousePoultry&&(identical(other.name, name) || other.name == name)&&(identical(other.killer, killer) || other.killer == killer)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.quantitySum, quantitySum) || other.quantitySum == quantitySum)&&(identical(other.firstQuantity, firstQuantity) || other.firstQuantity == firstQuantity)&&(identical(other.poultryQuantitySum, poultryQuantitySum) || other.poultryQuantitySum == poultryQuantitySum)&&(identical(other.killReqKey, killReqKey) || other.killReqKey == killReqKey));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,name,killer,fullname,quantitySum,firstQuantity,poultryQuantitySum,killReqKey);
@override
String toString() {
return 'KillHousePoultry(name: $name, killer: $killer, fullname: $fullname, quantitySum: $quantitySum, firstQuantity: $firstQuantity, poultryQuantitySum: $poultryQuantitySum, killReqKey: $killReqKey)';
}
}
/// @nodoc
abstract mixin class $KillHousePoultryCopyWith<$Res> {
factory $KillHousePoultryCopyWith(KillHousePoultry value, $Res Function(KillHousePoultry) _then) = _$KillHousePoultryCopyWithImpl;
@useResult
$Res call({
String? name, bool? killer, String? fullname, int? quantitySum, int? firstQuantity, int? poultryQuantitySum, String? killReqKey
});
}
/// @nodoc
class _$KillHousePoultryCopyWithImpl<$Res>
implements $KillHousePoultryCopyWith<$Res> {
_$KillHousePoultryCopyWithImpl(this._self, this._then);
final KillHousePoultry _self;
final $Res Function(KillHousePoultry) _then;
/// Create a copy of KillHousePoultry
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? name = freezed,Object? killer = freezed,Object? fullname = freezed,Object? quantitySum = freezed,Object? firstQuantity = freezed,Object? poultryQuantitySum = freezed,Object? killReqKey = freezed,}) {
return _then(_self.copyWith(
name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String?,killer: freezed == killer ? _self.killer : killer // ignore: cast_nullable_to_non_nullable
as bool?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
as String?,quantitySum: freezed == quantitySum ? _self.quantitySum : quantitySum // ignore: cast_nullable_to_non_nullable
as int?,firstQuantity: freezed == firstQuantity ? _self.firstQuantity : firstQuantity // ignore: cast_nullable_to_non_nullable
as int?,poultryQuantitySum: freezed == poultryQuantitySum ? _self.poultryQuantitySum : poultryQuantitySum // ignore: cast_nullable_to_non_nullable
as int?,killReqKey: freezed == killReqKey ? _self.killReqKey : killReqKey // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [KillHousePoultry].
extension KillHousePoultryPatterns on KillHousePoultry {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _KillHousePoultry value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _KillHousePoultry() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _KillHousePoultry value) $default,){
final _that = this;
switch (_that) {
case _KillHousePoultry():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _KillHousePoultry value)? $default,){
final _that = this;
switch (_that) {
case _KillHousePoultry() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? name, bool? killer, String? fullname, int? quantitySum, int? firstQuantity, int? poultryQuantitySum, String? killReqKey)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _KillHousePoultry() when $default != null:
return $default(_that.name,_that.killer,_that.fullname,_that.quantitySum,_that.firstQuantity,_that.poultryQuantitySum,_that.killReqKey);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? name, bool? killer, String? fullname, int? quantitySum, int? firstQuantity, int? poultryQuantitySum, String? killReqKey) $default,) {final _that = this;
switch (_that) {
case _KillHousePoultry():
return $default(_that.name,_that.killer,_that.fullname,_that.quantitySum,_that.firstQuantity,_that.poultryQuantitySum,_that.killReqKey);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? name, bool? killer, String? fullname, int? quantitySum, int? firstQuantity, int? poultryQuantitySum, String? killReqKey)? $default,) {final _that = this;
switch (_that) {
case _KillHousePoultry() when $default != null:
return $default(_that.name,_that.killer,_that.fullname,_that.quantitySum,_that.firstQuantity,_that.poultryQuantitySum,_that.killReqKey);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _KillHousePoultry implements KillHousePoultry {
const _KillHousePoultry({this.name, this.killer, this.fullname, this.quantitySum, this.firstQuantity, this.poultryQuantitySum, this.killReqKey});
factory _KillHousePoultry.fromJson(Map<String, dynamic> json) => _$KillHousePoultryFromJson(json);
@override final String? name;
@override final bool? killer;
@override final String? fullname;
@override final int? quantitySum;
@override final int? firstQuantity;
@override final int? poultryQuantitySum;
@override final String? killReqKey;
/// Create a copy of KillHousePoultry
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$KillHousePoultryCopyWith<_KillHousePoultry> get copyWith => __$KillHousePoultryCopyWithImpl<_KillHousePoultry>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$KillHousePoultryToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _KillHousePoultry&&(identical(other.name, name) || other.name == name)&&(identical(other.killer, killer) || other.killer == killer)&&(identical(other.fullname, fullname) || other.fullname == fullname)&&(identical(other.quantitySum, quantitySum) || other.quantitySum == quantitySum)&&(identical(other.firstQuantity, firstQuantity) || other.firstQuantity == firstQuantity)&&(identical(other.poultryQuantitySum, poultryQuantitySum) || other.poultryQuantitySum == poultryQuantitySum)&&(identical(other.killReqKey, killReqKey) || other.killReqKey == killReqKey));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,name,killer,fullname,quantitySum,firstQuantity,poultryQuantitySum,killReqKey);
@override
String toString() {
return 'KillHousePoultry(name: $name, killer: $killer, fullname: $fullname, quantitySum: $quantitySum, firstQuantity: $firstQuantity, poultryQuantitySum: $poultryQuantitySum, killReqKey: $killReqKey)';
}
}
/// @nodoc
abstract mixin class _$KillHousePoultryCopyWith<$Res> implements $KillHousePoultryCopyWith<$Res> {
factory _$KillHousePoultryCopyWith(_KillHousePoultry value, $Res Function(_KillHousePoultry) _then) = __$KillHousePoultryCopyWithImpl;
@override @useResult
$Res call({
String? name, bool? killer, String? fullname, int? quantitySum, int? firstQuantity, int? poultryQuantitySum, String? killReqKey
});
}
/// @nodoc
class __$KillHousePoultryCopyWithImpl<$Res>
implements _$KillHousePoultryCopyWith<$Res> {
__$KillHousePoultryCopyWithImpl(this._self, this._then);
final _KillHousePoultry _self;
final $Res Function(_KillHousePoultry) _then;
/// Create a copy of KillHousePoultry
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? name = freezed,Object? killer = freezed,Object? fullname = freezed,Object? quantitySum = freezed,Object? firstQuantity = freezed,Object? poultryQuantitySum = freezed,Object? killReqKey = freezed,}) {
return _then(_KillHousePoultry(
name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String?,killer: freezed == killer ? _self.killer : killer // ignore: cast_nullable_to_non_nullable
as bool?,fullname: freezed == fullname ? _self.fullname : fullname // ignore: cast_nullable_to_non_nullable
as String?,quantitySum: freezed == quantitySum ? _self.quantitySum : quantitySum // ignore: cast_nullable_to_non_nullable
as int?,firstQuantity: freezed == firstQuantity ? _self.firstQuantity : firstQuantity // ignore: cast_nullable_to_non_nullable
as int?,poultryQuantitySum: freezed == poultryQuantitySum ? _self.poultryQuantitySum : poultryQuantitySum // ignore: cast_nullable_to_non_nullable
as int?,killReqKey: freezed == killReqKey ? _self.killReqKey : killReqKey // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,29 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'kill_house_poultry.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_KillHousePoultry _$KillHousePoultryFromJson(Map<String, dynamic> json) =>
_KillHousePoultry(
name: json['name'] as String?,
killer: json['killer'] as bool?,
fullname: json['fullname'] as String?,
quantitySum: (json['quantity_sum'] as num?)?.toInt(),
firstQuantity: (json['first_quantity'] as num?)?.toInt(),
poultryQuantitySum: (json['poultry_quantity_sum'] as num?)?.toInt(),
killReqKey: json['kill_req_key'] as String?,
);
Map<String, dynamic> _$KillHousePoultryToJson(_KillHousePoultry instance) =>
<String, dynamic>{
'name': instance.name,
'killer': instance.killer,
'fullname': instance.fullname,
'quantity_sum': instance.quantitySum,
'first_quantity': instance.firstQuantity,
'poultry_quantity_sum': instance.poultryQuantitySum,
'kill_req_key': instance.killReqKey,
};

View File

@@ -0,0 +1,257 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'kill_request_poultry.freezed.dart';
part 'kill_request_poultry.g.dart';
@freezed
abstract class KillRequestPoultry with _$KillRequestPoultry{
const factory KillRequestPoultry({
UserProfile? userprofile,
Address? address,
PoultryOwner? poultryOwner,
PoultryTenant? poultryTenant,
List<Hatching>? hatching,
List<int>? registerVetHalls,
Allow? allow,
ProvinceAllowChooseKillHouse? provinceAllowChooseKillHouse,
bool? provinceAllowSellFree,
VetFarm? vetFarm,
LastHatchingDifferentRequestQuantity? lastHatchingDiffrentRequestQuantity,
UserBankInfo? userBankInfo,
int? leftOverOwnHatching,
String? key,
bool? trash,
int? ownerIdForeignKey,
int? userIdForeignKey,
int? addressIdForeignKey,
bool? hasChainCompany,
int? userBankIdForeignKey,
String? cityOperator,
String? unitName,
String? gisCode,
int? operatingLicenceCapacity,
int? numberOfHalls,
bool? tenant,
bool? hasTenant,
String? personType,
String? economicCode,
String? systemCode,
String? epidemiologicalCode,
String? breedingUniqueId,
int? totalCapacity,
String? licenceNumber,
String? healthCertificateNumber,
int? numberOfRequests,
String? hatchingDate,
String? lastPartyDate,
int? numberOfIncubators,
int? herdAgeByDay,
int? herdAgeByWeek,
int? numberOfParty,
String? communicationType,
String? cooperative,
String? dateOfRegister,
String? unitStatus,
bool? active,
String? identityDocuments,
String? samasatUserCode,
int? baseOrder,
String? incubationDate,
int? walletAmount,
int? city,
int? cityNumber,
String? cityName,
int? provinceNumber,
String? provinceName,
int? walletIdForeignKey,
int? poultryIdKey,
double? lat,
double? long,
String? date,
int? killingAveAge,
int? activeLeftOver,
int? killingAveCount,
double? killingAveWeight,
double? killingLiveWeight,
double? killingCarcassesWeight,
double? killingLossWeightPercent,
double? realKillingAveWeight,
double? realKillingLiveWeight,
double? realKillingCarcassesWeight,
double? realKillingLossWeightPercent,
int? interestLicenseId,
bool? orderLimit,
int? owner,
int? wallet,
}) = _KillRequestPoultry;
factory KillRequestPoultry.fromJson(Map<String, dynamic> json) =>
_$KillRequestPoultryFromJson(json);
}
@freezed
abstract class UserProfile with _$UserProfile {
const factory UserProfile({
String? userKey,
int? baseOrder,
String? fullName,
String? mobile,
String? city,
String? province,
String? breedingUniqueId,
}) = _UserProfile;
factory UserProfile.fromJson(Map<String, dynamic> json) =>
_$UserProfileFromJson(json);
}
@freezed
abstract class Address with _$Address {
const factory Address({
Province? province,
City? city,
String? address,
String? postalCode,
}) = _Address;
factory Address.fromJson(Map<String, dynamic> json) =>
_$AddressFromJson(json);
}
@freezed
abstract class Province with _$Province {
const factory Province({
String? key,
String? name,
}) = _Province;
factory Province.fromJson(Map<String, dynamic> json) =>
_$ProvinceFromJson(json);
}
@freezed
abstract class City with _$City {
const factory City({
String? key,
String? name,
}) = _City;
factory City.fromJson(Map<String, dynamic> json) => _$CityFromJson(json);
}
@freezed
abstract class PoultryOwner with _$PoultryOwner {
const factory PoultryOwner({
String? fullName,
String? mobile,
String? unitName,
int? numberOfHalls,
String? breedingUniqueId,
}) = _PoultryOwner;
factory PoultryOwner.fromJson(Map<String, dynamic> json) =>
_$PoultryOwnerFromJson(json);
}
@freezed
abstract class PoultryTenant with _$PoultryTenant {
const factory PoultryTenant({
String? key,
String? firstName,
String? lastName,
String? fullName,
String? mobile,
String? nationalId,
String? breedingUniqueId,
}) = _PoultryTenant;
factory PoultryTenant.fromJson(Map<String, dynamic> json) =>
_$PoultryTenantFromJson(json);
}
@freezed
abstract class Hatching with _$Hatching {
const factory Hatching({
String? poultryKey,
String? poultryHatchingKey,
String? poultry,
int? quantity,
int? losses,
int? leftOver,
double? outProvinceKilledQuantity,
double? exportKilledQuantity,
int? hall,
String? date,
int? period,
String? state,
int? age,
}) = _Hatching;
factory Hatching.fromJson(Map<String, dynamic> json) =>
_$HatchingFromJson(json);
}
@freezed
abstract class Allow with _$Allow {
const factory Allow({
bool? city,
bool? province,
}) = _Allow;
factory Allow.fromJson(Map<String, dynamic> json) => _$AllowFromJson(json);
}
@freezed
abstract class ProvinceAllowChooseKillHouse with _$ProvinceAllowChooseKillHouse {
const factory ProvinceAllowChooseKillHouse({
bool? allowState,
bool? mandatory,
}) = _ProvinceAllowChooseKillHouse;
factory ProvinceAllowChooseKillHouse.fromJson(Map<String, dynamic> json) =>
_$ProvinceAllowChooseKillHouseFromJson(json);
}
@freezed
abstract class VetFarm with _$VetFarm {
const factory VetFarm({
String? fullName,
String? mobile,
String? city,
String? province,
}) = _VetFarm;
factory VetFarm.fromJson(Map<String, dynamic> json) =>
_$VetFarmFromJson(json);
}
@freezed
abstract class LastHatchingDifferentRequestQuantity
with _$LastHatchingDifferentRequestQuantity {
const factory LastHatchingDifferentRequestQuantity({
double? leftExportQuantity,
double? leftPoultryOutProvince,
int? lastHatchingRemainQuantity,
}) = _LastHatchingDifferentRequestQuantity;
factory LastHatchingDifferentRequestQuantity.fromJson(
Map<String, dynamic> json) =>
_$LastHatchingDifferentRequestQuantityFromJson(json);
}
@freezed
abstract class UserBankInfo with _$UserBankInfo {
const factory UserBankInfo({
String? key,
String? nameOfBankUser,
String? bankName,
String? card,
String? shaba,
String? account,
int? userBankIdKey,
String? provinceName,
}) = _UserBankInfo;
factory UserBankInfo.fromJson(Map<String, dynamic> json) =>
_$UserBankInfoFromJson(json);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,410 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'kill_request_poultry.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_KillRequestPoultry _$KillRequestPoultryFromJson(
Map<String, dynamic> json,
) => _KillRequestPoultry(
userprofile: json['userprofile'] == null
? null
: UserProfile.fromJson(json['userprofile'] as Map<String, dynamic>),
address: json['address'] == null
? null
: Address.fromJson(json['address'] as Map<String, dynamic>),
poultryOwner: json['poultry_owner'] == null
? null
: PoultryOwner.fromJson(json['poultry_owner'] as Map<String, dynamic>),
poultryTenant: json['poultry_tenant'] == null
? null
: PoultryTenant.fromJson(json['poultry_tenant'] as Map<String, dynamic>),
hatching: (json['hatching'] as List<dynamic>?)
?.map((e) => Hatching.fromJson(e as Map<String, dynamic>))
.toList(),
registerVetHalls: (json['register_vet_halls'] as List<dynamic>?)
?.map((e) => (e as num).toInt())
.toList(),
allow: json['allow'] == null
? null
: Allow.fromJson(json['allow'] as Map<String, dynamic>),
provinceAllowChooseKillHouse: json['province_allow_choose_kill_house'] == null
? null
: ProvinceAllowChooseKillHouse.fromJson(
json['province_allow_choose_kill_house'] as Map<String, dynamic>,
),
provinceAllowSellFree: json['province_allow_sell_free'] as bool?,
vetFarm: json['vet_farm'] == null
? null
: VetFarm.fromJson(json['vet_farm'] as Map<String, dynamic>),
lastHatchingDiffrentRequestQuantity:
json['last_hatching_diffrent_request_quantity'] == null
? null
: LastHatchingDifferentRequestQuantity.fromJson(
json['last_hatching_diffrent_request_quantity']
as Map<String, dynamic>,
),
userBankInfo: json['user_bank_info'] == null
? null
: UserBankInfo.fromJson(json['user_bank_info'] as Map<String, dynamic>),
leftOverOwnHatching: (json['left_over_own_hatching'] as num?)?.toInt(),
key: json['key'] as String?,
trash: json['trash'] as bool?,
ownerIdForeignKey: (json['owner_id_foreign_key'] as num?)?.toInt(),
userIdForeignKey: (json['user_id_foreign_key'] as num?)?.toInt(),
addressIdForeignKey: (json['address_id_foreign_key'] as num?)?.toInt(),
hasChainCompany: json['has_chain_company'] as bool?,
userBankIdForeignKey: (json['user_bank_id_foreign_key'] as num?)?.toInt(),
cityOperator: json['city_operator'] as String?,
unitName: json['unit_name'] as String?,
gisCode: json['gis_code'] as String?,
operatingLicenceCapacity: (json['operating_licence_capacity'] as num?)
?.toInt(),
numberOfHalls: (json['number_of_halls'] as num?)?.toInt(),
tenant: json['tenant'] as bool?,
hasTenant: json['has_tenant'] as bool?,
personType: json['person_type'] as String?,
economicCode: json['economic_code'] as String?,
systemCode: json['system_code'] as String?,
epidemiologicalCode: json['epidemiological_code'] as String?,
breedingUniqueId: json['breeding_unique_id'] as String?,
totalCapacity: (json['total_capacity'] as num?)?.toInt(),
licenceNumber: json['licence_number'] as String?,
healthCertificateNumber: json['health_certificate_number'] as String?,
numberOfRequests: (json['number_of_requests'] as num?)?.toInt(),
hatchingDate: json['hatching_date'] as String?,
lastPartyDate: json['last_party_date'] as String?,
numberOfIncubators: (json['number_of_incubators'] as num?)?.toInt(),
herdAgeByDay: (json['herd_age_by_day'] as num?)?.toInt(),
herdAgeByWeek: (json['herd_age_by_week'] as num?)?.toInt(),
numberOfParty: (json['number_of_party'] as num?)?.toInt(),
communicationType: json['communication_type'] as String?,
cooperative: json['cooperative'] as String?,
dateOfRegister: json['date_of_register'] as String?,
unitStatus: json['unit_status'] as String?,
active: json['active'] as bool?,
identityDocuments: json['identity_documents'] as String?,
samasatUserCode: json['samasat_user_code'] as String?,
baseOrder: (json['base_order'] as num?)?.toInt(),
incubationDate: json['incubation_date'] as String?,
walletAmount: (json['wallet_amount'] as num?)?.toInt(),
city: (json['city'] as num?)?.toInt(),
cityNumber: (json['city_number'] as num?)?.toInt(),
cityName: json['city_name'] as String?,
provinceNumber: (json['province_number'] as num?)?.toInt(),
provinceName: json['province_name'] as String?,
walletIdForeignKey: (json['wallet_id_foreign_key'] as num?)?.toInt(),
poultryIdKey: (json['poultry_id_key'] as num?)?.toInt(),
lat: (json['lat'] as num?)?.toDouble(),
long: (json['long'] as num?)?.toDouble(),
date: json['date'] as String?,
killingAveAge: (json['killing_ave_age'] as num?)?.toInt(),
activeLeftOver: (json['active_left_over'] as num?)?.toInt(),
killingAveCount: (json['killing_ave_count'] as num?)?.toInt(),
killingAveWeight: (json['killing_ave_weight'] as num?)?.toDouble(),
killingLiveWeight: (json['killing_live_weight'] as num?)?.toDouble(),
killingCarcassesWeight: (json['killing_carcasses_weight'] as num?)
?.toDouble(),
killingLossWeightPercent: (json['killing_loss_weight_percent'] as num?)
?.toDouble(),
realKillingAveWeight: (json['real_killing_ave_weight'] as num?)?.toDouble(),
realKillingLiveWeight: (json['real_killing_live_weight'] as num?)?.toDouble(),
realKillingCarcassesWeight: (json['real_killing_carcasses_weight'] as num?)
?.toDouble(),
realKillingLossWeightPercent:
(json['real_killing_loss_weight_percent'] as num?)?.toDouble(),
interestLicenseId: (json['interest_license_id'] as num?)?.toInt(),
orderLimit: json['order_limit'] as bool?,
owner: (json['owner'] as num?)?.toInt(),
wallet: (json['wallet'] as num?)?.toInt(),
);
Map<String, dynamic> _$KillRequestPoultryToJson(_KillRequestPoultry instance) =>
<String, dynamic>{
'userprofile': instance.userprofile,
'address': instance.address,
'poultry_owner': instance.poultryOwner,
'poultry_tenant': instance.poultryTenant,
'hatching': instance.hatching,
'register_vet_halls': instance.registerVetHalls,
'allow': instance.allow,
'province_allow_choose_kill_house': instance.provinceAllowChooseKillHouse,
'province_allow_sell_free': instance.provinceAllowSellFree,
'vet_farm': instance.vetFarm,
'last_hatching_diffrent_request_quantity':
instance.lastHatchingDiffrentRequestQuantity,
'user_bank_info': instance.userBankInfo,
'left_over_own_hatching': instance.leftOverOwnHatching,
'key': instance.key,
'trash': instance.trash,
'owner_id_foreign_key': instance.ownerIdForeignKey,
'user_id_foreign_key': instance.userIdForeignKey,
'address_id_foreign_key': instance.addressIdForeignKey,
'has_chain_company': instance.hasChainCompany,
'user_bank_id_foreign_key': instance.userBankIdForeignKey,
'city_operator': instance.cityOperator,
'unit_name': instance.unitName,
'gis_code': instance.gisCode,
'operating_licence_capacity': instance.operatingLicenceCapacity,
'number_of_halls': instance.numberOfHalls,
'tenant': instance.tenant,
'has_tenant': instance.hasTenant,
'person_type': instance.personType,
'economic_code': instance.economicCode,
'system_code': instance.systemCode,
'epidemiological_code': instance.epidemiologicalCode,
'breeding_unique_id': instance.breedingUniqueId,
'total_capacity': instance.totalCapacity,
'licence_number': instance.licenceNumber,
'health_certificate_number': instance.healthCertificateNumber,
'number_of_requests': instance.numberOfRequests,
'hatching_date': instance.hatchingDate,
'last_party_date': instance.lastPartyDate,
'number_of_incubators': instance.numberOfIncubators,
'herd_age_by_day': instance.herdAgeByDay,
'herd_age_by_week': instance.herdAgeByWeek,
'number_of_party': instance.numberOfParty,
'communication_type': instance.communicationType,
'cooperative': instance.cooperative,
'date_of_register': instance.dateOfRegister,
'unit_status': instance.unitStatus,
'active': instance.active,
'identity_documents': instance.identityDocuments,
'samasat_user_code': instance.samasatUserCode,
'base_order': instance.baseOrder,
'incubation_date': instance.incubationDate,
'wallet_amount': instance.walletAmount,
'city': instance.city,
'city_number': instance.cityNumber,
'city_name': instance.cityName,
'province_number': instance.provinceNumber,
'province_name': instance.provinceName,
'wallet_id_foreign_key': instance.walletIdForeignKey,
'poultry_id_key': instance.poultryIdKey,
'lat': instance.lat,
'long': instance.long,
'date': instance.date,
'killing_ave_age': instance.killingAveAge,
'active_left_over': instance.activeLeftOver,
'killing_ave_count': instance.killingAveCount,
'killing_ave_weight': instance.killingAveWeight,
'killing_live_weight': instance.killingLiveWeight,
'killing_carcasses_weight': instance.killingCarcassesWeight,
'killing_loss_weight_percent': instance.killingLossWeightPercent,
'real_killing_ave_weight': instance.realKillingAveWeight,
'real_killing_live_weight': instance.realKillingLiveWeight,
'real_killing_carcasses_weight': instance.realKillingCarcassesWeight,
'real_killing_loss_weight_percent': instance.realKillingLossWeightPercent,
'interest_license_id': instance.interestLicenseId,
'order_limit': instance.orderLimit,
'owner': instance.owner,
'wallet': instance.wallet,
};
_UserProfile _$UserProfileFromJson(Map<String, dynamic> json) => _UserProfile(
userKey: json['user_key'] as String?,
baseOrder: (json['base_order'] as num?)?.toInt(),
fullName: json['full_name'] as String?,
mobile: json['mobile'] as String?,
city: json['city'] as String?,
province: json['province'] as String?,
breedingUniqueId: json['breeding_unique_id'] as String?,
);
Map<String, dynamic> _$UserProfileToJson(_UserProfile instance) =>
<String, dynamic>{
'user_key': instance.userKey,
'base_order': instance.baseOrder,
'full_name': instance.fullName,
'mobile': instance.mobile,
'city': instance.city,
'province': instance.province,
'breeding_unique_id': instance.breedingUniqueId,
};
_Address _$AddressFromJson(Map<String, dynamic> json) => _Address(
province: json['province'] == null
? null
: Province.fromJson(json['province'] as Map<String, dynamic>),
city: json['city'] == null
? null
: City.fromJson(json['city'] as Map<String, dynamic>),
address: json['address'] as String?,
postalCode: json['postal_code'] as String?,
);
Map<String, dynamic> _$AddressToJson(_Address instance) => <String, dynamic>{
'province': instance.province,
'city': instance.city,
'address': instance.address,
'postal_code': instance.postalCode,
};
_Province _$ProvinceFromJson(Map<String, dynamic> json) =>
_Province(key: json['key'] as String?, name: json['name'] as String?);
Map<String, dynamic> _$ProvinceToJson(_Province instance) => <String, dynamic>{
'key': instance.key,
'name': instance.name,
};
_City _$CityFromJson(Map<String, dynamic> json) =>
_City(key: json['key'] as String?, name: json['name'] as String?);
Map<String, dynamic> _$CityToJson(_City instance) => <String, dynamic>{
'key': instance.key,
'name': instance.name,
};
_PoultryOwner _$PoultryOwnerFromJson(Map<String, dynamic> json) =>
_PoultryOwner(
fullName: json['full_name'] as String?,
mobile: json['mobile'] as String?,
unitName: json['unit_name'] as String?,
numberOfHalls: (json['number_of_halls'] as num?)?.toInt(),
breedingUniqueId: json['breeding_unique_id'] as String?,
);
Map<String, dynamic> _$PoultryOwnerToJson(_PoultryOwner instance) =>
<String, dynamic>{
'full_name': instance.fullName,
'mobile': instance.mobile,
'unit_name': instance.unitName,
'number_of_halls': instance.numberOfHalls,
'breeding_unique_id': instance.breedingUniqueId,
};
_PoultryTenant _$PoultryTenantFromJson(Map<String, dynamic> json) =>
_PoultryTenant(
key: json['key'] as String?,
firstName: json['first_name'] as String?,
lastName: json['last_name'] as String?,
fullName: json['full_name'] as String?,
mobile: json['mobile'] as String?,
nationalId: json['national_id'] as String?,
breedingUniqueId: json['breeding_unique_id'] as String?,
);
Map<String, dynamic> _$PoultryTenantToJson(_PoultryTenant instance) =>
<String, dynamic>{
'key': instance.key,
'first_name': instance.firstName,
'last_name': instance.lastName,
'full_name': instance.fullName,
'mobile': instance.mobile,
'national_id': instance.nationalId,
'breeding_unique_id': instance.breedingUniqueId,
};
_Hatching _$HatchingFromJson(Map<String, dynamic> json) => _Hatching(
poultryKey: json['poultry_key'] as String?,
poultryHatchingKey: json['poultry_hatching_key'] as String?,
poultry: json['poultry'] as String?,
quantity: (json['quantity'] as num?)?.toInt(),
losses: (json['losses'] as num?)?.toInt(),
leftOver: (json['left_over'] as num?)?.toInt(),
outProvinceKilledQuantity: (json['out_province_killed_quantity'] as num?)
?.toDouble(),
exportKilledQuantity: (json['export_killed_quantity'] as num?)?.toDouble(),
hall: (json['hall'] as num?)?.toInt(),
date: json['date'] as String?,
period: (json['period'] as num?)?.toInt(),
state: json['state'] as String?,
age: (json['age'] as num?)?.toInt(),
);
Map<String, dynamic> _$HatchingToJson(_Hatching instance) => <String, dynamic>{
'poultry_key': instance.poultryKey,
'poultry_hatching_key': instance.poultryHatchingKey,
'poultry': instance.poultry,
'quantity': instance.quantity,
'losses': instance.losses,
'left_over': instance.leftOver,
'out_province_killed_quantity': instance.outProvinceKilledQuantity,
'export_killed_quantity': instance.exportKilledQuantity,
'hall': instance.hall,
'date': instance.date,
'period': instance.period,
'state': instance.state,
'age': instance.age,
};
_Allow _$AllowFromJson(Map<String, dynamic> json) =>
_Allow(city: json['city'] as bool?, province: json['province'] as bool?);
Map<String, dynamic> _$AllowToJson(_Allow instance) => <String, dynamic>{
'city': instance.city,
'province': instance.province,
};
_ProvinceAllowChooseKillHouse _$ProvinceAllowChooseKillHouseFromJson(
Map<String, dynamic> json,
) => _ProvinceAllowChooseKillHouse(
allowState: json['allow_state'] as bool?,
mandatory: json['mandatory'] as bool?,
);
Map<String, dynamic> _$ProvinceAllowChooseKillHouseToJson(
_ProvinceAllowChooseKillHouse instance,
) => <String, dynamic>{
'allow_state': instance.allowState,
'mandatory': instance.mandatory,
};
_VetFarm _$VetFarmFromJson(Map<String, dynamic> json) => _VetFarm(
fullName: json['full_name'] as String?,
mobile: json['mobile'] as String?,
city: json['city'] as String?,
province: json['province'] as String?,
);
Map<String, dynamic> _$VetFarmToJson(_VetFarm instance) => <String, dynamic>{
'full_name': instance.fullName,
'mobile': instance.mobile,
'city': instance.city,
'province': instance.province,
};
_LastHatchingDifferentRequestQuantity
_$LastHatchingDifferentRequestQuantityFromJson(Map<String, dynamic> json) =>
_LastHatchingDifferentRequestQuantity(
leftExportQuantity: (json['left_export_quantity'] as num?)?.toDouble(),
leftPoultryOutProvince: (json['left_poultry_out_province'] as num?)
?.toDouble(),
lastHatchingRemainQuantity:
(json['last_hatching_remain_quantity'] as num?)?.toInt(),
);
Map<String, dynamic> _$LastHatchingDifferentRequestQuantityToJson(
_LastHatchingDifferentRequestQuantity instance,
) => <String, dynamic>{
'left_export_quantity': instance.leftExportQuantity,
'left_poultry_out_province': instance.leftPoultryOutProvince,
'last_hatching_remain_quantity': instance.lastHatchingRemainQuantity,
};
_UserBankInfo _$UserBankInfoFromJson(Map<String, dynamic> json) =>
_UserBankInfo(
key: json['key'] as String?,
nameOfBankUser: json['name_of_bank_user'] as String?,
bankName: json['bank_name'] as String?,
card: json['card'] as String?,
shaba: json['shaba'] as String?,
account: json['account'] as String?,
userBankIdKey: (json['user_bank_id_key'] as num?)?.toInt(),
provinceName: json['province_name'] as String?,
);
Map<String, dynamic> _$UserBankInfoToJson(_UserBankInfo instance) =>
<String, dynamic>{
'key': instance.key,
'name_of_bank_user': instance.nameOfBankUser,
'bank_name': instance.bankName,
'card': instance.card,
'shaba': instance.shaba,
'account': instance.account,
'user_bank_id_key': instance.userBankIdKey,
'province_name': instance.provinceName,
};

View File

@@ -0,0 +1,545 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'poultry_hatching.freezed.dart';
part 'poultry_hatching.g.dart';
@freezed
abstract class PoultryHatching with _$PoultryHatching {
const factory PoultryHatching({
int? id,
Poultry? poultry,
ChainCompany? chainCompany,
int? age,
dynamic inspectionLosses,
VetFarm? vetFarm,
ActiveKill? activeKill,
KillingInfo? killingInfo,
FreeGovernmentalInfo? freeGovernmentalInfo,
ManagementHatchingAgeRange? managementHatchingAgeRange,
String? key,
String? createDate,
String? modifyDate,
bool? trash,
bool? hasChainCompany,
dynamic poultryIdForeignKey,
dynamic poultryHatchingIdKey,
int? quantity,
int? losses,
int? leftOver,
int? killedQuantity,
int? extraKilledQuantity,
double? governmentalKilledQuantity,
double? governmentalQuantity,
double? freeKilledQuantity,
double? freeQuantity,
double? chainKilledQuantity,
double? chainKilledWeight,
double? outProvinceKilledWeight,
double? outProvinceKilledQuantity,
double? exportKilledWeight,
double? exportKilledQuantity,
double? totalCommitment,
String? commitmentType,
double? totalCommitmentQuantity,
double? totalFreeCommitmentQuantity,
double? totalFreeCommitmentWeight,
double? totalKilledWeight,
double? totalAverageKilledWeight,
int? requestLeftOver,
int? hall,
String? date,
dynamic predicateDate,
String? chickenBreed,
int? period,
String? allowHatching,
String? state,
bool? archive,
bool? violation,
dynamic message,
Registrar? registrar,
List<Breed>? breed,
int? cityNumber,
String? cityName,
int? provinceNumber,
String? provinceName,
LastChange? lastChange,
int? chickenAge,
int? nowAge,
LatestHatchingChange? latestHatchingChange,
String? violationReport,
String? violationMessage,
List<String>? violationImage,
String? violationReporter,
String? violationReportDate,
String? violationReportEditor,
String? violationReportEditDate,
int? totalLosses,
int? directLosses,
String? directLossesInputer,
String? directLossesDate,
String? directLossesEditor,
String? directLossesLastEditDate,
String? endPeriodLossesInputer,
String? endPeriodLossesDate,
String? endPeriodLossesEditor,
String? endPeriodLossesLastEditDate,
String? breedingUniqueId,
String? licenceNumber,
bool? temporaryTrash,
bool? temporaryDeleted,
dynamic firstDateInputArchive,
dynamic secondDateInputArchive,
dynamic inputArchiver,
dynamic outputArchiveDate,
dynamic outputArchiver,
double? barDifferenceRequestWeight,
double? barDifferenceRequestQuantity,
dynamic healthCertificate,
int? samasatDischargePercentage,
dynamic personTypeName,
String? interactTypeName,
dynamic unionTypeName,
dynamic certId,
int? increaseQuantity,
String? tenantFullname,
String? tenantNationalCode,
String? tenantMobile,
String? tenantCity,
bool? hasTenant,
dynamic archiveDate,
dynamic createdBy,
dynamic modifiedBy,
}) = _PoultryHatching;
factory PoultryHatching.fromJson(Map<String, dynamic> json) =>
_$PoultryHatchingFromJson(json);
}
// Sub models
@freezed
abstract class Poultry with _$Poultry {
const factory Poultry({
UserProfile? userprofile,
Address? address,
dynamic poultryOwner,
PoultryTenant? poultryTenant,
List<Hatching>? hatching,
List<int>? registerVetHalls,
Allow? allow,
ProvinceAllowChooseKillHouse? provinceAllowChooseKillHouse,
bool? provinceAllowSellFree,
VetFarm? vetFarm,
LastHatchingDiffrentRequestQuantity? lastHatchingDiffrentRequestQuantity,
UserBankInfo? userBankInfo,
int? leftOverOwnHatching,
String? key,
bool? trash,
int? ownerIdForeignKey,
int? userIdForeignKey,
int? addressIdForeignKey,
bool? hasChainCompany,
int? userBankIdForeignKey,
String? cityOperator,
String? unitName,
String? gisCode,
int? operatingLicenceCapacity,
int? numberOfHalls,
bool? tenant,
bool? hasTenant,
dynamic personType,
dynamic economicCode,
String? systemCode,
String? epidemiologicalCode,
String? breedingUniqueId,
int? totalCapacity,
String? licenceNumber,
String? healthCertificateNumber,
int? numberOfRequests,
String? hatchingDate,
String? lastPartyDate,
int? numberOfIncubators,
int? herdAgeByDay,
int? herdAgeByWeek,
int? numberOfParty,
dynamic communicationType,
dynamic cooperative,
String? dateOfRegister,
dynamic unitStatus,
bool? active,
dynamic identityDocuments,
dynamic samasatUserCode,
dynamic baseOrder,
String? incubationDate,
int? walletAmount,
int? city,
int? cityNumber,
String? cityName,
int? provinceNumber,
String? provinceName,
int? walletIdForeignKey,
int? poultryIdKey,
double? lat,
double? long,
dynamic date,
int? killingAveAge,
int? activeLeftOver,
int? killingAveCount,
int? killingAveWeight,
int? killingLiveWeight,
int? killingCarcassesWeight,
int? killingLossWeightPercent,
double? realKillingAveWeight,
double? realKillingLiveWeight,
double? realKillingCarcassesWeight,
double? realKillingLossWeightPercent,
dynamic interestLicenseId,
bool? orderLimit,
dynamic owner,
int? wallet,
}) = _Poultry;
factory Poultry.fromJson(Map<String, dynamic> json) =>
_$PoultryFromJson(json);
}
@freezed
abstract class UserProfile with _$UserProfile {
const factory UserProfile({
String? userKey,
int? baseOrder,
String? fullName,
String? mobile,
String? city,
String? province,
String? breedingUniqueId,
}) = _UserProfile;
factory UserProfile.fromJson(Map<String, dynamic> json) =>
_$UserProfileFromJson(json);
}
@freezed
abstract class Address with _$Address {
const factory Address({
Province? province,
City? city,
String? address,
String? postalCode,
}) = _Address;
factory Address.fromJson(Map<String, dynamic> json) =>
_$AddressFromJson(json);
}
@freezed
abstract class Province with _$Province {
const factory Province({
String? key,
String? name,
}) = _Province;
factory Province.fromJson(Map<String, dynamic> json) =>
_$ProvinceFromJson(json);
}
@freezed
abstract class City with _$City {
const factory City({
String? key,
String? name,
}) = _City;
factory City.fromJson(Map<String, dynamic> json) => _$CityFromJson(json);
}
@freezed
abstract class PoultryTenant with _$PoultryTenant {
const factory PoultryTenant({
String? key,
String? firstName,
String? lastName,
String? fullName,
String? mobile,
String? nationalId,
String? breedingUniqueId,
}) = _PoultryTenant;
factory PoultryTenant.fromJson(Map<String, dynamic> json) =>
_$PoultryTenantFromJson(json);
}
@freezed
abstract class Hatching with _$Hatching {
const factory Hatching({
String? poultryKey,
String? poultryHatchingKey,
String? poultry,
int? quantity,
int? losses,
int? leftOver,
double? outProvinceKilledQuantity,
double? exportKilledQuantity,
int? hall,
String? date,
int? period,
String? state,
int? age,
}) = _Hatching;
factory Hatching.fromJson(Map<String, dynamic> json) =>
_$HatchingFromJson(json);
}
@freezed
abstract class Allow with _$Allow {
const factory Allow({
bool? city,
bool? province,
}) = _Allow;
factory Allow.fromJson(Map<String, dynamic> json) => _$AllowFromJson(json);
}
@freezed
abstract class ProvinceAllowChooseKillHouse with _$ProvinceAllowChooseKillHouse {
const factory ProvinceAllowChooseKillHouse({
bool? allowState,
bool? mandatory,
}) = _ProvinceAllowChooseKillHouse;
factory ProvinceAllowChooseKillHouse.fromJson(Map<String, dynamic> json) =>
_$ProvinceAllowChooseKillHouseFromJson(json);
}
@freezed
abstract class VetFarm with _$VetFarm {
const factory VetFarm({
String? fullName,
String? mobile,
String? city,
String? province,
String? vetFarmFullName,
String? vetFarmMobile,
}) = _VetFarm;
factory VetFarm.fromJson(Map<String, dynamic> json) =>
_$VetFarmFromJson(json);
}
@freezed
abstract class LastHatchingDiffrentRequestQuantity
with _$LastHatchingDiffrentRequestQuantity {
const factory LastHatchingDiffrentRequestQuantity({
dynamic leftExportQuantity,
double? leftPoultryOutProvince,
int? lastHatchingRemainQuantity,
}) = _LastHatchingDiffrentRequestQuantity;
factory LastHatchingDiffrentRequestQuantity.fromJson(
Map<String, dynamic> json) =>
_$LastHatchingDiffrentRequestQuantityFromJson(json);
}
@freezed
abstract class UserBankInfo with _$UserBankInfo {
const factory UserBankInfo({
String? key,
String? nameOfBankUser,
String? bankName,
String? card,
String? shaba,
String? account,
int? userBankIdKey,
String? provinceName,
}) = _UserBankInfo;
factory UserBankInfo.fromJson(Map<String, dynamic> json) =>
_$UserBankInfoFromJson(json);
}
@freezed
abstract class ChainCompany with _$ChainCompany {
const factory ChainCompany({
ChainUser? user,
dynamic userBankInfo,
String? key,
bool? trash,
String? name,
dynamic city,
dynamic province,
dynamic postalCode,
dynamic address,
int? wallet,
}) = _ChainCompany;
factory ChainCompany.fromJson(Map<String, dynamic> json) =>
_$ChainCompanyFromJson(json);
}
@freezed
abstract class ChainUser with _$ChainUser {
const factory ChainUser({
List<String>? role,
String? city,
String? province,
String? key,
String? userGateWayId,
dynamic userDjangoIdForeignKey,
dynamic provinceIdForeignKey,
dynamic cityIdForeignKey,
dynamic systemUserProfileIdKey,
String? fullname,
String? firstName,
String? lastName,
dynamic nationalCode,
dynamic nationalCodeImage,
String? nationalId,
String? mobile,
dynamic birthday,
dynamic image,
String? password,
bool? active,
ChainUserState? state,
int? baseOrder,
int? cityNumber,
String? cityName,
int? provinceNumber,
String? provinceName,
String? unitName,
String? unitNationalId,
String? unitRegistrationNumber,
String? unitEconomicalNumber,
String? unitProvince,
String? unitCity,
String? unitPostalCode,
String? unitAddress,
}) = _ChainUser;
factory ChainUser.fromJson(Map<String, dynamic> json) =>
_$ChainUserFromJson(json);
}
@freezed
abstract class ChainUserState with _$ChainUserState {
const factory ChainUserState({
String? city,
String? image,
String? mobile,
String? birthday,
String? province,
String? lastName,
String? firstName,
String? nationalId,
String? nationalCode,
}) = _ChainUserState;
factory ChainUserState.fromJson(Map<String, dynamic> json) =>
_$ChainUserStateFromJson(json);
}
@freezed
abstract class ActiveKill with _$ActiveKill {
const factory ActiveKill({
bool? activeKill,
int? countOfRequest,
}) = _ActiveKill;
factory ActiveKill.fromJson(Map<String, dynamic> json) =>
_$ActiveKillFromJson(json);
}
@freezed
abstract class KillingInfo with _$KillingInfo {
const factory KillingInfo({
String? violationMessage,
int? provinceKillRequests,
int? provinceKillRequestsQuantity,
double? provinceKillRequestsWeight,
int? killHouseRequests,
int? killHouseRequestsFirstQuantity,
double? killHouseRequestsFirstWeight,
int? barCompleteWithKillHouse,
int? acceptedRealQuantityFinal,
double? acceptedRealWightFinal,
int? wareHouseBars,
int? wareHouseBarsQuantity,
double? wareHouseBarsWeight,
double? wareHouseBarsWeightLose,
}) = _KillingInfo;
factory KillingInfo.fromJson(Map<String, dynamic> json) =>
_$KillingInfoFromJson(json);
}
@freezed
abstract class FreeGovernmentalInfo with _$FreeGovernmentalInfo {
const factory FreeGovernmentalInfo({
int? governmentalAllocatedQuantity,
double? totalCommitmentQuantity,
int? freeAllocatedQuantity,
double? totalFreeCommitmentQuantity,
int? leftTotalFreeCommitmentQuantity,
}) = _FreeGovernmentalInfo;
factory FreeGovernmentalInfo.fromJson(Map<String, dynamic> json) =>
_$FreeGovernmentalInfoFromJson(json);
}
@freezed
abstract class ManagementHatchingAgeRange with _$ManagementHatchingAgeRange {
const factory ManagementHatchingAgeRange({
double? fromWeight,
double? toWeight,
}) = _ManagementHatchingAgeRange;
factory ManagementHatchingAgeRange.fromJson(Map<String, dynamic> json) =>
_$ManagementHatchingAgeRangeFromJson(json);
}
@freezed
abstract class Registrar with _$Registrar {
const factory Registrar({
String? date,
String? role,
String? fullname,
}) = _Registrar;
factory Registrar.fromJson(Map<String, dynamic> json) =>
_$RegistrarFromJson(json);
}
@freezed
abstract class Breed with _$Breed {
const factory Breed({
String? breed,
int? mainQuantity,
int? remainQuantity,
}) = _Breed;
factory Breed.fromJson(Map<String, dynamic> json) => _$BreedFromJson(json);
}
@freezed
abstract class LastChange with _$LastChange {
const factory LastChange({
String? date,
String? role,
String? type,
String? fullName,
}) = _LastChange;
factory LastChange.fromJson(Map<String, dynamic> json) =>
_$LastChangeFromJson(json);
}
@freezed
abstract class LatestHatchingChange with _$LatestHatchingChange {
const factory LatestHatchingChange({
String? date,
String? role,
String? fullName,
}) = _LatestHatchingChange;
factory LatestHatchingChange.fromJson(Map<String, dynamic> json) =>
_$LatestHatchingChangeFromJson(json);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,929 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'poultry_hatching.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_PoultryHatching _$PoultryHatchingFromJson(
Map<String, dynamic> json,
) => _PoultryHatching(
id: (json['id'] as num?)?.toInt(),
poultry: json['poultry'] == null
? null
: Poultry.fromJson(json['poultry'] as Map<String, dynamic>),
chainCompany: json['chain_company'] == null
? null
: ChainCompany.fromJson(json['chain_company'] as Map<String, dynamic>),
age: (json['age'] as num?)?.toInt(),
inspectionLosses: json['inspection_losses'],
vetFarm: json['vet_farm'] == null
? null
: VetFarm.fromJson(json['vet_farm'] as Map<String, dynamic>),
activeKill: json['active_kill'] == null
? null
: ActiveKill.fromJson(json['active_kill'] as Map<String, dynamic>),
killingInfo: json['killing_info'] == null
? null
: KillingInfo.fromJson(json['killing_info'] as Map<String, dynamic>),
freeGovernmentalInfo: json['free_governmental_info'] == null
? null
: FreeGovernmentalInfo.fromJson(
json['free_governmental_info'] as Map<String, dynamic>,
),
managementHatchingAgeRange: json['management_hatching_age_range'] == null
? null
: ManagementHatchingAgeRange.fromJson(
json['management_hatching_age_range'] 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?,
hasChainCompany: json['has_chain_company'] as bool?,
poultryIdForeignKey: json['poultry_id_foreign_key'],
poultryHatchingIdKey: json['poultry_hatching_id_key'],
quantity: (json['quantity'] as num?)?.toInt(),
losses: (json['losses'] as num?)?.toInt(),
leftOver: (json['left_over'] as num?)?.toInt(),
killedQuantity: (json['killed_quantity'] as num?)?.toInt(),
extraKilledQuantity: (json['extra_killed_quantity'] as num?)?.toInt(),
governmentalKilledQuantity: (json['governmental_killed_quantity'] as num?)
?.toDouble(),
governmentalQuantity: (json['governmental_quantity'] as num?)?.toDouble(),
freeKilledQuantity: (json['free_killed_quantity'] as num?)?.toDouble(),
freeQuantity: (json['free_quantity'] as num?)?.toDouble(),
chainKilledQuantity: (json['chain_killed_quantity'] as num?)?.toDouble(),
chainKilledWeight: (json['chain_killed_weight'] as num?)?.toDouble(),
outProvinceKilledWeight: (json['out_province_killed_weight'] as num?)
?.toDouble(),
outProvinceKilledQuantity: (json['out_province_killed_quantity'] as num?)
?.toDouble(),
exportKilledWeight: (json['export_killed_weight'] as num?)?.toDouble(),
exportKilledQuantity: (json['export_killed_quantity'] as num?)?.toDouble(),
totalCommitment: (json['total_commitment'] as num?)?.toDouble(),
commitmentType: json['commitment_type'] as String?,
totalCommitmentQuantity: (json['total_commitment_quantity'] as num?)
?.toDouble(),
totalFreeCommitmentQuantity: (json['total_free_commitment_quantity'] as num?)
?.toDouble(),
totalFreeCommitmentWeight: (json['total_free_commitment_weight'] as num?)
?.toDouble(),
totalKilledWeight: (json['total_killed_weight'] as num?)?.toDouble(),
totalAverageKilledWeight: (json['total_average_killed_weight'] as num?)
?.toDouble(),
requestLeftOver: (json['request_left_over'] as num?)?.toInt(),
hall: (json['hall'] as num?)?.toInt(),
date: json['date'] as String?,
predicateDate: json['predicate_date'],
chickenBreed: json['chicken_breed'] as String?,
period: (json['period'] as num?)?.toInt(),
allowHatching: json['allow_hatching'] as String?,
state: json['state'] as String?,
archive: json['archive'] as bool?,
violation: json['violation'] as bool?,
message: json['message'],
registrar: json['registrar'] == null
? null
: Registrar.fromJson(json['registrar'] as Map<String, dynamic>),
breed: (json['breed'] as List<dynamic>?)
?.map((e) => Breed.fromJson(e as Map<String, dynamic>))
.toList(),
cityNumber: (json['city_number'] as num?)?.toInt(),
cityName: json['city_name'] as String?,
provinceNumber: (json['province_number'] as num?)?.toInt(),
provinceName: json['province_name'] as String?,
lastChange: json['last_change'] == null
? null
: LastChange.fromJson(json['last_change'] as Map<String, dynamic>),
chickenAge: (json['chicken_age'] as num?)?.toInt(),
nowAge: (json['now_age'] as num?)?.toInt(),
latestHatchingChange: json['latest_hatching_change'] == null
? null
: LatestHatchingChange.fromJson(
json['latest_hatching_change'] as Map<String, dynamic>,
),
violationReport: json['violation_report'] as String?,
violationMessage: json['violation_message'] as String?,
violationImage: (json['violation_image'] as List<dynamic>?)
?.map((e) => e as String)
.toList(),
violationReporter: json['violation_reporter'] as String?,
violationReportDate: json['violation_report_date'] as String?,
violationReportEditor: json['violation_report_editor'] as String?,
violationReportEditDate: json['violation_report_edit_date'] as String?,
totalLosses: (json['total_losses'] as num?)?.toInt(),
directLosses: (json['direct_losses'] as num?)?.toInt(),
directLossesInputer: json['direct_losses_inputer'] as String?,
directLossesDate: json['direct_losses_date'] as String?,
directLossesEditor: json['direct_losses_editor'] as String?,
directLossesLastEditDate: json['direct_losses_last_edit_date'] as String?,
endPeriodLossesInputer: json['end_period_losses_inputer'] as String?,
endPeriodLossesDate: json['end_period_losses_date'] as String?,
endPeriodLossesEditor: json['end_period_losses_editor'] as String?,
endPeriodLossesLastEditDate:
json['end_period_losses_last_edit_date'] as String?,
breedingUniqueId: json['breeding_unique_id'] as String?,
licenceNumber: json['licence_number'] as String?,
temporaryTrash: json['temporary_trash'] as bool?,
temporaryDeleted: json['temporary_deleted'] as bool?,
firstDateInputArchive: json['first_date_input_archive'],
secondDateInputArchive: json['second_date_input_archive'],
inputArchiver: json['input_archiver'],
outputArchiveDate: json['output_archive_date'],
outputArchiver: json['output_archiver'],
barDifferenceRequestWeight: (json['bar_difference_request_weight'] as num?)
?.toDouble(),
barDifferenceRequestQuantity:
(json['bar_difference_request_quantity'] as num?)?.toDouble(),
healthCertificate: json['health_certificate'],
samasatDischargePercentage: (json['samasat_discharge_percentage'] as num?)
?.toInt(),
personTypeName: json['person_type_name'],
interactTypeName: json['interact_type_name'] as String?,
unionTypeName: json['union_type_name'],
certId: json['cert_id'],
increaseQuantity: (json['increase_quantity'] as num?)?.toInt(),
tenantFullname: json['tenant_fullname'] as String?,
tenantNationalCode: json['tenant_national_code'] as String?,
tenantMobile: json['tenant_mobile'] as String?,
tenantCity: json['tenant_city'] as String?,
hasTenant: json['has_tenant'] as bool?,
archiveDate: json['archive_date'],
createdBy: json['created_by'],
modifiedBy: json['modified_by'],
);
Map<String, dynamic> _$PoultryHatchingToJson(_PoultryHatching instance) =>
<String, dynamic>{
'id': instance.id,
'poultry': instance.poultry,
'chain_company': instance.chainCompany,
'age': instance.age,
'inspection_losses': instance.inspectionLosses,
'vet_farm': instance.vetFarm,
'active_kill': instance.activeKill,
'killing_info': instance.killingInfo,
'free_governmental_info': instance.freeGovernmentalInfo,
'management_hatching_age_range': instance.managementHatchingAgeRange,
'key': instance.key,
'create_date': instance.createDate,
'modify_date': instance.modifyDate,
'trash': instance.trash,
'has_chain_company': instance.hasChainCompany,
'poultry_id_foreign_key': instance.poultryIdForeignKey,
'poultry_hatching_id_key': instance.poultryHatchingIdKey,
'quantity': instance.quantity,
'losses': instance.losses,
'left_over': instance.leftOver,
'killed_quantity': instance.killedQuantity,
'extra_killed_quantity': instance.extraKilledQuantity,
'governmental_killed_quantity': instance.governmentalKilledQuantity,
'governmental_quantity': instance.governmentalQuantity,
'free_killed_quantity': instance.freeKilledQuantity,
'free_quantity': instance.freeQuantity,
'chain_killed_quantity': instance.chainKilledQuantity,
'chain_killed_weight': instance.chainKilledWeight,
'out_province_killed_weight': instance.outProvinceKilledWeight,
'out_province_killed_quantity': instance.outProvinceKilledQuantity,
'export_killed_weight': instance.exportKilledWeight,
'export_killed_quantity': instance.exportKilledQuantity,
'total_commitment': instance.totalCommitment,
'commitment_type': instance.commitmentType,
'total_commitment_quantity': instance.totalCommitmentQuantity,
'total_free_commitment_quantity': instance.totalFreeCommitmentQuantity,
'total_free_commitment_weight': instance.totalFreeCommitmentWeight,
'total_killed_weight': instance.totalKilledWeight,
'total_average_killed_weight': instance.totalAverageKilledWeight,
'request_left_over': instance.requestLeftOver,
'hall': instance.hall,
'date': instance.date,
'predicate_date': instance.predicateDate,
'chicken_breed': instance.chickenBreed,
'period': instance.period,
'allow_hatching': instance.allowHatching,
'state': instance.state,
'archive': instance.archive,
'violation': instance.violation,
'message': instance.message,
'registrar': instance.registrar,
'breed': instance.breed,
'city_number': instance.cityNumber,
'city_name': instance.cityName,
'province_number': instance.provinceNumber,
'province_name': instance.provinceName,
'last_change': instance.lastChange,
'chicken_age': instance.chickenAge,
'now_age': instance.nowAge,
'latest_hatching_change': instance.latestHatchingChange,
'violation_report': instance.violationReport,
'violation_message': instance.violationMessage,
'violation_image': instance.violationImage,
'violation_reporter': instance.violationReporter,
'violation_report_date': instance.violationReportDate,
'violation_report_editor': instance.violationReportEditor,
'violation_report_edit_date': instance.violationReportEditDate,
'total_losses': instance.totalLosses,
'direct_losses': instance.directLosses,
'direct_losses_inputer': instance.directLossesInputer,
'direct_losses_date': instance.directLossesDate,
'direct_losses_editor': instance.directLossesEditor,
'direct_losses_last_edit_date': instance.directLossesLastEditDate,
'end_period_losses_inputer': instance.endPeriodLossesInputer,
'end_period_losses_date': instance.endPeriodLossesDate,
'end_period_losses_editor': instance.endPeriodLossesEditor,
'end_period_losses_last_edit_date': instance.endPeriodLossesLastEditDate,
'breeding_unique_id': instance.breedingUniqueId,
'licence_number': instance.licenceNumber,
'temporary_trash': instance.temporaryTrash,
'temporary_deleted': instance.temporaryDeleted,
'first_date_input_archive': instance.firstDateInputArchive,
'second_date_input_archive': instance.secondDateInputArchive,
'input_archiver': instance.inputArchiver,
'output_archive_date': instance.outputArchiveDate,
'output_archiver': instance.outputArchiver,
'bar_difference_request_weight': instance.barDifferenceRequestWeight,
'bar_difference_request_quantity': instance.barDifferenceRequestQuantity,
'health_certificate': instance.healthCertificate,
'samasat_discharge_percentage': instance.samasatDischargePercentage,
'person_type_name': instance.personTypeName,
'interact_type_name': instance.interactTypeName,
'union_type_name': instance.unionTypeName,
'cert_id': instance.certId,
'increase_quantity': instance.increaseQuantity,
'tenant_fullname': instance.tenantFullname,
'tenant_national_code': instance.tenantNationalCode,
'tenant_mobile': instance.tenantMobile,
'tenant_city': instance.tenantCity,
'has_tenant': instance.hasTenant,
'archive_date': instance.archiveDate,
'created_by': instance.createdBy,
'modified_by': instance.modifiedBy,
};
_Poultry _$PoultryFromJson(Map<String, dynamic> json) => _Poultry(
userprofile: json['userprofile'] == null
? null
: UserProfile.fromJson(json['userprofile'] as Map<String, dynamic>),
address: json['address'] == null
? null
: Address.fromJson(json['address'] as Map<String, dynamic>),
poultryOwner: json['poultry_owner'],
poultryTenant: json['poultry_tenant'] == null
? null
: PoultryTenant.fromJson(json['poultry_tenant'] as Map<String, dynamic>),
hatching: (json['hatching'] as List<dynamic>?)
?.map((e) => Hatching.fromJson(e as Map<String, dynamic>))
.toList(),
registerVetHalls: (json['register_vet_halls'] as List<dynamic>?)
?.map((e) => (e as num).toInt())
.toList(),
allow: json['allow'] == null
? null
: Allow.fromJson(json['allow'] as Map<String, dynamic>),
provinceAllowChooseKillHouse: json['province_allow_choose_kill_house'] == null
? null
: ProvinceAllowChooseKillHouse.fromJson(
json['province_allow_choose_kill_house'] as Map<String, dynamic>,
),
provinceAllowSellFree: json['province_allow_sell_free'] as bool?,
vetFarm: json['vet_farm'] == null
? null
: VetFarm.fromJson(json['vet_farm'] as Map<String, dynamic>),
lastHatchingDiffrentRequestQuantity:
json['last_hatching_diffrent_request_quantity'] == null
? null
: LastHatchingDiffrentRequestQuantity.fromJson(
json['last_hatching_diffrent_request_quantity']
as Map<String, dynamic>,
),
userBankInfo: json['user_bank_info'] == null
? null
: UserBankInfo.fromJson(json['user_bank_info'] as Map<String, dynamic>),
leftOverOwnHatching: (json['left_over_own_hatching'] as num?)?.toInt(),
key: json['key'] as String?,
trash: json['trash'] as bool?,
ownerIdForeignKey: (json['owner_id_foreign_key'] as num?)?.toInt(),
userIdForeignKey: (json['user_id_foreign_key'] as num?)?.toInt(),
addressIdForeignKey: (json['address_id_foreign_key'] as num?)?.toInt(),
hasChainCompany: json['has_chain_company'] as bool?,
userBankIdForeignKey: (json['user_bank_id_foreign_key'] as num?)?.toInt(),
cityOperator: json['city_operator'] as String?,
unitName: json['unit_name'] as String?,
gisCode: json['gis_code'] as String?,
operatingLicenceCapacity: (json['operating_licence_capacity'] as num?)
?.toInt(),
numberOfHalls: (json['number_of_halls'] as num?)?.toInt(),
tenant: json['tenant'] as bool?,
hasTenant: json['has_tenant'] as bool?,
personType: json['person_type'],
economicCode: json['economic_code'],
systemCode: json['system_code'] as String?,
epidemiologicalCode: json['epidemiological_code'] as String?,
breedingUniqueId: json['breeding_unique_id'] as String?,
totalCapacity: (json['total_capacity'] as num?)?.toInt(),
licenceNumber: json['licence_number'] as String?,
healthCertificateNumber: json['health_certificate_number'] as String?,
numberOfRequests: (json['number_of_requests'] as num?)?.toInt(),
hatchingDate: json['hatching_date'] as String?,
lastPartyDate: json['last_party_date'] as String?,
numberOfIncubators: (json['number_of_incubators'] as num?)?.toInt(),
herdAgeByDay: (json['herd_age_by_day'] as num?)?.toInt(),
herdAgeByWeek: (json['herd_age_by_week'] as num?)?.toInt(),
numberOfParty: (json['number_of_party'] as num?)?.toInt(),
communicationType: json['communication_type'],
cooperative: json['cooperative'],
dateOfRegister: json['date_of_register'] as String?,
unitStatus: json['unit_status'],
active: json['active'] as bool?,
identityDocuments: json['identity_documents'],
samasatUserCode: json['samasat_user_code'],
baseOrder: json['base_order'],
incubationDate: json['incubation_date'] as String?,
walletAmount: (json['wallet_amount'] as num?)?.toInt(),
city: (json['city'] as num?)?.toInt(),
cityNumber: (json['city_number'] as num?)?.toInt(),
cityName: json['city_name'] as String?,
provinceNumber: (json['province_number'] as num?)?.toInt(),
provinceName: json['province_name'] as String?,
walletIdForeignKey: (json['wallet_id_foreign_key'] as num?)?.toInt(),
poultryIdKey: (json['poultry_id_key'] as num?)?.toInt(),
lat: (json['lat'] as num?)?.toDouble(),
long: (json['long'] as num?)?.toDouble(),
date: json['date'],
killingAveAge: (json['killing_ave_age'] as num?)?.toInt(),
activeLeftOver: (json['active_left_over'] as num?)?.toInt(),
killingAveCount: (json['killing_ave_count'] as num?)?.toInt(),
killingAveWeight: (json['killing_ave_weight'] as num?)?.toInt(),
killingLiveWeight: (json['killing_live_weight'] as num?)?.toInt(),
killingCarcassesWeight: (json['killing_carcasses_weight'] as num?)?.toInt(),
killingLossWeightPercent: (json['killing_loss_weight_percent'] as num?)
?.toInt(),
realKillingAveWeight: (json['real_killing_ave_weight'] as num?)?.toDouble(),
realKillingLiveWeight: (json['real_killing_live_weight'] as num?)?.toDouble(),
realKillingCarcassesWeight: (json['real_killing_carcasses_weight'] as num?)
?.toDouble(),
realKillingLossWeightPercent:
(json['real_killing_loss_weight_percent'] as num?)?.toDouble(),
interestLicenseId: json['interest_license_id'],
orderLimit: json['order_limit'] as bool?,
owner: json['owner'],
wallet: (json['wallet'] as num?)?.toInt(),
);
Map<String, dynamic> _$PoultryToJson(_Poultry instance) => <String, dynamic>{
'userprofile': instance.userprofile,
'address': instance.address,
'poultry_owner': instance.poultryOwner,
'poultry_tenant': instance.poultryTenant,
'hatching': instance.hatching,
'register_vet_halls': instance.registerVetHalls,
'allow': instance.allow,
'province_allow_choose_kill_house': instance.provinceAllowChooseKillHouse,
'province_allow_sell_free': instance.provinceAllowSellFree,
'vet_farm': instance.vetFarm,
'last_hatching_diffrent_request_quantity':
instance.lastHatchingDiffrentRequestQuantity,
'user_bank_info': instance.userBankInfo,
'left_over_own_hatching': instance.leftOverOwnHatching,
'key': instance.key,
'trash': instance.trash,
'owner_id_foreign_key': instance.ownerIdForeignKey,
'user_id_foreign_key': instance.userIdForeignKey,
'address_id_foreign_key': instance.addressIdForeignKey,
'has_chain_company': instance.hasChainCompany,
'user_bank_id_foreign_key': instance.userBankIdForeignKey,
'city_operator': instance.cityOperator,
'unit_name': instance.unitName,
'gis_code': instance.gisCode,
'operating_licence_capacity': instance.operatingLicenceCapacity,
'number_of_halls': instance.numberOfHalls,
'tenant': instance.tenant,
'has_tenant': instance.hasTenant,
'person_type': instance.personType,
'economic_code': instance.economicCode,
'system_code': instance.systemCode,
'epidemiological_code': instance.epidemiologicalCode,
'breeding_unique_id': instance.breedingUniqueId,
'total_capacity': instance.totalCapacity,
'licence_number': instance.licenceNumber,
'health_certificate_number': instance.healthCertificateNumber,
'number_of_requests': instance.numberOfRequests,
'hatching_date': instance.hatchingDate,
'last_party_date': instance.lastPartyDate,
'number_of_incubators': instance.numberOfIncubators,
'herd_age_by_day': instance.herdAgeByDay,
'herd_age_by_week': instance.herdAgeByWeek,
'number_of_party': instance.numberOfParty,
'communication_type': instance.communicationType,
'cooperative': instance.cooperative,
'date_of_register': instance.dateOfRegister,
'unit_status': instance.unitStatus,
'active': instance.active,
'identity_documents': instance.identityDocuments,
'samasat_user_code': instance.samasatUserCode,
'base_order': instance.baseOrder,
'incubation_date': instance.incubationDate,
'wallet_amount': instance.walletAmount,
'city': instance.city,
'city_number': instance.cityNumber,
'city_name': instance.cityName,
'province_number': instance.provinceNumber,
'province_name': instance.provinceName,
'wallet_id_foreign_key': instance.walletIdForeignKey,
'poultry_id_key': instance.poultryIdKey,
'lat': instance.lat,
'long': instance.long,
'date': instance.date,
'killing_ave_age': instance.killingAveAge,
'active_left_over': instance.activeLeftOver,
'killing_ave_count': instance.killingAveCount,
'killing_ave_weight': instance.killingAveWeight,
'killing_live_weight': instance.killingLiveWeight,
'killing_carcasses_weight': instance.killingCarcassesWeight,
'killing_loss_weight_percent': instance.killingLossWeightPercent,
'real_killing_ave_weight': instance.realKillingAveWeight,
'real_killing_live_weight': instance.realKillingLiveWeight,
'real_killing_carcasses_weight': instance.realKillingCarcassesWeight,
'real_killing_loss_weight_percent': instance.realKillingLossWeightPercent,
'interest_license_id': instance.interestLicenseId,
'order_limit': instance.orderLimit,
'owner': instance.owner,
'wallet': instance.wallet,
};
_UserProfile _$UserProfileFromJson(Map<String, dynamic> json) => _UserProfile(
userKey: json['user_key'] as String?,
baseOrder: (json['base_order'] as num?)?.toInt(),
fullName: json['full_name'] as String?,
mobile: json['mobile'] as String?,
city: json['city'] as String?,
province: json['province'] as String?,
breedingUniqueId: json['breeding_unique_id'] as String?,
);
Map<String, dynamic> _$UserProfileToJson(_UserProfile instance) =>
<String, dynamic>{
'user_key': instance.userKey,
'base_order': instance.baseOrder,
'full_name': instance.fullName,
'mobile': instance.mobile,
'city': instance.city,
'province': instance.province,
'breeding_unique_id': instance.breedingUniqueId,
};
_Address _$AddressFromJson(Map<String, dynamic> json) => _Address(
province: json['province'] == null
? null
: Province.fromJson(json['province'] as Map<String, dynamic>),
city: json['city'] == null
? null
: City.fromJson(json['city'] as Map<String, dynamic>),
address: json['address'] as String?,
postalCode: json['postal_code'] as String?,
);
Map<String, dynamic> _$AddressToJson(_Address instance) => <String, dynamic>{
'province': instance.province,
'city': instance.city,
'address': instance.address,
'postal_code': instance.postalCode,
};
_Province _$ProvinceFromJson(Map<String, dynamic> json) =>
_Province(key: json['key'] as String?, name: json['name'] as String?);
Map<String, dynamic> _$ProvinceToJson(_Province instance) => <String, dynamic>{
'key': instance.key,
'name': instance.name,
};
_City _$CityFromJson(Map<String, dynamic> json) =>
_City(key: json['key'] as String?, name: json['name'] as String?);
Map<String, dynamic> _$CityToJson(_City instance) => <String, dynamic>{
'key': instance.key,
'name': instance.name,
};
_PoultryTenant _$PoultryTenantFromJson(Map<String, dynamic> json) =>
_PoultryTenant(
key: json['key'] as String?,
firstName: json['first_name'] as String?,
lastName: json['last_name'] as String?,
fullName: json['full_name'] as String?,
mobile: json['mobile'] as String?,
nationalId: json['national_id'] as String?,
breedingUniqueId: json['breeding_unique_id'] as String?,
);
Map<String, dynamic> _$PoultryTenantToJson(_PoultryTenant instance) =>
<String, dynamic>{
'key': instance.key,
'first_name': instance.firstName,
'last_name': instance.lastName,
'full_name': instance.fullName,
'mobile': instance.mobile,
'national_id': instance.nationalId,
'breeding_unique_id': instance.breedingUniqueId,
};
_Hatching _$HatchingFromJson(Map<String, dynamic> json) => _Hatching(
poultryKey: json['poultry_key'] as String?,
poultryHatchingKey: json['poultry_hatching_key'] as String?,
poultry: json['poultry'] as String?,
quantity: (json['quantity'] as num?)?.toInt(),
losses: (json['losses'] as num?)?.toInt(),
leftOver: (json['left_over'] as num?)?.toInt(),
outProvinceKilledQuantity: (json['out_province_killed_quantity'] as num?)
?.toDouble(),
exportKilledQuantity: (json['export_killed_quantity'] as num?)?.toDouble(),
hall: (json['hall'] as num?)?.toInt(),
date: json['date'] as String?,
period: (json['period'] as num?)?.toInt(),
state: json['state'] as String?,
age: (json['age'] as num?)?.toInt(),
);
Map<String, dynamic> _$HatchingToJson(_Hatching instance) => <String, dynamic>{
'poultry_key': instance.poultryKey,
'poultry_hatching_key': instance.poultryHatchingKey,
'poultry': instance.poultry,
'quantity': instance.quantity,
'losses': instance.losses,
'left_over': instance.leftOver,
'out_province_killed_quantity': instance.outProvinceKilledQuantity,
'export_killed_quantity': instance.exportKilledQuantity,
'hall': instance.hall,
'date': instance.date,
'period': instance.period,
'state': instance.state,
'age': instance.age,
};
_Allow _$AllowFromJson(Map<String, dynamic> json) =>
_Allow(city: json['city'] as bool?, province: json['province'] as bool?);
Map<String, dynamic> _$AllowToJson(_Allow instance) => <String, dynamic>{
'city': instance.city,
'province': instance.province,
};
_ProvinceAllowChooseKillHouse _$ProvinceAllowChooseKillHouseFromJson(
Map<String, dynamic> json,
) => _ProvinceAllowChooseKillHouse(
allowState: json['allow_state'] as bool?,
mandatory: json['mandatory'] as bool?,
);
Map<String, dynamic> _$ProvinceAllowChooseKillHouseToJson(
_ProvinceAllowChooseKillHouse instance,
) => <String, dynamic>{
'allow_state': instance.allowState,
'mandatory': instance.mandatory,
};
_VetFarm _$VetFarmFromJson(Map<String, dynamic> json) => _VetFarm(
fullName: json['full_name'] as String?,
mobile: json['mobile'] as String?,
city: json['city'] as String?,
province: json['province'] as String?,
vetFarmFullName: json['vet_farm_full_name'] as String?,
vetFarmMobile: json['vet_farm_mobile'] as String?,
);
Map<String, dynamic> _$VetFarmToJson(_VetFarm instance) => <String, dynamic>{
'full_name': instance.fullName,
'mobile': instance.mobile,
'city': instance.city,
'province': instance.province,
'vet_farm_full_name': instance.vetFarmFullName,
'vet_farm_mobile': instance.vetFarmMobile,
};
_LastHatchingDiffrentRequestQuantity
_$LastHatchingDiffrentRequestQuantityFromJson(Map<String, dynamic> json) =>
_LastHatchingDiffrentRequestQuantity(
leftExportQuantity: json['left_export_quantity'],
leftPoultryOutProvince: (json['left_poultry_out_province'] as num?)
?.toDouble(),
lastHatchingRemainQuantity:
(json['last_hatching_remain_quantity'] as num?)?.toInt(),
);
Map<String, dynamic> _$LastHatchingDiffrentRequestQuantityToJson(
_LastHatchingDiffrentRequestQuantity instance,
) => <String, dynamic>{
'left_export_quantity': instance.leftExportQuantity,
'left_poultry_out_province': instance.leftPoultryOutProvince,
'last_hatching_remain_quantity': instance.lastHatchingRemainQuantity,
};
_UserBankInfo _$UserBankInfoFromJson(Map<String, dynamic> json) =>
_UserBankInfo(
key: json['key'] as String?,
nameOfBankUser: json['name_of_bank_user'] as String?,
bankName: json['bank_name'] as String?,
card: json['card'] as String?,
shaba: json['shaba'] as String?,
account: json['account'] as String?,
userBankIdKey: (json['user_bank_id_key'] as num?)?.toInt(),
provinceName: json['province_name'] as String?,
);
Map<String, dynamic> _$UserBankInfoToJson(_UserBankInfo instance) =>
<String, dynamic>{
'key': instance.key,
'name_of_bank_user': instance.nameOfBankUser,
'bank_name': instance.bankName,
'card': instance.card,
'shaba': instance.shaba,
'account': instance.account,
'user_bank_id_key': instance.userBankIdKey,
'province_name': instance.provinceName,
};
_ChainCompany _$ChainCompanyFromJson(Map<String, dynamic> json) =>
_ChainCompany(
user: json['user'] == null
? null
: ChainUser.fromJson(json['user'] as Map<String, dynamic>),
userBankInfo: json['user_bank_info'],
key: json['key'] as String?,
trash: json['trash'] as bool?,
name: json['name'] as String?,
city: json['city'],
province: json['province'],
postalCode: json['postal_code'],
address: json['address'],
wallet: (json['wallet'] as num?)?.toInt(),
);
Map<String, dynamic> _$ChainCompanyToJson(_ChainCompany instance) =>
<String, dynamic>{
'user': instance.user,
'user_bank_info': instance.userBankInfo,
'key': instance.key,
'trash': instance.trash,
'name': instance.name,
'city': instance.city,
'province': instance.province,
'postal_code': instance.postalCode,
'address': instance.address,
'wallet': instance.wallet,
};
_ChainUser _$ChainUserFromJson(Map<String, dynamic> json) => _ChainUser(
role: (json['role'] as List<dynamic>?)?.map((e) => e as String).toList(),
city: json['city'] as String?,
province: json['province'] as String?,
key: json['key'] as String?,
userGateWayId: json['user_gate_way_id'] as String?,
userDjangoIdForeignKey: json['user_django_id_foreign_key'],
provinceIdForeignKey: json['province_id_foreign_key'],
cityIdForeignKey: json['city_id_foreign_key'],
systemUserProfileIdKey: json['system_user_profile_id_key'],
fullname: json['fullname'] as String?,
firstName: json['first_name'] as String?,
lastName: json['last_name'] as String?,
nationalCode: json['national_code'],
nationalCodeImage: json['national_code_image'],
nationalId: json['national_id'] as String?,
mobile: json['mobile'] as String?,
birthday: json['birthday'],
image: json['image'],
password: json['password'] as String?,
active: json['active'] as bool?,
state: json['state'] == null
? null
: ChainUserState.fromJson(json['state'] as Map<String, dynamic>),
baseOrder: (json['base_order'] as num?)?.toInt(),
cityNumber: (json['city_number'] as num?)?.toInt(),
cityName: json['city_name'] as String?,
provinceNumber: (json['province_number'] as num?)?.toInt(),
provinceName: json['province_name'] as String?,
unitName: json['unit_name'] as String?,
unitNationalId: json['unit_national_id'] as String?,
unitRegistrationNumber: json['unit_registration_number'] as String?,
unitEconomicalNumber: json['unit_economical_number'] as String?,
unitProvince: json['unit_province'] as String?,
unitCity: json['unit_city'] as String?,
unitPostalCode: json['unit_postal_code'] as String?,
unitAddress: json['unit_address'] as String?,
);
Map<String, dynamic> _$ChainUserToJson(_ChainUser instance) =>
<String, dynamic>{
'role': instance.role,
'city': instance.city,
'province': instance.province,
'key': instance.key,
'user_gate_way_id': instance.userGateWayId,
'user_django_id_foreign_key': instance.userDjangoIdForeignKey,
'province_id_foreign_key': instance.provinceIdForeignKey,
'city_id_foreign_key': instance.cityIdForeignKey,
'system_user_profile_id_key': instance.systemUserProfileIdKey,
'fullname': instance.fullname,
'first_name': instance.firstName,
'last_name': instance.lastName,
'national_code': instance.nationalCode,
'national_code_image': instance.nationalCodeImage,
'national_id': instance.nationalId,
'mobile': instance.mobile,
'birthday': instance.birthday,
'image': instance.image,
'password': instance.password,
'active': instance.active,
'state': instance.state,
'base_order': instance.baseOrder,
'city_number': instance.cityNumber,
'city_name': instance.cityName,
'province_number': instance.provinceNumber,
'province_name': instance.provinceName,
'unit_name': instance.unitName,
'unit_national_id': instance.unitNationalId,
'unit_registration_number': instance.unitRegistrationNumber,
'unit_economical_number': instance.unitEconomicalNumber,
'unit_province': instance.unitProvince,
'unit_city': instance.unitCity,
'unit_postal_code': instance.unitPostalCode,
'unit_address': instance.unitAddress,
};
_ChainUserState _$ChainUserStateFromJson(Map<String, dynamic> json) =>
_ChainUserState(
city: json['city'] as String?,
image: json['image'] as String?,
mobile: json['mobile'] as String?,
birthday: json['birthday'] as String?,
province: json['province'] as String?,
lastName: json['last_name'] as String?,
firstName: json['first_name'] as String?,
nationalId: json['national_id'] as String?,
nationalCode: json['national_code'] as String?,
);
Map<String, dynamic> _$ChainUserStateToJson(_ChainUserState instance) =>
<String, dynamic>{
'city': instance.city,
'image': instance.image,
'mobile': instance.mobile,
'birthday': instance.birthday,
'province': instance.province,
'last_name': instance.lastName,
'first_name': instance.firstName,
'national_id': instance.nationalId,
'national_code': instance.nationalCode,
};
_ActiveKill _$ActiveKillFromJson(Map<String, dynamic> json) => _ActiveKill(
activeKill: json['active_kill'] as bool?,
countOfRequest: (json['count_of_request'] as num?)?.toInt(),
);
Map<String, dynamic> _$ActiveKillToJson(_ActiveKill instance) =>
<String, dynamic>{
'active_kill': instance.activeKill,
'count_of_request': instance.countOfRequest,
};
_KillingInfo _$KillingInfoFromJson(Map<String, dynamic> json) => _KillingInfo(
violationMessage: json['violation_message'] as String?,
provinceKillRequests: (json['province_kill_requests'] as num?)?.toInt(),
provinceKillRequestsQuantity:
(json['province_kill_requests_quantity'] as num?)?.toInt(),
provinceKillRequestsWeight: (json['province_kill_requests_weight'] as num?)
?.toDouble(),
killHouseRequests: (json['kill_house_requests'] as num?)?.toInt(),
killHouseRequestsFirstQuantity:
(json['kill_house_requests_first_quantity'] as num?)?.toInt(),
killHouseRequestsFirstWeight:
(json['kill_house_requests_first_weight'] as num?)?.toDouble(),
barCompleteWithKillHouse: (json['bar_complete_with_kill_house'] as num?)
?.toInt(),
acceptedRealQuantityFinal: (json['accepted_real_quantity_final'] as num?)
?.toInt(),
acceptedRealWightFinal: (json['accepted_real_wight_final'] as num?)
?.toDouble(),
wareHouseBars: (json['ware_house_bars'] as num?)?.toInt(),
wareHouseBarsQuantity: (json['ware_house_bars_quantity'] as num?)?.toInt(),
wareHouseBarsWeight: (json['ware_house_bars_weight'] as num?)?.toDouble(),
wareHouseBarsWeightLose: (json['ware_house_bars_weight_lose'] as num?)
?.toDouble(),
);
Map<String, dynamic> _$KillingInfoToJson(
_KillingInfo instance,
) => <String, dynamic>{
'violation_message': instance.violationMessage,
'province_kill_requests': instance.provinceKillRequests,
'province_kill_requests_quantity': instance.provinceKillRequestsQuantity,
'province_kill_requests_weight': instance.provinceKillRequestsWeight,
'kill_house_requests': instance.killHouseRequests,
'kill_house_requests_first_quantity': instance.killHouseRequestsFirstQuantity,
'kill_house_requests_first_weight': instance.killHouseRequestsFirstWeight,
'bar_complete_with_kill_house': instance.barCompleteWithKillHouse,
'accepted_real_quantity_final': instance.acceptedRealQuantityFinal,
'accepted_real_wight_final': instance.acceptedRealWightFinal,
'ware_house_bars': instance.wareHouseBars,
'ware_house_bars_quantity': instance.wareHouseBarsQuantity,
'ware_house_bars_weight': instance.wareHouseBarsWeight,
'ware_house_bars_weight_lose': instance.wareHouseBarsWeightLose,
};
_FreeGovernmentalInfo _$FreeGovernmentalInfoFromJson(
Map<String, dynamic> json,
) => _FreeGovernmentalInfo(
governmentalAllocatedQuantity:
(json['governmental_allocated_quantity'] as num?)?.toInt(),
totalCommitmentQuantity: (json['total_commitment_quantity'] as num?)
?.toDouble(),
freeAllocatedQuantity: (json['free_allocated_quantity'] as num?)?.toInt(),
totalFreeCommitmentQuantity: (json['total_free_commitment_quantity'] as num?)
?.toDouble(),
leftTotalFreeCommitmentQuantity:
(json['left_total_free_commitment_quantity'] as num?)?.toInt(),
);
Map<String, dynamic> _$FreeGovernmentalInfoToJson(
_FreeGovernmentalInfo instance,
) => <String, dynamic>{
'governmental_allocated_quantity': instance.governmentalAllocatedQuantity,
'total_commitment_quantity': instance.totalCommitmentQuantity,
'free_allocated_quantity': instance.freeAllocatedQuantity,
'total_free_commitment_quantity': instance.totalFreeCommitmentQuantity,
'left_total_free_commitment_quantity':
instance.leftTotalFreeCommitmentQuantity,
};
_ManagementHatchingAgeRange _$ManagementHatchingAgeRangeFromJson(
Map<String, dynamic> json,
) => _ManagementHatchingAgeRange(
fromWeight: (json['from_weight'] as num?)?.toDouble(),
toWeight: (json['to_weight'] as num?)?.toDouble(),
);
Map<String, dynamic> _$ManagementHatchingAgeRangeToJson(
_ManagementHatchingAgeRange instance,
) => <String, dynamic>{
'from_weight': instance.fromWeight,
'to_weight': instance.toWeight,
};
_Registrar _$RegistrarFromJson(Map<String, dynamic> json) => _Registrar(
date: json['date'] as String?,
role: json['role'] as String?,
fullname: json['fullname'] as String?,
);
Map<String, dynamic> _$RegistrarToJson(_Registrar instance) =>
<String, dynamic>{
'date': instance.date,
'role': instance.role,
'fullname': instance.fullname,
};
_Breed _$BreedFromJson(Map<String, dynamic> json) => _Breed(
breed: json['breed'] as String?,
mainQuantity: (json['main_quantity'] as num?)?.toInt(),
remainQuantity: (json['remain_quantity'] as num?)?.toInt(),
);
Map<String, dynamic> _$BreedToJson(_Breed instance) => <String, dynamic>{
'breed': instance.breed,
'main_quantity': instance.mainQuantity,
'remain_quantity': instance.remainQuantity,
};
_LastChange _$LastChangeFromJson(Map<String, dynamic> json) => _LastChange(
date: json['date'] as String?,
role: json['role'] as String?,
type: json['type'] as String?,
fullName: json['full_name'] as String?,
);
Map<String, dynamic> _$LastChangeToJson(_LastChange instance) =>
<String, dynamic>{
'date': instance.date,
'role': instance.role,
'type': instance.type,
'full_name': instance.fullName,
};
_LatestHatchingChange _$LatestHatchingChangeFromJson(
Map<String, dynamic> json,
) => _LatestHatchingChange(
date: json['date'] as String?,
role: json['role'] as String?,
fullName: json['full_name'] as String?,
);
Map<String, dynamic> _$LatestHatchingChangeToJson(
_LatestHatchingChange instance,
) => <String, dynamic>{
'date': instance.date,
'role': instance.role,
'full_name': instance.fullName,
};

View File

@@ -0,0 +1,151 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'poultry_order.freezed.dart';
part 'poultry_order.g.dart';
@freezed
abstract class PoultryOrder with _$PoultryOrder {
const factory PoultryOrder({
String? key,
int? id,
Poultry? poultry,
int? orderCode,
String? createDate,
String? sendDate,
List<String>? killHouseList,
int? firstQuantity,
int? quantity,
bool? directBuying,
bool? union,
double? amount,
String? financialOperation,
int? remainQuantity,
@JsonKey(name: "Index_weight") double? indexWeight,
Hatching? hatching,
String? finalState,
int? losses,
String? provinceState,
String? stateProcess,
Registrar? registrar,
VetFarm? vetFarm,
bool? freeSaleInProvince,
bool? freezing,
bool? export,
String? cityCheckRequest,
bool? market,
}) = _PoultryOrder;
factory PoultryOrder.fromJson(Map<String, dynamic> json) => _$PoultryOrderFromJson(json);
}
@freezed
abstract class Poultry with _$Poultry {
const factory Poultry({
String? unitName,
String? cityOperator,
User? user,
int? totalCapacity,
Address? address,
String? breedingUniqueId,
String? systemCode,
}) = _Poultry;
factory Poultry.fromJson(Map<String, dynamic> json) => _$PoultryFromJson(json);
}
@freezed
abstract class User with _$User {
const factory User({
String? fullName,
String? firstName,
String? lastName,
int? baseOrder,
String? mobile,
String? nationalId,
String? nationalCode,
String? key,
City? city,
String? unitName,
String? unitNationalId,
String? unitRegistrationNumber,
String? unitEconomicalNumber,
String? unitProvince,
String? unitCity,
String? unitPostalCode,
String? unitAddress,
}) = _User;
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
}
@freezed
abstract class City with _$City {
const factory City({
int? id,
String? key,
String? createDate,
String? modifyDate,
bool? trash,
int? provinceIdForeignKey,
int? cityIdKey,
String? name,
double? productPrice,
bool? provinceCenter,
int? cityNumber,
String? cityName,
int? provinceNumber,
String? provinceName,
dynamic createdBy,
dynamic modifiedBy,
int? province,
}) = _City;
factory City.fromJson(Map<String, dynamic> json) => _$CityFromJson(json);
}
@freezed
abstract class Address with _$Address {
const factory Address({Province? province, City? city, String? address, String? postalCode}) =
_Address;
factory Address.fromJson(Map<String, dynamic> json) => _$AddressFromJson(json);
}
@freezed
abstract class Province with _$Province {
const factory Province({String? key, String? name}) = _Province;
factory Province.fromJson(Map<String, dynamic> json) => _$ProvinceFromJson(json);
}
@freezed
abstract class Hatching with _$Hatching {
const factory Hatching({
int? age,
int? leftOver,
String? fileState,
String? hatchingDate,
String? allowHatching,
int? inspectionLosses,
double? inspectionLossesPercent,
double? totalLossesPercent,
double? poultryLossesPercent,
double? totalWeight,
}) = _Hatching;
factory Hatching.fromJson(Map<String, dynamic> json) => _$HatchingFromJson(json);
}
@freezed
abstract class Registrar with _$Registrar {
const factory Registrar({String? date, String? role, String? fullName}) = _Registrar;
factory Registrar.fromJson(Map<String, dynamic> json) => _$RegistrarFromJson(json);
}
@freezed
abstract class VetFarm with _$VetFarm {
const factory VetFarm({String? vetFarmFullName, String? vetFarmMobile}) = _VetFarm;
factory VetFarm.fromJson(Map<String, dynamic> json) => _$VetFarmFromJson(json);
}

View File

@@ -0,0 +1,261 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'poultry_order.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_PoultryOrder _$PoultryOrderFromJson(Map<String, dynamic> json) =>
_PoultryOrder(
key: json['key'] as String?,
id: (json['id'] as num?)?.toInt(),
poultry: json['poultry'] == null
? null
: Poultry.fromJson(json['poultry'] as Map<String, dynamic>),
orderCode: (json['order_code'] as num?)?.toInt(),
createDate: json['create_date'] as String?,
sendDate: json['send_date'] as String?,
killHouseList: (json['kill_house_list'] as List<dynamic>?)
?.map((e) => e as String)
.toList(),
firstQuantity: (json['first_quantity'] as num?)?.toInt(),
quantity: (json['quantity'] as num?)?.toInt(),
directBuying: json['direct_buying'] as bool?,
union: json['union'] as bool?,
amount: (json['amount'] as num?)?.toDouble(),
financialOperation: json['financial_operation'] as String?,
remainQuantity: (json['remain_quantity'] as num?)?.toInt(),
indexWeight: (json['Index_weight'] as num?)?.toDouble(),
hatching: json['hatching'] == null
? null
: Hatching.fromJson(json['hatching'] as Map<String, dynamic>),
finalState: json['final_state'] as String?,
losses: (json['losses'] as num?)?.toInt(),
provinceState: json['province_state'] as String?,
stateProcess: json['state_process'] as String?,
registrar: json['registrar'] == null
? null
: Registrar.fromJson(json['registrar'] as Map<String, dynamic>),
vetFarm: json['vet_farm'] == null
? null
: VetFarm.fromJson(json['vet_farm'] as Map<String, dynamic>),
freeSaleInProvince: json['free_sale_in_province'] as bool?,
freezing: json['freezing'] as bool?,
export: json['export'] as bool?,
cityCheckRequest: json['city_check_request'] as String?,
market: json['market'] as bool?,
);
Map<String, dynamic> _$PoultryOrderToJson(_PoultryOrder instance) =>
<String, dynamic>{
'key': instance.key,
'id': instance.id,
'poultry': instance.poultry,
'order_code': instance.orderCode,
'create_date': instance.createDate,
'send_date': instance.sendDate,
'kill_house_list': instance.killHouseList,
'first_quantity': instance.firstQuantity,
'quantity': instance.quantity,
'direct_buying': instance.directBuying,
'union': instance.union,
'amount': instance.amount,
'financial_operation': instance.financialOperation,
'remain_quantity': instance.remainQuantity,
'Index_weight': instance.indexWeight,
'hatching': instance.hatching,
'final_state': instance.finalState,
'losses': instance.losses,
'province_state': instance.provinceState,
'state_process': instance.stateProcess,
'registrar': instance.registrar,
'vet_farm': instance.vetFarm,
'free_sale_in_province': instance.freeSaleInProvince,
'freezing': instance.freezing,
'export': instance.export,
'city_check_request': instance.cityCheckRequest,
'market': instance.market,
};
_Poultry _$PoultryFromJson(Map<String, dynamic> json) => _Poultry(
unitName: json['unit_name'] as String?,
cityOperator: json['city_operator'] as String?,
user: json['user'] == null
? null
: User.fromJson(json['user'] as Map<String, dynamic>),
totalCapacity: (json['total_capacity'] as num?)?.toInt(),
address: json['address'] == null
? null
: Address.fromJson(json['address'] as Map<String, dynamic>),
breedingUniqueId: json['breeding_unique_id'] as String?,
systemCode: json['system_code'] as String?,
);
Map<String, dynamic> _$PoultryToJson(_Poultry instance) => <String, dynamic>{
'unit_name': instance.unitName,
'city_operator': instance.cityOperator,
'user': instance.user,
'total_capacity': instance.totalCapacity,
'address': instance.address,
'breeding_unique_id': instance.breedingUniqueId,
'system_code': instance.systemCode,
};
_User _$UserFromJson(Map<String, dynamic> json) => _User(
fullName: json['full_name'] as String?,
firstName: json['first_name'] as String?,
lastName: json['last_name'] as String?,
baseOrder: (json['base_order'] as num?)?.toInt(),
mobile: json['mobile'] as String?,
nationalId: json['national_id'] as String?,
nationalCode: json['national_code'] as String?,
key: json['key'] as String?,
city: json['city'] == null
? null
: City.fromJson(json['city'] as Map<String, dynamic>),
unitName: json['unit_name'] as String?,
unitNationalId: json['unit_national_id'] as String?,
unitRegistrationNumber: json['unit_registration_number'] as String?,
unitEconomicalNumber: json['unit_economical_number'] as String?,
unitProvince: json['unit_province'] as String?,
unitCity: json['unit_city'] as String?,
unitPostalCode: json['unit_postal_code'] as String?,
unitAddress: json['unit_address'] as String?,
);
Map<String, dynamic> _$UserToJson(_User instance) => <String, dynamic>{
'full_name': instance.fullName,
'first_name': instance.firstName,
'last_name': instance.lastName,
'base_order': instance.baseOrder,
'mobile': instance.mobile,
'national_id': instance.nationalId,
'national_code': instance.nationalCode,
'key': instance.key,
'city': instance.city,
'unit_name': instance.unitName,
'unit_national_id': instance.unitNationalId,
'unit_registration_number': instance.unitRegistrationNumber,
'unit_economical_number': instance.unitEconomicalNumber,
'unit_province': instance.unitProvince,
'unit_city': instance.unitCity,
'unit_postal_code': instance.unitPostalCode,
'unit_address': instance.unitAddress,
};
_City _$CityFromJson(Map<String, dynamic> json) => _City(
id: (json['id'] as num?)?.toInt(),
key: json['key'] as String?,
createDate: json['create_date'] as String?,
modifyDate: json['modify_date'] as String?,
trash: json['trash'] as bool?,
provinceIdForeignKey: (json['province_id_foreign_key'] as num?)?.toInt(),
cityIdKey: (json['city_id_key'] as num?)?.toInt(),
name: json['name'] as String?,
productPrice: (json['product_price'] as num?)?.toDouble(),
provinceCenter: json['province_center'] as bool?,
cityNumber: (json['city_number'] as num?)?.toInt(),
cityName: json['city_name'] as String?,
provinceNumber: (json['province_number'] as num?)?.toInt(),
provinceName: json['province_name'] as String?,
createdBy: json['created_by'],
modifiedBy: json['modified_by'],
province: (json['province'] as num?)?.toInt(),
);
Map<String, dynamic> _$CityToJson(_City instance) => <String, dynamic>{
'id': instance.id,
'key': instance.key,
'create_date': instance.createDate,
'modify_date': instance.modifyDate,
'trash': instance.trash,
'province_id_foreign_key': instance.provinceIdForeignKey,
'city_id_key': instance.cityIdKey,
'name': instance.name,
'product_price': instance.productPrice,
'province_center': instance.provinceCenter,
'city_number': instance.cityNumber,
'city_name': instance.cityName,
'province_number': instance.provinceNumber,
'province_name': instance.provinceName,
'created_by': instance.createdBy,
'modified_by': instance.modifiedBy,
'province': instance.province,
};
_Address _$AddressFromJson(Map<String, dynamic> json) => _Address(
province: json['province'] == null
? null
: Province.fromJson(json['province'] as Map<String, dynamic>),
city: json['city'] == null
? null
: City.fromJson(json['city'] as Map<String, dynamic>),
address: json['address'] as String?,
postalCode: json['postal_code'] as String?,
);
Map<String, dynamic> _$AddressToJson(_Address instance) => <String, dynamic>{
'province': instance.province,
'city': instance.city,
'address': instance.address,
'postal_code': instance.postalCode,
};
_Province _$ProvinceFromJson(Map<String, dynamic> json) =>
_Province(key: json['key'] as String?, name: json['name'] as String?);
Map<String, dynamic> _$ProvinceToJson(_Province instance) => <String, dynamic>{
'key': instance.key,
'name': instance.name,
};
_Hatching _$HatchingFromJson(Map<String, dynamic> json) => _Hatching(
age: (json['age'] as num?)?.toInt(),
leftOver: (json['left_over'] as num?)?.toInt(),
fileState: json['file_state'] as String?,
hatchingDate: json['hatching_date'] as String?,
allowHatching: json['allow_hatching'] as String?,
inspectionLosses: (json['inspection_losses'] as num?)?.toInt(),
inspectionLossesPercent: (json['inspection_losses_percent'] as num?)
?.toDouble(),
totalLossesPercent: (json['total_losses_percent'] as num?)?.toDouble(),
poultryLossesPercent: (json['poultry_losses_percent'] as num?)?.toDouble(),
totalWeight: (json['total_weight'] as num?)?.toDouble(),
);
Map<String, dynamic> _$HatchingToJson(_Hatching instance) => <String, dynamic>{
'age': instance.age,
'left_over': instance.leftOver,
'file_state': instance.fileState,
'hatching_date': instance.hatchingDate,
'allow_hatching': instance.allowHatching,
'inspection_losses': instance.inspectionLosses,
'inspection_losses_percent': instance.inspectionLossesPercent,
'total_losses_percent': instance.totalLossesPercent,
'poultry_losses_percent': instance.poultryLossesPercent,
'total_weight': instance.totalWeight,
};
_Registrar _$RegistrarFromJson(Map<String, dynamic> json) => _Registrar(
date: json['date'] as String?,
role: json['role'] as String?,
fullName: json['full_name'] as String?,
);
Map<String, dynamic> _$RegistrarToJson(_Registrar instance) =>
<String, dynamic>{
'date': instance.date,
'role': instance.role,
'full_name': instance.fullName,
};
_VetFarm _$VetFarmFromJson(Map<String, dynamic> json) => _VetFarm(
vetFarmFullName: json['vet_farm_full_name'] as String?,
vetFarmMobile: json['vet_farm_mobile'] as String?,
);
Map<String, dynamic> _$VetFarmToJson(_VetFarm instance) => <String, dynamic>{
'vet_farm_full_name': instance.vetFarmFullName,
'vet_farm_mobile': instance.vetFarmMobile,
};

View File

@@ -0,0 +1,16 @@
import 'package:rasadyar_core/core.dart';
part 'sell_for_freezing.freezed.dart';
part 'sell_for_freezing.g.dart';
@freezed
abstract class SellForFreezing with _$SellForFreezing {
const factory SellForFreezing({
bool? permission,
}) = _SellForFreezing;
factory SellForFreezing.fromJson(Map<String, dynamic> json) =>
_$SellForFreezingFromJson(json);
}

View File

@@ -0,0 +1,277 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'sell_for_freezing.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$SellForFreezing {
bool? get permission;
/// Create a copy of SellForFreezing
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$SellForFreezingCopyWith<SellForFreezing> get copyWith => _$SellForFreezingCopyWithImpl<SellForFreezing>(this as SellForFreezing, _$identity);
/// Serializes this SellForFreezing to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SellForFreezing&&(identical(other.permission, permission) || other.permission == permission));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,permission);
@override
String toString() {
return 'SellForFreezing(permission: $permission)';
}
}
/// @nodoc
abstract mixin class $SellForFreezingCopyWith<$Res> {
factory $SellForFreezingCopyWith(SellForFreezing value, $Res Function(SellForFreezing) _then) = _$SellForFreezingCopyWithImpl;
@useResult
$Res call({
bool? permission
});
}
/// @nodoc
class _$SellForFreezingCopyWithImpl<$Res>
implements $SellForFreezingCopyWith<$Res> {
_$SellForFreezingCopyWithImpl(this._self, this._then);
final SellForFreezing _self;
final $Res Function(SellForFreezing) _then;
/// Create a copy of SellForFreezing
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? permission = freezed,}) {
return _then(_self.copyWith(
permission: freezed == permission ? _self.permission : permission // ignore: cast_nullable_to_non_nullable
as bool?,
));
}
}
/// Adds pattern-matching-related methods to [SellForFreezing].
extension SellForFreezingPatterns on SellForFreezing {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _SellForFreezing value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _SellForFreezing() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _SellForFreezing value) $default,){
final _that = this;
switch (_that) {
case _SellForFreezing():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _SellForFreezing value)? $default,){
final _that = this;
switch (_that) {
case _SellForFreezing() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool? permission)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SellForFreezing() when $default != null:
return $default(_that.permission);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool? permission) $default,) {final _that = this;
switch (_that) {
case _SellForFreezing():
return $default(_that.permission);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool? permission)? $default,) {final _that = this;
switch (_that) {
case _SellForFreezing() when $default != null:
return $default(_that.permission);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _SellForFreezing implements SellForFreezing {
const _SellForFreezing({this.permission});
factory _SellForFreezing.fromJson(Map<String, dynamic> json) => _$SellForFreezingFromJson(json);
@override final bool? permission;
/// Create a copy of SellForFreezing
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SellForFreezingCopyWith<_SellForFreezing> get copyWith => __$SellForFreezingCopyWithImpl<_SellForFreezing>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$SellForFreezingToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SellForFreezing&&(identical(other.permission, permission) || other.permission == permission));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,permission);
@override
String toString() {
return 'SellForFreezing(permission: $permission)';
}
}
/// @nodoc
abstract mixin class _$SellForFreezingCopyWith<$Res> implements $SellForFreezingCopyWith<$Res> {
factory _$SellForFreezingCopyWith(_SellForFreezing value, $Res Function(_SellForFreezing) _then) = __$SellForFreezingCopyWithImpl;
@override @useResult
$Res call({
bool? permission
});
}
/// @nodoc
class __$SellForFreezingCopyWithImpl<$Res>
implements _$SellForFreezingCopyWith<$Res> {
__$SellForFreezingCopyWithImpl(this._self, this._then);
final _SellForFreezing _self;
final $Res Function(_SellForFreezing) _then;
/// Create a copy of SellForFreezing
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? permission = freezed,}) {
return _then(_SellForFreezing(
permission: freezed == permission ? _self.permission : permission // ignore: cast_nullable_to_non_nullable
as bool?,
));
}
}
// dart format on

View File

@@ -0,0 +1,13 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'sell_for_freezing.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_SellForFreezing _$SellForFreezingFromJson(Map<String, dynamic> json) =>
_SellForFreezing(permission: json['permission'] as bool?);
Map<String, dynamic> _$SellForFreezingToJson(_SellForFreezing instance) =>
<String, dynamic>{'permission': instance.permission};

View File

@@ -1,7 +1,16 @@
import 'package:rasadyar_chicken/data/models/poultry_export/poultry_export.dart';
import 'package:rasadyar_chicken/data/models/request/kill_registration/kill_registration.dart';
import 'package:rasadyar_chicken/data/models/response/all_poultry/all_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/approved_price/approved_price.dart';
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
import 'package:rasadyar_chicken/data/models/response/hatching_report/hatching_report.dart';
import 'package:rasadyar_chicken/data/models/response/poultry/poultry_farm.dart';
import 'package:rasadyar_chicken/data/models/response/kill_house_poultry/kill_house_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/kill_request_poultry/kill_request_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_hatching/poultry_hatching.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_science/home_poultry_science/home_poultry_science_model.dart';
import 'package:rasadyar_chicken/data/models/response/sell_for_freezing/sell_for_freezing.dart';
import 'package:rasadyar_core/core.dart';
abstract class PoultryScienceRepository {
@@ -30,4 +39,50 @@ abstract class PoultryScienceRepository {
Map<String, dynamic>? queryParameters,
});
Future<ApprovedPrice?> getApprovedPrice({ required String token,
Map<String, dynamic>? queryParameters,});
Future<List<AllPoultry>?> getAllPoultry({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<SellForFreezing?> getSellForFreezing({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<PoultryExport?> getPoultryExport({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<List<KillRequestPoultry>?> getUserPoultry({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<List<PoultryHatching>?> getPoultryHatching({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<List<KillHousePoultry>?> getKillHouseList({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> submitKillRegistration({
required String token,
required KillRegistrationRequest request,
});
Future<PaginationModel<PoultryOrder>?> getPoultryOderList({
required String token,
Map<String, dynamic>? queryParameters,
});
}

View File

@@ -1,8 +1,17 @@
import 'package:rasadyar_chicken/data/data_source/remote/poultry_science/poultry_science_remote.dart';
import 'package:rasadyar_chicken/data/models/poultry_export/poultry_export.dart';
import 'package:rasadyar_chicken/data/models/request/kill_registration/kill_registration.dart';
import 'package:rasadyar_chicken/data/models/response/all_poultry/all_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/approved_price/approved_price.dart';
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
import 'package:rasadyar_chicken/data/models/response/hatching_report/hatching_report.dart';
import 'package:rasadyar_chicken/data/models/response/poultry/poultry_farm.dart';
import 'package:rasadyar_chicken/data/models/response/kill_house_poultry/kill_house_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/kill_request_poultry/kill_request_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_hatching/poultry_hatching.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_science/home_poultry_science/home_poultry_science_model.dart';
import 'package:rasadyar_chicken/data/models/response/sell_for_freezing/sell_for_freezing.dart';
import 'package:rasadyar_core/core.dart';
import 'poultry_science_repository.dart';
@@ -53,4 +62,76 @@ class PoultryScienceRepositoryImp implements PoultryScienceRepository {
queryParameters: queryParameters,
);
}
@override
Future<ApprovedPrice?> getApprovedPrice({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
return await datasource.getApprovedPrice(token: token, queryParameters: queryParameters);
}
@override
Future<List<AllPoultry>?> getAllPoultry({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
return await datasource.getAllPoultry(token: token, queryParameters: queryParameters);
}
@override
Future<PoultryExport?> getPoultryExport({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
return await datasource.getPoultryExport(token: token, queryParameters: queryParameters);
}
@override
Future<SellForFreezing?> getSellForFreezing({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
return await datasource.getSellForFreezing(token: token, queryParameters: queryParameters);
}
@override
Future<List<KillRequestPoultry>?> getUserPoultry({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
return await datasource.getUserPoultry(token: token, queryParameters: queryParameters);
}
@override
Future<List<PoultryHatching>?> getPoultryHatching({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
return await datasource.getPoultryHatching(token: token, queryParameters: queryParameters);
}
@override
Future<List<KillHousePoultry>?> getKillHouseList({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
return await datasource.getKillHouseList(token: token, queryParameters: queryParameters);
}
@override
Future<void> submitKillRegistration({
required String token,
required KillRegistrationRequest request,
}) async {
await datasource.submitKillRegistration(token: token, request: request);
}
@override
Future<PaginationModel<PoultryOrder>?> getPoultryOderList({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
return await datasource.getPoultryOderList(token: token, queryParameters: queryParameters);
}
}

View File

@@ -1,12 +1,13 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
import 'package:rasadyar_chicken/data/models/request/change_password/change_password_request_model.dart';
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart';
import 'package:rasadyar_core/core.dart';
class ProfileLogic extends GetxController {
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
ChickenRepository chickenRepository = diChicken.get<ChickenRepository>();
GService gService = Get.find<GService>();
TokenStorageService tokenService = Get.find<TokenStorageService>();
RxInt selectedInformationType = 0.obs;
@@ -78,9 +79,8 @@ class ProfileLogic extends GetxController {
Future<void> getUserProfile() async {
userProfile.value = Resource.loading();
await safeCall<UserProfile?>(
call: () async => await rootLogic.chickenRepository.getUserProfile(
token: rootLogic.tokenService.accessToken.value!,
),
call: () async =>
await chickenRepository.getUserProfile(token: tokenService.accessToken.value!),
onSuccess: (result) {
if (result != null) {
userProfile.value = Resource.success(result);
@@ -92,8 +92,7 @@ class ProfileLogic extends GetxController {
Future<void> getCites() async {
await safeCall(
call: () =>
rootLogic.chickenRepository.getCity(provinceName: selectedProvince.value?.name ?? ''),
call: () => chickenRepository.getCity(provinceName: selectedProvince.value?.name ?? ''),
onSuccess: (result) {
if (result != null && result.isNotEmpty) {
cites.value = result;
@@ -115,8 +114,8 @@ class ProfileLogic extends GetxController {
);
isOnLoading.value = true;
await safeCall(
call: () async => await rootLogic.chickenRepository.updateUserProfile(
token: rootLogic.tokenService.accessToken.value!,
call: () async => await chickenRepository.updateUserProfile(
token: tokenService.accessToken.value!,
userProfile: userProfile,
),
onSuccess: (result) {
@@ -136,8 +135,8 @@ class ProfileLogic extends GetxController {
);
await safeCall(
call: () async => await rootLogic.chickenRepository.updatePassword(
token: rootLogic.tokenService.accessToken.value!,
call: () async => await chickenRepository.updatePassword(
token: tokenService.accessToken.value!,
model: model,
),
);
@@ -147,7 +146,7 @@ class ProfileLogic extends GetxController {
Future<void> getUserRole() async {
userLocal.value = Resource.loading();
await safeCall<UserLocalModel?>(
call: () async => rootLogic.tokenService.getUserLocal(Module.chicken),
call: () async => tokenService.getUserLocal(Module.chicken),
onSuccess: (result) {
if (result != null) {
userLocal.value = Resource.success(result);
@@ -164,7 +163,8 @@ class ProfileLogic extends GetxController {
}
Future<void> changeUserRole(String newRole) async {
await gService.saveSelectedRole(Module.chicken, newRole);
dLog(newRole);
await gService.saveRoute(Module.chicken, newRole);
Get.offAllNamed(newRole);
}

View File

@@ -4,7 +4,6 @@ import 'package:flutter/cupertino.dart' hide Image;
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/common/fa_user_role.dart';
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
import 'package:rasadyar_core/core.dart';
@@ -461,33 +460,6 @@ class ProfilePage extends GetView<ProfileLogic> {
);
}
Widget _provinceWidget() {
return Obx(() {
return OverlayDropdownWidget<IranProvinceCityModel>(
items: controller.rootLogic.provinces,
onChanged: (value) {
controller.selectedProvince.value = value;
},
selectedItem: controller.selectedProvince.value,
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
labelBuilder: (item) => Text(item?.name ?? 'انتخاب استان'),
);
});
}
Widget _cityWidget() {
return ObxValue((data) {
return OverlayDropdownWidget<IranProvinceCityModel>(
items: data,
onChanged: (value) {
controller.selectedCity.value = value;
},
selectedItem: controller.selectedCity.value,
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
labelBuilder: (item) => Text(item?.name ?? 'انتخاب شهر'),
);
}, controller.cites);
}
Widget changePasswordBottomSheet() {
return BaseBottomSheet(
@@ -616,7 +588,7 @@ class ProfilePage extends GetView<ProfileLogic> {
backgroundColor: AppColor.error,
onPressed: () async {
await Future.wait([
controller.rootLogic.tokenService.deleteModuleTokens(Module.chicken),
controller.tokenService.deleteModuleTokens(Module.chicken),
controller.gService.clearSelectedModule(),
]).then((value) async {
await removeChickenDI();
@@ -660,7 +632,7 @@ class ProfilePage extends GetView<ProfileLogic> {
Map tmpRole = getFaUserRoleWithOnTap(item?[index]);
return CustomChip(
isSelected:
controller.gService.getSelectedRole(Module.chicken) == tmpRole.values.first,
controller.gService.getRoute(Module.chicken) == tmpRole.values.first,
title: tmpRole.keys.first,
index: index,
onTap: (int p1) {

View File

@@ -42,10 +42,15 @@ class RolePage extends GetView<RoleLogic> {
title: role.keys.first,
onTap: () async {
String route = role.values.first;
await controller.gService.saveSelectedRole(
await controller.gService.saveRoute(
Module.chicken,
route,
);
await controller.gService.saveRole(
Module.chicken,
data[index],
);
Get.offAllNamed(route);
},
);

View File

@@ -3,6 +3,7 @@ import 'package:get/get.dart';
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
import 'package:rasadyar_chicken/data/models/response/hatching_report/hatching_report.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/logic.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/list_item/list_item2.dart';
@@ -17,7 +18,7 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
hasSearch: false,
hasFilter: false,
routes: controller.routesName,
onBackPressed: () => Get.back(id: 0),
onBackPressed: () => Get.back(id: poultryFirstKey),
widgets: [
hatchingWidget()
],
@@ -127,11 +128,11 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
buildRow(title: 'شماره مجوز جوجه ریزی', value: item.licenceNumber ?? 'N/A'),
buildRow(
title: 'حجم جوجه ریزی',
value: item.quantity.separatedByComma,
value: item.quantity.separatedByCommaFa,
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
buildRow(title: 'مانده در سالن', value: item.leftOver.separatedByComma),
buildRow(title: 'تلفات', value: item.losses.separatedByComma),
buildRow(title: 'مانده در سالن', value: item.leftOver.separatedByCommaFa),
buildRow(title: 'تلفات', value: item.losses.separatedByCommaFa),
buildRow(
title: 'دامپزشک فارم',
value: '${item.vetFarm?.vetFarmFullName}(${item.vetFarm?.vetFarmMobile})',

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/poultry/poultry_farm.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/home/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
import 'package:rasadyar_core/core.dart';

View File

@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/poultry/poultry_farm.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
@@ -14,7 +16,7 @@ class FarmPage extends GetView<FarmLogic> {
routes: controller.routes,
hasFilter: false,
hasSearch: false,
onBackPressed: () => Get.back(id: 0),
onBackPressed: () => Get.back(id: poultryFirstKey),
widgets: [firstTagInformation(), farmListWidget()],
);
}
@@ -131,7 +133,7 @@ class FarmPage extends GetView<FarmLogic> {
title: 'دامپزشک فارم',
value: '${item.vetFarm?.fullName ?? '-'} (${item.vetFarm?.mobile ?? '-'})',
),
buildRow(title: 'ظرفیت فارم', value: item.totalCapacity.separatedByComma),
buildRow(title: 'ظرفیت فارم', value: item.totalCapacity.separatedByCommaFa),
buildRow(
title: 'جوجه ریزی فعال (تعداد دوره) ',
value:

View File

@@ -0,0 +1,86 @@
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
import 'package:rasadyar_core/core.dart';
class GenocideLogic extends GetxController {
List<String> routes = ['اقدام', 'درخواست کشتارها'];
var tokenService = Get.find<TokenStorageService>();
var gService = Get.find<GService>();
var rootLogic = Get.find<PoultryScienceRootLogic>();
Rx<Resource<PaginationModel<PoultryOrder>>> poultryOrderList =
Resource<PaginationModel<PoultryOrder>>.loading().obs;
RxList<int> isExpandedList = <int>[].obs;
final RxInt currentPage = 1.obs;
final RxBool isLoadingMore = false.obs;
Rx<Jalali> fromDateFilter = Jalali
.now()
.obs;
Rx<Jalali> toDateFilter = Jalali
.now()
.obs;
RxnString searchedValue = RxnString();
/* final RxBool isLoadingMoreAllocationsMade = false.obs;
final RxBool isOnLoadingSubmitOrEdit = false.obs;*/
@override
void onReady() {
super.onReady();
getPoultryOrderList();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
Future<void> getPoultryOrderList([bool loadingMore = false]) async {
if (loadingMore) {
isLoadingMore.value = true;
} else {
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.loading();
}
if (searchedValue.value != null &&
searchedValue.value!.trim().isNotEmpty &&
currentPage.value > 1) {
currentPage.value = 1;
}
await safeCall(
call: () =>
rootLogic.poultryRepository.getPoultryOderList(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams(
pageSize: 20,
page: currentPage.value,
search: 'filter',
role: gService.getRole(Module.chicken),
value: searchedValue.value,
fromDate: fromDateFilter.value.toDateTime(),
toDate: toDateFilter.value.toDateTime(),
queryParams: {'today': null}
),
),
onSuccess: (res) async {
await Future.delayed(Duration(milliseconds: 500));
if ((res?.count ?? 0) == 0) {
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.empty();
} else {
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(
PaginationModel<PoultryOrder>(
count: res?.count ?? 0,
next: res?.next,
previous: res?.previous,
results: [...(poultryOrderList.value.data?.results ?? []), ...(res?.results ?? [])],
),
);
}
},
);
}
}

View File

@@ -0,0 +1,222 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class GenocidePage extends GetView<GenocideLogic> {
const GenocidePage({super.key});
@override
Widget build(BuildContext context) {
return BasePage(
routes: controller.routes,
hasSearch: false,
hasFilter: false,
onBackPressed: () => Get.back(id: poultryFirstKey),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
floatingActionButton: RFab.add(
onPressed: () {
Get.toNamed(ChickenRoutes.killingRegistrationPoultryScience, id: poultryFirstKey);
},
),
widgets: [poultryOrderListWidget()],
);
}
Widget poultryOrderListWidget() {
return Expanded(
child: ObxValue((data) {
return RPaginatedListView(
listType: ListType.separated,
resource: data.value,
hasMore: data.value.data?.next != null,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cubeScanSvg.path,
);
}, controller.isExpandedList);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getPoultryOrderList(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getPoultryOrderList();
},
);
}, controller.poultryOrderList),
);
}
Container itemListExpandedWidget(PoultryOrder item) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
item.poultry?.unitName ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
Spacer(),
Visibility(
child: Text(
'${item.poultry?.address?.province?.name} / ${item.poultry?.address?.city?.name}',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
),
],
),
Container(
height: 32,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blueLightHover),
borderRadius: BorderRadius.circular(8),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'سن مرغ: ${item.hatching?.age ?? '-'}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
Text(
item.sendDate?.formattedJalaliDate ?? '-',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
Text(
'تعداد:${item.quantity.separatedByComma ?? '-'} (قطعه)',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
],
),
),
buildRow(title: 'کد سفارش', value: '${item.orderCode} '),
buildRow(
title: 'نوع فروش',
value: (item.freeSaleInProvince ?? false) ? 'آزاد' : 'دولتی ',
),
buildRow(title: 'نوع کشتار ', value: getKillType(item)),
buildRow(title: 'درخواست', value: getRequestType(item) ?? 'N/A'),
buildRow(title: 'میانگین وزنی', value: '${(item.indexWeight)} (کیلوگرم)'),
buildRow(title: 'قیمت مرغدار', value: '${item.amount.separatedByComma} (ریال)'),
buildRow(title: 'مانده در سالن ', value: '${item.hatching?.leftOver.separatedByComma ?? 0} (قطعه)'),
buildRow(title: ' وضعیت', value: getState(item)),
],
),
);
}
Widget itemListWidget(PoultryOrder item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(width: 20),
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 3,
children: [
Text(
item.poultry?.unitName ?? 'N/A',
textAlign: TextAlign.start,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
Text(
item.sendDate?.formattedJalaliDate ?? '-',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
],
),
),
Expanded(
flex: 3,
child: Column(
spacing: 3,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'کد سفارش : ${item.orderCode ?? '-'}',
textAlign: TextAlign.start,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
Text(
'تعداد:${item.quantity.separatedByComma ?? '-'} (قطعه)',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
],
),
),
Expanded(
flex: 1,
child: Assets.vec.scanSvg.svg(
width: 32.w,
height: 32.h,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
),
],
);
}
}
String getRequestType(PoultryOrder item) {
if (item.market ?? false) {
return 'پنل معاملات';
} else if (item.union ?? false) {
return 'اتحادیه';
} else {
return 'خرید مستقیم';
}
}
String getKillType(PoultryOrder item) {
if (item.export ?? false) {
return 'صادرات';
} else if (item.freezing ?? false) {
return 'انجماد';
} else {
return 'عادی';
}
}
String getState(PoultryOrder item) {
if (item.stateProcess == 'pending') {
return 'در انتظار تایید';
} else {
return 'تایید شده';
}
}

View File

@@ -116,13 +116,13 @@ class PoultryScienceHomeLogic extends GetxController {
tagInfo['first'] = tagInfo['first']!.map((tag) {
if (tag.labelTitle == 'کل فارم ها') {
return tag.copyWith(
value: result.farmCount?.separatedByComma ?? '0',
value: result.farmCount?.separatedByCommaFa ?? '0',
isLoading: false,
);
}
if (tag.labelTitle == 'تعداد جوجه ریزی') {
return tag.copyWith(
value: result.hatchingCount?.separatedByComma ?? '0',
value: result.hatchingCount?.separatedByCommaFa ?? '0',
isLoading: false,
);
}
@@ -134,12 +134,12 @@ class PoultryScienceHomeLogic extends GetxController {
switch (tag.labelTitle) {
case 'حجم جوجه ریزی':
return tag.copyWith(
value: result.hatchingQuantity?.separatedByComma ?? '0',
value: result.hatchingQuantity?.separatedByCommaFa ?? '0',
isLoading: false,
);
case 'مانده در سالن':
return tag.copyWith(
value: result.hatchingLeftOver?.separatedByComma ?? '0',
value: result.hatchingLeftOver?.separatedByCommaFa ?? '0',
isLoading: false,
);
default:
@@ -152,12 +152,12 @@ class PoultryScienceHomeLogic extends GetxController {
switch (tag.labelTitle) {
case 'تلفات':
return tag.copyWith(
value: result.hatchingLosses?.separatedByComma ?? '0',
value: result.hatchingLosses?.separatedByCommaFa ?? '0',
isLoading: false,
);
case 'حجم کشتار شده':
return tag.copyWith(
value: result.hatchingKilledQuantity?.separatedByComma ?? '0',
value: result.hatchingKilledQuantity?.separatedByCommaFa ?? '0',
isLoading: false,
);
default:
@@ -169,12 +169,12 @@ class PoultryScienceHomeLogic extends GetxController {
switch (element.labelTitle) {
case 'کمترین سن جوجه ریزی':
return element.copyWith(
value: result.hatchingMinAge?.separatedByComma ?? '0',
value: result.hatchingMinAge?.separatedByCommaFa ?? '0',
isLoading: false,
);
case 'بیشترین سن جوجه ریزی':
return element.copyWith(
value: result.hatchingMaxAge?.separatedByComma ?? '0',
value: result.hatchingMaxAge?.separatedByCommaFa ?? '0',
isLoading: false,
);
default:

View File

@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
import 'package:rasadyar_chicken/data/models/response/hatching_report/hatching_report.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/page_route.dart';
import 'package:rasadyar_core/core.dart';
@@ -18,7 +19,7 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
hasBack: true,
hasFilter: false,
routesWidget: ObxValue((route) => buildPageRoute(route), controller.routesName),
onBackPressed: () => Get.back(id: 0),
onBackPressed: () => Get.back(id: poultryFirstKey),
widgets: [
segmentWidget(),
@@ -132,11 +133,11 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
buildRow(title: 'شماره مجوز جوجه ریزی', value: item.licenceNumber ?? 'N/A'),
buildRow(
title: 'حجم جوجه ریزی',
value: item.quantity.separatedByComma,
value: item.quantity.separatedByCommaFa,
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
buildRow(title: 'مانده در سالن', value: item.leftOver.separatedByComma),
buildRow(title: 'تلفات', value: item.losses.separatedByComma),
buildRow(title: 'مانده در سالن', value: item.leftOver.separatedByCommaFa),
buildRow(title: 'تلفات', value: item.losses.separatedByCommaFa),
buildRow(
title: 'دامپزشک فارم',
value: '${item.vetFarm?.vetFarmFullName}(${item.vetFarm?.vetFarmMobile})',
@@ -425,14 +426,14 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
buildRow(title: 'شماره مجوز جوجه ریزی', value: item.hatching?.licenceNumber ?? 'N/A'),
buildRow(
title: 'حجم جوجه ریزی',
value: item.hatching?.quantity.separatedByComma ?? 'N/A',
value: item.hatching?.quantity.separatedByCommaFa ?? 'N/A',
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
buildRow(
title: 'مانده در سالن',
value: item.hatching?.leftOver.separatedByComma ?? 'N/A',
value: item.hatching?.leftOver.separatedByCommaFa ?? 'N/A',
),
buildRow(title: 'تلفات', value: item.hatching?.losses.separatedByComma ?? 'N/A'),
buildRow(title: 'تلفات', value: item.hatching?.losses.separatedByCommaFa ?? 'N/A'),
buildRow(
title: 'دامپزشک فارم',
value:

View File

@@ -0,0 +1,360 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/poultry_export/poultry_export.dart';
import 'package:rasadyar_chicken/data/models/request/kill_registration/kill_registration.dart';
import 'package:rasadyar_chicken/data/models/response/all_poultry/all_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/approved_price/approved_price.dart';
import 'package:rasadyar_chicken/data/models/response/kill_house_poultry/kill_house_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/kill_request_poultry/kill_request_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_hatching/poultry_hatching.dart';
import 'package:rasadyar_chicken/data/models/response/sell_for_freezing/sell_for_freezing.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_core/core.dart';
class KillingRegistrationLogic extends GetxController {
List<String> routes = ['اقدام', 'درخواست کشتارها', 'ثبت کشتار'];
var tokenService = Get.find<TokenStorageService>();
var gService = Get.find<GService>();
var rootLogic = Get.find<PoultryScienceRootLogic>();
GlobalKey<FormState> formKey = GlobalKey<FormState>();
Rxn<ApprovedPrice> approvedPrice = Rxn<ApprovedPrice>();
Rx<Jalali> killsDate = Jalali.now().obs;
Rxn<SellForFreezing> sellForFreezing = Rxn<SellForFreezing>();
Rxn<PoultryExport> poultryExport = Rxn<PoultryExport>();
TextEditingController quantityKillsController = TextEditingController();
TextEditingController quantityLoseController = TextEditingController(text: 0.toString());
TextEditingController averageWeightKillsController = TextEditingController();
TextEditingController priceFreeSaleController = TextEditingController();
RxInt generatedApprovedPrice = 0.obs;
RxBool isOnSubmitLoading = false.obs;
RxBool isExportSelected = false.obs;
RxBool isFreezedSelected = false.obs;
RxBool isMarketSelected = false.obs;
RxBool isFreeSale = false.obs;
//step 1
Rx<Resource<List<AllPoultry>>> allPoultryList = Resource<List<AllPoultry>>.loading().obs;
Rxn<AllPoultry> selectedPoultry = Rxn();
//step 2
Rx<Resource<List<KillRequestPoultry>>> poultryList = Resource<List<KillRequestPoultry>>.success(
[],
).obs;
Rxn<KillRequestPoultry> selectedKillRequestPoultry = Rxn();
//step 3
Rx<Resource<List<PoultryHatching>>> poultryHatchingList = Resource<List<PoultryHatching>>.success(
[],
).obs;
Rxn<PoultryHatching> selectedPoultryHatching = Rxn();
//step 5
Rx<Resource<List<KillHousePoultry>>> killHouseList = Resource<List<KillHousePoultry>>.success(
[],
).obs;
Rxn<KillHousePoultry> selectedKillHouse = Rxn();
@override
void onReady() {
super.onReady();
getApprovedPrice();
getAllPoultryList();
getSellForFreezing();
getPoultryExport();
priceListener();
ever(selectedKillRequestPoultry, (callback) {
if (callback?.provinceAllowChooseKillHouse?.allowState ?? false) {
getKillHouseList();
}
});
everAll(
[selectedPoultry, selectedKillRequestPoultry, selectedPoultryHatching, selectedKillHouse],
(callback) {
checkSubmitButton();
},
);
}
@override
void onClose() {
super.onClose();
quantityKillsController.dispose();
quantityLoseController.dispose();
averageWeightKillsController.dispose();
priceFreeSaleController.dispose();
clearSelectedStep1();
clearSelectedStep2();
selectedKillHouse.value = null;
killHouseList.value = Resource<List<KillHousePoultry>>.success([]);
}
void priceListener() {
quantityKillsController.addListener(() {
if (averageWeightKillsController.text.isNotEmpty && quantityKillsController.text.isNotEmpty) {
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
priceFreeSaleController.text = generatedApprovedPrice.value.separatedByComma;
checkSubmitButton();
} else {
generatedApprovedPrice.value = 0;
priceFreeSaleController.text = '0';
checkSubmitButton();
}
});
averageWeightKillsController.addListener(() {
if (averageWeightKillsController.text.isNotEmpty && quantityKillsController.text.isNotEmpty) {
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
priceFreeSaleController.text = generatedApprovedPrice.value.separatedByComma;
checkSubmitButton();
} else {
generatedApprovedPrice.value = 0;
priceFreeSaleController.text = '0';
checkSubmitButton();
}
});
priceFreeSaleController.addListener(() {
final text = priceFreeSaleController.text;
if (text.isNotEmpty) {
generatedApprovedPrice.value = int.parse(text.replaceAll(',', ''));
} else {
generatedApprovedPrice.value = 0;
}
checkSubmitButton();
});
}
void clearSelectedStep1() {
selectedPoultry.value = null;
selectedKillRequestPoultry.value = null;
selectedPoultryHatching.value = null;
poultryList.value = Resource<List<KillRequestPoultry>>.success([]);
poultryHatchingList.value = Resource<List<PoultryHatching>>.success([]);
}
void clearSelectedStep2() {
selectedKillRequestPoultry.value = null;
selectedPoultryHatching.value = null;
poultryHatchingList.value = Resource<List<PoultryHatching>>.success([]);
}
Future<void> getApprovedPrice() async {
await safeCall(
call: () async => await rootLogic.poultryRepository.getApprovedPrice(
token: tokenService.accessToken.value ?? '',
),
onSuccess: (result) {
if (result != null) {
approvedPrice.value = result;
}
},
onError: (error, stackTrace) {},
);
}
Future<void> getAllPoultryList() async {
await safeCall(
call: () async => await rootLogic.poultryRepository.getAllPoultry(
token: tokenService.accessToken.value ?? '',
queryParameters: buildRawQueryParams(role: gService.getRole(Module.chicken)),
),
onSuccess: (result) {
if (result != null) {
allPoultryList.value = Resource<List<AllPoultry>>.success(result);
}
},
onError: (error, stackTrace) {
allPoultryList.value = Resource<List<AllPoultry>>.error('$error -- $stackTrace');
},
);
}
Future<void> getSellForFreezing() async {
await safeCall(
call: () async => await rootLogic.poultryRepository.getSellForFreezing(
token: tokenService.accessToken.value ?? '',
),
onSuccess: (result) {
if (result != null) {
sellForFreezing.value = result;
}
},
onError: (error, stackTrace) {},
);
}
Future<void> getPoultryExport() async {
await safeCall(
call: () async => await rootLogic.poultryRepository.getPoultryExport(
token: tokenService.accessToken.value ?? '',
),
onSuccess: (result) {
if (result != null) {
poultryExport.value = result;
}
},
onError: (error, stackTrace) {},
);
}
Future<void> getUserPoultryList() async {
poultryList.value = Resource<List<KillRequestPoultry>>.loading();
await safeCall(
call: () async => await rootLogic.poultryRepository.getUserPoultry(
token: tokenService.accessToken.value ?? '',
queryParameters: buildQueryParams(
value: selectedPoultry.value?.user?.mobile,
queryParams: {'type': 'filter'},
),
),
onSuccess: (result) {
if (result != null) {
poultryList.value = Resource<List<KillRequestPoultry>>.success(result);
}
},
onError: (error, stackTrace) {
poultryList.value = Resource<List<KillRequestPoultry>>.error('$error -- $stackTrace');
},
);
}
Future<void> getPoultryHatchingList() async {
poultryHatchingList.value = Resource<List<PoultryHatching>>.loading();
await safeCall(
call: () async => await rootLogic.poultryRepository.getPoultryHatching(
token: tokenService.accessToken.value ?? '',
queryParameters: buildRawQueryParams(
queryParams: {'key': selectedKillRequestPoultry.value?.key},
),
),
onSuccess: (result) {
if (result != null) {
poultryHatchingList.value = Resource<List<PoultryHatching>>.success(result);
}
},
onError: (error, stackTrace) {
poultryHatchingList.value = Resource<List<PoultryHatching>>.error('$error -- $stackTrace');
},
);
}
Future<void> getKillHouseList() async {
killHouseList.value = Resource<List<KillHousePoultry>>.loading();
await safeCall(
call: () async => await rootLogic.poultryRepository.getKillHouseList(
token: tokenService.accessToken.value ?? '',
queryParameters: buildRawQueryParams(
queryParams: {'show_poultry': '', 'date': DateTime.now().formattedDashedGregorian},
),
),
onSuccess: (result) {
if (result != null) {
killHouseList.value = Resource<List<KillHousePoultry>>.success(result);
}
},
onError: (error, stackTrace) {
killHouseList.value = Resource<List<KillHousePoultry>>.error('$error -- $stackTrace');
},
);
}
double calculateApprovedPrice() {
final inputWeight = double.parse(averageWeightKillsController.text) * 1000;
final lowestWeight = approvedPrice.value?.lowestWeight ?? 0;
final highestWeight = approvedPrice.value?.highestWeight ?? 0;
final lowestPrice = approvedPrice.value?.lowestPrice ?? 0;
final highestPrice = approvedPrice.value?.highestPrice ?? 0;
if (inputWeight <= lowestWeight) {
return lowestPrice;
} else if (inputWeight >= highestWeight) {
return highestPrice;
} else {
final diffWeight = highestWeight - lowestWeight;
final diffPrice = highestPrice - lowestPrice;
final fraction = diffPrice / diffWeight;
final diffFromMinWeight = inputWeight - lowestWeight;
return diffFromMinWeight * fraction + lowestPrice;
}
}
void changeSaleType() {
isFreeSale.value = !isFreeSale.value;
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
}
void checkSubmitButton() {
isOnSubmitLoading.value =
selectedPoultry.value != null &&
selectedKillRequestPoultry.value != null &&
selectedPoultryHatching.value != null &&
quantityKillsController.text.isNotEmpty &&
averageWeightKillsController.text.isNotEmpty &&
((selectedKillRequestPoultry.value?.provinceAllowChooseKillHouse?.mandatory ?? false)
? selectedKillHouse.value != null
: true);
}
Future<void> submitKillRegistration() async {
isOnSubmitLoading.value = false;
if (!formKey.currentState!.validate()) {
return;
}
KillRegistrationRequest registrationRequest = KillRegistrationRequest(
indexWeight: double.parse(averageWeightKillsController.text),
amount: generatedApprovedPrice.value,
approvedPrice: approvedPrice.value?.approved ?? false,
auctionList: [],
cash: true,
chickenBreed: selectedPoultryHatching.value?.chickenBreed,
confirmPoultryMobile: selectedPoultry.value?.user?.mobile,
credit: false,
export: isExportSelected.value,
financialOperation: "outside-system",
freeSaleInProvince: isMarketSelected.value,
freezing: isFreezedSelected.value,
killHouseList: [
if (selectedKillHouse.value != null)
'${selectedKillHouse.value?.name}(${selectedKillHouse.value?.fullname})',
],
killReqKey: selectedKillHouse.value?.killReqKey,
losses: quantityLoseController.text,
market: isMarketSelected.value,
operatorKey: "",
poultryHatchingKey: selectedPoultryHatching.value?.key,
poultryKey: selectedPoultry.value?.key,
quantity: int.parse(quantityKillsController.text),
role: gService.getRole(Module.chicken),
sendDate: killsDate.value.toDateTime().formattedDashedGregorian,
);
await safeCall(
call: () async => await rootLogic.poultryRepository.submitKillRegistration(
token: tokenService.accessToken.value ?? '',
request: registrationRequest,
),
onSuccess: (result) async {
defaultShowSuccessMessage(
'ثبت با موفقیت انجام شد',
onDismissed: () {
Get.back(id: poultryFirstKey);
},
);
},
onError: (error, stackTrace) {},
);
}
}

View File

@@ -0,0 +1,496 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rasadyar_chicken/data/models/response/all_poultry/all_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/kill_house_poultry/kill_house_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/kill_request_poultry/kill_request_poultry.dart';
import 'package:rasadyar_chicken/data/models/response/poultry_hatching/poultry_hatching.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class KillingRegistrationPage extends GetView<KillingRegistrationLogic> {
const KillingRegistrationPage({super.key});
@override
Widget build(BuildContext context) {
return BasePageWithScroll(
hasSearch: false,
hasFilter: false,
routes: controller.routes,
onBackPressed: () => Get.back(id: poultryFirstKey),
widgets: [
poultryFarmWidget(),
poultryUserListWidget(),
poultryHatchingWidget(),
ObxValue((data) {
return Visibility(
visible: controller.selectedPoultryHatching.value != null,
child: Form(
key: controller.formKey,
child: Column(
children: [
informationWidget(),
killDateWidget(
date: controller.killsDate,
onChanged: (Jalali jalali) {
controller.killsDate.value = jalali;
},
),
loseWidget(),
quantityKillsWidget(),
averageWeightKillsWidget(),
saleTypeWidget(),
priceWidget(),
buyerListWidget(),
slaughterhouseSelectedWidget(),
submitButtonWidget(),
],
),
),
);
}, controller.selectedPoultryHatching),
],
);
}
Widget informationWidget() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
child: ObxValue(
(data) => Column(
spacing: 8,
children: [
buildUnitRow(
title: 'تعداد جوجه ریزی',
value: data.value?.quantity.separatedByCommaFa,
unit: 'قطعه',
),
buildUnitRow(
title: 'جمع تلفات ثبت شده دامپزشک و مرغدار',
value: data.value?.losses.separatedByCommaFa,
unit: 'قطعه',
),
buildUnitRow(
title: 'باقیمانده',
value: data.value?.leftOver.separatedByCommaFa,
unit: 'قطعه',
),
buildUnitRow(
title: 'سن مرغ',
value: data.value?.chickenAge.separatedByCommaFa,
unit: 'روز',
),
buildUnitRow(
title: 'مجوز فروش آزاد',
value: data.value?.freeGovernmentalInfo?.totalFreeCommitmentQuantity.separatedByCommaFa,
unit: 'قطعه',
),
buildUnitRow(
title: 'مانده فروش آزاد',
value: data
.value
?.freeGovernmentalInfo
?.leftTotalFreeCommitmentQuantity
.separatedByCommaFa,
unit: 'قطعه',
),
],
),
controller.selectedPoultryHatching,
),
);
}
Widget poultryFarmWidget() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
child: ObxValue((data) {
return ResourceOverlayDropdown<AllPoultry>(
items: data.value,
background: Colors.white,
onChanged: (value) {
controller.clearSelectedStep1();
controller.selectedPoultry.value = value;
controller.getUserPoultryList();
},
selectedItem: controller.selectedPoultry.value,
itemBuilder: (item) => Text(labelPoultry(item), maxLines: 2),
labelBuilder: (item) => Text(labelPoultry(item)),
);
}, controller.allPoultryList),
);
}
String labelPoultry(AllPoultry? item) {
if (item == null) {
return 'انتخاب مرغداری';
} else {
return '${item.unitName} (${item.address?.city?.name}) / ${item.user?.fullname} (${item.user?.mobile}) / ${item.lastHatchingRemainQuantity} قطعه ';
}
}
Widget poultryUserListWidget() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: ObxValue((data) {
return ResourceOverlayDropdown<KillRequestPoultry>(
items: data.value,
background: Colors.white,
onChanged: (value) {
controller.clearSelectedStep2();
controller.selectedKillRequestPoultry.value = value;
controller.getPoultryHatchingList();
},
selectedItem: controller.selectedKillRequestPoultry.value,
itemBuilder: (item) => Text(item.unitName ?? '-'),
labelBuilder: (item) => Text(item?.unitName ?? 'محل پرورش'),
);
}, controller.poultryList),
);
}
Widget poultryHatchingWidget() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
child: ObxValue((data) {
return ResourceOverlayDropdown<PoultryHatching>(
items: data.value,
background: Colors.white,
onChanged: (value) {
controller.selectedPoultryHatching.value = value;
},
selectedItem: controller.selectedPoultryHatching.value,
itemBuilder: (item) => Text(labelPoultryHatching(item)),
labelBuilder: (item) => Text(labelPoultryHatching(item)),
);
}, controller.poultryHatchingList),
);
}
String labelPoultryHatching(PoultryHatching? item) {
if (item == null) {
return 'دوره جوجه ریزی';
} else {
return ' دوره ${item.period} سالن ${item.hall} نژاد ${item.chickenBreed} باقیمانده ${item.leftOver} قطعه ';
}
}
Widget killDateWidget({required Rx<Jalali> date, required Function(Jalali jalali) onChanged}) {
return GestureDetector(
onTap: () {
Get.bottomSheet(modalDatePicker(onDateSelected: (value) => onChanged(value)));
},
child: Container(
height: 40,
margin: EdgeInsets.symmetric(horizontal: 20.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.darkGreyLight),
),
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.yekan14.copyWith(color: AppColor.bgDark)),
Spacer(),
ObxValue((data) {
return Text(
date.value.formatCompactDate(),
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
);
}, date),
],
),
),
);
}
Widget loseWidget() {
return Padding(
padding: EdgeInsets.fromLTRB(20.w, 10.h, 20.w, 0),
child: RTextField(
label: 'تعداد تلفات (قطعه)',
filled: true,
filledColor: Colors.white,
keyboardType: TextInputType.number,
controller: controller.quantityLoseController,
),
);
}
Widget quantityKillsWidget() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
child: RTextField(
label: 'تعداد کشتار (قطعه)',
filled: true,
validator: (value) {
if (value == null || value.isEmpty) {
return 'تعداد کشتار را وارد کنید';
}
final count = double.tryParse(value.replaceAll(',', ''));
if (controller.isFreeSale.value) {
if (count! >
(controller
.selectedPoultryHatching
.value
?.freeGovernmentalInfo
?.leftTotalFreeCommitmentQuantity ??
0)) {
return 'مجوز فروش آزاد شما کافی نیست';
}
} else {
if (count! > (controller.selectedPoultryHatching.value?.leftOver ?? 0)) {
return 'تعداد کشتار نباید بیشتر از باقیمانده جوجه ریزی باشد';
}
}
return null;
},
textInputAction: TextInputAction.next,
filledColor: Colors.white,
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly, SeparatorInputFormatter()],
controller: controller.quantityKillsController,
),
);
}
Widget averageWeightKillsWidget() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: RTextField(
label: 'میانگین وزن (کیلوگرم)',
filled: true,
validator: (value) {
if (value == null || value.isEmpty) {
return 'میانگین وزن را وارد کنید';
}
final weight = double.tryParse(value.replaceAll(',', ''));
if (weight == null || weight <= 0) {
return 'میانگین وزن باید عددی بزرگتر از صفر باشد';
} else if (weight >
(controller.selectedPoultryHatching.value?.managementHatchingAgeRange?.toWeight ??
10000) ||
weight <
(controller
.selectedPoultryHatching
.value
?.managementHatchingAgeRange
?.fromWeight ??
-10000)) {
return 'میانگین وزن باید بین ${controller.selectedPoultryHatching.value?.managementHatchingAgeRange?.fromWeight} تا ${controller.selectedPoultryHatching.value?.managementHatchingAgeRange?.toWeight} کیلوگرم باشد';
}
return null;
},
filledColor: Colors.white,
keyboardType: TextInputType.number,
controller: controller.averageWeightKillsController,
),
);
}
Widget saleTypeWidget() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
child: ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
CustomChip(
title: 'فروش دولتی',
index: 0,
onTap: (int p1) {
controller.changeSaleType();
},
isSelected: !(data.value),
),
CustomChip(
title: 'فروش آزاد',
index: 1,
onTap: (int p1) {
controller.changeSaleType();
},
isSelected: data.value,
),
],
);
}, controller.isFreeSale),
);
}
Widget priceWidget() {
return ObxValue((data){
if(!data.value){
return Container(
height: 40.h,
margin: EdgeInsets.symmetric(horizontal: 20.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1.w, color: AppColor.darkGreyLight),
),
padding: EdgeInsets.symmetric(horizontal: 11.w, vertical: 4.h),
child: Row(
spacing: 8,
children: [
Text('قیمت مصوب', style: AppFonts.yekan14.copyWith(color: AppColor.bgDark)),
Spacer(),
ObxValue((data) {
return Text(
' ${data.value.separatedByCommaFa} ریال',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
);
}, controller.generatedApprovedPrice),
],
),
);
}else{
return Padding(
padding: EdgeInsets.fromLTRB(20.w, 10.h, 20.w, 0),
child: RTextField(
label: 'قیمت پیشنهادی (ریال)',
validator: (value) {
if (value == null || value.isEmpty) {
return 'قیمت پیشنهادی را وارد کنید';
}
final price = double.tryParse(value.replaceAll(',', ''));
dLog(controller.priceFreeSaleController.text);
fLog(value);
if (price == null || price <= 0) {
return 'قیمت پیشنهادی باید عددی بزرگتر از صفر باشد';
}
return null;
},
filled: true,
filledColor: Colors.white,
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly, SeparatorInputFormatter()],
controller: controller.priceFreeSaleController,
),
);
}
}, controller.isFreeSale);
}
Widget buyerListWidget() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
child: ObxValue((data) {
return Visibility(
visible: data.value?.provinceAllowChooseKillHouse?.allowState ?? false,
child: ObxValue((data) {
return ResourceOverlayDropdown<KillHousePoultry>(
items: data.value,
background: Colors.white,
onChanged: (value) {
controller.selectedKillHouse.value = value;
},
selectedItem: controller.selectedKillHouse.value,
itemBuilder: (item) => Text(buildKillHouseLabel(item)),
labelBuilder: (item) => Text(buildKillHouseLabel(item)),
);
}, controller.killHouseList),
);
}, controller.selectedKillRequestPoultry),
);
}
String buildKillHouseLabel(KillHousePoultry? item) {
if (item == null) {
return 'خریدار/ظرفیت باقیمانده';
} else {
return '${item.name} / ${item.quantitySum} قطعه ';
}
}
Widget slaughterhouseSelectedWidget() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: Wrap(
spacing: 10,
runSpacing: 10,
children: [
ObxValue((data) {
return Visibility(
visible: data.value?.permission ?? false,
child: ObxValue(
(data) => CheckBoxChips(
title: 'کشتار برای انجماد',
data: data.value,
onTap: (p1) {
controller.isFreezedSelected.value = !controller.isFreezedSelected.value;
},
isSelected: data.value,
),
controller.isFreezedSelected,
),
);
}, controller.sellForFreezing),
ObxValue((data) {
return CheckBoxChips(
title: 'نمایش در پنل معاملات',
data: 0,
onTap: (int p1) {
controller.isMarketSelected.value = !controller.isMarketSelected.value;
},
isSelected: data.value,
);
}, controller.isMarketSelected),
ObxValue((data) {
return Visibility(
visible: data.value?.allow ?? false,
child: ObxValue((data) {
return CheckBoxChips(
title: 'کشتار برای صادرات',
data: data.value,
onTap: (_) {
controller.isExportSelected.value = !controller.isExportSelected.value;
},
isSelected: data.value,
);
}, controller.isExportSelected),
);
}, controller.poultryExport),
],
),
);
}
Widget submitButtonWidget() {
return ObxValue((data) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.h),
child: RElevated(
enabled: data.value,
height: 45.h,
isFullWidth: true,
backgroundColor: AppColor.greenNormal,
textStyle: AppFonts.yekan16Bold.copyWith(color: Colors.white),
onPressed: () {
controller.submitKillRegistration();
},
text: 'ثبت کشتار',
),
);
}, controller.isOnSubmitLoading);
}
}

View File

@@ -18,7 +18,7 @@ class PoultryActionLogic extends GetxController {
),
PoultryActionItem(
title: "ثبت کشتار",
route: ChickenRoutes.killingRegistrationPoultryScience,
route: ChickenRoutes.genocidePoultryScience,
icon: Assets.vec.noteRemoveSvg.path,
),
PoultryActionItem(

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_core/core.dart';
@@ -53,7 +54,7 @@ class PoultryActionPage extends GetView<PoultryActionLogic> {
vecIcon: item.icon,
iconColor: AppColor.blueNormal,
onTap: () async {
Get.toNamed(item.route, id: 0);
Get.toNamed(item.route, id: poultryFirstKey);
},
);
},

View File

@@ -4,6 +4,7 @@ import 'package:rasadyar_chicken/data/repositories/poultry_science/poultry_scien
import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/home/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/poultry_action/view.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
import 'package:rasadyar_core/core.dart';
@@ -12,9 +13,11 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
class PoultryScienceRootLogic extends GetxController {
RxInt currentPage = 1.obs;
List<Widget> pages = [PoultryActionPage(), PoultryScienceHomePage(), ProfilePage()];
late DioRemote dioRemote;
var tokenService = Get.find<TokenStorageService>();
late PoultryScienceRepository poultryRepository;
RxList<ErrorLocationType> errorLocationType = RxList();
RxMap<int, dynamic> homeExpandedList = RxMap();
@@ -46,4 +49,17 @@ class PoultryScienceRootLogic extends GetxController {
void changePage(int index) {
currentPage.value = index;
}
int getNestedKey() {
switch (currentPage.value) {
case 0:
return poultryFirstKey;
case 1:
return poultrySecondKey;
case 2:
return poultryThirdKey;
default:
return poultryFirstKey;
}
}
}

View File

@@ -18,7 +18,7 @@ class PoultryScienceRootPage extends GetView<PoultryScienceRootLogic> {
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, result) async {
final nestedKey = Get.nestedKey(controller.currentPage.value);
final nestedKey = Get.nestedKey(controller.getNestedKey());
final currentNavigator = nestedKey?.currentState;
if (currentNavigator?.canPop() ?? false) {

View File

@@ -92,7 +92,7 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
),
),
Text(
'${item.weightOfCarcasses?.separatedByComma}kg',
'${item.weightOfCarcasses?.separatedByCommaFa}kg',
textAlign: TextAlign.left,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
@@ -206,9 +206,9 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
buildRow(
title: 'وزن خریداری شده',
value: '${item.weightOfCarcasses?.separatedByComma} کیلوگرم',
value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم',
),
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByComma} ریال'),
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByCommaFa} ریال'),
Visibility(
visible: item.receiverState == 'pending',
child: Row(

View File

@@ -109,7 +109,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
),
),
Text(
'${item.weightOfCarcasses?.separatedByComma}kg',
'${item.weightOfCarcasses?.separatedByCommaFa}kg',
textAlign: TextAlign.left,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
@@ -218,9 +218,9 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
buildRow(
title: 'وزن خریداری شده',
value: '${item.weightOfCarcasses?.separatedByComma} کیلوگرم',
value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم',
),
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByComma} ریال'),
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByCommaFa} ریال'),
Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 16.w,

View File

@@ -142,7 +142,7 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
buildRow(
title: 'وزن خریداری شده',
value: '${item.weightOfCarcasses?.separatedByComma} کیلوگرم',
value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم',
),
buildRowOnTapped(
title: 'مشاهده بارنامه',
@@ -269,7 +269,7 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
),
),
Text(
'${item.weightOfCarcasses?.separatedByComma}kg',
'${item.weightOfCarcasses?.separatedByCommaFa}kg',
textAlign: TextAlign.left,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
@@ -427,7 +427,7 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
Text(item?.name ?? 'انتخاب محصول'),
Spacer(),
Text(
'موجودی:${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByComma ?? 0}',
'موجودی:${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByCommaFa ?? 0}',
),
],
),

View File

@@ -175,7 +175,7 @@ class HomePage extends GetView<HomeLogic> {
child: _informationIconCard(
title: 'توزیع داخل استان',
isLoading: data.value == null,
description: data.value?.freeSalesWeight.separatedByComma ?? '0',
description: data.value?.freeSalesWeight.separatedByCommaFa ?? '0',
iconPath: Assets.vec.truckSvg.path,
iconColor: const Color.fromRGBO(85, 97, 93, 1),
bgDescriptionColor: const Color(0xFFE6FAF5),
@@ -186,7 +186,7 @@ class HomePage extends GetView<HomeLogic> {
child: _informationIconCard(
title: 'توزیع خارج استان',
isLoading: data.value == null,
description: data.value?.stewardAllocationsWeight.separatedByComma ?? '0',
description: data.value?.stewardAllocationsWeight.separatedByCommaFa ?? '0',
iconPath: Assets.vec.truckFastSvg.path,
iconColor: Color(0xFF647379),
bgDescriptionColor: const Color(0xFFEAEFFF),
@@ -223,7 +223,7 @@ class HomePage extends GetView<HomeLogic> {
description: data.value != null
? ((data.value?.provinceGovernmentalCarcassesWeight ?? 0) +
(data.value?.provinceFreeCarcassesWeight ?? 0))
.separatedByComma
.separatedByCommaFa
: '0',
iconPath: Assets.vec.cubeSvg.path,
iconColor: const Color(0xFF6C5D60),
@@ -235,7 +235,7 @@ class HomePage extends GetView<HomeLogic> {
child: _informationLabelCard(
title: 'خارج استان',
isLoading: data.value == null,
description: data.value?.freeBuyingCarcassesWeight.separatedByComma ?? '0',
description: data.value?.freeBuyingCarcassesWeight.separatedByCommaFa ?? '0',
iconPath: Assets.vec.cubeSearchSvg.path,
iconColor: Color(0xFF2D5FFF),
bgLabelColor: const Color(0xFFAFCBFF),
@@ -259,7 +259,7 @@ class HomePage extends GetView<HomeLogic> {
child: _informationLabelCard(
title: 'مانده انبار',
isLoading: data.value == null,
description: data.value?.totalRemainWeight.separatedByComma ?? '0',
description: data.value?.totalRemainWeight.separatedByCommaFa ?? '0',
iconPath: Assets.vec.cubeSearchSvg.path,
iconColor: const Color(0xFF426060),
bgDescriptionColor: const Color(0xFFC7DFE0),
@@ -270,7 +270,7 @@ class HomePage extends GetView<HomeLogic> {
child: _informationLabelCard(
title: 'توزیع شده',
isLoading: data.value == null,
description: data.value?.realAllocatedWeight.separatedByComma ?? '0',
description: data.value?.realAllocatedWeight.separatedByCommaFa ?? '0',
iconPath: Assets.vec.cubeRotateSvg.path,
iconColor: Color(0xFF5C4D64),
bgLabelColor: Color(0xFFC8B8D1),
@@ -295,7 +295,7 @@ class HomePage extends GetView<HomeLogic> {
title: 'بارهای امروز',
titleColor: AppColor.blueNormal,
isLoading: data.value == null,
description: data.value?.separatedByComma ?? '0',
description: data.value?.separatedByCommaFa ?? '0',
iconPath: Assets.vec.cubeSearchSvg.path,
iconColor: AppColor.blueNormal,
bgDescriptionColor: Colors.white,
@@ -314,9 +314,9 @@ class HomePage extends GetView<HomeLogic> {
return _informationLabelCard(
title: 'درانتظار تایید',
isLoading: data.value == null,
description: data.value?.totalNotEnteredBars.separatedByComma ?? '0',
description: data.value?.totalNotEnteredBars.separatedByCommaFa ?? '0',
unit:
'(${data.value?.totalNotEnteredKillHouseRequestsWeight.separatedByComma})\nکیلوگرم',
'(${data.value?.totalNotEnteredKillHouseRequestsWeight.separatedByCommaFa})\nکیلوگرم',
iconPath: Assets.vec.cubeWattingSvg.path,
bgDescriptionColor: Colors.white,
gradient: LinearGradient(

View File

@@ -178,7 +178,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
),
),
Text(
'${item.weightOfCarcasses?.separatedByComma}kg',
'${item.weightOfCarcasses?.separatedByCommaFa}kg',
textAlign: TextAlign.left,
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
),
@@ -186,7 +186,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
),
SizedBox(height: 2),
Text(
'${item.amount.separatedByComma} ریال',
'${item.amount.separatedByCommaFa} ریال',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDark),
),
@@ -303,13 +303,13 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
),
buildRow(
title: 'وزن خریداری شده',
value: '${item.weightOfCarcasses?.separatedByComma} کیلوگرم',
value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم',
),
buildRow(
title: 'افت وزن(کیلوگرم)',
value: item.weightLossOfCarcasses?.toInt().toString() ?? 'N/A',
),
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByComma} ریال'),
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByCommaFa} ریال'),
buildRow(title: 'کداحراز', value: item.registrationCode?.toString() ?? 'ندارد'),
buildRow(
@@ -603,7 +603,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
Text(item?.name ?? 'انتخاب محصول'),
Spacer(),
Text(
'موجودی:${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByComma ?? 0}',
'موجودی:${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByCommaFa ?? 0}',
),
],
),
@@ -780,16 +780,16 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
buildRow(
title: 'قیمت هر کیلو',
value: '${controller.tmpStewardAllocation?.amount.separatedByComma ?? 0} ریال ',
value: '${controller.tmpStewardAllocation?.amount.separatedByCommaFa ?? 0} ریال ',
),
buildRow(
title: 'وزن تخصیصی',
value:
'${controller.tmpStewardAllocation?.weightOfCarcasses?.toInt().separatedByComma ?? 0} کیلوگرم',
'${controller.tmpStewardAllocation?.weightOfCarcasses?.toInt().separatedByCommaFa ?? 0} کیلوگرم',
),
buildRow(
title: 'قیمت کل',
value: '${controller.tmpStewardAllocation?.totalAmount.separatedByComma ?? 0} ریال',
value: '${controller.tmpStewardAllocation?.totalAmount.separatedByCommaFa ?? 0} ریال',
),
Row(

View File

@@ -156,7 +156,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
),
Text(
'${item.weightOfCarcasses?.separatedByComma ?? 0}KG',
'${item.weightOfCarcasses?.separatedByCommaFa ?? 0}KG',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
),
@@ -235,7 +235,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
buildRow(title: 'مشخصات خریدار', value: item.buyer?.fullname ?? 'N/A'),
buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'N/A'),
buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'N/A'),
buildRow(title: 'وزن لاشه', value: '${item.weightOfCarcasses?.separatedByComma}'),
buildRow(title: 'وزن لاشه', value: '${item.weightOfCarcasses?.separatedByCommaFa}'),
Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -419,7 +419,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
Text(item?.name ?? 'انتخاب محصول'),
Spacer(),
Text(
'موجودی:${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByComma ?? 0}',
'موجودی:${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByCommaFa ?? 0}',
),
],
),

View File

@@ -281,9 +281,9 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
buildRow(title: 'نام واحد', value: item.unitName ?? 'N/A'),
buildRow(
title: 'تعداد درخواست ها',
value: '${item.requestsInfo?.numberOfRequests.separatedByComma}',
value: '${item.requestsInfo?.numberOfRequests.separatedByCommaFa}',
),
buildRow(title: 'وزن', value: '${item.requestsInfo?.totalWeight.separatedByComma}'),
buildRow(title: 'وزن', value: '${item.requestsInfo?.totalWeight.separatedByCommaFa}'),
Row(
mainAxisAlignment: MainAxisAlignment.center,

View File

@@ -121,7 +121,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
),
Text(
'${item.weightOfCarcasses?.separatedByComma ?? 0}KG',
'${item.weightOfCarcasses?.separatedByCommaFa ?? 0}KG',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
),
@@ -200,7 +200,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
buildRow(title: 'مشخصات خریدار', value: item.buyer?.fullname ?? 'N/A'),
buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'N/A'),
buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'N/A'),
buildRow(title: 'وزن لاشه', value: '${item.weightOfCarcasses?.separatedByComma}'),
buildRow(title: 'وزن لاشه', value: '${item.weightOfCarcasses?.separatedByCommaFa}'),
Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -384,7 +384,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
Text(item?.name ?? 'انتخاب محصول'),
Spacer(),
Text(
'موجودی:${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByComma ?? 0}',
'موجودی:${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByCommaFa ?? 0}',
),
],
),

View File

@@ -129,7 +129,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
Expanded(
flex: 2,
child: Text(
'${item.weight.separatedByComma} KG',
'${item.weight.separatedByCommaFa} KG',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
),
@@ -204,7 +204,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
: item.buyer?.shop ?? 'N/A',
),
buildRow(title: 'ماهیت', value: item.toGuild != null ? 'مباشر' : 'قطعه‌بند'),
buildRow(title: 'وزن قطعه‌بندی', value: '${item.weight?.separatedByComma}'),
buildRow(title: 'وزن قطعه‌بندی', value: '${item.weight?.separatedByCommaFa}'),
Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -394,7 +394,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
Text(item?.name ?? 'انتخاب محصول'),
Spacer(),
Text(
'موجودی: ${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByComma ?? 0} کیلوگرم',
'موجودی: ${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByCommaFa ?? 0} کیلوگرم',
),
],
),

View File

@@ -0,0 +1,19 @@
import 'package:rasadyar_chicken/presentation/pages/common/profile/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
import 'package:rasadyar_chicken/presentation/widget/search/logic.dart';
import 'package:rasadyar_core/core.dart';
import '../widget/base_page/logic.dart';
class GlobalBinding extends Bindings {
@override
void dependencies() {
Get.put(BaseLogic(), permanent: true);
Get.lazyPut(() => ProfileLogic(), fenix: true);
Get.lazyPut(() => SearchLogic(), fenix: true);
//root logics
}
}

View File

@@ -1,20 +1,26 @@
import 'package:rasadyar_chicken/presentation/pages/common/auth/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/common/auth/view.dart';
import 'package:rasadyar_chicken/presentation/pages/common/profile/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart';
import 'package:rasadyar_chicken/presentation/pages/common/role/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/common/role/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/farm/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/farm/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/genocide/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/genocide/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/home/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/inspection/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/inspection/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/killing_registration/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/killing_registration/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/poultry_action/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/poultry_action/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/view.dart';
import 'package:rasadyar_chicken/presentation/pages/steward/steward.dart';
import 'package:rasadyar_chicken/presentation/routes/global_binding.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
import 'package:rasadyar_chicken/presentation/widget/captcha/logic.dart';
@@ -42,21 +48,22 @@ sealed class ChickenPages {
}),
),
//region Steward Pages
GetPage(
name: ChickenRoutes.initSteward,
page: () => StewardRootPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => StewardRootLogic());
Get.lazyPut(() => HomeLogic());
Get.lazyPut(() => BuyLogic());
Get.lazyPut(() => SaleLogic());
Get.lazyPut(() => ProfileLogic());
Get.lazyPut(() => SegmentationLogic());
Get.lazyPut(() => SearchLogic());
}),
bindings: [
GlobalBinding(),
BindingsBuilder(() {
Get.lazyPut(() => StewardRootLogic());
Get.lazyPut(() => HomeLogic());
Get.lazyPut(() => BuyLogic());
Get.lazyPut(() => SaleLogic());
Get.lazyPut(() => SegmentationLogic());
}),
],
),
GetPage(
@@ -154,15 +161,15 @@ sealed class ChickenPages {
name: ChickenRoutes.initPoultryScience,
page: () => PoultryScienceRootPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => SearchLogic());
Get.lazyPut(() => PoultryScienceRootLogic());
Get.lazyPut(() => StewardRootLogic());
Get.lazyPut(() => PoultryScienceHomeLogic());
Get.lazyPut(() => ProfileLogic());
Get.lazyPut(() => PoultryActionLogic());
}),
bindings: [
GlobalBinding(),
BindingsBuilder(() {
Get.lazyPut(() => PoultryScienceRootLogic());
Get.lazyPut(() => PoultryScienceHomeLogic());
Get.lazyPut(() => PoultryActionLogic());
}),
],
),
GetPage(
@@ -202,6 +209,25 @@ sealed class ChickenPages {
Get.lazyPut(() => PoultryScienceRootLogic());
}),
),
GetPage(
name: ChickenRoutes.genocidePoultryScience,
page: () => GenocidePage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => GenocideLogic());
Get.lazyPut(() => PoultryScienceRootLogic());
}),
),
GetPage(
name: ChickenRoutes.killingRegistrationPoultryScience,
page: () => KillingRegistrationPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => KillingRegistrationLogic());
Get.lazyPut(() => GenocideLogic());
Get.lazyPut(() => PoultryScienceRootLogic());
}),
),
//endregion
];
}

View File

@@ -4,6 +4,7 @@ sealed class ChickenRoutes {
static const auth = '/AuthChicken';
static const _base = '/chicken';
static const role = '$_base/role';
static const String profile = '$_base/profile';
//region Steward Routes
static const _steward = '$_base/steward';
@@ -31,6 +32,10 @@ sealed class ChickenRoutes {
static const inspectionPoultryScience = '$_poultryScience/inspection';
static const farmPoultryScience = '$_poultryScience/farm';
static const activeHatchingPoultryScience = '$_poultryScience/activeHatching';
static const killingRegistrationPoultryScience = '$_poultryScience/KillingRegistration';
static const genocidePoultryScience = '$_poultryScience/genocidePoultryScience';
static const killingRegistrationPoultryScience = '$genocidePoultryScience/KillingRegistration';
//endregion
}

View File

@@ -6,7 +6,7 @@ import 'package:rasadyar_chicken/presentation/widget/search/logic.dart';
import 'package:rasadyar_chicken/presentation/widget/search/view.dart';
import 'package:rasadyar_core/core.dart';
class BasePage extends StatefulWidget {
class BasePage extends StatefulWidget {
const BasePage({
super.key,
this.routes,
@@ -51,10 +51,11 @@ class _BasePageState extends State<BasePage> {
BaseLogic get controller => Get.find<BaseLogic>();
Worker? filterWorker;
bool _isBottomSheetOpen = false;
@override
void initState() {
super.initState();
/* filterWorker = ever(controller.isFilterSelected, (bool isSelected) {
/* filterWorker = ever(controller.isFilterSelected, (bool isSelected) {
if (!mounted) return;
if (isSelected && widget.filteringWidget != null) {
@@ -92,6 +93,7 @@ class _BasePageState extends State<BasePage> {
filterWorker?.dispose();
super.dispose();
}
void _onFilterTap() {
if (widget.hasFilter && widget.filteringWidget != null) {
// بررسی اینکه آیا این route در top است یا نه
@@ -110,7 +112,6 @@ class _BasePageState extends State<BasePage> {
}
}
@override
Widget build(BuildContext context) {
return PopScope(
@@ -143,3 +144,109 @@ class _BasePageState extends State<BasePage> {
);
}
}
class BasePageWithScroll extends StatefulWidget {
const BasePageWithScroll({
super.key,
this.routes,
required this.widgets,
this.routesWidget,
this.floatingActionButtonLocation,
this.floatingActionButton,
this.onSearchChanged,
this.hasBack = true,
this.hasFilter = true,
this.hasSearch = true,
this.isBase = false,
this.onBackPressed,
this.onFilterTap,
this.onSearchTap,
this.filteringWidget,
}) : assert(
(routes != null) || routesWidget != null,
'Either routes or routesWidget must be provided.',
);
final List<String>? routes;
final Widget? routesWidget;
final List<Widget> widgets;
final FloatingActionButtonLocation? floatingActionButtonLocation;
final Widget? floatingActionButton;
final Widget? filteringWidget;
final void Function(String?)? onSearchChanged;
final bool hasBack;
final bool hasFilter;
final bool hasSearch;
final bool isBase;
final VoidCallback? onBackPressed;
final GestureTapCallback? onFilterTap;
final GestureTapCallback? onSearchTap;
@override
State<BasePageWithScroll> createState() => _BasePageWithScrollState();
}
class _BasePageWithScrollState extends State<BasePageWithScroll> {
BaseLogic get controller => Get.find<BaseLogic>();
Worker? filterWorker;
@override
void dispose() {
filterWorker?.dispose();
super.dispose();
}
void _onFilterTap() {
if (widget.hasFilter && widget.filteringWidget != null) {
// بررسی اینکه آیا این route در top است یا نه
final currentRoute = ModalRoute.of(context);
if (currentRoute?.isCurrent != true) {
return;
}
// مستقیماً bottomSheet را باز کنید
Get.bottomSheet(
widget.filteringWidget!,
isScrollControlled: true,
isDismissible: true,
enableDrag: true,
);
}
}
@override
Widget build(BuildContext context) {
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, result) => widget.onBackPressed,
child: Scaffold(
backgroundColor: AppColor.bgLight,
appBar: chickenAppBar(
hasBack: widget.isBase ? false : widget.hasBack,
onBackPressed: widget.onBackPressed,
hasFilter: widget.hasFilter,
hasSearch: widget.hasSearch,
isBase: widget.isBase,
onFilterTap: widget.hasFilter ? _onFilterTap : null,
onSearchTap: widget.hasSearch ? () => Get.find<SearchLogic>().toggleSearch() : null,
),
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(vertical: 8.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.routesWidget != null ? widget.routesWidget! : buildPageRoute(widget.routes!),
if (!widget.isBase && widget.hasSearch) ...{
SearchWidget(onSearchChanged: widget.onSearchChanged),
},
...widget.widgets,
],
),
),
floatingActionButtonLocation: widget.floatingActionButtonLocation,
floatingActionButton: widget.floatingActionButton,
),
);
}
}

View File

@@ -15,7 +15,7 @@ Widget inventoryWidget(StewardRootLogic rootLogic) {
alignment: Alignment.center,
child: ObxValue((data) {
return Text(
' موجودی انبار: ${data.value?.totalRemainWeight?.toInt().separatedByComma ?? '0'} کیلوگرم',
' موجودی انبار: ${data.value?.totalRemainWeight?.toInt().separatedByCommaFa ?? '0'} کیلوگرم',
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkHover),
);
}, rootLogic.inventoryModel),

View File

@@ -16,12 +16,7 @@ class AppModel extends HiveObject {
@HiveField(3)
List<TargetPage>? targetPages;
AppModel({
this.isFirstRun,
this.isDarkMode,
this.selectedModule,
this.targetPages,
});
AppModel({this.isFirstRun, this.isDarkMode, this.selectedModule, this.targetPages});
@override
String toString() {
@@ -40,6 +35,9 @@ class TargetPage extends HiveObject {
@HiveField(2)
Module? module;
@HiveField(3)
String? selectedRole;
TargetPage({required this.route, this.functions, this.module});
@override

View File

@@ -63,19 +63,21 @@ class TargetPageAdapter extends TypeAdapter<TargetPage> {
route: fields[0] as String?,
functions: (fields[1] as List?)?.cast<String>(),
module: fields[2] as Module?,
);
)..selectedRole = fields[3] as String?;
}
@override
void write(BinaryWriter writer, TargetPage obj) {
writer
..writeByte(3)
..writeByte(4)
..writeByte(0)
..write(obj.route)
..writeByte(1)
..write(obj.functions)
..writeByte(2)
..write(obj.module);
..write(obj.module)
..writeByte(3)
..write(obj.selectedRole);
}
@override

View File

@@ -46,8 +46,9 @@ class GService extends GetxService {
return res;
}
Future<void> saveSelectedRole(Module module, String route) async {
Future<void> saveRoute(Module module, String route) async {
AppModel model = box.values.first;
TargetPage? targetPage = model.targetPages?.firstWhere((element) => element.module == module);
if (targetPage != null) {
targetPage.route = route;
@@ -55,10 +56,21 @@ class GService extends GetxService {
}
}
String? getSelectedRole(Module module) {
TargetPage? targetPage = getTargetPage(module);
String? getRoute(Module module) {
return getTargetPage(module)?.route;
}
return targetPage?.route;
Future<void> saveRole(Module module, String role) async {
AppModel model = box.values.first;
TargetPage? targetPage = model.targetPages?.firstWhere((element) => element.module == module);
if (targetPage != null) {
targetPage.selectedRole = role;
model.save();
}
}
String? getRole(Module module) {
return getTargetPage(module)?.selectedRole;
}
Future<void> setIsNotFirstTime() async {

View File

@@ -3,13 +3,13 @@ import 'package:flutter/material.dart';
import '../../../core.dart';
GestureDetector dateFilterWidget({
isFrom = true,
bool isFrom = true,
required Rx<Jalali> date,
required Function(Jalali jalali) onChanged,
}) {
return GestureDetector(
onTap: () {
Get.bottomSheet(modalDatePicker((value) => onChanged(value)));
Get.bottomSheet(modalDatePicker(onDateSelected: (value) => onChanged(value)));
},
child: Container(
height: 35,
@@ -42,8 +42,8 @@ GestureDetector dateFilterWidget({
);
}
Container modalDatePicker(ValueChanged<Jalali> onDateSelected) {
Jalali? tempPickedDate;
Container modalDatePicker({required ValueChanged<Jalali> onDateSelected,Jalali? initialDate,}) {
Jalali? datePicked;
return Container(
height: 250,
color: Colors.white,
@@ -58,7 +58,7 @@ Container modalDatePicker(ValueChanged<Jalali> onDateSelected) {
width: 70,
textStyle: AppFonts.yekan14.copyWith(color: Colors.white),
onPressed: () {
onDateSelected(tempPickedDate ?? Jalali.now());
onDateSelected(initialDate ?? Jalali.now());
Get.back();
},
text: 'تایید',
@@ -70,7 +70,7 @@ Container modalDatePicker(ValueChanged<Jalali> onDateSelected) {
backgroundColor: AppColor.error,
textStyle: AppFonts.yekan14.copyWith(color: Colors.white),
onPressed: () {
onDateSelected(tempPickedDate ?? Jalali.now());
onDateSelected(initialDate ?? Jalali.now());
Get.back();
},
text: 'لغو',
@@ -81,10 +81,10 @@ Container modalDatePicker(ValueChanged<Jalali> onDateSelected) {
Divider(height: 0, thickness: 1),
Expanded(
child: PersianCupertinoDatePicker(
initialDateTime: Jalali.now(),
initialDateTime: initialDate ??Jalali.now(),
mode: PersianCupertinoDatePickerMode.date,
onDateTimeChanged: (dateTime) {
tempPickedDate = dateTime;
datePicked = dateTime;
},
),
),

View File

@@ -108,3 +108,65 @@ class RFilterChips extends StatelessWidget {
);
}
}
class CheckBoxChips<T> extends StatelessWidget {
const CheckBoxChips({
super.key,
this.isSelected = false,
required this.title,
required this.data,
required this.onTap,
this.selectedColor = AppColor.blueNormal,
this.unSelectedColor = AppColor.textColor,
});
final bool isSelected;
final String title;
final T data;
final Function(T) onTap;
final Color selectedColor;
final Color unSelectedColor;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
onTap.call(data);
},
child: Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 6.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: isSelected ? selectedColor : unSelectedColor, width: 1),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: 12.w,
height: 12.h,
child: Checkbox(
value: isSelected,
onChanged: (value) {
onTap.call(data);
},
visualDensity: VisualDensity.compact,
activeColor: selectedColor,
checkColor: Colors.white,
side: BorderSide(color: isSelected ? selectedColor : unSelectedColor, width: 1),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
),
SizedBox(width: 12.w),
Text(
title,
style: isSelected
? AppFonts.yekan12Bold.copyWith(color: AppColor.blueNormal)
: AppFonts.yekan12.copyWith(color: unSelectedColor),
),
],
),
));
}
}

View File

@@ -49,7 +49,8 @@ Widget buildRowOnTapped({
children: [
Flexible(
flex: 2,
child: titleWidget ??
child:
titleWidget ??
Text(
title ?? 'N/A',
textAlign: TextAlign.right,
@@ -60,7 +61,8 @@ Widget buildRowOnTapped({
flex: 2,
child: GestureDetector(
onTap: onTap,
child: valueWidget ??
child:
valueWidget ??
Text(
value ?? 'N/A',
textAlign: TextAlign.left,
@@ -72,3 +74,51 @@ Widget buildRowOnTapped({
),
);
}
Widget buildUnitRow({
required String title,
String? value,
required String unit,
TextStyle? titleStyle,
TextStyle? valueStyle,
TextStyle? unitStyle,
}) {
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: titleStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
),
Flexible(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
spacing: 5,
children: [
Text(
value == null || value.isEmpty ? '-' : value,
textAlign: TextAlign.left,
style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
Visibility(
visible: value != null ||( value?.isNotEmpty ?? false),
child: Text(
unit,
textAlign: TextAlign.left,
style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
),
],
),
),
],
),
);
}

View File

@@ -0,0 +1,184 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
class ResourceOverlayDropdown<T> extends StatefulWidget {
final Resource<List<T>> items;
final T? selectedItem;
final T? initialValue;
final int? height;
final Color? background;
final bool? hasDropIcon;
final Widget Function(T item) itemBuilder;
final Widget Function(T? selected) labelBuilder;
final void Function(T selected)? onChanged;
final EdgeInsets? contentPadding;
final bool isDisabled;
const ResourceOverlayDropdown({
super.key,
required this.items,
required this.itemBuilder,
required this.labelBuilder,
this.initialValue,
this.onChanged,
this.selectedItem,
this.contentPadding,
this.height,
this.background,
this.hasDropIcon = true,
this.isDisabled = false,
});
@override
State<ResourceOverlayDropdown<T>> createState() => _ResourceOverlayDropdownState<T>();
}
class _ResourceOverlayDropdownState<T> extends State<ResourceOverlayDropdown<T>> {
final GlobalKey _key = GlobalKey();
OverlayEntry? _overlayEntry;
bool _isOpen = false;
T? selectedItem;
@override
void initState() {
super.initState();
selectedItem = widget.selectedItem ?? widget.initialValue;
}
@override
void didUpdateWidget(covariant ResourceOverlayDropdown<T> oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.selectedItem != oldWidget.selectedItem) {
setState(() {
selectedItem = widget.selectedItem;
});
}
}
void _showOverlay() {
if (_overlayEntry != null) return;
final renderBox = _key.currentContext!.findRenderObject() as RenderBox;
final size = renderBox.size;
final offset = renderBox.localToGlobal(Offset.zero);
_overlayEntry = OverlayEntry(
builder: (_) => GestureDetector(
onTap: _removeOverlay,
behavior: HitTestBehavior.translucent,
child: Stack(
children: [
Positioned(
left: offset.dx,
top: offset.dy + size.height + 4,
width: size.width,
child: Material(
elevation: 4,
borderRadius: BorderRadius.circular(8),
child: Container(
decoration: BoxDecoration(
color: widget.background ?? AppColor.bgLight,
border: Border.all(color: AppColor.darkGreyLight),
borderRadius: BorderRadius.circular(8),
),
constraints: const BoxConstraints(maxHeight: 300),
child: ListView(
padding: EdgeInsets.zero,
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
children:
widget.items.data?.map((item) {
return InkWell(
onTap: () {
widget.onChanged?.call(item);
setState(() {
selectedItem = item;
});
_removeOverlay();
},
child: Padding(
padding:
widget.contentPadding ??
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: widget.itemBuilder(item),
),
);
}).toList() ??
[],
),
),
),
),
],
),
),
);
Overlay.of(context).insert(_overlayEntry!);
setState(() => _isOpen = true);
}
void _removeOverlay({bool fromDispose = false}) {
_overlayEntry?.remove();
_overlayEntry = null;
if (!fromDispose && mounted) {
setState(() => _isOpen = false);
}
}
@override
void dispose() {
_removeOverlay(fromDispose: true);
super.dispose();
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
return GestureDetector(
key: _key,
onTap: (widget.isDisabled || widget.items.status == ResourceStatus.loading)
? null
: () {
_isOpen ? _removeOverlay() : _showOverlay();
},
child: Container(
height: widget.height?.toDouble() ?? 40,
width: constraints.maxWidth,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
color: widget.background ?? AppColor.bgLight,
border: Border.all(color: AppColor.darkGreyLight),
borderRadius: BorderRadius.circular(8),
),
child: _buildWidget(widget.items),
),
);
},
);
}
Widget? _buildWidget(Resource<List<T>> items) {
switch (items.status) {
case ResourceStatus.initial:
case ResourceStatus.loading:
return CupertinoActivityIndicator();
case ResourceStatus.success:
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: widget.labelBuilder(selectedItem)),
if (widget.hasDropIcon ?? true)
Icon(_isOpen ? CupertinoIcons.chevron_up : CupertinoIcons.chevron_down, size: 14),
],
);
case ResourceStatus.error:
return Text('Error', style: AppFonts.yekan12.copyWith(color: AppColor.redNormal));
case ResourceStatus.empty:
return Text('بدون نتیجه', style: AppFonts.yekan12.copyWith(color: AppColor.textColor));
}
}
}

View File

@@ -27,7 +27,8 @@ export 'loading_widget.dart';
// other
export 'logo_widget.dart';
export 'marquee/r_marquee.dart';
export 'overlay_dropdown_widget/view.dart';
export 'overlay_dropdown_widget/overlay_dropdown.dart';
export 'overlay_dropdown_widget/resource_overlay_dropdown.dart';
export 'pagination/pagination_from_until.dart';
export 'pagination/show_more.dart';
export 'slider/slider.dart';

View File

@@ -1,8 +1,14 @@
import 'package:intl/intl.dart';
extension XNumExtension on num? {
String get separatedByComma {
String get separatedByCommaFa {
final formatter = NumberFormat('#,###', 'fa_IR');
return this == null ? '':formatter.format(this);
}
String get separatedByComma {
final formatter = NumberFormat('#,###', 'en_US');
return this == null ? '':formatter.format(this);
}
}

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import '../../core.dart';
/// Handles global API requests management with CancelToken.
class ApiHandler {
// Global CancelToken for all requests.
@@ -24,8 +25,6 @@ class ApiHandler {
}
}
typedef AppAsyncCallback<T> = Future<T> Function();
typedef ErrorCallback = Function(dynamic error, StackTrace? stackTrace);
typedef VoidCallback = void Function();
@@ -56,12 +55,11 @@ Future<T?> gSafeCall<T>({
final result = await call();
if (showSuccess) {
(onShowSuccessMessage ?? _defaultShowSuccessMessage)('عملیات با موفقیت انجام شد');
(onShowSuccessMessage ?? defaultShowSuccessMessage)('عملیات با موفقیت انجام شد');
}
onSuccess?.call(result);
return result;
} catch (error, stackTrace) {
retryCount++;
@@ -75,7 +73,6 @@ Future<T?> gSafeCall<T>({
return null;
}
if (retryCount > maxRetries || !_isRetryableError(error)) {
if (showError) {
final message = _getErrorMessage(error);
@@ -85,7 +82,6 @@ Future<T?> gSafeCall<T>({
return null;
}
if (retryCount <= maxRetries) {
await Future.delayed(retryDelay);
}
@@ -108,8 +104,7 @@ bool _isRetryableError(dynamic error) {
return error.type == DioExceptionType.connectionTimeout ||
error.type == DioExceptionType.receiveTimeout ||
error.type == DioExceptionType.sendTimeout ||
(error.response?.statusCode != null &&
error.response!.statusCode! >= 500);
(error.response?.statusCode != null && error.response!.statusCode! >= 500);
}
return false;
}
@@ -146,10 +141,7 @@ String _getErrorMessage(dynamic error) {
void _defaultShowLoading() {
// نمایش loading
Get.dialog(
Center(child: CircularProgressIndicator()),
barrierDismissible: false,
);
Get.dialog(Center(child: CircularProgressIndicator()), barrierDismissible: false);
}
void _defaultHideLoading() {
@@ -159,12 +151,22 @@ void _defaultHideLoading() {
}
}
void _defaultShowSuccessMessage(String message) {
void defaultShowSuccessMessage(
String message, {
int durationInSeconds = 2,
VoidCallback? onDismissed,
}) {
Get.snackbar(
'موفقیت',
message,
duration: Duration(seconds: durationInSeconds),
snackPosition: SnackPosition.TOP,
backgroundColor: Colors.green,
snackbarStatus: (status) {
if (status == SnackbarStatus.CLOSED) {
onDismissed?.call();
}
},
colorText: Colors.white,
);
}

View File

@@ -549,7 +549,7 @@ Widget cardWithLabel({
children: [
Text(title, style: AppFonts.yekan12.copyWith(color: AppColor.textColor)),
Text(
count.separatedByComma,
count.separatedByCommaFa,
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
),
Text(unit, style: AppFonts.yekan12.copyWith(color: AppColor.textColor)),

View File

@@ -426,7 +426,7 @@ class MapPage extends GetView<MapLogic> {
),
buildRow(
title: 'باقیمانده',
value: '${location.hatching?.first.leftOver.separatedByComma ?? 'N/A'} عدد',
value: '${location.hatching?.first.leftOver.separatedByCommaFa ?? 'N/A'} عدد',
),
buildRow(
title: 'سن جوجه ریزی',
@@ -523,21 +523,21 @@ class MapPage extends GetView<MapLogic> {
buildRow(
title: 'تعداد جوجه ریزی',
value: hatchingDetails?.quantity.separatedByComma.addCountEXT ?? 'N/A',
value: hatchingDetails?.quantity.separatedByCommaFa.addCountEXT ?? 'N/A',
),
buildRow(
title: 'تلفات کل',
value: hatchingDetails?.totalLosses.separatedByComma.addCountEXT ?? 'N/A',
value: hatchingDetails?.totalLosses.separatedByCommaFa.addCountEXT ?? 'N/A',
),
buildRow(
title: 'تلفات دامپزشکی',
value: hatchingDetails?.losses.separatedByComma.addCountEXT ?? 'N/A',
value: hatchingDetails?.losses.separatedByCommaFa.addCountEXT ?? 'N/A',
),
buildRow(
title: 'باقیمانده در سالن',
value: hatchingDetails?.leftOver.separatedByComma.addCountEXT ?? 'N/A',
value: hatchingDetails?.leftOver.separatedByCommaFa.addCountEXT ?? 'N/A',
),
buildRow(title: 'نژاد', value: hatchingDetails?.chickenBreed ?? 'N/A'),
@@ -553,7 +553,7 @@ class MapPage extends GetView<MapLogic> {
buildRow(
title: 'تعداد کشتار',
value: hatchingDetails?.killedQuantity.separatedByComma.addCountEXT ?? 'N/A',
value: hatchingDetails?.killedQuantity.separatedByCommaFa.addCountEXT ?? 'N/A',
),
buildRow(
@@ -563,7 +563,7 @@ class MapPage extends GetView<MapLogic> {
buildRow(
title: 'وزن کشتار',
value: hatchingDetails?.totalKilledWeight.separatedByComma.addKgEXT ?? 'N/A',
value: hatchingDetails?.totalKilledWeight.separatedByCommaFa.addKgEXT ?? 'N/A',
),
],
);

View File

@@ -168,7 +168,7 @@ class StatisticsPage extends GetView<StatisticsLogic> {
title: 'تعداد تراکنش ها',
titleColor: AppColor.blueNormal,
isLoading: data.value == null,
description: 25369654.separatedByComma,
description: 25369654.separatedByCommaFa,
iconPath: Assets.vec.cubeScanSvg.path,
bgDescriptionColor: Colors.white,
gradient: LinearGradient(
@@ -186,7 +186,7 @@ class StatisticsPage extends GetView<StatisticsLogic> {
return _informationLabelCard(
title: 'جمع تراکنش ها',
isLoading: data.value == null,
description: data.value.separatedByComma ?? '0',
description: data.value.separatedByCommaFa ?? '0',
unit: 'ريال',
iconPath: Assets.vec.cubeCardSvg.path,
bgDescriptionColor: Colors.white,

View File

@@ -855,7 +855,7 @@ class RequestTaggingPage extends GetView<RequestTaggingLogic> {
return GestureDetector(
onTap: () {
Get.bottomSheet(
modalDatePicker((value) {
modalDatePicker(onDateSelected: (value) {
controller.dateOfBirth.value = value;
}),
isScrollControlled: true,