prativa code
parent
d7072ee489
commit
0b9e0ed9be
|
@ -4,18 +4,26 @@ 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: MouseRegion(
|
||||
cursor: isLink ? SystemMouseCursors.click : SystemMouseCursors.basic,
|
||||
child: Text(
|
||||
value ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
style: isLink ? 11.txtSBoldBlue : 11.txtSBoldBlack,
|
||||
child: Container(
|
||||
|
||||
alignment: Alignment.center,
|
||||
child: MouseRegion(
|
||||
cursor: isLink ? SystemMouseCursors.click : SystemMouseCursors.basic,
|
||||
child: Center(
|
||||
child: Text(
|
||||
value ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
style: isLink ? 11.txtSBoldBlue : 11.txtSBoldBlack,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,14 +40,13 @@ 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: '',
|
||||
|
||||
|
||||
maxLength: maxLength,
|
||||
decoration: InputDecoration(
|
||||
counterText: '',
|
||||
isDense: true,
|
||||
hintStyle: 11.txtSBoldGrey,
|
||||
maintainHintHeight: true,
|
||||
|
@ -57,13 +60,12 @@ maxLength: maxLength,
|
|||
focusedErrorBorder: underLineBorder ?? inputBorder,
|
||||
filled: true,
|
||||
hintText: title ?? "",
|
||||
|
||||
labelStyle: 12.txtSBoldGrey,
|
||||
fillColor: AppColors.clrD9,
|
||||
errorStyle: TextStyle(
|
||||
fontSize: 10.0,
|
||||
// height: 0.2,
|
||||
),
|
||||
// errorText: "",
|
||||
errorStyle: TextStyle(fontSize: 10.0, color: errorTxtColor
|
||||
// height: 0.2,
|
||||
),
|
||||
),
|
||||
inputFormatters: inputFormatter,
|
||||
validator: validator,
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
@ -20,259 +20,337 @@ class AddInternalUser extends StatelessWidget {
|
|||
return Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
color: AppColors.clrF2,
|
||||
child: Stack(
|
||||
children: [
|
||||
Form(
|
||||
key: controller.formKey,
|
||||
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(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.firstName,isRequired: true,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
InputField(
|
||||
validator: Validations.checkValidations,
|
||||
controller: controller.nameCtrl,
|
||||
title: AppStrings.enterFirstName,
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.lastName,isRequired: true,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
InputField(
|
||||
validator: Validations.checkValidations,
|
||||
controller: controller.lastNCtrl,
|
||||
title: AppStrings.enterLastName,
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.employeeCode,isRequired: true,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
InputField(
|
||||
validator: Validations.checkValidations,
|
||||
controller: controller.employeeCodeCtrl,
|
||||
title: AppStrings.enterEmployeeCode,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16.0),
|
||||
child: Row(
|
||||
child: allData(),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(child: Container(
|
||||
// padding: EdgeInsets.only(right: 16),
|
||||
// height: 150,
|
||||
// color: Colors.pink,
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// TextView(
|
||||
// text: AppStrings.firstName,
|
||||
// isRequired: true,
|
||||
// ),
|
||||
// InputField(
|
||||
// errorTxtColor: controller.errorTextColor,
|
||||
// validator: Validations.checkValidations,
|
||||
// controller: controller.nameCtrl,
|
||||
// title: AppStrings.enterFirstName,
|
||||
// ),
|
||||
// TextView(
|
||||
// text: AppStrings.userType,
|
||||
// ),
|
||||
//
|
||||
// CustomDropdown(
|
||||
// initialValue: controller.userTypeList[1],
|
||||
// backClr: AppColors.clrD9,
|
||||
// borderClr: AppColors.clrGrey,
|
||||
// items: controller.userTypeList,
|
||||
// itemLabel: (item) => item,
|
||||
// onSelected: (selected) {
|
||||
// if (selected != null) {
|
||||
// controller.selectedValue.value = selected;
|
||||
// }
|
||||
// },
|
||||
// hintText: 'Select User Type',
|
||||
// ),
|
||||
// ],
|
||||
// ),)),
|
||||
// Expanded(child: Container(
|
||||
// padding: EdgeInsets.only(right: 16),
|
||||
// height: 150,
|
||||
// color: Colors.green,
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// TextView(
|
||||
// text: AppStrings.lastName,
|
||||
// isRequired: true,
|
||||
// ),
|
||||
// InputField(
|
||||
// errorTxtColor: controller.errorTextColor,
|
||||
// validator: Validations.checkValidations,
|
||||
// controller: controller.lastNCtrl,
|
||||
// title: AppStrings.enterLastName,
|
||||
// ),
|
||||
// TextView(
|
||||
// text: AppStrings.status,
|
||||
// ),
|
||||
//
|
||||
// CustomDropdown(
|
||||
// initialValue: controller.status[0],
|
||||
// backClr: AppColors.clrD9,
|
||||
// borderClr: AppColors.clrGrey,
|
||||
// items: controller.status,
|
||||
// itemLabel: (item) => item,
|
||||
// onSelected: (selected) {
|
||||
// if (selected != null) {
|
||||
// controller.selectedStatus.value = selected;
|
||||
// }
|
||||
// },
|
||||
// hintText: 'Active'),
|
||||
// ],
|
||||
// ),)),
|
||||
// Expanded(child: Container(
|
||||
// height: 150,
|
||||
// color: Colors.yellow,
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// TextView(
|
||||
// text: AppStrings.employeeCode,
|
||||
// isRequired: true,
|
||||
// ),
|
||||
// InputField(
|
||||
// errorTxtColor: controller.errorTextColor,
|
||||
// validator: Validations.checkValidations,
|
||||
// controller: controller.employeeCodeCtrl,
|
||||
// title: AppStrings.enterEmployeeCode,
|
||||
// ),
|
||||
// TextView(
|
||||
// text: AppStrings.emailAddress,
|
||||
// isRequired: true,
|
||||
// ),
|
||||
// //SizedBox(height: 8),
|
||||
// InputField(
|
||||
// errorTxtColor: controller.errorTextColor,
|
||||
// validator: Validations.checkEmailValidations,
|
||||
// controller: controller.emailCtrl,
|
||||
// title: AppStrings.enterEmailAddress,
|
||||
// ),
|
||||
//
|
||||
// ],
|
||||
// ),)),
|
||||
// ],
|
||||
// ),
|
||||
);
|
||||
}
|
||||
|
||||
allData() {
|
||||
return Column(
|
||||
children: [
|
||||
Form(
|
||||
key: controller.formKey,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.userType,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
initialValue: controller.userTypeList[1],
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.userTypeList,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectedValue.value = selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select User Type',
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.status,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
initialValue: controller.status[0],
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.status,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectedStatus.value = selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Active'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.emailAddress,isRequired: true,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
InputField(
|
||||
validator: Validations.checkEmailValidations,
|
||||
controller: controller.emailCtrl,
|
||||
title: AppStrings.enterEmailAddress,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16.0, bottom: 8),
|
||||
child: TextView(
|
||||
text: AppStrings.mobileNo,isRequired: true,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: InputField(
|
||||
maxLength: 10,
|
||||
validator: Validations.checkPhoneValidations,
|
||||
controller: controller.mobileCtrl,
|
||||
title: AppStrings.enterMobileNo,
|
||||
TextView(
|
||||
text: AppStrings.firstName,
|
||||
isRequired: true,
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
CommonBtn(
|
||||
bkClr: Colors.white,
|
||||
text: AppStrings.cancel,
|
||||
clickAction: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
controller.employeeCodeCtrl.text.isEmpty
|
||||
? CommonButton(
|
||||
height: 30,
|
||||
width: 100,
|
||||
borderRadius: 4,
|
||||
isLoading: controller.isLoading,
|
||||
text: AppStrings.add,
|
||||
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,
|
||||
width: 100,
|
||||
borderRadius: 4,
|
||||
isLoading: controller.editLoading,
|
||||
text: AppStrings.edit,
|
||||
clickAction: () {
|
||||
controller.editAllUser(
|
||||
controller.employeeCodeCtrl.text);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
InputField(
|
||||
errorTxtColor: controller.errorTextColor,
|
||||
validator: Validations.checkValidations,
|
||||
controller: controller.nameCtrl,
|
||||
title: AppStrings.enterFirstName,
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.lastName,
|
||||
isRequired: true,
|
||||
),
|
||||
InputField(
|
||||
errorTxtColor: controller.errorTextColor,
|
||||
validator: Validations.checkValidations,
|
||||
controller: controller.lastNCtrl,
|
||||
title: AppStrings.enterLastName,
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.employeeCode,
|
||||
isRequired: true,
|
||||
),
|
||||
InputField(
|
||||
errorTxtColor: controller.errorTextColor,
|
||||
validator: Validations.checkValidations,
|
||||
controller: controller.employeeCodeCtrl,
|
||||
title: AppStrings.enterEmployeeCode,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.userType,
|
||||
),
|
||||
CustomDropdown(
|
||||
initialValue: controller.userTypeList[1],
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.userTypeList,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectedValue.value = selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select User Type',
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.status,
|
||||
),
|
||||
CustomDropdown(
|
||||
initialValue: controller.status[0],
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.status,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectedStatus.value = selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Active'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: AppStrings.emailAddress,
|
||||
isRequired: true,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
InputField(
|
||||
errorTxtColor: controller.errorTextColor,
|
||||
validator: Validations.checkEmailValidations,
|
||||
controller: controller.emailCtrl,
|
||||
title: AppStrings.enterEmailAddress,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
TextView(
|
||||
text: AppStrings.mobileNo,
|
||||
isRequired: true,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: InputField(
|
||||
errorTxtColor: controller.errorTextColor,
|
||||
maxLength: 10,
|
||||
validator: Validations.checkPhoneValidations,
|
||||
controller: controller.mobileCtrl,
|
||||
title: AppStrings.enterMobileNo,
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
CommonBtn(
|
||||
bkClr: Colors.white,
|
||||
text: AppStrings.cancel,
|
||||
clickAction: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
controller.employeeCodeCtrl.text.isEmpty
|
||||
? CommonButton(
|
||||
height: 30,
|
||||
width: 100,
|
||||
borderRadius: 4,
|
||||
isLoading: controller.isLoading,
|
||||
text: AppStrings.add,
|
||||
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,
|
||||
width: 100,
|
||||
borderRadius: 4,
|
||||
isLoading: controller.editLoading,
|
||||
text: AppStrings.edit,
|
||||
clickAction: () {
|
||||
controller.editAllUser(
|
||||
controller.employeeCodeCtrl.text);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,44 @@ import '../../../../../components/styles/app_colors.dart';
|
|||
import '../../../../../components/styles/app_strings.dart';
|
||||
import '../../transporter/widgets/common_card.dart';
|
||||
|
||||
class InternalUserRoleMapping extends StatelessWidget {
|
||||
class InternalUserRoleMapping extends StatefulWidget {
|
||||
InternalUserRoleMapping({super.key});
|
||||
|
||||
@override
|
||||
State<InternalUserRoleMapping> createState() => _InternalUserRoleMappingState();
|
||||
}
|
||||
|
||||
class _InternalUserRoleMappingState extends State<InternalUserRoleMapping> {
|
||||
final ctrl = Get.put(DashboardCtrl());
|
||||
String? selectedEmail;
|
||||
|
||||
// Error message
|
||||
String? errorText;
|
||||
|
||||
// List of emails for the dropdown
|
||||
final List<String> emails = ['email1@example.com', 'email2@example.com', 'email3@example.com'];
|
||||
|
||||
// Function for when the email is selected
|
||||
void onEmailSelected(String? email) {
|
||||
setState(() {
|
||||
selectedEmail = email;
|
||||
});
|
||||
}
|
||||
void onSaveClick() {
|
||||
// Validate that an email is selected
|
||||
if (selectedEmail == null || selectedEmail!.isEmpty) {
|
||||
setState(() {
|
||||
errorText = "Please select an email."; // Set the error message
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
errorText = null; // Clear the error message if selection is valid
|
||||
});
|
||||
|
||||
// Perform your save action (e.g., API call, navigation, etc.)
|
||||
print('Email Selected: $selectedEmail');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -29,6 +63,24 @@ class InternalUserRoleMapping extends StatelessWidget {
|
|||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
// CustomDropdown<String>(
|
||||
// backClr: AppColors.clrD9,
|
||||
// borderClr: AppColors.clrGrey,
|
||||
// items: emails,
|
||||
// itemLabel: (item) => item,
|
||||
// onSelected: onEmailSelected,
|
||||
// hintText: "Select Email",
|
||||
// ),
|
||||
// // Error message for the dropdown if no value is selected
|
||||
// if (errorText != null)
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 8.0),
|
||||
// child: Text(
|
||||
// errorText!,
|
||||
// style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
Container(
|
||||
color: AppColors.clrF2,
|
||||
child: Padding(
|
||||
|
@ -54,6 +106,7 @@ class InternalUserRoleMapping extends StatelessWidget {
|
|||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
ctrl.selectedEmpCode.value = selected;
|
||||
ctrl.validateRoleMapCode.value = false;
|
||||
}
|
||||
},
|
||||
hintText: "Select Employee Code",
|
||||
|
@ -63,7 +116,11 @@ class InternalUserRoleMapping extends StatelessWidget {
|
|||
text: "Required",
|
||||
style: 10.txtSBoldRed,
|
||||
|
||||
) : SizedBox.shrink(),
|
||||
) : TextView(
|
||||
text: "ABC",
|
||||
style: 10.txtTransparent,
|
||||
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
|
@ -85,6 +142,7 @@ class InternalUserRoleMapping extends StatelessWidget {
|
|||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
ctrl.selectedEmail.value = selected;
|
||||
ctrl.validateRoleEmail.value = false;
|
||||
}
|
||||
},
|
||||
hintText: "Select Email",
|
||||
|
@ -94,7 +152,11 @@ class InternalUserRoleMapping extends StatelessWidget {
|
|||
text: "Required",
|
||||
style: 10.txtSBoldRed,
|
||||
|
||||
) : SizedBox.shrink(),
|
||||
) : TextView(
|
||||
text: "ABC",
|
||||
style: 10.txtTransparent,
|
||||
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
|
@ -226,11 +288,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(
|
||||
|
|
|
@ -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';
|
||||
|
@ -24,207 +25,186 @@ class ManageUser extends StatelessWidget {
|
|||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Obx(
|
||||
() => controller.isSelected.value
|
||||
() => controller.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: controller.nameCtrl),
|
||||
// margin: EdgeInsets.symmetric(vertical: 16),
|
||||
padding: EdgeInsets.all(16),
|
||||
color: AppColors.clrF2,
|
||||
|
||||
// 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: 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'),
|
||||
],
|
||||
)),
|
||||
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: 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'),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16.0),
|
||||
child: Row(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: "User Name",
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
|
||||
CustomDropdown(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.userNames,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectUser.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),
|
||||
|
||||
CustomDropdown(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.userTypesNames,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectType.value =
|
||||
selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Plant'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text: "Email Address",
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
|
||||
CustomDropdown(
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.userEmail,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectEmail.value =
|
||||
selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Plant'),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
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: 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 Product'),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
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),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
TextView(
|
||||
text: "",
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
CommonBtn(
|
||||
bkClr: Colors.white,
|
||||
text: AppStrings.cancel,
|
||||
clickAction: () {
|
||||
controller.isSelected.value = false;
|
||||
},
|
||||
TextView(
|
||||
text: "",
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
CommonButton(
|
||||
borderRadius: 4,
|
||||
width: 100,
|
||||
height: 30,
|
||||
text: AppStrings.submit,
|
||||
textStyle: 14.txtSBoldWhite,
|
||||
clickAction: () {
|
||||
controller.isSelected.value = false;
|
||||
controller.getManageUser();
|
||||
controller.getAllUser();
|
||||
},
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
CommonBtn(
|
||||
bkClr: Colors.white,
|
||||
text: AppStrings.cancel,
|
||||
clickAction: () {
|
||||
controller.isSelected.value = false;
|
||||
},
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
CommonButton(
|
||||
borderRadius: 4,
|
||||
width: 100,
|
||||
height: 30,
|
||||
text: AppStrings.submit,
|
||||
textStyle: 14.txtSBoldWhite,
|
||||
clickAction: () {
|
||||
//controller.isSelected.value = false;
|
||||
controller.getManageUser();
|
||||
controller.getAllUser();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
)
|
||||
: SizedBox(),
|
||||
),
|
||||
Obx(() {
|
||||
|
@ -236,133 +216,136 @@ class ManageUser extends StatelessWidget {
|
|||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Scrollbar(
|
||||
thumbVisibility: true,
|
||||
controller: controller.verticalScrollController,
|
||||
child: SingleChildScrollView(
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 16, top: 16),
|
||||
height: MediaQuery.of(context).size.height * 0.6,
|
||||
child: RawScrollbar(
|
||||
thumbColor: AppColors.clrD9,
|
||||
radius: Radius.circular(2),
|
||||
trackVisibility: true,
|
||||
thumbVisibility: true,
|
||||
thickness: 14,
|
||||
controller: controller.verticalScrollController,
|
||||
child: Scrollbar(
|
||||
thumbVisibility: true,
|
||||
controller: controller.horizontalScrollController,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: SingleChildScrollView(
|
||||
controller: controller.verticalScrollController,
|
||||
child: RawScrollbar(
|
||||
thumbColor: AppColors.clrD9,
|
||||
radius: Radius.circular(2),
|
||||
thickness: 14,
|
||||
trackVisibility: true,
|
||||
thumbVisibility: true,
|
||||
controller: controller.horizontalScrollController,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey.shade400,
|
||||
width: 1.0,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: controller.horizontalScrollController,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 24, right: 24),
|
||||
child: DataTable(
|
||||
dataRowHeight: 28,
|
||||
headingRowHeight: 40,
|
||||
headingRowColor:
|
||||
WidgetStateProperty.all(AppColors.clrF2),
|
||||
border: TableBorder(
|
||||
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),
|
||||
top: BorderSide(color: AppColors.clrGrey),
|
||||
),
|
||||
columns: [
|
||||
dataColumn("User Name"),
|
||||
dataColumn("Email ID"),
|
||||
dataColumn("Employee/\nTransporter Code"),
|
||||
dataColumn("Mobile No."),
|
||||
dataColumn("User Type"),
|
||||
dataColumn("Created By"),
|
||||
dataColumn("Created Date"),
|
||||
dataColumn("Last Updated By"),
|
||||
dataColumn("Last Update Date"),
|
||||
dataColumn("Status"),
|
||||
dataColumn("Action"),
|
||||
],
|
||||
rows: List<DataRow>.generate(
|
||||
|
||||
controller.getAllUserMain.length, (index) {
|
||||
final stoppage = controller.getAllUserMain[index];
|
||||
return DataRow(
|
||||
|
||||
selected: stoppage.isSelected,
|
||||
cells: [
|
||||
|
||||
editableCell(index, stoppage.userName ?? "-"),
|
||||
editableCell(
|
||||
index, stoppage.userEmail ?? "-"),
|
||||
editableCell(
|
||||
index, stoppage.userEmpTransCode ?? "-"),
|
||||
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, stoppage.lastUpdatedBy.toString()),
|
||||
editableCell(
|
||||
index,
|
||||
DateFormat("d MMMM yyyy").format(
|
||||
DateTime.parse(
|
||||
'${stoppage.lastUpdatedOn}'))),
|
||||
editableCell(
|
||||
index,
|
||||
stoppage.status == "A"
|
||||
? "Active"
|
||||
: "In-Active"),
|
||||
DataCell(CommonBtn(
|
||||
style: 8.txtSBoldWhite,
|
||||
margin: EdgeInsets.symmetric(vertical: 6),
|
||||
width: 35,
|
||||
text: "Edit",
|
||||
clickAction: () {
|
||||
controller.nameCtrl.text =
|
||||
stoppage.userFname ?? '';
|
||||
controller.lastNCtrl.text =
|
||||
stoppage.userLname ?? '';
|
||||
controller.mobileCtrl.text =
|
||||
stoppage.userMobile ?? '';
|
||||
controller.emailCtrl.text =
|
||||
stoppage.userEmail ?? '';
|
||||
controller.userTypeId.value =
|
||||
stoppage.usertypeId.toString();
|
||||
controller.selectedValue.value =
|
||||
stoppage.userAddedChannel ?? '';
|
||||
controller.selectedStatus.value =
|
||||
stoppage.status ?? '';
|
||||
controller.employeeCodeCtrl.text =
|
||||
stoppage.userEmpTransCode ?? '';
|
||||
controller.selectUserVal.value =
|
||||
stoppage.usertypeName ?? '';
|
||||
controller.selectedUser.value = 1;
|
||||
},
|
||||
)),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
child: DataTable(
|
||||
dataRowHeight: 28,
|
||||
headingRowHeight: 40,
|
||||
headingRowColor:
|
||||
WidgetStateProperty.all(AppColors.clrF2),
|
||||
border: TableBorder(
|
||||
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),
|
||||
top: BorderSide(color: AppColors.clrGrey),
|
||||
),
|
||||
columns: [
|
||||
|
||||
dataColumn("User Name"),
|
||||
dataColumn("Email ID"),
|
||||
dataColumn("Employee/\nTransporter Code"),
|
||||
dataColumn("Mobile No."),
|
||||
dataColumn("User Type"),
|
||||
dataColumn("Created By"),
|
||||
dataColumn("Created Date"),
|
||||
dataColumn("Last Updated By"),
|
||||
dataColumn("Last Update Date"),
|
||||
dataColumn("Status"),
|
||||
dataColumn("Action"),
|
||||
],
|
||||
rows: List<DataRow>.generate(
|
||||
controller.getAllUser.length, (index) {
|
||||
final stoppage = controller.getAllUser[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.userEmpTransCode ?? "-"),
|
||||
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, stoppage.lastUpdatedBy.toString()),
|
||||
editableCell(
|
||||
index,
|
||||
DateFormat("d MMMM yyyy").format(
|
||||
DateTime.parse(
|
||||
'${stoppage.lastUpdatedOn}'))),
|
||||
editableCell(index, stoppage.status =="A"?"Active":"In-Active"),
|
||||
|
||||
DataCell(CommonBtn(
|
||||
style: 8.txtSBoldWhite,
|
||||
margin: EdgeInsets.symmetric(vertical: 6),
|
||||
width: 35,
|
||||
text: "Edit",
|
||||
clickAction: () {
|
||||
controller.nameCtrl.text =
|
||||
stoppage.userFname ?? '';
|
||||
controller.lastNCtrl.text =
|
||||
stoppage.userLname ?? '';
|
||||
controller.mobileCtrl.text =
|
||||
stoppage.userMobile ?? '';
|
||||
controller.emailCtrl.text =
|
||||
stoppage.userEmail ?? '';
|
||||
controller.userTypeId.value =
|
||||
stoppage.usertypeId.toString();
|
||||
controller.selectedValue.value =
|
||||
stoppage.userAddedChannel ?? '';
|
||||
controller.selectedStatus.value =
|
||||
stoppage.status ?? '';
|
||||
controller.employeeCodeCtrl.text =
|
||||
stoppage.userEmpTransCode ?? '';
|
||||
controller.selectUserVal.value =
|
||||
stoppage.usertypeName ?? '';
|
||||
controller.selectedUser.value = 1;
|
||||
},
|
||||
)),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
|
||||
|
||||
|
||||
|
||||
],
|
||||
);
|
||||
}),
|
||||
|
||||
CustomPagination(
|
||||
currentPage: controller.currentPage.value,
|
||||
totalPages: controller.totalPages.value,
|
||||
|
@ -370,7 +353,6 @@ class ManageUser extends StatelessWidget {
|
|||
controller.onPageChanged(page);
|
||||
},
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class UserPlantMapping extends StatelessWidget {
|
|||
children: [
|
||||
TextView(
|
||||
text: "Employee/Transporter Code",
|
||||
style: 13.txtBoldBlack,
|
||||
|
||||
isRequired: true,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
|
@ -56,7 +56,11 @@ class UserPlantMapping extends StatelessWidget {
|
|||
text: "Required",
|
||||
style: 10.txtSBoldRed,
|
||||
|
||||
) : SizedBox.shrink(),
|
||||
) : TextView(
|
||||
text: "ABC",
|
||||
style: 10.txtTransparent,
|
||||
|
||||
),
|
||||
],
|
||||
)),
|
||||
|
||||
|
@ -69,7 +73,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 +93,11 @@ class UserPlantMapping extends StatelessWidget {
|
|||
text: "Required",
|
||||
style: 10.txtSBoldRed,
|
||||
|
||||
) : SizedBox.shrink(),
|
||||
) : TextView(
|
||||
text: "ABC",
|
||||
style: 10.txtTransparent,
|
||||
|
||||
),
|
||||
|
||||
],
|
||||
)),
|
||||
|
@ -236,7 +244,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();
|
||||
},
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.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/styles/app_colors.dart';
|
||||
import '../../../../../components/styles/app_images.dart';
|
||||
import '../../../../../components/styles/app_strings.dart';
|
||||
|
@ -45,8 +43,15 @@ class UserScreen extends StatelessWidget {
|
|||
ctrl.selectedUser.value = index;
|
||||
ctrl.clearPrefillData();
|
||||
ctrl.isSelected.value = false;
|
||||
ctrl.validateRoleMapCode.value = false;
|
||||
ctrl.validateRoleEmail.value = false;
|
||||
ctrl.validatePlantEmail.value = false;
|
||||
ctrl.validatePlantCode.value = false;
|
||||
ctrl.validateUserStatus.value = false;
|
||||
ctrl.validateUserType.value = false;
|
||||
|
||||
if (ctrl.selectedUser.value == 0) {
|
||||
print("fhudsfh");
|
||||
|
||||
ctrl.getManageUser();
|
||||
}
|
||||
if (ctrl.selectedUser.value == 2) {
|
||||
|
@ -74,10 +79,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),
|
||||
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -28,105 +28,121 @@ class UserType extends StatelessWidget {
|
|||
color: AppColors.clrF2,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(text:
|
||||
Expanded(child: SizedBox(
|
||||
// color: Colors.pink,
|
||||
height: 100,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(text:
|
||||
"Add User Type",isRequired: true,
|
||||
),
|
||||
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(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text:
|
||||
"Status Type",isRequired: true,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
initialValue: controller.selectStatus.value,
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.userTypeStatus,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectStatus.value = selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Status'),
|
||||
SizedBox(height: 5),
|
||||
controller.validateUserType.value == true ? TextView(
|
||||
text: "Required",
|
||||
style: 10.txtSBoldRed,
|
||||
|
||||
) : SizedBox.shrink(),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
//flex: 2,
|
||||
child: Column(
|
||||
children: [
|
||||
TextView(text:
|
||||
"",
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
CommonBtn(
|
||||
bkClr: Colors.white,
|
||||
text: AppStrings.cancel,
|
||||
clickAction: () {},
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
CommonButton(
|
||||
isLoading: controller.userTypeLoading,
|
||||
height: 28,
|
||||
borderRadius: 4,
|
||||
width: 100,
|
||||
text: AppStrings.submit,
|
||||
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 8),
|
||||
InputField(
|
||||
|
||||
controller: controller.userTypeCtrl,
|
||||
title: "Enter User Type",
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
controller.validateUserType.value == true ? TextView(
|
||||
text: "Required",
|
||||
style: 10.txtSBoldRed,
|
||||
|
||||
) : TextView(
|
||||
text: "ABC",
|
||||
style: 10.txtTransparent,
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(child: SizedBox(
|
||||
// color: Colors.green,
|
||||
height: 100,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text:
|
||||
"Status Type",isRequired: true,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
CustomDropdown(
|
||||
initialValue: controller.selectStatus.value,
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.userTypeStatus,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectStatus.value = selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Status'),
|
||||
SizedBox(height: 8),
|
||||
controller.validateUserType.value == true ? TextView(
|
||||
text: "Required",
|
||||
style: 10.txtSBoldRed,
|
||||
|
||||
) : TextView(
|
||||
text: "ABC",
|
||||
style: 10.txtTransparent,
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Expanded(child: SizedBox(
|
||||
|
||||
height: 100,
|
||||
child: Column(
|
||||
children: [
|
||||
TextView(text:
|
||||
"",
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 18.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
CommonBtn(
|
||||
bkClr: Colors.white,
|
||||
text: AppStrings.cancel,
|
||||
clickAction: () {},
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
CommonButton(
|
||||
isLoading: controller.userTypeLoading,
|
||||
height: 28,
|
||||
borderRadius: 4,
|
||||
width: 100,
|
||||
text: AppStrings.submit,
|
||||
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
@ -253,6 +269,116 @@ class UserType extends StatelessWidget {
|
|||
],
|
||||
);
|
||||
}
|
||||
data(){
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(text:
|
||||
"Add User Type",isRequired: true,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
InputField(
|
||||
controller: controller.userTypeCtrl,
|
||||
title: "Enter User Type",
|
||||
),
|
||||
|
||||
controller.validateUserType.value == true ? TextView(
|
||||
text: "Required",
|
||||
style: 10.txtSBoldRed,
|
||||
|
||||
) : TextView(
|
||||
text: "ABC",
|
||||
style: 10.txtTransparent,
|
||||
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextView(
|
||||
text:
|
||||
"Status Type",isRequired: true,
|
||||
),
|
||||
|
||||
CustomDropdown(
|
||||
initialValue: controller.selectStatus.value,
|
||||
backClr: AppColors.clrD9,
|
||||
borderClr: AppColors.clrGrey,
|
||||
items: controller.userTypeStatus,
|
||||
itemLabel: (item) => item,
|
||||
onSelected: (selected) {
|
||||
if (selected != null) {
|
||||
controller.selectStatus.value = selected;
|
||||
}
|
||||
},
|
||||
hintText: 'Select Status'),
|
||||
|
||||
controller.validateUserType.value == true ? TextView(
|
||||
text: "Required",
|
||||
style: 10.txtSBoldRed,
|
||||
|
||||
) : TextView(
|
||||
text: "ABC",
|
||||
style: 10.txtTransparent,
|
||||
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
//flex: 2,
|
||||
child: Column(
|
||||
children: [
|
||||
TextView(text:
|
||||
"",
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
CommonBtn(
|
||||
bkClr: Colors.white,
|
||||
text: AppStrings.cancel,
|
||||
clickAction: () {},
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
CommonButton(
|
||||
isLoading: controller.userTypeLoading,
|
||||
height: 28,
|
||||
borderRadius: 4,
|
||||
width: 100,
|
||||
text: AppStrings.submit,
|
||||
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
))
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,6 +42,13 @@ 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}");
|
||||
|
@ -95,27 +103,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 Status".obs;
|
||||
var selectEmail = "Select Status".obs;
|
||||
var selectCode = "Select Status".obs;
|
||||
var selectType = "Select Status".obs;
|
||||
getManageUser() async {
|
||||
try {
|
||||
userLoading.value = true;
|
||||
|
||||
Map<String, String> requestBody = {
|
||||
"userName": "",
|
||||
"userTypeName": "",
|
||||
"email": "",
|
||||
"employeeTransCode": "",
|
||||
"status": ""
|
||||
"userName": nameCtrl.text.isEmpty ? "" : nameCtrl.text,
|
||||
"userTypeName": userTypeCtrl.text.isEmpty ? "" : userTypeCtrl.text,
|
||||
"Email": emailCtrl.text.isEmpty ? "" : emailCtrl.text,
|
||||
"EmployeeTransCode":
|
||||
employeeCodeCtrl.text.isEmpty ? "" : employeeCodeCtrl.text,
|
||||
"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}");
|
||||
}
|
||||
|
@ -127,20 +171,20 @@ class DashboardCtrl extends GetxController {
|
|||
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 +210,6 @@ class DashboardCtrl extends GetxController {
|
|||
|
||||
getManageUser();
|
||||
getAllUser.refresh();
|
||||
//employeeCodeCtrl.clear();
|
||||
}
|
||||
// employeeCodeCtrl.clear();
|
||||
selectedUser.value = 0;
|
||||
|
@ -182,10 +225,14 @@ class DashboardCtrl extends GetxController {
|
|||
var status = ['Active', 'In-Active'];
|
||||
var selectedStatus = 'Select Status'.obs;
|
||||
var selectedValue = 'Select User Type'.obs;
|
||||
var isValidate = false.obs;
|
||||
Color errorTextColor = Colors.red;
|
||||
|
||||
void createUser() {
|
||||
if (formKey.currentState!.validate()) {
|
||||
addInternalUser();
|
||||
} else {
|
||||
isValidate.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,29 +333,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"
|
||||
};
|
||||
|
@ -348,6 +387,7 @@ class DashboardCtrl extends GetxController {
|
|||
var plantMappingLoader = false.obs;
|
||||
|
||||
RxList<PlantsData> plantMapping = <PlantsData>[].obs;
|
||||
|
||||
clearPlants() {
|
||||
selectPlantEmail.value.isEmpty;
|
||||
selectPlantCode.value.isEmpty;
|
||||
|
@ -371,8 +411,6 @@ class DashboardCtrl extends GetxController {
|
|||
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;
|
||||
|
||||
// rolemapping
|
||||
getRoleMappingData() async {
|
||||
try {
|
||||
fetchEmailsNCodesLoading.value = true;
|
||||
|
@ -406,9 +445,12 @@ class DashboardCtrl extends GetxController {
|
|||
};
|
||||
var response = await PostRequests.fetchEmailsAndEmpCodes(requestBody);
|
||||
if (response != null) {
|
||||
print('fetch role desc ${response.data?.length}');
|
||||
roleMappingData.value = response.data!;
|
||||
showRolesSection.value = true;
|
||||
statusMessage.value = response.status.toString();
|
||||
} else {
|
||||
print("cdg");
|
||||
// AppAlerts.alert(message: "sxjs");
|
||||
}
|
||||
} finally {
|
||||
fetchEmailsNCodesLoading.value = false;
|
||||
|
@ -534,10 +576,56 @@ 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;
|
||||
|
||||
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;
|
||||
|
||||
// Error message
|
||||
RxString? showErrorText;
|
||||
void onEmailSelected(dynamic email) {
|
||||
|
||||
selectedEmail.value = email;
|
||||
|
||||
}
|
||||
void onSaveClick() {
|
||||
// Validate that an email is selected
|
||||
if (selectedEmail.value.isEmpty) {
|
||||
|
||||
errorText.value = "Required"; // Set the error message
|
||||
|
||||
} else {
|
||||
|
||||
errorText.value = ""; // Clear the error message if selection is valid
|
||||
|
||||
|
||||
// Perform your save action (e.g., API call, navigation, etc.)
|
||||
print('Email Selected: $selectedEmail');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,35 +297,35 @@ class GenerateFrightBill extends StatelessWidget {
|
|||
clickAction: () {},
|
||||
),
|
||||
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();
|
||||
}
|
||||
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();
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -271,7 +271,9 @@ void showFreightBill(BuildContext context) {
|
|||
bkClr: Colors.white,
|
||||
margin: EdgeInsets.only(top: 24),
|
||||
text: "Done",
|
||||
clickAction: (){}),
|
||||
clickAction: (){
|
||||
Get.back();
|
||||
}),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
|
@ -19,12 +19,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
|
||||
|
@ -61,10 +58,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,
|
||||
|
|
|
@ -48,33 +48,32 @@ 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: [
|
||||
Text(
|
||||
capitalise != null && capitalise! ? text.toUpperCase() : text,
|
||||
maxLines: maxlines,
|
||||
overflow: maxlines != null ? TextOverflow.ellipsis : null,
|
||||
textAlign: textAlign,
|
||||
style: style ?? 12.txtBoldBlack,
|
||||
),
|
||||
if (isRequired == true)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 4.0),
|
||||
child: Text(
|
||||
"*",
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
child: Row(
|
||||
|
||||
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
capitalise != null && capitalise! ? text.toUpperCase() : text,
|
||||
maxLines: maxlines,
|
||||
overflow: maxlines != null ? TextOverflow.ellipsis : null,
|
||||
textAlign: textAlign,
|
||||
style: style ?? 12.txtBoldBlack,
|
||||
),
|
||||
if (isRequired == true)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 4.0),
|
||||
child: Text(
|
||||
"*",
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
// }
|
||||
|
|
|
@ -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!);
|
||||
|
|
|
@ -226,7 +226,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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue