feat: warehouse_and_distribution in killhouse module

This commit is contained in:
2025-12-01 15:25:19 +03:30
parent 6861e873ba
commit c42ee069e6
57 changed files with 11246 additions and 208 deletions

View File

@@ -28,12 +28,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: ChickenRoutes.buySteward,
1: ChickenRoutes.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 +85,9 @@ class StewardRootLogic extends GetxController {
if (widelyUsedList.value?.hasInit != true) {
//TODO
localDatasource.initWidleyUsed().then((value) => localDatasource.getAllWidely());
localDatasource.initWidleyUsed().then(
(value) => localDatasource.getAllWidely(),
);
}
}
@@ -115,6 +127,7 @@ class StewardRootLogic extends GetxController {
call: () async => await chickenRepository.getInventory(
token: tokenService.accessToken.value!,
cancelToken: _inventoryCancelToken,
role: 'Steward',
),
onSuccess: (result) {
if (result != null) {
@@ -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(
'خروج از برنامه',