fix: resolve import path issues and clean up unused imports across multiple files
This commit is contained in:
@@ -1,14 +1,7 @@
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/buy_in_province/logic.dart
|
||||
import 'package:rasadyar_chicken/features/steward/buy/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/buy_in_province_all/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/buy_in_province_waiting/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/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';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/buy_in_province/logic.dart
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class BuyInProvinceLogic extends GetxController {
|
||||
@@ -18,7 +11,7 @@ class BuyInProvinceLogic extends GetxController {
|
||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
||||
|
||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
||||
|
||||
BuyLogic get buyLogic => Get.find<BuyLogic>();
|
||||
RxInt selectedSegmentIndex = 0.obs;
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/buy_in_province/view.dart
|
||||
import 'package:rasadyar_chicken/features/steward/buy_in_province_all/view.dart';
|
||||
import 'package:rasadyar_chicken/features/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';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/buy_in_province/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/inventory/inventory_widget.dart';
|
||||
@@ -72,9 +67,7 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
|
||||
segmentWidget(),
|
||||
ObxValue((index) {
|
||||
return Expanded(
|
||||
child: index.value == 0
|
||||
? BuyInProvinceWaitingPage()
|
||||
: BuyInProvinceAllPage(),
|
||||
child: index.value == 0 ? BuyInProvinceWaitingPage() : BuyInProvinceAllPage(),
|
||||
);
|
||||
}, controller.selectedSegmentIndex),
|
||||
],
|
||||
@@ -94,8 +87,7 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
|
||||
borderColor: const Color(0xFFB4B4B4),
|
||||
selectedBorderColor: AppColor.blueNormal,
|
||||
selectedBackgroundColor: AppColor.blueLight,
|
||||
onSegmentSelected: (index) =>
|
||||
controller.selectedSegmentIndex.value = index,
|
||||
onSegmentSelected: (index) => controller.selectedSegmentIndex.value = index,
|
||||
backgroundColor: AppColor.whiteGreyNormal,
|
||||
),
|
||||
),
|
||||
@@ -110,18 +102,14 @@ class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Text(
|
||||
'فیلترها',
|
||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text('فیلترها', style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal)),
|
||||
Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: dateFilterWidget(
|
||||
date: controller.fromDateFilter,
|
||||
onChanged: (jalali) =>
|
||||
controller.fromDateFilter.value = jalali,
|
||||
onChanged: (jalali) => controller.fromDateFilter.value = jalali,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/buy_in_province_all/logic.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/features/steward/root/logic.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_allocation/steward_allocation_request.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/buy_in_province_all/logic.dart
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class BuyInProvinceAllLogic extends GetxController {
|
||||
@@ -39,11 +34,7 @@ class BuyInProvinceAllLogic extends GetxController {
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
debounce(
|
||||
searchedValue,
|
||||
(callback) => getAllArrivals(),
|
||||
time: Duration(milliseconds: 2000),
|
||||
);
|
||||
debounce(searchedValue, (callback) => getAllArrivals(), time: Duration(milliseconds: 2000));
|
||||
super.onReady();
|
||||
ever(approvedWithOtpCode, (callback) {
|
||||
if (callback == false) {
|
||||
@@ -56,8 +47,7 @@ class BuyInProvinceAllLogic extends GetxController {
|
||||
if (isLoadingMore) {
|
||||
isLoadingMoreAllocationsMade.value = true;
|
||||
} else {
|
||||
allProduct.value =
|
||||
Resource<PaginationModel<WaitingArrivalModel>>.loading();
|
||||
allProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.loading();
|
||||
}
|
||||
|
||||
if (searchedValue.value != null &&
|
||||
@@ -83,21 +73,16 @@ class BuyInProvinceAllLogic extends GetxController {
|
||||
onSuccess: (res) async {
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
if ((res?.count ?? 0) == 0) {
|
||||
allProduct.value =
|
||||
Resource<PaginationModel<WaitingArrivalModel>>.empty();
|
||||
allProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.empty();
|
||||
} else {
|
||||
allProduct.value =
|
||||
Resource<PaginationModel<WaitingArrivalModel>>.success(
|
||||
PaginationModel<WaitingArrivalModel>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [
|
||||
...(allProduct.value.data?.results ?? []),
|
||||
...(res?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
allProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.success(
|
||||
PaginationModel<WaitingArrivalModel>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [...(allProduct.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/buy_in_province_waiting/logic.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/features/steward/root/logic.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_allocation/steward_allocation_request.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/waiting_arrival/waiting_arrival.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/buy_in_province_waiting/logic.dart
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -62,8 +57,7 @@ class BuyInProvinceWaitingLogic extends GetxController {
|
||||
if (isLoadingMore) {
|
||||
isLoadingMoreAllocationsMade.value = true;
|
||||
} else {
|
||||
waitingProduct.value =
|
||||
Resource<PaginationModel<WaitingArrivalModel>>.loading();
|
||||
waitingProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.loading();
|
||||
}
|
||||
|
||||
if (searchedValue.value != null &&
|
||||
@@ -89,21 +83,16 @@ class BuyInProvinceWaitingLogic extends GetxController {
|
||||
onSuccess: (res) async {
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
if ((res?.count ?? 0) == 0) {
|
||||
waitingProduct.value =
|
||||
Resource<PaginationModel<WaitingArrivalModel>>.empty();
|
||||
waitingProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.empty();
|
||||
} else {
|
||||
waitingProduct.value =
|
||||
Resource<PaginationModel<WaitingArrivalModel>>.success(
|
||||
PaginationModel<WaitingArrivalModel>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [
|
||||
...(waitingProduct.value.data?.results ?? []),
|
||||
...(res?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
waitingProduct.value = Resource<PaginationModel<WaitingArrivalModel>>.success(
|
||||
PaginationModel<WaitingArrivalModel>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [...(waitingProduct.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||
),
|
||||
);
|
||||
flashingFabBgColor();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/buy_out_of_province/logic.dart
|
||||
import 'package:rasadyar_chicken/data/models/request/create_steward_free_bar/create_steward_free_bar.dart';
|
||||
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/features/steward/buy/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sale/logic.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/request/create_steward_free_bar/create_steward_free_bar.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||
@@ -15,7 +7,6 @@ import 'package:rasadyar_chicken/features/steward/data/model/response/steward_fr
|
||||
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';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/buy_out_of_province/logic.dart
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -94,14 +85,11 @@ class BuyOutOfProvinceLogic extends GetxController {
|
||||
searchedValue.value = data?.trim();
|
||||
}
|
||||
|
||||
Future<void> getStewardPurchaseOutOfProvince([
|
||||
bool isLoadingMore = false,
|
||||
]) async {
|
||||
Future<void> getStewardPurchaseOutOfProvince([bool isLoadingMore = false]) async {
|
||||
if (isLoadingMore) {
|
||||
isLoadingMoreAllocationsMade.value = true;
|
||||
} else {
|
||||
purchaseOutOfProvinceList.value =
|
||||
Resource<PaginationModel<StewardFreeBar>>.loading();
|
||||
purchaseOutOfProvinceList.value = Resource<PaginationModel<StewardFreeBar>>.loading();
|
||||
}
|
||||
|
||||
if (searchedValue.value != null &&
|
||||
@@ -110,37 +98,34 @@ class BuyOutOfProvinceLogic extends GetxController {
|
||||
currentPage.value = 1; // Reset to first page if search value is set
|
||||
}
|
||||
await safeCall(
|
||||
call: () =>
|
||||
rootLogic.stewardRepository.getStewardPurchasesOutSideOfTheProvince(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(
|
||||
pageSize: 20,
|
||||
page: currentPage.value,
|
||||
search: 'filter',
|
||||
role: 'Steward',
|
||||
value: searchedValue.value,
|
||||
fromDate: fromDateFilter.value.toDateTime(),
|
||||
toDate: toDateFilter.value.toDateTime(),
|
||||
),
|
||||
),
|
||||
call: () => rootLogic.stewardRepository.getStewardPurchasesOutSideOfTheProvince(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(
|
||||
pageSize: 20,
|
||||
page: currentPage.value,
|
||||
search: 'filter',
|
||||
role: 'Steward',
|
||||
value: searchedValue.value,
|
||||
fromDate: fromDateFilter.value.toDateTime(),
|
||||
toDate: toDateFilter.value.toDateTime(),
|
||||
),
|
||||
),
|
||||
onSuccess: (res) async {
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
if ((res?.count ?? 0) == 0) {
|
||||
purchaseOutOfProvinceList.value =
|
||||
Resource<PaginationModel<StewardFreeBar>>.empty();
|
||||
purchaseOutOfProvinceList.value = Resource<PaginationModel<StewardFreeBar>>.empty();
|
||||
} else {
|
||||
purchaseOutOfProvinceList.value =
|
||||
Resource<PaginationModel<StewardFreeBar>>.success(
|
||||
PaginationModel<StewardFreeBar>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [
|
||||
...(purchaseOutOfProvinceList.value.data?.results ?? []),
|
||||
...(res?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
purchaseOutOfProvinceList.value = Resource<PaginationModel<StewardFreeBar>>.success(
|
||||
PaginationModel<StewardFreeBar>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [
|
||||
...(purchaseOutOfProvinceList.value.data?.results ?? []),
|
||||
...(res?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
@@ -148,9 +133,8 @@ class BuyOutOfProvinceLogic extends GetxController {
|
||||
|
||||
Future<void> getCites() async {
|
||||
await safeCall(
|
||||
call: () => rootLogic.commonRepository.getCity(
|
||||
provinceName: selectedProvince.value?.name ?? '',
|
||||
),
|
||||
call: () =>
|
||||
rootLogic.commonRepository.getCity(provinceName: selectedProvince.value?.name ?? ''),
|
||||
onSuccess: (result) {
|
||||
if (result != null && result.isNotEmpty) {
|
||||
cites.value = result;
|
||||
@@ -219,11 +203,10 @@ class BuyOutOfProvinceLogic extends GetxController {
|
||||
date: DateTime.now().formattedYHMS,
|
||||
distributionType: 'App',
|
||||
);
|
||||
await rootLogic.stewardRepository
|
||||
.createStewardPurchasesOutSideOfTheProvince(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
body: createStewardFreeBar,
|
||||
);
|
||||
await rootLogic.stewardRepository.createStewardPurchasesOutSideOfTheProvince(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
body: createStewardFreeBar,
|
||||
);
|
||||
},
|
||||
onSuccess: (result) {
|
||||
getStewardPurchaseOutOfProvince();
|
||||
@@ -285,11 +268,10 @@ class BuyOutOfProvinceLogic extends GetxController {
|
||||
|
||||
await safeCall(
|
||||
showError: true,
|
||||
call: () =>
|
||||
rootLogic.stewardRepository.editStewardPurchasesOutSideOfTheProvince(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
body: edit,
|
||||
),
|
||||
call: () => rootLogic.stewardRepository.editStewardPurchasesOutSideOfTheProvince(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
body: edit,
|
||||
),
|
||||
onSuccess: (result) {
|
||||
onRefresh();
|
||||
rootLogic.onRefresh();
|
||||
@@ -300,11 +282,10 @@ class BuyOutOfProvinceLogic extends GetxController {
|
||||
|
||||
Future<void> deleteStewardPurchaseOutOfProvince(String key) async {
|
||||
await safeCall(
|
||||
call: () => rootLogic.stewardRepository
|
||||
.deleteStewardPurchasesOutSideOfTheProvince(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildRawQueryParams(queryParams: {'key': key}),
|
||||
),
|
||||
call: () => rootLogic.stewardRepository.deleteStewardPurchasesOutSideOfTheProvince(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildRawQueryParams(queryParams: {'key': key}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/home/logic.dart
|
||||
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/steward/root/logic.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';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/home/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 = [
|
||||
@@ -55,11 +48,10 @@ class HomeLogic extends GetxController {
|
||||
|
||||
Future<void> getGeneralBarsInformation() async {
|
||||
await safeCall<BarInformation?>(
|
||||
call: () async =>
|
||||
await rootLogic.commonRepository.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;
|
||||
@@ -71,15 +63,14 @@ class HomeLogic extends GetxController {
|
||||
|
||||
Future<void> getTodayBars() async {
|
||||
await safeCall<BarInformation?>(
|
||||
call: () async =>
|
||||
await rootLogic.commonRepository.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();
|
||||
@@ -91,10 +82,9 @@ class HomeLogic extends GetxController {
|
||||
|
||||
Future<void> getDistributionInformation() async {
|
||||
await safeCall<KillHouseDistributionInfo?>(
|
||||
call: () async =>
|
||||
await rootLogic.commonRepository.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;
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import 'package:flutter/cupertino.dart' hide LinearGradient;
|
||||
import 'package:flutter/material.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/home/view.dart
|
||||
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.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';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/home/view.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';
|
||||
|
||||
import '../../../../common/data/model/response/roles_products/roles_products.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class HomePage extends GetView<HomeLogic> {
|
||||
@@ -80,10 +77,7 @@ 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -107,9 +101,7 @@ 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(),
|
||||
@@ -137,17 +129,12 @@ 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -166,11 +153,7 @@ 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),
|
||||
@@ -183,8 +166,7 @@ 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(
|
||||
@@ -198,10 +180,7 @@ 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),
|
||||
),
|
||||
@@ -225,10 +204,7 @@ 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),
|
||||
),
|
||||
@@ -244,10 +220,7 @@ 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),
|
||||
),
|
||||
@@ -271,8 +244,7 @@ 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),
|
||||
@@ -283,9 +255,7 @@ 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),
|
||||
@@ -334,9 +304,7 @@ 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),
|
||||
@@ -360,8 +328,7 @@ 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),
|
||||
@@ -372,8 +339,7 @@ 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),
|
||||
@@ -411,10 +377,7 @@ 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,
|
||||
@@ -434,8 +397,7 @@ 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(
|
||||
@@ -449,10 +411,7 @@ 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,
|
||||
@@ -480,12 +439,7 @@ 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),
|
||||
@@ -496,8 +450,7 @@ 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,
|
||||
@@ -545,10 +498,7 @@ class HomePage extends GetView<HomeLogic> {
|
||||
),
|
||||
Divider(),
|
||||
|
||||
inventoryListItem(
|
||||
title: 'کل فروش',
|
||||
value: model.realAllocatedWeight?.separatedByComma,
|
||||
),
|
||||
inventoryListItem(title: 'کل فروش', value: model.realAllocatedWeight?.separatedByComma),
|
||||
Divider(),
|
||||
inventoryListItem(
|
||||
title: 'مانده انبار',
|
||||
@@ -567,25 +517,14 @@ 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))),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -609,9 +548,7 @@ 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(
|
||||
@@ -670,16 +607,12 @@ 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -725,9 +658,7 @@ 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
|
||||
@@ -735,16 +666,12 @@ 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -804,14 +731,8 @@ class HomePage extends GetView<HomeLogic> {
|
||||
'کل ورودی به انبار (کیلوگرم)',
|
||||
model.totalFreeBarsCarcassesWeight.toString(),
|
||||
),
|
||||
buildRow(
|
||||
'کل فروش (کیلوگرم)',
|
||||
model.realAllocatedWeight.toString(),
|
||||
),
|
||||
buildRow(
|
||||
'مانده انبار (کیلوگرم)',
|
||||
model.totalRemainWeight.toString(),
|
||||
),
|
||||
buildRow('کل فروش (کیلوگرم)', model.realAllocatedWeight.toString()),
|
||||
buildRow('مانده انبار (کیلوگرم)', model.totalRemainWeight.toString()),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -830,9 +751,7 @@ 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(
|
||||
@@ -840,9 +759,7 @@ 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),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -868,9 +785,7 @@ 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(
|
||||
@@ -903,10 +818,7 @@ 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: [
|
||||
@@ -919,9 +831,7 @@ 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)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -934,9 +844,7 @@ 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()),
|
||||
@@ -944,9 +852,7 @@ 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),
|
||||
],
|
||||
@@ -998,29 +904,19 @@ 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),
|
||||
),
|
||||
@@ -1035,26 +931,19 @@ 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),
|
||||
),
|
||||
@@ -1099,9 +988,7 @@ 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),
|
||||
|
||||
|
||||
@@ -4,21 +4,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/datasources/local/chicken_local.dart';
|
||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
||||
import 'package:rasadyar_chicken/data/models/local/widely_used_local_model.dart';
|
||||
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_remain_weight/steward_remain_weight.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/steward_sales_info_dashboard/steward_sales_info_dashboard.dart';
|
||||
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/features/common/profile/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/buy/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/home/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sale/view.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/segmentation/view.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/common/data/model/local/widely_used_local_model.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/inventory/inventory_model.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||
@@ -35,7 +21,7 @@ import 'package:rasadyar_chicken/features/steward/presentation/pages/home/view.d
|
||||
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';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.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';
|
||||
@@ -46,27 +32,12 @@ 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>{
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
||||
0: ChickenRoutes.buySteward,
|
||||
1: ChickenRoutes.saleSteward,
|
||||
========
|
||||
0: StewardRoutes.buySteward,
|
||||
1: StewardRoutes.saleSteward,
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
||||
};
|
||||
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;
|
||||
@@ -110,9 +81,7 @@ class StewardRootLogic extends GetxController {
|
||||
|
||||
if (widelyUsedList.value?.hasInit != true) {
|
||||
//TODO
|
||||
localDatasource.initWidleyUsed().then(
|
||||
(value) => localDatasource.getAllWidely(),
|
||||
);
|
||||
localDatasource.initWidleyUsed().then((value) => localDatasource.getAllWidely());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,17 +116,11 @@ class StewardRootLogic extends GetxController {
|
||||
// Cancel previous request if still running
|
||||
_inventoryCancelToken?.cancel();
|
||||
_inventoryCancelToken = CancelToken();
|
||||
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
||||
await safeCall<List<ProductModel>?>(
|
||||
call: () async => await chickenRepository.getRolesProducts(
|
||||
========
|
||||
/*
|
||||
await safeCall<List<InventoryModel>?>(
|
||||
call: () async => await commonRepository.getInventory(
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
||||
token: tokenService.accessToken.value!,
|
||||
cancelToken: _inventoryCancelToken,
|
||||
queryParameters: buildRawQueryParams(role: 'Steward'),
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
@@ -170,7 +133,7 @@ class StewardRootLogic extends GetxController {
|
||||
return;
|
||||
}
|
||||
},
|
||||
);
|
||||
);*/
|
||||
}
|
||||
|
||||
void rootErrorHandler(DioException error) {
|
||||
@@ -189,13 +152,7 @@ class StewardRootLogic extends GetxController {
|
||||
_provincesCancelToken = CancelToken();
|
||||
|
||||
try {
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
||||
final res = await chickenRepository.getProvince(
|
||||
========
|
||||
final res = await commonRepository.getProvince(
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
||||
cancelToken: _provincesCancelToken,
|
||||
);
|
||||
final res = await commonRepository.getProvince(cancelToken: _provincesCancelToken);
|
||||
if (res != null) {
|
||||
provinces.clear();
|
||||
provinces.value = res;
|
||||
@@ -211,15 +168,8 @@ class StewardRootLogic extends GetxController {
|
||||
|
||||
Future<void> getRolesProducts() async {
|
||||
safeCall(
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
||||
call: () async => await chickenRepository.getRolesProducts(
|
||||
token: tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(role: 'Steward'),
|
||||
========
|
||||
call: () async => await commonRepository.getRolesProducts(
|
||||
token: tokenService.accessToken.value!,
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
||||
),
|
||||
call: () async =>
|
||||
await commonRepository.getRolesProducts(token: tokenService.accessToken.value!),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
rolesProductsModel.value = result;
|
||||
@@ -246,13 +196,8 @@ class StewardRootLogic extends GetxController {
|
||||
|
||||
Future<void> getStewardRemainWeightData() async {
|
||||
safeCall(
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/logic.dart
|
||||
call: () async => await chickenRepository.getStewardRemainWeight(
|
||||
========
|
||||
call: () async => await stewardRepository.getStewardRemainWeight(
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/logic.dart
|
||||
token: tokenService.accessToken.value!,
|
||||
),
|
||||
call: () async =>
|
||||
await stewardRepository.getStewardRemainWeight(token: tokenService.accessToken.value!),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
stewardRemainWeight.value = result;
|
||||
@@ -292,8 +237,7 @@ 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,13 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/chicken.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/root/view.dart
|
||||
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/root/logic.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_chicken/features/steward/presentation/routes/routes.dart';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/root/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_core/core.dart';
|
||||
@@ -31,9 +27,8 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
onGenerateRoute: (settings) {
|
||||
final page = ChickenPages.pages.firstWhere(
|
||||
(e) => e.name == settings.name,
|
||||
orElse: () => ChickenPages.pages.firstWhere(
|
||||
(e) => e.name == StewardRoutes.buySteward,
|
||||
),
|
||||
orElse: () =>
|
||||
ChickenPages.pages.firstWhere((e) => e.name == StewardRoutes.buySteward),
|
||||
);
|
||||
|
||||
return buildRouteFromGetPage(page);
|
||||
@@ -44,9 +39,8 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
onGenerateRoute: (settings) {
|
||||
final page = ChickenPages.pages.firstWhere(
|
||||
(e) => e.name == settings.name,
|
||||
orElse: () => ChickenPages.pages.firstWhere(
|
||||
(e) => e.name == StewardRoutes.saleSteward,
|
||||
),
|
||||
orElse: () =>
|
||||
ChickenPages.pages.firstWhere((e) => e.name == StewardRoutes.saleSteward),
|
||||
);
|
||||
|
||||
return buildRouteFromGetPage(page);
|
||||
@@ -54,18 +48,15 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
),
|
||||
Navigator(
|
||||
key: Get.nestedKey(stewardThirdKey),
|
||||
onGenerateRoute: (settings) =>
|
||||
GetPageRoute(page: () => controller.pages[2]),
|
||||
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[2]),
|
||||
),
|
||||
Navigator(
|
||||
key: Get.nestedKey(stewardFourthKey),
|
||||
onGenerateRoute: (settings) =>
|
||||
GetPageRoute(page: () => controller.pages[3]),
|
||||
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[3]),
|
||||
),
|
||||
Navigator(
|
||||
key: Get.nestedKey(stewardFifthKey),
|
||||
onGenerateRoute: (settings) =>
|
||||
GetPageRoute(page: () => controller.pages[4]),
|
||||
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[4]),
|
||||
),
|
||||
],
|
||||
index: data.value,
|
||||
@@ -161,10 +152,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
return Container(
|
||||
height: 70,
|
||||
width: Get.width / 2,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -185,9 +173,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
Text(
|
||||
'بارهای امروز',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -254,9 +240,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
Text(
|
||||
title,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -279,16 +263,12 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -333,23 +313,17 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
Text(
|
||||
title,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||
),
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -397,18 +371,14 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: ShapeDecoration(
|
||||
color: const Color(0xFFBECDFF),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueNormal,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: SvgGenImage.vec(iconPath).svg(
|
||||
width: 24,
|
||||
@@ -418,10 +388,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
title,
|
||||
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
Text(title, style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -438,24 +405,16 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
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)),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -602,9 +561,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
@@ -612,9 +569,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
child: Text(
|
||||
value,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -640,9 +595,7 @@ class StewardRootPage extends GetView<StewardRootLogic> {
|
||||
Text(
|
||||
'اطلاعات ارسالی',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan16Bold.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
buildRow(
|
||||
|
||||
@@ -1,29 +1,19 @@
|
||||
import 'package:flutter/services.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sale/logic.dart
|
||||
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.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/data/models/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_bar_dashboard/steward_free_bar_dashboard.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sale/logic.dart
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class SaleLogic extends GetxController {
|
||||
Rxn<List<AllocatedMadeModel>?> allocatedMadeModel =
|
||||
Rxn<List<AllocatedMadeModel>?>();
|
||||
Rxn<List<AllocatedMadeModel>?> allocatedMadeModel = Rxn<List<AllocatedMadeModel>?>();
|
||||
|
||||
RxList<GuildModel> guildsModel = <GuildModel>[].obs;
|
||||
|
||||
Rxn<StewardFreeBarDashboard> stewardFreeDashboard =
|
||||
Rxn<StewardFreeBarDashboard>();
|
||||
Rxn<StewardFreeBarDashboard> stewardFreeDashboard = Rxn<StewardFreeBarDashboard>();
|
||||
|
||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
||||
|
||||
@@ -40,12 +30,7 @@ class SaleLogic extends GetxController {
|
||||
safeCall(
|
||||
call: () async => await rootLogic.stewardRepository.getAllocatedMade(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
search: 'filter',
|
||||
role: 'Steward',
|
||||
),
|
||||
queryParameters: buildQueryParams(page: 1, pageSize: 20, search: 'filter', role: 'Steward'),
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
@@ -88,8 +73,7 @@ class SaleLogic extends GetxController {
|
||||
safeCall(
|
||||
call: () async => await rootLogic.stewardRepository.confirmAllAllocation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
allocationTokens:
|
||||
allocatedMadeModel.value?.map((e) => e.key!).toList() ?? [],
|
||||
allocationTokens: allocatedMadeModel.value?.map((e) => e.key!).toList() ?? [],
|
||||
),
|
||||
onSuccess: (result) {
|
||||
getAllocatedMade();
|
||||
@@ -132,8 +116,7 @@ class SaleLogic extends GetxController {
|
||||
|
||||
void onPopScopTaped() async {
|
||||
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,18 +1,9 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
import 'package:rasadyar_chicken/data/models/request/conform_allocation/conform_allocation.dart';
|
||||
import 'package:rasadyar_chicken/data/models/request/submit_steward_allocation/submit_steward_allocation.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.dart';
|
||||
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/features/kill_house/warehouse_and_distribution/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sale/logic.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/request/conform_allocation/conform_allocation.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/request/submit_steward_allocation/submit_steward_allocation.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
||||
@@ -23,7 +14,6 @@ import 'package:rasadyar_chicken/features/common/data/model/response/roles_produ
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_remain_weight/steward_remain_weight.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sale/logic.dart';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_in_province/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';
|
||||
@@ -69,8 +59,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
final RxBool hasMoreDataAllocationsMade = true.obs;
|
||||
|
||||
Rxn<BroadcastPrice> broadcastPrice = Rxn<BroadcastPrice>();
|
||||
Rxn<AllocatedMadeModel> selectedAllocationModelForUpdate =
|
||||
Rxn<AllocatedMadeModel>();
|
||||
Rxn<AllocatedMadeModel> selectedAllocationModelForUpdate = Rxn<AllocatedMadeModel>();
|
||||
SubmitStewardAllocation? tmpStewardAllocation;
|
||||
|
||||
Rxn<Jalali> productionDate = Rxn(null);
|
||||
@@ -147,8 +136,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
void _updateGovernmentalProductionDateData() {
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
/* List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||
/* List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||
========
|
||||
List<RemainWeightDay> dates =
|
||||
rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||
@@ -162,7 +150,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
void _updateFreeProductionDateData() {
|
||||
/* var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
||||
/* var dates = rootLogic.stewardRemainWeight.value?.free ?? [];
|
||||
freeProductionDateData = {
|
||||
for (var element in dates)
|
||||
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||
@@ -175,8 +163,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
if (isLoadingMore) {
|
||||
isLoadingMoreAllocationsMade.value = true;
|
||||
} else {
|
||||
allocatedList.value =
|
||||
Resource<PaginationModel<AllocatedMadeModel>>.loading();
|
||||
allocatedList.value = Resource<PaginationModel<AllocatedMadeModel>>.loading();
|
||||
}
|
||||
|
||||
if (searchedValue.value != null &&
|
||||
@@ -185,8 +172,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
currentPage.value = 1; // Reset to first page if search value is set
|
||||
}
|
||||
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
/* safeCall(
|
||||
/* safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.getAllocatedMade(
|
||||
========
|
||||
safeCall(
|
||||
@@ -233,20 +219,15 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
isLoadingMoreAllocationsMade.value = false;
|
||||
},
|
||||
); */
|
||||
|
||||
}
|
||||
|
||||
void checkVerification() {
|
||||
var hasWeight = quotaType.value == 1
|
||||
? weight.value <=
|
||||
(governmentalProductionDateData[productionDate.value
|
||||
?.formatCompactDate()]
|
||||
?.value ??
|
||||
(governmentalProductionDateData[productionDate.value?.formatCompactDate()]?.value ??
|
||||
0)
|
||||
: weight.value <=
|
||||
(freeProductionDateData[productionDate.value?.formatCompactDate()]
|
||||
?.value ??
|
||||
0);
|
||||
(freeProductionDateData[productionDate.value?.formatCompactDate()]?.value ?? 0);
|
||||
|
||||
isValid.value =
|
||||
weight.value > 0 &&
|
||||
@@ -258,8 +239,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
void confirmAllocation(ConformAllocation allocation) {
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
/* safeCall(
|
||||
/* safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.confirmAllocation(
|
||||
========
|
||||
safeCall(
|
||||
@@ -276,8 +256,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
void denyAllocation(String token) {
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
/* safeCall(
|
||||
/* safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.denyAllocation(
|
||||
========
|
||||
safeCall(
|
||||
@@ -294,7 +273,6 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> confirmAllAllocations() async {
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
/* safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.confirmAllAllocation(
|
||||
========
|
||||
@@ -314,8 +292,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> getRolesProducts() async {
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
/* safeCall(
|
||||
/* safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.getRolesProducts(
|
||||
========
|
||||
safeCall(
|
||||
@@ -335,8 +312,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> getGuilds() async {
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
/* safeCall(
|
||||
/* safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.getGuilds(
|
||||
========
|
||||
safeCall(
|
||||
@@ -372,8 +348,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> getGuildProfile() async {
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
/* await safeCall(
|
||||
/* await safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.getProfile(
|
||||
========
|
||||
await safeCall(
|
||||
@@ -394,17 +369,13 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
allocationType:
|
||||
'${guildProfile.value?.steward == true ? "steward" : "guild"}_${selectedGuildModel.value?.steward == true ? "steward" : "guild"}',
|
||||
sellerType: guildProfile.value?.steward == true ? "Steward" : "Guild",
|
||||
buyerType: selectedGuildModel.value?.steward == true
|
||||
? "Steward"
|
||||
: "Guild",
|
||||
buyerType: selectedGuildModel.value?.steward == true ? "Steward" : "Guild",
|
||||
amount: pricePerKilo.value,
|
||||
totalAmount: totalCost.value,
|
||||
weightOfCarcasses: weight.value,
|
||||
sellType: saleType.value == 2 ? "free" : 'exclusive',
|
||||
numberOfCarcasses: 0,
|
||||
productionDate: productionDate.value
|
||||
?.toDateTime()
|
||||
.formattedDashedGregorian,
|
||||
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
||||
guildKey: selectedGuildModel.value?.key,
|
||||
productKey: selectedProductModel.value?.key,
|
||||
@@ -416,7 +387,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
Future<void> submitAllocation() async {
|
||||
setSubmitData();
|
||||
|
||||
/* safeCall(
|
||||
/* safeCall(
|
||||
showError: true,
|
||||
call: () async =>
|
||||
await rootLogic.stewardRepository.postSubmitStewardAllocation(
|
||||
@@ -439,8 +410,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> deleteAllocation(AllocatedMadeModel model) async {
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
/* safeCall(
|
||||
/* safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.deleteStewardAllocation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: {'steward_allocation_key': model.key},
|
||||
@@ -476,9 +446,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
pricePerKilo.value = item.amount ?? 0;
|
||||
totalCost.value = item.totalAmount ?? 0;
|
||||
weightController.text = weight.value.toString().separatedByComma;
|
||||
pricePerKiloController.text = pricePerKilo.value
|
||||
.toString()
|
||||
.separatedByComma;
|
||||
pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
|
||||
totalCostController.text = totalCost.value.toString().separatedByComma;
|
||||
isValid.value = true;
|
||||
productionDate.value = item.productionDate.toJalali;
|
||||
@@ -510,7 +478,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
weight_of_carcasses: weight.value,
|
||||
);
|
||||
|
||||
/* safeCall(
|
||||
/* safeCall(
|
||||
showError: true,
|
||||
call: () async =>
|
||||
await rootLogic.stewardRepository.updateStewardAllocation(
|
||||
@@ -563,8 +531,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> getBroadcastPrice() async {
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/kill_house/warehouse_and_distribution/sales_in_province/logic.dart
|
||||
/* safeCall(
|
||||
/* safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.getBroadcastPrice(
|
||||
========
|
||||
safeCall(
|
||||
@@ -590,11 +557,7 @@ class WarehouseAndDistributionSalesInProvinceLogic extends GetxController {
|
||||
toggleExpansion();
|
||||
currentPage.value = 1;
|
||||
hasMoreDataAllocationsMade.value = true;
|
||||
await Future.wait([
|
||||
getAllocatedMade(),
|
||||
getRolesProducts(),
|
||||
rootLogic.onRefresh(),
|
||||
]);
|
||||
await Future.wait([getAllocatedMade(), getRolesProducts(), rootLogic.onRefresh()]);
|
||||
}
|
||||
|
||||
void toggleExpansion({int? index}) {
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_in_province/view.dart
|
||||
import 'package:rasadyar_chicken/data/models/response/allocated_made/allocated_made.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sales_in_province/widgets/cu_sale_in_provience.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/allocated_made/allocated_made.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_in_province/widgets/cu_sale_in_provience.dart';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_in_province/view.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';
|
||||
@@ -15,7 +12,7 @@ import 'package:rasadyar_core/core.dart' hide modalDatePicker;
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
class SalesInProvincePage extends GetView<WarehouseAndDistributionSalesInProvinceLogic> {
|
||||
SalesInProvincePage({super.key});
|
||||
|
||||
@override
|
||||
@@ -33,7 +30,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
Positioned.fill(
|
||||
child: Column(
|
||||
children: [
|
||||
Obx(() {
|
||||
Obx(() {
|
||||
var list = [
|
||||
InventoryItemData(
|
||||
title: 'موجودی انبار',
|
||||
@@ -71,7 +68,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
|
||||
return InventoryWidget(inventoryModel: list);
|
||||
}),
|
||||
|
||||
|
||||
Expanded(
|
||||
child: ObxValue((data) {
|
||||
return RPaginatedListView(
|
||||
@@ -141,7 +138,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
onPressed: () async {
|
||||
await controller.confirmAllAllocations();
|
||||
controller.getAllocatedMade();
|
||||
controller.rootLogic.getRolesProduct();
|
||||
//controller.rootLogic.getRolesProduct();
|
||||
Get.back();
|
||||
},
|
||||
child: Text('تایید'),
|
||||
@@ -487,7 +484,7 @@ class SalesInProvincePage extends GetView<SalesInProvinceLogic> {
|
||||
}
|
||||
|
||||
GestureDetector timeFilterWidget({
|
||||
required SalesInProvinceLogic controller,
|
||||
required WarehouseAndDistributionSalesInProvinceLogic controller,
|
||||
isFrom = true,
|
||||
required Rx<Jalali> date,
|
||||
required Function(Jalali jalali) onChanged,
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_in_province/widgets/cu_sale_in_provience.dart
|
||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sales_in_province/logic.dart';
|
||||
========
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/sales_in_province/logic.dart';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_in_province/widgets/cu_sale_in_provience.dart
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
Widget addOrEditBottomSheet(SalesInProvinceLogic controller, {bool isEditMode = false}) {
|
||||
Widget addOrEditBottomSheet(
|
||||
WarehouseAndDistributionSalesInProvinceLogic controller, {
|
||||
bool isEditMode = false,
|
||||
}) {
|
||||
return BaseBottomSheet(
|
||||
height: Get.height * (isEditMode ? 0.60 : 0.75),
|
||||
child: Form(
|
||||
@@ -300,7 +298,7 @@ Widget addOrEditBottomSheet(SalesInProvinceLogic controller, {bool isEditMode =
|
||||
);
|
||||
}
|
||||
|
||||
Widget guildsDropDown(SalesInProvinceLogic controller) {
|
||||
Widget guildsDropDown(WarehouseAndDistributionSalesInProvinceLogic controller) {
|
||||
return Obx(() {
|
||||
final item = controller.selectedGuildModel.value;
|
||||
|
||||
@@ -350,7 +348,7 @@ Widget guildsDropDown(SalesInProvinceLogic controller) {
|
||||
});
|
||||
}
|
||||
|
||||
Widget productDropDown(SalesInProvinceLogic controller) {
|
||||
Widget productDropDown(WarehouseAndDistributionSalesInProvinceLogic controller) {
|
||||
return Obx(() {
|
||||
return OverlayDropdownWidget<ProductModel>(
|
||||
items: controller.rolesProductsModel,
|
||||
@@ -439,7 +437,7 @@ Container modalDatePicker(ValueChanged<Jalali> onDateSelected) {
|
||||
);
|
||||
}
|
||||
|
||||
Widget show2StepAddBottomSheet(SalesInProvinceLogic controller) {
|
||||
Widget show2StepAddBottomSheet(WarehouseAndDistributionSalesInProvinceLogic controller) {
|
||||
return BaseBottomSheet(
|
||||
height: Get.height * .39,
|
||||
child: Column(
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_out_of_province/logic.dart
|
||||
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.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/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/features/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sales_out_of_province_buyers/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sales_out_of_province_sales_list/logic.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/broadcast_price/broadcast_price.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||
@@ -23,7 +11,7 @@ import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.
|
||||
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';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_out_of_province/logic.dart
|
||||
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -32,11 +20,9 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
|
||||
SaleLogic saleLogic = Get.find<SaleLogic>();
|
||||
|
||||
SalesOutOfProvinceSalesListLogic saleListLogic =
|
||||
Get.find<SalesOutOfProvinceSalesListLogic>();
|
||||
SalesOutOfProvinceSalesListLogic saleListLogic = Get.find<SalesOutOfProvinceSalesListLogic>();
|
||||
|
||||
SalesOutOfProvinceBuyersLogic buyerLogic =
|
||||
Get.find<SalesOutOfProvinceBuyersLogic>();
|
||||
SalesOutOfProvinceBuyersLogic buyerLogic = Get.find<SalesOutOfProvinceBuyersLogic>();
|
||||
|
||||
RxBool isExpanded = false.obs;
|
||||
RxInt currentPage = 1.obs;
|
||||
@@ -115,8 +101,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
}
|
||||
|
||||
void _updateGovernmentalProductionDateData() {
|
||||
List<RemainWeightDay> dates =
|
||||
rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||
List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||
governmentalProductionDateData = {
|
||||
for (var element in dates)
|
||||
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||
@@ -167,21 +152,16 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
),
|
||||
onSuccess: (res) {
|
||||
if ((res?.count ?? 0) == 0) {
|
||||
salesList.value =
|
||||
Resource<PaginationModel<StewardFreeSaleBar>>.empty();
|
||||
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.empty();
|
||||
} else {
|
||||
salesList.value =
|
||||
Resource<PaginationModel<StewardFreeSaleBar>>.success(
|
||||
PaginationModel<StewardFreeSaleBar>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [
|
||||
...(salesList.value.data?.results ?? []),
|
||||
...(res?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.success(
|
||||
PaginationModel<StewardFreeSaleBar>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [...(salesList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||
),
|
||||
);
|
||||
|
||||
isLoadingMoreAllocationsMade.value = false;
|
||||
}
|
||||
@@ -195,8 +175,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
saleWeightController.addListener(() {
|
||||
checkSalesFormValid();
|
||||
weight.value = int.parse(saleWeightController.text.clearComma);
|
||||
var res = (weight / selectedProduct.value!.weightAverage!.toInt())
|
||||
.round();
|
||||
var res = (weight / selectedProduct.value!.weightAverage!.toInt()).round();
|
||||
saleCountController.text = res.separatedByComma;
|
||||
});
|
||||
ever(selectedBuyer, (_) => checkSalesFormValid);
|
||||
@@ -215,8 +194,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
|
||||
void setEditDataSales(StewardFreeSaleBar item) {
|
||||
quarantineCodeController.text = item.clearanceCode ?? '';
|
||||
saleWeightController.text =
|
||||
item.weightOfCarcasses?.toInt().toString() ?? '';
|
||||
saleWeightController.text = item.weightOfCarcasses?.toInt().toString() ?? '';
|
||||
saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!));
|
||||
selectedCity.value = IranProvinceCityModel(name: item.city);
|
||||
selectedBuyer.value = buyerLogic.buyerList.value.data?.results?.firstWhere(
|
||||
@@ -228,9 +206,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
quotaType.value = item.quota == 'governmental' ? 1 : 2;
|
||||
isSaleSubmitButtonEnabled.value = true;
|
||||
productionDate.value = item.productionDate.toJalali;
|
||||
pricePerKiloController.text = pricePerKilo.value
|
||||
.toString()
|
||||
.separatedByComma;
|
||||
pricePerKiloController.text = pricePerKilo.value.toString().separatedByComma;
|
||||
totalCostController.text = totalCost.value.toString().separatedByComma;
|
||||
}
|
||||
|
||||
@@ -254,16 +230,10 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
productKey: selectedProduct.value?.key,
|
||||
saleType: saleType.value == 2 ? 'free' : 'exclusive',
|
||||
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_out_of_province/logic.dart
|
||||
|
||||
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||
distributionType: 'App',
|
||||
);
|
||||
========
|
||||
productionDate: productionDate.value
|
||||
?.toDateTime()
|
||||
.formattedDashedGregorian,
|
||||
);
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/sales_out_of_province/logic.dart
|
||||
|
||||
await safeCall(
|
||||
showError: true,
|
||||
call: () => rootLogic.stewardRepository.createOutProvinceStewardFreeBar(
|
||||
@@ -409,9 +379,7 @@ class SalesOutOfProvinceLogic extends GetxController {
|
||||
saleDate.value = Jalali.now();
|
||||
Future.delayed(
|
||||
Duration(milliseconds: 300),
|
||||
() => defaultShowErrorMessage(
|
||||
"تاریخ تولید نمی تواند قبل از تاریخ فروش باشد",
|
||||
),
|
||||
() => defaultShowErrorMessage("تاریخ تولید نمی تواند قبل از تاریخ فروش باشد"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/sales_out_of_province/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_free_sale_bar/steward_free_sale_bar.dart';
|
||||
@@ -14,7 +15,8 @@ import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAndDistributionSalesOutOfProvinceLogic> {
|
||||
class WarehouseAndDistributionSalesOutOfProvincePage
|
||||
extends GetView<WarehouseAndDistributionSalesOutOfProvinceLogic> {
|
||||
const WarehouseAndDistributionSalesOutOfProvincePage({super.key});
|
||||
|
||||
@override
|
||||
@@ -32,12 +34,10 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
Positioned.fill(
|
||||
child: Column(
|
||||
children: [
|
||||
// inventoryWidget(controller.rootLogic),
|
||||
|
||||
// inventoryWidget(controller.rootLogic),
|
||||
ObxValue((data) {
|
||||
return RPaginatedListView(
|
||||
onLoadMore: () async =>
|
||||
controller.getOutProvinceSales(true),
|
||||
onLoadMore: () async => controller.getOutProvinceSales(true),
|
||||
hasMore: data.value.data?.next != null,
|
||||
listType: ListType.separated,
|
||||
resource: data.value,
|
||||
@@ -71,27 +71,19 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
children: [
|
||||
RFab.add(
|
||||
onPressed: () {
|
||||
Get.bottomSheet(
|
||||
addOrEditSaleBottomSheet(),
|
||||
isScrollControlled: true,
|
||||
).then((value) {
|
||||
Get.bottomSheet(addOrEditSaleBottomSheet(), isScrollControlled: true).then((
|
||||
value,
|
||||
) {
|
||||
controller.clearSaleForm();
|
||||
});
|
||||
},
|
||||
),
|
||||
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(
|
||||
StewardRoutes.salesOutOfProvinceBuyerSteward,
|
||||
id: stewardSecondKey,
|
||||
);
|
||||
Get.toNamed(StewardRoutes.salesOutOfProvinceBuyerSteward, id: stewardSecondKey);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 25),
|
||||
@@ -185,10 +177,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
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: [
|
||||
@@ -220,16 +209,12 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -246,10 +231,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
],
|
||||
),
|
||||
),
|
||||
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(
|
||||
@@ -267,10 +249,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
value: item.productionDate?.toJalali.formatCompactDate() ?? 'ندارد',
|
||||
),
|
||||
buildRow(title: 'انبار فروش', value: '${item.quota?.faTitle}'),
|
||||
buildRow(
|
||||
title: 'کد قرنطینه ',
|
||||
value: item.clearanceCode ?? 'بدون کد',
|
||||
),
|
||||
buildRow(title: 'کد قرنطینه ', value: item.clearanceCode ?? 'بدون کد'),
|
||||
|
||||
buildRow(
|
||||
title: 'حجم تقریبی لاشه ',
|
||||
@@ -283,9 +262,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
children: [
|
||||
Text(
|
||||
'کد احراز',
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
Spacer(),
|
||||
RElevated(
|
||||
@@ -295,9 +272,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
backgroundColor: AppColor.blueDarkHover,
|
||||
text: 'ارسال کد',
|
||||
onPressed: () {
|
||||
Get.bottomSheet(bottomSendOtpSheetSellCode(item)).then((
|
||||
value,
|
||||
) {
|
||||
Get.bottomSheet(bottomSendOtpSheetSellCode(item)).then((value) {
|
||||
controller.otpCode.value = '';
|
||||
controller.otpCodeSell.clear();
|
||||
});
|
||||
@@ -306,10 +281,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
],
|
||||
)
|
||||
: buildRow(title: 'کد احراز ', value: '${item.registerCode}'),
|
||||
buildRow(
|
||||
title: 'کد قرنطینه ',
|
||||
value: item.clearanceCode ?? 'بدون کد',
|
||||
),
|
||||
buildRow(title: 'کد قرنطینه ', value: item.clearanceCode ?? 'بدون کد'),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -367,12 +339,10 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
children: [
|
||||
Text(
|
||||
isOnEdit ? 'ویرایش فروش' : 'افزودن فروش',
|
||||
style: AppFonts.yekan16Bold.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
// _productDropDown(),
|
||||
|
||||
// _productDropDown(),
|
||||
Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
@@ -391,9 +361,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
label: 'تاریخ',
|
||||
onTap: () {
|
||||
Get.bottomSheet(
|
||||
modalDatePicker(
|
||||
(value) => controller.setSaleDate(value),
|
||||
),
|
||||
modalDatePicker((value) => controller.setSaleDate(value)),
|
||||
);
|
||||
},
|
||||
borderColor: AppColor.darkGreyLight,
|
||||
@@ -408,10 +376,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: AppColor.darkGreyLight,
|
||||
width: 1,
|
||||
),
|
||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
@@ -419,10 +384,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: Text("انبار"),
|
||||
),
|
||||
child: Container(color: Colors.white, child: Text("انبار")),
|
||||
top: -10,
|
||||
right: 8,
|
||||
),
|
||||
@@ -443,10 +405,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 1),
|
||||
Text(
|
||||
'دولتی',
|
||||
style: AppFonts.yekan14,
|
||||
),
|
||||
Text('دولتی', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -460,10 +419,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 2),
|
||||
Text(
|
||||
'آزاد',
|
||||
style: AppFonts.yekan14,
|
||||
),
|
||||
Text('آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -480,8 +436,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
Obx(() {
|
||||
return MonthlyDataCalendar(
|
||||
label: 'تاریخ تولید گوشت',
|
||||
selectedDate: controller.productionDate.value
|
||||
?.formatCompactDate(),
|
||||
selectedDate: controller.productionDate.value?.formatCompactDate(),
|
||||
onDateSelect: (value) {
|
||||
controller.setProductionDate(value);
|
||||
},
|
||||
@@ -491,10 +446,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
);
|
||||
}),
|
||||
|
||||
Visibility(
|
||||
visible: isOnEdit == false,
|
||||
child: _buyerWidget(),
|
||||
),
|
||||
Visibility(visible: isOnEdit == false, child: _buyerWidget()),
|
||||
|
||||
RTextField(
|
||||
controller: controller.saleWeightController,
|
||||
@@ -549,10 +501,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: AppColor.darkGreyLight,
|
||||
width: 1,
|
||||
),
|
||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
@@ -560,10 +509,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: Text("فروش"),
|
||||
),
|
||||
child: Container(color: Colors.white, child: Text("فروش")),
|
||||
top: -10,
|
||||
right: 8,
|
||||
),
|
||||
@@ -577,12 +523,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap:
|
||||
(controller
|
||||
.broadcastPrice
|
||||
.value
|
||||
?.active ??
|
||||
false)
|
||||
onTap: (controller.broadcastPrice.value?.active ?? false)
|
||||
? () {
|
||||
controller.saleType.value = 2;
|
||||
}
|
||||
@@ -592,20 +533,13 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
Radio(
|
||||
value: 1,
|
||||
enabled:
|
||||
controller
|
||||
.broadcastPrice
|
||||
.value
|
||||
?.active ??
|
||||
false,
|
||||
controller.broadcastPrice.value?.active ?? false,
|
||||
),
|
||||
Text(
|
||||
'قیمت مصوب',
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color:
|
||||
(controller
|
||||
.broadcastPrice
|
||||
.value
|
||||
?.active ??
|
||||
(controller.broadcastPrice.value?.active ??
|
||||
false)
|
||||
? AppColor.textColor
|
||||
: AppColor.labelTextColor,
|
||||
@@ -624,10 +558,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(value: 2),
|
||||
Text(
|
||||
'قیمت آزاد',
|
||||
style: AppFonts.yekan14,
|
||||
),
|
||||
Text('قیمت آزاد', style: AppFonts.yekan14),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -654,8 +585,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
filled: true,
|
||||
readonly: data.value == 1,
|
||||
onChanged: (p0) {
|
||||
controller.pricePerKilo.value =
|
||||
int.tryParse(p0.clearComma) ?? 0;
|
||||
controller.pricePerKilo.value = int.tryParse(p0.clearComma) ?? 0;
|
||||
},
|
||||
keyboardType: TextInputType.number,
|
||||
label: 'قیمت هر کیلو (ريال)',
|
||||
@@ -710,9 +640,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
text: isOnEdit ? 'ویرایش' : 'ثبت',
|
||||
onPressed: data.value
|
||||
? () async {
|
||||
isOnEdit
|
||||
? await controller.editSale()
|
||||
: await controller.createSale();
|
||||
isOnEdit ? await controller.editSale() : await controller.createSale();
|
||||
}
|
||||
: null,
|
||||
height: 40,
|
||||
@@ -890,9 +818,7 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
height: 40.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(
|
||||
@@ -954,16 +880,12 @@ class WarehouseAndDistributionSalesOutOfProvincePage extends GetView<WarehouseAn
|
||||
maxLines: 1,
|
||||
textDirection: TextDirection.ltr,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||
),
|
||||
Text(
|
||||
unit,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_out_of_province_buyers/logic.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/features/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sales_out_of_province/logic.dart';
|
||||
========
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.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';
|
||||
>>>>>>>> develop:packages/chicken/lib/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';
|
||||
|
||||
@@ -21,8 +14,7 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
|
||||
|
||||
SaleLogic get saleLogic => Get.find<SaleLogic>();
|
||||
|
||||
SalesOutOfProvinceLogic get saleOutOfProvince =>
|
||||
Get.find<SalesOutOfProvinceLogic>();
|
||||
SalesOutOfProvinceLogic get saleOutOfProvince => Get.find<SalesOutOfProvinceLogic>();
|
||||
|
||||
RxInt currentPage = 1.obs;
|
||||
RxInt expandedListIndex = (-1).obs;
|
||||
@@ -83,14 +75,11 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
Future<void> getOutProvinceCarcassesBuyer([
|
||||
bool isLoadingMore = false,
|
||||
]) async {
|
||||
Future<void> getOutProvinceCarcassesBuyer([bool isLoadingMore = false]) async {
|
||||
if (isLoadingMore) {
|
||||
isLoadingMoreAllocationsMade.value = true;
|
||||
} else {
|
||||
buyerList.value =
|
||||
Resource<PaginationModel<OutProvinceCarcassesBuyer>>.loading();
|
||||
buyerList.value = Resource<PaginationModel<OutProvinceCarcassesBuyer>>.loading();
|
||||
}
|
||||
|
||||
if (searchedValue.value != null &&
|
||||
@@ -111,25 +100,19 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
|
||||
value: searchedValue.value ?? '',
|
||||
),
|
||||
),
|
||||
onError: (error, stackTrace) =>
|
||||
isLoadingMoreAllocationsMade.value = false,
|
||||
onError: (error, stackTrace) => isLoadingMoreAllocationsMade.value = false,
|
||||
onSuccess: (res) {
|
||||
if ((res?.count ?? 0) == 0) {
|
||||
buyerList.value =
|
||||
Resource<PaginationModel<OutProvinceCarcassesBuyer>>.empty();
|
||||
buyerList.value = Resource<PaginationModel<OutProvinceCarcassesBuyer>>.empty();
|
||||
} else {
|
||||
buyerList.value =
|
||||
Resource<PaginationModel<OutProvinceCarcassesBuyer>>.success(
|
||||
PaginationModel<OutProvinceCarcassesBuyer>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [
|
||||
...(buyerList.value.data?.results ?? []),
|
||||
...(res?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
buyerList.value = Resource<PaginationModel<OutProvinceCarcassesBuyer>>.success(
|
||||
PaginationModel<OutProvinceCarcassesBuyer>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [...(buyerList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||
),
|
||||
);
|
||||
|
||||
isLoadingMoreAllocationsMade.value = false;
|
||||
}
|
||||
@@ -148,9 +131,8 @@ class SalesOutOfProvinceBuyersLogic extends GetxController {
|
||||
|
||||
Future<void> getCites() async {
|
||||
await safeCall(
|
||||
call: () => rootLogic.commonRepository.getCity(
|
||||
provinceName: selectedProvince.value?.name ?? '',
|
||||
),
|
||||
call: () =>
|
||||
rootLogic.commonRepository.getCity(provinceName: selectedProvince.value?.name ?? ''),
|
||||
onSuccess: (result) {
|
||||
if (result != null && result.isNotEmpty) {
|
||||
cites.value = result;
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/sales_out_of_province_sales_list/logic.dart
|
||||
import 'package:rasadyar_chicken/data/models/request/steward_free_sale_bar/steward_free_sale_bar_request.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/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/features/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sale/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/sales_out_of_province_buyers/logic.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/request/steward_free_sale_bar/steward_free_sale_bar_request.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/iran_province_city/iran_province_city_model.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/out_province_carcasses_buyer/out_province_carcasses_buyer.dart';
|
||||
@@ -17,7 +8,6 @@ import 'package:rasadyar_chicken/features/steward/data/model/response/steward_fr
|
||||
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';
|
||||
>>>>>>>> develop:packages/chicken/lib/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';
|
||||
|
||||
@@ -26,8 +16,7 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
|
||||
|
||||
SaleLogic saleLogic = Get.find<SaleLogic>();
|
||||
|
||||
SalesOutOfProvinceBuyersLogic buyerLogic =
|
||||
Get.find<SalesOutOfProvinceBuyersLogic>();
|
||||
SalesOutOfProvinceBuyersLogic buyerLogic = Get.find<SalesOutOfProvinceBuyersLogic>();
|
||||
|
||||
RxInt selectedSegmentIndex = 0.obs;
|
||||
RxBool isExpanded = false.obs;
|
||||
@@ -106,21 +95,16 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
|
||||
),
|
||||
onSuccess: (res) {
|
||||
if ((res?.count ?? 0) == 0) {
|
||||
salesList.value =
|
||||
Resource<PaginationModel<StewardFreeSaleBar>>.empty();
|
||||
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.empty();
|
||||
} else {
|
||||
salesList.value =
|
||||
Resource<PaginationModel<StewardFreeSaleBar>>.success(
|
||||
PaginationModel<StewardFreeSaleBar>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [
|
||||
...(salesList.value.data?.results ?? []),
|
||||
...(res?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
salesList.value = Resource<PaginationModel<StewardFreeSaleBar>>.success(
|
||||
PaginationModel<StewardFreeSaleBar>(
|
||||
count: res?.count ?? 0,
|
||||
next: res?.next,
|
||||
previous: res?.previous,
|
||||
results: [...(salesList.value.data?.results ?? []), ...(res?.results ?? [])],
|
||||
),
|
||||
);
|
||||
|
||||
isLoadingMoreAllocationsMade.value = false;
|
||||
}
|
||||
@@ -146,8 +130,7 @@ class SalesOutOfProvinceSalesListLogic extends GetxController {
|
||||
|
||||
void setEditDataSales(StewardFreeSaleBar item) {
|
||||
quarantineCodeController.text = item.clearanceCode ?? '';
|
||||
saleWeightController.text =
|
||||
item.weightOfCarcasses?.toInt().toString() ?? '';
|
||||
saleWeightController.text = item.weightOfCarcasses?.toInt().toString() ?? '';
|
||||
saleDate.value = Jalali.fromDateTime(DateTime.parse(item.date!));
|
||||
selectedCity.value = IranProvinceCityModel(name: item.city);
|
||||
selectedBuyer.value = buyerLogic.buyerList.value.data?.results?.firstWhere(
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/segmentation/logic.dart
|
||||
import 'package:rasadyar_chicken/data/models/response/broadcast_price/broadcast_price.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/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/features/steward/root/logic.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/broadcast_price/broadcast_price.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/segmentation_model/segmentation_model.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/steward_remain_weight/steward_remain_weight.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/segmentation/logic.dart
|
||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -57,10 +49,7 @@ class SegmentationLogic extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
routesName = ['قطعهبندی'].toList();
|
||||
once(
|
||||
rootLogic.rolesProductsModel,
|
||||
(callback) => selectedProduct.value = callback.first,
|
||||
);
|
||||
once(rootLogic.rolesProductsModel, (callback) => selectedProduct.value = callback.first);
|
||||
getAllSegmentation();
|
||||
getGuilds();
|
||||
|
||||
@@ -77,8 +66,7 @@ class SegmentationLogic extends GetxController {
|
||||
}
|
||||
|
||||
void _updateGovernmentalProductionDateData() {
|
||||
List<RemainWeightDay> dates =
|
||||
rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||
List<RemainWeightDay> dates = rootLogic.stewardRemainWeight.value?.governmental ?? [];
|
||||
governmentalProductionDateData = {
|
||||
for (var element in dates)
|
||||
element.day.toString().toJalali.formatCompactDate(): DayData(
|
||||
@@ -146,16 +134,14 @@ class SegmentationLogic extends GetxController {
|
||||
hasWeight &&
|
||||
productionDate.value != null &&
|
||||
weight > 0 &&
|
||||
(segmentType.value == 1 ||
|
||||
(segmentType.value == 2 && selectedGuildModel.value != null));
|
||||
(segmentType.value == 1 || (segmentType.value == 2 && selectedGuildModel.value != null));
|
||||
}
|
||||
|
||||
Future<void> getAllSegmentation([bool isLoadingMore = false]) async {
|
||||
if (isLoadingMore) {
|
||||
isLoadingMoreAllocationsMade.value = true;
|
||||
} else {
|
||||
segmentationList.value =
|
||||
Resource<PaginationModel<SegmentationModel>>.loading();
|
||||
segmentationList.value = Resource<PaginationModel<SegmentationModel>>.loading();
|
||||
}
|
||||
|
||||
if (searchedValue.value != null &&
|
||||
@@ -181,21 +167,19 @@ class SegmentationLogic extends GetxController {
|
||||
|
||||
onSuccess: (result) {
|
||||
if ((result?.count ?? 0) == 0) {
|
||||
segmentationList.value =
|
||||
Resource<PaginationModel<SegmentationModel>>.empty();
|
||||
segmentationList.value = Resource<PaginationModel<SegmentationModel>>.empty();
|
||||
} else {
|
||||
segmentationList.value =
|
||||
Resource<PaginationModel<SegmentationModel>>.success(
|
||||
PaginationModel<SegmentationModel>(
|
||||
count: result?.count ?? 0,
|
||||
next: result?.next,
|
||||
previous: result?.previous,
|
||||
results: [
|
||||
...(segmentationList.value.data?.results ?? []),
|
||||
...(result?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
segmentationList.value = Resource<PaginationModel<SegmentationModel>>.success(
|
||||
PaginationModel<SegmentationModel>(
|
||||
count: result?.count ?? 0,
|
||||
next: result?.next,
|
||||
previous: result?.previous,
|
||||
results: [
|
||||
...(segmentationList.value.data?.results ?? []),
|
||||
...(result?.results ?? []),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
isLoadingMoreAllocationsMade.value = false;
|
||||
}
|
||||
@@ -223,9 +207,7 @@ class SegmentationLogic extends GetxController {
|
||||
model: SegmentationModel(
|
||||
key: selectedSegment.value?.key,
|
||||
weight: int.tryParse(weightController.text.clearComma) ?? 0,
|
||||
productionDate: productionDate.value
|
||||
?.toDateTime()
|
||||
.formattedDashedGregorian,
|
||||
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||
),
|
||||
),
|
||||
onSuccess: (result) {
|
||||
@@ -250,14 +232,10 @@ class SegmentationLogic extends GetxController {
|
||||
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||
);
|
||||
if (segmentType.value == 2) {
|
||||
segmentationModel = segmentationModel.copyWith(
|
||||
guildKey: selectedGuildModel.value?.key,
|
||||
);
|
||||
segmentationModel = segmentationModel.copyWith(guildKey: selectedGuildModel.value?.key);
|
||||
}
|
||||
segmentationModel = segmentationModel.copyWith(
|
||||
productionDate: productionDate.value
|
||||
?.toDateTime()
|
||||
.formattedDashedGregorian,
|
||||
productionDate: productionDate.value?.toDateTime().formattedDashedGregorian,
|
||||
);
|
||||
await safeCall(
|
||||
showError: true,
|
||||
@@ -286,10 +264,7 @@ class SegmentationLogic extends GetxController {
|
||||
safeCall(
|
||||
call: () async => await rootLogic.commonRepository.getGuilds(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(
|
||||
queryParams: {'all': true},
|
||||
role: 'Steward',
|
||||
),
|
||||
queryParameters: buildQueryParams(queryParams: {'all': true}, role: 'Steward'),
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/segmentation/view.dart
|
||||
import 'package:rasadyar_chicken/data/models/response/segmentation_model/segmentation_model.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/segmentation/widgets/cu_bottom_sheet.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/steward/data/model/response/segmentation_model/segmentation_model.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/widgets/cu_bottom_sheet.dart';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/segmentation/view.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';
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
<<<<<<<< HEAD:packages/chicken/lib/features/steward/segmentation/widgets/cu_bottom_sheet.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/features/steward/segmentation/logic.dart';
|
||||
========
|
||||
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/guild/guild_model.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/model/response/roles_products/roles_products.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/segmentation/logic.dart';
|
||||
>>>>>>>> develop:packages/chicken/lib/features/steward/presentation/pages/segmentation/widgets/cu_bottom_sheet.dart
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
Widget addOrEditBottomSheet(SegmentationLogic controller, {bool isOnEdit = false}) {
|
||||
|
||||
Reference in New Issue
Block a user