diff --git a/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart b/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart index 3d48965..b8a1456 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_in_province/logic.dart @@ -39,6 +39,7 @@ class SalesInProvinceLogic extends GetxController { Rxn selectedGuildModel = Rxn(); Rxn guildProfile = Rxn(); RxInt saleType = 1.obs; + RxInt priceType = 1.obs; RxInt weight = 0.obs; RxInt pricePerKilo = 0.obs; RxInt totalCost = 0.obs; @@ -70,7 +71,7 @@ class SalesInProvinceLogic extends GetxController { }); debounce(weight, time: Duration(milliseconds: 110), (callback) { - iLog('weight: $callback, pricePerKilo: ${pricePerKilo.value}'); + totalCost.value = callback * pricePerKilo.value; }); @@ -273,7 +274,7 @@ class SalesInProvinceLogic extends GetxController { void setSubmitData() { tmpStewardAllocation = SubmitStewardAllocation( - approvedPriceStatus: false, + approvedPriceStatus: broadcastPrice.value?.active ?? false, allocationType: '${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}', sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild", diff --git a/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart b/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart index e821761..97b3028 100644 --- a/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart +++ b/packages/chicken/lib/presentation/pages/steward/sales_in_province/view.dart @@ -417,13 +417,8 @@ class SalesInProvincePage extends GetView { controller.selectedGuildModel.refresh(); }, ), - ObxValue((data) { - return Text( - (data.value?.active == true) ? 'قیمت مصوب' : 'فروش اختصاصی', - style: AppFonts.yekan14, - ); - }, controller.broadcastPrice), - SizedBox(width: 12), + Text('فروش اختصاصی', style: AppFonts.yekan14), + SizedBox(width: 30.w), Radio( value: 2, groupValue: controller.saleType.value, @@ -506,24 +501,46 @@ class SalesInProvincePage extends GetView { ), Obx(() { - return RTextField( - variant: RTextFieldVariant.noBorder, - controller: controller.pricePerKiloController, - borderColor: AppColor.darkGreyLight, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - SeparatorInputFormatter(), - ], - filledColor: AppColor.bgLight, - filled: true, - enabled: - (controller.broadcastPrice.value?.active == false || - controller.saleType.value == 2), - onChanged: (p0) { - controller.pricePerKilo.value = int.tryParse(p0.clearComma) ?? 0; + return RadioGroup( + groupValue: controller.priceType.value, + onChanged: (value) { + controller.priceType.value = value!; }, - keyboardType: TextInputType.number, - label: 'قیمت هر کیلو (ريال)', + 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, + child: RTextField( + variant: RTextFieldVariant.noBorder, + controller: controller.pricePerKiloController, + borderColor: AppColor.darkGreyLight, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + SeparatorInputFormatter(), + ], + filledColor: AppColor.bgLight, + filled: true, + enabled: (controller.priceType.value == 2), + onChanged: (p0) { + controller.pricePerKilo.value = int.tryParse(p0.clearComma) ?? 0; + }, + keyboardType: TextInputType.number, + label: 'قیمت هر کیلو (ريال)', + ), ); }), diff --git a/pubspec.yaml b/pubspec.yaml index a10dc28..cdc864e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: rasadyar_app description: "A new Flutter project." publish_to: 'none' -version: 1.3.16+13 +version: 1.3.17+14 environment: sdk: ^3.9.2