refactor : inspection
fix : module list remove injection
This commit is contained in:
@@ -66,6 +66,18 @@ class ModulesLogic extends GetxController {
|
|||||||
getSliders();
|
getSliders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
eLog("ModulesLogic closed");
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
eLog("ModulesLogic disposed");
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
void saveModule(Module module) {
|
void saveModule(Module module) {
|
||||||
tokenService.saveModule(module);
|
tokenService.saveModule(module);
|
||||||
tokenService.appModule.value = module;
|
tokenService.appModule.value = module;
|
||||||
@@ -102,9 +114,9 @@ class ModulesLogic extends GetxController {
|
|||||||
isLoading.value = !isLoading.value;
|
isLoading.value = !isLoading.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = await Get.toNamed(target.key, arguments: module);
|
await Get.toNamed(target.key, arguments: module);
|
||||||
|
|
||||||
if (target.value?[1] != null && args == -1) {
|
if (target.value?[1] != null) {
|
||||||
await target.value?[1]?.call();
|
await target.value?[1]?.call();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
|
fLog(Get.arguments.toString());
|
||||||
_textAnimationController =
|
_textAnimationController =
|
||||||
AnimationController(vsync: this, duration: const Duration(milliseconds: 1200))
|
AnimationController(vsync: this, duration: const Duration(milliseconds: 1200))
|
||||||
..repeat(reverse: true, count: 2).whenComplete(() {
|
..repeat(reverse: true, count: 2).whenComplete(() {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class AuthPage extends GetView<AuthLogic> {
|
|||||||
),
|
),
|
||||||
vecPath: Assets.vec.chickenPatternSvg.path,
|
vecPath: Assets.vec.chickenPatternSvg.path,
|
||||||
),
|
),
|
||||||
onPopScopTaped: () => Get.back(result: -1),
|
onPopScopTaped: () => Get.back(result: "HHHHHHHHEloo"),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:rasadyar_core/core.dart';
|
|||||||
|
|
||||||
class ActiveHatchingLogic extends GetxController {
|
class ActiveHatchingLogic extends GetxController {
|
||||||
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
||||||
|
BaseLogic baseLogic = Get.find<BaseLogic>();
|
||||||
Rx<Resource<PaginationModel<HatchingModel>>> activeHatchingList =
|
Rx<Resource<PaginationModel<HatchingModel>>> activeHatchingList =
|
||||||
Resource<PaginationModel<HatchingModel>>.loading().obs;
|
Resource<PaginationModel<HatchingModel>>.loading().obs;
|
||||||
|
|
||||||
@@ -13,17 +13,22 @@ class ActiveHatchingLogic extends GetxController {
|
|||||||
RxInt expandedIndex = RxInt(-1);
|
RxInt expandedIndex = RxInt(-1);
|
||||||
List<String> routesName = ['اقدام', 'جوجه ریزی فعال'];
|
List<String> routesName = ['اقدام', 'جوجه ریزی فعال'];
|
||||||
|
|
||||||
|
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
||||||
|
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
||||||
|
RxnString searchedValue = RxnString();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
getHatchingList();
|
getHatchingList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
baseLogic.searchValue.value = null;
|
||||||
|
baseLogic.isSearchSelected.value = false;
|
||||||
|
baseLogic.textEditingController.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getHatchingList([bool isLoadingMore = false]) async {
|
Future<void> getHatchingList([bool isLoadingMore = false]) async {
|
||||||
@@ -32,12 +37,12 @@ class ActiveHatchingLogic extends GetxController {
|
|||||||
} else {
|
} else {
|
||||||
activeHatchingList.value = Resource<PaginationModel<HatchingModel>>.loading();
|
activeHatchingList.value = Resource<PaginationModel<HatchingModel>>.loading();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
searchedValue.value!.trim().isNotEmpty &&
|
searchedValue.value!.trim().isNotEmpty &&
|
||||||
currentPage.value > 1) {
|
currentPage.value > 1) {
|
||||||
currentPage.value = 1;
|
currentPage.value = 1;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
safeCall(
|
safeCall(
|
||||||
call: () async => await rootLogic.poultryRepository.getHatchingPoultry(
|
call: () async => await rootLogic.poultryRepository.getHatchingPoultry(
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.d
|
|||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
import 'package:rasadyar_chicken/presentation/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/page_route.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
|
class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
|
||||||
@@ -12,23 +11,15 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ChickenBasePage(
|
return ChickenBasePage(
|
||||||
hasSearch: false,
|
hasSearch: true,
|
||||||
hasFilter: false,
|
hasFilter: false,
|
||||||
backId: poultryFirstKey,
|
backId: poultryFirstKey,
|
||||||
|
routes: controller.routesName,
|
||||||
//routesWidget: buildContainerPageRoute(controller.routesName),
|
onSearchChanged: (data) {
|
||||||
|
controller.searchedValue.value = data;
|
||||||
child: Stack(
|
controller.getHatchingList();
|
||||||
children: [
|
},
|
||||||
Positioned.fill(
|
child: hatchingWidget(),
|
||||||
child: Assets.vec.chickenPatternSvg.svg(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
colorFilter: ColorFilter.mode(Colors.grey.shade400, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned.fill(child: Column(children: [hatchingWidget()])),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
/*widgets: [
|
/*widgets: [
|
||||||
hatchingWidget()
|
hatchingWidget()
|
||||||
],*/
|
],*/
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.d
|
|||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class FarmLogic extends GetxController {
|
class FarmLogic extends GetxController {
|
||||||
List<String> routesName = ['اقدام', 'فارم ها'];
|
List<String> routes = ['اقدام', 'فارم ها'];
|
||||||
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
||||||
|
BaseLogic baseLogic = Get.find<BaseLogic>();
|
||||||
final PoultryScienceHomeLogic _homeLogic = Get.find<PoultryScienceHomeLogic>();
|
final PoultryScienceHomeLogic _homeLogic = Get.find<PoultryScienceHomeLogic>();
|
||||||
RxList<InformationTagData> tagInfo = <InformationTagData>[
|
RxList<InformationTagData> tagInfo = <InformationTagData>[
|
||||||
InformationTagData(
|
InformationTagData(
|
||||||
@@ -42,6 +43,10 @@ class FarmLogic extends GetxController {
|
|||||||
final RxBool isLoadingMoreList = false.obs;
|
final RxBool isLoadingMoreList = false.obs;
|
||||||
RxInt expandedIndex = RxInt(-1);
|
RxInt expandedIndex = RxInt(-1);
|
||||||
|
|
||||||
|
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
||||||
|
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
||||||
|
RxnString searchedValue = RxnString();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
@@ -60,6 +65,9 @@ class FarmLogic extends GetxController {
|
|||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
baseLogic.searchValue.value = null;
|
||||||
|
baseLogic.isSearchSelected.value = false;
|
||||||
|
baseLogic.textEditingController.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getFarmList([bool isLoadingMore = false]) async {
|
Future<void> getFarmList([bool isLoadingMore = false]) async {
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
|
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
import 'package:rasadyar_chicken/presentation/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/filter_bottom_sheet.dart';
|
||||||
|
import 'package:rasadyar_chicken/presentation/widget/label_item.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
@@ -13,10 +15,19 @@ class FarmPage extends GetView<FarmLogic> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ChickenBasePage(
|
return ChickenBasePage(
|
||||||
hasFilter: false,
|
hasFilter: false,
|
||||||
hasSearch: false,
|
hasSearch: true,
|
||||||
isBase: true,
|
onFilterTap: () {
|
||||||
|
Get.bottomSheet(
|
||||||
routes: [],
|
isScrollControlled: true,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
filterBottomSheet(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onSearchChanged: (data) {
|
||||||
|
controller.searchedValue.value = data;
|
||||||
|
controller.getFarmList();
|
||||||
|
},
|
||||||
|
routes: controller.routes,
|
||||||
backId: poultryFirstKey,
|
backId: poultryFirstKey,
|
||||||
widgets: [firstTagInformation(), farmListWidget()],
|
widgets: [firstTagInformation(), farmListWidget()],
|
||||||
);
|
);
|
||||||
@@ -56,7 +67,7 @@ class FarmPage extends GetView<FarmLogic> {
|
|||||||
onTap: () => controller.toggleExpanded(index),
|
onTap: () => controller.toggleExpanded(index),
|
||||||
index: index,
|
index: index,
|
||||||
child: itemListWidget(item),
|
child: itemListWidget(item),
|
||||||
secondChild: itemListExpandedWidget(item),
|
secondChild: itemListExpandedWidget2(item),
|
||||||
labelColor: AppColor.blueLight,
|
labelColor: AppColor.blueLight,
|
||||||
labelIcon: Assets.vec.cubeScanSvg.path,
|
labelIcon: Assets.vec.cubeScanSvg.path,
|
||||||
);
|
);
|
||||||
@@ -74,25 +85,21 @@ class FarmPage extends GetView<FarmLogic> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Container itemListExpandedWidget(PoultryFarm item) {
|
Container itemListExpandedWidget2(PoultryFarm item) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
item.unitName ?? 'N/A',
|
item.unitName ?? 'N/A',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
||||||
),
|
),
|
||||||
Spacer(),
|
|
||||||
|
|
||||||
Visibility(
|
Visibility(
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -101,86 +108,63 @@ class FarmPage extends GetView<FarmLogic> {
|
|||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.bottomSheet(BaseBottomSheet(
|
||||||
|
child: Container(
|
||||||
|
color: AppColor.blueDark,
|
||||||
|
),
|
||||||
|
));
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'جزئیات',
|
||||||
|
style: AppFonts.yekan10.copyWith(color: AppColor.iconColor),
|
||||||
|
),
|
||||||
|
SizedBox(width: 4.w),
|
||||||
|
Assets.vec.arrowLeftSvg.svg(
|
||||||
|
width: 10.w,
|
||||||
|
height: 10.h,
|
||||||
|
colorFilter: ColorFilter.mode(AppColor.iconColor, BlendMode.srcIn),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(
|
Wrap(
|
||||||
height: 32,
|
spacing: 8,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
runSpacing: 8,
|
||||||
decoration: ShapeDecoration(
|
children: [
|
||||||
color: AppColor.blueLight,
|
labelItem(label: 'تعاونی', value: item.cityOperator ?? 'ندارد'),
|
||||||
shape: RoundedRectangleBorder(
|
labelItem(label: 'تعداد سالن ', value: item.numberOfHalls?.toString() ?? 'ندارد'),
|
||||||
side: BorderSide(width: 1, color: AppColor.blueLightHover),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
labelItem(
|
||||||
|
label: 'مالک/ تلفن',
|
||||||
|
value: '${item.user?.fullname} (${item.user?.mobile})',
|
||||||
|
),
|
||||||
|
labelItem(label: 'شناسه یکتا', value: item.breedingUniqueId ?? 'N/A'),
|
||||||
|
labelItem(label: 'کد اپیدمیولوژیک', value: item.epidemiologicalCode ?? 'N/A'),
|
||||||
|
labelItem(label: 'کد بهداشتی', value: item.healthCertificateNumber ?? 'N/A'),
|
||||||
|
labelItem(
|
||||||
|
label: 'دامپزشک فارم',
|
||||||
|
value: '${item.vetFarm?.fullName} (${item.vetFarm?.mobile ?? '-'})',
|
||||||
),
|
),
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'تعاونی : ${item.cityOperator ?? 'ندارد'}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
labelItem(
|
||||||
' تعداد سالن : ${item.numberOfHalls}',
|
label: 'ظرفیت فارم',
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
value: item.totalCapacity.separatedByCommaFa,
|
||||||
),
|
unit: 'قطعه',
|
||||||
],
|
),
|
||||||
),
|
labelItem(
|
||||||
|
label: 'جوجه ریزی فعال (تعداد دوره)',
|
||||||
|
value:
|
||||||
|
'${(item.hatchingInfo?.activeHatching ?? false) ? 'دارد' : 'ندارد'} (${item.hatchingInfo?.period ?? 0})',
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
buildRow(
|
|
||||||
title: 'مالک/ تلفن',
|
|
||||||
value: '${item.user?.fullname} (${item.user?.mobile})',
|
|
||||||
),
|
|
||||||
buildRow(title: 'شناسه یکتا', value: item.breedingUniqueId ?? 'N/A'),
|
|
||||||
buildRow(
|
|
||||||
title: 'کد اپیدمیولوژیک',
|
|
||||||
value: item.epidemiologicalCode ?? 'N/A',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'کد بهداشتی',
|
|
||||||
value: item.healthCertificateNumber ?? 'N/A',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'دامپزشک فارم',
|
|
||||||
value: '${item.vetFarm?.fullName} (${item.vetFarm?.mobile ?? '-'})',
|
|
||||||
),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'ظرفیت فارم',
|
|
||||||
value: item.totalCapacity.separatedByCommaFa,
|
|
||||||
unit: '(قطعه)',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'جوجه ریزی فعال (تعداد دوره) ',
|
|
||||||
value:
|
|
||||||
'${(item.hatchingInfo?.activeHatching ?? false) ? 'دارد' : 'ندارد'} (${item.hatchingInfo?.period ?? 0})',
|
|
||||||
),
|
|
||||||
|
|
||||||
/* buildRow(
|
|
||||||
title: 'شرح بازرسی',
|
|
||||||
value: item.reportInfo?.image == false ? 'ارسال تصویر جوجه ریزی فارم ' : 'تکمیل شده',
|
|
||||||
titleStyle: AppFonts.yekan14.copyWith(
|
|
||||||
color: (item.reportInfo?.image ?? false) ? AppColor.greenNormal : AppColor.redDark,
|
|
||||||
),
|
|
||||||
valueStyle: AppFonts.yekan14.copyWith(
|
|
||||||
color: (item.reportInfo?.image ?? false) ? AppColor.greenNormal : AppColor.redDark,
|
|
||||||
),
|
|
||||||
),*/
|
|
||||||
/* Visibility(
|
|
||||||
visible: (item.reportInfo?.image == false),
|
|
||||||
child: RElevated(
|
|
||||||
text: 'ثبت بازرسی',
|
|
||||||
isFullWidth: true,
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
onPressed: () {
|
|
||||||
cameraBottomSheet(item.id!);
|
|
||||||
},
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
),
|
|
||||||
),*/
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -243,4 +227,12 @@ class FarmPage extends GetView<FarmLogic> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget filterBottomSheet() => filterBottomSheetWidget(
|
||||||
|
fromDate: controller.fromDateFilter,
|
||||||
|
onChangedFromDate: (jalali) => controller.fromDateFilter.value = jalali,
|
||||||
|
toDate: controller.toDateFilter,
|
||||||
|
onChangedToDate: (jalali) => controller.toDateFilter.value = jalali,
|
||||||
|
onSubmit: () => controller.getFarmList(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:rasadyar_core/core.dart';
|
|||||||
class GenocideLogic extends GetxController {
|
class GenocideLogic extends GetxController {
|
||||||
List<String> routesName = ['اقدام', 'درخواست کشتارها'];
|
List<String> routesName = ['اقدام', 'درخواست کشتارها'];
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
BaseLogic baseLogic = Get.find<BaseLogic>();
|
||||||
var gService = Get.find<GService>();
|
var gService = Get.find<GService>();
|
||||||
var rootLogic = Get.find<PoultryScienceRootLogic>();
|
var rootLogic = Get.find<PoultryScienceRootLogic>();
|
||||||
var killRegistration = Get.find<KillingRegistrationLogic>();
|
var killRegistration = Get.find<KillingRegistrationLogic>();
|
||||||
@@ -37,6 +38,9 @@ class GenocideLogic extends GetxController {
|
|||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
baseLogic.searchValue.value = null;
|
||||||
|
baseLogic.isSearchSelected.value = false;
|
||||||
|
baseLogic.textEditingController.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getPoultryOrderList([bool loadingMore = false]) async {
|
Future<void> getPoultryOrderList([bool loadingMore = false]) async {
|
||||||
@@ -70,23 +74,26 @@ class GenocideLogic extends GetxController {
|
|||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.empty();
|
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.empty();
|
||||||
} else {
|
} else {
|
||||||
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(
|
if (loadingMore) {
|
||||||
PaginationModel<PoultryOrder>(
|
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(
|
||||||
count: res?.count ?? 0,
|
PaginationModel<PoultryOrder>(
|
||||||
next: res?.next,
|
count: res?.count ?? 0,
|
||||||
previous: res?.previous,
|
next: res?.next,
|
||||||
results: [...(poultryOrderList.value.data?.results ?? []), ...(res?.results ?? [])],
|
previous: res?.previous,
|
||||||
),
|
results: [...(poultryOrderList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
);
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(res!);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Future<void> deletePoultryOrder(int id) async {
|
Future<void> deletePoultryOrder(int id) async {
|
||||||
toggleExpanded(-1);
|
toggleExpanded(-1);
|
||||||
await safeCall(
|
await safeCall(
|
||||||
call: () async => await rootLogic.poultryRepository.deletePoultryOder(
|
call: () async => await rootLogic.poultryRepository.deletePoultryOder(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -98,12 +105,10 @@ class GenocideLogic extends GetxController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
void toggleExpanded(int index) {
|
||||||
expandedIndex.value = expandedIndex.value == index ? -1 : index;
|
expandedIndex.value = expandedIndex.value == index ? -1 : index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String getRequestType(PoultryOrder item) {
|
String getRequestType(PoultryOrder item) {
|
||||||
if (item.market ?? false) {
|
if (item.market ?? false) {
|
||||||
return 'پنل معاملات';
|
return 'پنل معاملات';
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:rasadyar_chicken/presentation/pages/poultry_science/killing_regi
|
|||||||
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/filter_bottom_sheet.dart';
|
import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/widget/page_route.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
@@ -15,7 +14,7 @@ class GenocidePage extends GetView<GenocideLogic> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ChickenBasePage(
|
return ChickenBasePage(
|
||||||
routes:controller.routesName,
|
routes: controller.routesName,
|
||||||
hasSearch: true,
|
hasSearch: true,
|
||||||
hasFilter: true,
|
hasFilter: true,
|
||||||
onSearchChanged: (data) {
|
onSearchChanged: (data) {
|
||||||
@@ -23,7 +22,13 @@ class GenocidePage extends GetView<GenocideLogic> {
|
|||||||
controller.getPoultryOrderList();
|
controller.getPoultryOrderList();
|
||||||
},
|
},
|
||||||
backId: poultryFirstKey,
|
backId: poultryFirstKey,
|
||||||
filteringWidget: filterBottomSheet(),
|
onFilterTap: () {
|
||||||
|
Get.bottomSheet(
|
||||||
|
isScrollControlled: true,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
filterBottomSheet(),
|
||||||
|
);
|
||||||
|
},
|
||||||
child: Stack(
|
child: Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
children: [
|
children: [
|
||||||
@@ -67,7 +72,7 @@ class GenocidePage extends GetView<GenocideLogic> {
|
|||||||
child: itemListWidget(item),
|
child: itemListWidget(item),
|
||||||
secondChild: itemListExpandedWidget(item),
|
secondChild: itemListExpandedWidget(item),
|
||||||
labelColor: AppColor.blueLight,
|
labelColor: AppColor.blueLight,
|
||||||
labelIcon: Assets.vec.cubeScanSvg.path,
|
labelIcon: Assets.vec.timerSvg.path,
|
||||||
);
|
);
|
||||||
}, controller.expandedIndex);
|
}, controller.expandedIndex);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:rasadyar_chicken/data/models/response/kill_house_poultry/kill_ho
|
|||||||
import 'package:rasadyar_chicken/data/models/response/kill_request_poultry/kill_request_poultry.dart';
|
import 'package:rasadyar_chicken/data/models/response/kill_request_poultry/kill_request_poultry.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/poultry_hatching/poultry_hatching.dart';
|
import 'package:rasadyar_chicken/data/models/response/poultry_hatching/poultry_hatching.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/sell_for_freezing/sell_for_freezing.dart';
|
import 'package:rasadyar_chicken/data/models/response/sell_for_freezing/sell_for_freezing.dart';
|
||||||
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/genocide/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -320,6 +321,8 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
if (!formKey.currentState!.validate()) {
|
if (!formKey.currentState!.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dLog(double.parse(averageWeightKillsController.text));
|
||||||
KillRegistrationRequest registrationRequest = KillRegistrationRequest(
|
KillRegistrationRequest registrationRequest = KillRegistrationRequest(
|
||||||
indexWeight: double.parse(averageWeightKillsController.text),
|
indexWeight: double.parse(averageWeightKillsController.text),
|
||||||
amount: generatedApprovedPrice.value,
|
amount: generatedApprovedPrice.value,
|
||||||
@@ -343,7 +346,7 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
operatorKey: "",
|
operatorKey: "",
|
||||||
poultryHatchingKey: selectedPoultryHatching.value?.key,
|
poultryHatchingKey: selectedPoultryHatching.value?.key,
|
||||||
poultryKey: selectedPoultry.value?.key,
|
poultryKey: selectedPoultry.value?.key,
|
||||||
quantity: int.parse(quantityKillsController.text),
|
quantity: int.parse(quantityKillsController.text.clearComma),
|
||||||
role: gService.getRole(Module.chicken),
|
role: gService.getRole(Module.chicken),
|
||||||
sendDate: killsDate.value.toDateTime().formattedDashedGregorian,
|
sendDate: killsDate.value.toDateTime().formattedDashedGregorian,
|
||||||
);
|
);
|
||||||
@@ -358,9 +361,11 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
'ثبت با موفقیت انجام شد',
|
'ثبت با موفقیت انجام شد',
|
||||||
durationInSeconds: 2,
|
durationInSeconds: 2,
|
||||||
onDismissed: () async {
|
onDismissed: () async {
|
||||||
|
Get.find<GenocideLogic>().getPoultryOrderList();
|
||||||
Future.delayed(Duration(milliseconds: 300), () {
|
Future.delayed(Duration(milliseconds: 300), () {
|
||||||
Get.back();
|
Get.back();
|
||||||
});
|
});
|
||||||
|
Get.find<GenocideLogic>().getPoultryOrderList();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
55
packages/chicken/lib/presentation/widget/label_item.dart
Normal file
55
packages/chicken/lib/presentation/widget/label_item.dart
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
Widget labelItem({required String label, String? value, String? unit}) {
|
||||||
|
String getLabelText(String? value, String? unit) {
|
||||||
|
if (value != null && unit != null) {
|
||||||
|
return '$value ($unit)';
|
||||||
|
} else if (value != null) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return 'بدون مقدار';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
height: 49.h,
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
padding: EdgeInsets.fromLTRB(8.w, 7.h, 8.w, 7.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(width: 1, color: const Color(0xFFB9B9B9)),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
spacing: 6,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
spacing: 4,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
style: AppFonts.yekan10.copyWith(color: AppColor.unselectTextColor),
|
||||||
|
),
|
||||||
|
|
||||||
|
Assets.vec.arrowLeftSvg.svg(
|
||||||
|
width: 10.w,
|
||||||
|
height: 10.h,
|
||||||
|
colorFilter: ColorFilter.mode(AppColor.unselectTextColor, BlendMode.srcIn),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
getLabelText(value, unit),
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
style: AppFonts.yekan10.copyWith(color: AppColor.iconColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
name: rasadyar_app
|
name: rasadyar_app
|
||||||
description: "A new Flutter project."
|
description: "A new Flutter project."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 1.3.8+6
|
version: 1.3.10+7
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.9.2
|
sdk: ^3.9.2
|
||||||
|
|||||||
Reference in New Issue
Block a user