feat : sale out of Province

This commit is contained in:
2025-06-21 17:01:37 +03:30
parent fc4295e532
commit 656b5f0d87
28 changed files with 1270 additions and 489 deletions

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart' show Colors;
import 'package:flutter/widgets.dart';
import 'package:rasadyar_auth/data/services/token_storage_service.dart';
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
import 'package:rasadyar_chicken/data/repositories/chicken_repository.dart';
import 'package:rasadyar_chicken/data/repositories/chicken_repository_imp.dart';
import 'package:rasadyar_chicken/presentation/pages/home/view.dart';
@@ -28,8 +29,6 @@ class RootLogic extends GetxController {
GlobalKey<NavigatorState>(),
];
late DioRemote dioRemote;
var tokenService = Get.find<TokenStorageService>();
late ChickenRepository chickenRepository;
@@ -37,6 +36,8 @@ class RootLogic extends GetxController {
RxList<ErrorLocationType> errorLocationType = RxList();
RxMap<int, dynamic> inventoryExpandedList = RxMap();
RxList<IranProvinceCityModel> provinces = <IranProvinceCityModel>[].obs;
@override
void onInit() {
super.onInit();
@@ -44,6 +45,8 @@ class RootLogic extends GetxController {
dioRemote.init();
chickenRepository = ChickenRepositoryImpl(dioRemote);
getProvinces();
/*getInventory();
getKillHouseDistributionInfo();*/
}
@@ -65,4 +68,16 @@ class RootLogic extends GetxController {
void changePage(int index) {
currentPage.value = index;
}
Future<void> getProvinces() async {
try {
final res = await chickenRepository.getProvince();
if (res != null) {
provinces.clear();
provinces.value = res;
}
} catch (e) {
provinces.clear();
}
}
}