|  |  |  | @ -4,6 +4,8 @@ import 'package:mohem_flutter_app/api/profile_api_client.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/classes/colors.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/classes/utils.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/config/routes.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/extensions/int_extensions.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/extensions/string_extensions.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -26,6 +28,7 @@ class PhoneNumbers extends StatefulWidget { | 
		
	
		
			
				|  |  |  |  | class _PhoneNumbersState extends State<PhoneNumbers> { | 
		
	
		
			
				|  |  |  |  |   List<GetPhoneNumberTypesModel> getPhoneNumberTypesList = []; | 
		
	
		
			
				|  |  |  |  |   SubmitPhonesTransactionList submitPhoneNumbers = SubmitPhonesTransactionList(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   void initState() { | 
		
	
		
			
				|  |  |  |  |     super.initState(); | 
		
	
	
		
			
				
					|  |  |  | @ -46,129 +49,66 @@ class _PhoneNumbersState extends State<PhoneNumbers> { | 
		
	
		
			
				|  |  |  |  |         title: LocaleKeys.profile_contactDetails.tr(), | 
		
	
		
			
				|  |  |  |  |       ), | 
		
	
		
			
				|  |  |  |  |       backgroundColor: MyColors.backgroundColor, | 
		
	
		
			
				|  |  |  |  |       bottomSheet: footer(), | 
		
	
		
			
				|  |  |  |  |       body: SingleChildScrollView( | 
		
	
		
			
				|  |  |  |  |         child: Column( | 
		
	
		
			
				|  |  |  |  |           children: [ | 
		
	
		
			
				|  |  |  |  |             Container( | 
		
	
		
			
				|  |  |  |  |               width: double.infinity, | 
		
	
		
			
				|  |  |  |  |               margin: EdgeInsets.only(left: 25, right: 25, top: 25), | 
		
	
		
			
				|  |  |  |  |               padding: EdgeInsets.all(20), | 
		
	
		
			
				|  |  |  |  |               // height: 400, | 
		
	
		
			
				|  |  |  |  |               decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10.0), border: Border.all(color: Color.fromARGB(255, 209, 207, 207))), | 
		
	
		
			
				|  |  |  |  |               child: InkWell( | 
		
	
		
			
				|  |  |  |  |                 child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ | 
		
	
		
			
				|  |  |  |  |                   Icon( | 
		
	
		
			
				|  |  |  |  |                     Icons.add, | 
		
	
		
			
				|  |  |  |  |                     color: Color(0xff259CB8), | 
		
	
		
			
				|  |  |  |  |                   ), | 
		
	
		
			
				|  |  |  |  |                   Text( | 
		
	
		
			
				|  |  |  |  |                     LocaleKeys.addRow.tr(), | 
		
	
		
			
				|  |  |  |  |                     style: TextStyle(color: Color(0xff259CB8), fontWeight: FontWeight.bold), | 
		
	
		
			
				|  |  |  |  |                   ) | 
		
	
		
			
				|  |  |  |  |                 ]), | 
		
	
		
			
				|  |  |  |  |                 onTap: () { | 
		
	
		
			
				|  |  |  |  |                   addNewRow(); | 
		
	
		
			
				|  |  |  |  |                 }, | 
		
	
		
			
				|  |  |  |  |               ), | 
		
	
		
			
				|  |  |  |  |             ), | 
		
	
		
			
				|  |  |  |  |             Column( | 
		
	
		
			
				|  |  |  |  |                 crossAxisAlignment: CrossAxisAlignment.start, | 
		
	
		
			
				|  |  |  |  |                 children: widget.getEmployeePhonesList | 
		
	
		
			
				|  |  |  |  |                     .map((e) => e.aCTION != 'DELETE_ROW' | 
		
	
		
			
				|  |  |  |  |                         ? Container( | 
		
	
		
			
				|  |  |  |  |                             width: double.infinity, | 
		
	
		
			
				|  |  |  |  |                             margin: EdgeInsets.only( | 
		
	
		
			
				|  |  |  |  |                               top: 20, | 
		
	
		
			
				|  |  |  |  |                               left: 26, | 
		
	
		
			
				|  |  |  |  |                               right: 26, | 
		
	
		
			
				|  |  |  |  |                             ), | 
		
	
		
			
				|  |  |  |  |                             padding: EdgeInsets.only(left: 14, right: 14, top: 15, bottom: 15), | 
		
	
		
			
				|  |  |  |  |                             // height: 400, | 
		
	
		
			
				|  |  |  |  |                             decoration: BoxDecoration( | 
		
	
		
			
				|  |  |  |  |                               boxShadow: [ | 
		
	
		
			
				|  |  |  |  |                                 BoxShadow( | 
		
	
		
			
				|  |  |  |  |                                   color: Colors.grey.withOpacity(0.5), | 
		
	
		
			
				|  |  |  |  |                                   spreadRadius: 5, | 
		
	
		
			
				|  |  |  |  |                                   blurRadius: 26, | 
		
	
		
			
				|  |  |  |  |                                   offset: Offset(0, 3), | 
		
	
		
			
				|  |  |  |  |                                 ), | 
		
	
		
			
				|  |  |  |  |                               ], | 
		
	
		
			
				|  |  |  |  |                               color: Colors.white, | 
		
	
		
			
				|  |  |  |  |                               borderRadius: BorderRadius.circular(10.0), | 
		
	
		
			
				|  |  |  |  |                             ), | 
		
	
		
			
				|  |  |  |  |                             child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ | 
		
	
		
			
				|  |  |  |  |                               PopupMenuButton( | 
		
	
		
			
				|  |  |  |  |                                   child: DynamicTextFieldWidget( | 
		
	
		
			
				|  |  |  |  |                                     LocaleKeys.pleaseSelect.tr(), | 
		
	
		
			
				|  |  |  |  |                                     e.pHONETYPEMEANING ?? "", | 
		
	
		
			
				|  |  |  |  |                                     isEnable: false, | 
		
	
		
			
				|  |  |  |  |                                     isPopup: true, | 
		
	
		
			
				|  |  |  |  |                                   ).paddingOnly(bottom: 12), | 
		
	
		
			
				|  |  |  |  |                                   itemBuilder: (_) => <PopupMenuItem<int>>[ | 
		
	
		
			
				|  |  |  |  |                                         for (int i = 0; i < getPhoneNumberTypesList.length; i++) PopupMenuItem<int>(child: Text(getPhoneNumberTypesList![i].mEANING!), value: i), | 
		
	
		
			
				|  |  |  |  |                                       ], | 
		
	
		
			
				|  |  |  |  |                                   onSelected: (int index) { | 
		
	
		
			
				|  |  |  |  |                                     e.pHONETYPEMEANING = getPhoneNumberTypesList[index].mEANING; | 
		
	
		
			
				|  |  |  |  |                                     e.pHONETYPE = getPhoneNumberTypesList[index].cODE; | 
		
	
		
			
				|  |  |  |  |                                     setState(() {}); | 
		
	
		
			
				|  |  |  |  |                                   }), | 
		
	
		
			
				|  |  |  |  |                               DynamicTextFieldWidget( | 
		
	
		
			
				|  |  |  |  |                                 "", | 
		
	
		
			
				|  |  |  |  |                                 e.pHONENUMBER ?? "", | 
		
	
		
			
				|  |  |  |  |                                 isReadOnly: false, | 
		
	
		
			
				|  |  |  |  |                                 onChange: (text) { | 
		
	
		
			
				|  |  |  |  |                                   e.pHONENUMBER = text; | 
		
	
		
			
				|  |  |  |  |                                 }, | 
		
	
		
			
				|  |  |  |  |                               ).paddingOnly(bottom: 12), | 
		
	
		
			
				|  |  |  |  |                               InkWell( | 
		
	
		
			
				|  |  |  |  |                                 child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [ | 
		
	
		
			
				|  |  |  |  |                                   Icon( | 
		
	
		
			
				|  |  |  |  |                                     Icons.delete, | 
		
	
		
			
				|  |  |  |  |                                     color: Colors.red, | 
		
	
		
			
				|  |  |  |  |                                     size: 18, | 
		
	
		
			
				|  |  |  |  |                                   ), | 
		
	
		
			
				|  |  |  |  |                                   Text( | 
		
	
		
			
				|  |  |  |  |                                     LocaleKeys.delete.tr(), | 
		
	
		
			
				|  |  |  |  |                                     style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold), | 
		
	
		
			
				|  |  |  |  |                                   ) | 
		
	
		
			
				|  |  |  |  |                                 ]), | 
		
	
		
			
				|  |  |  |  |                                 onTap: () { | 
		
	
		
			
				|  |  |  |  |                                   // widget.getEmployeePhonesList.removeWhere((item) => item.pHONEID == e.pHONEID); | 
		
	
		
			
				|  |  |  |  |                                   setState(() { | 
		
	
		
			
				|  |  |  |  |                                     deleteRow(e); | 
		
	
		
			
				|  |  |  |  |                                   }); | 
		
	
		
			
				|  |  |  |  |                                 }, | 
		
	
		
			
				|  |  |  |  |                               ), | 
		
	
		
			
				|  |  |  |  |                               SizedBox( | 
		
	
		
			
				|  |  |  |  |                                 height: 10, | 
		
	
		
			
				|  |  |  |  |                               ), | 
		
	
		
			
				|  |  |  |  |                             ])) | 
		
	
		
			
				|  |  |  |  |                         : Container()) | 
		
	
		
			
				|  |  |  |  |                     .toList()), | 
		
	
		
			
				|  |  |  |  |             SizedBox( | 
		
	
		
			
				|  |  |  |  |               height: 80, | 
		
	
		
			
				|  |  |  |  |             ) | 
		
	
		
			
				|  |  |  |  |           ], | 
		
	
		
			
				|  |  |  |  |         ), | 
		
	
		
			
				|  |  |  |  |       ), | 
		
	
		
			
				|  |  |  |  |     ); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Widget footer() { | 
		
	
		
			
				|  |  |  |  |     return Container( | 
		
	
		
			
				|  |  |  |  |       decoration: BoxDecoration( | 
		
	
		
			
				|  |  |  |  |         // borderRadius: BorderRadius.circular(10), | 
		
	
		
			
				|  |  |  |  |         color: MyColors.white, | 
		
	
		
			
				|  |  |  |  |         boxShadow: [ | 
		
	
		
			
				|  |  |  |  |           BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), | 
		
	
		
			
				|  |  |  |  |       body: Column( | 
		
	
		
			
				|  |  |  |  |         children: [ | 
		
	
		
			
				|  |  |  |  |           ListView( | 
		
	
		
			
				|  |  |  |  |             physics: const BouncingScrollPhysics(), | 
		
	
		
			
				|  |  |  |  |             padding: const EdgeInsets.all(21), | 
		
	
		
			
				|  |  |  |  |             children: [ | 
		
	
		
			
				|  |  |  |  |               DefaultButton("+ ${LocaleKeys.addRow.tr()}", () { | 
		
	
		
			
				|  |  |  |  |                 widget.getEmployeePhonesList.add(GetEmployeePhonesList(aCTION: 'NEW_ROW')); | 
		
	
		
			
				|  |  |  |  |                 setState(() {}); | 
		
	
		
			
				|  |  |  |  |               }), | 
		
	
		
			
				|  |  |  |  |               12.height, | 
		
	
		
			
				|  |  |  |  |               ListView.separated( | 
		
	
		
			
				|  |  |  |  |                   shrinkWrap: true, | 
		
	
		
			
				|  |  |  |  |                   physics: const NeverScrollableScrollPhysics(), | 
		
	
		
			
				|  |  |  |  |                   itemBuilder: (cxt, index) { | 
		
	
		
			
				|  |  |  |  |                     var element = widget.getEmployeePhonesList[index]; | 
		
	
		
			
				|  |  |  |  |                     return element.aCTION != 'DELETE_ROW' | 
		
	
		
			
				|  |  |  |  |                         ? Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ | 
		
	
		
			
				|  |  |  |  |                             PopupMenuButton( | 
		
	
		
			
				|  |  |  |  |                                 child: DynamicTextFieldWidget( | 
		
	
		
			
				|  |  |  |  |                                   LocaleKeys.selectTypeT.tr(), | 
		
	
		
			
				|  |  |  |  |                                   element.pHONETYPEMEANING ?? LocaleKeys.pleaseSelect.tr(), | 
		
	
		
			
				|  |  |  |  |                                   isEnable: false, | 
		
	
		
			
				|  |  |  |  |                                   isPopup: true, | 
		
	
		
			
				|  |  |  |  |                                 ).paddingOnly(bottom: 12), | 
		
	
		
			
				|  |  |  |  |                                 itemBuilder: (_) => <PopupMenuItem<int>>[ | 
		
	
		
			
				|  |  |  |  |                                       for (int i = 0; i < getPhoneNumberTypesList.length; i++) PopupMenuItem<int>(child: Text(getPhoneNumberTypesList![i].mEANING!), value: i), | 
		
	
		
			
				|  |  |  |  |                                     ], | 
		
	
		
			
				|  |  |  |  |                                 onSelected: (int index) { | 
		
	
		
			
				|  |  |  |  |                                   element.pHONETYPEMEANING = getPhoneNumberTypesList[index].mEANING; | 
		
	
		
			
				|  |  |  |  |                                   element.pHONETYPE = getPhoneNumberTypesList[index].cODE; | 
		
	
		
			
				|  |  |  |  |                                   setState(() {}); | 
		
	
		
			
				|  |  |  |  |                                 }), | 
		
	
		
			
				|  |  |  |  |                             DynamicTextFieldWidget( | 
		
	
		
			
				|  |  |  |  |                               "Value", | 
		
	
		
			
				|  |  |  |  |                               element.pHONENUMBER ?? "", | 
		
	
		
			
				|  |  |  |  |                               isReadOnly: false, | 
		
	
		
			
				|  |  |  |  |                               onChange: (text) { | 
		
	
		
			
				|  |  |  |  |                                 element.pHONENUMBER = text; | 
		
	
		
			
				|  |  |  |  |                               }, | 
		
	
		
			
				|  |  |  |  |                             ).paddingOnly(bottom: 12), | 
		
	
		
			
				|  |  |  |  |                             Row(mainAxisAlignment: MainAxisAlignment.end, children: [ | 
		
	
		
			
				|  |  |  |  |                               Icon(Icons.delete, color: MyColors.redColor, size: 18), | 
		
	
		
			
				|  |  |  |  |                               LocaleKeys.delete.tr().toText14(color: MyColors.redColor), | 
		
	
		
			
				|  |  |  |  |                             ]).onPress(() { | 
		
	
		
			
				|  |  |  |  |                               element.aCTION = 'DELETE_ROW'; | 
		
	
		
			
				|  |  |  |  |                               setState(() {}); | 
		
	
		
			
				|  |  |  |  |                             }), | 
		
	
		
			
				|  |  |  |  |                           ]).objectContainerView().paddingOnly(bottom: 12) | 
		
	
		
			
				|  |  |  |  |                         : Container(); | 
		
	
		
			
				|  |  |  |  |                   }, | 
		
	
		
			
				|  |  |  |  |                   separatorBuilder: (cxt, index) => 0.height, | 
		
	
		
			
				|  |  |  |  |                   itemCount: widget.getEmployeePhonesList.length) | 
		
	
		
			
				|  |  |  |  |             ], | 
		
	
		
			
				|  |  |  |  |           ).expanded, | 
		
	
		
			
				|  |  |  |  |           DefaultButton(LocaleKeys.update.tr(), () async { | 
		
	
		
			
				|  |  |  |  |             updatePhone(); | 
		
	
		
			
				|  |  |  |  |           }).insideContainer | 
		
	
		
			
				|  |  |  |  |         ], | 
		
	
		
			
				|  |  |  |  |       ), | 
		
	
		
			
				|  |  |  |  |       child: DefaultButton(LocaleKeys.update.tr(), () async { | 
		
	
		
			
				|  |  |  |  |         updatePhone(); | 
		
	
		
			
				|  |  |  |  |         //     context.setLocale(const Locale("en", "US")); // to change Loacle | 
		
	
		
			
				|  |  |  |  |         // Profile(); | 
		
	
		
			
				|  |  |  |  |       }).insideContainer, | 
		
	
		
			
				|  |  |  |  |     ); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -176,7 +116,6 @@ class _PhoneNumbersState extends State<PhoneNumbers> { | 
		
	
		
			
				|  |  |  |  |     Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |     setUpdateStatus(); | 
		
	
		
			
				|  |  |  |  |     submitPhoneNumbers = await ProfileApiClient().submitPhoneNumbers(widget.getEmployeePhonesList); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |     Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, | 
		
	
		
			
				|  |  |  |  |         arguments: RequestSubmitScreenParams(LocaleKeys.profile_contactDetails.tr(), submitPhoneNumbers.pTRANSACTIONID!, submitPhoneNumbers.pITEMKEY!, 'phone_numbers')); | 
		
	
	
		
			
				
					|  |  |  | @ -191,14 +130,4 @@ class _PhoneNumbersState extends State<PhoneNumbers> { | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     }); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void addNewRow() { | 
		
	
		
			
				|  |  |  |  |     setState(() { | 
		
	
		
			
				|  |  |  |  |       widget.getEmployeePhonesList.add(GetEmployeePhonesList(aCTION: 'NEW_ROW')); | 
		
	
		
			
				|  |  |  |  |     }); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void deleteRow(GetEmployeePhonesList row) { | 
		
	
		
			
				|  |  |  |  |     row.aCTION = 'DELETE_ROW'; | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |