diff --git a/lib/config/config.dart b/lib/config/config.dart index 1035e221..6203f62a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -83,8 +83,11 @@ const GET_BABYINFORMATION_REQUEST = const GET_BABY_BY_USER_ID = 'Services/Community.svc/REST/GetBabyByUserID'; ///userInformation -const GET_USERINFORMATION_REQUEST = - 'Services/Community.svc/REST/GetUserInformation_New'; +const GET_USERINFORMATION_REQUEST = 'Services/Community.svc/REST/GetUserInformation_New'; + +///Update email +const UPDATE_PATENT_EMAIL = 'Services/Patients.svc/REST/UpdatePateintEmail'; +const UPDATE_PATENT_INFO = 'Services/Community.svc/REST/UpdateUserInfo_New'; ///addNewChild const GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby'; @@ -92,8 +95,8 @@ const GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby'; ///newUserId const GET_NEW_USER_REQUEST = 'Services/Community.svc/REST/CreateNewUser_New'; -///delteChild -const DELETE_CHILD_REQUEST = 'Services/Community.svc/REST/DeleteBaby'; +///delete Child +const DELETE_CHILD_REQUEST = '/Services/Community.svc/REST/DeleteBaby'; ///addNewTABLE const GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 978d83af..ceea459e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1112,10 +1112,14 @@ const Map localizedValues = { "en": "Delete", "ar": "حذف" }, - "deleted-child": { + "deleted-child-mes": { "en": "The request was successful. The children have removed from the vaccination schedule subscription service.", "ar": "تم حذف الطفل بنجاح" }, + "deleted-child":{ + "en":"Delete child", + "ar":"إالغاء الطفل" + }, "visit": { "en": "Visit", "ar": "زيارة" @@ -1128,5 +1132,24 @@ const Map localizedValues = { "en": "Due date", "ar": "تاريخ الاستحقاق" }, - + "valid-email": { + "en": "Please enter valid email", + "ar": "الرجاء إدخال عنوان بريد صحيح" + }, + "confirm-send": { + "en": "Send the child's schedule to the email?", + "ar": "ارسال جدول التطعيمات الى بريدك الالكتروني؟" + }, + "email-success": { + "en": " The request was successful. You will receive the Schedule in moments.", + "ar": "تم ارسال جدول التطعيمات " + }, + "add-instructions": { + "en": "Add the child's information below to recieve the schedule of vaccinations.", + "ar": "أضف معلومات الطفل لاستلام جدول التطعيمات" + }, + "added-child": { + "en": "The request was successful. You have added a child to the vaccination schedule subscription service.", + "ar": "تمت الاضافة بنجاح." + }, }; diff --git a/lib/core/service/childvaccines/add_new_child_service.dart b/lib/core/service/childvaccines/add_new_child_service.dart index 5e4a4d86..98e87100 100644 --- a/lib/core/service/childvaccines/add_new_child_service.dart +++ b/lib/core/service/childvaccines/add_new_child_service.dart @@ -14,19 +14,12 @@ class CreteNewBabyService extends BaseService { Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async { hasError = false; - await getUser(); Map body = Map.from(newChild.toJson()); body['CreatedBy'] = 102; body['EditedBy'] = 102; body['UserID'] = userID; body['AlertBy'] = 2; - body['EmailAddress'] = user.emailAddress; body['IsLogin'] = true; - body['LogInTokenID'] = await sharedPref.getString(TOKEN); - body['MobileNumber'] = user.mobileNumber; - body['NationalID'] = user.nationalityID; - body['ZipCode'] = user.zipCode; - body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_NEWCHILD_REQUEST, diff --git a/lib/core/service/childvaccines/delete_baby_service.dart b/lib/core/service/childvaccines/delete_baby_service.dart index 115d13c5..49cbd29e 100644 --- a/lib/core/service/childvaccines/delete_baby_service.dart +++ b/lib/core/service/childvaccines/delete_baby_service.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart'; @@ -17,22 +18,13 @@ class DeleteBabyService extends BaseService{ List deleteBabyModelList= List(); - Future getDeleteBabyOrder({DeleteBaby deleteChild,int babyID}) async { + Future getDeleteBabyOrder({List_BabyInformationModel babyInfo}) async { hasError = false; await getUser(); - Map body = Map.from(deleteChild.toJson()); - // body['CreatedBy'] = 102; + Map body = Map(); body['EditedBy'] = 102; - //body['BabyID'] = babyID; - //body['BabyID'] = createNewBabyModelList ; - // body['AlertBy'] = 2; - // body['EmailAddress'] = user.emailAddress; body['IsLogin'] = true; - body['LogInTokenID'] = await sharedPref.getString(TOKEN); - body['MobileNumber'] = user.mobileNumber; - body['NationalID'] = user.nationalityID; - body['ZipCode'] = user.zipCode; - + body['BabyID'] = babyInfo.babyID; body['isDentalAllowedBackend'] = false; await baseAppClient.post(DELETE_CHILD_REQUEST, @@ -45,31 +37,6 @@ class DeleteBabyService extends BaseService{ }, body: body); } - // Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async { - // hasError = false; - // await getUser(); - // Map body = Map.from(newChild.toJson()); - // body['CreatedBy'] = 102; - // body['EditedBy'] = 102; - // body['UserID'] = userID; - // body['AlertBy'] = 2; - // body['EmailAddress'] = user.emailAddress; - // body['IsLogin'] = true; - // body['LogInTokenID'] = await sharedPref.getString(TOKEN); - // body['MobileNumber'] = user.mobileNumber; - // body['NationalID'] = user.nationalityID; - // body['ZipCode'] = user.zipCode; - // - // body['isDentalAllowedBackend'] = false; - // - // await baseAppClient.post(GET_NEWCHILD_REQUEST, - // onSuccess: (dynamic response, int statusCode) { - // var asd =""; - // }, - // onFailure: (String error, int statusCode) { - // hasError = true; - // super.error = error; - // }, body: body); - // } + } \ No newline at end of file diff --git a/lib/core/service/childvaccines/get_vaccinations_item_services.dart b/lib/core/service/childvaccines/get_vaccinations_item_services.dart deleted file mode 100644 index 5ff936af..00000000 --- a/lib/core/service/childvaccines/get_vaccinations_item_services.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/get_vacainations_itemsmodel.dart'; - -import '../base_service.dart'; - -class GetVccinationsItemsService extends BaseService { - List getVaccinationsItemModelList = List(); - Map body = Map(); - - - - Future getaccinationsitemOrders() async { - hasError = false; - await baseAppClient.post(GET_TABLE_REQUEST, - onSuccess: (dynamic response, int statusCode) { - getVaccinationsItemModelList.clear(); - response['List_CreateVaccinationTableModel'].forEach((vital) { - getVaccinationsItemModelList.add( - GET_VACCINATIONS_ITEMSMODEL.fromJson(vital)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); - } - -} \ No newline at end of file diff --git a/lib/core/service/childvaccines/user_information_service.dart b/lib/core/service/childvaccines/user_information_service.dart index 0628920c..55ddc259 100644 --- a/lib/core/service/childvaccines/user_information_service.dart +++ b/lib/core/service/childvaccines/user_information_service.dart @@ -4,11 +4,11 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_m import '../base_service.dart'; class UserInformationService extends BaseService { - List userInformationModelList = List(); - Map body = Map(); + List_UserInformationModel userInformationModel = List_UserInformationModel(); Future getUserInformationOrders() async { hasError = false; + Map body = Map(); await getUser(); body['CreatedBy'] = 102; body['EditedBy'] = 102; @@ -22,14 +22,44 @@ class UserInformationService extends BaseService { await baseAppClient.post(GET_USERINFORMATION_REQUEST, onSuccess: (dynamic response, int statusCode) { - userInformationModelList.clear(); - response['List_UserInformationModel_New'].forEach((vital) { - userInformationModelList.add(List_UserInformationModel.fromJson(vital)); + userInformationModel = List_UserInformationModel.fromJson(vital); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } + + Future updateEmail(String email) async { + hasError = false; + Map body = Map(); + body['IsInternalRequest'] = true; + body['EmailAddress'] = email; + body['IsLogin'] = true; + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(UPDATE_PATENT_EMAIL, + onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future updateUserInfo(String email) async { + hasError = false; + Map body = Map(); + body['IsInternalRequest'] = true; + body['EmailAddress'] = email; + body['IsLogin'] = true; + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(UPDATE_PATENT_INFO, + onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } diff --git a/lib/core/service/childvaccines/vaccination_table_service.dart b/lib/core/service/childvaccines/vaccination_table_service.dart index 7f987b76..da3c8518 100644 --- a/lib/core/service/childvaccines/vaccination_table_service.dart +++ b/lib/core/service/childvaccines/vaccination_table_service.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import '../base_service.dart'; class VaccinationTableService extends BaseService { @@ -10,19 +12,16 @@ class VaccinationTableService extends BaseService { - Future getCreateVaccinationTableOrders() async { + Future getCreateVaccinationTableOrders({List_BabyInformationModel babyInfo, List_UserInformationModel informationModel, bool isSendEmail=false}) async { hasError = false; await getUser(); - body['BabyName']="fffffffffff eeeeeeeeeeeeee"; - body['DOB'] = "/Date(1585774800000+0300)/"; - body['EmailAddress'] = user.emailAddress; + body['BabyName']=babyInfo.babyName; + body['DOB'] = DateUtil.convertDateToString(babyInfo.dOB); + body['EmailAddress'] = informationModel.emailAddress; body['isDentalAllowedBackend'] = false; - body['SendEmail'] = false; + body['SendEmail'] = isSendEmail; body['IsLogin'] =true; - - - await baseAppClient.post(GET_TABLE_REQUEST, onSuccess: (dynamic response, int statusCode) { createVaccinationTableModelList.clear(); diff --git a/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart index eebaca02..2559c074 100644 --- a/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart +++ b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart @@ -13,7 +13,6 @@ class AddNewChildViewModel extends BaseViewModel { CreteNewBabyService _creteNewBabyService = locator(); ChildVaccinesService _childVaccinesService = locator(); - // DeleteBabyService _deleteBabyService = locator(); bool isAdded = false; ///create new baby createNewBabyOrders({ CreateNewBaby newChild}) async { @@ -25,13 +24,7 @@ class AddNewChildViewModel extends BaseViewModel { } else { isAdded = true; setState(ViewState.Idle); - await _childVaccinesService.getAllBabyInformationOrders(); - if (_childVaccinesService.hasError) { - error = _childVaccinesService.error; - setState(ViewState.Error); - } else{ - } } } diff --git a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart index 7c4af285..a713b6ec 100644 --- a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart +++ b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart @@ -16,14 +16,11 @@ class ChildVaccinesViewModel extends BaseViewModel{ List get babyInformationModelList=> _childVaccinesService.babyInformationModelList; - -//=========== CreteNewBabyService _creteNewBabyService = locator(); DeleteBabyService _deleteBabyService = locator(); bool isAdded = false; bool isDeleted = false; - //============ getNewUserOrders() async { @@ -48,25 +45,15 @@ class ChildVaccinesViewModel extends BaseViewModel{ ///delete baby - deleteBabyOrders({ DeleteBaby newChild}) async { + deleteBabyOrders({ List_BabyInformationModel babyInfo}) async { setState(ViewState.Busy); - //await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild, userID: _childVaccinesService.userID); - await _deleteBabyService.getDeleteBabyOrder(deleteChild: newChild,babyID: newChild.babyID); - //getDeleteBabyOrder(deleteChild: newChild,); - // getDeleteBabyOrder - if (_creteNewBabyService.hasError) { - error = _creteNewBabyService.error; + await _deleteBabyService.getDeleteBabyOrder(babyInfo: babyInfo); + if (_deleteBabyService.hasError) { + error = _deleteBabyService.error; setState(ViewState.Error); } else { isDeleted = true; - setState(ViewState.Idle); - await _childVaccinesService.getAllBabyInformationOrders(); - if (_childVaccinesService.hasError) { - error = _childVaccinesService.error; - setState(ViewState.Error); - } else{ - - } + getBabyInformatioRequestOrders(); } } diff --git a/lib/core/viewModels/child_vaccines/user_information_view_model.dart b/lib/core/viewModels/child_vaccines/user_information_view_model.dart index 43269f42..e183ee42 100644 --- a/lib/core/viewModels/child_vaccines/user_information_view_model.dart +++ b/lib/core/viewModels/child_vaccines/user_information_view_model.dart @@ -8,8 +8,7 @@ class UserInformationViewModel extends BaseViewModel { UserInformationService _userInformationService = locator(); - List get userInformationModelList => - _userInformationService.userInformationModelList; + List_UserInformationModel get userInformationModelList => _userInformationService.userInformationModel; getUserInformationRequestOrders() async { setState(ViewState.Busy); @@ -20,4 +19,15 @@ class UserInformationViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + updateEmail(String email)async{ + setState(ViewState.Busy); + await _userInformationService.updateEmail(email); + await _userInformationService.updateUserInfo(email); + if (_userInformationService.hasError) { + error = _userInformationService.error; + setState(ViewState.Error); + } else + await getUserInformationRequestOrders(); + } } diff --git a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart index 3b72dd50..25559b81 100644 --- a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart +++ b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart @@ -1,30 +1,27 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; -import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/service/childvaccines/vaccination_table_service.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; +class VaccinationTableViewModel extends BaseViewModel { + VaccinationTableService _creteVaccinationTableService = + locator(); -class VaccinationTableViewModel extends BaseViewModel{ + List get creteVaccinationTableModelList => + _creteVaccinationTableService.createVaccinationTableModelList; - VaccinationTableService _creteVaccinationTableService = locator(); - - // String get creteVaccinationTableContent => _creteVaccinationTableService.userAgreementContent; - //String get userAgreementContent => _creteNewBabyService.v//_reportsService.userAgreementContent; - List get creteVaccinationTableModelList=> _creteVaccinationTableService.createVaccinationTableModelList;//.createNewBabyModelList; - getCreateVaccinationTable() async { + getCreateVaccinationTable({List_BabyInformationModel babyInfo, List_UserInformationModel informationModel, bool isSendEmail =false}) async { setState(ViewState.Busy); - await _creteVaccinationTableService.getCreateVaccinationTableOrders();//getCreateNewBabyOrders(); - - if ( _creteVaccinationTableService.hasError) { - error = _creteVaccinationTableService.error; + await _creteVaccinationTableService.getCreateVaccinationTableOrders(babyInfo: babyInfo,informationModel: informationModel,isSendEmail: isSendEmail); + if (_creteVaccinationTableService.hasError) { + error = _creteVaccinationTableService.error; setState(ViewState.Error); } else setState(ViewState.Idle); } - } diff --git a/lib/pages/ChildVaccines/ChidDetailsWidget.dart b/lib/pages/ChildVaccines/ChidDetailsWidget.dart index bce5d54e..c06c5422 100644 --- a/lib/pages/ChildVaccines/ChidDetailsWidget.dart +++ b/lib/pages/ChildVaccines/ChidDetailsWidget.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -9,99 +10,110 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; + +import 'dialogs/delete_child.dart'; class ChildDetailsWidget extends StatelessWidget { final ChildVaccinesViewModel model; final List_BabyInformationModel babyInfo; - DeleteBaby deleteBaby = DeleteBaby(); + final List_UserInformationModel informationModel; + final Function onTapDelete; - ChildDetailsWidget({this.model, this.babyInfo}); + ChildDetailsWidget({this.model, this.babyInfo, this.informationModel, this.onTapDelete}); @override Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.only(left: 5, right: 5, bottom: 10), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.white, - ), - padding: EdgeInsets.all(12), - width: 200, - //double.infinity, - child: Column( - children: [ - Row(children: [ - Texts(TranslationBase.of(context).childName), - ]), - Row(children: [ - Texts(babyInfo.babyName.trim()), - ]), - Row(children: [ - IconButton( - icon: Image.asset(babyInfo.gender == 1 - ? 'assets/images/new-design/male.png' - : 'assets/images/new-design/female.png'), - tooltip: '', - onPressed: () { - }, + return InkWell( + onTap: (){ + Navigator.push( + context, + FadePage( + page: VaccinationTablePage( + babyInfo: babyInfo, + informationModel: informationModel, ), - Texts(babyInfo.genderDescription), - IconButton( - icon: Icon( - Icons.remove_red_eye, - color: Colors.red, - ), - tooltip: '', - onPressed: () { - Navigator.push( - context, - FadePage( - page: VaccinationTablePage(babyInfo: babyInfo,), - ), - ); - }, - ) - ]), - Row(children: [ - Texts(TranslationBase.of(context).childDob), - ]), - Row( - children: [ + ), + ); + }, + child: Container( + margin: EdgeInsets.only(left: 5, right: 5, bottom: 10), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border.all(color: Colors.white, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(5)), + color: Colors.white, + ), + padding: EdgeInsets.all(12), + width: 200, + //double.infinity, + child: Column( + children: [ + Row(children: [ + Texts(TranslationBase.of(context).childName), + ]), + Row(children: [ + Texts(babyInfo.babyName.trim()), + ]), + Row(children: [ IconButton( - icon: new Image.asset( - 'assets/images/new-design/calender-secondary.png'), + icon: Image.asset(babyInfo.gender == 1 + ? 'assets/images/new-design/male.png' + : 'assets/images/new-design/female.png'), tooltip: '', + onPressed: () { + }, ), - Texts( - DateUtil.yearMonthDay(babyInfo.dOB), + Texts(babyInfo.genderDescription), + IconButton( + icon: Icon( + Icons.remove_red_eye, + color: Colors.red, + ), + tooltip: '', + onPressed: () { + Navigator.push( + context, + FadePage( + page: VaccinationTablePage( + babyInfo: babyInfo, + informationModel: informationModel, + ), + ), + ); + }, + ) + ]), + Row(children: [ + Texts(TranslationBase.of(context).childDob), + ]), + Row( + children: [ + IconButton( + icon: new Image.asset( + 'assets/images/new-design/calender-secondary.png'), + tooltip: '', + ), + Texts( + DateUtil.yearMonthDay(babyInfo.dOB), + ), + ], + ), + Row(children: [ + IconButton( + icon: new Image.asset('assets/images/new-design/garbage.png'), + tooltip: '', + onPressed: () async { + onTapDelete(); + }, ), - ], - ), - Row(children: [ - IconButton( - icon: new Image.asset('assets/images/new-design/garbage.png'), - tooltip: '', - onPressed: () async { - await model.deleteBabyOrders(newChild: deleteBaby); - deleteBaby.babyID = babyInfo.babyID; - - await model.deleteBabyOrders(newChild: deleteBaby); - if (model.isDeleted) { - AppToast.showSuccessToast(message: TranslationBase.of(context).deletedChild); - Navigator.pop(context, model.isDeleted); - } else { - //TODO handling error - } - }, + Texts(TranslationBase.of(context).delete), + ]), + SizedBox( + height: 12, ), - Texts(TranslationBase.of(context).delete), - ]), - SizedBox( - height: 12, - ), - ], + ], + ), ), ); } diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart index 51b89f98..10dea666 100644 --- a/lib/pages/ChildVaccines/add_newchild_page.dart +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -21,39 +22,16 @@ import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; enum Gender { Male, Female, NON } -enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } class AddNewChildPage extends StatefulWidget { - final int frequency; - final int days; - final String itemDescription; String dateAdd; - List _scheduleList = List(); - List daysOfWeek = [ - DayOfWeek.Monday, - DayOfWeek.Tuesday, - DayOfWeek.Wednesday, - DayOfWeek.Thursday, - DayOfWeek.Friday, - DayOfWeek.Saturday, - DayOfWeek.Sunday - ]; - DateTime startDay; DateTime endDay; - //AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key); - AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) { + AddNewChildPage() { startDay = DateTime.now(); - endDay = - DateTime.now(); //endDay = DateTime.now().add(Duration(days: days)); - int hour = 24; //(24 / frequency).round(); - int durations = 24 ~/ hour; - for (int count = 0; count < durations; count++) { - _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day, (hour * count))); - } + endDay = DateTime.now(); } @override @@ -61,150 +39,140 @@ class AddNewChildPage extends StatefulWidget { } class _AddNewChildPageState extends State { - int tappedIndex; int checkedValue; - @override - void initState() { - super.initState(); - tappedIndex = -1; - } - TextEditingController _firstTextController = TextEditingController(); TextEditingController _secondTextController = TextEditingController(); - TextEditingController _notesTextController = TextEditingController(); - BeneficiaryType beneficiaryType = BeneficiaryType.NON; Gender gender = Gender.Male; CreateNewUser_New newUserChild = CreateNewUser_New(); - //ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel(); - List_BabyInformationModel addvancedModel = List_BabyInformationModel(); CreateNewBaby newChild = CreateNewBaby(); - List_UserInformationModel informationModel = List_UserInformationModel(); + + String firstName = ""; + String secondName = ""; @override Widget build(BuildContext context) { return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: "Vaccintion", + appBarTitle: TranslationBase.of(context).vaccination, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( margin: EdgeInsets.all(12), child: Column( - // crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 50, - ), - Texts( - "Add the child's information below to recieve the schedule of vaccinations.", - //+model.user.firstName, - textAlign: TextAlign.center, + height: 25, ), + Texts(TranslationBase.of(context).addInstructions), SizedBox( - height: 12, + height: 20, ), NewTextFields( - hintText: "First Name", + hintText: TranslationBase.of(context).firstName, controller: _firstTextController, + onChanged: (value) { + setState(() { + firstName = value; + }); + }, ), SizedBox( height: 12, ), NewTextFields( - hintText: "Second Name", + hintText: TranslationBase.of(context).lastName, controller: _secondTextController, + onChanged: (value) { + secondName = value; + }, ), SizedBox( - height: 12, + height: 20, ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Gender:", + TranslationBase.of(context).gender + " :", textAlign: TextAlign.end, ), ], ), + SizedBox( + height: 15, + ), Container( - height: MediaQuery.of(context).size.height * 0.12, + height: 60, width: double.infinity, - padding: EdgeInsets.all(12), - - child: Row( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: 175, - color: Colors.white, - child: SecondaryButton( - textColor: - checkedValue == 1 ? Colors.white : Colors.black, - color: checkedValue == 1 ? Colors.red : Colors.white, - - label: "Male", - // - onTap: () { - - setState(() { - checkedValue = 1; - print("checkedValue=" + checkedValue.toString()); - }); - - // bloodDetails. - }, + Expanded( + child: AnimatedContainer( + duration: Duration(milliseconds: 400), + height: 60, + color: Colors.white, + child: SecondaryButton( + textColor: + checkedValue == 1 ? Colors.white : Colors.black, + color: + checkedValue == 1 ? Colors.red : Colors.white, + label: TranslationBase.of(context).male, + onTap: () { + setState(() { + checkedValue = 1; + }); + }, + ), ), ), - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: 175, - color: Colors.white, - child: SecondaryButton( - textColor: - checkedValue == 2 ? Colors.white : Colors.black, - color: checkedValue == 2 ? Colors.red : Colors.white, - label: "Female", - // - onTap: () { - setState(() { - checkedValue = 2; - print("checkedValue=" + checkedValue.toString()); - }); - // bloodDetails.city=_selectedHospital.toString(); - - // bloodDetails. - }, + Expanded( + child: AnimatedContainer( + duration: Duration(milliseconds: 400), + height: 60, + color: Colors.white, + child: SecondaryButton( + textColor: + checkedValue == 2 ? Colors.white : Colors.black, + color: + checkedValue == 2 ? Colors.red : Colors.white, + label: TranslationBase.of(context).female, + onTap: () { + setState(() { + checkedValue = 2; + }); + }, + ), ), ) ], ), ), - //========== SizedBox( - height: 6, + height: 20, ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Date Of Birth::", + TranslationBase.of(context).dob + " :", textAlign: TextAlign.end, ), ], ), + SizedBox( + height: 8, + ), InkWell( onTap: () { DatePicker.showDatePicker( context, showTitleActions: true, - // minTime: DateTime( - // DateTime.now().year, DateTime.now().month - 1, 1), minTime: DateTime(1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { @@ -213,7 +181,6 @@ class _AddNewChildPageState extends State { }); }, currentTime: widget.startDay, - // locale: projectViewModel.localeType ); }, child: Container( @@ -224,99 +191,63 @@ class _AddNewChildPageState extends State { borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(//getStartDay() - // DateUtil.yearMonthDay(DateTime.now()) - getStartDay()), Icon( Icons.calendar_today, color: Colors.black, - ) + ), + SizedBox( + width: 25, + ), + Expanded(child: Texts(getStartDay())), ], ), ), ), SizedBox( - height: 12, + height: 25, ), Container( - height: MediaQuery.of(context).size.height * 0.12, + height: 60, width: double.infinity, - padding: EdgeInsets.all(15), child: SecondaryButton( textColor: Colors.white, - color: checkedValue == false - ? Colors.white24 - : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), - label: "Add", - // - onTap: () async{ - newChild.babyName = _firstTextController.text + " " + _secondTextController.text; + color: Colors.grey[800], + disabled: (checkedValue == null || + firstName.isEmpty || + secondName.isEmpty), + label: TranslationBase.of(context).add, + onTap: () async { + newChild.babyName = _firstTextController.text + + " " + + _secondTextController.text; newChild.gender = checkedValue.toString(); - newChild.strDOB = getStartDay(); + newChild.strDOB = widget.startDay.toIso8601String(); newChild.tempValue = true; newChild.isLogin = true; await model.createNewBabyOrders(newChild: newChild); - if(model.isAdded){ - AppToast.showSuccessToast(message: "Record Added"); - Navigator.pop(context,model.isAdded); - }else{ - - //TODO handling error + if (model.isAdded) { + AppToast.showSuccessToast( + message: TranslationBase.of(context).addedChild); + Navigator.pop(context, model.isAdded); + } else { + AppToast.showSuccessToast(message: model.error); } - }, ), ), - //========= ], ), ), ), - // bottomSheet: + // bottomSheet: ), ); } String getStartDay() { - return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}"; - } - - String getEndDay() { - return "${DateUtil.getMonth(widget.endDay.month)} ${widget.endDay.day}, ${widget.endDay.year}"; - } - - String getDateTime(DateTime dateTime) { - return '${dateTime.hour}:${dateTime.minute}'; - } - - String getDays() { - String days = ""; - widget.daysOfWeek.forEach((element) { - days += "${DateUtil.getDay(element)},"; - }); - return days; - } - - void confirmSelectDayDialog() { - showDialog( - context: context, - child: DayCheckBoxDialog( - title: 'Select Day', - selectedDaysOfWeek: widget.daysOfWeek, - onValueSelected: (value) { - setState(() { - widget.daysOfWeek = value; - }); - }, - ), - ); + return "${widget.startDay.day}-${widget.startDay.month}-${widget.startDay.year}"; } } diff --git a/lib/pages/ChildVaccines/child_page.dart b/lib/pages/ChildVaccines/child_page.dart index 7493a492..45020f79 100644 --- a/lib/pages/ChildVaccines/child_page.dart +++ b/lib/pages/ChildVaccines/child_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; @@ -13,15 +14,20 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; import 'ChidDetailsWidget.dart'; import 'dialogs/delete_child.dart'; class ChildPage extends StatefulWidget { + final List_UserInformationModel informationModel; + + const ChildPage({Key key, this.informationModel}) : super(key: key); + @override _ChildPageState createState() => _ChildPageState(); } -//TODO + class _ChildPageState extends State with SingleTickerProviderStateMixin { DeleteBaby deleteBaby = DeleteBaby(); @@ -31,7 +37,7 @@ class _ChildPageState extends State var checkedValue = true; return BaseView( onModelReady: (model) => model.getNewUserOrders(), - builder: (_, model, widget) => AppScaffold( + builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).vaccination, baseViewModel: model, @@ -54,6 +60,23 @@ class _ChildPageState extends State return ChildDetailsWidget( model: model, babyInfo: model.babyInformationModelList[index], + informationModel: widget.informationModel, + onTapDelete: () { + showDialog( + context: context, + child: DeleteChild(onTap: () async { + await model.deleteBabyOrders(babyInfo: model.babyInformationModelList[index]); + if (model.isDeleted) { + AppToast.showSuccessToast( + message: + TranslationBase.of(context).emailSuccess, + toastLength: Toast.LENGTH_LONG); + } else { + AppToast.showSuccessToast(message: model.error); + } + }), + ); + }, ); }, ), @@ -87,7 +110,8 @@ class _ChildPageState extends State builder: (context) => AddNewChildPage(), ), ).then((value) { - if (value) model.getNewUserOrders(); + if (value!=null) + model.getNewUserOrders(); }); }, ), diff --git a/lib/pages/ChildVaccines/child_vaccines_page.dart b/lib/pages/ChildVaccines/child_vaccines_page.dart index 4dd4c7f5..e3503894 100644 --- a/lib/pages/ChildVaccines/child_vaccines_page.dart +++ b/lib/pages/ChildVaccines/child_vaccines_page.dart @@ -23,6 +23,7 @@ class _ChildVaccinesPageState extends State TextEditingController titleController = TextEditingController(); var checkedValue = false; String addEmail = ""; + final updateEmailFormKey = GlobalKey(); @override Widget build(BuildContext context) { @@ -72,30 +73,31 @@ class _ChildVaccinesPageState extends State indent: 10, endIndent: 10, ), - Padding( - padding: const EdgeInsets.all(10.0), - child: Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - fillColor: Colors.red, - hintText: model.user.emailAddress, - controller: titleController, - fontSize: 20, - hintColor: Colors.black, - fontWeight: FontWeight.w600, - onChanged: (text) { - addEmail = text; - model.user.emailAddress == addEmail - ? checkedValue = false - : checkedValue = true; - }, - validator: (value) { - if (value == null) { - return model.user.emailAddress; - } else { - return model.user.emailAddress; - } - }, + Form( + key: updateEmailFormKey, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + fillColor: Colors.red, + initialValue: model.userInformationModelList.emailAddress, + fontSize: 20, + hintColor: Colors.black, + fontWeight: FontWeight.w600, + onChanged: (text) { + setState(() { + addEmail = text; + }); + }, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context).enterEmail; + else if (!RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(value)) + return TranslationBase.of(context).validEmail; + return null; + }, + ), ), ), ), @@ -105,23 +107,17 @@ class _ChildVaccinesPageState extends State padding: EdgeInsets.all(15), child: SecondaryButton( textColor: Colors.white, - color: checkedValue == false - ? Colors.white24 - : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), + color: model.userInformationModelList.emailAddress == addEmail ? Colors.white24 : Color.fromRGBO(63, 72, 74, 1,), + disabled: addEmail.isEmpty, label: TranslationBase.of(context).updateEmail, - // - onTap: () { - model.user.emailAddress = addEmail.toString(); - AppToast.showSuccessToast( - message: TranslationBase.of(context).updatedEmail); - // bloodDetails.city=_selectedHospital.toString(); + onTap: () async{ + final form = updateEmailFormKey.currentState; + if (form.validate()) { + form.save(); + await model.updateEmail(addEmail); + AppToast.showSuccessToast(message: TranslationBase.of(context).updatedEmail); + } - // bloodDetails. }, ), ), @@ -138,11 +134,10 @@ class _ChildVaccinesPageState extends State 1, ), label: TranslationBase.of(context).viewListChildren, - // onTap: () => Navigator.push( context, FadePage( - page: ChildPage(), + page: ChildPage(informationModel: model.userInformationModelList,), ), ), ), diff --git a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart b/lib/pages/ChildVaccines/dialogs/ConfirmSendEmailDialog.dart similarity index 70% rename from lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart rename to lib/pages/ChildVaccines/dialogs/ConfirmSendEmailDialog.dart index 33c11020..2279dd51 100644 --- a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart +++ b/lib/pages/ChildVaccines/dialogs/ConfirmSendEmailDialog.dart @@ -5,16 +5,18 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class SelectGenderDialog extends StatefulWidget { - final Email; +class ConfirmSendEmailDialog extends StatefulWidget { + final email; + final Function onTap; + + const ConfirmSendEmailDialog({Key key, this.email, this.onTap}) + : super(key: key); - const SelectGenderDialog({Key key, this.Email}) : super(key: key); @override - _SelectGenderDialogState createState() => _SelectGenderDialogState(); + _ConfirmSendEmailDialogState createState() => _ConfirmSendEmailDialogState(); } -class _SelectGenderDialogState extends State { - +class _ConfirmSendEmailDialogState extends State { @override Widget build(BuildContext context) { return SimpleDialog( @@ -22,22 +24,15 @@ class _SelectGenderDialogState extends State { Container( child: Column( children: [ + Texts(TranslationBase.of(context).confirm), Divider(), Row( children: [ Expanded( flex: 1, - child: InkWell( - onTap: () { - setState(() { - //beneficiaryType = Gender.Male; - }); - }, - child: ListTile( - title: Text("Send the child's schedule to the email\n Tamer.dasdasdas@gmail.com "), - - - ), + child: ListTile( + title: Text(TranslationBase.of(context).confirmSend + + "\n ${widget.email} "), ), ) ], @@ -45,15 +40,7 @@ class _SelectGenderDialogState extends State { SizedBox( height: 5.0, ), - - SizedBox( - height: 5.0, - ), - SizedBox( - height: 5.0, - ), Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 1, @@ -83,8 +70,7 @@ class _SelectGenderDialogState extends State { flex: 1, child: InkWell( onTap: () { - AppToast.showSuccessToast(message: "Email Sended"); - // widget.onValueSelected(beneficiaryType); + widget.onTap(); Navigator.pop(context); }, child: Padding( @@ -106,7 +92,4 @@ class _SelectGenderDialogState extends State { ], ); } - - - } diff --git a/lib/pages/ChildVaccines/dialogs/delete_child.dart b/lib/pages/ChildVaccines/dialogs/delete_child.dart index 250f40d3..41b02bd5 100644 --- a/lib/pages/ChildVaccines/dialogs/delete_child.dart +++ b/lib/pages/ChildVaccines/dialogs/delete_child.dart @@ -6,6 +6,10 @@ import 'package:flutter/material.dart'; class DeleteChild extends StatefulWidget { + final Function onTap; + + const DeleteChild({Key key, this.onTap}) : super(key: key); + @override _DeleteChildState createState() => _DeleteChildState(); } @@ -18,21 +22,14 @@ class _DeleteChildState extends State { Container( child: Column( children: [ + Texts(TranslationBase.of(context).confirm), Divider(), Row( children: [ Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - //beneficiaryType = Gender.Male; - }); - }, - child: ListTile( - title: Text("Delete the child "), + child: ListTile( + title: Texts(TranslationBase.of(context).deletedChild), - ), ), ) ], @@ -40,15 +37,7 @@ class _DeleteChildState extends State { SizedBox( height: 5.0, ), - - SizedBox( - height: 5.0, - ), - SizedBox( - height: 5.0, - ), Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 1, @@ -78,7 +67,7 @@ class _DeleteChildState extends State { flex: 1, child: InkWell( onTap: () { - // widget.onValueSelected(beneficiaryType); + widget.onTap(); Navigator.pop(context); }, child: Padding( diff --git a/lib/pages/ChildVaccines/vaccinationtable_page.dart b/lib/pages/ChildVaccines/vaccinationtable_page.dart index 4654c75a..68734c9a 100644 --- a/lib/pages/ChildVaccines/vaccinationtable_page.dart +++ b/lib/pages/ChildVaccines/vaccinationtable_page.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/vaccination_table_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -9,19 +11,23 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; import 'package:flutter_html/flutter_html.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'dialogs/SelectGenderDialog.dart'; +import 'dialogs/ConfirmSendEmailDialog.dart'; class VaccinationTablePage extends StatelessWidget { final List_BabyInformationModel babyInfo; + final List_UserInformationModel informationModel; + + const VaccinationTablePage({Key key, this.babyInfo, this.informationModel}) + : super(key: key); - const VaccinationTablePage({Key key, this.babyInfo}) : super(key: key); @override Widget build(BuildContext context) { var checkedValue; return BaseView( - onModelReady: (model) => model.getCreateVaccinationTable(), + onModelReady: (model) => model.getCreateVaccinationTable(babyInfo: babyInfo, informationModel: informationModel), builder: (_, model, w) => AppScaffold( isShowAppBar: true, baseViewModel: model, @@ -37,22 +43,30 @@ class VaccinationTablePage extends StatelessWidget { Expanded( child: Column( children: [ - Texts(TranslationBase.of(context).childName), - Texts(babyInfo.babyName??'',fontWeight: FontWeight.w600,), + Texts(TranslationBase.of(context).childName), + Texts( + babyInfo.babyName ?? '', + fontWeight: FontWeight.w600, + ), ], ), ), Expanded( - child: Column(children: [ - + child: Column( + children: [ Texts(TranslationBase.of(context).childDob), Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(FontAwesomeIcons.calendarCheck,color: Colors.red,), - SizedBox(width: 15,), - Texts(DateUtil.yearMonthDay(babyInfo.dOB)??''), + Icon( + FontAwesomeIcons.calendarCheck, + color: Colors.red, + ), + SizedBox( + width: 15, + ), + Texts(DateUtil.yearMonthDay(babyInfo.dOB) ?? ''), ], ), ], @@ -60,7 +74,9 @@ class VaccinationTablePage extends StatelessWidget { ), ], ), - SizedBox(height: 15,), + SizedBox( + height: 15, + ), Divider(), Column( children: [ @@ -75,25 +91,19 @@ class VaccinationTablePage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Texts(TranslationBase.of(context).descriptionVaccination), + Texts(TranslationBase.of(context) + .descriptionVaccination), ], ), ), Texts(TranslationBase.of(context).dueDate), ], ), - ], ), ...List.generate( model.creteVaccinationTableModelList.length, (index) => Container( - // decoration: BoxDecoration( - // shape: BoxShape.rectangle, - // border: Border.all(color: Colors.white, width: 0.5), - // borderRadius: BorderRadius.all(Radius.circular(5)), - // // color: Colors.white, - // ), padding: EdgeInsets.all(12), width: double.infinity, child: Column( @@ -111,16 +121,21 @@ class VaccinationTablePage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Html( - data: model.creteVaccinationTableModelList[index].vaccinesDescription, + data: model + .creteVaccinationTableModelList[index] + .vaccinesDescription, ), ], ), ), - Texts(model.creteVaccinationTableModelList[index].givenAt), + Texts(model + .creteVaccinationTableModelList[index].givenAt), ], ), Divider( - color: Colors.white,height: 3,thickness: 1.0, + color: Colors.white, + height: 3, + thickness: 1.0, ), ], ), @@ -140,12 +155,24 @@ class VaccinationTablePage extends StatelessWidget { textColor: Colors.white, color: checkedValue == false ? Colors.white24 - : Color.fromRGBO(63, 72, 74, 1,), + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), label: TranslationBase.of(context).sendEmail, onTap: () { showDialog( context: context, - child: SelectGenderDialog(), + child: ConfirmSendEmailDialog( + email: informationModel.emailAddress, + onTap: () async { + await model.getCreateVaccinationTable(babyInfo: babyInfo, informationModel: informationModel,isSendEmail: true); + AppToast.showSuccessToast(message: TranslationBase.of(context).emailSuccess,toastLength: Toast.LENGTH_LONG); + + }, + ), ); }, ), diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 1068dc74..34c7bf87 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -21,7 +21,7 @@ class DateUtil { static String convertDateToString(DateTime date) { const start = "/Date("; - const end = "+0300)"; + const end = "+0300)/"; int milliseconds = date.millisecondsSinceEpoch; return start + "$milliseconds" + end; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index b1162f5b..ae6ae844 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:diplomaticquarterapp/config/localized_values.dart'; -import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart'; import 'package:flutter/foundation.dart' show SynchronousFuture; import 'package:flutter/material.dart'; @@ -885,10 +884,16 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get childName => localizedValues['child-name'][locale.languageCode]; String get childDob => localizedValues['childDob'][locale.languageCode]; String get delete => localizedValues['delete'][locale.languageCode]; - String get deletedChild => localizedValues['deleted-child'][locale.languageCode]; + String get deletedChildMes => localizedValues['deleted-child-mes'][locale.languageCode]; String get visit => localizedValues['visit'][locale.languageCode]; String get descriptionVaccination => localizedValues['description-vaccination'][locale.languageCode]; String get dueDate => localizedValues['due-date'][locale.languageCode]; + String get validEmail => localizedValues['valid-email'][locale.languageCode]; + String get confirmSend => localizedValues['confirm-send'][locale.languageCode]; + String get emailSuccess => localizedValues['email-success'][locale.languageCode]; + String get deletedChild => localizedValues['deleted-child'][locale.languageCode]; + String get addInstructions => localizedValues['add-instructions'][locale.languageCode]; + String get addedChild => localizedValues['added-child'][locale.languageCode]; } diff --git a/lib/widgets/input/text_field.dart b/lib/widgets/input/text_field.dart index 6e740fc8..e31ae88a 100644 --- a/lib/widgets/input/text_field.dart +++ b/lib/widgets/input/text_field.dart @@ -47,7 +47,7 @@ class TextFields extends StatefulWidget { this.autoFocus, this.onChanged, - // this.initialValue, + this.initialValue, this.minLines, this.maxLines, this.inputFormatters, @@ -79,7 +79,7 @@ class TextFields extends StatefulWidget { final String hintText; - // final String initialValue; + final String initialValue; final String type; final bool autoFocus; final IconData suffixIcon; @@ -230,7 +230,7 @@ class _TextFieldsState extends State { minLines: widget.minLines ?? 1, maxLines: widget.maxLines ?? 1, maxLengthEnforced: widget.maxLengthEnforced, - // initialValue: widget.initialValue, + initialValue: widget.initialValue, onChanged: widget.onChanged, focusNode: _focusNode, maxLength: widget.maxLength ?? null,