feat : new segment logic

This commit is contained in:
2025-07-21 12:04:43 +03:30
parent 16833584f6
commit e2300293a7
5 changed files with 521 additions and 78 deletions

View File

@@ -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,