feat: new BLogic changes
This commit is contained in:
@@ -58,12 +58,13 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
spacing: 3,
|
||||
children: [
|
||||
Text(
|
||||
item.toSteward?.user?.fullname ?? 'N/A',
|
||||
'${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 ?? 'N/A',
|
||||
item.date?.formattedJalaliDate ?? 'ندارد',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
@@ -91,17 +92,15 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
item.weightOfCarcasses?.separatedByCommaFa.addKg ?? 'N/A',
|
||||
item.weightOfCarcasses?.separatedByCommaFa.addKg ?? 'ندارد',
|
||||
textAlign: TextAlign.left,
|
||||
textDirection: TextDirection.ltr,
|
||||
style: AppFonts.yekan12Bold.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Text(
|
||||
item?.toSteward?.guildsName ?? 'N/A',
|
||||
textAlign: TextAlign.start,
|
||||
'${item.amount?.separatedByCommaFa} ریال',
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
@@ -109,10 +108,19 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Assets.vec.scanSvg.svg(
|
||||
width: 32.w,
|
||||
height: 32.h,
|
||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 3,
|
||||
children: [
|
||||
Text(
|
||||
(item.approvedPriceStatus ?? false) ? 'مصوب' : 'آزاد',
|
||||
style: AppFonts.yekan12Bold.copyWith(
|
||||
color: (item.approvedPriceStatus ?? false)
|
||||
? AppColor.blueNormal
|
||||
: AppColor.greenNormal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -130,7 +138,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
item.toSteward?.user?.fullname ?? 'N/A',
|
||||
'${controller.rootLogic.isKillHouse(item) ? item.killHouse?.name : item.steward?.user?.fullname} ',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
||||
),
|
||||
@@ -161,12 +169,12 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
spacing: 3,
|
||||
children: [
|
||||
Text(
|
||||
item.date?.toJalali.formatter.wN ?? 'N/A',
|
||||
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
|
||||
Text(
|
||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'N/A'}',
|
||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
],
|
||||
@@ -178,22 +186,31 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
),
|
||||
|
||||
Text(
|
||||
'${item.date?.toJalali.formatter.tHH}:${item.date?.toJalali.formatter.tMM ?? 'N/A'}',
|
||||
'${item.date?.toJalali.formatter.tHH}:${item.date?.toJalali.formatter.tMM ?? 'ندارد'}',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
buildRow(title: 'مشخصات فروشنده', value: item.toSteward?.user?.fullname ?? 'N/A'),
|
||||
buildRow(
|
||||
title: 'مشخصات فروشنده',
|
||||
value:
|
||||
'${controller.rootLogic.isKillHouse(item) ? item.killHouse?.killHouseOperator?.user?.fullname : item.steward?.user?.fullname} ',
|
||||
),
|
||||
buildRow(
|
||||
title: 'تلفن فروشنده',
|
||||
value: item.toSteward?.user?.mobile ?? 'N/A',
|
||||
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 ?? 'N/A'),
|
||||
buildRow(title: ' سهمیه', value: item.quota?.faTitle ?? 'N/A'),
|
||||
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
|
||||
buildRow(title: 'نوع تخصیص', value: item.allocationType?.faAllocationType ?? 'ندارد'),
|
||||
buildRow(title: ' سهمیه', value: item.quota?.faTitle ?? 'ندارد'),
|
||||
buildRow(title: 'محصول', value: item.product?.name ?? 'ندارد'),
|
||||
buildRow(
|
||||
title: 'تاریخ تولید گوشت',
|
||||
value: item.productionDate?.toJalali.toJalaliDateTime() ?? 'ندارد',
|
||||
),
|
||||
buildRow(
|
||||
title: 'وزن خریداری شده',
|
||||
value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم',
|
||||
|
||||
@@ -115,12 +115,12 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
spacing: 3,
|
||||
children: [
|
||||
Text(
|
||||
item.date?.toJalali.formatter.wN ?? 'N/A',
|
||||
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
|
||||
Text(
|
||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'N/A'}',
|
||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
],
|
||||
@@ -132,21 +132,21 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
),
|
||||
|
||||
Text(
|
||||
'${item.date?.toJalali.formatter.tHH}:${item.date?.toJalali.formatter.tMM ?? 'N/A'}',
|
||||
'${item.date?.toJalali.formatter.tHH}:${item.date?.toJalali.formatter.tMM ?? 'ندارد'}',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
buildRow(title: 'مشخصات فروشنده', value: item.killHouseName ?? 'N/A'),
|
||||
buildRow(title: 'مشخصات فروشنده', value: item.killHouseName ?? 'ندارد'),
|
||||
|
||||
buildRow(
|
||||
title: 'تلفن فروشنده',
|
||||
value: item.killHouseMobile ?? 'N/A',
|
||||
value: item.killHouseMobile ?? 'ندارد',
|
||||
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
|
||||
buildRow(title: 'محصول', value: item.product?.name ?? 'ندارد'),
|
||||
buildRow(
|
||||
title: 'وزن خریداری شده',
|
||||
value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم',
|
||||
@@ -247,12 +247,12 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
spacing: 3,
|
||||
children: [
|
||||
Text(
|
||||
item.killHouseName ?? 'N/A',
|
||||
item.killHouseName ?? 'ندارد',
|
||||
textAlign: TextAlign.start,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(
|
||||
item.date?.formattedJalaliDate ?? 'N/A',
|
||||
item.date?.formattedJalaliDate ?? 'ندارد',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
@@ -287,9 +287,8 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
),
|
||||
|
||||
SizedBox(height: 2),
|
||||
|
||||
Text(
|
||||
'${item.province}',
|
||||
'${item.numberOfCarcasses.separatedByComma} ${'قطعه'}',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
@@ -297,11 +296,22 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Assets.vec.scanSvg.svg(
|
||||
width: 32.w,
|
||||
height: 32.h,
|
||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -9,6 +9,8 @@ import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.
|
||||
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_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/presentation/pages/common/profile/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/buy/view.dart';
|
||||
@@ -211,13 +213,11 @@ class StewardRootLogic extends GetxController {
|
||||
|
||||
final currentRoute = currentNestedKey?.currentState;
|
||||
|
||||
|
||||
fLog("onPopScopTaped ==> ${currentNestedKey?.currentState?.canPop()}");
|
||||
if (currentNestedKey?.currentState?.canPop() == true) {
|
||||
iLog(currentNestedKey?.currentState?.canPop());
|
||||
iLog(currentNestedKey?.currentContext );
|
||||
iLog(currentNestedKey?.currentContext);
|
||||
currentNestedKey?.currentState?.popUntil((route) => route.isFirst);
|
||||
|
||||
} else {
|
||||
final now = DateTime.now();
|
||||
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
||||
@@ -234,4 +234,7 @@ class StewardRootLogic extends GetxController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isKillHouse(WaitingArrivalModel model) =>
|
||||
model.allocationType?.split("_")[0].toLowerCase() == "killhouse";
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ class SalesInProvinceLogic extends GetxController {
|
||||
|
||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
||||
Rxn<Jalali?> productionData = Rxn();
|
||||
Rxn<ProductModel> selectedProductModel = Rxn<ProductModel>();
|
||||
Rxn<GuildModel> selectedGuildModel = Rxn<GuildModel>();
|
||||
Rxn<GuildProfile> guildProfile = Rxn<GuildProfile>();
|
||||
@@ -274,7 +275,7 @@ class SalesInProvinceLogic extends GetxController {
|
||||
|
||||
void setSubmitData() {
|
||||
tmpStewardAllocation = SubmitStewardAllocation(
|
||||
approvedPriceStatus: priceType.value==1,
|
||||
approvedPriceStatus: priceType.value == 1,
|
||||
allocationType:
|
||||
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}',
|
||||
sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild",
|
||||
@@ -284,6 +285,7 @@ class SalesInProvinceLogic extends GetxController {
|
||||
weightOfCarcasses: weight.value,
|
||||
sellType: saleType.value == 2 ? "free" : 'exclusive',
|
||||
numberOfCarcasses: 0,
|
||||
productionDate: productionData.value?.toDateTime().formattedDashedGregorian,
|
||||
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
||||
guildKey: selectedGuildModel.value?.key,
|
||||
productKey: selectedProductModel.value?.key,
|
||||
@@ -343,21 +345,21 @@ class SalesInProvinceLogic extends GetxController {
|
||||
pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
|
||||
totalCostController.text = totalCost.value.toString().separatedByComma;
|
||||
isValid.value = true;
|
||||
productionData.value = item.productionDate.toJalali;
|
||||
}
|
||||
|
||||
void clearForm() {
|
||||
selectedGuildModel.value = null;
|
||||
weight.value = 0;
|
||||
|
||||
totalCost.value = 0;
|
||||
weightController.clear();
|
||||
if (broadcastPrice.value?.active == false) {
|
||||
pricePerKilo.value = 0;
|
||||
pricePerKiloController.clear();
|
||||
}
|
||||
|
||||
totalCostController.clear();
|
||||
isValid.value = false;
|
||||
productionData.value = null;
|
||||
}
|
||||
|
||||
Future<void> updateAllocation() async {
|
||||
|
||||
@@ -39,7 +39,6 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
isPaginating: controller.isLoadingMoreAllocationsMade.value,
|
||||
onLoadMore: () async {
|
||||
controller.currentPage.value++;
|
||||
iLog(controller.currentPage.value);
|
||||
await controller.getAllocatedMade(true);
|
||||
},
|
||||
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
|
||||
@@ -198,7 +197,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
'${item.amount.separatedByCommaFa} ریال',
|
||||
item.amount.separatedByCommaFa.addReal,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDark),
|
||||
),
|
||||
@@ -209,13 +208,37 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
SizedBox(width: 8),
|
||||
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Assets.vec.scanSvg.svg(
|
||||
width: 32.w,
|
||||
height: 32.h,
|
||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||
flex: 2,
|
||||
child: Column(
|
||||
spacing: 3,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
item.approvedPriceStatus == true
|
||||
? 'دولتی'
|
||||
: item.approvedPriceStatus == false
|
||||
? 'آزاد'
|
||||
: '-',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: item.approvedPriceStatus == true
|
||||
? AppColor.blueNormal
|
||||
: AppColor.greenNormal,
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: item.productionDate != null,
|
||||
child: Text(
|
||||
item.productionDate?.formattedJalaliDate ?? '-',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(width: 8),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -294,11 +317,6 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
/* buildRow(
|
||||
title: 'مشخصات خریدار',
|
||||
value: controller.getBuyerInformation(item)?.user?.fullname ?? 'N/A',
|
||||
),*/
|
||||
buildRow(
|
||||
title: 'تلفن خریدار',
|
||||
value: controller.getBuyerInformation(item)?.user?.mobile ?? 'N/A',
|
||||
@@ -318,8 +336,12 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
),
|
||||
buildRow(
|
||||
title: 'قیمت هر کیلوگرم',
|
||||
titleLabel: (item.approvedPriceStatus ?? false) ? 'مصوب' : 'آزاد',
|
||||
titleLabelStyle: AppFonts.yekan14Bold.copyWith(color: AppColor.greenNormal),
|
||||
titleLabel: (item.approvedPriceStatus ?? false) ? 'دولتی' : 'آزاد',
|
||||
titleLabelStyle: AppFonts.yekan14Bold.copyWith(
|
||||
color: (item.approvedPriceStatus ?? false)
|
||||
? AppColor.blueNormal
|
||||
: AppColor.greenNormal,
|
||||
),
|
||||
value: '${item.amount?.separatedByCommaFa} ریال',
|
||||
),
|
||||
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByCommaFa} ریال'),
|
||||
@@ -419,11 +441,23 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('فروش اختصاصی', style: AppFonts.yekan14),
|
||||
SizedBox(width: 30.w),
|
||||
Radio(value: 2),
|
||||
Text('فروش آزاد', style: AppFonts.yekan14),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('فروش اختصاصی', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 2),
|
||||
Text('فروش آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -437,6 +471,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
@@ -450,6 +485,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
Visibility(
|
||||
visible: isEditMode == false,
|
||||
child: Column(
|
||||
spacing: 12,
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
ObxValue((data) {
|
||||
@@ -497,49 +533,6 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
},
|
||||
label: 'وزن لاشه (کیلوگرم)',
|
||||
),
|
||||
|
||||
Obx(() {
|
||||
return RadioGroup(
|
||||
groupValue: controller.priceType.value,
|
||||
onChanged: (value) {
|
||||
controller.priceType.value = value!;
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('قیمت مصوب', style: AppFonts.yekan14),
|
||||
|
||||
SizedBox(width: 30.w),
|
||||
|
||||
Radio(value: 2),
|
||||
Text('قیمت آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
Obx(() {
|
||||
return RadioGroup(
|
||||
groupValue: controller.quotaType.value,
|
||||
onChanged: (value) {
|
||||
controller.quotaType.value = value!;
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('انبار دولتی', style: AppFonts.yekan14),
|
||||
|
||||
SizedBox(width: 30.w),
|
||||
|
||||
Radio(value: 2),
|
||||
Text('انبار آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
Obx(() {
|
||||
return Visibility(
|
||||
visible: controller.broadcastPrice.value?.active == true,
|
||||
@@ -576,29 +569,152 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
controller: controller.totalCostController,
|
||||
label: 'هزینه کل (ريال)',
|
||||
),
|
||||
|
||||
ObxValue((data) {
|
||||
return RElevated(
|
||||
text: isEditMode ? 'ویرایش' : 'ثبت',
|
||||
isFullWidth: true,
|
||||
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
height: 40,
|
||||
enabled: data.value,
|
||||
onPressed: isEditMode
|
||||
? () async {
|
||||
await controller.updateAllocation();
|
||||
Get.back();
|
||||
}
|
||||
: () async {
|
||||
await controller.submitAllocation();
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
}, controller.isValid),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
ObxValue((data) {
|
||||
return RTextField(
|
||||
controller: TextEditingController(),
|
||||
filledColor: AppColor.bgLight,
|
||||
filled: true,
|
||||
label: 'تاریخ تولید گوشت',
|
||||
onTap: () {
|
||||
Get.bottomSheet(
|
||||
modalDatePicker((value) {
|
||||
controller.productionData.value = value;
|
||||
controller.productionData.refresh();
|
||||
}),
|
||||
);
|
||||
},
|
||||
borderColor: AppColor.darkGreyLight,
|
||||
initText: data.value?.formatCompactDate(),
|
||||
);
|
||||
}, controller.productionData),
|
||||
|
||||
SizedBox(height: 12.h),
|
||||
Container(
|
||||
height: 58.h,
|
||||
clipBehavior: Clip.none,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned(
|
||||
child: Container(color: Colors.white, child: Text("نوع فروش")),
|
||||
top: -10,
|
||||
right: 8,
|
||||
),
|
||||
Obx(() {
|
||||
return RadioGroup(
|
||||
groupValue: controller.priceType.value,
|
||||
onChanged: (value) {
|
||||
controller.priceType.value = value!;
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('قیمت دولتی', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 2),
|
||||
Text('قیمت آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12.h),
|
||||
Container(
|
||||
height: 58.h,
|
||||
clipBehavior: Clip.none,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned(
|
||||
child: Container(color: Colors.white, child: Text("نوع انبار")),
|
||||
top: -10,
|
||||
right: 8,
|
||||
),
|
||||
Obx(() {
|
||||
return RadioGroup(
|
||||
groupValue: controller.quotaType.value,
|
||||
onChanged: (value) {
|
||||
controller.quotaType.value = value!;
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('انبار دولتی', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 2),
|
||||
Text('انبار آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12.h),
|
||||
ObxValue((data) {
|
||||
return RElevated(
|
||||
text: isEditMode ? 'ویرایش' : 'ثبت',
|
||||
isFullWidth: true,
|
||||
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
height: 40,
|
||||
enabled: data.value,
|
||||
onPressed: isEditMode
|
||||
? () async {
|
||||
await controller.updateAllocation();
|
||||
Get.back();
|
||||
}
|
||||
: () async {
|
||||
await controller.submitAllocation();
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
}, controller.isValid),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -30,7 +30,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
RxList<String> routesName = RxList();
|
||||
RxBool isLoadingMoreAllocationsMade = false.obs;
|
||||
Rxn<IranProvinceCityModel> selectedCity = Rxn();
|
||||
|
||||
Rxn<Jalali?> productionData = Rxn();
|
||||
GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
TextEditingController quarantineCodeController = TextEditingController();
|
||||
TextEditingController saleWeightController = TextEditingController();
|
||||
@@ -151,6 +151,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
saleType.value = item.saleType == 'free' ? 2 : 1;
|
||||
quotaType.value = item.quota == 'governmental' ? 1 : 2;
|
||||
isSaleSubmitButtonEnabled.value = true;
|
||||
productionData.value = item.productionDate.toJalali;
|
||||
}
|
||||
|
||||
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
|
||||
@@ -193,6 +194,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
quarantineCodeController.clear();
|
||||
saleWeightController.clear();
|
||||
saleDate.value = Jalali.now();
|
||||
productionData.value = null;
|
||||
saleType.value = 2;
|
||||
quotaType.value = 1;
|
||||
selectedBuyer.value = null;
|
||||
|
||||
@@ -257,28 +257,20 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
||||
buildRow(
|
||||
title: 'وزن لاشه ',
|
||||
value: '${item.weightOfCarcasses?.separatedByCommaFa}',
|
||||
valueLabel: 'کیلوگرم'
|
||||
valueLabel: 'کیلوگرم',
|
||||
),
|
||||
buildRow(
|
||||
title: 'حجم تقریبی لاشه ',
|
||||
value: '${item.numberOfCarcasses?.separatedByCommaFa}',
|
||||
valueLabel: 'قطعه'
|
||||
|
||||
),
|
||||
buildRow(
|
||||
title: 'انبار فروش',
|
||||
value: '${item.quota?.faTitle}',
|
||||
),
|
||||
buildRow(
|
||||
title: 'کد قرنطینه ',
|
||||
value: item.clearanceCode?? 'بدون کد',
|
||||
valueLabel: 'قطعه',
|
||||
),
|
||||
buildRow(title: 'انبار فروش', value: '${item.quota?.faTitle}'),
|
||||
buildRow(title: 'کد قرنطینه ', value: item.clearanceCode ?? 'بدون کد'),
|
||||
|
||||
buildRow(
|
||||
title: 'حجم تقریبی لاشه ',
|
||||
value: '${item.numberOfCarcasses?.separatedByCommaFa}',
|
||||
valueLabel: 'قطعه'
|
||||
|
||||
title: 'حجم تقریبی لاشه ',
|
||||
value: '${item.numberOfCarcasses?.separatedByCommaFa}',
|
||||
valueLabel: 'قطعه',
|
||||
),
|
||||
|
||||
Row(
|
||||
@@ -351,17 +343,44 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
||||
child: Column(
|
||||
spacing: 12,
|
||||
children: [
|
||||
Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: timeFilterWidget(
|
||||
date: controller.saleDate,
|
||||
onChanged: (jalali) => controller.saleDate.value = jalali,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
ObxValue((data) {
|
||||
return RTextField(
|
||||
controller: TextEditingController(),
|
||||
filledColor: AppColor.bgLight,
|
||||
filled: true,
|
||||
label: 'تاریخ',
|
||||
onTap: () {
|
||||
Get.bottomSheet(
|
||||
modalDatePicker((value) {
|
||||
controller.saleDate.value = value;
|
||||
|
||||
controller.saleDate.refresh();
|
||||
}),
|
||||
);
|
||||
},
|
||||
borderColor: AppColor.darkGreyLight,
|
||||
initText: data.value?.formatCompactDate(),
|
||||
);
|
||||
}, controller.saleDate),
|
||||
|
||||
ObxValue((data) {
|
||||
return RTextField(
|
||||
controller: TextEditingController(),
|
||||
filledColor: AppColor.bgLight,
|
||||
filled: true,
|
||||
label: 'تاریخ تولید گوشت',
|
||||
onTap: () {
|
||||
Get.bottomSheet(
|
||||
modalDatePicker((value) {
|
||||
controller.productionData.value = value;
|
||||
controller.productionData.refresh();
|
||||
}),
|
||||
);
|
||||
},
|
||||
borderColor: AppColor.darkGreyLight,
|
||||
initText: data.value?.formatCompactDate(),
|
||||
);
|
||||
}, controller.productionData),
|
||||
_buyerWidget(),
|
||||
RTextField(
|
||||
controller: controller.saleWeightController,
|
||||
@@ -417,53 +436,130 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
||||
return null;
|
||||
},
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: ObxValue((data) {
|
||||
return RadioGroup(
|
||||
onChanged: (value) {
|
||||
controller.saleType.value = value ?? 0;
|
||||
},
|
||||
groupValue: controller.saleType.value,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Radio(value: 1, enabled: false),
|
||||
Text('فروش دولتی', style: AppFonts.yekan14),
|
||||
SizedBox(width: 12),
|
||||
Radio(value: 2, enabled: isOnEdit ? false : true),
|
||||
Text('فروش آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.saleType),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: ObxValue((data) {
|
||||
return RadioGroup(
|
||||
onChanged: (value) {
|
||||
controller.quotaType.value = value ?? 0;
|
||||
},
|
||||
groupValue: controller.quotaType.value,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Radio(value: 1, enabled: isOnEdit ? false : true),
|
||||
Text('انبار دولتی', style: AppFonts.yekan14),
|
||||
SizedBox(width: 12),
|
||||
Radio(value: 2, enabled: isOnEdit ? false : true),
|
||||
Text('انبار آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.saleType),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 50.h,
|
||||
clipBehavior: Clip.none,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned(
|
||||
child: Container(color: Colors.white, child: Text("نوع فروش")),
|
||||
top: -10,
|
||||
right: 8,
|
||||
),
|
||||
Obx(() {
|
||||
return RadioGroup(
|
||||
groupValue: controller.saleType.value,
|
||||
onChanged: (value) {
|
||||
controller.saleType.value = value ?? 0;
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.saleType.value = 1;
|
||||
},
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('قیمت دولتی', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.saleType.value = 2;
|
||||
},
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 2),
|
||||
Text('قیمت آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 50.h,
|
||||
clipBehavior: Clip.none,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned(
|
||||
child: Container(color: Colors.white, child: Text("نوع انبار")),
|
||||
top: -10,
|
||||
right: 8,
|
||||
),
|
||||
Obx(() {
|
||||
return RadioGroup(
|
||||
groupValue: controller.quotaType.value,
|
||||
onChanged: (value) {
|
||||
controller.quotaType.value = value ?? 0;
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.quotaType.value = 1;
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('انبار دولتی', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.quotaType.value = 2;
|
||||
},
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 2),
|
||||
Text('انبار آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
submitButtonWidget(isOnEdit),
|
||||
SizedBox(),
|
||||
],
|
||||
@@ -539,6 +635,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
||||
|
||||
GestureDetector timeFilterWidget({
|
||||
isFrom = true,
|
||||
String? title,
|
||||
required Rx<Jalali> date,
|
||||
required Function(Jalali jalali) onChanged,
|
||||
}) {
|
||||
@@ -562,7 +659,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
||||
height: 24,
|
||||
colorFilter: const ColorFilter.mode(AppColor.bgDark, BlendMode.srcIn),
|
||||
),
|
||||
Text('تاریخ', style: AppFonts.yekan16.copyWith(color: AppColor.bgDark)),
|
||||
Text(title ?? 'تاریخ', style: AppFonts.yekan16.copyWith(color: AppColor.bgDark)),
|
||||
Expanded(
|
||||
child: ObxValue((data) {
|
||||
return Text(
|
||||
|
||||
@@ -208,9 +208,10 @@ class SegmentationPage extends GetView<SegmentationLogic> {
|
||||
: item.buyer?.shop ?? 'N/A',
|
||||
),
|
||||
buildRow(title: 'ماهیت', value: item.toGuild != null ? 'مباشر' : 'قطعهبند'),
|
||||
buildRow(title: 'وزن قطعهبندی',
|
||||
value: item.weight!.separatedByCommaFa,
|
||||
valueLabel: 'کیلوگرم'
|
||||
buildRow(
|
||||
title: 'وزن قطعهبندی',
|
||||
value: item.weight!.separatedByCommaFa,
|
||||
valueLabel: 'کیلوگرم',
|
||||
),
|
||||
|
||||
Row(
|
||||
@@ -313,65 +314,130 @@ class SegmentationPage extends GetView<SegmentationLogic> {
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
height: 50.h,
|
||||
clipBehavior: Clip.none,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||
),
|
||||
|
||||
child: Column(
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: ObxValue((data) {
|
||||
return RadioGroup(
|
||||
onChanged: (value) {
|
||||
controller.saleType.value = value ?? 0;
|
||||
controller.selectedGuildModel.value = null;
|
||||
controller.selectedGuildModel.refresh();
|
||||
},
|
||||
groupValue: controller.saleType.value,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('فروش دولتی', style: AppFonts.yekan14),
|
||||
SizedBox(width: 12),
|
||||
Radio(value: 2),
|
||||
Text('فروش آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.saleType),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: ObxValue((data) {
|
||||
return RadioGroup(
|
||||
onChanged: (value) {
|
||||
controller.quotaType.value = value ?? 0;
|
||||
},
|
||||
groupValue: controller.quotaType.value,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('انبار دولتی', style: AppFonts.yekan14),
|
||||
SizedBox(width: 12),
|
||||
Radio(value: 2),
|
||||
Text('انبار آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.saleType),
|
||||
Positioned(
|
||||
child: Container(color: Colors.white, child: Text("نوع فروش")),
|
||||
top: -10,
|
||||
right: 8,
|
||||
),
|
||||
Obx(() {
|
||||
return RadioGroup(
|
||||
groupValue: controller.saleType.value,
|
||||
onChanged: (value) {
|
||||
controller.saleType.value = value ?? 0;
|
||||
controller.selectedGuildModel.value = null;
|
||||
controller.selectedGuildModel.refresh();
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.saleType.value = 1;
|
||||
},
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('قیمت دولتی', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.saleType.value = 2;
|
||||
},
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 2),
|
||||
Text('قیمت آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 50.h,
|
||||
clipBehavior: Clip.none,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned(
|
||||
child: Container(color: Colors.white, child: Text("نوع انبار")),
|
||||
top: -10,
|
||||
right: 8,
|
||||
),
|
||||
Obx(() {
|
||||
return RadioGroup(
|
||||
groupValue: controller.quotaType.value,
|
||||
onChanged: (value) {
|
||||
controller.quotaType.value = value ?? 0;
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.quotaType.value = 1;
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text('انبار دولتی', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.quotaType.value = 2;
|
||||
},
|
||||
child: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 2),
|
||||
Text('انبار آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
|
||||
Reference in New Issue
Block a user