feat : new changes from back
This commit is contained in:
@@ -35,6 +35,11 @@ class BuyInProvinceAllLogic extends GetxController {
|
||||
void onReady() {
|
||||
debounce(searchedValue, (callback) => getAllArrivals(), time: Duration(milliseconds: 2000));
|
||||
super.onReady();
|
||||
ever(approvedWithOtpCode, (callback) {
|
||||
if (callback == false) {
|
||||
approvedWithOtpController.clear();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -95,7 +100,9 @@ class BuyInProvinceAllLogic extends GetxController {
|
||||
state: 'accepted',
|
||||
receiverRealNumberOfCarcasses: model.realNumberOfCarcasses ?? 0,
|
||||
receiverRealWeightOfCarcasses: model.realWeightOfCarcasses?.toInt() ?? 0,
|
||||
registrationCode: model.registrationCode,
|
||||
registrationCode: approvedWithOtpCode.value
|
||||
? int.parse(approvedWithOtpController.text)
|
||||
: null,
|
||||
weightLossOfCarcasses: model.weightLossOfCarcasses?.toInt() ?? 0,
|
||||
).toJson();
|
||||
request.removeWhere((key, value) => value == null);
|
||||
|
||||
@@ -125,7 +125,7 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
item.steward?.user?.fullname ?? 'N/A',
|
||||
item.toSteward?.user?.fullname ?? 'N/A',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
||||
),
|
||||
@@ -184,19 +184,27 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
|
||||
),
|
||||
),
|
||||
|
||||
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.product?.name ?? 'N/A'),
|
||||
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} ریال'),
|
||||
|
||||
Visibility(
|
||||
visible: item.receiverState == 'pending',
|
||||
child: Row(
|
||||
@@ -210,12 +218,14 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
|
||||
height: 40.h,
|
||||
isLoading: data[item.key!] ?? false,
|
||||
onPressed: () async {
|
||||
Get.bottomSheet(conformationBottomSheet(item), isScrollControlled: true).then(
|
||||
(value) {
|
||||
Get.back();
|
||||
controller.clearApprovedController();
|
||||
},
|
||||
);
|
||||
await Get.bottomSheet(
|
||||
conformationBottomSheet(item),
|
||||
isScrollControlled: true,
|
||||
).then((value) {
|
||||
|
||||
Get.back();
|
||||
controller.clearApprovedController();
|
||||
});
|
||||
},
|
||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
|
||||
@@ -17,6 +17,7 @@ class BuyInProvinceWaitingLogic extends GetxController {
|
||||
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;
|
||||
@@ -42,6 +43,9 @@ class BuyInProvinceWaitingLogic extends GetxController {
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
getWaitingArrivals();
|
||||
approvedWithOtpController.addListener(() {
|
||||
isButtonConfirm.value = approvedWithOtpController.text.trim().length > 4;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -106,13 +110,17 @@ class BuyInProvinceWaitingLogic extends GetxController {
|
||||
state: 'accepted',
|
||||
receiverRealNumberOfCarcasses: model.realNumberOfCarcasses ?? 0,
|
||||
receiverRealWeightOfCarcasses: model.realWeightOfCarcasses?.toInt() ?? 0,
|
||||
registrationCode: model.registrationCode,
|
||||
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.chickenRepository.setSateForArrivals(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
request: request,
|
||||
@@ -125,7 +133,10 @@ class BuyInProvinceWaitingLogic extends GetxController {
|
||||
rootLogic.onRefresh();
|
||||
clearApprovedController();
|
||||
toggleExpansion();
|
||||
Get.back();
|
||||
Future.delayed(Duration(seconds: 3), () {
|
||||
Get.back();
|
||||
Get.back();
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
item.steward?.user?.fullname ?? 'N/A',
|
||||
item.toSteward?.user?.fullname ?? 'N/A',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
|
||||
),
|
||||
@@ -189,14 +189,20 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
value: item.toSteward?.user?.mobile ?? 'N/A',
|
||||
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
buildRow(title: 'نوع تخصیص', value: item.quota?.faTitle ?? 'N/A'),
|
||||
buildRow(title: 'سهمیه', value: item.allocationType?.faAllocationType ?? 'N/A'),
|
||||
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} کیلوگرم',
|
||||
),
|
||||
buildRow(title: 'قیمت هر کیلو', value: '${item.amount?.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(
|
||||
@@ -241,10 +247,11 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
Widget conformationBottomSheet(WaitingArrivalModel item) {
|
||||
controller.weightController.text = item.weightOfCarcasses.separatedByComma;
|
||||
return BaseBottomSheet(
|
||||
height: 430.h,
|
||||
height: 450.h,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(height: 10),
|
||||
RTextField(
|
||||
label: 'وزن(کیلوگرم)',
|
||||
controller: controller.weightController,
|
||||
@@ -301,6 +308,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
controller: controller.approvedWithOtpController,
|
||||
label: 'کد احراز',
|
||||
keyboardType: TextInputType.number,
|
||||
maxLength: 5,
|
||||
),
|
||||
visible: data.value,
|
||||
),
|
||||
@@ -308,10 +316,10 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
);
|
||||
}, controller.approvedWithOtpCode),
|
||||
SizedBox(height: 30.h),
|
||||
ObxValue((data) {
|
||||
Obx(() {
|
||||
return RElevated(
|
||||
enabled: controller.approvedWithOtpCode.value
|
||||
? controller.approvedWithOtpController.text.isNotEmpty
|
||||
? controller.isButtonConfirm.value
|
||||
: true,
|
||||
text: 'تایید',
|
||||
onPressed: () async {
|
||||
@@ -319,7 +327,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
|
||||
},
|
||||
isFullWidth: true,
|
||||
);
|
||||
}, controller.approvedWithOtpCode),
|
||||
}),
|
||||
SizedBox(height: 20.h),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -221,6 +221,7 @@ class BuyOutOfProvinceLogic extends GetxController {
|
||||
sellerNameController.clear();
|
||||
sellerPhoneController.clear();
|
||||
carcassWeightController.clear();
|
||||
carcassCountController.clear();
|
||||
selectedProvince.value = null;
|
||||
selectedCity.value = null;
|
||||
selectedImage.value = null;
|
||||
|
||||
@@ -274,7 +274,7 @@ class SalesInProvinceLogic extends GetxController {
|
||||
|
||||
void setSubmitData() {
|
||||
tmpStewardAllocation = SubmitStewardAllocation(
|
||||
approvedPriceStatus: broadcastPrice.value?.active ?? false,
|
||||
approvedPriceStatus: priceType.value==1,
|
||||
allocationType:
|
||||
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}',
|
||||
sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild",
|
||||
|
||||
@@ -303,8 +303,9 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
value: controller.getBuyerInformation(item)?.user?.mobile ?? 'N/A',
|
||||
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
buildRow(title: 'نوع فروش', value: item.sellType?.faItem ?? 'N/A'),
|
||||
buildRow(title: 'محصول', value: item.product?.name ?? 'N/A'),
|
||||
buildRow(title: 'نوع فروش', value: item.sellType?.faItem ?? 'N/A'),
|
||||
|
||||
buildRow(title: 'نوع تخصیص', value: item.allocationType?.faAllocationType ?? 'N/A'),
|
||||
buildRow(
|
||||
title: 'وزن خریداری شده',
|
||||
@@ -314,6 +315,12 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
title: 'افت وزن(کیلوگرم)',
|
||||
value: item.weightLossOfCarcasses?.toInt().toString() ?? 'N/A',
|
||||
),
|
||||
buildRow(
|
||||
title: 'قیمت هر کیلوگرم',
|
||||
titleLabel: (item.approvedPriceStatus ?? false) ? 'مصوب' : 'آزاد',
|
||||
titleLabelStyle: AppFonts.yekan14Bold.copyWith(color: AppColor.greenNormal),
|
||||
value: '${item.amount?.separatedByCommaFa} ریال',
|
||||
),
|
||||
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByCommaFa} ریال'),
|
||||
|
||||
buildRow(title: 'کداحراز', value: item.registrationCode?.toString() ?? 'ندارد'),
|
||||
|
||||
@@ -129,10 +129,23 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
item.date?.formattedJalaliDate ?? 'N/A',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
item.date?.formattedJalaliDate ?? 'N/A',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
|
||||
Text(
|
||||
'${item.weightOfCarcasses?.separatedByCommaFa ?? 0}KG',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12Bold.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
@@ -163,27 +176,22 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
|
||||
|
||||
Text(
|
||||
item.buyer?.unitName ?? 'N/A',
|
||||
item.buyer?.province?? 'N/A',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
Text(
|
||||
'${item.weightOfCarcasses?.separatedByCommaFa ?? 0}KG',
|
||||
item.buyer?.city?? 'N/A',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'${item.buyer?.province}\n${item.buyer?.city}',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -123,14 +123,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'${item.buyer?.province}\n${item.buyer?.city}',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
|
||||
|
||||
Widget addOrEditBottomSheet([bool isOnEdit = false]) {
|
||||
return BaseBottomSheet(
|
||||
height: 500.h,
|
||||
height: 550.h,
|
||||
child: SingleChildScrollView(
|
||||
child: Form(
|
||||
key: controller.formKey,
|
||||
|
||||
@@ -18,15 +18,16 @@ Widget inventoryWidget(StewardRootLogic rootLogic) {
|
||||
return _itemList(
|
||||
title: 'موجودی انبار',
|
||||
value: value ?? '', // در صورت نال بودن، رشته خالی نمایش داده شود
|
||||
color: const Color(0xFFEAFBFC),
|
||||
);
|
||||
}, rootLogic.inventoryModel),
|
||||
ObxValue((data) {
|
||||
final value = data.value?.totalGovernmentalRemainWeight?.separatedByCommaFa;
|
||||
return _itemList(title: 'مانده دولتی', value: value ?? '');
|
||||
return _itemList(title: 'مانده دولتی', value: value ?? '',color: const Color(0xFFF5ECEE),);
|
||||
}, rootLogic.stewardSalesInfoDashboard),
|
||||
ObxValue((data) {
|
||||
final value = data.value?.totalFreeRemainWeight?.separatedByCommaFa;
|
||||
return _itemList(title: 'مانده آزاد', value: value ?? '');
|
||||
return _itemList(title: 'مانده آزاد', value: value ?? '',color: const Color(0xFFF1E7FF));
|
||||
}, rootLogic.stewardSalesInfoDashboard),
|
||||
],
|
||||
),
|
||||
@@ -34,13 +35,13 @@ Widget inventoryWidget(StewardRootLogic rootLogic) {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _itemList({required String title, required String? value, String? unit}) {
|
||||
Widget _itemList({required String title, required String? value, String? unit,Color? color}) {
|
||||
return Container(
|
||||
width: 125.w,
|
||||
height: 50.h,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.40),
|
||||
color: color??Colors.white.withValues(alpha: 0.40),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Column(
|
||||
|
||||
Reference in New Issue
Block a user