feat : sale in the province

This commit is contained in:
MrM
2025-06-27 18:08:53 +03:30
parent 701e8e0fbe
commit 751d48c02e
13 changed files with 1542 additions and 1896 deletions

View File

@@ -11,7 +11,10 @@ import 'package:rasadyar_core/core.dart';
class SalesInProvinceLogic extends GetxController {
var rootLogic = Get.find<RootLogic>();
Rxn<AllocatedMadeModel> allocatedMadeModel = Rxn<AllocatedMadeModel>();
Rxn<List<AllocatedMadeModel>?> allocatedMadeModel =
Rxn<List<AllocatedMadeModel>?>();
RxList<int> isExpandedList = <int>[].obs;
RxList<ProductModel> rolesProductsModel = RxList<ProductModel>();
RxList<GuildModel> guildsModel = <GuildModel>[].obs;
@@ -86,15 +89,21 @@ class SalesInProvinceLogic extends GetxController {
safeCall(
call: () async => await rootLogic.chickenRepository.getAllocatedMade(
token: rootLogic.tokenService.accessToken.value!,
page: currentPageAllocationsMade.value,
queryParameters: buildQueryParams(
page: currentPageAllocationsMade.value,
pageSize: 20,
search: 'filter',
role: 'Steward',
),
),
onSuccess: (result) {
if (result != null) {
if (isLoadingMoreAllocationsMade.value &&
allocatedMadeModel.value?.results != null) {
allocatedMadeModel.value?.results?.addAll(result.results!);
allocatedMadeModel.value != null &&
(allocatedMadeModel.value?.isNotEmpty ?? false)) {
allocatedMadeModel.value?.addAll(result.results!);
} else {
allocatedMadeModel.value = result;
allocatedMadeModel.value = result.results;
}
}
@@ -146,8 +155,7 @@ class SalesInProvinceLogic extends GetxController {
call: () async => await rootLogic.chickenRepository.confirmAllAllocation(
token: rootLogic.tokenService.accessToken.value!,
allocationTokens:
allocatedMadeModel.value?.results?.map((e) => e.key!).toList() ??
[],
allocatedMadeModel.value?.map((e) => e.key!).toList() ?? [],
),
onSuccess: (result) {
getAllocatedMade();
@@ -164,6 +172,7 @@ class SalesInProvinceLogic extends GetxController {
onSuccess: (result) {
if (result != null) {
rolesProductsModel.value = result;
selectedProductModel.value = result.first;
}
},
onError: (error, stacktrace) {},
@@ -174,7 +183,10 @@ class SalesInProvinceLogic extends GetxController {
safeCall(
call: () async => await rootLogic.chickenRepository.getGuilds(
token: rootLogic.tokenService.accessToken.value!,
isFree: saleType.value == 2 ? true : false,
queryParameters: buildQueryParams(
queryParams: {'free': saleType.value == 2 ? true : false},
role: 'Steward',
),
),
onSuccess: (result) {
if (result != null) {
@@ -242,11 +254,12 @@ class SalesInProvinceLogic extends GetxController {
);
}
@override
void dispose() {
rootLogic.inventoryExpandedList.clear();
super.dispose();
}
//TODO
void setEditData(AllocatedMadeModel item) {}
}