feat: enhance kill house - submit request module with submit request functionality, including new models, repository updates, and UI integration

This commit is contained in:
2025-12-01 09:42:26 +03:30
parent b5904d753c
commit 6861e873ba
99 changed files with 5764 additions and 606 deletions

View File

@@ -37,7 +37,7 @@ class ProfileLogic extends GetxController {
GlobalKey<FormState> formKey = GlobalKey();
ImagePicker imagePicker = ImagePicker();
Rxn<XFile> selectedImage = Rxn<XFile>();
RxnString _base64Image = RxnString();
final RxnString _base64Image = RxnString();
RxBool isOnLoading = false.obs;
RxBool isUserInformationOpen = true.obs;
@@ -79,10 +79,6 @@ class ProfileLogic extends GetxController {
});
}
@override
void onClose() {
super.onClose();
}
Future<void> getUserProfile() async {
userProfile.value = Resource.loading();

View File

@@ -1,8 +1,13 @@
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_core/core.dart';
class KillHouseActionLogic extends GetxController {
List<GlassMorphismCardItem> items = [
GlassMorphismCardItem(title: "ثبت درخواست", icon: Assets.vec.submitRequestSvg.path, route: ''),
GlassMorphismCardItem(
title: "ثبت درخواست",
icon: Assets.vec.submitRequestSvg.path,
route: ChickenRoutes.submitRequestKillHouse,
),
GlassMorphismCardItem(
title: "انبار و توزیع",
icon: Assets.vec.warehouseDistributionSvg.path,

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
@@ -13,8 +14,8 @@ class KillHouseActionPage extends GetView<KillHouseActionLogic> {
isBase: true,
child: GlassMorphismGrid(
items: controller.items,
onTap: () {
iLog("Hoooooura 😍😍😍😍😍");
onTap: (item) {
Get.toNamed(item.route, id: killHouseActionKey);
},
),
);

View File

@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
import 'package:rasadyar_chicken/data/repositories/kill_house/kill_house_repository.dart';
import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart';
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
@@ -6,11 +8,21 @@ import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_core/core.dart';
class KillHouseRootLogic extends GetxController {
RxInt currentPage = 2.obs;
RxInt currentPage = 1.obs;
var tokenService = Get.find<TokenStorageService>();
late KillHouseRepository killHouseRepository;
@override
void onInit() {
super.onInit();
killHouseRepository = diChicken.get<KillHouseRepository>();
}
final pages = [
Navigator(
key: Get.nestedKey(killHouseFirstKey),
key: Get.nestedKey(killHouseActionKey),
onGenerateRoute: (settings) {
final page = ChickenPages.pages.firstWhere(
(e) => e.name == settings.name,

View File

@@ -0,0 +1,378 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
Widget addKillRequestBottomSheet(SubmitRequestKillHouseLogic controller) {
return ObxValue(
(data) => AnimatedContainer(
duration: Duration(milliseconds: 300),
height: data.value ? 680.h : 580.h,
child: BaseBottomSheet(
child: Column(
children: [
Row(
children: [
SizedBox(width: 12),
Text(
"ثبت درخواست کشتار",
style: AppFonts.yekan18Bold.copyWith(color: AppColor.iconColor),
),
],
),
Divider(),
SizedBox(height: 8),
InformationTag(
data: InformationTagData(
labelTitle: 'قیمت روز مرغ (${Jalali.now().formatCompactDate()})',
labelTitleStyle: AppFonts.yekan14,
isLoading: false,
height: 40.h,
value: controller.commissionPrices.chickenAveragePrice.separatedByComma.addReal,
valueStyle: AppFonts.yekan14,
borderColor: AppColor.greenNormal,
radiusWidth: 1,
valueBgColor: Colors.white,
labelGradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [AppColor.greenLightActive, Colors.white],
),
),
),
SizedBox(height: 12),
ResourceOverlayDropdown(
height: 40.h,
items: controller.killHouseList,
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
labelBuilder: (selected) => Text(selected?.name ?? 'محل کشتار'),
onChanged: controller.setKillHouse,
),
SizedBox(height: 8),
UnitTextField(
controller: controller.breedCountController,
keyboardType: TextInputType.number,
maxLines: 1,
minLines: 1,
inputFormatters: [FilteringTextInputFormatter.digitsOnly, SeparatorInputFormatter()],
unit: 'قطعه',
hint: 'حجم کشتار',
initialValue: 0.separatedByComma,
),
SizedBox(height: 8),
ResourceOverlayDropdown(
items: controller.timeFrameOfKilling,
itemBuilder: (item) => Text(item),
labelBuilder: (selected) => Text(selected ?? 'زمان دریافت'),
onChanged: (selected) => controller.setTimeFrameOfKilling(selected),
),
SizedBox(height: 8),
RTextField(
controller: controller.dateOfSlaughterTextEditor,
hintText: 'تاریخ کشتار',
filled: true,
filledColor: AppColor.bgLight,
prefixIcon: Padding(
padding: const EdgeInsets.all(8.0),
child: Assets.vec.calendarSvg.svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(AppColor.bgIcon, BlendMode.srcIn),
),
),
readonly: true,
onTap: () {
Get.bottomSheet(
modalDatePicker(
onDateSelected: (value) {
controller.dateOfSlaughterTextEditor.text = value.formatCompactDate();
controller.dateOfSlaughter = value;
},
),
isScrollControlled: true,
isDismissible: true,
ignoreSafeArea: false,
);
},
),
SizedBox(height: 8),
buildAnimatedLabelContainer(controller),
SizedBox(height: 8),
Container(
height: 40.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.blueDark, width: 0.5),
),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if (controller.isAgreedUndertaking.value == false) {
undertakingDialog(controller);
}
else{
controller.toggleAgreeUndertaking(false);
}
},
child: Row(
spacing: 2,
children: [
ObxValue((data) {
return Checkbox(
value: data.value,
onChanged: (value) {
if (controller.isAgreedUndertaking.value == false) {
undertakingDialog(controller);
}
else {
controller.toggleAgreeUndertaking(false);
}
},
);
}, controller.isAgreedUndertaking),
Text(
"با تعهدنامه موافق هستم !",
style: AppFonts.yekan14Bold.copyWith(color: AppColor.blueDark),
),
],
),
),
),
SizedBox(height: 8),
Container(
height: 40.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.mediumGrey, width: 1),
),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => controller.toggleAgreeSmsNotification(),
child: Row(
spacing: 2,
children: [
ObxValue((selected) {
return Checkbox(
value: selected.value,
onChanged: (value) => controller.toggleAgreeSmsNotification(),
);
}, controller.isAgreedSmsNotification),
Text(
"دریافت پیامک اطلاع رسانی",
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2),
),
],
),
),
),
SizedBox(height: 16),
Row(
spacing: 16,
mainAxisAlignment: .center,
children: [
RElevated(
width: 160.w,
height: 40.h,
backgroundColor: AppColor.greenNormal,
text: 'ثبت',
onPressed: () async {
await controller.submitKillRequest();
},
),
ROutlinedElevated(
height: 40,
text: 'انصراف',
borderColor: AppColor.redNormal,
onPressed: () {
Get.back();
},
),
],
),
],
),
),
),
controller.isBreedWeightSelected,
);
}
void undertakingDialog(SubmitRequestKillHouseLogic controller) {
Get.dialog(
AlertDialog(
title: Text("تعهد نامه", textAlign: TextAlign.center),
titleTextStyle: AppFonts.yekan20.copyWith(color: AppColor.textColor3),
content: Column(
mainAxisSize: .min,
spacing: 10,
children: [
Text(
"اینجانب ${controller.baseLogic.userProfile.value.data?.fullname} موافقت خود را نسبت به موارد ذکر شده اعلام می نمایم.",
style: AppFonts.yekan13.copyWith(color: AppColor.textColor3),
),
Text(
"✅ بر اساس این توافق نامه در صورت لغو کشتار جریمه خواهم شد.",
style: AppFonts.yekan13.copyWith(color: AppColor.textColor3),
),
],
),
actions: [
Row(
spacing: 10,
children: [
Expanded(
child: RElevated(
text: 'موافقم',
height: 32.h,
onPressed: () {
controller.toggleAgreeUndertaking(true);
Get.back();
},
textStyle: AppFonts.yekan20Bold.copyWith(color: Colors.white),
backgroundColor: AppColor.greenNormal,
),
),
Expanded(
child: ROutlinedElevated(
text: 'رد',
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
height: 32.h,
onPressed: () {
controller.toggleAgreeUndertaking(false);
Get.back();
},
borderColor: AppColor.redNormal,
),
),
],
),
],
),
);
}
Widget buildAnimatedLabelContainer(SubmitRequestKillHouseLogic controller) {
return ObxValue((data) {
return AnimatedCrossFade(
firstChild: GestureDetector(
onTap: () {
controller.toggleBreedWeightSelection();
},
child: Container(
height: 40.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.mediumGrey, width: 0.5),
),
child: Row(
spacing: 7,
children: [
Directionality(
textDirection: TextDirection.ltr,
child: Switch(
value: data.value,
onChanged: (data) => controller.toggleBreedWeightSelection(),
),
),
Text(
"تعیین نژاد / وزن مرغ",
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2),
),
],
),
),
),
secondChild: SizedBox(
height: 140.h,
child: Stack(
fit: StackFit.passthrough,
children: [
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
height: 121.h,
padding: EdgeInsets.fromLTRB(8.r, 18.r, 8.r, 8.r),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.mediumGrey, width: (0.5).w),
),
child: Column(
spacing: 8,
children: [
ResourceOverlayDropdown(
items: controller.chickenBreedList,
itemBuilder: (item) => Text(item),
labelBuilder: (selected) => Text(selected ?? 'نژاد مرغ'),
onChanged: (selected) => controller.setChickenBreed(selected),
),
RTextField(
controller: controller.chickenWeight,
label: ' وزن مرغ (کیلوگرم) ',
filled: true,
filledColor: AppColor.bgLight,
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
SeparatorInputFormatter(),
],
),
],
),
),
),
Positioned(
top: 0,
right: 7,
child: GestureDetector(
onTap: () {
controller.toggleBreedWeightSelection();
},
child: Container(
height: 30.h,
padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 4.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.mediumGrey, width: 0.5),
),
child: Row(
spacing: 7,
children: [
Directionality(
textDirection: TextDirection.ltr,
child: FittedBox(
fit: BoxFit.scaleDown,
child: Switch(
value: data.value,
onChanged: (_) => controller.toggleBreedWeightSelection(),
),
),
),
Text(
"تعیین نژاد / وزن مرغ",
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor2),
),
],
),
),
),
),
],
),
),
crossFadeState: data.value ? CrossFadeState.showSecond : CrossFadeState.showFirst,
duration: Duration(milliseconds: 500),
);
}, controller.isBreedWeightSelected);
}

View File

@@ -0,0 +1,225 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/request/kill_request_response.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/chicken_commission_prices/chicken_commission_prices.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_house/kill_house_response.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_request_list/kill_request_list.dart'
as listModel;
import 'package:rasadyar_chicken/presentation/pages/kill_house/root/logic.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
import 'package:rasadyar_core/core.dart';
class SubmitRequestKillHouseLogic extends GetxController {
ChickenBaseLogic baseLogic = Get.find<ChickenBaseLogic>();
RxList<String> routesName = ["عملیات", "ثبت درخواست کشتار"].obs;
late KillHouseRootLogic rootLogic;
RxInt expandedItemIndex = RxInt(-1);
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString();
RxBool isBreedWeightSelected = false.obs;
TextEditingController breedCountController = TextEditingController();
TextEditingController dateOfSlaughterTextEditor = TextEditingController();
Jalali dateOfSlaughter = Jalali.now();
TextEditingController chickenWeight = TextEditingController();
Resource<List<String>> timeFrameOfKilling = Resource.success([
'12 - 14',
'14 - 16',
'16 - 18',
'18 - 20',
'20 - 22',
'22 - 24',
]);
RxString timeFrameOfKillingSelected = ''.obs;
Resource<List<String>> chickenBreedList = Resource.success([
'آرین',
'راس',
'آربراکوز (آیلاس)',
'کاب',
'هوبارد',
'ترکیبی',
'وارداتی',
]);
RxString chickenBreedSelected = ''.obs;
RxBool isAgreedUndertaking = false.obs;
RxBool isAgreedSmsNotification = false.obs;
KillHouseResponse? selectedKillHouse;
late Resource<List<KillHouseResponse>> killHouseList;
late ChickenCommissionPrices commissionPrices;
Rx<Resource<List<listModel.KillRequestList>>> killRequestList = Rx(
Resource.initial(),
);
@override
void onInit() {
super.onInit();
rootLogic = Get.find<KillHouseRootLogic>();
getCommissionPrice();
getKillHouseList();
getListOfKillRequests();
dateOfSlaughterTextEditor.text = Jalali.now().formatCompactDate();
dateOfSlaughter = Jalali.now();
chickenWeight.text = '2.7';
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
void onRefresh() {
getCommissionPrice();
getKillHouseList();
getListOfKillRequests();
}
void toggleExpandedItem(int index) {
if (expandedItemIndex.value == index) {
expandedItemIndex.value = -1;
} else {
expandedItemIndex.value = index;
}
}
void toggleBreedWeightSelection() {
isBreedWeightSelected.value = !isBreedWeightSelected.value;
}
void clearPage() {
expandedItemIndex.value = -1;
isBreedWeightSelected.value = false;
isAgreedUndertaking.value = false;
isAgreedSmsNotification.value = false;
breedCountController.clear();
dateOfSlaughter = Jalali.now();
dateOfSlaughterTextEditor.text = Jalali.now().formatCompactDate();
chickenWeight.text = '2.7';
timeFrameOfKillingSelected.value = '';
chickenBreedSelected.value = '';
}
void setKillHouse(KillHouseResponse killHouse) {
selectedKillHouse = killHouse;
iLog(selectedKillHouse?.key);
}
void setTimeFrameOfKilling(String timeFrame) {
timeFrameOfKillingSelected.value = timeFrame;
}
void setChickenBreed(String breed) {
chickenBreedSelected.value = breed;
}
void toggleAgreeUndertaking(bool item) {
isAgreedUndertaking.value = item;
}
void toggleAgreeSmsNotification() {
isAgreedSmsNotification.value = !isAgreedSmsNotification.value;
}
Future<void> getKillHouseList() async {
await safeCall(
call: () => rootLogic.killHouseRepository.getKillHouseList(
token: rootLogic.tokenService.accessToken.value ?? '',
),
onSuccess: (result) => killHouseList = Resource.success(result ?? []),
);
}
Future<void> getCommissionPrice() async {
await safeCall(
call: () => rootLogic.killHouseRepository.getCommissionPrice(
token: rootLogic.tokenService.accessToken.value ?? '',
),
onSuccess: (result) => commissionPrices =
result ?? ChickenCommissionPrices(chickenAveragePrice: 0),
);
}
Future<void> submitKillRequest() async {
KillRequestResponse request = KillRequestResponse(
killCapacity: int.parse(breedCountController.text),
reciveTime: timeFrameOfKillingSelected.value,
reciveDate: dateOfSlaughter
.toDateTime()
.formattedGregorianDateWithoutMillisecond,
lowWeight: false,
highWeight: false,
indexWeight: double.parse(chickenWeight.text),
chickenBreed: chickenBreedSelected.value,
cash: true,
credit: false,
smsPayment: isAgreedSmsNotification.value,
killHouseKey: selectedKillHouse?.key,
killerKillHouseKey: null,
role: 'KillHouse',
);
await safeCall(
showError: true,
call: () => rootLogic.killHouseRepository.submitKillHouseRequest(
token: rootLogic.tokenService.accessToken.value ?? '',
data: request,
),
onSuccess: (result) {
onRefresh();
Get.back();
Future.delayed(
Duration(seconds: 3),
() => defaultShowSuccessMessage("عملیات با موفقیت انجام شد"),
);
},
);
}
Future<void> getListOfKillRequests() async {
await safeCall(
showError: true,
call: () => rootLogic.killHouseRepository.getListKillRequest(
token: rootLogic.tokenService.accessToken.value ?? '',
queryParameters: buildRawQueryParams(
role: 'KillHouse',
fromDate: fromDateFilter.value.toDateTime(),
toDate: toDateFilter.value.toDateTime(),
),
),
onSuccess: (result) {
if (result == null || result.isEmpty) {
killRequestList.value = Resource.empty();
return;
}
killRequestList.value = Resource.success(result);
},
onError: (error, stackTrace) {
killRequestList.value = Resource.error(error);
},
);
}
Future<void> deleteRequest(int id) async {
await safeCall(
showError: true,
call: () => rootLogic.killHouseRepository.deleteKillRequest(
token: rootLogic.tokenService.accessToken.value ?? '',
requestId: id,
),
onSuccess: (result) {
onRefresh();
Get.back();
},
);
}
}

View File

@@ -0,0 +1,232 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/kill_house_module/register_request/response/kill_request_list/kill_request_list.dart'
as listModel
show KillRequestList;
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
import 'add_request_bottom_sheet.dart';
import 'logic.dart';
class SubmitRequestKillHousePage extends GetView<SubmitRequestKillHouseLogic> {
const SubmitRequestKillHousePage({super.key});
@override
Widget build(BuildContext context) {
return ChickenBasePage(
hasBack: true,
hasFilter: true,
hasSearch: true,
onBackTap: () => Get.back(id: killHouseActionKey),
onSearchChanged: (data) {
//Todo
},
onRefresh: () async => controller.onRefresh(),
routesWidget: ContainerBreadcrumb(rxRoutes: controller.routesName),
child: Stack(
fit: .expand,
children: [
Positioned.fill(
right: 13,
left: 14,
child: Obx(() {
return RListView.separated(
itemCount: controller.killRequestList.value.data?.length ?? 0,
itemBuilder: (context, index) {
var item = controller.killRequestList.value.data![index];
return ObxValue((data) {
return ExpandableListItem2(
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item),
onTap: () => controller.toggleExpandedItem(index),
selected: data.value == index,
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.virtualSvg.path,
);
}, controller.expandedItemIndex);
},
separatorBuilder: (context, index) => SizedBox(height: 8),
resource: controller.killRequestList.value,
);
}),
),
Positioned(
right: 8,
bottom: 92,
child: RFab.add(
onPressed: () {
Get.bottomSheet(
isScrollControlled: true,
addKillRequestBottomSheet(controller),
).then((value) {
controller.clearPage();
});
},
),
),
],
),
);
}
Row itemListWidget(listModel.KillRequestList item) {
return Row(
children: [
SizedBox(width: 30),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
item.killHouse?.name ?? 'بدون نام',
style: AppFonts.yekan14Bold.copyWith(color: AppColor.blueNormal),
),
SizedBox(height: 4),
Text(
item.createDate?.toJalali.formatCompactDate() ?? "-",
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
],
),
Spacer(),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'درخواست ${item.killCapacity}'.addCountEXT,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
SizedBox(height: 4),
Text(
'تعداد مورد تایید 150 قطعه',
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
],
),
Spacer(),
Assets.vec.scanSvg.svg(
width: 32.w,
height: 32.h,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
SizedBox(width: 12),
],
);
}
Container itemListExpandedWidget(listModel.KillRequestList item) {
Jalali date = item.createDate.toJalali;
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
item.killHouse?.name ?? 'بدون نام',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
Spacer(),
//todo
Text(
'در انتظار تایید استان',
textAlign: TextAlign.center,
style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyDark),
),
SizedBox(width: 7),
Assets.vec.clockSvg.svg(width: 16.w, height: 16.h),
],
),
Container(
height: 32,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blueLightHover),
borderRadius: BorderRadius.circular(8),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
spacing: 3,
children: [
Text(
date.formatter.wN,
style: AppFonts.yekan14.copyWith(
color: AppColor.textColor,
),
),
Text(
'${date.formatter.d} ${date.formatter.mN ?? 'N/A'}',
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
],
),
Text(
date.formatter.y,
style: AppFonts.yekan20.copyWith(color: AppColor.textColor),
),
Text(
'${date.formatter.tHH}:${date.formatter.tMM ?? 'N/A'}',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
],
),
),
buildRow(
title: 'تعداد درخواست اولیه',
value: item.killCapacity.separatedByComma.addCountEXT,
),
//todo
buildRow(
title: 'تعداد مورد تایید',
value: item.numberOfAllocated.separatedByComma.addCountEXT,
),
buildRow(title: 'زمان دریافت', value: item.reciveTime ?? '-'),
buildRow(
title: 'تاریخ درخواستی کشتار',
value: item.reciveDate.toJalali.formatCompactDate(),
),
ROutlinedElevated(
text: 'حذف',
height: 40.h,
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
isFullWidth: true,
onPressed: () {
buildWarningDialog(
title: 'اخطار',
middleText: 'آیا از حذف شدن این مورد اطمینان دارید؟',
onConfirm: () async {
controller.deleteRequest(item.id!);
},
onRefresh: () async {
controller.onRefresh();
},
);
},
borderColor: AppColor.redNormal,
),
],
),
);
}
}

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import '../widgets/step1_page.dart';
class PoultryFarmInspectionHomeLogic extends GetxController
with GetTickerProviderStateMixin {

View File

@@ -49,10 +49,6 @@ class PoultryScienceRootLogic extends GetxController {
poultryRepository = diChicken.get<PoultryScienceRepository>();
}
@override
void onClose() {
super.onClose();
}
void toggleExpanded(int index) {
if (homeExpandedList.keys.contains(index)) {

View File

@@ -5,10 +5,6 @@ class BuyLogic extends GetxController {
List<String> routesName = ['خرید'];
DateTime? _lastBackPressed;
@override
void onInit() {
super.onInit();
}
@override
void onReady() {

View File

@@ -133,7 +133,7 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
),
Spacer(),
Text(
item.receiverState?.faItem,
item.receiverState?.faItem ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyDark),
),

View File

@@ -29,7 +29,7 @@ class BuyOutOfProvinceLogic extends GetxController {
Rxn<IranProvinceCityModel> selectedProvince = Rxn();
Rxn<IranProvinceCityModel> selectedCity = Rxn();
Rxn<XFile> selectedImage = Rxn<XFile>();
RxnString _base64Image = RxnString();
final RxnString _base64Image = RxnString();
RxnString editImageUrl = RxnString();
RxnString editFreeBarKey = RxnString();

View File

@@ -464,7 +464,7 @@ class SalesInProvinceLogic extends GetxController {
}
Steward? getBuyerInformation(AllocatedMadeModel model) {
if (model.allocationType?.buyerIsGuild) {
if (model.allocationType?.buyerIsGuild ?? false) {
return model.toGuilds;
} else {
return model.steward;

View File

@@ -111,7 +111,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
onSubmit: () => controller.submitFilter(),
);
itemListWidget(StewardFreeSaleBar item) {
Row itemListWidget(StewardFreeSaleBar item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@@ -182,7 +182,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
);
}
itemListExpandedWidget(StewardFreeSaleBar item, int index) {
Container itemListExpandedWidget(StewardFreeSaleBar item, int index) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(

View File

@@ -277,7 +277,7 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
);
}
itemListExpandedWidget(OutProvinceCarcassesBuyer item) {
Container itemListExpandedWidget(OutProvinceCarcassesBuyer item) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),

View File

@@ -70,7 +70,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
);
}
itemListWidget(StewardFreeSaleBar item) {
Row itemListWidget(StewardFreeSaleBar item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@@ -128,7 +128,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
);
}
itemListExpandedWidget(StewardFreeSaleBar item, int index) {
Container itemListExpandedWidget(StewardFreeSaleBar item, int index) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),

View File

@@ -90,10 +90,6 @@ class SegmentationLogic extends GetxController {
setUpListener();
}
@override
void onClose() {
super.onClose();
}
void setSearchValue(String? value) {
searchedValue.value = value?.trim();

View File

@@ -81,7 +81,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
onSubmit: () => controller.getAllSegmentation(),
);
itemListWidget(SegmentationModel item) {
Row itemListWidget(SegmentationModel item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@@ -160,7 +160,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
);
}
itemListExpandedWidget(SegmentationModel item, int index) {
Container itemListExpandedWidget(SegmentationModel item, int index) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),

View File

@@ -6,6 +6,8 @@ import 'package:rasadyar_chicken/presentation/pages/kill_house/action/logic.dart
import 'package:rasadyar_chicken/presentation/pages/kill_house/action/view.dart';
import 'package:rasadyar_chicken/presentation/pages/kill_house/root/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/kill_house/root/view.dart';
import 'package:rasadyar_chicken/presentation/pages/kill_house/submit_request/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/kill_house/submit_request/view.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_farm_inspection/poultry_farm_inspection.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/view.dart';
@@ -25,6 +27,7 @@ import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/view.da
import 'package:rasadyar_chicken/presentation/pages/steward/steward.dart';
import 'package:rasadyar_chicken/presentation/routes/global_binding.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
import 'package:rasadyar_chicken/presentation/widget/captcha/logic.dart';
import 'package:rasadyar_core/core.dart';
@@ -38,7 +41,7 @@ sealed class ChickenPages {
binding: BindingsBuilder(() {
Get.lazyPut(() => AuthLogic());
Get.lazyPut(() => CaptchaWidgetLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
),
@@ -47,7 +50,7 @@ sealed class ChickenPages {
page: () => RolePage(),
binding: BindingsBuilder(() {
Get.lazyPut(() => RoleLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
),
@@ -59,7 +62,7 @@ sealed class ChickenPages {
bindings: [
GlobalBinding(),
BindingsBuilder(() {
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
Get.lazyPut(() => StewardRootLogic());
Get.lazyPut(() => HomeLogic());
Get.lazyPut(() => BuyLogic());
@@ -75,7 +78,7 @@ sealed class ChickenPages {
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.put(HomeLogic());
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
}),
),
@@ -86,7 +89,7 @@ sealed class ChickenPages {
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => SaleLogic());
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
Get.lazyPut(() => SalesOutOfProvinceLogic());
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
Get.lazyPut(() => StewardRootLogic());
@@ -117,7 +120,7 @@ sealed class ChickenPages {
page: () => SalesInProvincePage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
Get.lazyPut(() => SalesInProvinceLogic());
}),
),
@@ -128,7 +131,7 @@ sealed class ChickenPages {
page: () => BuyPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
Get.lazyPut(() => BuyLogic());
}),
),
@@ -137,7 +140,7 @@ sealed class ChickenPages {
page: () => BuyOutOfProvincePage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
Get.lazyPut(() => BuyOutOfProvinceLogic());
}),
),
@@ -146,7 +149,7 @@ sealed class ChickenPages {
page: () => BuyInProvincePage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => BaseLogic());
Get.lazyPut(() => ChickenBaseLogic());
Get.lazyPut(() => BuyInProvinceLogic());
Get.lazyPut(() => BuyInProvinceWaitingLogic());
Get.lazyPut(() => BuyInProvinceAllLogic());
@@ -234,7 +237,7 @@ sealed class ChickenPages {
page: () => PoultryFarmInspectionHomePage(),
binding: BindingsBuilder(() {
Get.lazyPut(() => PoultryFarmInspectionHomeLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
),
//endregion
@@ -245,7 +248,7 @@ sealed class ChickenPages {
page: () => KillHouseRootPage(),
binding: BindingsBuilder(() {
Get.lazyPut(() => KillHouseRootLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
),
GetPage(
@@ -255,7 +258,19 @@ sealed class ChickenPages {
GlobalBinding(),
BindingsBuilder(() {
Get.lazyPut(() => KillHouseActionLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
],
),
GetPage(
name: ChickenRoutes.submitRequestKillHouse,
page: () => SubmitRequestKillHousePage(),
bindings: [
GlobalBinding(),
BindingsBuilder(() {
Get.lazyPut(() => SubmitRequestKillHouseLogic());
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
}),
],
),

View File

@@ -48,6 +48,7 @@ sealed class ChickenRoutes {
static const _killHouse = '$_base/killHouse';
static const initKillHouse = '$_killHouse/home';
static const actionKillHouse = '$_killHouse/action';
static const submitRequestKillHouse = '$actionKillHouse/submitRequest';
//endregion
}

View File

@@ -13,6 +13,6 @@ const int poultryThirdKey = 107;
//endregion
//region kill house Keys
const int killHouseFirstKey = 108;
const int killHouseActionKey = 108;
//endregion

View File

@@ -1,5 +1,5 @@
extension XStringUtils on String {
get faAllocationType {
String get faAllocationType {
final tmp = split('_');
tmp.insert(1, '_');
if (tmp.length > 1) {
@@ -9,9 +9,9 @@ extension XStringUtils on String {
}
}
get faItem => utilsMap[this] ?? this;
String get faItem => utilsMap[this] ?? this;
get buyerIsGuild {
bool get buyerIsGuild {
final tmp = split('_');
if (tmp.length > 1) {
return tmp.last == 'guild';

View File

@@ -0,0 +1,32 @@
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart';
import 'package:rasadyar_core/core.dart';
import '../../../data/models/response/user_profile/user_profile.dart';
class ChickenBaseLogic extends BasePageLogic {
var tokenService = Get.find<TokenStorageService>();
ChickenRepository chickenRepository = diChicken.get<ChickenRepository>();
Rx<Resource<UserProfile>> userProfile = Rx<Resource<UserProfile>>(Resource.loading());
@override
void onInit() {
super.onInit();
getUserProfile();
}
Future<void> getUserProfile() async {
userProfile.value = Resource.loading();
await safeCall<UserProfile?>(
call: () async =>
await chickenRepository.getUserProfile(token: tokenService.accessToken.value!),
onSuccess: (result) {
if (result != null) {
userProfile.value = Resource.success(result);
}
},
onError: (error, stackTrace) {},
);
}
}

View File

@@ -3,7 +3,9 @@ import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/back_ground.dart';
import 'package:rasadyar_core/core.dart';
class ChickenBasePage extends GetView<BaseLogic> {
import 'logic.dart';
class ChickenBasePage extends GetView<ChickenBaseLogic> {
const ChickenBasePage({
super.key,
this.hasBack = true,

View File

@@ -62,7 +62,7 @@ Widget _itemList({required String title, required String? value, String? unit,Co
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
value!,
value,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: const Color(0xFF5B5B5B)),
),

View File

@@ -9,10 +9,6 @@ class WidelyUsedLogic extends GetxController {
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
@override
void onReady() {
super.onReady();
}
@override
void onClose() {