View Freight Bill GRN Details

feature_dev_ankit
Ankit Sharma 2025-02-05 14:05:35 +05:30
commit e4ad29f845
27 changed files with 2247 additions and 2323 deletions

View File

@ -254,7 +254,7 @@
"languageVersion": "3.6"
}
],
"generated": "2025-02-05T07:53:21.908016Z",
"generated": "2025-02-05T08:21:07.654873Z",
"generator": "pub",
"generatorVersion": "3.6.1",
"flutterRoot": "file:///C:/src/flutter/flutter",

View File

@ -194,7 +194,7 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
message: widget.itemLabel(item),
child: Text(
widget.itemLabel(item),
style: 12.txtSBoldGrey,
style: 11.txtSBoldGrey,
),
),
onTap: () => _selectItem(item),
@ -278,9 +278,16 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
selectedItem != null
? widget.itemLabel(selectedItem as T)
: widget.hintText,
style: 12.txtSBoldGrey,
style: 11.txtSBoldGrey,
overflow: TextOverflow.ellipsis,
),
// Text(
// selectedItem != null
// ? widget.itemLabel(selectedItem as T)
// : widget.hintText,
// style: 12.txtSBoldGrey,
// overflow: TextOverflow.ellipsis,
// ),
),
const Icon(
Icons.keyboard_arrow_down_outlined,

View File

@ -4,10 +4,15 @@ import 'package:shayog/components/styles/textStyles.dart';
DataCell editableCell(int index, String? value,
{bool isLink = false, VoidCallback? onTap}) {
return DataCell(
GestureDetector(
onTap: isLink && onTap != null ? onTap : null,
child: Container(
alignment: Alignment.center,
child: MouseRegion(
cursor: isLink ? SystemMouseCursors.click : SystemMouseCursors.basic,
child: Center(
child: Text(
value ?? "",
textAlign: TextAlign.center,
@ -16,6 +21,9 @@ DataCell editableCell(int index, String? value,
),
),
),
),
),
);
}

View File

@ -14,7 +14,9 @@ class InputField extends StatelessWidget {
this.onFieldSubmitted,
this.validator,
this.edgesInsects,
this.underLineBorder,this.maxLength});
this.errorTxtColor,
this.underLineBorder,
this.maxLength});
String? title;
OutlineInputBorder? underLineBorder;
@ -25,6 +27,8 @@ class InputField extends StatelessWidget {
List<TextInputFormatter>? inputFormatter;
EdgeInsets? edgesInsects;
int? maxLength;
Color? errorTxtColor;
var inputBorder = OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide: BorderSide(color: AppColors.clrGrey));
@ -36,9 +40,9 @@ class InputField extends StatelessWidget {
Widget build(BuildContext context) {
return TextFormField(
controller: controller,
contextMenuBuilder: (context, editableTextState) {
return Container(height: 0, color: Colors.transparent);
},
// contextMenuBuilder: (context, editableTextState) {
// return Container(height: 0, color: Colors.transparent);
// },
style: 12.txtSBoldBlack,
maxLength: maxLength,
decoration: InputDecoration(counterText: '',
@ -60,8 +64,8 @@ class InputField extends StatelessWidget {
labelStyle: 12.txtSBoldGrey,
fillColor: AppColors.clrD9,
errorStyle: TextStyle(
fontSize: 10.0,
// errorText: "",
errorStyle: TextStyle(fontSize: 10.0, color: errorTxtColor
// height: 0.2,
),
),

View File

@ -10,4 +10,5 @@ static Color clrF2 = Color(0xffF2F2F2);
static Color black = Color(0xff000000);
static Color white = Color(0xffFFFFFF);
static Color green = Color(0xff10A711);
static Color red = Colors.red;
}

View File

@ -27,6 +27,7 @@ extension TextStyles on num{
TextStyle get txtSBoldGrey => _textStyle(this,AppColors.darkGrey,Family.semiBold);
TextStyle get txtSBoldBlue => _textStyle(this,AppColors.primaryClr,Family.semiBold);
TextStyle get txtSBoldRed => _textStyle(this,Colors.red,Family.semiBold);
TextStyle get txtTransparent => _textStyle(this,Colors.transparent,Family.semiBold);
TextStyle get txtSBoldWhite => _textStyle(this,Colors.white,Family.semiBold);

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:shayog/components/common/common_button.dart';
import 'package:shayog/components/styles/textStyles.dart';
import 'package:shayog/feature/presentation/widgets/text_view.dart';
import '../../../../../../components/common/common_btn.dart';
import '../../../../../../components/common/custom_drop_down.dart';
@ -20,48 +21,21 @@ class AddInternalUser extends StatelessWidget {
return Container(
padding: EdgeInsets.all(16),
color: AppColors.clrF2,
child: Stack(
child: allData(),
);
}
allData() {
return Column(
children: [
Form(
key: controller.formKey,
//autovalidateMode: AutovalidateMode.onUserInteraction,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Obx(
// () => Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// CustomDropdown<String>(
// items: ['Item 1', 'Item 2', 'Item 3'],
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// controller.selectedItem.value = selected;
// }
// },
// hintText: 'Select an item',
// ),
// controller.showE.value == true &&
// controller.selectedItem.value == ''
// ? Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// const SizedBox(
// height: 4,
// ),
// Text(
// 'Please Select an option',
// style: TextStyle(
// color: Colors.red, fontSize: 10),
// ),
// ],
// )
// : Text(''),
// ],
// ),
// ),
Row(
children: [
Expanded(
@ -70,10 +44,11 @@ class AddInternalUser extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(
text: AppStrings.firstName,isRequired: true,
text: AppStrings.firstName,
isRequired: true,
),
SizedBox(height: 8),
InputField(
errorTxtColor: controller.errorTextColor,
validator: Validations.checkValidations,
controller: controller.nameCtrl,
title: AppStrings.enterFirstName,
@ -87,10 +62,11 @@ class AddInternalUser extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(
text: AppStrings.lastName,isRequired: true,
text: AppStrings.lastName,
isRequired: true,
),
SizedBox(height: 8),
InputField(
errorTxtColor: controller.errorTextColor,
validator: Validations.checkValidations,
controller: controller.lastNCtrl,
title: AppStrings.enterLastName,
@ -104,10 +80,11 @@ class AddInternalUser extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(
text: AppStrings.employeeCode,isRequired: true,
text: AppStrings.employeeCode,
isRequired: true,
),
SizedBox(height: 8),
InputField(
errorTxtColor: controller.errorTextColor,
validator: Validations.checkValidations,
controller: controller.employeeCodeCtrl,
title: AppStrings.enterEmployeeCode,
@ -116,11 +93,10 @@ class AddInternalUser extends StatelessWidget {
)),
],
),
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Row(
SizedBox(height:8 ),
Row(
children: [
Expanded(
Flexible(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -142,6 +118,15 @@ class AddInternalUser extends StatelessWidget {
},
hintText: 'Select User Type',
),
Obx(() => controller.validateAdduser.value == true ?
TextView(
margin: EdgeInsets.only(top: 4),
text: "Required",
style: 10.txtTransparent,
) :
SizedBox.shrink(
))
],
)),
SizedBox(width: 16),
@ -155,7 +140,8 @@ class AddInternalUser extends StatelessWidget {
),
SizedBox(height: 8),
CustomDropdown(
initialValue: controller.status[0],
//initialValue: controller.status[0],
initialValue: "Active",
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.status,
@ -166,6 +152,16 @@ class AddInternalUser extends StatelessWidget {
}
},
hintText: 'Active'),
Obx(() => controller.validateAdduser.value == true ?
TextView(
margin: EdgeInsets.only(top: 4),
text: "Required",
style: 10.txtTransparent,
) :
SizedBox.shrink(
))
],
)),
SizedBox(width: 16),
@ -175,10 +171,12 @@ class AddInternalUser extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(
text: AppStrings.emailAddress,isRequired: true,
text: AppStrings.emailAddress,
isRequired: true,
),
SizedBox(height: 8),
InputField(
errorTxtColor: controller.errorTextColor,
validator: Validations.checkEmailValidations,
controller: controller.emailCtrl,
title: AppStrings.enterEmailAddress,
@ -187,12 +185,9 @@ class AddInternalUser extends StatelessWidget {
)),
],
),
),
Padding(
padding: const EdgeInsets.only(top: 16.0, bottom: 8),
child: TextView(
text: AppStrings.mobileNo,isRequired: true,
),
TextView(
text: AppStrings.mobileNo,
isRequired: true,
),
Row(
children: [
@ -200,6 +195,7 @@ class AddInternalUser extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.only(right: 8.0),
child: InputField(
errorTxtColor: controller.errorTextColor,
maxLength: 10,
validator: Validations.checkPhoneValidations,
controller: controller.mobileCtrl,
@ -231,26 +227,7 @@ class AddInternalUser extends StatelessWidget {
clickAction: () {
controller.createUser();
}
// if(controller.formKey.currentState!.validate()){
// controller.createUser();
// } else {
// controller.validatePlants.value == true;
//
// }
// if (controller.formKey.currentState
// ?.validate() ??
// false) {
// ScaffoldMessenger.of(context)
// .showSnackBar(
// SnackBar(
// content: Text(
// 'Form submitted successfully!')),
// );
// controller.createUser();
// } else {
// controller.showE.value = true;
// }
// }
)
: CommonButton(
height: 30,
@ -272,7 +249,6 @@ class AddInternalUser extends StatelessWidget {
),
),
],
),
);
}
}

View File

@ -10,11 +10,17 @@ import '../../../../../components/styles/app_colors.dart';
import '../../../../../components/styles/app_strings.dart';
import '../../transporter/widgets/common_card.dart';
class InternalUserRoleMapping extends StatelessWidget {
InternalUserRoleMapping({super.key});
class InternalUserRoleMapping extends StatefulWidget {
const InternalUserRoleMapping({super.key});
@override
State<InternalUserRoleMapping> createState() => _InternalUserRoleMappingState();
}
class _InternalUserRoleMappingState extends State<InternalUserRoleMapping> {
final ctrl = Get.put(DashboardCtrl());
@override
Widget build(BuildContext context) {
return Obx(() {
@ -29,6 +35,8 @@ class InternalUserRoleMapping extends StatelessWidget {
color: Colors.white,
child: Column(
children: [
Container(
color: AppColors.clrF2,
child: Padding(
@ -54,16 +62,22 @@ class InternalUserRoleMapping extends StatelessWidget {
onSelected: (selected) {
if (selected != null) {
ctrl.selectedEmpCode.value = selected;
}
},
hintText: "Select Employee Code",
),
SizedBox(height: 5),
ctrl.validateRoleMapCode.value == true ? TextView(
ctrl.validateRoleEmail.value == true ? TextView(
text: "Required",
style: 10.txtSBoldRed,
style: 10.txtTransparent,
) : TextView(
text: "ABC",
style: 10.txtTransparent,
),
) : SizedBox.shrink(),
],
)),
SizedBox(width: 16),
@ -85,6 +99,7 @@ class InternalUserRoleMapping extends StatelessWidget {
onSelected: (selected) {
if (selected != null) {
ctrl.selectedEmail.value = selected;
ctrl.validateRoleEmail.value = false;
}
},
hintText: "Select Email",
@ -94,7 +109,11 @@ class InternalUserRoleMapping extends StatelessWidget {
text: "Required",
style: 10.txtSBoldRed,
) : SizedBox.shrink(),
) : TextView(
text: "ABC",
style: 10.txtTransparent,
),
],
)),
SizedBox(width: 16),
@ -122,12 +141,12 @@ class InternalUserRoleMapping extends StatelessWidget {
width: 100,
text: AppStrings.submit,
clickAction: () {
if(ctrl.selectedEmail.value == "Select Email" ||ctrl.selectedEmpCode.value == "Select Employee Code" ){
if(ctrl.selectedEmail.value == "Select Email" ){
ctrl.validateRoleEmail.value = true;
ctrl.validateRoleMapCode.value = true;
} else{
ctrl.validateRoleEmail.value = false;
ctrl.validateRoleMapCode.value = false;
ctrl.getRoleMappingData();
}
@ -226,11 +245,12 @@ class InternalUserRoleMapping extends StatelessWidget {
clickAction: () {},
),
SizedBox(width: 16),
CommonButton(
borderRadius: 4,
height: 30,
width: 100,
text: AppStrings.submit,
text: AppStrings.save,
clickAction: () {
CommonAlertDialog.showDialog(

View File

@ -4,6 +4,7 @@ import 'package:intl/intl.dart';
import 'package:shayog/components/styles/textStyles.dart';
import '../../../../../components/common/common_btn.dart';
import '../../../../../components/common/common_button.dart';
import '../../../../../components/common/custom_drop_down.dart';
import '../../../../../components/common/data_cell.dart';
import '../../../../../components/common/input_field.dart';
import '../../../../../components/styles/app_colors.dart';
@ -26,160 +27,142 @@ class ManageUser extends StatelessWidget {
Obx(
() => controller.isSelected.value
? Container(
margin: EdgeInsets.symmetric(vertical: 16),
// margin: EdgeInsets.symmetric(vertical: 16),
padding: EdgeInsets.all(16),
color: AppColors.clrF2,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(
text: "User Name",
),
SizedBox(height: 8),
InputField(
title: "Enter User Name",
controller: controller.nameCtrl),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value =
// selected;
// }
// },
// hintText: 'Select Plant'),
CustomDropdown(
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.userNames,
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectUser.value =
selected;
}
},
hintText: 'Select UserName'),
],
)),
SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(
text: "User Type",
),
SizedBox(height: 8),
InputField(
title: "Enter User Type",
controller: controller.userTypeCtrl),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.freightBillList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedFreight.value =
// selected;
// }
// },
// hintText: 'Select Freight Number'),
CustomDropdown(
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.userTypesNames,
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectType.value =
selected;
}
},
hintText: 'Select User Type'),
],
)),
SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(
text: "Email Address",
),
SizedBox(height: 8),
InputField(
title: "Enter Email Address",
controller: controller.emailCtrl),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value =
// selected;
// }
// },
// hintText: 'Select Product'),
CustomDropdown(
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.userEmail,
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectEmail.value =
selected;
}
},
hintText: 'Select Email Address'),
],
)),
],
),
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Row(
SizedBox(height: 8),
Row(
children: [
Expanded(
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(
text: "Employee/Transporter Code",
),
SizedBox(height: 8),
InputField(
title: "Enter Employee Code",
controller: controller.employeeCodeCtrl),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value =
// selected;
// }
// },
// hintText: 'Select Product'),
CustomDropdown(
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.userEmpCode,
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectCode.value =
selected;
}
},
hintText: 'Select Employer Code'),
],
)),
SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(
text: "Status",
),
SizedBox(height: 8),
InputField(
title: "Enter Status",
controller: controller.statusCtrl),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value =
// selected;
// }
// },
// hintText: 'Select Product'),
CustomDropdown(
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.userStatus,
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectUserStatus.value =
selected;
}
},
hintText: 'Select Status'),
],
)),
SizedBox(width: 16),
@ -191,14 +174,14 @@ class ManageUser extends StatelessWidget {
),
SizedBox(height: 8),
Row(
mainAxisAlignment:
MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
CommonBtn(
bkClr: Colors.white,
text: AppStrings.cancel,
clickAction: () {
controller.isSelected.value = false;
controller.clearUserData();
},
),
SizedBox(width: 16),
@ -209,7 +192,7 @@ class ManageUser extends StatelessWidget {
text: AppStrings.submit,
textStyle: 14.txtSBoldWhite,
clickAction: () {
controller.isSelected.value = false;
//controller.isSelected.value = false;
controller.getManageUser();
controller.getAllUser();
},
@ -221,7 +204,6 @@ class ManageUser extends StatelessWidget {
),
],
),
),
],
),
)
@ -236,25 +218,30 @@ class ManageUser extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Scrollbar(
Container(
margin: EdgeInsets.only(bottom: 16, top: 16),
height: MediaQuery.of(context).size.height * 0.4,
child: RawScrollbar(
thumbColor: AppColors.clrD9,
radius: Radius.circular(2),
trackVisibility: true,
thumbVisibility: true,
thickness: 14,
controller: controller.verticalScrollController,
child: SingleChildScrollView(
controller: controller.verticalScrollController,
child: Scrollbar(
child: RawScrollbar(
thumbColor: AppColors.clrD9,
radius: Radius.circular(2),
thickness: 14,
trackVisibility: true,
thumbVisibility: true,
controller: controller.horizontalScrollController,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: controller.horizontalScrollController,
child: Container(
margin: EdgeInsets.only(top: 16),
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey.shade400,
width: 1.0,
),
),
margin: EdgeInsets.only(bottom: 24, right: 24),
child: DataTable(
dataRowHeight: 28,
headingRowHeight: 40,
@ -284,27 +271,30 @@ class ManageUser extends StatelessWidget {
dataColumn("Action"),
],
rows: List<DataRow>.generate(
controller.getAllUser.length, (index) {
final stoppage = controller.getAllUser[index];
controller.getAllUserMain.length, (index) {
final stoppage = controller.getAllUserMain[index];
return DataRow(
selected: stoppage.isSelected,
// onSelectChanged: (value) {
// controller.toggleSelection(index, value ?? false);
// },
cells: [
// editableCell(index, ""
// "${index + 1}"),
editableCell(index, stoppage.userName ?? "-"),
editableCell(index, stoppage.userEmail ?? "-"),
editableCell(
index, stoppage.userEmail ?? "-"),
editableCell(
index, stoppage.userEmpTransCode ?? "-"),
editableCell(index, stoppage.userMobile ?? "-"),
editableCell(
index, stoppage.userMobile ?? "-"),
editableCell(
index, stoppage.usertypeName ?? "-"),
editableCell(
index, stoppage.createdBy.toString()),
editableCell(index, DateFormat("d MMMM yyyy").format(DateTime.parse('${stoppage.createdOn}'))),
editableCell(
index,
DateFormat("d MMMM yyyy").format(
DateTime.parse(
'${stoppage.createdOn}'))),
editableCell(
index, stoppage.lastUpdatedBy.toString()),
editableCell(
@ -312,9 +302,11 @@ class ManageUser extends StatelessWidget {
DateFormat("d MMMM yyyy").format(
DateTime.parse(
'${stoppage.lastUpdatedOn}'))),
editableCell(index, stoppage.status =="A"?"Active":"In-Active"),
editableCell(
index,
stoppage.status == "A"
? "Active"
: "In-Active"),
DataCell(CommonBtn(
style: 8.txtSBoldWhite,
margin: EdgeInsets.symmetric(vertical: 6),
@ -351,14 +343,11 @@ class ManageUser extends StatelessWidget {
),
),
),
SizedBox(height: 16),
),
],
);
}),
CustomPagination(
currentPage: controller.currentPage.value,
totalPages: controller.totalPages.value,
@ -366,7 +355,6 @@ class ManageUser extends StatelessWidget {
controller.onPageChanged(page);
},
),
],
);
}

View File

@ -34,7 +34,7 @@ class UserPlantMapping extends StatelessWidget {
children: [
TextView(
text: "Employee/Transporter Code",
style: 13.txtBoldBlack,
isRequired: true,
),
SizedBox(height: 8),
@ -52,11 +52,16 @@ class UserPlantMapping extends StatelessWidget {
hintText: 'Select Employee Code',
),
SizedBox(height: 5),
ctrl.validatePlantCode.value == true ? TextView(
ctrl.validatePlantEmail.value == true ? TextView(
text: "Required",
style: 10.txtSBoldRed,
style: 10.txtTransparent,
) : TextView(
text: "ABC",
style: 10.txtTransparent,
),
) : SizedBox.shrink(),
],
)),
@ -69,7 +74,7 @@ class UserPlantMapping extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text:
"Email Address",style:13.txtBoldBlack,isRequired: true,
"Email Address",isRequired: true,
),
SizedBox(height: 8),
CustomDropdown(
@ -89,7 +94,11 @@ class UserPlantMapping extends StatelessWidget {
text: "Required",
style: 10.txtSBoldRed,
) : SizedBox.shrink(),
) : TextView(
text: "ABC",
style: 10.txtTransparent,
),
],
)),
@ -121,20 +130,18 @@ class UserPlantMapping extends StatelessWidget {
text: AppStrings.submit,
clickAction: () {
if(ctrl.selectPlantEmail.value == "Select Email" ||ctrl.selectedCode.value == "Select Employee Code" ){
if(ctrl.selectPlantEmail.value == "Select Email"){
ctrl.validatePlantEmail.value = true;
ctrl.validatePlantCode.value = true;
} else{
ctrl.validatePlantEmail.value = false;
ctrl.validatePlantCode.value = false;
ctrl.getPlantMapping();
}
},
// clickAction: () {
// ctrl.checkPlants();
// },
),
],
),
@ -179,9 +186,9 @@ class UserPlantMapping extends StatelessWidget {
value ?? false);
},
activeColor: AppColors.primaryClr,
// Custom color when selected
checkColor: Colors.white,
// Custom color for check mark
materialTapTargetSize: MaterialTapTargetSize
.shrinkWrap,
),
@ -236,7 +243,7 @@ class UserPlantMapping extends StatelessWidget {
clickAction: () {
CommonAlertDialog.showDialog(
message: 'Are you sure you want to do this action?',
positiveText: "Submit",
positiveText: "Save",
negativeBtCallback: () {
Get.back();
},

View File

@ -1,12 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:shayog/components/common/input_field.dart';
import 'package:shayog/components/styles/textStyles.dart';
import 'package:shayog/feature/presentation/screens/admin/user_management/user_plant_mapping.dart';
import 'package:shayog/feature/presentation/widgets/text_view.dart';
import '../../../../../components/common/common_btn.dart';
import '../../../../../components/common/common_button.dart';
import '../../../../../components/styles/app_colors.dart';
import '../../../../../components/styles/app_images.dart';
import '../../../../../components/styles/app_strings.dart';
@ -24,9 +20,7 @@ class UserScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: [
Container(
child: Container(
padding: EdgeInsets.only(bottom: 16),
margin: EdgeInsets.all(16),
child: Column(
@ -47,8 +41,13 @@ class UserScreen extends StatelessWidget {
ctrl.selectedUser.value = index;
ctrl.clearPrefillData();
ctrl.isSelected.value = false;
ctrl.validateRoleEmail.value = false;
ctrl.validatePlantEmail.value = false;
if (ctrl.selectedUser.value == 0) {
print("fhudsfh");
ctrl.getManageUser();
}
if (ctrl.selectedUser.value == 2) {
@ -76,10 +75,7 @@ class UserScreen extends StatelessWidget {
child: TextView(
text: ctrl.userTabs[index].title ?? "",
style: 12.txtBoldWhite,
// style: TextStyle(
// fontSize: 12,
// fontWeight: FontWeight.w900,
// color: Colors.white),
),
),
),
@ -138,209 +134,6 @@ class UserScreen extends StatelessWidget {
],
),
),
Obx(
() => ctrl.isSelected.value
? Container(
margin: EdgeInsets.symmetric(vertical: 16),
padding: EdgeInsets.all(16),
color: AppColors.clrF2,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
TextView(
text: "User Name",
),
SizedBox(height: 8),
InputField(
title: "Enter User Name",
controller: ctrl.nameCtrl),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value =
// selected;
// }
// },
// hintText: 'Select Plant'),
],
)),
SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
TextView(
text: "User Type",
),
SizedBox(height: 8),
InputField(
title: "Enter User Type",
controller: ctrl.userTypeCtrl),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.freightBillList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedFreight.value =
// selected;
// }
// },
// hintText: 'Select Freight Number'),
],
)),
SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
TextView(
text: "Email Address",
),
SizedBox(height: 8),
InputField(
title: "Enter Email Address",
controller: ctrl.emailCtrl),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value =
// selected;
// }
// },
// hintText: 'Select Product'),
],
)),
],
),
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Row(
children: [
Expanded(
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
TextView(
text: "Employee/Transporter Code",
),
SizedBox(height: 8),
InputField(
title: "Enter Employee Code",
controller: ctrl.employeeCodeCtrl),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value =
// selected;
// }
// },
// hintText: 'Select Product'),
],
)),
SizedBox(width: 16),
Expanded(
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
TextView(
text: "Status",
),
SizedBox(height: 8),
InputField(
title: "Enter Status",
controller: ctrl.statusCtrl),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value =
// selected;
// }
// },
// hintText: 'Select Product'),
],
)),
SizedBox(width: 16),
Expanded(
child: Column(
children: [
TextView(
text: "",
),
SizedBox(height: 8),
Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: [
CommonBtn(
bkClr: Colors.white,
text: AppStrings.cancel,
clickAction: () {
ctrl.isSelected.value = false;
},
),
SizedBox(width: 16),
CommonButton(
borderRadius: 4,
width: 100,
height: 30,
text: AppStrings.submit,
textStyle: 14.txtSBoldWhite,
clickAction: () {
ctrl.isSelected.value = false;
ctrl.getAllUser();
},
),
],
),
],
),
),
],
),
),
],
),
)
: SizedBox(),
),
Obx(() {
switch (ctrl.selectedUser.value) {
case 0:
@ -357,8 +150,6 @@ class UserScreen extends StatelessWidget {
}),
],
),
)
],
),
);
}

View File

@ -28,7 +28,9 @@ class UserType extends StatelessWidget {
color: AppColors.clrF2,
child: Row(
children: [
Expanded(
Expanded(child: SizedBox(
// color: Colors.pink,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -38,19 +40,18 @@ class UserType extends StatelessWidget {
),
SizedBox(height: 8),
InputField(
controller: controller.userTypeCtrl,
title: "Enter User Type",
),
SizedBox(height: 5),
controller.validateUserType.value == true ? TextView(
text: "Required",
style: 10.txtSBoldRed,
) : SizedBox.shrink(),
],
),
)),
SizedBox(width: 16),
Expanded(
Expanded(child: SizedBox(
// color: Colors.green,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -72,24 +73,20 @@ class UserType extends StatelessWidget {
}
},
hintText: 'Select Status'),
SizedBox(height: 5),
controller.validateUserType.value == true ? TextView(
text: "Required",
style: 10.txtSBoldRed,
) : SizedBox.shrink(),
],
),
)),
SizedBox(width: 16),
Expanded(
//flex: 2,
Expanded(child: SizedBox(
height: 100,
child: Column(
children: [
TextView(text:
"",
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
padding: const EdgeInsets.only(top: 18.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
@ -108,15 +105,8 @@ class UserType extends StatelessWidget {
clickAction: () {
if(controller.userTypeCtrl.text.isEmpty ||controller.selectStatus.value == "Select Status" ){
controller.validateUserStatus.value = true;
controller.validateUserType.value = true;
} else{
controller.validateUserStatus.value = false;
controller.validateUserType.value = false;
controller.createUserType();
}
},
),
@ -124,9 +114,10 @@ class UserType extends StatelessWidget {
),
),
],
),
))
],
),
)
),
),
Container(

View File

@ -1,4 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:shayog/components/styles/app_images.dart';
import 'package:shayog/feature/presentation/screens/admin/user_management/model/select_assign_role_model/select_assign_role_model.dart';
@ -41,12 +42,20 @@ class DashboardCtrl extends GetxController {
RxBool isSelected = false.obs;
RxString selectedItem = ''.obs;
@override
void onClose() {
verticalScrollController.dispose();
horizontalScrollController.dispose();
super.onClose();
}
void toggleContainer() {
isSelected.value = true;
print("isSelected.value..${isSelected.value}");
}
String? validateDropdown(String? value) {
print('data');
if (value == null || value.isEmpty) {
return 'Please select an item';
}
@ -85,7 +94,7 @@ class DashboardCtrl extends GetxController {
@override
void onInit() {
getManageUser();
getDropDownData();
getPlantEmailCode();
getEmailCodeOfRoleMapping();
userTypeDetails();
super.onInit();
@ -95,27 +104,63 @@ class DashboardCtrl extends GetxController {
RxInt currentPage = 1.obs; // Current page being viewed
RxInt totalPages = 1.obs; // Total number of pages from the API
RxList<AllUser> getAllUser = <AllUser>[].obs;
final int limit = 20;
RxList<AllUser> getAllUserMain = <AllUser>[].obs;
RxInt limit = 20.obs;
var userLoading = false.obs;
setNextPage() {
if (currentPage.value < totalPages.value.toInt()) {
currentPage.value++;
getManageUser();
}
}
setPrevPage() {
if (currentPage.value > 1) {
currentPage.value--;
getManageUser();
}
}
var userNames =[].obs;
var userTypesNames =[].obs;
var userEmpCode =[].obs;
var userEmail =[].obs;
var selectUser = "Select User Name".obs;
var selectEmail = "Select Email".obs;
var selectCode = "Select Employee Code".obs;
var selectType = "Select UserType".obs;
getManageUser() async {
try {
userLoading.value = true;
Map<String, String> requestBody = {
"userName": "",
"userTypeName": "",
"email": "",
"employeeTransCode": "",
"status": ""
"userName": selectUser.value == "Select User Name" ? "" : selectUser.value,
"userTypeName": selectType.value == "Select UserType" ? "" : selectType.value,
"Email": selectEmail.value == "Select Email" ?"": selectEmail.value,
"EmployeeTransCode":
selectCode.value == "Select Employee Code" ? "" : selectCode.value,
"status": selectUserStatus.value == "Select Status"
? ""
: selectUserStatus.value == "Active"
? "A"
: "I",
};
var response =
await PostRequests.getAllUser(requestBody, currentPage.value, limit);
await PostRequests.getAllUser(requestBody, currentPage.value);
if (response != null) {
List<AllUser> flattenedContent =
response.content!.expand((list) => list).toList();
getAllUser.assignAll(flattenedContent);
getAllUserMain.assignAll(flattenedContent);
for (var i = 0; i < flattenedContent.length; i++) {
userTypesNames.add(flattenedContent[i].usertypeName);
userNames.add(flattenedContent[i].userName);
userEmpCode.add(flattenedContent[i].userEmpTransCode);
userEmail.add(flattenedContent[i].userEmail);
}
totalPages.value = response.totalPages!;
print("getAllUser>>>>>${getAllUser.length}");
}
@ -123,24 +168,31 @@ class DashboardCtrl extends GetxController {
userLoading.value = false;
}
}
clearUserData(){
selectUser.value = "Select User Name";
selectEmail.value = "Select Email";
selectCode.value = "Select Employee Code";
selectType.value = "Select UserType";
selectedStatus.value = "Select Status";
getManageUser();
}
void nextPage() {
if (currentPage.value < totalPages.value) {
currentPage.value++;
getManageUser(); // Fetch data for the next page
getManageUser();
}
}
void previousPage() {
if (currentPage.value > 1) {
currentPage.value--;
getManageUser(); // Fetch data for the previous page
getManageUser();
}
}
void onPageChanged(int page) {
currentPage.value = page;
getManageUser(); // Fetch data for the selected page
getManageUser();
}
//********************************edit User****************************//
@ -166,7 +218,6 @@ class DashboardCtrl extends GetxController {
getManageUser();
getAllUser.refresh();
//employeeCodeCtrl.clear();
}
// employeeCodeCtrl.clear();
selectedUser.value = 0;
@ -183,9 +234,14 @@ class DashboardCtrl extends GetxController {
var selectedStatus = 'Select Status'.obs;
var selectedValue = 'Select User Type'.obs;
Color errorTextColor = Colors.red;
void createUser() {
if (formKey.currentState!.validate()) {
validateAdduser.value = false;
addInternalUser();
} else {
validateAdduser.value = true;
}
}
@ -216,6 +272,8 @@ class DashboardCtrl extends GetxController {
onclick: () {
Get.back();
getManageUser();
getEmailCodeOfRoleMapping();
getPlantEmailCode();
clearPrefillData();
selectedUser.value = 0;
});
@ -286,29 +344,21 @@ class DashboardCtrl extends GetxController {
var userTypeData = <UserTypeData>[].obs;
var userTypeStatus = ['Active', 'In-Active'];
var selectStatus = 'Select Status'.obs;
clearUserType() {
userTypeCtrl.text.isEmpty;
selectedStatus.value.isEmpty;
}
// addUserType() {
// if (userTypeCtrl.text.isEmpty || selectedStatus.value == "") {
// CommonDialog.showDialog(
// message: "Select all mandatory fields",
// onclick: () {
// Get.back();
// });
// } else {
// createUserType();
// }
// }
var selectUserStatus = "Select Status".obs;
var userStatus = ["Active", "In-Active"];
createUserType() async {
try {
userTypeLoading.value = true;
Map<String, String> requestBody = {
"userTypeName": userTypeCtrl.text,
"status": selectStatus.value == "Active" ? "A" : "I",
"status": selectUserStatus.value == "Active" ? "A" : "I",
"createdBy": "0",
"lastUpdatedBy": "0"
};
@ -330,7 +380,7 @@ class DashboardCtrl extends GetxController {
var employeeCode = [].obs;
var userEmails = [].obs;
getDropDownData() async {
getPlantEmailCode() async {
try {
dropDownLoader.value = true;
@ -348,31 +398,19 @@ class DashboardCtrl extends GetxController {
var plantMappingLoader = false.obs;
RxList<PlantsData> plantMapping = <PlantsData>[].obs;
clearPlants() {
selectPlantEmail.value.isEmpty;
selectPlantCode.value.isEmpty;
}
checkPlants() {
if (selectPlantEmail.value == "Select Email" ||
selectPlantCode.value == "Select Employee Code") {
CommonDialog.showDialog(
message: "Select all mandatory fields",
onclick: () {
Get.back();
});
} else {
getPlantMapping();
}
}
clearRoleMapping() {
selectedEmail.value.isEmpty;
selectedEmpCode.value.isEmpty;
}
getPlantMapping() async {
try {
plantMappingLoader.value = true;
@ -386,7 +424,6 @@ class DashboardCtrl extends GetxController {
plantMapping.value = response.data!;
showPlantRolesSection.value = true;
}
} finally {
plantMappingLoader.value = false;
}
@ -396,7 +433,9 @@ class DashboardCtrl extends GetxController {
RxList<InternalRoleMappingData> roleMappingData =
<InternalRoleMappingData>[].obs;
var fetchEmailsNCodesLoading = false.obs;
var statusMessage = "".obs;
// roleMappingEmailCode
getRoleMappingData() async {
try {
fetchEmailsNCodesLoading.value = true;
@ -404,11 +443,15 @@ class DashboardCtrl extends GetxController {
"email": selectedEmail.value,
"employeeTransCode": selectedEmpCode.value,
};
var response = await PostRequests.fetchEmailsAndEmpCodes(requestBody);
var response = await PostRequests.fetchEmailsAndEmpCodes(requestBody,statusMessage.value);
if (response != null) {
print('fetch role desc ${response.data?.length}');
roleMappingData.value = response.data!;
showRolesSection.value = true;
} else {
//print("cdg");
// AppAlerts.alert(message: "sxjs");
}
} finally {
fetchEmailsNCodesLoading.value = false;
@ -534,10 +577,35 @@ class DashboardCtrl extends GetxController {
userTypeLoader.value = false;
}
}
RxBool validateRoleEmail = false.obs;
RxBool validateRoleMapCode = false.obs;
RxBool validatePlantEmail = false.obs;
RxBool validatePlantCode = false.obs;
RxBool validateUserStatus = false.obs;
RxBool validateUserType = false.obs;
RxBool validateAdduser = false.obs;
searchEmpCode(String enterValue) {
print('-----typing ---- ${enterValue}');
//List<AllChandlo> searchList = [];
List<AllUser> searchList = [];
if (enterValue.isEmpty) {
//searchList = getCndMain;
searchList = getAllUserMain;
} else {
searchList = getAllUserMain
.where((user) =>
user.usertypeName!.toLowerCase().contains(enterValue.toLowerCase()))
.toList();
}
getAllUser.assignAll(searchList);
getAllUser.refresh();
for (var item in getAllUser) {
print('name :: ${item.usertypeName}');
}
}
RxString? validateEmail;
}

View File

@ -24,6 +24,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.white,
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: AppColors.secondaryClr,

View File

@ -5,6 +5,7 @@ import 'package:shayog/components/common/common_button.dart';
import 'package:shayog/components/styles/app_colors.dart';
import 'package:shayog/components/styles/textStyles.dart';
import 'package:shayog/feature/presentation/widgets/text_view.dart';
import 'package:shayog/services/model/generate_freight_model.dart';
import 'package:sizer/sizer.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
import 'package:vph_web_date_picker/vph_web_date_picker.dart';
@ -24,6 +25,10 @@ class GenerateFrightBill extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: [
Obx(
() => controller.isFilterVisibleGenerateFreight.value
? Column(
children: [
Container(
padding: EdgeInsets.all(16),
@ -34,34 +39,6 @@ class GenerateFrightBill extends StatelessWidget {
children: [
Row(
children: [
// Expanded(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// TextView(text:
// "Plant", isRequired: true,),
// SizedBox(height: 8),
// CustomDropdown(
//
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: controller.plant,
// itemLabel: (item) => "${item.plantCode}-${item
// .plantDesc}",
// onSelected: (selected) {
// if (selected != null) {
// controller.selectPlant.value =
// selected.plantCode ?? "";
// print(
// "selectPlant${controller.selectPlant.value}");
// }
// },
// hintText: "Select Plant",
// ),
// ],
// ),
// ),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
@ -73,26 +50,29 @@ class GenerateFrightBill extends StatelessWidget {
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.plant,
itemLabel: (item) => "${item.plantCode}-${item.plantDesc}",
itemLabel: (item) =>
"${item.plantCode} - ${item.plantDesc}",
// Dropdown should show both
onSelected: (selected) {
if (selected != null) {
controller.selectPlant.value = selected.plantCode ?? "";
controller.showPlantError.value = false;
controller.selectPlantFreight.value =
selected.plantCode ?? "";
controller.showPlantErrorFreight
.value = false;
}
},
hintText: "Select Plant",
),
// Obx(() => controller.showPlantError.value
// ? Padding(
// padding: const EdgeInsets.only(top: 4),
// child: Text(
// 'Required',
// style: TextStyle(color: Colors.red, fontSize: 12),
// ),
// )
// : SizedBox.shrink()),
Obx(() =>
controller.showPlantErrorFreight.value
? Text(
'Required',
style: TextStyle(
color: Colors.red,
fontSize: 12),
)
: Text('')),
],
),
),
@ -102,34 +82,37 @@ class GenerateFrightBill extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text: "Product Name", isRequired: true),
TextView(
text: "Product Name",
isRequired: true,
),
SizedBox(height: 8),
CustomDropdown<dynamic>(
width: 250,
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.product,
itemLabel: (item) => "${item.materialCode}-${item
.materialDescription}",
itemLabel: (item) =>
"${item.materialCode}-${item.materialDescription}",
onSelected: (selected) {
if (selected != null) {
controller.selectProduct.value = selected;
controller.showProductError.value = false;
print("Updated product: ${controller.selectProductVal.value}"); // Debug print
controller.selectProductFreight
.value = selected.materialCode;
controller.showProductErrorFreight
.value = false;
}
},
hintText: "Select Product Name",
),
// Obx(() => controller.showProductError.value
// ? Padding(
// padding: const EdgeInsets.only(top: 4),
// child: Text(
// 'Required',
// style: TextStyle(color: Colors.red, fontSize: 12),
// ),
// )
// : SizedBox.shrink()),
Obx(() =>
controller.showProductErrorFreight.value
? Text(
'Required',
style: TextStyle(
color: Colors.red,
fontSize: 12),
)
: Text('')),
],
),
),
@ -139,7 +122,9 @@ class GenerateFrightBill extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text: "Transaction Type", isRequired: true),
TextView(
text: "Transaction Type",
isRequired: true),
SizedBox(height: 8),
CustomDropdown<String>(
backClr: AppColors.clrD9,
@ -148,46 +133,69 @@ class GenerateFrightBill extends StatelessWidget {
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectTransactionType.value = selected;
controller.showTransactionError.value = false;
print(
"selectTransactionType${controller
.selectTransactionType.value}");
controller
.selectTransactionTypeFreight
.value = selected;
controller.showTransactionErrorFreight
.value = false;
}
},
hintText: "Select Transaction Type",
),
// Obx(() => controller.showTransactionError.value
// ? Padding(
// padding: const EdgeInsets.only(top: 4),
// child: Text(
// 'Required',
// style: TextStyle(color: Colors.red, fontSize: 12),
// ),
// )
// : SizedBox.shrink()),
Obx(() => controller
.showTransactionErrorFreight.value
? Text(
'Required',
style: TextStyle(
color: Colors.red,
fontSize: 12),
)
: Text('')),
],
),
),
],
),
Padding(
padding: const EdgeInsets.only(top: 0, left: 0, right: 8),
padding: const EdgeInsets.only(
top: 16.0, left: 0, right: 8),
child: Row(
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
TextView(text: "MRN Date Range"),
Container(
margin: EdgeInsets.only(top: 8),
height: 35,
child: TextFormField(
key: controller.fromTextFieldKey,
controller: controller.fromController,
onTap: () async {
await _showDateRangePicker(context);
final pickedDate =
await showWebDatePicker(
width: 20.w,
context: controller
.fromTextFieldKey
.currentContext!,
initialDate:
controller.fromSelectedDate,
firstDate: DateTime(2000),
lastDate: DateTime.now(),
);
if (pickedDate != null) {
controller.fromSelectedDate =
pickedDate;
String formattedDate = controller
.getFormattedDate(pickedDate);
controller.fromController.text =
formattedDate;
controller.dateCheck.value = true;
}
},
decoration: InputDecoration(
fillColor: AppColors.clrD9,
@ -195,40 +203,52 @@ class GenerateFrightBill extends StatelessWidget {
hintText: 'Select MRN Date Range',
hintStyle: TextStyle(
fontSize: 12,
overflow: TextOverflow.ellipsis),
overflow:
TextOverflow.ellipsis),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.black),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.black),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.clrGrey),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.clrGrey),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.clrGrey),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.clrGrey),
),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.clrGrey),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.clrGrey),
),
suffixIcon: controller.dateCheck.value
suffixIcon: controller
.dateCheck.value
? InkWell(
onTap: () {
controller.dateCheck.value = false;
controller.fromController.clear();
controller.fromSelectedDate =
controller.dateCheck
.value = false;
controller.fromController
.clear();
controller
.fromSelectedDate =
DateTime.now();
},
child: Icon(Icons.close, size: 1.2.w),
child: Icon(Icons.close,
size: 1.2.w),
)
: null,
contentPadding: const EdgeInsets.symmetric(
horizontal: 12.0, vertical: 0.0),
contentPadding:
const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 0.0),
),
),
),
@ -239,7 +259,8 @@ class GenerateFrightBill extends StatelessWidget {
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
TextView(text: "From Location"),
SizedBox(height: 8),
@ -250,7 +271,8 @@ class GenerateFrightBill extends StatelessWidget {
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectLocation.value = selected;
controller.selectLocation.value =
selected;
}
},
hintText: "Select From Location",
@ -265,49 +287,53 @@ class GenerateFrightBill extends StatelessWidget {
//flex: 2,
child: Column(
children: [
TextView(text:
"",
TextView(
text: "",
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment:
MainAxisAlignment.end,
children: [
CommonBtn(
bkClr: Colors.white,
text: AppStrings.cancel,
clickAction: () {},
clickAction: () =>
controller.clearFiltersGenerateFreightBill(),
),
SizedBox(width: 16),
// CommonButton(
// borderRadius: 4,
// height: 30,
// width: 100,
// text: AppStrings.submit,
//
// clickAction: () {
// controller.postData();
// },
// ),
CommonButton(
borderRadius: 4,
height: 30,
width: 100,
text: AppStrings.submit,
clickAction: () {
controller.validateFields();
if (controller.showPlantError.value ||
controller.showProductError.value ||
controller.showTransactionError.value
) {
print('controller.showProductError.value ${controller.showProductError.value}');
} else {
controller.postData();
}
},
// clickAction: () {
// // controller.postData();
// controller.handleFilterSubmit();
// },
clickAction: () =>
controller.handleFilterSubmitGenerateFreight(),
),
// CommonButton(
// borderRadius: 4,
// height: 30,
// width: 100,
// text: AppStrings.submit,
// clickAction: () {
// controller.validateFields();
//
// if (controller.showPlantError.value ||
// controller.showProductError.value ||
// controller.showTransactionError.value
// ) {
// print('controller.showProductError.value ${controller.showProductError.value}');
//
// } else {
// controller.postData();
// }
// },
// ),
],
),
),
@ -319,6 +345,48 @@ class GenerateFrightBill extends StatelessWidget {
],
),
),
],
)
: SizedBox.shrink()
),
Obx(() {
if (controller.isLoading.value) {
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(
child: CircularProgressIndicator(
color: AppColors.primaryClr,
)));
}
if (controller.errorMessage.isNotEmpty) {
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(child: Text(controller.errorMessage.value)));
}
if (controller.grnDetails.isEmpty) {
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(
child: Text('No data available.'),
),
);
}
return
// controller.isFilterVisibleGenerateFreight.value == true
// ? SizedBox(
// height: MediaQuery.sizeOf(context).height /3,
// width: MediaQuery.sizeOf(context).width,
//
// child: Center(child: Text('No data available.')))
// :
Column(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 10),
margin: EdgeInsets.only(top: 16),
@ -326,7 +394,9 @@ class GenerateFrightBill extends StatelessWidget {
color: AppColors.primaryClr,
child: Row(
children: [
TextView(text: AppStrings.viewGrnDetails, style: 14.txtBoldWhite),
TextView(
text: AppStrings.viewGrnDetails,
style: 14.txtBoldWhite),
Spacer(),
CommonBtn(
width: 150,
@ -334,23 +404,24 @@ class GenerateFrightBill extends StatelessWidget {
borderClr: AppColors.primaryClr,
style: 12.txtBoldBlue,
text: "Generate Freight Bill",
// text: AppStrings.save,
clickAction: () {
bool hasSelectedRows = controller.grnDetails
.any((element) => element.isSelected);
if (!hasSelectedRows) {
showPopup(context: context, onClick: () {
showPopup(
context: context,
onClick: () {
Get.back();
});
} else {
CommonAlertDialog.showDialog(
message: "Are you sure want to\nsave this?",
message:
"Are you sure want to\nsave this?",
positiveText: "Save",
negativeText: "Cancel",
positiveBtCallback: () {
Get.back();
controller.addFreightBill();
showFreightBill(context);
},
negativeBtCallback: () {});
@ -359,19 +430,7 @@ class GenerateFrightBill extends StatelessWidget {
],
),
),
Obx(() {
if (controller.isLoading.value) {
return Center(child: CircularProgressIndicator());
}
if (controller.errorMessage.isNotEmpty) {
return Center(child: Text(controller.errorMessage.value));
}
if (controller.grnDetails.isEmpty) {
return Center(child: Text('No data available.'));
}
return Scrollbar(
Scrollbar(
thumbVisibility: true,
controller: controller.verticalScrollController,
child: SingleChildScrollView(
@ -390,12 +449,15 @@ class GenerateFrightBill extends StatelessWidget {
),
),
child: DataTable(
dataRowHeight: 28,
dataRowHeight: 40,
headingRowHeight: 40,
headingRowColor: WidgetStateProperty.all(AppColors.clrF2),
headingRowColor:
WidgetStateProperty.all(AppColors.clrF2),
border: TableBorder(
horizontalInside: BorderSide(color: AppColors.clrGrey),
verticalInside: BorderSide(color: AppColors.clrGrey),
horizontalInside:
BorderSide(color: AppColors.clrGrey),
verticalInside:
BorderSide(color: AppColors.clrGrey),
bottom: BorderSide(color: AppColors.clrGrey),
left: BorderSide(color: AppColors.clrGrey),
right: BorderSide(color: AppColors.clrGrey),
@ -435,8 +497,8 @@ class GenerateFrightBill extends StatelessWidget {
dataColumn(AppStrings.freightRate),
dataColumn(AppStrings.freightAmount),
],
rows: List<DataRow>.generate(controller.grnDetails.length,
(index) {
rows: List<DataRow>.generate(
controller.grnDetails.length, (index) {
final stoppage = controller.grnDetails[index];
return DataRow(
@ -455,44 +517,51 @@ class GenerateFrightBill extends StatelessWidget {
// Custom color when selected
checkColor: Colors.white,
// Custom color for check mark
materialTapTargetSize: MaterialTapTargetSize
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap, // Avoids large tap area
),
),
),
// editableCell(index, "0${index + 1}"),
editableCell(index, stoppage.grnNo ?? ""),
editableCell(index, stoppage.plantCode ?? ""),
editableCell(
index, stoppage.plantCode ?? ""),
editableCell(
index, stoppage.materialCode ?? ""),
editableCell(
index,
DateFormat('yyyy-MM-dd').format(
stoppage.grnDate ?? DateTime.now())),
stoppage.grnDate ??
DateTime.now())),
editableCell(
index, stoppage.fromLocation ?? ""),
editableCell(index, stoppage.vehicleNo ?? ""),
editableCell(
index, stoppage.vehicleNo ?? ""),
editableCell(index, stoppage.lrNo ?? ""),
editableCell(
index,
DateFormat('yyyy-MM-dd')
.format(
stoppage.lrDate ?? DateTime.now())),
editableCell(
index, stoppage.dispQty?.toString() ?? ""),
editableCell(
index, stoppage.netQty?.toString() ?? ""),
DateFormat('yyyy-MM-dd').format(
stoppage.lrDate ??
DateTime.now())),
editableCell(index,
stoppage.dispQty?.toString() ?? ""),
editableCell(index,
stoppage.netQty?.toString() ?? ""),
editableCell(
index,
stoppage.billingQty?.toString() ?? ""),
stoppage.billingQty?.toString() ??
""),
editableCell(
index,
stoppage.freightRate?.toString() ?? ""),
stoppage.freightRate?.toString() ??
""),
editableCell(
index,
stoppage.shipmentCost?.toString() ?? ""),
editableCell(
index, stoppage.statusId?.toString() ?? ""),
stoppage.shipmentCost?.toString() ??
""),
editableCell(index,
stoppage.statusId?.toString() ?? ""),
],
);
}),
@ -501,6 +570,8 @@ class GenerateFrightBill extends StatelessWidget {
),
),
),
),
],
);
}),
],

View File

@ -26,6 +26,8 @@ class PendingGeneration extends StatelessWidget {
Widget build(BuildContext context) {
return Column(
children: [
Obx(() => controller.isFilterVisiblePendingGeneration.value
? Column(children: [
Container(
padding: EdgeInsets.all(16),
color: AppColors.clrF2,
@ -40,31 +42,32 @@ class PendingGeneration extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text:
"Plant", isRequired: true),
TextView(text: "Plant", isRequired: true),
SizedBox(height: 8),
CustomDropdown(
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.plant,
itemLabel: (item) => "${item.plantCode}-${item.plantDesc}",
itemLabel: (item) =>
"${item.plantCode}-${item.plantDesc}",
onSelected: (selected) {
if (selected != null) {
controller.selectPlant.value = selected.plantCode ?? "";
controller.showPlantErrorPending.value = false;
controller.selectPlantPending.value =
selected.plantCode ?? "";
controller.showPlantErrorPending.value =
false;
}
},
hintText: "Select Plant",
),
// Obx(() => controller.showPlantErrorPending.value
// ? Padding(
// padding: const EdgeInsets.only(top: 4),
// child: Text(
// 'Required',
// style: TextStyle(color: Colors.red, fontSize: 12),
// ),
// )
// : SizedBox.shrink()),
Obx(() => controller.showPlantErrorPending.value
? Text(
'Required',
style: TextStyle(
color: Colors.red, fontSize: 12),
)
: Text('')),
],
),
),
@ -74,23 +77,37 @@ class PendingGeneration extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text:"Product Name", isRequired: true),
TextView(
text: "Product Name", isRequired: true),
SizedBox(height: 8),
CustomDropdown<dynamic>(
width: 250,
backClr: AppColors.clrD9,
borderClr: AppColors.clrGrey,
items: controller.product,
itemLabel: (item) => "${item.materialCode}-${item.materialDescription}",
itemLabel: (item) =>
"${item.materialCode}-${item.materialDescription}",
onSelected: (selected) {
if (selected != null) {
controller.selectProduct.value = selected;
controller.selectProductPending.value =
selected.materialCode;
controller.showProductErrorPending.value =
false;
print(
"selectPlant${controller.selectProduct.value}");
}
},
hintText: "Select Product Name",
),
Obx(() => controller
.showProductErrorPending.value
? Text(
'Required',
style: TextStyle(
color: Colors.red, fontSize: 12),
)
: Text('')),
],
),
),
@ -100,7 +117,8 @@ class PendingGeneration extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextView(text:"Transaction Type", isRequired: true),
TextView(
text: "Transaction Type", isRequired: true),
SizedBox(height: 8),
CustomDropdown<String>(
backClr: AppColors.clrD9,
@ -109,27 +127,30 @@ class PendingGeneration extends StatelessWidget {
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectTransactionType.value = selected;
controller.showTransactionErrorPending.value = false; }
controller.selectTransactionTypePending
.value = selected;
controller.showTransactionErrorPending
.value = false;
}
},
hintText: "Select Transaction Type",
),
// Obx(() => controller.showTransactionErrorPending.value
// ? Padding(
// padding: const EdgeInsets.only(top: 4),
// child: Text(
// 'Required',
// style: TextStyle(color: Colors.red, fontSize: 12),
// ),
// )
// : SizedBox.shrink()),
Obx(() => controller
.showTransactionErrorPending.value
? Text(
'Required',
style: TextStyle(
color: Colors.red, fontSize: 12),
)
: Text('')),
],
),
),
],
),
Padding(
padding: const EdgeInsets.only(top: 16.0, left: 0, right: 8),
padding:
const EdgeInsets.only(top: 16.0, left: 0, right: 8),
child: Row(
children: [
Expanded(
@ -154,23 +175,25 @@ class PendingGeneration extends StatelessWidget {
margin: EdgeInsets.only(top: 8),
height: 35,
child: TextFormField(
key: controller.fromTextFieldKey,
controller: controller.fromController,
onTap: () async {
final pickedDate = await showWebDatePicker(
final pickedDate =
await showWebDatePicker(
width: 20.w,
context: controller
.fromTextFieldKey.currentContext!,
initialDate: controller.fromSelectedDate,
initialDate:
controller.fromSelectedDate,
firstDate: DateTime(2000),
lastDate: DateTime.now(),
);
if (pickedDate != null) {
controller.fromSelectedDate = pickedDate;
String formattedDate =
controller.getFormattedDate(pickedDate);
controller.fromSelectedDate =
pickedDate;
String formattedDate = controller
.getFormattedDate(pickedDate);
controller.fromController.text =
formattedDate;
controller.dateCheck.value = true;
@ -184,38 +207,47 @@ class PendingGeneration extends StatelessWidget {
fontSize: 12,
overflow: TextOverflow.ellipsis),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.black),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.black),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.clrGrey),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.clrGrey),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.clrGrey),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.clrGrey),
),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(2.0),
borderSide:
BorderSide(color: AppColors.clrGrey),
borderRadius:
BorderRadius.circular(2.0),
borderSide: BorderSide(
color: AppColors.clrGrey),
),
suffixIcon: controller.dateCheck.value
? InkWell(
onTap: () {
controller.dateCheck.value = false;
controller.fromController.clear();
controller.dateCheck.value =
false;
controller.fromController
.clear();
controller.fromSelectedDate =
DateTime.now();
},
child: Icon(Icons.close, size: 1.2.w),
child: Icon(Icons.close,
size: 1.2.w),
)
: null,
contentPadding: const EdgeInsets.symmetric(
horizontal: 12.0, vertical: 0.0),
contentPadding:
const EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 0.0),
),
),
),
@ -237,7 +269,8 @@ class PendingGeneration extends StatelessWidget {
itemLabel: (item) => item,
onSelected: (selected) {
if (selected != null) {
controller.selectLocation.value = selected;
controller.selectLocation.value =
selected;
}
},
hintText: "Select From Location",
@ -252,8 +285,8 @@ class PendingGeneration extends StatelessWidget {
//flex: 2,
child: Column(
children: [
TextView(text:
"",
TextView(
text: "",
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
@ -263,7 +296,7 @@ class PendingGeneration extends StatelessWidget {
CommonBtn(
bkClr: Colors.white,
text: AppStrings.cancel,
clickAction: () {},
clickAction: () => controller.clearFiltersPendingGeneration(),
),
SizedBox(width: 16),
CommonButton(
@ -271,19 +304,21 @@ class PendingGeneration extends StatelessWidget {
height: 30,
width: 100,
text: AppStrings.submit,
clickAction: () =>
// controller.validateFieldsPending();
// if (controller.showPlantErrorPending
// .value ||
// controller.showProductErrorPending
// .value ||
// controller
// .showTransactionErrorPending
// .value) {
// } else {
// controller.postData();
// }
controller
.handleFilterSubmitPendingGeneration(),
clickAction: () {
controller.validateFieldsPending();
if (controller.showPlantErrorPending.value ||
controller.showProductErrorPending.value ||
controller.showTransactionErrorPending.value
) {
} else {
controller.postData();
}
},
),
],
),
@ -295,70 +330,42 @@ class PendingGeneration extends StatelessWidget {
),
],
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 10),
margin: EdgeInsets.only(top: 16),
height: 45,
color: AppColors.primaryClr,
child: Row(
children: [
TextView(text: AppStrings.viewGrnDetails, style: 14.txtBoldWhite),
Spacer(),
CommonBtn(
width: 150,
bkClr: AppColors.white,
borderClr: AppColors.primaryClr,
style: 12.txtBoldBlue,
text: "Generate Freight Bill",
// text: AppStrings.save,
clickAction: () {
bool hasSelectedRows = controller.grnDetails
.any((element) => element.isSelected);
if (!hasSelectedRows) {
showPopup(context: context, onClick: () {
Get.back();
});
} else {
CommonAlertDialog.showDialog(
message: "Are you sure want to\nsave this?",
positiveText: "Save",
negativeText: "Cancel",
positiveBtCallback: () {
Get.back();
controller.addFreightBill();
showFreightBill(context);
},
negativeBtCallback: () {});
}
}),
],
),
),
Obx(() {
if (controller.freightViewLoader.value) {
return Center(
child: CircularProgressIndicator(
color: AppColors.primaryClr,
),
);
} else {
return Column(
children: [
)
])
: SizedBox.shrink()),
Obx(() {
if (controller.grnPendingLoader.value) {
return Center(child: CircularProgressIndicator());
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(
child: CircularProgressIndicator(
color: AppColors.primaryClr,
)),
);
}
if (controller.errorMessage.isNotEmpty) {
return Center(child: Text(controller.errorMessage.value));
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(child: Text(controller.errorMessage.value)));
}
if (controller.grnPendingData.isEmpty) {
return Center(child: Text('No data available.'));
return SizedBox(
height: MediaQuery.sizeOf(context).height,
width: MediaQuery.sizeOf(context).width,
child: Center(child: Text('No data available.',)));
}
return Scrollbar(
return
Column(
children: [
SizedBox(height: 20,),
Scrollbar(
thumbVisibility: true,
controller: controller.verticalScrollController,
child: SingleChildScrollView(
@ -377,7 +384,7 @@ class PendingGeneration extends StatelessWidget {
),
),
child: DataTable(
dataRowHeight: 28,
dataRowHeight: 40,
headingRowHeight: 40,
headingRowColor:
WidgetStateProperty.all(AppColors.clrF2),
@ -440,11 +447,9 @@ class PendingGeneration extends StatelessWidget {
index, value ?? false);
},
activeColor: AppColors.primaryClr,
checkColor: Colors.white,
materialTapTargetSize: MaterialTapTargetSize
.shrinkWrap,
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
),
),
),
@ -474,8 +479,8 @@ class PendingGeneration extends StatelessWidget {
stoppage.codeValue?.toString() ?? ""),
editableCell(index,
stoppage.freightRate?.toString() ?? ""),
editableCell(
index, stoppage.shipmentCost?.toString() ?? ""),
editableCell(index,
stoppage.shipmentCost?.toString() ?? ""),
editableCell(
index, stoppage.remark?.toString() ?? ""),
],
@ -486,13 +491,11 @@ class PendingGeneration extends StatelessWidget {
),
),
),
),
],
);
}),
],
);
}
}),
],
);
}
}

View File

@ -61,16 +61,16 @@ class ViewFreightBill extends StatelessWidget {
},
hintText: "Select Plant",
),
// Obx(() =>
// controller.showPlantErrorFreight.value
// ? Padding(
// padding: const EdgeInsets.only(top: 4),
// child: Text(
// 'Required',
// style: TextStyle(color: Colors.red, fontSize: 12),
// ),
// )
// : SizedBox.shrink()),
Obx(() => controller.showPlantErrorFreight.value
? Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
'Please select a plant',
style: TextStyle(
color: Colors.red, fontSize: 12),
),
)
: SizedBox.shrink()),
],
),
),
@ -125,16 +125,16 @@ class ViewFreightBill extends StatelessWidget {
},
hintText: "Select Transaction Type",
),
// Obx(() =>
// controller.showTransactionErrorFreight.value
// ? Padding(
// padding: const EdgeInsets.only(top: 4),
// child: Text(
// 'Required',
// style: TextStyle(color: Colors.red, fontSize: 12),
// ),
// )
// : SizedBox.shrink()),
Obx(() => controller.showTransactionErrorFreight.value
? Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
'Please select Transaction Type',
style: TextStyle(
color: Colors.red, fontSize: 12),
),
)
: SizedBox.shrink()),
],
),
),
@ -276,10 +276,11 @@ class ViewFreightBill extends StatelessWidget {
.showProductErrorFreight.value ||
controller
.showTransactionErrorFreight.value) {
print(
'controller.showProductError.value ${controller.showProductError.value}');
} else {
controller.postData();
}
controller.postData();
},
),
],
@ -293,48 +294,6 @@ class ViewFreightBill extends StatelessWidget {
],
),
),
// Container(
// padding: EdgeInsets.symmetric(horizontal: 10),
// margin: EdgeInsets.only(top: 16),
// height: 45,
// color: AppColors.primaryClr,
// child: Row(
// children: [
// TextView(text: AppStrings.viewGrnDetails, style: 14.txtBoldWhite),
// Spacer(),
// CommonBtn(
// width: 150,
// bkClr: AppColors.white,
// borderClr: AppColors.primaryClr,
// style: 12.txtBoldBlue,
// text: "Generate Freight Bill",
//
// clickAction: () {
// bool hasSelectedRows = controller.grnDetails
// .any((element) => element.isSelected);
// if (!hasSelectedRows) {
// showPopup(
// context: context,
// onClick: () {
// Get.back();
// });
// } else {
// CommonAlertDialog.showDialog(
// message: "Are you sure want to\nsave this?",
// positiveText: "Save",
// negativeText: "Cancel",
// positiveBtCallback: () {
// Get.back();
// controller.addFreightBill();
//
// showFreightBill(context);
// },
// negativeBtCallback: () {});
// }
// }),
// ],
// ),
// ),
SizedBox(
height: 20,
),
@ -556,10 +515,8 @@ class ViewFreightBill extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${AppStrings.freightBill} ${freightBill.freightbillId ?? "-"}"),
Text(
"${AppStrings.freightDate} ${freightBill.statusDate ?? "-"}"),
Text("${AppStrings.freightBill} ${freightBill.freightbillId}"),
Text("${AppStrings.freightDate} ${freightBill.statusDate}"),
const SizedBox(
height: 8,
),

View File

@ -29,6 +29,8 @@ class _TransportViewState extends State<TransportView> {
@override
Widget build(BuildContext context) {
return ListView(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
@ -163,210 +165,38 @@ class _TransportViewState extends State<TransportView> {
style: 12.txtBoldWhite,
),
),
Obx(
() => Visibility(
visible: ctrl.selectedUser.value >= 1,
child: InkWell(
onTap: ctrl.toggleContainer,
child: Image.asset(AppImages.filter,
height: 16, width: 16)),
InkWell(
onTap: () {
if(ctrl.selectedUser.value == 0){
ctrl.toggleFilter();
}
else if(ctrl.selectedUser.value == 2){
ctrl.togglePending();
}
},
child:
Image.asset(AppImages.filter, height: 16, width: 16),
),
),
Visibility(
visible: ctrl.selectedUser.value >= 1,
child: Padding(
Padding(
padding: const EdgeInsets.all(8.0),
child: TextView(
text: AppStrings.filter,
style: 12.txtBoldWhite,
),
),
),
],
),
),
// Obx(
// () => ctrl.isSelected.value
// ? Container(
// margin: EdgeInsets.symmetric(vertical: 16),
// padding: EdgeInsets.all(16),
// color: AppColors.clrF2,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// children: [
// Expanded(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// TextView(
// text: "Plant",
// ),
// SizedBox(height: 8),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value = selected;
// }
// },
// hintText: 'Select Plant'),
// ],
// )),
// SizedBox(width: 16),
// Expanded(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// TextView(
// text: "Freight Bill No.",
// ),
// SizedBox(height: 8),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.freightBillList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedFreight.value =
// selected;
// }
// },
// hintText: 'Select Freight Number'),
// ],
// )),
// SizedBox(width: 16),
// Expanded(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// TextView(
// text: "Product Name",
// ),
// SizedBox(height: 8),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value = selected;
// }
// },
// hintText: 'Select Product'),
// ],
// )),
// ],
// ),
// SizedBox(height: 12),
// Row(
// children: [
// Expanded(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// TextView(
// text: "Plant",
// ),
// SizedBox(height: 8),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value =
// selected;
// }
// },
// hintText: 'Select Product'),
// ],
// )),
// SizedBox(width: 16),
// Expanded(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// TextView(
// text: "Transaction Type",
// ),
// SizedBox(height: 8),
// CustomDropdown(
// backClr: AppColors.clrD9,
// borderClr: AppColors.clrGrey,
// items: ctrl.plantList,
// itemLabel: (item) => item,
// onSelected: (selected) {
// if (selected != null) {
// ctrl.selectedPlant.value =
// selected;
// }
// },
// hintText: 'Select Product'),
// ],
// )),
// SizedBox(width: 16),
// Expanded(
// child: Column(
// children: [
// TextView(
// text: "",
// ),
// SizedBox(height: 8),
// Row(
// mainAxisAlignment:
// MainAxisAlignment.end,
// children: [
// CommonBtn(
// bkClr: Colors.white,
// text: AppStrings.cancel,
// clickAction: () {
// ctrl.isSelected.value = false;
// },
// ),
// SizedBox(width: 16),
// CommonBtn(
// text: AppStrings.submit,
// style: 14.txtSBoldWhite,
// clickAction: () {
// ctrl.isSelected.value = false;
// },
// ),
// ],
// ),
// ],
// ),
// ),
// ],
// ),
// ],
// ),
// )
// : SizedBox(),
// ),
Obx(() {
switch (ctrl.selectedUser.value) {
case 0:
return GenerateFrightBill();
case 1:
return ViewFreightBill();
default:
case 2:
return PendingGeneration();
default :
return SizedBox.shrink();
}
}),
],

View File

@ -20,6 +20,14 @@ class TransportController extends GetxController {
var selectProduct = ''.obs;
var selectLocation = ''.obs;
var selectTransactionType = ''.obs;
RxString selectPlantFreight = ''.obs;
var selectProductFreight = ''.obs;
var selectLocationFreight = ''.obs;
var selectTransactionTypeFreight = ''.obs;
RxString selectPlantPending = ''.obs;
var selectProductPending = ''.obs;
var selectLocationPending = ''.obs;
var selectTransactionTypePending = ''.obs;
var selectedItem = false.obs;
var grnDetails = <Content>[].obs;
var product = <Prodect>[].obs;
@ -27,18 +35,44 @@ class TransportController extends GetxController {
var freightBill = [].obs;
var fromLocation = [].obs;
var grnList = [].obs;
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
RxBool showE = false.obs;
RxBool selectAllField = false.obs;
RxBool plantValidate = false.obs;
RxBool transValidate = false.obs;
void toggleSelection(int index, bool? value) {
grnDetails[index].isSelected = value!;
grnDetails.refresh();
}
RxBool isFilterVisibleGenerateFreight = false.obs;
RxBool isFilterVisiblePendingGeneration = false.obs;
final int initialRecordCount = 20;
// Validation variables
RxBool showPlantError = false.obs;
RxBool showProductError = false.obs;
RxBool showTransactionError = false.obs;
void toggleFilter() {
// if (selectedUser.value == 0) {
isFilterVisibleGenerateFreight.value =
!isFilterVisibleGenerateFreight.value;
if (!isFilterVisibleGenerateFreight.value) {
clearFiltersGenerateFreightBill();
}
// }
// if (selectedUser.value == 2) {
// }
}
void togglePending(){
isFilterVisiblePendingGeneration.value =
!isFilterVisiblePendingGeneration.value;
if (!isFilterVisiblePendingGeneration.value) {
clearFiltersPendingGeneration();
}
}
void selectAll(bool value) {
for (var item in grnDetails) {
item.isSelected = value;
@ -47,11 +81,39 @@ RxBool transValidate = false.obs;
grnDetails.refresh();
}
RxBool showPlantErrorFreight = false.obs;
RxBool showProductErrorFreight = false.obs;
RxBool showTransactionErrorFreight = false.obs;
final selectProductValFreight = ''.obs;
RxBool showPlantErrorPending = false.obs;
RxBool showProductErrorPending = false.obs;
RxBool showTransactionErrorPending = false.obs;
void validateFields() {
showPlantError.value = selectPlant.value.isEmpty;
showTransactionError.value = selectTransactionType.value.isEmpty;
}
void validateFieldsPending() {
showPlantErrorPending.value = selectPlantPending.value.isEmpty;
showTransactionErrorPending.value =
selectTransactionTypePending.value.isEmpty;
showProductErrorPending.value = selectProductPending.value.isEmpty;
}
void validateFieldsGenerateFreight() {
showPlantErrorFreight.value = selectPlantFreight.value.isEmpty;
showTransactionErrorFreight.value =
selectTransactionTypeFreight.value.isEmpty;
showProductErrorFreight.value = selectProductFreight.value.isEmpty;
}
@override
void onInit() {
getFreightBills();
viewFreightView();
grnPending();
postData();
super.onInit();
}
@ -90,10 +152,10 @@ RxBool transValidate = false.obs;
isLoading.value = true;
Map<String, String> requestBody = {
"plant": selectPlant.value,
"productNane": selectProduct.value,
"transactionType": selectTransactionType.value,
"fromLocation": selectLocation.value,
"plant": "",
"productNane": "",
"transactionType": "",
"fromLocation": "",
"grnFromDate": "",
"grnToDate": ""
};
@ -109,12 +171,115 @@ RxBool transValidate = false.obs;
}
}
void displayFilteredData() async {
try {
isLoading.value = true;
Map<String, String> requestBody = {
"plant": selectPlantFreight.value,
"productNane": selectProductFreight.value,
"transactionType": selectTransactionTypeFreight.value,
"fromLocation": selectLocation.value,
"grnFromDate": "",
"grnToDate": ""
};
var response = await PostRequests.addFreightBill(requestBody);
if (response != null) {
List<Content> flattenedContent =
response.content!.expand((list) => list).toList();
print("Flattened content size: ${flattenedContent.length}");
print(
"Filter criteria: Plant: ${selectPlantFreight.value}, Product: ${selectProductFreight.value}, Transaction: ${selectTransactionTypeFreight.value}");
List<Content> filteredData = flattenedContent.where((item) {
return (selectPlantFreight.value.isEmpty ||
item.plantCode == selectPlantFreight.value) &&
(selectProductFreight.value.isEmpty ||
item.materialCode == selectProductFreight.value) &&
(selectTransactionTypeFreight.value.isEmpty ||
item.codeValue == selectTransactionTypeFreight.value);
}).toList();
print("Filtered Data: ${filteredData.length}");
grnDetails.assignAll(filteredData);
print("✅ Filtered Data: ${filteredData.length} items displayed.");
print("✅ Filtered Data: ${grnDetails.length} items displayed.");
} else {
print("❌ No response from API.");
}
} finally {
isLoading.value = false;
}
}
// void handleFilterSubmit() {
// validateFieldsGenerateFreight();
//
// if (showPlantError.value ||
// showProductError.value ||
// showTransactionError.value) {
// print('show errr');
// } else {
// postData();
// }
// }
void handleFilterSubmitGenerateFreight() {
validateFieldsGenerateFreight();
if (selectPlantFreight.value.isEmpty ||
selectProductFreight.value.isEmpty ||
selectTransactionTypeFreight.value.isEmpty) {
print('please fill data ');
}
else {
displayFilteredData();
}
}
void handleFilterSubmitPendingGeneration() {
validateFieldsPending();
if (selectPlantPending.value.isEmpty ||
selectProductPending.value.isEmpty ||
selectTransactionTypePending.value.isEmpty) {
}
else {
displayFilteredDataFromPending();
}
}
void clearFiltersGenerateFreightBill() {
selectPlantFreight.value = '';
selectProductFreight.value = '';
selectTransactionTypeFreight.value = '';
fromController.clear();
showPlantError.value = false;
showProductError.value = false;
showTransactionError.value = false;
postData();
}
void clearFiltersPendingGeneration() {
selectPlantPending.value = '';
selectProductPending.value = '';
selectTransactionTypePending.value = '';
fromController.clear();
showPlantErrorPending.value = false;
showProductErrorPending.value = false;
showTransactionErrorPending.value = false;
postData();
}
getFreightBills() async {
try {
isLoading.value = true;
var response = await GetRequests.getFreightBill();
if (response != null) {
print("gtyfhg");
plant.assignAll(response.plant ?? []);
product.assignAll(response.prodect ?? []);
freightBill.assignAll(response.freightBill ?? []);
@ -125,14 +290,6 @@ RxBool transValidate = false.obs;
}
}
bool isEmbeddedProduct(String materialCode) {
var product = <Prodect>[].obs;
return product.any((prodect) => prodect.materialCode == materialCode);
}
final fromTextFieldKey = GlobalKey();
TextEditingController fromController = TextEditingController();
DateTime fromSelectedDate = DateTime.now(); // Initialize with a default value
@ -163,21 +320,12 @@ RxBool transValidate = false.obs;
"Plant 5",
];
RxString selectedFreight = "".obs;
List freightBillList = [
"Plant 1",
"Plant 2",
"Plant 3",
"Plant 4",
"Plant 5",
];
addFreightBill() async {
try {
grnListLoader.value = true;
// Filter the selected rows
final List<Map<String, dynamic>> selectedGrns = grnDetails
.where((grn) => grn.isSelected) // Get only the selected rows
.where((grn) => grn.isSelected)
.map((grn) => {
"grn_id": grn.grnId,
"grn_no": grn.grnNo,
@ -219,44 +367,11 @@ RxBool transValidate = false.obs;
var pageSize = 2.obs;
var sortField = "grn_date".obs;
var sortDirection = "desc".obs;
// viewFreightView({int? page, String? sort, String? direction}) async {
// try {
// freightViewLoader.value = true;
//
// currentPage.value = page ?? currentPage.value;
// if (sort != null) sortField.value = sort;
// if (direction != null) sortDirection.value = direction;
//
// Map<String, String> requestBody = {
// "plant": "",
// "productNane": "",
// "freightBillNo": "",
// "transactionType": "",
// "fromLocation": "",
// "grnFromDate": "",
// "grnToDate": "",
// "page": currentPage.toString(),
// "size": pageSize.toString(),
// "sort": "${sortField.value},${sortDirection.value}"
// };
//
// var response = await PostRequests.viewFreightBill(requestBody,
// currentPage.value, pageSize.value, '$sortField', '$sortDirection');
// if (response != null) {
// List<FreightBill> flattenedContent =
// response.content!.expand((list) => list).toList();
// freightBillData.assignAll(flattenedContent);
//
// totalPages.value = response.totalPages ?? 0;
// totalElements.value = response.totalElements ?? 0;
// }
// } finally {
// freightViewLoader.value = false;
// }
// }
RxInt currentPage = 1.obs;
RxInt totalPages = 3.obs;
final int limit = 10;
viewFreightView() async {
try {
freightViewLoader.value = true;
@ -323,7 +438,9 @@ RxBool transValidate = false.obs;
}
var grnPendingData = <GrnPending>[].obs;
grnPending() async {
print('get pending');
try {
grnPendingLoader.value = true;
@ -343,39 +460,52 @@ RxBool transValidate = false.obs;
List<GrnPending> flattenedContent =
response.content!.expand((list) => list).toList();
grnPendingData.assignAll(flattenedContent);
print('response from pending tab${response.first.toString()} and ${flattenedContent.length} and ${grnPendingData.value[0].codeValue} and ${grnPendingData.value[0].plantCode} and ${grnPendingData.value[0].materialCode}');
}
} finally {
grnPendingLoader.value = false;
}
}
RxBool showPlantError = false.obs;
RxBool showProductError = false.obs;
RxBool showTransactionError = false.obs;
final selectProductVal = Rx<dynamic>(null);
RxBool showPlantErrorFreight = false.obs;
RxBool showProductErrorFreight = false.obs;
RxBool showTransactionErrorFreight = false.obs;
final selectProductValFreight = Rx<dynamic>(null);
RxBool showPlantErrorPending = false.obs;
RxBool showProductErrorPending = false.obs;
RxBool showTransactionErrorPending = false.obs;
final selectProductValPending = Rx<dynamic>(null);
void displayFilteredDataFromPending() async {
try {
isLoading.value = true;
Map<String, String> requestBody = {
"plant": selectPlantPending.value,
"productNane": selectProductPending.value,
"transactionType": selectTransactionTypePending.value,
"fromLocation": selectLocation.value,
"grnFromDate": "",
"grnToDate": ""
};
void validateFields() {
showPlantError.value = selectPlant.value.isEmpty;
showTransactionError.value = selectTransactionType.value.isEmpty;
showProductError.value = selectProductVal.value == null;
var response = await PostRequests.grnPending(requestBody);
if (response != null) {
List<GrnPending> flattenedContent =
response.content!.expand((list) => list).toList();
List<GrnPending> filteredData = flattenedContent.where((item) {
return (selectPlantFreight.value.isEmpty ||
item.plantCode == selectPlantFreight.value) &&
(selectProductFreight.value.isEmpty ||
item.materialCode == selectProductFreight.value) &&
(selectTransactionTypeFreight.value.isEmpty ||
item.codeValue == selectTransactionTypeFreight.value);
}).toList();
print("pending Data: ${filteredData.length}");
grnPendingData.assignAll(filteredData);
print("✅ pending Data: ${filteredData.length} items displayed pending.");
} else {
print("❌ No response from API.");
}
void validateFieldsPending() {
showPlantErrorPending.value = selectPlant.value.isEmpty;
showTransactionErrorPending.value = selectTransactionType.value.isEmpty;
showProductErrorPending.value = selectProductVal.value == null;
} finally {
isLoading.value = false;
}
void validateFieldsFreight() {
showPlantErrorFreight.value = selectPlant.value.isEmpty;
showTransactionErrorFreight.value = selectTransactionType.value.isEmpty;
showProductErrorFreight.value = selectProductVal.value == null;
}
}

View File

@ -207,7 +207,7 @@ void showFreightBill(BuildContext context) {
),
Obx(() {
if (controller.grnListLoader.value) {
return Center(child: CircularProgressIndicator());
return Center(child: CircularProgressIndicator(color: AppColors.primaryClr,));
}
if (controller.errorMessage.isNotEmpty) {
@ -271,7 +271,9 @@ void showFreightBill(BuildContext context) {
bkClr: Colors.white,
margin: EdgeInsets.only(top: 24),
text: "Done",
clickAction: (){}),
clickAction: (){
Get.back();
}),
)
],
),

View File

@ -20,12 +20,9 @@ class CustomPagination extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
padding: const EdgeInsets.symmetric(vertical: 2.0),
decoration: BoxDecoration(
//color: Colors.grey[200],
border: Border(
top: BorderSide(color: Colors.grey[300]!),
),
color: AppColors.clrF2,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end, // Center the pagination
@ -62,10 +59,10 @@ class CustomPagination extends StatelessWidget {
return InkWell(
onTap: () => onPageChanged(pageNumber),
child: Container(
height: 25,
width: 25,
height: 22,
width: 22,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
borderRadius: BorderRadius.circular(4),
border: Border.all(
color: isSelected ? AppColors.primaryClr : AppColors.primaryClr),
color: isSelected ? AppColors.primaryClr : Colors.transparent,

View File

@ -48,9 +48,9 @@ class TextView extends StatelessWidget {
Widget build(BuildContext context) {
return Padding(
padding: margin ?? EdgeInsets.zero,
child: GestureDetector(
onTap: onTap,
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@ -75,7 +75,6 @@ class TextView extends StatelessWidget {
),
],
),
),
);
}
}

View File

@ -35,3 +35,40 @@ class ApiUrls {
static const grnPendingDetails =
"http://46.28.44.130:9092/bill/grndetailsPanding?page=0&size=20&sort=grn_date,desc";
}
// class ApiUrls {
// ApiUrls._();
//
// static const String baseUrl = "http://localhost:9092/";
//
// static const addFreightBill =
// 'bill/grndetails?page=0&size=20&sort=grn_date,desc';
// static const getFreightBills = 'bill/dropdown';
// static const generateFreightBill =
// 'http://localhost:9092/bill/addFreightBill';
// static const createUser = 'http://localhost:9093/api/users/createUser';
// static const editUser =
// 'http://localhost:9093/api/users/update?userEmpTransCode=';
// static const getAllUser =
// 'http://localhost:9093/api/users/userdetails?page=';
// static const viewFreightBill =
// 'http://localhost:9092/bill/freightbill?page';
// static const addUserType =
// 'http://localhost:9093/api/user-types/createUserType';
// static const dropDownList =
// 'http://localhost:9093/api/user-roles/userrole_dropdown';
// static const plantMapping = 'http://localhost:9093/userplant/fetchPlants';
// static const checkStatus =
// 'http://localhost:9093/api/user-types/update-status/';
// static const getInternalUserDropdown =
// 'http://localhost:9093/api/user-roles/userrole_dropdown';
// static const fetchEmailsAndEmpCode =
// 'http://localhost:9093/api/user-roles/fetchRoles';
// static const selectAndAssignRole =
// "http://localhost:9093/api/user-roles/assignRoles";
// static const assignPlantRole =
// "http://localhost:9093/userplant/assignPlants";
// static const userTypeDetails =
// "http://localhost:9093/api/user-types/usertypedetails?page=0&size=15&sort=last_updated_on,desc";
// static const grnPendingDetails =
// "http://localhost:9092/bill/grndetailsPanding?page=0&size=20&sort=grn_date,desc";
// }

View File

@ -67,9 +67,9 @@ class PostRequests {
}
static Future<GetAllUserResModel?> getAllUser(
Map<String, String> requestBody, int page, int limit) async {
Map<String, String> requestBody, int page) async {
var apiResponse = await RemoteService.postUser(requestBody,
"${ApiUrls.getAllUser}$page&size=$limit&sort=last_updated_on,desc");
"${ApiUrls.getAllUser}$page&size=9&sort=last_updated_on,desc");
if (apiResponse != null) {
return getAllUserResModelFromJson(apiResponse.response!);
@ -155,17 +155,26 @@ class PostRequests {
}
}
// static Future<FetchInternalUserModel?> fetchEmailsAndEmpCodes(
// Map<String, String> requestBody) async {
// var apiResponse = await RemoteService.postUser(
// requestBody, ApiUrls.fetchEmailsAndEmpCode);
// if (apiResponse != null) {
// return fetchInternalUserModelFromJson(apiResponse.response!);
// } else {
// return null;
// }
// }
static Future<FetchInternalUserModel?> fetchEmailsAndEmpCodes(
Map<String, String> requestBody) async {
var apiResponse = await RemoteService.postUser(
requestBody, ApiUrls.fetchEmailsAndEmpCode);
Map<String, String> requestBody,String message) async {
var apiResponse = await RemoteService.postMethod(
requestBody, ApiUrls.fetchEmailsAndEmpCode,message);
if (apiResponse != null) {
return fetchInternalUserModelFromJson(apiResponse.response!);
} else {
return null;
}
}
static Future<SelectAssignRoleModel?> selectAssignRole(
Map<String, dynamic> requestBody) async {
var apiResponse =

View File

@ -53,7 +53,7 @@ class RemoteService {
try {
final map = jsonDecode(response.body) as Map<String, dynamic>;
AppAlerts.alert(message: '${map['message']}');
// AppAlerts.alert(message: '${map['message']}');
throw map['message'];
} catch (e) {
@ -133,7 +133,7 @@ class RemoteService {
} else {
try {
final map = jsonDecode(response.body) as Map<String, dynamic>;
AppAlerts.alert(message: '${map['message']}');
// AppAlerts.alert(message: '${map['message']}');
throw map['message'];
} catch (e) {
@ -156,7 +156,7 @@ class RemoteService {
} else {
try {
final map = jsonDecode(response.body) as Map<String, dynamic>;
AppAlerts.alert(message: '${map['message']}');
// AppAlerts.alert(message: '${map['message']}');
throw map['message'];
} catch (e) {
@ -210,7 +210,7 @@ class RemoteService {
} else {
try {
final map = jsonDecode(response.body) as Map<String, dynamic>;
AppAlerts.alert(message: '${map['message']}');
// AppAlerts.alert(message: '${map['message']}');
throw map['message'];
} catch (e) {
@ -225,7 +225,7 @@ class RemoteService {
final response =
await http.post(Uri.parse(endUrl), headers: getHeaders(), body: body);
print('${response.body}response');
print(_baseUrl + endUrl);
print(endUrl);
print('${response.statusCode}response');
var responseCode = response.statusCode;
@ -236,7 +236,7 @@ class RemoteService {
try {
final map = jsonDecode(response.body) as Map<String, dynamic>;
AppAlerts.alert(message: '${map['message']}');
// AppAlerts.alert(message: '${map['message']}');
throw map['message'];
} catch (e) {
@ -285,7 +285,34 @@ class RemoteService {
} else {
try {
final map = jsonDecode(response.body) as Map<String, dynamic>;
AppAlerts.alert(message: '${map['message']}');
// AppAlerts.alert(message: '${map['message']}');
throw map['message'];
} catch (e) {
return null;
}
}
}
static Future<CommonResModel?> postMethod(
Map<String, dynamic> requestBody, String endUrl,String message) async {
var body = json.encode(requestBody);
final response =
await http.post(Uri.parse(endUrl), headers: getHeaders(), body: body);
print('${response.body}response');
print(endUrl);
print('${response.statusCode}response');
var responseCode = response.statusCode;
if (Helpers.isResponseSuccessful(responseCode)) {
return CommonResModel(statusCode: responseCode, response: response.body);
} else {
print(response.body);
try {
final map = jsonDecode(response.body) as Map<String, dynamic>;
message = '${map['message']}';
print("message?????${message}");
throw map['message'];
} catch (e) {
return null;

View File

@ -321,5 +321,5 @@ packages:
source: hosted
version: "1.1.0"
sdks:
dart: ">=3.6.1 <4.0.0"
dart: ">=3.6.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"

View File

@ -19,8 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ^3.6.1
sdk: ^3.6.0
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions