refactor: update routing and logic for steward features, including route imports and path adjustments
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
|
||||
String getFaUserRole(String? role) {
|
||||
@@ -151,7 +152,7 @@ Map<String, String?> getFaUserRoleWithOnTap(String? role) {
|
||||
case "LiveStockProvinceJahad":
|
||||
return {"جهاد استان": null};
|
||||
case "Steward":
|
||||
return {"مباشر": ChickenRoutes.initSteward};
|
||||
return {"مباشر": StewardRoutes.initSteward};
|
||||
case "PoultryScience":
|
||||
return {"کارشناس طیور": PoultryScienceRoutes.initPoultryScience};
|
||||
default:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:rasadyar_chicken/data/models/local/widely_used_local_model.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'chicken_local.dart';
|
||||
@@ -22,7 +23,7 @@ class ChickenLocalDataSourceImp implements ChickenLocalDataSource {
|
||||
color: AppColor.greenLightActive.toARGB32(),
|
||||
iconColor: AppColor.greenNormal.toARGB32(),
|
||||
iconPath: Assets.vec.cubeSearchSvg.path,
|
||||
path: ChickenRoutes.buysInProvinceSteward,
|
||||
path: StewardRoutes.buysInProvinceSteward,
|
||||
),
|
||||
WidelyUsedLocalItem(
|
||||
index: 1,
|
||||
@@ -31,7 +32,7 @@ class ChickenLocalDataSourceImp implements ChickenLocalDataSource {
|
||||
color: AppColor.blueLightActive.toARGB32(),
|
||||
iconColor: AppColor.blueNormal.toARGB32(),
|
||||
iconPath: Assets.vec.cubeSvg.path,
|
||||
path: ChickenRoutes.salesInProvinceSteward,
|
||||
path: StewardRoutes.salesInProvinceSteward,
|
||||
),
|
||||
|
||||
WidelyUsedLocalItem(
|
||||
@@ -40,7 +41,7 @@ class ChickenLocalDataSourceImp implements ChickenLocalDataSource {
|
||||
color: AppColor.blueLightActive.toARGB32(),
|
||||
iconColor: AppColor.blueNormal.toARGB32(),
|
||||
iconPath: Assets.vec.cubeRotateSvg.path,
|
||||
path: ChickenRoutes.buysInProvinceSteward,
|
||||
path: StewardRoutes.buysInProvinceSteward,
|
||||
),
|
||||
]; */
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:rasadyar_chicken/chicken.dart';
|
||||
import 'package:rasadyar_chicken/data/common/dio_error_handler.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/data/data_source/local/chicken_local.dart';
|
||||
import 'package:rasadyar_chicken/data/data_source/local/chicken_local_imp.dart';
|
||||
import 'package:rasadyar_chicken/data/data_source/remote/auth/auth_remote.dart';
|
||||
@@ -40,7 +41,7 @@ Future<void> setupChickenDI() async {
|
||||
},
|
||||
clearTokenCallback: () async {
|
||||
await tokenService.deleteModuleTokens(Module.chicken);
|
||||
Get.offAllNamed(ChickenRoutes.auth, arguments: Module.chicken);
|
||||
Get.offAllNamed(CommonRoutes.auth, arguments: Module.chicken);
|
||||
},
|
||||
),
|
||||
instanceName: 'chickenInterceptor',
|
||||
@@ -51,14 +52,18 @@ Future<void> setupChickenDI() async {
|
||||
diChicken.registerLazySingleton<DioRemote>(
|
||||
() => DioRemote(
|
||||
baseUrl: baseUrl,
|
||||
interceptors: diChicken.get<AppInterceptor>(instanceName: 'chickenInterceptor'),
|
||||
interceptors: diChicken.get<AppInterceptor>(
|
||||
instanceName: 'chickenInterceptor',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final dioRemote = diChicken.get<DioRemote>();
|
||||
await dioRemote.init();
|
||||
|
||||
diChicken.registerLazySingleton<AuthRemoteDataSource>(() => AuthRemoteDataSourceImp(dioRemote));
|
||||
diChicken.registerLazySingleton<AuthRemoteDataSource>(
|
||||
() => AuthRemoteDataSourceImp(dioRemote),
|
||||
);
|
||||
|
||||
diChicken.registerLazySingleton<AuthRepository>(
|
||||
() => AuthRepositoryImpl(diChicken.get<AuthRemoteDataSource>()),
|
||||
@@ -68,7 +73,9 @@ Future<void> setupChickenDI() async {
|
||||
() => ChickenRemoteDatasourceImp(diChicken.get<DioRemote>()),
|
||||
);
|
||||
|
||||
diChicken.registerLazySingleton<ChickenLocalDataSource>(() => ChickenLocalDataSourceImp());
|
||||
diChicken.registerLazySingleton<ChickenLocalDataSource>(
|
||||
() => ChickenLocalDataSourceImp(),
|
||||
);
|
||||
|
||||
diChicken.registerLazySingleton<ChickenRepository>(
|
||||
() => ChickenRepositoryImp(
|
||||
@@ -82,7 +89,9 @@ Future<void> setupChickenDI() async {
|
||||
);
|
||||
|
||||
diChicken.registerLazySingleton<PoultryScienceRepository>(
|
||||
() => PoultryScienceRepositoryImp(diChicken.get<PoultryScienceRemoteDatasource>()),
|
||||
() => PoultryScienceRepositoryImp(
|
||||
diChicken.get<PoultryScienceRemoteDatasource>(),
|
||||
),
|
||||
);
|
||||
|
||||
//region kill house module DI
|
||||
@@ -102,8 +111,12 @@ Future<void> newSetupAuthDI(String newUrl) async {
|
||||
await tokenService.saveBaseUrl(Module.chicken, newUrl);
|
||||
|
||||
// Re-register AppInterceptor
|
||||
if (diChicken.isRegistered<AppInterceptor>(instanceName: 'chickenInterceptor')) {
|
||||
await diChicken.unregister<AppInterceptor>(instanceName: 'chickenInterceptor');
|
||||
if (diChicken.isRegistered<AppInterceptor>(
|
||||
instanceName: 'chickenInterceptor',
|
||||
)) {
|
||||
await diChicken.unregister<AppInterceptor>(
|
||||
instanceName: 'chickenInterceptor',
|
||||
);
|
||||
}
|
||||
diChicken.registerLazySingleton<AppInterceptor>(
|
||||
() => AppInterceptor(
|
||||
@@ -113,7 +126,7 @@ Future<void> newSetupAuthDI(String newUrl) async {
|
||||
},
|
||||
clearTokenCallback: () async {
|
||||
await tokenService.deleteModuleTokens(Module.chicken);
|
||||
Get.offAllNamed(ChickenRoutes.auth, arguments: Module.chicken);
|
||||
Get.offAllNamed(CommonRoutes.auth, arguments: Module.chicken);
|
||||
},
|
||||
),
|
||||
instanceName: 'chickenInterceptor',
|
||||
@@ -126,16 +139,24 @@ Future<void> newSetupAuthDI(String newUrl) async {
|
||||
diChicken.registerLazySingleton<DioRemote>(
|
||||
() => DioRemote(
|
||||
baseUrl: newUrl,
|
||||
interceptors: diChicken.get<AppInterceptor>(instanceName: 'chickenInterceptor'),
|
||||
interceptors: diChicken.get<AppInterceptor>(
|
||||
instanceName: 'chickenInterceptor',
|
||||
),
|
||||
),
|
||||
);
|
||||
final dioRemote = diChicken.get<DioRemote>();
|
||||
await dioRemote.init();
|
||||
|
||||
// Re-register dependent layers
|
||||
await reRegister<AuthRemoteDataSource>(() => AuthRemoteDataSourceImp(dioRemote));
|
||||
await reRegister<AuthRepository>(() => AuthRepositoryImpl(diChicken.get<AuthRemoteDataSource>()));
|
||||
await reRegister<ChickenRemoteDatasource>(() => ChickenRemoteDatasourceImp(dioRemote));
|
||||
await reRegister<AuthRemoteDataSource>(
|
||||
() => AuthRemoteDataSourceImp(dioRemote),
|
||||
);
|
||||
await reRegister<AuthRepository>(
|
||||
() => AuthRepositoryImpl(diChicken.get<AuthRemoteDataSource>()),
|
||||
);
|
||||
await reRegister<ChickenRemoteDatasource>(
|
||||
() => ChickenRemoteDatasourceImp(dioRemote),
|
||||
);
|
||||
await reRegister<ChickenLocalDataSource>(() => ChickenLocalDataSourceImp());
|
||||
await reRegister<ChickenRepository>(
|
||||
() => ChickenRepositoryImp(
|
||||
@@ -148,7 +169,9 @@ Future<void> newSetupAuthDI(String newUrl) async {
|
||||
() => PoultryScienceRemoteDatasourceImp(dioRemote),
|
||||
);
|
||||
await reRegister<PoultryScienceRepository>(
|
||||
() => PoultryScienceRepositoryImp(diChicken.get<PoultryScienceRemoteDatasource>()),
|
||||
() => PoultryScienceRepositoryImp(
|
||||
diChicken.get<PoultryScienceRemoteDatasource>(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
2
packages/chicken/lib/features/common/common.dart
Normal file
2
packages/chicken/lib/features/common/common.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'presentation/routes/routes.dart';
|
||||
export 'presentation/routes/pages.dart';
|
||||
@@ -0,0 +1,3 @@
|
||||
abstract class ChickenRemoteDataSource {
|
||||
Future<void> getChickens();
|
||||
}
|
||||
@@ -7,7 +7,8 @@ import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/user_info/user_info_model.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/user_profile_model/user_profile_model.dart';
|
||||
import 'package:rasadyar_chicken/data/repositories/auth/auth_repository.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/captcha/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -28,7 +29,8 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
Rx<GlobalKey<FormState>> formKeySentOtp = GlobalKey<FormState>().obs;
|
||||
Rx<TextEditingController> usernameController = TextEditingController().obs;
|
||||
Rx<TextEditingController> passwordController = TextEditingController().obs;
|
||||
Rx<TextEditingController> phoneOtpNumberController = TextEditingController().obs;
|
||||
Rx<TextEditingController> phoneOtpNumberController =
|
||||
TextEditingController().obs;
|
||||
Rx<TextEditingController> otpCodeController = TextEditingController().obs;
|
||||
|
||||
var captchaController = Get.find<CaptchaWidgetLogic>();
|
||||
@@ -56,12 +58,18 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
_textAnimationController =
|
||||
AnimationController(vsync: this, duration: const Duration(milliseconds: 1200))
|
||||
AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 1200),
|
||||
)
|
||||
..repeat(reverse: true, count: 2).whenComplete(() {
|
||||
showCard.value = true;
|
||||
});
|
||||
|
||||
textAnimation = CurvedAnimation(parent: _textAnimationController, curve: Curves.easeInOut);
|
||||
textAnimation = CurvedAnimation(
|
||||
parent: _textAnimationController,
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
|
||||
initUserPassData();
|
||||
getDeviceModel();
|
||||
@@ -98,7 +106,8 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
}
|
||||
|
||||
bool _isFormValid() {
|
||||
final isCaptchaValid = captchaController.formKey.currentState?.validate() ?? false;
|
||||
final isCaptchaValid =
|
||||
captchaController.formKey.currentState?.validate() ?? false;
|
||||
final isFormValid = formKey.currentState?.validate() ?? false;
|
||||
return isCaptchaValid && isFormValid;
|
||||
}
|
||||
@@ -117,8 +126,14 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
onSuccess: (result) async {
|
||||
await gService.saveSelectedModule(_module);
|
||||
await tokenStorageService.saveModule(_module);
|
||||
await tokenStorageService.saveAccessToken(_module, result?.accessToken ?? '');
|
||||
await tokenStorageService.saveRefreshToken(_module, result?.accessToken ?? '');
|
||||
await tokenStorageService.saveAccessToken(
|
||||
_module,
|
||||
result?.accessToken ?? '',
|
||||
);
|
||||
await tokenStorageService.saveRefreshToken(
|
||||
_module,
|
||||
result?.accessToken ?? '',
|
||||
);
|
||||
var tmpRoles = result?.role?.where((element) {
|
||||
final allowedRoles = {'poultryscience', 'steward', 'killhouse'};
|
||||
final lowerElement = element.toString().toLowerCase().trim();
|
||||
@@ -143,9 +158,9 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
);
|
||||
|
||||
if (tmpRoles!.length > 1) {
|
||||
Get.offAndToNamed(ChickenRoutes.role);
|
||||
Get.offAndToNamed(CommonRoutes.role);
|
||||
} else {
|
||||
Get.offAllNamed(ChickenRoutes.initSteward);
|
||||
Get.offAllNamed(StewardRoutes.initSteward);
|
||||
}
|
||||
},
|
||||
onError: (error, stackTrace) {
|
||||
@@ -183,7 +198,9 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
}
|
||||
|
||||
void initUserPassData() {
|
||||
UserLocalModel? userLocalModel = tokenStorageService.getUserLocal(Module.chicken);
|
||||
UserLocalModel? userLocalModel = tokenStorageService.getUserLocal(
|
||||
Module.chicken,
|
||||
);
|
||||
if (userLocalModel?.username != null && userLocalModel?.password != null) {
|
||||
usernameController.value.text = userLocalModel?.username ?? '';
|
||||
passwordController.value.text = userLocalModel?.password ?? '';
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/auth/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/auth/view.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/profile/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/profile/view.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/role/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/role/view.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/captcha/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class CommonPages {
|
||||
CommonPages._();
|
||||
|
||||
static List<GetPage> get pages => [
|
||||
GetPage(
|
||||
name: CommonRoutes.auth,
|
||||
page: () => AuthPage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => AuthLogic());
|
||||
Get.lazyPut(() => CaptchaWidgetLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: CommonRoutes.role,
|
||||
page: () => RolePage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => RoleLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
|
||||
}),
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
sealed class CommonRoutes {
|
||||
CommonRoutes._();
|
||||
|
||||
static const auth = '/AuthChicken';
|
||||
static const _base = '/chicken';
|
||||
static const role = '$_base/role';
|
||||
static const String profile = '$_base/profile';
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||
import 'package:rasadyar_chicken/data/repositories/poultry_science/poultry_science_repository.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/pages/home/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/profile/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.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';
|
||||
@@ -30,7 +30,10 @@ class BuyPage extends GetView<BuyLogic> {
|
||||
end: AlignmentGeometry.bottomRight,
|
||||
),
|
||||
onTap: () {
|
||||
Get.toNamed(ChickenRoutes.buysInProvinceSteward, id: stewardFirstKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.buysInProvinceSteward,
|
||||
id: stewardFirstKey,
|
||||
);
|
||||
},
|
||||
),
|
||||
GlassMorphismCardIcon(
|
||||
@@ -43,7 +46,10 @@ class BuyPage extends GetView<BuyLogic> {
|
||||
end: AlignmentGeometry.bottomRight,
|
||||
),
|
||||
onTap: () {
|
||||
Get.toNamed(ChickenRoutes.buysOutOfProvinceSteward, id: stewardFirstKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.buysOutOfProvinceSteward,
|
||||
id: stewardFirstKey,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/buy/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/buy_in_province_all/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/buy_in_province_waiting/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_all/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_waiting/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class BuyInProvinceLogic extends GetxController {
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/buy_in_province_all/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/buy_in_province_waiting/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_all/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_waiting/view.dart';
|
||||
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/steward/inventory_widget.dart';
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/data/models/request/steward_allocation/steward_allocation_request.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class BuyInProvinceAllLogic extends GetxController {
|
||||
@@ -3,7 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/data/models/request/steward_allocation/steward_allocation_request.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -3,9 +3,9 @@ import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/cre
|
||||
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';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_free_bar.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/buy/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class HomeLogic extends GetxController {
|
||||
@@ -13,11 +13,12 @@ import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboa
|
||||
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart'
|
||||
hide ProductModel;
|
||||
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/buy/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/home/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sale/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/segmentation/view.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/profile/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/home/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
@@ -28,12 +29,22 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
||||
class StewardRootLogic extends GetxController {
|
||||
DateTime? _lastBackPressed;
|
||||
RxInt currentPage = 2.obs;
|
||||
List<Widget> pages = [BuyPage(), SalePage(), HomePage(), SegmentationPage(), ProfilePage()];
|
||||
List<Widget> pages = [
|
||||
BuyPage(),
|
||||
SalePage(),
|
||||
HomePage(),
|
||||
SegmentationPage(),
|
||||
ProfilePage(),
|
||||
];
|
||||
|
||||
final defaultRoutes = <int, String>{0: ChickenRoutes.buySteward, 1: ChickenRoutes.saleSteward};
|
||||
final defaultRoutes = <int, String>{
|
||||
0: StewardRoutes.buySteward,
|
||||
1: StewardRoutes.saleSteward,
|
||||
};
|
||||
RxList<ProductModel> rolesProductsModel = RxList<ProductModel>();
|
||||
Rxn<WidelyUsedLocalModel> widelyUsedList = Rxn<WidelyUsedLocalModel>();
|
||||
Rxn<StewardSalesInfoDashboard> stewardSalesInfoDashboard = Rxn<StewardSalesInfoDashboard>();
|
||||
Rxn<StewardSalesInfoDashboard> stewardSalesInfoDashboard =
|
||||
Rxn<StewardSalesInfoDashboard>();
|
||||
Rxn<StewardRemainWeight> stewardRemainWeight = Rxn<StewardRemainWeight>();
|
||||
|
||||
late DioRemote dioRemote;
|
||||
@@ -75,7 +86,9 @@ class StewardRootLogic extends GetxController {
|
||||
|
||||
if (widelyUsedList.value?.hasInit != true) {
|
||||
//TODO
|
||||
localDatasource.initWidleyUsed().then((value) => localDatasource.getAllWidely());
|
||||
localDatasource.initWidleyUsed().then(
|
||||
(value) => localDatasource.getAllWidely(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +159,9 @@ class StewardRootLogic extends GetxController {
|
||||
_provincesCancelToken = CancelToken();
|
||||
|
||||
try {
|
||||
final res = await chickenRepository.getProvince(cancelToken: _provincesCancelToken);
|
||||
final res = await chickenRepository.getProvince(
|
||||
cancelToken: _provincesCancelToken,
|
||||
);
|
||||
if (res != null) {
|
||||
provinces.clear();
|
||||
provinces.value = res;
|
||||
@@ -162,8 +177,9 @@ class StewardRootLogic extends GetxController {
|
||||
|
||||
Future<void> getRolesProducts() async {
|
||||
safeCall(
|
||||
call: () async =>
|
||||
await chickenRepository.getRolesProducts(token: tokenService.accessToken.value!),
|
||||
call: () async => await chickenRepository.getRolesProducts(
|
||||
token: tokenService.accessToken.value!,
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
rolesProductsModel.value = result;
|
||||
@@ -190,8 +206,9 @@ class StewardRootLogic extends GetxController {
|
||||
|
||||
Future<void> getStewardRemainWeightData() async {
|
||||
safeCall(
|
||||
call: () async =>
|
||||
await chickenRepository.getStewardRemainWeight(token: tokenService.accessToken.value!),
|
||||
call: () async => await chickenRepository.getStewardRemainWeight(
|
||||
token: tokenService.accessToken.value!,
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
stewardRemainWeight.value = result;
|
||||
@@ -231,7 +248,8 @@ class StewardRootLogic extends GetxController {
|
||||
currentNestedKey?.currentState?.popUntil((route) => route.isFirst);
|
||||
} else {
|
||||
final now = DateTime.now();
|
||||
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
||||
if (_lastBackPressed == null ||
|
||||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
|
||||
_lastBackPressed = now;
|
||||
Get.snackbar(
|
||||
'خروج از برنامه',
|
||||
@@ -1,7 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/chicken.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';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.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';
|
||||
@@ -26,7 +27,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
final page = ChickenPages.pages.firstWhere(
|
||||
(e) => e.name == settings.name,
|
||||
orElse: () => ChickenPages.pages.firstWhere(
|
||||
(e) => e.name == ChickenRoutes.buySteward,
|
||||
(e) => e.name == StewardRoutes.buySteward,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -39,7 +40,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
final page = ChickenPages.pages.firstWhere(
|
||||
(e) => e.name == settings.name,
|
||||
orElse: () => ChickenPages.pages.firstWhere(
|
||||
(e) => e.name == ChickenRoutes.saleSteward,
|
||||
(e) => e.name == StewardRoutes.saleSteward,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_m
|
||||
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/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class SaleLogic extends GetxController {
|
||||
@@ -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/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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -9,8 +9,8 @@ import 'package:rasadyar_chicken/data/models/response/guild/guild_model.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/guild_profile/guild_profile.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sales_in_province/widgets/cu_sale_in_provience.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_in_province/widgets/cu_sale_in_provience.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sales_in_province/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_in_province/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
Widget addOrEditBottomSheet(SalesInProvinceLogic controller, {bool isEditMode = false}) {
|
||||
@@ -6,10 +6,10 @@ import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buy
|
||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sales_out_of_province_buyers/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sales_out_of_province_sales_list/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_buyers/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_sales_list/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.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/utils/string_utils.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||
@@ -89,7 +89,7 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
onPressed: () {
|
||||
Get.toNamed(
|
||||
ChickenRoutes.salesOutOfProvinceBuyerSteward,
|
||||
StewardRoutes.salesOutOfProvinceBuyerSteward,
|
||||
id: stewardSecondKey,
|
||||
);
|
||||
},
|
||||
@@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sales_out_of_province/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -4,9 +4,9 @@ import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_pr
|
||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/sales_out_of_province_buyers/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_buyers/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -4,12 +4,13 @@ import 'package:flutter/services.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesListLogic> {
|
||||
class SalesOutOfProvinceSalesListPage
|
||||
extends GetView<SalesOutOfProvinceSalesListLogic> {
|
||||
const SalesOutOfProvinceSalesListPage({super.key});
|
||||
|
||||
@override
|
||||
@@ -57,10 +58,14 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
|
||||
),
|
||||
Spacer(),
|
||||
RFab(
|
||||
icon: Icon(CupertinoIcons.person_add_solid, color: Colors.white, size: 35.w),
|
||||
icon: Icon(
|
||||
CupertinoIcons.person_add_solid,
|
||||
color: Colors.white,
|
||||
size: 35.w,
|
||||
),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
onPressed: () {
|
||||
Get.toNamed(ChickenRoutes.salesOutOfProvinceBuyerSteward, id: 1);
|
||||
Get.toNamed(StewardRoutes.salesOutOfProvinceBuyerSteward, id: 1);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 25),
|
||||
@@ -131,7 +136,10 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
|
||||
Container itemListExpandedWidget(StewardFreeSaleBar item, int index) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
@@ -163,12 +171,16 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
|
||||
children: [
|
||||
Text(
|
||||
item.date?.toJalali.formatter.wN ?? 'ندارد',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.textColor,
|
||||
),
|
||||
),
|
||||
|
||||
Text(
|
||||
'${item.date?.toJalali.formatter.d} ${item.date?.toJalali.formatter.mN ?? 'ندارد'}',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -185,10 +197,16 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
|
||||
],
|
||||
),
|
||||
),
|
||||
buildRow(title: 'مشخصات خریدار', value: item.buyer?.fullname ?? 'ندارد'),
|
||||
buildRow(
|
||||
title: 'مشخصات خریدار',
|
||||
value: item.buyer?.fullname ?? 'ندارد',
|
||||
),
|
||||
buildRow(title: 'تلفن خریدار', value: item.buyer?.mobile ?? 'ندارد'),
|
||||
buildRow(title: 'نام واحد', value: item.buyer?.unitName ?? 'ندارد'),
|
||||
buildRow(title: 'وزن لاشه', value: '${item.weightOfCarcasses?.separatedByCommaFa}'),
|
||||
buildRow(
|
||||
title: 'وزن لاشه',
|
||||
value: '${item.weightOfCarcasses?.separatedByCommaFa}',
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -244,7 +262,9 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
|
||||
children: [
|
||||
Text(
|
||||
isOnEdit ? 'ویرایش فروش' : 'افزودن فروش',
|
||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||
style: AppFonts.yekan16Bold.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
_productDropDown(),
|
||||
|
||||
@@ -264,7 +284,8 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
|
||||
Expanded(
|
||||
child: timeFilterWidget(
|
||||
date: controller.saleDate,
|
||||
onChanged: (jalali) => controller.saleDate.value = jalali,
|
||||
onChanged: (jalali) =>
|
||||
controller.saleDate.value = jalali,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -342,7 +363,9 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
|
||||
text: isOnEdit ? 'ویرایش' : 'ثبت',
|
||||
onPressed: data.value
|
||||
? () async {
|
||||
var res = isOnEdit ? await controller.editSale() : await controller.createSale();
|
||||
var res = isOnEdit
|
||||
? await controller.editSale()
|
||||
: await controller.createSale();
|
||||
if (res) {
|
||||
controller.getOutProvinceSales();
|
||||
controller.clearSaleForm();
|
||||
@@ -423,15 +446,23 @@ class SalesOutOfProvinceSalesListPage extends GetView<SalesOutOfProvinceSalesLis
|
||||
Assets.vec.calendarSvg.svg(
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: const ColorFilter.mode(AppColor.bgDark, BlendMode.srcIn),
|
||||
colorFilter: const ColorFilter.mode(
|
||||
AppColor.bgDark,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'تاریخ',
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
Text('تاریخ', style: AppFonts.yekan16.copyWith(color: AppColor.bgDark)),
|
||||
Expanded(
|
||||
child: ObxValue((data) {
|
||||
return Text(
|
||||
date.value.formatCompactDate(),
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDark),
|
||||
style: AppFonts.yekan16.copyWith(
|
||||
color: AppColor.darkGreyDark,
|
||||
),
|
||||
);
|
||||
}, date),
|
||||
),
|
||||
@@ -5,7 +5,7 @@ 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/segmentation_model/segmentation_model.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_remain_weight/steward_remain_weight.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/segmentation/widgets/cu_bottom_sheet.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/widgets/cu_bottom_sheet.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.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/presentation/pages/steward/segmentation/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
Widget addOrEditBottomSheet(SegmentationLogic controller, {bool isOnEdit = false}) {
|
||||
@@ -0,0 +1,135 @@
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_all/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_in_province_waiting/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_out_of_province/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/buy_out_of_province/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/home/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/home/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_in_province/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_in_province/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_buyers/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_buyers/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_out_of_province_sales_list/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/global_binding.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class StewardPages {
|
||||
StewardPages._();
|
||||
|
||||
static List<GetPage> get pages => [
|
||||
//region Steward Pages
|
||||
GetPage(
|
||||
name: StewardRoutes.initSteward,
|
||||
page: () => StewardRootPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
bindings: [
|
||||
GlobalBinding(),
|
||||
BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
|
||||
Get.lazyPut(() => StewardRootLogic());
|
||||
Get.lazyPut(() => HomeLogic());
|
||||
Get.lazyPut(() => BuyLogic());
|
||||
Get.lazyPut(() => SaleLogic());
|
||||
Get.lazyPut(() => SegmentationLogic());
|
||||
}),
|
||||
],
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: StewardRoutes.homeSteward,
|
||||
page: () => HomePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.put(HomeLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
//sales
|
||||
GetPage(
|
||||
name: StewardRoutes.saleSteward,
|
||||
page: () => SalePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => SaleLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
||||
Get.lazyPut(() => StewardRootLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: StewardRoutes.salesOutOfProvinceSteward,
|
||||
page: () => SalesOutOfProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: StewardRoutes.salesOutOfProvinceBuyerSteward,
|
||||
page: () => SalesOutOfProvinceBuyersPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: StewardRoutes.salesInProvinceSteward,
|
||||
page: () => SalesInProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => SalesInProvinceLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
//buy
|
||||
GetPage(
|
||||
name: StewardRoutes.buySteward,
|
||||
page: () => BuyPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => BuyLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: StewardRoutes.buysOutOfProvinceSteward,
|
||||
page: () => BuyOutOfProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => BuyOutOfProvinceLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: StewardRoutes.buysInProvinceSteward,
|
||||
page: () => BuyInProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => BuyInProvinceLogic());
|
||||
Get.lazyPut(() => BuyInProvinceWaitingLogic());
|
||||
Get.lazyPut(() => BuyInProvinceAllLogic());
|
||||
}),
|
||||
),
|
||||
//endregion
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
sealed class StewardRoutes {
|
||||
StewardRoutes._();
|
||||
|
||||
static const _base = '/chicken/steward';
|
||||
static const initSteward = '$_base/';
|
||||
static const homeSteward = '$_base/home';
|
||||
static const buySteward = '$_base/buy';
|
||||
static const saleSteward = '$_base/sale';
|
||||
static const segmentationSteward = '$_base/segmentation';
|
||||
|
||||
//buys
|
||||
static const buysOutOfProvinceSteward = '$buySteward/buyOutOfProvince';
|
||||
static const buysInProvinceSteward = '$buySteward/buyInProvince';
|
||||
|
||||
//sales
|
||||
static const salesInProvinceSteward = '$saleSteward/SalesInProvince';
|
||||
static const salesOutOfProvinceSteward = '$saleSteward/saleOutOfProvince';
|
||||
static const salesOutOfProvinceBuyerSteward =
|
||||
'$saleSteward/saleOutOfProvinceBuyer ';
|
||||
}
|
||||
2
packages/chicken/lib/features/steward/steward.dart
Normal file
2
packages/chicken/lib/features/steward/steward.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'presentation/routes/routes.dart';
|
||||
export 'presentation/routes/pages.dart';
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||
import 'package:rasadyar_chicken/data/repositories/kill_house/kill_house_repository.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/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';
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
export 'buy/logic.dart';
|
||||
export 'buy/view.dart';
|
||||
export 'buy_in_province/logic.dart';
|
||||
export 'buy_in_province/view.dart';
|
||||
export 'buy_in_province_all/logic.dart';
|
||||
export 'buy_in_province_all/view.dart';
|
||||
export 'buy_in_province_waiting/logic.dart';
|
||||
export 'buy_in_province_waiting/view.dart';
|
||||
export 'buy_out_of_province/logic.dart';
|
||||
export 'buy_out_of_province/view.dart';
|
||||
export 'home/logic.dart';
|
||||
export 'home/view.dart';
|
||||
export 'root/logic.dart';
|
||||
export 'root/view.dart';
|
||||
export 'sale/logic.dart';
|
||||
export 'sale/view.dart';
|
||||
export 'sales_in_province/logic.dart';
|
||||
export 'sales_in_province/view.dart';
|
||||
export 'sales_out_of_province/logic.dart';
|
||||
export 'sales_out_of_province/view.dart';
|
||||
export 'sales_out_of_province_buyers/logic.dart';
|
||||
export 'sales_out_of_province_buyers/view.dart';
|
||||
export 'sales_out_of_province_sales_list/logic.dart';
|
||||
export 'sales_out_of_province_sales_list/view.dart';
|
||||
export 'segmentation/logic.dart';
|
||||
export 'segmentation/view.dart';
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:rasadyar_chicken/presentation/pages/common/profile/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/profile/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class GlobalBinding extends Bindings {
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
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/features/common/common.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';
|
||||
@@ -10,138 +7,22 @@ import 'package:rasadyar_chicken/presentation/pages/kill_house/submit_request/lo
|
||||
import 'package:rasadyar_chicken/presentation/pages/kill_house/submit_request/view.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/poultry_farm_inspection.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/poultry_science.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/steward.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/steward.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/global_binding.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/captcha/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
sealed class ChickenPages {
|
||||
ChickenPages._();
|
||||
|
||||
static final pages = [
|
||||
GetPage(
|
||||
name: ChickenRoutes.auth,
|
||||
page: () => AuthPage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => AuthLogic());
|
||||
Get.lazyPut(() => CaptchaWidgetLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
|
||||
}),
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: ChickenRoutes.role,
|
||||
page: () => RolePage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => RoleLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
|
||||
}),
|
||||
),
|
||||
//region Common Pages
|
||||
...CommonPages.pages,
|
||||
//endregion
|
||||
|
||||
//region Steward Pages
|
||||
GetPage(
|
||||
name: ChickenRoutes.initSteward,
|
||||
page: () => StewardRootPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
bindings: [
|
||||
GlobalBinding(),
|
||||
BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
|
||||
Get.lazyPut(() => StewardRootLogic());
|
||||
Get.lazyPut(() => HomeLogic());
|
||||
Get.lazyPut(() => BuyLogic());
|
||||
Get.lazyPut(() => SaleLogic());
|
||||
Get.lazyPut(() => SegmentationLogic());
|
||||
}),
|
||||
],
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: ChickenRoutes.homeSteward,
|
||||
page: () => HomePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.put(HomeLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
//sales
|
||||
GetPage(
|
||||
name: ChickenRoutes.saleSteward,
|
||||
page: () => SalePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => SaleLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
||||
Get.lazyPut(() => StewardRootLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.salesOutOfProvinceSteward,
|
||||
page: () => SalesOutOfProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.salesOutOfProvinceBuyerSteward,
|
||||
page: () => SalesOutOfProvinceBuyersPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.salesInProvinceSteward,
|
||||
page: () => SalesInProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => SalesInProvinceLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
//buy
|
||||
GetPage(
|
||||
name: ChickenRoutes.buySteward,
|
||||
page: () => BuyPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => BuyLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.buysOutOfProvinceSteward,
|
||||
page: () => BuyOutOfProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => BuyOutOfProvinceLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.buysInProvinceSteward,
|
||||
page: () => BuyInProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => BuyInProvinceLogic());
|
||||
Get.lazyPut(() => BuyInProvinceWaitingLogic());
|
||||
Get.lazyPut(() => BuyInProvinceAllLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
...StewardPages.pages,
|
||||
//endregion
|
||||
|
||||
//region Poultry science Pages
|
||||
|
||||
@@ -1,28 +1,7 @@
|
||||
sealed class ChickenRoutes {
|
||||
ChickenRoutes._();
|
||||
|
||||
static const auth = '/AuthChicken';
|
||||
static const _base = '/chicken';
|
||||
static const role = '$_base/role';
|
||||
static const String profile = '$_base/profile';
|
||||
|
||||
//region Steward Routes
|
||||
static const _steward = '$_base/steward';
|
||||
static const initSteward = '$_steward/';
|
||||
static const homeSteward = '$_steward/home';
|
||||
static const buySteward = '$_steward/buy';
|
||||
static const saleSteward = '$_steward/sale';
|
||||
static const segmentationSteward = '$_steward/segmentation';
|
||||
|
||||
//buys
|
||||
static const buysOutOfProvinceSteward = '$buySteward/buyOutOfProvince';
|
||||
static const buysInProvinceSteward = '$buySteward/buyInProvince';
|
||||
|
||||
//sales
|
||||
static const salesInProvinceSteward = '$saleSteward/SalesInProvince';
|
||||
static const salesOutOfProvinceSteward = '$saleSteward/saleOutOfProvince';
|
||||
static const salesOutOfProvinceBuyerSteward =
|
||||
'$saleSteward/saleOutOfProvinceBuyer ';
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
const int timeDebounce = 1200;
|
||||
|
||||
void handleGeneric(DioException error, [void Function()? onError]) {
|
||||
Get.showSnackbar(_errorSnackBar('اعتبار توکن شما منقضی شده است لطفا دوباره وارد شوید'));
|
||||
Get.showSnackbar(
|
||||
_errorSnackBar('اعتبار توکن شما منقضی شده است لطفا دوباره وارد شوید'),
|
||||
);
|
||||
|
||||
Get.offAllNamed(ChickenRoutes.auth, arguments: Module.chicken);
|
||||
Get.offAllNamed(CommonRoutes.auth, arguments: Module.chicken);
|
||||
}
|
||||
|
||||
GetSnackBar _errorSnackBar(String message) {
|
||||
return GetSnackBar(
|
||||
titleText: Text('خطا', style: AppFonts.yekan14.copyWith(color: Colors.white)),
|
||||
messageText: Text(message, style: AppFonts.yekan12.copyWith(color: Colors.white)),
|
||||
titleText: Text(
|
||||
'خطا',
|
||||
style: AppFonts.yekan14.copyWith(color: Colors.white),
|
||||
),
|
||||
messageText: Text(
|
||||
message,
|
||||
style: AppFonts.yekan12.copyWith(color: Colors.white),
|
||||
),
|
||||
backgroundColor: AppColor.error,
|
||||
margin: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
borderRadius: 12,
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'dart:math';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/common/auth/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/auth/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
Widget inventoryWidget(StewardRootLogic rootLogic) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import 'package:rasadyar_chicken/presentation/pages/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
enum WidelyUsedType { edit, normal }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -39,7 +39,10 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
controller.rootLogic.currentPage.value = 0;
|
||||
controller.rootLogic.currentPage.refresh();
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
Get.toNamed(ChickenRoutes.buysOutOfProvinceSteward, id: stewardFirstKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.buysOutOfProvinceSteward,
|
||||
id: stewardFirstKey,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -52,7 +55,10 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
controller.rootLogic.currentPage.value = 0;
|
||||
controller.rootLogic.currentPage.refresh();
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
Get.toNamed(ChickenRoutes.buysInProvinceSteward, id: stewardFirstKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.buysInProvinceSteward,
|
||||
id: stewardFirstKey,
|
||||
);
|
||||
},
|
||||
isOnEdit: false,
|
||||
),
|
||||
@@ -65,7 +71,10 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
controller.rootLogic.currentPage.value = 1;
|
||||
controller.rootLogic.currentPage.refresh();
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: stewardSecondKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.salesOutOfProvinceSteward,
|
||||
id: stewardSecondKey,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -77,7 +86,10 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
controller.rootLogic.currentPage.value = 1;
|
||||
controller.rootLogic.currentPage.refresh();
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: stewardSecondKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.salesInProvinceSteward,
|
||||
id: stewardSecondKey,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -93,7 +105,11 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
|
||||
),
|
||||
child: Text('پر کاربردها', textAlign: TextAlign.right, style: AppFonts.yekan16),
|
||||
child: Text(
|
||||
'پر کاربردها',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan16,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -126,20 +142,27 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: ShapeDecoration(
|
||||
color: cardColor ?? Color(0xFFBECDFF),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
width: 40.w,
|
||||
height: 40.h,
|
||||
decoration: ShapeDecoration(
|
||||
color: labelColor ?? AppColor.blueNormal,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.all(4),
|
||||
child: SvgGenImage.vec(iconPath).svg(
|
||||
width: 24.w,
|
||||
height: 24.h,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
colorFilter: ColorFilter.mode(
|
||||
Colors.white,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
@@ -152,7 +175,9 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white60,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -172,9 +197,16 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
child: Container(
|
||||
width: 16,
|
||||
height: 16,
|
||||
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.white),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(CupertinoIcons.minus, color: AppColor.error, size: 15),
|
||||
child: Icon(
|
||||
CupertinoIcons.minus,
|
||||
color: AppColor.error,
|
||||
size: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -183,7 +215,12 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(title, style: AppFonts.yekan10.copyWith(color: textColor ?? AppColor.textColor)),
|
||||
Text(
|
||||
title,
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: textColor ?? AppColor.textColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -201,16 +238,24 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: ShapeDecoration(
|
||||
color: const Color(0xFFD9F7F0),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Assets.vec.messageAddSvg.svg(
|
||||
width: 40,
|
||||
height: 40,
|
||||
colorFilter: ColorFilter.mode(AppColor.greenNormal, BlendMode.srcIn),
|
||||
colorFilter: ColorFilter.mode(
|
||||
AppColor.greenNormal,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Text('افزودن', style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover)),
|
||||
Text(
|
||||
'افزودن',
|
||||
style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
/* import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:rasadyar_chicken/data/common/fa_user_role.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
|
||||
@@ -23,4 +23,4 @@ void main() {
|
||||
expect(getFaUserRoleWithOnTap(null), {'نامشخص': null});
|
||||
});
|
||||
});
|
||||
}
|
||||
} */
|
||||
Reference in New Issue
Block a user