feat : buy in province

This commit is contained in:
2025-07-07 11:38:37 +03:30
parent 21d3490d0c
commit 80dabe991d
23 changed files with 568 additions and 605 deletions

View File

@@ -1,31 +1,39 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/pages/buy/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/buy_in_province_all/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/buy_in_province_waiting/logic.dart';
import 'package:rasadyar_chicken/presentation/pages/root/logic.dart';
import 'package:rasadyar_core/core.dart';
class BuyInProvinceLogic extends GetxController {
RxList<String> routesName = RxList();
RxList<String> routesName = RxList();
RxList<int> isExpandedList = <int>[].obs;
RxnString searchedValue = RxnString();
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
RootLogic get rootLogic => Get.find<RootLogic>();
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 ? 'در انتظار':'همه');
routesName.add(selectedSegmentIndex.value == 0 ? 'در انتظار' : 'همه');
ever(selectedSegmentIndex, (callback) {
routesName.removeLast();
routesName.add(callback ==0 ? 'در انتظار':'همه');
},);
routesName.add(callback == 0 ? 'در انتظار' : 'همه');
});
ever(fromDateFilter, (callback) => _setFromDateFilter(callback));
ever(toDateFilter, (callback) => _setToDateFilter(callback));
}
@override
void onReady() {
// TODO: implement onReady
@@ -38,8 +46,40 @@ class BuyInProvinceLogic extends GetxController {
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.getImportedEntries();
}
}
void setSearchValue(String? data) {
searchedValue.value = data?.trim();
//TODO
final isWaiting = selectedSegmentIndex.value == 0;
if (isWaiting) {
buyWaitingLogic.searchedValue.value = searchedValue.value;
} else {
buyAllLogic.searchedValue.value = searchedValue.value;
}
}
}

View File

@@ -16,7 +16,7 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
routesWidget: ObxValue((route) => buildPageRoute(route), controller.routesName),
onBackPressed: () => Get.back(id: 0),
onSearchChanged: (data) => controller.setSearchValue(data),
filteringWidget: Container(color: Colors.redAccent),
filteringWidget: filterBottomSheet(),
widgets: [
segmentWidget(),
ObxValue((index) {
@@ -48,4 +48,44 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
),
);
}
Widget filterBottomSheet() {
return BaseBottomSheet(
height: 250,
child: Column(
spacing: 16,
children: [
Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover)),
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,
),
),
],
),
SizedBox(height: 2),
RElevated(
text: 'اعمال فیلتر',
onPressed: () {
controller.submitFilter();
Get.back();
},
height: 40,
),
SizedBox(height: 16),
],
),
);
}
}

View File

@@ -1,9 +1,24 @@
import 'package:rasadyar_auth/data/utils/safe_call.dart';
import 'package:rasadyar_chicken/data/models/response/imported_loads_model/imported_loads_model.dart';
import 'package:rasadyar_chicken/presentation/pages/root/logic.dart';
import 'package:rasadyar_core/core.dart';
class BuyInProvinceAllLogic extends GetxController {
RxList<int> isExpandedList = <int>[].obs;
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
RxnString searchedValue = RxnString();
RootLogic rootLogic = Get.find<RootLogic>();
Rx<Resource<List<ImportedLoadsModel>>> importedLoads =
Resource<List<ImportedLoadsModel>>.loading().obs;
@override
void onReady() {
// TODO: implement onReady
debounce(searchedValue, (callback) => getImportedEntries(), time: Duration(milliseconds: 2000));
super.onReady();
}
@@ -12,4 +27,28 @@ class BuyInProvinceAllLogic extends GetxController {
// TODO: implement onClose
super.onClose();
}
Future<void> getImportedEntries() async {
safeCall(
call: () async => await rootLogic.chickenRepository.getImportedLoadsModel(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams(
queryParams: {'type': 'entered'},
role: 'Steward',
search: 'filter',
page: 1,
pageSize: 10,
value: searchedValue.value
),
),
onSuccess: (res) async {
await Future.delayed(Duration(milliseconds: 200));
if ((res?.count ?? 0) == 0) {
importedLoads.value = Resource<List<ImportedLoadsModel>>.empty();
} else {
importedLoads.value = Resource<List<ImportedLoadsModel>>.success(res!.results!);
}
},
);
}
}

View File

@@ -1,18 +1,39 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:rasadyar_auth/data/utils/safe_call.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/root/logic.dart';
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
import 'package:rasadyar_core/core.dart';
class BuyInProvinceWaitingLogic extends GetxController {
RxList<int> isExpandedList = <int>[].obs;
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().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;
RootLogic rootLogic = Get.find<RootLogic>();
Rx<Resource<List<WaitingArrivalModel>>> waitingProduct =
Resource<List<WaitingArrivalModel>>.loading().obs;
@override
void onInit() {
super.onInit();
debounce(
searchedValue,
(callback) => getWaitingArrivals(),
time: Duration(milliseconds: timeDebounce),
);
}
@override
void onReady() {
super.onReady();
@@ -24,14 +45,17 @@ class BuyInProvinceWaitingLogic extends GetxController {
super.onClose();
}
void setSearchValue(String? data) {
searchedValue.value = data?.trim();
}
Future<void> getWaitingArrivals() async {
safeCall(
call: () async => await rootLogic.chickenRepository.getWaitingArrivals(
call: () async =>
await rootLogic.chickenRepository.getWaitingArrivals(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams(
queryParams: {
'type':'not_entered'
},
queryParams: {'type': 'not_entered'},
pageSize: 10,
page: 1,
search: 'filter',
@@ -42,17 +66,78 @@ class BuyInProvinceWaitingLogic extends GetxController {
),
),
onSuccess: (res) async {
await Future.delayed(Duration(milliseconds: 500));
await Future.delayed(Duration(milliseconds: 200));
if ((res?.count ?? 0) == 0) {
waitingProduct.value = Resource<List<WaitingArrivalModel>>.empty();
} else {
waitingProduct.value = Resource<List<WaitingArrivalModel>>.success(res!.results!);
flashingFabBgColor();
}
},
);
}
void setSearchValue(String? data) {
searchedValue.value = data?.trim();
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: model.registrationCode ?? 0,
weightLossOfCarcasses: model.weightLossOfCarcasses?.toInt() ?? 0,
).toJson();
request.removeWhere((key, value) => value == null);
safeCall(
call: () async =>
await rootLogic.chickenRepository.setSateForArrivals(
token: rootLogic.tokenService.accessToken.value!,
request: request,
),
onError: (error, stackTrace) {
eLog(error);
},
onSuccess: (result) {
getWaitingArrivals();
// getBarGeneralInformation();
},
);
}
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.chickenRepository.setSateForArrivals(
token: rootLogic.tokenService.accessToken.value!,
request: request,
),
onError: (error, stackTrace) {
eLog(error);
},
onSuccess: (result) {
getWaitingArrivals();
//TODO
// getBarGeneralInformation();
},
);
}
void flashingFabBgColor() {
Timer.periodic(Duration(seconds: 2), (timer) {
if (bgConfirmAllColor.value == AppColor.blueNormal) {
bgConfirmAllColor.value = AppColor.blueDarkActive;
} else {
bgConfirmAllColor.value = AppColor.blueNormal;
}
});
}
}

View File

@@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
@@ -12,36 +11,50 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: ObxValue((data) {
return RPaginatedListView(
listType: ListType.separated,
resource: data.value,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data![index];
return ObxValue((val) {
return ListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.truckFastOutlinedSvg.path,
);
}, controller.isExpandedList);
},
itemCount: data.value.data?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async {},
);
return Scaffold(
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: ObxValue((data) {
return RPaginatedListView(
listType: ListType.separated,
resource: data.value,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data![index];
return ObxValue((val) {
return ListItem2(
selected: val.contains(index),
onTap: () => controller.isExpandedList.toggle(index),
index: index,
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.timerSvg.path,
);
}, controller.isExpandedList);
},
itemCount: data.value.data?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async {},
);
}, controller.waitingProduct),
),
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
floatingActionButton: ObxValue((data) {
if ((data.value.data?.length ?? 0) > 1) {
return AnimatedFab(
onPressed: () {},
message: 'تایید یکجا',
icon: Assets.vec.clipboardTaskSvg.svg(),
backgroundColor: controller.bgConfirmAllColor.value,
);
} else {
return SizedBox.shrink();
}
}, controller.waitingProduct),
);
}
Row itemListWidget(WaitingArrivalModel item) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
@@ -76,7 +89,7 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 3,
spacing: 6,
children: [
Visibility(
visible: item.product?.name?.contains('مرغ گرم') ?? false,
@@ -95,8 +108,6 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
),
SizedBox(height: 2),
],
),
),
@@ -127,6 +138,14 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
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(
@@ -170,95 +189,61 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
),
),
// buildRow(title: 'مشخصات فروشنده', value: item.killHouseName ?? 'N/A'),
// buildRow(title: 'مشخصات فروشنده', value: item.killHouseName ?? '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.product?.name ?? 'N/A'),
buildRow(
title: 'وزن خریداری شده',
value: '${item.weightOfCarcasses?.separatedByComma} کیلوگرم',
),
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.darkGreyDarkHover),
),
/* 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(
buildRow(title: 'قیمت کل', value: '${item.totalAmount?.separatedByComma} ریال'),
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,
),
ObxValue((data) {
return RElevated(
text: 'تایید',
width: 150.w,
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!);
},
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
backgroundColor: AppColor.greenNormal,
);
}, controller.isLoadingConfirmMap),
ROutlinedElevated(
text: 'حذف',
text: 'رد',
textStyle: AppFonts.yekan20.copyWith(color: AppColor.redNormal),
width: 150.w,
height: 40.h,
onPressed: () {
buildDeleteDialog(
onConfirm: () => controller.deleteStewardPurchaseOutOfProvince(item.key!),
onRefresh: () => controller.getStewardPurchaseOutOfProvince(),
buildWarningDialog(
title: 'اخطار',
middleText: 'آیا از رد شدن این مورد اطمینان دارید؟',
onConfirm: () => controller.denyEntries(item),
onRefresh: () => controller.getWaitingArrivals(),
);
},
borderColor: AppColor.redNormal,
),
],
),*/
),
],
),
);
}
}

View File

@@ -33,26 +33,7 @@ class EnteringTheWarehouseLogic extends GetxController {
@override
void onReady() {
super.onReady();
getBarGeneralInformation();
getImportedEntried();
scrollControllerImportedLoad.addListener(() {
if (scrollControllerImportedLoad.position.pixels >=
scrollControllerImportedLoad.position.maxScrollExtent - 100) {
addPageImportedLoad.value = true;
getImportedEntried();
}
});
scrollControllerWaitingForArrival.addListener(() {
if (scrollControllerWaitingForArrival.position.pixels >=
scrollControllerWaitingForArrival.position.maxScrollExtent - 100) {
addPageWaitingForArrival.value = true;
}
});
}
Future<void> getBarGeneralInformation() async {
@@ -74,68 +55,6 @@ class EnteringTheWarehouseLogic extends GetxController {
Future<void> acceptEntried(String key) async {
var request = StewardAllocationRequest(
allocationKey: key,
checkAllocation: true,
state: 'accepted',
receiverRealNumberOfCarcasses: int.parse(
volumeController.text.isNotEmpty ? volumeController.text : '0',
),
receiverRealWeightOfCarcasses: int.parse(
weightController.text.isNotEmpty ? weightController.text : '0',
),
registrationCode: acceptType.value == 1
? int.parse(
authenticationCodeController.text.isNotEmpty
? authenticationCodeController.text
: '0',
)
: null,
weightLossOfCarcasses: int.parse(
weightLossController.text.isNotEmpty ? weightLossController.text : '0',
),
).toJson();
request.removeWhere((key, value) => value == null);
safeCall(
call: () async => await rootLogic.chickenRepository.setSateForArrivals(
token: rootLogic.tokenService.accessToken.value!,
request: request,
),
onError: (error, stackTrace) {
eLog(error);
},
onSuccess: (result) {
clearControllers();
getBarGeneralInformation();
},
);
}
Future<void> denyEntried(String key) async {
var request = StewardAllocationRequest(
allocationKey: key,
checkAllocation: true,
state: 'rejected',
).toJson();
request.removeWhere((key, value) => value == null);
safeCall(
call: () async => await rootLogic.chickenRepository.setSateForArrivals(
token: rootLogic.tokenService.accessToken.value!,
request: request,
),
onError: (error, stackTrace) {
eLog(error);
},
onSuccess: (result) {
getBarGeneralInformation();
},
);
}
Future<void> getImportedEntried() async {
if (isLoadingMoreImportedLoad.value || !hasMoreDataImportedLoad.value) {
@@ -146,7 +65,7 @@ class EnteringTheWarehouseLogic extends GetxController {
currentPageImportedLoad.value++;
}
safeCall(
/* safeCall(
call: () async => await rootLogic.chickenRepository.getImportedLoadsModel(
token: rootLogic.tokenService.accessToken.value!,
page: currentPageImportedLoad.value,
@@ -164,7 +83,7 @@ class EnteringTheWarehouseLogic extends GetxController {
isLoadingMoreImportedLoad.value = false;
}
},
);
);*/
}
clearControllers() {

View File

@@ -1,33 +0,0 @@
extension xStringUtils on String {
get faAllocationType {
final tmp = split('_');
tmp.insert(1, '_');
if (tmp.length > 1) {
return tmp.map((e) => utilsMap[e] ?? e).join(' ');
} else {
return utilsMap[this] ?? this;
}
}
get faItem => utilsMap[this] ?? this;
get buyerIsGuild {
final tmp = split('_');
if (tmp.length > 1) {
return tmp.last == 'guild';
} else {
return false;
}
}
}
Map<String, String> utilsMap = {
'killhouse': 'کشتارگاه',
'_': 'به',
'steward': 'مباشر',
'exclusive': 'اختصاصی',
'free': 'آزاد',
'pending': 'در انتظار',
'accepted': 'تایید شده',
'guild': 'صنف',
};

View File

@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart';
import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
import 'package:rasadyar_chicken/presentation/pages/entering_the_warehouse/string_utils.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -22,7 +20,7 @@ class EnteringTheWarehousePage extends GetView<EnteringTheWarehouseLogic> {
return generalBarInformation(data.value);
}, controller.barInformation),
importedLoads(),
// importedLoads(),
],
),
),
@@ -43,7 +41,7 @@ class EnteringTheWarehousePage extends GetView<EnteringTheWarehouseLogic> {
),
),
SizedBox(height: 4),
/* ObxValue(
/* ObxValue(
(data) => data.isEmpty
? Container(
margin: const EdgeInsets.symmetric(vertical: 2),
@@ -135,14 +133,8 @@ class EnteringTheWarehousePage extends GetView<EnteringTheWarehouseLogic> {
'کل ورودی به انبار (کیلوگرم)',
model.totalFreeBarsCarcassesWeight.toString(),
),
buildRow(
'کل فروش (کیلوگرم)',
model.realAllocatedWeight.toString(),
),
buildRow(
'مانده انبار (کیلوگرم)',
model.totalRemainWeight.toString(),
),
buildRow('کل فروش (کیلوگرم)', model.realAllocatedWeight.toString()),
buildRow('مانده انبار (کیلوگرم)', model.totalRemainWeight.toString()),
],
),
),
@@ -161,9 +153,7 @@ class EnteringTheWarehousePage extends GetView<EnteringTheWarehouseLogic> {
child: Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
),
Flexible(
@@ -172,9 +162,7 @@ class EnteringTheWarehousePage extends GetView<EnteringTheWarehouseLogic> {
value,
textAlign: TextAlign.left,
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
),
),
],
@@ -209,14 +197,8 @@ class EnteringTheWarehousePage extends GetView<EnteringTheWarehouseLogic> {
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8,
children: [
buildRow(
'تعداد کل بارها',
model.totalBars!.toInt().toString(),
),
buildRow(
'وزن کل بارها (کیلوگرم)',
model.totalBarsWeight!.toInt().toString(),
),
buildRow('تعداد کل بارها', model.totalBars!.toInt().toString()),
buildRow('وزن کل بارها (کیلوگرم)', model.totalBarsWeight!.toInt().toString()),
buildRow(
'تعداد کل بارهای وارد شده',
model.totalEnteredBars!.toInt().toString(),
@@ -231,14 +213,9 @@ class EnteringTheWarehousePage extends GetView<EnteringTheWarehouseLogic> {
),
buildRow(
'وزن کل بار وارد نشده (کیلوگرم)',
model.totalNotEnteredKillHouseRequestsWeight!
.toInt()
.toString(),
),
buildRow(
'تعداد کل بارهای رد شده',
model.totalRejectedBars!.toInt().toString(),
model.totalNotEnteredKillHouseRequestsWeight!.toInt().toString(),
),
buildRow('تعداد کل بارهای رد شده', model.totalRejectedBars!.toInt().toString()),
buildRow(
' وزن کل بارهای رد شده',
model.totalRejectedBarsWeight!.toInt().toString(),
@@ -251,7 +228,7 @@ class EnteringTheWarehousePage extends GetView<EnteringTheWarehouseLogic> {
);
}
/* Widget waitingForArrival() {
/* Widget waitingForArrival() {
return Column(
children: [
const SizedBox(height: 8),
@@ -400,153 +377,72 @@ class EnteringTheWarehousePage extends GetView<EnteringTheWarehouseLogic> {
);
}*/
Widget importedLoads() {
return Column(
children: [
const SizedBox(height: 8),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Align(
alignment: Alignment.centerRight,
child: Text(
'بارهای وارد شده',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
),
/* Widget importedLoads() {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildRow('ردیف', '${index + 1}'),
buildRow(
'تاریخ ثبت',
result.date!.formattedJalaliDate ?? 'N/A',
),
),
ObxValue((data) {
if (data.value == null) {
return Container(
height: 80,
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: Center(child: CircularProgressIndicator()),
);
} else if (data.value?.results?.isEmpty ?? true) {
return Container(
height: 80,
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: Center(child: Text('هیچ بار وارد شده‌ای وجود ندارد')),
);
} else {
return Container(
margin: const EdgeInsets.symmetric(vertical: 2),
height: 700,
padding: const EdgeInsets.all(6),
child: ListView.separated(
controller: controller.scrollControllerImportedLoad,
padding: const EdgeInsets.all(8.0),
itemCount: data.value!.results!.length + 1,
itemBuilder: (BuildContext context, int index) {
if (index == data.value!.results!.length) {
return Obx(
() => controller.isLoadingMoreImportedLoad.value
? const Padding(
padding: EdgeInsets.symmetric(vertical: 16),
child: Center(child: CircularProgressIndicator()),
)
: const SizedBox(),
);
}
final result = data.value!.results![index];
return Card(
color: Colors.white,
margin: const EdgeInsets.symmetric(vertical: 4.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: const BorderSide(
color: AppColor.blueNormal,
width: 1,
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildRow('ردیف', '${index + 1}'),
buildRow(
'تاریخ ثبت',
result.date!.formattedJalaliDate ?? 'N/A',
),
buildRow(
'نوع تخصیص',
result.allocationType?.faAllocationType ?? 'N/A',
),
buildRow(
'مشخصات خریدار',
'${result.toSteward?.user?.fullname} - ${result.toSteward?.guildsName}' ??
'N/A',
),
buildRow(
'مشخصات فروشنده',
result.killHouse?.name ?? 'N/A',
),
buildRow(
'نوع فروش',
result.sellType?.faItem ?? 'N/A',
),
buildRow(
'قیمت هر کیلو',
'${result.amount ?? 0} ریال ',
),
buildRow(
'قیمت کل',
'${result.totalAmount ?? 0} ریال',
),
buildRow(
'وزن تخصیصی',
'${result.weightOfCarcasses?.toInt() ?? 0} کیلوگرم',
),
buildRow(
'کداحراز',
result.registrationCode?.toString() ?? 'N/A',
),
buildRow(
'وضعیت کد احراز',
result.systemRegistrationCode == true
? "ارسال شده"
: "ارسال نشده" ?? 'N/A',
),
buildRow(
'افت وزن(کیلوگرم)',
result.weightLossOfCarcasses?.toInt().toString() ??
'N/A',
),
buildRow(
'وضعیت',
result.receiverState?.faItem ?? 'N/A',
),
],
),
),
);
},
separatorBuilder: (BuildContext context, int index) =>
SizedBox(height: 8),
),
);
}
}, controller.importedLoads),
],
buildRow(
'نوع تخصیص',
result.allocationType?.faAllocationType ?? 'N/A',
),
buildRow(
'مشخصات خریدار',
'${result.toSteward?.user?.fullname} - ${result.toSteward?.guildsName}' ??
'N/A',
),
buildRow(
'مشخصات فروشنده',
result.killHouse?.name ?? 'N/A',
),
buildRow(
'نوع فروش',
result.sellType?.faItem ?? 'N/A',
),
buildRow(
'قیمت هر کیلو',
'${result.amount ?? 0} ریال ',
),
buildRow(
'قیمت کل',
'${result.totalAmount ?? 0} ریال',
),
buildRow(
'وزن تخصیصی',
'${result.weightOfCarcasses?.toInt() ?? 0} کیلوگرم',
),
buildRow(
'کداحراز',
result.registrationCode?.toString() ?? 'N/A',
),
buildRow(
'وضعیت کد احراز',
result.systemRegistrationCode == true
? "ارسال شده"
: "ارسال نشده" ?? 'N/A',
),
buildRow(
'افت وزن(کیلوگرم)',
result.weightLossOfCarcasses?.toInt().toString() ??
'N/A',
),
buildRow(
'وضعیت',
result.receiverState?.faItem ?? 'N/A',
),
],
),
);
}
}*/
/* Widget acceptBottomSheet(ResultModel resultModel) {
/* Widget acceptBottomSheet(ResultModel resultModel) {
return BaseBottomSheet(
height: 500,
child: Column(

View File

@@ -4,8 +4,8 @@ import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_
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/presentation/pages/entering_the_warehouse/string_utils.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';