refactor: remove unused local and remote data sources, models, and tests for chicken and poultry features to streamline codebase

This commit is contained in:
2025-12-08 16:10:34 +03:30
parent 890be0ded6
commit 455a5a5571
230 changed files with 2812 additions and 3471 deletions

View File

@@ -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/presentation/pages/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;

View File

@@ -1,7 +1,7 @@
import 'package:flutter/cupertino.dart' hide LinearGradient;
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.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/inventory/inventory_model.dart';
import 'package:rasadyar_chicken/features/common/data/model/response/kill_house_distribution_info/kill_house_distribution_info.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/steward/widely_used/view.dart';
import 'package:rasadyar_core/core.dart';
@@ -75,7 +75,10 @@ class HomePage extends GetView<HomeLogic> {
AnimatedRotation(
turns: 180,
duration: Duration(milliseconds: 3000),
child: Icon(CupertinoIcons.chevron_up, size: 18),
child: Icon(
CupertinoIcons.chevron_up,
size: 18,
),
),
],
),
@@ -99,7 +102,9 @@ class HomePage extends GetView<HomeLogic> {
Row(
spacing: 8,
mainAxisAlignment: MainAxisAlignment.end,
children: [Icon(CupertinoIcons.chevron_down, size: 18)],
children: [
Icon(CupertinoIcons.chevron_down, size: 18),
],
),
_todayShipmentWidget(),
_todayShipmentWidget2(),
@@ -127,12 +132,17 @@ class HomePage extends GetView<HomeLogic> {
Assets.vec.chicken2Svg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(AppColor.blueDark, BlendMode.srcIn),
colorFilter: ColorFilter.mode(
AppColor.blueDark,
BlendMode.srcIn,
),
),
Text(
'اطلاعات مرغ گرم',
textAlign: TextAlign.right,
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
style: AppFonts.yekan16Bold.copyWith(
color: AppColor.iconColor,
),
),
],
),
@@ -151,7 +161,11 @@ class HomePage extends GetView<HomeLogic> {
Row(
children: [
SizedBox(width: 5.w),
Text('اطلاعات پخش', textAlign: TextAlign.right, style: AppFonts.yekan16),
Text(
'اطلاعات پخش',
textAlign: TextAlign.right,
style: AppFonts.yekan16,
),
],
),
SizedBox(height: 8.h),
@@ -164,7 +178,8 @@ class HomePage extends GetView<HomeLogic> {
title: 'وزن دولتی',
titleBgColor: const Color(0xFFB8E7DC),
valueBgColor: const Color(0xFFE6FAF5),
value: data.value?.totalGovernmentalInputWeight.separatedByComma,
value:
data.value?.totalGovernmentalInputWeight.separatedByComma,
),
),
Expanded(
@@ -178,7 +193,10 @@ class HomePage extends GetView<HomeLogic> {
Expanded(
child: broadcastItem(
title: 'فروش دولتی',
value: data.value?.totalGovernmentalOutputWeight.separatedByComma,
value: data
.value
?.totalGovernmentalOutputWeight
.separatedByComma,
titleBgColor: const Color(0xFFEBC4CE),
valueBgColor: const Color(0xFFEDDCE0),
),
@@ -202,7 +220,10 @@ class HomePage extends GetView<HomeLogic> {
Expanded(
child: broadcastItem(
title: 'مانده دولتی',
value: data.value?.totalGovernmentalRemainWeight.separatedByComma,
value: data
.value
?.totalGovernmentalRemainWeight
.separatedByComma,
titleBgColor: const Color(0xFFB8E7DC),
valueBgColor: const Color(0xFFE6FAF5),
),
@@ -218,7 +239,10 @@ class HomePage extends GetView<HomeLogic> {
Expanded(
child: broadcastItem(
title: 'فروش خارج استان',
value: data.value?.totalStewardFreeSaleBarCarcassesWeight.separatedByComma,
value: data
.value
?.totalStewardFreeSaleBarCarcassesWeight
.separatedByComma,
titleBgColor: const Color(0xFFEBC4CE),
valueBgColor: const Color(0xFFEDDCE0),
),
@@ -242,7 +266,8 @@ class HomePage extends GetView<HomeLogic> {
child: _informationIconCard(
title: 'توزیع داخل استان',
isLoading: data.value == null,
description: data.value?.freeSalesWeight.separatedByCommaFa ?? '0',
description:
data.value?.freeSalesWeight.separatedByCommaFa ?? '0',
iconPath: Assets.vec.truckSvg.path,
iconColor: const Color.fromRGBO(85, 97, 93, 1),
bgDescriptionColor: const Color(0xFFE6FAF5),
@@ -253,7 +278,9 @@ class HomePage extends GetView<HomeLogic> {
child: _informationIconCard(
title: 'توزیع خارج استان',
isLoading: data.value == null,
description: data.value?.stewardAllocationsWeight.separatedByCommaFa ?? '0',
description:
data.value?.stewardAllocationsWeight.separatedByCommaFa ??
'0',
iconPath: Assets.vec.truckFastSvg.path,
iconColor: Color(0xFF647379),
bgDescriptionColor: const Color(0xFFEAEFFF),
@@ -302,7 +329,9 @@ class HomePage extends GetView<HomeLogic> {
child: _informationLabelCard(
title: 'خارج استان',
isLoading: data.value == null,
description: data.value?.freeBuyingCarcassesWeight.separatedByCommaFa ?? '0',
description:
data.value?.freeBuyingCarcassesWeight.separatedByCommaFa ??
'0',
iconPath: Assets.vec.cubeSearchSvg.path,
iconColor: Color(0xFF2D5FFF),
bgLabelColor: const Color(0xFFAFCBFF),
@@ -326,7 +355,8 @@ class HomePage extends GetView<HomeLogic> {
child: _informationLabelCard(
title: 'مانده انبار',
isLoading: data.value == null,
description: data.value?.totalRemainWeight.separatedByCommaFa ?? '0',
description:
data.value?.totalRemainWeight.separatedByCommaFa ?? '0',
iconPath: Assets.vec.cubeSearchSvg.path,
bgDescriptionColor: const Color(0xFFEAEFFF),
bgLabelColor: const Color(0xFFBDD4FF),
@@ -337,7 +367,8 @@ class HomePage extends GetView<HomeLogic> {
child: _informationLabelCard(
title: 'توزیع شده',
isLoading: data.value == null,
description: data.value?.realAllocatedWeight.separatedByCommaFa ?? '0',
description:
data.value?.realAllocatedWeight.separatedByCommaFa ?? '0',
iconPath: Assets.vec.cubeRotateSvg.path,
iconColor: Color(0xFF5C4D64),
bgLabelColor: Color(0xFFC8B8D1),
@@ -375,7 +406,10 @@ class HomePage extends GetView<HomeLogic> {
child: Assets.vec.cubeScanSvg.svg(
width: 12.w,
height: 12.h,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
colorFilter: const ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
),
),
),
bgDescriptionColor: Colors.white,
@@ -395,7 +429,8 @@ class HomePage extends GetView<HomeLogic> {
title: 'درانتظار',
borderColor: const Color(0xFF9758FF),
isLoading: data.value == null,
description: data.value?.totalNotEnteredBars.separatedByCommaFa ?? '0',
description:
data.value?.totalNotEnteredBars.separatedByCommaFa ?? '0',
unit:
'(${data.value?.totalNotEnteredKillHouseRequestsWeight.separatedByCommaFa})\nکیلوگرم',
icon: Container(
@@ -409,7 +444,10 @@ class HomePage extends GetView<HomeLogic> {
child: Assets.vec.cubeCardFreeSvg.svg(
width: 12.w,
height: 12.h,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
colorFilter: const ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
),
),
),
bgDescriptionColor: Colors.white,
@@ -437,7 +475,12 @@ class HomePage extends GetView<HomeLogic> {
child: _informationLabelCard(
title: 'مانده دولتی',
isLoading: data.value == null,
description: data.value?.totalGovernmentalRemainWeight?.separatedByCommaFa ?? '0',
description:
data
.value
?.totalGovernmentalRemainWeight
?.separatedByCommaFa ??
'0',
iconPath: Assets.vec.cubeCardGovermentSvg.path,
iconColor: AppColor.textColor,
bgDescriptionColor: const Color(0xFFF5ECEE),
@@ -448,7 +491,8 @@ class HomePage extends GetView<HomeLogic> {
child: _informationLabelCard(
title: 'مانده آزاد',
isLoading: data.value == null,
description: data.value?.totalFreeRemainWeight.separatedByCommaFa ?? '0',
description:
data.value?.totalFreeRemainWeight.separatedByCommaFa ?? '0',
unit: 'کیلوگرم',
iconPath: Assets.vec.cubeCardFreeSvg.path,
iconColor: AppColor.textColor,
@@ -496,7 +540,10 @@ class HomePage extends GetView<HomeLogic> {
),
Divider(),
inventoryListItem(title: 'کل فروش', value: model.realAllocatedWeight?.separatedByComma),
inventoryListItem(
title: 'کل فروش',
value: model.realAllocatedWeight?.separatedByComma,
),
Divider(),
inventoryListItem(
title: 'مانده انبار',
@@ -515,14 +562,25 @@ class HomePage extends GetView<HomeLogic> {
children: [
Text(
title,
style: AppFonts.yekan14.copyWith(color: const Color(0xFF353535), height: 1.2),
style: AppFonts.yekan14.copyWith(
color: const Color(0xFF353535),
height: 1.2,
),
),
Spacer(),
value == null
? Center(child: CupertinoActivityIndicator())
: Text(value, style: AppFonts.yekan14.copyWith(color: const Color(0xFF353535))),
: Text(
value,
style: AppFonts.yekan14.copyWith(
color: const Color(0xFF353535),
),
),
SizedBox(width: 20.w),
Text('کیلوگرم', style: AppFonts.yekan10.copyWith(color: const Color(0xFF353535))),
Text(
'کیلوگرم',
style: AppFonts.yekan10.copyWith(color: const Color(0xFF353535)),
),
],
),
);
@@ -546,7 +604,9 @@ class HomePage extends GetView<HomeLogic> {
height: 65.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: borderColor != null ? Border.all(width: 1, color: borderColor) : null,
border: borderColor != null
? Border.all(width: 1, color: borderColor)
: null,
),
clipBehavior: Clip.hardEdge,
child: Row(
@@ -605,12 +665,16 @@ class HomePage extends GetView<HomeLogic> {
Text(
description,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan16.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
Text(
unit,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan12.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
],
),
@@ -656,7 +720,9 @@ class HomePage extends GetView<HomeLogic> {
Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan14.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
isLoading
@@ -664,12 +730,16 @@ class HomePage extends GetView<HomeLogic> {
: Text(
description,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan16.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
Text(
unit,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan12.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
],
),
@@ -729,8 +799,14 @@ class HomePage extends GetView<HomeLogic> {
'کل ورودی به انبار (کیلوگرم)',
model.totalFreeBarsCarcassesWeight.toString(),
),
buildRow('کل فروش (کیلوگرم)', model.realAllocatedWeight.toString()),
buildRow('مانده انبار (کیلوگرم)', model.totalRemainWeight.toString()),
buildRow(
'کل فروش (کیلوگرم)',
model.realAllocatedWeight.toString(),
),
buildRow(
'مانده انبار (کیلوگرم)',
model.totalRemainWeight.toString(),
),
],
),
),
@@ -749,7 +825,9 @@ class HomePage extends GetView<HomeLogic> {
child: Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
Flexible(
@@ -757,7 +835,9 @@ class HomePage extends GetView<HomeLogic> {
child: Text(
value,
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
],
@@ -783,7 +863,9 @@ class HomePage extends GetView<HomeLogic> {
Text(
'اطلاعات ارسالی',
textAlign: TextAlign.right,
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
style: AppFonts.yekan16Bold.copyWith(
color: AppColor.blueNormal,
),
),
const SizedBox(height: 12),
buildRow(
@@ -816,7 +898,10 @@ class HomePage extends GetView<HomeLogic> {
return Container(
height: height?.h ?? 73.h,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(color: valueBgColor, borderRadius: BorderRadius.circular(8)),
decoration: BoxDecoration(
color: valueBgColor,
borderRadius: BorderRadius.circular(8),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
@@ -829,7 +914,9 @@ class HomePage extends GetView<HomeLogic> {
Text(
title ?? 'بدون تیتر',
textAlign: TextAlign.center,
style: titleStyle ?? AppFonts.yekan12.copyWith(color: const Color(0xFF3E3E3E)),
style:
titleStyle ??
AppFonts.yekan12.copyWith(color: const Color(0xFF3E3E3E)),
),
],
),
@@ -842,7 +929,9 @@ class HomePage extends GetView<HomeLogic> {
child: Text(
value,
textAlign: TextAlign.right,
style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.textColor),
style:
valueStyle ??
AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
)
: Center(child: CupertinoActivityIndicator()),
@@ -850,7 +939,9 @@ class HomePage extends GetView<HomeLogic> {
Text(
unit ?? 'کیلوگرم',
textAlign: TextAlign.center,
style: unitStyle ?? AppFonts.yekan10.copyWith(color: Color(0xFF717171)),
style:
unitStyle ??
AppFonts.yekan10.copyWith(color: Color(0xFF717171)),
),
SizedBox(height: 4.h),
],
@@ -902,19 +993,29 @@ class HomePage extends GetView<HomeLogic> {
Row(
children: [
SizedBox(width: 5.w),
Text('تعهدات', textAlign: TextAlign.right, style: AppFonts.yekan16),
Text(
'تعهدات',
textAlign: TextAlign.right,
style: AppFonts.yekan16,
),
],
),
commitmentsItemList(
title: 'تعهد دولتی توزیع داخل استان',
value: data.value?.totalCommitmentSellingInProvinceGovernmentalWeight.separatedByComma,
value: data
.value
?.totalCommitmentSellingInProvinceGovernmentalWeight
.separatedByComma,
labelColor: const Color(0xFFB9E8DC),
bgColor: const Color(0xFFF3F9F8),
),
commitmentsItemList(
title: 'توزیع دولتی داخل استان',
value: data.value?.totalSellingInProvinceGovernmentalWeight.separatedByComma,
value: data
.value
?.totalSellingInProvinceGovernmentalWeight
.separatedByComma,
labelColor: const Color(0xFFC3D4F3),
bgColor: const Color(0xFFECF3FF),
),
@@ -929,19 +1030,26 @@ class HomePage extends GetView<HomeLogic> {
),
commitmentsItemList(
title: 'تعهد آزاد توزیع داخل استان',
value: data.value?.totalCommitmentSellingInProvinceFreeWeight.separatedByComma,
value: data
.value
?.totalCommitmentSellingInProvinceFreeWeight
.separatedByComma,
labelColor: const Color(0xFFC7DADA),
bgColor: const Color(0xFFE5F7F7),
),
commitmentsItemList(
title: 'توزیع آزاد داخل استان',
value: data.value?.totalSellingInProvinceFreeWeight.separatedByComma,
value:
data.value?.totalSellingInProvinceFreeWeight.separatedByComma,
labelColor: const Color(0xFFE0D6ED),
bgColor: const Color(0xFFF5EDFF),
),
commitmentsItemList(
title: 'باقیمانده تعهد آزاد توزیع داخل استان',
value: data.value?.totalCommitmentSellingInProvinceFreeRemainWeight.separatedByComma,
value: data
.value
?.totalCommitmentSellingInProvinceFreeRemainWeight
.separatedByComma,
labelColor: const Color(0xFFEBC5CE),
bgColor: const Color(0xFFFFF1F4),
),
@@ -986,7 +1094,9 @@ class HomePage extends GetView<HomeLogic> {
: Text(
value,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
style: AppFonts.yekan16.copyWith(
color: AppColor.textColor,
),
),
SizedBox(width: 8.w),