diff --git a/lib/config/config.dart b/lib/config/config.dart index 2f497de2..e45d5cf8 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -69,14 +69,16 @@ const GET_FINDUS_REQUEST= const GET_LIVECHAT_REQUEST= 'Services/Patients.svc/REST/GetPatientICProjects'; -///babyInformation -const GET_BABYINFORMATION_REQUEST= - 'Services/Community.svc/REST/GetBabyByUserID'; +///Get Baby By User ID +const GET_BABY_BY_USER_ID= 'Services/Community.svc/REST/GetBabyByUserID'; ///userInformation const GET_USERINFORMATION_REQUEST= 'Services/Community.svc/REST/GetUserInformation_New'; +///newUserId +const GET_NEW_USER_REQUEST= + 'Services/Community.svc/REST/CreateNewUser_New'; ///addNewChild const GET_NEWCHILD_REQUEST= diff --git a/lib/core/model/childvaccines/create_new_user_model.dart b/lib/core/model/childvaccines/create_new_user_model.dart new file mode 100644 index 00000000..980567e2 --- /dev/null +++ b/lib/core/model/childvaccines/create_new_user_model.dart @@ -0,0 +1,165 @@ +class CreateNewUser_New { + Null date; + int languageID; + int serviceName; + Null time; + Null androidLink; + Null authenticationTokenID; + Null data; + bool dataw; + int dietType; + Null errorCode; + Null errorEndUserMessage; + Null errorEndUserMessageN; + Null errorMessage; + int errorType; + int foodCategory; + Null iOSLink; + bool isAuthenticated; + int mealOrderStatus; + int mealType; + int messageStatus; + int numberOfResultRecords; + Null patientBlodType; + Null successMsg; + Null successMsgN; + Null htmlResult; + bool isHMGPatient; + bool isRegister; + bool isSendSMS; + Null listBabyInformationModel; + Null listBabyNeedReminderModel; + Null listCreateVaccinationTableModel; + Null listHisPatientModel; + Null listUserInformationModel; + Null listUserInformationModelNew; + Null listVaccinationTableModel; + Null tokinID; + int userID; + Null verificationCode; + + CreateNewUser_New( + {this.date, + this.languageID, + this.serviceName, + this.time, + this.androidLink, + this.authenticationTokenID, + this.data, + this.dataw, + this.dietType, + this.errorCode, + this.errorEndUserMessage, + this.errorEndUserMessageN, + this.errorMessage, + this.errorType, + this.foodCategory, + this.iOSLink, + this.isAuthenticated, + this.mealOrderStatus, + this.mealType, + this.messageStatus, + this.numberOfResultRecords, + this.patientBlodType, + this.successMsg, + this.successMsgN, + this.htmlResult, + this.isHMGPatient, + this.isRegister, + this.isSendSMS, + this.listBabyInformationModel, + this.listBabyNeedReminderModel, + this.listCreateVaccinationTableModel, + this.listHisPatientModel, + this.listUserInformationModel, + this.listUserInformationModelNew, + this.listVaccinationTableModel, + this.tokinID, + this.userID, + this.verificationCode}); + + CreateNewUser_New.fromJson(Map json) { + date = json['Date']; + languageID = json['LanguageID']; + serviceName = json['ServiceName']; + time = json['Time']; + androidLink = json['AndroidLink']; + authenticationTokenID = json['AuthenticationTokenID']; + data = json['Data']; + dataw = json['Dataw']; + dietType = json['DietType']; + errorCode = json['ErrorCode']; + errorEndUserMessage = json['ErrorEndUserMessage']; + errorEndUserMessageN = json['ErrorEndUserMessageN']; + errorMessage = json['ErrorMessage']; + errorType = json['ErrorType']; + foodCategory = json['FoodCategory']; + iOSLink = json['IOSLink']; + isAuthenticated = json['IsAuthenticated']; + mealOrderStatus = json['MealOrderStatus']; + mealType = json['MealType']; + messageStatus = json['MessageStatus']; + numberOfResultRecords = json['NumberOfResultRecords']; + patientBlodType = json['PatientBlodType']; + successMsg = json['SuccessMsg']; + successMsgN = json['SuccessMsgN']; + htmlResult = json['HtmlResult']; + isHMGPatient = json['IsHMGPatient']; + isRegister = json['IsRegister']; + isSendSMS = json['IsSendSMS']; + listBabyInformationModel = json['List_BabyInformationModel']; + listBabyNeedReminderModel = json['List_BabyNeedReminderModel']; + listCreateVaccinationTableModel = json['List_CreateVaccinationTableModel']; + listHisPatientModel = json['List_His_PatientModel']; + listUserInformationModel = json['List_UserInformationModel']; + listUserInformationModelNew = json['List_UserInformationModel_New']; + listVaccinationTableModel = json['List_VaccinationTableModel']; + tokinID = json['TokinID']; + userID = json['UserID']; + verificationCode = json['VerificationCode']; + } + + Map toJson() { + final Map data = new Map(); + data['Date'] = this.date; + data['LanguageID'] = this.languageID; + data['ServiceName'] = this.serviceName; + data['Time'] = this.time; + data['AndroidLink'] = this.androidLink; + data['AuthenticationTokenID'] = this.authenticationTokenID; + data['Data'] = this.data; + data['Dataw'] = this.dataw; + data['DietType'] = this.dietType; + data['ErrorCode'] = this.errorCode; + data['ErrorEndUserMessage'] = this.errorEndUserMessage; + data['ErrorEndUserMessageN'] = this.errorEndUserMessageN; + data['ErrorMessage'] = this.errorMessage; + data['ErrorType'] = this.errorType; + data['FoodCategory'] = this.foodCategory; + data['IOSLink'] = this.iOSLink; + data['IsAuthenticated'] = this.isAuthenticated; + data['MealOrderStatus'] = this.mealOrderStatus; + data['MealType'] = this.mealType; + data['MessageStatus'] = this.messageStatus; + data['NumberOfResultRecords'] = this.numberOfResultRecords; + data['PatientBlodType'] = this.patientBlodType; + data['SuccessMsg'] = this.successMsg; + data['SuccessMsgN'] = this.successMsgN; + data['HtmlResult'] = this.htmlResult; + data['IsHMGPatient'] = this.isHMGPatient; + data['IsRegister'] = this.isRegister; + data['IsSendSMS'] = this.isSendSMS; + data['List_BabyInformationModel'] = this.listBabyInformationModel; + data['List_BabyNeedReminderModel'] = this.listBabyNeedReminderModel; + data['List_CreateVaccinationTableModel'] = + this.listCreateVaccinationTableModel; + data['List_His_PatientModel'] = this.listHisPatientModel; + data['List_UserInformationModel'] = this.listUserInformationModel; + data['List_UserInformationModel_New'] = this.listUserInformationModelNew; + data['List_VaccinationTableModel'] = this.listVaccinationTableModel; + data['TokinID'] = this.tokinID; + data['UserID'] = this.userID; + data['VerificationCode'] = this.verificationCode; + return data; + } +} \ No newline at end of file diff --git a/lib/core/service/childvaccines/add_new_child_service.dart b/lib/core/service/childvaccines/add_new_child_service.dart index 22a081a3..5e4a4d86 100644 --- a/lib/core/service/childvaccines/add_new_child_service.dart +++ b/lib/core/service/childvaccines/add_new_child_service.dart @@ -1,26 +1,41 @@ import 'package:diplomaticquarterapp/config/config.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'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import '../base_service.dart'; class CreteNewBabyService extends BaseService { List createNewBabyModelList = List(); + List userModelList = List(); + List newUserModelList = List(); - Future getCreateNewBabyOrders({ CreateNewBaby newChild}) async { + + 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) { - createNewBabyModelList.clear(); - - response['List_UserInformationModel_New'].forEach((vital) { - createNewBabyModelList.add( - CreateNewBaby.fromJson(vital)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: newChild.toJson()); + 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/child_vaccines_service.dart b/lib/core/service/childvaccines/child_vaccines_service.dart index 75a07338..09256f47 100644 --- a/lib/core/service/childvaccines/child_vaccines_service.dart +++ b/lib/core/service/childvaccines/child_vaccines_service.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; @@ -8,22 +9,17 @@ import '../base_service.dart'; class ChildVaccinesService extends BaseService { List babyInformationModelList = List(); List userInformationModelList = List(); + int userID = 0; - Map body = Map(); Future getAllBabyInformationOrders() async { + Map body = Map(); hasError = false; - body['isDentalAllowedBackend'] = false; body['IsLogin'] = true; - - //body['UserID'] = userInformationModelList[0].userID;//AuthenticatedUser.fromJson(json['List'][0] //babyInformationModelList[0].userID; - body['UserID'] = 46013;//42843; - - - await baseAppClient.post(GET_BABYINFORMATION_REQUEST, + body['UserID'] = userID; + await baseAppClient.post(GET_BABY_BY_USER_ID, onSuccess: (dynamic response, int statusCode) { babyInformationModelList.clear(); - response['List_BabyInformationModel'].forEach((vital) { babyInformationModelList.add(List_BabyInformationModel.fromJson(vital)); }); @@ -32,4 +28,29 @@ class ChildVaccinesService extends BaseService { super.error = error; }, body: body); } + + Future getNewUserOrders() async { + Map body = Map(); + hasError = false; + await getUser(); + 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_NEW_USER_REQUEST, + onSuccess: (dynamic response, int statusCode) { + userID = response['UserID']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } diff --git a/lib/core/service/childvaccines/get_vaccinations_item_services.dart b/lib/core/service/childvaccines/get_vaccinations_item_services.dart index f7fe4662..5ff936af 100644 --- a/lib/core/service/childvaccines/get_vaccinations_item_services.dart +++ b/lib/core/service/childvaccines/get_vaccinations_item_services.dart @@ -11,17 +11,6 @@ class GetVccinationsItemsService extends BaseService { Future getaccinationsitemOrders() async { hasError = false; - // await getUser(); - // body['BabyName']="fffffffffff eeeeeeeeeeeeee"; - // body['DOB'] = "/Date(1585774800000+0300)/"; - // body['EmailAddress'] = user.emailAddress; - // body['isDentalAllowedBackend'] = false; - // body['SendEmail'] = false; - // body['IsLogin'] =true; - - - - await baseAppClient.post(GET_TABLE_REQUEST, onSuccess: (dynamic response, int statusCode) { getVaccinationsItemModelList.clear(); diff --git a/lib/core/service/childvaccines/user_information_service.dart b/lib/core/service/childvaccines/user_information_service.dart index 7651ef0f..0628920c 100644 --- a/lib/core/service/childvaccines/user_information_service.dart +++ b/lib/core/service/childvaccines/user_information_service.dart @@ -1,41 +1,35 @@ - import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import '../base_service.dart'; -class UserInformationService extends BaseService{ - +class UserInformationService extends BaseService { List userInformationModelList = List(); Map body = Map(); - - Future getUserInformationOrders() async { hasError = false; - await getUser(); - body['CreatedBy'] = 102; - body['EditedBy'] = 102; - body['EmailAddress'] = user.emailAddress; - body['IsLogin'] =true; - body['LogInTokenID'] = 'ZBGoQFUG50eQJd6Y7u1ykA=='; - body['MobileNumber'] = user.mobileNumber; - body['NationalID'] = user.nationalityID; - body['ZipCode'] = user.zipCode; - body['isDentalAllowedBackend'] = false; - + await getUser(); + body['CreatedBy'] = 102; + body['EditedBy'] = 102; + 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_USERINFORMATION_REQUEST, onSuccess: (dynamic response, int statusCode) { - userInformationModelList.clear(); - - response['List_UserInformationModel_New'].forEach((vital) { - userInformationModelList.add(List_UserInformationModel.fromJson(vital)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + userInformationModelList.clear(); + + response['List_UserInformationModel_New'].forEach((vital) { + userInformationModelList.add(List_UserInformationModel.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/viewModels/child_vaccines/add_new_child_view_model.dart b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart index 26355bd7..f0b55caa 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 @@ -1,28 +1,36 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart'; +import 'package:diplomaticquarterapp/core/service/childvaccines/child_vaccines_service.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; -class AddNewChildViewModel extends BaseViewModel{ +class AddNewChildViewModel extends BaseViewModel { CreteNewBabyService _creteNewBabyService = locator(); - - - - List get creteNewBabyModelList=> _creteNewBabyService.createNewBabyModelList; - getNewBabyOrders({ CreateNewBaby newChild}) async { + ChildVaccinesService _childVaccinesService = locator(); + bool isAdded = false; + ///create new baby + createNewBabyOrders({ CreateNewBaby newChild}) async { setState(ViewState.Busy); - - await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild); - - if ( _creteNewBabyService.hasError) { - error = _creteNewBabyService.error; + await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild, userID: _childVaccinesService.userID); + if (_creteNewBabyService.hasError) { + error = _creteNewBabyService.error; setState(ViewState.Error); - } else + } 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 e6a8ca60..c19d9168 100644 --- a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart +++ b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart @@ -7,18 +7,22 @@ import '../../../locator.dart'; import '../base_view_model.dart'; class ChildVaccinesViewModel extends BaseViewModel{ - - ChildVaccinesService _childVaccinesService = locator(); + List get babyInformationModelList=> _childVaccinesService.babyInformationModelList; - - List get babyInformationModelList=> _childVaccinesService.babyInformationModelList;//BabyInformationModelList; - getBabyInformatioRequestOrders() async { + getNewUserOrders() async { setState(ViewState.Busy); + await _childVaccinesService.getNewUserOrders(); + if (_childVaccinesService.hasError) { + error = _childVaccinesService.error; + setState(ViewState.Error); + } else + getBabyInformatioRequestOrders(); + } + getBabyInformatioRequestOrders() async { await _childVaccinesService.getAllBabyInformationOrders(); - if (_childVaccinesService.hasError) { error = _childVaccinesService.error; setState(ViewState.Error); 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 c362ef73..43269f42 100644 --- a/lib/core/viewModels/child_vaccines/user_information_view_model.dart +++ b/lib/core/viewModels/child_vaccines/user_information_view_model.dart @@ -11,11 +11,9 @@ class UserInformationViewModel extends BaseViewModel { List get userInformationModelList => _userInformationService.userInformationModelList; - getUserInformatioRequestOrders() async { + getUserInformationRequestOrders() async { setState(ViewState.Busy); - await _userInformationService.getUserInformationOrders(); - if (_userInformationService.hasError) { error = _userInformationService.error; setState(ViewState.Error); diff --git a/lib/locator.dart b/lib/locator.dart index 46b97fce..734e281f 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -123,6 +123,7 @@ void setupLocator() { locator.registerLazySingleton(() => ChildVaccinesService()); locator.registerLazySingleton(() => UserInformationService()); locator.registerLazySingleton(() => CreteNewBabyService()); + locator.registerLazySingleton(() => VaccinationTableService()); diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart index f2970cad..a8e97b60 100644 --- a/lib/pages/ChildVaccines/add_newchild_page.dart +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -1,6 +1,7 @@ import 'package:device_calendar/device_calendar.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_new_user_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/add_new_child_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; @@ -19,8 +20,6 @@ import 'package:flutter/material.dart'; 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 } @@ -56,6 +55,7 @@ class AddNewChildPage extends StatefulWidget { DateTime.now().day, (hour * count))); } } + @override _AddNewChildPageState createState() => _AddNewChildPageState(); } @@ -75,15 +75,17 @@ class _AddNewChildPageState extends State { 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(); + CreateNewBaby newChild = CreateNewBaby(); + List_UserInformationModel informationModel = List_UserInformationModel(); @override Widget build(BuildContext context) { return BaseView( - builder: (_,model,w)=> AppScaffold( + builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: "Vaccintion", body: SingleChildScrollView( @@ -97,7 +99,8 @@ class _AddNewChildPageState extends State { height: 50, ), Texts( - "Add the child's information below to recieve the schedule of vaccinations.", //+model.user.firstName, + "Add the child's information below to recieve the schedule of vaccinations.", + //+model.user.firstName, textAlign: TextAlign.center, ), SizedBox( @@ -139,13 +142,13 @@ class _AddNewChildPageState extends State { width: 170, child: SecondaryButton( textColor: - checkedValue == 1 ? Colors.white : Colors.black, + checkedValue == 1 ? Colors.white : Colors.black, color: checkedValue == 1 ? Colors.red : Colors.white, label: "Male", // onTap: () { - // bloodDetails.city=_selectedHospital.toString(); + setState(() { checkedValue = 1; print("checkedValue=" + checkedValue.toString()); @@ -160,7 +163,7 @@ class _AddNewChildPageState extends State { width: 170, child: SecondaryButton( textColor: - checkedValue == 2 ? Colors.white : Colors.black, + checkedValue == 2 ? Colors.white : Colors.black, color: checkedValue == 2 ? Colors.red : Colors.white, label: "Female", // @@ -220,9 +223,8 @@ class _AddNewChildPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Texts(//getStartDay() - // DateUtil.yearMonthDay(DateTime.now()) - getStartDay() - ), + // DateUtil.yearMonthDay(DateTime.now()) + getStartDay()), Icon( Icons.calendar_today, color: Colors.black, @@ -248,45 +250,29 @@ class _AddNewChildPageState extends State { color: checkedValue == false ? Colors.white24 : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), + 63, + 72, + 74, + 1, + ), label: "Add", // - onTap: () { - - newChild.babyName = - _firstTextController.text + " " + _secondTextController.text; + onTap: () async{ + newChild.babyName = _firstTextController.text + " " + _secondTextController.text; newChild.gender = checkedValue.toString(); - newChild.strDOB=getStartDay() ; - newChild.alertBy=addvancedModel.alertBy; - newChild.createdBy=informationModel.createdBy ; - newChild.editedBy=informationModel.createdBy; - newChild.tempValue=true; - // newChild.userID=46013;//informationModel.userID; - newChild.isLogin=true; - //newChild.tokenID='qMgbP94U23RkXtWWT0Sw=='; - //'ZBGoQFUG50eQJd6Y7u1ykA=='; - - - model.getNewBabyOrders(newChild: newChild); - - + newChild.strDOB = getStartDay(); + newChild.tempValue = true; + newChild.isLogin = true; + await model.createNewBabyOrders(newChild: newChild); + if(model.isAdded){ AppToast.showSuccessToast(message: "Record Added"); - //============ - Navigator.push( - context, - FadePage( - page: ChildPage(), + Navigator.pop(context,model.isAdded); + }else{ - ), - ); - //============== + //TODO handling error + } - // bloodDetails. }, ), ), diff --git a/lib/pages/ChildVaccines/child_page.dart b/lib/pages/ChildVaccines/child_page.dart index 6a937aad..becd086f 100644 --- a/lib/pages/ChildVaccines/child_page.dart +++ b/lib/pages/ChildVaccines/child_page.dart @@ -12,139 +12,172 @@ import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; class ChildPage extends StatefulWidget { - - @override _ChildPageState createState() => _ChildPageState(); } -class _ChildPageState extends State with SingleTickerProviderStateMixin { +class _ChildPageState extends State + with SingleTickerProviderStateMixin { @override Widget build(BuildContext context) { - var checkedValue= true; + var checkedValue = true; return BaseView( - onModelReady: (model) => model.getBabyInformatioRequestOrders(),//model.getCOC(),getFindUsRequestOrders() - builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - appBarTitle: " Vaccination", - baseViewModel: model, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(left: 15,right: 15,top: 70), - child: Column( - children: [ - ...List.generate(model.babyInformationModelList.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), + onModelReady: (model) => model.getNewUserOrders(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: " Vaccination", + baseViewModel: model, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 15, right: 15, top: 70), + child: Column( + children: [ + ...List.generate( + model.babyInformationModelList.length, + (index) => Container( + margin: EdgeInsets.only( + left: 0, right: 0, bottom: 20), + + 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( + children: [ + Row(children: [ + Texts("CHILD NAME"), + ]), + Row(children: [ + Texts(model + .babyInformationModelList[index] + .babyName + .trim()), + ]), + Row(children: [ + IconButton( + icon: Image.asset(model + .babyInformationModelList[ + index] + .gender == + 1 + ? 'assets/images/new-design/male.png' + : 'assets/images/new-design/female.png'), + tooltip: '', + onPressed: () { + setState(() { + // _volume += 10; + // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + }); + }, + ), + Texts(model + .babyInformationModelList[index] + .genderDescription), + IconButton( + icon: Icon( + Icons.remove_red_eye, + color: Colors.red, + ), + tooltip: 'Increase volume by 10', + onPressed: () { + Navigator.push( + context, + FadePage( + page: VaccinationTablePage(), + + //ChildPage(babyInformationModelList:model.BabyInformationModelList) + // HospitalsPage( + // findusHospitalModelList: model.FindusHospitalModelList, + // ) + ), + ); + // setState(() { + // // _volume += 10; + // // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + // }); + }, + ) + ]), + Row(children: [ + Texts("Birthday"), + ]), + Row(children: [ + IconButton( + icon: new Image.asset( + 'assets/images/new-design/calender-secondary.png'), + tooltip: 'Increase volume by 10', + onPressed: () { + setState(() { + // _volume += 10; + // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + }); + }, + ), + Texts(DateUtil.yearMonthDay(model + .babyInformationModelList[index] + .dOB)), + ]), + Row(children: [ + IconButton( + icon: new Image.asset( + 'assets/images/new-design/garbage.png'), + tooltip: '', + onPressed: () { + setState(() { + // _volume += 10; + // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + }); + }, + ), + Texts("Birthday"), + ]), + SizedBox( + height: 12, + ), + ], + ), + + ), + + + ) + ], + )) + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.12, width: double.infinity, - child: Column( - - children: [ - Row(children:[Texts("CHILD NAME"),]), - Row(children:[Texts(model.babyInformationModelList[index].babyName.trim()),]), - - Row( - children: [IconButton( - icon: Image.asset(model.babyInformationModelList[index].gender==1? 'assets/images/new-design/male.png':'assets/images/new-design/female.png'), - tooltip: '', - onPressed: () { - setState(() { - // _volume += 10; - // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); - }); - }, - ), - Texts(model.babyInformationModelList[index].genderDescription), - IconButton( - icon: Icon(Icons.remove_red_eye,color: Colors.red,), - tooltip: 'Increase volume by 10', - onPressed: () { - Navigator.push( - context, - FadePage( - page: VaccinationTablePage(), - - //ChildPage(babyInformationModelList:model.BabyInformationModelList) - // HospitalsPage( - // findusHospitalModelList: model.FindusHospitalModelList, - // ) - - ), - ); - // setState(() { - // // _volume += 10; - // // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); - // }); - }, - )] - ), - Row(children:[Texts("Birthday"),]), - Row(children:[IconButton( - icon: new Image.asset('assets/images/new-design/calender-secondary.png'), - tooltip: 'Increase volume by 10', - onPressed: () { - setState(() { - // _volume += 10; - // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); - }); - }, - ), - Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)),]), - Row(children:[IconButton( - icon: new Image.asset('assets/images/new-design/garbage.png'), - tooltip: '', - onPressed: () { - setState(() { - // _volume += 10; - // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); - }); - }, - ), - Texts("Birthday"),]), - ], - ) - - - ) - - ) - - ], - - - ) - ) - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - - padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), - label: "ADD NEW CHILD ", - // - onTap: () => Navigator.push( - context, - FadePage( - page: AddNewChildPage(), - - - ), - ), - - - ), - ), - ) - ); + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), + label: "ADD NEW CHILD ", + // + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddNewChildPage(), + ), + ).then((value) { + if (value) model.getNewUserOrders(); + }); + }, + ), + ), + )); } } diff --git a/lib/pages/ChildVaccines/child_vaccines_page.dart b/lib/pages/ChildVaccines/child_vaccines_page.dart index ba4589a9..f8fe7b74 100644 --- a/lib/pages/ChildVaccines/child_vaccines_page.dart +++ b/lib/pages/ChildVaccines/child_vaccines_page.dart @@ -29,7 +29,7 @@ class _ChildVaccinesPageState extends State Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getUserInformatioRequestOrders(), + onModelReady: (model) => model.getUserInformationRequestOrders(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, baseViewModel: model, @@ -132,10 +132,7 @@ class _ChildVaccinesPageState extends State FadePage( page: ChildPage(), - //ChildPage(babyInformationModelList:model.BabyInformationModelList) - // HospitalsPage( - // findusHospitalModelList: model.FindusHospitalModelList, - // ) + ), ),