Merge branch with resolved conflicts - restructured features and added new modules
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
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/features/common/data/model/response/bar_information/bar_information.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class HomeLogic extends GetxController {
|
||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
||||
RxnInt totalWeightTodayBars = RxnInt();
|
||||
Rxn<KillHouseDistributionInfo> killHouseDistributionInfo = Rxn<KillHouseDistributionInfo>();
|
||||
Rxn<KillHouseDistributionInfo> killHouseDistributionInfo =
|
||||
Rxn<KillHouseDistributionInfo>();
|
||||
Rxn<BarInformation> barInformation = Rxn();
|
||||
|
||||
RxList<Map<String, String?>> inventoryItems = [
|
||||
@@ -34,7 +35,6 @@ class HomeLogic extends GetxController {
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
refreshData();
|
||||
|
||||
}
|
||||
|
||||
Future<void> refreshData() async {
|
||||
@@ -49,10 +49,11 @@ class HomeLogic extends GetxController {
|
||||
|
||||
Future<void> getGeneralBarsInformation() async {
|
||||
await safeCall<BarInformation?>(
|
||||
call: () async => await rootLogic.chickenRepository.getGeneralBarInformation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(role: 'Steward'),
|
||||
),
|
||||
call: () async =>
|
||||
await rootLogic.commonRepository.getGeneralBarInformation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(role: 'Steward'),
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
barInformation.value = result;
|
||||
@@ -64,14 +65,15 @@ class HomeLogic extends GetxController {
|
||||
|
||||
Future<void> getTodayBars() async {
|
||||
await safeCall<BarInformation?>(
|
||||
call: () async => await rootLogic.chickenRepository.getGeneralBarInformation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(
|
||||
fromDate: DateTime.now(),
|
||||
toDate: DateTime.now(),
|
||||
role: 'Steward',
|
||||
),
|
||||
),
|
||||
call: () async =>
|
||||
await rootLogic.commonRepository.getGeneralBarInformation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(
|
||||
fromDate: DateTime.now(),
|
||||
toDate: DateTime.now(),
|
||||
role: 'Steward',
|
||||
),
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
totalWeightTodayBars.value = result.totalBarsWeight?.toInt();
|
||||
@@ -83,9 +85,10 @@ class HomeLogic extends GetxController {
|
||||
|
||||
Future<void> getDistributionInformation() async {
|
||||
await safeCall<KillHouseDistributionInfo?>(
|
||||
call: () async => await rootLogic.chickenRepository.getKillHouseDistributionInfo(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
),
|
||||
call: () async =>
|
||||
await rootLogic.commonRepository.getKillHouseDistributionInfo(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
killHouseDistributionInfo.value = result;
|
||||
|
||||
Reference in New Issue
Block a user