feat : segment page

This commit is contained in:
2025-07-15 09:03:11 +03:30
parent f79a3ae46f
commit b1496b1ed0
15 changed files with 63 additions and 63 deletions

View File

@@ -31,7 +31,7 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
return RPaginatedListView(
listType: ListType.separated,
resource: data.value,
hasMore:data.value.data?.next!=null ,
hasMore: data.value.data?.next != null,
padding: EdgeInsets.fromLTRB(8, 8, 8, 80),
itemBuilder: (context, index) {
var item = data.value.data!.results![index];
@@ -356,17 +356,10 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
},
),
RTextField(
UnitTextField(
controller: controller.carcassWeightController,
label: 'وزن',
filled: true,
suffixIcon: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Assets.vec.killogramSvg.svg(),
),
filledColor: AppColor.bgLight,
keyboardType: TextInputType.number,
borderColor: AppColor.darkGreyLight,
hint: 'وزن',
unit: 'کیلوگرم',
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
SeparatorInputFormatter(),
@@ -589,10 +582,8 @@ class BuyOutOfProvincePage extends GetView<BuyOutOfProvinceLogic> {
},
height: 40,
),
],
),
);
}
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_auth/data/utils/safe_call.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';
@@ -75,10 +76,8 @@ class SegmentationLogic extends GetxController {
void clearForm() {
weightController.text = '0';
isSubmitButtonEnabled.value = false;
selectedProduct.value = null;
selectedSegment.value = null;
formKey.currentState?.reset();
}
void validateForm() {
@@ -142,6 +141,7 @@ class SegmentationLogic extends GetxController {
Future<void> deleteSegmentation(String key) async {
await safeCall(
showError: true,
call: () => rootLogic.chickenRepository.deleteSegmentation(
token: rootLogic.tokenService.accessToken.value!,
key: key,
@@ -152,6 +152,7 @@ class SegmentationLogic extends GetxController {
Future<bool> editSegment() async {
var res = true;
safeCall(
showError: true,
call: () async => await rootLogic.chickenRepository.editSegmentation(
token: rootLogic.tokenService.accessToken.value!,
model: SegmentationModel(

View File

@@ -17,7 +17,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
routes: controller.routesName,
onSearchChanged: (data) => controller.setSearchValue(data),
filteringWidget: filterBottomSheet(),
isBase: true,
hasBack: false,
widgets: [
Expanded(
child: ObxValue((data) {
@@ -41,7 +41,8 @@ class SegmentationPage extends GetView<SegmentationLogic> {
child: itemListWidget(item),
secondChild: itemListExpandedWidget(item, index),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.timerSvg.path,
labelIconColor: AppColor.customGrey,
labelIcon: Assets.vec.convertCubeSvg.path,
);
}, controller.isExpandedList);
},
@@ -51,11 +52,10 @@ class SegmentationPage extends GetView<SegmentationLogic> {
}, controller.segmentationList),
),
],
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
floatingActionButton: RFab.add(
onPressed: () {
//TODO
//Get.bottomSheet(addOrEditSaleBottomSheet(), isScrollControlled: true);
Get.bottomSheet(addOrEditBottomSheet(), isScrollControlled: true);
},
),
);
@@ -221,7 +221,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
Widget addOrEditBottomSheet([bool isOnEdit = false]) {
return BaseBottomSheet(
height: 500.h,
height: 300.h,
child: SingleChildScrollView(
child: Form(
key: controller.formKey,
@@ -244,18 +244,14 @@ class SegmentationPage extends GetView<SegmentationLogic> {
child: Column(
spacing: 12,
children: [
RTextField(
UnitTextField(
hint: 'وزن',
unit: 'کیلوگرم',
controller: controller.weightController,
label: 'وزن',
keyboardType: TextInputType.number,
borderColor: AppColor.darkGreyLight,
filledColor: AppColor.bgLight,
filled: true,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
SeparatorInputFormatter(),
],
validator: (value) {
if (value == null) {
return 'لطفاً وزن لاشه را وارد کنید';
@@ -295,13 +291,13 @@ class SegmentationPage extends GetView<SegmentationLogic> {
: null,
height: 40,
);
}, controller.isSaleSubmitButtonEnabled);
}, controller.isSubmitButtonEnabled);
}
Widget _productDropDown() {
return Obx(() {
return OverlayDropdownWidget<ProductModel>(
items: controller.rolesProductsModel,
items: controller.rootLogic.rolesProductsModel,
height: 56,
hasDropIcon: false,
background: Colors.white,
@@ -321,7 +317,7 @@ class SegmentationPage extends GetView<SegmentationLogic> {
Text(item?.name ?? 'انتخاب محصول'),
Spacer(),
Text(
'موجودی:${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByComma ?? 0}',
'موجودی: ${controller.rootLogic.inventoryModel.value?.totalRemainWeight.separatedByComma ?? 0} کیلوگرم',
),
],
),