feat: killHouse action page
This commit is contained in:
@@ -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