fix: resolve import path issues and clean up unused imports across multiple files
This commit is contained in:
@@ -1,13 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/poultry_science/active_hatching/view.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/active_hatching/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching/hatching_models.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching/hatching_models.dart';
|
||||||
import 'package:rasadyar_chicken/features/jahad/presentation/pages/active_hatching/logic.dart';
|
import 'package:rasadyar_chicken/features/jahad/presentation/pages/active_hatching/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/create_inspection_bottom_sheet.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/create_inspection_bottom_sheet.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/create_inspection_bottom_sheet_logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/create_inspection_bottom_sheet_logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/jahad/presentation/pages/active_hatching/view.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_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
@@ -64,10 +60,7 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
|
|||||||
Container itemListExpandedWidget(HatchingModel item) {
|
Container itemListExpandedWidget(HatchingModel 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: [
|
||||||
@@ -120,10 +113,7 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
buildRow(
|
buildRow(title: 'شماره مجوز جوجه ریزی', value: item.licenceNumber ?? 'N/A'),
|
||||||
title: 'شماره مجوز جوجه ریزی',
|
|
||||||
value: item.licenceNumber ?? 'N/A',
|
|
||||||
),
|
|
||||||
buildUnitRow(
|
buildUnitRow(
|
||||||
title: 'حجم جوجه ریزی',
|
title: 'حجم جوجه ریزی',
|
||||||
value: item.quantity.separatedByCommaFa,
|
value: item.quantity.separatedByCommaFa,
|
||||||
@@ -134,30 +124,19 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
|
|||||||
value: item.leftOver.separatedByCommaFa,
|
value: item.leftOver.separatedByCommaFa,
|
||||||
unit: '(قطعه)',
|
unit: '(قطعه)',
|
||||||
),
|
),
|
||||||
buildUnitRow(
|
buildUnitRow(title: 'تلفات', value: item.losses.separatedByCommaFa, unit: '(قطعه)'),
|
||||||
title: 'تلفات',
|
|
||||||
value: item.losses.separatedByCommaFa,
|
|
||||||
unit: '(قطعه)',
|
|
||||||
),
|
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'دامپزشک فارم',
|
title: 'دامپزشک فارم',
|
||||||
value:
|
value: '${item.vetFarm?.vetFarmFullName}(${item.vetFarm?.vetFarmMobile})',
|
||||||
'${item.vetFarm?.vetFarmFullName}(${item.vetFarm?.vetFarmMobile})',
|
|
||||||
),
|
),
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'شرح بازرسی',
|
title: 'شرح بازرسی',
|
||||||
value: item.reportInfo?.image == false
|
value: item.reportInfo?.image == false ? 'ارسال تصویر جوجه ریزی فارم ' : 'تکمیل شده',
|
||||||
? 'ارسال تصویر جوجه ریزی فارم '
|
|
||||||
: 'تکمیل شده',
|
|
||||||
titleStyle: AppFonts.yekan14.copyWith(
|
titleStyle: AppFonts.yekan14.copyWith(
|
||||||
color: (item.reportInfo?.image ?? false)
|
color: (item.reportInfo?.image ?? false) ? AppColor.greenNormal : AppColor.redDark,
|
||||||
? AppColor.greenNormal
|
|
||||||
: AppColor.redDark,
|
|
||||||
),
|
),
|
||||||
valueStyle: AppFonts.yekan14.copyWith(
|
valueStyle: AppFonts.yekan14.copyWith(
|
||||||
color: (item.reportInfo?.image ?? false)
|
color: (item.reportInfo?.image ?? false) ? AppColor.greenNormal : AppColor.redDark,
|
||||||
? AppColor.greenNormal
|
|
||||||
: AppColor.redDark,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -165,9 +144,7 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
|
|||||||
height: 40.h,
|
height: 40.h,
|
||||||
isFullWidth: true,
|
isFullWidth: true,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.find<CreateInspectionBottomSheetLogic>().setHatchingModel(
|
Get.find<CreateInspectionBottomSheetLogic>().setHatchingModel(item);
|
||||||
item,
|
|
||||||
);
|
|
||||||
Get.bottomSheet(
|
Get.bottomSheet(
|
||||||
CreateInspectionBottomSheet(),
|
CreateInspectionBottomSheet(),
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/repositories/kill_house/kill_house_repository.dart';
|
import 'package:rasadyar_chicken/data/repositories/kill_house/kill_house_repository.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/presentation/page/profile/view.dart';
|
import 'package:rasadyar_chicken/features/common/presentation/page/profile/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
|
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
|
||||||
@@ -28,9 +27,8 @@ class KillHouseRootLogic extends GetxController {
|
|||||||
onGenerateRoute: (settings) {
|
onGenerateRoute: (settings) {
|
||||||
final page = ChickenPages.pages.firstWhere(
|
final page = ChickenPages.pages.firstWhere(
|
||||||
(e) => e.name == settings.name,
|
(e) => e.name == settings.name,
|
||||||
orElse: () => ChickenPages.pages.firstWhere(
|
orElse: () =>
|
||||||
(e) => e.name == ChickenRoutes.actionKillHouse,
|
ChickenPages.pages.firstWhere((e) => e.name == ChickenRoutes.actionKillHouse),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return buildRouteFromGetPage(page);
|
return buildRouteFromGetPage(page);
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/kill_house_module/warehouse_and_distribution/response/kill_house_bars/kill_house_bars_response.dart';
|
import 'package:rasadyar_chicken/data/models/kill_house_module/warehouse_and_distribution/response/kill_house_bars/kill_house_bars_response.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/request/steward_allocation/steward_allocation_request.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
import '../../../steward/data/model/request/steward_allocation/steward_allocation_request.dart';
|
||||||
|
import '../../../steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionBuyInProvinceEnteredLogic extends GetxController {
|
class WarehouseAndDistributionBuyInProvinceEnteredLogic extends GetxController {
|
||||||
RxInt isExpandedListIndex = (-1).obs;
|
RxInt isExpandedListIndex = (-1).obs;
|
||||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
||||||
@@ -14,8 +15,7 @@ class WarehouseAndDistributionBuyInProvinceEnteredLogic extends GetxController {
|
|||||||
final RxBool isLoadingMoreAllocationsMade = false.obs;
|
final RxBool isLoadingMoreAllocationsMade = false.obs;
|
||||||
RxInt currentPage = 1.obs;
|
RxInt currentPage = 1.obs;
|
||||||
|
|
||||||
WarehouseAndDistributionRootLogic rootLogic =
|
WarehouseAndDistributionRootLogic rootLogic = Get.find<WarehouseAndDistributionRootLogic>();
|
||||||
Get.find<WarehouseAndDistributionRootLogic>();
|
|
||||||
|
|
||||||
Rx<Resource<PaginationModel<KillHouseBarsResponse>>> enteredBars =
|
Rx<Resource<PaginationModel<KillHouseBarsResponse>>> enteredBars =
|
||||||
Resource<PaginationModel<KillHouseBarsResponse>>.loading().obs;
|
Resource<PaginationModel<KillHouseBarsResponse>>.loading().obs;
|
||||||
@@ -35,11 +35,7 @@ class WarehouseAndDistributionBuyInProvinceEnteredLogic extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
debounce(
|
debounce(searchedValue, (callback) => getkillHouseBars(), time: Duration(milliseconds: 2000));
|
||||||
searchedValue,
|
|
||||||
(callback) => getkillHouseBars(),
|
|
||||||
time: Duration(milliseconds: 2000),
|
|
||||||
);
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
ever(approvedWithOtpCode, (callback) {
|
ever(approvedWithOtpCode, (callback) {
|
||||||
if (callback == false) {
|
if (callback == false) {
|
||||||
@@ -52,8 +48,7 @@ class WarehouseAndDistributionBuyInProvinceEnteredLogic extends GetxController {
|
|||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
enteredBars.value =
|
enteredBars.value = Resource<PaginationModel<KillHouseBarsResponse>>.loading();
|
||||||
Resource<PaginationModel<KillHouseBarsResponse>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -72,7 +67,6 @@ class WarehouseAndDistributionBuyInProvinceEnteredLogic extends GetxController {
|
|||||||
search: 'filter',
|
search: 'filter',
|
||||||
role: 'KillHouse',
|
role: 'KillHouse',
|
||||||
value: searchedValue.value,
|
value: searchedValue.value,
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -80,24 +74,18 @@ class WarehouseAndDistributionBuyInProvinceEnteredLogic extends GetxController {
|
|||||||
await Future.delayed(Duration(milliseconds: 200));
|
await Future.delayed(Duration(milliseconds: 200));
|
||||||
|
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
enteredBars.value =
|
enteredBars.value = Resource<PaginationModel<KillHouseBarsResponse>>.empty();
|
||||||
Resource<PaginationModel<KillHouseBarsResponse>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
enteredBars.value =
|
enteredBars.value = Resource<PaginationModel<KillHouseBarsResponse>>.success(
|
||||||
Resource<PaginationModel<KillHouseBarsResponse>>.success(
|
PaginationModel<KillHouseBarsResponse>(
|
||||||
PaginationModel<KillHouseBarsResponse>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [...(enteredBars.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
results: [
|
),
|
||||||
...(enteredBars.value.data?.results ?? []),
|
);
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
enteredBars.value =
|
enteredBars.value = Resource<PaginationModel<KillHouseBarsResponse>>.empty();
|
||||||
Resource<PaginationModel<KillHouseBarsResponse>>.empty();
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/kill_house_module/warehouse_and_distribution/response/kill_house_bars/kill_house_bars_response.dart';
|
import 'package:rasadyar_chicken/data/models/kill_house_module/warehouse_and_distribution/response/kill_house_bars/kill_house_bars_response.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
|
|
||||||
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
import '../../../steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionBuyInProvinceEnteredPage
|
class WarehouseAndDistributionBuyInProvinceEnteredPage
|
||||||
@@ -87,20 +87,14 @@ class WarehouseAndDistributionBuyInProvinceEnteredPage
|
|||||||
child: Assets.vec.hotChickenSvg.svg(
|
child: Assets.vec.hotChickenSvg.svg(
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||||
AppColor.blueNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'item.weightOfCarcasses?.separatedByCommaFa.addKg ' ??
|
'item.weightOfCarcasses?.separatedByCommaFa.addKg ' ?? 'N/A',
|
||||||
'N/A',
|
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
style: AppFonts.yekan12Bold.copyWith(
|
style: AppFonts.yekan12Bold.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -128,10 +122,7 @@ class WarehouseAndDistributionBuyInProvinceEnteredPage
|
|||||||
Container itemListExpandedWidget(KillHouseBarsResponse item) {
|
Container itemListExpandedWidget(KillHouseBarsResponse 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: [
|
||||||
@@ -153,10 +144,7 @@ class WarehouseAndDistributionBuyInProvinceEnteredPage
|
|||||||
SvgGenImage.vec(controller.getVecPathItem('pending')).svg(
|
SvgGenImage.vec(controller.getVecPathItem('pending')).svg(
|
||||||
width: 16.w,
|
width: 16.w,
|
||||||
height: 16.h,
|
height: 16.h,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(AppColor.darkGreyDark, BlendMode.srcIn),
|
||||||
AppColor.darkGreyDark,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -178,16 +166,12 @@ class WarehouseAndDistributionBuyInProvinceEnteredPage
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'item.date?.toJalali.formatter.wN ' ?? 'N/A',
|
'item.date?.toJalali.formatter.wN ' ?? 'N/A',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
'${'item.date?.toJalali.formatter.d '} ${'item.date?.toJalali.formatter.mN ' ?? 'N/A'}',
|
'${'item.date?.toJalali.formatter.d '} ${'item.date?.toJalali.formatter.mN ' ?? 'N/A'}',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -205,19 +189,13 @@ class WarehouseAndDistributionBuyInProvinceEnteredPage
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
buildRow(
|
buildRow(title: 'مشخصات فروشنده', value: 'item.toSteward?.user?.fullname ' ?? 'N/A'),
|
||||||
title: 'مشخصات فروشنده',
|
|
||||||
value: 'item.toSteward?.user?.fullname ' ?? 'N/A',
|
|
||||||
),
|
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'تلفن فروشنده',
|
title: 'تلفن فروشنده',
|
||||||
value: 'item.toSteward?.user?.mobile ' ?? 'N/A',
|
value: 'item.toSteward?.user?.mobile ' ?? 'N/A',
|
||||||
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
),
|
),
|
||||||
buildRow(
|
buildRow(title: 'نوع تخصیص', value: 'item.allocationType?.faAllocationType ' ?? 'N/A'),
|
||||||
title: 'نوع تخصیص',
|
|
||||||
value: 'item.allocationType?.faAllocationType ' ?? 'N/A',
|
|
||||||
),
|
|
||||||
buildRow(title: ' سهمیه', value: 'item.quota?.faTitle ' ?? 'N/A'),
|
buildRow(title: ' سهمیه', value: 'item.quota?.faTitle ' ?? 'N/A'),
|
||||||
buildRow(title: 'محصول', value: 'item.product?.name ' ?? 'N/A'),
|
buildRow(title: 'محصول', value: 'item.product?.name ' ?? 'N/A'),
|
||||||
buildRow(
|
buildRow(
|
||||||
@@ -228,9 +206,7 @@ class WarehouseAndDistributionBuyInProvinceEnteredPage
|
|||||||
buildRow(
|
buildRow(
|
||||||
title: 'قیمت هر کیلوگرم',
|
title: 'قیمت هر کیلوگرم',
|
||||||
titleLabel: (false) ? 'مصوب' : 'آزاد',
|
titleLabel: (false) ? 'مصوب' : 'آزاد',
|
||||||
titleLabelStyle: AppFonts.yekan14Bold.copyWith(
|
titleLabelStyle: AppFonts.yekan14Bold.copyWith(color: AppColor.greenNormal),
|
||||||
color: AppColor.greenNormal,
|
|
||||||
),
|
|
||||||
value: item.amount?.separatedByCommaFa ?? 'N/A',
|
value: item.amount?.separatedByCommaFa ?? 'N/A',
|
||||||
valueLabel: 'ریال',
|
valueLabel: 'ریال',
|
||||||
),
|
),
|
||||||
@@ -268,9 +244,7 @@ class WarehouseAndDistributionBuyInProvinceEnteredPage
|
|||||||
}, controller.isLoadingConfirmMap),
|
}, controller.isLoadingConfirmMap),
|
||||||
ROutlinedElevated(
|
ROutlinedElevated(
|
||||||
text: 'رد',
|
text: 'رد',
|
||||||
textStyle: AppFonts.yekan20.copyWith(
|
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
|
||||||
color: AppColor.redNormal,
|
|
||||||
),
|
|
||||||
width: 150.w,
|
width: 150.w,
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -315,37 +289,25 @@ class WarehouseAndDistributionBuyInProvinceEnteredPage
|
|||||||
label: 'وزن(کیلوگرم)',
|
label: 'وزن(کیلوگرم)',
|
||||||
controller: controller.weightController,
|
controller: controller.weightController,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
inputFormatters: [
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly, SeparatorInputFormatter()],
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.h),
|
SizedBox(height: 16.h),
|
||||||
RTextField(
|
RTextField(
|
||||||
label: 'حجم(قطعه)',
|
label: 'حجم(قطعه)',
|
||||||
controller: controller.countController,
|
controller: controller.countController,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
inputFormatters: [
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly, SeparatorInputFormatter()],
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.h),
|
SizedBox(height: 16.h),
|
||||||
RTextField(
|
RTextField(
|
||||||
label: 'افت وزن(کیلوگرم)',
|
label: 'افت وزن(کیلوگرم)',
|
||||||
controller: controller.lossController,
|
controller: controller.lossController,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
inputFormatters: [
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly, SeparatorInputFormatter()],
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.h),
|
SizedBox(height: 16.h),
|
||||||
|
|
||||||
Text(
|
Text('تایید ', style: AppFonts.yekan16Bold.copyWith(color: AppColor.textColor)),
|
||||||
'تایید ',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
ObxValue((data) {
|
ObxValue((data) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -415,12 +377,7 @@ class WarehouseAndDistributionBuyInProvinceEnteredPage
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Radio(value: value),
|
Radio(value: value),
|
||||||
Text(
|
Text(label, style: textStyle ?? AppFonts.yekan16.copyWith(color: AppColor.textColor)),
|
||||||
label,
|
|
||||||
style:
|
|
||||||
textStyle ??
|
|
||||||
AppFonts.yekan16.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/kill_house_module/warehouse_and_distribution/response/kill_house_bars/kill_house_bars_response.dart';
|
import 'package:rasadyar_chicken/data/models/kill_house_module/warehouse_and_distribution/response/kill_house_bars/kill_house_bars_response.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/request/steward_allocation/steward_allocation_request.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
import '../../../steward/data/model/request/steward_allocation/steward_allocation_request.dart';
|
||||||
|
import '../../../steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionBuyInProvinceWaitingLogic extends GetxController {
|
class WarehouseAndDistributionBuyInProvinceWaitingLogic extends GetxController {
|
||||||
RxInt isExpandedListIndex = (-1).obs;
|
RxInt isExpandedListIndex = (-1).obs;
|
||||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
||||||
@@ -18,8 +19,7 @@ class WarehouseAndDistributionBuyInProvinceWaitingLogic extends GetxController {
|
|||||||
RxInt currentPage = 1.obs;
|
RxInt currentPage = 1.obs;
|
||||||
final RxBool isLoadingMoreAllocationsMade = false.obs;
|
final RxBool isLoadingMoreAllocationsMade = false.obs;
|
||||||
|
|
||||||
WarehouseAndDistributionRootLogic rootLogic =
|
WarehouseAndDistributionRootLogic rootLogic = Get.find<WarehouseAndDistributionRootLogic>();
|
||||||
Get.find<WarehouseAndDistributionRootLogic>();
|
|
||||||
RxBool isButtonConfirm = false.obs;
|
RxBool isButtonConfirm = false.obs;
|
||||||
|
|
||||||
Rx<Resource<PaginationModel<KillHouseBarsResponse>>> waitingBars =
|
Rx<Resource<PaginationModel<KillHouseBarsResponse>>> waitingBars =
|
||||||
@@ -59,8 +59,7 @@ class WarehouseAndDistributionBuyInProvinceWaitingLogic extends GetxController {
|
|||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
waitingBars.value =
|
waitingBars.value = Resource<PaginationModel<KillHouseBarsResponse>>.loading();
|
||||||
Resource<PaginationModel<KillHouseBarsResponse>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -79,32 +78,25 @@ class WarehouseAndDistributionBuyInProvinceWaitingLogic extends GetxController {
|
|||||||
search: 'filter',
|
search: 'filter',
|
||||||
role: 'KillHouse',
|
role: 'KillHouse',
|
||||||
value: searchedValue.value,
|
value: searchedValue.value,
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onSuccess: (res) async {
|
onSuccess: (res) async {
|
||||||
await Future.delayed(Duration(milliseconds: 200));
|
await Future.delayed(Duration(milliseconds: 200));
|
||||||
|
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
waitingBars.value =
|
waitingBars.value = Resource<PaginationModel<KillHouseBarsResponse>>.empty();
|
||||||
Resource<PaginationModel<KillHouseBarsResponse>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
waitingBars.value =
|
waitingBars.value = Resource<PaginationModel<KillHouseBarsResponse>>.success(
|
||||||
Resource<PaginationModel<KillHouseBarsResponse>>.success(
|
PaginationModel<KillHouseBarsResponse>(
|
||||||
PaginationModel<KillHouseBarsResponse>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [...(waitingBars.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
results: [
|
),
|
||||||
...(waitingBars.value.data?.results ?? []),
|
);
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
flashingFabBgColor();
|
flashingFabBgColor();
|
||||||
}
|
}
|
||||||
waitingBars.value =
|
waitingBars.value = Resource<PaginationModel<KillHouseBarsResponse>>.empty();
|
||||||
Resource<PaginationModel<KillHouseBarsResponse>>.empty();
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/create_steward_free_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/buy/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/buy/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
import '../../../common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
|
import '../../../common/data/model/response/roles_products/roles_products.dart';
|
||||||
|
import '../../../steward/data/model/request/create_steward_free_bar/create_steward_free_bar.dart';
|
||||||
|
import '../../../steward/data/model/response/steward_free_bar/steward_free_bar.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionBuyOutOfProvinceLogic extends GetxController {
|
class WarehouseAndDistributionBuyOutOfProvinceLogic extends GetxController {
|
||||||
late List<String> routesName;
|
late List<String> routesName;
|
||||||
RxBool isSubmitButtonEnabled = false.obs;
|
RxBool isSubmitButtonEnabled = false.obs;
|
||||||
@@ -33,11 +34,9 @@ class WarehouseAndDistributionBuyOutOfProvinceLogic extends GetxController {
|
|||||||
RxnString editImageUrl = RxnString();
|
RxnString editImageUrl = RxnString();
|
||||||
RxnString editFreeBarKey = RxnString();
|
RxnString editFreeBarKey = RxnString();
|
||||||
|
|
||||||
WarehouseAndDistributionRootLogic rootLogic =
|
WarehouseAndDistributionRootLogic rootLogic = Get.find<WarehouseAndDistributionRootLogic>();
|
||||||
Get.find<WarehouseAndDistributionRootLogic>();
|
|
||||||
|
|
||||||
WarehouseAndDistributionBuyLogic buyLogic =
|
WarehouseAndDistributionBuyLogic buyLogic = Get.find<WarehouseAndDistributionBuyLogic>();
|
||||||
Get.find<WarehouseAndDistributionBuyLogic>();
|
|
||||||
|
|
||||||
WarehouseAndDistributionSaleLogic outOfTheProvinceLogic =
|
WarehouseAndDistributionSaleLogic outOfTheProvinceLogic =
|
||||||
Get.find<WarehouseAndDistributionSaleLogic>();
|
Get.find<WarehouseAndDistributionSaleLogic>();
|
||||||
@@ -89,14 +88,11 @@ class WarehouseAndDistributionBuyOutOfProvinceLogic extends GetxController {
|
|||||||
searchedValue.value = data?.trim();
|
searchedValue.value = data?.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getStewardPurchaseOutOfProvince([
|
Future<void> getStewardPurchaseOutOfProvince([bool isLoadingMore = false]) async {
|
||||||
bool isLoadingMore = false,
|
|
||||||
]) async {
|
|
||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
purchaseOutOfProvinceList.value =
|
purchaseOutOfProvinceList.value = Resource<PaginationModel<StewardFreeBar>>.loading();
|
||||||
Resource<PaginationModel<StewardFreeBar>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -137,8 +133,7 @@ class WarehouseAndDistributionBuyOutOfProvinceLogic extends GetxController {
|
|||||||
// ),
|
// ),
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
purchaseOutOfProvinceList.value =
|
purchaseOutOfProvinceList.value = Resource<PaginationModel<StewardFreeBar>>.empty();
|
||||||
Resource<PaginationModel<StewardFreeBar>>.empty();
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,12 @@ import 'dart:io';
|
|||||||
import 'package:flutter/cupertino.dart' hide Image;
|
import 'package:flutter/cupertino.dart' hide Image;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar/steward_free_bar.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.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_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
import '../../../common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionBuyOutOfProvincePage
|
class WarehouseAndDistributionBuyOutOfProvincePage
|
||||||
@@ -55,8 +54,7 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
},
|
},
|
||||||
itemCount: data.value.data?.results?.length ?? 0,
|
itemCount: data.value.data?.results?.length ?? 0,
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
||||||
onLoadMore: () async =>
|
onLoadMore: () async => controller.getStewardPurchaseOutOfProvince(true),
|
||||||
controller.getStewardPurchaseOutOfProvince(true),
|
|
||||||
);
|
);
|
||||||
}, controller.purchaseOutOfProvinceList),
|
}, controller.purchaseOutOfProvinceList),
|
||||||
],
|
],
|
||||||
@@ -85,10 +83,7 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
Container itemListExpandedWidget(StewardFreeBar item) {
|
Container itemListExpandedWidget(StewardFreeBar 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: [
|
||||||
@@ -120,16 +115,12 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -147,10 +138,7 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
buildRow(
|
buildRow(title: 'مشخصات فروشنده', value: item.killHouseName ?? 'ندارد'),
|
||||||
title: 'مشخصات فروشنده',
|
|
||||||
value: item.killHouseName ?? 'ندارد',
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'تلفن فروشنده',
|
title: 'تلفن فروشنده',
|
||||||
@@ -172,10 +160,7 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
valueWidget: Assets.vec.clipboardEyeSvg.svg(
|
valueWidget: Assets.vec.clipboardEyeSvg.svg(
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 24,
|
height: 24,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||||
AppColor.blueNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.bottomSheet(
|
Get.bottomSheet(
|
||||||
@@ -186,9 +171,7 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'بارنامه',
|
'بارنامه',
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Image.network(
|
Image.network(
|
||||||
@@ -237,8 +220,7 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
height: 40.h,
|
height: 40.h,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
buildDeleteDialog(
|
buildDeleteDialog(
|
||||||
onConfirm: () => controller
|
onConfirm: () => controller.deleteStewardPurchaseOutOfProvince(item.key!),
|
||||||
.deleteStewardPurchaseOutOfProvince(item.key!),
|
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
controller.rootLogic.onRefresh();
|
controller.rootLogic.onRefresh();
|
||||||
controller.onRefresh();
|
controller.onRefresh();
|
||||||
@@ -296,18 +278,13 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
child: Assets.vec.hotChickenSvg.svg(
|
child: Assets.vec.hotChickenSvg.svg(
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||||
AppColor.blueNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${item.weightOfCarcasses?.separatedByCommaFa}kg',
|
'${item.weightOfCarcasses?.separatedByCommaFa}kg',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -355,8 +332,8 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
isOnEdit ? 'ویرایش اطلاعات خرید' : 'ثبت اطلاعات خرید',
|
isOnEdit ? 'ویرایش اطلاعات خرید' : 'ثبت اطلاعات خرید',
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||||
),
|
),
|
||||||
//_productDropDown(),
|
|
||||||
|
|
||||||
|
//_productDropDown(),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -365,10 +342,7 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||||
),
|
),
|
||||||
|
|
||||||
child: Column(
|
child: Column(spacing: 12, children: [_provinceWidget(), _cityWidget()]),
|
||||||
spacing: 12,
|
|
||||||
children: [_provinceWidget(), _cityWidget()],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Container(
|
Container(
|
||||||
@@ -467,7 +441,7 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Widget _productDropDown() {
|
/* Widget _productDropDown() {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
return OverlayDropdownWidget<ProductModel>(
|
return OverlayDropdownWidget<ProductModel>(
|
||||||
items: controller.rootLogic.rolesProductsModel,
|
items: controller.rootLogic.rolesProductsModel,
|
||||||
@@ -511,15 +485,10 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker),
|
style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker),
|
||||||
),
|
),
|
||||||
labelBuilder: (item) => item?.name != null
|
labelBuilder: (item) => item?.name != null
|
||||||
? Text(
|
? Text(item!.name!, style: AppFonts.yekan14.copyWith(color: AppColor.textColor))
|
||||||
item!.name!,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
)
|
|
||||||
: Text(
|
: Text(
|
||||||
'انتخاب استان',
|
'انتخاب استان',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight),
|
||||||
color: AppColor.textColorLight,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -538,16 +507,8 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker),
|
style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker),
|
||||||
),
|
),
|
||||||
labelBuilder: (item) => item?.name != null
|
labelBuilder: (item) => item?.name != null
|
||||||
? Text(
|
? Text(item!.name!, style: AppFonts.yekan14.copyWith(color: AppColor.textColor))
|
||||||
item!.name!,
|
: Text('انتخاب شهر', style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight)),
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
)
|
|
||||||
: Text(
|
|
||||||
'انتخاب شهر',
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.textColorLight,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}, controller.cites);
|
}, controller.cites);
|
||||||
}
|
}
|
||||||
@@ -563,12 +524,7 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
child: Column(
|
child: Column(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text('بارنامه', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)),
|
||||||
'بارنامه',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ObxValue((data) {
|
child: ObxValue((data) {
|
||||||
return Container(
|
return Container(
|
||||||
@@ -584,21 +540,10 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
? Image.network(controller.editImageUrl.value ?? '')
|
? Image.network(controller.editImageUrl.value ?? '')
|
||||||
: data.value == null
|
: data.value == null
|
||||||
? Padding(
|
? Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(30, 10, 10, 30),
|
||||||
30,
|
child: Assets.vec.placeHolderSvg.svg(width: 200.w, height: 150.h),
|
||||||
10,
|
|
||||||
10,
|
|
||||||
30,
|
|
||||||
),
|
|
||||||
child: Assets.vec.placeHolderSvg.svg(
|
|
||||||
width: 200.w,
|
|
||||||
height: 150.h,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
: Image.file(
|
: Image.file(File(data.value!.path), fit: BoxFit.cover),
|
||||||
File(data.value!.path),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}, controller.selectedImage),
|
}, controller.selectedImage),
|
||||||
@@ -614,14 +559,12 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
height: 40.h,
|
height: 40.h,
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
controller.selectedImage.value = await controller
|
controller.selectedImage.value = await controller.imagePicker.pickImage(
|
||||||
.imagePicker
|
source: ImageSource.gallery,
|
||||||
.pickImage(
|
imageQuality: 60,
|
||||||
source: ImageSource.gallery,
|
maxWidth: 1080,
|
||||||
imageQuality: 60,
|
maxHeight: 720,
|
||||||
maxWidth: 1080,
|
);
|
||||||
maxHeight: 720,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
@@ -629,18 +572,14 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
text: 'دوربین',
|
text: 'دوربین',
|
||||||
width: 150.w,
|
width: 150.w,
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
textStyle: AppFonts.yekan20.copyWith(
|
textStyle: AppFonts.yekan20.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
controller.selectedImage.value = await controller
|
controller.selectedImage.value = await controller.imagePicker.pickImage(
|
||||||
.imagePicker
|
source: ImageSource.camera,
|
||||||
.pickImage(
|
imageQuality: 60,
|
||||||
source: ImageSource.camera,
|
maxWidth: 1080,
|
||||||
imageQuality: 60,
|
maxHeight: 720,
|
||||||
maxWidth: 1080,
|
);
|
||||||
maxHeight: 720,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -658,18 +597,14 @@ class WarehouseAndDistributionBuyOutOfProvincePage
|
|||||||
child: Column(
|
child: Column(
|
||||||
spacing: 16,
|
spacing: 16,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)),
|
||||||
'فیلترها',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: dateFilterWidget(
|
child: dateFilterWidget(
|
||||||
date: controller.fromDateFilter,
|
date: controller.fromDateFilter,
|
||||||
onChanged: (jalali) =>
|
onChanged: (jalali) => controller.fromDateFilter.value = jalali,
|
||||||
controller.fromDateFilter.value = jalali,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/root/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionHomeLogic extends GetxController {
|
class WarehouseAndDistributionHomeLogic extends GetxController {
|
||||||
WarehouseAndDistributionRootLogic rootLogic =
|
WarehouseAndDistributionRootLogic rootLogic = Get.find<WarehouseAndDistributionRootLogic>();
|
||||||
Get.find<WarehouseAndDistributionRootLogic>();
|
|
||||||
|
|
||||||
RxList<Map<String, String?>> inventoryItems = [
|
RxList<Map<String, String?>> inventoryItems = [
|
||||||
{'خریدهای دولتی داخل استان': null},
|
{'خریدهای دولتی داخل استان': null},
|
||||||
@@ -35,12 +31,6 @@ class WarehouseAndDistributionHomeLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> refreshData() async {
|
Future<void> refreshData() async {
|
||||||
await Future.wait([
|
await Future.wait([rootLogic.getRolesProducts(), rootLogic.getInfoSaleDashboard()]);
|
||||||
rootLogic.getRolesProducts(),
|
|
||||||
rootLogic.getInfoSaleDashboard(),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import 'package:flutter/cupertino.dart' hide LinearGradient;
|
import 'package:flutter/cupertino.dart' hide LinearGradient;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.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_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
import '../../../common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
||||||
|
import '../../../common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionHomePage
|
class WarehouseAndDistributionHomePage extends GetView<WarehouseAndDistributionHomeLogic> {
|
||||||
extends GetView<WarehouseAndDistributionHomeLogic> {
|
|
||||||
const WarehouseAndDistributionHomePage({super.key});
|
const WarehouseAndDistributionHomePage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -77,10 +76,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
AnimatedRotation(
|
AnimatedRotation(
|
||||||
turns: 180,
|
turns: 180,
|
||||||
duration: Duration(milliseconds: 3000),
|
duration: Duration(milliseconds: 3000),
|
||||||
child: Icon(
|
child: Icon(CupertinoIcons.chevron_up, size: 18),
|
||||||
CupertinoIcons.chevron_up,
|
|
||||||
size: 18,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -104,9 +100,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
Row(
|
Row(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [Icon(CupertinoIcons.chevron_down, size: 18)],
|
||||||
Icon(CupertinoIcons.chevron_down, size: 18),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
_dashboradWidget1(),
|
_dashboradWidget1(),
|
||||||
_dashboradWidget2(),
|
_dashboradWidget2(),
|
||||||
@@ -133,17 +127,12 @@ class WarehouseAndDistributionHomePage
|
|||||||
Assets.vec.chicken2Svg.svg(
|
Assets.vec.chicken2Svg.svg(
|
||||||
width: 24.w,
|
width: 24.w,
|
||||||
height: 24.h,
|
height: 24.h,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(AppColor.blueDark, BlendMode.srcIn),
|
||||||
AppColor.blueDark,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'اطلاعات مرغ گرم',
|
'اطلاعات مرغ گرم',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
|
||||||
color: AppColor.iconColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -167,8 +156,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
titleColor: AppColor.textColor,
|
titleColor: AppColor.textColor,
|
||||||
borderColor: Color(0xFFFFAE00),
|
borderColor: Color(0xFFFFAE00),
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.realAllocatedWeight.separatedByCommaFa ?? '0',
|
||||||
data.value?.realAllocatedWeight.separatedByCommaFa ?? '0',
|
|
||||||
icon: Container(
|
icon: Container(
|
||||||
width: 24.w,
|
width: 24.w,
|
||||||
height: 24.h,
|
height: 24.h,
|
||||||
@@ -180,10 +168,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
child: Assets.vec.cubeScanSvg.svg(
|
child: Assets.vec.cubeScanSvg.svg(
|
||||||
width: 12.w,
|
width: 12.w,
|
||||||
height: 12.h,
|
height: 12.h,
|
||||||
colorFilter: const ColorFilter.mode(
|
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||||
Colors.white,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bgDescriptionColor: Colors.white,
|
bgDescriptionColor: Colors.white,
|
||||||
@@ -203,8 +188,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
title: 'مانده انبار',
|
title: 'مانده انبار',
|
||||||
borderColor: const Color(0xFF9758FF),
|
borderColor: const Color(0xFF9758FF),
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.totalRemainWeight.separatedByCommaFa ?? '0',
|
||||||
data.value?.totalRemainWeight.separatedByCommaFa ?? '0',
|
|
||||||
unit: 'کیلوگرم',
|
unit: 'کیلوگرم',
|
||||||
icon: Container(
|
icon: Container(
|
||||||
width: 24.w,
|
width: 24.w,
|
||||||
@@ -217,10 +201,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
child: Assets.vec.cubeCardFreeSvg.svg(
|
child: Assets.vec.cubeCardFreeSvg.svg(
|
||||||
width: 12.w,
|
width: 12.w,
|
||||||
height: 12.h,
|
height: 12.h,
|
||||||
colorFilter: const ColorFilter.mode(
|
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||||
Colors.white,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bgDescriptionColor: Colors.white,
|
bgDescriptionColor: Colors.white,
|
||||||
@@ -248,12 +229,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
child: _informationLabelCard(
|
child: _informationLabelCard(
|
||||||
title: 'مانده دولتی',
|
title: 'مانده دولتی',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.totalGovernmentalRemainWeight?.separatedByCommaFa ?? '0',
|
||||||
data
|
|
||||||
.value
|
|
||||||
?.totalGovernmentalRemainWeight
|
|
||||||
?.separatedByCommaFa ??
|
|
||||||
'0',
|
|
||||||
iconPath: Assets.vec.cubeCardGovermentSvg.path,
|
iconPath: Assets.vec.cubeCardGovermentSvg.path,
|
||||||
iconColor: AppColor.textColor,
|
iconColor: AppColor.textColor,
|
||||||
bgDescriptionColor: const Color(0xFFF5ECEE),
|
bgDescriptionColor: const Color(0xFFF5ECEE),
|
||||||
@@ -264,8 +240,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
child: _informationLabelCard(
|
child: _informationLabelCard(
|
||||||
title: 'مانده آزاد',
|
title: 'مانده آزاد',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.totalFreeRemainWeight.separatedByCommaFa ?? '0',
|
||||||
data.value?.totalFreeRemainWeight.separatedByCommaFa ?? '0',
|
|
||||||
unit: 'کیلوگرم',
|
unit: 'کیلوگرم',
|
||||||
iconPath: Assets.vec.cubeCardFreeSvg.path,
|
iconPath: Assets.vec.cubeCardFreeSvg.path,
|
||||||
iconColor: AppColor.textColor,
|
iconColor: AppColor.textColor,
|
||||||
@@ -287,11 +262,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
Text(
|
Text('اطلاعات پخش', textAlign: TextAlign.right, style: AppFonts.yekan16),
|
||||||
'اطلاعات پخش',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.h),
|
SizedBox(height: 8.h),
|
||||||
@@ -304,8 +275,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
title: 'وزن دولتی',
|
title: 'وزن دولتی',
|
||||||
titleBgColor: const Color(0xFFB8E7DC),
|
titleBgColor: const Color(0xFFB8E7DC),
|
||||||
valueBgColor: const Color(0xFFE6FAF5),
|
valueBgColor: const Color(0xFFE6FAF5),
|
||||||
value:
|
value: data.value?.totalGovernmentalInputWeight.separatedByComma,
|
||||||
data.value?.totalGovernmentalInputWeight.separatedByComma,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -319,10 +289,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: broadcastItem(
|
child: broadcastItem(
|
||||||
title: 'فروش دولتی',
|
title: 'فروش دولتی',
|
||||||
value: data
|
value: data.value?.totalGovernmentalOutputWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalGovernmentalOutputWeight
|
|
||||||
.separatedByComma,
|
|
||||||
titleBgColor: const Color(0xFFEBC4CE),
|
titleBgColor: const Color(0xFFEBC4CE),
|
||||||
valueBgColor: const Color(0xFFEDDCE0),
|
valueBgColor: const Color(0xFFEDDCE0),
|
||||||
),
|
),
|
||||||
@@ -348,8 +315,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
title: 'وزن انجماد',
|
title: 'وزن انجماد',
|
||||||
titleBgColor: const Color(0xFFEBC4CE),
|
titleBgColor: const Color(0xFFEBC4CE),
|
||||||
valueBgColor: const Color(0xFFEDDCE0),
|
valueBgColor: const Color(0xFFEDDCE0),
|
||||||
value:
|
value: data.value?.coldHouseAllocationsWeight.separatedByComma,
|
||||||
data.value?.coldHouseAllocationsWeight.separatedByComma,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -387,10 +353,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: broadcastItem(
|
child: broadcastItem(
|
||||||
title: 'فروش و توزیع داخل استان',
|
title: 'فروش و توزیع داخل استان',
|
||||||
value: data
|
value: data.value?.totalKillHouseAllocationsWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalKillHouseAllocationsWeight
|
|
||||||
.separatedByComma,
|
|
||||||
titleBgColor: const Color(0xFFEBC4CE),
|
titleBgColor: const Color(0xFFEBC4CE),
|
||||||
valueBgColor: const Color(0xFFEDDCE0),
|
valueBgColor: const Color(0xFFEDDCE0),
|
||||||
),
|
),
|
||||||
@@ -398,10 +361,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: broadcastItem(
|
child: broadcastItem(
|
||||||
title: 'فروش و توزیع خارج استان',
|
title: 'فروش و توزیع خارج استان',
|
||||||
value: data
|
value: data.value?.totalKillHouseFreeSaleBarCarcassesWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalKillHouseFreeSaleBarCarcassesWeight
|
|
||||||
.separatedByComma,
|
|
||||||
titleBgColor: const Color(0xFFC2D3F2),
|
titleBgColor: const Color(0xFFC2D3F2),
|
||||||
valueBgColor: const Color(0xFFECF2FF),
|
valueBgColor: const Color(0xFFECF2FF),
|
||||||
),
|
),
|
||||||
@@ -488,9 +448,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
child: _informationLabelCard(
|
child: _informationLabelCard(
|
||||||
title: 'خارج استان',
|
title: 'خارج استان',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.freeBuyingCarcassesWeight.separatedByCommaFa ?? '0',
|
||||||
data.value?.freeBuyingCarcassesWeight.separatedByCommaFa ??
|
|
||||||
'0',
|
|
||||||
iconPath: Assets.vec.cubeSearchSvg.path,
|
iconPath: Assets.vec.cubeSearchSvg.path,
|
||||||
iconColor: Color(0xFF2D5FFF),
|
iconColor: Color(0xFF2D5FFF),
|
||||||
bgLabelColor: const Color(0xFFAFCBFF),
|
bgLabelColor: const Color(0xFFAFCBFF),
|
||||||
@@ -518,8 +476,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
children: [
|
children: [
|
||||||
inventoryListItem(
|
inventoryListItem(
|
||||||
title: 'خریدهای دولتی داخل استان',
|
title: 'خریدهای دولتی داخل استان',
|
||||||
value:
|
value: model?.provinceGovernmentalCarcassesWeight?.separatedByComma,
|
||||||
model?.provinceGovernmentalCarcassesWeight?.separatedByComma,
|
|
||||||
),
|
),
|
||||||
Divider(),
|
Divider(),
|
||||||
inventoryListItem(
|
inventoryListItem(
|
||||||
@@ -560,25 +517,14 @@ class WarehouseAndDistributionHomePage
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: const Color(0xFF353535), height: 1.2),
|
||||||
color: const Color(0xFF353535),
|
|
||||||
height: 1.2,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
value == null
|
value == null
|
||||||
? Center(child: CupertinoActivityIndicator())
|
? Center(child: CupertinoActivityIndicator())
|
||||||
: Text(
|
: Text(value, style: AppFonts.yekan14.copyWith(color: const Color(0xFF353535))),
|
||||||
value,
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: const Color(0xFF353535),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Text(
|
Text('کیلوگرم', style: AppFonts.yekan10.copyWith(color: const Color(0xFF353535))),
|
||||||
'کیلوگرم',
|
|
||||||
style: AppFonts.yekan10.copyWith(color: const Color(0xFF353535)),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -604,9 +550,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
height: 65.h,
|
height: 65.h,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
border: borderColor != null
|
border: borderColor != null ? Border.all(width: 1, color: borderColor) : null,
|
||||||
? Border.all(width: 1, color: borderColor)
|
|
||||||
: null,
|
|
||||||
),
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -669,16 +613,12 @@ class WarehouseAndDistributionHomePage
|
|||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style:
|
style:
|
||||||
descriptionStyle ??
|
descriptionStyle ??
|
||||||
AppFonts.yekan16.copyWith(
|
AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
unit,
|
unit,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -724,9 +664,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
isLoading
|
isLoading
|
||||||
@@ -734,16 +672,12 @@ class WarehouseAndDistributionHomePage
|
|||||||
: Text(
|
: Text(
|
||||||
description,
|
description,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
unit,
|
unit,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -803,14 +737,8 @@ class WarehouseAndDistributionHomePage
|
|||||||
'کل ورودی به انبار (کیلوگرم)',
|
'کل ورودی به انبار (کیلوگرم)',
|
||||||
model.totalFreeBarsCarcassesWeight.toString(),
|
model.totalFreeBarsCarcassesWeight.toString(),
|
||||||
),
|
),
|
||||||
buildRow(
|
buildRow('کل فروش (کیلوگرم)', model.realAllocatedWeight.toString()),
|
||||||
'کل فروش (کیلوگرم)',
|
buildRow('مانده انبار (کیلوگرم)', model.totalRemainWeight.toString()),
|
||||||
model.realAllocatedWeight.toString(),
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
'مانده انبار (کیلوگرم)',
|
|
||||||
model.totalRemainWeight.toString(),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -829,9 +757,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
@@ -839,9 +765,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
child: Text(
|
child: Text(
|
||||||
value,
|
value,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -867,9 +791,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
Text(
|
Text(
|
||||||
'اطلاعات ارسالی',
|
'اطلاعات ارسالی',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
buildRow(
|
buildRow(
|
||||||
@@ -902,10 +824,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
return Container(
|
return Container(
|
||||||
height: height?.h ?? 73.h,
|
height: height?.h ?? 73.h,
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(color: valueBgColor, borderRadius: BorderRadius.circular(8)),
|
||||||
color: valueBgColor,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
@@ -918,9 +837,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
Text(
|
Text(
|
||||||
title ?? 'بدون تیتر',
|
title ?? 'بدون تیتر',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style:
|
style: titleStyle ?? AppFonts.yekan12.copyWith(color: const Color(0xFF3E3E3E)),
|
||||||
titleStyle ??
|
|
||||||
AppFonts.yekan12.copyWith(color: const Color(0xFF3E3E3E)),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -933,9 +850,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
child: Text(
|
child: Text(
|
||||||
value,
|
value,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style:
|
style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||||
valueStyle ??
|
|
||||||
AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Center(child: CupertinoActivityIndicator()),
|
: Center(child: CupertinoActivityIndicator()),
|
||||||
@@ -943,9 +858,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
Text(
|
Text(
|
||||||
unit ?? 'کیلوگرم',
|
unit ?? 'کیلوگرم',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style:
|
style: unitStyle ?? AppFonts.yekan10.copyWith(color: Color(0xFF717171)),
|
||||||
unitStyle ??
|
|
||||||
AppFonts.yekan10.copyWith(color: Color(0xFF717171)),
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 4.h),
|
SizedBox(height: 4.h),
|
||||||
],
|
],
|
||||||
@@ -997,29 +910,19 @@ class WarehouseAndDistributionHomePage
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
Text(
|
Text('تعهدات', textAlign: TextAlign.right, style: AppFonts.yekan16),
|
||||||
'تعهدات',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
commitmentsItemList(
|
commitmentsItemList(
|
||||||
title: 'تعهد دولتی توزیع داخل استان',
|
title: 'تعهد دولتی توزیع داخل استان',
|
||||||
value: data
|
value: data.value?.totalCommitmentSellingInProvinceGovernmentalWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalCommitmentSellingInProvinceGovernmentalWeight
|
|
||||||
.separatedByComma,
|
|
||||||
labelColor: const Color(0xFFB9E8DC),
|
labelColor: const Color(0xFFB9E8DC),
|
||||||
bgColor: const Color(0xFFF3F9F8),
|
bgColor: const Color(0xFFF3F9F8),
|
||||||
),
|
),
|
||||||
commitmentsItemList(
|
commitmentsItemList(
|
||||||
title: 'توزیع دولتی داخل استان',
|
title: 'توزیع دولتی داخل استان',
|
||||||
value: data
|
value: data.value?.totalSellingInProvinceGovernmentalWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalSellingInProvinceGovernmentalWeight
|
|
||||||
.separatedByComma,
|
|
||||||
labelColor: const Color(0xFFC3D4F3),
|
labelColor: const Color(0xFFC3D4F3),
|
||||||
bgColor: const Color(0xFFECF3FF),
|
bgColor: const Color(0xFFECF3FF),
|
||||||
),
|
),
|
||||||
@@ -1034,26 +937,19 @@ class WarehouseAndDistributionHomePage
|
|||||||
),
|
),
|
||||||
commitmentsItemList(
|
commitmentsItemList(
|
||||||
title: 'تعهد آزاد توزیع داخل استان',
|
title: 'تعهد آزاد توزیع داخل استان',
|
||||||
value: data
|
value: data.value?.totalCommitmentSellingInProvinceFreeWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalCommitmentSellingInProvinceFreeWeight
|
|
||||||
.separatedByComma,
|
|
||||||
labelColor: const Color(0xFFC7DADA),
|
labelColor: const Color(0xFFC7DADA),
|
||||||
bgColor: const Color(0xFFE5F7F7),
|
bgColor: const Color(0xFFE5F7F7),
|
||||||
),
|
),
|
||||||
commitmentsItemList(
|
commitmentsItemList(
|
||||||
title: 'توزیع آزاد داخل استان',
|
title: 'توزیع آزاد داخل استان',
|
||||||
value:
|
value: data.value?.totalSellingInProvinceFreeWeight.separatedByComma,
|
||||||
data.value?.totalSellingInProvinceFreeWeight.separatedByComma,
|
|
||||||
labelColor: const Color(0xFFE0D6ED),
|
labelColor: const Color(0xFFE0D6ED),
|
||||||
bgColor: const Color(0xFFF5EDFF),
|
bgColor: const Color(0xFFF5EDFF),
|
||||||
),
|
),
|
||||||
commitmentsItemList(
|
commitmentsItemList(
|
||||||
title: 'باقیمانده تعهد آزاد توزیع داخل استان',
|
title: 'باقیمانده تعهد آزاد توزیع داخل استان',
|
||||||
value: data
|
value: data.value?.totalCommitmentSellingInProvinceFreeRemainWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalCommitmentSellingInProvinceFreeRemainWeight
|
|
||||||
.separatedByComma,
|
|
||||||
labelColor: const Color(0xFFEBC5CE),
|
labelColor: const Color(0xFFEBC5CE),
|
||||||
bgColor: const Color(0xFFFFF1F4),
|
bgColor: const Color(0xFFFFF1F4),
|
||||||
),
|
),
|
||||||
@@ -1098,9 +994,7 @@ class WarehouseAndDistributionHomePage
|
|||||||
: Text(
|
: Text(
|
||||||
value,
|
value,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 8.w),
|
SizedBox(width: 8.w),
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,6 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/kill_house_module/warehouse_and_distribution/response/kill_house_sales_info_dashboard/kill_house_sales_info_dashboard.dart';
|
import 'package:rasadyar_chicken/data/models/kill_house_module/warehouse_and_distribution/response/kill_house_sales_info_dashboard/kill_house_sales_info_dashboard.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/local/widely_used_local_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
|
||||||
hide ProductModel;
|
|
||||||
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/repositories/kill_house/kill_house_repository.dart';
|
import 'package:rasadyar_chicken/data/repositories/kill_house/kill_house_repository.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/profile/view.dart';
|
import 'package:rasadyar_chicken/features/common/profile/view.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/buy/view.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/buy/view.dart';
|
||||||
@@ -23,6 +15,14 @@ import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
|||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
import '../../../common/data/model/local/widely_used_local_model.dart';
|
||||||
|
import '../../../common/data/model/response/broadcast_price/broadcast_price.dart';
|
||||||
|
import '../../../common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
|
import '../../../common/data/model/response/roles_products/roles_products.dart';
|
||||||
|
import '../../../steward/data/model/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
|
import '../../../steward/data/model/response/waiting_arrival/waiting_arrival.dart'
|
||||||
|
hide ProductModel;
|
||||||
|
|
||||||
enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
||||||
|
|
||||||
class WarehouseAndDistributionRootLogic extends GetxController {
|
class WarehouseAndDistributionRootLogic extends GetxController {
|
||||||
@@ -41,7 +41,6 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
];
|
];
|
||||||
|
|
||||||
late KillHouseRepository killHouseRepository;
|
late KillHouseRepository killHouseRepository;
|
||||||
late ChickenRepository chickenRepository;
|
|
||||||
|
|
||||||
final defaultRoutes = <int, String>{
|
final defaultRoutes = <int, String>{
|
||||||
0: ChickenRoutes.buyWarehouseAndDistribution,
|
0: ChickenRoutes.buyWarehouseAndDistribution,
|
||||||
@@ -52,8 +51,7 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
Rxn<WidelyUsedLocalModel> widelyUsedList = Rxn<WidelyUsedLocalModel>();
|
Rxn<WidelyUsedLocalModel> widelyUsedList = Rxn<WidelyUsedLocalModel>();
|
||||||
|
|
||||||
Rxn<BroadcastPrice> broadcastPrice = Rxn<BroadcastPrice>();
|
Rxn<BroadcastPrice> broadcastPrice = Rxn<BroadcastPrice>();
|
||||||
Rxn<KillHouseSalesInfoDashboard> salesInfoDashboard =
|
Rxn<KillHouseSalesInfoDashboard> salesInfoDashboard = Rxn<KillHouseSalesInfoDashboard>();
|
||||||
Rxn<KillHouseSalesInfoDashboard>();
|
|
||||||
Rxn<StewardRemainWeight> remainWeight = Rxn<StewardRemainWeight>();
|
Rxn<StewardRemainWeight> remainWeight = Rxn<StewardRemainWeight>();
|
||||||
|
|
||||||
RxList<ErrorLocationType> errorLocationType = RxList();
|
RxList<ErrorLocationType> errorLocationType = RxList();
|
||||||
@@ -70,7 +68,6 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
killHouseRepository = diChicken.get<KillHouseRepository>();
|
killHouseRepository = diChicken.get<KillHouseRepository>();
|
||||||
chickenRepository = diChicken.get<ChickenRepository>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -122,9 +119,8 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
_inventoryCancelToken = CancelToken();
|
_inventoryCancelToken = CancelToken();
|
||||||
|
|
||||||
await safeCall<KillHouseSalesInfoDashboard?>(
|
await safeCall<KillHouseSalesInfoDashboard?>(
|
||||||
call: () async => await killHouseRepository.getInfoDashboard(
|
call: () async =>
|
||||||
token: tokenService.accessToken.value!,
|
await killHouseRepository.getInfoDashboard(token: tokenService.accessToken.value!),
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
salesInfoDashboard.value = result;
|
salesInfoDashboard.value = result;
|
||||||
@@ -155,13 +151,13 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
_provincesCancelToken = CancelToken();
|
_provincesCancelToken = CancelToken();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final res = await chickenRepository.getProvince(
|
/* final res = await chickenRepository.getProvince(
|
||||||
cancelToken: _provincesCancelToken,
|
cancelToken: _provincesCancelToken,
|
||||||
);
|
);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
provinces.clear();
|
provinces.clear();
|
||||||
provinces.value = res;
|
provinces.value = res;
|
||||||
}
|
}*/
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e is DioException && e.type == DioExceptionType.cancel) {
|
if (e is DioException && e.type == DioExceptionType.cancel) {
|
||||||
// Request was cancelled, ignore the error
|
// Request was cancelled, ignore the error
|
||||||
@@ -172,7 +168,7 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getBroadcastPrice() async {
|
Future<void> getBroadcastPrice() async {
|
||||||
safeCall(
|
/* safeCall(
|
||||||
call: () async => await chickenRepository.getBroadcastPrice(
|
call: () async => await chickenRepository.getBroadcastPrice(
|
||||||
token: tokenService.accessToken.value!,
|
token: tokenService.accessToken.value!,
|
||||||
),
|
),
|
||||||
@@ -180,11 +176,11 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
broadcastPrice.value = result;
|
broadcastPrice.value = result;
|
||||||
},
|
},
|
||||||
onError: (error, stacktrace) {},
|
onError: (error, stacktrace) {},
|
||||||
);
|
);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getRolesProducts() async {
|
Future<void> getRolesProducts() async {
|
||||||
await safeCall(
|
/*await safeCall(
|
||||||
call: () async => await chickenRepository.getRolesProducts(
|
call: () async => await chickenRepository.getRolesProducts(
|
||||||
token: tokenService.accessToken.value!,
|
token: tokenService.accessToken.value!,
|
||||||
queryParameters: buildRawQueryParams(role: 'KillHouse'),
|
queryParameters: buildRawQueryParams(role: 'KillHouse'),
|
||||||
@@ -195,7 +191,7 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError: (error, stacktrace) {},
|
onError: (error, stacktrace) {},
|
||||||
);
|
);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNestedKey() {
|
int getNestedKey() {
|
||||||
@@ -228,8 +224,7 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
currentNestedKey?.currentState?.popUntil((route) => route.isFirst);
|
currentNestedKey?.currentState?.popUntil((route) => route.isFirst);
|
||||||
} else {
|
} else {
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
if (_lastBackPressed == null ||
|
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
||||||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
|
||||||
_lastBackPressed = now;
|
_lastBackPressed = now;
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'خروج از برنامه',
|
'خروج از برنامه',
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/chicken.dart';
|
import 'package:rasadyar_chicken/chicken.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/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_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionRootPage
|
import '../../../common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
||||||
extends GetView<WarehouseAndDistributionRootLogic> {
|
|
||||||
|
class WarehouseAndDistributionRootPage extends GetView<WarehouseAndDistributionRootLogic> {
|
||||||
WarehouseAndDistributionRootPage({super.key});
|
WarehouseAndDistributionRootPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -27,8 +27,7 @@ class WarehouseAndDistributionRootPage
|
|||||||
final page = ChickenPages.pages.firstWhere(
|
final page = ChickenPages.pages.firstWhere(
|
||||||
(e) => e.name == settings.name,
|
(e) => e.name == settings.name,
|
||||||
orElse: () => ChickenPages.pages.firstWhere(
|
orElse: () => ChickenPages.pages.firstWhere(
|
||||||
(e) =>
|
(e) => e.name == ChickenRoutes.buyWarehouseAndDistribution,
|
||||||
e.name == ChickenRoutes.buyWarehouseAndDistribution,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -41,9 +40,7 @@ class WarehouseAndDistributionRootPage
|
|||||||
final page = ChickenPages.pages.firstWhere(
|
final page = ChickenPages.pages.firstWhere(
|
||||||
(e) => e.name == settings.name,
|
(e) => e.name == settings.name,
|
||||||
orElse: () => ChickenPages.pages.firstWhere(
|
orElse: () => ChickenPages.pages.firstWhere(
|
||||||
(e) =>
|
(e) => e.name == ChickenRoutes.saleWarehouseAndDistribution,
|
||||||
e.name ==
|
|
||||||
ChickenRoutes.saleWarehouseAndDistribution,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -52,18 +49,15 @@ class WarehouseAndDistributionRootPage
|
|||||||
),
|
),
|
||||||
Navigator(
|
Navigator(
|
||||||
key: Get.nestedKey(stewardThirdKey),
|
key: Get.nestedKey(stewardThirdKey),
|
||||||
onGenerateRoute: (settings) =>
|
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[2]),
|
||||||
GetPageRoute(page: () => controller.pages[2]),
|
|
||||||
),
|
),
|
||||||
Navigator(
|
Navigator(
|
||||||
key: Get.nestedKey(stewardFourthKey),
|
key: Get.nestedKey(stewardFourthKey),
|
||||||
onGenerateRoute: (settings) =>
|
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[3]),
|
||||||
GetPageRoute(page: () => controller.pages[3]),
|
|
||||||
),
|
),
|
||||||
Navigator(
|
Navigator(
|
||||||
key: Get.nestedKey(stewardFifthKey),
|
key: Get.nestedKey(stewardFifthKey),
|
||||||
onGenerateRoute: (settings) =>
|
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[4]),
|
||||||
GetPageRoute(page: () => controller.pages[4]),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
index: data.value,
|
index: data.value,
|
||||||
@@ -159,10 +153,7 @@ class WarehouseAndDistributionRootPage
|
|||||||
return Container(
|
return Container(
|
||||||
height: 70,
|
height: 70,
|
||||||
width: Get.width / 2,
|
width: Get.width / 2,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -183,9 +174,7 @@ class WarehouseAndDistributionRootPage
|
|||||||
Text(
|
Text(
|
||||||
'بارهای امروز',
|
'بارهای امروز',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -252,9 +241,7 @@ class WarehouseAndDistributionRootPage
|
|||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -277,16 +264,12 @@ class WarehouseAndDistributionRootPage
|
|||||||
Text(
|
Text(
|
||||||
description,
|
description,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
unit,
|
unit,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -331,23 +314,17 @@ class WarehouseAndDistributionRootPage
|
|||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
description,
|
description,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
unit,
|
unit,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -395,18 +372,14 @@ class WarehouseAndDistributionRootPage
|
|||||||
padding: EdgeInsets.all(4),
|
padding: EdgeInsets.all(4),
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: const Color(0xFFBECDFF),
|
color: const Color(0xFFBECDFF),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 40,
|
width: 40,
|
||||||
height: 40,
|
height: 40,
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: AppColor.blueNormal,
|
color: AppColor.blueNormal,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: SvgGenImage.vec(iconPath).svg(
|
child: SvgGenImage.vec(iconPath).svg(
|
||||||
width: 24,
|
width: 24,
|
||||||
@@ -416,10 +389,7 @@ class WarehouseAndDistributionRootPage
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(title, style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
|
||||||
title,
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -436,29 +406,20 @@ class WarehouseAndDistributionRootPage
|
|||||||
padding: EdgeInsets.all(4),
|
padding: EdgeInsets.all(4),
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: const Color(0xFFD9F7F0),
|
color: const Color(0xFFD9F7F0),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Assets.vec.messageAddSvg.svg(
|
child: Assets.vec.messageAddSvg.svg(
|
||||||
width: 40,
|
width: 40,
|
||||||
height: 40,
|
height: 40,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(AppColor.greenNormal, BlendMode.srcIn),
|
||||||
AppColor.greenNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text('افزودن', style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover)),
|
||||||
'افزودن',
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget buildRow(String title, String value) {
|
Widget buildRow(String title, String value) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
@@ -470,9 +431,7 @@ class WarehouseAndDistributionRootPage
|
|||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
@@ -480,9 +439,7 @@ class WarehouseAndDistributionRootPage
|
|||||||
child: Text(
|
child: Text(
|
||||||
value,
|
value,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -508,9 +465,7 @@ class WarehouseAndDistributionRootPage
|
|||||||
Text(
|
Text(
|
||||||
'اطلاعات ارسالی',
|
'اطلاعات ارسالی',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
buildRow(
|
buildRow(
|
||||||
|
|||||||
@@ -1,23 +1,22 @@
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
||||||
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionSaleLogic extends GetxController {
|
class WarehouseAndDistributionSaleLogic extends GetxController {
|
||||||
Rxn<List<AllocatedMadeModel>?> allocatedMadeModel =
|
Rxn<List<AllocatedMadeModel>?> allocatedMadeModel = Rxn<List<AllocatedMadeModel>?>();
|
||||||
Rxn<List<AllocatedMadeModel>?>();
|
|
||||||
|
|
||||||
RxList<GuildModel> guildsModel = <GuildModel>[].obs;
|
RxList<GuildModel> guildsModel = <GuildModel>[].obs;
|
||||||
|
|
||||||
Rxn<StewardFreeBarDashboard> stewardFreeDashboard =
|
Rxn<StewardFreeBarDashboard> stewardFreeDashboard = Rxn<StewardFreeBarDashboard>();
|
||||||
Rxn<StewardFreeBarDashboard>();
|
|
||||||
|
|
||||||
WarehouseAndDistributionRootLogic rootLogic =
|
WarehouseAndDistributionRootLogic rootLogic = Get.find<WarehouseAndDistributionRootLogic>();
|
||||||
Get.find<WarehouseAndDistributionRootLogic>();
|
|
||||||
|
|
||||||
List<String> routesName = ['فروش'];
|
List<String> routesName = ['فروش'];
|
||||||
DateTime? _lastBackPressed;
|
DateTime? _lastBackPressed;
|
||||||
@@ -118,8 +117,7 @@ class WarehouseAndDistributionSaleLogic extends GetxController {
|
|||||||
|
|
||||||
void onPopScopTaped() async {
|
void onPopScopTaped() async {
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
if (_lastBackPressed == null ||
|
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
||||||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
|
||||||
_lastBackPressed = now;
|
_lastBackPressed = now;
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'خروج از برنامه',
|
'خروج از برنامه',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/chicken.dart';
|
import 'package:rasadyar_chicken/chicken.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar_dashboard/steward_free_bar_dashboard.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_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
@@ -25,14 +25,14 @@ class WarehouseAndDistributionSalePage extends GetView<WarehouseAndDistributionS
|
|||||||
title: 'فروش داخل استان',
|
title: 'فروش داخل استان',
|
||||||
vecIcon: Assets.vec.map2Svg.path,
|
vecIcon: Assets.vec.map2Svg.path,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: stewardSecondKey);
|
// Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: stewardSecondKey);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
GlassMorphismCardIcon(
|
GlassMorphismCardIcon(
|
||||||
title: 'فروش خارج استان',
|
title: 'فروش خارج استان',
|
||||||
vecIcon: Assets.vec.saleOutProvinceSvg.path,
|
vecIcon: Assets.vec.saleOutProvinceSvg.path,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: stewardSecondKey);
|
//Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: stewardSecondKey);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
=
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
||||||
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/submit_steward_allocation/submit_steward_allocation.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/submit_steward_allocation/submit_steward_allocation.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
||||||
@@ -9,9 +11,6 @@ import 'package:rasadyar_chicken/features/common/data/model/response/broadcast_p
|
|||||||
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/guild_profile/guild_profile.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/guild_profile/guild_profile.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_remain_weight/steward_remain_weight.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
@@ -57,8 +56,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
final RxBool hasMoreDataAllocationsMade = true.obs;
|
final RxBool hasMoreDataAllocationsMade = true.obs;
|
||||||
|
|
||||||
Rxn<BroadcastPrice> broadcastPrice = Rxn<BroadcastPrice>();
|
Rxn<BroadcastPrice> broadcastPrice = Rxn<BroadcastPrice>();
|
||||||
Rxn<AllocatedMadeModel> selectedAllocationModelForUpdate =
|
Rxn<AllocatedMadeModel> selectedAllocationModelForUpdate = Rxn<AllocatedMadeModel>();
|
||||||
Rxn<AllocatedMadeModel>();
|
|
||||||
SubmitStewardAllocation? tmpStewardAllocation;
|
SubmitStewardAllocation? tmpStewardAllocation;
|
||||||
|
|
||||||
Rxn<Jalali> productionDate = Rxn(null);
|
Rxn<Jalali> productionDate = Rxn(null);
|
||||||
@@ -135,8 +133,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateGovernmentalProductionDateData() {
|
void _updateGovernmentalProductionDateData() {
|
||||||
=
|
/*List<RemainWeightDay> dates =
|
||||||
List<RemainWeightDay> dates =
|
|
||||||
rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||||
governmentalProductionDateData = {
|
governmentalProductionDateData = {
|
||||||
for (var element in dates)
|
for (var element in dates)
|
||||||
@@ -147,7 +144,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateFreeProductionDateData() {
|
void _updateFreeProductionDateData() {
|
||||||
/* var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
/* var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
||||||
freeProductionDateData = {
|
freeProductionDateData = {
|
||||||
for (var element in dates)
|
for (var element in dates)
|
||||||
element.day.toString().toJalali.formatCompactDate(): DayData(
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
@@ -160,17 +157,16 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
allocatedList.value =
|
allocatedList.value = Resource<PaginationModel<AllocatedMadeModel>>.loading();
|
||||||
Resource<PaginationModel<AllocatedMadeModel>>.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; // Reset to first page if search value is set
|
currentPage.value = 1; // Reset to first page if search value is set
|
||||||
}
|
}
|
||||||
|
|
||||||
=
|
|
||||||
safeCall(
|
safeCall(
|
||||||
call: () async => await rootLogic.stewardRepository.getAllocatedMade(
|
call: () async => await rootLogic.stewardRepository.getAllocatedMade(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -214,20 +210,15 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
isLoadingMoreAllocationsMade.value = false;
|
isLoadingMoreAllocationsMade.value = false;
|
||||||
},
|
},
|
||||||
); */
|
); */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkVerification() {
|
void checkVerification() {
|
||||||
var hasWeight = quotaType.value == 1
|
var hasWeight = quotaType.value == 1
|
||||||
? weight.value <=
|
? weight.value <=
|
||||||
(governmentalProductionDateData[productionDate.value
|
(governmentalProductionDateData[productionDate.value?.formatCompactDate()]?.value ??
|
||||||
?.formatCompactDate()]
|
|
||||||
?.value ??
|
|
||||||
0)
|
0)
|
||||||
: weight.value <=
|
: weight.value <=
|
||||||
(freeProductionDateData[productionDate.value?.formatCompactDate()]
|
(freeProductionDateData[productionDate.value?.formatCompactDate()]?.value ?? 0);
|
||||||
?.value ??
|
|
||||||
0);
|
|
||||||
|
|
||||||
isValid.value =
|
isValid.value =
|
||||||
weight.value > 0 &&
|
weight.value > 0 &&
|
||||||
@@ -239,7 +230,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void confirmAllocation(ConformAllocation allocation) {
|
void confirmAllocation(ConformAllocation allocation) {
|
||||||
=
|
/*
|
||||||
safeCall(
|
safeCall(
|
||||||
call: () async => await rootLogic.stewardRepository.confirmAllocation(
|
call: () async => await rootLogic.stewardRepository.confirmAllocation(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -253,8 +244,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void denyAllocation(String token) {
|
void denyAllocation(String token) {
|
||||||
=
|
/*safeCall(
|
||||||
safeCall(
|
|
||||||
call: () async => await rootLogic.stewardRepository.denyAllocation(
|
call: () async => await rootLogic.stewardRepository.denyAllocation(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
allocationToken: token,
|
allocationToken: token,
|
||||||
@@ -267,7 +257,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> confirmAllAllocations() async {
|
Future<void> confirmAllAllocations() async {
|
||||||
=
|
/*
|
||||||
safeCall(
|
safeCall(
|
||||||
call: () async => await rootLogic.stewardRepository.confirmAllAllocation(
|
call: () async => await rootLogic.stewardRepository.confirmAllAllocation(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -283,7 +273,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getRolesProducts() async {
|
Future<void> getRolesProducts() async {
|
||||||
=
|
/*
|
||||||
safeCall(
|
safeCall(
|
||||||
call: () async => await rootLogic.commonRepository.getRolesProducts(
|
call: () async => await rootLogic.commonRepository.getRolesProducts(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -300,7 +290,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getGuilds() async {
|
Future<void> getGuilds() async {
|
||||||
=
|
/*
|
||||||
safeCall(
|
safeCall(
|
||||||
call: () async => await rootLogic.commonRepository.getGuilds(
|
call: () async => await rootLogic.commonRepository.getGuilds(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -333,7 +323,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getGuildProfile() async {
|
Future<void> getGuildProfile() async {
|
||||||
=
|
/*
|
||||||
await safeCall(
|
await safeCall(
|
||||||
call: () async => await rootLogic.commonRepository.getProfile(
|
call: () async => await rootLogic.commonRepository.getProfile(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -351,17 +341,13 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
allocationType:
|
allocationType:
|
||||||
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}',
|
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}',
|
||||||
sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild",
|
sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild",
|
||||||
buyerType: selectedGuildModel.value?.steward == true
|
buyerType: selectedGuildModel.value?.steward == true ? "Steward" : "Guild",
|
||||||
? "Steward"
|
|
||||||
: "Guild",
|
|
||||||
amount: pricePerKilo.value,
|
amount: pricePerKilo.value,
|
||||||
totalAmount: totalCost.value,
|
totalAmount: totalCost.value,
|
||||||
weightOfCarcasses: weight.value,
|
weightOfCarcasses: weight.value,
|
||||||
sellType: saleType.value == 2 ? "free" : 'exclusive',
|
sellType: saleType.value == 2 ? "free" : 'exclusive',
|
||||||
numberOfCarcasses: 0,
|
numberOfCarcasses: 0,
|
||||||
productionDate: productionDate.value
|
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||||
?.toDateTime()
|
|
||||||
.formattedDashedGregorian,
|
|
||||||
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
||||||
guildKey: selectedGuildModel.value?.key,
|
guildKey: selectedGuildModel.value?.key,
|
||||||
productKey: selectedProductModel.value?.key,
|
productKey: selectedProductModel.value?.key,
|
||||||
@@ -373,7 +359,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
Future<void> submitAllocation() async {
|
Future<void> submitAllocation() async {
|
||||||
setSubmitData();
|
setSubmitData();
|
||||||
|
|
||||||
/* safeCall(
|
/* safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () async =>
|
call: () async =>
|
||||||
await rootLogic.stewardRepository.postSubmitStewardAllocation(
|
await rootLogic.stewardRepository.postSubmitStewardAllocation(
|
||||||
@@ -396,7 +382,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteAllocation(AllocatedMadeModel model) async {
|
Future<void> deleteAllocation(AllocatedMadeModel model) async {
|
||||||
=
|
/*
|
||||||
safeCall(
|
safeCall(
|
||||||
call: () async =>
|
call: () async =>
|
||||||
await rootLogic.stewardRepository.deleteStewardAllocation(
|
await rootLogic.stewardRepository.deleteStewardAllocation(
|
||||||
@@ -426,9 +412,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
pricePerKilo.value = item.amount ?? 0;
|
pricePerKilo.value = item.amount ?? 0;
|
||||||
totalCost.value = item.totalAmount ?? 0;
|
totalCost.value = item.totalAmount ?? 0;
|
||||||
weightController.text = weight.value.toString().separatedByComma;
|
weightController.text = weight.value.toString().separatedByComma;
|
||||||
pricePerKiloController.text = pricePerKilo.value
|
pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
|
||||||
.toString()
|
|
||||||
.separatedByComma;
|
|
||||||
totalCostController.text = totalCost.value.toString().separatedByComma;
|
totalCostController.text = totalCost.value.toString().separatedByComma;
|
||||||
isValid.value = true;
|
isValid.value = true;
|
||||||
productionDate.value = item.productionDate.toJalali;
|
productionDate.value = item.productionDate.toJalali;
|
||||||
@@ -460,7 +444,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
weight_of_carcasses: weight.value,
|
weight_of_carcasses: weight.value,
|
||||||
);
|
);
|
||||||
|
|
||||||
/* safeCall(
|
/* safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () async =>
|
call: () async =>
|
||||||
await rootLogic.stewardRepository.updateStewardAllocation(
|
await rootLogic.stewardRepository.updateStewardAllocation(
|
||||||
@@ -513,7 +497,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getBroadcastPrice() async {
|
Future<void> getBroadcastPrice() async {
|
||||||
=
|
/*
|
||||||
safeCall(
|
safeCall(
|
||||||
call: () async => await rootLogic.commonRepository.getBroadcastPrice(
|
call: () async => await rootLogic.commonRepository.getBroadcastPrice(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -536,11 +520,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
toggleExpansion();
|
toggleExpansion();
|
||||||
currentPage.value = 1;
|
currentPage.value = 1;
|
||||||
hasMoreDataAllocationsMade.value = true;
|
hasMoreDataAllocationsMade.value = true;
|
||||||
await Future.wait([
|
await Future.wait([getAllocatedMade(), getRolesProducts(), rootLogic.onRefresh()]);
|
||||||
getAllocatedMade(),
|
|
||||||
getRolesProducts(),
|
|
||||||
rootLogic.onRefresh(),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpansion({int? index}) {
|
void toggleExpansion({int? index}) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_in_province/widgets/cu_sale_in_provience.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_in_province/widgets/cu_sale_in_provience.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.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/utils/string_utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||||
@@ -35,8 +35,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
listType: ListType.separated,
|
listType: ListType.separated,
|
||||||
resource: data.value,
|
resource: data.value,
|
||||||
hasMore: data.value.data?.next != null,
|
hasMore: data.value.data?.next != null,
|
||||||
isPaginating:
|
isPaginating: controller.isLoadingMoreAllocationsMade.value,
|
||||||
controller.isLoadingMoreAllocationsMade.value,
|
|
||||||
onLoadMore: () async {
|
onLoadMore: () async {
|
||||||
controller.currentPage.value++;
|
controller.currentPage.value++;
|
||||||
await controller.getAllocatedMade(true);
|
await controller.getAllocatedMade(true);
|
||||||
@@ -47,8 +46,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
return ObxValue((val) {
|
return ObxValue((val) {
|
||||||
return ExpandableListItem2(
|
return ExpandableListItem2(
|
||||||
selected: val.value == index,
|
selected: val.value == index,
|
||||||
onTap: () =>
|
onTap: () => controller.toggleExpansion(index: index),
|
||||||
controller.toggleExpansion(index: index),
|
|
||||||
index: index,
|
index: index,
|
||||||
child: itemListWidget(item),
|
child: itemListWidget(item),
|
||||||
secondChild: itemListExpandedWidget(item, index),
|
secondChild: itemListExpandedWidget(item, index),
|
||||||
@@ -61,8 +59,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
}, controller.expandedListIndex);
|
}, controller.expandedListIndex);
|
||||||
},
|
},
|
||||||
itemCount: data.value.data?.results?.length ?? 0,
|
itemCount: data.value.data?.results?.length ?? 0,
|
||||||
separatorBuilder: (context, index) =>
|
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
||||||
SizedBox(height: 8.h),
|
|
||||||
);
|
);
|
||||||
}, controller.allocatedList),
|
}, controller.allocatedList),
|
||||||
),
|
),
|
||||||
@@ -96,13 +93,12 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
title: 'تایید یکجا',
|
title: 'تایید یکجا',
|
||||||
middleText:
|
middleText: 'آیا از تایید تمامی تخصیص ها اطمینان دارید؟',
|
||||||
'آیا از تایید تمامی تخصیص ها اطمینان دارید؟',
|
|
||||||
confirm: ElevatedButton(
|
confirm: ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await controller.confirmAllAllocations();
|
await controller.confirmAllAllocations();
|
||||||
controller.getAllocatedMade();
|
controller.getAllocatedMade();
|
||||||
// controller.rootLogic.getKillHouseSalesInfoDashboard();
|
// controller.rootLogic.getKillHouseSalesInfoDashboard();
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
child: Text('تایید'),
|
child: Text('تایید'),
|
||||||
@@ -118,10 +114,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
style: OutlinedButton.styleFrom(
|
style: OutlinedButton.styleFrom(
|
||||||
foregroundColor: AppColor.error,
|
foregroundColor: AppColor.error,
|
||||||
enableFeedback: true,
|
enableFeedback: true,
|
||||||
side: BorderSide(
|
side: BorderSide(color: AppColor.error, width: 1),
|
||||||
color: AppColor.error,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
@@ -134,10 +127,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
message: 'تایید یکجا',
|
message: 'تایید یکجا',
|
||||||
icon: Assets.vec.clipboardTaskSvg.svg(
|
icon: Assets.vec.clipboardTaskSvg.svg(width: 40.w, height: 40.h),
|
||||||
width: 40.w,
|
|
||||||
height: 40.h,
|
|
||||||
),
|
|
||||||
backgroundColor: controller.bgConfirmAllColor.value,
|
backgroundColor: controller.bgConfirmAllColor.value,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -193,19 +183,14 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
child: Assets.vec.hotChickenSvg.svg(
|
child: Assets.vec.hotChickenSvg.svg(
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||||
AppColor.blueNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
item.weightOfCarcasses!.separatedByCommaFa.addKg,
|
item.weightOfCarcasses!.separatedByCommaFa.addKg,
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
style: AppFonts.yekan12Bold.copyWith(
|
style: AppFonts.yekan12Bold.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -252,10 +237,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
Container itemListExpandedWidget(AllocatedMadeModel item, int index) {
|
Container itemListExpandedWidget(AllocatedMadeModel item, int index) {
|
||||||
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: [
|
||||||
@@ -269,14 +251,10 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
Text(
|
Text(
|
||||||
item.registrationCode == null
|
item.registrationCode == null ? 'در انتظار' : 'در انتظار تایید خریدار',
|
||||||
? 'در انتظار'
|
|
||||||
: 'در انتظار تایید خریدار',
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan10.copyWith(
|
style: AppFonts.yekan10.copyWith(
|
||||||
color: item.registrationCode == null
|
color: item.registrationCode == null ? AppColor.darkGreyDark : AppColor.error,
|
||||||
? AppColor.darkGreyDark
|
|
||||||
: AppColor.error,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 7),
|
SizedBox(width: 7),
|
||||||
@@ -284,9 +262,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
width: 16.w,
|
width: 16.w,
|
||||||
height: 16.h,
|
height: 16.h,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(
|
||||||
item.registrationCode == null
|
item.registrationCode == null ? AppColor.darkGreyDark : AppColor.error,
|
||||||
? AppColor.darkGreyDark
|
|
||||||
: AppColor.error,
|
|
||||||
BlendMode.srcIn,
|
BlendMode.srcIn,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -310,16 +286,12 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -338,8 +310,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
),
|
),
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'تلفن خریدار',
|
title: 'تلفن خریدار',
|
||||||
value:
|
value: controller.getBuyerInformation(item)?.user?.mobile ?? 'ندارد',
|
||||||
controller.getBuyerInformation(item)?.user?.mobile ?? 'ندارد',
|
|
||||||
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
),
|
),
|
||||||
buildRow(title: 'محصول', value: item.product?.name ?? 'ندارد'),
|
buildRow(title: 'محصول', value: item.product?.name ?? 'ندارد'),
|
||||||
@@ -349,18 +320,12 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
value: item.productionDate?.toJalali.formatCompactDate() ?? 'ندارد',
|
value: item.productionDate?.toJalali.formatCompactDate() ?? 'ندارد',
|
||||||
),
|
),
|
||||||
|
|
||||||
buildRow(
|
buildRow(title: 'نوع تخصیص', value: item.allocationType?.faAllocationType ?? 'ندارد'),
|
||||||
title: 'نوع تخصیص',
|
|
||||||
value: item.allocationType?.faAllocationType ?? 'ندارد',
|
|
||||||
),
|
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'نوع فروش',
|
title: 'نوع فروش',
|
||||||
value: (item.approvedPriceStatus ?? false) ? 'دولتی' : 'آزاد',
|
value: (item.approvedPriceStatus ?? false) ? 'دولتی' : 'آزاد',
|
||||||
),
|
),
|
||||||
buildRow(
|
buildRow(title: 'نوع انبار', value: (item.quota == 'governmental') ? 'دولتی' : 'آزاد'),
|
||||||
title: 'نوع انبار',
|
|
||||||
value: (item.quota == 'governmental') ? 'دولتی' : 'آزاد',
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'وزن خریداری شده',
|
title: 'وزن خریداری شده',
|
||||||
@@ -380,20 +345,12 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
),
|
),
|
||||||
value: '${item.amount?.separatedByCommaFa} ریال',
|
value: '${item.amount?.separatedByCommaFa} ریال',
|
||||||
),
|
),
|
||||||
buildRow(
|
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByCommaFa} ریال'),
|
||||||
title: 'قیمت کل',
|
|
||||||
value: '${item.totalAmount?.separatedByCommaFa} ریال',
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(
|
buildRow(title: 'کداحراز', value: item.registrationCode?.toString() ?? 'ندارد'),
|
||||||
title: 'کداحراز',
|
|
||||||
value: item.registrationCode?.toString() ?? 'ندارد',
|
|
||||||
),
|
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'وضعیت کد احراز',
|
title: 'وضعیت کد احراز',
|
||||||
value: item.systemRegistrationCode == true
|
value: item.systemRegistrationCode == true ? "ارسال شده" : "ارسال نشده",
|
||||||
? "ارسال شده"
|
|
||||||
: "ارسال نشده",
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Visibility(
|
Visibility(
|
||||||
@@ -421,9 +378,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
),
|
),
|
||||||
ROutlinedElevated(
|
ROutlinedElevated(
|
||||||
text: 'حذف',
|
text: 'حذف',
|
||||||
textStyle: AppFonts.yekan20.copyWith(
|
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
|
||||||
color: AppColor.redNormal,
|
|
||||||
),
|
|
||||||
width: 150.w,
|
width: 150.w,
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -452,10 +407,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
child: Column(
|
child: Column(
|
||||||
spacing: 16,
|
spacing: 16,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)),
|
||||||
'فیلترها',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
@@ -463,8 +415,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
child: timeFilterWidget(
|
child: timeFilterWidget(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
date: controller.fromDateFilter,
|
date: controller.fromDateFilter,
|
||||||
onChanged: (jalali) =>
|
onChanged: (jalali) => controller.fromDateFilter.value = jalali,
|
||||||
controller.fromDateFilter.value = jalali,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -515,10 +466,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
Assets.vec.calendarSvg.svg(
|
Assets.vec.calendarSvg.svg(
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
colorFilter: const ColorFilter.mode(
|
colorFilter: const ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||||
AppColor.blueNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
isFrom ? 'از' : 'تا',
|
isFrom ? 'از' : 'تا',
|
||||||
@@ -529,9 +477,7 @@ class WarehouseAndDistributionSalesInProvincePage
|
|||||||
return Text(
|
return Text(
|
||||||
date.value.formatCompactDate(),
|
date.value.formatCompactDate(),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.lightGreyNormalActive),
|
||||||
color: AppColor.lightGreyNormalActive,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}, date),
|
}, date),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
Widget addOrEditBottomSheet(WarehouseAndDistributionSalesInProvinceLogic controller, {bool isEditMode = false}) {
|
Widget addOrEditBottomSheet(
|
||||||
|
WarehouseAndDistributionSalesInProvinceLogic controller, {
|
||||||
|
bool isEditMode = false,
|
||||||
|
}) {
|
||||||
return BaseBottomSheet(
|
return BaseBottomSheet(
|
||||||
height: Get.height * (isEditMode ? 0.60 : 0.75),
|
height: Get.height * (isEditMode ? 0.60 : 0.75),
|
||||||
child: Form(
|
child: Form(
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/broadcast_price/broadcast_price.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_out_of_province_buyers/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_out_of_province_buyers/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_out_of_province_sales_list/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_out_of_province_sales_list/logic.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -18,9 +18,11 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
|
|
||||||
WarehouseAndDistributionSaleLogic saleLogic = Get.find<WarehouseAndDistributionSaleLogic>();
|
WarehouseAndDistributionSaleLogic saleLogic = Get.find<WarehouseAndDistributionSaleLogic>();
|
||||||
|
|
||||||
WarehouseAndDistributionSalesOutOfProvinceSalesListLogic saleListLogic = Get.find<WarehouseAndDistributionSalesOutOfProvinceSalesListLogic>();
|
WarehouseAndDistributionSalesOutOfProvinceSalesListLogic saleListLogic =
|
||||||
|
Get.find<WarehouseAndDistributionSalesOutOfProvinceSalesListLogic>();
|
||||||
|
|
||||||
WarehouseAndDistributionSalesOutOfProvinceBuyersLogic buyerLogic = Get.find<WarehouseAndDistributionSalesOutOfProvinceBuyersLogic>();
|
WarehouseAndDistributionSalesOutOfProvinceBuyersLogic buyerLogic =
|
||||||
|
Get.find<WarehouseAndDistributionSalesOutOfProvinceBuyersLogic>();
|
||||||
|
|
||||||
RxBool isExpanded = false.obs;
|
RxBool isExpanded = false.obs;
|
||||||
RxInt currentPage = 1.obs;
|
RxInt currentPage = 1.obs;
|
||||||
@@ -71,7 +73,7 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
super.onReady();
|
super.onReady();
|
||||||
getOutProvinceSales();
|
getOutProvinceSales();
|
||||||
getBroadcastPrice();
|
getBroadcastPrice();
|
||||||
// selectedProduct.value = rootLogic.rolesProductsModel.first;
|
// selectedProduct.value = rootLogic.rolesProductsModel.first;
|
||||||
debounce(
|
debounce(
|
||||||
searchedValue,
|
searchedValue,
|
||||||
(callback) => getOutProvinceSales(),
|
(callback) => getOutProvinceSales(),
|
||||||
@@ -81,7 +83,7 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
|
|
||||||
_updateGovernmentalProductionDateData();
|
_updateGovernmentalProductionDateData();
|
||||||
_updateFreeProductionDateData();
|
_updateFreeProductionDateData();
|
||||||
/* ever(rootLogic.stewardRemainWeight, (callback) {
|
/* ever(rootLogic.stewardRemainWeight, (callback) {
|
||||||
_updateGovernmentalProductionDateData();
|
_updateGovernmentalProductionDateData();
|
||||||
_updateFreeProductionDateData();
|
_updateFreeProductionDateData();
|
||||||
}); */
|
}); */
|
||||||
@@ -99,7 +101,7 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateGovernmentalProductionDateData() {
|
void _updateGovernmentalProductionDateData() {
|
||||||
/* List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
/* List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||||
governmentalProductionDateData = {
|
governmentalProductionDateData = {
|
||||||
for (var element in dates)
|
for (var element in dates)
|
||||||
element.day.toString().toJalali.formatCompactDate(): DayData(
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
@@ -109,7 +111,7 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateFreeProductionDateData() {
|
void _updateFreeProductionDateData() {
|
||||||
/* var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
/* var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
||||||
freeProductionDateData = {
|
freeProductionDateData = {
|
||||||
for (var element in dates)
|
for (var element in dates)
|
||||||
element.day.toString().toJalali.formatCompactDate(): DayData(
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
@@ -129,7 +131,7 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getOutProvinceSales([bool isLoadingMore = false]) async {
|
Future<void> getOutProvinceSales([bool isLoadingMore = false]) async {
|
||||||
/* if (isLoadingMore) {
|
/* if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.loading();
|
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.loading();
|
||||||
@@ -195,10 +197,10 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
saleWeightController.text = item.weightOfCarcasses?.toInt().toString() ?? '';
|
saleWeightController.text = item.weightOfCarcasses?.toInt().toString() ?? '';
|
||||||
saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!));
|
saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!));
|
||||||
selectedCity.value = IranProvinceCityModel(name: item.city);
|
selectedCity.value = IranProvinceCityModel(name: item.city);
|
||||||
selectedBuyer.value = buyerLogic.buyerList.value.data?.results?.firstWhere(
|
/*selectedBuyer.value = buyerLogic.buyerList.value.data?.results?.firstWhere(
|
||||||
(element) => element.key == item.buyer?.key,
|
(element) => element.key == item.buyer?.key,
|
||||||
);
|
);*/
|
||||||
// selectedProduct.value = rootLogic.rolesProductsModel.first;
|
// selectedProduct.value = rootLogic.rolesProductsModel.first;
|
||||||
key = item.key;
|
key = item.key;
|
||||||
saleType.value = item.saleType == 'free' ? 2 : 1;
|
saleType.value = item.saleType == 'free' ? 2 : 1;
|
||||||
quotaType.value = item.quota == 'governmental' ? 1 : 2;
|
quotaType.value = item.quota == 'governmental' ? 1 : 2;
|
||||||
@@ -209,7 +211,7 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
|
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
call: () => rootLogic.chickenRepository.deleteOutProvinceStewardFreeBar(
|
call: () => rootLogic.chickenRepository.deleteOutProvinceStewardFreeBar(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
key: key,
|
key: key,
|
||||||
@@ -230,7 +232,7 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
||||||
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||||
);
|
);
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () => rootLogic.chickenRepository.createOutProvinceStewardFreeBar(
|
call: () => rootLogic.chickenRepository.createOutProvinceStewardFreeBar(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -271,7 +273,7 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
||||||
key: key,
|
key: key,
|
||||||
);
|
);
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
call: () => rootLogic.chickenRepository.updateOutProvinceStewardFreeBar(
|
call: () => rootLogic.chickenRepository.updateOutProvinceStewardFreeBar(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
body: requestBody,
|
body: requestBody,
|
||||||
@@ -306,7 +308,7 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
city: item.city,
|
city: item.city,
|
||||||
province: item.province,
|
province: item.province,
|
||||||
);
|
);
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () => rootLogic.chickenRepository.updateOutProvinceStewardFreeBar(
|
call: () => rootLogic.chickenRepository.updateOutProvinceStewardFreeBar(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -347,7 +349,7 @@ class WarehouseAndDistributionSalesOutOfProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getBroadcastPrice() async {
|
Future<void> getBroadcastPrice() async {
|
||||||
/* safeCall(
|
/* safeCall(
|
||||||
call: () async => await rootLogic.chickenRepository.getBroadcastPrice(
|
call: () async => await rootLogic.chickenRepository.getBroadcastPrice(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_out_of_province/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_out_of_province/logic.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionSalesOutOfProvinceBuyersLogic
|
class WarehouseAndDistributionSalesOutOfProvinceBuyersLogic extends GetxController {
|
||||||
extends GetxController {
|
WarehouseAndDistributionRootLogic rootLogic = Get.find<WarehouseAndDistributionRootLogic>();
|
||||||
WarehouseAndDistributionRootLogic rootLogic =
|
|
||||||
Get.find<WarehouseAndDistributionRootLogic>();
|
|
||||||
|
|
||||||
WarehouseAndDistributionSaleLogic get saleLogic =>
|
WarehouseAndDistributionSaleLogic get saleLogic => Get.find<WarehouseAndDistributionSaleLogic>();
|
||||||
Get.find<WarehouseAndDistributionSaleLogic>();
|
|
||||||
|
|
||||||
WarehouseAndDistributionSalesOutOfProvinceLogic get saleOutOfProvince =>
|
WarehouseAndDistributionSalesOutOfProvinceLogic get saleOutOfProvince =>
|
||||||
Get.find<WarehouseAndDistributionSalesOutOfProvinceLogic>();
|
Get.find<WarehouseAndDistributionSalesOutOfProvinceLogic>();
|
||||||
@@ -78,14 +74,11 @@ class WarehouseAndDistributionSalesOutOfProvinceBuyersLogic
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getOutProvinceCarcassesBuyer([
|
Future<void> getOutProvinceCarcassesBuyer([bool isLoadingMore = false]) async {
|
||||||
bool isLoadingMore = false,
|
|
||||||
]) async {
|
|
||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
buyerList.value =
|
buyerList.value = Resource<PaginationModel<OutProvinceCarcassesBuyer>>.loading();
|
||||||
Resource<PaginationModel<OutProvinceCarcassesBuyer>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -172,7 +165,7 @@ class WarehouseAndDistributionSalesOutOfProvinceBuyersLogic
|
|||||||
if (!(formKey.currentState?.validate() ?? false)) {
|
if (!(formKey.currentState?.validate() ?? false)) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
call: () async {
|
call: () async {
|
||||||
OutProvinceCarcassesBuyer buyer = OutProvinceCarcassesBuyer(
|
OutProvinceCarcassesBuyer buyer = OutProvinceCarcassesBuyer(
|
||||||
province: selectedProvince.value!.name,
|
province: selectedProvince.value!.name,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.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/filter_bottom_sheet.dart';
|
||||||
@@ -8,7 +8,8 @@ import 'package:rasadyar_core/core.dart';
|
|||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionSalesOutOfProvinceBuyersPage extends GetView<WarehouseAndDistributionSalesOutOfProvinceBuyersLogic> {
|
class WarehouseAndDistributionSalesOutOfProvinceBuyersPage
|
||||||
|
extends GetView<WarehouseAndDistributionSalesOutOfProvinceBuyersLogic> {
|
||||||
const WarehouseAndDistributionSalesOutOfProvinceBuyersPage({super.key});
|
const WarehouseAndDistributionSalesOutOfProvinceBuyersPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_out_of_province_buyers/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_out_of_province_buyers/logic.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart'
|
||||||
|
show OutProvinceCarcassesBuyer;
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -15,7 +16,8 @@ class WarehouseAndDistributionSalesOutOfProvinceSalesListLogic extends GetxContr
|
|||||||
|
|
||||||
WarehouseAndDistributionSaleLogic saleLogic = Get.find<WarehouseAndDistributionSaleLogic>();
|
WarehouseAndDistributionSaleLogic saleLogic = Get.find<WarehouseAndDistributionSaleLogic>();
|
||||||
|
|
||||||
WarehouseAndDistributionSalesOutOfProvinceBuyersLogic buyerLogic = Get.find<WarehouseAndDistributionSalesOutOfProvinceBuyersLogic>();
|
WarehouseAndDistributionSalesOutOfProvinceBuyersLogic buyerLogic =
|
||||||
|
Get.find<WarehouseAndDistributionSalesOutOfProvinceBuyersLogic>();
|
||||||
|
|
||||||
RxInt selectedSegmentIndex = 0.obs;
|
RxInt selectedSegmentIndex = 0.obs;
|
||||||
RxBool isExpanded = false.obs;
|
RxBool isExpanded = false.obs;
|
||||||
@@ -32,12 +34,9 @@ class WarehouseAndDistributionSalesOutOfProvinceSalesListLogic extends GetxContr
|
|||||||
//TODO add this to Di
|
//TODO add this to Di
|
||||||
ImagePicker imagePicker = ImagePicker();
|
ImagePicker imagePicker = ImagePicker();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RxInt saleType = 1.obs;
|
RxInt saleType = 1.obs;
|
||||||
RxInt quotaType = 1.obs;
|
RxInt quotaType = 1.obs;
|
||||||
|
|
||||||
|
|
||||||
GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||||
TextEditingController quarantineCodeController = TextEditingController();
|
TextEditingController quarantineCodeController = TextEditingController();
|
||||||
TextEditingController saleWeightController = TextEditingController();
|
TextEditingController saleWeightController = TextEditingController();
|
||||||
@@ -81,7 +80,7 @@ class WarehouseAndDistributionSalesOutOfProvinceSalesListLogic extends GetxContr
|
|||||||
} else {
|
} else {
|
||||||
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.loading();
|
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.loading();
|
||||||
}
|
}
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
call: () => rootLogic.chickenRepository.getStewardFreeSaleBar(
|
call: () => rootLogic.chickenRepository.getStewardFreeSaleBar(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
queryParameters: buildQueryParams(
|
queryParameters: buildQueryParams(
|
||||||
@@ -115,7 +114,6 @@ class WarehouseAndDistributionSalesOutOfProvinceSalesListLogic extends GetxContr
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setupListeners() {
|
void setupListeners() {
|
||||||
|
|
||||||
quarantineCodeController.addListener(checkSalesFormValid);
|
quarantineCodeController.addListener(checkSalesFormValid);
|
||||||
ever(selectedBuyer, (_) => checkSalesFormValid);
|
ever(selectedBuyer, (_) => checkSalesFormValid);
|
||||||
ever(selectedProduct, (_) => checkSalesFormValid);
|
ever(selectedProduct, (_) => checkSalesFormValid);
|
||||||
@@ -168,7 +166,7 @@ class WarehouseAndDistributionSalesOutOfProvinceSalesListLogic extends GetxContr
|
|||||||
clearanceCode: quarantineCodeController.text,
|
clearanceCode: quarantineCodeController.text,
|
||||||
productKey: selectedProduct.value?.key,
|
productKey: selectedProduct.value?.key,
|
||||||
);
|
);
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
call: () => rootLogic.chickenRepository.createOutProvinceStewardFreeBar(
|
call: () => rootLogic.chickenRepository.createOutProvinceStewardFreeBar(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
body: requestBody,
|
body: requestBody,
|
||||||
@@ -197,7 +195,7 @@ class WarehouseAndDistributionSalesOutOfProvinceSalesListLogic extends GetxContr
|
|||||||
clearanceCode: quarantineCodeController.text,
|
clearanceCode: quarantineCodeController.text,
|
||||||
key: key,
|
key: key,
|
||||||
);
|
);
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
call: () => rootLogic.chickenRepository.updateOutProvinceStewardFreeBar(
|
call: () => rootLogic.chickenRepository.updateOutProvinceStewardFreeBar(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
body: requestBody,
|
body: requestBody,
|
||||||
@@ -214,6 +212,7 @@ class WarehouseAndDistributionSalesOutOfProvinceSalesListLogic extends GetxContr
|
|||||||
selectedProduct.value = null;
|
selectedProduct.value = null;
|
||||||
key = null;
|
key = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpansion({int? index}) {
|
void toggleExpansion({int? index}) {
|
||||||
if (expandedListIndex.value == index || index == null) {
|
if (expandedListIndex.value == index || index == null) {
|
||||||
expandedListIndex.value = -1;
|
expandedListIndex.value = -1;
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionSalesOutOfProvinceSalesListPage extends GetView<WarehouseAndDistributionSalesOutOfProvinceSalesListLogic> {
|
class WarehouseAndDistributionSalesOutOfProvinceSalesListPage
|
||||||
|
extends GetView<WarehouseAndDistributionSalesOutOfProvinceSalesListLogic> {
|
||||||
const WarehouseAndDistributionSalesOutOfProvinceSalesListPage({super.key});
|
const WarehouseAndDistributionSalesOutOfProvinceSalesListPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -60,7 +61,7 @@ class WarehouseAndDistributionSalesOutOfProvinceSalesListPage extends GetView<Wa
|
|||||||
icon: Icon(CupertinoIcons.person_add_solid, color: Colors.white, size: 35.w),
|
icon: Icon(CupertinoIcons.person_add_solid, color: Colors.white, size: 35.w),
|
||||||
backgroundColor: AppColor.blueNormal,
|
backgroundColor: AppColor.blueNormal,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.toNamed(ChickenRoutes.salesOutOfProvinceBuyerSteward, id: 1);
|
//Get.toNamed(ChickenRoutes.salesOutOfProvinceBuyerSteward, id: 1);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: 25),
|
SizedBox(width: 25),
|
||||||
@@ -246,8 +247,8 @@ class WarehouseAndDistributionSalesOutOfProvinceSalesListPage extends GetView<Wa
|
|||||||
isOnEdit ? 'ویرایش فروش' : 'افزودن فروش',
|
isOnEdit ? 'ویرایش فروش' : 'افزودن فروش',
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||||
),
|
),
|
||||||
//_productDropDown(),
|
|
||||||
|
|
||||||
|
//_productDropDown(),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -369,7 +370,7 @@ class WarehouseAndDistributionSalesOutOfProvinceSalesListPage extends GetView<Wa
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Widget _productDropDown() {
|
/* Widget _productDropDown() {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
return OverlayDropdownWidget<ProductModel>(
|
return OverlayDropdownWidget<ProductModel>(
|
||||||
items: controller.rootLogic.rolesProductsModel,
|
items: controller.rootLogic.rolesProductsModel,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/broadcast_price/broadcast_price.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/response/segmentation_model/segmentation_model.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -57,14 +57,14 @@ class WarehouseAndDistributionSegmentationLogic extends GetxController {
|
|||||||
});
|
});
|
||||||
_updateGovernmentalProductionDateData();
|
_updateGovernmentalProductionDateData();
|
||||||
_updateFreeProductionDateData();
|
_updateFreeProductionDateData();
|
||||||
/* ever(rootLogic.stewardRemainWeight, (callback) {
|
/* ever(rootLogic.stewardRemainWeight, (callback) {
|
||||||
_updateGovernmentalProductionDateData();
|
_updateGovernmentalProductionDateData();
|
||||||
_updateFreeProductionDateData();
|
_updateFreeProductionDateData();
|
||||||
}); */
|
}); */
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateGovernmentalProductionDateData() {
|
void _updateGovernmentalProductionDateData() {
|
||||||
/* List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
/* List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||||
governmentalProductionDateData = {
|
governmentalProductionDateData = {
|
||||||
for (var element in dates)
|
for (var element in dates)
|
||||||
element.day.toString().toJalali.formatCompactDate(): DayData(
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
@@ -89,7 +89,6 @@ class WarehouseAndDistributionSegmentationLogic extends GetxController {
|
|||||||
setUpListener();
|
setUpListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setSearchValue(String? value) {
|
void setSearchValue(String? value) {
|
||||||
searchedValue.value = value?.trim();
|
searchedValue.value = value?.trim();
|
||||||
}
|
}
|
||||||
@@ -149,7 +148,7 @@ class WarehouseAndDistributionSegmentationLogic extends GetxController {
|
|||||||
currentPage.value = 1; // Reset to first page if search value is set
|
currentPage.value = 1; // Reset to first page if search value is set
|
||||||
}
|
}
|
||||||
|
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () async => await rootLogic.chickenRepository.getSegmentation(
|
call: () async => await rootLogic.chickenRepository.getSegmentation(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -187,7 +186,7 @@ class WarehouseAndDistributionSegmentationLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteSegmentation(String key) async {
|
Future<void> deleteSegmentation(String key) async {
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
showSuccess: true,
|
showSuccess: true,
|
||||||
call: () => rootLogic.chickenRepository.deleteSegmentation(
|
call: () => rootLogic.chickenRepository.deleteSegmentation(
|
||||||
@@ -199,7 +198,7 @@ class WarehouseAndDistributionSegmentationLogic extends GetxController {
|
|||||||
|
|
||||||
Future<bool> editSegment() async {
|
Future<bool> editSegment() async {
|
||||||
var res = true;
|
var res = true;
|
||||||
/* safeCall(
|
/* safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () async => await rootLogic.chickenRepository.editSegmentation(
|
call: () async => await rootLogic.chickenRepository.editSegmentation(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -234,7 +233,7 @@ class WarehouseAndDistributionSegmentationLogic extends GetxController {
|
|||||||
segmentationModel = segmentationModel.copyWith(
|
segmentationModel = segmentationModel.copyWith(
|
||||||
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||||
);
|
);
|
||||||
/* await safeCall(
|
/* await safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () async => await rootLogic.chickenRepository.createSegmentation(
|
call: () async => await rootLogic.chickenRepository.createSegmentation(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
@@ -258,7 +257,7 @@ class WarehouseAndDistributionSegmentationLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getGuilds() async {
|
Future<void> getGuilds() async {
|
||||||
/* safeCall(
|
/* safeCall(
|
||||||
call: () async => await rootLogic.chickenRepository.getGuilds(
|
call: () async => await rootLogic.chickenRepository.getGuilds(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
queryParameters: buildQueryParams(queryParams: {'all': true}, role: 'Steward'),
|
queryParameters: buildQueryParams(queryParams: {'all': true}, role: 'Steward'),
|
||||||
@@ -284,7 +283,7 @@ class WarehouseAndDistributionSegmentationLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getBroadcastPrice() async {
|
Future<void> getBroadcastPrice() async {
|
||||||
/* safeCall(
|
/* safeCall(
|
||||||
call: () async => await rootLogic.chickenRepository.getBroadcastPrice(
|
call: () async => await rootLogic.chickenRepository.getBroadcastPrice(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/segmentation/widgets/cu_bottom_sheet.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/segmentation/widgets/cu_bottom_sheet.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/steward/data/model/response/segmentation_model/segmentation_model.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_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
@@ -144,9 +144,7 @@ class WarehouseAndDistributionSegmentationPage
|
|||||||
item.weight.separatedByCommaFa.addKg,
|
item.weight.separatedByCommaFa.addKg,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
style: AppFonts.yekan14Bold.copyWith(
|
style: AppFonts.yekan14Bold.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
item.saleType == "governmental" ? 'دولتی' : 'آزاد',
|
item.saleType == "governmental" ? 'دولتی' : 'آزاد',
|
||||||
@@ -168,10 +166,7 @@ class WarehouseAndDistributionSegmentationPage
|
|||||||
Container itemListExpandedWidget(SegmentationModel item, int index) {
|
Container itemListExpandedWidget(SegmentationModel item, int index) {
|
||||||
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: [
|
||||||
@@ -192,18 +187,13 @@ class WarehouseAndDistributionSegmentationPage
|
|||||||
spacing: 3,
|
spacing: 3,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
DateTimeExtensions(item.date)?.toJalali().formatter.wN ??
|
DateTimeExtensions(item.date)?.toJalali().formatter.wN ?? 'N/A',
|
||||||
'N/A',
|
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
'${DateTimeExtensions(item.date)?.toJalali().formatter.d} ${DateTimeExtensions(item.date)?.toJalali().formatter.mN ?? 'N/A'}',
|
'${DateTimeExtensions(item.date)?.toJalali().formatter.d} ${DateTimeExtensions(item.date)?.toJalali().formatter.mN ?? 'N/A'}',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -238,18 +228,9 @@ class WarehouseAndDistributionSegmentationPage
|
|||||||
? item.toGuild?.guildsName ?? 'N/A'
|
? item.toGuild?.guildsName ?? 'N/A'
|
||||||
: item.buyer?.shop ?? 'N/A',
|
: item.buyer?.shop ?? 'N/A',
|
||||||
),
|
),
|
||||||
buildRow(
|
buildRow(title: 'ماهیت', value: item.toGuild != null ? 'قطعهبند' : 'مباشر'),
|
||||||
title: 'ماهیت',
|
buildRow(title: 'نوع فروش', value: item.saleType == "governmental" ? 'دولتی' : 'آزاد'),
|
||||||
value: item.toGuild != null ? 'قطعهبند' : 'مباشر',
|
buildRow(title: 'انبار فروش', value: item.quota == "governmental" ? 'دولتی' : 'آزاد'),
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'نوع فروش',
|
|
||||||
value: item.saleType == "governmental" ? 'دولتی' : 'آزاد',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'انبار فروش',
|
|
||||||
value: item.quota == "governmental" ? 'دولتی' : 'آزاد',
|
|
||||||
),
|
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'تاریخ تولید گوشت',
|
title: 'تاریخ تولید گوشت',
|
||||||
value: item.productionDate?.toJalali.formatCompactDate() ?? 'ندارد',
|
value: item.productionDate?.toJalali.formatCompactDate() ?? 'ندارد',
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/segmentation/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/segmentation/logic.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
Widget addOrEditBottomSheet(WarehouseAndDistributionSegmentationLogic controller, {bool isOnEdit = false}) {
|
Widget addOrEditBottomSheet(
|
||||||
|
WarehouseAndDistributionSegmentationLogic controller, {
|
||||||
|
bool isOnEdit = false,
|
||||||
|
}) {
|
||||||
return BaseBottomSheet(
|
return BaseBottomSheet(
|
||||||
height: isOnEdit ? 350.h : 600.h,
|
height: isOnEdit ? 350.h : 600.h,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
@@ -257,7 +259,10 @@ Widget addOrEditBottomSheet(WarehouseAndDistributionSegmentationLogic controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget submitButtonWidget(WarehouseAndDistributionSegmentationLogic controller, {bool isOnEdit = false}) {
|
Widget submitButtonWidget(
|
||||||
|
WarehouseAndDistributionSegmentationLogic controller, {
|
||||||
|
bool isOnEdit = false,
|
||||||
|
}) {
|
||||||
return ObxValue((data) {
|
return ObxValue((data) {
|
||||||
return RElevated(
|
return RElevated(
|
||||||
isFullWidth: true,
|
isFullWidth: true,
|
||||||
@@ -279,7 +284,7 @@ Widget submitButtonWidget(WarehouseAndDistributionSegmentationLogic controller,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _productDropDown(WarehouseAndDistributionSegmentationLogic controller) {
|
Widget _productDropDown(WarehouseAndDistributionSegmentationLogic controller) {
|
||||||
/* return Obx(() {
|
/* return Obx(() {
|
||||||
return OverlayDropdownWidget<ProductModel>(
|
return OverlayDropdownWidget<ProductModel>(
|
||||||
items: controller.rootLogic.rolesProductsModel,
|
items: controller.rootLogic.rolesProductsModel,
|
||||||
height: 56,
|
height: 56,
|
||||||
@@ -335,7 +340,10 @@ Widget guildsDropDown(WarehouseAndDistributionSegmentationLogic controller) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Container modalDatePicker(WarehouseAndDistributionSegmentationLogic controller, ValueChanged<Jalali> onDateSelected) {
|
Container modalDatePicker(
|
||||||
|
WarehouseAndDistributionSegmentationLogic controller,
|
||||||
|
ValueChanged<Jalali> onDateSelected,
|
||||||
|
) {
|
||||||
Jalali currentDate = Jalali.now();
|
Jalali currentDate = Jalali.now();
|
||||||
Jalali? tempPickedDate;
|
Jalali? tempPickedDate;
|
||||||
return Container(
|
return Container(
|
||||||
|
|||||||
@@ -1,151 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class PoultryFarmInspectionHomeLogic extends GetxController
|
|
||||||
with GetTickerProviderStateMixin {
|
|
||||||
RxInt selectedSegmentIndex = 0.obs;
|
|
||||||
RxList<Resource<PaginationModel<String>>> inspectionList = RxList([
|
|
||||||
Resource<PaginationModel<String>>.success(
|
|
||||||
PaginationModel(results: ["s", "b", "c", "d"]),
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
RxList<Resource<PaginationModel<String>>> inactiveInspectionList = RxList([
|
|
||||||
Resource<PaginationModel<String>>.success(
|
|
||||||
PaginationModel(results: ["s", "b", "c", "d"]),
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
|
|
||||||
RxInt expandedIndex = RxInt(-1);
|
|
||||||
|
|
||||||
late TabController tabController;
|
|
||||||
|
|
||||||
RxInt selectedTabIndex = 0.obs;
|
|
||||||
|
|
||||||
RxInt activeStepperIndex = 0.obs;
|
|
||||||
|
|
||||||
PageController pageController = PageController(initialPage: 0);
|
|
||||||
|
|
||||||
//step1
|
|
||||||
|
|
||||||
TextEditingController nameOfThePoultryFarmUnit = TextEditingController();
|
|
||||||
|
|
||||||
//step2
|
|
||||||
RxInt sanitaryConditionOfTheHallIndex = (-1).obs;
|
|
||||||
RxInt ventilationStatusIndex = (-1).obs;
|
|
||||||
RxInt beddingStatusIndex = (-1).obs;
|
|
||||||
RxInt waterQualityIndex = (-1).obs;
|
|
||||||
RxInt fuelTypeIndex = (-1).obs;
|
|
||||||
RxInt sampleTypeIndex = (-1).obs;
|
|
||||||
|
|
||||||
//step3
|
|
||||||
RxInt grainQualityInputIndex = (-1).obs;
|
|
||||||
RxInt generatorOperatingStatusIndex = (-1).obs;
|
|
||||||
RxInt workerContractStatusIndex = (-1).obs;
|
|
||||||
RxInt newBeneficiaryRequestIndex = (-1).obs;
|
|
||||||
|
|
||||||
//step4
|
|
||||||
RxInt inspectorConclusionIndex = (-1).obs;
|
|
||||||
TextEditingController inspectorConclusionDescriptionController =
|
|
||||||
TextEditingController();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
|
|
||||||
activeStepperIndex.listen((value) {
|
|
||||||
pageController.animateToPage(
|
|
||||||
value,
|
|
||||||
duration: Duration(milliseconds: 300),
|
|
||||||
curve: Curves.linear,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
|
||||||
expandedIndex.value = expandedIndex.value == index ? -1 : index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void changeSegmentIndex(int index) {
|
|
||||||
if (index == selectedSegmentIndex.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
expandedIndex.value = -1;
|
|
||||||
selectedSegmentIndex.value = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void changeTab(int index) {
|
|
||||||
if (index == selectedTabIndex.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
selectedTabIndex.value = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearForm() {
|
|
||||||
nameOfThePoultryFarmUnit.clear();
|
|
||||||
activeStepperIndex.value = 0;
|
|
||||||
selectedTabIndex.value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSanitaryConditionOfTheHallIndex(int index) {
|
|
||||||
sanitaryConditionOfTheHallIndex.value =
|
|
||||||
index == sanitaryConditionOfTheHallIndex.value ? -1 : index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setFuelTypeIndex(int index) {
|
|
||||||
fuelTypeIndex.value = index == fuelTypeIndex.value ? -1 : index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setVentilationStatusIndex(int index) {
|
|
||||||
ventilationStatusIndex.value = index == ventilationStatusIndex.value
|
|
||||||
? -1
|
|
||||||
: index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setBeddingStatusIndex(int index) {
|
|
||||||
beddingStatusIndex.value = index == beddingStatusIndex.value ? -1 : index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setWaterQualityIndex(int index) {
|
|
||||||
waterQualityIndex.value = index == waterQualityIndex.value ? -1 : index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSampleTypeIndex(int index) {
|
|
||||||
sampleTypeIndex.value = index == sampleTypeIndex.value ? -1 : index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setGrainQualityInputIndex(int index) {
|
|
||||||
grainQualityInputIndex.value = index == grainQualityInputIndex.value
|
|
||||||
? -1
|
|
||||||
: index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setGeneratorOperatingStatusIndex(int index) {
|
|
||||||
generatorOperatingStatusIndex.value =
|
|
||||||
index == generatorOperatingStatusIndex.value ? -1 : index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setWorkerContractStatusIndex(int index) {
|
|
||||||
workerContractStatusIndex.value = index == workerContractStatusIndex.value
|
|
||||||
? -1
|
|
||||||
: index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setNewBeneficiaryRequestIndex(int index) {
|
|
||||||
newBeneficiaryRequestIndex.value = index == newBeneficiaryRequestIndex.value
|
|
||||||
? -1
|
|
||||||
: index;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setInspectorConclusionIndex(int index) {
|
|
||||||
inspectorConclusionIndex.value = index == inspectorConclusionIndex.value
|
|
||||||
? -1
|
|
||||||
: index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,934 +0,0 @@
|
|||||||
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_chicken/presentation/widget/info_card/info_card.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import '../widgets/cu_bottom_sheet.dart';
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class PoultryFarmInspectionHomePage extends GetView<PoultryFarmInspectionHomeLogic> {
|
|
||||||
const PoultryFarmInspectionHomePage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
onFilterTap: () {
|
|
||||||
//TODO
|
|
||||||
},
|
|
||||||
|
|
||||||
onSearchTap: () {
|
|
||||||
//TODO
|
|
||||||
},
|
|
||||||
|
|
||||||
onSearchChanged: (data) {
|
|
||||||
//TODO
|
|
||||||
},
|
|
||||||
backId: poultryFirstKey,
|
|
||||||
|
|
||||||
child: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
Positioned.fill(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
infoCards(),
|
|
||||||
segmentWidget(),
|
|
||||||
ObxValue((data) {
|
|
||||||
return data.value == 0 ? activeInspectionWidget() : inactiveInspectionWidget();
|
|
||||||
}, controller.selectedSegmentIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Positioned(
|
|
||||||
right: 10,
|
|
||||||
bottom: 90.h,
|
|
||||||
child: RFab.add(
|
|
||||||
onPressed: () {
|
|
||||||
Get.bottomSheet(
|
|
||||||
addOrEditBottomSheet(controller),
|
|
||||||
isScrollControlled: true,
|
|
||||||
ignoreSafeArea: false,
|
|
||||||
).then((value) => controller.clearForm());
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Padding infoCards() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(9, 12, 9, 8),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
cardInfo(value: 2225256, description: 'بازرسی شده', color: const Color(0xFFB6DED8)),
|
|
||||||
cardInfo(value: 2050, description: 'بازرسی نشده', color: const Color(0xFFE9CED7)),
|
|
||||||
cardInfo(value: 2225256, description: 'عملکرد مناسب', color: const Color(0xFFCFE0FF)),
|
|
||||||
cardInfo(value: 55225, description: 'عملکرد ضعیف', color: const Color(0xFFF3D6CB)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Padding segmentWidget() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: RSegment(
|
|
||||||
children: ['بازرسی فعال', 'بایگانی'],
|
|
||||||
selectedIndex: 0,
|
|
||||||
borderColor: const Color(0xFFB4B4B4),
|
|
||||||
selectedBorderColor: AppColor.blueNormal,
|
|
||||||
selectedBackgroundColor: AppColor.blueLight,
|
|
||||||
onSegmentSelected: (index) => controller.changeSegmentIndex(index),
|
|
||||||
backgroundColor: AppColor.whiteGreyNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget activeInspectionWidget() {
|
|
||||||
return Expanded(
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return RPaginatedListView(
|
|
||||||
listType: ListType.separated,
|
|
||||||
resource: data.first,
|
|
||||||
hasMore: false,
|
|
||||||
onLoadMore: () async {},
|
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return ObxValue((val) {
|
|
||||||
return ExpandableListItem2(
|
|
||||||
selected: val.value.isEqual(index),
|
|
||||||
onTap: () => controller.toggleExpanded(index),
|
|
||||||
index: index,
|
|
||||||
child: activeinspecitonItemListWidget(),
|
|
||||||
secondChild: avtiveInspectionItemListExpandedWidget(),
|
|
||||||
labelColor: AppColor.blueLight,
|
|
||||||
labelIcon: Assets.vec.checkSquareSvg.path,
|
|
||||||
labelIconColor: AppColor.mediumGreyDarkHover,
|
|
||||||
);
|
|
||||||
}, controller.expandedIndex);
|
|
||||||
},
|
|
||||||
itemCount: 2,
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
|
||||||
);
|
|
||||||
}, controller.inspectionList),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container avtiveInspectionItemListExpandedWidget() {
|
|
||||||
const farmerName = 'آرمان صادقی';
|
|
||||||
const showViolationLabel = true;
|
|
||||||
const violationLabel = 'پیگیری';
|
|
||||||
const breed = 'راس ۳۰۸';
|
|
||||||
const ageInDays = '۴۲';
|
|
||||||
const growPeriod = 'بهار ۱۴۰۴';
|
|
||||||
const licenceNumber = '۱۲۳۴۵۶۷۸';
|
|
||||||
const chickVolume = '۲۵,۰۰۰';
|
|
||||||
const hallRemain = '۲۳,۴۵۰';
|
|
||||||
const losses = '۱,۵۵۰';
|
|
||||||
const vetInfo = 'دکتر نرگس مرادی(۰۹۳۵۴۵۶۶۷۷۹)';
|
|
||||||
const showReportButton = true;
|
|
||||||
const reportStatus = 'ارسال تصویر جوجه ریزی فارم';
|
|
||||||
final reportColor = AppColor.redDark;
|
|
||||||
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(
|
|
||||||
farmerName,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
Visibility(
|
|
||||||
visible: showViolationLabel,
|
|
||||||
child: Text(
|
|
||||||
violationLabel,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.redDark),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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: [
|
|
||||||
Text('نژاد:$breed', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
|
|
||||||
Text(
|
|
||||||
' سن $ageInDays (روزه)',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' دوره جوجه ریزی:$growPeriod',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
buildRow(title: 'شماره مجوز جوجه ریزی', value: licenceNumber),
|
|
||||||
buildUnitRow(title: 'حجم جوجه ریزی', value: chickVolume, unit: '(قطعه)'),
|
|
||||||
buildUnitRow(title: 'مانده در سالن', value: hallRemain, unit: '(قطعه)'),
|
|
||||||
buildUnitRow(title: 'تلفات', value: losses, unit: '(قطعه)'),
|
|
||||||
buildRow(title: 'دامپزشک فارم', value: vetInfo),
|
|
||||||
buildRow(
|
|
||||||
title: 'شرح بازرسی',
|
|
||||||
value: reportStatus,
|
|
||||||
titleStyle: AppFonts.yekan14.copyWith(color: reportColor),
|
|
||||||
valueStyle: AppFonts.yekan14.copyWith(color: reportColor),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
visible: showReportButton,
|
|
||||||
child: RElevated(
|
|
||||||
text: 'ثبت بازرسی',
|
|
||||||
isFullWidth: true,
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
onPressed: () {},
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget activeinspecitonItemListWidget() {
|
|
||||||
const farmerName = 'آرمان صادقی';
|
|
||||||
const farmerMobile = '۰۹۱۲۱۲۳۴۵۶۷';
|
|
||||||
const unitName = 'فارم نمونه آفتاب';
|
|
||||||
const unitLicence = 'مجوز ۵۴۲۱-الف';
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 5,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
farmerName,
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
farmerMobile,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
spacing: 5,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
unitName,
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
unitLicence,
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Assets.vec.scanSvg.svg(
|
|
||||||
width: 32.w,
|
|
||||||
height: 32.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget inactiveInspectionWidget() {
|
|
||||||
return Expanded(
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return RPaginatedListView(
|
|
||||||
listType: ListType.separated,
|
|
||||||
resource: data.first,
|
|
||||||
hasMore: false,
|
|
||||||
onLoadMore: () async {},
|
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return ObxValue((val) {
|
|
||||||
return ExpandableListItem2(
|
|
||||||
selected: val.value.isEqual(index),
|
|
||||||
onTap: () => controller.toggleExpanded(index),
|
|
||||||
index: index,
|
|
||||||
child: inActiveinspecitonItemListWidget(),
|
|
||||||
secondChild: inAvtiveInspectionItemListExpandedWidget(),
|
|
||||||
labelColor: AppColor.blueLight,
|
|
||||||
labelIcon: Assets.vec.checkSquareSvg.path,
|
|
||||||
labelIconColor: AppColor.mediumGreyDarkHover,
|
|
||||||
);
|
|
||||||
}, controller.expandedIndex);
|
|
||||||
},
|
|
||||||
itemCount: 5,
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
|
||||||
);
|
|
||||||
}, controller.inspectionList),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget inActiveinspecitonItemListWidget() {
|
|
||||||
const farmerName = 'زهرا موسوی';
|
|
||||||
const farmerMobile = '۰۹۳۸۸۸۷۷۶۶۵';
|
|
||||||
const unitName = 'کشت و پرورش افق سبز';
|
|
||||||
const unitLicence = 'مجوز ۷۶۳۲-ج';
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 5,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
farmerName,
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
farmerMobile,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
spacing: 5,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
unitName,
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
unitLicence,
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Assets.vec.scanSvg.svg(
|
|
||||||
width: 32.w,
|
|
||||||
height: 32.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container inAvtiveInspectionItemListExpandedWidget() {
|
|
||||||
const farmerName = 'زهرا موسوی';
|
|
||||||
const showViolationLabel = false;
|
|
||||||
const violationLabel = 'عادی';
|
|
||||||
const breed = 'کاب ۵۰۰';
|
|
||||||
const ageInDays = '۳۵';
|
|
||||||
const growPeriod = 'پاییز ۱۴۰۳';
|
|
||||||
const licenceNumber = '۸۹۴۵۶۱۲۳';
|
|
||||||
const chickVolume = '۱۸,۵۰۰';
|
|
||||||
const hallRemain = '۱۷,۹۴۰';
|
|
||||||
const losses = '۵۶۰';
|
|
||||||
const vetInfo = 'دکتر حمید نادری(۰۹۱۳۴۴۵۵۶۶۷)';
|
|
||||||
const reportStatus = 'بازدید تایید شده';
|
|
||||||
final reportColor = AppColor.greenNormal;
|
|
||||||
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(
|
|
||||||
farmerName,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
Visibility(
|
|
||||||
visible: showViolationLabel,
|
|
||||||
child: Text(
|
|
||||||
violationLabel,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.redDark),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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: [
|
|
||||||
Text('نژاد:$breed', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
|
|
||||||
Text(
|
|
||||||
' سن $ageInDays (روزه)',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' دوره جوجه ریزی:$growPeriod',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
buildRow(title: 'شماره مجوز جوجه ریزی', value: licenceNumber),
|
|
||||||
buildUnitRow(title: 'حجم جوجه ریزی', value: chickVolume, unit: '(قطعه)'),
|
|
||||||
buildUnitRow(title: 'مانده در سالن', value: hallRemain, unit: '(قطعه)'),
|
|
||||||
buildUnitRow(title: 'تلفات', value: losses, unit: '(قطعه)'),
|
|
||||||
buildRow(title: 'دامپزشک فارم', value: vetInfo),
|
|
||||||
buildRow(
|
|
||||||
title: 'شرح بازرسی',
|
|
||||||
value: reportStatus,
|
|
||||||
titleStyle: AppFonts.yekan14.copyWith(color: reportColor),
|
|
||||||
valueStyle: AppFonts.yekan14.copyWith(color: reportColor),
|
|
||||||
),
|
|
||||||
ROutlinedElevated(
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Assets.vec.excelDownloadSvg.svg(
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.greenDark, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'مشاهده جزییات ',
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
borderColor: AppColor.greenDark,
|
|
||||||
onPressed: () {
|
|
||||||
Get.bottomSheet(detailsWidget(), isScrollControlled: true, isDismissible: true);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget detailsWidget() {
|
|
||||||
return BaseBottomSheet(
|
|
||||||
height: Get.height * 0.8,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 10),
|
|
||||||
child: Text(
|
|
||||||
'جزییات',
|
|
||||||
style: AppFonts.yekan18Bold.copyWith(color: AppColor.iconColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Divider(color: AppColor.blackLightHover, height: 1, thickness: 1),
|
|
||||||
ObxValue((data) {
|
|
||||||
return tabBarWidget(
|
|
||||||
['اطلاعات', 'پاییش سلامت', 'زیرساخت', 'مستندات'],
|
|
||||||
controller.selectedTabIndex.value,
|
|
||||||
(index) => controller.changeTab(index),
|
|
||||||
);
|
|
||||||
}, controller.selectedTabIndex),
|
|
||||||
|
|
||||||
ObxValue((data) {
|
|
||||||
switch (data.value) {
|
|
||||||
case 0:
|
|
||||||
return infoTable();
|
|
||||||
case 1:
|
|
||||||
return healthTable();
|
|
||||||
case 2:
|
|
||||||
return infrastructureTable();
|
|
||||||
case 3:
|
|
||||||
return documentsTable();
|
|
||||||
default:
|
|
||||||
return infoTable();
|
|
||||||
}
|
|
||||||
}, controller.selectedTabIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Expanded در سطح بالاتر
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container infoTable() {
|
|
||||||
return Container(
|
|
||||||
height: Get.height,
|
|
||||||
width: Get.width,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text('مشخصات کلی', style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
rTableRow(title: 'نام واحد مرغداری', value: 'لذیذ'),
|
|
||||||
rTableRow(title: 'کد یکتا / شناسه واحد', value: '2541415'),
|
|
||||||
rTableRow(title: 'نام مالک / بهرهبردار', value: 'مرغداری احمدی'),
|
|
||||||
rTableRow(title: 'موجودی سوخت اضطراری', value: '200 لیتر'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Row rTableRow({String? title, String? value}) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 9, vertical: 11),
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.bgLight2,
|
|
||||||
border: Border(bottom: BorderSide(color: AppColor.blackLightHover, width: 1)),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
title ?? '',
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.iconColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 9, vertical: 11),
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(bottom: BorderSide(color: AppColor.blackLightHover, width: 1)),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
value ?? '',
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget tabBarWidget(List<String> tabs, int selectedIndex, Function(int) onTabSelected) {
|
|
||||||
return SizedBox(
|
|
||||||
height: 38.h,
|
|
||||||
width: Get.width,
|
|
||||||
child: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
right: 0,
|
|
||||||
top: 0,
|
|
||||||
bottom: 0,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
...tabs.map(
|
|
||||||
(tab) => GestureDetector(
|
|
||||||
onTap: () => onTabSelected(tabs.indexOf(tab)),
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 11),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: tab == tabs[selectedIndex]
|
|
||||||
? Border(bottom: BorderSide(color: AppColor.blueNormalOld, width: 3))
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
tab,
|
|
||||||
style: AppFonts.yekan12Bold.copyWith(
|
|
||||||
color: tab == tabs[selectedIndex]
|
|
||||||
? AppColor.blueNormalOld
|
|
||||||
: AppColor.mediumGrey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Positioned(
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Divider(color: AppColor.blackLightHover, height: 1, thickness: 1),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget healthTable() {
|
|
||||||
return Container(
|
|
||||||
height: Get.height,
|
|
||||||
width: Get.width,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text('پاییش سلامت', style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
rTableRow(title: 'نام واحد مرغداری', value: 'لذیذ'),
|
|
||||||
rTableRow(title: 'کد یکتا / شناسه واحد', value: '2541415'),
|
|
||||||
rTableRow(title: 'نام مالک / بهرهبردار', value: 'مرغداری احمدی'),
|
|
||||||
rTableRow(title: 'موجودی سوخت اضطراری', value: '200 لیتر'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget infrastructureTable() {
|
|
||||||
return Container(
|
|
||||||
height: Get.height,
|
|
||||||
width: Get.width,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text('زیرساخت', style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
rTableRow(title: 'نام واحد مرغداری', value: 'لذیذ'),
|
|
||||||
rTableRow(title: 'کد یکتا / شناسه واحد', value: '2541415'),
|
|
||||||
rTableRow(title: 'نام مالک / بهرهبردار', value: 'مرغداری احمدی'),
|
|
||||||
rTableRow(title: 'موجودی سوخت اضطراری', value: '200 لیتر'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(title: 'تاریخ ثبت جوجه ریزی', value: '1402/09/19 (10:12)'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget documentsTable() {
|
|
||||||
return Container(
|
|
||||||
height: Get.height,
|
|
||||||
width: Get.width,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text('مستندات', style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 16),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 135.h,
|
|
||||||
width: Get.width,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.bgLight,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 100.h,
|
|
||||||
width: Get.width,
|
|
||||||
child: ListView.separated(
|
|
||||||
itemCount: 10,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return Container(
|
|
||||||
width: 80.w,
|
|
||||||
height: 80.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0x33000000),
|
|
||||||
image: DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: NetworkImage("https://picsum.photos/150/150?random=$index"),
|
|
||||||
),
|
|
||||||
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (context, index) => SizedBox(width: 10),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'200 فارم در این سالن تخمین زده شده است.',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 16),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 135.h,
|
|
||||||
width: Get.width,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.bgLight,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 100.h,
|
|
||||||
width: Get.width,
|
|
||||||
child: ListView.separated(
|
|
||||||
itemCount: 10,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return Container(
|
|
||||||
width: 80.w,
|
|
||||||
height: 80.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0x33000000),
|
|
||||||
image: DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: NetworkImage(
|
|
||||||
"https://picsum.photos/150/150?random=${index * 2 + 1}",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (context, index) => SizedBox(width: 10),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'انبار نهاده ها',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 16),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 135.h,
|
|
||||||
width: Get.width,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.bgLight,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 100.h,
|
|
||||||
width: Get.width,
|
|
||||||
child: ListView.separated(
|
|
||||||
itemCount: 10,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return Container(
|
|
||||||
width: 80.w,
|
|
||||||
height: 80.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0x33000000),
|
|
||||||
image: DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: NetworkImage(
|
|
||||||
"https://picsum.photos/150/150?random=${index * 3 + 1}",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (context, index) => SizedBox(width: 10),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'تلفات',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/home/logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/home/logic.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -20,8 +19,7 @@ Widget farmInfoWidget({
|
|||||||
border: Border.all(width: 0.50, color: AppColor.mediumGrey),
|
border: Border.all(width: 0.50, color: AppColor.mediumGrey),
|
||||||
),
|
),
|
||||||
|
|
||||||
padding:
|
padding: padding ?? EdgeInsets.symmetric(horizontal: 12.w, vertical: 11.h),
|
||||||
padding ?? EdgeInsets.symmetric(horizontal: 12.w, vertical: 11.h),
|
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -35,10 +33,7 @@ Widget farmInfoWidget({
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
border: Border.all(width: 0.50, color: AppColor.mediumGrey),
|
border: Border.all(width: 0.50, color: AppColor.mediumGrey),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(title, style: AppFonts.yekan14.copyWith(color: AppColor.iconColor)),
|
||||||
title,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.iconColor),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/home/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
Widget farmInfoWidget({
|
|
||||||
required PoultryFarmInspectionHomeLogic controller,
|
|
||||||
required String title,
|
|
||||||
required Widget child,
|
|
||||||
EdgeInsets? padding,
|
|
||||||
}) {
|
|
||||||
return Stack(
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: [
|
|
||||||
Positioned.fill(
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 0.50, color: AppColor.mediumGrey),
|
|
||||||
),
|
|
||||||
|
|
||||||
padding:
|
|
||||||
padding ?? EdgeInsets.symmetric(horizontal: 12.w, vertical: 11.h),
|
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: -17,
|
|
||||||
right: 7,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 5.h),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 0.50, color: AppColor.mediumGrey),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
title,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.iconColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget cardInfo({required Widget child, EdgeInsets? padding}) {
|
|
||||||
return Container(
|
|
||||||
width: Get.width,
|
|
||||||
padding: padding ?? EdgeInsets.symmetric(horizontal: 12.w, vertical: 14.h),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.bgLight,
|
|
||||||
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 1, color: AppColor.blackLight),
|
|
||||||
),
|
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,224 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
import '../home/logic.dart';
|
|
||||||
import 'step1_page.dart';
|
|
||||||
import 'step2_page.dart';
|
|
||||||
import 'step3_page.dart';
|
|
||||||
import 'step4_page.dart';
|
|
||||||
import 'step5_page.dart';
|
|
||||||
|
|
||||||
Widget addOrEditBottomSheet(PoultryFarmInspectionHomeLogic controller) {
|
|
||||||
List<Widget> pages = [
|
|
||||||
step1Page(controller),
|
|
||||||
step2Page(controller),
|
|
||||||
step3Page(controller),
|
|
||||||
step4Page(controller),
|
|
||||||
step5Page(controller),
|
|
||||||
];
|
|
||||||
|
|
||||||
return BaseBottomSheet(
|
|
||||||
height: Get.height,
|
|
||||||
rootChild: Column(
|
|
||||||
children: [
|
|
||||||
ObxValue((data) {
|
|
||||||
return stepper(activeStep: data.value);
|
|
||||||
}, controller.activeStepperIndex),
|
|
||||||
Expanded(
|
|
||||||
child: PageView.builder(
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
reverse: true,
|
|
||||||
controller: controller.pageController,
|
|
||||||
itemBuilder: (context, index) => pages[index],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
ObxValue((data) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
||||||
child: Row(
|
|
||||||
spacing: 16,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: RElevated(
|
|
||||||
height: 40.h,
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
|
|
||||||
children: [
|
|
||||||
Icon(Icons.arrow_back_ios, color: Colors.white),
|
|
||||||
|
|
||||||
Text('ادامه'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
if (controller.activeStepperIndex.value <4) {
|
|
||||||
controller.activeStepperIndex.value++;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: ROutlinedElevated(
|
|
||||||
borderColor: AppColor.error,
|
|
||||||
height: 40.h,
|
|
||||||
child: Text('برگشت'),
|
|
||||||
enabled: controller.activeStepperIndex.value > 0,
|
|
||||||
onPressed: () {
|
|
||||||
if (controller.activeStepperIndex.value > 0) {
|
|
||||||
controller.activeStepperIndex.value--;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.activeStepperIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class stepper extends StatelessWidget {
|
|
||||||
const stepper({super.key, required this.activeStep});
|
|
||||||
final int activeStep;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Directionality(
|
|
||||||
textDirection: TextDirection.ltr,
|
|
||||||
child: SizedBox(
|
|
||||||
height: 24,
|
|
||||||
width: Get.width,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: activeStep >= 0
|
|
||||||
? AppColor.greenNormalHover
|
|
||||||
: AppColor.whiteNormalActive,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
child: Text(
|
|
||||||
'1',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(
|
|
||||||
color: activeStep >= 0 ? Colors.white : AppColor.iconColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Divider(
|
|
||||||
color: activeStep >= 1
|
|
||||||
? AppColor.greenNormalHover
|
|
||||||
: AppColor.whiteNormalActive,
|
|
||||||
thickness: 8,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: activeStep >= 1
|
|
||||||
? AppColor.greenNormalHover
|
|
||||||
: AppColor.whiteNormalActive,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
child: Text(
|
|
||||||
'2',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(
|
|
||||||
color: activeStep >= 1 ? Colors.white : AppColor.iconColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Divider(
|
|
||||||
color: activeStep >= 2
|
|
||||||
? AppColor.greenNormalHover
|
|
||||||
: AppColor.whiteNormalActive,
|
|
||||||
thickness: 8,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: activeStep >= 2
|
|
||||||
? AppColor.greenNormalHover
|
|
||||||
: AppColor.whiteNormalActive,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
child: Text(
|
|
||||||
'3',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(
|
|
||||||
color: activeStep >= 2 ? Colors.white : AppColor.iconColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Divider(
|
|
||||||
color: activeStep >= 3
|
|
||||||
? AppColor.greenNormalHover
|
|
||||||
: AppColor.whiteNormalActive,
|
|
||||||
thickness: 8,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: activeStep >= 3
|
|
||||||
? AppColor.greenNormalHover
|
|
||||||
: AppColor.whiteNormalActive,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
child: Text(
|
|
||||||
'4',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(
|
|
||||||
color: activeStep >= 3 ? Colors.white : AppColor.iconColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Divider(
|
|
||||||
color: activeStep >= 4
|
|
||||||
? AppColor.greenNormalHover
|
|
||||||
: AppColor.whiteNormalActive,
|
|
||||||
thickness: 8,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: activeStep >= 4
|
|
||||||
? AppColor.greenNormalHover
|
|
||||||
: AppColor.whiteNormalActive,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
child: Text(
|
|
||||||
'5',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(
|
|
||||||
color: activeStep >= 3 ? Colors.white : AppColor.iconColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,167 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import '../home/logic.dart';
|
|
||||||
|
|
||||||
Widget step1Page(PoultryFarmInspectionHomeLogic controller) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 25.h),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 610.h,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
width: Get.width,
|
|
||||||
child: farmInfoWidget(
|
|
||||||
controller: controller,
|
|
||||||
title: 'اطلاعات پایه واحد',
|
|
||||||
child: basicUnitInformation(controller),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 30.h),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 400.h,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
width: Get.width,
|
|
||||||
child: farmInfoWidget(
|
|
||||||
controller: controller,
|
|
||||||
title: 'اطلاعات جوجه ریزی',
|
|
||||||
child: hatchingInformation(controller),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 16.h),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Column basicUnitInformation(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,
|
|
||||||
),
|
|
||||||
|
|
||||||
ResourceOverlayDropdown(
|
|
||||||
items: Resource.success(['مالک', 'بهرهبردار', 'مشاور', 'دیگر']),
|
|
||||||
|
|
||||||
itemBuilder: (item) => Text(item),
|
|
||||||
labelBuilder: (selected) => Text(selected ?? 'نوع مالکیت'),
|
|
||||||
),
|
|
||||||
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
|
|
||||||
RElevated(
|
|
||||||
isFullWidth: true,
|
|
||||||
height: 40.h,
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
onPressed: () {},
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Icon(Icons.my_location_rounded, color: Colors.white, size: 24),
|
|
||||||
Text('دریافت موقعیت جغرافیایی', style: AppFonts.yekan14.copyWith(color: Colors.white)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Column hatchingInformation(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,
|
|
||||||
),
|
|
||||||
|
|
||||||
ResourceOverlayDropdown(
|
|
||||||
items: Resource.success(['سرابی', 'پژدر', 'روتوایلر', 'دیگر']),
|
|
||||||
|
|
||||||
itemBuilder: (item) => Text(item),
|
|
||||||
labelBuilder: (selected) => Text(selected ?? 'نوع نژاد'),
|
|
||||||
),
|
|
||||||
|
|
||||||
RTextField(
|
|
||||||
controller: controller.nameOfThePoultryFarmUnit,
|
|
||||||
label: 'گرید جوجه',
|
|
||||||
filled: true,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
),
|
|
||||||
RTextField(
|
|
||||||
controller: controller.nameOfThePoultryFarmUnit,
|
|
||||||
label: 'میانگین وزن جوجه در ورود',
|
|
||||||
filled: true,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,500 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import '../home/logic.dart';
|
|
||||||
|
|
||||||
Widget step2Page(PoultryFarmInspectionHomeLogic controller) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 35.h),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 760.h,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
width: Get.width,
|
|
||||||
child: farmInfoWidget(
|
|
||||||
controller: controller,
|
|
||||||
title: 'وضعیت عمومی سالن',
|
|
||||||
child: generalConditionOfTheHall(controller),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 30.h),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 430.h,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
width: Get.width,
|
|
||||||
child: farmInfoWidget(
|
|
||||||
controller: controller,
|
|
||||||
title: 'تلفات',
|
|
||||||
child: casualtiesInformation(controller),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 24.h),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 450.h,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
width: Get.width,
|
|
||||||
child: farmInfoWidget(
|
|
||||||
controller: controller,
|
|
||||||
title: 'بیماریها و وضعیت سلامت',
|
|
||||||
child: diseasesAndHealthInformation(controller),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Column generalConditionOfTheHall(PoultryFarmInspectionHomeLogic controller) {
|
|
||||||
return Column(
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 12),
|
|
||||||
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(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.spaceBetween,
|
|
||||||
children: [
|
|
||||||
formChips(
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'عالی',
|
|
||||||
onTap: (index) => controller.setSanitaryConditionOfTheHallIndex(index),
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'خوب',
|
|
||||||
onTap: (index) => controller.setSanitaryConditionOfTheHallIndex(index),
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'متوسط',
|
|
||||||
onTap: (index) => controller.setSanitaryConditionOfTheHallIndex(index),
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 3,
|
|
||||||
label: 'ضعیف',
|
|
||||||
onTap: (index) => controller.setSanitaryConditionOfTheHallIndex(index),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.sanitaryConditionOfTheHallIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
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.setVentilationStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'خشک',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setVentilationStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'نیمهمرطوب',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setVentilationStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'مرطوب',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.ventilationStatusIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
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 SingleChildScrollView(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
child: Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setBeddingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'خشک',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setBeddingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'نیمهمرطوب',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setBeddingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'مرطوب',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setBeddingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'نیازمند اصلاح',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.beddingStatusIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
RTextField(
|
|
||||||
controller: controller.nameOfThePoultryFarmUnit,
|
|
||||||
label: 'دمای سالن',
|
|
||||||
filled: true,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
maxLines: 1,
|
|
||||||
minLines: 1,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
),
|
|
||||||
|
|
||||||
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.setWaterQualityIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'چاه',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setWaterQualityIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'شهری',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setWaterQualityIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'تصفیهشده',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.waterQualityIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
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.spaceBetween,
|
|
||||||
children: [
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setFuelTypeIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'گازوییل',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setFuelTypeIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'بنزین',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setFuelTypeIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'گاز',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 3,
|
|
||||||
label: 'نفت',
|
|
||||||
onTap: (index) => controller.setFuelTypeIndex(index),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.fuelTypeIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 casualtiesInformation(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,
|
|
||||||
),
|
|
||||||
|
|
||||||
ResourceOverlayDropdown(
|
|
||||||
items: Resource.success(['بیماری', 'قطعی برق', 'استرس گرمایی', 'مشکلات دانه']),
|
|
||||||
|
|
||||||
itemBuilder: (item) => Text(item),
|
|
||||||
labelBuilder: (selected) => Text(selected ?? 'علت احتمالی تلفات غیرعادی'),
|
|
||||||
),
|
|
||||||
|
|
||||||
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.setSampleTypeIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'رنده',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setSampleTypeIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'لاشه',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setSampleTypeIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'ترکیبی',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.sampleTypeIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Column diseasesAndHealthInformation(PoultryFarmInspectionHomeLogic controller) {
|
|
||||||
return Column(
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 1.h),
|
|
||||||
|
|
||||||
ResourceOverlayDropdown(
|
|
||||||
items: Resource.success(['بیماری', 'قطعی برق', 'استرس گرمایی', 'مشکلات دانه']),
|
|
||||||
|
|
||||||
itemBuilder: (item) => Text(item),
|
|
||||||
labelBuilder: (selected) => Text(selected ?? 'وجود علائم بیماری در گله'),
|
|
||||||
),
|
|
||||||
|
|
||||||
ResourceOverlayDropdown(
|
|
||||||
items: Resource.success(['انجام نشد', 'انجام شد']),
|
|
||||||
|
|
||||||
itemBuilder: (item) => Text(item),
|
|
||||||
labelBuilder: (selected) => Text(selected ?? 'نوع بیماری تشخیص دادهشده / مشکوک'),
|
|
||||||
),
|
|
||||||
|
|
||||||
RTextField(
|
|
||||||
controller: controller.nameOfThePoultryFarmUnit,
|
|
||||||
label: 'تاریخ واکسیناسیونهای انجامشده',
|
|
||||||
filled: true,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
),
|
|
||||||
|
|
||||||
ResourceOverlayDropdown(
|
|
||||||
items: Resource.success([
|
|
||||||
'واکسن 1',
|
|
||||||
'واکسن 2',
|
|
||||||
'واکسن 3',
|
|
||||||
'واکسن 4',
|
|
||||||
'واکسن 5',
|
|
||||||
'واکسن 6',
|
|
||||||
'واکسن 7',
|
|
||||||
'واکسن 8',
|
|
||||||
'واکسن 9',
|
|
||||||
'واکسن 10',
|
|
||||||
]),
|
|
||||||
|
|
||||||
itemBuilder: (item) => Text(item),
|
|
||||||
labelBuilder: (selected) => Text(selected ?? 'نوع واکسن'),
|
|
||||||
),
|
|
||||||
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,720 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/widgets/card_info.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import '../home/logic.dart';
|
|
||||||
|
|
||||||
Widget step3Page(PoultryFarmInspectionHomeLogic controller) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 35.h),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 410.h,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
width: Get.width,
|
|
||||||
child: farmInfoWidget(
|
|
||||||
controller: controller,
|
|
||||||
title: 'نهاده و خوراک',
|
|
||||||
child: agriculturalInput(controller),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 30.h),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 650.h,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
width: Get.width,
|
|
||||||
child: farmInfoWidget(
|
|
||||||
controller: controller,
|
|
||||||
title: 'زیرساخت و انرژی',
|
|
||||||
child: infrastructureAndEnergy(controller),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 24.h),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 405.h,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
width: Get.width,
|
|
||||||
child: farmInfoWidget(
|
|
||||||
controller: controller,
|
|
||||||
title: 'نیروی انسانی',
|
|
||||||
child: humanResources(controller),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 24.h),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 440.h,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
width: Get.width,
|
|
||||||
child: farmInfoWidget(
|
|
||||||
controller: controller,
|
|
||||||
title: 'تسهیلات و حمایتها',
|
|
||||||
child: facilitiesAndSupport(controller),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Column agriculturalInput2(PoultryFarmInspectionHomeLogic controller) {
|
|
||||||
return Column(
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
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(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.spaceBetween,
|
|
||||||
children: [
|
|
||||||
formChips(
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'عالی',
|
|
||||||
onTap: (index) => controller.setSanitaryConditionOfTheHallIndex(index),
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'خوب',
|
|
||||||
onTap: (index) => controller.setSanitaryConditionOfTheHallIndex(index),
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'متوسط',
|
|
||||||
onTap: (index) => controller.setSanitaryConditionOfTheHallIndex(index),
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 3,
|
|
||||||
label: 'ضعیف',
|
|
||||||
onTap: (index) => controller.setSanitaryConditionOfTheHallIndex(index),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.sanitaryConditionOfTheHallIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
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.setVentilationStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'خشک',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setVentilationStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'نیمهمرطوب',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setVentilationStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'مرطوب',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.ventilationStatusIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
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 SingleChildScrollView(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
child: Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setBeddingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'خشک',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setBeddingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'نیمهمرطوب',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setBeddingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'مرطوب',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setBeddingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'نیازمند اصلاح',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.beddingStatusIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
RTextField(
|
|
||||||
controller: controller.nameOfThePoultryFarmUnit,
|
|
||||||
label: 'دمای سالن',
|
|
||||||
filled: true,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
maxLines: 1,
|
|
||||||
minLines: 1,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
),
|
|
||||||
|
|
||||||
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.setWaterQualityIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'چاه',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setWaterQualityIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'شهری',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setWaterQualityIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'تصفیهشده',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.waterQualityIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
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.spaceBetween,
|
|
||||||
children: [
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setFuelTypeIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'گازوییل',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setFuelTypeIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'بنزین',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setFuelTypeIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'گاز',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 3,
|
|
||||||
label: 'نفت',
|
|
||||||
onTap: (index) => controller.setFuelTypeIndex(index),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.fuelTypeIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 infrastructureAndEnergy(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: 'ظرفیت (KVA)',
|
|
||||||
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.setGeneratorOperatingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 0,
|
|
||||||
label: 'سالم',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setGeneratorOperatingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 1,
|
|
||||||
label: 'نیمهسالم',
|
|
||||||
),
|
|
||||||
formChips(
|
|
||||||
onTap: (index) => controller.setGeneratorOperatingStatusIndex(index),
|
|
||||||
selectedIndex: data.value,
|
|
||||||
index: 2,
|
|
||||||
label: 'معیوب',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.generatorOperatingStatusIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
RTextField(
|
|
||||||
controller: controller.nameOfThePoultryFarmUnit,
|
|
||||||
label: 'میزان موجودی سوخت اضطراری (لیتر)',
|
|
||||||
filled: true,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
),
|
|
||||||
|
|
||||||
ResourceOverlayDropdown(
|
|
||||||
items: Resource.success(['بیماری', 'قطعی برق', 'استرس گرمایی', 'مشکلات دانه']),
|
|
||||||
|
|
||||||
itemBuilder: (item) => Text(item),
|
|
||||||
labelBuilder: (selected) => Text(selected ?? 'علت احتمالی تلفات غیرعادی'),
|
|
||||||
),
|
|
||||||
|
|
||||||
ResourceOverlayDropdown(
|
|
||||||
items: Resource.success(['ندارد', 'دارد']),
|
|
||||||
|
|
||||||
itemBuilder: (item) => Text(item),
|
|
||||||
labelBuilder: (selected) => Text(selected ?? 'سابقه قطعی برق دوره جاری'),
|
|
||||||
),
|
|
||||||
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 SingleChildScrollView(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
child: 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),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,488 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/presentation/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: 455.h,
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
width: Get.width,
|
|
||||||
child: farmInfoWidget(
|
|
||||||
controller: controller,
|
|
||||||
title: 'مستندات',
|
|
||||||
child: documents(controller),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 30.h),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 220.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 SingleChildScrollView(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
child: 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: 'توصیهها / اخطارها / اقدامات اصلاحی ...',
|
|
||||||
hintStyle: AppFonts.yekan14.copyWith(color: AppColor.textColorLight),
|
|
||||||
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),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,598 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import '../home/logic.dart';
|
|
||||||
|
|
||||||
Widget step5Page(PoultryFarmInspectionHomeLogic controller) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
child: detailsWidget(controller),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget detailsWidget(PoultryFarmInspectionHomeLogic controller) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 4,
|
|
||||||
vertical: 10,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'جزییات',
|
|
||||||
style: AppFonts.yekan18Bold.copyWith(
|
|
||||||
color: AppColor.iconColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Divider(color: AppColor.blackLightHover, height: 1, thickness: 1),
|
|
||||||
ObxValue((data) {
|
|
||||||
return tabBarWidget(
|
|
||||||
['اطلاعات', 'پاییش سلامت', 'زیرساخت', 'مستندات'],
|
|
||||||
controller.selectedTabIndex.value,
|
|
||||||
(index) => controller.changeTab(index),
|
|
||||||
);
|
|
||||||
}, controller.selectedTabIndex),
|
|
||||||
|
|
||||||
ObxValue((data) {
|
|
||||||
switch (data.value) {
|
|
||||||
case 0:
|
|
||||||
return infoTable();
|
|
||||||
case 1:
|
|
||||||
return healthTable();
|
|
||||||
case 2:
|
|
||||||
return infrastructureTable();
|
|
||||||
case 3:
|
|
||||||
return documentsTable();
|
|
||||||
default:
|
|
||||||
return infoTable();
|
|
||||||
}
|
|
||||||
}, controller.selectedTabIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
// Expanded در سطح بالاتر
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Column infoTable() {
|
|
||||||
return Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'مشخصات کلی',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
rTableRow(title: 'نام واحد مرغداری', value: 'لذیذ'),
|
|
||||||
rTableRow(title: 'کد یکتا / شناسه واحد', value: '2541415'),
|
|
||||||
rTableRow(title: 'نام مالک / بهرهبردار', value: 'مرغداری احمدی'),
|
|
||||||
rTableRow(title: 'موجودی سوخت اضطراری', value: '200 لیتر'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(
|
|
||||||
title: 'تاریخ ثبت جوجه ریزی',
|
|
||||||
value: '1402/09/19 (10:12)',
|
|
||||||
),
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(
|
|
||||||
title: 'تاریخ ثبت جوجه ریزی',
|
|
||||||
value: '1402/09/19 (10:12)',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Row rTableRow({String? title, String? value}) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 9, vertical: 11),
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.bgLight2,
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(color: AppColor.blackLightHover, width: 1),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
title ?? '',
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.iconColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 9, vertical: 11),
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(color: AppColor.blackLightHover, width: 1),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
value ?? '',
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget tabBarWidget(
|
|
||||||
List<String> tabs,
|
|
||||||
int selectedIndex,
|
|
||||||
Function(int) onTabSelected,
|
|
||||||
) {
|
|
||||||
return SizedBox(
|
|
||||||
height: 38.h,
|
|
||||||
width: Get.width,
|
|
||||||
child: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
right: 0,
|
|
||||||
top: 0,
|
|
||||||
bottom: 0,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
...tabs.map(
|
|
||||||
(tab) => GestureDetector(
|
|
||||||
onTap: () => onTabSelected(tabs.indexOf(tab)),
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 11),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: tab == tabs[selectedIndex]
|
|
||||||
? Border(
|
|
||||||
bottom: BorderSide(
|
|
||||||
color: AppColor.blueNormalOld,
|
|
||||||
width: 3,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
tab,
|
|
||||||
style: AppFonts.yekan12Bold.copyWith(
|
|
||||||
color: tab == tabs[selectedIndex]
|
|
||||||
? AppColor.blueNormalOld
|
|
||||||
: AppColor.mediumGrey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Positioned(
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Divider(
|
|
||||||
color: AppColor.blackLightHover,
|
|
||||||
height: 1,
|
|
||||||
thickness: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget healthTable() {
|
|
||||||
return Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'پاییش سلامت',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
rTableRow(title: 'نام واحد مرغداری', value: 'لذیذ'),
|
|
||||||
rTableRow(title: 'کد یکتا / شناسه واحد', value: '2541415'),
|
|
||||||
rTableRow(title: 'نام مالک / بهرهبردار', value: 'مرغداری احمدی'),
|
|
||||||
rTableRow(title: 'موجودی سوخت اضطراری', value: '200 لیتر'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(
|
|
||||||
title: 'تاریخ ثبت جوجه ریزی',
|
|
||||||
value: '1402/09/19 (10:12)',
|
|
||||||
),
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(
|
|
||||||
title: 'تاریخ ثبت جوجه ریزی',
|
|
||||||
value: '1402/09/19 (10:12)',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget infrastructureTable() {
|
|
||||||
return Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'زیرساخت',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
rTableRow(title: 'نام واحد مرغداری', value: 'لذیذ'),
|
|
||||||
rTableRow(title: 'کد یکتا / شناسه واحد', value: '2541415'),
|
|
||||||
rTableRow(title: 'نام مالک / بهرهبردار', value: 'مرغداری احمدی'),
|
|
||||||
rTableRow(title: 'موجودی سوخت اضطراری', value: '200 لیتر'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(
|
|
||||||
title: 'تاریخ ثبت جوجه ریزی',
|
|
||||||
value: '1402/09/19 (10:12)',
|
|
||||||
),
|
|
||||||
rTableRow(title: 'شهر/تعاونی', value: 'خرم آباد/تعاونی خرم آباد'),
|
|
||||||
|
|
||||||
rTableRow(title: 'شماره تلفن واحد', value: '021-12345678'),
|
|
||||||
rTableRow(title: 'دامپزشک فارم', value: 'dd dd (05218569685)'),
|
|
||||||
|
|
||||||
rTableRow(title: 'سالن', value: '2'),
|
|
||||||
rTableRow(
|
|
||||||
title: 'تاریخ ثبت جوجه ریزی',
|
|
||||||
value: '1402/09/19 (10:12)',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget documentsTable() {
|
|
||||||
return Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'مستندات',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 16),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 135.h,
|
|
||||||
width: Get.width,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.bgLight,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 100.h,
|
|
||||||
width: Get.width,
|
|
||||||
child: ListView.separated(
|
|
||||||
itemCount: 10,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return Container(
|
|
||||||
width: 80.w,
|
|
||||||
height: 80.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0x33000000),
|
|
||||||
image: DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: NetworkImage(
|
|
||||||
"https://picsum.photos/150/150?random=$index",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
top: 6,
|
|
||||||
left: 6,
|
|
||||||
child: Container(
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white.withValues(alpha: 0.80),
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
),
|
|
||||||
child: Assets.vec.trashSvg.svg(
|
|
||||||
width: 16.w,
|
|
||||||
height: 16.h,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.redNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (context, index) => SizedBox(width: 10),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'200 فارم در این سالن تخمین زده شده است.',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(
|
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 16),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 135.h,
|
|
||||||
width: Get.width,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.bgLight,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 100.h,
|
|
||||||
width: Get.width,
|
|
||||||
child: ListView.separated(
|
|
||||||
itemCount: 10,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return Container(
|
|
||||||
width: 80.w,
|
|
||||||
height: 80.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0x33000000),
|
|
||||||
image: DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: NetworkImage(
|
|
||||||
"https://picsum.photos/150/150?random=${index * 2 + 1}",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
top: 6,
|
|
||||||
left: 6,
|
|
||||||
child: Container(
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white.withValues(alpha: 0.80),
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
),
|
|
||||||
child: Assets.vec.trashSvg.svg(
|
|
||||||
width: 16.w,
|
|
||||||
height: 16.h,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.redNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (context, index) => SizedBox(width: 10),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'انبار نهاده ها',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(
|
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 16),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
height: 135.h,
|
|
||||||
width: Get.width,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.bgLight,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: 100.h,
|
|
||||||
width: Get.width,
|
|
||||||
child: ListView.separated(
|
|
||||||
itemCount: 10,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return Container(
|
|
||||||
width: 80.w,
|
|
||||||
height: 80.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0x33000000),
|
|
||||||
image: DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: NetworkImage(
|
|
||||||
"https://picsum.photos/150/150?random=${index * 3 + 1}",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
top: 6,
|
|
||||||
left: 6,
|
|
||||||
child: Container(
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white.withValues(alpha: 0.80),
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
),
|
|
||||||
child: Assets.vec.trashSvg.svg(
|
|
||||||
width: 16.w,
|
|
||||||
height: 16.h,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.redNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (context, index) => SizedBox(width: 10),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'تلفات',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(
|
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
=
|
|
||||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching/hatching_models.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/repositories/poultry_science_repository.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class ActiveHatchingLogic extends GetxController {
|
|
||||||
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
|
||||||
BaseLogic baseLogic = Get.find<BaseLogic>();
|
|
||||||
late PoultryScienceRepository poultryScienceRepository;
|
|
||||||
Rx<Resource<PaginationModel<HatchingModel>>> activeHatchingList =
|
|
||||||
Resource<PaginationModel<HatchingModel>>.loading().obs;
|
|
||||||
|
|
||||||
final RxBool isLoadingMoreList = false.obs;
|
|
||||||
RxInt currentPage = 1.obs;
|
|
||||||
RxInt expandedIndex = RxInt(-1);
|
|
||||||
List<String> routesName = ['اقدام', 'جوجه ریزی فعال'];
|
|
||||||
|
|
||||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
|
||||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
|
||||||
RxnString searchedValue = RxnString();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
poultryScienceRepository = diChicken.get<PoultryScienceRepository>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
getHatchingList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
super.onClose();
|
|
||||||
baseLogic.clearSearch();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getHatchingList([bool isLoadingMore = false]) async {
|
|
||||||
if (isLoadingMore) {
|
|
||||||
isLoadingMoreList.value = true;
|
|
||||||
} else {
|
|
||||||
activeHatchingList.value =
|
|
||||||
Resource<PaginationModel<HatchingModel>>.loading();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
|
||||||
searchedValue.value!.trim().isNotEmpty &&
|
|
||||||
currentPage.value > 1) {
|
|
||||||
currentPage.value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
safeCall(
|
|
||||||
call: () async => await poultryScienceRepository.getHatchingPoultry(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(
|
|
||||||
queryParams: {'type': 'hatching'},
|
|
||||||
role: 'PoultryScience',
|
|
||||||
pageSize: 50,
|
|
||||||
page: currentPage.value,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (res) {
|
|
||||||
if ((res?.count ?? 0) == 0) {
|
|
||||||
activeHatchingList.value =
|
|
||||||
Resource<PaginationModel<HatchingModel>>.empty();
|
|
||||||
} else {
|
|
||||||
activeHatchingList.value =
|
|
||||||
Resource<PaginationModel<HatchingModel>>.success(
|
|
||||||
PaginationModel<HatchingModel>(
|
|
||||||
count: res?.count ?? 0,
|
|
||||||
next: res?.next,
|
|
||||||
previous: res?.previous,
|
|
||||||
results: [
|
|
||||||
...(activeHatchingList.value.data?.results ?? []),
|
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
|
||||||
expandedIndex.value = expandedIndex.value == index ? -1 : index;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> onRefresh() async {
|
|
||||||
currentPage.value = 1;
|
|
||||||
await getHatchingList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,240 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching/hatching_models.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/jahad/presentation/pages/active_hatching/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/create_inspection_bottom_sheet.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/widgets/submit_inspection_bottom_sheet/create_inspection_bottom_sheet_logic.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';
|
|
||||||
|
|
||||||
class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
|
|
||||||
const ActiveHatchingPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
hasSearch: true,
|
|
||||||
hasFilter: false,
|
|
||||||
backId: jahadActionKey,
|
|
||||||
routes: controller.routesName,
|
|
||||||
onSearchChanged: (data) {
|
|
||||||
controller.searchedValue.value = data;
|
|
||||||
controller.getHatchingList();
|
|
||||||
},
|
|
||||||
child: hatchingWidget(),
|
|
||||||
/*widgets: [
|
|
||||||
hatchingWidget()
|
|
||||||
],*/
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget hatchingWidget() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
return RPaginatedListView(
|
|
||||||
listType: ListType.separated,
|
|
||||||
resource: data.value,
|
|
||||||
hasMore: data.value.data?.next != null,
|
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
var item = data.value.data!.results![index];
|
|
||||||
return ObxValue((val) {
|
|
||||||
return ExpandableListItem2(
|
|
||||||
selected: val.value.isEqual(index),
|
|
||||||
onTap: () => controller.toggleExpanded(index),
|
|
||||||
index: index,
|
|
||||||
child: itemListWidget(item),
|
|
||||||
secondChild: itemListExpandedWidget(item),
|
|
||||||
labelColor: AppColor.blueLight,
|
|
||||||
labelIcon: Assets.vec.activeFramSvg.path,
|
|
||||||
);
|
|
||||||
}, controller.expandedIndex);
|
|
||||||
},
|
|
||||||
itemCount: data.value.data?.results?.length ?? 0,
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
|
||||||
onLoadMore: () async => controller.getHatchingList(true),
|
|
||||||
);
|
|
||||||
}, controller.activeHatchingList);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container itemListExpandedWidget(HatchingModel item) {
|
|
||||||
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.poultry?.user?.fullname ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
|
|
||||||
Visibility(
|
|
||||||
child: Text(
|
|
||||||
item.violation == true ? 'پیگیری' : 'عادی',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.redDark),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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: [
|
|
||||||
Text(
|
|
||||||
'نژاد:${item.breed?.first.breed ?? 'N/A'}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' سن${item.age} (روز)',
|
|
||||||
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' دوره جوجه ریزی:${item.period}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(
|
|
||||||
title: 'شماره مجوز جوجه ریزی',
|
|
||||||
value: item.licenceNumber ?? 'N/A',
|
|
||||||
),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'حجم جوجه ریزی',
|
|
||||||
value: item.quantity.separatedByCommaFa,
|
|
||||||
unit: '(قطعه)',
|
|
||||||
),
|
|
||||||
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: 'شرح بازرسی',
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
RElevated(
|
|
||||||
height: 40.h,
|
|
||||||
isFullWidth: true,
|
|
||||||
onPressed: () {
|
|
||||||
Get.find<CreateInspectionBottomSheetLogic>().setHatchingModel(
|
|
||||||
item,
|
|
||||||
);
|
|
||||||
Get.bottomSheet(
|
|
||||||
CreateInspectionBottomSheet(),
|
|
||||||
isScrollControlled: true,
|
|
||||||
ignoreSafeArea: false,
|
|
||||||
).then((value) {
|
|
||||||
if (Get.isRegistered<CreateInspectionBottomSheetLogic>()) {
|
|
||||||
Get.find<CreateInspectionBottomSheetLogic>().clearForm();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Text('ثبت بازرسی'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget itemListWidget(HatchingModel item) {
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 3,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.poultry?.user?.fullname ?? 'N/A',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.poultry?.user?.mobile ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
spacing: 3,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.poultry?.unitName ?? 'N/Aaq',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.poultry?.licenceNumber ?? 'N/A',
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Assets.vec.scanSvg.svg(
|
|
||||||
width: 32.w,
|
|
||||||
height: 32.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_farm/poultry_farm.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/home/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class FarmLogic extends GetxController {
|
|
||||||
List<String> routes = ['اقدام', 'فارم ها'];
|
|
||||||
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
|
||||||
BasePageLogic baseLogic = Get.find<BasePageLogic>();
|
|
||||||
final PoultryScienceHomeLogic _homeLogic =
|
|
||||||
Get.find<PoultryScienceHomeLogic>();
|
|
||||||
RxList<InformationTagData> tagInfo = <InformationTagData>[
|
|
||||||
InformationTagData(
|
|
||||||
labelTitle: 'کل فارم ها',
|
|
||||||
isLoading: true,
|
|
||||||
labelVecIcon: Assets.vec.cubeScanSvg.path,
|
|
||||||
iconColor: AppColor.blueNormalOld,
|
|
||||||
valueBgColor: Colors.white,
|
|
||||||
labelGradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [AppColor.blueLight, Colors.white],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
InformationTagData(
|
|
||||||
labelTitle: 'حجم جوجه ریزی',
|
|
||||||
unit: 'قطعه',
|
|
||||||
isLoading: true,
|
|
||||||
labelVecIcon: Assets.vec.cubeCardSvg.path,
|
|
||||||
blendMode: BlendMode.dst,
|
|
||||||
valueBgColor: Colors.white,
|
|
||||||
labelGradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [AppColor.greenLightHover, Colors.white],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].obs;
|
|
||||||
Rx<Resource<PaginationModel<PoultryFarm>>> farmList =
|
|
||||||
Resource<PaginationModel<PoultryFarm>>.loading().obs;
|
|
||||||
|
|
||||||
RxInt currentPage = 1.obs;
|
|
||||||
final RxBool isLoadingMoreList = false.obs;
|
|
||||||
RxInt expandedIndex = RxInt(-1);
|
|
||||||
|
|
||||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
|
||||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
|
||||||
RxnString searchedValue = RxnString();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
tagInfo[0] = tagInfo[0].copyWith(
|
|
||||||
isLoading: false,
|
|
||||||
value: _homeLogic.tagInfo['first']!.first.value,
|
|
||||||
);
|
|
||||||
tagInfo[1] = tagInfo[1].copyWith(
|
|
||||||
isLoading: false,
|
|
||||||
value: _homeLogic.tagInfo['second']!.first.value,
|
|
||||||
);
|
|
||||||
|
|
||||||
getFarmList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
super.onClose();
|
|
||||||
baseLogic.clearSearch();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getFarmList([bool isLoadingMore = false]) async {
|
|
||||||
if (isLoadingMore) {
|
|
||||||
isLoadingMoreList.value = true;
|
|
||||||
} else {
|
|
||||||
farmList.value = Resource<PaginationModel<PoultryFarm>>.loading();
|
|
||||||
}
|
|
||||||
await safeCall(
|
|
||||||
call: () async =>
|
|
||||||
await rootLogic.poultryRepository.getPoultryScienceFarmList(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(
|
|
||||||
queryParams: {'type': 'farm'},
|
|
||||||
role: 'PoultryScience',
|
|
||||||
pageSize: 50,
|
|
||||||
search: 'filter',
|
|
||||||
value: '',
|
|
||||||
page: currentPage.value,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (res) {
|
|
||||||
if ((res?.count ?? 0) == 0) {
|
|
||||||
farmList.value = Resource<PaginationModel<PoultryFarm>>.empty();
|
|
||||||
} else {
|
|
||||||
farmList.value = Resource<PaginationModel<PoultryFarm>>.success(
|
|
||||||
PaginationModel<PoultryFarm>(
|
|
||||||
count: res?.count ?? 0,
|
|
||||||
next: res?.next,
|
|
||||||
previous: res?.previous,
|
|
||||||
results: [
|
|
||||||
...(farmList.value.data?.results ?? []),
|
|
||||||
...?res?.results,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
|
||||||
expandedIndex.value = expandedIndex.value == index ? -1 : index;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> onRefresh() async {
|
|
||||||
currentPage.value = 1;
|
|
||||||
farmList.value = Resource<PaginationModel<PoultryFarm>>.loading();
|
|
||||||
await getFarmList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,261 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_farm/poultry_farm.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/filter_bottom_sheet.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class FarmPage extends GetView<FarmLogic> {
|
|
||||||
const FarmPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
hasFilter: false,
|
|
||||||
hasSearch: true,
|
|
||||||
onRefresh: controller.onRefresh,
|
|
||||||
onFilterTap: () {
|
|
||||||
Get.bottomSheet(
|
|
||||||
isScrollControlled: true,
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
filterBottomSheet(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onSearchChanged: (data) {
|
|
||||||
controller.searchedValue.value = data;
|
|
||||||
controller.getFarmList();
|
|
||||||
},
|
|
||||||
routes: controller.routes,
|
|
||||||
backId: poultryScienceActionKey,
|
|
||||||
child: Column(children: [firstTagInformation(), farmListWidget()]),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget firstTagInformation() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20.w),
|
|
||||||
child: Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: List.generate(
|
|
||||||
data.length,
|
|
||||||
(index) => Expanded(child: InformationTag(data: data[index])),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.tagInfo),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget farmListWidget() {
|
|
||||||
return Expanded(
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return RPaginatedListView(
|
|
||||||
listType: ListType.separated,
|
|
||||||
resource: data.value,
|
|
||||||
hasMore: data.value.data?.next != null,
|
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
var item = data.value.data!.results![index];
|
|
||||||
return ObxValue((val) {
|
|
||||||
return ExpandableListItem2(
|
|
||||||
selected: val.value.isEqual(index),
|
|
||||||
onTap: () => controller.toggleExpanded(index),
|
|
||||||
index: index,
|
|
||||||
child: itemListWidget(item),
|
|
||||||
secondChild: itemListExpandedWidget(item),
|
|
||||||
labelColor: AppColor.blueLight,
|
|
||||||
labelIcon: Assets.vec.cubeScanSvg.path,
|
|
||||||
);
|
|
||||||
}, controller.expandedIndex);
|
|
||||||
},
|
|
||||||
itemCount: data.value.data?.results?.length ?? 0,
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
|
||||||
onLoadMore: () async => controller.getFarmList(true),
|
|
||||||
);
|
|
||||||
}, controller.farmList),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container itemListExpandedWidget(PoultryFarm item) {
|
|
||||||
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.unitName ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
|
|
||||||
Visibility(
|
|
||||||
child: Text(
|
|
||||||
'${item.address?.province?.name} / ${item.address?.city?.name}',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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: [
|
|
||||||
Text(
|
|
||||||
'تعاونی : ${item.cityOperator ?? 'ندارد'}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
' تعداد سالن : ${item.numberOfHalls}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
),*/
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget itemListWidget(PoultryFarm item) {
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
spacing: 3,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.unitName ?? 'N/A',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.user?.mobile ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
spacing: 3,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'شناسه یکتا: ${item.breedingUniqueId}',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${item.address?.province?.name}/${item.address?.city?.name}',
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Assets.vec.scanSvg.svg(
|
|
||||||
width: 32.w,
|
|
||||||
height: 32.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget filterBottomSheet() => filterBottomSheetWidget(
|
|
||||||
fromDate: controller.fromDateFilter,
|
|
||||||
onChangedFromDate: (jalali) => controller.fromDateFilter.value = jalali,
|
|
||||||
toDate: controller.toDateFilter,
|
|
||||||
onChangedToDate: (jalali) => controller.toDateFilter.value = jalali,
|
|
||||||
onSubmit: () => controller.getFarmList(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_order/poultry_order.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/killing_registration/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class GenocideLogic extends GetxController {
|
|
||||||
List<String> routesName = ['اقدام', 'درخواست کشتارها'];
|
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
|
||||||
BaseLogic baseLogic = Get.find<BaseLogic>();
|
|
||||||
var gService = Get.find<GService>();
|
|
||||||
var rootLogic = Get.find<PoultryScienceRootLogic>();
|
|
||||||
var killRegistration = Get.find<KillingRegistrationLogic>();
|
|
||||||
|
|
||||||
Rx<Resource<PaginationModel<PoultryOrder>>> poultryOrderList =
|
|
||||||
Resource<PaginationModel<PoultryOrder>>.loading().obs;
|
|
||||||
|
|
||||||
RxInt expandedIndex = RxInt(-1);
|
|
||||||
final RxInt currentPage = 1.obs;
|
|
||||||
|
|
||||||
final RxBool isLoadingMore = false.obs;
|
|
||||||
|
|
||||||
final RxBool isLoadingDelete = false.obs;
|
|
||||||
|
|
||||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
|
||||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
|
||||||
RxnString searchedValue = RxnString();
|
|
||||||
|
|
||||||
/* final RxBool isLoadingMoreAllocationsMade = false.obs;
|
|
||||||
final RxBool isOnLoadingSubmitOrEdit = false.obs;*/
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
getPoultryOrderList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
super.onClose();
|
|
||||||
baseLogic.clearSearch();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getPoultryOrderList([bool loadingMore = false]) async {
|
|
||||||
if (loadingMore) {
|
|
||||||
isLoadingMore.value = true;
|
|
||||||
} else {
|
|
||||||
poultryOrderList.value =
|
|
||||||
Resource<PaginationModel<PoultryOrder>>.loading();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
|
||||||
searchedValue.value!.trim().isNotEmpty &&
|
|
||||||
currentPage.value > 1) {
|
|
||||||
currentPage.value = 1;
|
|
||||||
}
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.poultryRepository.getPoultryOderList(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(
|
|
||||||
pageSize: 20,
|
|
||||||
page: currentPage.value,
|
|
||||||
search: 'filter',
|
|
||||||
role: gService.getRole(Module.chicken),
|
|
||||||
value: searchedValue.value,
|
|
||||||
fromDate: fromDateFilter.value.toDateTime(),
|
|
||||||
toDate: toDateFilter.value.toDateTime(),
|
|
||||||
queryParams: {'today': null},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (res) async {
|
|
||||||
await Future.delayed(Duration(milliseconds: 500));
|
|
||||||
if ((res?.count ?? 0) == 0) {
|
|
||||||
poultryOrderList.value =
|
|
||||||
Resource<PaginationModel<PoultryOrder>>.empty();
|
|
||||||
} else {
|
|
||||||
if (loadingMore) {
|
|
||||||
poultryOrderList.value =
|
|
||||||
Resource<PaginationModel<PoultryOrder>>.success(
|
|
||||||
PaginationModel<PoultryOrder>(
|
|
||||||
count: res?.count ?? 0,
|
|
||||||
next: res?.next,
|
|
||||||
previous: res?.previous,
|
|
||||||
results: [
|
|
||||||
...(poultryOrderList.value.data?.results ?? []),
|
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
poultryOrderList.value =
|
|
||||||
Resource<PaginationModel<PoultryOrder>>.success(res!);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> deletePoultryOrder(int id) async {
|
|
||||||
toggleExpanded(-1);
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.poultryRepository.deletePoultryOder(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
orderId: id.toString(),
|
|
||||||
),
|
|
||||||
onSuccess: (_) {
|
|
||||||
defaultShowSuccessMessage('درخواست با موفقیت حذف شد');
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
|
||||||
expandedIndex.value = expandedIndex.value == index ? -1 : index;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getRequestType(PoultryOrder item) {
|
|
||||||
if (item.market ?? false) {
|
|
||||||
return 'پنل معاملات';
|
|
||||||
} else if (item.union ?? false) {
|
|
||||||
return 'اتحادیه';
|
|
||||||
} else {
|
|
||||||
return 'خرید مستقیم';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String getKillType(PoultryOrder item) {
|
|
||||||
if (item.export ?? false) {
|
|
||||||
return 'صادرات';
|
|
||||||
} else if (item.freezing ?? false) {
|
|
||||||
return 'انجماد';
|
|
||||||
} else {
|
|
||||||
return 'عادی';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String getState(PoultryOrder item) {
|
|
||||||
if (item.stateProcess == 'pending') {
|
|
||||||
return 'در انتظار تایید';
|
|
||||||
} else {
|
|
||||||
return 'تایید شده';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> onRefresh() async {
|
|
||||||
currentPage.value = 1;
|
|
||||||
await getPoultryOrderList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,309 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_order/poultry_order.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/killing_registration/view.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/filter_bottom_sheet.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class GenocidePage extends GetView<GenocideLogic> {
|
|
||||||
const GenocidePage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
routes: controller.routesName,
|
|
||||||
hasSearch: true,
|
|
||||||
hasFilter: true,
|
|
||||||
onRefresh: controller.onRefresh,
|
|
||||||
onSearchChanged: (data) {
|
|
||||||
controller.searchedValue.value = data;
|
|
||||||
controller.getPoultryOrderList();
|
|
||||||
},
|
|
||||||
backId: poultryScienceActionKey,
|
|
||||||
onFilterTap: () {
|
|
||||||
Get.bottomSheet(
|
|
||||||
isScrollControlled: true,
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
filterBottomSheet(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
Positioned.fill(child: poultryOrderListWidget()),
|
|
||||||
Positioned(
|
|
||||||
bottom: 130,
|
|
||||||
right: 16,
|
|
||||||
child: RFab.add(
|
|
||||||
onPressed: () {
|
|
||||||
Get.bottomSheet(
|
|
||||||
isScrollControlled: true,
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
killRegistrationBottomSheet(),
|
|
||||||
).whenComplete(() {
|
|
||||||
controller.killRegistration.clearAllFields();
|
|
||||||
controller.killRegistration.onReady();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//region List and Items
|
|
||||||
Widget poultryOrderListWidget() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
return RPaginatedListView(
|
|
||||||
listType: ListType.separated,
|
|
||||||
resource: data.value,
|
|
||||||
hasMore: data.value.data?.next != null,
|
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
var item = data.value.data!.results![index];
|
|
||||||
return ObxValue((val) {
|
|
||||||
return ExpandableListItem2(
|
|
||||||
selected: val.value.isEqual(index),
|
|
||||||
onTap: () => controller.toggleExpanded(index),
|
|
||||||
index: index,
|
|
||||||
child: itemListWidget(item),
|
|
||||||
secondChild: itemListExpandedWidget(item),
|
|
||||||
labelColor: AppColor.blueLight,
|
|
||||||
labelIcon: Assets.vec.timerSvg.path,
|
|
||||||
labelIconColor: AppColor.yellowNormal2,
|
|
||||||
);
|
|
||||||
}, controller.expandedIndex);
|
|
||||||
},
|
|
||||||
itemCount: data.value.data?.results?.length ?? 0,
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
|
||||||
onLoadMore: () async => controller.getPoultryOrderList(true),
|
|
||||||
);
|
|
||||||
}, controller.poultryOrderList);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container itemListExpandedWidget(PoultryOrder item) {
|
|
||||||
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.poultry?.unitName ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
|
|
||||||
Visibility(
|
|
||||||
child: Text(
|
|
||||||
'${item.poultry?.address?.province?.name} / ${item.poultry?.address?.city?.name}',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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: [
|
|
||||||
Text(
|
|
||||||
'سن مرغ:${item.hatching?.age ?? '-'} (روز)',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
item.sendDate?.formattedJalaliDate ?? '-',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'تعداد:${item.quantity.separatedByComma} (قطعه)',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(title: 'کد سفارش', value: '${item.orderCode} '),
|
|
||||||
buildRow(
|
|
||||||
title: 'نوع فروش',
|
|
||||||
value: (item.freeSaleInProvince ?? false) ? 'آزاد' : 'دولتی ',
|
|
||||||
),
|
|
||||||
buildRow(title: 'نوع کشتار ', value: controller.getKillType(item)),
|
|
||||||
buildRow(title: 'درخواست', value: controller.getRequestType(item)),
|
|
||||||
|
|
||||||
buildRow(
|
|
||||||
title: 'میانگین وزنی',
|
|
||||||
value: '${(item.indexWeight)} (کیلوگرم)',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'قیمت مرغدار',
|
|
||||||
value: '${item.amount.separatedByComma} (ریال)',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'مانده در سالن ',
|
|
||||||
value: '${item.hatching?.leftOver.separatedByComma ?? 0} (قطعه)',
|
|
||||||
),
|
|
||||||
buildRow(title: ' وضعیت', value: controller.getState(item)),
|
|
||||||
|
|
||||||
Visibility(
|
|
||||||
visible: item.stateProcess == 'pending',
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return ROutlinedElevatedIcon(
|
|
||||||
height: 40.h,
|
|
||||||
width: Get.width,
|
|
||||||
text: 'حذف',
|
|
||||||
icon: Assets.vec.trashSvg.svg(
|
|
||||||
width: 16.w,
|
|
||||||
height: 16.h,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.error,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
textStyle: AppFonts.yekan16Bold.copyWith(color: AppColor.error),
|
|
||||||
borderColor: AppColor.error,
|
|
||||||
foregroundColor: AppColor.error,
|
|
||||||
pressedBackgroundColor: AppColor.error,
|
|
||||||
onPressed: data.value
|
|
||||||
? null
|
|
||||||
: () => _buildDeleteDialog(
|
|
||||||
onConfirm: () async {
|
|
||||||
Get.back();
|
|
||||||
await controller.deletePoultryOrder(item.id!);
|
|
||||||
controller.getPoultryOrderList();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.isLoadingDelete),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget itemListWidget(PoultryOrder item) {
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
spacing: 3,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.poultry?.unitName ?? 'N/A',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.sendDate?.formattedJalaliDate ?? '-',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
spacing: 3,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'کد سفارش : ${item.orderCode ?? '-'}',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'تعداد:${item.quantity.separatedByComma} (قطعه)',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Assets.vec.scanSvg.svg(
|
|
||||||
width: 32.w,
|
|
||||||
height: 32.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region other widgets
|
|
||||||
void _buildDeleteDialog({required VoidCallback onConfirm}) {
|
|
||||||
Get.defaultDialog(
|
|
||||||
title: 'حذف درخواست کشتار',
|
|
||||||
middleText: 'آیا از حذف این درخواست کشتار مطمئن هستید؟',
|
|
||||||
confirm: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: AppColor.error,
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
),
|
|
||||||
onPressed: onConfirm,
|
|
||||||
child: Text('بله'),
|
|
||||||
),
|
|
||||||
cancel: ElevatedButton(
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: Text('خیر'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget filterBottomSheet() => filterBottomSheetWidget(
|
|
||||||
fromDate: controller.fromDateFilter,
|
|
||||||
onChangedFromDate: (jalali) => controller.fromDateFilter.value = jalali,
|
|
||||||
toDate: controller.toDateFilter,
|
|
||||||
onChangedToDate: (jalali) => controller.toDateFilter.value = jalali,
|
|
||||||
onSubmit: () => controller.getPoultryOrderList(),
|
|
||||||
);
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region kill registration bottom sheet
|
|
||||||
Widget killRegistrationBottomSheet() {
|
|
||||||
return BaseBottomSheet(
|
|
||||||
height: Get.height * 0.9,
|
|
||||||
bgColor: Color(0x66E4E4E4),
|
|
||||||
child: KillingRegistrationPage(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
}
|
|
||||||
@@ -1,192 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/home_poultry_science/home_poultry_science_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
import 'package:rasadyar_core/presentation/widget/custom/information_card_widget.dart';
|
|
||||||
|
|
||||||
class PoultryScienceHomeLogic extends GetxController {
|
|
||||||
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
|
||||||
Rxn<HomePoultryScienceModel> homeInformation = Rxn();
|
|
||||||
RxBool isExpanded = false.obs;
|
|
||||||
RxMap<String, List<InformationTagData>> tagInfo = RxMap({
|
|
||||||
'first': [
|
|
||||||
InformationTagData(
|
|
||||||
labelTitle: 'کل فارم ها',
|
|
||||||
isLoading: true,
|
|
||||||
labelVecIcon: Assets.vec.cubeScanSvg.path,
|
|
||||||
iconColor: AppColor.blueFlashing,
|
|
||||||
blendMode: BlendMode.srcOut,
|
|
||||||
valueBgColor: Colors.white,
|
|
||||||
labelGradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [AppColor.blueLight, Colors.white],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
InformationTagData(
|
|
||||||
labelTitle: 'تعداد جوجه ریزی',
|
|
||||||
isLoading: true,
|
|
||||||
labelVecIcon: Assets.vec.cubeCardSvg.path,
|
|
||||||
blendMode: BlendMode.dst,
|
|
||||||
valueBgColor: Colors.white,
|
|
||||||
labelGradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [AppColor.greenLightHover, Colors.white],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
'second': [
|
|
||||||
InformationTagData(
|
|
||||||
labelTitle: 'حجم جوجه ریزی',
|
|
||||||
unit: 'قطعه',
|
|
||||||
isLoading: true,
|
|
||||||
labelVecIcon: Assets.vec.hashtagSvg.path,
|
|
||||||
iconColor: const Color(0xFF6C5D60),
|
|
||||||
labelBgColor: const Color(0xFFDDC0C7),
|
|
||||||
valueBgColor: const Color(0xFFEDDCE0),
|
|
||||||
),
|
|
||||||
InformationTagData(
|
|
||||||
labelTitle: 'مانده در سالن',
|
|
||||||
unit: 'قطعه',
|
|
||||||
isLoading: true,
|
|
||||||
labelVecIcon: Assets.vec.homeHashtagSvg.path,
|
|
||||||
labelBgColor: const Color(0xFFAFCBFF),
|
|
||||||
valueBgColor: const Color(0xFFCEDFFF),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
'third': [
|
|
||||||
InformationTagData(
|
|
||||||
labelTitle: 'تلفات',
|
|
||||||
unit: 'قطعه',
|
|
||||||
isLoading: true,
|
|
||||||
labelVecIcon: Assets.vec.boxRemoveSvg.path,
|
|
||||||
|
|
||||||
iconColor: const Color(0xFF426060),
|
|
||||||
labelBgColor: const Color(0xFFA5D1D2),
|
|
||||||
valueBgColor: const Color(0xFFC7DFE0),
|
|
||||||
),
|
|
||||||
InformationTagData(
|
|
||||||
labelTitle: 'حجم کشتار شده',
|
|
||||||
unit: 'قطعه',
|
|
||||||
isLoading: true,
|
|
||||||
labelVecIcon: Assets.vec.closeSquareFilledSvg.path,
|
|
||||||
blendMode: BlendMode.dst,
|
|
||||||
labelBgColor: Color(0xFFC8B8D1),
|
|
||||||
valueBgColor: Color(0xFFDAD4DD),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
RxList<InformationCardData> ageCardData = [
|
|
||||||
InformationCardData(
|
|
||||||
labelTitle: 'بیشترین سن جوجه ریزی',
|
|
||||||
isLoading: true,
|
|
||||||
unit: 'روز',
|
|
||||||
labelVecIcon: Assets.vec.homeTrendUpSvg.path,
|
|
||||||
iconColor: const Color.fromRGBO(85, 97, 93, 1),
|
|
||||||
cardBgColor: const Color(0xFFE6FAF5),
|
|
||||||
labelBgColor: const Color(0xFFB0EFDF),
|
|
||||||
),
|
|
||||||
InformationCardData(
|
|
||||||
labelTitle: 'کمترین سن جوجه ریزی',
|
|
||||||
isLoading: true,
|
|
||||||
unit: 'روز',
|
|
||||||
labelVecIcon: Assets.vec.homeTrendDownSvg.path,
|
|
||||||
iconColor: const Color(0xFF6F6164),
|
|
||||||
cardBgColor: const Color(0xFFEDDCE0),
|
|
||||||
labelBgColor: const Color(0xFFE0BCC5),
|
|
||||||
),
|
|
||||||
].obs;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
getHomePoultryHatching();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getHomePoultryHatching() async {
|
|
||||||
await safeCall<HomePoultryScienceModel?>(
|
|
||||||
call: () async => await rootLogic.poultryRepository.getHomePoultry(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
type: 'home',
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
homeInformation.value = result;
|
|
||||||
tagInfo['first'] = tagInfo['first']!.map((tag) {
|
|
||||||
if (tag.labelTitle == 'کل فارم ها') {
|
|
||||||
return tag.copyWith(
|
|
||||||
value: result.farmCount?.separatedByCommaFa ?? '0',
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (tag.labelTitle == 'تعداد جوجه ریزی') {
|
|
||||||
return tag.copyWith(
|
|
||||||
value: result.hatchingCount?.separatedByCommaFa ?? '0',
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return tag;
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
// second
|
|
||||||
tagInfo['second'] = tagInfo['second']!.map((tag) {
|
|
||||||
switch (tag.labelTitle) {
|
|
||||||
case 'حجم جوجه ریزی':
|
|
||||||
return tag.copyWith(
|
|
||||||
value: result.hatchingQuantity?.separatedByCommaFa ?? '0',
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
case 'مانده در سالن':
|
|
||||||
return tag.copyWith(
|
|
||||||
value: result.hatchingLeftOver?.separatedByCommaFa ?? '0',
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
// third
|
|
||||||
tagInfo['third'] = tagInfo['third']!.map((tag) {
|
|
||||||
switch (tag.labelTitle) {
|
|
||||||
case 'تلفات':
|
|
||||||
return tag.copyWith(
|
|
||||||
value: result.hatchingLosses?.separatedByCommaFa ?? '0',
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
case 'حجم کشتار شده':
|
|
||||||
return tag.copyWith(
|
|
||||||
value:
|
|
||||||
result.hatchingKilledQuantity?.separatedByCommaFa ?? '0',
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
ageCardData.value = ageCardData.map((element) {
|
|
||||||
switch (element.labelTitle) {
|
|
||||||
case 'کمترین سن جوجه ریزی':
|
|
||||||
return element.copyWith(
|
|
||||||
value: result.hatchingMinAge?.separatedByCommaFa ?? '0',
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
case 'بیشترین سن جوجه ریزی':
|
|
||||||
return element.copyWith(
|
|
||||||
value: result.hatchingMaxAge?.separatedByCommaFa ?? '0',
|
|
||||||
isLoading: false,
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
}).toList();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,448 +0,0 @@
|
|||||||
import 'package:flutter/cupertino.dart' hide LinearGradient;
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/routes/routes.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';
|
|
||||||
import 'package:rasadyar_core/presentation/widget/custom/information_card_widget.dart';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|
||||||
const PoultryScienceHomePage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
isBase: true,
|
|
||||||
hasNotification: true,
|
|
||||||
hasNews: true,
|
|
||||||
scrollable: true,
|
|
||||||
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 18.h),
|
|
||||||
InkWell(
|
|
||||||
onTap: () {
|
|
||||||
controller.isExpanded.value = !controller.isExpanded.value;
|
|
||||||
},
|
|
||||||
child: Stack(
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsetsGeometry.all(6),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(
|
|
||||||
width: 0.50,
|
|
||||||
color: const Color(0xFFA9A9A9),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return AnimatedSize(
|
|
||||||
duration: Duration(milliseconds: 300),
|
|
||||||
child: data.value
|
|
||||||
? mainItemWidget()
|
|
||||||
: mainItemWidgetExpanded(),
|
|
||||||
);
|
|
||||||
}, controller.isExpanded),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: -10,
|
|
||||||
right: 20,
|
|
||||||
child: Container(
|
|
||||||
height: 32.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(
|
|
||||||
width: 0.50,
|
|
||||||
color: const Color(0xFFA9A9A9),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
child: Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Assets.vec.chicken2Svg.svg(
|
|
||||||
width: 16.w,
|
|
||||||
height: 16.h,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.blueDark,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'اطلاعات فارمها',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
|
||||||
color: AppColor.iconColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
widelyWidget(),
|
|
||||||
SizedBox(height: 20),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Padding mainItemWidget() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 8),
|
|
||||||
firstTagInformation(),
|
|
||||||
secondTagInformation(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Padding mainItemWidgetExpanded() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 8),
|
|
||||||
/* Row(
|
|
||||||
spacing: 8,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)),
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Assets.images.liveChicken.image(
|
|
||||||
width: 40.w,
|
|
||||||
height: 40.h,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'فارم ها',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
AnimatedRotation(
|
|
||||||
turns: 180,
|
|
||||||
duration: Duration(milliseconds: 3000),
|
|
||||||
child: Icon(CupertinoIcons.chevron_up, size: 18),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),*/
|
|
||||||
SizedBox(height: 8),
|
|
||||||
firstTagInformation(),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'اطلاعات جوجهریزی',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
secondTagInformation(),
|
|
||||||
thirdTagInformation(),
|
|
||||||
ageCardInformation(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget firstTagInformation() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
List<InformationTagData>? items = data['first']!;
|
|
||||||
return Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: List.generate(
|
|
||||||
items.length,
|
|
||||||
(index) => Expanded(child: InformationTag(data: items[index])),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.tagInfo),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget secondTagInformation() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
List<InformationTagData>? items = data['second']!;
|
|
||||||
return Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: List.generate(
|
|
||||||
items.length,
|
|
||||||
(index) => Expanded(child: InformationTag(data: items[index])),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.tagInfo),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget thirdTagInformation() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
List<InformationTagData>? items = data['third']!;
|
|
||||||
return Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: List.generate(
|
|
||||||
items.length,
|
|
||||||
(index) => Expanded(child: InformationTag(data: items[index])),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.tagInfo),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget ageCardInformation() {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(30.w, 8, 30.w, 13),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: List.generate(
|
|
||||||
data.length,
|
|
||||||
(index) => Expanded(child: InformationCard(data: data[index])),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.ageCardData),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//region Widely Used Widget
|
|
||||||
Widget widelyWidget() {
|
|
||||||
return Container(
|
|
||||||
margin: EdgeInsetsGeometry.all(6),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
|
|
||||||
),
|
|
||||||
child: Stack(
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(12.w, 24.h, 12.w, 16.h),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
widelyUsed(
|
|
||||||
title: 'بازرسی',
|
|
||||||
iconPath: Assets.vec.cubeSearchSvg.path,
|
|
||||||
isOnEdit: false,
|
|
||||||
cardColor: AppColor.greenLightActive,
|
|
||||||
labelColor: AppColor.greenNormal,
|
|
||||||
textColor: AppColor.textColor,
|
|
||||||
onTap: () async {
|
|
||||||
controller.rootLogic.currentPage.value = 0;
|
|
||||||
|
|
||||||
Get.toNamed(
|
|
||||||
PoultryScienceRoutes.inspectionPoultryScience,
|
|
||||||
id: poultryFirstKey,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
|
|
||||||
widelyUsed(
|
|
||||||
title: 'ثبت کشتار',
|
|
||||||
iconPath: Assets.vec.noteRemoveSvg.path,
|
|
||||||
isOnEdit: false,
|
|
||||||
cardColor: AppColor.blueLightActive,
|
|
||||||
labelColor: AppColor.blueNormalOld,
|
|
||||||
textColor: AppColor.textColor,
|
|
||||||
onTap: () async {
|
|
||||||
controller.rootLogic.currentPage.value = 0;
|
|
||||||
Get.toNamed(
|
|
||||||
PoultryScienceRoutes.genocidePoultryScience,
|
|
||||||
id: poultryFirstKey,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
widelyUsed(
|
|
||||||
title: 'فارم ها',
|
|
||||||
iconPath: Assets.vec.cubeScanSvg.path,
|
|
||||||
cardColor: Color(0xFFFFCFA3),
|
|
||||||
labelColor: Color(0xFFF68D2B),
|
|
||||||
textColor: AppColor.textColor,
|
|
||||||
isOnEdit: false,
|
|
||||||
onTap: () async {
|
|
||||||
controller.rootLogic.currentPage.value = 0;
|
|
||||||
Get.toNamed(
|
|
||||||
PoultryScienceRoutes.farmPoultryScience,
|
|
||||||
id: poultryFirstKey,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
|
|
||||||
widelyUsed(
|
|
||||||
title: 'جوجهریزی فعال',
|
|
||||||
iconPath: Assets.vec.boxTickSvg.path,
|
|
||||||
isOnEdit: false,
|
|
||||||
cardColor: Color(0xFFD9BEFF),
|
|
||||||
labelColor: Color(0xFF9757FF),
|
|
||||||
textColor: AppColor.textColor,
|
|
||||||
onTap: () async {
|
|
||||||
controller.rootLogic.currentPage.value = 0;
|
|
||||||
Get.toNamed(
|
|
||||||
PoultryScienceRoutes.activeHatchingPoultryScience,
|
|
||||||
id: poultryFirstKey,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: -17,
|
|
||||||
right: 11,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'پر کاربردها',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget widelyUsed({
|
|
||||||
required String title,
|
|
||||||
required String iconPath,
|
|
||||||
required VoidCallback onTap,
|
|
||||||
required bool isOnEdit,
|
|
||||||
Color? cardColor,
|
|
||||||
Color? labelColor,
|
|
||||||
Color? textColor,
|
|
||||||
}) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: !isOnEdit ? onTap : null,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Stack(
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 48,
|
|
||||||
height: 48,
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
color: cardColor ?? Color(0xFFBECDFF),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
color: labelColor ?? AppColor.blueNormal,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: SvgGenImage.vec(iconPath).svg(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
Colors.white,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
visible: isOnEdit,
|
|
||||||
child: Container(
|
|
||||||
width: 48,
|
|
||||||
height: 48,
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
color: Colors.white60,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Visibility(
|
|
||||||
visible: isOnEdit,
|
|
||||||
child: Positioned(
|
|
||||||
top: -15,
|
|
||||||
left: -12,
|
|
||||||
child: SizedBox(
|
|
||||||
width: 32.w,
|
|
||||||
height: 32.h,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {},
|
|
||||||
behavior: HitTestBehavior.translucent,
|
|
||||||
child: Center(
|
|
||||||
child: Container(
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Icon(
|
|
||||||
CupertinoIcons.minus,
|
|
||||||
color: AppColor.error,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
style: AppFonts.yekan10Bold.copyWith(
|
|
||||||
color: textColor ?? AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
}
|
|
||||||
@@ -1,289 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching/hatching_models.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching_report/hatching_report.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class InspectionPoultryScienceLogic extends GetxController {
|
|
||||||
BaseLogic baseLogic = Get.find<BaseLogic>();
|
|
||||||
Rx<Resource<PaginationModel<HatchingModel>>> hatchingList =
|
|
||||||
Resource<PaginationModel<HatchingModel>>.loading().obs;
|
|
||||||
|
|
||||||
Rx<Resource<PaginationModel<HatchingReport>>> hatchingReportList =
|
|
||||||
Resource<PaginationModel<HatchingReport>>.loading().obs;
|
|
||||||
|
|
||||||
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
|
||||||
|
|
||||||
Rx<LatLng> currentLocation = LatLng(
|
|
||||||
34.798315281272544,
|
|
||||||
48.51479142983491,
|
|
||||||
).obs;
|
|
||||||
|
|
||||||
final RxBool isLoadingMoreAllocationsMade = false.obs;
|
|
||||||
RxInt currentPage = 1.obs;
|
|
||||||
RxInt expandedIndex = RxInt(-1);
|
|
||||||
RxList<XFile> pickedImages = <XFile>[].obs;
|
|
||||||
final List<MultipartFile> _multiPartPickedImages = <MultipartFile>[];
|
|
||||||
|
|
||||||
RxBool isOnUpload = false.obs;
|
|
||||||
|
|
||||||
RxDouble presentUpload = 0.0.obs;
|
|
||||||
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();
|
|
||||||
|
|
||||||
routesName.value = ['اقدام'].toList();
|
|
||||||
|
|
||||||
ever(selectedSegmentIndex, (callback) {
|
|
||||||
routesName.removeLast();
|
|
||||||
routesName.add(callback == 0 ? 'بازرسی' : 'بایگانی');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
getHatchingList();
|
|
||||||
getHatchingReport();
|
|
||||||
|
|
||||||
checkLocationPermission(request: true);
|
|
||||||
|
|
||||||
ever(pickedImages, (callback) {
|
|
||||||
_multiPartPickedImages.clear();
|
|
||||||
for (var element in pickedImages) {
|
|
||||||
_multiPartPickedImages.add(
|
|
||||||
MultipartFile.fromFileSync(element.path, filename: element.name),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
super.onClose();
|
|
||||||
baseLogic.clearSearch();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getHatchingList([bool isLoadingMore = false]) async {
|
|
||||||
if (isLoadingMore) {
|
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
|
||||||
} 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(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (res) {
|
|
||||||
if ((res?.count ?? 0) == 0) {
|
|
||||||
hatchingList.value = Resource<PaginationModel<HatchingModel>>.empty();
|
|
||||||
} else {
|
|
||||||
hatchingList.value = Resource<PaginationModel<HatchingModel>>.success(
|
|
||||||
PaginationModel<HatchingModel>(
|
|
||||||
count: res?.count ?? 0,
|
|
||||||
next: res?.next,
|
|
||||||
previous: res?.previous,
|
|
||||||
results: [
|
|
||||||
...(hatchingList.value.data?.results ?? []),
|
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getHatchingReport([bool isLoadingMore = false]) async {
|
|
||||||
if (isLoadingMore) {
|
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
|
||||||
} 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(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(
|
|
||||||
role: 'PoultryScience',
|
|
||||||
pageSize: 50,
|
|
||||||
search: 'filter',
|
|
||||||
value: searchedValue.value,
|
|
||||||
fromDate: fromDateFilter.value.toDateTime(),
|
|
||||||
toDate: toDateFilter.value.toDateTime(),
|
|
||||||
page: currentPage.value,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (res) {
|
|
||||||
if ((res?.count ?? 0) == 0) {
|
|
||||||
hatchingReportList.value =
|
|
||||||
Resource<PaginationModel<HatchingReport>>.empty();
|
|
||||||
} else {
|
|
||||||
hatchingReportList.value =
|
|
||||||
Resource<PaginationModel<HatchingReport>>.success(
|
|
||||||
PaginationModel<HatchingReport>(
|
|
||||||
count: res?.count ?? 0,
|
|
||||||
next: res?.next,
|
|
||||||
previous: res?.previous,
|
|
||||||
results: [
|
|
||||||
...(hatchingReportList.value.data?.results ?? []),
|
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> pickImages() async {
|
|
||||||
determineCurrentPosition();
|
|
||||||
var tmp = await pickCameraImage();
|
|
||||||
if (tmp?.path != null && pickedImages.length < 7) {
|
|
||||||
pickedImages.add(tmp!);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeImage(int index) {
|
|
||||||
pickedImages.removeAt(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearImages() {
|
|
||||||
pickedImages.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> submitInspectionReport({required int id}) async {
|
|
||||||
isOnUpload.value = true;
|
|
||||||
|
|
||||||
final tmpFiles = await Future.wait(
|
|
||||||
pickedImages.map(
|
|
||||||
(element) =>
|
|
||||||
MultipartFile.fromFile(element.path, filename: element.name),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
var data = FormData.fromMap({
|
|
||||||
'file': tmpFiles,
|
|
||||||
'hatching_id': id.toString(),
|
|
||||||
'lat': currentLocation.value.latitude.toString(),
|
|
||||||
'log': currentLocation.value.longitude.toString(),
|
|
||||||
});
|
|
||||||
|
|
||||||
safeCall(
|
|
||||||
call: () async =>
|
|
||||||
await rootLogic.poultryRepository.submitPoultryScienceReport(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
data: data,
|
|
||||||
onSendProgress: (sent, total) {
|
|
||||||
presentUpload.value = calculateUploadProgress(
|
|
||||||
sent: sent,
|
|
||||||
total: total,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
onSuccess: (res) {
|
|
||||||
closeBottomSheet();
|
|
||||||
clearImages();
|
|
||||||
getHatchingList();
|
|
||||||
getHatchingReport();
|
|
||||||
isOnUpload.value = false;
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) async {
|
|
||||||
clearImages();
|
|
||||||
isOnUpload.value = false;
|
|
||||||
|
|
||||||
await Future.delayed(
|
|
||||||
const Duration(seconds: 4),
|
|
||||||
).then((value) => closeBottomSheet());
|
|
||||||
},
|
|
||||||
showError: true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void closeBottomSheet() {
|
|
||||||
Get.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
double calculateUploadProgress({required int sent, required int total}) {
|
|
||||||
if (total != 0) {
|
|
||||||
double progress = (sent * 100 / total) / 100;
|
|
||||||
return progress;
|
|
||||||
} else {
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
dLog('Search Value: $data');
|
|
||||||
searchedValue.value = data?.trim();
|
|
||||||
final isReporter = selectedSegmentIndex.value == 1;
|
|
||||||
if (isReporter) {
|
|
||||||
getHatchingReport();
|
|
||||||
} else {
|
|
||||||
getHatchingList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> onRefresh() async {
|
|
||||||
currentPage.value = 1;
|
|
||||||
|
|
||||||
await Future.wait([getHatchingList(), getHatchingReport()]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,699 +0,0 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching/hatching_models.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching_report/hatching_report.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';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic> {
|
|
||||||
const InspectionPoultrySciencePage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
hasBack: true,
|
|
||||||
hasFilter: true,
|
|
||||||
hasSearch: true,
|
|
||||||
onFilterTap: () {
|
|
||||||
Get.bottomSheet(filterBottomSheet());
|
|
||||||
},
|
|
||||||
onRefresh: controller.onRefresh,
|
|
||||||
onSearchChanged: (data) => controller.setSearchValue(data),
|
|
||||||
backId: poultryScienceActionKey,
|
|
||||||
routesWidget: ContainerBreadcrumb(rxRoutes: controller.routesName),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 50, child: segmentWidget()),
|
|
||||||
ObxValue((data) {
|
|
||||||
return data.value == 0 ? hatchingWidget() : reportWidget();
|
|
||||||
}, controller.selectedSegmentIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget hatchingWidget() {
|
|
||||||
return Expanded(
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return RPaginatedListView(
|
|
||||||
listType: ListType.separated,
|
|
||||||
resource: data.value,
|
|
||||||
hasMore: data.value.data?.next != null,
|
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
var item = data.value.data!.results![index];
|
|
||||||
return ObxValue((val) {
|
|
||||||
return ExpandableListItem2(
|
|
||||||
selected: val.value.isEqual(index),
|
|
||||||
onTap: () => controller.toggleExpanded(index),
|
|
||||||
index: index,
|
|
||||||
child: itemListWidget(item),
|
|
||||||
secondChild: itemListExpandedWidget(item),
|
|
||||||
labelColor: AppColor.blueLight,
|
|
||||||
labelIcon: item.reportInfo?.image == false
|
|
||||||
? Assets.vec.timerSvg.path
|
|
||||||
: Assets.vec.checkSquareSvg.path,
|
|
||||||
labelIconColor: item.reportInfo?.image == false
|
|
||||||
? AppColor.yellowNormal2
|
|
||||||
: AppColor.mediumGreyDarkHover,
|
|
||||||
);
|
|
||||||
}, controller.expandedIndex);
|
|
||||||
},
|
|
||||||
itemCount: data.value.data?.results?.length ?? 0,
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
|
||||||
onLoadMore: () async => controller.getHatchingList(true),
|
|
||||||
);
|
|
||||||
}, controller.hatchingList),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container itemListExpandedWidget(HatchingModel item) {
|
|
||||||
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.poultry?.user?.fullname ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
|
|
||||||
Visibility(
|
|
||||||
child: Text(
|
|
||||||
item.violation == true ? 'پیگیری' : 'عادی',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.redDark),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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: [
|
|
||||||
Text(
|
|
||||||
'نژاد:${item.breed?.first.breed ?? 'N/A'}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' سن ${item.age} (روزه)',
|
|
||||||
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' دوره جوجه ریزی:${item.period}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(title: 'شماره مجوز جوجه ریزی', value: item.licenceNumber ?? 'N/A'),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'حجم جوجه ریزی',
|
|
||||||
value: item.quantity.separatedByCommaFa,
|
|
||||||
|
|
||||||
unit: '(قطعه)',
|
|
||||||
),
|
|
||||||
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: 'شرح بازرسی',
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cameraBottomSheet(int id) {
|
|
||||||
Get.bottomSheet(
|
|
||||||
isDismissible: false,
|
|
||||||
isScrollControlled: false,
|
|
||||||
BaseBottomSheet(
|
|
||||||
height: 350.h,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
ObxValue((data) {
|
|
||||||
return GridView.builder(
|
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 4,
|
|
||||||
mainAxisSpacing: 8,
|
|
||||||
crossAxisSpacing: 8,
|
|
||||||
childAspectRatio: 1,
|
|
||||||
),
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemCount: controller.pickedImages.length + 1,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index + 1 < 7 && index == data.length) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () async {
|
|
||||||
await controller.pickImages();
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
width: 80.h,
|
|
||||||
height: 80.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.lightGreyNormal,
|
|
||||||
borderRadius: BorderRadius.circular(8.r),
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: Icon(
|
|
||||||
Icons.add_a_photo,
|
|
||||||
color: AppColor.lightGreyDarker,
|
|
||||||
size: 32.h,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Container(
|
|
||||||
width: 80.h,
|
|
||||||
height: 80.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.lightGreyNormal,
|
|
||||||
borderRadius: BorderRadius.circular(8.r),
|
|
||||||
),
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Positioned.fill(
|
|
||||||
child: Image.file(File(data[index].path), fit: BoxFit.cover),
|
|
||||||
),
|
|
||||||
|
|
||||||
Positioned(
|
|
||||||
top: 4,
|
|
||||||
left: 4,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
controller.removeImage(index);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
color: Colors.white.withValues(alpha: 0.80),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Assets.vec.trashSvg.svg(
|
|
||||||
width: 8.w,
|
|
||||||
height: 8.h,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.redNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}, controller.pickedImages),
|
|
||||||
|
|
||||||
SizedBox(height: 35.h),
|
|
||||||
Text(
|
|
||||||
'حداقل ۲ تصویر برای ثبت بازرسی لازم است',
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
SizedBox(height: 8.h),
|
|
||||||
Row(
|
|
||||||
spacing: 16,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Obx(() {
|
|
||||||
return RElevated(
|
|
||||||
height: 40.h,
|
|
||||||
text: 'ارسال',
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
progress: controller.presentUpload.value,
|
|
||||||
isLoading: controller.isOnUpload.value,
|
|
||||||
enabled: controller.pickedImages.length >= 2,
|
|
||||||
onPressed: () async {
|
|
||||||
controller.submitInspectionReport(id: id);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
ObxValue((data) {
|
|
||||||
return RElevated(
|
|
||||||
height: 40.h,
|
|
||||||
text: 'انصراف',
|
|
||||||
backgroundColor: AppColor.redNormal,
|
|
||||||
enabled: !data.value,
|
|
||||||
onPressed: () {
|
|
||||||
if (!data.value) {
|
|
||||||
controller.clearImages();
|
|
||||||
Get.back();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}, controller.isOnUpload),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 8.h),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
).whenComplete(() {
|
|
||||||
controller.pickedImages.clear();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Padding segmentWidget() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: RSegment(
|
|
||||||
children: ['بازرسی', 'بایگانی'],
|
|
||||||
selectedIndex: 0,
|
|
||||||
borderColor: const Color(0xFFB4B4B4),
|
|
||||||
selectedBorderColor: AppColor.blueNormal,
|
|
||||||
selectedBackgroundColor: AppColor.blueLight,
|
|
||||||
onSegmentSelected: (index) => controller.selectedSegmentIndex.value = index,
|
|
||||||
backgroundColor: AppColor.whiteGreyNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget reportWidget() {
|
|
||||||
return Expanded(
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return RPaginatedListView(
|
|
||||||
listType: ListType.separated,
|
|
||||||
resource: data.value,
|
|
||||||
hasMore: data.value.data?.next != null,
|
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
var item = data.value.data!.results![index];
|
|
||||||
return ObxValue((val) {
|
|
||||||
return ExpandableListItem2(
|
|
||||||
selected: val.value.isEqual(index),
|
|
||||||
onTap: () => controller.toggleExpanded(index),
|
|
||||||
index: index,
|
|
||||||
child: itemListWidgetReport(item),
|
|
||||||
secondChild: itemListExpandedWidgetReport(item),
|
|
||||||
labelColor: item.state == 'rejected' ? AppColor.redLight : AppColor.greenLight,
|
|
||||||
labelIcon: Assets.vec.cubeSearchSvg.path,
|
|
||||||
);
|
|
||||||
}, controller.expandedIndex);
|
|
||||||
},
|
|
||||||
itemCount: data.value.data?.results?.length ?? 0,
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
|
||||||
onLoadMore: () async => controller.getHatchingReport(true),
|
|
||||||
);
|
|
||||||
}, controller.hatchingReportList),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget itemListExpandedWidgetReport(HatchingReport item) {
|
|
||||||
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.hatching?.poultry?.user?.fullname ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
|
|
||||||
Visibility(
|
|
||||||
child: Text(
|
|
||||||
item.hatching?.violation == true ? 'پیگیری' : 'عادی',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.redDark),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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('نژاد:', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
|
|
||||||
Text(
|
|
||||||
item.hatching?.chickenBreed ?? 'N/A',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' سن ${item.hatching?.chickenAge} (روزه)',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
' دوره جوجه ریزی:${item.hatching?.period}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(title: 'شماره مجوز جوجه ریزی', value: item.hatching?.licenceNumber ?? 'N/A'),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'حجم جوجه ریزی',
|
|
||||||
value: item.hatching?.quantity.separatedByCommaFa ?? 'N/A',
|
|
||||||
|
|
||||||
unit: '(قطعه)',
|
|
||||||
),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'مانده در سالن',
|
|
||||||
value: item.hatching?.leftOver.separatedByCommaFa ?? 'N/A',
|
|
||||||
unit: '(قطعه)',
|
|
||||||
),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'تلفات',
|
|
||||||
value: item.hatching?.losses.separatedByCommaFa ?? 'N/A',
|
|
||||||
unit: '(قطعه)',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'دامپزشک فارم',
|
|
||||||
value:
|
|
||||||
'${item.hatching?.vetFarm?.vetFarmFullName}(${item.hatching?.vetFarm?.vetFarmMobile})',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'شرح بازرسی',
|
|
||||||
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(
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemCount: item.image?.length ?? 0,
|
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 2,
|
|
||||||
mainAxisSpacing: 10,
|
|
||||||
crossAxisSpacing: 10,
|
|
||||||
),
|
|
||||||
itemBuilder: (context, index) => Container(
|
|
||||||
height: 100.h,
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
child: Image.network(
|
|
||||||
item.image?[index] ?? '',
|
|
||||||
loadingBuilder: (context, child, loadingProgress) {
|
|
||||||
if (loadingProgress == null) return child;
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsetsGeometry.all(80),
|
|
||||||
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
color: AppColor.blueDark,
|
|
||||||
value: loadingProgress.expectedTotalBytes != null
|
|
||||||
? loadingProgress.cumulativeBytesLoaded /
|
|
||||||
(loadingProgress.expectedTotalBytes ?? 1)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8.r)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget itemListWidget(HatchingModel item) {
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 5,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.poultry?.user?.fullname ?? 'N/A',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.poultry?.user?.mobile ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
spacing: 5,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.poultry?.unitName ?? 'N/Aaq',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.poultry?.licenceNumber ?? 'N/A',
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Assets.vec.scanSvg.svg(
|
|
||||||
width: 32.w,
|
|
||||||
height: 32.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Row itemListWidgetReport(HatchingReport item) {
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 5,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.hatching?.poultry?.user?.fullname ?? 'N/A',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.hatching?.poultry?.user?.mobile ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
spacing: 5,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.hatching?.poultry?.unitName ?? 'N/Aaq',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.hatching?.licenceNumber ?? 'N/A',
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Assets.vec.scanSvg.svg(
|
|
||||||
width: 32.w,
|
|
||||||
height: 32.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,450 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_export/poultry_export.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/request/kill_registration/kill_registration.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/all_poultry/all_poultry.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/approved_price/approved_price.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/kill_house_poultry/kill_house_poultry.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/kill_request_poultry/kill_request_poultry.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_hatching/poultry_hatching.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/sell_for_freezing/sell_for_freezing.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/genocide/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class KillingRegistrationLogic extends GetxController {
|
|
||||||
List<String> routes = ['اقدام', 'درخواست کشتارها', 'ثبت کشتار'];
|
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
|
||||||
var gService = Get.find<GService>();
|
|
||||||
var rootLogic = Get.find<PoultryScienceRootLogic>();
|
|
||||||
GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
|
||||||
|
|
||||||
Rxn<ApprovedPrice> approvedPrice = Rxn<ApprovedPrice>();
|
|
||||||
Rx<Jalali> killsDate = Jalali.now().obs;
|
|
||||||
|
|
||||||
Rxn<SellForFreezing> sellForFreezing = Rxn<SellForFreezing>();
|
|
||||||
Rxn<PoultryExport> poultryExport = Rxn<PoultryExport>();
|
|
||||||
|
|
||||||
TextEditingController quantityKillsController = TextEditingController();
|
|
||||||
RxBool quantityKillsIsCompleted = false.obs;
|
|
||||||
TextEditingController quantityLoseController = TextEditingController(
|
|
||||||
text: 0.toString(),
|
|
||||||
);
|
|
||||||
TextEditingController averageWeightKillsController = TextEditingController();
|
|
||||||
RxBool averageWeightKillsIsCompleted = false.obs;
|
|
||||||
TextEditingController priceFreeSaleController = TextEditingController();
|
|
||||||
|
|
||||||
RxInt generatedApprovedPrice = 0.obs;
|
|
||||||
RxBool isOnSubmitLoading = false.obs;
|
|
||||||
|
|
||||||
RxBool isExportSelected = false.obs;
|
|
||||||
RxBool isFreezedSelected = false.obs;
|
|
||||||
RxBool isMarketSelected = false.obs;
|
|
||||||
RxBool isFreeSale = false.obs;
|
|
||||||
|
|
||||||
//step 1
|
|
||||||
Rx<Resource<List<AllPoultry>>> allPoultryList =
|
|
||||||
Resource<List<AllPoultry>>.loading().obs;
|
|
||||||
Rxn<AllPoultry> selectedPoultry = Rxn();
|
|
||||||
|
|
||||||
//step 2
|
|
||||||
Rx<Resource<List<KillRequestPoultry>>> poultryList =
|
|
||||||
Resource<List<KillRequestPoultry>>.success([]).obs;
|
|
||||||
Rxn<KillRequestPoultry> selectedKillRequestPoultry = Rxn();
|
|
||||||
|
|
||||||
//step 3
|
|
||||||
Rx<Resource<List<PoultryHatching>>> poultryHatchingList =
|
|
||||||
Resource<List<PoultryHatching>>.success([]).obs;
|
|
||||||
Rxn<PoultryHatching> selectedPoultryHatching = Rxn();
|
|
||||||
|
|
||||||
//step 5
|
|
||||||
Rx<Resource<List<KillHousePoultry>>> killHouseList =
|
|
||||||
Resource<List<KillHousePoultry>>.success([]).obs;
|
|
||||||
Rxn<KillHousePoultry> selectedKillHouse = Rxn();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
|
|
||||||
getApprovedPrice();
|
|
||||||
|
|
||||||
getAllPoultryList();
|
|
||||||
|
|
||||||
getSellForFreezing();
|
|
||||||
|
|
||||||
getPoultryExport();
|
|
||||||
|
|
||||||
priceListener();
|
|
||||||
|
|
||||||
ever(selectedKillRequestPoultry, (callback) {
|
|
||||||
if (callback?.provinceAllowChooseKillHouse?.allowState ?? false) {
|
|
||||||
getKillHouseList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
everAll(
|
|
||||||
[
|
|
||||||
selectedPoultry,
|
|
||||||
selectedKillRequestPoultry,
|
|
||||||
selectedPoultryHatching,
|
|
||||||
selectedKillHouse,
|
|
||||||
],
|
|
||||||
(callback) {
|
|
||||||
checkSubmitButton();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
super.onClose();
|
|
||||||
quantityKillsController.dispose();
|
|
||||||
quantityLoseController.dispose();
|
|
||||||
averageWeightKillsController.dispose();
|
|
||||||
priceFreeSaleController.dispose();
|
|
||||||
clearSelectedStep1();
|
|
||||||
clearSelectedStep2();
|
|
||||||
selectedKillHouse.value = null;
|
|
||||||
killHouseList.value = Resource<List<KillHousePoultry>>.success([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void priceListener() {
|
|
||||||
quantityKillsController.addListener(() {
|
|
||||||
quantityKillsIsCompleted.value = quantityKillsController.text
|
|
||||||
.trim()
|
|
||||||
.isNotEmpty;
|
|
||||||
|
|
||||||
if (averageWeightKillsController.text.isNotEmpty &&
|
|
||||||
quantityKillsController.text.trim().isNotEmpty) {
|
|
||||||
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
|
|
||||||
priceFreeSaleController.text =
|
|
||||||
generatedApprovedPrice.value.separatedByComma;
|
|
||||||
|
|
||||||
checkSubmitButton();
|
|
||||||
} else {
|
|
||||||
generatedApprovedPrice.value = 0;
|
|
||||||
priceFreeSaleController.text = '0';
|
|
||||||
checkSubmitButton();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
averageWeightKillsController.addListener(() {
|
|
||||||
averageWeightKillsIsCompleted.value = averageWeightKillsController.text
|
|
||||||
.trim()
|
|
||||||
.isNotEmpty;
|
|
||||||
|
|
||||||
if (averageWeightKillsController.text.trim().isNotEmpty &&
|
|
||||||
quantityKillsController.text.trim().isNotEmpty) {
|
|
||||||
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
|
|
||||||
priceFreeSaleController.text =
|
|
||||||
generatedApprovedPrice.value.separatedByComma;
|
|
||||||
checkSubmitButton();
|
|
||||||
} else {
|
|
||||||
generatedApprovedPrice.value = 0;
|
|
||||||
priceFreeSaleController.text = '0';
|
|
||||||
checkSubmitButton();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
priceFreeSaleController.addListener(() {
|
|
||||||
final text = priceFreeSaleController.text;
|
|
||||||
if (text.isNotEmpty) {
|
|
||||||
generatedApprovedPrice.value = int.parse(text.replaceAll(',', ''));
|
|
||||||
} else {
|
|
||||||
generatedApprovedPrice.value = 0;
|
|
||||||
}
|
|
||||||
checkSubmitButton();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearSelectedStep1() {
|
|
||||||
selectedPoultry.value = null;
|
|
||||||
selectedKillRequestPoultry.value = null;
|
|
||||||
selectedPoultryHatching.value = null;
|
|
||||||
poultryList.value = Resource<List<KillRequestPoultry>>.success([]);
|
|
||||||
poultryHatchingList.value = Resource<List<PoultryHatching>>.success([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearSelectedStep2() {
|
|
||||||
selectedKillRequestPoultry.value = null;
|
|
||||||
selectedPoultryHatching.value = null;
|
|
||||||
poultryHatchingList.value = Resource<List<PoultryHatching>>.success([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getApprovedPrice() async {
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.poultryRepository.getApprovedPrice(
|
|
||||||
token: tokenService.accessToken.value ?? '',
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
approvedPrice.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getAllPoultryList() async {
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.poultryRepository.getAllPoultry(
|
|
||||||
token: tokenService.accessToken.value ?? '',
|
|
||||||
queryParameters: buildRawQueryParams(
|
|
||||||
role: gService.getRole(Module.chicken),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
allPoultryList.value = Resource<List<AllPoultry>>.success(result);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {
|
|
||||||
allPoultryList.value = Resource<List<AllPoultry>>.error(
|
|
||||||
'$error -- $stackTrace',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getSellForFreezing() async {
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.poultryRepository.getSellForFreezing(
|
|
||||||
token: tokenService.accessToken.value ?? '',
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
sellForFreezing.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getPoultryExport() async {
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.poultryRepository.getPoultryExport(
|
|
||||||
token: tokenService.accessToken.value ?? '',
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
poultryExport.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getUserPoultryList() async {
|
|
||||||
poultryList.value = Resource<List<KillRequestPoultry>>.loading();
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.poultryRepository.getUserPoultry(
|
|
||||||
token: tokenService.accessToken.value ?? '',
|
|
||||||
queryParameters: buildQueryParams(
|
|
||||||
value: selectedPoultry.value?.user?.mobile,
|
|
||||||
queryParams: {'type': 'filter'},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
poultryList.value = Resource<List<KillRequestPoultry>>.success(
|
|
||||||
result,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {
|
|
||||||
poultryList.value = Resource<List<KillRequestPoultry>>.error(
|
|
||||||
'$error -- $stackTrace',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getPoultryHatchingList() async {
|
|
||||||
poultryHatchingList.value = Resource<List<PoultryHatching>>.loading();
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.poultryRepository.getPoultryHatching(
|
|
||||||
token: tokenService.accessToken.value ?? '',
|
|
||||||
queryParameters: buildRawQueryParams(
|
|
||||||
queryParams: {'key': selectedKillRequestPoultry.value?.key},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
poultryHatchingList.value = Resource<List<PoultryHatching>>.success(
|
|
||||||
result,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {
|
|
||||||
poultryHatchingList.value = Resource<List<PoultryHatching>>.error(
|
|
||||||
'$error -- $stackTrace',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getKillHouseList() async {
|
|
||||||
killHouseList.value = Resource<List<KillHousePoultry>>.loading();
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.poultryRepository.getKillHouseList(
|
|
||||||
token: tokenService.accessToken.value ?? '',
|
|
||||||
queryParameters: buildRawQueryParams(
|
|
||||||
queryParams: {
|
|
||||||
'show_poultry': '',
|
|
||||||
'date': DateTime.now().formattedDashedGregorian,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
killHouseList.value = Resource<List<KillHousePoultry>>.success(
|
|
||||||
result,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {
|
|
||||||
killHouseList.value = Resource<List<KillHousePoultry>>.error(
|
|
||||||
'$error -- $stackTrace',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
double calculateApprovedPrice() {
|
|
||||||
final inputWeight = double.parse(averageWeightKillsController.text) * 1000;
|
|
||||||
final lowestWeight = approvedPrice.value?.lowestWeight ?? 0;
|
|
||||||
final highestWeight = approvedPrice.value?.highestWeight ?? 0;
|
|
||||||
final lowestPrice = approvedPrice.value?.lowestPrice ?? 0;
|
|
||||||
final highestPrice = approvedPrice.value?.highestPrice ?? 0;
|
|
||||||
|
|
||||||
if (inputWeight <= lowestWeight) {
|
|
||||||
return lowestPrice;
|
|
||||||
} else if (inputWeight >= highestWeight) {
|
|
||||||
return highestPrice;
|
|
||||||
} else {
|
|
||||||
final diffWeight = highestWeight - lowestWeight;
|
|
||||||
final diffPrice = highestPrice - lowestPrice;
|
|
||||||
final fraction = diffPrice / diffWeight;
|
|
||||||
final diffFromMinWeight = inputWeight - lowestWeight;
|
|
||||||
return diffFromMinWeight * fraction + lowestPrice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void changeSaleType() {
|
|
||||||
isFreeSale.value = !isFreeSale.value;
|
|
||||||
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkSubmitButton() {
|
|
||||||
isOnSubmitLoading.value =
|
|
||||||
selectedPoultry.value != null &&
|
|
||||||
selectedKillRequestPoultry.value != null &&
|
|
||||||
selectedPoultryHatching.value != null &&
|
|
||||||
quantityKillsController.text.isNotEmpty &&
|
|
||||||
averageWeightKillsController.text.isNotEmpty &&
|
|
||||||
((selectedKillRequestPoultry
|
|
||||||
.value
|
|
||||||
?.provinceAllowChooseKillHouse
|
|
||||||
?.mandatory ??
|
|
||||||
false)
|
|
||||||
? selectedKillHouse.value != null
|
|
||||||
: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> submitKillRegistration() async {
|
|
||||||
isOnSubmitLoading.value = false;
|
|
||||||
if (!formKey.currentState!.validate()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dLog(double.parse(averageWeightKillsController.text));
|
|
||||||
KillRegistrationRequest registrationRequest = KillRegistrationRequest(
|
|
||||||
indexWeight: double.parse(averageWeightKillsController.text),
|
|
||||||
amount: generatedApprovedPrice.value,
|
|
||||||
approvedPrice: approvedPrice.value?.approved ?? false,
|
|
||||||
auctionList: [],
|
|
||||||
cash: true,
|
|
||||||
chickenBreed: selectedPoultryHatching.value?.chickenBreed,
|
|
||||||
confirmPoultryMobile: selectedPoultry.value?.user?.mobile,
|
|
||||||
credit: false,
|
|
||||||
export: isExportSelected.value,
|
|
||||||
financialOperation: "outside-system",
|
|
||||||
freeSaleInProvince: isMarketSelected.value,
|
|
||||||
freezing: isFreezedSelected.value,
|
|
||||||
killHouseList: [
|
|
||||||
if (selectedKillHouse.value != null)
|
|
||||||
'${selectedKillHouse.value?.name}(${selectedKillHouse.value?.fullname})',
|
|
||||||
],
|
|
||||||
killReqKey: selectedKillHouse.value?.killReqKey,
|
|
||||||
losses: quantityLoseController.text,
|
|
||||||
market: isMarketSelected.value,
|
|
||||||
operatorKey: "",
|
|
||||||
poultryHatchingKey: selectedPoultryHatching.value?.key,
|
|
||||||
poultryKey: selectedPoultry.value?.key,
|
|
||||||
quantity: int.parse(quantityKillsController.text.clearComma),
|
|
||||||
role: gService.getRole(Module.chicken),
|
|
||||||
sendDate: killsDate.value.toDateTime().formattedDashedGregorian,
|
|
||||||
);
|
|
||||||
|
|
||||||
await safeCall(
|
|
||||||
call: () async =>
|
|
||||||
await rootLogic.poultryRepository.submitKillRegistration(
|
|
||||||
token: tokenService.accessToken.value ?? '',
|
|
||||||
request: registrationRequest,
|
|
||||||
),
|
|
||||||
onSuccess: (result) async {
|
|
||||||
defaultShowSuccessMessage(
|
|
||||||
'ثبت با موفقیت انجام شد',
|
|
||||||
durationInSeconds: 2,
|
|
||||||
onDismissed: () async {
|
|
||||||
Get.find<GenocideLogic>().getPoultryOrderList();
|
|
||||||
Future.delayed(Duration(milliseconds: 300), () {
|
|
||||||
Get.back();
|
|
||||||
});
|
|
||||||
Get.find<GenocideLogic>().getPoultryOrderList();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearAllFields() {
|
|
||||||
// ریست فرم
|
|
||||||
formKey.currentState?.reset();
|
|
||||||
|
|
||||||
// ریست Rxn ها
|
|
||||||
approvedPrice.value = null;
|
|
||||||
sellForFreezing.value = null;
|
|
||||||
poultryExport.value = null;
|
|
||||||
selectedPoultry.value = null;
|
|
||||||
selectedKillRequestPoultry.value = null;
|
|
||||||
selectedPoultryHatching.value = null;
|
|
||||||
selectedKillHouse.value = null;
|
|
||||||
|
|
||||||
// ریست Rx ها
|
|
||||||
killsDate.value = Jalali.now();
|
|
||||||
generatedApprovedPrice.value = 0;
|
|
||||||
isOnSubmitLoading.value = false;
|
|
||||||
isExportSelected.value = false;
|
|
||||||
isFreezedSelected.value = false;
|
|
||||||
isMarketSelected.value = false;
|
|
||||||
isFreeSale.value = false;
|
|
||||||
|
|
||||||
// ریست TextEditingController ها
|
|
||||||
quantityKillsController.clear();
|
|
||||||
quantityLoseController.text = '0';
|
|
||||||
averageWeightKillsController.clear();
|
|
||||||
priceFreeSaleController.clear();
|
|
||||||
|
|
||||||
// ریست RxBool ها
|
|
||||||
quantityKillsIsCompleted.value = false;
|
|
||||||
averageWeightKillsIsCompleted.value = false;
|
|
||||||
|
|
||||||
// ریست Resource لیستها
|
|
||||||
allPoultryList.value = Resource<List<AllPoultry>>.loading();
|
|
||||||
poultryList.value = Resource<List<KillRequestPoultry>>.success([]);
|
|
||||||
poultryHatchingList.value = Resource<List<PoultryHatching>>.success([]);
|
|
||||||
killHouseList.value = Resource<List<KillHousePoultry>>.success([]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,587 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/all_poultry/all_poultry.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/kill_house_poultry/kill_house_poultry.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/kill_request_poultry/kill_request_poultry.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_hatching/poultry_hatching.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class KillingRegistrationPage extends GetView<KillingRegistrationLogic> {
|
|
||||||
const KillingRegistrationPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Form(
|
|
||||||
key: controller.formKey,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
poultryFarmWidget(),
|
|
||||||
poultryUserListWidget(),
|
|
||||||
poultryHatchingWidget(),
|
|
||||||
ObxValue((data) {
|
|
||||||
return Visibility(
|
|
||||||
visible: controller.selectedPoultryHatching.value != null,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
informationWidget(),
|
|
||||||
killDateWidget(
|
|
||||||
date: controller.killsDate,
|
|
||||||
onChanged: (Jalali jalali) {
|
|
||||||
controller.killsDate.value = jalali;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
quantityKillsWidget(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.selectedPoultryHatching),
|
|
||||||
ObxValue((data) {
|
|
||||||
return Visibility(
|
|
||||||
visible: data.value,
|
|
||||||
child: Column(children: [averageWeightKillsWidget()]),
|
|
||||||
);
|
|
||||||
}, controller.quantityKillsIsCompleted),
|
|
||||||
|
|
||||||
ObxValue((data) {
|
|
||||||
return Visibility(
|
|
||||||
visible: data.value,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
saleTypeWidget(),
|
|
||||||
priceWidget(),
|
|
||||||
buyerListWidget(),
|
|
||||||
slaughterhouseSelectedWidget(),
|
|
||||||
submitButtonWidget(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.averageWeightKillsIsCompleted),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget poultryFarmWidget() {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 10.h),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return ResourceOverlayDropdown<AllPoultry>(
|
|
||||||
items: data.value,
|
|
||||||
background: Colors.white,
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.clearSelectedStep1();
|
|
||||||
controller.selectedPoultry.value = value;
|
|
||||||
controller.getUserPoultryList();
|
|
||||||
},
|
|
||||||
selectedItem: controller.selectedPoultry.value,
|
|
||||||
itemBuilder: (item) => labelPoultryWidget(item),
|
|
||||||
labelBuilder: (item) => labelPoultryWidget(item),
|
|
||||||
);
|
|
||||||
}, controller.allPoultryList),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget labelPoultryWidget(AllPoultry? item) {
|
|
||||||
if (item == null) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Assets.vec.farmSvg.svg(
|
|
||||||
width: 28.w,
|
|
||||||
height: 28.h,
|
|
||||||
colorFilter: const ColorFilter.mode(AppColor.darkGreyDark, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
SizedBox(width: 4.w),
|
|
||||||
Text('انتخاب مرغداری', style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Text('${item.unitName} (${item.address?.city?.name})', maxLines: 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget poultryUserListWidget() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
if (data.value == null) {
|
|
||||||
return SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8.w),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return ResourceOverlayDropdown<KillRequestPoultry>(
|
|
||||||
items: data.value,
|
|
||||||
background: Colors.white,
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.clearSelectedStep2();
|
|
||||||
controller.selectedKillRequestPoultry.value = value;
|
|
||||||
controller.getPoultryHatchingList();
|
|
||||||
},
|
|
||||||
selectedItem: controller.selectedKillRequestPoultry.value,
|
|
||||||
itemBuilder: (item) => labelPoultryUser(item),
|
|
||||||
labelBuilder: (item) => labelPoultryUser(item),
|
|
||||||
);
|
|
||||||
}, controller.poultryList),
|
|
||||||
);
|
|
||||||
}, controller.selectedPoultry);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget labelPoultryUser(KillRequestPoultry? item) {
|
|
||||||
if (item == null) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Assets.vec.chickenHouseSvg.svg(
|
|
||||||
width: 28.w,
|
|
||||||
height: 28.h,
|
|
||||||
colorFilter: const ColorFilter.mode(AppColor.darkGreyDark, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
SizedBox(width: 6.w),
|
|
||||||
Text('محل پرورش', style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Text(item.unitName ?? '-');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget poultryHatchingWidget() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
if (data.value == null) {
|
|
||||||
return SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 10.h),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return ResourceOverlayDropdown<PoultryHatching>(
|
|
||||||
items: data.value,
|
|
||||||
background: Colors.white,
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.selectedPoultryHatching.value = value;
|
|
||||||
},
|
|
||||||
selectedItem: controller.selectedPoultryHatching.value,
|
|
||||||
itemBuilder: (item) => labelPoultryHatching(item),
|
|
||||||
labelBuilder: (item) => labelPoultryHatching(item),
|
|
||||||
);
|
|
||||||
}, controller.poultryHatchingList),
|
|
||||||
);
|
|
||||||
}, controller.selectedKillRequestPoultry);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget labelPoultryHatching(PoultryHatching? item) {
|
|
||||||
if (item == null) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Assets.vec.calendarSvg.svg(
|
|
||||||
width: 28.w,
|
|
||||||
height: 28.h,
|
|
||||||
colorFilter: const ColorFilter.mode(AppColor.darkGreyDark, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
SizedBox(width: 6.w),
|
|
||||||
Text('دوره جوجه ریزی', style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Text(
|
|
||||||
' دوره ${item.period} سالن ${item.hall} نژاد ${item.chickenBreed} باقیمانده ${item.leftOver} قطعه ',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget informationWidget() {
|
|
||||||
return Container(
|
|
||||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
|
||||||
margin: EdgeInsets.fromLTRB(8.w, 0, 8.w, 10.h),
|
|
||||||
padding: EdgeInsets.all(7),
|
|
||||||
child: ObxValue(
|
|
||||||
(data) => Column(
|
|
||||||
spacing: 8,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
|
||||||
child: Text(
|
|
||||||
'اطلاعات مرغداری',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
color: const Color(0xFFEAEFFF),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
side: BorderSide(width: 1, color: const Color(0xFFE0E7FF)),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
child: buildUnitRow(
|
|
||||||
title: 'تعداد جوجه ریزی',
|
|
||||||
value: data.value?.quantity.separatedByCommaFa,
|
|
||||||
unit: 'قطعه',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'تلفات',
|
|
||||||
value: data.value?.losses.separatedByCommaFa,
|
|
||||||
unit: 'قطعه',
|
|
||||||
padding: EdgeInsetsGeometry.symmetric(horizontal: 4),
|
|
||||||
),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'باقیمانده',
|
|
||||||
value: data.value?.leftOver.separatedByCommaFa,
|
|
||||||
unit: 'قطعه',
|
|
||||||
padding: EdgeInsetsGeometry.symmetric(horizontal: 4),
|
|
||||||
),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'سن جوجه',
|
|
||||||
value: data.value?.chickenAge.separatedByCommaFa,
|
|
||||||
unit: 'روز',
|
|
||||||
padding: EdgeInsetsGeometry.symmetric(horizontal: 4),
|
|
||||||
),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'مجوز فروش آزاد',
|
|
||||||
value:
|
|
||||||
data.value?.freeGovernmentalInfo?.totalFreeCommitmentQuantity.separatedByCommaFa,
|
|
||||||
unit: 'قطعه',
|
|
||||||
padding: EdgeInsetsGeometry.symmetric(horizontal: 4),
|
|
||||||
),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'مانده فروش آزاد',
|
|
||||||
value: data
|
|
||||||
.value
|
|
||||||
?.freeGovernmentalInfo
|
|
||||||
?.leftTotalFreeCommitmentQuantity
|
|
||||||
.separatedByCommaFa,
|
|
||||||
unit: 'قطعه',
|
|
||||||
padding: EdgeInsetsGeometry.symmetric(horizontal: 4),
|
|
||||||
),
|
|
||||||
buildUnitRow(
|
|
||||||
title: 'تلفن مرغدار',
|
|
||||||
value: data.value?.poultry?.userprofile?.mobile,
|
|
||||||
unit: '',
|
|
||||||
padding: EdgeInsetsGeometry.symmetric(horizontal: 4),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
controller.selectedPoultryHatching,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget killDateWidget({required Rx<Jalali> date, required Function(Jalali jalali) onChanged}) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
Get.bottomSheet(modalDatePicker(onDateSelected: (value) => onChanged(value)));
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
height: 40,
|
|
||||||
margin: EdgeInsets.symmetric(horizontal: 8.w),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 1, color: AppColor.darkGreyLight),
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 11, vertical: 4),
|
|
||||||
child: Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Assets.vec.calendarSvg.svg(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
colorFilter: const ColorFilter.mode(AppColor.bgDark, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
Text('تاریخ کشتار', style: AppFonts.yekan14.copyWith(color: AppColor.bgDark)),
|
|
||||||
Spacer(),
|
|
||||||
ObxValue((data) {
|
|
||||||
return Text(
|
|
||||||
date.value.formatCompactDate(),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
|
|
||||||
);
|
|
||||||
}, date),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget quantityKillsWidget() {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 10.h),
|
|
||||||
child: RTextField(
|
|
||||||
label: 'تعداد کشتار (قطعه)',
|
|
||||||
filled: true,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'تعداد کشتار را وارد کنید';
|
|
||||||
}
|
|
||||||
final count = double.tryParse(value.replaceAll(',', ''));
|
|
||||||
if (controller.isFreeSale.value) {
|
|
||||||
if (count! >
|
|
||||||
(controller
|
|
||||||
.selectedPoultryHatching
|
|
||||||
.value
|
|
||||||
?.freeGovernmentalInfo
|
|
||||||
?.leftTotalFreeCommitmentQuantity ??
|
|
||||||
0)) {
|
|
||||||
return 'مجوز فروش آزاد شما کافی نیست';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (count! > (controller.selectedPoultryHatching.value?.leftOver ?? 0)) {
|
|
||||||
return 'تعداد کشتار نباید بیشتر از باقیمانده جوجه ریزی باشد';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
filledColor: Colors.white,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly, SeparatorInputFormatter()],
|
|
||||||
controller: controller.quantityKillsController,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget averageWeightKillsWidget() {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8.w),
|
|
||||||
child: RTextField(
|
|
||||||
label: 'میانگین وزن (کیلوگرم)',
|
|
||||||
filled: true,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'میانگین وزن را وارد کنید';
|
|
||||||
}
|
|
||||||
final weight = double.tryParse(value.replaceAll(',', ''));
|
|
||||||
if (weight == null || weight <= 0) {
|
|
||||||
return 'میانگین وزن باید عددی بزرگتر از صفر باشد';
|
|
||||||
} else if (weight >
|
|
||||||
(controller.selectedPoultryHatching.value?.managementHatchingAgeRange?.toWeight ??
|
|
||||||
10000) ||
|
|
||||||
weight <
|
|
||||||
(controller
|
|
||||||
.selectedPoultryHatching
|
|
||||||
.value
|
|
||||||
?.managementHatchingAgeRange
|
|
||||||
?.fromWeight ??
|
|
||||||
-10000)) {
|
|
||||||
return 'میانگین وزن باید بین ${controller.selectedPoultryHatching.value?.managementHatchingAgeRange?.fromWeight} تا ${controller.selectedPoultryHatching.value?.managementHatchingAgeRange?.toWeight} کیلوگرم باشد';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
filledColor: Colors.white,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
inputFormatters: [FirstDigitDecimalFormatter()],
|
|
||||||
controller: controller.averageWeightKillsController,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget saleTypeWidget() {
|
|
||||||
return Container(
|
|
||||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
|
||||||
margin: EdgeInsets.symmetric(horizontal: 8.w, vertical: 10.h),
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 4.h),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'نوع فروش',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14Bold.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
RadioGroup(
|
|
||||||
groupValue: data.value ? 1 : 0,
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.changeSaleType();
|
|
||||||
},
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Radio(value: 0, activeColor: AppColor.blueNormal),
|
|
||||||
Text('دولتی', style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark)),
|
|
||||||
Spacer(),
|
|
||||||
Radio(value: 1, activeColor: AppColor.blueNormal),
|
|
||||||
Text('آزاد', style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.isFreeSale),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget priceWidget() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
if (!data.value) {
|
|
||||||
return Container(
|
|
||||||
height: 40.h,
|
|
||||||
margin: EdgeInsets.symmetric(horizontal: 8.w),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.greenLight,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 1.w, color: AppColor.whiteNormalHover),
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 11.w, vertical: 4.h),
|
|
||||||
child: Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Text('قیمت مصوب', style: AppFonts.yekan14.copyWith(color: AppColor.textColor)),
|
|
||||||
Spacer(),
|
|
||||||
|
|
||||||
ObxValue((data) {
|
|
||||||
return Text(
|
|
||||||
' ${data.value.separatedByCommaFa} ریال',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
);
|
|
||||||
}, controller.generatedApprovedPrice),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(8.w, 0, 8.w, 0),
|
|
||||||
child: RTextField(
|
|
||||||
label: 'قیمت پیشنهادی (ریال)',
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'قیمت پیشنهادی را وارد کنید';
|
|
||||||
}
|
|
||||||
final price = double.tryParse(value.replaceAll(',', ''));
|
|
||||||
|
|
||||||
if (price == null || price <= 0) {
|
|
||||||
return 'قیمت پیشنهادی باید عددی بزرگتر از صفر باشد';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
filled: true,
|
|
||||||
borderColor: AppColor.whiteNormalHover,
|
|
||||||
filledColor: AppColor.accent1,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly, SeparatorInputFormatter()],
|
|
||||||
controller: controller.priceFreeSaleController,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}, controller.isFreeSale);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buyerListWidget() {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return Visibility(
|
|
||||||
visible: data.value?.provinceAllowChooseKillHouse?.allowState ?? false,
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return ResourceOverlayDropdown<KillHousePoultry>(
|
|
||||||
items: data.value,
|
|
||||||
background: Colors.white,
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.selectedKillHouse.value = value;
|
|
||||||
},
|
|
||||||
selectedItem: controller.selectedKillHouse.value,
|
|
||||||
itemBuilder: (item) => Text(buildKillHouseLabel(item)),
|
|
||||||
labelBuilder: (item) => Text(buildKillHouseLabel(item)),
|
|
||||||
);
|
|
||||||
}, controller.killHouseList),
|
|
||||||
);
|
|
||||||
}, controller.selectedKillRequestPoultry),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String buildKillHouseLabel(KillHousePoultry? item) {
|
|
||||||
if (item == null) {
|
|
||||||
return 'خریدار/ظرفیت باقیمانده';
|
|
||||||
} else {
|
|
||||||
return '${item.name} / ${item.quantitySum} قطعه ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget slaughterhouseSelectedWidget() {
|
|
||||||
return Container(
|
|
||||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
|
||||||
margin: EdgeInsets.symmetric(horizontal: 8.w),
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8.w),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 8.h),
|
|
||||||
Text('عملیات کشتار', style: AppFonts.yekan14Bold.copyWith(color: AppColor.blueNormal)),
|
|
||||||
SizedBox(height: 8.h),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
ObxValue((data) {
|
|
||||||
return Visibility(
|
|
||||||
visible: data.value?.permission ?? false,
|
|
||||||
child: ObxValue(
|
|
||||||
(data) => TitleCheckBox(
|
|
||||||
title: ' انجماد',
|
|
||||||
onChanged: (_) {
|
|
||||||
controller.isFreezedSelected.value = !controller.isFreezedSelected.value;
|
|
||||||
},
|
|
||||||
isSelected: data.value,
|
|
||||||
),
|
|
||||||
controller.isFreezedSelected,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.sellForFreezing),
|
|
||||||
|
|
||||||
ObxValue((data) {
|
|
||||||
return TitleCheckBox(
|
|
||||||
title: 'پنل معاملات',
|
|
||||||
onChanged: (_) {
|
|
||||||
controller.isMarketSelected.value = !controller.isMarketSelected.value;
|
|
||||||
},
|
|
||||||
isSelected: data.value,
|
|
||||||
);
|
|
||||||
}, controller.isMarketSelected),
|
|
||||||
|
|
||||||
ObxValue((data) {
|
|
||||||
return Visibility(
|
|
||||||
visible: data.value?.allow ?? false,
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return TitleCheckBox(
|
|
||||||
title: 'صادرات',
|
|
||||||
isSelected: data.value,
|
|
||||||
onChanged: (_) {
|
|
||||||
controller.isExportSelected.value = !controller.isExportSelected.value;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}, controller.isExportSelected),
|
|
||||||
);
|
|
||||||
}, controller.poultryExport),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 8.h),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget submitButtonWidget() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 12.h),
|
|
||||||
child: RElevated(
|
|
||||||
enabled: data.value,
|
|
||||||
height: 45.h,
|
|
||||||
isFullWidth: true,
|
|
||||||
disabledBackgroundColor: AppColor.greenDarkHover,
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
textStyle: AppFonts.yekan16Bold.copyWith(color: Colors.white),
|
|
||||||
onPressed: () {
|
|
||||||
controller.submitKillRegistration();
|
|
||||||
},
|
|
||||||
text: 'ثبت کشتار',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.isOnSubmitLoading);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/routes/routes.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class PoultryActionItem {
|
|
||||||
final String title;
|
|
||||||
final String route;
|
|
||||||
final String icon;
|
|
||||||
|
|
||||||
PoultryActionItem({
|
|
||||||
required this.title,
|
|
||||||
required this.route,
|
|
||||||
required this.icon,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class PoultryActionLogic extends GetxController {
|
|
||||||
RxList<PoultryActionItem> items = [
|
|
||||||
PoultryActionItem(
|
|
||||||
title: "بازرسی",
|
|
||||||
route: PoultryScienceRoutes.inspectionPoultryScience,
|
|
||||||
icon: Assets.vec.chickenInspectionSvg.path,
|
|
||||||
),
|
|
||||||
PoultryActionItem(
|
|
||||||
title: "ثبت کشتار",
|
|
||||||
route: PoultryScienceRoutes.genocidePoultryScience,
|
|
||||||
icon: Assets.vec.registerKillSvg.path,
|
|
||||||
),
|
|
||||||
PoultryActionItem(
|
|
||||||
title: "فارم ها",
|
|
||||||
route: PoultryScienceRoutes.farmPoultryScience,
|
|
||||||
icon: Assets.vec.farmsSvg.path,
|
|
||||||
),
|
|
||||||
PoultryActionItem(
|
|
||||||
title: "جوجه ریزی فعال",
|
|
||||||
route: PoultryScienceRoutes.activeHatchingPoultryScience,
|
|
||||||
icon: Assets.vec.activeFramSvg.path,
|
|
||||||
),
|
|
||||||
|
|
||||||
PoultryActionItem(
|
|
||||||
title: "بازرسی مزارع طیور",
|
|
||||||
route: PoultryScienceRoutes.newInspectionPoultryScience,
|
|
||||||
icon: Assets.vec.activeFramSvg.path,
|
|
||||||
),
|
|
||||||
].obs;
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
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';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class PoultryActionPage extends GetView<PoultryActionLogic> {
|
|
||||||
PoultryActionPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
isBase: true,
|
|
||||||
hasNews: true,
|
|
||||||
hasNotification: true,
|
|
||||||
child: gridWidget(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget gridWidget() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
return GridView.builder(
|
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 18.h, horizontal: 32.w),
|
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 2,
|
|
||||||
mainAxisSpacing: 24.h,
|
|
||||||
crossAxisSpacing: 24.w,
|
|
||||||
),
|
|
||||||
itemCount: data.length,
|
|
||||||
hitTestBehavior: HitTestBehavior.opaque,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
var item = data[index];
|
|
||||||
return GlassMorphismCardIcon(
|
|
||||||
title: item.title,
|
|
||||||
vecIcon: item.icon,
|
|
||||||
onTap: () async {
|
|
||||||
Get.toNamed(item.route, id: poultryScienceActionKey);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}, controller.items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +1,7 @@
|
|||||||
<<<<<<<< HEAD:packages/chicken/lib/features/poultry_science/active_hatching/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching/hatching_models.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching/hatching_models.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/repositories/poultry_science_repository.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/repositories/poultry_science_repository.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/poultry_science/presentation/pages/active_hatching/logic.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class ActiveHatchingLogic extends GetxController {
|
class ActiveHatchingLogic extends GetxController {
|
||||||
@@ -47,8 +42,7 @@ class ActiveHatchingLogic extends GetxController {
|
|||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreList.value = true;
|
isLoadingMoreList.value = true;
|
||||||
} else {
|
} else {
|
||||||
activeHatchingList.value =
|
activeHatchingList.value = Resource<PaginationModel<HatchingModel>>.loading();
|
||||||
Resource<PaginationModel<HatchingModel>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -69,21 +63,16 @@ class ActiveHatchingLogic extends GetxController {
|
|||||||
),
|
),
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
activeHatchingList.value =
|
activeHatchingList.value = Resource<PaginationModel<HatchingModel>>.empty();
|
||||||
Resource<PaginationModel<HatchingModel>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
activeHatchingList.value =
|
activeHatchingList.value = Resource<PaginationModel<HatchingModel>>.success(
|
||||||
Resource<PaginationModel<HatchingModel>>.success(
|
PaginationModel<HatchingModel>(
|
||||||
PaginationModel<HatchingModel>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [...(activeHatchingList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
results: [
|
),
|
||||||
...(activeHatchingList.value.data?.results ?? []),
|
);
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/poultry_science/farm/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/home/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_farm/poultry_farm.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_farm/poultry_farm.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/home/logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/home/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/poultry_science/presentation/pages/farm/logic.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class FarmLogic extends GetxController {
|
class FarmLogic extends GetxController {
|
||||||
List<String> routes = ['اقدام', 'فارم ها'];
|
List<String> routes = ['اقدام', 'فارم ها'];
|
||||||
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
||||||
BasePageLogic baseLogic = Get.find<BasePageLogic>();
|
BasePageLogic baseLogic = Get.find<BasePageLogic>();
|
||||||
final PoultryScienceHomeLogic _homeLogic =
|
final PoultryScienceHomeLogic _homeLogic = Get.find<PoultryScienceHomeLogic>();
|
||||||
Get.find<PoultryScienceHomeLogic>();
|
|
||||||
RxList<InformationTagData> tagInfo = <InformationTagData>[
|
RxList<InformationTagData> tagInfo = <InformationTagData>[
|
||||||
InformationTagData(
|
InformationTagData(
|
||||||
labelTitle: 'کل فارم ها',
|
labelTitle: 'کل فارم ها',
|
||||||
@@ -82,18 +76,17 @@ class FarmLogic extends GetxController {
|
|||||||
farmList.value = Resource<PaginationModel<PoultryFarm>>.loading();
|
farmList.value = Resource<PaginationModel<PoultryFarm>>.loading();
|
||||||
}
|
}
|
||||||
await safeCall(
|
await safeCall(
|
||||||
call: () async =>
|
call: () async => await rootLogic.poultryRepository.getPoultryScienceFarmList(
|
||||||
await rootLogic.poultryRepository.getPoultryScienceFarmList(
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
queryParameters: buildQueryParams(
|
||||||
queryParameters: buildQueryParams(
|
queryParams: {'type': 'farm'},
|
||||||
queryParams: {'type': 'farm'},
|
role: 'PoultryScience',
|
||||||
role: 'PoultryScience',
|
pageSize: 50,
|
||||||
pageSize: 50,
|
search: 'filter',
|
||||||
search: 'filter',
|
value: '',
|
||||||
value: '',
|
page: currentPage.value,
|
||||||
page: currentPage.value,
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
farmList.value = Resource<PaginationModel<PoultryFarm>>.empty();
|
farmList.value = Resource<PaginationModel<PoultryFarm>>.empty();
|
||||||
@@ -103,10 +96,7 @@ class FarmLogic extends GetxController {
|
|||||||
count: res?.count ?? 0,
|
count: res?.count ?? 0,
|
||||||
next: res?.next,
|
next: res?.next,
|
||||||
previous: res?.previous,
|
previous: res?.previous,
|
||||||
results: [
|
results: [...(farmList.value.data?.results ?? []), ...?res?.results],
|
||||||
...(farmList.value.data?.results ?? []),
|
|
||||||
...?res?.results,
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
<<<<<<<< HEAD:packages/chicken/lib/features/poultry_science/genocide/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/killing_registration/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_order/poultry_order.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_order/poultry_order.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/killing_registration/logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/killing_registration/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/poultry_science/presentation/pages/genocide/logic.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class GenocideLogic extends GetxController {
|
class GenocideLogic extends GetxController {
|
||||||
@@ -50,8 +44,7 @@ class GenocideLogic extends GetxController {
|
|||||||
if (loadingMore) {
|
if (loadingMore) {
|
||||||
isLoadingMore.value = true;
|
isLoadingMore.value = true;
|
||||||
} else {
|
} else {
|
||||||
poultryOrderList.value =
|
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.loading();
|
||||||
Resource<PaginationModel<PoultryOrder>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -76,25 +69,19 @@ class GenocideLogic extends GetxController {
|
|||||||
onSuccess: (res) async {
|
onSuccess: (res) async {
|
||||||
await Future.delayed(Duration(milliseconds: 500));
|
await Future.delayed(Duration(milliseconds: 500));
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
poultryOrderList.value =
|
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.empty();
|
||||||
Resource<PaginationModel<PoultryOrder>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
if (loadingMore) {
|
if (loadingMore) {
|
||||||
poultryOrderList.value =
|
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(
|
||||||
Resource<PaginationModel<PoultryOrder>>.success(
|
PaginationModel<PoultryOrder>(
|
||||||
PaginationModel<PoultryOrder>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [...(poultryOrderList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
results: [
|
),
|
||||||
...(poultryOrderList.value.data?.results ?? []),
|
);
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
poultryOrderList.value =
|
poultryOrderList.value = Resource<PaginationModel<PoultryOrder>>.success(res!);
|
||||||
Resource<PaginationModel<PoultryOrder>>.success(res!);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/poultry_science/genocide/view.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/poultry_order/poultry_order.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/killing_registration/view.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_order/poultry_order.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_order/poultry_order.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/killing_registration/view.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/killing_registration/view.dart';
|
||||||
|
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/poultry_science/presentation/pages/genocide/view.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/filter_bottom_sheet.dart';
|
||||||
@@ -94,10 +89,7 @@ class GenocidePage extends GetView<GenocideLogic> {
|
|||||||
Container itemListExpandedWidget(PoultryOrder item) {
|
Container itemListExpandedWidget(PoultryOrder 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: [
|
||||||
@@ -159,14 +151,8 @@ class GenocidePage extends GetView<GenocideLogic> {
|
|||||||
buildRow(title: 'نوع کشتار ', value: controller.getKillType(item)),
|
buildRow(title: 'نوع کشتار ', value: controller.getKillType(item)),
|
||||||
buildRow(title: 'درخواست', value: controller.getRequestType(item)),
|
buildRow(title: 'درخواست', value: controller.getRequestType(item)),
|
||||||
|
|
||||||
buildRow(
|
buildRow(title: 'میانگین وزنی', value: '${(item.indexWeight)} (کیلوگرم)'),
|
||||||
title: 'میانگین وزنی',
|
buildRow(title: 'قیمت مرغدار', value: '${item.amount.separatedByComma} (ریال)'),
|
||||||
value: '${(item.indexWeight)} (کیلوگرم)',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'قیمت مرغدار',
|
|
||||||
value: '${item.amount.separatedByComma} (ریال)',
|
|
||||||
),
|
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'مانده در سالن ',
|
title: 'مانده در سالن ',
|
||||||
value: '${item.hatching?.leftOver.separatedByComma ?? 0} (قطعه)',
|
value: '${item.hatching?.leftOver.separatedByComma ?? 0} (قطعه)',
|
||||||
@@ -183,10 +169,7 @@ class GenocidePage extends GetView<GenocideLogic> {
|
|||||||
icon: Assets.vec.trashSvg.svg(
|
icon: Assets.vec.trashSvg.svg(
|
||||||
width: 16.w,
|
width: 16.w,
|
||||||
height: 16.h,
|
height: 16.h,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(AppColor.error, BlendMode.srcIn),
|
||||||
AppColor.error,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
textStyle: AppFonts.yekan16Bold.copyWith(color: AppColor.error),
|
textStyle: AppFonts.yekan16Bold.copyWith(color: AppColor.error),
|
||||||
borderColor: AppColor.error,
|
borderColor: AppColor.error,
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/poultry_science/home/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/poultry_science/home_poultry_science/home_poultry_science_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/home_poultry_science/home_poultry_science_model.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/home_poultry_science/home_poultry_science_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/poultry_science/presentation/pages/home/logic.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:rasadyar_core/presentation/widget/custom/information_card_widget.dart';
|
import 'package:rasadyar_core/presentation/widget/custom/information_card_widget.dart';
|
||||||
|
|
||||||
@@ -163,8 +159,7 @@ class PoultryScienceHomeLogic extends GetxController {
|
|||||||
);
|
);
|
||||||
case 'حجم کشتار شده':
|
case 'حجم کشتار شده':
|
||||||
return tag.copyWith(
|
return tag.copyWith(
|
||||||
value:
|
value: result.hatchingKilledQuantity?.separatedByCommaFa ?? '0',
|
||||||
result.hatchingKilledQuantity?.separatedByCommaFa ?? '0',
|
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/poultry_science/inspection/logic.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/features/poultry_science/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching/hatching_models.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching/hatching_models.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching_report/hatching_report.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/hatching_report/hatching_report.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/poultry_science/presentation/pages/inspection/logic.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class InspectionPoultryScienceLogic extends GetxController {
|
class InspectionPoultryScienceLogic extends GetxController {
|
||||||
@@ -20,10 +15,7 @@ class InspectionPoultryScienceLogic extends GetxController {
|
|||||||
|
|
||||||
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
||||||
|
|
||||||
Rx<LatLng> currentLocation = LatLng(
|
Rx<LatLng> currentLocation = LatLng(34.798315281272544, 48.51479142983491).obs;
|
||||||
34.798315281272544,
|
|
||||||
48.51479142983491,
|
|
||||||
).obs;
|
|
||||||
|
|
||||||
final RxBool isLoadingMoreAllocationsMade = false.obs;
|
final RxBool isLoadingMoreAllocationsMade = false.obs;
|
||||||
RxInt currentPage = 1.obs;
|
RxInt currentPage = 1.obs;
|
||||||
@@ -113,10 +105,7 @@ class InspectionPoultryScienceLogic extends GetxController {
|
|||||||
count: res?.count ?? 0,
|
count: res?.count ?? 0,
|
||||||
next: res?.next,
|
next: res?.next,
|
||||||
previous: res?.previous,
|
previous: res?.previous,
|
||||||
results: [
|
results: [...(hatchingList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
...(hatchingList.value.data?.results ?? []),
|
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -128,8 +117,7 @@ class InspectionPoultryScienceLogic extends GetxController {
|
|||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
hatchingReportList.value =
|
hatchingReportList.value = Resource<PaginationModel<HatchingReport>>.loading();
|
||||||
Resource<PaginationModel<HatchingReport>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -139,36 +127,30 @@ class InspectionPoultryScienceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
safeCall(
|
safeCall(
|
||||||
call: () async =>
|
call: () async => await rootLogic.poultryRepository.getHatchingPoultryReport(
|
||||||
await rootLogic.poultryRepository.getHatchingPoultryReport(
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
queryParameters: buildQueryParams(
|
||||||
queryParameters: buildQueryParams(
|
role: 'PoultryScience',
|
||||||
role: 'PoultryScience',
|
pageSize: 50,
|
||||||
pageSize: 50,
|
search: 'filter',
|
||||||
search: 'filter',
|
value: searchedValue.value,
|
||||||
value: searchedValue.value,
|
fromDate: fromDateFilter.value.toDateTime(),
|
||||||
fromDate: fromDateFilter.value.toDateTime(),
|
toDate: toDateFilter.value.toDateTime(),
|
||||||
toDate: toDateFilter.value.toDateTime(),
|
page: currentPage.value,
|
||||||
page: currentPage.value,
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
hatchingReportList.value =
|
hatchingReportList.value = Resource<PaginationModel<HatchingReport>>.empty();
|
||||||
Resource<PaginationModel<HatchingReport>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
hatchingReportList.value =
|
hatchingReportList.value = Resource<PaginationModel<HatchingReport>>.success(
|
||||||
Resource<PaginationModel<HatchingReport>>.success(
|
PaginationModel<HatchingReport>(
|
||||||
PaginationModel<HatchingReport>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [...(hatchingReportList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
results: [
|
),
|
||||||
...(hatchingReportList.value.data?.results ?? []),
|
);
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -194,10 +176,7 @@ class InspectionPoultryScienceLogic extends GetxController {
|
|||||||
isOnUpload.value = true;
|
isOnUpload.value = true;
|
||||||
|
|
||||||
final tmpFiles = await Future.wait(
|
final tmpFiles = await Future.wait(
|
||||||
pickedImages.map(
|
pickedImages.map((element) => MultipartFile.fromFile(element.path, filename: element.name)),
|
||||||
(element) =>
|
|
||||||
MultipartFile.fromFile(element.path, filename: element.name),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var data = FormData.fromMap({
|
var data = FormData.fromMap({
|
||||||
@@ -208,17 +187,13 @@ class InspectionPoultryScienceLogic extends GetxController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
safeCall(
|
safeCall(
|
||||||
call: () async =>
|
call: () async => await rootLogic.poultryRepository.submitPoultryScienceReport(
|
||||||
await rootLogic.poultryRepository.submitPoultryScienceReport(
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
data: data,
|
||||||
data: data,
|
onSendProgress: (sent, total) {
|
||||||
onSendProgress: (sent, total) {
|
presentUpload.value = calculateUploadProgress(sent: sent, total: total);
|
||||||
presentUpload.value = calculateUploadProgress(
|
},
|
||||||
sent: sent,
|
),
|
||||||
total: total,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
closeBottomSheet();
|
closeBottomSheet();
|
||||||
clearImages();
|
clearImages();
|
||||||
@@ -230,9 +205,7 @@ class InspectionPoultryScienceLogic extends GetxController {
|
|||||||
clearImages();
|
clearImages();
|
||||||
isOnUpload.value = false;
|
isOnUpload.value = false;
|
||||||
|
|
||||||
await Future.delayed(
|
await Future.delayed(const Duration(seconds: 4)).then((value) => closeBottomSheet());
|
||||||
const Duration(seconds: 4),
|
|
||||||
).then((value) => closeBottomSheet());
|
|
||||||
},
|
},
|
||||||
showError: true,
|
showError: true,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,16 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/poultry_science/killing_registration/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/poultry_export/poultry_export.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/request/kill_registration/kill_registration.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/all_poultry/all_poultry.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/approved_price/approved_price.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/kill_house_poultry/kill_house_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/sell_for_freezing/sell_for_freezing.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/genocide/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_export/poultry_export.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/poultry_export/poultry_export.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/request/kill_registration/kill_registration.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/request/kill_registration/kill_registration.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/all_poultry/all_poultry.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/all_poultry/all_poultry.dart';
|
||||||
@@ -21,7 +9,6 @@ import 'package:rasadyar_chicken/features/poultry_science/data/model/response/po
|
|||||||
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/sell_for_freezing/sell_for_freezing.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/model/response/sell_for_freezing/sell_for_freezing.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/genocide/logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/genocide/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/poultry_science/presentation/pages/killing_registration/logic.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class KillingRegistrationLogic extends GetxController {
|
class KillingRegistrationLogic extends GetxController {
|
||||||
@@ -39,9 +26,7 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
|
|
||||||
TextEditingController quantityKillsController = TextEditingController();
|
TextEditingController quantityKillsController = TextEditingController();
|
||||||
RxBool quantityKillsIsCompleted = false.obs;
|
RxBool quantityKillsIsCompleted = false.obs;
|
||||||
TextEditingController quantityLoseController = TextEditingController(
|
TextEditingController quantityLoseController = TextEditingController(text: 0.toString());
|
||||||
text: 0.toString(),
|
|
||||||
);
|
|
||||||
TextEditingController averageWeightKillsController = TextEditingController();
|
TextEditingController averageWeightKillsController = TextEditingController();
|
||||||
RxBool averageWeightKillsIsCompleted = false.obs;
|
RxBool averageWeightKillsIsCompleted = false.obs;
|
||||||
TextEditingController priceFreeSaleController = TextEditingController();
|
TextEditingController priceFreeSaleController = TextEditingController();
|
||||||
@@ -55,23 +40,25 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
RxBool isFreeSale = false.obs;
|
RxBool isFreeSale = false.obs;
|
||||||
|
|
||||||
//step 1
|
//step 1
|
||||||
Rx<Resource<List<AllPoultry>>> allPoultryList =
|
Rx<Resource<List<AllPoultry>>> allPoultryList = Resource<List<AllPoultry>>.loading().obs;
|
||||||
Resource<List<AllPoultry>>.loading().obs;
|
|
||||||
Rxn<AllPoultry> selectedPoultry = Rxn();
|
Rxn<AllPoultry> selectedPoultry = Rxn();
|
||||||
|
|
||||||
//step 2
|
//step 2
|
||||||
Rx<Resource<List<KillRequestPoultry>>> poultryList =
|
Rx<Resource<List<KillRequestPoultry>>> poultryList = Resource<List<KillRequestPoultry>>.success(
|
||||||
Resource<List<KillRequestPoultry>>.success([]).obs;
|
[],
|
||||||
|
).obs;
|
||||||
Rxn<KillRequestPoultry> selectedKillRequestPoultry = Rxn();
|
Rxn<KillRequestPoultry> selectedKillRequestPoultry = Rxn();
|
||||||
|
|
||||||
//step 3
|
//step 3
|
||||||
Rx<Resource<List<PoultryHatching>>> poultryHatchingList =
|
Rx<Resource<List<PoultryHatching>>> poultryHatchingList = Resource<List<PoultryHatching>>.success(
|
||||||
Resource<List<PoultryHatching>>.success([]).obs;
|
[],
|
||||||
|
).obs;
|
||||||
Rxn<PoultryHatching> selectedPoultryHatching = Rxn();
|
Rxn<PoultryHatching> selectedPoultryHatching = Rxn();
|
||||||
|
|
||||||
//step 5
|
//step 5
|
||||||
Rx<Resource<List<KillHousePoultry>>> killHouseList =
|
Rx<Resource<List<KillHousePoultry>>> killHouseList = Resource<List<KillHousePoultry>>.success(
|
||||||
Resource<List<KillHousePoultry>>.success([]).obs;
|
[],
|
||||||
|
).obs;
|
||||||
Rxn<KillHousePoultry> selectedKillHouse = Rxn();
|
Rxn<KillHousePoultry> selectedKillHouse = Rxn();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -95,12 +82,7 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
everAll(
|
everAll(
|
||||||
[
|
[selectedPoultry, selectedKillRequestPoultry, selectedPoultryHatching, selectedKillHouse],
|
||||||
selectedPoultry,
|
|
||||||
selectedKillRequestPoultry,
|
|
||||||
selectedPoultryHatching,
|
|
||||||
selectedKillHouse,
|
|
||||||
],
|
|
||||||
(callback) {
|
(callback) {
|
||||||
checkSubmitButton();
|
checkSubmitButton();
|
||||||
},
|
},
|
||||||
@@ -122,15 +104,12 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
|
|
||||||
void priceListener() {
|
void priceListener() {
|
||||||
quantityKillsController.addListener(() {
|
quantityKillsController.addListener(() {
|
||||||
quantityKillsIsCompleted.value = quantityKillsController.text
|
quantityKillsIsCompleted.value = quantityKillsController.text.trim().isNotEmpty;
|
||||||
.trim()
|
|
||||||
.isNotEmpty;
|
|
||||||
|
|
||||||
if (averageWeightKillsController.text.isNotEmpty &&
|
if (averageWeightKillsController.text.isNotEmpty &&
|
||||||
quantityKillsController.text.trim().isNotEmpty) {
|
quantityKillsController.text.trim().isNotEmpty) {
|
||||||
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
|
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
|
||||||
priceFreeSaleController.text =
|
priceFreeSaleController.text = generatedApprovedPrice.value.separatedByComma;
|
||||||
generatedApprovedPrice.value.separatedByComma;
|
|
||||||
|
|
||||||
checkSubmitButton();
|
checkSubmitButton();
|
||||||
} else {
|
} else {
|
||||||
@@ -141,15 +120,12 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
averageWeightKillsController.addListener(() {
|
averageWeightKillsController.addListener(() {
|
||||||
averageWeightKillsIsCompleted.value = averageWeightKillsController.text
|
averageWeightKillsIsCompleted.value = averageWeightKillsController.text.trim().isNotEmpty;
|
||||||
.trim()
|
|
||||||
.isNotEmpty;
|
|
||||||
|
|
||||||
if (averageWeightKillsController.text.trim().isNotEmpty &&
|
if (averageWeightKillsController.text.trim().isNotEmpty &&
|
||||||
quantityKillsController.text.trim().isNotEmpty) {
|
quantityKillsController.text.trim().isNotEmpty) {
|
||||||
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
|
generatedApprovedPrice.value = calculateApprovedPrice().toInt();
|
||||||
priceFreeSaleController.text =
|
priceFreeSaleController.text = generatedApprovedPrice.value.separatedByComma;
|
||||||
generatedApprovedPrice.value.separatedByComma;
|
|
||||||
checkSubmitButton();
|
checkSubmitButton();
|
||||||
} else {
|
} else {
|
||||||
generatedApprovedPrice.value = 0;
|
generatedApprovedPrice.value = 0;
|
||||||
@@ -201,9 +177,7 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
await safeCall(
|
await safeCall(
|
||||||
call: () async => await rootLogic.poultryRepository.getAllPoultry(
|
call: () async => await rootLogic.poultryRepository.getAllPoultry(
|
||||||
token: tokenService.accessToken.value ?? '',
|
token: tokenService.accessToken.value ?? '',
|
||||||
queryParameters: buildRawQueryParams(
|
queryParameters: buildRawQueryParams(role: gService.getRole(Module.chicken)),
|
||||||
role: gService.getRole(Module.chicken),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
@@ -211,9 +185,7 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError: (error, stackTrace) {
|
onError: (error, stackTrace) {
|
||||||
allPoultryList.value = Resource<List<AllPoultry>>.error(
|
allPoultryList.value = Resource<List<AllPoultry>>.error('$error -- $stackTrace');
|
||||||
'$error -- $stackTrace',
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -258,15 +230,11 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
),
|
),
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
poultryList.value = Resource<List<KillRequestPoultry>>.success(
|
poultryList.value = Resource<List<KillRequestPoultry>>.success(result);
|
||||||
result,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError: (error, stackTrace) {
|
onError: (error, stackTrace) {
|
||||||
poultryList.value = Resource<List<KillRequestPoultry>>.error(
|
poultryList.value = Resource<List<KillRequestPoultry>>.error('$error -- $stackTrace');
|
||||||
'$error -- $stackTrace',
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -282,15 +250,11 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
),
|
),
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
poultryHatchingList.value = Resource<List<PoultryHatching>>.success(
|
poultryHatchingList.value = Resource<List<PoultryHatching>>.success(result);
|
||||||
result,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError: (error, stackTrace) {
|
onError: (error, stackTrace) {
|
||||||
poultryHatchingList.value = Resource<List<PoultryHatching>>.error(
|
poultryHatchingList.value = Resource<List<PoultryHatching>>.error('$error -- $stackTrace');
|
||||||
'$error -- $stackTrace',
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -301,23 +265,16 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
call: () async => await rootLogic.poultryRepository.getKillHouseList(
|
call: () async => await rootLogic.poultryRepository.getKillHouseList(
|
||||||
token: tokenService.accessToken.value ?? '',
|
token: tokenService.accessToken.value ?? '',
|
||||||
queryParameters: buildRawQueryParams(
|
queryParameters: buildRawQueryParams(
|
||||||
queryParams: {
|
queryParams: {'show_poultry': '', 'date': DateTime.now().formattedDashedGregorian},
|
||||||
'show_poultry': '',
|
|
||||||
'date': DateTime.now().formattedDashedGregorian,
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
killHouseList.value = Resource<List<KillHousePoultry>>.success(
|
killHouseList.value = Resource<List<KillHousePoultry>>.success(result);
|
||||||
result,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError: (error, stackTrace) {
|
onError: (error, stackTrace) {
|
||||||
killHouseList.value = Resource<List<KillHousePoultry>>.error(
|
killHouseList.value = Resource<List<KillHousePoultry>>.error('$error -- $stackTrace');
|
||||||
'$error -- $stackTrace',
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -354,11 +311,7 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
selectedPoultryHatching.value != null &&
|
selectedPoultryHatching.value != null &&
|
||||||
quantityKillsController.text.isNotEmpty &&
|
quantityKillsController.text.isNotEmpty &&
|
||||||
averageWeightKillsController.text.isNotEmpty &&
|
averageWeightKillsController.text.isNotEmpty &&
|
||||||
((selectedKillRequestPoultry
|
((selectedKillRequestPoultry.value?.provinceAllowChooseKillHouse?.mandatory ?? false)
|
||||||
.value
|
|
||||||
?.provinceAllowChooseKillHouse
|
|
||||||
?.mandatory ??
|
|
||||||
false)
|
|
||||||
? selectedKillHouse.value != null
|
? selectedKillHouse.value != null
|
||||||
: true);
|
: true);
|
||||||
}
|
}
|
||||||
@@ -399,11 +352,10 @@ class KillingRegistrationLogic extends GetxController {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await safeCall(
|
await safeCall(
|
||||||
call: () async =>
|
call: () async => await rootLogic.poultryRepository.submitKillRegistration(
|
||||||
await rootLogic.poultryRepository.submitKillRegistration(
|
token: tokenService.accessToken.value ?? '',
|
||||||
token: tokenService.accessToken.value ?? '',
|
request: registrationRequest,
|
||||||
request: registrationRequest,
|
),
|
||||||
),
|
|
||||||
onSuccess: (result) async {
|
onSuccess: (result) async {
|
||||||
defaultShowSuccessMessage(
|
defaultShowSuccessMessage(
|
||||||
'ثبت با موفقیت انجام شد',
|
'ثبت با موفقیت انجام شد',
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/poultry_science/root/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/repositories/poultry_science/poultry_science_repository.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/profile/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/home/view.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/repositories/poultry_science_repository.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/data/repositories/poultry_science_repository.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/home/view.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/home/view.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/presentation/page/profile/view.dart';
|
import 'package:rasadyar_chicken/features/common/presentation/page/profile/view.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/poultry_science/presentation/pages/root/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
|
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/routes/routes.dart';
|
import 'package:rasadyar_chicken/features/poultry_science/presentation/routes/routes.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
||||||
@@ -92,8 +87,7 @@ class PoultryScienceRootLogic extends GetxController {
|
|||||||
Get.back(id: nestedKeyId);
|
Get.back(id: nestedKeyId);
|
||||||
} else {
|
} else {
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
if (_lastBackPressed == null ||
|
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
||||||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
|
||||||
_lastBackPressed = now;
|
_lastBackPressed = now;
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'خروج از برنامه',
|
'خروج از برنامه',
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/data/repositories/poultry_science_repository.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/home/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/presentation/page/profile/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/routes/routes.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|
||||||
|
|
||||||
class PoultryScienceRootLogic extends GetxController {
|
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
|
||||||
|
|
||||||
late PoultryScienceRepository poultryRepository;
|
|
||||||
|
|
||||||
RxList<ErrorLocationType> errorLocationType = RxList();
|
|
||||||
RxMap<int, dynamic> homeExpandedList = RxMap();
|
|
||||||
DateTime? _lastBackPressed;
|
|
||||||
|
|
||||||
RxInt currentPage = 1.obs;
|
|
||||||
|
|
||||||
final pages = [
|
|
||||||
Navigator(
|
|
||||||
key: Get.nestedKey(poultryScienceActionKey),
|
|
||||||
onGenerateRoute: (settings) {
|
|
||||||
final page = ChickenPages.pages.firstWhere(
|
|
||||||
(e) => e.name == settings.name,
|
|
||||||
orElse: () => ChickenPages.pages.firstWhere(
|
|
||||||
(e) => e.name == PoultryScienceRoutes.actionPoultryScience,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return buildRouteFromGetPage(page);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
PoultryScienceHomePage(),
|
|
||||||
ProfilePage(),
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
poultryRepository = diChicken.get<PoultryScienceRepository>();
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
|
||||||
if (homeExpandedList.keys.contains(index)) {
|
|
||||||
homeExpandedList.remove(index);
|
|
||||||
} else {
|
|
||||||
homeExpandedList[index] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void rootErrorHandler(DioException error) {
|
|
||||||
handleGeneric(error, () {
|
|
||||||
tokenService.deleteModuleTokens(Module.chicken);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void changePage(int index) {
|
|
||||||
currentPage.value = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getNestedKey() {
|
|
||||||
switch (currentPage.value) {
|
|
||||||
case 0:
|
|
||||||
return poultryFirstKey;
|
|
||||||
case 1:
|
|
||||||
return poultrySecondKey;
|
|
||||||
case 2:
|
|
||||||
return poultryThirdKey;
|
|
||||||
default:
|
|
||||||
return poultryFirstKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void popBackTaped() async {
|
|
||||||
final nestedKeyId = getNestedKey();
|
|
||||||
GlobalKey<NavigatorState>? currentNestedKey = Get.nestedKey(nestedKeyId);
|
|
||||||
|
|
||||||
if (currentNestedKey?.currentState?.canPop() == true) {
|
|
||||||
Get.back(id: nestedKeyId);
|
|
||||||
} else {
|
|
||||||
final now = DateTime.now();
|
|
||||||
if (_lastBackPressed == null ||
|
|
||||||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
|
||||||
_lastBackPressed = now;
|
|
||||||
Get.snackbar(
|
|
||||||
'خروج از برنامه',
|
|
||||||
'برای خروج دوباره بازگشت را بزنید',
|
|
||||||
snackPosition: SnackPosition.TOP,
|
|
||||||
duration: Duration(seconds: 2),
|
|
||||||
backgroundColor: AppColor.warning,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
await SystemNavigator.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
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';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class PoultryScienceRootPage extends GetView<PoultryScienceRootLogic> {
|
|
||||||
const PoultryScienceRootPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
isFullScreen: true,
|
|
||||||
onPopScopTaped: controller.popBackTaped,
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return Stack(
|
|
||||||
children: [
|
|
||||||
IndexedStack(children: controller.pages, index: data.value),
|
|
||||||
Positioned(
|
|
||||||
right: 0,
|
|
||||||
left: 0,
|
|
||||||
bottom: 0,
|
|
||||||
child: RBottomNavigation(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
items: [
|
|
||||||
RBottomNavigationItem(
|
|
||||||
label: 'عملیات',
|
|
||||||
icon: Assets.vec.settingSvg.path,
|
|
||||||
isSelected: controller.currentPage.value == 0,
|
|
||||||
onTap: () {
|
|
||||||
Get.nestedKey(
|
|
||||||
poultryScienceActionKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
|
|
||||||
controller.changePage(0);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
RBottomNavigationItem(
|
|
||||||
label: 'خانه',
|
|
||||||
icon: Assets.vec.homeSvg.path,
|
|
||||||
isSelected: controller.currentPage.value == 1,
|
|
||||||
onTap: () {
|
|
||||||
Get.nestedKey(
|
|
||||||
poultryScienceActionKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
|
|
||||||
controller.changePage(1);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
RBottomNavigationItem(
|
|
||||||
label: 'پروفایل',
|
|
||||||
icon: Assets.vec.profileCircleSvg.path,
|
|
||||||
isSelected: controller.currentPage.value == 2,
|
|
||||||
onTap: () {
|
|
||||||
Get.nestedKey(
|
|
||||||
poultryScienceActionKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
|
|
||||||
controller.changePage(2);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.currentPage),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class BuyLogic extends GetxController {
|
|
||||||
List<String> routesName = ['خرید'];
|
|
||||||
DateTime? _lastBackPressed;
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
fLog('BuyLogic onReady');
|
|
||||||
super.onReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void onPopScopTaped() async {
|
|
||||||
final now = DateTime.now();
|
|
||||||
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
|
||||||
_lastBackPressed = now;
|
|
||||||
Get.snackbar(
|
|
||||||
'خروج از برنامه',
|
|
||||||
'برای خروج دوباره بازگشت را بزنید',
|
|
||||||
snackPosition: SnackPosition.TOP,
|
|
||||||
duration: Duration(seconds: 2),
|
|
||||||
backgroundColor: AppColor.warning,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
await SystemNavigator.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.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';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class BuyPage extends GetView<BuyLogic> {
|
|
||||||
const BuyPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
routes: controller.routesName,
|
|
||||||
isBase: true,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 21.w,
|
|
||||||
children: [
|
|
||||||
GlassMorphismCardIcon(
|
|
||||||
title: 'خرید داخل استان',
|
|
||||||
vecIcon: Assets.vec.map1Svg.path,
|
|
||||||
gradient: LinearGradient(
|
|
||||||
colors: [Color(0xFF00E096), Color(0xFF007D5E)],
|
|
||||||
stops: [0.0, 0.95],
|
|
||||||
begin: AlignmentGeometry.topLeft,
|
|
||||||
end: AlignmentGeometry.bottomRight,
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Get.toNamed(
|
|
||||||
StewardRoutes.buysInProvinceSteward,
|
|
||||||
id: stewardFirstKey,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
GlassMorphismCardIcon(
|
|
||||||
title: 'خرید خارج استان',
|
|
||||||
vecIcon: Assets.vec.buyOutProvinceSvg.path,
|
|
||||||
gradient: LinearGradient(
|
|
||||||
colors: [Color(0xFF00E096), Color(0xFF007D5E)],
|
|
||||||
stops: [0.0, 0.95],
|
|
||||||
begin: AlignmentGeometry.topLeft,
|
|
||||||
end: AlignmentGeometry.bottomRight,
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Get.toNamed(
|
|
||||||
StewardRoutes.buysOutOfProvinceSteward,
|
|
||||||
id: stewardFirstKey,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_all/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_waiting/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class BuyInProvinceLogic extends GetxController {
|
|
||||||
RxList<String> routesName = RxList();
|
|
||||||
RxList<int> isExpandedList = <int>[].obs;
|
|
||||||
RxnString searchedValue = RxnString();
|
|
||||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
|
||||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
|
||||||
|
|
||||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
|
||||||
|
|
||||||
BuyLogic get buyLogic => Get.find<BuyLogic>();
|
|
||||||
RxInt selectedSegmentIndex = 0.obs;
|
|
||||||
|
|
||||||
BuyInProvinceAllLogic buyAllLogic = Get.find<BuyInProvinceAllLogic>();
|
|
||||||
BuyInProvinceWaitingLogic buyWaitingLogic = Get.find<BuyInProvinceWaitingLogic>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
routesName.value = [...buyLogic.routesName, 'داخل استان'].toList();
|
|
||||||
routesName.add(selectedSegmentIndex.value == 0 ? 'در انتظار' : 'کل خریدها');
|
|
||||||
ever(selectedSegmentIndex, (callback) {
|
|
||||||
routesName.removeLast();
|
|
||||||
routesName.add(callback == 0 ? 'در انتظار' : 'کل خریدها');
|
|
||||||
});
|
|
||||||
|
|
||||||
ever(fromDateFilter, (callback) => _setFromDateFilter(callback));
|
|
||||||
ever(toDateFilter, (callback) => _setToDateFilter(callback));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
fLog('BuyInProvinceLogic onReady');
|
|
||||||
super.onReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _setFromDateFilter(Jalali jalali) {
|
|
||||||
final isWaiting = selectedSegmentIndex.value == 0;
|
|
||||||
if (isWaiting) {
|
|
||||||
buyWaitingLogic.fromDateFilter.value = fromDateFilter.value;
|
|
||||||
} else {
|
|
||||||
buyAllLogic.fromDateFilter.value = fromDateFilter.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _setToDateFilter(Jalali jalali) {
|
|
||||||
final isWaiting = selectedSegmentIndex.value == 0;
|
|
||||||
if (isWaiting) {
|
|
||||||
buyWaitingLogic.toDateFilter.value = fromDateFilter.value;
|
|
||||||
} else {
|
|
||||||
buyAllLogic.toDateFilter.value = fromDateFilter.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> submitFilter() async {
|
|
||||||
final isWaiting = selectedSegmentIndex.value == 0;
|
|
||||||
if (isWaiting) {
|
|
||||||
buyWaitingLogic.getWaitingArrivals();
|
|
||||||
} else {
|
|
||||||
buyAllLogic.getAllArrivals();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSearchValue(String? data) {
|
|
||||||
searchedValue.value = data?.trim();
|
|
||||||
final isWaiting = selectedSegmentIndex.value == 0;
|
|
||||||
if (isWaiting) {
|
|
||||||
buyWaitingLogic.searchedValue.value = searchedValue.value;
|
|
||||||
} else {
|
|
||||||
buyAllLogic.searchedValue.value = searchedValue.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> onRefresh() async {
|
|
||||||
await rootLogic.onRefresh();
|
|
||||||
await Future.wait([buyWaitingLogic.getWaitingArrivals(), buyAllLogic.getAllArrivals()]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_all/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_waiting/view.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/inventory/inventory_widget.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
|
|
||||||
const BuyInProvincePage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
routesWidget: ContainerBreadcrumb(rxRoutes: controller.routesName),
|
|
||||||
onSearchChanged: (data) => controller.setSearchValue(data),
|
|
||||||
hasBack: true,
|
|
||||||
backId: stewardFirstKey,
|
|
||||||
|
|
||||||
onFilterTap: () {
|
|
||||||
Get.bottomSheet(filterBottomSheet());
|
|
||||||
},
|
|
||||||
onRefresh: controller.onRefresh,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Obx(() {
|
|
||||||
var list = [
|
|
||||||
InventoryItemData(
|
|
||||||
title: 'موجودی انبار',
|
|
||||||
value: controller
|
|
||||||
.rootLogic
|
|
||||||
.inventoryModel
|
|
||||||
.value
|
|
||||||
?.totalRemainWeight
|
|
||||||
?.separatedByCommaFa,
|
|
||||||
color: const Color(0xFFEAFBFC),
|
|
||||||
),
|
|
||||||
InventoryItemData(
|
|
||||||
title: 'مانده دولتی',
|
|
||||||
value: controller
|
|
||||||
.rootLogic
|
|
||||||
.inventoryModel
|
|
||||||
.value
|
|
||||||
?.totalGovernmentalRemainWeight
|
|
||||||
?.separatedByCommaFa,
|
|
||||||
|
|
||||||
color: const Color(0xFFF5ECEE),
|
|
||||||
),
|
|
||||||
InventoryItemData(
|
|
||||||
title: 'مانده آزاد',
|
|
||||||
value: controller
|
|
||||||
.rootLogic
|
|
||||||
.inventoryModel
|
|
||||||
.value
|
|
||||||
?.totalFreeRemainWeight
|
|
||||||
?.separatedByCommaFa,
|
|
||||||
|
|
||||||
color: const Color(0xFFF1E7FF),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
|
|
||||||
return InventoryWidget(inventoryModel: list);
|
|
||||||
}),
|
|
||||||
|
|
||||||
segmentWidget(),
|
|
||||||
ObxValue((index) {
|
|
||||||
return Expanded(
|
|
||||||
child: index.value == 0
|
|
||||||
? BuyInProvinceWaitingPage()
|
|
||||||
: BuyInProvinceAllPage(),
|
|
||||||
);
|
|
||||||
}, controller.selectedSegmentIndex),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Padding segmentWidget() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: RSegment(
|
|
||||||
children: ['در انتظار', 'کل خریدها'],
|
|
||||||
selectedIndex: 0,
|
|
||||||
borderColor: const Color(0xFFB4B4B4),
|
|
||||||
selectedBorderColor: AppColor.blueNormal,
|
|
||||||
selectedBackgroundColor: AppColor.blueLight,
|
|
||||||
onSegmentSelected: (index) =>
|
|
||||||
controller.selectedSegmentIndex.value = index,
|
|
||||||
backgroundColor: AppColor.whiteGreyNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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: () {
|
|
||||||
controller.submitFilter();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
height: 40,
|
|
||||||
),
|
|
||||||
SizedBox(height: 16),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,189 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_allocation/steward_allocation_request.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class BuyInProvinceAllLogic extends GetxController {
|
|
||||||
RxInt isExpandedListIndex = (-1).obs;
|
|
||||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
|
||||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
|
||||||
RxnString searchedValue = RxnString();
|
|
||||||
RxMap<String, bool> isLoadingConfirmMap = RxMap();
|
|
||||||
final RxBool isLoadingMoreAllocationsMade = false.obs;
|
|
||||||
RxInt currentPage = 1.obs;
|
|
||||||
|
|
||||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
|
||||||
|
|
||||||
Rx<Resource<PaginationModel<WaitingArrivalModel>>> allProduct =
|
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.loading().obs;
|
|
||||||
|
|
||||||
TextEditingController weightController = TextEditingController();
|
|
||||||
TextEditingController countController = TextEditingController();
|
|
||||||
TextEditingController lossController = TextEditingController();
|
|
||||||
TextEditingController approvedWithOtpController = TextEditingController();
|
|
||||||
|
|
||||||
RxBool approvedWithOtpCode = false.obs;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
getAllArrivals();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
debounce(
|
|
||||||
searchedValue,
|
|
||||||
(callback) => getAllArrivals(),
|
|
||||||
time: Duration(milliseconds: 2000),
|
|
||||||
);
|
|
||||||
super.onReady();
|
|
||||||
ever(approvedWithOtpCode, (callback) {
|
|
||||||
if (callback == false) {
|
|
||||||
approvedWithOtpController.clear();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getAllArrivals([bool isLoadingMore = false]) async {
|
|
||||||
if (isLoadingMore) {
|
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
|
||||||
} else {
|
|
||||||
allProduct.value =
|
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.loading();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
|
||||||
searchedValue.value!.trim().isNotEmpty &&
|
|
||||||
currentPage.value > 1) {
|
|
||||||
currentPage.value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
safeCall(
|
|
||||||
call: () async => await rootLogic.stewardRepository.getWaitingArrivals(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(
|
|
||||||
queryParams: {'type': 'all'},
|
|
||||||
pageSize: 20,
|
|
||||||
page: currentPage.value,
|
|
||||||
search: 'filter',
|
|
||||||
role: 'Steward',
|
|
||||||
value: searchedValue.value,
|
|
||||||
fromDate: fromDateFilter.value.toDateTime(),
|
|
||||||
toDate: toDateFilter.value.toDateTime(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (res) async {
|
|
||||||
await Future.delayed(Duration(milliseconds: 200));
|
|
||||||
if ((res?.count ?? 0) == 0) {
|
|
||||||
allProduct.value =
|
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.empty();
|
|
||||||
} else {
|
|
||||||
allProduct.value =
|
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.success(
|
|
||||||
PaginationModel<WaitingArrivalModel>(
|
|
||||||
count: res?.count ?? 0,
|
|
||||||
next: res?.next,
|
|
||||||
previous: res?.previous,
|
|
||||||
results: [
|
|
||||||
...(allProduct.value.data?.results ?? []),
|
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> acceptEntries(WaitingArrivalModel model) async {
|
|
||||||
var request = StewardAllocationRequest(
|
|
||||||
allocationKey: model.key,
|
|
||||||
checkAllocation: true,
|
|
||||||
state: 'accepted',
|
|
||||||
receiverRealNumberOfCarcasses: model.realNumberOfCarcasses ?? 0,
|
|
||||||
receiverRealWeightOfCarcasses: model.realWeightOfCarcasses?.toInt() ?? 0,
|
|
||||||
registrationCode: approvedWithOtpCode.value
|
|
||||||
? int.parse(approvedWithOtpController.text)
|
|
||||||
: null,
|
|
||||||
weightLossOfCarcasses: model.weightLossOfCarcasses?.toInt() ?? 0,
|
|
||||||
).toJson();
|
|
||||||
request.removeWhere((key, value) => value == null);
|
|
||||||
|
|
||||||
safeCall(
|
|
||||||
showError: true,
|
|
||||||
call: () async => await rootLogic.stewardRepository.setSateForArrivals(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
request: request,
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
getAllArrivals();
|
|
||||||
rootLogic.onRefresh();
|
|
||||||
clearApprovedController();
|
|
||||||
toggleExpansion();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> denyEntries(WaitingArrivalModel model) async {
|
|
||||||
var request = StewardAllocationRequest(
|
|
||||||
allocationKey: model.key,
|
|
||||||
checkAllocation: true,
|
|
||||||
state: 'rejected',
|
|
||||||
).toJson();
|
|
||||||
request.removeWhere((key, value) => value == null);
|
|
||||||
|
|
||||||
safeCall(
|
|
||||||
call: () async => await rootLogic.stewardRepository.setSateForArrivals(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
request: request,
|
|
||||||
),
|
|
||||||
onError: (error, stackTrace) {
|
|
||||||
eLog(error);
|
|
||||||
},
|
|
||||||
onSuccess: (result) {
|
|
||||||
getAllArrivals();
|
|
||||||
rootLogic.onRefresh();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String getVecPathItem(String? item) {
|
|
||||||
switch (item) {
|
|
||||||
case 'pending':
|
|
||||||
return Assets.vec.timerSvg.path;
|
|
||||||
case 'accepted':
|
|
||||||
return Assets.vec.checkSquareSvg.path;
|
|
||||||
case 'rejected':
|
|
||||||
return Assets.vec.closeCircleSvg.path;
|
|
||||||
default:
|
|
||||||
return Assets.vec.timerSvg.path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearApprovedController() {
|
|
||||||
weightController.clear();
|
|
||||||
countController.clear();
|
|
||||||
lossController.clear();
|
|
||||||
approvedWithOtpController.clear();
|
|
||||||
approvedWithOtpCode.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleExpansion({int? index}) {
|
|
||||||
if (isExpandedListIndex.value == index || index == null) {
|
|
||||||
isExpandedListIndex.value = -1;
|
|
||||||
} else {
|
|
||||||
isExpandedListIndex.value = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Color getLabelColor(String? receiverState) {
|
|
||||||
if (receiverState == 'pending') {
|
|
||||||
return AppColor.yellowNormal2;
|
|
||||||
}
|
|
||||||
return AppColor.mediumGreyDarkHover;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,425 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
|
|
||||||
const BuyInProvinceAllPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return RPaginatedListView(
|
|
||||||
listType: ListType.separated,
|
|
||||||
resource: data.value,
|
|
||||||
hasMore: data.value.data?.next != null,
|
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
var item = data.value.data!.results![index];
|
|
||||||
return ObxValue((val) {
|
|
||||||
return ExpandableListItem2(
|
|
||||||
selected: val.value == index,
|
|
||||||
onTap: () => controller.toggleExpansion(index: index),
|
|
||||||
index: index,
|
|
||||||
child: itemListWidget(item),
|
|
||||||
secondChild: itemListExpandedWidget(item),
|
|
||||||
labelColor: getLabelColor(item.receiverState),
|
|
||||||
labelIcon: controller.getVecPathItem(item.receiverState),
|
|
||||||
labelIconColor: controller.getLabelColor(item.receiverState),
|
|
||||||
);
|
|
||||||
}, controller.isExpandedListIndex);
|
|
||||||
},
|
|
||||||
itemCount: data.value.data?.results?.length ?? 0,
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
|
||||||
onLoadMore: () async => controller.getAllArrivals(true),
|
|
||||||
);
|
|
||||||
}, controller.allProduct),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Row itemListWidget(WaitingArrivalModel item) {
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 3,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.toSteward?.user?.fullname ?? 'N/A',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.date?.formattedJalaliDate ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
spacing: 3,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
spacing: 6,
|
|
||||||
children: [
|
|
||||||
Visibility(
|
|
||||||
visible: item.product?.name?.contains('مرغ گرم') ?? false,
|
|
||||||
child: Assets.vec.hotChickenSvg.svg(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.blueNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.weightOfCarcasses?.separatedByCommaFa.addKg ?? 'N/A',
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
textDirection: TextDirection.ltr,
|
|
||||||
style: AppFonts.yekan12Bold.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
item.toSteward?.guildsName ?? 'N/Aaq',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Assets.vec.scanSvg.svg(
|
|
||||||
width: 32.w,
|
|
||||||
height: 32.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container itemListExpandedWidget(WaitingArrivalModel item) {
|
|
||||||
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.toSteward?.user?.fullname ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
Text(
|
|
||||||
item.receiverState?.faItem ?? 'N/A',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.darkGreyDark),
|
|
||||||
),
|
|
||||||
SizedBox(width: 7),
|
|
||||||
SvgGenImage.vec(
|
|
||||||
controller.getVecPathItem(item.receiverState),
|
|
||||||
).svg(
|
|
||||||
width: 16.w,
|
|
||||||
height: 16.h,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.darkGreyDark,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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(
|
|
||||||
item.date?.toJalali.formatter.wN ?? 'N/A',
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'N/A'}',
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'${item.date?.toJalali.formatter.y}',
|
|
||||||
style: AppFonts.yekan20.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'${item.date?.toJalali.formatter.tHH}:${item.date?.toJalali.formatter.tMM ?? 'N/A'}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(
|
|
||||||
title: 'مشخصات فروشنده',
|
|
||||||
value: item.toSteward?.user?.fullname ?? 'N/A',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'تلفن فروشنده',
|
|
||||||
value: item.toSteward?.user?.mobile ?? 'N/A',
|
|
||||||
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'نوع تخصیص',
|
|
||||||
value: item.allocationType?.faAllocationType ?? 'N/A',
|
|
||||||
),
|
|
||||||
buildRow(title: ' سهمیه', value: item.quota?.faTitle ?? 'N/A'),
|
|
||||||
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
|
|
||||||
buildRow(
|
|
||||||
title: 'وزن خریداری شده',
|
|
||||||
value: item.weightOfCarcasses?.separatedByCommaFa ?? 'N/A',
|
|
||||||
valueLabel: 'کیلوگرم',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'قیمت هر کیلوگرم',
|
|
||||||
titleLabel: (item.approvedPriceStatus ?? false) ? 'مصوب' : 'آزاد',
|
|
||||||
titleLabelStyle: AppFonts.yekan14Bold.copyWith(
|
|
||||||
color: AppColor.greenNormal,
|
|
||||||
),
|
|
||||||
value: item.amount?.separatedByCommaFa ?? 'N/A',
|
|
||||||
valueLabel: 'ریال',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'قیمت کل',
|
|
||||||
value: item.totalAmount?.separatedByCommaFa ?? 'N/A',
|
|
||||||
valueLabel: 'ریال',
|
|
||||||
),
|
|
||||||
|
|
||||||
Visibility(
|
|
||||||
visible: item.receiverState == 'pending',
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 16.w,
|
|
||||||
children: [
|
|
||||||
ObxValue((data) {
|
|
||||||
return RElevated(
|
|
||||||
text: 'تایید',
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
isLoading: data[item.key!] ?? false,
|
|
||||||
onPressed: () async {
|
|
||||||
await Get.bottomSheet(
|
|
||||||
conformationBottomSheet(item),
|
|
||||||
isScrollControlled: true,
|
|
||||||
).then((value) {
|
|
||||||
Get.back();
|
|
||||||
controller.clearApprovedController();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
);
|
|
||||||
}, controller.isLoadingConfirmMap),
|
|
||||||
ROutlinedElevated(
|
|
||||||
text: 'رد',
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(
|
|
||||||
color: AppColor.redNormal,
|
|
||||||
),
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
onPressed: () {
|
|
||||||
buildWarningDialog(
|
|
||||||
title: 'اخطار',
|
|
||||||
middleText: 'آیا از رد شدن این مورد اطمینان دارید؟',
|
|
||||||
onConfirm: () => controller.denyEntries(item),
|
|
||||||
onRefresh: () => controller.getAllArrivals(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
borderColor: AppColor.redNormal,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Color getLabelColor(String? item) {
|
|
||||||
switch (item) {
|
|
||||||
case 'pending':
|
|
||||||
return AppColor.blueLight;
|
|
||||||
case 'accepted':
|
|
||||||
return AppColor.greenLightHover;
|
|
||||||
case 'rejected':
|
|
||||||
return AppColor.redLightHover;
|
|
||||||
default:
|
|
||||||
return AppColor.blueLight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget conformationBottomSheet(WaitingArrivalModel item) {
|
|
||||||
controller.weightController.text = item.weightOfCarcasses.separatedByComma;
|
|
||||||
return BaseBottomSheet(
|
|
||||||
height: 430.h,
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
RTextField(
|
|
||||||
label: 'وزن(کیلوگرم)',
|
|
||||||
controller: controller.weightController,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 16.h),
|
|
||||||
RTextField(
|
|
||||||
label: 'حجم(قطعه)',
|
|
||||||
controller: controller.countController,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 16.h),
|
|
||||||
RTextField(
|
|
||||||
label: 'افت وزن(کیلوگرم)',
|
|
||||||
controller: controller.lossController,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 16.h),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'تایید ',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
ObxValue((data) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
RadioGroup(
|
|
||||||
groupValue: data.value,
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.approvedWithOtpCode.value = value ?? false;
|
|
||||||
},
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
|
||||||
radioRow(
|
|
||||||
value: true,
|
|
||||||
label: ' با کد احراز',
|
|
||||||
onTap: () {
|
|
||||||
controller.approvedWithOtpCode.value = true;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
radioRow(
|
|
||||||
value: false,
|
|
||||||
label: 'بدون کد احراز',
|
|
||||||
onTap: () {
|
|
||||||
controller.approvedWithOtpCode.value = false;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
child: RTextField(
|
|
||||||
controller: controller.approvedWithOtpController,
|
|
||||||
label: 'کد احراز',
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
),
|
|
||||||
visible: data.value,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.approvedWithOtpCode),
|
|
||||||
SizedBox(height: 30.h),
|
|
||||||
ObxValue((data) {
|
|
||||||
return RElevated(
|
|
||||||
enabled: controller.approvedWithOtpCode.value
|
|
||||||
? controller.approvedWithOtpController.text.isNotEmpty
|
|
||||||
: true,
|
|
||||||
text: 'تایید',
|
|
||||||
onPressed: () async {
|
|
||||||
await controller.acceptEntries(item);
|
|
||||||
},
|
|
||||||
isFullWidth: true,
|
|
||||||
);
|
|
||||||
}, controller.approvedWithOtpCode),
|
|
||||||
SizedBox(height: 20.h),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget radioRow({
|
|
||||||
required bool value,
|
|
||||||
required String label,
|
|
||||||
TextStyle? textStyle,
|
|
||||||
GestureTapCallback? onTap,
|
|
||||||
}) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: onTap,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Radio(value: value),
|
|
||||||
Text(
|
|
||||||
label,
|
|
||||||
style:
|
|
||||||
textStyle ??
|
|
||||||
AppFonts.yekan16.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,194 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_allocation/steward_allocation_request.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class BuyInProvinceWaitingLogic extends GetxController {
|
|
||||||
RxInt isExpandedListIndex = (-1).obs;
|
|
||||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
|
||||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
|
||||||
RxnString searchedValue = RxnString();
|
|
||||||
RxMap<String, bool> isLoadingConfirmMap = RxMap();
|
|
||||||
Rx<Color> bgConfirmAllColor = AppColor.blueNormal.obs;
|
|
||||||
RxInt currentPage = 1.obs;
|
|
||||||
final RxBool isLoadingMoreAllocationsMade = false.obs;
|
|
||||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
|
||||||
RxBool isButtonConfirm = false.obs;
|
|
||||||
|
|
||||||
Rx<Resource<PaginationModel<WaitingArrivalModel>>> waitingProduct =
|
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.loading().obs;
|
|
||||||
|
|
||||||
TextEditingController weightController = TextEditingController();
|
|
||||||
TextEditingController countController = TextEditingController();
|
|
||||||
TextEditingController lossController = TextEditingController();
|
|
||||||
TextEditingController approvedWithOtpController = TextEditingController();
|
|
||||||
|
|
||||||
RxBool approvedWithOtpCode = false.obs;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
debounce(
|
|
||||||
searchedValue,
|
|
||||||
(callback) => getWaitingArrivals(),
|
|
||||||
time: Duration(milliseconds: timeDebounce),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
getWaitingArrivals();
|
|
||||||
approvedWithOtpController.addListener(() {
|
|
||||||
isButtonConfirm.value = approvedWithOtpController.text.trim().length > 4;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSearchValue(String? data) {
|
|
||||||
searchedValue.value = data?.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getWaitingArrivals([bool isLoadingMore = false]) async {
|
|
||||||
if (isLoadingMore) {
|
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
|
||||||
} else {
|
|
||||||
waitingProduct.value =
|
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.loading();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
|
||||||
searchedValue.value!.trim().isNotEmpty &&
|
|
||||||
currentPage.value > 1) {
|
|
||||||
currentPage.value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
safeCall(
|
|
||||||
call: () async => await rootLogic.stewardRepository.getWaitingArrivals(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(
|
|
||||||
queryParams: {'type': 'not_entered'},
|
|
||||||
pageSize: 20,
|
|
||||||
page: currentPage.value,
|
|
||||||
search: 'filter',
|
|
||||||
role: 'Steward',
|
|
||||||
value: searchedValue.value,
|
|
||||||
fromDate: fromDateFilter.value.toDateTime(),
|
|
||||||
toDate: toDateFilter.value.toDateTime(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (res) async {
|
|
||||||
await Future.delayed(Duration(milliseconds: 200));
|
|
||||||
if ((res?.count ?? 0) == 0) {
|
|
||||||
waitingProduct.value =
|
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.empty();
|
|
||||||
} else {
|
|
||||||
waitingProduct.value =
|
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.success(
|
|
||||||
PaginationModel<WaitingArrivalModel>(
|
|
||||||
count: res?.count ?? 0,
|
|
||||||
next: res?.next,
|
|
||||||
previous: res?.previous,
|
|
||||||
results: [
|
|
||||||
...(waitingProduct.value.data?.results ?? []),
|
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
flashingFabBgColor();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> acceptEntries(WaitingArrivalModel model) async {
|
|
||||||
var request = StewardAllocationRequest(
|
|
||||||
allocationKey: model.key,
|
|
||||||
checkAllocation: true,
|
|
||||||
state: 'accepted',
|
|
||||||
receiverRealNumberOfCarcasses: model.realNumberOfCarcasses ?? 0,
|
|
||||||
receiverRealWeightOfCarcasses: model.realWeightOfCarcasses?.toInt() ?? 0,
|
|
||||||
registrationCode: approvedWithOtpCode.value
|
|
||||||
? int.parse(approvedWithOtpController.text.trim())
|
|
||||||
: null,
|
|
||||||
weightLossOfCarcasses: model.weightLossOfCarcasses?.toInt() ?? 0,
|
|
||||||
stewardCheckAllocation: true,
|
|
||||||
).toJson();
|
|
||||||
request.removeWhere((key, value) => value == null);
|
|
||||||
|
|
||||||
safeCall(
|
|
||||||
showError: true,
|
|
||||||
showSuccess: true,
|
|
||||||
call: () async => await rootLogic.stewardRepository.setSateForArrivals(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
request: request,
|
|
||||||
),
|
|
||||||
onError: (error, stackTrace) {
|
|
||||||
eLog(error);
|
|
||||||
},
|
|
||||||
onSuccess: (result) {
|
|
||||||
getWaitingArrivals();
|
|
||||||
rootLogic.onRefresh();
|
|
||||||
clearApprovedController();
|
|
||||||
toggleExpansion();
|
|
||||||
Future.delayed(Duration(seconds: 3), () {
|
|
||||||
Get.back();
|
|
||||||
Get.back();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> denyEntries(WaitingArrivalModel model) async {
|
|
||||||
var request = StewardAllocationRequest(
|
|
||||||
allocationKey: model.key,
|
|
||||||
checkAllocation: true,
|
|
||||||
state: 'rejected',
|
|
||||||
).toJson();
|
|
||||||
request.removeWhere((key, value) => value == null);
|
|
||||||
|
|
||||||
safeCall(
|
|
||||||
call: () async => await rootLogic.stewardRepository.setSateForArrivals(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
request: request,
|
|
||||||
),
|
|
||||||
onError: (error, stackTrace) {
|
|
||||||
eLog(error);
|
|
||||||
},
|
|
||||||
onSuccess: (result) {
|
|
||||||
getWaitingArrivals();
|
|
||||||
rootLogic.onRefresh();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void flashingFabBgColor() {
|
|
||||||
Timer.periodic(Duration(seconds: 2), (timer) {
|
|
||||||
if (bgConfirmAllColor.value == AppColor.blueNormal) {
|
|
||||||
bgConfirmAllColor.value = AppColor.blueLightHover;
|
|
||||||
} else {
|
|
||||||
bgConfirmAllColor.value = AppColor.blueNormal;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearApprovedController() {
|
|
||||||
weightController.clear();
|
|
||||||
countController.clear();
|
|
||||||
lossController.clear();
|
|
||||||
approvedWithOtpController.clear();
|
|
||||||
approvedWithOtpCode.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleExpansion({int? index}) {
|
|
||||||
if (isExpandedListIndex.value == index || index == null) {
|
|
||||||
isExpandedListIndex.value = -1;
|
|
||||||
} else {
|
|
||||||
isExpandedListIndex.value = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,416 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
|
||||||
const BuyInProvinceWaitingPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
body: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return RPaginatedListView(
|
|
||||||
listType: ListType.separated,
|
|
||||||
resource: data.value,
|
|
||||||
hasMore: data.value.data?.next != null,
|
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
var item = data.value.data!.results![index];
|
|
||||||
return ObxValue((val) {
|
|
||||||
return ExpandableListItem2(
|
|
||||||
selected: controller.isExpandedListIndex.value == index,
|
|
||||||
onTap: () => controller.toggleExpansion(index: index),
|
|
||||||
index: index,
|
|
||||||
child: itemListWidget(item),
|
|
||||||
secondChild: itemListExpandedWidget(item),
|
|
||||||
labelColor: AppColor.blueLight,
|
|
||||||
labelIcon: Assets.vec.timerSvg.path,
|
|
||||||
labelIconColor: AppColor.yellowNormal2,
|
|
||||||
);
|
|
||||||
}, controller.isExpandedListIndex);
|
|
||||||
},
|
|
||||||
itemCount: data.value.data?.results?.length ?? 0,
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
|
||||||
onLoadMore: () async => controller.getWaitingArrivals(true),
|
|
||||||
);
|
|
||||||
}, controller.waitingProduct),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Row itemListWidget(WaitingArrivalModel item) {
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 3,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${controller.rootLogic.isKillHouse(item) ? 'کشتارگاه' : 'مباشر'} ${controller.rootLogic.isKillHouse(item) ? item.killHouse?.name : item.steward?.user?.fullname} ',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.date?.formattedJalaliDate ?? 'ندارد',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
spacing: 3,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
spacing: 6,
|
|
||||||
children: [
|
|
||||||
Visibility(
|
|
||||||
visible: item.product?.name?.contains('مرغ گرم') ?? false,
|
|
||||||
child: Assets.vec.hotChickenSvg.svg(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.blueNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.weightOfCarcasses?.separatedByCommaFa.addKg ?? 'ندارد',
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
textDirection: TextDirection.ltr,
|
|
||||||
style: AppFonts.yekan12Bold.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${item.amount?.separatedByCommaFa} ریال',
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 3,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
(item.approvedPriceStatus ?? false) ? 'دولتی' : 'آزاد',
|
|
||||||
style: AppFonts.yekan12Bold.copyWith(
|
|
||||||
color: (item.approvedPriceStatus ?? false)
|
|
||||||
? AppColor.blueNormal
|
|
||||||
: AppColor.greenNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container itemListExpandedWidget(WaitingArrivalModel item) {
|
|
||||||
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(
|
|
||||||
'${controller.rootLogic.isKillHouse(item) ? item.killHouse?.name : item.steward?.user?.fullname} ',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
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(
|
|
||||||
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'${item.date?.toJalali.formatter.y}',
|
|
||||||
style: AppFonts.yekan20.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'${item.date?.toJalali.formatter.tHH}:${item.date?.toJalali.formatter.tMM ?? 'ندارد'}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(
|
|
||||||
title: 'مشخصات فروشنده',
|
|
||||||
value:
|
|
||||||
'${controller.rootLogic.isKillHouse(item) ? item.killHouse?.killHouseOperator?.user?.fullname : item.steward?.user?.fullname} ',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'تلفن فروشنده',
|
|
||||||
value:
|
|
||||||
'${controller.rootLogic.isKillHouse(item) ? item.killHouse?.killHouseOperator?.user?.mobile : item.steward?.user?.mobile} ',
|
|
||||||
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'نوع تخصیص',
|
|
||||||
value: item.allocationType?.faAllocationType ?? 'ندارد',
|
|
||||||
),
|
|
||||||
buildRow(title: ' سهمیه', value: item.quota?.faTitle ?? 'ندارد'),
|
|
||||||
buildRow(
|
|
||||||
title: 'نوع فروش',
|
|
||||||
value: item.saleType == "governmental" ? 'دولتی' : 'آزاد',
|
|
||||||
),
|
|
||||||
buildRow(title: 'محصول', value: item.product?.name ?? 'ندارد'),
|
|
||||||
buildRow(
|
|
||||||
title: 'تاریخ تولید گوشت',
|
|
||||||
value: item.productionDate?.toJalali.toJalaliDateTime() ?? 'ندارد',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'وزن خریداری شده',
|
|
||||||
value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'قیمت هر کیلوگرم',
|
|
||||||
titleLabel: (item.approvedPriceStatus ?? false) ? 'دولتی' : 'آزاد',
|
|
||||||
titleLabelStyle: AppFonts.yekan14Bold.copyWith(
|
|
||||||
color: AppColor.greenNormal,
|
|
||||||
),
|
|
||||||
value: '${item.amount?.separatedByCommaFa} ریال',
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(
|
|
||||||
title: 'قیمت کل',
|
|
||||||
value: '${item.totalAmount?.separatedByCommaFa} ریال',
|
|
||||||
),
|
|
||||||
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 16.w,
|
|
||||||
children: [
|
|
||||||
ObxValue((data) {
|
|
||||||
return RElevated(
|
|
||||||
text: 'تایید',
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
isLoading: data[item.key!] ?? false,
|
|
||||||
onPressed: () async {
|
|
||||||
await Get.bottomSheet(
|
|
||||||
conformationBottomSheet(item),
|
|
||||||
isScrollControlled: true,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
);
|
|
||||||
}, controller.isLoadingConfirmMap),
|
|
||||||
ROutlinedElevated(
|
|
||||||
text: 'رد',
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
onPressed: () {
|
|
||||||
buildWarningDialog(
|
|
||||||
title: 'اخطار',
|
|
||||||
middleText: 'آیا از رد شدن این مورد اطمینان دارید؟',
|
|
||||||
onConfirm: () => controller.denyEntries(item),
|
|
||||||
onRefresh: () => controller.getWaitingArrivals(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
borderColor: AppColor.redNormal,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget conformationBottomSheet(WaitingArrivalModel item) {
|
|
||||||
controller.weightController.text = item.weightOfCarcasses.separatedByComma;
|
|
||||||
return BaseBottomSheet(
|
|
||||||
height: 450.h,
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 10),
|
|
||||||
RTextField(
|
|
||||||
label: 'وزن(کیلوگرم)',
|
|
||||||
controller: controller.weightController,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 16.h),
|
|
||||||
RTextField(
|
|
||||||
label: 'حجم(قطعه)',
|
|
||||||
controller: controller.countController,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 16.h),
|
|
||||||
RTextField(
|
|
||||||
label: 'افت وزن(کیلوگرم)',
|
|
||||||
controller: controller.lossController,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 16.h),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'تایید ',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
ObxValue((data) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
RadioGroup(
|
|
||||||
groupValue: data.value,
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.approvedWithOtpCode.value = value ?? false;
|
|
||||||
},
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
|
||||||
radioRow(
|
|
||||||
value: true,
|
|
||||||
label: ' با کد احراز',
|
|
||||||
onTap: () {
|
|
||||||
controller.approvedWithOtpCode.value = true;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
radioRow(
|
|
||||||
value: false,
|
|
||||||
label: 'بدون کد احراز',
|
|
||||||
onTap: () {
|
|
||||||
controller.approvedWithOtpCode.value = false;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
child: RTextField(
|
|
||||||
controller: controller.approvedWithOtpController,
|
|
||||||
label: 'کد احراز',
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
maxLength: 5,
|
|
||||||
),
|
|
||||||
visible: data.value,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}, controller.approvedWithOtpCode),
|
|
||||||
SizedBox(height: 30.h),
|
|
||||||
Obx(() {
|
|
||||||
return RElevated(
|
|
||||||
enabled: controller.approvedWithOtpCode.value
|
|
||||||
? controller.isButtonConfirm.value
|
|
||||||
: true,
|
|
||||||
text: 'تایید',
|
|
||||||
onPressed: () async {
|
|
||||||
await controller.acceptEntries(item);
|
|
||||||
},
|
|
||||||
isFullWidth: true,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
SizedBox(height: 20.h),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget radioRow({
|
|
||||||
required bool value,
|
|
||||||
required String label,
|
|
||||||
TextStyle? textStyle,
|
|
||||||
GestureTapCallback? onTap,
|
|
||||||
}) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: onTap,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Radio(value: value),
|
|
||||||
Text(
|
|
||||||
label,
|
|
||||||
style:
|
|
||||||
textStyle ??
|
|
||||||
AppFonts.yekan16.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,315 +0,0 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/create_steward_free_bar/create_steward_free_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar/steward_free_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class BuyOutOfProvinceLogic extends GetxController {
|
|
||||||
late List<String> routesName;
|
|
||||||
RxBool isSubmitButtonEnabled = false.obs;
|
|
||||||
RxInt expandedListIndex = (-1).obs;
|
|
||||||
|
|
||||||
final RxInt currentPage = 1.obs;
|
|
||||||
final RxBool isLoadingMoreAllocationsMade = false.obs;
|
|
||||||
final RxBool isOnLoadingSubmitOrEdit = false.obs;
|
|
||||||
|
|
||||||
//TODO add this to Di
|
|
||||||
ImagePicker imagePicker = ImagePicker();
|
|
||||||
|
|
||||||
Rx<Resource<PaginationModel<StewardFreeBar>>> purchaseOutOfProvinceList =
|
|
||||||
Resource<PaginationModel<StewardFreeBar>>.loading().obs;
|
|
||||||
Rxn<ProductModel> selectedProduct = Rxn();
|
|
||||||
|
|
||||||
RxList<IranProvinceCityModel> cites = <IranProvinceCityModel>[].obs;
|
|
||||||
Rxn<IranProvinceCityModel> selectedProvince = Rxn();
|
|
||||||
Rxn<IranProvinceCityModel> selectedCity = Rxn();
|
|
||||||
Rxn<XFile> selectedImage = Rxn<XFile>();
|
|
||||||
final RxnString _base64Image = RxnString();
|
|
||||||
RxnString editImageUrl = RxnString();
|
|
||||||
RxnString editFreeBarKey = RxnString();
|
|
||||||
|
|
||||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
|
||||||
|
|
||||||
BuyLogic buyLogic = Get.find<BuyLogic>();
|
|
||||||
|
|
||||||
SaleLogic outOfTheProvinceLogic = Get.find<SaleLogic>();
|
|
||||||
|
|
||||||
GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
|
||||||
TextEditingController sellerNameController = TextEditingController();
|
|
||||||
TextEditingController sellerPhoneController = TextEditingController();
|
|
||||||
TextEditingController carcassWeightController = TextEditingController();
|
|
||||||
TextEditingController carcassCountController = TextEditingController();
|
|
||||||
|
|
||||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
|
||||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
|
||||||
RxnString searchedValue = RxnString();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
routesName = [...buyLogic.routesName, 'خارج استان'].toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
getStewardPurchaseOutOfProvince();
|
|
||||||
selectedProvince.listen((p0) => getCites());
|
|
||||||
|
|
||||||
selectedProduct.value = rootLogic.rolesProductsModel.first;
|
|
||||||
setupListeners();
|
|
||||||
|
|
||||||
debounce(
|
|
||||||
searchedValue,
|
|
||||||
(callback) => getStewardPurchaseOutOfProvince(),
|
|
||||||
time: Duration(milliseconds: timeDebounce),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
sellerNameController.dispose();
|
|
||||||
sellerPhoneController.dispose();
|
|
||||||
carcassWeightController.dispose();
|
|
||||||
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSearchValue(String? data) {
|
|
||||||
searchedValue.value = data?.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getStewardPurchaseOutOfProvince([
|
|
||||||
bool isLoadingMore = false,
|
|
||||||
]) async {
|
|
||||||
if (isLoadingMore) {
|
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
|
||||||
} else {
|
|
||||||
purchaseOutOfProvinceList.value =
|
|
||||||
Resource<PaginationModel<StewardFreeBar>>.loading();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
|
||||||
searchedValue.value!.trim().isNotEmpty &&
|
|
||||||
currentPage.value > 1) {
|
|
||||||
currentPage.value = 1; // Reset to first page if search value is set
|
|
||||||
}
|
|
||||||
await safeCall(
|
|
||||||
call: () =>
|
|
||||||
rootLogic.stewardRepository.getStewardPurchasesOutSideOfTheProvince(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(
|
|
||||||
pageSize: 20,
|
|
||||||
page: currentPage.value,
|
|
||||||
search: 'filter',
|
|
||||||
role: 'Steward',
|
|
||||||
value: searchedValue.value,
|
|
||||||
fromDate: fromDateFilter.value.toDateTime(),
|
|
||||||
toDate: toDateFilter.value.toDateTime(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (res) async {
|
|
||||||
await Future.delayed(Duration(milliseconds: 500));
|
|
||||||
if ((res?.count ?? 0) == 0) {
|
|
||||||
purchaseOutOfProvinceList.value =
|
|
||||||
Resource<PaginationModel<StewardFreeBar>>.empty();
|
|
||||||
} else {
|
|
||||||
purchaseOutOfProvinceList.value =
|
|
||||||
Resource<PaginationModel<StewardFreeBar>>.success(
|
|
||||||
PaginationModel<StewardFreeBar>(
|
|
||||||
count: res?.count ?? 0,
|
|
||||||
next: res?.next,
|
|
||||||
previous: res?.previous,
|
|
||||||
results: [
|
|
||||||
...(purchaseOutOfProvinceList.value.data?.results ?? []),
|
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getCites() async {
|
|
||||||
await safeCall(
|
|
||||||
call: () => rootLogic.commonRepository.getCity(
|
|
||||||
provinceName: selectedProvince.value?.name ?? '',
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null && result.isNotEmpty) {
|
|
||||||
cites.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setupListeners() {
|
|
||||||
sellerNameController.addListener(() {
|
|
||||||
checkFormValid();
|
|
||||||
if (!isSubmitButtonEnabled.value) {
|
|
||||||
isSubmitButtonEnabled.value = !isSubmitButtonEnabled.value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sellerPhoneController.addListener(checkFormValid);
|
|
||||||
carcassWeightController.addListener(checkFormValid);
|
|
||||||
carcassCountController.addListener(checkFormValid);
|
|
||||||
|
|
||||||
ever(selectedProvince, (_) => checkFormValid());
|
|
||||||
ever(selectedCity, (_) => checkFormValid());
|
|
||||||
ever(selectedProduct, (_) => checkFormValid());
|
|
||||||
ever(selectedImage, (data) async {
|
|
||||||
checkFormValid();
|
|
||||||
if (data?.path != null) {
|
|
||||||
_base64Image.value = await convertImageToBase64(data!.path);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkFormValid() {
|
|
||||||
isSubmitButtonEnabled.value =
|
|
||||||
sellerNameController.text.isNotEmpty &&
|
|
||||||
sellerPhoneController.text.isNotEmpty &&
|
|
||||||
carcassWeightController.text.isNotEmpty &&
|
|
||||||
carcassCountController.text.isNotEmpty &&
|
|
||||||
selectedProvince.value != null &&
|
|
||||||
selectedCity.value != null &&
|
|
||||||
selectedProduct.value != null &&
|
|
||||||
(selectedImage.value != null || editImageUrl.value != null);
|
|
||||||
|
|
||||||
if (isSubmitButtonEnabled.value) {
|
|
||||||
isOnLoadingSubmitOrEdit.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> createStewardPurchaseOutOfProvince() async {
|
|
||||||
bool res = false;
|
|
||||||
isOnLoadingSubmitOrEdit.value = true;
|
|
||||||
if (!(formKey.currentState?.validate() ?? false)) {
|
|
||||||
isOnLoadingSubmitOrEdit.value = false;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
await safeCall(
|
|
||||||
showError: true,
|
|
||||||
call: () async {
|
|
||||||
CreateStewardFreeBar createStewardFreeBar = CreateStewardFreeBar(
|
|
||||||
productKey: selectedProduct.value!.key,
|
|
||||||
killHouseName: sellerNameController.text,
|
|
||||||
killHouseMobile: sellerPhoneController.text,
|
|
||||||
province: selectedProvince.value!.name,
|
|
||||||
city: selectedCity.value!.name,
|
|
||||||
weightOfCarcasses: int.parse(carcassWeightController.text.clearComma),
|
|
||||||
numberOfCarcasses: int.parse(carcassCountController.text.clearComma),
|
|
||||||
barImage: _base64Image.value,
|
|
||||||
date: DateTime.now().formattedYHMS,
|
|
||||||
distributionType: 'App',
|
|
||||||
);
|
|
||||||
await rootLogic.stewardRepository
|
|
||||||
.createStewardPurchasesOutSideOfTheProvince(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
body: createStewardFreeBar,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onSuccess: (result) {
|
|
||||||
getStewardPurchaseOutOfProvince();
|
|
||||||
resetSubmitForm();
|
|
||||||
toggleExpansion();
|
|
||||||
res = true;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
isOnLoadingSubmitOrEdit.value = false;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
void resetSubmitForm() {
|
|
||||||
sellerNameController.clear();
|
|
||||||
sellerPhoneController.clear();
|
|
||||||
carcassWeightController.clear();
|
|
||||||
carcassCountController.clear();
|
|
||||||
selectedProvince.value = null;
|
|
||||||
selectedCity.value = null;
|
|
||||||
selectedImage.value = null;
|
|
||||||
_base64Image.value = null;
|
|
||||||
editImageUrl.value = null;
|
|
||||||
|
|
||||||
isSubmitButtonEnabled.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setEditData(StewardFreeBar item) async {
|
|
||||||
editImageUrl.value = item.barImage;
|
|
||||||
sellerNameController.text = item.killHouseName ?? '';
|
|
||||||
sellerPhoneController.text = item.killHouseMobile ?? '';
|
|
||||||
carcassWeightController.text = item.weightOfCarcasses.separatedByComma;
|
|
||||||
carcassCountController.text = item.numberOfCarcasses.separatedByComma;
|
|
||||||
editFreeBarKey.value = item.key;
|
|
||||||
selectedProvince.value = IranProvinceCityModel(name: item.province);
|
|
||||||
selectedCity.value = IranProvinceCityModel(name: item.city);
|
|
||||||
selectedProduct.value = rootLogic.rolesProductsModel.firstWhere(
|
|
||||||
(element) => element.key == item.product!.key,
|
|
||||||
);
|
|
||||||
|
|
||||||
isSubmitButtonEnabled.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> editStewardPurchaseOutOfProvince() async {
|
|
||||||
CreateStewardFreeBar edit = CreateStewardFreeBar(
|
|
||||||
productKey: selectedProduct.value!.key,
|
|
||||||
key: editFreeBarKey.value,
|
|
||||||
killHouseName: sellerNameController.text,
|
|
||||||
killHouseMobile: sellerPhoneController.text,
|
|
||||||
province: selectedProvince.value!.name,
|
|
||||||
city: selectedCity.value!.name,
|
|
||||||
weightOfCarcasses: int.parse(carcassWeightController.text.clearComma),
|
|
||||||
numberOfCarcasses: int.parse(carcassCountController.text.clearComma),
|
|
||||||
date: DateTime.now().formattedYHMS,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (_base64Image.value != null) {
|
|
||||||
edit = edit.copyWith(barImage: _base64Image.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
await safeCall(
|
|
||||||
showError: true,
|
|
||||||
call: () =>
|
|
||||||
rootLogic.stewardRepository.editStewardPurchasesOutSideOfTheProvince(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
body: edit,
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
onRefresh();
|
|
||||||
rootLogic.onRefresh();
|
|
||||||
toggleExpansion();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
|
|
||||||
await safeCall(
|
|
||||||
call: () => rootLogic.stewardRepository
|
|
||||||
.deleteStewardPurchasesOutSideOfTheProvince(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildRawQueryParams(queryParams: {'key': key}),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> onRefresh() async {
|
|
||||||
currentPage.value = 1;
|
|
||||||
await rootLogic.onRefresh();
|
|
||||||
await getStewardPurchaseOutOfProvince();
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleExpansion({int? index}) {
|
|
||||||
if (expandedListIndex.value == index || index == null) {
|
|
||||||
expandedListIndex.value = -1;
|
|
||||||
} else {
|
|
||||||
expandedListIndex.value = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,673 +0,0 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart' hide Image;
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar/steward_free_bar.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/inventory/inventory_widget.dart';
|
|
||||||
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
|
||||||
const BuyOutOfProvincePage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
routes: controller.routesName,
|
|
||||||
backId: stewardFirstKey,
|
|
||||||
onRefresh: controller.onRefresh,
|
|
||||||
onSearchChanged: (data) => controller.setSearchValue(data),
|
|
||||||
onFilterTap: () {
|
|
||||||
Get.bottomSheet(filterBottomSheet());
|
|
||||||
},
|
|
||||||
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Positioned.fill(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Obx(() {
|
|
||||||
var list = [
|
|
||||||
InventoryItemData(
|
|
||||||
title: 'موجودی انبار',
|
|
||||||
value: controller
|
|
||||||
.rootLogic
|
|
||||||
.inventoryModel
|
|
||||||
.value
|
|
||||||
?.totalRemainWeight
|
|
||||||
?.separatedByCommaFa,
|
|
||||||
color: const Color(0xFFEAFBFC),
|
|
||||||
),
|
|
||||||
InventoryItemData(
|
|
||||||
title: 'مانده دولتی',
|
|
||||||
value: controller
|
|
||||||
.rootLogic
|
|
||||||
.inventoryModel
|
|
||||||
.value
|
|
||||||
?.totalGovernmentalRemainWeight
|
|
||||||
?.separatedByCommaFa,
|
|
||||||
|
|
||||||
color: const Color(0xFFF5ECEE),
|
|
||||||
),
|
|
||||||
InventoryItemData(
|
|
||||||
title: 'مانده آزاد',
|
|
||||||
value: controller
|
|
||||||
.rootLogic
|
|
||||||
.inventoryModel
|
|
||||||
.value
|
|
||||||
?.totalFreeRemainWeight
|
|
||||||
?.separatedByCommaFa,
|
|
||||||
|
|
||||||
color: const Color(0xFFF1E7FF),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
|
|
||||||
return InventoryWidget(inventoryModel: list);
|
|
||||||
}),
|
|
||||||
|
|
||||||
ObxValue((data) {
|
|
||||||
return RPaginatedListView(
|
|
||||||
listType: ListType.separated,
|
|
||||||
resource: data.value,
|
|
||||||
hasMore: data.value.data?.next != null,
|
|
||||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
var item = data.value.data!.results![index];
|
|
||||||
return ObxValue((val) {
|
|
||||||
return ExpandableListItem2(
|
|
||||||
selected: val.value == index,
|
|
||||||
onTap: () => controller.toggleExpansion(index: index),
|
|
||||||
index: index,
|
|
||||||
child: itemListWidget(item),
|
|
||||||
secondChild: itemListExpandedWidget(item),
|
|
||||||
labelColor: AppColor.blueLight,
|
|
||||||
labelIcon: Assets.vec.truckFastOutlinedSvg.path,
|
|
||||||
);
|
|
||||||
}, controller.expandedListIndex);
|
|
||||||
},
|
|
||||||
itemCount: data.value.data?.results?.length ?? 0,
|
|
||||||
separatorBuilder: (context, index) => SizedBox(height: 8.h),
|
|
||||||
onLoadMore: () async => controller.getStewardPurchaseOutOfProvince(true),
|
|
||||||
);
|
|
||||||
}, controller.purchaseOutOfProvinceList),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
right: 5,
|
|
||||||
bottom: 95,
|
|
||||||
child: RFab.add(
|
|
||||||
onPressed: () {
|
|
||||||
Get.bottomSheet(
|
|
||||||
addPurchasedInformationBottomSheet(),
|
|
||||||
isScrollControlled: true,
|
|
||||||
ignoreSafeArea: false,
|
|
||||||
).whenComplete(() {
|
|
||||||
controller.resetSubmitForm();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container itemListExpandedWidget(StewardFreeBar item) {
|
|
||||||
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.province}-${item.city}',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
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(
|
|
||||||
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'${item.date?.toJalali.formatter.y}',
|
|
||||||
style: AppFonts.yekan20.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'${item.date?.toJalali.formatter.tHH}:${item.date?.toJalali.formatter.tMM ?? 'ندارد'}',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(title: 'مشخصات فروشنده', value: item.killHouseName ?? 'ندارد'),
|
|
||||||
|
|
||||||
buildRow(
|
|
||||||
title: 'تلفن فروشنده',
|
|
||||||
value: item.killHouseMobile ?? 'ندارد',
|
|
||||||
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
buildRow(title: 'محصول', value: item.product?.name ?? 'ندارد'),
|
|
||||||
buildRow(
|
|
||||||
title: 'وزن خریداری شده',
|
|
||||||
value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم',
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
title: 'حجم خریداری شده',
|
|
||||||
value: '${item.numberOfCarcasses?.separatedByCommaFa} قطعه',
|
|
||||||
),
|
|
||||||
buildRowOnTapped(
|
|
||||||
title: 'مشاهده بارنامه',
|
|
||||||
titleStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
|
||||||
valueWidget: Assets.vec.clipboardEyeSvg.svg(
|
|
||||||
width: 20,
|
|
||||||
height: 24,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Get.bottomSheet(
|
|
||||||
BaseBottomSheet(
|
|
||||||
height: 400,
|
|
||||||
child: Column(
|
|
||||||
spacing: 16,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'بارنامه',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
|
|
||||||
Image.network(
|
|
||||||
item.barImage ?? '',
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
height: 300,
|
|
||||||
errorBuilder: (context, error, stackTrace) {
|
|
||||||
eLog(error.toString());
|
|
||||||
return Center(child: Text('خطایی پیش آمده!'));
|
|
||||||
},
|
|
||||||
loadingBuilder: (context, child, loadingProgress) {
|
|
||||||
if (loadingProgress == null) return child;
|
|
||||||
return CupertinoActivityIndicator();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 16.w,
|
|
||||||
children: [
|
|
||||||
RElevated(
|
|
||||||
text: 'ویرایش',
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
onPressed: () {
|
|
||||||
controller.setEditData(item);
|
|
||||||
Get.bottomSheet(
|
|
||||||
addPurchasedInformationBottomSheet(true),
|
|
||||||
isScrollControlled: true,
|
|
||||||
).whenComplete(() {
|
|
||||||
controller.resetSubmitForm();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
),
|
|
||||||
ROutlinedElevated(
|
|
||||||
text: 'حذف',
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
onPressed: () {
|
|
||||||
buildDeleteDialog(
|
|
||||||
onConfirm: () => controller.deleteStewardPurchaseOutOfProvince(item.key!),
|
|
||||||
onRefresh: () async {
|
|
||||||
controller.rootLogic.onRefresh();
|
|
||||||
controller.onRefresh();
|
|
||||||
controller.toggleExpansion();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
borderColor: AppColor.redNormal,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Row itemListWidget(StewardFreeBar item) {
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 3,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
item.killHouseName ?? 'ندارد',
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
item.date?.formattedJalaliDate ?? 'ندارد',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
spacing: 3,
|
|
||||||
children: [
|
|
||||||
Visibility(
|
|
||||||
visible: item.product?.name?.contains('مرغ گرم') ?? false,
|
|
||||||
child: Assets.vec.hotChickenSvg.svg(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${item.weightOfCarcasses?.separatedByCommaFa}kg',
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 2),
|
|
||||||
Text(
|
|
||||||
'${item.numberOfCarcasses.separatedByComma} ${'قطعه'}',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 3,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${item.province}',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${item.city}',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget addPurchasedInformationBottomSheet([bool isOnEdit = false]) {
|
|
||||||
return BaseBottomSheet(
|
|
||||||
child: Form(
|
|
||||||
key: controller.formKey,
|
|
||||||
child: Column(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
isOnEdit ? 'ویرایش اطلاعات خرید' : 'ثبت اطلاعات خرید',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
_productDropDown(),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(8),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
|
||||||
),
|
|
||||||
|
|
||||||
child: Column(spacing: 12, children: [_provinceWidget(), _cityWidget()]),
|
|
||||||
),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(8),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
|
||||||
),
|
|
||||||
|
|
||||||
child: Column(
|
|
||||||
spacing: 12,
|
|
||||||
children: [
|
|
||||||
RTextField(
|
|
||||||
controller: controller.sellerNameController,
|
|
||||||
label: 'نام فروشنده',
|
|
||||||
borderColor: AppColor.darkGreyLight,
|
|
||||||
filled: true,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
),
|
|
||||||
RTextField(
|
|
||||||
controller: controller.sellerPhoneController,
|
|
||||||
label: 'تلفن فروشنده',
|
|
||||||
keyboardType: TextInputType.phone,
|
|
||||||
borderColor: AppColor.darkGreyLight,
|
|
||||||
maxLength: 11,
|
|
||||||
filled: true,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'لطفاً شماره موبایل را وارد کنید';
|
|
||||||
}
|
|
||||||
String cleaned = value.replaceAll(',', '');
|
|
||||||
if (cleaned.length != 11) {
|
|
||||||
return 'شماره موبایل باید ۱۱ رقم باشد';
|
|
||||||
}
|
|
||||||
if (!cleaned.startsWith('09')) {
|
|
||||||
return 'شماره موبایل باید با 09 شروع شود';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
|
|
||||||
UnitTextField(
|
|
||||||
controller: controller.carcassWeightController,
|
|
||||||
hint: 'وزن',
|
|
||||||
unit: 'کیلوگرم',
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
UnitTextField(
|
|
||||||
controller: controller.carcassCountController,
|
|
||||||
hint: 'حجم',
|
|
||||||
unit: 'قطعه',
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
SeparatorInputFormatter(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
_imageCarcasesWidget(isOnEdit),
|
|
||||||
submitButtonWidget(isOnEdit),
|
|
||||||
SizedBox(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget submitButtonWidget(bool isOnEdit) {
|
|
||||||
return Obx(() {
|
|
||||||
return RElevated(
|
|
||||||
text: isOnEdit ? 'ویرایش' : 'ثبت',
|
|
||||||
width: Get.width,
|
|
||||||
backgroundColor: AppColor.greenNormal,
|
|
||||||
isLoading: controller.isOnLoadingSubmitOrEdit.value,
|
|
||||||
enabled: controller.isSubmitButtonEnabled.value,
|
|
||||||
onPressed: isOnEdit
|
|
||||||
? () async {
|
|
||||||
await controller.editStewardPurchaseOutOfProvince();
|
|
||||||
Get.back();
|
|
||||||
}
|
|
||||||
: () async {
|
|
||||||
var res = await controller.createStewardPurchaseOutOfProvince();
|
|
||||||
if (res) {
|
|
||||||
Get.back();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
height: 40,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _productDropDown() {
|
|
||||||
return Obx(() {
|
|
||||||
return OverlayDropdownWidget<ProductModel>(
|
|
||||||
items: controller.rootLogic.rolesProductsModel,
|
|
||||||
height: 56,
|
|
||||||
hasDropIcon: false,
|
|
||||||
background: Colors.white,
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.selectedProduct.value = value;
|
|
||||||
},
|
|
||||||
selectedItem: controller.selectedProduct.value,
|
|
||||||
initialValue: controller.selectedProduct.value,
|
|
||||||
itemBuilder: (item) => Text(item.name ?? 'بدون نام'),
|
|
||||||
labelBuilder: (item) => Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
(item?.name?.contains('مرغ گرم') ?? false)
|
|
||||||
? Assets.images.chicken.image(width: 40, height: 40)
|
|
||||||
: Assets.vec.placeHolderSvg.svg(width: 40, height: 40),
|
|
||||||
|
|
||||||
Text(item?.name ?? 'انتخاب محصول'),
|
|
||||||
Spacer(),
|
|
||||||
Text(
|
|
||||||
'موجودی:${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByCommaFa ?? 0}',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _provinceWidget() {
|
|
||||||
return Obx(() {
|
|
||||||
return OverlayDropdownWidget<IranProvinceCityModel>(
|
|
||||||
items: controller.rootLogic.provinces,
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.selectedProvince.value = value;
|
|
||||||
},
|
|
||||||
selectedItem: controller.selectedProvince.value,
|
|
||||||
itemBuilder: (item) => Text(
|
|
||||||
item.name ?? 'بدون نام',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker),
|
|
||||||
),
|
|
||||||
labelBuilder: (item) => item?.name != null
|
|
||||||
? Text(item!.name!, style: AppFonts.yekan14.copyWith(color: AppColor.textColor))
|
|
||||||
: Text(
|
|
||||||
'انتخاب استان',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _cityWidget() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
return OverlayDropdownWidget<IranProvinceCityModel>(
|
|
||||||
items: data,
|
|
||||||
onChanged: (value) {
|
|
||||||
controller.selectedCity.value = value;
|
|
||||||
},
|
|
||||||
selectedItem: controller.selectedCity.value,
|
|
||||||
itemBuilder: (item) => Text(
|
|
||||||
item.name ?? 'بدون نام',
|
|
||||||
style: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarker),
|
|
||||||
),
|
|
||||||
labelBuilder: (item) => item?.name != null
|
|
||||||
? Text(item!.name!, style: AppFonts.yekan14.copyWith(color: AppColor.textColor))
|
|
||||||
: Text('انتخاب شهر', style: AppFonts.yekan14.copyWith(color: AppColor.textColorLight)),
|
|
||||||
);
|
|
||||||
}, controller.cites);
|
|
||||||
}
|
|
||||||
|
|
||||||
SizedBox _imageCarcasesWidget(bool isOnEdit) {
|
|
||||||
return SizedBox(
|
|
||||||
width: Get.width,
|
|
||||||
height: 370,
|
|
||||||
child: Card(
|
|
||||||
color: Colors.white,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(4.0),
|
|
||||||
child: Column(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Text('بارنامه', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)),
|
|
||||||
Expanded(
|
|
||||||
child: ObxValue((data) {
|
|
||||||
return Container(
|
|
||||||
width: Get.width,
|
|
||||||
height: 270,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.lightGreyNormal,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 1, color: AppColor.blackLight),
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: isOnEdit
|
|
||||||
? Image.network(controller.editImageUrl.value ?? '')
|
|
||||||
: data.value == null
|
|
||||||
? Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(30, 10, 10, 30),
|
|
||||||
child: Assets.vec.placeHolderSvg.svg(width: 200.w, height: 150.h),
|
|
||||||
)
|
|
||||||
: Image.file(File(data.value!.path), fit: BoxFit.cover),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.selectedImage),
|
|
||||||
),
|
|
||||||
|
|
||||||
Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
RElevated(
|
|
||||||
text: 'گالری',
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
|
||||||
onPressed: () async {
|
|
||||||
controller.selectedImage.value = await controller.imagePicker.pickImage(
|
|
||||||
source: ImageSource.gallery,
|
|
||||||
imageQuality: 60,
|
|
||||||
maxWidth: 1080,
|
|
||||||
maxHeight: 720,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(width: 16),
|
|
||||||
ROutlinedElevated(
|
|
||||||
text: 'دوربین',
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: AppColor.blueNormal),
|
|
||||||
onPressed: () async {
|
|
||||||
controller.selectedImage.value = await controller.imagePicker.pickImage(
|
|
||||||
source: ImageSource.camera,
|
|
||||||
imageQuality: 60,
|
|
||||||
maxWidth: 1080,
|
|
||||||
maxHeight: 720,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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: () {
|
|
||||||
controller.getStewardPurchaseOutOfProvince();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
height: 40,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
import 'package:rasadyar_chicken/features/common/data/model/response/bar_information/bar_information.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class HomeLogic extends GetxController {
|
|
||||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
|
||||||
RxnInt totalWeightTodayBars = RxnInt();
|
|
||||||
Rxn<KillHouseDistributionInfo> killHouseDistributionInfo =
|
|
||||||
Rxn<KillHouseDistributionInfo>();
|
|
||||||
Rxn<BarInformation> barInformation = Rxn();
|
|
||||||
|
|
||||||
RxList<Map<String, String?>> inventoryItems = [
|
|
||||||
{'خریدهای دولتی داخل استان': null},
|
|
||||||
{'خریدهای آزاد داخل استان': null},
|
|
||||||
{'وزن خریدهای خارج استان': null},
|
|
||||||
{'کل ورودی به انبار': null},
|
|
||||||
{'کل فروش': null},
|
|
||||||
{'مانده انبار': null},
|
|
||||||
].obs;
|
|
||||||
|
|
||||||
RxList<Map<String, String>> broadcastItems = [
|
|
||||||
{'وزن دولتی': '2،225،256'},
|
|
||||||
{'وزن آزاد': '2،225،256'},
|
|
||||||
{'فروش دولتی': '2،225،256'},
|
|
||||||
{'فروش آزاد': '2،225،256'},
|
|
||||||
{'توزیع داخل استان': '2،225،256'},
|
|
||||||
{'توزیع خارج استان': '2،225،256'},
|
|
||||||
{'قطعه بندی': '2،225،256'},
|
|
||||||
].obs;
|
|
||||||
|
|
||||||
RxBool isExpanded = false.obs;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
refreshData();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> refreshData() async {
|
|
||||||
await Future.wait([
|
|
||||||
getGeneralBarsInformation(),
|
|
||||||
getTodayBars(),
|
|
||||||
getDistributionInformation(),
|
|
||||||
rootLogic.getRolesProducts(),
|
|
||||||
rootLogic.getRolesProduct(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getGeneralBarsInformation() async {
|
|
||||||
await safeCall<BarInformation?>(
|
|
||||||
call: () async =>
|
|
||||||
await rootLogic.commonRepository.getGeneralBarInformation(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(role: 'Steward'),
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
barInformation.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getTodayBars() async {
|
|
||||||
await safeCall<BarInformation?>(
|
|
||||||
call: () async =>
|
|
||||||
await rootLogic.commonRepository.getGeneralBarInformation(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(
|
|
||||||
fromDate: DateTime.now(),
|
|
||||||
toDate: DateTime.now(),
|
|
||||||
role: 'Steward',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
totalWeightTodayBars.value = result.totalBarsWeight?.toInt();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getDistributionInformation() async {
|
|
||||||
await safeCall<KillHouseDistributionInfo?>(
|
|
||||||
call: () async =>
|
|
||||||
await rootLogic.commonRepository.getKillHouseDistributionInfo(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
killHouseDistributionInfo.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,7 @@
|
|||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/buy_in_province/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/features/steward/buy/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/buy_in_province_all/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/buy_in_province_waiting/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_all/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_all/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_waiting/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_waiting/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/buy_in_province/logic.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class BuyInProvinceLogic extends GetxController {
|
class BuyInProvinceLogic extends GetxController {
|
||||||
@@ -18,7 +11,7 @@ class BuyInProvinceLogic extends GetxController {
|
|||||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
||||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
||||||
|
|
||||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
||||||
|
|
||||||
BuyLogic get buyLogic => Get.find<BuyLogic>();
|
BuyLogic get buyLogic => Get.find<BuyLogic>();
|
||||||
RxInt selectedSegmentIndex = 0.obs;
|
RxInt selectedSegmentIndex = 0.obs;
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/buy_in_province/view.dart
|
|
||||||
import 'package:rasadyar_chicken/features/steward/buy_in_province_all/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/buy_in_province_waiting/view.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_all/view.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_all/view.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_waiting/view.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_waiting/view.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/buy_in_province/view.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/inventory/inventory_widget.dart';
|
import 'package:rasadyar_chicken/presentation/widget/inventory/inventory_widget.dart';
|
||||||
@@ -72,9 +67,7 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
|
|||||||
segmentWidget(),
|
segmentWidget(),
|
||||||
ObxValue((index) {
|
ObxValue((index) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: index.value == 0
|
child: index.value == 0 ? BuyInProvinceWaitingPage() : BuyInProvinceAllPage(),
|
||||||
? BuyInProvinceWaitingPage()
|
|
||||||
: BuyInProvinceAllPage(),
|
|
||||||
);
|
);
|
||||||
}, controller.selectedSegmentIndex),
|
}, controller.selectedSegmentIndex),
|
||||||
],
|
],
|
||||||
@@ -94,8 +87,7 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
|
|||||||
borderColor: const Color(0xFFB4B4B4),
|
borderColor: const Color(0xFFB4B4B4),
|
||||||
selectedBorderColor: AppColor.blueNormal,
|
selectedBorderColor: AppColor.blueNormal,
|
||||||
selectedBackgroundColor: AppColor.blueLight,
|
selectedBackgroundColor: AppColor.blueLight,
|
||||||
onSegmentSelected: (index) =>
|
onSegmentSelected: (index) => controller.selectedSegmentIndex.value = index,
|
||||||
controller.selectedSegmentIndex.value = index,
|
|
||||||
backgroundColor: AppColor.whiteGreyNormal,
|
backgroundColor: AppColor.whiteGreyNormal,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -110,18 +102,14 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
spacing: 16,
|
spacing: 16,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)),
|
||||||
'فیلترها',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: dateFilterWidget(
|
child: dateFilterWidget(
|
||||||
date: controller.fromDateFilter,
|
date: controller.fromDateFilter,
|
||||||
onChanged: (jalali) =>
|
onChanged: (jalali) => controller.fromDateFilter.value = jalali,
|
||||||
controller.fromDateFilter.value = jalali,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/buy_in_province_all/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/request/steward_allocation/steward_allocation_request.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_allocation/steward_allocation_request.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_allocation/steward_allocation_request.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/buy_in_province_all/logic.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class BuyInProvinceAllLogic extends GetxController {
|
class BuyInProvinceAllLogic extends GetxController {
|
||||||
@@ -39,11 +34,7 @@ class BuyInProvinceAllLogic extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
debounce(
|
debounce(searchedValue, (callback) => getAllArrivals(), time: Duration(milliseconds: 2000));
|
||||||
searchedValue,
|
|
||||||
(callback) => getAllArrivals(),
|
|
||||||
time: Duration(milliseconds: 2000),
|
|
||||||
);
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
ever(approvedWithOtpCode, (callback) {
|
ever(approvedWithOtpCode, (callback) {
|
||||||
if (callback == false) {
|
if (callback == false) {
|
||||||
@@ -56,8 +47,7 @@ class BuyInProvinceAllLogic extends GetxController {
|
|||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
allProduct.value =
|
allProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.loading();
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -83,21 +73,16 @@ class BuyInProvinceAllLogic extends GetxController {
|
|||||||
onSuccess: (res) async {
|
onSuccess: (res) async {
|
||||||
await Future.delayed(Duration(milliseconds: 200));
|
await Future.delayed(Duration(milliseconds: 200));
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
allProduct.value =
|
allProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.empty();
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
allProduct.value =
|
allProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.success(
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.success(
|
PaginationModel<WaitingArrivalModel>(
|
||||||
PaginationModel<WaitingArrivalModel>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [...(allProduct.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
results: [
|
),
|
||||||
...(allProduct.value.data?.results ?? []),
|
);
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/buy_in_province_waiting/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/request/steward_allocation/steward_allocation_request.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_allocation/steward_allocation_request.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_allocation/steward_allocation_request.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/buy_in_province_waiting/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -62,8 +57,7 @@ class BuyInProvinceWaitingLogic extends GetxController {
|
|||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
waitingProduct.value =
|
waitingProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.loading();
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -89,21 +83,16 @@ class BuyInProvinceWaitingLogic extends GetxController {
|
|||||||
onSuccess: (res) async {
|
onSuccess: (res) async {
|
||||||
await Future.delayed(Duration(milliseconds: 200));
|
await Future.delayed(Duration(milliseconds: 200));
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
waitingProduct.value =
|
waitingProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.empty();
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
waitingProduct.value =
|
waitingProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.success(
|
||||||
Resource<PaginationModel<WaitingArrivalModel>>.success(
|
PaginationModel<WaitingArrivalModel>(
|
||||||
PaginationModel<WaitingArrivalModel>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [...(waitingProduct.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
results: [
|
),
|
||||||
...(waitingProduct.value.data?.results ?? []),
|
);
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
flashingFabBgColor();
|
flashingFabBgColor();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/buy_out_of_province/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/create_steward_free_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/buy/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sale/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/create_steward_free_bar/create_steward_free_bar.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/create_steward_free_bar/create_steward_free_bar.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
@@ -15,7 +7,6 @@ import 'package:rasadyar_chicken/features/steward/data/model/response/steward_fr
|
|||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/buy_out_of_province/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -94,14 +85,11 @@ class BuyOutOfProvinceLogic extends GetxController {
|
|||||||
searchedValue.value = data?.trim();
|
searchedValue.value = data?.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getStewardPurchaseOutOfProvince([
|
Future<void> getStewardPurchaseOutOfProvince([bool isLoadingMore = false]) async {
|
||||||
bool isLoadingMore = false,
|
|
||||||
]) async {
|
|
||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
purchaseOutOfProvinceList.value =
|
purchaseOutOfProvinceList.value = Resource<PaginationModel<StewardFreeBar>>.loading();
|
||||||
Resource<PaginationModel<StewardFreeBar>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -110,37 +98,34 @@ class BuyOutOfProvinceLogic extends GetxController {
|
|||||||
currentPage.value = 1; // Reset to first page if search value is set
|
currentPage.value = 1; // Reset to first page if search value is set
|
||||||
}
|
}
|
||||||
await safeCall(
|
await safeCall(
|
||||||
call: () =>
|
call: () => rootLogic.stewardRepository.getStewardPurchasesOutSideOfTheProvince(
|
||||||
rootLogic.stewardRepository.getStewardPurchasesOutSideOfTheProvince(
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
queryParameters: buildQueryParams(
|
||||||
queryParameters: buildQueryParams(
|
pageSize: 20,
|
||||||
pageSize: 20,
|
page: currentPage.value,
|
||||||
page: currentPage.value,
|
search: 'filter',
|
||||||
search: 'filter',
|
role: 'Steward',
|
||||||
role: 'Steward',
|
value: searchedValue.value,
|
||||||
value: searchedValue.value,
|
fromDate: fromDateFilter.value.toDateTime(),
|
||||||
fromDate: fromDateFilter.value.toDateTime(),
|
toDate: toDateFilter.value.toDateTime(),
|
||||||
toDate: toDateFilter.value.toDateTime(),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
onSuccess: (res) async {
|
onSuccess: (res) async {
|
||||||
await Future.delayed(Duration(milliseconds: 500));
|
await Future.delayed(Duration(milliseconds: 500));
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
purchaseOutOfProvinceList.value =
|
purchaseOutOfProvinceList.value = Resource<PaginationModel<StewardFreeBar>>.empty();
|
||||||
Resource<PaginationModel<StewardFreeBar>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
purchaseOutOfProvinceList.value =
|
purchaseOutOfProvinceList.value = Resource<PaginationModel<StewardFreeBar>>.success(
|
||||||
Resource<PaginationModel<StewardFreeBar>>.success(
|
PaginationModel<StewardFreeBar>(
|
||||||
PaginationModel<StewardFreeBar>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [
|
||||||
results: [
|
...(purchaseOutOfProvinceList.value.data?.results ?? []),
|
||||||
...(purchaseOutOfProvinceList.value.data?.results ?? []),
|
...(res?.results ?? []),
|
||||||
...(res?.results ?? []),
|
],
|
||||||
],
|
),
|
||||||
),
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -148,9 +133,8 @@ class BuyOutOfProvinceLogic extends GetxController {
|
|||||||
|
|
||||||
Future<void> getCites() async {
|
Future<void> getCites() async {
|
||||||
await safeCall(
|
await safeCall(
|
||||||
call: () => rootLogic.commonRepository.getCity(
|
call: () =>
|
||||||
provinceName: selectedProvince.value?.name ?? '',
|
rootLogic.commonRepository.getCity(provinceName: selectedProvince.value?.name ?? ''),
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null && result.isNotEmpty) {
|
if (result != null && result.isNotEmpty) {
|
||||||
cites.value = result;
|
cites.value = result;
|
||||||
@@ -219,11 +203,10 @@ class BuyOutOfProvinceLogic extends GetxController {
|
|||||||
date: DateTime.now().formattedYHMS,
|
date: DateTime.now().formattedYHMS,
|
||||||
distributionType: 'App',
|
distributionType: 'App',
|
||||||
);
|
);
|
||||||
await rootLogic.stewardRepository
|
await rootLogic.stewardRepository.createStewardPurchasesOutSideOfTheProvince(
|
||||||
.createStewardPurchasesOutSideOfTheProvince(
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
body: createStewardFreeBar,
|
||||||
body: createStewardFreeBar,
|
);
|
||||||
);
|
|
||||||
},
|
},
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
getStewardPurchaseOutOfProvince();
|
getStewardPurchaseOutOfProvince();
|
||||||
@@ -285,11 +268,10 @@ class BuyOutOfProvinceLogic extends GetxController {
|
|||||||
|
|
||||||
await safeCall(
|
await safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () =>
|
call: () => rootLogic.stewardRepository.editStewardPurchasesOutSideOfTheProvince(
|
||||||
rootLogic.stewardRepository.editStewardPurchasesOutSideOfTheProvince(
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
body: edit,
|
||||||
body: edit,
|
),
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
onRefresh();
|
onRefresh();
|
||||||
rootLogic.onRefresh();
|
rootLogic.onRefresh();
|
||||||
@@ -300,11 +282,10 @@ class BuyOutOfProvinceLogic extends GetxController {
|
|||||||
|
|
||||||
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
|
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
|
||||||
await safeCall(
|
await safeCall(
|
||||||
call: () => rootLogic.stewardRepository
|
call: () => rootLogic.stewardRepository.deleteStewardPurchasesOutSideOfTheProvince(
|
||||||
.deleteStewardPurchasesOutSideOfTheProvince(
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
queryParameters: buildRawQueryParams(queryParams: {'key': key}),
|
||||||
queryParameters: buildRawQueryParams(queryParams: {'key': key}),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,12 @@
|
|||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/home/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/bar_information/bar_information.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/bar_information/bar_information.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/home/logic.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class HomeLogic extends GetxController {
|
class HomeLogic extends GetxController {
|
||||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
||||||
RxnInt totalWeightTodayBars = RxnInt();
|
RxnInt totalWeightTodayBars = RxnInt();
|
||||||
Rxn<KillHouseDistributionInfo> killHouseDistributionInfo =
|
Rxn<KillHouseDistributionInfo> killHouseDistributionInfo = Rxn<KillHouseDistributionInfo>();
|
||||||
Rxn<KillHouseDistributionInfo>();
|
|
||||||
Rxn<BarInformation> barInformation = Rxn();
|
Rxn<BarInformation> barInformation = Rxn();
|
||||||
|
|
||||||
RxList<Map<String, String?>> inventoryItems = [
|
RxList<Map<String, String?>> inventoryItems = [
|
||||||
@@ -55,11 +48,10 @@ class HomeLogic extends GetxController {
|
|||||||
|
|
||||||
Future<void> getGeneralBarsInformation() async {
|
Future<void> getGeneralBarsInformation() async {
|
||||||
await safeCall<BarInformation?>(
|
await safeCall<BarInformation?>(
|
||||||
call: () async =>
|
call: () async => await rootLogic.commonRepository.getGeneralBarInformation(
|
||||||
await rootLogic.commonRepository.getGeneralBarInformation(
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
queryParameters: buildQueryParams(role: 'Steward'),
|
||||||
queryParameters: buildQueryParams(role: 'Steward'),
|
),
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
barInformation.value = result;
|
barInformation.value = result;
|
||||||
@@ -71,15 +63,14 @@ class HomeLogic extends GetxController {
|
|||||||
|
|
||||||
Future<void> getTodayBars() async {
|
Future<void> getTodayBars() async {
|
||||||
await safeCall<BarInformation?>(
|
await safeCall<BarInformation?>(
|
||||||
call: () async =>
|
call: () async => await rootLogic.commonRepository.getGeneralBarInformation(
|
||||||
await rootLogic.commonRepository.getGeneralBarInformation(
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
queryParameters: buildQueryParams(
|
||||||
queryParameters: buildQueryParams(
|
fromDate: DateTime.now(),
|
||||||
fromDate: DateTime.now(),
|
toDate: DateTime.now(),
|
||||||
toDate: DateTime.now(),
|
role: 'Steward',
|
||||||
role: 'Steward',
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
totalWeightTodayBars.value = result.totalBarsWeight?.toInt();
|
totalWeightTodayBars.value = result.totalBarsWeight?.toInt();
|
||||||
@@ -91,10 +82,9 @@ class HomeLogic extends GetxController {
|
|||||||
|
|
||||||
Future<void> getDistributionInformation() async {
|
Future<void> getDistributionInformation() async {
|
||||||
await safeCall<KillHouseDistributionInfo?>(
|
await safeCall<KillHouseDistributionInfo?>(
|
||||||
call: () async =>
|
call: () async => await rootLogic.commonRepository.getKillHouseDistributionInfo(
|
||||||
await rootLogic.commonRepository.getKillHouseDistributionInfo(
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
),
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
killHouseDistributionInfo.value = result;
|
killHouseDistributionInfo.value = result;
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
import 'package:flutter/cupertino.dart' hide LinearGradient;
|
import 'package:flutter/cupertino.dart' hide LinearGradient;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/home/view.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/inventory/inventory_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/inventory/inventory_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/home/view.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/steward/widely_used/view.dart';
|
import 'package:rasadyar_chicken/presentation/widget/steward/widely_used/view.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
import '../../../../common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
class HomePage extends GetView<HomeLogic> {
|
class HomePage extends GetView<HomeLogic> {
|
||||||
@@ -80,10 +77,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
AnimatedRotation(
|
AnimatedRotation(
|
||||||
turns: 180,
|
turns: 180,
|
||||||
duration: Duration(milliseconds: 3000),
|
duration: Duration(milliseconds: 3000),
|
||||||
child: Icon(
|
child: Icon(CupertinoIcons.chevron_up, size: 18),
|
||||||
CupertinoIcons.chevron_up,
|
|
||||||
size: 18,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -107,9 +101,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Row(
|
Row(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [Icon(CupertinoIcons.chevron_down, size: 18)],
|
||||||
Icon(CupertinoIcons.chevron_down, size: 18),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
_todayShipmentWidget(),
|
_todayShipmentWidget(),
|
||||||
_todayShipmentWidget2(),
|
_todayShipmentWidget2(),
|
||||||
@@ -137,17 +129,12 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Assets.vec.chicken2Svg.svg(
|
Assets.vec.chicken2Svg.svg(
|
||||||
width: 24.w,
|
width: 24.w,
|
||||||
height: 24.h,
|
height: 24.h,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(AppColor.blueDark, BlendMode.srcIn),
|
||||||
AppColor.blueDark,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'اطلاعات مرغ گرم',
|
'اطلاعات مرغ گرم',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
|
||||||
color: AppColor.iconColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -166,11 +153,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
Text(
|
Text('اطلاعات پخش', textAlign: TextAlign.right, style: AppFonts.yekan16),
|
||||||
'اطلاعات پخش',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.h),
|
SizedBox(height: 8.h),
|
||||||
@@ -183,8 +166,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
title: 'وزن دولتی',
|
title: 'وزن دولتی',
|
||||||
titleBgColor: const Color(0xFFB8E7DC),
|
titleBgColor: const Color(0xFFB8E7DC),
|
||||||
valueBgColor: const Color(0xFFE6FAF5),
|
valueBgColor: const Color(0xFFE6FAF5),
|
||||||
value:
|
value: data.value?.totalGovernmentalInputWeight.separatedByComma,
|
||||||
data.value?.totalGovernmentalInputWeight.separatedByComma,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -198,10 +180,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: broadcastItem(
|
child: broadcastItem(
|
||||||
title: 'فروش دولتی',
|
title: 'فروش دولتی',
|
||||||
value: data
|
value: data.value?.totalGovernmentalOutputWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalGovernmentalOutputWeight
|
|
||||||
.separatedByComma,
|
|
||||||
titleBgColor: const Color(0xFFEBC4CE),
|
titleBgColor: const Color(0xFFEBC4CE),
|
||||||
valueBgColor: const Color(0xFFEDDCE0),
|
valueBgColor: const Color(0xFFEDDCE0),
|
||||||
),
|
),
|
||||||
@@ -225,10 +204,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: broadcastItem(
|
child: broadcastItem(
|
||||||
title: 'مانده دولتی',
|
title: 'مانده دولتی',
|
||||||
value: data
|
value: data.value?.totalGovernmentalRemainWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalGovernmentalRemainWeight
|
|
||||||
.separatedByComma,
|
|
||||||
titleBgColor: const Color(0xFFB8E7DC),
|
titleBgColor: const Color(0xFFB8E7DC),
|
||||||
valueBgColor: const Color(0xFFE6FAF5),
|
valueBgColor: const Color(0xFFE6FAF5),
|
||||||
),
|
),
|
||||||
@@ -244,10 +220,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: broadcastItem(
|
child: broadcastItem(
|
||||||
title: 'فروش خارج استان',
|
title: 'فروش خارج استان',
|
||||||
value: data
|
value: data.value?.totalStewardFreeSaleBarCarcassesWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalStewardFreeSaleBarCarcassesWeight
|
|
||||||
.separatedByComma,
|
|
||||||
titleBgColor: const Color(0xFFEBC4CE),
|
titleBgColor: const Color(0xFFEBC4CE),
|
||||||
valueBgColor: const Color(0xFFEDDCE0),
|
valueBgColor: const Color(0xFFEDDCE0),
|
||||||
),
|
),
|
||||||
@@ -271,8 +244,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: _informationIconCard(
|
child: _informationIconCard(
|
||||||
title: 'توزیع داخل استان',
|
title: 'توزیع داخل استان',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.freeSalesWeight.separatedByCommaFa ?? '0',
|
||||||
data.value?.freeSalesWeight.separatedByCommaFa ?? '0',
|
|
||||||
iconPath: Assets.vec.truckSvg.path,
|
iconPath: Assets.vec.truckSvg.path,
|
||||||
iconColor: const Color.fromRGBO(85, 97, 93, 1),
|
iconColor: const Color.fromRGBO(85, 97, 93, 1),
|
||||||
bgDescriptionColor: const Color(0xFFE6FAF5),
|
bgDescriptionColor: const Color(0xFFE6FAF5),
|
||||||
@@ -283,9 +255,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: _informationIconCard(
|
child: _informationIconCard(
|
||||||
title: 'توزیع خارج استان',
|
title: 'توزیع خارج استان',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.stewardAllocationsWeight.separatedByCommaFa ?? '0',
|
||||||
data.value?.stewardAllocationsWeight.separatedByCommaFa ??
|
|
||||||
'0',
|
|
||||||
iconPath: Assets.vec.truckFastSvg.path,
|
iconPath: Assets.vec.truckFastSvg.path,
|
||||||
iconColor: Color(0xFF647379),
|
iconColor: Color(0xFF647379),
|
||||||
bgDescriptionColor: const Color(0xFFEAEFFF),
|
bgDescriptionColor: const Color(0xFFEAEFFF),
|
||||||
@@ -334,9 +304,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: _informationLabelCard(
|
child: _informationLabelCard(
|
||||||
title: 'خارج استان',
|
title: 'خارج استان',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.freeBuyingCarcassesWeight.separatedByCommaFa ?? '0',
|
||||||
data.value?.freeBuyingCarcassesWeight.separatedByCommaFa ??
|
|
||||||
'0',
|
|
||||||
iconPath: Assets.vec.cubeSearchSvg.path,
|
iconPath: Assets.vec.cubeSearchSvg.path,
|
||||||
iconColor: Color(0xFF2D5FFF),
|
iconColor: Color(0xFF2D5FFF),
|
||||||
bgLabelColor: const Color(0xFFAFCBFF),
|
bgLabelColor: const Color(0xFFAFCBFF),
|
||||||
@@ -360,8 +328,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: _informationLabelCard(
|
child: _informationLabelCard(
|
||||||
title: 'مانده انبار',
|
title: 'مانده انبار',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.totalRemainWeight.separatedByCommaFa ?? '0',
|
||||||
data.value?.totalRemainWeight.separatedByCommaFa ?? '0',
|
|
||||||
iconPath: Assets.vec.cubeSearchSvg.path,
|
iconPath: Assets.vec.cubeSearchSvg.path,
|
||||||
bgDescriptionColor: const Color(0xFFEAEFFF),
|
bgDescriptionColor: const Color(0xFFEAEFFF),
|
||||||
bgLabelColor: const Color(0xFFBDD4FF),
|
bgLabelColor: const Color(0xFFBDD4FF),
|
||||||
@@ -372,8 +339,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: _informationLabelCard(
|
child: _informationLabelCard(
|
||||||
title: 'توزیع شده',
|
title: 'توزیع شده',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.realAllocatedWeight.separatedByCommaFa ?? '0',
|
||||||
data.value?.realAllocatedWeight.separatedByCommaFa ?? '0',
|
|
||||||
iconPath: Assets.vec.cubeRotateSvg.path,
|
iconPath: Assets.vec.cubeRotateSvg.path,
|
||||||
iconColor: Color(0xFF5C4D64),
|
iconColor: Color(0xFF5C4D64),
|
||||||
bgLabelColor: Color(0xFFC8B8D1),
|
bgLabelColor: Color(0xFFC8B8D1),
|
||||||
@@ -411,10 +377,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: Assets.vec.cubeScanSvg.svg(
|
child: Assets.vec.cubeScanSvg.svg(
|
||||||
width: 12.w,
|
width: 12.w,
|
||||||
height: 12.h,
|
height: 12.h,
|
||||||
colorFilter: const ColorFilter.mode(
|
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||||
Colors.white,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bgDescriptionColor: Colors.white,
|
bgDescriptionColor: Colors.white,
|
||||||
@@ -434,8 +397,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
title: 'درانتظار',
|
title: 'درانتظار',
|
||||||
borderColor: const Color(0xFF9758FF),
|
borderColor: const Color(0xFF9758FF),
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.totalNotEnteredBars.separatedByCommaFa ?? '0',
|
||||||
data.value?.totalNotEnteredBars.separatedByCommaFa ?? '0',
|
|
||||||
unit:
|
unit:
|
||||||
'(${data.value?.totalNotEnteredKillHouseRequestsWeight.separatedByCommaFa})\nکیلوگرم',
|
'(${data.value?.totalNotEnteredKillHouseRequestsWeight.separatedByCommaFa})\nکیلوگرم',
|
||||||
icon: Container(
|
icon: Container(
|
||||||
@@ -449,10 +411,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: Assets.vec.cubeCardFreeSvg.svg(
|
child: Assets.vec.cubeCardFreeSvg.svg(
|
||||||
width: 12.w,
|
width: 12.w,
|
||||||
height: 12.h,
|
height: 12.h,
|
||||||
colorFilter: const ColorFilter.mode(
|
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||||
Colors.white,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bgDescriptionColor: Colors.white,
|
bgDescriptionColor: Colors.white,
|
||||||
@@ -480,12 +439,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: _informationLabelCard(
|
child: _informationLabelCard(
|
||||||
title: 'مانده دولتی',
|
title: 'مانده دولتی',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.totalGovernmentalRemainWeight?.separatedByCommaFa ?? '0',
|
||||||
data
|
|
||||||
.value
|
|
||||||
?.totalGovernmentalRemainWeight
|
|
||||||
?.separatedByCommaFa ??
|
|
||||||
'0',
|
|
||||||
iconPath: Assets.vec.cubeCardGovermentSvg.path,
|
iconPath: Assets.vec.cubeCardGovermentSvg.path,
|
||||||
iconColor: AppColor.textColor,
|
iconColor: AppColor.textColor,
|
||||||
bgDescriptionColor: const Color(0xFFF5ECEE),
|
bgDescriptionColor: const Color(0xFFF5ECEE),
|
||||||
@@ -496,8 +450,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: _informationLabelCard(
|
child: _informationLabelCard(
|
||||||
title: 'مانده آزاد',
|
title: 'مانده آزاد',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
description:
|
description: data.value?.totalFreeRemainWeight.separatedByCommaFa ?? '0',
|
||||||
data.value?.totalFreeRemainWeight.separatedByCommaFa ?? '0',
|
|
||||||
unit: 'کیلوگرم',
|
unit: 'کیلوگرم',
|
||||||
iconPath: Assets.vec.cubeCardFreeSvg.path,
|
iconPath: Assets.vec.cubeCardFreeSvg.path,
|
||||||
iconColor: AppColor.textColor,
|
iconColor: AppColor.textColor,
|
||||||
@@ -545,10 +498,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
),
|
),
|
||||||
Divider(),
|
Divider(),
|
||||||
|
|
||||||
inventoryListItem(
|
inventoryListItem(title: 'کل فروش', value: model.realAllocatedWeight?.separatedByComma),
|
||||||
title: 'کل فروش',
|
|
||||||
value: model.realAllocatedWeight?.separatedByComma,
|
|
||||||
),
|
|
||||||
Divider(),
|
Divider(),
|
||||||
inventoryListItem(
|
inventoryListItem(
|
||||||
title: 'مانده انبار',
|
title: 'مانده انبار',
|
||||||
@@ -567,25 +517,14 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: const Color(0xFF353535), height: 1.2),
|
||||||
color: const Color(0xFF353535),
|
|
||||||
height: 1.2,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
value == null
|
value == null
|
||||||
? Center(child: CupertinoActivityIndicator())
|
? Center(child: CupertinoActivityIndicator())
|
||||||
: Text(
|
: Text(value, style: AppFonts.yekan14.copyWith(color: const Color(0xFF353535))),
|
||||||
value,
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: const Color(0xFF353535),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Text(
|
Text('کیلوگرم', style: AppFonts.yekan10.copyWith(color: const Color(0xFF353535))),
|
||||||
'کیلوگرم',
|
|
||||||
style: AppFonts.yekan10.copyWith(color: const Color(0xFF353535)),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -609,9 +548,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
height: 65.h,
|
height: 65.h,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
border: borderColor != null
|
border: borderColor != null ? Border.all(width: 1, color: borderColor) : null,
|
||||||
? Border.all(width: 1, color: borderColor)
|
|
||||||
: null,
|
|
||||||
),
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -670,16 +607,12 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Text(
|
Text(
|
||||||
description,
|
description,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
unit,
|
unit,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -725,9 +658,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
isLoading
|
isLoading
|
||||||
@@ -735,16 +666,12 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
: Text(
|
: Text(
|
||||||
description,
|
description,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
unit,
|
unit,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -804,14 +731,8 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
'کل ورودی به انبار (کیلوگرم)',
|
'کل ورودی به انبار (کیلوگرم)',
|
||||||
model.totalFreeBarsCarcassesWeight.toString(),
|
model.totalFreeBarsCarcassesWeight.toString(),
|
||||||
),
|
),
|
||||||
buildRow(
|
buildRow('کل فروش (کیلوگرم)', model.realAllocatedWeight.toString()),
|
||||||
'کل فروش (کیلوگرم)',
|
buildRow('مانده انبار (کیلوگرم)', model.totalRemainWeight.toString()),
|
||||||
model.realAllocatedWeight.toString(),
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
'مانده انبار (کیلوگرم)',
|
|
||||||
model.totalRemainWeight.toString(),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -830,9 +751,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
@@ -840,9 +759,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
value,
|
value,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -868,9 +785,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Text(
|
Text(
|
||||||
'اطلاعات ارسالی',
|
'اطلاعات ارسالی',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
buildRow(
|
buildRow(
|
||||||
@@ -903,10 +818,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
return Container(
|
return Container(
|
||||||
height: height?.h ?? 73.h,
|
height: height?.h ?? 73.h,
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(color: valueBgColor, borderRadius: BorderRadius.circular(8)),
|
||||||
color: valueBgColor,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
@@ -919,9 +831,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Text(
|
Text(
|
||||||
title ?? 'بدون تیتر',
|
title ?? 'بدون تیتر',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style:
|
style: titleStyle ?? AppFonts.yekan12.copyWith(color: const Color(0xFF3E3E3E)),
|
||||||
titleStyle ??
|
|
||||||
AppFonts.yekan12.copyWith(color: const Color(0xFF3E3E3E)),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -934,9 +844,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
value,
|
value,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style:
|
style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||||
valueStyle ??
|
|
||||||
AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Center(child: CupertinoActivityIndicator()),
|
: Center(child: CupertinoActivityIndicator()),
|
||||||
@@ -944,9 +852,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Text(
|
Text(
|
||||||
unit ?? 'کیلوگرم',
|
unit ?? 'کیلوگرم',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style:
|
style: unitStyle ?? AppFonts.yekan10.copyWith(color: Color(0xFF717171)),
|
||||||
unitStyle ??
|
|
||||||
AppFonts.yekan10.copyWith(color: Color(0xFF717171)),
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 4.h),
|
SizedBox(height: 4.h),
|
||||||
],
|
],
|
||||||
@@ -998,29 +904,19 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
Text(
|
Text('تعهدات', textAlign: TextAlign.right, style: AppFonts.yekan16),
|
||||||
'تعهدات',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
commitmentsItemList(
|
commitmentsItemList(
|
||||||
title: 'تعهد دولتی توزیع داخل استان',
|
title: 'تعهد دولتی توزیع داخل استان',
|
||||||
value: data
|
value: data.value?.totalCommitmentSellingInProvinceGovernmentalWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalCommitmentSellingInProvinceGovernmentalWeight
|
|
||||||
.separatedByComma,
|
|
||||||
labelColor: const Color(0xFFB9E8DC),
|
labelColor: const Color(0xFFB9E8DC),
|
||||||
bgColor: const Color(0xFFF3F9F8),
|
bgColor: const Color(0xFFF3F9F8),
|
||||||
),
|
),
|
||||||
commitmentsItemList(
|
commitmentsItemList(
|
||||||
title: 'توزیع دولتی داخل استان',
|
title: 'توزیع دولتی داخل استان',
|
||||||
value: data
|
value: data.value?.totalSellingInProvinceGovernmentalWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalSellingInProvinceGovernmentalWeight
|
|
||||||
.separatedByComma,
|
|
||||||
labelColor: const Color(0xFFC3D4F3),
|
labelColor: const Color(0xFFC3D4F3),
|
||||||
bgColor: const Color(0xFFECF3FF),
|
bgColor: const Color(0xFFECF3FF),
|
||||||
),
|
),
|
||||||
@@ -1035,26 +931,19 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
),
|
),
|
||||||
commitmentsItemList(
|
commitmentsItemList(
|
||||||
title: 'تعهد آزاد توزیع داخل استان',
|
title: 'تعهد آزاد توزیع داخل استان',
|
||||||
value: data
|
value: data.value?.totalCommitmentSellingInProvinceFreeWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalCommitmentSellingInProvinceFreeWeight
|
|
||||||
.separatedByComma,
|
|
||||||
labelColor: const Color(0xFFC7DADA),
|
labelColor: const Color(0xFFC7DADA),
|
||||||
bgColor: const Color(0xFFE5F7F7),
|
bgColor: const Color(0xFFE5F7F7),
|
||||||
),
|
),
|
||||||
commitmentsItemList(
|
commitmentsItemList(
|
||||||
title: 'توزیع آزاد داخل استان',
|
title: 'توزیع آزاد داخل استان',
|
||||||
value:
|
value: data.value?.totalSellingInProvinceFreeWeight.separatedByComma,
|
||||||
data.value?.totalSellingInProvinceFreeWeight.separatedByComma,
|
|
||||||
labelColor: const Color(0xFFE0D6ED),
|
labelColor: const Color(0xFFE0D6ED),
|
||||||
bgColor: const Color(0xFFF5EDFF),
|
bgColor: const Color(0xFFF5EDFF),
|
||||||
),
|
),
|
||||||
commitmentsItemList(
|
commitmentsItemList(
|
||||||
title: 'باقیمانده تعهد آزاد توزیع داخل استان',
|
title: 'باقیمانده تعهد آزاد توزیع داخل استان',
|
||||||
value: data
|
value: data.value?.totalCommitmentSellingInProvinceFreeRemainWeight.separatedByComma,
|
||||||
.value
|
|
||||||
?.totalCommitmentSellingInProvinceFreeRemainWeight
|
|
||||||
.separatedByComma,
|
|
||||||
labelColor: const Color(0xFFEBC5CE),
|
labelColor: const Color(0xFFEBC5CE),
|
||||||
bgColor: const Color(0xFFFFF1F4),
|
bgColor: const Color(0xFFFFF1F4),
|
||||||
),
|
),
|
||||||
@@ -1099,9 +988,7 @@ class HomePage extends GetView<HomeLogic> {
|
|||||||
: Text(
|
: Text(
|
||||||
value,
|
value,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 8.w),
|
SizedBox(width: 8.w),
|
||||||
|
|
||||||
|
|||||||
@@ -4,21 +4,7 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/datasources/local/chicken_local.dart';
|
import 'package:rasadyar_chicken/features/common/data/datasources/local/chicken_local.dart';
|
||||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/local/widely_used_local_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
|
||||||
hide ProductModel;
|
|
||||||
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/profile/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/buy/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/home/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sale/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/segmentation/view.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/local/widely_used_local_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/local/widely_used_local_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/inventory/inventory_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/inventory/inventory_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
@@ -35,7 +21,7 @@ import 'package:rasadyar_chicken/features/steward/presentation/pages/home/view.d
|
|||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/view.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/view.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/view.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/view.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
import 'package:rasadyar_chicken/presentation/routes/routes.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/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
@@ -46,27 +32,12 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
class StewardRootLogic extends GetxController {
|
class StewardRootLogic extends GetxController {
|
||||||
DateTime? _lastBackPressed;
|
DateTime? _lastBackPressed;
|
||||||
RxInt currentPage = 2.obs;
|
RxInt currentPage = 2.obs;
|
||||||
List<Widget> pages = [
|
List<Widget> pages = [BuyPage(), SalePage(), HomePage(), SegmentationPage(), ProfilePage()];
|
||||||
BuyPage(),
|
|
||||||
SalePage(),
|
|
||||||
HomePage(),
|
|
||||||
SegmentationPage(),
|
|
||||||
ProfilePage(),
|
|
||||||
];
|
|
||||||
|
|
||||||
final defaultRoutes = <int, String>{
|
final defaultRoutes = <int, String>{0: StewardRoutes.buySteward, 1: StewardRoutes.saleSteward};
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
|
||||||
0: ChickenRoutes.buySteward,
|
|
||||||
1: ChickenRoutes.saleSteward,
|
|
||||||
========
|
|
||||||
0: StewardRoutes.buySteward,
|
|
||||||
1: StewardRoutes.saleSteward,
|
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
|
||||||
};
|
|
||||||
RxList<ProductModel> rolesProductsModel = RxList<ProductModel>();
|
RxList<ProductModel> rolesProductsModel = RxList<ProductModel>();
|
||||||
Rxn<WidelyUsedLocalModel> widelyUsedList = Rxn<WidelyUsedLocalModel>();
|
Rxn<WidelyUsedLocalModel> widelyUsedList = Rxn<WidelyUsedLocalModel>();
|
||||||
Rxn<StewardSalesInfoDashboard> stewardSalesInfoDashboard =
|
Rxn<StewardSalesInfoDashboard> stewardSalesInfoDashboard = Rxn<StewardSalesInfoDashboard>();
|
||||||
Rxn<StewardSalesInfoDashboard>();
|
|
||||||
Rxn<StewardRemainWeight> stewardRemainWeight = Rxn<StewardRemainWeight>();
|
Rxn<StewardRemainWeight> stewardRemainWeight = Rxn<StewardRemainWeight>();
|
||||||
|
|
||||||
late DioRemote dioRemote;
|
late DioRemote dioRemote;
|
||||||
@@ -110,9 +81,7 @@ class StewardRootLogic extends GetxController {
|
|||||||
|
|
||||||
if (widelyUsedList.value?.hasInit != true) {
|
if (widelyUsedList.value?.hasInit != true) {
|
||||||
//TODO
|
//TODO
|
||||||
localDatasource.initWidleyUsed().then(
|
localDatasource.initWidleyUsed().then((value) => localDatasource.getAllWidely());
|
||||||
(value) => localDatasource.getAllWidely(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,17 +116,11 @@ class StewardRootLogic extends GetxController {
|
|||||||
// Cancel previous request if still running
|
// Cancel previous request if still running
|
||||||
_inventoryCancelToken?.cancel();
|
_inventoryCancelToken?.cancel();
|
||||||
_inventoryCancelToken = CancelToken();
|
_inventoryCancelToken = CancelToken();
|
||||||
|
/*
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
|
||||||
await safeCall<List<ProductModel>?>(
|
|
||||||
call: () async => await chickenRepository.getRolesProducts(
|
|
||||||
========
|
|
||||||
await safeCall<List<InventoryModel>?>(
|
await safeCall<List<InventoryModel>?>(
|
||||||
call: () async => await commonRepository.getInventory(
|
call: () async => await commonRepository.getInventory(
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
|
||||||
token: tokenService.accessToken.value!,
|
token: tokenService.accessToken.value!,
|
||||||
cancelToken: _inventoryCancelToken,
|
cancelToken: _inventoryCancelToken,
|
||||||
queryParameters: buildRawQueryParams(role: 'Steward'),
|
|
||||||
),
|
),
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
@@ -170,7 +133,7 @@ class StewardRootLogic extends GetxController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void rootErrorHandler(DioException error) {
|
void rootErrorHandler(DioException error) {
|
||||||
@@ -189,13 +152,7 @@ class StewardRootLogic extends GetxController {
|
|||||||
_provincesCancelToken = CancelToken();
|
_provincesCancelToken = CancelToken();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
final res = await commonRepository.getProvince(cancelToken: _provincesCancelToken);
|
||||||
final res = await chickenRepository.getProvince(
|
|
||||||
========
|
|
||||||
final res = await commonRepository.getProvince(
|
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
|
||||||
cancelToken: _provincesCancelToken,
|
|
||||||
);
|
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
provinces.clear();
|
provinces.clear();
|
||||||
provinces.value = res;
|
provinces.value = res;
|
||||||
@@ -211,15 +168,8 @@ class StewardRootLogic extends GetxController {
|
|||||||
|
|
||||||
Future<void> getRolesProducts() async {
|
Future<void> getRolesProducts() async {
|
||||||
safeCall(
|
safeCall(
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
call: () async =>
|
||||||
call: () async => await chickenRepository.getRolesProducts(
|
await commonRepository.getRolesProducts(token: tokenService.accessToken.value!),
|
||||||
token: tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(role: 'Steward'),
|
|
||||||
========
|
|
||||||
call: () async => await commonRepository.getRolesProducts(
|
|
||||||
token: tokenService.accessToken.value!,
|
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
rolesProductsModel.value = result;
|
rolesProductsModel.value = result;
|
||||||
@@ -246,13 +196,8 @@ class StewardRootLogic extends GetxController {
|
|||||||
|
|
||||||
Future<void> getStewardRemainWeightData() async {
|
Future<void> getStewardRemainWeightData() async {
|
||||||
safeCall(
|
safeCall(
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
call: () async =>
|
||||||
call: () async => await chickenRepository.getStewardRemainWeight(
|
await stewardRepository.getStewardRemainWeight(token: tokenService.accessToken.value!),
|
||||||
========
|
|
||||||
call: () async => await stewardRepository.getStewardRemainWeight(
|
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
|
||||||
token: tokenService.accessToken.value!,
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
stewardRemainWeight.value = result;
|
stewardRemainWeight.value = result;
|
||||||
@@ -292,8 +237,7 @@ class StewardRootLogic extends GetxController {
|
|||||||
currentNestedKey?.currentState?.popUntil((route) => route.isFirst);
|
currentNestedKey?.currentState?.popUntil((route) => route.isFirst);
|
||||||
} else {
|
} else {
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
if (_lastBackPressed == null ||
|
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
||||||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
|
||||||
_lastBackPressed = now;
|
_lastBackPressed = now;
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'خروج از برنامه',
|
'خروج از برنامه',
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/chicken.dart';
|
import 'package:rasadyar_chicken/chicken.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/view.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/view.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_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
@@ -31,9 +27,8 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
onGenerateRoute: (settings) {
|
onGenerateRoute: (settings) {
|
||||||
final page = ChickenPages.pages.firstWhere(
|
final page = ChickenPages.pages.firstWhere(
|
||||||
(e) => e.name == settings.name,
|
(e) => e.name == settings.name,
|
||||||
orElse: () => ChickenPages.pages.firstWhere(
|
orElse: () =>
|
||||||
(e) => e.name == StewardRoutes.buySteward,
|
ChickenPages.pages.firstWhere((e) => e.name == StewardRoutes.buySteward),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return buildRouteFromGetPage(page);
|
return buildRouteFromGetPage(page);
|
||||||
@@ -44,9 +39,8 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
onGenerateRoute: (settings) {
|
onGenerateRoute: (settings) {
|
||||||
final page = ChickenPages.pages.firstWhere(
|
final page = ChickenPages.pages.firstWhere(
|
||||||
(e) => e.name == settings.name,
|
(e) => e.name == settings.name,
|
||||||
orElse: () => ChickenPages.pages.firstWhere(
|
orElse: () =>
|
||||||
(e) => e.name == StewardRoutes.saleSteward,
|
ChickenPages.pages.firstWhere((e) => e.name == StewardRoutes.saleSteward),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return buildRouteFromGetPage(page);
|
return buildRouteFromGetPage(page);
|
||||||
@@ -54,18 +48,15 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
),
|
),
|
||||||
Navigator(
|
Navigator(
|
||||||
key: Get.nestedKey(stewardThirdKey),
|
key: Get.nestedKey(stewardThirdKey),
|
||||||
onGenerateRoute: (settings) =>
|
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[2]),
|
||||||
GetPageRoute(page: () => controller.pages[2]),
|
|
||||||
),
|
),
|
||||||
Navigator(
|
Navigator(
|
||||||
key: Get.nestedKey(stewardFourthKey),
|
key: Get.nestedKey(stewardFourthKey),
|
||||||
onGenerateRoute: (settings) =>
|
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[3]),
|
||||||
GetPageRoute(page: () => controller.pages[3]),
|
|
||||||
),
|
),
|
||||||
Navigator(
|
Navigator(
|
||||||
key: Get.nestedKey(stewardFifthKey),
|
key: Get.nestedKey(stewardFifthKey),
|
||||||
onGenerateRoute: (settings) =>
|
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[4]),
|
||||||
GetPageRoute(page: () => controller.pages[4]),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
index: data.value,
|
index: data.value,
|
||||||
@@ -161,10 +152,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
return Container(
|
return Container(
|
||||||
height: 70,
|
height: 70,
|
||||||
width: Get.width / 2,
|
width: Get.width / 2,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -185,9 +173,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
Text(
|
Text(
|
||||||
'بارهای امروز',
|
'بارهای امروز',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -254,9 +240,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -279,16 +263,12 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
Text(
|
Text(
|
||||||
description,
|
description,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
unit,
|
unit,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -333,23 +313,17 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
description,
|
description,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
unit,
|
unit,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -397,18 +371,14 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
padding: EdgeInsets.all(4),
|
padding: EdgeInsets.all(4),
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: const Color(0xFFBECDFF),
|
color: const Color(0xFFBECDFF),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 40,
|
width: 40,
|
||||||
height: 40,
|
height: 40,
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: AppColor.blueNormal,
|
color: AppColor.blueNormal,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: SvgGenImage.vec(iconPath).svg(
|
child: SvgGenImage.vec(iconPath).svg(
|
||||||
width: 24,
|
width: 24,
|
||||||
@@ -418,10 +388,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(title, style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
|
||||||
title,
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -438,24 +405,16 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
padding: EdgeInsets.all(4),
|
padding: EdgeInsets.all(4),
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: const Color(0xFFD9F7F0),
|
color: const Color(0xFFD9F7F0),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Assets.vec.messageAddSvg.svg(
|
child: Assets.vec.messageAddSvg.svg(
|
||||||
width: 40,
|
width: 40,
|
||||||
height: 40,
|
height: 40,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(AppColor.greenNormal, BlendMode.srcIn),
|
||||||
AppColor.greenNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text('افزودن', style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover)),
|
||||||
'افزودن',
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -602,9 +561,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
@@ -612,9 +569,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
value,
|
value,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -640,9 +595,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
|||||||
Text(
|
Text(
|
||||||
'اطلاعات ارسالی',
|
'اطلاعات ارسالی',
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
buildRow(
|
buildRow(
|
||||||
|
|||||||
@@ -1,29 +1,19 @@
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sale/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sale/logic.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class SaleLogic extends GetxController {
|
class SaleLogic extends GetxController {
|
||||||
Rxn<List<AllocatedMadeModel>?> allocatedMadeModel =
|
Rxn<List<AllocatedMadeModel>?> allocatedMadeModel = Rxn<List<AllocatedMadeModel>?>();
|
||||||
Rxn<List<AllocatedMadeModel>?>();
|
|
||||||
|
|
||||||
RxList<GuildModel> guildsModel = <GuildModel>[].obs;
|
RxList<GuildModel> guildsModel = <GuildModel>[].obs;
|
||||||
|
|
||||||
Rxn<StewardFreeBarDashboard> stewardFreeDashboard =
|
Rxn<StewardFreeBarDashboard> stewardFreeDashboard = Rxn<StewardFreeBarDashboard>();
|
||||||
Rxn<StewardFreeBarDashboard>();
|
|
||||||
|
|
||||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
||||||
|
|
||||||
@@ -40,12 +30,7 @@ class SaleLogic extends GetxController {
|
|||||||
safeCall(
|
safeCall(
|
||||||
call: () async => await rootLogic.stewardRepository.getAllocatedMade(
|
call: () async => await rootLogic.stewardRepository.getAllocatedMade(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
queryParameters: buildQueryParams(
|
queryParameters: buildQueryParams(page: 1, pageSize: 20, search: 'filter', role: 'Steward'),
|
||||||
page: 1,
|
|
||||||
pageSize: 20,
|
|
||||||
search: 'filter',
|
|
||||||
role: 'Steward',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
@@ -88,8 +73,7 @@ class SaleLogic extends GetxController {
|
|||||||
safeCall(
|
safeCall(
|
||||||
call: () async => await rootLogic.stewardRepository.confirmAllAllocation(
|
call: () async => await rootLogic.stewardRepository.confirmAllAllocation(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
allocationTokens:
|
allocationTokens: allocatedMadeModel.value?.map((e) => e.key!).toList() ?? [],
|
||||||
allocatedMadeModel.value?.map((e) => e.key!).toList() ?? [],
|
|
||||||
),
|
),
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
getAllocatedMade();
|
getAllocatedMade();
|
||||||
@@ -132,8 +116,7 @@ class SaleLogic extends GetxController {
|
|||||||
|
|
||||||
void onPopScopTaped() async {
|
void onPopScopTaped() async {
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
if (_lastBackPressed == null ||
|
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
||||||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
|
||||||
_lastBackPressed = now;
|
_lastBackPressed = now;
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'خروج از برنامه',
|
'خروج از برنامه',
|
||||||
|
|||||||
@@ -1,18 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/submit_steward_allocation/submit_steward_allocation.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/submit_steward_allocation/submit_steward_allocation.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
||||||
@@ -23,7 +14,6 @@ import 'package:rasadyar_chicken/features/common/data/model/response/roles_produ
|
|||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_remain_weight/steward_remain_weight.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_in_province/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
@@ -69,8 +59,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
final RxBool hasMoreDataAllocationsMade = true.obs;
|
final RxBool hasMoreDataAllocationsMade = true.obs;
|
||||||
|
|
||||||
Rxn<BroadcastPrice> broadcastPrice = Rxn<BroadcastPrice>();
|
Rxn<BroadcastPrice> broadcastPrice = Rxn<BroadcastPrice>();
|
||||||
Rxn<AllocatedMadeModel> selectedAllocationModelForUpdate =
|
Rxn<AllocatedMadeModel> selectedAllocationModelForUpdate = Rxn<AllocatedMadeModel>();
|
||||||
Rxn<AllocatedMadeModel>();
|
|
||||||
SubmitStewardAllocation? tmpStewardAllocation;
|
SubmitStewardAllocation? tmpStewardAllocation;
|
||||||
|
|
||||||
Rxn<Jalali> productionDate = Rxn(null);
|
Rxn<Jalali> productionDate = Rxn(null);
|
||||||
@@ -147,8 +136,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateGovernmentalProductionDateData() {
|
void _updateGovernmentalProductionDateData() {
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
/* List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||||
/* List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
|
||||||
========
|
========
|
||||||
List<RemainWeightDay> dates =
|
List<RemainWeightDay> dates =
|
||||||
rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||||
@@ -162,7 +150,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateFreeProductionDateData() {
|
void _updateFreeProductionDateData() {
|
||||||
/* var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
/* var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
||||||
freeProductionDateData = {
|
freeProductionDateData = {
|
||||||
for (var element in dates)
|
for (var element in dates)
|
||||||
element.day.toString().toJalali.formatCompactDate(): DayData(
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
@@ -175,8 +163,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
allocatedList.value =
|
allocatedList.value = Resource<PaginationModel<AllocatedMadeModel>>.loading();
|
||||||
Resource<PaginationModel<AllocatedMadeModel>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -185,8 +172,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
currentPage.value = 1; // Reset to first page if search value is set
|
currentPage.value = 1; // Reset to first page if search value is set
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
/* safeCall(
|
||||||
/* safeCall(
|
|
||||||
call: () async => await rootLogic.chickenRepository.getAllocatedMade(
|
call: () async => await rootLogic.chickenRepository.getAllocatedMade(
|
||||||
========
|
========
|
||||||
safeCall(
|
safeCall(
|
||||||
@@ -233,20 +219,15 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
isLoadingMoreAllocationsMade.value = false;
|
isLoadingMoreAllocationsMade.value = false;
|
||||||
},
|
},
|
||||||
); */
|
); */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkVerification() {
|
void checkVerification() {
|
||||||
var hasWeight = quotaType.value == 1
|
var hasWeight = quotaType.value == 1
|
||||||
? weight.value <=
|
? weight.value <=
|
||||||
(governmentalProductionDateData[productionDate.value
|
(governmentalProductionDateData[productionDate.value?.formatCompactDate()]?.value ??
|
||||||
?.formatCompactDate()]
|
|
||||||
?.value ??
|
|
||||||
0)
|
0)
|
||||||
: weight.value <=
|
: weight.value <=
|
||||||
(freeProductionDateData[productionDate.value?.formatCompactDate()]
|
(freeProductionDateData[productionDate.value?.formatCompactDate()]?.value ?? 0);
|
||||||
?.value ??
|
|
||||||
0);
|
|
||||||
|
|
||||||
isValid.value =
|
isValid.value =
|
||||||
weight.value > 0 &&
|
weight.value > 0 &&
|
||||||
@@ -258,8 +239,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void confirmAllocation(ConformAllocation allocation) {
|
void confirmAllocation(ConformAllocation allocation) {
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
/* safeCall(
|
||||||
/* safeCall(
|
|
||||||
call: () async => await rootLogic.chickenRepository.confirmAllocation(
|
call: () async => await rootLogic.chickenRepository.confirmAllocation(
|
||||||
========
|
========
|
||||||
safeCall(
|
safeCall(
|
||||||
@@ -276,8 +256,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void denyAllocation(String token) {
|
void denyAllocation(String token) {
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
/* safeCall(
|
||||||
/* safeCall(
|
|
||||||
call: () async => await rootLogic.chickenRepository.denyAllocation(
|
call: () async => await rootLogic.chickenRepository.denyAllocation(
|
||||||
========
|
========
|
||||||
safeCall(
|
safeCall(
|
||||||
@@ -294,7 +273,6 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> confirmAllAllocations() async {
|
Future<void> confirmAllAllocations() async {
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
|
||||||
/* safeCall(
|
/* safeCall(
|
||||||
call: () async => await rootLogic.chickenRepository.confirmAllAllocation(
|
call: () async => await rootLogic.chickenRepository.confirmAllAllocation(
|
||||||
========
|
========
|
||||||
@@ -314,8 +292,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getRolesProducts() async {
|
Future<void> getRolesProducts() async {
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
/* safeCall(
|
||||||
/* safeCall(
|
|
||||||
call: () async => await rootLogic.chickenRepository.getRolesProducts(
|
call: () async => await rootLogic.chickenRepository.getRolesProducts(
|
||||||
========
|
========
|
||||||
safeCall(
|
safeCall(
|
||||||
@@ -335,8 +312,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getGuilds() async {
|
Future<void> getGuilds() async {
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
/* safeCall(
|
||||||
/* safeCall(
|
|
||||||
call: () async => await rootLogic.chickenRepository.getGuilds(
|
call: () async => await rootLogic.chickenRepository.getGuilds(
|
||||||
========
|
========
|
||||||
safeCall(
|
safeCall(
|
||||||
@@ -372,8 +348,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getGuildProfile() async {
|
Future<void> getGuildProfile() async {
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
/* await safeCall(
|
||||||
/* await safeCall(
|
|
||||||
call: () async => await rootLogic.chickenRepository.getProfile(
|
call: () async => await rootLogic.chickenRepository.getProfile(
|
||||||
========
|
========
|
||||||
await safeCall(
|
await safeCall(
|
||||||
@@ -394,17 +369,13 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
allocationType:
|
allocationType:
|
||||||
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}',
|
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}',
|
||||||
sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild",
|
sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild",
|
||||||
buyerType: selectedGuildModel.value?.steward == true
|
buyerType: selectedGuildModel.value?.steward == true ? "Steward" : "Guild",
|
||||||
? "Steward"
|
|
||||||
: "Guild",
|
|
||||||
amount: pricePerKilo.value,
|
amount: pricePerKilo.value,
|
||||||
totalAmount: totalCost.value,
|
totalAmount: totalCost.value,
|
||||||
weightOfCarcasses: weight.value,
|
weightOfCarcasses: weight.value,
|
||||||
sellType: saleType.value == 2 ? "free" : 'exclusive',
|
sellType: saleType.value == 2 ? "free" : 'exclusive',
|
||||||
numberOfCarcasses: 0,
|
numberOfCarcasses: 0,
|
||||||
productionDate: productionDate.value
|
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||||
?.toDateTime()
|
|
||||||
.formattedDashedGregorian,
|
|
||||||
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
||||||
guildKey: selectedGuildModel.value?.key,
|
guildKey: selectedGuildModel.value?.key,
|
||||||
productKey: selectedProductModel.value?.key,
|
productKey: selectedProductModel.value?.key,
|
||||||
@@ -416,7 +387,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
Future<void> submitAllocation() async {
|
Future<void> submitAllocation() async {
|
||||||
setSubmitData();
|
setSubmitData();
|
||||||
|
|
||||||
/* safeCall(
|
/* safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () async =>
|
call: () async =>
|
||||||
await rootLogic.stewardRepository.postSubmitStewardAllocation(
|
await rootLogic.stewardRepository.postSubmitStewardAllocation(
|
||||||
@@ -439,8 +410,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteAllocation(AllocatedMadeModel model) async {
|
Future<void> deleteAllocation(AllocatedMadeModel model) async {
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
/* safeCall(
|
||||||
/* safeCall(
|
|
||||||
call: () async => await rootLogic.chickenRepository.deleteStewardAllocation(
|
call: () async => await rootLogic.chickenRepository.deleteStewardAllocation(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
queryParameters: {'steward_allocation_key': model.key},
|
queryParameters: {'steward_allocation_key': model.key},
|
||||||
@@ -476,9 +446,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
pricePerKilo.value = item.amount ?? 0;
|
pricePerKilo.value = item.amount ?? 0;
|
||||||
totalCost.value = item.totalAmount ?? 0;
|
totalCost.value = item.totalAmount ?? 0;
|
||||||
weightController.text = weight.value.toString().separatedByComma;
|
weightController.text = weight.value.toString().separatedByComma;
|
||||||
pricePerKiloController.text = pricePerKilo.value
|
pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
|
||||||
.toString()
|
|
||||||
.separatedByComma;
|
|
||||||
totalCostController.text = totalCost.value.toString().separatedByComma;
|
totalCostController.text = totalCost.value.toString().separatedByComma;
|
||||||
isValid.value = true;
|
isValid.value = true;
|
||||||
productionDate.value = item.productionDate.toJalali;
|
productionDate.value = item.productionDate.toJalali;
|
||||||
@@ -510,7 +478,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
weight_of_carcasses: weight.value,
|
weight_of_carcasses: weight.value,
|
||||||
);
|
);
|
||||||
|
|
||||||
/* safeCall(
|
/* safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () async =>
|
call: () async =>
|
||||||
await rootLogic.stewardRepository.updateStewardAllocation(
|
await rootLogic.stewardRepository.updateStewardAllocation(
|
||||||
@@ -563,8 +531,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getBroadcastPrice() async {
|
Future<void> getBroadcastPrice() async {
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
/* safeCall(
|
||||||
/* safeCall(
|
|
||||||
call: () async => await rootLogic.chickenRepository.getBroadcastPrice(
|
call: () async => await rootLogic.chickenRepository.getBroadcastPrice(
|
||||||
========
|
========
|
||||||
safeCall(
|
safeCall(
|
||||||
@@ -590,11 +557,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
|||||||
toggleExpansion();
|
toggleExpansion();
|
||||||
currentPage.value = 1;
|
currentPage.value = 1;
|
||||||
hasMoreDataAllocationsMade.value = true;
|
hasMoreDataAllocationsMade.value = true;
|
||||||
await Future.wait([
|
await Future.wait([getAllocatedMade(), getRolesProducts(), rootLogic.onRefresh()]);
|
||||||
getAllocatedMade(),
|
|
||||||
getRolesProducts(),
|
|
||||||
rootLogic.onRefresh(),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpansion({int? index}) {
|
void toggleExpansion({int? index}) {
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_in_province/view.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sales_in_province/widgets/cu_sale_in_provience.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_in_province/widgets/cu_sale_in_provience.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_in_province/widgets/cu_sale_in_provience.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_in_province/view.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/utils/string_utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||||
@@ -15,7 +12,7 @@ import 'package:rasadyar_core/core.dart' hide modalDatePicker;
|
|||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
class SalesInProvincePage extends GetView<WarehouseAndDistributionSalesInProvinceLogic> {
|
||||||
SalesInProvincePage({super.key});
|
SalesInProvincePage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -33,7 +30,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
|||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Obx(() {
|
Obx(() {
|
||||||
var list = [
|
var list = [
|
||||||
InventoryItemData(
|
InventoryItemData(
|
||||||
title: 'موجودی انبار',
|
title: 'موجودی انبار',
|
||||||
@@ -71,7 +68,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
|||||||
|
|
||||||
return InventoryWidget(inventoryModel: list);
|
return InventoryWidget(inventoryModel: list);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ObxValue((data) {
|
child: ObxValue((data) {
|
||||||
return RPaginatedListView(
|
return RPaginatedListView(
|
||||||
@@ -141,7 +138,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await controller.confirmAllAllocations();
|
await controller.confirmAllAllocations();
|
||||||
controller.getAllocatedMade();
|
controller.getAllocatedMade();
|
||||||
controller.rootLogic.getRolesProduct();
|
//controller.rootLogic.getRolesProduct();
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
child: Text('تایید'),
|
child: Text('تایید'),
|
||||||
@@ -487,7 +484,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GestureDetector timeFilterWidget({
|
GestureDetector timeFilterWidget({
|
||||||
required SalesInProvinceLogic controller,
|
required WarehouseAndDistributionSalesInProvinceLogic controller,
|
||||||
isFrom = true,
|
isFrom = true,
|
||||||
required Rx<Jalali> date,
|
required Rx<Jalali> date,
|
||||||
required Function(Jalali jalali) onChanged,
|
required Function(Jalali jalali) onChanged,
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_in_province/widgets/cu_sale_in_provience.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sales_in_province/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_in_province/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_in_province/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_in_province/widgets/cu_sale_in_provience.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
Widget addOrEditBottomSheet(SalesInProvinceLogic controller, {bool isEditMode = false}) {
|
Widget addOrEditBottomSheet(
|
||||||
|
WarehouseAndDistributionSalesInProvinceLogic controller, {
|
||||||
|
bool isEditMode = false,
|
||||||
|
}) {
|
||||||
return BaseBottomSheet(
|
return BaseBottomSheet(
|
||||||
height: Get.height * (isEditMode ? 0.60 : 0.75),
|
height: Get.height * (isEditMode ? 0.60 : 0.75),
|
||||||
child: Form(
|
child: Form(
|
||||||
@@ -300,7 +298,7 @@ Widget addOrEditBottomSheet(SalesInProvinceLogic controller, {bool isEditMode =
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget guildsDropDown(SalesInProvinceLogic controller) {
|
Widget guildsDropDown(WarehouseAndDistributionSalesInProvinceLogic controller) {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
final item = controller.selectedGuildModel.value;
|
final item = controller.selectedGuildModel.value;
|
||||||
|
|
||||||
@@ -350,7 +348,7 @@ Widget guildsDropDown(SalesInProvinceLogic controller) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget productDropDown(SalesInProvinceLogic controller) {
|
Widget productDropDown(WarehouseAndDistributionSalesInProvinceLogic controller) {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
return OverlayDropdownWidget<ProductModel>(
|
return OverlayDropdownWidget<ProductModel>(
|
||||||
items: controller.rolesProductsModel,
|
items: controller.rolesProductsModel,
|
||||||
@@ -439,7 +437,7 @@ Container modalDatePicker(ValueChanged<Jalali> onDateSelected) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget show2StepAddBottomSheet(SalesInProvinceLogic controller) {
|
Widget show2StepAddBottomSheet(WarehouseAndDistributionSalesInProvinceLogic controller) {
|
||||||
return BaseBottomSheet(
|
return BaseBottomSheet(
|
||||||
height: Get.height * .39,
|
height: Get.height * .39,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -1,17 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_out_of_province/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sale/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sales_out_of_province_buyers/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sales_out_of_province_sales_list/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/broadcast_price/broadcast_price.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/broadcast_price/broadcast_price.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
@@ -23,7 +11,7 @@ import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.
|
|||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_buyers/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_buyers/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_sales_list/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_sales_list/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_out_of_province/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -32,11 +20,9 @@ class SalesOutOfProvinceLogic extends GetxController {
|
|||||||
|
|
||||||
SaleLogic saleLogic = Get.find<SaleLogic>();
|
SaleLogic saleLogic = Get.find<SaleLogic>();
|
||||||
|
|
||||||
SalesOutOfProvinceSalesListLogic saleListLogic =
|
SalesOutOfProvinceSalesListLogic saleListLogic = Get.find<SalesOutOfProvinceSalesListLogic>();
|
||||||
Get.find<SalesOutOfProvinceSalesListLogic>();
|
|
||||||
|
|
||||||
SalesOutOfProvinceBuyersLogic buyerLogic =
|
SalesOutOfProvinceBuyersLogic buyerLogic = Get.find<SalesOutOfProvinceBuyersLogic>();
|
||||||
Get.find<SalesOutOfProvinceBuyersLogic>();
|
|
||||||
|
|
||||||
RxBool isExpanded = false.obs;
|
RxBool isExpanded = false.obs;
|
||||||
RxInt currentPage = 1.obs;
|
RxInt currentPage = 1.obs;
|
||||||
@@ -115,8 +101,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateGovernmentalProductionDateData() {
|
void _updateGovernmentalProductionDateData() {
|
||||||
List<RemainWeightDay> dates =
|
List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||||
rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
|
||||||
governmentalProductionDateData = {
|
governmentalProductionDateData = {
|
||||||
for (var element in dates)
|
for (var element in dates)
|
||||||
element.day.toString().toJalali.formatCompactDate(): DayData(
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
@@ -167,21 +152,16 @@ class SalesOutOfProvinceLogic extends GetxController {
|
|||||||
),
|
),
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
salesList.value =
|
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.empty();
|
||||||
Resource<PaginationModel<StewardFreeSaleBar>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
salesList.value =
|
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.success(
|
||||||
Resource<PaginationModel<StewardFreeSaleBar>>.success(
|
PaginationModel<StewardFreeSaleBar>(
|
||||||
PaginationModel<StewardFreeSaleBar>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [...(salesList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
results: [
|
),
|
||||||
...(salesList.value.data?.results ?? []),
|
);
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
isLoadingMoreAllocationsMade.value = false;
|
isLoadingMoreAllocationsMade.value = false;
|
||||||
}
|
}
|
||||||
@@ -195,8 +175,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
|||||||
saleWeightController.addListener(() {
|
saleWeightController.addListener(() {
|
||||||
checkSalesFormValid();
|
checkSalesFormValid();
|
||||||
weight.value = int.parse(saleWeightController.text.clearComma);
|
weight.value = int.parse(saleWeightController.text.clearComma);
|
||||||
var res = (weight / selectedProduct.value!.weightAverage!.toInt())
|
var res = (weight / selectedProduct.value!.weightAverage!.toInt()).round();
|
||||||
.round();
|
|
||||||
saleCountController.text = res.separatedByComma;
|
saleCountController.text = res.separatedByComma;
|
||||||
});
|
});
|
||||||
ever(selectedBuyer, (_) => checkSalesFormValid);
|
ever(selectedBuyer, (_) => checkSalesFormValid);
|
||||||
@@ -215,8 +194,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
|||||||
|
|
||||||
void setEditDataSales(StewardFreeSaleBar item) {
|
void setEditDataSales(StewardFreeSaleBar item) {
|
||||||
quarantineCodeController.text = item.clearanceCode ?? '';
|
quarantineCodeController.text = item.clearanceCode ?? '';
|
||||||
saleWeightController.text =
|
saleWeightController.text = item.weightOfCarcasses?.toInt().toString() ?? '';
|
||||||
item.weightOfCarcasses?.toInt().toString() ?? '';
|
|
||||||
saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!));
|
saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!));
|
||||||
selectedCity.value = IranProvinceCityModel(name: item.city);
|
selectedCity.value = IranProvinceCityModel(name: item.city);
|
||||||
selectedBuyer.value = buyerLogic.buyerList.value.data?.results?.firstWhere(
|
selectedBuyer.value = buyerLogic.buyerList.value.data?.results?.firstWhere(
|
||||||
@@ -228,9 +206,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
|||||||
quotaType.value = item.quota == 'governmental' ? 1 : 2;
|
quotaType.value = item.quota == 'governmental' ? 1 : 2;
|
||||||
isSaleSubmitButtonEnabled.value = true;
|
isSaleSubmitButtonEnabled.value = true;
|
||||||
productionDate.value = item.productionDate.toJalali;
|
productionDate.value = item.productionDate.toJalali;
|
||||||
pricePerKiloController.text = pricePerKilo.value
|
pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
|
||||||
.toString()
|
|
||||||
.separatedByComma;
|
|
||||||
totalCostController.text = totalCost.value.toString().separatedByComma;
|
totalCostController.text = totalCost.value.toString().separatedByComma;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,16 +230,10 @@ class SalesOutOfProvinceLogic extends GetxController {
|
|||||||
productKey: selectedProduct.value?.key,
|
productKey: selectedProduct.value?.key,
|
||||||
saleType: saleType.value == 2 ? 'free' : 'exclusive',
|
saleType: saleType.value == 2 ? 'free' : 'exclusive',
|
||||||
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_out_of_province/logic.dart
|
|
||||||
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||||
distributionType: 'App',
|
|
||||||
);
|
|
||||||
========
|
|
||||||
productionDate: productionDate.value
|
|
||||||
?.toDateTime()
|
|
||||||
.formattedDashedGregorian,
|
|
||||||
);
|
);
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_out_of_province/logic.dart
|
|
||||||
await safeCall(
|
await safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
call: () => rootLogic.stewardRepository.createOutProvinceStewardFreeBar(
|
call: () => rootLogic.stewardRepository.createOutProvinceStewardFreeBar(
|
||||||
@@ -409,9 +379,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
|||||||
saleDate.value = Jalali.now();
|
saleDate.value = Jalali.now();
|
||||||
Future.delayed(
|
Future.delayed(
|
||||||
Duration(milliseconds: 300),
|
Duration(milliseconds: 300),
|
||||||
() => defaultShowErrorMessage(
|
() => defaultShowErrorMessage("تاریخ تولید نمی تواند قبل از تاریخ فروش باشد"),
|
||||||
"تاریخ تولید نمی تواند قبل از تاریخ فروش باشد",
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_out_of_province/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
||||||
@@ -14,7 +15,8 @@ import 'package:rasadyar_core/core.dart';
|
|||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAndDistributionSalesOutOfProvinceLogic> {
|
class WarehouseAndDistributionSalesOutOfProvincePage
|
||||||
|
extends GetView<WarehouseAndDistributionSalesOutOfProvinceLogic> {
|
||||||
const WarehouseAndDistributionSalesOutOfProvincePage({super.key});
|
const WarehouseAndDistributionSalesOutOfProvincePage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -32,12 +34,10 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// inventoryWidget(controller.rootLogic),
|
// inventoryWidget(controller.rootLogic),
|
||||||
|
|
||||||
ObxValue((data) {
|
ObxValue((data) {
|
||||||
return RPaginatedListView(
|
return RPaginatedListView(
|
||||||
onLoadMore: () async =>
|
onLoadMore: () async => controller.getOutProvinceSales(true),
|
||||||
controller.getOutProvinceSales(true),
|
|
||||||
hasMore: data.value.data?.next != null,
|
hasMore: data.value.data?.next != null,
|
||||||
listType: ListType.separated,
|
listType: ListType.separated,
|
||||||
resource: data.value,
|
resource: data.value,
|
||||||
@@ -71,27 +71,19 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
children: [
|
children: [
|
||||||
RFab.add(
|
RFab.add(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.bottomSheet(
|
Get.bottomSheet(addOrEditSaleBottomSheet(), isScrollControlled: true).then((
|
||||||
addOrEditSaleBottomSheet(),
|
value,
|
||||||
isScrollControlled: true,
|
) {
|
||||||
).then((value) {
|
|
||||||
controller.clearSaleForm();
|
controller.clearSaleForm();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
RFab(
|
RFab(
|
||||||
icon: Icon(
|
icon: Icon(CupertinoIcons.person_add_solid, color: Colors.white, size: 35.w),
|
||||||
CupertinoIcons.person_add_solid,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 35.w,
|
|
||||||
),
|
|
||||||
backgroundColor: AppColor.blueNormal,
|
backgroundColor: AppColor.blueNormal,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.toNamed(
|
Get.toNamed(StewardRoutes.salesOutOfProvinceBuyerSteward, id: stewardSecondKey);
|
||||||
StewardRoutes.salesOutOfProvinceBuyerSteward,
|
|
||||||
id: stewardSecondKey,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: 25),
|
SizedBox(width: 25),
|
||||||
@@ -185,10 +177,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
Container itemListExpandedWidget(StewardFreeSaleBar item, int index) {
|
Container itemListExpandedWidget(StewardFreeSaleBar item, int index) {
|
||||||
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: [
|
||||||
@@ -220,16 +209,12 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||||
color: AppColor.textColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -246,10 +231,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
buildRow(
|
buildRow(title: 'مشخصات خریدار', value: item.buyer?.fullname ?? 'ندارد'),
|
||||||
title: 'مشخصات خریدار',
|
|
||||||
value: item.buyer?.fullname ?? 'ندارد',
|
|
||||||
),
|
|
||||||
buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'ندارد'),
|
buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'ندارد'),
|
||||||
buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'ندارد'),
|
buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'ندارد'),
|
||||||
buildRow(
|
buildRow(
|
||||||
@@ -267,10 +249,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
value: item.productionDate?.toJalali.formatCompactDate() ?? 'ندارد',
|
value: item.productionDate?.toJalali.formatCompactDate() ?? 'ندارد',
|
||||||
),
|
),
|
||||||
buildRow(title: 'انبار فروش', value: '${item.quota?.faTitle}'),
|
buildRow(title: 'انبار فروش', value: '${item.quota?.faTitle}'),
|
||||||
buildRow(
|
buildRow(title: 'کد قرنطینه ', value: item.clearanceCode ?? 'بدون کد'),
|
||||||
title: 'کد قرنطینه ',
|
|
||||||
value: item.clearanceCode ?? 'بدون کد',
|
|
||||||
),
|
|
||||||
|
|
||||||
buildRow(
|
buildRow(
|
||||||
title: 'حجم تقریبی لاشه ',
|
title: 'حجم تقریبی لاشه ',
|
||||||
@@ -283,9 +262,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'کد احراز',
|
'کد احراز',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
RElevated(
|
RElevated(
|
||||||
@@ -295,9 +272,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
backgroundColor: AppColor.blueDarkHover,
|
backgroundColor: AppColor.blueDarkHover,
|
||||||
text: 'ارسال کد',
|
text: 'ارسال کد',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.bottomSheet(bottomSendOtpSheetSellCode(item)).then((
|
Get.bottomSheet(bottomSendOtpSheetSellCode(item)).then((value) {
|
||||||
value,
|
|
||||||
) {
|
|
||||||
controller.otpCode.value = '';
|
controller.otpCode.value = '';
|
||||||
controller.otpCodeSell.clear();
|
controller.otpCodeSell.clear();
|
||||||
});
|
});
|
||||||
@@ -306,10 +281,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
: buildRow(title: 'کد احراز ', value: '${item.registerCode}'),
|
: buildRow(title: 'کد احراز ', value: '${item.registerCode}'),
|
||||||
buildRow(
|
buildRow(title: 'کد قرنطینه ', value: item.clearanceCode ?? 'بدون کد'),
|
||||||
title: 'کد قرنطینه ',
|
|
||||||
value: item.clearanceCode ?? 'بدون کد',
|
|
||||||
),
|
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -367,12 +339,10 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
isOnEdit ? 'ویرایش فروش' : 'افزودن فروش',
|
isOnEdit ? 'ویرایش فروش' : 'افزودن فروش',
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
// _productDropDown(),
|
|
||||||
|
|
||||||
|
// _productDropDown(),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -391,9 +361,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
label: 'تاریخ',
|
label: 'تاریخ',
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.bottomSheet(
|
Get.bottomSheet(
|
||||||
modalDatePicker(
|
modalDatePicker((value) => controller.setSaleDate(value)),
|
||||||
(value) => controller.setSaleDate(value),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
borderColor: AppColor.darkGreyLight,
|
borderColor: AppColor.darkGreyLight,
|
||||||
@@ -408,10 +376,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
border: Border.all(
|
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||||
color: AppColor.darkGreyLight,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
@@ -419,10 +384,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
child: Container(
|
child: Container(color: Colors.white, child: Text("انبار")),
|
||||||
color: Colors.white,
|
|
||||||
child: Text("انبار"),
|
|
||||||
),
|
|
||||||
top: -10,
|
top: -10,
|
||||||
right: 8,
|
right: 8,
|
||||||
),
|
),
|
||||||
@@ -443,10 +405,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Radio(value: 1),
|
Radio(value: 1),
|
||||||
Text(
|
Text('دولتی', style: AppFonts.yekan14),
|
||||||
'دولتی',
|
|
||||||
style: AppFonts.yekan14,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -460,10 +419,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Radio(value: 2),
|
Radio(value: 2),
|
||||||
Text(
|
Text('آزاد', style: AppFonts.yekan14),
|
||||||
'آزاد',
|
|
||||||
style: AppFonts.yekan14,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -480,8 +436,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
Obx(() {
|
Obx(() {
|
||||||
return MonthlyDataCalendar(
|
return MonthlyDataCalendar(
|
||||||
label: 'تاریخ تولید گوشت',
|
label: 'تاریخ تولید گوشت',
|
||||||
selectedDate: controller.productionDate.value
|
selectedDate: controller.productionDate.value?.formatCompactDate(),
|
||||||
?.formatCompactDate(),
|
|
||||||
onDateSelect: (value) {
|
onDateSelect: (value) {
|
||||||
controller.setProductionDate(value);
|
controller.setProductionDate(value);
|
||||||
},
|
},
|
||||||
@@ -491,10 +446,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Visibility(
|
Visibility(visible: isOnEdit == false, child: _buyerWidget()),
|
||||||
visible: isOnEdit == false,
|
|
||||||
child: _buyerWidget(),
|
|
||||||
),
|
|
||||||
|
|
||||||
RTextField(
|
RTextField(
|
||||||
controller: controller.saleWeightController,
|
controller: controller.saleWeightController,
|
||||||
@@ -549,10 +501,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
border: Border.all(
|
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||||
color: AppColor.darkGreyLight,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
@@ -560,10 +509,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
child: Container(
|
child: Container(color: Colors.white, child: Text("فروش")),
|
||||||
color: Colors.white,
|
|
||||||
child: Text("فروش"),
|
|
||||||
),
|
|
||||||
top: -10,
|
top: -10,
|
||||||
right: 8,
|
right: 8,
|
||||||
),
|
),
|
||||||
@@ -577,12 +523,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap:
|
onTap: (controller.broadcastPrice.value?.active ?? false)
|
||||||
(controller
|
|
||||||
.broadcastPrice
|
|
||||||
.value
|
|
||||||
?.active ??
|
|
||||||
false)
|
|
||||||
? () {
|
? () {
|
||||||
controller.saleType.value = 2;
|
controller.saleType.value = 2;
|
||||||
}
|
}
|
||||||
@@ -592,20 +533,13 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
Radio(
|
Radio(
|
||||||
value: 1,
|
value: 1,
|
||||||
enabled:
|
enabled:
|
||||||
controller
|
controller.broadcastPrice.value?.active ?? false,
|
||||||
.broadcastPrice
|
|
||||||
.value
|
|
||||||
?.active ??
|
|
||||||
false,
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'قیمت مصوب',
|
'قیمت مصوب',
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(
|
||||||
color:
|
color:
|
||||||
(controller
|
(controller.broadcastPrice.value?.active ??
|
||||||
.broadcastPrice
|
|
||||||
.value
|
|
||||||
?.active ??
|
|
||||||
false)
|
false)
|
||||||
? AppColor.textColor
|
? AppColor.textColor
|
||||||
: AppColor.labelTextColor,
|
: AppColor.labelTextColor,
|
||||||
@@ -624,10 +558,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Radio(value: 2),
|
Radio(value: 2),
|
||||||
Text(
|
Text('قیمت آزاد', style: AppFonts.yekan14),
|
||||||
'قیمت آزاد',
|
|
||||||
style: AppFonts.yekan14,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -654,8 +585,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
filled: true,
|
filled: true,
|
||||||
readonly: data.value == 1,
|
readonly: data.value == 1,
|
||||||
onChanged: (p0) {
|
onChanged: (p0) {
|
||||||
controller.pricePerKilo.value =
|
controller.pricePerKilo.value = int.tryParse(p0.clearComma) ?? 0;
|
||||||
int.tryParse(p0.clearComma) ?? 0;
|
|
||||||
},
|
},
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
label: 'قیمت هر کیلو (ريال)',
|
label: 'قیمت هر کیلو (ريال)',
|
||||||
@@ -710,9 +640,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
text: isOnEdit ? 'ویرایش' : 'ثبت',
|
text: isOnEdit ? 'ویرایش' : 'ثبت',
|
||||||
onPressed: data.value
|
onPressed: data.value
|
||||||
? () async {
|
? () async {
|
||||||
isOnEdit
|
isOnEdit ? await controller.editSale() : await controller.createSale();
|
||||||
? await controller.editSale()
|
|
||||||
: await controller.createSale();
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
height: 40,
|
height: 40,
|
||||||
@@ -890,9 +818,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
height: 40.h,
|
height: 40.h,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
border: borderColor != null
|
border: borderColor != null ? Border.all(width: 1, color: borderColor) : null,
|
||||||
? Border.all(width: 1, color: borderColor)
|
|
||||||
: null,
|
|
||||||
),
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -954,16 +880,12 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
unit,
|
unit,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,18 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_out_of_province_buyers/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sale/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sales_out_of_province/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_out_of_province_buyers/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -21,8 +14,7 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
|
|||||||
|
|
||||||
SaleLogic get saleLogic => Get.find<SaleLogic>();
|
SaleLogic get saleLogic => Get.find<SaleLogic>();
|
||||||
|
|
||||||
SalesOutOfProvinceLogic get saleOutOfProvince =>
|
SalesOutOfProvinceLogic get saleOutOfProvince => Get.find<SalesOutOfProvinceLogic>();
|
||||||
Get.find<SalesOutOfProvinceLogic>();
|
|
||||||
|
|
||||||
RxInt currentPage = 1.obs;
|
RxInt currentPage = 1.obs;
|
||||||
RxInt expandedListIndex = (-1).obs;
|
RxInt expandedListIndex = (-1).obs;
|
||||||
@@ -83,14 +75,11 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getOutProvinceCarcassesBuyer([
|
Future<void> getOutProvinceCarcassesBuyer([bool isLoadingMore = false]) async {
|
||||||
bool isLoadingMore = false,
|
|
||||||
]) async {
|
|
||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
buyerList.value =
|
buyerList.value = Resource<PaginationModel<OutProvinceCarcassesBuyer>>.loading();
|
||||||
Resource<PaginationModel<OutProvinceCarcassesBuyer>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -111,25 +100,19 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
|
|||||||
value: searchedValue.value ?? '',
|
value: searchedValue.value ?? '',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onError: (error, stackTrace) =>
|
onError: (error, stackTrace) => isLoadingMoreAllocationsMade.value = false,
|
||||||
isLoadingMoreAllocationsMade.value = false,
|
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
buyerList.value =
|
buyerList.value = Resource<PaginationModel<OutProvinceCarcassesBuyer>>.empty();
|
||||||
Resource<PaginationModel<OutProvinceCarcassesBuyer>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
buyerList.value =
|
buyerList.value = Resource<PaginationModel<OutProvinceCarcassesBuyer>>.success(
|
||||||
Resource<PaginationModel<OutProvinceCarcassesBuyer>>.success(
|
PaginationModel<OutProvinceCarcassesBuyer>(
|
||||||
PaginationModel<OutProvinceCarcassesBuyer>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [...(buyerList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
results: [
|
),
|
||||||
...(buyerList.value.data?.results ?? []),
|
);
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
isLoadingMoreAllocationsMade.value = false;
|
isLoadingMoreAllocationsMade.value = false;
|
||||||
}
|
}
|
||||||
@@ -148,9 +131,8 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
|
|||||||
|
|
||||||
Future<void> getCites() async {
|
Future<void> getCites() async {
|
||||||
await safeCall(
|
await safeCall(
|
||||||
call: () => rootLogic.commonRepository.getCity(
|
call: () =>
|
||||||
provinceName: selectedProvince.value?.name ?? '',
|
rootLogic.commonRepository.getCity(provinceName: selectedProvince.value?.name ?? ''),
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null && result.isNotEmpty) {
|
if (result != null && result.isNotEmpty) {
|
||||||
cites.value = result;
|
cites.value = result;
|
||||||
|
|||||||
@@ -1,14 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_out_of_province_sales_list/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sale/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/sales_out_of_province_buyers/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||||
@@ -17,7 +8,6 @@ import 'package:rasadyar_chicken/features/steward/data/model/response/steward_fr
|
|||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_buyers/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_buyers/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_out_of_province_sales_list/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -26,8 +16,7 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
|
|||||||
|
|
||||||
SaleLogic saleLogic = Get.find<SaleLogic>();
|
SaleLogic saleLogic = Get.find<SaleLogic>();
|
||||||
|
|
||||||
SalesOutOfProvinceBuyersLogic buyerLogic =
|
SalesOutOfProvinceBuyersLogic buyerLogic = Get.find<SalesOutOfProvinceBuyersLogic>();
|
||||||
Get.find<SalesOutOfProvinceBuyersLogic>();
|
|
||||||
|
|
||||||
RxInt selectedSegmentIndex = 0.obs;
|
RxInt selectedSegmentIndex = 0.obs;
|
||||||
RxBool isExpanded = false.obs;
|
RxBool isExpanded = false.obs;
|
||||||
@@ -106,21 +95,16 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
|
|||||||
),
|
),
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
if ((res?.count ?? 0) == 0) {
|
if ((res?.count ?? 0) == 0) {
|
||||||
salesList.value =
|
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.empty();
|
||||||
Resource<PaginationModel<StewardFreeSaleBar>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
salesList.value =
|
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.success(
|
||||||
Resource<PaginationModel<StewardFreeSaleBar>>.success(
|
PaginationModel<StewardFreeSaleBar>(
|
||||||
PaginationModel<StewardFreeSaleBar>(
|
count: res?.count ?? 0,
|
||||||
count: res?.count ?? 0,
|
next: res?.next,
|
||||||
next: res?.next,
|
previous: res?.previous,
|
||||||
previous: res?.previous,
|
results: [...(salesList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||||
results: [
|
),
|
||||||
...(salesList.value.data?.results ?? []),
|
);
|
||||||
...(res?.results ?? []),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
isLoadingMoreAllocationsMade.value = false;
|
isLoadingMoreAllocationsMade.value = false;
|
||||||
}
|
}
|
||||||
@@ -146,8 +130,7 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
|
|||||||
|
|
||||||
void setEditDataSales(StewardFreeSaleBar item) {
|
void setEditDataSales(StewardFreeSaleBar item) {
|
||||||
quarantineCodeController.text = item.clearanceCode ?? '';
|
quarantineCodeController.text = item.clearanceCode ?? '';
|
||||||
saleWeightController.text =
|
saleWeightController.text = item.weightOfCarcasses?.toInt().toString() ?? '';
|
||||||
item.weightOfCarcasses?.toInt().toString() ?? '';
|
|
||||||
saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!));
|
saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!));
|
||||||
selectedCity.value = IranProvinceCityModel(name: item.city);
|
selectedCity.value = IranProvinceCityModel(name: item.city);
|
||||||
selectedBuyer.value = buyerLogic.buyerList.value.data?.results?.firstWhere(
|
selectedBuyer.value = buyerLogic.buyerList.value.data?.results?.firstWhere(
|
||||||
|
|||||||
@@ -1,20 +1,12 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/segmentation/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/broadcast_price/broadcast_price.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/broadcast_price/broadcast_price.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/segmentation_model/segmentation_model.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/segmentation_model/segmentation_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_remain_weight/steward_remain_weight.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_remain_weight/steward_remain_weight.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/segmentation/logic.dart
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -57,10 +49,7 @@ class SegmentationLogic extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
routesName = ['قطعهبندی'].toList();
|
routesName = ['قطعهبندی'].toList();
|
||||||
once(
|
once(rootLogic.rolesProductsModel, (callback) => selectedProduct.value = callback.first);
|
||||||
rootLogic.rolesProductsModel,
|
|
||||||
(callback) => selectedProduct.value = callback.first,
|
|
||||||
);
|
|
||||||
getAllSegmentation();
|
getAllSegmentation();
|
||||||
getGuilds();
|
getGuilds();
|
||||||
|
|
||||||
@@ -77,8 +66,7 @@ class SegmentationLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateGovernmentalProductionDateData() {
|
void _updateGovernmentalProductionDateData() {
|
||||||
List<RemainWeightDay> dates =
|
List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||||
rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
|
||||||
governmentalProductionDateData = {
|
governmentalProductionDateData = {
|
||||||
for (var element in dates)
|
for (var element in dates)
|
||||||
element.day.toString().toJalali.formatCompactDate(): DayData(
|
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||||
@@ -146,16 +134,14 @@ class SegmentationLogic extends GetxController {
|
|||||||
hasWeight &&
|
hasWeight &&
|
||||||
productionDate.value != null &&
|
productionDate.value != null &&
|
||||||
weight > 0 &&
|
weight > 0 &&
|
||||||
(segmentType.value == 1 ||
|
(segmentType.value == 1 || (segmentType.value == 2 && selectedGuildModel.value != null));
|
||||||
(segmentType.value == 2 && selectedGuildModel.value != null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getAllSegmentation([bool isLoadingMore = false]) async {
|
Future<void> getAllSegmentation([bool isLoadingMore = false]) async {
|
||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreAllocationsMade.value = true;
|
isLoadingMoreAllocationsMade.value = true;
|
||||||
} else {
|
} else {
|
||||||
segmentationList.value =
|
segmentationList.value = Resource<PaginationModel<SegmentationModel>>.loading();
|
||||||
Resource<PaginationModel<SegmentationModel>>.loading();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchedValue.value != null &&
|
if (searchedValue.value != null &&
|
||||||
@@ -181,21 +167,19 @@ class SegmentationLogic extends GetxController {
|
|||||||
|
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if ((result?.count ?? 0) == 0) {
|
if ((result?.count ?? 0) == 0) {
|
||||||
segmentationList.value =
|
segmentationList.value = Resource<PaginationModel<SegmentationModel>>.empty();
|
||||||
Resource<PaginationModel<SegmentationModel>>.empty();
|
|
||||||
} else {
|
} else {
|
||||||
segmentationList.value =
|
segmentationList.value = Resource<PaginationModel<SegmentationModel>>.success(
|
||||||
Resource<PaginationModel<SegmentationModel>>.success(
|
PaginationModel<SegmentationModel>(
|
||||||
PaginationModel<SegmentationModel>(
|
count: result?.count ?? 0,
|
||||||
count: result?.count ?? 0,
|
next: result?.next,
|
||||||
next: result?.next,
|
previous: result?.previous,
|
||||||
previous: result?.previous,
|
results: [
|
||||||
results: [
|
...(segmentationList.value.data?.results ?? []),
|
||||||
...(segmentationList.value.data?.results ?? []),
|
...(result?.results ?? []),
|
||||||
...(result?.results ?? []),
|
],
|
||||||
],
|
),
|
||||||
),
|
);
|
||||||
);
|
|
||||||
|
|
||||||
isLoadingMoreAllocationsMade.value = false;
|
isLoadingMoreAllocationsMade.value = false;
|
||||||
}
|
}
|
||||||
@@ -223,9 +207,7 @@ class SegmentationLogic extends GetxController {
|
|||||||
model: SegmentationModel(
|
model: SegmentationModel(
|
||||||
key: selectedSegment.value?.key,
|
key: selectedSegment.value?.key,
|
||||||
weight: int.tryParse(weightController.text.clearComma) ?? 0,
|
weight: int.tryParse(weightController.text.clearComma) ?? 0,
|
||||||
productionDate: productionDate.value
|
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||||
?.toDateTime()
|
|
||||||
.formattedDashedGregorian,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
@@ -250,14 +232,10 @@ class SegmentationLogic extends GetxController {
|
|||||||
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||||
);
|
);
|
||||||
if (segmentType.value == 2) {
|
if (segmentType.value == 2) {
|
||||||
segmentationModel = segmentationModel.copyWith(
|
segmentationModel = segmentationModel.copyWith(guildKey: selectedGuildModel.value?.key);
|
||||||
guildKey: selectedGuildModel.value?.key,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
segmentationModel = segmentationModel.copyWith(
|
segmentationModel = segmentationModel.copyWith(
|
||||||
productionDate: productionDate.value
|
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||||
?.toDateTime()
|
|
||||||
.formattedDashedGregorian,
|
|
||||||
);
|
);
|
||||||
await safeCall(
|
await safeCall(
|
||||||
showError: true,
|
showError: true,
|
||||||
@@ -286,10 +264,7 @@ class SegmentationLogic extends GetxController {
|
|||||||
safeCall(
|
safeCall(
|
||||||
call: () async => await rootLogic.commonRepository.getGuilds(
|
call: () async => await rootLogic.commonRepository.getGuilds(
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
token: rootLogic.tokenService.accessToken.value!,
|
||||||
queryParameters: buildQueryParams(
|
queryParameters: buildQueryParams(queryParams: {'all': true}, role: 'Steward'),
|
||||||
queryParams: {'all': true},
|
|
||||||
role: 'Steward',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/segmentation/view.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/segmentation/widgets/cu_bottom_sheet.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/segmentation_model/segmentation_model.dart';
|
import 'package:rasadyar_chicken/features/steward/data/model/response/segmentation_model/segmentation_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/widgets/cu_bottom_sheet.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/widgets/cu_bottom_sheet.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/segmentation/view.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_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/segmentation/widgets/cu_bottom_sheet.dart
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/segmentation/logic.dart';
|
|
||||||
========
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/logic.dart';
|
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/logic.dart';
|
||||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/segmentation/widgets/cu_bottom_sheet.dart
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
Widget addOrEditBottomSheet(SegmentationLogic controller, {bool isOnEdit = false}) {
|
Widget addOrEditBottomSheet(SegmentationLogic controller, {bool isOnEdit = false}) {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class StewardPages {
|
|||||||
Get.lazyPut(() => StewardRootLogic());
|
Get.lazyPut(() => StewardRootLogic());
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
GetPage(
|
/* GetPage(
|
||||||
name: StewardRoutes.salesOutOfProvinceSteward,
|
name: StewardRoutes.salesOutOfProvinceSteward,
|
||||||
page: () => SalesOutOfProvincePage(),
|
page: () => SalesOutOfProvincePage(),
|
||||||
middlewares: [AuthMiddleware()],
|
middlewares: [AuthMiddleware()],
|
||||||
@@ -79,7 +79,7 @@ class StewardPages {
|
|||||||
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
||||||
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
|
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
|
||||||
}),
|
}),
|
||||||
),
|
),*/
|
||||||
GetPage(
|
GetPage(
|
||||||
name: StewardRoutes.salesOutOfProvinceBuyerSteward,
|
name: StewardRoutes.salesOutOfProvinceBuyerSteward,
|
||||||
page: () => SalesOutOfProvinceBuyersPage(),
|
page: () => SalesOutOfProvinceBuyersPage(),
|
||||||
@@ -90,7 +90,7 @@ class StewardPages {
|
|||||||
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
|
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
GetPage(
|
/* GetPage(
|
||||||
name: StewardRoutes.salesInProvinceSteward,
|
name: StewardRoutes.salesInProvinceSteward,
|
||||||
page: () => SalesInProvincePage(),
|
page: () => SalesInProvincePage(),
|
||||||
middlewares: [AuthMiddleware()],
|
middlewares: [AuthMiddleware()],
|
||||||
@@ -98,7 +98,7 @@ class StewardPages {
|
|||||||
Get.lazyPut(() => ChickenBaseLogic());
|
Get.lazyPut(() => ChickenBaseLogic());
|
||||||
Get.lazyPut(() => SalesInProvinceLogic());
|
Get.lazyPut(() => SalesInProvinceLogic());
|
||||||
}),
|
}),
|
||||||
),
|
),*/
|
||||||
|
|
||||||
//buy
|
//buy
|
||||||
GetPage(
|
GetPage(
|
||||||
|
|||||||
@@ -1,279 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/datasources/local/chicken_local.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/local/widely_used_local_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/inventory/inventory_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_remain_weight/steward_remain_weight.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart'
|
|
||||||
hide ProductModel;
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/repositories/common/common_repository.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/repositories/steward_repository.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/presentation/page/profile/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/home/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|
||||||
|
|
||||||
class StewardRootLogic extends GetxController {
|
|
||||||
DateTime? _lastBackPressed;
|
|
||||||
RxInt currentPage = 2.obs;
|
|
||||||
List<Widget> pages = [
|
|
||||||
BuyPage(),
|
|
||||||
SalePage(),
|
|
||||||
HomePage(),
|
|
||||||
SegmentationPage(),
|
|
||||||
ProfilePage(),
|
|
||||||
];
|
|
||||||
|
|
||||||
final defaultRoutes = <int, String>{
|
|
||||||
=
|
|
||||||
0: StewardRoutes.buySteward,
|
|
||||||
1: StewardRoutes.saleSteward,
|
|
||||||
};
|
|
||||||
RxList<ProductModel> rolesProductsModel = RxList<ProductModel>();
|
|
||||||
Rxn<WidelyUsedLocalModel> widelyUsedList = Rxn<WidelyUsedLocalModel>();
|
|
||||||
Rxn<StewardSalesInfoDashboard> stewardSalesInfoDashboard =
|
|
||||||
Rxn<StewardSalesInfoDashboard>();
|
|
||||||
Rxn<StewardRemainWeight> stewardRemainWeight = Rxn<StewardRemainWeight>();
|
|
||||||
|
|
||||||
late DioRemote dioRemote;
|
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
|
||||||
late CommonRepository commonRepository;
|
|
||||||
late StewardRepository stewardRepository;
|
|
||||||
late ChickenLocalDataSource localDatasource;
|
|
||||||
|
|
||||||
RxList<ErrorLocationType> errorLocationType = RxList();
|
|
||||||
RxMap<int, dynamic> inventoryExpandedList = RxMap();
|
|
||||||
Rxn<ProductModel> inventoryModel = Rxn<ProductModel>();
|
|
||||||
RxList<IranProvinceCityModel> provinces = <IranProvinceCityModel>[].obs;
|
|
||||||
|
|
||||||
// Cancel tokens for API calls
|
|
||||||
CancelToken? _inventoryCancelToken;
|
|
||||||
CancelToken? _provincesCancelToken;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
localDatasource = diChicken.get<ChickenLocalDataSource>();
|
|
||||||
commonRepository = diChicken.get<CommonRepository>();
|
|
||||||
stewardRepository = diChicken.get<StewardRepository>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
|
|
||||||
if (provinces.isEmpty) {
|
|
||||||
getProvinces();
|
|
||||||
}
|
|
||||||
if (inventoryModel.value == null) {
|
|
||||||
getRolesProduct();
|
|
||||||
}
|
|
||||||
if (rolesProductsModel.isEmpty) {
|
|
||||||
getRolesProducts();
|
|
||||||
}
|
|
||||||
getStewardSaleDashboard();
|
|
||||||
getStewardRemainWeightData();
|
|
||||||
|
|
||||||
if (widelyUsedList.value?.hasInit != true) {
|
|
||||||
//TODO
|
|
||||||
localDatasource.initWidleyUsed().then(
|
|
||||||
(value) => localDatasource.getAllWidely(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
// Cancel any ongoing requests when controller is disposed
|
|
||||||
_inventoryCancelToken?.cancel();
|
|
||||||
_provincesCancelToken?.cancel();
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> onRefresh() async {
|
|
||||||
await Future.wait([
|
|
||||||
getRolesProduct(),
|
|
||||||
getRolesProducts(),
|
|
||||||
getStewardSaleDashboard(),
|
|
||||||
getStewardRemainWeightData(),
|
|
||||||
getProvinces(),
|
|
||||||
getStewardRemainWeightData(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
|
||||||
if (inventoryExpandedList.keys.contains(index)) {
|
|
||||||
inventoryExpandedList.remove(index);
|
|
||||||
} else {
|
|
||||||
inventoryExpandedList[index] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getRolesProduct() async {
|
|
||||||
// Cancel previous request if still running
|
|
||||||
_inventoryCancelToken?.cancel();
|
|
||||||
_inventoryCancelToken = CancelToken();
|
|
||||||
|
|
||||||
=
|
|
||||||
await safeCall<List<InventoryModel>?>(
|
|
||||||
call: () async => await commonRepository.getInventory(
|
|
||||||
token: tokenService.accessToken.value!,
|
|
||||||
cancelToken: _inventoryCancelToken,
|
|
||||||
queryParameters: buildRawQueryParams(role: 'Steward'),
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
inventoryModel.value = result.first;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {
|
|
||||||
if (error is DioException && error.type == DioExceptionType.cancel) {
|
|
||||||
// Request was cancelled, ignore the error
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void rootErrorHandler(DioException error) {
|
|
||||||
handleGeneric(error, () {
|
|
||||||
tokenService.deleteModuleTokens(Module.chicken);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void changePage(int index) {
|
|
||||||
currentPage.value = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getProvinces() async {
|
|
||||||
// Cancel previous request if still running
|
|
||||||
_provincesCancelToken?.cancel();
|
|
||||||
_provincesCancelToken = CancelToken();
|
|
||||||
|
|
||||||
try {
|
|
||||||
=
|
|
||||||
final res = await commonRepository.getProvince(
|
|
||||||
cancelToken: _provincesCancelToken,
|
|
||||||
);
|
|
||||||
if (res != null) {
|
|
||||||
provinces.clear();
|
|
||||||
provinces.value = res;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
if (e is DioException && e.type == DioExceptionType.cancel) {
|
|
||||||
// Request was cancelled, ignore the error
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
provinces.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getRolesProducts() async {
|
|
||||||
safeCall(
|
|
||||||
=
|
|
||||||
call: () async => await commonRepository.getRolesProducts(
|
|
||||||
token: tokenService.accessToken.value!,
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
rolesProductsModel.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stacktrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getStewardSaleDashboard() async {
|
|
||||||
safeCall(
|
|
||||||
call: () async => await stewardRepository.getStewardSalesInfoDashboard(
|
|
||||||
token: tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildRawQueryParams(role: 'Steward'),
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
stewardSalesInfoDashboard.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stacktrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getStewardRemainWeightData() async {
|
|
||||||
safeCall(
|
|
||||||
=
|
|
||||||
call: () async => await stewardRepository.getStewardRemainWeight(
|
|
||||||
token: tokenService.accessToken.value!,
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
stewardRemainWeight.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stacktrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
int getNestedKey() {
|
|
||||||
switch (currentPage.value) {
|
|
||||||
case 0:
|
|
||||||
return stewardFirstKey;
|
|
||||||
case 1:
|
|
||||||
return stewardSecondKey;
|
|
||||||
case 2:
|
|
||||||
return stewardThirdKey;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
return stewardFourthKey;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
return stewardFourthKey;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return stewardThirdKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onPopScopTaped() async {
|
|
||||||
final nestedKeyId = getNestedKey();
|
|
||||||
GlobalKey<NavigatorState>? currentNestedKey = Get.nestedKey(nestedKeyId);
|
|
||||||
|
|
||||||
if (currentNestedKey?.currentState?.canPop() == true) {
|
|
||||||
iLog(currentNestedKey?.currentState?.canPop());
|
|
||||||
iLog(currentNestedKey?.currentContext);
|
|
||||||
currentNestedKey?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
} else {
|
|
||||||
final now = DateTime.now();
|
|
||||||
if (_lastBackPressed == null ||
|
|
||||||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
|
||||||
_lastBackPressed = now;
|
|
||||||
Get.snackbar(
|
|
||||||
'خروج از برنامه',
|
|
||||||
'برای خروج دوباره بازگشت را بزنید',
|
|
||||||
snackPosition: SnackPosition.TOP,
|
|
||||||
duration: Duration(seconds: 2),
|
|
||||||
backgroundColor: AppColor.warning,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
await SystemNavigator.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isKillHouse(WaitingArrivalModel model) =>
|
|
||||||
model.allocationType?.split("_")[0].toLowerCase() == "killhouse";
|
|
||||||
}
|
|
||||||
@@ -1,693 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_chicken/chicken.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.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';
|
|
||||||
|
|
||||||
class StewardRootPage extends GetView<StewardRootLogic> {
|
|
||||||
StewardRootPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ObxValue((data) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
isFullScreen: true,
|
|
||||||
isBase: true,
|
|
||||||
onPopScopTaped: controller.onPopScopTaped,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
IndexedStack(
|
|
||||||
children: [
|
|
||||||
Navigator(
|
|
||||||
key: Get.nestedKey(stewardFirstKey),
|
|
||||||
onGenerateRoute: (settings) {
|
|
||||||
final page = ChickenPages.pages.firstWhere(
|
|
||||||
(e) => e.name == settings.name,
|
|
||||||
orElse: () => ChickenPages.pages.firstWhere(
|
|
||||||
(e) => e.name == StewardRoutes.buySteward,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return buildRouteFromGetPage(page);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Navigator(
|
|
||||||
key: Get.nestedKey(stewardSecondKey),
|
|
||||||
onGenerateRoute: (settings) {
|
|
||||||
final page = ChickenPages.pages.firstWhere(
|
|
||||||
(e) => e.name == settings.name,
|
|
||||||
orElse: () => ChickenPages.pages.firstWhere(
|
|
||||||
(e) => e.name == StewardRoutes.saleSteward,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return buildRouteFromGetPage(page);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Navigator(
|
|
||||||
key: Get.nestedKey(stewardThirdKey),
|
|
||||||
onGenerateRoute: (settings) =>
|
|
||||||
GetPageRoute(page: () => controller.pages[2]),
|
|
||||||
),
|
|
||||||
Navigator(
|
|
||||||
key: Get.nestedKey(stewardFourthKey),
|
|
||||||
onGenerateRoute: (settings) =>
|
|
||||||
GetPageRoute(page: () => controller.pages[3]),
|
|
||||||
),
|
|
||||||
Navigator(
|
|
||||||
key: Get.nestedKey(stewardFifthKey),
|
|
||||||
onGenerateRoute: (settings) =>
|
|
||||||
GetPageRoute(page: () => controller.pages[4]),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
index: data.value,
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
bottom: 0,
|
|
||||||
right: 0,
|
|
||||||
left: 0,
|
|
||||||
child: RBottomNavigation(
|
|
||||||
items: [
|
|
||||||
RBottomNavigationItem(
|
|
||||||
label: 'خرید',
|
|
||||||
icon: Assets.vec.buySvg.path,
|
|
||||||
isSelected: controller.currentPage.value == 0,
|
|
||||||
onTap: () {
|
|
||||||
Get.nestedKey(
|
|
||||||
stewardFirstKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
Get.nestedKey(
|
|
||||||
stewardSecondKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
|
|
||||||
controller.changePage(0);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
RBottomNavigationItem(
|
|
||||||
label: 'فروش',
|
|
||||||
icon: Assets.vec.saleSvg.path,
|
|
||||||
isSelected: controller.currentPage.value == 1,
|
|
||||||
onTap: () {
|
|
||||||
Get.nestedKey(
|
|
||||||
stewardFirstKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
Get.nestedKey(
|
|
||||||
stewardSecondKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
controller.changePage(1);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
RBottomNavigationItem(
|
|
||||||
label: 'خانه',
|
|
||||||
icon: Assets.vec.homeSvg.path,
|
|
||||||
isSelected: controller.currentPage.value == 2,
|
|
||||||
onTap: () {
|
|
||||||
Get.nestedKey(
|
|
||||||
stewardSecondKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
Get.nestedKey(
|
|
||||||
stewardFirstKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
controller.changePage(2);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
RBottomNavigationItem(
|
|
||||||
label: 'قطعه بندی',
|
|
||||||
icon: Assets.vec.convertCubeSvg.path,
|
|
||||||
isSelected: controller.currentPage.value == 3,
|
|
||||||
onTap: () {
|
|
||||||
Get.nestedKey(
|
|
||||||
stewardSecondKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
Get.nestedKey(
|
|
||||||
stewardFirstKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
controller.changePage(3);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
RBottomNavigationItem(
|
|
||||||
label: 'پروفایل',
|
|
||||||
icon: Assets.vec.profileCircleSvg.path,
|
|
||||||
isSelected: controller.currentPage.value == 4,
|
|
||||||
onTap: () {
|
|
||||||
Get.nestedKey(
|
|
||||||
stewardSecondKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
Get.nestedKey(
|
|
||||||
stewardFirstKey,
|
|
||||||
)?.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
|
|
||||||
controller.changePage(4);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.currentPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container _todayShipmentWidget() {
|
|
||||||
return Container(
|
|
||||||
height: 70,
|
|
||||||
width: Get.width / 2,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [const Color(0xFFEAEFFF), Colors.white],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Assets.icons.cubeScan.svg(width: 30.w, height: 30),
|
|
||||||
Text(
|
|
||||||
'بارهای امروز',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'2،225،256',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'کیلوگرم',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container _informationLabelCard({
|
|
||||||
required String title,
|
|
||||||
required String description,
|
|
||||||
String unit = 'کیلوگرم',
|
|
||||||
required String iconPath,
|
|
||||||
required Color iconColor,
|
|
||||||
required Color bgDescriptionColor,
|
|
||||||
required Color bgLabelColor,
|
|
||||||
}) {
|
|
||||||
return Container(
|
|
||||||
height: 82,
|
|
||||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8)),
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
// Left side with icon and title
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
height: 82,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: bgLabelColor,
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
topRight: Radius.circular(8),
|
|
||||||
bottomRight: Radius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
SvgGenImage.vec(iconPath).svg(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Right side with description and unit
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: bgDescriptionColor,
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
topLeft: Radius.circular(8),
|
|
||||||
bottomLeft: Radius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
description,
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16.copyWith(
|
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
unit,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan12.copyWith(
|
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container _informationIconCard({
|
|
||||||
required String title,
|
|
||||||
required String description,
|
|
||||||
String unit = 'کیلوگرم',
|
|
||||||
required String iconPath,
|
|
||||||
required Color iconColor,
|
|
||||||
required Color bgDescriptionColor,
|
|
||||||
required Color bgLabelColor,
|
|
||||||
}) {
|
|
||||||
return Container(
|
|
||||||
height: 110,
|
|
||||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8)),
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
child: Stack(
|
|
||||||
alignment: Alignment.topCenter,
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
bottom: 0,
|
|
||||||
right: 0,
|
|
||||||
left: 0,
|
|
||||||
child: Container(
|
|
||||||
height: 91,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: bgDescriptionColor,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 0.25, color: const Color(0xFFB4B4B4)),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
description,
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16.copyWith(
|
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
unit,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan12.copyWith(
|
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 0,
|
|
||||||
child: Container(
|
|
||||||
width: 32,
|
|
||||||
height: 32,
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
color: bgLabelColor,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(30),
|
|
||||||
side: BorderSide(width: 0.25, color: const Color(0xFFD5D5D5)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: SvgGenImage.vec(iconPath).svg(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget widelyUsed({
|
|
||||||
required String title,
|
|
||||||
required String iconPath,
|
|
||||||
required VoidCallback onTap,
|
|
||||||
}) {
|
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 48,
|
|
||||||
height: 48,
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
color: const Color(0xFFBECDFF),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: SvgGenImage.vec(iconPath).svg(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget addWidelyUsed({required VoidCallback onTap}) {
|
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 48,
|
|
||||||
height: 48,
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
color: const Color(0xFFD9F7F0),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Assets.vec.messageAddSvg.svg(
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
AppColor.greenNormal,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'افزودن',
|
|
||||||
style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Column oldPage() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
inventoryWidget(),
|
|
||||||
ObxValue((data) => broadcastInformationWidget(data.value), controller.killHouseDistributionInfo),
|
|
||||||
SizedBox(height: 20),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
cardWidget(
|
|
||||||
title: 'ورود به انبار',
|
|
||||||
iconPath: Assets.icons.whareHouse.path,
|
|
||||||
onTap: () {
|
|
||||||
Get.toNamed(ChickenRoutes.enteringTheWarehouse);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
cardWidget(
|
|
||||||
title: 'فروش داخل استان',
|
|
||||||
iconPath: Assets.icons.inside.path,
|
|
||||||
onTap: () {
|
|
||||||
Get.toNamed(ChickenRoutes.salesInProvince);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
cardWidget(
|
|
||||||
title: 'فروش خارج استان',
|
|
||||||
iconPath: Assets.icons.outside.path,
|
|
||||||
onTap: () {
|
|
||||||
Get.toNamed(ChickenRoutes.salesOutOfProvince);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget inventoryWidget() {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Text('موجودی انبار', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)),
|
|
||||||
),
|
|
||||||
SizedBox(height: 4),
|
|
||||||
ObxValue(
|
|
||||||
(data) =>
|
|
||||||
data.isEmpty
|
|
||||||
? Container(
|
|
||||||
margin: const EdgeInsets.symmetric(vertical: 2),
|
|
||||||
height: 80,
|
|
||||||
padding: EdgeInsets.all(6),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(color: AppColor.blueNormal, width: 1),
|
|
||||||
),
|
|
||||||
child: Center(child: CircularProgressIndicator()),
|
|
||||||
)
|
|
||||||
: ListView.separated(
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
itemCount: controller.inventoryList.length,
|
|
||||||
separatorBuilder: (context, index) => const SizedBox(height: 8),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return ObxValue((expand) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
controller.toggleExpanded(index);
|
|
||||||
},
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
child: AnimatedContainer(
|
|
||||||
onEnd: () {
|
|
||||||
controller.inventoryExpandedList[index] = !controller.inventoryExpandedList[index]!;
|
|
||||||
},
|
|
||||||
margin: const EdgeInsets.symmetric(vertical: 2),
|
|
||||||
padding: EdgeInsets.all(6),
|
|
||||||
curve: Curves.easeInOut,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(color: AppColor.blueNormal, width: 1),
|
|
||||||
),
|
|
||||||
duration: const Duration(seconds: 1),
|
|
||||||
height: expand.keys.contains(index) ? 250 : 80,
|
|
||||||
child: inventoryItem(
|
|
||||||
isExpanded: expand.keys.contains(index) && expand[index]!,
|
|
||||||
index: index,
|
|
||||||
model: controller.inventoryList[index],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.inventoryExpandedList);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
controller.inventoryList,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget inventoryItem({required bool isExpanded, required int index, required ProductModel model}) {
|
|
||||||
return Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
buildRow('نام محصول', model.name ?? ''),
|
|
||||||
Visibility(
|
|
||||||
visible: isExpanded,
|
|
||||||
child: Column(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
buildRow('وزن خریدهای دولتی داخل استان (کیلوگرم)', '0326598653'),
|
|
||||||
buildRow('وزن خریدهای آزاد داخل استان (کیلوگرم)', model.receiveFreeCarcassesWeight.toString()),
|
|
||||||
buildRow('وزن خریدهای خارج استان (کیلوگرم)', model.freeBuyingCarcassesWeight.toString()),
|
|
||||||
buildRow('کل ورودی به انبار (کیلوگرم)', model.totalFreeBarsCarcassesWeight.toString()),
|
|
||||||
buildRow('کل فروش (کیلوگرم)', model.realAllocatedWeight.toString()),
|
|
||||||
buildRow('مانده انبار (کیلوگرم)', model.totalRemainWeight.toString()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
Widget buildRow(String title, String value) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
title,
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: Text(
|
|
||||||
value,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget broadcastInformationWidget(KillHouseDistributionInfo? model) {
|
|
||||||
return Container(
|
|
||||||
height: 140,
|
|
||||||
margin: const EdgeInsets.all(8),
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(color: AppColor.blueNormal, width: 1),
|
|
||||||
),
|
|
||||||
child: model != null
|
|
||||||
? Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'اطلاعات ارسالی',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
buildRow(
|
|
||||||
'فروش و توزیع داخل استان (کیلوگرم)',
|
|
||||||
model.stewardAllocationsWeight!.toInt().toString(),
|
|
||||||
),
|
|
||||||
buildRow(
|
|
||||||
'فروش و توزیع خارج استان (کیلوگرم)',
|
|
||||||
model.freeSalesWeight!.toInt().toString(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: const Center(child: CircularProgressIndicator()),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget cardWidget({
|
|
||||||
required String title,
|
|
||||||
required String iconPath,
|
|
||||||
required VoidCallback onTap,
|
|
||||||
}) {
|
|
||||||
return Container(
|
|
||||||
width: Get.width / 4,
|
|
||||||
height: 130,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: onTap,
|
|
||||||
child: Card(
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
side: BorderSide(width: 1, color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(16),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
SvgGenImage(iconPath).svg(width: 50, height: 50),
|
|
||||||
SizedBox(height: 4),
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
import 'package:flutter/services.dart';
|
|
||||||
=
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class SaleLogic extends GetxController {
|
|
||||||
Rxn<List<AllocatedMadeModel>?> allocatedMadeModel =
|
|
||||||
Rxn<List<AllocatedMadeModel>?>();
|
|
||||||
|
|
||||||
RxList<GuildModel> guildsModel = <GuildModel>[].obs;
|
|
||||||
|
|
||||||
Rxn<StewardFreeBarDashboard> stewardFreeDashboard =
|
|
||||||
Rxn<StewardFreeBarDashboard>();
|
|
||||||
|
|
||||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
|
||||||
|
|
||||||
List<String> routesName = ['فروش'];
|
|
||||||
DateTime? _lastBackPressed;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
getStewardDashBord();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getAllocatedMade() async {
|
|
||||||
safeCall(
|
|
||||||
call: () async => await rootLogic.stewardRepository.getAllocatedMade(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
queryParameters: buildQueryParams(
|
|
||||||
page: 1,
|
|
||||||
pageSize: 20,
|
|
||||||
search: 'filter',
|
|
||||||
role: 'Steward',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
allocatedMadeModel.value = result.results;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stacktrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkVerfication() {}
|
|
||||||
|
|
||||||
void confirmAllocation(ConformAllocation allocation) {
|
|
||||||
safeCall(
|
|
||||||
call: () async => await rootLogic.stewardRepository.confirmAllocation(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
allocation: allocation.toJson(),
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
getAllocatedMade();
|
|
||||||
},
|
|
||||||
onError: (error, stacktrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void denyAllocation(String token) {
|
|
||||||
safeCall(
|
|
||||||
call: () async => await rootLogic.stewardRepository.denyAllocation(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
allocationToken: token,
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
getAllocatedMade();
|
|
||||||
},
|
|
||||||
onError: (error, stacktrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> confirmAllAllocations() async {
|
|
||||||
safeCall(
|
|
||||||
call: () async => await rootLogic.stewardRepository.confirmAllAllocation(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
allocationTokens:
|
|
||||||
allocatedMadeModel.value?.map((e) => e.key!).toList() ?? [],
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
getAllocatedMade();
|
|
||||||
},
|
|
||||||
onError: (error, stacktrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getGuilds() async {}
|
|
||||||
|
|
||||||
Future<void> addSale() async {}
|
|
||||||
|
|
||||||
void setSelectedGuild(GuildModel value) {}
|
|
||||||
|
|
||||||
void setSelectedProduct(ProductModel value) {}
|
|
||||||
|
|
||||||
Future<void> getStewardDashBord() async {
|
|
||||||
safeCall(
|
|
||||||
call: () async => await rootLogic.stewardRepository.getStewardDashboard(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
stratDate: DateTime.now().formattedDashedGregorian,
|
|
||||||
endDate: DateTime.now().formattedDashedGregorian,
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
stewardFreeDashboard.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stacktrace) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> submitAllocation() async {}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
rootLogic.inventoryExpandedList.clear();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void onPopScopTaped() async {
|
|
||||||
final now = DateTime.now();
|
|
||||||
if (_lastBackPressed == null ||
|
|
||||||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
|
||||||
_lastBackPressed = now;
|
|
||||||
Get.snackbar(
|
|
||||||
'خروج از برنامه',
|
|
||||||
'برای خروج دوباره بازگشت را بزنید',
|
|
||||||
snackPosition: SnackPosition.TOP,
|
|
||||||
duration: Duration(seconds: 2),
|
|
||||||
backgroundColor: AppColor.warning,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
await SystemNavigator.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,207 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
|
||||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.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';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class SalePage extends GetView<SaleLogic> {
|
|
||||||
SalePage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ChickenBasePage(
|
|
||||||
routes: controller.routesName,
|
|
||||||
isBase: true,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 21,
|
|
||||||
children: [
|
|
||||||
GlassMorphismCardIcon(
|
|
||||||
title: 'فروش داخل استان',
|
|
||||||
vecIcon: Assets.vec.map2Svg.path,
|
|
||||||
onTap: () {
|
|
||||||
Get.toNamed(
|
|
||||||
StewardRoutes.salesInProvinceSteward,
|
|
||||||
id: stewardSecondKey,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
GlassMorphismCardIcon(
|
|
||||||
title: 'فروش خارج استان',
|
|
||||||
vecIcon: Assets.vec.saleOutProvinceSvg.path,
|
|
||||||
onTap: () {
|
|
||||||
Get.toNamed(
|
|
||||||
StewardRoutes.salesOutOfProvinceSteward,
|
|
||||||
id: stewardSecondKey,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget addSaleOutOfTheProvinceBottomSheet() {
|
|
||||||
return BaseBottomSheet(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Text(
|
|
||||||
'ثبت فروش خارج استان',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 4),
|
|
||||||
RElevated(text: 'ثبت توزیع/ فروش', onPressed: () {}),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _typeOuterInfoCard({
|
|
||||||
required String title,
|
|
||||||
required String iconPath,
|
|
||||||
required Color foregroundColor,
|
|
||||||
VoidCallback? onTap,
|
|
||||||
}) {
|
|
||||||
return InkWell(
|
|
||||||
onTap: onTap,
|
|
||||||
child: Container(
|
|
||||||
height: 180,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 1, color: foregroundColor),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Stack(
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
top: -41,
|
|
||||||
child: SvgGenImage.vec(iconPath).svg(
|
|
||||||
width: 45,
|
|
||||||
height: 45,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
foregroundColor,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Assets.vec.shoppingBasketSvg.svg(
|
|
||||||
width: 55,
|
|
||||||
height: 60,
|
|
||||||
colorFilter: ColorFilter.mode(
|
|
||||||
foregroundColor,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: foregroundColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget summaryOfInformation(StewardFreeBarDashboard? model) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'خلاصه اطلاعات',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
height: 140,
|
|
||||||
margin: const EdgeInsets.all(8),
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(color: AppColor.blueNormal, width: 1),
|
|
||||||
),
|
|
||||||
child: model == null
|
|
||||||
? const Center(child: CircularProgressIndicator())
|
|
||||||
: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 10,
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
buildRow(
|
|
||||||
'تعداد کل بارها',
|
|
||||||
model.totalQuantity?.toString() ?? '0',
|
|
||||||
),
|
|
||||||
buildRow('تعداد کل', model.totalBars?.toString() ?? '0'),
|
|
||||||
buildRow(
|
|
||||||
'وزن کل (کیلوگرم)',
|
|
||||||
model.totalWeight?.toString() ?? '0',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildRow(String title, String value) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
title,
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Flexible(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
value,
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user