feat : new ui and fix bug's

This commit is contained in:
2025-10-06 10:57:46 +03:30
parent a4c7fa87a3
commit 887aff27ae
44 changed files with 842 additions and 206 deletions

View File

@@ -0,0 +1 @@
{"format-version":[1,0,0],"native-assets":{}}

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
{"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"],"packages/flutter_map/lib/assets/flutter_map_logo.png":["packages/flutter_map/lib/assets/flutter_map_logo.png"]}

View File

@@ -0,0 +1 @@
[{"family":"packages/cupertino_icons/CupertinoIcons","fonts":[{"asset":"packages/cupertino_icons/assets/CupertinoIcons.ttf"}]}]

Binary file not shown.

View File

@@ -0,0 +1 @@
{"format-version":[1,0,0],"native-assets":{}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -5,6 +5,7 @@ import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/stewa
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart'; import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart'; import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart'; import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart';
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
import 'package:rasadyar_chicken/data/models/response/dashboard_kill_house_free_bar/dashboard_kill_house_free_bar.dart'; import 'package:rasadyar_chicken/data/models/response/dashboard_kill_house_free_bar/dashboard_kill_house_free_bar.dart';
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart'; import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart'; import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart';
@@ -152,4 +153,7 @@ abstract class ChickenRemoteDatasource {
Future<void> editSegmentation({required String token, required SegmentationModel model}); Future<void> editSegmentation({required String token, required SegmentationModel model});
Future<SegmentationModel?> deleteSegmentation({required String token, required String key}); Future<SegmentationModel?> deleteSegmentation({required String token, required String key});
Future<BroadcastPrice?> getBroadcastPrice({required String token});
} }

View File

@@ -1,4 +1,3 @@
import 'package:rasadyar_chicken/data/models/request/change_password/change_password_request_model.dart'; import 'package:rasadyar_chicken/data/models/request/change_password/change_password_request_model.dart';
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart'; import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/create_steward_free_bar.dart'; import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/create_steward_free_bar.dart';
@@ -6,6 +5,7 @@ import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/stewa
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart'; import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart'; import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart'; import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart';
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
import 'package:rasadyar_chicken/data/models/response/dashboard_kill_house_free_bar/dashboard_kill_house_free_bar.dart'; import 'package:rasadyar_chicken/data/models/response/dashboard_kill_house_free_bar/dashboard_kill_house_free_bar.dart';
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart'; import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart'; import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart';
@@ -482,4 +482,16 @@ class ChickenRemoteDatasourceImp implements ChickenRemoteDatasource {
return res.data; return res.data;
} }
@override
Future<BroadcastPrice?> getBroadcastPrice({required String token}) async {
var res = await _httpClient.get(
'/broadcast-price/',
headers: {'Authorization': 'Bearer $token'},
fromJson: (json) => BroadcastPrice.fromJson(json),
);
return res.data;
}
} }

View File

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

View File

@@ -0,0 +1,23 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'broadcast_price.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_BroadcastPrice _$BroadcastPriceFromJson(Map<String, dynamic> json) =>
_BroadcastPrice(
active: json['active'] as bool?,
killHousePrice: (json['kill_house_price'] as num?)?.toInt(),
stewardPrice: (json['steward_price'] as num?)?.toInt(),
guildPrice: (json['guild_price'] as num?)?.toInt(),
);
Map<String, dynamic> _$BroadcastPriceToJson(_BroadcastPrice instance) =>
<String, dynamic>{
'active': instance.active,
'kill_house_price': instance.killHousePrice,
'steward_price': instance.stewardPrice,
'guild_price': instance.guildPrice,
};

View File

@@ -11,6 +11,8 @@ abstract class SegmentationModel with _$SegmentationModel {
String? productKey, String? productKey,
String? guildKey, String? guildKey,
String? result, String? result,
String? quota,
String? saleType,
int? weight, int? weight,
Buyer? buyer, Buyer? buyer,
DateTime? date, DateTime? date,

View File

@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$SegmentationModel { mixin _$SegmentationModel {
String? get key; String? get productKey; String? get guildKey; String? get result; int? get weight; Buyer? get buyer; DateTime? get date; ToGuild? get toGuild; String? get key; String? get productKey; String? get guildKey; String? get result; String? get quota; String? get saleType; int? get weight; Buyer? get buyer; DateTime? get date; ToGuild? get toGuild;
/// Create a copy of SegmentationModel /// Create a copy of SegmentationModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $SegmentationModelCopyWith<SegmentationModel> get copyWith => _$SegmentationMode
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SegmentationModel&&(identical(other.key, key) || other.key == key)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.result, result) || other.result == result)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.date, date) || other.date == date)&&(identical(other.toGuild, toGuild) || other.toGuild == toGuild)); return identical(this, other) || (other.runtimeType == runtimeType&&other is SegmentationModel&&(identical(other.key, key) || other.key == key)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.result, result) || other.result == result)&&(identical(other.quota, quota) || other.quota == quota)&&(identical(other.saleType, saleType) || other.saleType == saleType)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.date, date) || other.date == date)&&(identical(other.toGuild, toGuild) || other.toGuild == toGuild));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,key,productKey,guildKey,result,weight,buyer,date,toGuild); int get hashCode => Object.hash(runtimeType,key,productKey,guildKey,result,quota,saleType,weight,buyer,date,toGuild);
@override @override
String toString() { String toString() {
return 'SegmentationModel(key: $key, productKey: $productKey, guildKey: $guildKey, result: $result, weight: $weight, buyer: $buyer, date: $date, toGuild: $toGuild)'; return 'SegmentationModel(key: $key, productKey: $productKey, guildKey: $guildKey, result: $result, quota: $quota, saleType: $saleType, weight: $weight, buyer: $buyer, date: $date, toGuild: $toGuild)';
} }
@@ -48,7 +48,7 @@ abstract mixin class $SegmentationModelCopyWith<$Res> {
factory $SegmentationModelCopyWith(SegmentationModel value, $Res Function(SegmentationModel) _then) = _$SegmentationModelCopyWithImpl; factory $SegmentationModelCopyWith(SegmentationModel value, $Res Function(SegmentationModel) _then) = _$SegmentationModelCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String? key, String? productKey, String? guildKey, String? result, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild String? key, String? productKey, String? guildKey, String? result, String? quota, String? saleType, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild
}); });
@@ -65,12 +65,14 @@ class _$SegmentationModelCopyWithImpl<$Res>
/// Create a copy of SegmentationModel /// Create a copy of SegmentationModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? productKey = freezed,Object? guildKey = freezed,Object? result = freezed,Object? weight = freezed,Object? buyer = freezed,Object? date = freezed,Object? toGuild = freezed,}) { @pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? productKey = freezed,Object? guildKey = freezed,Object? result = freezed,Object? quota = freezed,Object? saleType = freezed,Object? weight = freezed,Object? buyer = freezed,Object? date = freezed,Object? toGuild = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable as String?,productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable
as String?,guildKey: freezed == guildKey ? _self.guildKey : guildKey // ignore: cast_nullable_to_non_nullable as String?,guildKey: freezed == guildKey ? _self.guildKey : guildKey // ignore: cast_nullable_to_non_nullable
as String?,result: freezed == result ? _self.result : result // ignore: cast_nullable_to_non_nullable as String?,result: freezed == result ? _self.result : result // ignore: cast_nullable_to_non_nullable
as String?,quota: freezed == quota ? _self.quota : quota // ignore: cast_nullable_to_non_nullable
as String?,saleType: freezed == saleType ? _self.saleType : saleType // ignore: cast_nullable_to_non_nullable
as String?,weight: freezed == weight ? _self.weight : weight // ignore: cast_nullable_to_non_nullable as String?,weight: freezed == weight ? _self.weight : weight // ignore: cast_nullable_to_non_nullable
as int?,buyer: freezed == buyer ? _self.buyer : buyer // ignore: cast_nullable_to_non_nullable as int?,buyer: freezed == buyer ? _self.buyer : buyer // ignore: cast_nullable_to_non_nullable
as Buyer?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable as Buyer?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable
@@ -184,10 +186,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? key, String? productKey, String? guildKey, String? result, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? key, String? productKey, String? guildKey, String? result, String? quota, String? saleType, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _SegmentationModel() when $default != null: case _SegmentationModel() when $default != null:
return $default(_that.key,_that.productKey,_that.guildKey,_that.result,_that.weight,_that.buyer,_that.date,_that.toGuild);case _: return $default(_that.key,_that.productKey,_that.guildKey,_that.result,_that.quota,_that.saleType,_that.weight,_that.buyer,_that.date,_that.toGuild);case _:
return orElse(); return orElse();
} }
@@ -205,10 +207,10 @@ return $default(_that.key,_that.productKey,_that.guildKey,_that.result,_that.wei
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? key, String? productKey, String? guildKey, String? result, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? key, String? productKey, String? guildKey, String? result, String? quota, String? saleType, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _SegmentationModel(): case _SegmentationModel():
return $default(_that.key,_that.productKey,_that.guildKey,_that.result,_that.weight,_that.buyer,_that.date,_that.toGuild);case _: return $default(_that.key,_that.productKey,_that.guildKey,_that.result,_that.quota,_that.saleType,_that.weight,_that.buyer,_that.date,_that.toGuild);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -225,10 +227,10 @@ return $default(_that.key,_that.productKey,_that.guildKey,_that.result,_that.wei
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? key, String? productKey, String? guildKey, String? result, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? key, String? productKey, String? guildKey, String? result, String? quota, String? saleType, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _SegmentationModel() when $default != null: case _SegmentationModel() when $default != null:
return $default(_that.key,_that.productKey,_that.guildKey,_that.result,_that.weight,_that.buyer,_that.date,_that.toGuild);case _: return $default(_that.key,_that.productKey,_that.guildKey,_that.result,_that.quota,_that.saleType,_that.weight,_that.buyer,_that.date,_that.toGuild);case _:
return null; return null;
} }
@@ -240,13 +242,15 @@ return $default(_that.key,_that.productKey,_that.guildKey,_that.result,_that.wei
@JsonSerializable() @JsonSerializable()
class _SegmentationModel implements SegmentationModel { class _SegmentationModel implements SegmentationModel {
const _SegmentationModel({this.key, this.productKey, this.guildKey, this.result, this.weight, this.buyer, this.date, this.toGuild}); const _SegmentationModel({this.key, this.productKey, this.guildKey, this.result, this.quota, this.saleType, this.weight, this.buyer, this.date, this.toGuild});
factory _SegmentationModel.fromJson(Map<String, dynamic> json) => _$SegmentationModelFromJson(json); factory _SegmentationModel.fromJson(Map<String, dynamic> json) => _$SegmentationModelFromJson(json);
@override final String? key; @override final String? key;
@override final String? productKey; @override final String? productKey;
@override final String? guildKey; @override final String? guildKey;
@override final String? result; @override final String? result;
@override final String? quota;
@override final String? saleType;
@override final int? weight; @override final int? weight;
@override final Buyer? buyer; @override final Buyer? buyer;
@override final DateTime? date; @override final DateTime? date;
@@ -265,16 +269,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SegmentationModel&&(identical(other.key, key) || other.key == key)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.result, result) || other.result == result)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.date, date) || other.date == date)&&(identical(other.toGuild, toGuild) || other.toGuild == toGuild)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _SegmentationModel&&(identical(other.key, key) || other.key == key)&&(identical(other.productKey, productKey) || other.productKey == productKey)&&(identical(other.guildKey, guildKey) || other.guildKey == guildKey)&&(identical(other.result, result) || other.result == result)&&(identical(other.quota, quota) || other.quota == quota)&&(identical(other.saleType, saleType) || other.saleType == saleType)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.buyer, buyer) || other.buyer == buyer)&&(identical(other.date, date) || other.date == date)&&(identical(other.toGuild, toGuild) || other.toGuild == toGuild));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,key,productKey,guildKey,result,weight,buyer,date,toGuild); int get hashCode => Object.hash(runtimeType,key,productKey,guildKey,result,quota,saleType,weight,buyer,date,toGuild);
@override @override
String toString() { String toString() {
return 'SegmentationModel(key: $key, productKey: $productKey, guildKey: $guildKey, result: $result, weight: $weight, buyer: $buyer, date: $date, toGuild: $toGuild)'; return 'SegmentationModel(key: $key, productKey: $productKey, guildKey: $guildKey, result: $result, quota: $quota, saleType: $saleType, weight: $weight, buyer: $buyer, date: $date, toGuild: $toGuild)';
} }
@@ -285,7 +289,7 @@ abstract mixin class _$SegmentationModelCopyWith<$Res> implements $SegmentationM
factory _$SegmentationModelCopyWith(_SegmentationModel value, $Res Function(_SegmentationModel) _then) = __$SegmentationModelCopyWithImpl; factory _$SegmentationModelCopyWith(_SegmentationModel value, $Res Function(_SegmentationModel) _then) = __$SegmentationModelCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String? key, String? productKey, String? guildKey, String? result, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild String? key, String? productKey, String? guildKey, String? result, String? quota, String? saleType, int? weight, Buyer? buyer, DateTime? date, ToGuild? toGuild
}); });
@@ -302,12 +306,14 @@ class __$SegmentationModelCopyWithImpl<$Res>
/// Create a copy of SegmentationModel /// Create a copy of SegmentationModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? productKey = freezed,Object? guildKey = freezed,Object? result = freezed,Object? weight = freezed,Object? buyer = freezed,Object? date = freezed,Object? toGuild = freezed,}) { @override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? productKey = freezed,Object? guildKey = freezed,Object? result = freezed,Object? quota = freezed,Object? saleType = freezed,Object? weight = freezed,Object? buyer = freezed,Object? date = freezed,Object? toGuild = freezed,}) {
return _then(_SegmentationModel( return _then(_SegmentationModel(
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable as String?,productKey: freezed == productKey ? _self.productKey : productKey // ignore: cast_nullable_to_non_nullable
as String?,guildKey: freezed == guildKey ? _self.guildKey : guildKey // ignore: cast_nullable_to_non_nullable as String?,guildKey: freezed == guildKey ? _self.guildKey : guildKey // ignore: cast_nullable_to_non_nullable
as String?,result: freezed == result ? _self.result : result // ignore: cast_nullable_to_non_nullable as String?,result: freezed == result ? _self.result : result // ignore: cast_nullable_to_non_nullable
as String?,quota: freezed == quota ? _self.quota : quota // ignore: cast_nullable_to_non_nullable
as String?,saleType: freezed == saleType ? _self.saleType : saleType // ignore: cast_nullable_to_non_nullable
as String?,weight: freezed == weight ? _self.weight : weight // ignore: cast_nullable_to_non_nullable as String?,weight: freezed == weight ? _self.weight : weight // ignore: cast_nullable_to_non_nullable
as int?,buyer: freezed == buyer ? _self.buyer : buyer // ignore: cast_nullable_to_non_nullable as int?,buyer: freezed == buyer ? _self.buyer : buyer // ignore: cast_nullable_to_non_nullable
as Buyer?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable as Buyer?,date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable

View File

@@ -12,6 +12,8 @@ _SegmentationModel _$SegmentationModelFromJson(Map<String, dynamic> json) =>
productKey: json['product_key'] as String?, productKey: json['product_key'] as String?,
guildKey: json['guild_key'] as String?, guildKey: json['guild_key'] as String?,
result: json['result'] as String?, result: json['result'] as String?,
quota: json['quota'] as String?,
saleType: json['sale_type'] as String?,
weight: (json['weight'] as num?)?.toInt(), weight: (json['weight'] as num?)?.toInt(),
buyer: json['buyer'] == null buyer: json['buyer'] == null
? null ? null
@@ -30,6 +32,8 @@ Map<String, dynamic> _$SegmentationModelToJson(_SegmentationModel instance) =>
'product_key': instance.productKey, 'product_key': instance.productKey,
'guild_key': instance.guildKey, 'guild_key': instance.guildKey,
'result': instance.result, 'result': instance.result,
'quota': instance.quota,
'sale_type': instance.saleType,
'weight': instance.weight, 'weight': instance.weight,
'buyer': instance.buyer, 'buyer': instance.buyer,
'date': instance.date?.toIso8601String(), 'date': instance.date?.toIso8601String(),

View File

@@ -5,6 +5,7 @@ import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/stewa
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart'; import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart'; import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart'; import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart';
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
import 'package:rasadyar_chicken/data/models/response/dashboard_kill_house_free_bar/dashboard_kill_house_free_bar.dart'; import 'package:rasadyar_chicken/data/models/response/dashboard_kill_house_free_bar/dashboard_kill_house_free_bar.dart';
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart'; import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart'; import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart';
@@ -158,6 +159,7 @@ abstract class ChickenRepository {
Future<SegmentationModel?> deleteSegmentation({required String token, required String key}); Future<SegmentationModel?> deleteSegmentation({required String token, required String key});
Future<BroadcastPrice?> getBroadcastPrice({required String token});
//endregion //endregion

View File

@@ -8,6 +8,7 @@ import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/stewa
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart'; import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart'; import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart'; import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart';
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
import 'package:rasadyar_chicken/data/models/response/dashboard_kill_house_free_bar/dashboard_kill_house_free_bar.dart'; import 'package:rasadyar_chicken/data/models/response/dashboard_kill_house_free_bar/dashboard_kill_house_free_bar.dart';
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart'; import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart'; import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart';
@@ -323,6 +324,12 @@ class ChickenRepositoryImp implements ChickenRepository {
return res; return res;
} }
@override
Future<BroadcastPrice?> getBroadcastPrice({required String token}) async {
var res = await remote.getBroadcastPrice(token: token);
return res;
}
//endregion //endregion
//region local //region local
@@ -330,6 +337,7 @@ class ChickenRepositoryImp implements ChickenRepository {
WidelyUsedLocalModel? getAllWidely() => local.getAllWidely(); WidelyUsedLocalModel? getAllWidely() => local.getAllWidely();
@override @override
Future<void> initWidleyUsed() async => local.initWidleyUsed(); Future<void> initWidleyUsed() async {}
//endregion //endregion
} }

View File

@@ -18,7 +18,7 @@ class ProfilePage extends GetView<ProfileLogic> {
spacing: 30, spacing: 30,
children: [ children: [
Expanded( Expanded(
flex: 1,
child: Container( child: Container(
color: AppColor.blueNormal, color: AppColor.blueNormal,
child: Column( child: Column(
@@ -142,6 +142,7 @@ class ProfilePage extends GetView<ProfileLogic> {
), ),
), ),
], ],
), ),
), ),
), ),

View File

@@ -1,8 +1,9 @@
import 'package:flutter/services.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
class BuyLogic extends GetxController { class BuyLogic extends GetxController {
List<String> routesName = ['خرید']; List<String> routesName = ['خرید'];
DateTime? _lastBackPressed;
@override @override
void onInit() { void onInit() {
@@ -11,7 +12,7 @@ class BuyLogic extends GetxController {
@override @override
void onReady() { void onReady() {
// TODO: implement onReady fLog('BuyLogic onReady');
super.onReady(); super.onReady();
} }
@@ -20,4 +21,20 @@ class BuyLogic extends GetxController {
// TODO: implement onClose // TODO: implement onClose
super.onClose(); super.onClose();
} }
void onPopScopTaped() async {
final now = DateTime.now();
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
_lastBackPressed = now;
Get.snackbar(
'خروج از برنامه',
'برای خروج دوباره بازگشت را بزنید',
snackPosition: SnackPosition.TOP,
duration: Duration(seconds: 2),
backgroundColor: AppColor.warning,
);
} else {
await SystemNavigator.pop();
}
}
} }

View File

@@ -23,10 +23,10 @@ class BuyInProvinceLogic extends GetxController {
void onInit() { void onInit() {
super.onInit(); super.onInit();
routesName.value = [...buyLogic.routesName, 'داخل استان'].toList(); routesName.value = [...buyLogic.routesName, 'داخل استان'].toList();
routesName.add(selectedSegmentIndex.value == 0 ? 'در انتظار' : 'بایگانی'); routesName.add(selectedSegmentIndex.value == 0 ? 'در انتظار' : 'کل خریدها');
ever(selectedSegmentIndex, (callback) { ever(selectedSegmentIndex, (callback) {
routesName.removeLast(); routesName.removeLast();
routesName.add(callback == 0 ? 'در انتظار' : 'بایگانی'); routesName.add(callback == 0 ? 'در انتظار' : 'کل خریدها');
}); });
ever(fromDateFilter, (callback) => _setFromDateFilter(callback)); ever(fromDateFilter, (callback) => _setFromDateFilter(callback));
@@ -35,7 +35,7 @@ class BuyInProvinceLogic extends GetxController {
@override @override
void onReady() { void onReady() {
// TODO: implement onReady fLog('BuyInProvinceLogic onReady');
super.onReady(); super.onReady();
} }

View File

@@ -41,7 +41,7 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
children: [ children: [
Expanded( Expanded(
child: RSegment( child: RSegment(
children: ['در انتظار', 'بایگانی'], children: ['در انتظار', 'کل خریدها'],
selectedIndex: 0, selectedIndex: 0,
borderColor: const Color(0xFFB4B4B4), borderColor: const Color(0xFFB4B4B4),
selectedBorderColor: AppColor.blueNormal, selectedBorderColor: AppColor.blueNormal,

View File

@@ -5,8 +5,8 @@ import 'package:rasadyar_core/core.dart';
class BuyInProvinceAllLogic extends GetxController { class BuyInProvinceAllLogic extends GetxController {
RxList<int> isExpandedList = <int>[].obs; RxList<int> isExpandedList = <int>[].obs;
Rxn<Jalali> fromDateFilter = Rxn(); Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rxn<Jalali> toDateFilter = Rxn(); Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString(); RxnString searchedValue = RxnString();
RxMap<String, bool> isLoadingConfirmMap = RxMap(); RxMap<String, bool> isLoadingConfirmMap = RxMap();
final RxBool isLoadingMoreAllocationsMade = false.obs; final RxBool isLoadingMoreAllocationsMade = false.obs;

View File

@@ -12,6 +12,7 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
eLog("BuyInProvinceAllPage");
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
child: ObxValue((data) { child: ObxValue((data) {

View File

@@ -9,8 +9,8 @@ import 'package:rasadyar_core/core.dart';
class BuyInProvinceWaitingLogic extends GetxController { class BuyInProvinceWaitingLogic extends GetxController {
RxList<int> isExpandedList = <int>[].obs; RxList<int> isExpandedList = <int>[].obs;
Rxn<Jalali> fromDateFilter = Rxn(); Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rxn<Jalali> toDateFilter = Rxn(); Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString(); RxnString searchedValue = RxnString();
RxMap<String, bool> isLoadingConfirmMap = RxMap(); RxMap<String, bool> isLoadingConfirmMap = RxMap();
Rx<Color> bgConfirmAllColor = AppColor.blueNormal.obs; Rx<Color> bgConfirmAllColor = AppColor.blueNormal.obs;
@@ -21,8 +21,6 @@ class BuyInProvinceWaitingLogic extends GetxController {
Rx<Resource<PaginationModel<WaitingArrivalModel>>> waitingProduct = Rx<Resource<PaginationModel<WaitingArrivalModel>>> waitingProduct =
Resource<PaginationModel<WaitingArrivalModel>>.loading().obs; Resource<PaginationModel<WaitingArrivalModel>>.loading().obs;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
@@ -37,7 +35,6 @@ class BuyInProvinceWaitingLogic extends GetxController {
void onReady() { void onReady() {
super.onReady(); super.onReady();
getWaitingArrivals(); getWaitingArrivals();
} }
@override @override
@@ -95,8 +92,6 @@ class BuyInProvinceWaitingLogic extends GetxController {
); );
} }
Future<void> acceptEntries(WaitingArrivalModel model) async { Future<void> acceptEntries(WaitingArrivalModel model) async {
var request = StewardAllocationRequest( var request = StewardAllocationRequest(
allocationKey: model.key, allocationKey: model.key,

View File

@@ -12,6 +12,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
eLog("BuyInProvinceWaitingPage");
return Scaffold( return Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: Padding( body: Padding(

View File

@@ -15,6 +15,7 @@ import 'package:rasadyar_chicken/presentation/pages/steward/home/view.dart';
import 'package:rasadyar_chicken/presentation/pages/steward/sale/view.dart'; import 'package:rasadyar_chicken/presentation/pages/steward/sale/view.dart';
import 'package:rasadyar_chicken/presentation/pages/steward/segmentation/view.dart'; import 'package:rasadyar_chicken/presentation/pages/steward/segmentation/view.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart'; import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/utils/utils.dart'; import 'package:rasadyar_chicken/presentation/utils/utils.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
@@ -157,12 +158,36 @@ class StewardRootLogic extends GetxController {
); );
} }
void onPopScopTaped() async { int getNestedKey() {
final nestedKey = Get.nestedKey(currentPage.value); switch (currentPage.value) {
final currentNavigator = nestedKey?.currentState; case 0:
return stewardFirstKey;
case 1:
return stewardSecondKey;
case 2:
return stewardThirdKey;
case 3:
return stewardFourthKey;
case 4:
return stewardFourthKey;
default:
return stewardThirdKey;
}
}
void onPopScopTaped() async {
final nestedKeyId = getNestedKey();
GlobalKey<NavigatorState>? currentNestedKey = Get.nestedKey(nestedKeyId);
fLog("onPopScopTaped ==> ${currentNestedKey?.currentState?.canPop()}");
if (currentNestedKey?.currentState?.canPop() == true) {
iLog(currentNestedKey?.currentState?.canPop());
iLog(currentNestedKey?.currentContext );
currentNestedKey?.currentState?.popUntil((route) => route.isFirst);
if (currentNavigator?.canPop() ?? false) {
currentNavigator?.pop();
} else { } else {
final now = DateTime.now(); final now = DateTime.now();
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) { if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {

View File

@@ -1,4 +1,5 @@
import 'package:flutter/services.dart';
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart'; import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart'; import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart'; import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
@@ -17,7 +18,7 @@ class SaleLogic extends GetxController {
StewardRootLogic rootLogic = Get.find<StewardRootLogic>(); StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
List<String> routesName = ['فروش']; List<String> routesName = ['فروش'];
DateTime? _lastBackPressed;
@override @override
void onReady() { void onReady() {
@@ -114,4 +115,23 @@ class SaleLogic extends GetxController {
rootLogic.inventoryExpandedList.clear(); rootLogic.inventoryExpandedList.clear();
super.dispose(); super.dispose();
} }
void onPopScopTaped() async {
final now = DateTime.now();
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
_lastBackPressed = now;
Get.snackbar(
'خروج از برنامه',
'برای خروج دوباره بازگشت را بزنید',
snackPosition: SnackPosition.TOP,
duration: Duration(seconds: 2),
backgroundColor: AppColor.warning,
);
} else {
await SystemNavigator.pop();
}
}
} }

View File

@@ -3,7 +3,6 @@ import 'package:rasadyar_chicken/chicken.dart';
import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart'; import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.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/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/sale_buy_card_item.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
import 'logic.dart'; import 'logic.dart';
@@ -21,7 +20,6 @@ class SalePage extends GetView<SaleLogic> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
spacing: 21, spacing: 21,
children: [ children: [
GlassMorphismCardIcon( GlassMorphismCardIcon(
title: 'فروش داخل استان', title: 'فروش داخل استان',
vecIcon: Assets.vec.map2Svg.path, vecIcon: Assets.vec.map2Svg.path,

View File

@@ -1,10 +1,10 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart'; import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart'; import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart'; import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart'; import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart'; import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart';
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart'; import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
@@ -33,8 +33,8 @@ class SalesInProvinceLogic extends GetxController {
GlobalKey<FormState> formKey = GlobalKey<FormState>(); GlobalKey<FormState> formKey = GlobalKey<FormState>();
Rxn<Jalali> fromDateFilter = Rxn<Jalali>(null); Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rxn<Jalali> toDateFilter = Rxn<Jalali>(null); Rx<Jalali> toDateFilter = Jalali.now().obs;
Rxn<ProductModel> selectedProductModel = Rxn<ProductModel>(); Rxn<ProductModel> selectedProductModel = Rxn<ProductModel>();
Rxn<GuildModel> selectedGuildModel = Rxn<GuildModel>(); Rxn<GuildModel> selectedGuildModel = Rxn<GuildModel>();
Rxn<GuildProfile> guildProfile = Rxn<GuildProfile>(); Rxn<GuildProfile> guildProfile = Rxn<GuildProfile>();
@@ -52,6 +52,7 @@ class SalesInProvinceLogic extends GetxController {
final RxBool addPageAllocationsMade = false.obs; final RxBool addPageAllocationsMade = false.obs;
final RxBool hasMoreDataAllocationsMade = true.obs; final RxBool hasMoreDataAllocationsMade = true.obs;
Rxn<BroadcastPrice> broadcastPrice = Rxn<BroadcastPrice>();
Rxn<AllocatedMadeModel> selectedAllocationModelForUpdate = Rxn<AllocatedMadeModel>(); Rxn<AllocatedMadeModel> selectedAllocationModelForUpdate = Rxn<AllocatedMadeModel>();
SubmitStewardAllocation? tmpStewardAllocation; SubmitStewardAllocation? tmpStewardAllocation;
@@ -63,29 +64,29 @@ class SalesInProvinceLogic extends GetxController {
getRolesProducts(); getRolesProducts();
getGuilds(); getGuilds();
getGuildProfile(); getGuildProfile();
getBroadcastPrice();
ever(saleType, (callback) { ever(saleType, (callback) {
getGuilds(); getGuilds();
}); });
debounce(weight, time: Duration(milliseconds: 110), (callback) { debounce(weight, time: Duration(milliseconds: 110), (callback) {
totalCost.value = callback * weight.value; iLog('weight: $callback, pricePerKilo: ${pricePerKilo.value}');
totalCost.value = callback * pricePerKilo.value;
}); });
debounce(pricePerKilo, time: Duration(milliseconds: 100), (callback) { debounce(pricePerKilo, time: Duration(milliseconds: 100), (callback) {
totalCost.value = callback * weight.value; totalCost.value = callback * weight.value;
}); });
totalCost.listen((data) { totalCost.listen((data) {
totalCostController.text = data totalCostController.text = data.toString().separatedByComma;
.toString()
.separatedByComma;
isValid.value = isValid.value =
weight.value > 0 && weight.value > 0 &&
pricePerKilo.value > 0 && pricePerKilo.value > 0 &&
totalCost.value > 0 && totalCost.value > 0 &&
selectedProductModel.value != null && selectedProductModel.value != null &&
selectedGuildModel.value != null; selectedGuildModel.value != null;
}); });
everAll([ everAll([
totalCost, totalCost,
@@ -93,8 +94,8 @@ class SalesInProvinceLogic extends GetxController {
pricePerKilo, pricePerKilo,
totalCost, totalCost,
selectedProductModel, selectedProductModel,
selectedGuildModel selectedGuildModel,
], (callback) => checkVerification(),); ], (callback) => checkVerification());
scrollControllerAllocationsMade.addListener(() { scrollControllerAllocationsMade.addListener(() {
if (scrollControllerAllocationsMade.position.pixels >= if (scrollControllerAllocationsMade.position.pixels >=
@@ -106,7 +107,7 @@ class SalesInProvinceLogic extends GetxController {
debounce( debounce(
searchedValue, searchedValue,
(callback) => getAllocatedMade(), (callback) => getAllocatedMade(),
time: Duration(milliseconds: timeDebounce), time: Duration(milliseconds: timeDebounce),
); );
} }
@@ -125,8 +126,7 @@ class SalesInProvinceLogic extends GetxController {
} }
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.getAllocatedMade(
await rootLogic.chickenRepository.getAllocatedMade(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams( queryParameters: buildQueryParams(
page: currentPage.value, page: currentPage.value,
@@ -134,6 +134,8 @@ class SalesInProvinceLogic extends GetxController {
search: 'filter', search: 'filter',
role: 'Steward', role: 'Steward',
value: searchedValue.value, value: searchedValue.value,
fromDate: fromDateFilter.value.toDateTime(),
toDate: toDateFilter.value.toDateTime(),
), ),
), ),
onSuccess: (res) async { onSuccess: (res) async {
@@ -166,16 +168,15 @@ class SalesInProvinceLogic extends GetxController {
void checkVerification() { void checkVerification() {
isValid.value = isValid.value =
weight.value > 0 && weight.value > 0 &&
pricePerKilo.value > 0 && pricePerKilo.value > 0 &&
totalCost.value > 0 && totalCost.value > 0 &&
selectedProductModel.value != null && selectedProductModel.value != null &&
selectedGuildModel.value != null; selectedGuildModel.value != null;
} }
void confirmAllocation(ConformAllocation allocation) { void confirmAllocation(ConformAllocation allocation) {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.confirmAllocation(
await rootLogic.chickenRepository.confirmAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
allocation: allocation.toJson(), allocation: allocation.toJson(),
), ),
@@ -188,8 +189,7 @@ class SalesInProvinceLogic extends GetxController {
void denyAllocation(String token) { void denyAllocation(String token) {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.denyAllocation(
await rootLogic.chickenRepository.denyAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
allocationToken: token, allocationToken: token,
), ),
@@ -202,8 +202,7 @@ class SalesInProvinceLogic extends GetxController {
Future<void> confirmAllAllocations() async { Future<void> confirmAllAllocations() async {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.confirmAllAllocation(
await rootLogic.chickenRepository.confirmAllAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
allocationTokens: allocatedList.value.data?.results?.map((e) => e.key!).toList() ?? [], allocationTokens: allocatedList.value.data?.results?.map((e) => e.key!).toList() ?? [],
), ),
@@ -216,8 +215,7 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getRolesProducts() async { Future<void> getRolesProducts() async {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.getRolesProducts(
await rootLogic.chickenRepository.getRolesProducts(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
), ),
onSuccess: (result) { onSuccess: (result) {
@@ -232,8 +230,7 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getGuilds() async { Future<void> getGuilds() async {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.getGuilds(
await rootLogic.chickenRepository.getGuilds(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams( queryParameters: buildQueryParams(
queryParams: {'free': saleType.value == 2 ? true : false}, queryParams: {'free': saleType.value == 2 ? true : false},
@@ -264,8 +261,7 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getGuildProfile() async { Future<void> getGuildProfile() async {
await safeCall( await safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.getProfile(
await rootLogic.chickenRepository.getProfile(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
), ),
onError: (error, stackTrace) {}, onError: (error, stackTrace) {},
@@ -279,8 +275,7 @@ class SalesInProvinceLogic extends GetxController {
tmpStewardAllocation = SubmitStewardAllocation( tmpStewardAllocation = SubmitStewardAllocation(
approvedPriceStatus: false, approvedPriceStatus: false,
allocationType: allocationType:
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value '${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}',
?.steward == true ? "steward" : "guild"}',
sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild", sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild",
buyerType: selectedGuildModel.value?.steward == true ? "Steward" : "Guild", buyerType: selectedGuildModel.value?.steward == true ? "Steward" : "Guild",
amount: pricePerKilo.value, amount: pricePerKilo.value,
@@ -290,17 +285,14 @@ class SalesInProvinceLogic extends GetxController {
numberOfCarcasses: 0, numberOfCarcasses: 0,
guildKey: selectedGuildModel.value?.key, guildKey: selectedGuildModel.value?.key,
productKey: selectedProductModel.value?.key, productKey: selectedProductModel.value?.key,
date: DateTime date: DateTime.now().formattedDashedGregorian,
.now()
.formattedDashedGregorian,
type: "manual", type: "manual",
); );
} }
Future<void> submitAllocation() async { Future<void> submitAllocation() async {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.postSubmitStewardAllocation(
await rootLogic.chickenRepository.postSubmitStewardAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
request: tmpStewardAllocation!, request: tmpStewardAllocation!,
), ),
@@ -314,8 +306,7 @@ class SalesInProvinceLogic extends GetxController {
Future<void> deleteAllocation(AllocatedMadeModel model) async { Future<void> deleteAllocation(AllocatedMadeModel model) async {
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.deleteStewardAllocation(
await rootLogic.chickenRepository.deleteStewardAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
queryParameters: {'steward_allocation_key': model.key}, queryParameters: {'steward_allocation_key': model.key},
), ),
@@ -341,25 +332,23 @@ class SalesInProvinceLogic extends GetxController {
weight.value = item.weightOfCarcasses ?? 0; weight.value = item.weightOfCarcasses ?? 0;
pricePerKilo.value = item.amount ?? 0; pricePerKilo.value = item.amount ?? 0;
totalCost.value = item.totalAmount ?? 0; totalCost.value = item.totalAmount ?? 0;
weightController.text = weight.value weightController.text = weight.value.toString().separatedByComma;
.toString() pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
.separatedByComma; totalCostController.text = totalCost.value.toString().separatedByComma;
pricePerKiloController.text = pricePerKilo.value
.toString()
.separatedByComma;
totalCostController.text = totalCost.value
.toString()
.separatedByComma;
isValid.value = true; isValid.value = true;
} }
void clearForm() { void clearForm() {
selectedGuildModel.value = null; selectedGuildModel.value = null;
weight.value = 0; weight.value = 0;
pricePerKilo.value = 0;
totalCost.value = 0; totalCost.value = 0;
weightController.clear(); weightController.clear();
pricePerKiloController.clear(); if (broadcastPrice.value?.active == false) {
pricePerKilo.value = 0;
pricePerKiloController.clear();
}
totalCostController.clear(); totalCostController.clear();
isValid.value = false; isValid.value = false;
} }
@@ -374,8 +363,7 @@ class SalesInProvinceLogic extends GetxController {
); );
safeCall( safeCall(
call: () async => call: () async => await rootLogic.chickenRepository.updateStewardAllocation(
await rootLogic.chickenRepository.updateStewardAllocation(
token: rootLogic.tokenService.accessToken.value!, token: rootLogic.tokenService.accessToken.value!,
request: updatedAllocationModel, request: updatedAllocationModel,
), ),
@@ -416,4 +404,20 @@ class SalesInProvinceLogic extends GetxController {
return model.steward; return model.steward;
} }
} }
Future<void> getBroadcastPrice() async {
safeCall(
call: () async => await rootLogic.chickenRepository.getBroadcastPrice(
token: rootLogic.tokenService.accessToken.value!,
),
onSuccess: (result) {
broadcastPrice.value = result;
if (broadcastPrice.value?.active == true) {
pricePerKilo.value = broadcastPrice.value?.stewardPrice ?? 0;
pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
}
},
onError: (error, stacktrace) {},
);
}
} }

View File

@@ -20,7 +20,6 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
routes: controller.routesName, routes: controller.routesName,
backId: stewardSecondKey, backId: stewardSecondKey,
onSearchChanged: (data) => controller.setSearchValue(data), onSearchChanged: (data) => controller.setSearchValue(data),
onFilterTap: () { onFilterTap: () {
Get.bottomSheet(filterBottomSheet()); Get.bottomSheet(filterBottomSheet());
}, },
@@ -418,7 +417,12 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
controller.selectedGuildModel.refresh(); controller.selectedGuildModel.refresh();
}, },
), ),
Text('فروش اختصاصی', style: AppFonts.yekan14), ObxValue((data) {
return Text(
(data.value?.active == true) ? 'قیمت مصوب' : 'فروش اختصاصی',
style: AppFonts.yekan14,
);
}, controller.broadcastPrice),
SizedBox(width: 12), SizedBox(width: 12),
Radio( Radio(
value: 2, value: 2,
@@ -498,24 +502,30 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
onChanged: (p0) { onChanged: (p0) {
controller.weight.value = int.tryParse(p0.clearComma) ?? 0; controller.weight.value = int.tryParse(p0.clearComma) ?? 0;
}, },
label: 'وزن لاشه', label: 'وزن لاشه (کیلوگرم)',
), ),
RTextField( Obx(() {
controller: controller.pricePerKiloController, return RTextField(
borderColor: AppColor.darkGreyLight, variant: RTextFieldVariant.noBorder,
inputFormatters: [ controller: controller.pricePerKiloController,
FilteringTextInputFormatter.digitsOnly, borderColor: AppColor.darkGreyLight,
SeparatorInputFormatter(), inputFormatters: [
], FilteringTextInputFormatter.digitsOnly,
filledColor: AppColor.bgLight, SeparatorInputFormatter(),
filled: true, ],
onChanged: (p0) { filledColor: AppColor.bgLight,
controller.pricePerKilo.value = int.tryParse(p0.clearComma) ?? 0; filled: true,
}, enabled:
keyboardType: TextInputType.number, (controller.broadcastPrice.value?.active == false ||
label: 'قیمت هر کیلو', controller.saleType.value == 2),
), onChanged: (p0) {
controller.pricePerKilo.value = int.tryParse(p0.clearComma) ?? 0;
},
keyboardType: TextInputType.number,
label: 'قیمت هر کیلو (ريال)',
);
}),
RTextField( RTextField(
variant: RTextFieldVariant.noBorder, variant: RTextFieldVariant.noBorder,
@@ -528,7 +538,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
SeparatorInputFormatter(), SeparatorInputFormatter(),
], ],
controller: controller.totalCostController, controller: controller.totalCostController,
label: 'هزینه کل', label: 'هزینه کل (ريال)',
), ),
ObxValue((data) { ObxValue((data) {
@@ -662,7 +672,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
GestureDetector timeFilterWidget({ GestureDetector timeFilterWidget({
isFrom = true, isFrom = true,
required Rxn<Jalali> date, required Rx<Jalali> date,
required Function(Jalali jalali) onChanged, required Function(Jalali jalali) onChanged,
}) { }) {
return GestureDetector( return GestureDetector(

View File

@@ -17,12 +17,12 @@ class SalesOutOfProvinceLogic extends GetxController {
SaleLogic get saleLogic => Get.find<SaleLogic>(); SaleLogic get saleLogic => Get.find<SaleLogic>();
SalesOutOfProvinceBuyersLogic get buyersLogic => Get.find<SalesOutOfProvinceBuyersLogic>();
SalesOutOfProvinceSalesListLogic get saleListLogic => SalesOutOfProvinceSalesListLogic get saleListLogic =>
Get.find<SalesOutOfProvinceSalesListLogic>(); Get.find<SalesOutOfProvinceSalesListLogic>();
SalesOutOfProvinceBuyersLogic get buyerLogic => Get.find<SalesOutOfProvinceBuyersLogic>(); SalesOutOfProvinceBuyersLogic buyerLogic = Get.find<SalesOutOfProvinceBuyersLogic>();
RxBool isExpanded = false.obs; RxBool isExpanded = false.obs;
RxInt currentPage = 1.obs; RxInt currentPage = 1.obs;

View File

@@ -285,7 +285,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
buildRow(title: 'مشخصات خریدار', value: item.buyer?.fullname ?? 'N/A'), buildRow(title: 'مشخصات خریدار', value: item.buyer?.fullname ?? 'N/A'),
buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'N/A'), buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'N/A'),
buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'N/A'), buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'N/A'),
buildRow(title: 'وزن لاشه', value: '${item.weightOfCarcasses?.separatedByCommaFa}'), buildRow(title: 'وزن لاشه (ريال)', value: '${item.weightOfCarcasses?.separatedByCommaFa}'),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

View File

@@ -21,35 +21,58 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
child: Stack( child: Stack(
children: [ children: [
Positioned.fill( Positioned.fill(
child: ObxValue((data) { child: Column(
return RPaginatedListView( children: [
onLoadMore: () async => controller.getOutProvinceCarcassesBuyer(true), Container(
onRefresh: () async { width: Get.width,
controller.currentPage.value = 1; height: 39,
await controller.getOutProvinceCarcassesBuyer(); margin: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
}, decoration: BoxDecoration(
hasMore: data.value.data?.next != null, color: AppColor.greenLight,
listType: ListType.separated, borderRadius: BorderRadius.circular(8),
resource: data.value, border: Border.all(color: AppColor.textColor, width: 0.5),
padding: EdgeInsets.fromLTRB(8, 8, 8, 80), ),
itemBuilder: (context, index) { alignment: Alignment.center,
var item = data.value.data!.results![index]; child:Text(
return ObxValue((val) { 'لیست خریداران خارج از استان',
return ExpandableListItem2( style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkHover),
selected: val.contains(index), ),
onTap: () => controller.isExpandedList.toggle(index), ),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item), Expanded(
labelColor: AppColor.blueLight, child: ObxValue((data) {
labelIcon: Assets.vec.userRaduisSvg.path, return RPaginatedListView(
onLoadMore: () async => controller.getOutProvinceCarcassesBuyer(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getOutProvinceCarcassesBuyer();
},
hasMore: data.value.data?.next != null,
listType: ListType.separated,
resource: data.value,
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.userRaduisSvg.path,
);
}, controller.isExpandedList);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
); );
}, controller.isExpandedList); }, controller.buyerList),
}, ),
itemCount: data.value.data?.results?.length ?? 0, ],
separatorBuilder: (context, index) => SizedBox(height: 8.h), ),
);
}, controller.buyerList),
), ),
Positioned( Positioned(
bottom: 100, bottom: 100,

View File

@@ -1,6 +1,5 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart'; import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart'; import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart'; import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
@@ -22,7 +21,9 @@ class SegmentationLogic extends GetxController {
Rx<Jalali> fromDateFilter = Jalali.now().obs; Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs; Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString(); RxnString searchedValue = RxnString();
RxInt segmentType = 1.obs;
RxInt saleType = 1.obs; RxInt saleType = 1.obs;
RxInt quotaType = 1.obs;
GlobalKey<FormState> formKey = GlobalKey<FormState>(); GlobalKey<FormState> formKey = GlobalKey<FormState>();
TextEditingController weightController = TextEditingController(text: '0'); TextEditingController weightController = TextEditingController(text: '0');
RxBool isSubmitButtonEnabled = false.obs; RxBool isSubmitButtonEnabled = false.obs;
@@ -82,6 +83,9 @@ class SegmentationLogic extends GetxController {
weightController.text = '0'; weightController.text = '0';
selectedSegment.value = null; selectedSegment.value = null;
selectedGuildModel.value = null; selectedGuildModel.value = null;
segmentType.value = 1;
saleType.value = 1;
quotaType.value = 1;
} }
void validateForm() { void validateForm() {
@@ -178,8 +182,10 @@ class SegmentationLogic extends GetxController {
SegmentationModel segmentationModel = SegmentationModel( SegmentationModel segmentationModel = SegmentationModel(
productKey: selectedProduct.value?.key, productKey: selectedProduct.value?.key,
weight: int.tryParse(weightController.text.clearComma) ?? 0, weight: int.tryParse(weightController.text.clearComma) ?? 0,
saleType: saleType.value == 1 ? 'governmental' : 'free',
quota: quotaType.value == 1 ? 'governmental' : 'free',
); );
if (saleType.value == 2) { if (segmentType.value == 2) {
segmentationModel = segmentationModel.copyWith(guildKey: selectedGuildModel.value?.key); segmentationModel = segmentationModel.copyWith(guildKey: selectedGuildModel.value?.key);
} }
await safeCall( await safeCall(
@@ -189,6 +195,8 @@ class SegmentationLogic extends GetxController {
), ),
onSuccess: (result) { onSuccess: (result) {
res = true; res = true;
isSubmitButtonEnabled.value = true;
}, },
onError: (error, stacktrace) { onError: (error, stacktrace) {
res = false; res = false;

View File

@@ -5,8 +5,6 @@ import 'package:rasadyar_chicken/data/models/response/roles_products/roles_produ
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart'; import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart'; import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart'; import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
import 'logic.dart'; import 'logic.dart';
@@ -23,53 +21,56 @@ class SegmentationPage extends GetView<SegmentationLogic> {
hasBack: false, hasBack: false,
child: Stack( child: Stack(
children: [ children: [
Positioned.fill(child: ObxValue((data) { Positioned.fill(
return RPaginatedListView( child: ObxValue((data) {
onLoadMore: () async => controller.getAllSegmentation(true), return RPaginatedListView(
onRefresh: () async { onLoadMore: () async => controller.getAllSegmentation(true),
controller.currentPage.value = 1; onRefresh: () async {
await controller.getAllSegmentation(); controller.currentPage.value = 1;
}, await controller.getAllSegmentation();
hasMore: data.value.data?.next != null, },
listType: ListType.separated, hasMore: data.value.data?.next != null,
resource: data.value, listType: ListType.separated,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80), resource: data.value,
itemBuilder: (context, index) { padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
var item = data.value.data!.results![index]; itemBuilder: (context, index) {
return ObxValue((val) { var item = data.value.data!.results![index];
return ExpandableListItem2( return ObxValue((val) {
selected: val.contains(index), return ExpandableListItem2(
onTap: () => controller.isExpandedList.toggle(index), selected: val.contains(index),
index: index, onTap: () => controller.isExpandedList.toggle(index),
child: itemListWidget(item), index: index,
secondChild: itemListExpandedWidget(item, index), child: itemListWidget(item),
labelColor: AppColor.blueLight, secondChild: itemListExpandedWidget(item, index),
labelIconColor: AppColor.customGrey, labelColor: AppColor.blueLight,
labelIcon: Assets.vec.convertCubeSvg.path, labelIconColor: AppColor.customGrey,
); labelIcon: Assets.vec.convertCubeSvg.path,
}, controller.isExpandedList); );
}, }, controller.isExpandedList);
itemCount: data.value.data?.results?.length ?? 0, },
separatorBuilder: (context, index) => SizedBox(height: 8.h), itemCount: data.value.data?.results?.length ?? 0,
); separatorBuilder: (context, index) => SizedBox(height: 8.h),
}, controller.segmentationList)), );
}, controller.segmentationList),
),
Positioned( Positioned(
right: 10, right: 10,
bottom: 90.h, bottom: 90.h,
child: RFab.add( child: RFab.add(
onPressed: () { onPressed: () {
Get.bottomSheet( Get.bottomSheet(
addOrEditBottomSheet(), addOrEditBottomSheet(),
isScrollControlled: true, isScrollControlled: true,
ignoreSafeArea: false, ignoreSafeArea: false,
).whenComplete(() { ).whenComplete(() {
controller.clearForm(); controller.clearForm();
}); //defaultShowSuccessMessage('با موفقیت ثبت شد');
}, });
)) },
),
),
], ],
), ),
); );
} }
@@ -257,7 +258,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
Widget addOrEditBottomSheet([bool isOnEdit = false]) { Widget addOrEditBottomSheet([bool isOnEdit = false]) {
return BaseBottomSheet( return BaseBottomSheet(
height: 430.h, height: 480.h,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Form( child: Form(
key: controller.formKey, key: controller.formKey,
@@ -284,25 +285,25 @@ class SegmentationPage extends GetView<SegmentationLogic> {
height: 40, height: 40,
child: ObxValue((data) { child: ObxValue((data) {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Radio( Radio(
value: 1, value: 1,
groupValue: controller.saleType.value, groupValue: controller.segmentType.value,
onChanged: (value) { onChanged: (value) {
controller.saleType.value = value!; controller.segmentType.value = value!;
controller.selectedGuildModel.value = null; controller.selectedGuildModel.value = null;
controller.selectedGuildModel.refresh(); controller.selectedGuildModel.refresh();
}, },
), ),
Text('قطعه‌بندی(مباشر)', style: AppFonts.yekan14), Text('قطعه‌بندی(کاربر)', style: AppFonts.yekan14),
SizedBox(width: 12), SizedBox(width: 12),
Radio( Radio(
value: 2, value: 2,
groupValue: controller.saleType.value, groupValue: controller.segmentType.value,
onChanged: (value) { onChanged: (value) {
controller.saleType.value = value!; controller.segmentType.value = value!;
}, },
), ),
Text('تخصیص به قطعه‌بند', style: AppFonts.yekan14), Text('تخصیص به قطعه‌بند', style: AppFonts.yekan14),
@@ -312,7 +313,68 @@ class SegmentationPage extends GetView<SegmentationLogic> {
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
guildsDropDown(), ObxValue((data) {
return Visibility(visible: data.value == 2, child: guildsDropDown());
}, controller.segmentType),
],
),
),
Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.darkGreyLight, width: 1),
),
child: Column(
children: [
const SizedBox(height: 8),
SizedBox(
height: 40,
child: ObxValue((data) {
return RadioGroup(
onChanged: (value) {
controller.saleType.value = value ?? 0;
controller.selectedGuildModel.value = null;
controller.selectedGuildModel.refresh();
},
groupValue: controller.saleType.value,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Radio(value: 1),
Text('فروش دولتی', style: AppFonts.yekan14),
SizedBox(width: 12),
Radio(value: 2),
Text('فروش آزاد', style: AppFonts.yekan14),
],
),
);
}, controller.saleType),
),
const SizedBox(height: 12),
SizedBox(
height: 40,
child: ObxValue((data) {
return RadioGroup(
onChanged: (value) {
controller.quotaType.value = value ?? 0;
},
groupValue: controller.quotaType.value,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Radio(value: 1),
Text('انبار دولتی', style: AppFonts.yekan14),
SizedBox(width: 12),
Radio(value: 2),
Text('انبار آزاد', style: AppFonts.yekan14),
],
),
);
}, controller.saleType),
),
], ],
), ),
), ),

View File

@@ -84,6 +84,7 @@ sealed class ChickenPages {
Get.lazyPut(() => SaleLogic()); Get.lazyPut(() => SaleLogic());
Get.lazyPut(() => BaseLogic()); Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => SalesOutOfProvinceLogic()); Get.lazyPut(() => SalesOutOfProvinceLogic());
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
Get.lazyPut(() => StewardRootLogic()); Get.lazyPut(() => StewardRootLogic());
}), }),
), ),

View File

@@ -0,0 +1,15 @@
// File: packages/chicken/test/data/common/constant_test.dart
import 'package:flutter_test/flutter_test.dart';
import 'package:rasadyar_chicken/data/common/constant.dart';
void main() {
group('ApiEnvironment', () {
test('dam environment returns correct baseUrl', () {
expect(ApiEnvironment.dam.baseUrl, 'https://api.dam.rasadyar.net/');
});
test('dam environment url property is correct', () {
expect(ApiEnvironment.dam.url, 'https://api.dam.rasadyar.net/');
});
});
}

View File

@@ -0,0 +1,40 @@
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';
import 'package:rasadyar_core/core.dart';
class MockGet extends Mock implements GetInterface {}
void main() {
late DioErrorHandler errorHandler;
late MockGet mockGet;
setUp(() {
errorHandler = DioErrorHandler();
mockGet = MockGet();
Get.testMode = true;
Get.put<GetInterface>(mockGet);
});
/*test('handle 410 Error', () {
final error = DioException(
response: Response(statusCode: 410, requestOptions: RequestOptions(path: "/")),
requestOptions: RequestOptions(path: "/"),
);
errorHandler.handle(error);
verify(
() => mockGet.showSnackbar(
any(
that: isA<GetSnackBar>().having(
(s) => (s.messageText as Text).data,
'messageText',
'نام کاربری یا رمز عبور اشتباه است',
),
),
),
).called(1);
});*/
}

View File

@@ -0,0 +1,26 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:rasadyar_chicken/data/common/fa_user_role.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
void main() {
group('getFaUserRole', () {
test('returns correct Farsi role for known roles and unknown/null', () {
expect(getFaUserRole('Admin'), 'ادمین استان');
expect(getFaUserRole('Poultry'), 'مرغدار');
expect(getFaUserRole('ProvinceFinancial'), 'مالی اتحادیه');
expect(getFaUserRole('SuperAdmin'), 'ادمین کل');
expect(getFaUserRole('UnknownRole'), 'نامشخص');
expect(getFaUserRole(null), 'نامشخص');
});
});
group('getFaUserRoleWithOnTap', () {
test('returns correct map for known roles and unknown/null', () {
expect(getFaUserRoleWithOnTap('Admin'), {'ادمین استان': null});
expect(getFaUserRoleWithOnTap('Steward'), {'مباشر': ChickenRoutes.initSteward});
expect(getFaUserRoleWithOnTap('PoultryScience'), {'کارشناس طیور': ChickenRoutes.initPoultryScience});
expect(getFaUserRoleWithOnTap('UnknownRole'), {'نامشخص': null});
expect(getFaUserRoleWithOnTap(null), {'نامشخص': null});
});
});
}

View File

@@ -0,0 +1,19 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:rasadyar_chicken/data/common/dio_error_handler.dart';
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
import 'package:rasadyar_core/core.dart';
void main() {
setUp(() async {
await setupAllCoreProvider();
Get.put(TokenStorageService());
await setupChickenDI();
});
group('Check class type registered', () {
test('DioErrorHandler is registered', () {
expect(diChicken, isA<GetIt>());
expect(diChicken.isRegistered<DioErrorHandler>(), true);
});
});
}

View File

@@ -93,6 +93,8 @@ class BasePage extends GetView<BaseLogic> {
return PopScope( return PopScope(
canPop: false, canPop: false,
onPopInvokedWithResult: (didPop, result) { onPopInvokedWithResult: (didPop, result) {
tLog("PopScope Tapped ==> $didPop");
if (!didPop) { if (!didPop) {
onPopScopTaped!(); onPopScopTaped!();
} }