feat: implement step 4 page for poultry farm inspection with inspector conclusion and document upload features

This commit is contained in:
2025-11-22 08:47:49 +03:30
parent 6b7a12c4ad
commit 9364c0c351
4 changed files with 538 additions and 13 deletions

View File

@@ -45,6 +45,11 @@ class PoultryFarmInspectionHomeLogic extends GetxController
RxInt workerContractStatusIndex = (-1).obs; RxInt workerContractStatusIndex = (-1).obs;
RxInt newBeneficiaryRequestIndex = (-1).obs; RxInt newBeneficiaryRequestIndex = (-1).obs;
//step4
RxInt inspectorConclusionIndex = (-1).obs;
TextEditingController inspectorConclusionDescriptionController =
TextEditingController();
@override @override
void onReady() { void onReady() {
super.onReady(); super.onReady();
@@ -126,13 +131,21 @@ class PoultryFarmInspectionHomeLogic extends GetxController
index == generatorOperatingStatusIndex.value ? -1 : index; index == generatorOperatingStatusIndex.value ? -1 : index;
} }
void setWorkerContractStatusIndex(int index) { void setWorkerContractStatusIndex(int index) {
workerContractStatusIndex.value = index == workerContractStatusIndex.value ? -1 : index; workerContractStatusIndex.value = index == workerContractStatusIndex.value
? -1
: index;
} }
void setNewBeneficiaryRequestIndex(int index) { void setNewBeneficiaryRequestIndex(int index) {
newBeneficiaryRequestIndex.value = index == newBeneficiaryRequestIndex.value ? -1 : index; newBeneficiaryRequestIndex.value = index == newBeneficiaryRequestIndex.value
? -1
: index;
}
void setInspectorConclusionIndex(int index) {
inspectorConclusionIndex.value = index == inspectorConclusionIndex.value
? -1
: index;
} }
} }

View File

@@ -1,16 +1,17 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_farm_inspection/widgets/step2_page.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
import '../home/logic.dart'; import '../home/logic.dart';
import 'step1_page.dart'; import 'step1_page.dart';
import 'step2_page.dart';
import 'step3_page.dart'; import 'step3_page.dart';
import 'step4_page.dart';
Widget addOrEditBottomSheet(PoultryFarmInspectionHomeLogic controller) { Widget addOrEditBottomSheet(PoultryFarmInspectionHomeLogic controller) {
List<Widget> pages = [ List<Widget> pages = [
step1Page(controller), step1Page(controller),
step2Page(controller), step2Page(controller),
step3Page(controller), step3Page(controller),
Container(color: Colors.green), step4Page(controller),
]; ];
return BaseBottomSheet( return BaseBottomSheet(

View File

@@ -25,7 +25,7 @@ Widget step3Page(PoultryFarmInspectionHomeLogic controller) {
SizedBox(height: 30.h), SizedBox(height: 30.h),
Container( Container(
height: 410.h, height: 550.h,
clipBehavior: Clip.none, clipBehavior: Clip.none,
width: Get.width, width: Get.width,
child: farmInfoWidget( child: farmInfoWidget(
@@ -46,7 +46,7 @@ Widget step3Page(PoultryFarmInspectionHomeLogic controller) {
child: humanResources(controller), child: humanResources(controller),
), ),
), ),
SizedBox(height: 24.h), SizedBox(height: 24.h),
Container( Container(
height: 380.h, height: 380.h,
@@ -681,13 +681,13 @@ Column facilitiesAndSupport(PoultryFarmInspectionHomeLogic controller) {
controller: controller.nameOfThePoultryFarmUnit, controller: controller.nameOfThePoultryFarmUnit,
label: 'مبلغ', label: 'مبلغ',
filled: true, filled: true,
filledColor: AppColor.bgLight, filledColor: AppColor.bgLight,
), RTextField( ), RTextField(
controller: controller.nameOfThePoultryFarmUnit, controller: controller.nameOfThePoultryFarmUnit,
label: 'سال دریافت', label: 'سال دریافت',
filled: true, filled: true,
filledColor: AppColor.bgLight, filledColor: AppColor.bgLight,
), ),
@@ -725,7 +725,7 @@ Column facilitiesAndSupport(PoultryFarmInspectionHomeLogic controller) {
), ),
formChips( formChips(
onTap: (index) => onTap: (index) =>
controller.setNewBeneficiaryRequestIndex(index), controller.setNewBeneficiaryRequestIndex(index),
selectedIndex: data.value, selectedIndex: data.value,
index: 1, index: 1,
label: 'تسهیلات', label: 'تسهیلات',
@@ -736,7 +736,7 @@ Column facilitiesAndSupport(PoultryFarmInspectionHomeLogic controller) {
selectedIndex: data.value, selectedIndex: data.value,
index: 2, index: 2,
label: 'واکسن', label: 'واکسن',
), formChips( ), formChips(
onTap: (index) => onTap: (index) =>
controller.setNewBeneficiaryRequestIndex(index), controller.setNewBeneficiaryRequestIndex(index),
selectedIndex: data.value, selectedIndex: data.value,

View File

@@ -0,0 +1,511 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_farm_inspection/widgets/card_info.dart';
import 'package:rasadyar_core/core.dart';
import '../home/logic.dart';
Widget step4Page(PoultryFarmInspectionHomeLogic controller) {
return SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
children: [
SizedBox(height: 35.h),
Container(
height: 430.h,
clipBehavior: Clip.none,
width: Get.width,
child: farmInfoWidget(
controller: controller,
title: 'مستندات',
child: documents(controller),
),
),
SizedBox(height: 30.h),
Container(
height: 200.h,
clipBehavior: Clip.none,
width: Get.width,
child: farmInfoWidget(
controller: controller,
title: 'جمع‌بندی بازرس',
child: inspectorConclusion(controller),
),
),
SizedBox(height: 24.h),
],
),
);
}
Column documents(PoultryFarmInspectionHomeLogic controller) {
return Column(
spacing: 10,
children: [
cardInfo(
padding: EdgeInsets.fromLTRB(0, 12, 12, 6),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 9,
children: [
SizedBox(height: 10.h),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: 80.h,
width: 80.w,
padding: EdgeInsets.all(22),
decoration: BoxDecoration(
color: Color(0xFFE9E9E9),
border: Border.all(
width: 1,
color: AppColor.blackLightHover,
),
borderRadius: BorderRadius.circular(8),
),
child: Assets.vec.galleryAddSvg.svg(width: 36, height: 36),
),
],
),
),
Text(
'ثبت عکس سالن (حداقل ۳ زاویه) *',
style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight),
),
],
),
),
cardInfo(
padding: EdgeInsets.fromLTRB(0, 12, 12, 6),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 9,
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: 80.h,
width: 80.w,
padding: EdgeInsets.all(22),
decoration: BoxDecoration(
color: Color(0xFFE9E9E9),
border: Border.all(
width: 1,
color: AppColor.blackLightHover,
),
borderRadius: BorderRadius.circular(8),
),
child: Assets.vec.galleryAddSvg.svg(width: 36, height: 36),
),
],
),
),
Text(
'ثبت عکس انبار نهاده‌ها',
style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight),
),
],
),
),
cardInfo(
padding: EdgeInsets.fromLTRB(0, 12, 12, 6),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 9,
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: 80.h,
width: 80.w,
padding: EdgeInsets.all(22),
decoration: BoxDecoration(
color: Color(0xFFE9E9E9),
border: Border.all(
width: 1,
color: AppColor.blackLightHover,
),
borderRadius: BorderRadius.circular(8),
),
child: Assets.vec.galleryAddSvg.svg(width: 36, height: 36),
),
],
),
),
Text(
'ثبت عکس تلفات',
style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight),
),
],
),
),
],
);
}
ChoiceChip formChips({
required int selectedIndex,
required int index,
required String label,
required Function(int) onTap,
}) {
return ChoiceChip(
selectedColor: AppColor.green1Normal,
labelStyle: index == selectedIndex
? AppFonts.yekan14Bold.copyWith(color: Colors.white)
: AppFonts.yekan14.copyWith(color: AppColor.textColor),
surfaceTintColor: Colors.white,
checkmarkColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: index == selectedIndex
? BorderSide.none
: BorderSide(width: 1, color: AppColor.blackLightHover),
),
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
label: Text(label),
selected: index == selectedIndex,
onSelected: (value) => onTap(index),
);
}
Column inspectorConclusion(PoultryFarmInspectionHomeLogic controller) {
return Column(
spacing: 10,
children: [
SizedBox(height: 1.h),
cardInfo(
padding: EdgeInsets.fromLTRB(12, 12, 12, 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 9,
children: [
Text(
'وضعیت کلی واحد',
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2),
),
ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 10,
children: [
formChips(
onTap: (index) =>
controller.setInspectorConclusionIndex(index),
selectedIndex: data.value,
index: 0,
label: 'تایید شده',
),
formChips(
onTap: (index) =>
controller.setInspectorConclusionIndex(index),
selectedIndex: data.value,
index: 1,
label: 'نیازمند اصلاح',
),
formChips(
onTap: (index) =>
controller.setInspectorConclusionIndex(index),
selectedIndex: data.value,
index: 2,
label: 'پرریسک',
),
],
);
}, controller.inspectorConclusionIndex),
],
),
),
RTextField(
controller: controller.inspectorConclusionDescriptionController,
hintText: 'توصیه‌ها / اخطارها / اقدامات اصلاحی ...',
maxLines: 3,
minLines: 3,
filled: true,
filledColor: AppColor.bgLight,
),
],
);
}
Column agriculturalInput(PoultryFarmInspectionHomeLogic controller) {
return Column(
spacing: 10,
children: [
SizedBox(height: 1.h),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'میزان نهاده مصرفی تا روز بازدید (کیلوگرم)',
filled: true,
filledColor: AppColor.bgLight,
),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'میزان نهاده موجود در انبار',
filled: true,
filledColor: AppColor.bgLight,
),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'میزان نهاده خریداری‌شده و حمل‌نشده از بازارگاه',
filled: true,
filledColor: AppColor.bgLight,
),
cardInfo(
padding: EdgeInsets.fromLTRB(12, 12, 12, 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 9,
children: [
Text(
'کیفیت دانه',
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2),
),
ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 10,
children: [
formChips(
onTap: (index) => controller.setSampleTypeIndex(index),
selectedIndex: data.value,
index: 0,
label: 'خوب',
),
formChips(
onTap: (index) => controller.setSampleTypeIndex(index),
selectedIndex: data.value,
index: 1,
label: 'متوسط',
),
formChips(
onTap: (index) =>
controller.setGrainQualityInputIndex(index),
selectedIndex: data.value,
index: 2,
label: 'ضعیف',
),
],
);
}, controller.grainQualityInputIndex),
],
),
),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'فرمول دانه (در صورت ارائه)',
filled: true,
minLines: 3,
maxLines: 3,
filledColor: AppColor.bgLight,
),
],
);
}
Column humanResources(PoultryFarmInspectionHomeLogic controller) {
return Column(
spacing: 10,
children: [
SizedBox(height: 1.h),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'تعداد افراد شاغل',
filled: true,
filledColor: AppColor.bgLight,
),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'تعداد افراد بومی',
filled: true,
filledColor: AppColor.bgLight,
),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'تعداد افراد غیر بومی',
filled: true,
maxLines: 3,
minLines: 3,
filledColor: AppColor.bgLight,
),
cardInfo(
padding: EdgeInsets.fromLTRB(12, 12, 12, 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 9,
children: [
Text(
'وضعیت قرارداد کارگران',
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2),
),
ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 10,
children: [
formChips(
onTap: (index) =>
controller.setWorkerContractStatusIndex(index),
selectedIndex: data.value,
index: 0,
label: 'دائم',
),
formChips(
onTap: (index) =>
controller.setWorkerContractStatusIndex(index),
selectedIndex: data.value,
index: 1,
label: 'موقت',
),
formChips(
onTap: (index) =>
controller.setWorkerContractStatusIndex(index),
selectedIndex: data.value,
index: 2,
label: 'روزمزدی',
),
],
);
}, controller.workerContractStatusIndex),
],
),
),
ResourceOverlayDropdown(
items: Resource.success(['آموزش‌ ندیده است', 'آموزش‌ دیده است']),
itemBuilder: (item) => Text(item),
labelBuilder: (selected) =>
Text(selected ?? 'آموزش‌دیده در حوزه بهداشت و امنیت زیستی'),
),
],
);
}
Column facilitiesAndSupport(PoultryFarmInspectionHomeLogic controller) {
return Column(
spacing: 10,
children: [
SizedBox(height: 1.h),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'تسهیلات دریافتی فعال',
filled: true,
filledColor: AppColor.bgLight,
),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'نوع تسهیلات',
filled: true,
filledColor: AppColor.bgLight,
),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'مبلغ',
filled: true,
filledColor: AppColor.bgLight,
),
RTextField(
controller: controller.nameOfThePoultryFarmUnit,
label: 'سال دریافت',
filled: true,
filledColor: AppColor.bgLight,
),
ResourceOverlayDropdown(
items: Resource.success(['دریافت نشده', 'دریافت شده']),
itemBuilder: (item) => Text(item),
labelBuilder: (selected) => Text(selected ?? 'وضعیت بازپرداخت'),
),
cardInfo(
padding: EdgeInsets.fromLTRB(12, 12, 12, 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 9,
children: [
Text(
'درخواست جدید بهره‌بردار',
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2),
),
ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 10,
children: [
formChips(
onTap: (index) =>
controller.setNewBeneficiaryRequestIndex(index),
selectedIndex: data.value,
index: 0,
label: 'نهاده',
),
formChips(
onTap: (index) =>
controller.setNewBeneficiaryRequestIndex(index),
selectedIndex: data.value,
index: 1,
label: 'تسهیلات',
),
formChips(
onTap: (index) =>
controller.setNewBeneficiaryRequestIndex(index),
selectedIndex: data.value,
index: 2,
label: 'واکسن',
),
formChips(
onTap: (index) =>
controller.setNewBeneficiaryRequestIndex(index),
selectedIndex: data.value,
index: 3,
label: 'تجهیزات',
),
],
);
}, controller.newBeneficiaryRequestIndex),
],
),
),
],
);
}