fix : inspection -> poultry science

This commit is contained in:
2025-09-13 11:41:53 +03:30
parent bf31f4f149
commit 3649d82ccc
3 changed files with 79 additions and 75 deletions

View File

@@ -14,6 +14,7 @@ class FarmPage extends GetView<FarmLogic> {
routes: controller.routes, routes: controller.routes,
hasFilter: false, hasFilter: false,
hasSearch: false, hasSearch: false,
onBackPressed: () => Get.back(id:0),
widgets: [firstTagInformation(), farmListWidget()], widgets: [firstTagInformation(), farmListWidget()],
); );
} }

View File

@@ -29,40 +29,40 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
); );
} }
ObxValue<Rx<Resource<PaginationModel<HatchingModel>>>> hatchingWidget() { Widget hatchingWidget() {
return ObxValue((data) { return Expanded(
return RPaginatedListView( child: ObxValue((data) {
listType: ListType.separated, return RPaginatedListView(
resource: data.value, listType: ListType.separated,
hasMore: data.value.data?.next != null, resource: data.value,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80), hasMore: data.value.data?.next != null,
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), child: itemListWidget(item),
labelColor: AppColor.blueLight, secondChild: itemListExpandedWidget(item),
labelIcon: Assets.vec.checkSquareSvg.path, labelColor: AppColor.blueLight,
); labelIcon: Assets.vec.checkSquareSvg.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,
onLoadMore: () async => controller.getHatchingList(true), separatorBuilder: (context, index) => SizedBox(height: 8.h),
onRefresh: () async { onLoadMore: () async => controller.getHatchingList(true),
controller.currentPage.value = 1; onRefresh: () async {
await controller.getHatchingList(); controller.currentPage.value = 1;
}, await controller.getHatchingList();
); },
}, controller.hatchingList); );
}, controller.hatchingList),
);
} }
Container itemListExpandedWidget(HatchingModel item) { Container itemListExpandedWidget(HatchingModel item) {
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 8), padding: EdgeInsets.symmetric(horizontal: 8),
@@ -135,8 +135,8 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
value: item.quantity.separatedByComma, value: item.quantity.separatedByComma,
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
), ),
buildRow(title: 'مانده در سالن', value: item.leftOver.separatedByComma ), buildRow(title: 'مانده در سالن', value: item.leftOver.separatedByComma),
buildRow(title: 'تلفات', value: item.losses.separatedByComma ), buildRow(title: 'تلفات', value: item.losses.separatedByComma),
buildRow( buildRow(
title: 'دامپزشک فارم', title: 'دامپزشک فارم',
value: '${item.vetFarm?.vetFarmFullName}(${item.vetFarm?.vetFarmMobile})', value: '${item.vetFarm?.vetFarmFullName}(${item.vetFarm?.vetFarmMobile})',
@@ -323,35 +323,37 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
} }
Widget reportWidget() { Widget reportWidget() {
return ObxValue((data) { return Expanded(
return RPaginatedListView( child: ObxValue((data) {
listType: ListType.separated, return RPaginatedListView(
resource: data.value, listType: ListType.separated,
hasMore: data.value.data?.next != null, resource: data.value,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80), hasMore: data.value.data?.next != null,
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: itemListWidgetReport(item), index: index,
secondChild: itemListExpandedWidgetReport(item), child: itemListWidgetReport(item),
labelColor: AppColor.blueLight, secondChild: itemListExpandedWidgetReport(item),
labelIcon: Assets.vec.checkSquareSvg.path, labelColor: AppColor.blueLight,
); labelIcon: Assets.vec.checkSquareSvg.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,
onLoadMore: () async => controller.getHatchingReport(true), separatorBuilder: (context, index) => SizedBox(height: 8.h),
onRefresh: () async { onLoadMore: () async => controller.getHatchingReport(true),
controller.currentPage.value = 1; onRefresh: () async {
await controller.getHatchingReport(); controller.currentPage.value = 1;
}, await controller.getHatchingReport();
); },
}, controller.hatchingReportList); );
}, controller.hatchingReportList),
);
} }
Widget itemListExpandedWidgetReport(HatchingReport item) { Widget itemListExpandedWidgetReport(HatchingReport item) {
@@ -398,14 +400,14 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
children: [ children: [
Text('نژاد:', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)), Text('نژاد:', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
Text( Text(
item.hatching?.chickenBreed?? 'N/A', item.hatching?.chickenBreed ?? 'N/A',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor), style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
), ),
SizedBox(width: 2), SizedBox(width: 2),
Text( Text(
' سن${ item.hatching?.chickenAge}', ' سن${item.hatching?.chickenAge}',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
), ),
@@ -413,7 +415,7 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
), ),
Text( Text(
' دوره جوجه ریزی:${ item.hatching?.period}', ' دوره جوجه ریزی:${item.hatching?.period}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor), style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
), ),
], ],
@@ -426,21 +428,21 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
value: item.hatching?.quantity.separatedByComma ?? 'N/A', value: item.hatching?.quantity.separatedByComma ?? 'N/A',
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
), ),
buildRow(title: 'مانده در سالن', value: item.hatching?.leftOver.separatedByComma ?? 'N/A'), buildRow(
title: 'مانده در سالن',
value: item.hatching?.leftOver.separatedByComma ?? 'N/A',
),
buildRow(title: 'تلفات', value: item.hatching?.losses.separatedByComma ?? 'N/A'), buildRow(title: 'تلفات', value: item.hatching?.losses.separatedByComma ?? 'N/A'),
buildRow( buildRow(
title: 'دامپزشک فارم', title: 'دامپزشک فارم',
value: '${item.hatching?.vetFarm?.vetFarmFullname}(${item.hatching?.vetFarm?.vetFarmMobile})', value:
'${item.hatching?.vetFarm?.vetFarmFullname}(${item.hatching?.vetFarm?.vetFarmMobile})',
), ),
buildRow( buildRow(
title: 'شرح بازرسی', title: 'شرح بازرسی',
value: 'تکمیل شده', value: 'تکمیل شده',
titleStyle: AppFonts.yekan14.copyWith( titleStyle: AppFonts.yekan14.copyWith(color: AppColor.greenNormal),
color: AppColor.greenNormal valueStyle: AppFonts.yekan14.copyWith(color: AppColor.greenNormal),
),
valueStyle: AppFonts.yekan14.copyWith(
color: AppColor.greenNormal
),
), ),
SizedBox( SizedBox(
@@ -472,7 +474,7 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
} }
Widget itemListWidget(HatchingModel item) { Widget itemListWidget(HatchingModel item) {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
SizedBox(width: 20), SizedBox(width: 20),

View File

@@ -168,6 +168,7 @@ sealed class ChickenPages {
middlewares: [AuthMiddleware()], middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() { binding: BindingsBuilder(() {
Get.lazyPut(() => InspectionPoultryScienceLogic()); Get.lazyPut(() => InspectionPoultryScienceLogic());
Get.lazyPut(() => SearchLogic());
}), }),
), ),
GetPage( GetPage(