fix : some ui bug

This commit is contained in:
2025-09-21 15:42:08 +03:30
parent 50d708469c
commit 338dd8f681
8 changed files with 241 additions and 82 deletions

View File

@@ -98,25 +98,13 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
spacing: 3,
children: [
Text('نژاد:', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
Text(
item.breed?.first.breed ?? 'N/A',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
SizedBox(width: 2),
Text('نژاد:${item.breed?.first.breed ?? 'N/A'}', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
Text(
' سن${item.age} (روز)',
Text(
' سن${item.age}',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
],
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
Text(
' دوره جوجه ریزی:${item.period}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
@@ -126,13 +114,13 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
),
buildRow(title: 'شماره مجوز جوجه ریزی', value: item.licenceNumber ?? 'N/A'),
buildRow(
buildUnitRow(
title: 'حجم جوجه ریزی',
value: item.quantity.separatedByCommaFa,
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
unit: '(قطعه)',
),
buildRow(title: 'مانده در سالن', value: item.leftOver.separatedByCommaFa),
buildRow(title: 'تلفات', value: item.losses.separatedByCommaFa),
buildUnitRow(title: 'مانده در سالن', value: item.leftOver.separatedByCommaFa,unit: '(قطعه)',),
buildUnitRow(title: 'تلفات', value: item.losses.separatedByCommaFa,unit: '(قطعه)',),
buildRow(
title: 'دامپزشک فارم',
value: '${item.vetFarm?.vetFarmFullName}(${item.vetFarm?.vetFarmMobile})',

View File

@@ -131,9 +131,9 @@ class FarmPage extends GetView<FarmLogic> {
buildRow(title: 'کد بهداشتی', value: item.healthCertificateNumber ?? 'N/A'),
buildRow(
title: 'دامپزشک فارم',
value: '${item.vetFarm?.fullName ?? '-'} (${item.vetFarm?.mobile ?? '-'})',
value: '${item.vetFarm?.fullName} (${item.vetFarm?.mobile ?? '-'})',
),
buildRow(title: 'ظرفیت فارم', value: item.totalCapacity.separatedByCommaFa),
buildUnitRow(title: 'ظرفیت فارم', value: item.totalCapacity.separatedByCommaFa, unit: '(قطعه)'),
buildRow(
title: 'جوجه ریزی فعال (تعداد دوره) ',
value:

View File

@@ -118,7 +118,7 @@ class GenocidePage extends GetView<GenocideLogic> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'سن مرغ: ${item.hatching?.age ?? '-'}',
'سن مرغ:${item.hatching?.age ?? '-'} (روز)',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),

View File

@@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
import 'package:rasadyar_chicken/data/models/response/hatching_report/hatching_report.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
@@ -26,6 +27,10 @@ class InspectionPoultryScienceLogic extends GetxController {
RxList<String> routesName = RxList();
RxInt selectedSegmentIndex = 0.obs;
RxnString searchedValue = RxnString();
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
@override
void onInit() {
super.onInit();
@@ -68,12 +73,12 @@ class InspectionPoultryScienceLogic extends GetxController {
} else {
hatchingList.value = Resource<PaginationModel<HatchingModel>>.loading();
}
/*
if (searchedValue.value != null &&
searchedValue.value!.trim().isNotEmpty &&
currentPage.value > 1) {
currentPage.value = 1;
}*/
}
safeCall(
call: () async => await rootLogic.poultryRepository.getHatchingPoultry(
@@ -81,6 +86,10 @@ class InspectionPoultryScienceLogic extends GetxController {
queryParameters: buildQueryParams(
queryParams: {'type': 'hatching', 'report': true},
role: 'PoultryScience',
search: 'filter',
value: searchedValue.value,
fromDate: fromDateFilter.value.toDateTime(),
toDate: toDateFilter.value.toDateTime(),
pageSize: 50,
page: currentPage.value,
),
@@ -108,12 +117,12 @@ class InspectionPoultryScienceLogic extends GetxController {
} else {
hatchingReportList.value = Resource<PaginationModel<HatchingReport>>.loading();
}
/*
if (searchedValue.value != null &&
searchedValue.value!.trim().isNotEmpty &&
currentPage.value > 1) {
currentPage.value = 1;
}*/
}
safeCall(
call: () async => await rootLogic.poultryRepository.getHatchingPoultryReport(
@@ -122,7 +131,9 @@ class InspectionPoultryScienceLogic extends GetxController {
role: 'PoultryScience',
pageSize: 50,
search: 'filter',
value: '',
value: searchedValue.value,
fromDate: fromDateFilter.value.toDateTime(),
toDate: toDateFilter.value.toDateTime(),
page: currentPage.value,
),
),
@@ -214,4 +225,34 @@ class InspectionPoultryScienceLogic extends GetxController {
void toggleExpanded(int index) {
expandedIndex.value = expandedIndex.value == index ? -1 : index;
}
String getStatus(HatchingReport item) {
if (item.state == 'accepted') {
return 'تکمیل شده';
} else if (item.state == 'rejected') {
return 'رد شده';
} else {
return 'در حال بررسی';
}
}
Color getStatusColor(HatchingReport item) {
if (item.state == 'accepted') {
return AppColor.greenNormal;
} else if (item.state == 'rejected') {
return AppColor.redNormal;
} else {
return AppColor.yellowNormal;
}
}
void setSearchValue(String? data) {
searchedValue.value = data?.trim();
final isReporter = selectedSegmentIndex.value == 0;
if (isReporter) {
getHatchingReport();
} else {
getHatchingList();
}
}
}

View File

@@ -17,7 +17,11 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
Widget build(BuildContext context) {
return BasePage(
hasBack: true,
hasFilter: false,
hasFilter: true,
hasSearch: true,
filteringWidget: filterBottomSheet(),
onSearchChanged: (data) => controller.setSearchValue(data),
routesWidget: ObxValue((route) => buildPageRoute(route), controller.routesName),
onBackPressed: () => Get.back(id: poultryFirstKey),
widgets: [
@@ -105,25 +109,13 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
spacing: 3,
children: [
Text('نژاد:', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
Text(
item.breed?.first.breed ?? 'N/A',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
SizedBox(width: 2),
Text('نژاد:${ item.breed?.first.breed ?? 'N/A'}', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
Text(
' سن ${item.age} (روزه)',
Text(
' سن${item.age}',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
],
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
Text(
' دوره جوجه ریزی:${item.period}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
@@ -133,16 +125,18 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
),
buildRow(title: 'شماره مجوز جوجه ریزی', value: item.licenceNumber ?? 'N/A'),
buildRow(
buildUnitRow(
title: 'حجم جوجه ریزی',
value: item.quantity.separatedByCommaFa,
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
unit: '(قطعه)',
),
buildRow(title: 'مانده در سالن', value: item.leftOver.separatedByCommaFa),
buildRow(title: 'تلفات', value: item.losses.separatedByCommaFa),
buildUnitRow(title: 'مانده در سالن', value: item.leftOver.separatedByCommaFa,unit: '(قطعه)',),
buildUnitRow(title: 'تلفات', value: item.losses.separatedByCommaFa,unit: '(قطعه)',),
buildRow(
title: 'دامپزشک فارم',
value: '${item.vetFarm?.vetFarmFullName}(${item.vetFarm?.vetFarmMobile})',
),
buildRow(
title: 'شرح بازرسی',
@@ -342,7 +336,7 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
index: index,
child: itemListWidgetReport(item),
secondChild: itemListExpandedWidgetReport(item),
labelColor: AppColor.greenLight,
labelColor: item.state == 'rejected' ? AppColor.redLight : AppColor.greenLight,
labelIcon: Assets.vec.checkSquareSvg.path,
);
}, controller.expandedIndex);
@@ -407,16 +401,15 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
SizedBox(width: 2),
Text(
' سن${item.hatching?.chickenAge}',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
],
),
Text(
' سن ${item.hatching?.chickenAge} (روزه)',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
Text(
' دوره جوجه ریزی:${item.hatching?.period}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
@@ -426,16 +419,18 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
),
buildRow(title: 'شماره مجوز جوجه ریزی', value: item.hatching?.licenceNumber ?? 'N/A'),
buildRow(
buildUnitRow(
title: 'حجم جوجه ریزی',
value: item.hatching?.quantity.separatedByCommaFa ?? 'N/A',
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
unit: '(قطعه)'
),
buildRow(
buildUnitRow(
title: 'مانده در سالن',
value: item.hatching?.leftOver.separatedByCommaFa ?? 'N/A',
unit: '(قطعه)'
),
buildRow(title: 'تلفات', value: item.hatching?.losses.separatedByCommaFa ?? 'N/A'),
buildUnitRow(title: 'تلفات', value: item.hatching?.losses.separatedByCommaFa ?? 'N/A', unit: '(قطعه)'),
buildRow(
title: 'دامپزشک فارم',
value:
@@ -443,11 +438,52 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
),
buildRow(
title: 'شرح بازرسی',
value: 'تکمیل شده',
titleStyle: AppFonts.yekan14.copyWith(color: AppColor.greenNormal),
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.greenNormal),
value: controller.getStatus(item),
titleStyle: AppFonts.yekan14.copyWith(color: controller.getStatusColor(item)),
valueStyle: AppFonts.yekan14.copyWith(color: controller.getStatusColor(item)),
),
if (item.state == 'accepted') ...{
Visibility(
visible: item.realQuantityAi != null,
child: buildRow(title: 'تعداد تاییده هوش مصنوعی', value: item.realQuantityAi.separatedByComma),
),
Visibility(
visible: item.realQuantity != null,
child: buildRow(title: 'تعداد تاییده', value: item.realQuantity.separatedByComma ?? '-'),
),
},
if (item.state == 'rejected') ...{
Visibility(
visible: item.messageAi != null,
child: buildRow(title: 'پیام هوش مصنوعی', value: item.messageAi ?? '-'),
),
Visibility(
visible: item.message != null,
child: buildRow(title: 'پیام', value: item.message ?? '-'),
),
Visibility(
visible: item.messageRegistererFullname != null,
child: buildRow(
title: 'ثبت کننده گزارش',
value: item.messageRegistererFullname ?? '-',
),
),
Visibility(
visible: item.messageRegistererMobile != null,
child: buildRow(
title: 'موبایل کننده گزارش',
value: item.messageRegistererMobile ?? '-',
),
),
Visibility(
visible: item.messageRegistererRole != null,
child: buildRow(title: 'نقش کننده گزارش', value: item.messageRegistererRole ?? '-'),
),
},
SizedBox(
height: 140.h,
child: GridView.builder(
@@ -459,7 +495,7 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
crossAxisSpacing: 10,
),
itemBuilder: (context, index) => Container(
height: 138.h,
height: 100.h,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
@@ -589,4 +625,50 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
],
);
}
Widget filterBottomSheet() {
return BaseBottomSheet(
height: 200,
child: Column(
spacing: 16,
children: [
Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)),
Row(
spacing: 8,
children: [
Expanded(
child: dateFilterWidget(
date: controller.fromDateFilter,
onChanged: (jalali) => controller.fromDateFilter.value = jalali,
),
),
Expanded(
child: dateFilterWidget(
isFrom: false,
date: controller.toDateFilter,
onChanged: (jalali) => controller.toDateFilter.value = jalali,
),
),
],
),
RElevated(
text: 'اعمال فیلتر',
isFullWidth: true,
backgroundColor: AppColor.greenNormal,
onPressed: () {
final isReporter = controller.selectedSegmentIndex.value == 0;
if (isReporter) {
controller.getHatchingReport();
} else {
controller.getHatchingList();
}
Get.back();
},
height: 40,
),
],
),
);
}
}