feat: killHouse action page
This commit is contained in:
@@ -92,7 +92,7 @@ Map<String, String?> getFaUserRoleWithOnTap(String? role) {
|
||||
case "ProvinceFinancial":
|
||||
return {"مالی اتحادیه": null};
|
||||
case "KillHouse":
|
||||
return {"کشتارگاه": null};
|
||||
return {"کشتارگاه": ChickenRoutes.initKillHouse};
|
||||
case "KillHouseVet":
|
||||
return {"دامپزشک کشتارگاه": null};
|
||||
case "VetFarm":
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'kill_request_response.freezed.dart';
|
||||
part 'kill_request_response.g.dart';
|
||||
|
||||
@freezed
|
||||
class KillRequestResponse with _$KillRequestResponse {
|
||||
const factory KillRequestResponse({
|
||||
int? killCapacity,
|
||||
String? reciveTime,
|
||||
String? reciveDate,
|
||||
bool? lowWeight,
|
||||
bool? highWeight,
|
||||
double? indexWeight,
|
||||
String? chickenBreed,
|
||||
bool? cash,
|
||||
bool? credit,
|
||||
bool? smsPayment,
|
||||
String? killHouseKey,
|
||||
String? killerKillHouseKey,
|
||||
String? role,
|
||||
}) = _KillRequestResponse;
|
||||
|
||||
factory KillRequestResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$KillRequestResponseFromJson(json);
|
||||
}
|
||||
@@ -15,7 +15,8 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$KillRegistrationRequest {
|
||||
|
||||
bool? get approvedPrice; bool? get market; String? get killReqKey; String? get operatorKey; String? get poultryHatchingKey; int? get quantity; String? get sendDate; String? get chickenBreed;@JsonKey(name: "Index_weight") double? get indexWeight; String? get losses; List<dynamic>? get auctionList; bool? get freezing; bool? get export; bool? get cash; bool? get credit; List<dynamic>? get killHouseList; String? get role; String? get poultryKey; int? get amount; String? get financialOperation; bool? get freeSaleInProvince; String? get confirmPoultryMobile;
|
||||
bool? get approvedPrice; bool? get market; String? get killReqKey; String? get operatorKey; String? get poultryHatchingKey; int? get quantity; String? get sendDate; String? get chickenBreed;// ignore: invalid_annotation_target
|
||||
@JsonKey(name: "Index_weight") double? get indexWeight; String? get losses; List<dynamic>? get auctionList; bool? get freezing; bool? get export; bool? get cash; bool? get credit; List<dynamic>? get killHouseList; String? get role; String? get poultryKey; int? get amount; String? get financialOperation; bool? get freeSaleInProvince; String? get confirmPoultryMobile;
|
||||
/// Create a copy of KillRegistrationRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -241,6 +242,7 @@ class _KillRegistrationRequest implements KillRegistrationRequest {
|
||||
@override final int? quantity;
|
||||
@override final String? sendDate;
|
||||
@override final String? chickenBreed;
|
||||
// ignore: invalid_annotation_target
|
||||
@override@JsonKey(name: "Index_weight") final double? indexWeight;
|
||||
@override final String? losses;
|
||||
final List<dynamic>? _auctionList;
|
||||
|
||||
@@ -15,7 +15,8 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$PoultryOrder {
|
||||
|
||||
String? get key; int? get id; Poultry? get poultry; int? get orderCode; String? get createDate; String? get sendDate; List<String>? get killHouseList; int? get firstQuantity; int? get quantity; bool? get directBuying; bool? get union; double? get amount; String? get financialOperation; int? get remainQuantity;@JsonKey(name: "Index_weight") double? get indexWeight; Hatching? get hatching; String? get finalState; int? get losses; String? get provinceState; String? get stateProcess; Registrar? get registrar; VetFarm? get vetFarm; bool? get freeSaleInProvince; bool? get freezing; bool? get export; String? get cityCheckRequest; bool? get market;
|
||||
String? get key; int? get id; Poultry? get poultry; int? get orderCode; String? get createDate; String? get sendDate; List<String>? get killHouseList; int? get firstQuantity; int? get quantity; bool? get directBuying; bool? get union; double? get amount; String? get financialOperation; int? get remainQuantity;// ignore: invalid_annotation_target
|
||||
@JsonKey(name: "Index_weight") double? get indexWeight; Hatching? get hatching; String? get finalState; int? get losses; String? get provinceState; String? get stateProcess; Registrar? get registrar; VetFarm? get vetFarm; bool? get freeSaleInProvince; bool? get freezing; bool? get export; String? get cityCheckRequest; bool? get market;
|
||||
/// Create a copy of PoultryOrder
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -308,6 +309,7 @@ class _PoultryOrder implements PoultryOrder {
|
||||
@override final double? amount;
|
||||
@override final String? financialOperation;
|
||||
@override final int? remainQuantity;
|
||||
// ignore: invalid_annotation_target
|
||||
@override@JsonKey(name: "Index_weight") final double? indexWeight;
|
||||
@override final Hatching? hatching;
|
||||
@override final String? finalState;
|
||||
|
||||
@@ -119,17 +119,11 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
await tokenStorageService.saveModule(_module);
|
||||
await tokenStorageService.saveAccessToken(_module, result?.accessToken ?? '');
|
||||
await tokenStorageService.saveRefreshToken(_module, result?.accessToken ?? '');
|
||||
var tmpRoles = result?.role
|
||||
?.where((element) => element == 'PoultryScience' || element == 'Steward')
|
||||
.toList();
|
||||
|
||||
/*var tmpRoles = result?.role?.where((element) {
|
||||
return element == 'PoultryScience' ||
|
||||
element == 'Steward' ||
|
||||
element == 'CityOperator' ||
|
||||
element == 'CityJahad' ||
|
||||
element.toLowerCase().contains("admin");
|
||||
}).toList();*/
|
||||
var tmpRoles = result?.role?.where((element) {
|
||||
final allowedRoles = {'poultryscience', 'steward', 'killhouse'};
|
||||
final lowerElement = element.toString().toLowerCase().trim();
|
||||
return allowedRoles.contains(lowerElement);
|
||||
}).toList();
|
||||
|
||||
await tokenStorageService.saveRoles(_module, tmpRoles ?? []);
|
||||
if (rememberMe.value) {
|
||||
|
||||
@@ -32,11 +32,17 @@ class RolePage extends GetView<RoleLogic> {
|
||||
return roleCard(
|
||||
title: role.keys.first,
|
||||
onTap: () async {
|
||||
String route = role.values.first;
|
||||
await controller.gService.saveRoute(Module.chicken, route);
|
||||
try {
|
||||
String route = role.values.first;
|
||||
await controller.gService.saveRoute(Module.chicken, route);
|
||||
|
||||
await controller.gService.saveRole(Module.chicken, data[index]);
|
||||
Get.offAllNamed(route);
|
||||
await controller.gService.saveRole(Module.chicken, data[index]);
|
||||
Get.offAllNamed(route);
|
||||
} catch (e) {
|
||||
eLog(
|
||||
"احتمالا در\n ``getFaUserRoleWithOnTap`` \nروت اش را تعریف نکردی 👻👻 ==>$e ",
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class KillHouseActionLogic extends GetxController {
|
||||
List<GlassMorphismCardItem> items = [
|
||||
GlassMorphismCardItem(title: "ثبت درخواست", icon: Assets.vec.submitRequestSvg.path, route: ''),
|
||||
GlassMorphismCardItem(
|
||||
title: "انبار و توزیع",
|
||||
icon: Assets.vec.warehouseDistributionSvg.path,
|
||||
route: '',
|
||||
),
|
||||
GlassMorphismCardItem(
|
||||
title: "سفارشات دریافتی",
|
||||
icon: Assets.vec.ordersReceivedSvg.path,
|
||||
route: '',
|
||||
),
|
||||
GlassMorphismCardItem(title: "خرید مستقیم", icon: Assets.vec.directPurchaseSvg.path, route: ''),
|
||||
GlassMorphismCardItem(title: "تخصیص خودرو", icon: Assets.vec.carAllocationSvg.path, route: ''),
|
||||
GlassMorphismCardItem(
|
||||
title: "ورود اطلاعات بار",
|
||||
icon: Assets.vec.enterCargoInformationSvg.path,
|
||||
route: '',
|
||||
),
|
||||
GlassMorphismCardItem(
|
||||
title: "مدیریت بارها",
|
||||
icon: Assets.vec.managementBarsSvg.path,
|
||||
route: '',
|
||||
),
|
||||
];
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class KillHouseActionPage extends GetView<KillHouseActionLogic> {
|
||||
const KillHouseActionPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ChickenBasePage(
|
||||
isBase: true,
|
||||
child: GlassMorphismGrid(
|
||||
items: controller.items,
|
||||
onTap: () {
|
||||
iLog("Hoooooura 😍😍😍😍😍");
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class KillHouseRootLogic extends GetxController {
|
||||
RxInt currentPage = 2.obs;
|
||||
|
||||
final pages = [
|
||||
Navigator(
|
||||
key: Get.nestedKey(killHouseFirstKey),
|
||||
onGenerateRoute: (settings) {
|
||||
final page = ChickenPages.pages.firstWhere(
|
||||
(e) => e.name == settings.name,
|
||||
orElse: () =>
|
||||
ChickenPages.pages.firstWhere((e) => e.name == ChickenRoutes.actionKillHouse),
|
||||
);
|
||||
|
||||
return buildRouteFromGetPage(page);
|
||||
},
|
||||
),
|
||||
Container(color: Colors.deepPurpleAccent.withAlpha(50)),
|
||||
ProfilePage(),
|
||||
];
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
void changePage(int i) {
|
||||
currentPage.value = i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class KillHouseRootPage extends GetView<KillHouseRootLogic> {
|
||||
const KillHouseRootPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ObxValue((data) {
|
||||
return ChickenBasePage(
|
||||
isBase: true,
|
||||
isFullScreen: true,
|
||||
scrollable: true,
|
||||
child: Stack(
|
||||
children: [
|
||||
IndexedStack(children: controller.pages, index: data.value),
|
||||
Positioned(
|
||||
right: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
child: RBottomNavigation(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
items: [
|
||||
RBottomNavigationItem(
|
||||
label: 'عملیات',
|
||||
icon: Assets.vec.settingSvg.path,
|
||||
isSelected: controller.currentPage.value == 0,
|
||||
onTap: () {
|
||||
/* Get.nestedKey(
|
||||
poultrySecondKey,
|
||||
)?.currentState?.popUntil((route) => route.isFirst);
|
||||
Get.nestedKey(
|
||||
poultryFirstKey,
|
||||
)?.currentState?.popUntil((route) => route.isFirst);*/
|
||||
controller.changePage(0);
|
||||
},
|
||||
),
|
||||
RBottomNavigationItem(
|
||||
label: 'خانه',
|
||||
icon: Assets.vec.homeSvg.path,
|
||||
isSelected: controller.currentPage.value == 1,
|
||||
onTap: () {
|
||||
/* Get.nestedKey(
|
||||
poultryFirstKey,
|
||||
)?.currentState?.popUntil((route) => route.isFirst);
|
||||
Get.nestedKey(
|
||||
poultryThirdKey,
|
||||
)?.currentState?.popUntil((route) => route.isFirst);*/
|
||||
controller.changePage(1);
|
||||
},
|
||||
),
|
||||
RBottomNavigationItem(
|
||||
label: 'پروفایل',
|
||||
icon: Assets.vec.profileCircleSvg.path,
|
||||
isSelected: controller.currentPage.value == 2,
|
||||
onTap: () {
|
||||
/* Get.nestedKey(
|
||||
poultryFirstKey,
|
||||
)?.currentState?.popUntil((route) => route.isFirst);
|
||||
Get.nestedKey(
|
||||
poultrySecondKey,
|
||||
)?.currentState?.popUntil((route) => route.isFirst);*/
|
||||
controller.changePage(2);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.currentPage);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,10 @@ import 'package:rasadyar_chicken/presentation/pages/common/auth/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/common/auth/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/common/role/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/common/role/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/kill_house/action/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/kill_house/action/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/kill_house/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/kill_house/root/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/poultry_farm_inspection/poultry_farm_inspection.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/view.dart';
|
||||
@@ -234,5 +238,27 @@ sealed class ChickenPages {
|
||||
}),
|
||||
),
|
||||
//endregion
|
||||
|
||||
//region kill house
|
||||
GetPage(
|
||||
name: ChickenRoutes.initKillHouse,
|
||||
page: () => KillHouseRootPage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => KillHouseRootLogic());
|
||||
Get.lazyPut(() => BaseLogic(), fenix: true);
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.actionKillHouse,
|
||||
page: () => KillHouseActionPage(),
|
||||
bindings: [
|
||||
GlobalBinding(),
|
||||
BindingsBuilder(() {
|
||||
Get.lazyPut(() => KillHouseActionLogic());
|
||||
Get.lazyPut(() => BaseLogic(), fenix: true);
|
||||
}),
|
||||
],
|
||||
),
|
||||
//endregion
|
||||
];
|
||||
}
|
||||
|
||||
@@ -42,4 +42,12 @@ sealed class ChickenRoutes {
|
||||
static const poultryFarmInspectionHome = '$_poultryFarmInspection/Home';
|
||||
|
||||
//endregion
|
||||
|
||||
//region KillHouse Routes
|
||||
|
||||
static const _killHouse = '$_base/killHouse';
|
||||
static const initKillHouse = '$_killHouse/home';
|
||||
static const actionKillHouse = '$_killHouse/action';
|
||||
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -11,3 +11,8 @@ const int poultryFirstKey = 105;
|
||||
const int poultrySecondKey = 106;
|
||||
const int poultryThirdKey = 107;
|
||||
//endregion
|
||||
|
||||
//region kill house Keys
|
||||
const int killHouseFirstKey = 108;
|
||||
|
||||
//endregion
|
||||
|
||||
Reference in New Issue
Block a user