feat: new ui changes

This commit is contained in:
2025-10-07 14:21:09 +03:30
parent d5729e04ff
commit 99d1111655
44 changed files with 506 additions and 460 deletions

View File

@@ -13,7 +13,7 @@ class AuthPage extends GetView<AuthLogic> {
Widget build(BuildContext context) {
return ChickenBasePage(
isFullScreen: true,
backGroundWidget: BackGroundWidget(
backGroundWidget: backGroundDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
@@ -24,7 +24,7 @@ class AuthPage extends GetView<AuthLogic> {
],
stops: const [0.0, 0.5, 1.0],
),
vecPath: Assets.vec.chickenPatternSvg.path,
backgroundPath: Assets.images.patternChicken.path,
),
onPopScopTaped: () => Get.back(result: -1),
child: Stack(

View File

@@ -73,4 +73,11 @@ class ActiveHatchingLogic extends GetxController {
void toggleExpanded(int index) {
expandedIndex.value = expandedIndex.value == index ? -1 : index;
}
Future<void> onRefresh() async {
currentPage.value = 1;
await getHatchingList();
}
}

View File

@@ -50,10 +50,7 @@ class ActiveHatchingPage extends GetView<ActiveHatchingLogic> {
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getHatchingList(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getHatchingList();
},
);
}, controller.activeHatchingList);
}

View File

@@ -107,4 +107,10 @@ class FarmLogic extends GetxController {
void toggleExpanded(int index) {
expandedIndex.value = expandedIndex.value == index ? -1 : index;
}
Future<void> onRefresh() async {
currentPage.value = 1;
farmList.value = Resource<PaginationModel<PoultryFarm>>.loading();
await getFarmList();
}
}

View File

@@ -3,7 +3,6 @@ import 'package:rasadyar_chicken/data/models/response/poultry_farm/poultry_farm.
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart';
import 'package:rasadyar_chicken/presentation/widget/label_item.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -16,6 +15,7 @@ class FarmPage extends GetView<FarmLogic> {
return ChickenBasePage(
hasFilter: false,
hasSearch: true,
onRefresh: controller.onRefresh,
onFilterTap: () {
Get.bottomSheet(
isScrollControlled: true,
@@ -29,7 +29,7 @@ class FarmPage extends GetView<FarmLogic> {
},
routes: controller.routes,
backId: poultryFirstKey,
widgets: [firstTagInformation(), farmListWidget()],
child: Column(children: [firstTagInformation(), farmListWidget()]),
);
}
@@ -76,10 +76,7 @@ class FarmPage extends GetView<FarmLogic> {
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getFarmList(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getFarmList();
},
);
}, controller.farmList),
);
@@ -153,7 +150,7 @@ class FarmPage extends GetView<FarmLogic> {
buildRow(
title: 'جوجه ریزی فعال (تعداد دوره) ',
value:
'${(item.hatchingInfo?.activeHatching ?? false) ? 'دارد' : 'ندارد'} (${item.hatchingInfo?.period ?? 0})',
'${(item.hatchingInfo?.activeHatching ?? false) ? 'دارد' : 'ندارد'} (${item.hatchingInfo?.period ?? 0})',
),
/* buildRow(

View File

@@ -133,4 +133,11 @@ class GenocideLogic extends GetxController {
return 'تایید شده';
}
}
Future<void> onRefresh() async {
currentPage.value = 1;
await getPoultryOrderList();
}
}

View File

@@ -17,6 +17,7 @@ class GenocidePage extends GetView<GenocideLogic> {
routes: controller.routesName,
hasSearch: true,
hasFilter: true,
onRefresh: controller.onRefresh,
onSearchChanged: (data) {
controller.searchedValue.value = data;
controller.getPoultryOrderList();
@@ -79,10 +80,7 @@ class GenocidePage extends GetView<GenocideLogic> {
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getPoultryOrderList(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getPoultryOrderList();
},
);
}, controller.poultryOrderList);
}

View File

@@ -19,65 +19,67 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
hasNews: true,
scrollable: true,
widgets: [
SizedBox(height: 8.h),
InkWell(
onTap: () {
controller.isExpanded.value = !controller.isExpanded.value;
},
child: Stack(
clipBehavior: Clip.none,
children: [
Container(
margin: EdgeInsetsGeometry.all(6),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
),
child: ObxValue((data) {
return AnimatedSize(
duration: Duration(milliseconds: 300),
child: data.value ? mainItemWidget() : mainItemWidgetExpanded(),
);
}, controller.isExpanded),
),
Positioned(
top: -10,
right: 20,
child: Container(
height: 32.h,
child: Column(
children: [
SizedBox(height: 8.h),
InkWell(
onTap: () {
controller.isExpanded.value = !controller.isExpanded.value;
},
child: Stack(
clipBehavior: Clip.none,
children: [
Container(
margin: EdgeInsetsGeometry.all(6),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
),
padding: EdgeInsets.symmetric(horizontal: 8),
child: Row(
spacing: 8,
children: [
Assets.vec.chicken2Svg.svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(AppColor.blueDark, BlendMode.srcIn),
),
Text(
'اطلاعات فارم‌ها',
textAlign: TextAlign.right,
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
),
],
child: ObxValue((data) {
return AnimatedSize(
duration: Duration(milliseconds: 300),
child: data.value ? mainItemWidget() : mainItemWidgetExpanded(),
);
}, controller.isExpanded),
),
Positioned(
top: -10,
right: 20,
child: Container(
height: 32.h,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
),
padding: EdgeInsets.symmetric(horizontal: 8),
child: Row(
spacing: 8,
children: [
Assets.vec.chicken2Svg.svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(AppColor.blueDark, BlendMode.srcIn),
),
Text(
'اطلاعات فارم‌ها',
textAlign: TextAlign.right,
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
),
],
),
),
),
),
],
],
),
),
),
SizedBox(height: 10),
widelyWidget(),
SizedBox(height: 20),
],
SizedBox(height: 10),
widelyWidget(),
SizedBox(height: 20),
],
),
);
}

View File

@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.dart';
import 'package:rasadyar_chicken/data/models/response/hatching_report/hatching_report.dart';
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
import 'package:rasadyar_core/core.dart';
class InspectionPoultryScienceLogic extends GetxController {
@@ -43,8 +42,6 @@ class InspectionPoultryScienceLogic extends GetxController {
routesName.removeLast();
routesName.add(callback == 0 ? 'بازرسی' : 'بایگانی');
});
}
@override
@@ -71,7 +68,6 @@ class InspectionPoultryScienceLogic extends GetxController {
baseLogic.clearSearch();
}
Future<void> getHatchingList([bool isLoadingMore = false]) async {
if (isLoadingMore) {
isLoadingMoreAllocationsMade.value = true;
@@ -261,5 +257,10 @@ class InspectionPoultryScienceLogic extends GetxController {
getHatchingList();
}
}
}
Future<void> onRefresh() async {
currentPage.value = 1;
await Future.wait([getHatchingList(), getHatchingReport()]);
}
}

View File

@@ -21,15 +21,18 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
onFilterTap: () {
Get.bottomSheet(filterBottomSheet());
},
onRefresh: controller.onRefresh,
onSearchChanged: (data) => controller.setSearchValue(data),
backId: poultryFirstKey,
routesWidget: ContainerBreadcrumb(rxRoutes: controller.routesName),
widgets: [
SizedBox(height: 50, child: segmentWidget()),
ObxValue((data) {
return data.value == 0 ? hatchingWidget() : reportWidget();
}, controller.selectedSegmentIndex),
],
child: Column(
children: [
SizedBox(height: 50, child: segmentWidget()),
ObxValue((data) {
return data.value == 0 ? hatchingWidget() : reportWidget();
}, controller.selectedSegmentIndex),
],
),
);
}
@@ -60,10 +63,6 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getHatchingList(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getHatchingList();
},
);
}, controller.hatchingList),
);
@@ -356,10 +355,6 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getHatchingReport(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getHatchingReport();
},
);
}, controller.hatchingReportList),
);
@@ -518,7 +513,8 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
item.image?[index] ?? '',
loadingBuilder: (context, child, loadingProgress) {
if (loadingProgress == null) return child;
return Padding(padding: EdgeInsetsGeometry.all(80),
return Padding(
padding: EdgeInsetsGeometry.all(80),
child: CircularProgressIndicator(
color: AppColor.blueDark,

View File

@@ -14,40 +14,42 @@ class BuyPage extends GetView<BuyLogic> {
return ChickenBasePage(
routes: controller.routesName,
isBase: true,
widgets: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 21.w,
children: [
GlassMorphismCardIcon(
title: 'خرید داخل استان',
vecIcon: Assets.vec.map1Svg.path,
gradient: LinearGradient(
colors: [Color(0xFF00E096), Color(0xFF007D5E)],
stops: [0.0, 0.95],
begin: AlignmentGeometry.topLeft,
end: AlignmentGeometry.bottomRight,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 21.w,
children: [
GlassMorphismCardIcon(
title: 'خرید داخل استان',
vecIcon: Assets.vec.map1Svg.path,
gradient: LinearGradient(
colors: [Color(0xFF00E096), Color(0xFF007D5E)],
stops: [0.0, 0.95],
begin: AlignmentGeometry.topLeft,
end: AlignmentGeometry.bottomRight,
),
onTap: () {
Get.toNamed(ChickenRoutes.buysInProvinceSteward, id: stewardFirstKey);
},
),
onTap: () {
Get.toNamed(ChickenRoutes.buysInProvinceSteward, id: stewardFirstKey);
},
),
GlassMorphismCardIcon(
title: 'خرید خارج استان',
vecIcon: Assets.vec.buyOutProvinceSvg.path,
gradient: LinearGradient(
colors: [Color(0xFF00E096), Color(0xFF007D5E)],
stops: [0.0, 0.95],
begin: AlignmentGeometry.topLeft,
end: AlignmentGeometry.bottomRight,
GlassMorphismCardIcon(
title: 'خرید خارج استان',
vecIcon: Assets.vec.buyOutProvinceSvg.path,
gradient: LinearGradient(
colors: [Color(0xFF00E096), Color(0xFF007D5E)],
stops: [0.0, 0.95],
begin: AlignmentGeometry.topLeft,
end: AlignmentGeometry.bottomRight,
),
onTap: () {
Get.toNamed(ChickenRoutes.buysOutOfProvinceSteward, id: stewardFirstKey);
},
),
onTap: () {
Get.toNamed(ChickenRoutes.buysOutOfProvinceSteward, id: stewardFirstKey);
},
),
],
),
],
],
),
],
),
);
}
}

View File

@@ -81,4 +81,9 @@ class BuyInProvinceLogic extends GetxController {
buyAllLogic.searchedValue.value = searchedValue.value;
}
}
Future<void> onRefresh() async {
final isWaiting = selectedSegmentIndex.value == 0;
await Future.wait([buyWaitingLogic.getWaitingArrivals(), buyAllLogic.getAllArrivals()]);
}
}

View File

@@ -22,15 +22,18 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
onFilterTap: () {
Get.bottomSheet(filterBottomSheet());
},
widgets: [
inventoryWidget(controller.rootLogic),
segmentWidget(),
ObxValue((index) {
return Expanded(
child: index.value == 0 ? BuyInProvinceWaitingPage() : BuyInProvinceAllPage(),
);
}, controller.selectedSegmentIndex),
],
onRefresh: controller.onRefresh,
child: Column(
children: [
inventoryWidget(controller.rootLogic),
segmentWidget(),
ObxValue((index) {
return Expanded(
child: index.value == 0 ? BuyInProvinceWaitingPage() : BuyInProvinceAllPage(),
);
}, controller.selectedSegmentIndex),
],
)
);
}

View File

@@ -12,7 +12,6 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
@override
Widget build(BuildContext context) {
eLog("BuyInProvinceAllPage");
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: ObxValue((data) {
@@ -38,10 +37,7 @@ class BuyInProvinceAllPage extends GetView<BuyInProvinceAllLogic> {
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getAllArrivals(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getAllArrivals();
},
);
}, controller.allProduct),
);

View File

@@ -12,7 +12,6 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
@override
Widget build(BuildContext context) {
eLog("BuyInProvinceWaitingPage");
return Scaffold(
backgroundColor: Colors.transparent,
body: Padding(
@@ -40,28 +39,9 @@ class BuyInProvinceWaitingPage extends GetView<BuyInProvinceWaitingLogic> {
itemCount: data.value.data?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getWaitingArrivals(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getWaitingArrivals();
},
);
}, controller.waitingProduct),
),
/* floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
floatingActionButton: ObxValue((data) {
if ((data.value.data?.results?.length ?? 0) > 1) {
return AnimatedFab(
onPressed: () {
//TODO FAB
},
message: 'تایید یکجا',
icon: Assets.vec.clipboardTaskSvg.svg(width: 45.w, height: 42.h),
backgroundColor: controller.bgConfirmAllColor.value,
);
} else {
return SizedBox.shrink();
}
}, controller.waitingProduct),*/
);
}

View File

@@ -1,5 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/create_steward_free_bar.dart';
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';
@@ -236,4 +235,9 @@ class BuyOutOfProvinceLogic extends GetxController {
),
);
}
Future<void> onRefresh() async {
currentPage.value = 1;
await getStewardPurchaseOutOfProvince();
}
}

View File

@@ -21,6 +21,7 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
return ChickenBasePage(
routes: controller.routesName,
backId: stewardFirstKey,
onRefresh: controller.onRefresh,
onSearchChanged: (data) => controller.setSearchValue(data),
onFilterTap: () {
Get.bottomSheet(filterBottomSheet());
@@ -28,58 +29,55 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
child: Stack(
children: [
Positioned.fill(child:Column(
children: [
inventoryWidget(controller.rootLogic),
ObxValue((data) {
return RPaginatedListView(
listType: ListType.separated,
resource: data.value,
hasMore: data.value.data?.next != null,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
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?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getStewardPurchaseOutOfProvince(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getStewardPurchaseOutOfProvince();
},
);
}, controller.purchaseOutOfProvinceList)
],
)),
Positioned.fill(
child: Column(
children: [
inventoryWidget(controller.rootLogic),
ObxValue((data) {
return RPaginatedListView(
listType: ListType.separated,
resource: data.value,
hasMore: data.value.data?.next != null,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
return ObxValue((val) {
return ExpandableListItem2(
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?.results?.length ?? 0,
separatorBuilder: (context, index) => SizedBox(height: 8.h),
onLoadMore: () async => controller.getStewardPurchaseOutOfProvince(true),
);
}, controller.purchaseOutOfProvinceList),
],
),
),
Positioned(
right: 5,
bottom: 95,
child: RFab.add(
onPressed: () {
Get.bottomSheet(
addPurchasedInformationBottomSheet(),
isScrollControlled: true,
ignoreSafeArea: false,
).whenComplete(() {
controller.resetSubmitForm();
});
},
))
right: 5,
bottom: 95,
child: RFab.add(
onPressed: () {
Get.bottomSheet(
addPurchasedInformationBottomSheet(),
isScrollControlled: true,
ignoreSafeArea: false,
).whenComplete(() {
controller.resetSubmitForm();
});
},
),
),
],
),
);
}

View File

@@ -1,5 +1,3 @@
import 'package:rasadyar_chicken/chicken.dart';
import 'package:rasadyar_chicken/data/models/response/bar_information/bar_information.dart';
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
@@ -16,9 +14,11 @@ class HomeLogic extends GetxController {
@override
void onReady() {
super.onReady();
getGeneralBarsInformation();
getTodayBars();
getDistributionInformation();
refreshData();
}
Future<void> refreshData() async {
await Future.wait([getGeneralBarsInformation(), getTodayBars(), getDistributionInformation()]);
}
Future<void> getGeneralBarsInformation() async {

View File

@@ -16,13 +16,16 @@ class HomePage extends GetView<HomeLogic> {
return ChickenBasePage(
scrollable: true,
isBase: true,
widgets: [
SizedBox(height: 8.h),
mainInformation(),
SizedBox(height: 8.h),
WidelyUsedWidget(),
SizedBox(height: 20),
],
onRefresh: controller.refreshData,
child: Column(
children: [
SizedBox(height: 18.h),
mainInformation(),
SizedBox(height: 8.h),
WidelyUsedWidget(),
SizedBox(height: 20),
],
),
);
}

View File

@@ -182,6 +182,12 @@ class StewardRootLogic extends GetxController {
final nestedKeyId = getNestedKey();
GlobalKey<NavigatorState>? currentNestedKey = Get.nestedKey(nestedKeyId);
final currentRoute = currentNestedKey?.currentState;
fLog(Get.currentRoute);
/*
fLog("onPopScopTaped ==> ${currentNestedKey?.currentState?.canPop()}");
if (currentNestedKey?.currentState?.canPop() == true) {
iLog(currentNestedKey?.currentState?.canPop());
@@ -202,6 +208,6 @@ class StewardRootLogic extends GetxController {
} else {
await SystemNavigator.pop();
}
}
}*/
}
}

View File

@@ -15,28 +15,30 @@ class SalePage extends GetView<SaleLogic> {
return ChickenBasePage(
routes: controller.routesName,
isBase: true,
widgets: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 21,
children: [
GlassMorphismCardIcon(
title: 'فروش داخل استان',
vecIcon: Assets.vec.map2Svg.path,
onTap: () {
Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: stewardSecondKey);
},
),
GlassMorphismCardIcon(
title: 'فروش خارج استان',
vecIcon: Assets.vec.saleOutProvinceSvg.path,
onTap: () {
Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: stewardSecondKey);
},
),
],
),
],
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 21,
children: [
GlassMorphismCardIcon(
title: 'فروش داخل استان',
vecIcon: Assets.vec.map2Svg.path,
onTap: () {
Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: stewardSecondKey);
},
),
GlassMorphismCardIcon(
title: 'فروش خارج استان',
vecIcon: Assets.vec.saleOutProvinceSvg.path,
onTap: () {
Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: stewardSecondKey);
},
),
],
),
],
),
);
}

View File

@@ -33,13 +33,18 @@ class SalesInProvinceLogic extends GetxController {
GlobalKey<FormState> formKey = GlobalKey<FormState>();
Rx<Jalali> fromDateFilter = Jalali.now().obs;
Rx<Jalali> toDateFilter = Jalali.now().obs;
Rx<Jalali> fromDateFilter = Jalali
.now()
.obs;
Rx<Jalali> toDateFilter = Jalali
.now()
.obs;
Rxn<ProductModel> selectedProductModel = Rxn<ProductModel>();
Rxn<GuildModel> selectedGuildModel = Rxn<GuildModel>();
Rxn<GuildProfile> guildProfile = Rxn<GuildProfile>();
RxInt saleType = 1.obs;
RxInt priceType = 1.obs;
RxInt quotaType = 1.obs;
RxInt weight = 0.obs;
RxInt pricePerKilo = 0.obs;
RxInt totalCost = 0.obs;
@@ -71,7 +76,6 @@ class SalesInProvinceLogic extends GetxController {
});
debounce(weight, time: Duration(milliseconds: 110), (callback) {
totalCost.value = callback * pricePerKilo.value;
});
@@ -80,14 +84,16 @@ class SalesInProvinceLogic extends GetxController {
});
totalCost.listen((data) {
totalCostController.text = data.toString().separatedByComma;
totalCostController.text = data
.toString()
.separatedByComma;
isValid.value =
weight.value > 0 &&
pricePerKilo.value > 0 &&
totalCost.value > 0 &&
selectedProductModel.value != null &&
selectedGuildModel.value != null;
pricePerKilo.value > 0 &&
totalCost.value > 0 &&
selectedProductModel.value != null &&
selectedGuildModel.value != null;
});
everAll([
totalCost,
@@ -108,7 +114,7 @@ class SalesInProvinceLogic extends GetxController {
debounce(
searchedValue,
(callback) => getAllocatedMade(),
(callback) => getAllocatedMade(),
time: Duration(milliseconds: timeDebounce),
);
}
@@ -127,7 +133,8 @@ class SalesInProvinceLogic extends GetxController {
}
safeCall(
call: () async => await rootLogic.chickenRepository.getAllocatedMade(
call: () async =>
await rootLogic.chickenRepository.getAllocatedMade(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams(
page: currentPage.value,
@@ -169,15 +176,16 @@ class SalesInProvinceLogic extends GetxController {
void checkVerification() {
isValid.value =
weight.value > 0 &&
pricePerKilo.value > 0 &&
totalCost.value > 0 &&
selectedProductModel.value != null &&
selectedGuildModel.value != null;
pricePerKilo.value > 0 &&
totalCost.value > 0 &&
selectedProductModel.value != null &&
selectedGuildModel.value != null;
}
void confirmAllocation(ConformAllocation allocation) {
safeCall(
call: () async => await rootLogic.chickenRepository.confirmAllocation(
call: () async =>
await rootLogic.chickenRepository.confirmAllocation(
token: rootLogic.tokenService.accessToken.value!,
allocation: allocation.toJson(),
),
@@ -190,7 +198,8 @@ class SalesInProvinceLogic extends GetxController {
void denyAllocation(String token) {
safeCall(
call: () async => await rootLogic.chickenRepository.denyAllocation(
call: () async =>
await rootLogic.chickenRepository.denyAllocation(
token: rootLogic.tokenService.accessToken.value!,
allocationToken: token,
),
@@ -203,7 +212,8 @@ class SalesInProvinceLogic extends GetxController {
Future<void> confirmAllAllocations() async {
safeCall(
call: () async => await rootLogic.chickenRepository.confirmAllAllocation(
call: () async =>
await rootLogic.chickenRepository.confirmAllAllocation(
token: rootLogic.tokenService.accessToken.value!,
allocationTokens: allocatedList.value.data?.results?.map((e) => e.key!).toList() ?? [],
),
@@ -216,7 +226,8 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getRolesProducts() async {
safeCall(
call: () async => await rootLogic.chickenRepository.getRolesProducts(
call: () async =>
await rootLogic.chickenRepository.getRolesProducts(
token: rootLogic.tokenService.accessToken.value!,
),
onSuccess: (result) {
@@ -231,7 +242,8 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getGuilds() async {
safeCall(
call: () async => await rootLogic.chickenRepository.getGuilds(
call: () async =>
await rootLogic.chickenRepository.getGuilds(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: buildQueryParams(
queryParams: {'free': saleType.value == 2 ? true : false},
@@ -262,7 +274,8 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getGuildProfile() async {
await safeCall(
call: () async => await rootLogic.chickenRepository.getProfile(
call: () async =>
await rootLogic.chickenRepository.getProfile(
token: rootLogic.tokenService.accessToken.value!,
),
onError: (error, stackTrace) {},
@@ -276,7 +289,8 @@ class SalesInProvinceLogic extends GetxController {
tmpStewardAllocation = SubmitStewardAllocation(
approvedPriceStatus: broadcastPrice.value?.active ?? false,
allocationType:
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}',
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value
?.steward == true ? "steward" : "guild"}',
sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild",
buyerType: selectedGuildModel.value?.steward == true ? "Steward" : "Guild",
amount: pricePerKilo.value,
@@ -284,16 +298,20 @@ class SalesInProvinceLogic extends GetxController {
weightOfCarcasses: weight.value,
sellType: saleType.value == 2 ? "free" : 'exclusive',
numberOfCarcasses: 0,
quota: quotaType.value == 1 ? 'governmental' : 'free',
guildKey: selectedGuildModel.value?.key,
productKey: selectedProductModel.value?.key,
date: DateTime.now().formattedDashedGregorian,
date: DateTime
.now()
.formattedDashedGregorian,
type: "manual",
);
}
Future<void> submitAllocation() async {
safeCall(
call: () async => await rootLogic.chickenRepository.postSubmitStewardAllocation(
call: () async =>
await rootLogic.chickenRepository.postSubmitStewardAllocation(
token: rootLogic.tokenService.accessToken.value!,
request: tmpStewardAllocation!,
),
@@ -307,7 +325,8 @@ class SalesInProvinceLogic extends GetxController {
Future<void> deleteAllocation(AllocatedMadeModel model) async {
safeCall(
call: () async => await rootLogic.chickenRepository.deleteStewardAllocation(
call: () async =>
await rootLogic.chickenRepository.deleteStewardAllocation(
token: rootLogic.tokenService.accessToken.value!,
queryParameters: {'steward_allocation_key': model.key},
),
@@ -333,9 +352,15 @@ class SalesInProvinceLogic extends GetxController {
weight.value = item.weightOfCarcasses ?? 0;
pricePerKilo.value = item.amount ?? 0;
totalCost.value = item.totalAmount ?? 0;
weightController.text = weight.value.toString().separatedByComma;
pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
totalCostController.text = totalCost.value.toString().separatedByComma;
weightController.text = weight.value
.toString()
.separatedByComma;
pricePerKiloController.text = pricePerKilo.value
.toString()
.separatedByComma;
totalCostController.text = totalCost.value
.toString()
.separatedByComma;
isValid.value = true;
}
@@ -364,7 +389,8 @@ class SalesInProvinceLogic extends GetxController {
);
safeCall(
call: () async => await rootLogic.chickenRepository.updateStewardAllocation(
call: () async =>
await rootLogic.chickenRepository.updateStewardAllocation(
token: rootLogic.tokenService.accessToken.value!,
request: updatedAllocationModel,
),
@@ -408,17 +434,27 @@ class SalesInProvinceLogic extends GetxController {
Future<void> getBroadcastPrice() async {
safeCall(
call: () async => await rootLogic.chickenRepository.getBroadcastPrice(
call: () async =>
await rootLogic.chickenRepository.getBroadcastPrice(
token: rootLogic.tokenService.accessToken.value!,
),
onSuccess: (result) {
broadcastPrice.value = result;
if (broadcastPrice.value?.active == true) {
pricePerKilo.value = broadcastPrice.value?.stewardPrice ?? 0;
pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
pricePerKiloController.text = pricePerKilo.value
.toString()
.separatedByComma;
}
},
onError: (error, stacktrace) {},
);
}
Future<void> onRefresh() async {
currentPage.value = 1;
hasMoreDataAllocationsMade.value = true;
await Future.wait([getAllocatedMade()]);
}
}

View File

@@ -20,6 +20,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
routes: controller.routesName,
backId: stewardSecondKey,
onSearchChanged: (data) => controller.setSearchValue(data),
onRefresh: controller.onRefresh,
onFilterTap: () {
Get.bottomSheet(filterBottomSheet());
},
@@ -36,10 +37,6 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
resource: data.value,
hasMore: data.value.data?.next != null,
isPaginating: controller.isLoadingMoreAllocationsMade.value,
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getAllocatedMade();
},
onLoadMore: () async {
controller.currentPage.value++;
iLog(controller.currentPage.value);
@@ -404,30 +401,23 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
SizedBox(
height: 40,
child: ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Radio(
value: 1,
groupValue: controller.saleType.value,
onChanged: (value) {
controller.saleType.value = value!;
controller.selectedGuildModel.value = null;
controller.selectedGuildModel.refresh();
},
),
Text('فروش اختصاصی', style: AppFonts.yekan14),
SizedBox(width: 30.w),
Radio(
value: 2,
groupValue: controller.saleType.value,
onChanged: (value) {
controller.saleType.value = value!;
},
),
Text('فروش آزاد', style: AppFonts.yekan14),
],
return RadioGroup(
groupValue: controller.saleType.value,
onChanged: (value) {
controller.saleType.value = value!;
controller.selectedGuildModel.value = null;
controller.selectedGuildModel.refresh();
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Radio(value: 1),
Text('فروش اختصاصی', style: AppFonts.yekan14),
SizedBox(width: 30.w),
Radio(value: 2),
Text('فروش آزاد', style: AppFonts.yekan14),
],
),
);
}, controller.saleType),
),
@@ -521,6 +511,27 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
);
}),
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,

View File

@@ -211,4 +211,12 @@ class SalesOutOfProvinceLogic extends GetxController {
selectedProduct.value = null;
key = null;
}
Future<void> onRefresh() async {
currentPage.value = 1;
await getOutProvinceSales();
}
}

View File

@@ -21,6 +21,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
return ChickenBasePage(
routes: controller.routesName,
backId: stewardSecondKey,
onRefresh: controller.onRefresh,
onSearchChanged: (data) => controller.setSearchValue(data),
onFilterTap: () {
Get.bottomSheet(filterBottomSheet());
@@ -73,10 +74,6 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
ObxValue((data) {
return RPaginatedListView(
onLoadMore: () async => controller.getOutProvinceSales(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getOutProvinceSales();
},
hasMore: data.value.data?.next != null,
listType: ListType.separated,
resource: data.value,
@@ -285,7 +282,10 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
buildRow(title: 'مشخصات خریدار', value: item.buyer?.fullname ?? 'N/A'),
buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'N/A'),
buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'N/A'),
buildRow(title: 'وزن لاشه (ريال)', value: '${item.weightOfCarcasses?.separatedByCommaFa}'),
buildRow(
title: 'وزن لاشه (ريال)',
value: '${item.weightOfCarcasses?.separatedByCommaFa}',
),
Row(
mainAxisAlignment: MainAxisAlignment.center,

View File

@@ -208,4 +208,10 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
toDateFilter.value = toDateFilter.value;
getOutProvinceCarcassesBuyer();
}
Future<void> onRefresh() async {
currentPage.value = 1;
await getOutProvinceCarcassesBuyer();
}
}

View File

@@ -16,6 +16,7 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
return ChickenBasePage(
routes: controller.routesName,
backId: stewardSecondKey,
onRefresh: controller.onRefresh,
onSearchChanged: (data) => controller.setSearchValue(data),
filteringWidget: filterBottomSheet(),
child: Stack(
@@ -33,21 +34,16 @@ class SalesOutOfProvinceBuyersPage extends GetView<SalesOutOfProvinceBuyersLogic
border: Border.all(color: AppColor.textColor, width: 0.5),
),
alignment: Alignment.center,
child:Text(
child: Text(
'لیست خریداران خارج از استان',
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkHover),
),
),
Expanded(
child: ObxValue((data) {
return RPaginatedListView(
onLoadMore: () async => controller.getOutProvinceCarcassesBuyer(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getOutProvinceCarcassesBuyer();
},
hasMore: data.value.data?.next != null,
listType: ListType.separated,
resource: data.value,

View File

@@ -20,10 +20,7 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
body: ObxValue((data) {
return RPaginatedListView(
onLoadMore: () async => controller.getOutProvinceSales(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getOutProvinceSales();
},
hasMore: data.value.data?.next != null,
listType: ListType.separated,
resource: data.value,

View File

@@ -220,4 +220,10 @@ class SegmentationLogic extends GetxController {
onError: (error, stacktrace) {},
);
}
Future<void> onRefresh() async {
currentPage.value = 1;
await getAllSegmentation();
}
}

View File

@@ -18,6 +18,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
onFilterTap: () {
Get.bottomSheet(filterBottomSheet());
},
onRefresh: controller.onRefresh,
hasBack: false,
child: Stack(
children: [
@@ -25,10 +26,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
child: ObxValue((data) {
return RPaginatedListView(
onLoadMore: () async => controller.getAllSegmentation(true),
onRefresh: () async {
controller.currentPage.value = 1;
await controller.getAllSegmentation();
},
hasMore: data.value.data?.next != null,
listType: ListType.separated,
resource: data.value,