feat : new changes from back
This commit is contained in:
@@ -17,7 +17,7 @@ class SegmentationLogic extends GetxController {
|
||||
RxInt selectedSegmentIndex = 0.obs;
|
||||
RxBool isExpanded = false.obs;
|
||||
|
||||
RxList<int> isExpandedList = <int>[].obs;
|
||||
RxInt expandedListIndex = (-1).obs;
|
||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
||||
RxnString searchedValue = RxnString();
|
||||
@@ -89,12 +89,12 @@ class SegmentationLogic extends GetxController {
|
||||
}
|
||||
|
||||
void validateForm() {
|
||||
var weight = int.tryParse(weightController.text.clearComma.trim());
|
||||
var weight = int.tryParse(weightController.text.trim().clearComma);
|
||||
isSubmitButtonEnabled.value =
|
||||
selectedProduct.value != null &&
|
||||
weightController.text.isNotEmpty &&
|
||||
weight! > 0 &&
|
||||
(saleType.value == 1 || (saleType.value == 2 && selectedGuildModel.value != null));
|
||||
(segmentType.value == 1 || (segmentType.value == 2 && selectedGuildModel.value != null));
|
||||
}
|
||||
|
||||
Future<void> getAllSegmentation([bool isLoadingMore = false]) async {
|
||||
@@ -169,6 +169,7 @@ class SegmentationLogic extends GetxController {
|
||||
),
|
||||
onSuccess: (result) {
|
||||
res = true;
|
||||
onRefresh();
|
||||
},
|
||||
onError: (error, stacktrace) {
|
||||
res = false;
|
||||
@@ -196,6 +197,7 @@ class SegmentationLogic extends GetxController {
|
||||
onSuccess: (result) {
|
||||
res = true;
|
||||
isSubmitButtonEnabled.value = true;
|
||||
onRefresh();
|
||||
},
|
||||
onError: (error, stacktrace) {
|
||||
res = false;
|
||||
@@ -221,8 +223,17 @@ class SegmentationLogic extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> onRefresh() async {
|
||||
toggleExpansion();
|
||||
currentPage.value = 1;
|
||||
await rootLogic.onRefresh();
|
||||
await getAllSegmentation();
|
||||
}
|
||||
|
||||
void toggleExpansion({int? index}) {
|
||||
if (expandedListIndex.value == index || index == null) {
|
||||
expandedListIndex.value = -1;
|
||||
} else {
|
||||
expandedListIndex.value = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user