feat : new segment logic
This commit is contained in:
@@ -35,7 +35,6 @@ class SegmentationLogic extends GetxController {
|
||||
|
||||
RxList<GuildModel> guildsModel = <GuildModel>[].obs;
|
||||
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
@@ -82,12 +81,16 @@ class SegmentationLogic extends GetxController {
|
||||
void clearForm() {
|
||||
weightController.text = '0';
|
||||
selectedSegment.value = null;
|
||||
selectedGuildModel.value = null;
|
||||
}
|
||||
|
||||
void validateForm() {
|
||||
var weight = int.tryParse(weightController.text.clearComma.trim());
|
||||
isSubmitButtonEnabled.value =
|
||||
selectedProduct.value != null && weightController.text.isNotEmpty && weight! > 0;
|
||||
selectedProduct.value != null &&
|
||||
weightController.text.isNotEmpty &&
|
||||
weight! > 0 &&
|
||||
(saleType.value == 1 || (saleType.value == 2 && selectedGuildModel.value != null));
|
||||
}
|
||||
|
||||
Future<void> getAllSegmentation([bool isLoadingMore = false]) async {
|
||||
@@ -177,9 +180,9 @@ class SegmentationLogic extends GetxController {
|
||||
weight: int.tryParse(weightController.text.clearComma) ?? 0,
|
||||
);
|
||||
if (saleType.value == 2) {
|
||||
segmentationModel.copyWith(guildKey: selectedGuildModel.value?.key);
|
||||
segmentationModel = segmentationModel.copyWith(guildKey: selectedGuildModel.value?.key);
|
||||
}
|
||||
safeCall(
|
||||
await safeCall(
|
||||
call: () async => await rootLogic.chickenRepository.createSegmentation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
model: segmentationModel,
|
||||
|
||||
Reference in New Issue
Block a user