merge with prativa
commit
0e5d771da7
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:shayog/components/common/common_button.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 'package:shayog/feature/presentation/widgets/text_view.dart';
|
||||||
import '../../../../../../components/common/common_btn.dart';
|
import '../../../../../../components/common/common_btn.dart';
|
||||||
import '../../../../../../components/common/custom_drop_down.dart';
|
import '../../../../../../components/common/custom_drop_down.dart';
|
||||||
|
@ -21,114 +22,7 @@ class AddInternalUser extends StatelessWidget {
|
||||||
padding: EdgeInsets.all(16),
|
padding: EdgeInsets.all(16),
|
||||||
color: AppColors.clrF2,
|
color: AppColors.clrF2,
|
||||||
child: allData(),
|
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,
|
|
||||||
// ),
|
|
||||||
//
|
|
||||||
// ],
|
|
||||||
// ),)),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +31,7 @@ class AddInternalUser extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Form(
|
Form(
|
||||||
key: controller.formKey,
|
key: controller.formKey,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
//autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
@ -199,6 +93,7 @@ class AddInternalUser extends StatelessWidget {
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
SizedBox(height:8 ),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
|
@ -209,6 +104,7 @@ class AddInternalUser extends StatelessWidget {
|
||||||
TextView(
|
TextView(
|
||||||
text: AppStrings.userType,
|
text: AppStrings.userType,
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
initialValue: controller.userTypeList[1],
|
initialValue: controller.userTypeList[1],
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
|
@ -222,6 +118,15 @@ class AddInternalUser extends StatelessWidget {
|
||||||
},
|
},
|
||||||
hintText: 'Select User Type',
|
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),
|
SizedBox(width: 16),
|
||||||
|
@ -233,8 +138,10 @@ class AddInternalUser extends StatelessWidget {
|
||||||
TextView(
|
TextView(
|
||||||
text: AppStrings.status,
|
text: AppStrings.status,
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
initialValue: controller.status[0],
|
//initialValue: controller.status[0],
|
||||||
|
initialValue: "Active",
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
borderClr: AppColors.clrGrey,
|
borderClr: AppColors.clrGrey,
|
||||||
items: controller.status,
|
items: controller.status,
|
||||||
|
@ -245,6 +152,16 @@ class AddInternalUser extends StatelessWidget {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hintText: 'Active'),
|
hintText: 'Active'),
|
||||||
|
Obx(() => controller.validateAdduser.value == true ?
|
||||||
|
TextView(
|
||||||
|
margin: EdgeInsets.only(top: 4),
|
||||||
|
text: "Required",
|
||||||
|
style: 10.txtTransparent,
|
||||||
|
|
||||||
|
) :
|
||||||
|
SizedBox.shrink(
|
||||||
|
))
|
||||||
|
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
|
@ -310,26 +227,7 @@ class AddInternalUser extends StatelessWidget {
|
||||||
clickAction: () {
|
clickAction: () {
|
||||||
controller.createUser();
|
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(
|
: CommonButton(
|
||||||
height: 30,
|
height: 30,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import '../../../../../components/styles/app_strings.dart';
|
||||||
import '../../transporter/widgets/common_card.dart';
|
import '../../transporter/widgets/common_card.dart';
|
||||||
|
|
||||||
class InternalUserRoleMapping extends StatefulWidget {
|
class InternalUserRoleMapping extends StatefulWidget {
|
||||||
InternalUserRoleMapping({super.key});
|
const InternalUserRoleMapping({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<InternalUserRoleMapping> createState() => _InternalUserRoleMappingState();
|
State<InternalUserRoleMapping> createState() => _InternalUserRoleMappingState();
|
||||||
|
@ -19,35 +19,7 @@ class InternalUserRoleMapping extends StatefulWidget {
|
||||||
|
|
||||||
class _InternalUserRoleMappingState extends State<InternalUserRoleMapping> {
|
class _InternalUserRoleMappingState extends State<InternalUserRoleMapping> {
|
||||||
final ctrl = Get.put(DashboardCtrl());
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -63,23 +35,7 @@ class _InternalUserRoleMappingState extends State<InternalUserRoleMapping> {
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
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(
|
Container(
|
||||||
color: AppColors.clrF2,
|
color: AppColors.clrF2,
|
||||||
|
@ -106,21 +62,22 @@ class _InternalUserRoleMappingState extends State<InternalUserRoleMapping> {
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
ctrl.selectedEmpCode.value = selected;
|
ctrl.selectedEmpCode.value = selected;
|
||||||
ctrl.validateRoleMapCode.value = false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hintText: "Select Employee Code",
|
hintText: "Select Employee Code",
|
||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
ctrl.validateRoleMapCode.value == true ? TextView(
|
ctrl.validateRoleEmail.value == true ? TextView(
|
||||||
text: "Required",
|
text: "Required",
|
||||||
style: 10.txtSBoldRed,
|
style: 10.txtTransparent,
|
||||||
|
|
||||||
) : TextView(
|
) : TextView(
|
||||||
text: "ABC",
|
text: "ABC",
|
||||||
style: 10.txtTransparent,
|
style: 10.txtTransparent,
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
|
@ -184,12 +141,12 @@ class _InternalUserRoleMappingState extends State<InternalUserRoleMapping> {
|
||||||
width: 100,
|
width: 100,
|
||||||
text: AppStrings.submit,
|
text: AppStrings.submit,
|
||||||
clickAction: () {
|
clickAction: () {
|
||||||
if(ctrl.selectedEmail.value == "Select Email" ||ctrl.selectedEmpCode.value == "Select Employee Code" ){
|
if(ctrl.selectedEmail.value == "Select Email" ){
|
||||||
ctrl.validateRoleEmail.value = true;
|
ctrl.validateRoleEmail.value = true;
|
||||||
ctrl.validateRoleMapCode.value = true;
|
|
||||||
} else{
|
} else{
|
||||||
ctrl.validateRoleEmail.value = false;
|
ctrl.validateRoleEmail.value = false;
|
||||||
ctrl.validateRoleMapCode.value = false;
|
|
||||||
ctrl.getRoleMappingData();
|
ctrl.getRoleMappingData();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,6 +181,7 @@ class ManageUser extends StatelessWidget {
|
||||||
text: AppStrings.cancel,
|
text: AppStrings.cancel,
|
||||||
clickAction: () {
|
clickAction: () {
|
||||||
controller.isSelected.value = false;
|
controller.isSelected.value = false;
|
||||||
|
controller.clearUserData();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
|
@ -219,7 +220,7 @@ class ManageUser extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(bottom: 16, top: 16),
|
margin: EdgeInsets.only(bottom: 16, top: 16),
|
||||||
height: MediaQuery.of(context).size.height * 0.6,
|
height: MediaQuery.of(context).size.height * 0.4,
|
||||||
child: RawScrollbar(
|
child: RawScrollbar(
|
||||||
thumbColor: AppColors.clrD9,
|
thumbColor: AppColors.clrD9,
|
||||||
radius: Radius.circular(2),
|
radius: Radius.circular(2),
|
||||||
|
|
|
@ -52,15 +52,16 @@ class UserPlantMapping extends StatelessWidget {
|
||||||
hintText: 'Select Employee Code',
|
hintText: 'Select Employee Code',
|
||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
ctrl.validatePlantCode.value == true ? TextView(
|
ctrl.validatePlantEmail.value == true ? TextView(
|
||||||
text: "Required",
|
text: "Required",
|
||||||
style: 10.txtSBoldRed,
|
style: 10.txtTransparent,
|
||||||
|
|
||||||
) : TextView(
|
) : TextView(
|
||||||
text: "ABC",
|
text: "ABC",
|
||||||
style: 10.txtTransparent,
|
style: 10.txtTransparent,
|
||||||
|
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
|
|
||||||
|
@ -129,20 +130,18 @@ class UserPlantMapping extends StatelessWidget {
|
||||||
text: AppStrings.submit,
|
text: AppStrings.submit,
|
||||||
clickAction: () {
|
clickAction: () {
|
||||||
|
|
||||||
if(ctrl.selectPlantEmail.value == "Select Email" ||ctrl.selectedCode.value == "Select Employee Code" ){
|
if(ctrl.selectPlantEmail.value == "Select Email"){
|
||||||
ctrl.validatePlantEmail.value = true;
|
ctrl.validatePlantEmail.value = true;
|
||||||
ctrl.validatePlantCode.value = true;
|
|
||||||
} else{
|
} else{
|
||||||
ctrl.validatePlantEmail.value = false;
|
ctrl.validatePlantEmail.value = false;
|
||||||
ctrl.validatePlantCode.value = false;
|
|
||||||
ctrl.getPlantMapping();
|
ctrl.getPlantMapping();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
// clickAction: () {
|
|
||||||
// ctrl.checkPlants();
|
|
||||||
// },
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -187,9 +186,9 @@ class UserPlantMapping extends StatelessWidget {
|
||||||
value ?? false);
|
value ?? false);
|
||||||
},
|
},
|
||||||
activeColor: AppColors.primaryClr,
|
activeColor: AppColors.primaryClr,
|
||||||
// Custom color when selected
|
|
||||||
checkColor: Colors.white,
|
checkColor: Colors.white,
|
||||||
// Custom color for check mark
|
|
||||||
materialTapTargetSize: MaterialTapTargetSize
|
materialTapTargetSize: MaterialTapTargetSize
|
||||||
.shrinkWrap,
|
.shrinkWrap,
|
||||||
),
|
),
|
||||||
|
|
|
@ -20,142 +20,136 @@ class UserScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Column(
|
child: Container(
|
||||||
children: [
|
padding: EdgeInsets.only(bottom: 16),
|
||||||
Container(
|
margin: EdgeInsets.all(16),
|
||||||
padding: EdgeInsets.only(bottom: 16),
|
child: Column(
|
||||||
margin: EdgeInsets.all(16),
|
children: [
|
||||||
child: Column(
|
Container(
|
||||||
children: [
|
height: 50,
|
||||||
Container(
|
color: AppColors.primaryClr,
|
||||||
height: 50,
|
child: Row(
|
||||||
color: AppColors.primaryClr,
|
children: [
|
||||||
child: Row(
|
ListView.separated(
|
||||||
children: [
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||||
ListView.separated(
|
scrollDirection: Axis.horizontal,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
shrinkWrap: true,
|
||||||
scrollDirection: Axis.horizontal,
|
itemBuilder: (context, index) {
|
||||||
shrinkWrap: true,
|
return Obx(
|
||||||
itemBuilder: (context, index) {
|
() => InkWell(
|
||||||
return Obx(
|
onTap: () {
|
||||||
() => InkWell(
|
ctrl.selectedUser.value = index;
|
||||||
onTap: () {
|
ctrl.clearPrefillData();
|
||||||
ctrl.selectedUser.value = index;
|
ctrl.isSelected.value = false;
|
||||||
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) {
|
ctrl.validateRoleEmail.value = false;
|
||||||
|
ctrl.validatePlantEmail.value = false;
|
||||||
|
|
||||||
ctrl.getManageUser();
|
|
||||||
}
|
|
||||||
if (ctrl.selectedUser.value == 2) {
|
|
||||||
ctrl.showRolesSection.value = false;
|
|
||||||
}
|
|
||||||
if (ctrl.selectedUser.value != 3) {
|
|
||||||
ctrl.selectPlantEmail.value =
|
|
||||||
"Select Email";
|
|
||||||
ctrl.selectPlantCode.value =
|
|
||||||
'Select Employee Code';
|
|
||||||
ctrl.plantMapping.clear();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
margin: EdgeInsets.only(bottom: 10, top: 10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(
|
|
||||||
color: ctrl.selectedUser.value ==
|
|
||||||
index
|
|
||||||
? Colors.white
|
|
||||||
: AppColors.primaryClr,
|
|
||||||
width: 3))),
|
|
||||||
child: Center(
|
|
||||||
child: TextView(
|
|
||||||
text: ctrl.userTabs[index].title ?? "",
|
|
||||||
style: 12.txtBoldWhite,
|
|
||||||
|
|
||||||
),
|
if (ctrl.selectedUser.value == 0) {
|
||||||
),
|
|
||||||
|
ctrl.getManageUser();
|
||||||
|
}
|
||||||
|
if (ctrl.selectedUser.value == 2) {
|
||||||
|
ctrl.showRolesSection.value = false;
|
||||||
|
}
|
||||||
|
if (ctrl.selectedUser.value != 3) {
|
||||||
|
ctrl.selectPlantEmail.value =
|
||||||
|
"Select Email";
|
||||||
|
ctrl.selectPlantCode.value =
|
||||||
|
'Select Employee Code';
|
||||||
|
ctrl.plantMapping.clear();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 10, top: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: ctrl.selectedUser.value ==
|
||||||
|
index
|
||||||
|
? Colors.white
|
||||||
|
: AppColors.primaryClr,
|
||||||
|
width: 3))),
|
||||||
|
child: Center(
|
||||||
|
child: TextView(
|
||||||
|
text: ctrl.userTabs[index].title ?? "",
|
||||||
|
style: 12.txtBoldWhite,
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
separatorBuilder: (context, index) {
|
);
|
||||||
return SizedBox(width: 16);
|
},
|
||||||
},
|
separatorBuilder: (context, index) {
|
||||||
itemCount: 5),
|
return SizedBox(width: 16);
|
||||||
Spacer(),
|
},
|
||||||
InkWell(
|
itemCount: 5),
|
||||||
|
Spacer(),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
ctrl.selectedUser.value == 0
|
||||||
|
? ctrl.getManageUser()
|
||||||
|
: ctrl.selectedUser.value == 1
|
||||||
|
? ctrl.clearPrefillData()
|
||||||
|
: ctrl.selectedUser.value == 2
|
||||||
|
? ctrl.clearRoleMapping()
|
||||||
|
: ctrl.selectedUser.value == 3
|
||||||
|
? ctrl.clearPlants()
|
||||||
|
: ctrl.clearUserType();
|
||||||
|
},
|
||||||
|
child: Image.asset(AppImages.refresh,
|
||||||
|
height: 12, width: 12)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: TextView(
|
||||||
|
text: AppStrings.refresh,
|
||||||
|
style: 12.txtBoldWhite,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Obx(
|
||||||
|
() => Visibility(
|
||||||
|
visible: ctrl.selectedUser.value == 0,
|
||||||
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
ctrl.selectedUser.value == 0
|
ctrl.toggleContainer();
|
||||||
? ctrl.getManageUser()
|
|
||||||
: ctrl.selectedUser.value == 1
|
|
||||||
? ctrl.clearPrefillData()
|
|
||||||
: ctrl.selectedUser.value == 2
|
|
||||||
? ctrl.clearRoleMapping()
|
|
||||||
: ctrl.selectedUser.value == 3
|
|
||||||
? ctrl.clearPlants()
|
|
||||||
: ctrl.clearUserType();
|
|
||||||
},
|
},
|
||||||
child: Image.asset(AppImages.refresh,
|
child: Image.asset(AppImages.filter,
|
||||||
height: 12, width: 12)),
|
height: 16, width: 16)),
|
||||||
Padding(
|
),
|
||||||
|
),
|
||||||
|
Obx(
|
||||||
|
() => Visibility(
|
||||||
|
visible: ctrl.selectedUser.value == 0,
|
||||||
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: TextView(
|
child: TextView(
|
||||||
text: AppStrings.refresh,
|
text: AppStrings.filter,
|
||||||
style: 12.txtBoldWhite,
|
style: 12.txtBoldWhite,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(
|
),
|
||||||
() => Visibility(
|
|
||||||
visible: ctrl.selectedUser.value == 0,
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
ctrl.toggleContainer();
|
|
||||||
},
|
|
||||||
child: Image.asset(AppImages.filter,
|
|
||||||
height: 16, width: 16)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Obx(
|
|
||||||
() => Visibility(
|
|
||||||
visible: ctrl.selectedUser.value == 0,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: TextView(
|
|
||||||
text: AppStrings.filter,
|
|
||||||
style: 12.txtBoldWhite,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
Obx(() {
|
),
|
||||||
switch (ctrl.selectedUser.value) {
|
|
||||||
case 0:
|
|
||||||
return ManageUser();
|
|
||||||
case 1:
|
|
||||||
return AddInternalUser();
|
|
||||||
case 2:
|
|
||||||
return InternalUserRoleMapping();
|
|
||||||
case 3:
|
|
||||||
return UserPlantMapping();
|
|
||||||
default:
|
|
||||||
return UserType();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
Obx(() {
|
||||||
],
|
switch (ctrl.selectedUser.value) {
|
||||||
|
case 0:
|
||||||
|
return ManageUser();
|
||||||
|
case 1:
|
||||||
|
return AddInternalUser();
|
||||||
|
case 2:
|
||||||
|
return InternalUserRoleMapping();
|
||||||
|
case 3:
|
||||||
|
return UserPlantMapping();
|
||||||
|
default:
|
||||||
|
return UserType();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,16 +44,7 @@ class UserType extends StatelessWidget {
|
||||||
controller: controller.userTypeCtrl,
|
controller: controller.userTypeCtrl,
|
||||||
title: "Enter User Type",
|
title: "Enter User Type",
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
|
||||||
controller.validateUserType.value == true ? TextView(
|
|
||||||
text: "Required",
|
|
||||||
style: 10.txtSBoldRed,
|
|
||||||
|
|
||||||
) : TextView(
|
|
||||||
text: "ABC",
|
|
||||||
style: 10.txtTransparent,
|
|
||||||
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
@ -82,16 +73,7 @@ class UserType extends StatelessWidget {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hintText: 'Select Status'),
|
hintText: 'Select Status'),
|
||||||
SizedBox(height: 8),
|
|
||||||
controller.validateUserType.value == true ? TextView(
|
|
||||||
text: "Required",
|
|
||||||
style: 10.txtSBoldRed,
|
|
||||||
|
|
||||||
) : TextView(
|
|
||||||
text: "ABC",
|
|
||||||
style: 10.txtTransparent,
|
|
||||||
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
@ -123,15 +105,8 @@ SizedBox(height: 8),
|
||||||
|
|
||||||
|
|
||||||
clickAction: () {
|
clickAction: () {
|
||||||
if(controller.userTypeCtrl.text.isEmpty ||controller.selectStatus.value == "Select Status" ){
|
controller.createUserType();
|
||||||
controller.validateUserStatus.value = true;
|
|
||||||
controller.validateUserType.value = true;
|
|
||||||
} else{
|
|
||||||
controller.validateUserStatus.value = false;
|
|
||||||
controller.validateUserType.value = false;
|
|
||||||
controller.createUserType();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -269,116 +244,6 @@ SizedBox(height: 8),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
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();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
))
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ class DashboardCtrl extends GetxController {
|
||||||
}
|
}
|
||||||
|
|
||||||
String? validateDropdown(String? value) {
|
String? validateDropdown(String? value) {
|
||||||
|
print('data');
|
||||||
if (value == null || value.isEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
return 'Please select an item';
|
return 'Please select an item';
|
||||||
}
|
}
|
||||||
|
@ -93,7 +94,7 @@ class DashboardCtrl extends GetxController {
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
getManageUser();
|
getManageUser();
|
||||||
getDropDownData();
|
getPlantEmailCode();
|
||||||
getEmailCodeOfRoleMapping();
|
getEmailCodeOfRoleMapping();
|
||||||
userTypeDetails();
|
userTypeDetails();
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
@ -134,7 +135,7 @@ var userEmail =[].obs;
|
||||||
|
|
||||||
Map<String, String> requestBody = {
|
Map<String, String> requestBody = {
|
||||||
"userName": selectUser.value == "Select User Name" ? "" : selectUser.value,
|
"userName": selectUser.value == "Select User Name" ? "" : selectUser.value,
|
||||||
"userTypeName": selectUser.value == "Select User Name" ? "" : selectUser.value,
|
"userTypeName": selectType.value == "Select UserType" ? "" : selectType.value,
|
||||||
"Email": selectEmail.value == "Select Email" ?"": selectEmail.value,
|
"Email": selectEmail.value == "Select Email" ?"": selectEmail.value,
|
||||||
"EmployeeTransCode":
|
"EmployeeTransCode":
|
||||||
selectCode.value == "Select Employee Code" ? "" : selectCode.value,
|
selectCode.value == "Select Employee Code" ? "" : selectCode.value,
|
||||||
|
@ -167,7 +168,14 @@ var userEmail =[].obs;
|
||||||
userLoading.value = false;
|
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() {
|
void nextPage() {
|
||||||
if (currentPage.value < totalPages.value) {
|
if (currentPage.value < totalPages.value) {
|
||||||
currentPage.value++;
|
currentPage.value++;
|
||||||
|
@ -225,14 +233,15 @@ var userEmail =[].obs;
|
||||||
var status = ['Active', 'In-Active'];
|
var status = ['Active', 'In-Active'];
|
||||||
var selectedStatus = 'Select Status'.obs;
|
var selectedStatus = 'Select Status'.obs;
|
||||||
var selectedValue = 'Select User Type'.obs;
|
var selectedValue = 'Select User Type'.obs;
|
||||||
var isValidate = false.obs;
|
|
||||||
Color errorTextColor = Colors.red;
|
Color errorTextColor = Colors.red;
|
||||||
|
|
||||||
void createUser() {
|
void createUser() {
|
||||||
if (formKey.currentState!.validate()) {
|
if (formKey.currentState!.validate()) {
|
||||||
|
validateAdduser.value = false;
|
||||||
addInternalUser();
|
addInternalUser();
|
||||||
} else {
|
} else {
|
||||||
isValidate.value = true;
|
validateAdduser.value = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +272,8 @@ var userEmail =[].obs;
|
||||||
onclick: () {
|
onclick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
getManageUser();
|
getManageUser();
|
||||||
|
getEmailCodeOfRoleMapping();
|
||||||
|
getPlantEmailCode();
|
||||||
clearPrefillData();
|
clearPrefillData();
|
||||||
selectedUser.value = 0;
|
selectedUser.value = 0;
|
||||||
});
|
});
|
||||||
|
@ -369,7 +380,7 @@ var userEmail =[].obs;
|
||||||
var employeeCode = [].obs;
|
var employeeCode = [].obs;
|
||||||
var userEmails = [].obs;
|
var userEmails = [].obs;
|
||||||
|
|
||||||
getDropDownData() async {
|
getPlantEmailCode() async {
|
||||||
try {
|
try {
|
||||||
dropDownLoader.value = true;
|
dropDownLoader.value = true;
|
||||||
|
|
||||||
|
@ -393,18 +404,7 @@ var userEmail =[].obs;
|
||||||
selectPlantCode.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() {
|
clearRoleMapping() {
|
||||||
selectedEmail.value.isEmpty;
|
selectedEmail.value.isEmpty;
|
||||||
|
@ -435,7 +435,7 @@ var userEmail =[].obs;
|
||||||
var fetchEmailsNCodesLoading = false.obs;
|
var fetchEmailsNCodesLoading = false.obs;
|
||||||
var statusMessage = "".obs;
|
var statusMessage = "".obs;
|
||||||
|
|
||||||
// rolemapping
|
// roleMappingEmailCode
|
||||||
getRoleMappingData() async {
|
getRoleMappingData() async {
|
||||||
try {
|
try {
|
||||||
fetchEmailsNCodesLoading.value = true;
|
fetchEmailsNCodesLoading.value = true;
|
||||||
|
@ -443,13 +443,14 @@ var userEmail =[].obs;
|
||||||
"email": selectedEmail.value,
|
"email": selectedEmail.value,
|
||||||
"employeeTransCode": selectedEmpCode.value,
|
"employeeTransCode": selectedEmpCode.value,
|
||||||
};
|
};
|
||||||
var response = await PostRequests.fetchEmailsAndEmpCodes(requestBody);
|
var response = await PostRequests.fetchEmailsAndEmpCodes(requestBody,statusMessage.value);
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
roleMappingData.value = response.data!;
|
roleMappingData.value = response.data!;
|
||||||
showRolesSection.value = true;
|
showRolesSection.value = true;
|
||||||
statusMessage.value = response.status.toString();
|
|
||||||
} else {
|
} else {
|
||||||
print("cdg");
|
|
||||||
|
//print("cdg");
|
||||||
// AppAlerts.alert(message: "sxjs");
|
// AppAlerts.alert(message: "sxjs");
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -578,11 +579,10 @@ var userEmail =[].obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
RxBool validateRoleEmail = false.obs;
|
RxBool validateRoleEmail = false.obs;
|
||||||
RxBool validateRoleMapCode = false.obs;
|
|
||||||
RxBool validatePlantEmail = false.obs;
|
RxBool validatePlantEmail = false.obs;
|
||||||
RxBool validatePlantCode = false.obs;
|
RxBool validateAdduser = false.obs;
|
||||||
RxBool validateUserStatus = false.obs;
|
|
||||||
RxBool validateUserType = false.obs;
|
|
||||||
|
|
||||||
searchEmpCode(String enterValue) {
|
searchEmpCode(String enterValue) {
|
||||||
print('-----typing ---- ${enterValue}');
|
print('-----typing ---- ${enterValue}');
|
||||||
|
@ -606,26 +606,6 @@ var userEmail =[].obs;
|
||||||
}
|
}
|
||||||
RxString? validateEmail;
|
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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,17 +152,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(
|
static Future<FetchInternalUserModel?> fetchEmailsAndEmpCodes(
|
||||||
Map<String, String> requestBody) async {
|
Map<String, String> requestBody,String message) async {
|
||||||
var apiResponse = await RemoteService.postUser(
|
var apiResponse = await RemoteService.postMethod(
|
||||||
requestBody, ApiUrls.fetchEmailsAndEmpCode);
|
requestBody, ApiUrls.fetchEmailsAndEmpCode,message);
|
||||||
if (apiResponse != null) {
|
if (apiResponse != null) {
|
||||||
return fetchInternalUserModelFromJson(apiResponse.response!);
|
return fetchInternalUserModelFromJson(apiResponse.response!);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<SelectAssignRoleModel?> selectAssignRole(
|
static Future<SelectAssignRoleModel?> selectAssignRole(
|
||||||
Map<String, dynamic> requestBody) async {
|
Map<String, dynamic> requestBody) async {
|
||||||
var apiResponse =
|
var apiResponse =
|
||||||
|
|
|
@ -287,6 +287,33 @@ class RemoteService {
|
||||||
try {
|
try {
|
||||||
final map = jsonDecode(response.body) as Map<String, dynamic>;
|
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'];
|
throw map['message'];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue