Merge branch with resolved conflicts - restructured features and added new modules
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/killing_registration/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/root/logic.dart';
|
||||
=
|
||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_order/poultry_order.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/killing_registration/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class GenocideLogic extends GetxController {
|
||||
@@ -44,7 +45,8 @@ class GenocideLogic extends GetxController {
|
||||
if (loadingMore) {
|
||||
isLoadingMore.value = true;
|
||||
} else {
|
||||
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.loading();
|
||||
poultryOrderList.value =
|
||||
Resource<PaginationModel<PoultryOrder>>.loading();
|
||||
}
|
||||
|
||||
if (searchedValue.value != null &&
|
||||
@@ -69,20 +71,25 @@ class GenocideLogic extends GetxController {
|
||||
onSuccess: (res) async {
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
if ((res?.count ?? 0) == 0) {
|
||||
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.empty();
|
||||
poultryOrderList.value =
|
||||
Resource<PaginationModel<PoultryOrder>>.empty();
|
||||
} else {
|
||||
if (loadingMore) {
|
||||
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(
|
||||
PaginationModel<PoultryOrder>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [...(poultryOrderList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||
),
|
||||
);
|
||||
poultryOrderList.value =
|
||||
Resource<PaginationModel<PoultryOrder>>.success(
|
||||
PaginationModel<PoultryOrder>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [
|
||||
...(poultryOrderList.value.data?.results ?? []),
|
||||
...(res?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
||||
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(res!);
|
||||
poultryOrderList.value =
|
||||
Resource<PaginationModel<PoultryOrder>>.success(res!);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -134,10 +141,8 @@ class GenocideLogic extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> onRefresh() async {
|
||||
currentPage.value = 1;
|
||||
await getPoultryOrderList();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/killing_registration/view.dart';
|
||||
=
|
||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_order/poultry_order.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/killing_registration/view.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/filter_bottom_sheet.dart';
|
||||
@@ -22,7 +24,7 @@ class GenocidePage extends GetView<GenocideLogic> {
|
||||
controller.searchedValue.value = data;
|
||||
controller.getPoultryOrderList();
|
||||
},
|
||||
backId: poultryFirstKey,
|
||||
backId: poultryScienceActionKey,
|
||||
onFilterTap: () {
|
||||
Get.bottomSheet(
|
||||
isScrollControlled: true,
|
||||
@@ -81,7 +83,6 @@ class GenocidePage extends GetView<GenocideLogic> {
|
||||
itemCount: data.value.data?.results?.length ?? 0,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
||||
onLoadMore: () async => controller.getPoultryOrderList(true),
|
||||
|
||||
);
|
||||
}, controller.poultryOrderList);
|
||||
}
|
||||
@@ -89,7 +90,10 @@ class GenocidePage extends GetView<GenocideLogic> {
|
||||
Container itemListExpandedWidget(PoultryOrder item) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
@@ -151,8 +155,14 @@ class GenocidePage extends GetView<GenocideLogic> {
|
||||
buildRow(title: 'نوع کشتار ', value: controller.getKillType(item)),
|
||||
buildRow(title: 'درخواست', value: controller.getRequestType(item)),
|
||||
|
||||
buildRow(title: 'میانگین وزنی', value: '${(item.indexWeight)} (کیلوگرم)'),
|
||||
buildRow(title: 'قیمت مرغدار', value: '${item.amount.separatedByComma} (ریال)'),
|
||||
buildRow(
|
||||
title: 'میانگین وزنی',
|
||||
value: '${(item.indexWeight)} (کیلوگرم)',
|
||||
),
|
||||
buildRow(
|
||||
title: 'قیمت مرغدار',
|
||||
value: '${item.amount.separatedByComma} (ریال)',
|
||||
),
|
||||
buildRow(
|
||||
title: 'مانده در سالن ',
|
||||
value: '${item.hatching?.leftOver.separatedByComma ?? 0} (قطعه)',
|
||||
@@ -169,7 +179,10 @@ class GenocidePage extends GetView<GenocideLogic> {
|
||||
icon: Assets.vec.trashSvg.svg(
|
||||
width: 16.w,
|
||||
height: 16.h,
|
||||
colorFilter: ColorFilter.mode(AppColor.error, BlendMode.srcIn),
|
||||
colorFilter: ColorFilter.mode(
|
||||
AppColor.error,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
textStyle: AppFonts.yekan16Bold.copyWith(color: AppColor.error),
|
||||
borderColor: AppColor.error,
|
||||
|
||||
Reference in New Issue
Block a user