feat : new ui and fix bug's
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.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';
|
||||
@@ -22,7 +21,9 @@ class SegmentationLogic extends GetxController {
|
||||
Rx<Jalali> fromDateFilter = Jalali.now().obs;
|
||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
||||
RxnString searchedValue = RxnString();
|
||||
RxInt segmentType = 1.obs;
|
||||
RxInt saleType = 1.obs;
|
||||
RxInt quotaType = 1.obs;
|
||||
GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
TextEditingController weightController = TextEditingController(text: '0');
|
||||
RxBool isSubmitButtonEnabled = false.obs;
|
||||
@@ -82,6 +83,9 @@ class SegmentationLogic extends GetxController {
|
||||
weightController.text = '0';
|
||||
selectedSegment.value = null;
|
||||
selectedGuildModel.value = null;
|
||||
segmentType.value = 1;
|
||||
saleType.value = 1;
|
||||
quotaType.value = 1;
|
||||
}
|
||||
|
||||
void validateForm() {
|
||||
@@ -178,8 +182,10 @@ class SegmentationLogic extends GetxController {
|
||||
SegmentationModel segmentationModel = SegmentationModel(
|
||||
productKey: selectedProduct.value?.key,
|
||||
weight: int.tryParse(weightController.text.clearComma) ?? 0,
|
||||
saleType: saleType.value == 1 ? 'governmental' : 'free',
|
||||
quota: quotaType.value == 1 ? 'governmental' : 'free',
|
||||
);
|
||||
if (saleType.value == 2) {
|
||||
if (segmentType.value == 2) {
|
||||
segmentationModel = segmentationModel.copyWith(guildKey: selectedGuildModel.value?.key);
|
||||
}
|
||||
await safeCall(
|
||||
@@ -189,6 +195,8 @@ class SegmentationLogic extends GetxController {
|
||||
),
|
||||
onSuccess: (result) {
|
||||
res = true;
|
||||
isSubmitButtonEnabled.value = true;
|
||||
|
||||
},
|
||||
onError: (error, stacktrace) {
|
||||
res = false;
|
||||
|
||||
Reference in New Issue
Block a user