diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index 3e254b4..3039e67 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -122,10 +122,7 @@ class ProfileApiClient { Future> getPhoneNumberTypes() async { String url = "${ApiConsts.erpRest}GET_OBJECT_VALUES"; - Map postParams = { - "P_MENU_TYPE": "E", - "P_SELECTED_RESP_ID": -999, - }; + Map postParams = {"P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": -999, "P_OBJECT_NAME": "PHONE_TYPE", "P_OBJECT_TYPE": "LOOKUP"}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); diff --git a/lib/main.dart b/lib/main.dart index 9952762..5e9f705 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -30,7 +30,7 @@ Future main() async { await EasyLocalization.ensureInitialized(); await Firebase.initializeApp(); AppState().setPostParamsModel( - PostParamsModel(channel: 31, versionID: 3.4, mobileType: Platform.isAndroid ? "android" : "ios"), + PostParamsModel(channel: 31, versionID: 3.6, mobileType: Platform.isAndroid ? "android" : "ios"), ); runApp( EasyLocalization( diff --git a/lib/models/get_employee_phones_model.dart b/lib/models/get_employee_phones_model.dart index 1fbba7f..b4038ae 100644 --- a/lib/models/get_employee_phones_model.dart +++ b/lib/models/get_employee_phones_model.dart @@ -1,4 +1,3 @@ - class GetEmployeePhonesList { String? dATEFROM; String? dATETO; @@ -10,20 +9,12 @@ class GetEmployeePhonesList { String? pHONETYPE; String? pHONETYPEMEANING; int? rOWINDEX; - + String? aCTION; GetEmployeePhonesList( - {this.dATEFROM, - this.dATETO, - this.oBJECTVERSIONNUMBER, - this.pARENTID, - this.pARENTTABLE, - this.pHONEID, - this.pHONENUMBER, - this.pHONETYPE, - this.pHONETYPEMEANING, - this.rOWINDEX}); + {this.aCTION, this.dATEFROM, this.dATETO, this.oBJECTVERSIONNUMBER, this.pARENTID, this.pARENTTABLE, this.pHONEID, this.pHONENUMBER, this.pHONETYPE, this.pHONETYPEMEANING, this.rOWINDEX}); GetEmployeePhonesList.fromJson(Map json) { + aCTION = json['ACTION']; dATEFROM = json['DATE_FROM']; dATETO = json['DATE_TO']; oBJECTVERSIONNUMBER = json['OBJECT_VERSION_NUMBER']; @@ -38,6 +29,7 @@ class GetEmployeePhonesList { Map toJson() { final Map data = new Map(); + data['ACTION'] = this.aCTION; data['DATE_FROM'] = this.dATEFROM; data['DATE_TO'] = this.dATETO; data['OBJECT_VERSION_NUMBER'] = this.oBJECTVERSIONNUMBER; @@ -50,4 +42,4 @@ class GetEmployeePhonesList { data['ROW_INDEX'] = this.rOWINDEX; return data; } -} \ No newline at end of file +} diff --git a/lib/ui/profile/contact_details.dart b/lib/ui/profile/contact_details.dart index d36b19a..ce00b1d 100644 --- a/lib/ui/profile/contact_details.dart +++ b/lib/ui/profile/contact_details.dart @@ -75,7 +75,8 @@ class _ContactDetailsState extends State { ), backgroundColor: MyColors.backgroundColor, bottomSheet: footer(), - body: Column(children: [ + body: SingleChildScrollView( + child: Column(children: [ Container( width: double.infinity, margin: EdgeInsets.only( @@ -84,7 +85,8 @@ class _ContactDetailsState extends State { right: 26, ), padding: EdgeInsets.only(left: 14, right: 14, top: 5, bottom: 20), - height: 200, + + ///height: 200, decoration: BoxDecoration( boxShadow: [ BoxShadow( @@ -139,7 +141,7 @@ class _ContactDetailsState extends State { right: 26, ), padding: EdgeInsets.only(left: 14, right: 14, top: 5, bottom: 20), - height: 400, + // height: 400, decoration: BoxDecoration( boxShadow: [ BoxShadow( @@ -152,8 +154,7 @@ class _ContactDetailsState extends State { color: Colors.white, borderRadius: BorderRadius.circular(10.0), ), - child: SingleChildScrollView( - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -177,7 +178,7 @@ class _ContactDetailsState extends State { ), ])) .toList()) - ]))) + ])) // "${getEmployeeAddressList[0].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), // "${getEmployeeAddressList[0].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), // SizedBox( @@ -208,7 +209,7 @@ class _ContactDetailsState extends State { //]), //), //], - ])); + ]))); } footer() { diff --git a/lib/ui/profile/phone_numbers.dart b/lib/ui/profile/phone_numbers.dart index aabf50e..cba17d5 100644 --- a/lib/ui/profile/phone_numbers.dart +++ b/lib/ui/profile/phone_numbers.dart @@ -48,51 +48,108 @@ class _PhoneNumbersState extends State { ), backgroundColor: MyColors.backgroundColor, bottomSheet: footer(), - body: Column(children: [ + body: SingleChildScrollView( + child: Column(children: [ Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 20, - left: 26, - right: 26, - ), - padding: EdgeInsets.only(left: 14, right: 14, top: 5, bottom: 20), - 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: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: widget.getEmployeePhonesList - .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - PopupMenuButton( - child: DynamicTextFieldWidget( - "Please Select *", - e.pHONETYPEMEANING ?? "", - isEnable: true, - isPopup: true, - ).paddingOnly(bottom: 12), - itemBuilder: (_) => >[ - for (int i = 0; i < getPhoneNumberTypesList.length; i++) PopupMenuItem(child: Text(getPhoneNumberTypesList![i].mEANING!), value: i), - ], - onSelected: (int index) { - e.pHONETYPEMEANING = getPhoneNumberTypesList[index].mEANING; - setState(() {}); - }), - "${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), - ])) - .toList()))) - ])); + 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( + 'Add new row', + 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( + "Please Select *", + e.pHONETYPEMEANING ?? "", + isEnable: false, + isPopup: true, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < getPhoneNumberTypesList.length; i++) PopupMenuItem(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( + 'Delete', + 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, + ) + ]))); } footer() { @@ -105,11 +162,24 @@ class _PhoneNumbersState extends State { ], ), child: DefaultButton(LocaleKeys.update.tr(), () async { + updatePhone(); // context.setLocale(const Locale("en", "US")); // to change Loacle - Profile(); + // Profile(); }).insideContainer, ); } - updatePhone() {} + void updatePhone() { + print(widget.getEmployeePhonesList); + } + + void addNewRow() { + setState(() { + widget.getEmployeePhonesList.add(GetEmployeePhonesList(aCTION: 'NEW_ROW')); + }); + } + + void deleteRow(GetEmployeePhonesList row) { + row.aCTION = 'DELETE_ROW'; + } }