feat: new ui changes
This commit is contained in:
@@ -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);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
);
|
||||
|
||||
@@ -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),*/
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -211,4 +211,12 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
selectedProduct.value = null;
|
||||
key = null;
|
||||
}
|
||||
|
||||
|
||||
Future<void> onRefresh() async {
|
||||
currentPage.value = 1;
|
||||
await getOutProvinceSales();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -208,4 +208,10 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
|
||||
toDateFilter.value = toDateFilter.value;
|
||||
getOutProvinceCarcassesBuyer();
|
||||
}
|
||||
|
||||
|
||||
Future<void> onRefresh() async {
|
||||
currentPage.value = 1;
|
||||
await getOutProvinceCarcassesBuyer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -220,4 +220,10 @@ class SegmentationLogic extends GetxController {
|
||||
onError: (error, stacktrace) {},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Future<void> onRefresh() async {
|
||||
currentPage.value = 1;
|
||||
await getAllSegmentation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user