Merge branch with resolved conflicts - restructured features and added new modules
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
|
||||
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/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
||||
=
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class SaleLogic extends GetxController {
|
||||
Rxn<List<AllocatedMadeModel>?> allocatedMadeModel = Rxn<List<AllocatedMadeModel>?>();
|
||||
Rxn<List<AllocatedMadeModel>?> allocatedMadeModel =
|
||||
Rxn<List<AllocatedMadeModel>?>();
|
||||
|
||||
RxList<GuildModel> guildsModel = <GuildModel>[].obs;
|
||||
|
||||
Rxn<StewardFreeBarDashboard> stewardFreeDashboard = Rxn<StewardFreeBarDashboard>();
|
||||
Rxn<StewardFreeBarDashboard> stewardFreeDashboard =
|
||||
Rxn<StewardFreeBarDashboard>();
|
||||
|
||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
||||
|
||||
@@ -24,14 +26,18 @@ class SaleLogic extends GetxController {
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
getStewardDashBord();
|
||||
|
||||
}
|
||||
|
||||
Future<void> getAllocatedMade() async {
|
||||
safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.getAllocatedMade(
|
||||
call: () async => await rootLogic.stewardRepository.getAllocatedMade(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(page: 1, pageSize: 20, search: 'filter', role: 'Steward'),
|
||||
queryParameters: buildQueryParams(
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
search: 'filter',
|
||||
role: 'Steward',
|
||||
),
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
@@ -46,7 +52,7 @@ class SaleLogic extends GetxController {
|
||||
|
||||
void confirmAllocation(ConformAllocation allocation) {
|
||||
safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.confirmAllocation(
|
||||
call: () async => await rootLogic.stewardRepository.confirmAllocation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
allocation: allocation.toJson(),
|
||||
),
|
||||
@@ -59,7 +65,7 @@ class SaleLogic extends GetxController {
|
||||
|
||||
void denyAllocation(String token) {
|
||||
safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.denyAllocation(
|
||||
call: () async => await rootLogic.stewardRepository.denyAllocation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
allocationToken: token,
|
||||
),
|
||||
@@ -72,9 +78,10 @@ class SaleLogic extends GetxController {
|
||||
|
||||
Future<void> confirmAllAllocations() async {
|
||||
safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.confirmAllAllocation(
|
||||
call: () async => await rootLogic.stewardRepository.confirmAllAllocation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
allocationTokens: allocatedMadeModel.value?.map((e) => e.key!).toList() ?? [],
|
||||
allocationTokens:
|
||||
allocatedMadeModel.value?.map((e) => e.key!).toList() ?? [],
|
||||
),
|
||||
onSuccess: (result) {
|
||||
getAllocatedMade();
|
||||
@@ -83,7 +90,6 @@ class SaleLogic extends GetxController {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Future<void> getGuilds() async {}
|
||||
|
||||
Future<void> addSale() async {}
|
||||
@@ -94,7 +100,7 @@ class SaleLogic extends GetxController {
|
||||
|
||||
Future<void> getStewardDashBord() async {
|
||||
safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.getStewardDashboard(
|
||||
call: () async => await rootLogic.stewardRepository.getStewardDashboard(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
stratDate: DateTime.now().formattedDashedGregorian,
|
||||
endDate: DateTime.now().formattedDashedGregorian,
|
||||
@@ -116,22 +122,20 @@ class SaleLogic extends GetxController {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
void onPopScopTaped() async {
|
||||
|
||||
final now = DateTime.now();
|
||||
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
||||
_lastBackPressed = now;
|
||||
Get.snackbar(
|
||||
'خروج از برنامه',
|
||||
'برای خروج دوباره بازگشت را بزنید',
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(seconds: 2),
|
||||
backgroundColor: AppColor.warning,
|
||||
);
|
||||
} else {
|
||||
await SystemNavigator.pop();
|
||||
}
|
||||
|
||||
final now = DateTime.now();
|
||||
if (_lastBackPressed == null ||
|
||||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
||||
_lastBackPressed = now;
|
||||
Get.snackbar(
|
||||
'خروج از برنامه',
|
||||
'برای خروج دوباره بازگشت را بزنید',
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(seconds: 2),
|
||||
backgroundColor: AppColor.warning,
|
||||
);
|
||||
} else {
|
||||
await SystemNavigator.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/chicken.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
@@ -25,14 +25,20 @@ class SalePage extends GetView<SaleLogic> {
|
||||
title: 'فروش داخل استان',
|
||||
vecIcon: Assets.vec.map2Svg.path,
|
||||
onTap: () {
|
||||
Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: stewardSecondKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.salesInProvinceSteward,
|
||||
id: stewardSecondKey,
|
||||
);
|
||||
},
|
||||
),
|
||||
GlassMorphismCardIcon(
|
||||
title: 'فروش خارج استان',
|
||||
vecIcon: Assets.vec.saleOutProvinceSvg.path,
|
||||
onTap: () {
|
||||
Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: stewardSecondKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.salesOutOfProvinceSteward,
|
||||
id: stewardSecondKey,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -89,14 +95,20 @@ class SalePage extends GetView<SaleLogic> {
|
||||
child: SvgGenImage.vec(iconPath).svg(
|
||||
width: 45,
|
||||
height: 45,
|
||||
colorFilter: ColorFilter.mode(foregroundColor, BlendMode.srcIn),
|
||||
colorFilter: ColorFilter.mode(
|
||||
foregroundColor,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Assets.vec.shoppingBasketSvg.svg(
|
||||
width: 55,
|
||||
height: 60,
|
||||
colorFilter: ColorFilter.mode(foregroundColor, BlendMode.srcIn),
|
||||
colorFilter: ColorFilter.mode(
|
||||
foregroundColor,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
],
|
||||
@@ -123,7 +135,9 @@ class SalePage extends GetView<SaleLogic> {
|
||||
children: [
|
||||
Text(
|
||||
'خلاصه اطلاعات',
|
||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||
style: AppFonts.yekan16Bold.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -144,9 +158,15 @@ class SalePage extends GetView<SaleLogic> {
|
||||
spacing: 10,
|
||||
children: [
|
||||
const SizedBox(height: 12),
|
||||
buildRow('تعداد کل بارها', model.totalQuantity?.toString() ?? '0'),
|
||||
buildRow(
|
||||
'تعداد کل بارها',
|
||||
model.totalQuantity?.toString() ?? '0',
|
||||
),
|
||||
buildRow('تعداد کل', model.totalBars?.toString() ?? '0'),
|
||||
buildRow('وزن کل (کیلوگرم)', model.totalWeight?.toString() ?? '0'),
|
||||
buildRow(
|
||||
'وزن کل (کیلوگرم)',
|
||||
model.totalWeight?.toString() ?? '0',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -165,7 +185,9 @@ class SalePage extends GetView<SaleLogic> {
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
@@ -173,7 +195,9 @@ class SalePage extends GetView<SaleLogic> {
|
||||
child: Text(
|
||||
value,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user