feat: changed like production date and quota and sale Type
This commit is contained in:
@@ -22,7 +22,7 @@ class SegmentationLogic extends GetxController {
|
||||
Rx<Jalali> toDateFilter = Jalali.now().obs;
|
||||
RxnString searchedValue = RxnString();
|
||||
RxInt segmentType = 1.obs;
|
||||
RxInt saleType = 1.obs;
|
||||
RxInt saleType = 2.obs;
|
||||
RxInt quotaType = 1.obs;
|
||||
GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
TextEditingController weightController = TextEditingController(text: '0');
|
||||
@@ -35,6 +35,8 @@ class SegmentationLogic extends GetxController {
|
||||
Resource<PaginationModel<SegmentationModel>>.loading().obs;
|
||||
|
||||
RxList<GuildModel> guildsModel = <GuildModel>[].obs;
|
||||
Rxn<Jalali?> productionData = Rxn();
|
||||
Rx<Jalali> saleDate = Jalali.now().obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@@ -83,6 +85,7 @@ class SegmentationLogic extends GetxController {
|
||||
weightController.text = '0';
|
||||
selectedSegment.value = null;
|
||||
selectedGuildModel.value = null;
|
||||
productionData.value = null;
|
||||
segmentType.value = 1;
|
||||
saleType.value = 1;
|
||||
quotaType.value = 1;
|
||||
@@ -111,6 +114,8 @@ class SegmentationLogic extends GetxController {
|
||||
}
|
||||
|
||||
await safeCall(
|
||||
showError: true,
|
||||
showSuccess: true,
|
||||
call: () async => await rootLogic.chickenRepository.getSegmentation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
queryParameters: buildQueryParams(
|
||||
@@ -148,7 +153,8 @@ class SegmentationLogic extends GetxController {
|
||||
|
||||
Future<void> deleteSegmentation(String key) async {
|
||||
await safeCall(
|
||||
showError: false,
|
||||
showError: true,
|
||||
showSuccess: true,
|
||||
call: () => rootLogic.chickenRepository.deleteSegmentation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
key: key,
|
||||
@@ -165,6 +171,7 @@ class SegmentationLogic extends GetxController {
|
||||
model: SegmentationModel(
|
||||
key: selectedSegment.value?.key,
|
||||
weight: int.tryParse(weightController.text.clearComma) ?? 0,
|
||||
productionDate: productionData.value?.toDateTime().formattedDashedGregorian,
|
||||
),
|
||||
),
|
||||
onSuccess: (result) {
|
||||
@@ -189,7 +196,14 @@ class SegmentationLogic extends GetxController {
|
||||
if (segmentType.value == 2) {
|
||||
segmentationModel = segmentationModel.copyWith(guildKey: selectedGuildModel.value?.key);
|
||||
}
|
||||
if (productionData.value != null) {
|
||||
segmentationModel = segmentationModel.copyWith(
|
||||
productionDate: productionData.value?.toDateTime().formattedDashedGregorian,
|
||||
);
|
||||
}
|
||||
await safeCall(
|
||||
showError: true,
|
||||
showSuccess: true,
|
||||
call: () async => await rootLogic.chickenRepository.createSegmentation(
|
||||
token: rootLogic.tokenService.accessToken.value!,
|
||||
model: segmentationModel,
|
||||
|
||||
Reference in New Issue
Block a user