feat: enhance kill house - submit request module with submit request functionality, including new models, repository updates, and UI integration

This commit is contained in:
2025-12-01 09:42:26 +03:30
parent b5904d753c
commit 6861e873ba
99 changed files with 5764 additions and 606 deletions

View File

@@ -0,0 +1,25 @@
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/chicken_commission_prices/chicken_commission_prices.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_house/kill_house_response.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_request_list/kill_request_list.dart'
as listModel;
abstract class KillHouseRemoteDataSource {
Future<List<KillHouseResponse>?> getKillHouseList({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<ChickenCommissionPrices?> getCommissionPrice({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> submitKillHouseRequest({required String token, required Map<String, dynamic> data});
Future<List<listModel.KillRequestList>?> getListKillRequest({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> deleteKillRequest({required String token, required int requestId});
}

View File

@@ -1,20 +1,80 @@
import 'package:rasadyar_chicken/data/data_source/remote/kill_house/kill_house_remote.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/chicken_commission_prices/chicken_commission_prices.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_house/kill_house_response.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_request_list/kill_request_list.dart'
as listModel;
import 'package:rasadyar_core/core.dart';
abstract class KillHouseRemoteDataSource {
Future<List<KillHouseResponse>> getKillHouseList({
class KillHouseRemoteDataSourceImpl extends KillHouseRemoteDataSource {
final DioRemote _httpClient;
KillHouseRemoteDataSourceImpl(this._httpClient);
@override
Future<ChickenCommissionPrices?> getCommissionPrice({
required String token,
Map<String, dynamic>? queryParameters,
});
}) async {
var res = await _httpClient.get(
'/chicken-commission-prices/',
headers: {'Authorization': 'Bearer $token'},
fromJson: (json) {
var data = json['results'] as List<dynamic>;
return ChickenCommissionPrices.fromJson(data.first as Map<String, dynamic>);
},
);
Future<List<KillHouseResponse>> getCommissionPrice({
return res.data;
}
@override
Future<List<KillHouseResponse>?> getKillHouseList({
required String token,
Map<String, dynamic>? queryParameters,
});
}) async {
var res = await _httpClient.get(
'/kill_house/?kill_house',
headers: {'Authorization': 'Bearer $token'},
fromJsonList: (json) =>
json.map((e) => KillHouseResponse.fromJson(e as Map<String, dynamic>)).toList(),
);
return res.data;
}
Future<void> submitKillHouseReport({
@override
Future<void> submitKillHouseRequest({
required String token,
required Map<String, dynamic> data,
});
}) async {
await _httpClient.post(
'/kill_request/',
headers: {'Authorization': 'Bearer $token'},
data: data,
);
}
@override
Future<List<listModel.KillRequestList>?> getListKillRequest({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
var res = await _httpClient.get(
'/kill_request/',
headers: {'Authorization': 'Bearer $token'},
queryParameters: queryParameters,
fromJsonList: (json) =>
json.map((e) => listModel.KillRequestList.fromJson(e as Map<String, dynamic>)).toList(),
);
return res.data;
}
@override
Future<void> deleteKillRequest({required String token, required int requestId}) async {
await _httpClient.delete(
'/kill_request/$requestId/',
headers: {'Authorization': 'Bearer $token'},
);
}
}

View File

@@ -6,12 +6,16 @@ import 'package:rasadyar_chicken/data/data_source/remote/auth/auth_remote.dart';
import 'package:rasadyar_chicken/data/data_source/remote/auth/auth_remote_imp.dart';
import 'package:rasadyar_chicken/data/data_source/remote/chicken/chicken_remote.dart';
import 'package:rasadyar_chicken/data/data_source/remote/chicken/chicken_remote_imp.dart';
import 'package:rasadyar_chicken/data/data_source/remote/kill_house/kill_house_remote.dart';
import 'package:rasadyar_chicken/data/data_source/remote/kill_house/kill_house_remote_impl.dart';
import 'package:rasadyar_chicken/data/data_source/remote/poultry_science/poultry_science_remote.dart';
import 'package:rasadyar_chicken/data/data_source/remote/poultry_science/poultry_science_remote_imp.dart';
import 'package:rasadyar_chicken/data/repositories/auth/auth_repository.dart';
import 'package:rasadyar_chicken/data/repositories/auth/auth_repository_imp.dart';
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart';
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository_imp.dart';
import 'package:rasadyar_chicken/data/repositories/kill_house/kill_house_repository.dart';
import 'package:rasadyar_chicken/data/repositories/kill_house/kill_house_repository_impl.dart';
import 'package:rasadyar_chicken/data/repositories/poultry_science/poultry_science_repository.dart';
import 'package:rasadyar_chicken/data/repositories/poultry_science/poultry_science_repository_imp.dart';
import 'package:rasadyar_core/core.dart';
@@ -80,6 +84,15 @@ Future<void> setupChickenDI() async {
diChicken.registerLazySingleton<PoultryScienceRepository>(
() => PoultryScienceRepositoryImp(diChicken.get<PoultryScienceRemoteDatasource>()),
);
//region kill house module DI
diChicken.registerLazySingleton<KillHouseRemoteDataSource>(
() => KillHouseRemoteDataSourceImpl(diChicken.get<DioRemote>()),
);
diChicken.registerLazySingleton<KillHouseRepository>(
() => KillHouseRepositoryImpl(diChicken.get<KillHouseRemoteDataSource>()),
);
//endregion
}
Future<void> newSetupAuthDI(String newUrl) async {

View File

@@ -0,0 +1,26 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'kill_request_response.freezed.dart';
part 'kill_request_response.g.dart';
@freezed
abstract class KillRequestResponse with _$KillRequestResponse {
const factory KillRequestResponse({
int? killCapacity,
String? reciveTime,
String? reciveDate,
bool? lowWeight,
bool? highWeight,
@JsonKey(name: "Index_weight") double? indexWeight,
String? chickenBreed,
bool? cash,
bool? credit,
bool? smsPayment,
String? killHouseKey,
String? killerKillHouseKey,
String? role,
}) = _KillRequestResponse;
factory KillRequestResponse.fromJson(Map<String, dynamic> json) =>
_$KillRequestResponseFromJson(json);
}

View File

@@ -0,0 +1,313 @@
// 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_request_response.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$KillRequestResponse {
int? get killCapacity; String? get reciveTime; String? get reciveDate; bool? get lowWeight; bool? get highWeight;@JsonKey(name: "Index_weight") double? get indexWeight; String? get chickenBreed; bool? get cash; bool? get credit; bool? get smsPayment; String? get killHouseKey; String? get killerKillHouseKey; String? get role;
/// Create a copy of KillRequestResponse
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$KillRequestResponseCopyWith<KillRequestResponse> get copyWith => _$KillRequestResponseCopyWithImpl<KillRequestResponse>(this as KillRequestResponse, _$identity);
/// Serializes this KillRequestResponse to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is KillRequestResponse&&(identical(other.killCapacity, killCapacity) || other.killCapacity == killCapacity)&&(identical(other.reciveTime, reciveTime) || other.reciveTime == reciveTime)&&(identical(other.reciveDate, reciveDate) || other.reciveDate == reciveDate)&&(identical(other.lowWeight, lowWeight) || other.lowWeight == lowWeight)&&(identical(other.highWeight, highWeight) || other.highWeight == highWeight)&&(identical(other.indexWeight, indexWeight) || other.indexWeight == indexWeight)&&(identical(other.chickenBreed, chickenBreed) || other.chickenBreed == chickenBreed)&&(identical(other.cash, cash) || other.cash == cash)&&(identical(other.credit, credit) || other.credit == credit)&&(identical(other.smsPayment, smsPayment) || other.smsPayment == smsPayment)&&(identical(other.killHouseKey, killHouseKey) || other.killHouseKey == killHouseKey)&&(identical(other.killerKillHouseKey, killerKillHouseKey) || other.killerKillHouseKey == killerKillHouseKey)&&(identical(other.role, role) || other.role == role));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,killCapacity,reciveTime,reciveDate,lowWeight,highWeight,indexWeight,chickenBreed,cash,credit,smsPayment,killHouseKey,killerKillHouseKey,role);
@override
String toString() {
return 'KillRequestResponse(killCapacity: $killCapacity, reciveTime: $reciveTime, reciveDate: $reciveDate, lowWeight: $lowWeight, highWeight: $highWeight, indexWeight: $indexWeight, chickenBreed: $chickenBreed, cash: $cash, credit: $credit, smsPayment: $smsPayment, killHouseKey: $killHouseKey, killerKillHouseKey: $killerKillHouseKey, role: $role)';
}
}
/// @nodoc
abstract mixin class $KillRequestResponseCopyWith<$Res> {
factory $KillRequestResponseCopyWith(KillRequestResponse value, $Res Function(KillRequestResponse) _then) = _$KillRequestResponseCopyWithImpl;
@useResult
$Res call({
int? killCapacity, String? reciveTime, String? reciveDate, bool? lowWeight, bool? highWeight,@JsonKey(name: "Index_weight") double? indexWeight, String? chickenBreed, bool? cash, bool? credit, bool? smsPayment, String? killHouseKey, String? killerKillHouseKey, String? role
});
}
/// @nodoc
class _$KillRequestResponseCopyWithImpl<$Res>
implements $KillRequestResponseCopyWith<$Res> {
_$KillRequestResponseCopyWithImpl(this._self, this._then);
final KillRequestResponse _self;
final $Res Function(KillRequestResponse) _then;
/// Create a copy of KillRequestResponse
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? killCapacity = freezed,Object? reciveTime = freezed,Object? reciveDate = freezed,Object? lowWeight = freezed,Object? highWeight = freezed,Object? indexWeight = freezed,Object? chickenBreed = freezed,Object? cash = freezed,Object? credit = freezed,Object? smsPayment = freezed,Object? killHouseKey = freezed,Object? killerKillHouseKey = freezed,Object? role = freezed,}) {
return _then(_self.copyWith(
killCapacity: freezed == killCapacity ? _self.killCapacity : killCapacity // ignore: cast_nullable_to_non_nullable
as int?,reciveTime: freezed == reciveTime ? _self.reciveTime : reciveTime // ignore: cast_nullable_to_non_nullable
as String?,reciveDate: freezed == reciveDate ? _self.reciveDate : reciveDate // ignore: cast_nullable_to_non_nullable
as String?,lowWeight: freezed == lowWeight ? _self.lowWeight : lowWeight // ignore: cast_nullable_to_non_nullable
as bool?,highWeight: freezed == highWeight ? _self.highWeight : highWeight // ignore: cast_nullable_to_non_nullable
as bool?,indexWeight: freezed == indexWeight ? _self.indexWeight : indexWeight // ignore: cast_nullable_to_non_nullable
as double?,chickenBreed: freezed == chickenBreed ? _self.chickenBreed : chickenBreed // ignore: cast_nullable_to_non_nullable
as String?,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?,smsPayment: freezed == smsPayment ? _self.smsPayment : smsPayment // ignore: cast_nullable_to_non_nullable
as bool?,killHouseKey: freezed == killHouseKey ? _self.killHouseKey : killHouseKey // ignore: cast_nullable_to_non_nullable
as String?,killerKillHouseKey: freezed == killerKillHouseKey ? _self.killerKillHouseKey : killerKillHouseKey // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [KillRequestResponse].
extension KillRequestResponsePatterns on KillRequestResponse {
/// 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( _KillRequestResponse value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _KillRequestResponse() 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( _KillRequestResponse value) $default,){
final _that = this;
switch (_that) {
case _KillRequestResponse():
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( _KillRequestResponse value)? $default,){
final _that = this;
switch (_that) {
case _KillRequestResponse() 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( int? killCapacity, String? reciveTime, String? reciveDate, bool? lowWeight, bool? highWeight, @JsonKey(name: "Index_weight") double? indexWeight, String? chickenBreed, bool? cash, bool? credit, bool? smsPayment, String? killHouseKey, String? killerKillHouseKey, String? role)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _KillRequestResponse() when $default != null:
return $default(_that.killCapacity,_that.reciveTime,_that.reciveDate,_that.lowWeight,_that.highWeight,_that.indexWeight,_that.chickenBreed,_that.cash,_that.credit,_that.smsPayment,_that.killHouseKey,_that.killerKillHouseKey,_that.role);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( int? killCapacity, String? reciveTime, String? reciveDate, bool? lowWeight, bool? highWeight, @JsonKey(name: "Index_weight") double? indexWeight, String? chickenBreed, bool? cash, bool? credit, bool? smsPayment, String? killHouseKey, String? killerKillHouseKey, String? role) $default,) {final _that = this;
switch (_that) {
case _KillRequestResponse():
return $default(_that.killCapacity,_that.reciveTime,_that.reciveDate,_that.lowWeight,_that.highWeight,_that.indexWeight,_that.chickenBreed,_that.cash,_that.credit,_that.smsPayment,_that.killHouseKey,_that.killerKillHouseKey,_that.role);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( int? killCapacity, String? reciveTime, String? reciveDate, bool? lowWeight, bool? highWeight, @JsonKey(name: "Index_weight") double? indexWeight, String? chickenBreed, bool? cash, bool? credit, bool? smsPayment, String? killHouseKey, String? killerKillHouseKey, String? role)? $default,) {final _that = this;
switch (_that) {
case _KillRequestResponse() when $default != null:
return $default(_that.killCapacity,_that.reciveTime,_that.reciveDate,_that.lowWeight,_that.highWeight,_that.indexWeight,_that.chickenBreed,_that.cash,_that.credit,_that.smsPayment,_that.killHouseKey,_that.killerKillHouseKey,_that.role);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _KillRequestResponse implements KillRequestResponse {
const _KillRequestResponse({this.killCapacity, this.reciveTime, this.reciveDate, this.lowWeight, this.highWeight, @JsonKey(name: "Index_weight") this.indexWeight, this.chickenBreed, this.cash, this.credit, this.smsPayment, this.killHouseKey, this.killerKillHouseKey, this.role});
factory _KillRequestResponse.fromJson(Map<String, dynamic> json) => _$KillRequestResponseFromJson(json);
@override final int? killCapacity;
@override final String? reciveTime;
@override final String? reciveDate;
@override final bool? lowWeight;
@override final bool? highWeight;
@override@JsonKey(name: "Index_weight") final double? indexWeight;
@override final String? chickenBreed;
@override final bool? cash;
@override final bool? credit;
@override final bool? smsPayment;
@override final String? killHouseKey;
@override final String? killerKillHouseKey;
@override final String? role;
/// Create a copy of KillRequestResponse
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$KillRequestResponseCopyWith<_KillRequestResponse> get copyWith => __$KillRequestResponseCopyWithImpl<_KillRequestResponse>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$KillRequestResponseToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _KillRequestResponse&&(identical(other.killCapacity, killCapacity) || other.killCapacity == killCapacity)&&(identical(other.reciveTime, reciveTime) || other.reciveTime == reciveTime)&&(identical(other.reciveDate, reciveDate) || other.reciveDate == reciveDate)&&(identical(other.lowWeight, lowWeight) || other.lowWeight == lowWeight)&&(identical(other.highWeight, highWeight) || other.highWeight == highWeight)&&(identical(other.indexWeight, indexWeight) || other.indexWeight == indexWeight)&&(identical(other.chickenBreed, chickenBreed) || other.chickenBreed == chickenBreed)&&(identical(other.cash, cash) || other.cash == cash)&&(identical(other.credit, credit) || other.credit == credit)&&(identical(other.smsPayment, smsPayment) || other.smsPayment == smsPayment)&&(identical(other.killHouseKey, killHouseKey) || other.killHouseKey == killHouseKey)&&(identical(other.killerKillHouseKey, killerKillHouseKey) || other.killerKillHouseKey == killerKillHouseKey)&&(identical(other.role, role) || other.role == role));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,killCapacity,reciveTime,reciveDate,lowWeight,highWeight,indexWeight,chickenBreed,cash,credit,smsPayment,killHouseKey,killerKillHouseKey,role);
@override
String toString() {
return 'KillRequestResponse(killCapacity: $killCapacity, reciveTime: $reciveTime, reciveDate: $reciveDate, lowWeight: $lowWeight, highWeight: $highWeight, indexWeight: $indexWeight, chickenBreed: $chickenBreed, cash: $cash, credit: $credit, smsPayment: $smsPayment, killHouseKey: $killHouseKey, killerKillHouseKey: $killerKillHouseKey, role: $role)';
}
}
/// @nodoc
abstract mixin class _$KillRequestResponseCopyWith<$Res> implements $KillRequestResponseCopyWith<$Res> {
factory _$KillRequestResponseCopyWith(_KillRequestResponse value, $Res Function(_KillRequestResponse) _then) = __$KillRequestResponseCopyWithImpl;
@override @useResult
$Res call({
int? killCapacity, String? reciveTime, String? reciveDate, bool? lowWeight, bool? highWeight,@JsonKey(name: "Index_weight") double? indexWeight, String? chickenBreed, bool? cash, bool? credit, bool? smsPayment, String? killHouseKey, String? killerKillHouseKey, String? role
});
}
/// @nodoc
class __$KillRequestResponseCopyWithImpl<$Res>
implements _$KillRequestResponseCopyWith<$Res> {
__$KillRequestResponseCopyWithImpl(this._self, this._then);
final _KillRequestResponse _self;
final $Res Function(_KillRequestResponse) _then;
/// Create a copy of KillRequestResponse
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? killCapacity = freezed,Object? reciveTime = freezed,Object? reciveDate = freezed,Object? lowWeight = freezed,Object? highWeight = freezed,Object? indexWeight = freezed,Object? chickenBreed = freezed,Object? cash = freezed,Object? credit = freezed,Object? smsPayment = freezed,Object? killHouseKey = freezed,Object? killerKillHouseKey = freezed,Object? role = freezed,}) {
return _then(_KillRequestResponse(
killCapacity: freezed == killCapacity ? _self.killCapacity : killCapacity // ignore: cast_nullable_to_non_nullable
as int?,reciveTime: freezed == reciveTime ? _self.reciveTime : reciveTime // ignore: cast_nullable_to_non_nullable
as String?,reciveDate: freezed == reciveDate ? _self.reciveDate : reciveDate // ignore: cast_nullable_to_non_nullable
as String?,lowWeight: freezed == lowWeight ? _self.lowWeight : lowWeight // ignore: cast_nullable_to_non_nullable
as bool?,highWeight: freezed == highWeight ? _self.highWeight : highWeight // ignore: cast_nullable_to_non_nullable
as bool?,indexWeight: freezed == indexWeight ? _self.indexWeight : indexWeight // ignore: cast_nullable_to_non_nullable
as double?,chickenBreed: freezed == chickenBreed ? _self.chickenBreed : chickenBreed // ignore: cast_nullable_to_non_nullable
as String?,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?,smsPayment: freezed == smsPayment ? _self.smsPayment : smsPayment // ignore: cast_nullable_to_non_nullable
as bool?,killHouseKey: freezed == killHouseKey ? _self.killHouseKey : killHouseKey // ignore: cast_nullable_to_non_nullable
as String?,killerKillHouseKey: freezed == killerKillHouseKey ? _self.killerKillHouseKey : killerKillHouseKey // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,42 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'kill_request_response.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_KillRequestResponse _$KillRequestResponseFromJson(Map<String, dynamic> json) =>
_KillRequestResponse(
killCapacity: (json['kill_capacity'] as num?)?.toInt(),
reciveTime: json['recive_time'] as String?,
reciveDate: json['recive_date'] as String?,
lowWeight: json['low_weight'] as bool?,
highWeight: json['high_weight'] as bool?,
indexWeight: (json['Index_weight'] as num?)?.toDouble(),
chickenBreed: json['chicken_breed'] as String?,
cash: json['cash'] as bool?,
credit: json['credit'] as bool?,
smsPayment: json['sms_payment'] as bool?,
killHouseKey: json['kill_house_key'] as String?,
killerKillHouseKey: json['killer_kill_house_key'] as String?,
role: json['role'] as String?,
);
Map<String, dynamic> _$KillRequestResponseToJson(
_KillRequestResponse instance,
) => <String, dynamic>{
'kill_capacity': instance.killCapacity,
'recive_time': instance.reciveTime,
'recive_date': instance.reciveDate,
'low_weight': instance.lowWeight,
'high_weight': instance.highWeight,
'Index_weight': instance.indexWeight,
'chicken_breed': instance.chickenBreed,
'cash': instance.cash,
'credit': instance.credit,
'sms_payment': instance.smsPayment,
'kill_house_key': instance.killHouseKey,
'killer_kill_house_key': instance.killerKillHouseKey,
'role': instance.role,
};

View File

@@ -0,0 +1,12 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'chicken_commission_prices.freezed.dart';
part 'chicken_commission_prices.g.dart';
@freezed
abstract class ChickenCommissionPrices with _$ChickenCommissionPrices {
const factory ChickenCommissionPrices({double? chickenAveragePrice}) = _ChickenCommissionPrices;
factory ChickenCommissionPrices.fromJson(Map<String, dynamic> json) =>
_$ChickenCommissionPricesFromJson(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 'chicken_commission_prices.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ChickenCommissionPrices {
double? get chickenAveragePrice;
/// Create a copy of ChickenCommissionPrices
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ChickenCommissionPricesCopyWith<ChickenCommissionPrices> get copyWith => _$ChickenCommissionPricesCopyWithImpl<ChickenCommissionPrices>(this as ChickenCommissionPrices, _$identity);
/// Serializes this ChickenCommissionPrices to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChickenCommissionPrices&&(identical(other.chickenAveragePrice, chickenAveragePrice) || other.chickenAveragePrice == chickenAveragePrice));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,chickenAveragePrice);
@override
String toString() {
return 'ChickenCommissionPrices(chickenAveragePrice: $chickenAveragePrice)';
}
}
/// @nodoc
abstract mixin class $ChickenCommissionPricesCopyWith<$Res> {
factory $ChickenCommissionPricesCopyWith(ChickenCommissionPrices value, $Res Function(ChickenCommissionPrices) _then) = _$ChickenCommissionPricesCopyWithImpl;
@useResult
$Res call({
double? chickenAveragePrice
});
}
/// @nodoc
class _$ChickenCommissionPricesCopyWithImpl<$Res>
implements $ChickenCommissionPricesCopyWith<$Res> {
_$ChickenCommissionPricesCopyWithImpl(this._self, this._then);
final ChickenCommissionPrices _self;
final $Res Function(ChickenCommissionPrices) _then;
/// Create a copy of ChickenCommissionPrices
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? chickenAveragePrice = freezed,}) {
return _then(_self.copyWith(
chickenAveragePrice: freezed == chickenAveragePrice ? _self.chickenAveragePrice : chickenAveragePrice // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
/// Adds pattern-matching-related methods to [ChickenCommissionPrices].
extension ChickenCommissionPricesPatterns on ChickenCommissionPrices {
/// 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( _ChickenCommissionPrices value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _ChickenCommissionPrices() 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( _ChickenCommissionPrices value) $default,){
final _that = this;
switch (_that) {
case _ChickenCommissionPrices():
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( _ChickenCommissionPrices value)? $default,){
final _that = this;
switch (_that) {
case _ChickenCommissionPrices() 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( double? chickenAveragePrice)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ChickenCommissionPrices() when $default != null:
return $default(_that.chickenAveragePrice);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( double? chickenAveragePrice) $default,) {final _that = this;
switch (_that) {
case _ChickenCommissionPrices():
return $default(_that.chickenAveragePrice);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( double? chickenAveragePrice)? $default,) {final _that = this;
switch (_that) {
case _ChickenCommissionPrices() when $default != null:
return $default(_that.chickenAveragePrice);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _ChickenCommissionPrices implements ChickenCommissionPrices {
const _ChickenCommissionPrices({this.chickenAveragePrice});
factory _ChickenCommissionPrices.fromJson(Map<String, dynamic> json) => _$ChickenCommissionPricesFromJson(json);
@override final double? chickenAveragePrice;
/// Create a copy of ChickenCommissionPrices
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ChickenCommissionPricesCopyWith<_ChickenCommissionPrices> get copyWith => __$ChickenCommissionPricesCopyWithImpl<_ChickenCommissionPrices>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$ChickenCommissionPricesToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChickenCommissionPrices&&(identical(other.chickenAveragePrice, chickenAveragePrice) || other.chickenAveragePrice == chickenAveragePrice));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,chickenAveragePrice);
@override
String toString() {
return 'ChickenCommissionPrices(chickenAveragePrice: $chickenAveragePrice)';
}
}
/// @nodoc
abstract mixin class _$ChickenCommissionPricesCopyWith<$Res> implements $ChickenCommissionPricesCopyWith<$Res> {
factory _$ChickenCommissionPricesCopyWith(_ChickenCommissionPrices value, $Res Function(_ChickenCommissionPrices) _then) = __$ChickenCommissionPricesCopyWithImpl;
@override @useResult
$Res call({
double? chickenAveragePrice
});
}
/// @nodoc
class __$ChickenCommissionPricesCopyWithImpl<$Res>
implements _$ChickenCommissionPricesCopyWith<$Res> {
__$ChickenCommissionPricesCopyWithImpl(this._self, this._then);
final _ChickenCommissionPrices _self;
final $Res Function(_ChickenCommissionPrices) _then;
/// Create a copy of ChickenCommissionPrices
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? chickenAveragePrice = freezed,}) {
return _then(_ChickenCommissionPrices(
chickenAveragePrice: freezed == chickenAveragePrice ? _self.chickenAveragePrice : chickenAveragePrice // ignore: cast_nullable_to_non_nullable
as double?,
));
}
}
// dart format on

View File

@@ -0,0 +1,17 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'chicken_commission_prices.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_ChickenCommissionPrices _$ChickenCommissionPricesFromJson(
Map<String, dynamic> json,
) => _ChickenCommissionPrices(
chickenAveragePrice: (json['chicken_average_price'] as num?)?.toDouble(),
);
Map<String, dynamic> _$ChickenCommissionPricesToJson(
_ChickenCommissionPrices instance,
) => <String, dynamic>{'chicken_average_price': instance.chickenAveragePrice};

View File

@@ -0,0 +1,12 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'kill_house_response.freezed.dart';
part 'kill_house_response.g.dart';
@freezed
abstract class KillHouseResponse with _$KillHouseResponse {
const factory KillHouseResponse({String? name, String? key}) = _KillHouseResponse;
factory KillHouseResponse.fromJson(Map<String, dynamic> json) =>
_$KillHouseResponseFromJson(json);
}

View File

@@ -0,0 +1,280 @@
// 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_response.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$KillHouseResponse {
String? get name; String? get key;
/// Create a copy of KillHouseResponse
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$KillHouseResponseCopyWith<KillHouseResponse> get copyWith => _$KillHouseResponseCopyWithImpl<KillHouseResponse>(this as KillHouseResponse, _$identity);
/// Serializes this KillHouseResponse to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is KillHouseResponse&&(identical(other.name, name) || other.name == name)&&(identical(other.key, key) || other.key == key));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,name,key);
@override
String toString() {
return 'KillHouseResponse(name: $name, key: $key)';
}
}
/// @nodoc
abstract mixin class $KillHouseResponseCopyWith<$Res> {
factory $KillHouseResponseCopyWith(KillHouseResponse value, $Res Function(KillHouseResponse) _then) = _$KillHouseResponseCopyWithImpl;
@useResult
$Res call({
String? name, String? key
});
}
/// @nodoc
class _$KillHouseResponseCopyWithImpl<$Res>
implements $KillHouseResponseCopyWith<$Res> {
_$KillHouseResponseCopyWithImpl(this._self, this._then);
final KillHouseResponse _self;
final $Res Function(KillHouseResponse) _then;
/// Create a copy of KillHouseResponse
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? name = freezed,Object? key = freezed,}) {
return _then(_self.copyWith(
name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [KillHouseResponse].
extension KillHouseResponsePatterns on KillHouseResponse {
/// 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( _KillHouseResponse value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _KillHouseResponse() 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( _KillHouseResponse value) $default,){
final _that = this;
switch (_that) {
case _KillHouseResponse():
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( _KillHouseResponse value)? $default,){
final _that = this;
switch (_that) {
case _KillHouseResponse() 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, String? key)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _KillHouseResponse() when $default != null:
return $default(_that.name,_that.key);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, String? key) $default,) {final _that = this;
switch (_that) {
case _KillHouseResponse():
return $default(_that.name,_that.key);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, String? key)? $default,) {final _that = this;
switch (_that) {
case _KillHouseResponse() when $default != null:
return $default(_that.name,_that.key);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _KillHouseResponse implements KillHouseResponse {
const _KillHouseResponse({this.name, this.key});
factory _KillHouseResponse.fromJson(Map<String, dynamic> json) => _$KillHouseResponseFromJson(json);
@override final String? name;
@override final String? key;
/// Create a copy of KillHouseResponse
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$KillHouseResponseCopyWith<_KillHouseResponse> get copyWith => __$KillHouseResponseCopyWithImpl<_KillHouseResponse>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$KillHouseResponseToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _KillHouseResponse&&(identical(other.name, name) || other.name == name)&&(identical(other.key, key) || other.key == key));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,name,key);
@override
String toString() {
return 'KillHouseResponse(name: $name, key: $key)';
}
}
/// @nodoc
abstract mixin class _$KillHouseResponseCopyWith<$Res> implements $KillHouseResponseCopyWith<$Res> {
factory _$KillHouseResponseCopyWith(_KillHouseResponse value, $Res Function(_KillHouseResponse) _then) = __$KillHouseResponseCopyWithImpl;
@override @useResult
$Res call({
String? name, String? key
});
}
/// @nodoc
class __$KillHouseResponseCopyWithImpl<$Res>
implements _$KillHouseResponseCopyWith<$Res> {
__$KillHouseResponseCopyWithImpl(this._self, this._then);
final _KillHouseResponse _self;
final $Res Function(_KillHouseResponse) _then;
/// Create a copy of KillHouseResponse
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? name = freezed,Object? key = freezed,}) {
return _then(_KillHouseResponse(
name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String?,key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,16 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'kill_house_response.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_KillHouseResponse _$KillHouseResponseFromJson(Map<String, dynamic> json) =>
_KillHouseResponse(
name: json['name'] as String?,
key: json['key'] as String?,
);
Map<String, dynamic> _$KillHouseResponseToJson(_KillHouseResponse instance) =>
<String, dynamic>{'name': instance.name, 'key': instance.key};

View File

@@ -0,0 +1,125 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'kill_request_list.freezed.dart';
part 'kill_request_list.g.dart';
@freezed
abstract class KillRequestList with _$KillRequestList {
const factory KillRequestList({
int? id,
KillHouseResponse? killHouse,
KillHouseVetResponse? killHouseVet,
int? numberOfAllocated,
String? key,
String? createDate,
String? modifyDate,
bool? trash,
int? killCapacity,
int? previousKillCapacity,
int? remainQuantityForPoultry,
int? remainQuantity,
String? reciveTime,
String? reciveDate,
String? state,
String? provinceState,
BuyTypeResponse? buyType,
WeightTypeResponse? weightType,
String? chickenBreed,
double? indexWeight,
bool? smsPayment,
RegistrarResponse? registrar,
}) = _KillRequestList;
factory KillRequestList.fromJson(Map<String, dynamic> json) => _$KillRequestListFromJson(json);
}
///////////////////////////////////////////////////
/// SUB MODELS
///////////////////////////////////////////////////
@freezed
abstract class KillHouseResponse with _$KillHouseResponse {
const factory KillHouseResponse({
KillHouseOperator? killHouseOperator,
String? name,
bool? killer,
String? key,
}) = _KillHouseResponse;
factory KillHouseResponse.fromJson(Map<String, dynamic> json) =>
_$KillHouseResponseFromJson(json);
}
@freezed
abstract class KillHouseOperator with _$KillHouseOperator {
const factory KillHouseOperator({UserResponse? user}) = _KillHouseOperator;
factory KillHouseOperator.fromJson(Map<String, dynamic> json) =>
_$KillHouseOperatorFromJson(json);
}
@freezed
abstract class UserResponse with _$UserResponse {
const factory UserResponse({
String? fullname,
String? firstName,
String? lastName,
String? mobile,
String? key,
CityResponse? city,
}) = _UserResponse;
factory UserResponse.fromJson(Map<String, dynamic> json) => _$UserResponseFromJson(json);
}
@freezed
abstract class CityResponse with _$CityResponse {
const factory CityResponse({int? id, String? name, String? provinceName}) = _CityResponse;
factory CityResponse.fromJson(Map<String, dynamic> json) => _$CityResponseFromJson(json);
}
@freezed
abstract class KillHouseVetResponse with _$KillHouseVetResponse {
const factory KillHouseVetResponse({
int? id,
VetResponse? vet,
KillHouseResponse? killHouse,
String? key,
bool? trash,
}) = _KillHouseVetResponse;
factory KillHouseVetResponse.fromJson(Map<String, dynamic> json) =>
_$KillHouseVetResponseFromJson(json);
}
@freezed
abstract class VetResponse with _$VetResponse {
const factory VetResponse({UserResponse? user}) = _VetResponse;
factory VetResponse.fromJson(Map<String, dynamic> json) => _$VetResponseFromJson(json);
}
@freezed
abstract class BuyTypeResponse with _$BuyTypeResponse {
const factory BuyTypeResponse({bool? cash, bool? credit}) = _BuyTypeResponse;
factory BuyTypeResponse.fromJson(Map<String, dynamic> json) => _$BuyTypeResponseFromJson(json);
}
@freezed
abstract class WeightTypeResponse with _$WeightTypeResponse {
const factory WeightTypeResponse({bool? lowWeight, bool? highWeight}) = _WeightTypeResponse;
factory WeightTypeResponse.fromJson(Map<String, dynamic> json) =>
_$WeightTypeResponseFromJson(json);
}
@freezed
abstract class RegistrarResponse with _$RegistrarResponse {
const factory RegistrarResponse({String? date, String? role, String? fullName}) =
_RegistrarResponse;
factory RegistrarResponse.fromJson(Map<String, dynamic> json) =>
_$RegistrarResponseFromJson(json);
}

View File

@@ -0,0 +1,209 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'kill_request_list.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_KillRequestList _$KillRequestListFromJson(
Map<String, dynamic> json,
) => _KillRequestList(
id: (json['id'] as num?)?.toInt(),
killHouse: json['kill_house'] == null
? null
: KillHouseResponse.fromJson(json['kill_house'] as Map<String, dynamic>),
killHouseVet: json['kill_house_vet'] == null
? null
: KillHouseVetResponse.fromJson(
json['kill_house_vet'] as Map<String, dynamic>,
),
numberOfAllocated: (json['number_of_allocated'] 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?,
killCapacity: (json['kill_capacity'] as num?)?.toInt(),
previousKillCapacity: (json['previous_kill_capacity'] as num?)?.toInt(),
remainQuantityForPoultry: (json['remain_quantity_for_poultry'] as num?)
?.toInt(),
remainQuantity: (json['remain_quantity'] as num?)?.toInt(),
reciveTime: json['recive_time'] as String?,
reciveDate: json['recive_date'] as String?,
state: json['state'] as String?,
provinceState: json['province_state'] as String?,
buyType: json['buy_type'] == null
? null
: BuyTypeResponse.fromJson(json['buy_type'] as Map<String, dynamic>),
weightType: json['weight_type'] == null
? null
: WeightTypeResponse.fromJson(
json['weight_type'] as Map<String, dynamic>,
),
chickenBreed: json['chicken_breed'] as String?,
indexWeight: (json['index_weight'] as num?)?.toDouble(),
smsPayment: json['sms_payment'] as bool?,
registrar: json['registrar'] == null
? null
: RegistrarResponse.fromJson(json['registrar'] as Map<String, dynamic>),
);
Map<String, dynamic> _$KillRequestListToJson(_KillRequestList instance) =>
<String, dynamic>{
'id': instance.id,
'kill_house': instance.killHouse,
'kill_house_vet': instance.killHouseVet,
'number_of_allocated': instance.numberOfAllocated,
'key': instance.key,
'create_date': instance.createDate,
'modify_date': instance.modifyDate,
'trash': instance.trash,
'kill_capacity': instance.killCapacity,
'previous_kill_capacity': instance.previousKillCapacity,
'remain_quantity_for_poultry': instance.remainQuantityForPoultry,
'remain_quantity': instance.remainQuantity,
'recive_time': instance.reciveTime,
'recive_date': instance.reciveDate,
'state': instance.state,
'province_state': instance.provinceState,
'buy_type': instance.buyType,
'weight_type': instance.weightType,
'chicken_breed': instance.chickenBreed,
'index_weight': instance.indexWeight,
'sms_payment': instance.smsPayment,
'registrar': instance.registrar,
};
_KillHouseResponse _$KillHouseResponseFromJson(Map<String, dynamic> json) =>
_KillHouseResponse(
killHouseOperator: json['kill_house_operator'] == null
? null
: KillHouseOperator.fromJson(
json['kill_house_operator'] as Map<String, dynamic>,
),
name: json['name'] as String?,
killer: json['killer'] as bool?,
key: json['key'] as String?,
);
Map<String, dynamic> _$KillHouseResponseToJson(_KillHouseResponse instance) =>
<String, dynamic>{
'kill_house_operator': instance.killHouseOperator,
'name': instance.name,
'killer': instance.killer,
'key': instance.key,
};
_KillHouseOperator _$KillHouseOperatorFromJson(Map<String, dynamic> json) =>
_KillHouseOperator(
user: json['user'] == null
? null
: UserResponse.fromJson(json['user'] as Map<String, dynamic>),
);
Map<String, dynamic> _$KillHouseOperatorToJson(_KillHouseOperator instance) =>
<String, dynamic>{'user': instance.user};
_UserResponse _$UserResponseFromJson(Map<String, dynamic> json) =>
_UserResponse(
fullname: json['fullname'] as String?,
firstName: json['first_name'] as String?,
lastName: json['last_name'] as String?,
mobile: json['mobile'] as String?,
key: json['key'] as String?,
city: json['city'] == null
? null
: CityResponse.fromJson(json['city'] as Map<String, dynamic>),
);
Map<String, dynamic> _$UserResponseToJson(_UserResponse instance) =>
<String, dynamic>{
'fullname': instance.fullname,
'first_name': instance.firstName,
'last_name': instance.lastName,
'mobile': instance.mobile,
'key': instance.key,
'city': instance.city,
};
_CityResponse _$CityResponseFromJson(Map<String, dynamic> json) =>
_CityResponse(
id: (json['id'] as num?)?.toInt(),
name: json['name'] as String?,
provinceName: json['province_name'] as String?,
);
Map<String, dynamic> _$CityResponseToJson(_CityResponse instance) =>
<String, dynamic>{
'id': instance.id,
'name': instance.name,
'province_name': instance.provinceName,
};
_KillHouseVetResponse _$KillHouseVetResponseFromJson(
Map<String, dynamic> json,
) => _KillHouseVetResponse(
id: (json['id'] as num?)?.toInt(),
vet: json['vet'] == null
? null
: VetResponse.fromJson(json['vet'] as Map<String, dynamic>),
killHouse: json['kill_house'] == null
? null
: KillHouseResponse.fromJson(json['kill_house'] as Map<String, dynamic>),
key: json['key'] as String?,
trash: json['trash'] as bool?,
);
Map<String, dynamic> _$KillHouseVetResponseToJson(
_KillHouseVetResponse instance,
) => <String, dynamic>{
'id': instance.id,
'vet': instance.vet,
'kill_house': instance.killHouse,
'key': instance.key,
'trash': instance.trash,
};
_VetResponse _$VetResponseFromJson(Map<String, dynamic> json) => _VetResponse(
user: json['user'] == null
? null
: UserResponse.fromJson(json['user'] as Map<String, dynamic>),
);
Map<String, dynamic> _$VetResponseToJson(_VetResponse instance) =>
<String, dynamic>{'user': instance.user};
_BuyTypeResponse _$BuyTypeResponseFromJson(Map<String, dynamic> json) =>
_BuyTypeResponse(
cash: json['cash'] as bool?,
credit: json['credit'] as bool?,
);
Map<String, dynamic> _$BuyTypeResponseToJson(_BuyTypeResponse instance) =>
<String, dynamic>{'cash': instance.cash, 'credit': instance.credit};
_WeightTypeResponse _$WeightTypeResponseFromJson(Map<String, dynamic> json) =>
_WeightTypeResponse(
lowWeight: json['low_weight'] as bool?,
highWeight: json['high_weight'] as bool?,
);
Map<String, dynamic> _$WeightTypeResponseToJson(_WeightTypeResponse instance) =>
<String, dynamic>{
'low_weight': instance.lowWeight,
'high_weight': instance.highWeight,
};
_RegistrarResponse _$RegistrarResponseFromJson(Map<String, dynamic> json) =>
_RegistrarResponse(
date: json['date'] as String?,
role: json['role'] as String?,
fullName: json['full_name'] as String?,
);
Map<String, dynamic> _$RegistrarResponseToJson(_RegistrarResponse instance) =>
<String, dynamic>{
'date': instance.date,
'role': instance.role,
'full_name': instance.fullName,
};

View File

@@ -1,5 +1,4 @@
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/utils/utils.dart';
part 'widely_used_local_model.g.dart';

View File

@@ -0,0 +1,27 @@
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/request/kill_request_response.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/chicken_commission_prices/chicken_commission_prices.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_house/kill_house_response.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_request_list/kill_request_list.dart'
as listModel
show KillRequestList;
abstract class KillHouseRepository {
Future<List<KillHouseResponse>?> getKillHouseList({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<ChickenCommissionPrices?> getCommissionPrice({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> submitKillHouseRequest({required String token, required KillRequestResponse data});
Future<List<listModel.KillRequestList>?> getListKillRequest({
required String token,
Map<String, dynamic>? queryParameters,
});
Future<void> deleteKillRequest({required String token, required int requestId});
}

View File

@@ -1,16 +1,58 @@
import 'package:rasadyar_chicken/data/data_source/remote/kill_house/kill_house_remote.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/request/kill_request_response.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/chicken_commission_prices/chicken_commission_prices.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_house/kill_house_response.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_request_list/kill_request_list.dart'
as listModel;
abstract class KillHouseRepository {
import 'kill_house_repository.dart';
class KillHouseRepositoryImpl extends KillHouseRepository {
final KillHouseRemoteDataSource remoteDataSource;
KillHouseRepositoryImpl(this.remoteDataSource);
@override
Future<List<KillHouseResponse>?> getKillHouseList({
required String token,
Map<String, dynamic>? queryParameters,
});
}) async {
return await remoteDataSource.getKillHouseList(token: token, queryParameters: queryParameters);
}
@override
Future<ChickenCommissionPrices?> getCommissionPrice({
required String token,
Map<String, dynamic>? queryParameters,
});
}) async {
return await remoteDataSource.getCommissionPrice(
token: token,
queryParameters: queryParameters,
);
}
Future<void> submitKillHouseReport({required String token, required Map<String, dynamic> data});
@override
Future<void> submitKillHouseRequest({
required String token,
required KillRequestResponse data,
}) async {
var jsonData = data.toJson();
return await remoteDataSource.submitKillHouseRequest(token: token, data: jsonData);
}
@override
Future<List<listModel.KillRequestList>?> getListKillRequest({
required String token,
Map<String, dynamic>? queryParameters,
}) async {
return await remoteDataSource.getListKillRequest(
token: token,
queryParameters: queryParameters,
);
}
@override
Future<void> deleteKillRequest({required String token, required int requestId}) async {
await remoteDataSource.deleteKillRequest(token: token, requestId: requestId);
}
}

View File

@@ -37,7 +37,7 @@ class ProfileLogic extends GetxController {
GlobalKey<FormState> formKey = GlobalKey();
ImagePicker imagePicker = ImagePicker();
Rxn<XFile> selectedImage = Rxn<XFile>();
RxnString _base64Image = RxnString();
final RxnString _base64Image = RxnString();
RxBool isOnLoading = false.obs;
RxBool isUserInformationOpen = true.obs;
@@ -79,10 +79,6 @@ class ProfileLogic extends GetxController {
});
}
@override
void onClose() {
super.onClose();
}
Future<void> getUserProfile() async {
userProfile.value = Resource.loading();

View File

@@ -1,8 +1,13 @@
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_core/core.dart';
class KillHouseActionLogic extends GetxController {
List<GlassMorphismCardItem> items = [
GlassMorphismCardItem(title: "ثبت درخواست", icon: Assets.vec.submitRequestSvg.path, route: ''),
GlassMorphismCardItem(
title: "ثبت درخواست",
icon: Assets.vec.submitRequestSvg.path,
route: ChickenRoutes.submitRequestKillHouse,
),
GlassMorphismCardItem(
title: "انبار و توزیع",
icon: Assets.vec.warehouseDistributionSvg.path,

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/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
@@ -13,8 +14,8 @@ class KillHouseActionPage extends GetView<KillHouseActionLogic> {
isBase: true,
child: GlassMorphismGrid(
items: controller.items,
onTap: () {
iLog("Hoooooura 😍😍😍😍😍");
onTap: (item) {
Get.toNamed(item.route, id: killHouseActionKey);
},
),
);

View File

@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
import 'package:rasadyar_chicken/data/repositories/kill_house/kill_house_repository.dart';
import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart';
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
@@ -6,11 +8,21 @@ import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_core/core.dart';
class KillHouseRootLogic extends GetxController {
RxInt currentPage = 2.obs;
RxInt currentPage = 1.obs;
var tokenService = Get.find<TokenStorageService>();
late KillHouseRepository killHouseRepository;
@override
void onInit() {
super.onInit();
killHouseRepository = diChicken.get<KillHouseRepository>();
}
final pages = [
Navigator(
key: Get.nestedKey(killHouseFirstKey),
key: Get.nestedKey(killHouseActionKey),
onGenerateRoute: (settings) {
final page = ChickenPages.pages.firstWhere(
(e) => e.name == settings.name,

View File

@@ -0,0 +1,378 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
Widget addKillRequestBottomSheet(SubmitRequestKillHouseLogic controller) {
return ObxValue(
(data) => AnimatedContainer(
duration: Duration(milliseconds: 300),
height: data.value ? 680.h : 580.h,
child: BaseBottomSheet(
child: Column(
children: [
Row(
children: [
SizedBox(width: 12),
Text(
"ثبت درخواست کشتار",
style: AppFonts.yekan18Bold.copyWith(color: AppColor.iconColor),
),
],
),
Divider(),
SizedBox(height: 8),
InformationTag(
data: InformationTagData(
labelTitle: 'قیمت روز مرغ (${Jalali.now().formatCompactDate()})',
labelTitleStyle: AppFonts.yekan14,
isLoading: false,
height: 40.h,
value: controller.commissionPrices.chickenAveragePrice.separatedByComma.addReal,
valueStyle: AppFonts.yekan14,
borderColor: AppColor.greenNormal,
radiusWidth: 1,
valueBgColor: Colors.white,
labelGradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [AppColor.greenLightActive, Colors.white],
),
),
),
SizedBox(height: 12),
ResourceOverlayDropdown(
height: 40.h,
items: controller.killHouseList,
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
labelBuilder: (selected) => Text(selected?.name ?? 'محل کشتار'),
onChanged: controller.setKillHouse,
),
SizedBox(height: 8),
UnitTextField(
controller: controller.breedCountController,
keyboardType: TextInputType.number,
maxLines: 1,
minLines: 1,
inputFormatters: [FilteringTextInputFormatter.digitsOnly, SeparatorInputFormatter()],
unit: 'قطعه',
hint: 'حجم کشتار',
initialValue: 0.separatedByComma,
),
SizedBox(height: 8),
ResourceOverlayDropdown(
items: controller.timeFrameOfKilling,
itemBuilder: (item) => Text(item),
labelBuilder: (selected) => Text(selected ?? 'زمان دریافت'),
onChanged: (selected) => controller.setTimeFrameOfKilling(selected),
),
SizedBox(height: 8),
RTextField(
controller: controller.dateOfSlaughterTextEditor,
hintText: 'تاریخ کشتار',
filled: true,
filledColor: AppColor.bgLight,
prefixIcon: Padding(
padding: const EdgeInsets.all(8.0),
child: Assets.vec.calendarSvg.svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(AppColor.bgIcon, BlendMode.srcIn),
),
),
readonly: true,
onTap: () {
Get.bottomSheet(
modalDatePicker(
onDateSelected: (value) {
controller.dateOfSlaughterTextEditor.text = value.formatCompactDate();
controller.dateOfSlaughter = value;
},
),
isScrollControlled: true,
isDismissible: true,
ignoreSafeArea: false,
);
},
),
SizedBox(height: 8),
buildAnimatedLabelContainer(controller),
SizedBox(height: 8),
Container(
height: 40.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.blueDark, width: 0.5),
),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if (controller.isAgreedUndertaking.value == false) {
undertakingDialog(controller);
}
else{
controller.toggleAgreeUndertaking(false);
}
},
child: Row(
spacing: 2,
children: [
ObxValue((data) {
return Checkbox(
value: data.value,
onChanged: (value) {
if (controller.isAgreedUndertaking.value == false) {
undertakingDialog(controller);
}
else {
controller.toggleAgreeUndertaking(false);
}
},
);
}, controller.isAgreedUndertaking),
Text(
"با تعهدنامه موافق هستم !",
style: AppFonts.yekan14Bold.copyWith(color: AppColor.blueDark),
),
],
),
),
),
SizedBox(height: 8),
Container(
height: 40.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.mediumGrey, width: 1),
),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => controller.toggleAgreeSmsNotification(),
child: Row(
spacing: 2,
children: [
ObxValue((selected) {
return Checkbox(
value: selected.value,
onChanged: (value) => controller.toggleAgreeSmsNotification(),
);
}, controller.isAgreedSmsNotification),
Text(
"دریافت پیامک اطلاع رسانی",
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2),
),
],
),
),
),
SizedBox(height: 16),
Row(
spacing: 16,
mainAxisAlignment: .center,
children: [
RElevated(
width: 160.w,
height: 40.h,
backgroundColor: AppColor.greenNormal,
text: 'ثبت',
onPressed: () async {
await controller.submitKillRequest();
},
),
ROutlinedElevated(
height: 40,
text: 'انصراف',
borderColor: AppColor.redNormal,
onPressed: () {
Get.back();
},
),
],
),
],
),
),
),
controller.isBreedWeightSelected,
);
}
void undertakingDialog(SubmitRequestKillHouseLogic controller) {
Get.dialog(
AlertDialog(
title: Text("تعهد نامه", textAlign: TextAlign.center),
titleTextStyle: AppFonts.yekan20.copyWith(color: AppColor.textColor3),
content: Column(
mainAxisSize: .min,
spacing: 10,
children: [
Text(
"اینجانب ${controller.baseLogic.userProfile.value.data?.fullname} موافقت خود را نسبت به موارد ذکر شده اعلام می نمایم.",
style: AppFonts.yekan13.copyWith(color: AppColor.textColor3),
),
Text(
"✅ بر اساس این توافق نامه در صورت لغو کشتار جریمه خواهم شد.",
style: AppFonts.yekan13.copyWith(color: AppColor.textColor3),
),
],
),
actions: [
Row(
spacing: 10,
children: [
Expanded(
child: RElevated(
text: 'موافقم',
height: 32.h,
onPressed: () {
controller.toggleAgreeUndertaking(true);
Get.back();
},
textStyle: AppFonts.yekan20Bold.copyWith(color: Colors.white),
backgroundColor: AppColor.greenNormal,
),
),
Expanded(
child: ROutlinedElevated(
text: 'رد',
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
height: 32.h,
onPressed: () {
controller.toggleAgreeUndertaking(false);
Get.back();
},
borderColor: AppColor.redNormal,
),
),
],
),
],
),
);
}
Widget buildAnimatedLabelContainer(SubmitRequestKillHouseLogic controller) {
return ObxValue((data) {
return AnimatedCrossFade(
firstChild: GestureDetector(
onTap: () {
controller.toggleBreedWeightSelection();
},
child: Container(
height: 40.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.mediumGrey, width: 0.5),
),
child: Row(
spacing: 7,
children: [
Directionality(
textDirection: TextDirection.ltr,
child: Switch(
value: data.value,
onChanged: (data) => controller.toggleBreedWeightSelection(),
),
),
Text(
"تعیین نژاد / وزن مرغ",
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2),
),
],
),
),
),
secondChild: SizedBox(
height: 140.h,
child: Stack(
fit: StackFit.passthrough,
children: [
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
height: 121.h,
padding: EdgeInsets.fromLTRB(8.r, 18.r, 8.r, 8.r),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.mediumGrey, width: (0.5).w),
),
child: Column(
spacing: 8,
children: [
ResourceOverlayDropdown(
items: controller.chickenBreedList,
itemBuilder: (item) => Text(item),
labelBuilder: (selected) => Text(selected ?? 'نژاد مرغ'),
onChanged: (selected) => controller.setChickenBreed(selected),
),
RTextField(
controller: controller.chickenWeight,
label: ' وزن مرغ (کیلوگرم) ',
filled: true,
filledColor: AppColor.bgLight,
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
SeparatorInputFormatter(),
],
),
],
),
),
),
Positioned(
top: 0,
right: 7,
child: GestureDetector(
onTap: () {
controller.toggleBreedWeightSelection();
},
child: Container(
height: 30.h,
padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 4.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.mediumGrey, width: 0.5),
),
child: Row(
spacing: 7,
children: [
Directionality(
textDirection: TextDirection.ltr,
child: FittedBox(
fit: BoxFit.scaleDown,
child: Switch(
value: data.value,
onChanged: (_) => controller.toggleBreedWeightSelection(),
),
),
),
Text(
"تعیین نژاد / وزن مرغ",
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2),
),
],
),
),
),
),
],
),
),
crossFadeState: data.value ? CrossFadeState.showSecond : CrossFadeState.showFirst,
duration: Duration(milliseconds: 500),
);
}, controller.isBreedWeightSelected);
}

View File

@@ -0,0 +1,225 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/request/kill_request_response.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/chicken_commission_prices/chicken_commission_prices.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_house/kill_house_response.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_request_list/kill_request_list.dart'
as listModel;
import 'package:rasadyar_chicken/presentation/pages/kill_house/root/logic.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
import 'package:rasadyar_core/core.dart';
class SubmitRequestKillHouseLogic extends GetxController {
ChickenBaseLogic baseLogic = Get.find<ChickenBaseLogic>();
RxList<String> routesName = ["عملیات", "ثبت درخواست کشتار"].obs;
late KillHouseRootLogic rootLogic;
RxInt expandedItemIndex = RxInt(-1);
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString();
RxBool isBreedWeightSelected = false.obs;
TextEditingController breedCountController = TextEditingController();
TextEditingController dateOfSlaughterTextEditor = TextEditingController();
Jalali dateOfSlaughter = Jalali.now();
TextEditingController chickenWeight = TextEditingController();
Resource<List<String>> timeFrameOfKilling = Resource.success([
'12 - 14',
'14 - 16',
'16 - 18',
'18 - 20',
'20 - 22',
'22 - 24',
]);
RxString timeFrameOfKillingSelected = ''.obs;
Resource<List<String>> chickenBreedList = Resource.success([
'آرین',
'راس',
'آربراکوز (آیلاس)',
'کاب',
'هوبارد',
'ترکیبی',
'وارداتی',
]);
RxString chickenBreedSelected = ''.obs;
RxBool isAgreedUndertaking = false.obs;
RxBool isAgreedSmsNotification = false.obs;
KillHouseResponse? selectedKillHouse;
late Resource<List<KillHouseResponse>> killHouseList;
late ChickenCommissionPrices commissionPrices;
Rx<Resource<List<listModel.KillRequestList>>> killRequestList = Rx(
Resource.initial(),
);
@override
void onInit() {
super.onInit();
rootLogic = Get.find<KillHouseRootLogic>();
getCommissionPrice();
getKillHouseList();
getListOfKillRequests();
dateOfSlaughterTextEditor.text = Jalali.now().formatCompactDate();
dateOfSlaughter = Jalali.now();
chickenWeight.text = '2.7';
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
void onRefresh() {
getCommissionPrice();
getKillHouseList();
getListOfKillRequests();
}
void toggleExpandedItem(int index) {
if (expandedItemIndex.value == index) {
expandedItemIndex.value = -1;
} else {
expandedItemIndex.value = index;
}
}
void toggleBreedWeightSelection() {
isBreedWeightSelected.value = !isBreedWeightSelected.value;
}
void clearPage() {
expandedItemIndex.value = -1;
isBreedWeightSelected.value = false;
isAgreedUndertaking.value = false;
isAgreedSmsNotification.value = false;
breedCountController.clear();
dateOfSlaughter = Jalali.now();
dateOfSlaughterTextEditor.text = Jalali.now().formatCompactDate();
chickenWeight.text = '2.7';
timeFrameOfKillingSelected.value = '';
chickenBreedSelected.value = '';
}
void setKillHouse(KillHouseResponse killHouse) {
selectedKillHouse = killHouse;
iLog(selectedKillHouse?.key);
}
void setTimeFrameOfKilling(String timeFrame) {
timeFrameOfKillingSelected.value = timeFrame;
}
void setChickenBreed(String breed) {
chickenBreedSelected.value = breed;
}
void toggleAgreeUndertaking(bool item) {
isAgreedUndertaking.value = item;
}
void toggleAgreeSmsNotification() {
isAgreedSmsNotification.value = !isAgreedSmsNotification.value;
}
Future<void> getKillHouseList() async {
await safeCall(
call: () => rootLogic.killHouseRepository.getKillHouseList(
token: rootLogic.tokenService.accessToken.value ?? '',
),
onSuccess: (result) => killHouseList = Resource.success(result ?? []),
);
}
Future<void> getCommissionPrice() async {
await safeCall(
call: () => rootLogic.killHouseRepository.getCommissionPrice(
token: rootLogic.tokenService.accessToken.value ?? '',
),
onSuccess: (result) => commissionPrices =
result ?? ChickenCommissionPrices(chickenAveragePrice: 0),
);
}
Future<void> submitKillRequest() async {
KillRequestResponse request = KillRequestResponse(
killCapacity: int.parse(breedCountController.text),
reciveTime: timeFrameOfKillingSelected.value,
reciveDate: dateOfSlaughter
.toDateTime()
.formattedGregorianDateWithoutMillisecond,
lowWeight: false,
highWeight: false,
indexWeight: double.parse(chickenWeight.text),
chickenBreed: chickenBreedSelected.value,
cash: true,
credit: false,
smsPayment: isAgreedSmsNotification.value,
killHouseKey: selectedKillHouse?.key,
killerKillHouseKey: null,
role: 'KillHouse',
);
await safeCall(
showError: true,
call: () => rootLogic.killHouseRepository.submitKillHouseRequest(
token: rootLogic.tokenService.accessToken.value ?? '',
data: request,
),
onSuccess: (result) {
onRefresh();
Get.back();
Future.delayed(
Duration(seconds: 3),
() => defaultShowSuccessMessage("عملیات با موفقیت انجام شد"),
);
},
);
}
Future<void> getListOfKillRequests() async {
await safeCall(
showError: true,
call: () => rootLogic.killHouseRepository.getListKillRequest(
token: rootLogic.tokenService.accessToken.value ?? '',
queryParameters: buildRawQueryParams(
role: 'KillHouse',
fromDate: fromDateFilter.value.toDateTime(),
toDate: toDateFilter.value.toDateTime(),
),
),
onSuccess: (result) {
if (result == null || result.isEmpty) {
killRequestList.value = Resource.empty();
return;
}
killRequestList.value = Resource.success(result);
},
onError: (error, stackTrace) {
killRequestList.value = Resource.error(error);
},
);
}
Future<void> deleteRequest(int id) async {
await safeCall(
showError: true,
call: () => rootLogic.killHouseRepository.deleteKillRequest(
token: rootLogic.tokenService.accessToken.value ?? '',
requestId: id,
),
onSuccess: (result) {
onRefresh();
Get.back();
},
);
}
}

View File

@@ -0,0 +1,232 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_request_list/kill_request_list.dart'
as listModel
show KillRequestList;
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 'add_request_bottom_sheet.dart';
import 'logic.dart';
class SubmitRequestKillHousePage extends GetView<SubmitRequestKillHouseLogic> {
const SubmitRequestKillHousePage({super.key});
@override
Widget build(BuildContext context) {
return ChickenBasePage(
hasBack: true,
hasFilter: true,
hasSearch: true,
onBackTap: () => Get.back(id: killHouseActionKey),
onSearchChanged: (data) {
//Todo
},
onRefresh: () async => controller.onRefresh(),
routesWidget: ContainerBreadcrumb(rxRoutes: controller.routesName),
child: Stack(
fit: .expand,
children: [
Positioned.fill(
right: 13,
left: 14,
child: Obx(() {
return RListView.separated(
itemCount: controller.killRequestList.value.data?.length ?? 0,
itemBuilder: (context, index) {
var item = controller.killRequestList.value.data![index];
return ObxValue((data) {
return ExpandableListItem2(
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item),
onTap: () => controller.toggleExpandedItem(index),
selected: data.value == index,
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.virtualSvg.path,
);
}, controller.expandedItemIndex);
},
separatorBuilder: (context, index) => SizedBox(height: 8),
resource: controller.killRequestList.value,
);
}),
),
Positioned(
right: 8,
bottom: 92,
child: RFab.add(
onPressed: () {
Get.bottomSheet(
isScrollControlled: true,
addKillRequestBottomSheet(controller),
).then((value) {
controller.clearPage();
});
},
),
),
],
),
);
}
Row itemListWidget(listModel.KillRequestList item) {
return Row(
children: [
SizedBox(width: 30),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
item.killHouse?.name ?? 'بدون نام',
style: AppFonts.yekan14Bold.copyWith(color: AppColor.blueNormal),
),
SizedBox(height: 4),
Text(
item.createDate?.toJalali.formatCompactDate() ?? "-",
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
],
),
Spacer(),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'درخواست ${item.killCapacity}'.addCountEXT,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
SizedBox(height: 4),
Text(
'تعداد مورد تایید 150 قطعه',
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
],
),
Spacer(),
Assets.vec.scanSvg.svg(
width: 32.w,
height: 32.h,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
SizedBox(width: 12),
],
);
}
Container itemListExpandedWidget(listModel.KillRequestList item) {
Jalali date = item.createDate.toJalali;
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.killHouse?.name ?? 'بدون نام',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
Spacer(),
//todo
Text(
'در انتظار تایید استان',
textAlign: TextAlign.center,
style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyDark),
),
SizedBox(width: 7),
Assets.vec.clockSvg.svg(width: 16.w, height: 16.h),
],
),
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: [
Row(
spacing: 3,
children: [
Text(
date.formatter.wN,
style: AppFonts.yekan14.copyWith(
color: AppColor.textColor,
),
),
Text(
'${date.formatter.d} ${date.formatter.mN ?? 'N/A'}',
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
],
),
Text(
date.formatter.y,
style: AppFonts.yekan20.copyWith(color: AppColor.textColor),
),
Text(
'${date.formatter.tHH}:${date.formatter.tMM ?? 'N/A'}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
],
),
),
buildRow(
title: 'تعداد درخواست اولیه',
value: item.killCapacity.separatedByComma.addCountEXT,
),
//todo
buildRow(
title: 'تعداد مورد تایید',
value: item.numberOfAllocated.separatedByComma.addCountEXT,
),
buildRow(title: 'زمان دریافت', value: item.reciveTime ?? '-'),
buildRow(
title: 'تاریخ درخواستی کشتار',
value: item.reciveDate.toJalali.formatCompactDate(),
),
ROutlinedElevated(
text: 'حذف',
height: 40.h,
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
isFullWidth: true,
onPressed: () {
buildWarningDialog(
title: 'اخطار',
middleText: 'آیا از حذف شدن این مورد اطمینان دارید؟',
onConfirm: () async {
controller.deleteRequest(item.id!);
},
onRefresh: () async {
controller.onRefresh();
},
);
},
borderColor: AppColor.redNormal,
),
],
),
);
}
}

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import '../widgets/step1_page.dart';
class PoultryFarmInspectionHomeLogic extends GetxController
with GetTickerProviderStateMixin {

View File

@@ -49,10 +49,6 @@ class PoultryScienceRootLogic extends GetxController {
poultryRepository = diChicken.get<PoultryScienceRepository>();
}
@override
void onClose() {
super.onClose();
}
void toggleExpanded(int index) {
if (homeExpandedList.keys.contains(index)) {

View File

@@ -5,10 +5,6 @@ class BuyLogic extends GetxController {
List<String> routesName = ['خرید'];
DateTime? _lastBackPressed;
@override
void onInit() {
super.onInit();
}
@override
void onReady() {

View File

@@ -133,7 +133,7 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
),
Spacer(),
Text(
item.receiverState?.faItem,
item.receiverState?.faItem ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyDark),
),

View File

@@ -29,7 +29,7 @@ class BuyOutOfProvinceLogic extends GetxController {
Rxn<IranProvinceCityModel> selectedProvince = Rxn();
Rxn<IranProvinceCityModel> selectedCity = Rxn();
Rxn<XFile> selectedImage = Rxn<XFile>();
RxnString _base64Image = RxnString();
final RxnString _base64Image = RxnString();
RxnString editImageUrl = RxnString();
RxnString editFreeBarKey = RxnString();

View File

@@ -464,7 +464,7 @@ class SalesInProvinceLogic extends GetxController {
}
Steward? getBuyerInformation(AllocatedMadeModel model) {
if (model.allocationType?.buyerIsGuild) {
if (model.allocationType?.buyerIsGuild ?? false) {
return model.toGuilds;
} else {
return model.steward;

View File

@@ -111,7 +111,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
onSubmit: () => controller.submitFilter(),
);
itemListWidget(StewardFreeSaleBar item) {
Row itemListWidget(StewardFreeSaleBar item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@@ -182,7 +182,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
);
}
itemListExpandedWidget(StewardFreeSaleBar item, int index) {
Container itemListExpandedWidget(StewardFreeSaleBar item, int index) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(

View File

@@ -277,7 +277,7 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
);
}
itemListExpandedWidget(OutProvinceCarcassesBuyer item) {
Container itemListExpandedWidget(OutProvinceCarcassesBuyer item) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),

View File

@@ -70,7 +70,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
);
}
itemListWidget(StewardFreeSaleBar item) {
Row itemListWidget(StewardFreeSaleBar item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@@ -128,7 +128,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
);
}
itemListExpandedWidget(StewardFreeSaleBar item, int index) {
Container itemListExpandedWidget(StewardFreeSaleBar item, int index) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),

View File

@@ -90,10 +90,6 @@ class SegmentationLogic extends GetxController {
setUpListener();
}
@override
void onClose() {
super.onClose();
}
void setSearchValue(String? value) {
searchedValue.value = value?.trim();

View File

@@ -81,7 +81,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
onSubmit: () => controller.getAllSegmentation(),
);
itemListWidget(SegmentationModel item) {
Row itemListWidget(SegmentationModel item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@@ -160,7 +160,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
);
}
itemListExpandedWidget(SegmentationModel item, int index) {
Container itemListExpandedWidget(SegmentationModel item, int index) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),

View File

@@ -6,6 +6,8 @@ import 'package:rasadyar_chicken/presentation/pages/kill_house/action/logic.dart
import 'package:rasadyar_chicken/presentation/pages/kill_house/action/view.dart';
import 'package:rasadyar_chicken/presentation/pages/kill_house/root/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/kill_house/root/view.dart';
import 'package:rasadyar_chicken/presentation/pages/kill_house/submit_request/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/kill_house/submit_request/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_farm_inspection/poultry_farm_inspection.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';
@@ -25,6 +27,7 @@ import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/view.da
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';
import 'package:rasadyar_core/core.dart';
@@ -38,7 +41,7 @@ sealed class ChickenPages {
binding: BindingsBuilder(() {
Get.lazyPut(() => AuthLogic());
Get.lazyPut(() => CaptchaWidgetLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
),
@@ -47,7 +50,7 @@ sealed class ChickenPages {
page: () => RolePage(),
binding: BindingsBuilder(() {
Get.lazyPut(() => RoleLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
),
@@ -59,7 +62,7 @@ sealed class ChickenPages {
bindings: [
GlobalBinding(),
BindingsBuilder(() {
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
Get.lazyPut(() => StewardRootLogic());
Get.lazyPut(() => HomeLogic());
Get.lazyPut(() => BuyLogic());
@@ -75,7 +78,7 @@ sealed class ChickenPages {
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.put(HomeLogic());
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
}),
),
@@ -86,7 +89,7 @@ sealed class ChickenPages {
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => SaleLogic());
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
Get.lazyPut(() => SalesOutOfProvinceLogic());
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
Get.lazyPut(() => StewardRootLogic());
@@ -117,7 +120,7 @@ sealed class ChickenPages {
page: () => SalesInProvincePage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
Get.lazyPut(() => SalesInProvinceLogic());
}),
),
@@ -128,7 +131,7 @@ sealed class ChickenPages {
page: () => BuyPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
Get.lazyPut(() => BuyLogic());
}),
),
@@ -137,7 +140,7 @@ sealed class ChickenPages {
page: () => BuyOutOfProvincePage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
Get.lazyPut(() => BuyOutOfProvinceLogic());
}),
),
@@ -146,7 +149,7 @@ sealed class ChickenPages {
page: () => BuyInProvincePage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
Get.lazyPut(() => BuyInProvinceLogic());
Get.lazyPut(() => BuyInProvinceWaitingLogic());
Get.lazyPut(() => BuyInProvinceAllLogic());
@@ -234,7 +237,7 @@ sealed class ChickenPages {
page: () => PoultryFarmInspectionHomePage(),
binding: BindingsBuilder(() {
Get.lazyPut(() => PoultryFarmInspectionHomeLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
),
//endregion
@@ -245,7 +248,7 @@ sealed class ChickenPages {
page: () => KillHouseRootPage(),
binding: BindingsBuilder(() {
Get.lazyPut(() => KillHouseRootLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
),
GetPage(
@@ -255,7 +258,19 @@ sealed class ChickenPages {
GlobalBinding(),
BindingsBuilder(() {
Get.lazyPut(() => KillHouseActionLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
],
),
GetPage(
name: ChickenRoutes.submitRequestKillHouse,
page: () => SubmitRequestKillHousePage(),
bindings: [
GlobalBinding(),
BindingsBuilder(() {
Get.lazyPut(() => SubmitRequestKillHouseLogic());
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
],
),

View File

@@ -48,6 +48,7 @@ sealed class ChickenRoutes {
static const _killHouse = '$_base/killHouse';
static const initKillHouse = '$_killHouse/home';
static const actionKillHouse = '$_killHouse/action';
static const submitRequestKillHouse = '$actionKillHouse/submitRequest';
//endregion
}

View File

@@ -13,6 +13,6 @@ const int poultryThirdKey = 107;
//endregion
//region kill house Keys
const int killHouseFirstKey = 108;
const int killHouseActionKey = 108;
//endregion

View File

@@ -1,5 +1,5 @@
extension XStringUtils on String {
get faAllocationType {
String get faAllocationType {
final tmp = split('_');
tmp.insert(1, '_');
if (tmp.length > 1) {
@@ -9,9 +9,9 @@ extension XStringUtils on String {
}
}
get faItem => utilsMap[this] ?? this;
String get faItem => utilsMap[this] ?? this;
get buyerIsGuild {
bool get buyerIsGuild {
final tmp = split('_');
if (tmp.length > 1) {
return tmp.last == 'guild';

View File

@@ -0,0 +1,32 @@
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart';
import 'package:rasadyar_core/core.dart';
import '../../../data/models/response/user_profile/user_profile.dart';
class ChickenBaseLogic extends BasePageLogic {
var tokenService = Get.find<TokenStorageService>();
ChickenRepository chickenRepository = diChicken.get<ChickenRepository>();
Rx<Resource<UserProfile>> userProfile = Rx<Resource<UserProfile>>(Resource.loading());
@override
void onInit() {
super.onInit();
getUserProfile();
}
Future<void> getUserProfile() async {
userProfile.value = Resource.loading();
await safeCall<UserProfile?>(
call: () async =>
await chickenRepository.getUserProfile(token: tokenService.accessToken.value!),
onSuccess: (result) {
if (result != null) {
userProfile.value = Resource.success(result);
}
},
onError: (error, stackTrace) {},
);
}
}

View File

@@ -3,7 +3,9 @@ import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/back_ground.dart';
import 'package:rasadyar_core/core.dart';
class ChickenBasePage extends GetView<BaseLogic> {
import 'logic.dart';
class ChickenBasePage extends GetView<ChickenBaseLogic> {
const ChickenBasePage({
super.key,
this.hasBack = true,

View File

@@ -62,7 +62,7 @@ Widget _itemList({required String title, required String? value, String? unit,Co
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
value!,
value,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: const Color(0xFF5B5B5B)),
),

View File

@@ -9,10 +9,6 @@ class WidelyUsedLogic extends GetxController {
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
@override
void onReady() {
super.onReady();
}
@override
void onClose() {

View File

@@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:rasadyar_chicken/data/common/dio_error_handler.dart';

View File

@@ -4,7 +4,6 @@ import 'package:rasadyar_chicken/data/data_source/remote/auth/auth_remote_imp.da
import 'package:rasadyar_chicken/data/models/response/user_info/user_info_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile_model/user_profile_model.dart';
import 'package:rasadyar_core/core.dart';
import 'package:dio/dio.dart';
class MockDioRemote extends Mock implements DioRemote {}