fix : some bug

This commit is contained in:
2025-10-11 17:16:26 +03:30
parent be6e16f54e
commit 9a29b0ea58
20 changed files with 1962 additions and 300 deletions

View File

@@ -1,10 +1,11 @@
import 'package:flutter/material.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/presentation/pages/steward/root/logic.dart';
import 'package:rasadyar_core/core.dart';
class BuyInProvinceAllLogic extends GetxController {
RxList<int> isExpandedList = <int>[].obs;
RxInt isExpandedListIndex = (-1).obs;
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString();
@@ -17,6 +18,13 @@ class BuyInProvinceAllLogic extends GetxController {
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();
@@ -87,22 +95,23 @@ class BuyInProvinceAllLogic extends GetxController {
state: 'accepted',
receiverRealNumberOfCarcasses: model.realNumberOfCarcasses ?? 0,
receiverRealWeightOfCarcasses: model.realWeightOfCarcasses?.toInt() ?? 0,
registrationCode: model.registrationCode ?? 0,
registrationCode: model.registrationCode,
weightLossOfCarcasses: model.weightLossOfCarcasses?.toInt() ?? 0,
).toJson();
request.removeWhere((key, value) => value == null);
safeCall(
showError: true,
call: () async => await rootLogic.chickenRepository.setSateForArrivals(
token: rootLogic.tokenService.accessToken.value!,
request: request,
),
onError: (error, stackTrace) {
eLog(error);
},
onSuccess: (result) {
getAllArrivals();
rootLogic.getInventory();
rootLogic.onRefresh();
clearApprovedController();
toggleExpansion();
Get.back();
},
);
}
@@ -125,7 +134,7 @@ class BuyInProvinceAllLogic extends GetxController {
},
onSuccess: (result) {
getAllArrivals();
rootLogic.getInventory();
rootLogic.onRefresh();
},
);
}
@@ -142,4 +151,20 @@ class BuyInProvinceAllLogic extends GetxController {
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;
}
}
}

View File

@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart' hide ListItem2;
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -24,20 +23,19 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
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),
);
}, controller.isExpandedList);
}, controller.isExpandedListIndex);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getAllArrivals(true),
);
}, controller.allProduct),
);
@@ -138,12 +136,11 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
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)
SvgGenImage.vec(controller.getVecPathItem(item.receiverState)).svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(AppColor.darkGreyDark, BlendMode.srcIn),
),
],
),
Container(
@@ -187,19 +184,13 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
),
),
buildRow(
title: 'مشخصات فروشنده',
value: item.steward?.user?.fullname ?? 'N/A',
),
buildRow(title: 'مشخصات فروشنده', value: item.steward?.user?.fullname ?? 'N/A'),
buildRow(
title: 'تلفن فروشنده',
value: item.steward?.user?.mobile ?? 'N/A',
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
buildRow(
title: 'نوع تخصیص',
value: item.allocationType?.faAllocationType ?? 'N/A',
),
buildRow(title: 'نوع تخصیص', value: item.allocationType?.faAllocationType ?? 'N/A'),
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
buildRow(
title: 'وزن خریداری شده',
@@ -219,9 +210,12 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
height: 40.h,
isLoading: data[item.key!] ?? false,
onPressed: () async {
data[item.key!] = !(data[item.key!] ?? false);
await controller.acceptEntries(item);
data.remove(item.key!);
Get.bottomSheet(conformationBottomSheet(item), isScrollControlled: true).then(
(value) {
Get.back();
controller.clearApprovedController();
},
);
},
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
backgroundColor: AppColor.greenNormal,
@@ -255,7 +249,6 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
case 'pending':
return AppColor.blueLight;
case 'accepted':
return AppColor.greenLightHover;
case 'rejected':
return AppColor.redLightHover;
@@ -263,4 +256,109 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
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)),
],
),
);
}
}

View File

@@ -8,7 +8,7 @@ import 'package:rasadyar_chicken/presentation/utils/utils.dart';
import 'package:rasadyar_core/core.dart';
class BuyInProvinceWaitingLogic extends GetxController {
RxList<int> isExpandedList = <int>[].obs;
RxInt isExpandedListIndex = (-1).obs;
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString();
@@ -21,6 +21,13 @@ class BuyInProvinceWaitingLogic extends GetxController {
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();
@@ -99,12 +106,13 @@ class BuyInProvinceWaitingLogic extends GetxController {
state: 'accepted',
receiverRealNumberOfCarcasses: model.realNumberOfCarcasses ?? 0,
receiverRealWeightOfCarcasses: model.realWeightOfCarcasses?.toInt() ?? 0,
registrationCode: model.registrationCode ?? 0,
registrationCode: model.registrationCode,
weightLossOfCarcasses: model.weightLossOfCarcasses?.toInt() ?? 0,
).toJson();
request.removeWhere((key, value) => value == null);
safeCall(
showError: true,
call: () async => await rootLogic.chickenRepository.setSateForArrivals(
token: rootLogic.tokenService.accessToken.value!,
request: request,
@@ -114,7 +122,10 @@ class BuyInProvinceWaitingLogic extends GetxController {
},
onSuccess: (result) {
getWaitingArrivals();
// getBarGeneralInformation();
rootLogic.onRefresh();
clearApprovedController();
toggleExpansion();
Get.back();
},
);
}
@@ -137,8 +148,7 @@ class BuyInProvinceWaitingLogic extends GetxController {
},
onSuccess: (result) {
getWaitingArrivals();
//TODO
// getBarGeneralInformation();
rootLogic.onRefresh();
},
);
}
@@ -152,4 +162,20 @@ class BuyInProvinceWaitingLogic extends GetxController {
}
});
}
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;
}
}
}

View File

@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart' hide ListItem2;
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -26,15 +25,15 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
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,
);
}, controller.isExpandedList);
}, controller.isExpandedListIndex);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
@@ -184,25 +183,22 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
),
),
buildRow(
title: 'مشخصات فروشنده',
value: item.steward?.user?.fullname ?? 'N/A',
),
buildRow(title: 'مشخصات فروشنده', value: item.toSteward?.user?.fullname ?? 'N/A'),
buildRow(
title: 'تلفن فروشنده',
value: item.steward?.user?.mobile ?? 'N/A',
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.allocationType?.faAllocationType ?? 'N/A'),
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
buildRow(
title: 'وزن خریداری شده',
value: '${item.weightOfCarcasses?.separatedByCommaFa} کیلوگرم',
),
buildRow(title: 'قیمت هر کیلو', value: '${item.amount?.separatedByCommaFa} ریال'),
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByCommaFa} ریال'),
Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 16.w,
@@ -214,9 +210,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
height: 40.h,
isLoading: data[item.key!] ?? false,
onPressed: () async {
data[item.key!] = !(data[item.key!] ?? false);
await controller.acceptEntries(item);
data.remove(item.key!);
await Get.bottomSheet(conformationBottomSheet(item), isScrollControlled: true);
},
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
backgroundColor: AppColor.greenNormal,
@@ -243,4 +237,109 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
),
);
}
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)),
],
),
);
}
}

View File

@@ -11,9 +11,9 @@ import 'package:rasadyar_core/core.dart';
class BuyOutOfProvinceLogic extends GetxController {
late List<String> routesName;
RxBool isExpanded = false.obs;
RxBool isSubmitButtonEnabled = false.obs;
RxList<int> isExpandedList = <int>[].obs;
RxInt expandedListIndex = (-1).obs;
final RxInt currentPage = 1.obs;
final RxBool isLoadingMoreAllocationsMade = false.obs;
final RxBool isOnLoadingSubmitOrEdit = false.obs;
@@ -34,14 +34,15 @@ class BuyOutOfProvinceLogic extends GetxController {
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
BuyLogic get buyLogic => Get.find<BuyLogic>();
BuyLogic buyLogic = Get.find<BuyLogic>();
SaleLogic get outOfTheProvinceLogic => Get.find<SaleLogic>();
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;
@@ -51,8 +52,6 @@ class BuyOutOfProvinceLogic extends GetxController {
void onInit() {
super.onInit();
routesName = [...buyLogic.routesName, 'خارج استان'].toList();
fLog('BuyOutOfProvinceLogic ${rootLogic.stewardSalesInfoDashboard}');
}
@override
@@ -76,7 +75,6 @@ class BuyOutOfProvinceLogic extends GetxController {
sellerNameController.dispose();
sellerPhoneController.dispose();
carcassWeightController.dispose();
isExpandedList.clear();
super.onClose();
}
@@ -144,9 +142,15 @@ class BuyOutOfProvinceLogic extends GetxController {
}
void setupListeners() {
sellerNameController.addListener(checkFormValid);
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());
@@ -164,19 +168,26 @@ class BuyOutOfProvinceLogic extends GetxController {
sellerNameController.text.isNotEmpty &&
sellerPhoneController.text.isNotEmpty &&
carcassWeightController.text.isNotEmpty &&
carcassCountController.text.isNotEmpty &&
selectedProvince.value != null &&
selectedCity.value != null &&
selectedProduct.value != null &&
selectedImage.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,
@@ -188,7 +199,7 @@ class BuyOutOfProvinceLogic extends GetxController {
barImage: _base64Image.value,
date: DateTime.now().formattedYHMS,
);
final res = await rootLogic.chickenRepository.createStewardPurchasesOutSideOfTheProvince(
await rootLogic.chickenRepository.createStewardPurchasesOutSideOfTheProvince(
token: rootLogic.tokenService.accessToken.value!,
body: createStewardFreeBar,
);
@@ -196,6 +207,7 @@ class BuyOutOfProvinceLogic extends GetxController {
onSuccess: (result) {
getStewardPurchaseOutOfProvince();
resetSubmitForm();
toggleExpansion();
res = true;
},
);
@@ -229,11 +241,31 @@ class BuyOutOfProvinceLogic extends GetxController {
isSubmitButtonEnabled.value = true;
}
Future<void> editStewardPurchaseOutOfProvince(StewardFreeBar item) async {
CreateStewardFreeBar edit = 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),
barImage: _base64Image.value,
date: DateTime.now().formattedYHMS,
);
await safeCall(
call: () => rootLogic.chickenRepository.editStewardPurchasesOutSideOfTheProvince(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildRawQueryParams(queryParams: {'key': key}),
),
);
}
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
await safeCall(
call: () => rootLogic.chickenRepository.deleteStewardPurchasesOutSideOfTheProvince(
call: () => rootLogic.chickenRepository.editStewardPurchasesOutSideOfTheProvince(
token: rootLogic.tokenService.accessToken.value!,
stewardFreeBarKey: key,
queryParameters: buildRawQueryParams(queryParams: {'key': key}),
),
);
}
@@ -243,4 +275,12 @@ class BuyOutOfProvinceLogic extends GetxController {
await rootLogic.onRefresh();
await getStewardPurchaseOutOfProvince();
}
void toggleExpansion({int? index}) {
if (expandedListIndex.value == index || index == null) {
expandedListIndex.value = -1; // Collapse if the same index is tapped
} else {
expandedListIndex.value = index; // Expand the new index
}
}
}

View File

@@ -43,15 +43,15 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
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.isExpandedList);
}, controller.expandedListIndex);
},
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
@@ -380,6 +380,16 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
SeparatorInputFormatter(),
],
),
UnitTextField(
controller: controller.carcassCountController,
hint: 'حجم',
unit: 'قطعه',
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
SeparatorInputFormatter(),
],
),
],
),
),

View File

@@ -15,7 +15,7 @@ import 'package:rasadyar_core/core.dart';
class SalesOutOfProvinceLogic extends GetxController {
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
SaleLogic get saleLogic => Get.find<SaleLogic>();
SaleLogic saleLogic = Get.find<SaleLogic>();
@@ -148,7 +148,7 @@ class SalesOutOfProvinceLogic extends GetxController {
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
await safeCall(
call: () => rootLogic.chickenRepository.deleteStewardPurchasesOutSideOfTheProvince(
call: () => rootLogic.chickenRepository.editStewardPurchasesOutSideOfTheProvince(
token: rootLogic.tokenService.accessToken.value!,
stewardFreeBarKey: key,
),

View File

@@ -32,45 +32,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
child: Column(
children: [
inventoryWidget(controller.rootLogic),
/*Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
spacing: 8,
children: [
Expanded(
child: _informationLabelCard(
title: 'مانده دولتی',
titleColor: AppColor.textColor,
borderColor: Color(0xFFFFAE00),
description: 356952222222.separatedByCommaFa,
iconPath: Assets.vec.cubeCardGovermentSvg.path,
bgDescriptionColor: Colors.white,
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFFFFD47A), Colors.white],
),
),
),
Expanded(
child: _informationLabelCard(
title: 'مانده آزاد',
borderColor: const Color(0xFF9758FF),
description: 9658554788.separatedByCommaFa,
unit: 'KG',
iconPath: Assets.vec.cubeCardFreeSvg.path,
bgDescriptionColor: Colors.white,
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [const Color(0xFFD3B9FF), Colors.white],
),
),
),
],
),
),*/
ObxValue((data) {
return RPaginatedListView(
onLoadMore: () async => controller.getOutProvinceSales(true),

View File

@@ -148,7 +148,7 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
await safeCall(
call: () => rootLogic.chickenRepository
.deleteStewardPurchasesOutSideOfTheProvince(
.editStewardPurchasesOutSideOfTheProvince(
token: rootLogic.tokenService.accessToken.value!,
stewardFreeBarKey: key,
),