Merge branch 'child_vaccines' into 'master'

done child Vaccination

See merge request Cloud_Solution/diplomatic-quarter!136
merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
commit 1df9ed4a09

@ -83,8 +83,11 @@ const GET_BABYINFORMATION_REQUEST =
const GET_BABY_BY_USER_ID = 'Services/Community.svc/REST/GetBabyByUserID'; const GET_BABY_BY_USER_ID = 'Services/Community.svc/REST/GetBabyByUserID';
///userInformation ///userInformation
const GET_USERINFORMATION_REQUEST = const GET_USERINFORMATION_REQUEST = 'Services/Community.svc/REST/GetUserInformation_New';
'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 ///addNewChild
const GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby'; const GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby';
@ -92,8 +95,8 @@ const GET_NEWCHILD_REQUEST = 'Services/Community.svc/REST/CreateNewBaby';
///newUserId ///newUserId
const GET_NEW_USER_REQUEST = 'Services/Community.svc/REST/CreateNewUser_New'; const GET_NEW_USER_REQUEST = 'Services/Community.svc/REST/CreateNewUser_New';
///delteChild ///delete Child
const DELETE_CHILD_REQUEST = 'Services/Community.svc/REST/DeleteBaby'; const DELETE_CHILD_REQUEST = '/Services/Community.svc/REST/DeleteBaby';
///addNewTABLE ///addNewTABLE
const GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable'; const GET_TABLE_REQUEST = 'Services/Community.svc/REST/CreateVaccinationTable';

@ -1112,10 +1112,14 @@ const Map localizedValues = {
"en": "Delete", "en": "Delete",
"ar": "حذف" "ar": "حذف"
}, },
"deleted-child": { "deleted-child-mes": {
"en": "The request was successful. The children have removed from the vaccination schedule subscription service.", "en": "The request was successful. The children have removed from the vaccination schedule subscription service.",
"ar": "تم حذف الطفل بنجاح" "ar": "تم حذف الطفل بنجاح"
}, },
"deleted-child":{
"en":"Delete child",
"ar":"إالغاء الطفل"
},
"visit": { "visit": {
"en": "Visit", "en": "Visit",
"ar": "زيارة" "ar": "زيارة"
@ -1128,5 +1132,24 @@ const Map localizedValues = {
"en": "Due date", "en": "Due date",
"ar": "تاريخ الاستحقاق" "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": "تمت الاضافة بنجاح."
},
}; };

@ -14,19 +14,12 @@ class CreteNewBabyService extends BaseService {
Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async { Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async {
hasError = false; hasError = false;
await getUser();
Map<String, dynamic> body = Map.from(newChild.toJson()); Map<String, dynamic> body = Map.from(newChild.toJson());
body['CreatedBy'] = 102; body['CreatedBy'] = 102;
body['EditedBy'] = 102; body['EditedBy'] = 102;
body['UserID'] = userID; body['UserID'] = userID;
body['AlertBy'] = 2; body['AlertBy'] = 2;
body['EmailAddress'] = user.emailAddress;
body['IsLogin'] = true; body['IsLogin'] = true;
body['LogInTokenID'] = await sharedPref.getString(TOKEN);
body['MobileNumber'] = user.mobileNumber;
body['NationalID'] = user.nationalityID;
body['ZipCode'] = user.zipCode;
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.post(GET_NEWCHILD_REQUEST, await baseAppClient.post(GET_NEWCHILD_REQUEST,

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/config/config.dart'; 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/add_newchild_model.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.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/create_new_user_model.dart';
@ -17,22 +18,13 @@ class DeleteBabyService extends BaseService{
List<DeleteBaby> deleteBabyModelList= List(); List<DeleteBaby> deleteBabyModelList= List();
Future getDeleteBabyOrder({DeleteBaby deleteChild,int babyID}) async { Future getDeleteBabyOrder({List_BabyInformationModel babyInfo}) async {
hasError = false; hasError = false;
await getUser(); await getUser();
Map<String, dynamic> body = Map.from(deleteChild.toJson()); Map<String, dynamic> body = Map();
// body['CreatedBy'] = 102;
body['EditedBy'] = 102; body['EditedBy'] = 102;
//body['BabyID'] = babyID;
//body['BabyID'] = createNewBabyModelList ;
// body['AlertBy'] = 2;
// body['EmailAddress'] = user.emailAddress;
body['IsLogin'] = true; body['IsLogin'] = true;
body['LogInTokenID'] = await sharedPref.getString(TOKEN); body['BabyID'] = babyInfo.babyID;
body['MobileNumber'] = user.mobileNumber;
body['NationalID'] = user.nationalityID;
body['ZipCode'] = user.zipCode;
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
await baseAppClient.post(DELETE_CHILD_REQUEST, await baseAppClient.post(DELETE_CHILD_REQUEST,
@ -45,31 +37,6 @@ class DeleteBabyService extends BaseService{
}, body: body); }, body: body);
} }
// Future getCreateNewBabyOrders({CreateNewBaby newChild,int userID}) async {
// hasError = false;
// await getUser();
// Map<String, dynamic> 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);
// }
} }

@ -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<GET_VACCINATIONS_ITEMSMODEL> getVaccinationsItemModelList = List();
Map<String, dynamic> 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);
}
}

@ -4,11 +4,11 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_m
import '../base_service.dart'; import '../base_service.dart';
class UserInformationService extends BaseService { class UserInformationService extends BaseService {
List<List_UserInformationModel> userInformationModelList = List(); List_UserInformationModel userInformationModel = List_UserInformationModel();
Map<String, dynamic> body = Map();
Future getUserInformationOrders() async { Future getUserInformationOrders() async {
hasError = false; hasError = false;
Map<String, dynamic> body = Map();
await getUser(); await getUser();
body['CreatedBy'] = 102; body['CreatedBy'] = 102;
body['EditedBy'] = 102; body['EditedBy'] = 102;
@ -22,14 +22,44 @@ class UserInformationService extends BaseService {
await baseAppClient.post(GET_USERINFORMATION_REQUEST, await baseAppClient.post(GET_USERINFORMATION_REQUEST,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
userInformationModelList.clear();
response['List_UserInformationModel_New'].forEach((vital) { response['List_UserInformationModel_New'].forEach((vital) {
userInformationModelList.add(List_UserInformationModel.fromJson(vital)); userInformationModel = List_UserInformationModel.fromJson(vital);
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: body); }, body: body);
} }
Future updateEmail(String email) async {
hasError = false;
Map<String, dynamic> 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<String, dynamic> 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);
}
} }

@ -1,7 +1,9 @@
import 'package:diplomaticquarterapp/config/config.dart'; 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/add_newchild_model.dart';
import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart';
import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import '../base_service.dart'; import '../base_service.dart';
class VaccinationTableService extends BaseService { 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; hasError = false;
await getUser(); await getUser();
body['BabyName']="fffffffffff eeeeeeeeeeeeee"; body['BabyName']=babyInfo.babyName;
body['DOB'] = "/Date(1585774800000+0300)/"; body['DOB'] = DateUtil.convertDateToString(babyInfo.dOB);
body['EmailAddress'] = user.emailAddress; body['EmailAddress'] = informationModel.emailAddress;
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
body['SendEmail'] = false; body['SendEmail'] = isSendEmail;
body['IsLogin'] =true; body['IsLogin'] =true;
await baseAppClient.post(GET_TABLE_REQUEST, await baseAppClient.post(GET_TABLE_REQUEST,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
createVaccinationTableModelList.clear(); createVaccinationTableModelList.clear();

@ -13,7 +13,6 @@ class AddNewChildViewModel extends BaseViewModel {
CreteNewBabyService _creteNewBabyService = locator<CreteNewBabyService>(); CreteNewBabyService _creteNewBabyService = locator<CreteNewBabyService>();
ChildVaccinesService _childVaccinesService = locator<ChildVaccinesService>(); ChildVaccinesService _childVaccinesService = locator<ChildVaccinesService>();
// DeleteBabyService _deleteBabyService = locator<DeleteBabyService>();
bool isAdded = false; bool isAdded = false;
///create new baby ///create new baby
createNewBabyOrders({ CreateNewBaby newChild}) async { createNewBabyOrders({ CreateNewBaby newChild}) async {
@ -25,13 +24,7 @@ class AddNewChildViewModel extends BaseViewModel {
} else { } else {
isAdded = true; isAdded = true;
setState(ViewState.Idle); setState(ViewState.Idle);
await _childVaccinesService.getAllBabyInformationOrders();
if (_childVaccinesService.hasError) {
error = _childVaccinesService.error;
setState(ViewState.Error);
} else{
}
} }
} }

@ -16,14 +16,11 @@ class ChildVaccinesViewModel extends BaseViewModel{
List<List_BabyInformationModel> get babyInformationModelList=> _childVaccinesService.babyInformationModelList; List<List_BabyInformationModel> get babyInformationModelList=> _childVaccinesService.babyInformationModelList;
//===========
CreteNewBabyService _creteNewBabyService = locator<CreteNewBabyService>(); CreteNewBabyService _creteNewBabyService = locator<CreteNewBabyService>();
DeleteBabyService _deleteBabyService = locator<DeleteBabyService>(); DeleteBabyService _deleteBabyService = locator<DeleteBabyService>();
bool isAdded = false; bool isAdded = false;
bool isDeleted = false; bool isDeleted = false;
//============
getNewUserOrders() async { getNewUserOrders() async {
@ -48,25 +45,15 @@ class ChildVaccinesViewModel extends BaseViewModel{
///delete baby ///delete baby
deleteBabyOrders({ DeleteBaby newChild}) async { deleteBabyOrders({ List_BabyInformationModel babyInfo}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
//await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild, userID: _childVaccinesService.userID); await _deleteBabyService.getDeleteBabyOrder(babyInfo: babyInfo);
await _deleteBabyService.getDeleteBabyOrder(deleteChild: newChild,babyID: newChild.babyID); if (_deleteBabyService.hasError) {
//getDeleteBabyOrder(deleteChild: newChild,); error = _deleteBabyService.error;
// getDeleteBabyOrder
if (_creteNewBabyService.hasError) {
error = _creteNewBabyService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
isDeleted = true; isDeleted = true;
setState(ViewState.Idle); getBabyInformatioRequestOrders();
await _childVaccinesService.getAllBabyInformationOrders();
if (_childVaccinesService.hasError) {
error = _childVaccinesService.error;
setState(ViewState.Error);
} else{
}
} }
} }

@ -8,8 +8,7 @@ class UserInformationViewModel extends BaseViewModel {
UserInformationService _userInformationService = UserInformationService _userInformationService =
locator<UserInformationService>(); locator<UserInformationService>();
List<List_UserInformationModel> get userInformationModelList => List_UserInformationModel get userInformationModelList => _userInformationService.userInformationModel;
_userInformationService.userInformationModelList;
getUserInformationRequestOrders() async { getUserInformationRequestOrders() async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -20,4 +19,15 @@ class UserInformationViewModel extends BaseViewModel {
} else } else
setState(ViewState.Idle); 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();
}
} }

@ -1,30 +1,27 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; 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/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 'package:diplomaticquarterapp/core/service/childvaccines/vaccination_table_service.dart';
import '../../../locator.dart'; import '../../../locator.dart';
import '../base_view_model.dart'; import '../base_view_model.dart';
class VaccinationTableViewModel extends BaseViewModel {
VaccinationTableService _creteVaccinationTableService =
locator<VaccinationTableService>();
class VaccinationTableViewModel extends BaseViewModel{ List<CreateVaccinationTable> get creteVaccinationTableModelList =>
_creteVaccinationTableService.createVaccinationTableModelList;
VaccinationTableService _creteVaccinationTableService = locator<VaccinationTableService>(); getCreateVaccinationTable({List_BabyInformationModel babyInfo, List_UserInformationModel informationModel, bool isSendEmail =false}) async {
// String get creteVaccinationTableContent => _creteVaccinationTableService.userAgreementContent;
//String get userAgreementContent => _creteNewBabyService.v//_reportsService.userAgreementContent;
List<CreateVaccinationTable> get creteVaccinationTableModelList=> _creteVaccinationTableService.createVaccinationTableModelList;//.createNewBabyModelList;
getCreateVaccinationTable() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _creteVaccinationTableService.getCreateVaccinationTableOrders();//getCreateNewBabyOrders(); await _creteVaccinationTableService.getCreateVaccinationTableOrders(babyInfo: babyInfo,informationModel: informationModel,isSendEmail: isSendEmail);
if (_creteVaccinationTableService.hasError) {
if ( _creteVaccinationTableService.hasError) { error = _creteVaccinationTableService.error;
error = _creteVaccinationTableService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; 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/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/core/viewModels/child_vaccines/child_vaccines_view_model.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.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:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_flexible_toast/flutter_flexible_toast.dart';
import 'dialogs/delete_child.dart';
class ChildDetailsWidget extends StatelessWidget { class ChildDetailsWidget extends StatelessWidget {
final ChildVaccinesViewModel model; final ChildVaccinesViewModel model;
final List_BabyInformationModel babyInfo; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return InkWell(
margin: EdgeInsets.only(left: 5, right: 5, bottom: 10), onTap: (){
decoration: BoxDecoration( Navigator.push(
shape: BoxShape.rectangle, context,
border: Border.all(color: Colors.white, width: 0.5), FadePage(
borderRadius: BorderRadius.all(Radius.circular(5)), page: VaccinationTablePage(
color: Colors.white, babyInfo: babyInfo,
), informationModel: informationModel,
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: () {
},
), ),
Texts(babyInfo.genderDescription), ),
IconButton( );
icon: Icon( },
Icons.remove_red_eye, child: Container(
color: Colors.red, margin: EdgeInsets.only(left: 5, right: 5, bottom: 10),
), decoration: BoxDecoration(
tooltip: '', shape: BoxShape.rectangle,
onPressed: () { border: Border.all(color: Colors.white, width: 0.5),
Navigator.push( borderRadius: BorderRadius.all(Radius.circular(5)),
context, color: Colors.white,
FadePage( ),
page: VaccinationTablePage(babyInfo: babyInfo,), padding: EdgeInsets.all(12),
), width: 200,
); //double.infinity,
}, child: Column(
) children: [
]), Row(children: [
Row(children: [ Texts(TranslationBase.of(context).childName),
Texts(TranslationBase.of(context).childDob), ]),
]), Row(children: [
Row( Texts(babyInfo.babyName.trim()),
children: [ ]),
Row(children: [
IconButton( IconButton(
icon: new Image.asset( icon: Image.asset(babyInfo.gender == 1
'assets/images/new-design/calender-secondary.png'), ? 'assets/images/new-design/male.png'
: 'assets/images/new-design/female.png'),
tooltip: '', tooltip: '',
onPressed: () {
},
), ),
Texts( Texts(babyInfo.genderDescription),
DateUtil.yearMonthDay(babyInfo.dOB), 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();
},
), ),
], Texts(TranslationBase.of(context).delete),
), ]),
Row(children: [ SizedBox(
IconButton( height: 12,
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,
),
],
), ),
); );
} }

@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart'; import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.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/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.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'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
enum Gender { Male, Female, NON } enum Gender { Male, Female, NON }
enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON }
class AddNewChildPage extends StatefulWidget { class AddNewChildPage extends StatefulWidget {
final int frequency;
final int days;
final String itemDescription;
String dateAdd; String dateAdd;
List<DateTime> _scheduleList = List();
List<DayOfWeek> daysOfWeek = [
DayOfWeek.Monday,
DayOfWeek.Tuesday,
DayOfWeek.Wednesday,
DayOfWeek.Thursday,
DayOfWeek.Friday,
DayOfWeek.Saturday,
DayOfWeek.Sunday
];
DateTime startDay; DateTime startDay;
DateTime endDay; DateTime endDay;
//AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key); AddNewChildPage() {
AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) {
startDay = DateTime.now(); startDay = DateTime.now();
endDay = endDay = DateTime.now();
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)));
}
} }
@override @override
@ -61,150 +39,140 @@ class AddNewChildPage extends StatefulWidget {
} }
class _AddNewChildPageState extends State<AddNewChildPage> { class _AddNewChildPageState extends State<AddNewChildPage> {
int tappedIndex;
int checkedValue; int checkedValue;
@override
void initState() {
super.initState();
tappedIndex = -1;
}
TextEditingController _firstTextController = TextEditingController(); TextEditingController _firstTextController = TextEditingController();
TextEditingController _secondTextController = TextEditingController(); TextEditingController _secondTextController = TextEditingController();
TextEditingController _notesTextController = TextEditingController();
BeneficiaryType beneficiaryType = BeneficiaryType.NON;
Gender gender = Gender.Male; Gender gender = Gender.Male;
CreateNewUser_New newUserChild = CreateNewUser_New(); CreateNewUser_New newUserChild = CreateNewUser_New();
//ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel();
List_BabyInformationModel addvancedModel = List_BabyInformationModel();
CreateNewBaby newChild = CreateNewBaby(); CreateNewBaby newChild = CreateNewBaby();
List_UserInformationModel informationModel = List_UserInformationModel();
String firstName = "";
String secondName = "";
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<AddNewChildViewModel>( return BaseView<AddNewChildViewModel>(
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: "Vaccintion", appBarTitle: TranslationBase.of(context).vaccination,
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
child: Container( child: Container(
margin: EdgeInsets.all(12), margin: EdgeInsets.all(12),
child: Column( child: Column(
// crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 50, height: 25,
),
Texts(
"Add the child's information below to recieve the schedule of vaccinations.",
//+model.user.firstName,
textAlign: TextAlign.center,
), ),
Texts(TranslationBase.of(context).addInstructions),
SizedBox( SizedBox(
height: 12, height: 20,
), ),
NewTextFields( NewTextFields(
hintText: "First Name", hintText: TranslationBase.of(context).firstName,
controller: _firstTextController, controller: _firstTextController,
onChanged: (value) {
setState(() {
firstName = value;
});
},
), ),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
NewTextFields( NewTextFields(
hintText: "Second Name", hintText: TranslationBase.of(context).lastName,
controller: _secondTextController, controller: _secondTextController,
onChanged: (value) {
secondName = value;
},
), ),
SizedBox( SizedBox(
height: 12, height: 20,
), ),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"Gender:", TranslationBase.of(context).gender + " :",
textAlign: TextAlign.end, textAlign: TextAlign.end,
), ),
], ],
), ),
SizedBox(
height: 15,
),
Container( Container(
height: MediaQuery.of(context).size.height * 0.12, height: 60,
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(12),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( Expanded(
height: MediaQuery.of(context).size.height * 0.12, child: AnimatedContainer(
width: 175, duration: Duration(milliseconds: 400),
color: Colors.white, height: 60,
child: SecondaryButton( color: Colors.white,
textColor: child: SecondaryButton(
checkedValue == 1 ? Colors.white : Colors.black, textColor:
color: checkedValue == 1 ? Colors.red : Colors.white, checkedValue == 1 ? Colors.white : Colors.black,
color:
label: "Male", checkedValue == 1 ? Colors.red : Colors.white,
// label: TranslationBase.of(context).male,
onTap: () { onTap: () {
setState(() {
setState(() { checkedValue = 1;
checkedValue = 1; });
print("checkedValue=" + checkedValue.toString()); },
}); ),
// bloodDetails.
},
), ),
), ),
Container( Expanded(
height: MediaQuery.of(context).size.height * 0.12, child: AnimatedContainer(
width: 175, duration: Duration(milliseconds: 400),
color: Colors.white, height: 60,
child: SecondaryButton( color: Colors.white,
textColor: child: SecondaryButton(
checkedValue == 2 ? Colors.white : Colors.black, textColor:
color: checkedValue == 2 ? Colors.red : Colors.white, checkedValue == 2 ? Colors.white : Colors.black,
label: "Female", color:
// checkedValue == 2 ? Colors.red : Colors.white,
onTap: () { label: TranslationBase.of(context).female,
setState(() { onTap: () {
checkedValue = 2; setState(() {
print("checkedValue=" + checkedValue.toString()); checkedValue = 2;
}); });
// bloodDetails.city=_selectedHospital.toString(); },
),
// bloodDetails.
},
), ),
) )
], ],
), ),
), ),
//==========
SizedBox( SizedBox(
height: 6, height: 20,
), ),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"Date Of Birth::", TranslationBase.of(context).dob + " :",
textAlign: TextAlign.end, textAlign: TextAlign.end,
), ),
], ],
), ),
SizedBox(
height: 8,
),
InkWell( InkWell(
onTap: () { onTap: () {
DatePicker.showDatePicker( DatePicker.showDatePicker(
context, context,
showTitleActions: true, showTitleActions: true,
// minTime: DateTime(
// DateTime.now().year, DateTime.now().month - 1, 1),
minTime: DateTime(1, 1, 1), minTime: DateTime(1, 1, 1),
maxTime: DateTime.now(), maxTime: DateTime.now(),
onConfirm: (date) { onConfirm: (date) {
@ -213,7 +181,6 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
}); });
}, },
currentTime: widget.startDay, currentTime: widget.startDay,
// locale: projectViewModel.localeType
); );
}, },
child: Container( child: Container(
@ -224,99 +191,63 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
color: Colors.white), color: Colors.white),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Texts(//getStartDay()
// DateUtil.yearMonthDay(DateTime.now())
getStartDay()),
Icon( Icon(
Icons.calendar_today, Icons.calendar_today,
color: Colors.black, color: Colors.black,
) ),
SizedBox(
width: 25,
),
Expanded(child: Texts(getStartDay())),
], ],
), ),
), ),
), ),
SizedBox( SizedBox(
height: 12, height: 25,
), ),
Container( Container(
height: MediaQuery.of(context).size.height * 0.12, height: 60,
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(15),
child: SecondaryButton( child: SecondaryButton(
textColor: Colors.white, textColor: Colors.white,
color: checkedValue == false color: Colors.grey[800],
? Colors.white24 disabled: (checkedValue == null ||
: Color.fromRGBO( firstName.isEmpty ||
63, secondName.isEmpty),
72, label: TranslationBase.of(context).add,
74, onTap: () async {
1, newChild.babyName = _firstTextController.text +
), " " +
label: "Add", _secondTextController.text;
//
onTap: () async{
newChild.babyName = _firstTextController.text + " " + _secondTextController.text;
newChild.gender = checkedValue.toString(); newChild.gender = checkedValue.toString();
newChild.strDOB = getStartDay(); newChild.strDOB = widget.startDay.toIso8601String();
newChild.tempValue = true; newChild.tempValue = true;
newChild.isLogin = true; newChild.isLogin = true;
await model.createNewBabyOrders(newChild: newChild); await model.createNewBabyOrders(newChild: newChild);
if(model.isAdded){ if (model.isAdded) {
AppToast.showSuccessToast(message: "Record Added"); AppToast.showSuccessToast(
Navigator.pop(context,model.isAdded); message: TranslationBase.of(context).addedChild);
}else{ Navigator.pop(context, model.isAdded);
} else {
//TODO handling error AppToast.showSuccessToast(message: model.error);
} }
}, },
), ),
), ),
//=========
], ],
), ),
), ),
), ),
// bottomSheet: // bottomSheet:
), ),
); );
} }
String getStartDay() { String getStartDay() {
return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}"; return "${widget.startDay.day}-${widget.startDay.month}-${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;
});
},
),
);
} }
} }

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; 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/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/core/viewModels/child_vaccines/child_vaccines_view_model.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart';
import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:flutter_flexible_toast/flutter_flexible_toast.dart';
import 'ChidDetailsWidget.dart'; import 'ChidDetailsWidget.dart';
import 'dialogs/delete_child.dart'; import 'dialogs/delete_child.dart';
class ChildPage extends StatefulWidget { class ChildPage extends StatefulWidget {
final List_UserInformationModel informationModel;
const ChildPage({Key key, this.informationModel}) : super(key: key);
@override @override
_ChildPageState createState() => _ChildPageState(); _ChildPageState createState() => _ChildPageState();
} }
//TODO
class _ChildPageState extends State<ChildPage> class _ChildPageState extends State<ChildPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
DeleteBaby deleteBaby = DeleteBaby(); DeleteBaby deleteBaby = DeleteBaby();
@ -31,7 +37,7 @@ class _ChildPageState extends State<ChildPage>
var checkedValue = true; var checkedValue = true;
return BaseView<ChildVaccinesViewModel>( return BaseView<ChildVaccinesViewModel>(
onModelReady: (model) => model.getNewUserOrders(), onModelReady: (model) => model.getNewUserOrders(),
builder: (_, model, widget) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).vaccination, appBarTitle: TranslationBase.of(context).vaccination,
baseViewModel: model, baseViewModel: model,
@ -54,6 +60,23 @@ class _ChildPageState extends State<ChildPage>
return ChildDetailsWidget( return ChildDetailsWidget(
model: model, model: model,
babyInfo: model.babyInformationModelList[index], 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<ChildPage>
builder: (context) => AddNewChildPage(), builder: (context) => AddNewChildPage(),
), ),
).then((value) { ).then((value) {
if (value) model.getNewUserOrders(); if (value!=null)
model.getNewUserOrders();
}); });
}, },
), ),

@ -23,6 +23,7 @@ class _ChildVaccinesPageState extends State<ChildVaccinesPage>
TextEditingController titleController = TextEditingController(); TextEditingController titleController = TextEditingController();
var checkedValue = false; var checkedValue = false;
String addEmail = ""; String addEmail = "";
final updateEmailFormKey = GlobalKey<FormState>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -72,30 +73,31 @@ class _ChildVaccinesPageState extends State<ChildVaccinesPage>
indent: 10, indent: 10,
endIndent: 10, endIndent: 10,
), ),
Padding( Form(
padding: const EdgeInsets.all(10.0), key: updateEmailFormKey,
child: Container( child: Padding(
margin: EdgeInsets.only(left: 10, right: 10, top: 15), padding: const EdgeInsets.all(10.0),
child: TextFields( child: Container(
fillColor: Colors.red, margin: EdgeInsets.only(left: 10, right: 10, top: 15),
hintText: model.user.emailAddress, child: TextFields(
controller: titleController, fillColor: Colors.red,
fontSize: 20, initialValue: model.userInformationModelList.emailAddress,
hintColor: Colors.black, fontSize: 20,
fontWeight: FontWeight.w600, hintColor: Colors.black,
onChanged: (text) { fontWeight: FontWeight.w600,
addEmail = text; onChanged: (text) {
model.user.emailAddress == addEmail setState(() {
? checkedValue = false addEmail = text;
: checkedValue = true; });
}, },
validator: (value) { validator: (value) {
if (value == null) { if (value.isEmpty)
return model.user.emailAddress; return TranslationBase.of(context).enterEmail;
} else { else if (!RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(value))
return model.user.emailAddress; return TranslationBase.of(context).validEmail;
} return null;
}, },
),
), ),
), ),
), ),
@ -105,23 +107,17 @@ class _ChildVaccinesPageState extends State<ChildVaccinesPage>
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
child: SecondaryButton( child: SecondaryButton(
textColor: Colors.white, textColor: Colors.white,
color: checkedValue == false color: model.userInformationModelList.emailAddress == addEmail ? Colors.white24 : Color.fromRGBO(63, 72, 74, 1,),
? Colors.white24 disabled: addEmail.isEmpty,
: Color.fromRGBO(
63,
72,
74,
1,
),
label: TranslationBase.of(context).updateEmail, label: TranslationBase.of(context).updateEmail,
// onTap: () async{
onTap: () { final form = updateEmailFormKey.currentState;
model.user.emailAddress = addEmail.toString(); if (form.validate()) {
AppToast.showSuccessToast( form.save();
message: TranslationBase.of(context).updatedEmail); await model.updateEmail(addEmail);
// bloodDetails.city=_selectedHospital.toString(); AppToast.showSuccessToast(message: TranslationBase.of(context).updatedEmail);
}
// bloodDetails.
}, },
), ),
), ),
@ -138,11 +134,10 @@ class _ChildVaccinesPageState extends State<ChildVaccinesPage>
1, 1,
), ),
label: TranslationBase.of(context).viewListChildren, label: TranslationBase.of(context).viewListChildren,
//
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
FadePage( FadePage(
page: ChildPage(), page: ChildPage(informationModel: model.userInformationModelList,),
), ),
), ),
), ),

@ -5,16 +5,18 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class SelectGenderDialog extends StatefulWidget { class ConfirmSendEmailDialog extends StatefulWidget {
final Email; 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 @override
_SelectGenderDialogState createState() => _SelectGenderDialogState(); _ConfirmSendEmailDialogState createState() => _ConfirmSendEmailDialogState();
} }
class _SelectGenderDialogState extends State<SelectGenderDialog> { class _ConfirmSendEmailDialogState extends State<ConfirmSendEmailDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SimpleDialog( return SimpleDialog(
@ -22,22 +24,15 @@ class _SelectGenderDialogState extends State<SelectGenderDialog> {
Container( Container(
child: Column( child: Column(
children: [ children: [
Texts(TranslationBase.of(context).confirm),
Divider(), Divider(),
Row( Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
child: InkWell( child: ListTile(
onTap: () { title: Text(TranslationBase.of(context).confirmSend +
setState(() { "\n ${widget.email} "),
//beneficiaryType = Gender.Male;
});
},
child: ListTile(
title: Text("Send the child's schedule to the email\n Tamer.dasdasdas@gmail.com "),
),
), ),
) )
], ],
@ -45,15 +40,7 @@ class _SelectGenderDialogState extends State<SelectGenderDialog> {
SizedBox( SizedBox(
height: 5.0, height: 5.0,
), ),
SizedBox(
height: 5.0,
),
SizedBox(
height: 5.0,
),
Row( Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
@ -83,8 +70,7 @@ class _SelectGenderDialogState extends State<SelectGenderDialog> {
flex: 1, flex: 1,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
AppToast.showSuccessToast(message: "Email Sended"); widget.onTap();
// widget.onValueSelected(beneficiaryType);
Navigator.pop(context); Navigator.pop(context);
}, },
child: Padding( child: Padding(
@ -106,7 +92,4 @@ class _SelectGenderDialogState extends State<SelectGenderDialog> {
], ],
); );
} }
} }

@ -6,6 +6,10 @@ import 'package:flutter/material.dart';
class DeleteChild extends StatefulWidget { class DeleteChild extends StatefulWidget {
final Function onTap;
const DeleteChild({Key key, this.onTap}) : super(key: key);
@override @override
_DeleteChildState createState() => _DeleteChildState(); _DeleteChildState createState() => _DeleteChildState();
} }
@ -18,21 +22,14 @@ class _DeleteChildState extends State<DeleteChild> {
Container( Container(
child: Column( child: Column(
children: [ children: [
Texts(TranslationBase.of(context).confirm),
Divider(), Divider(),
Row( Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, child: ListTile(
child: InkWell( title: Texts(TranslationBase.of(context).deletedChild),
onTap: () {
setState(() {
//beneficiaryType = Gender.Male;
});
},
child: ListTile(
title: Text("Delete the child "),
),
), ),
) )
], ],
@ -40,15 +37,7 @@ class _DeleteChildState extends State<DeleteChild> {
SizedBox( SizedBox(
height: 5.0, height: 5.0,
), ),
SizedBox(
height: 5.0,
),
SizedBox(
height: 5.0,
),
Row( Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
@ -78,7 +67,7 @@ class _DeleteChildState extends State<DeleteChild> {
flex: 1, flex: 1,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
// widget.onValueSelected(beneficiaryType); widget.onTap();
Navigator.pop(context); Navigator.pop(context);
}, },
child: Padding( child: Padding(

@ -1,7 +1,9 @@
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; 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/child_vaccines/vaccination_table_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_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/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_flexible_toast/flutter_flexible_toast.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'dialogs/SelectGenderDialog.dart'; import 'dialogs/ConfirmSendEmailDialog.dart';
class VaccinationTablePage extends StatelessWidget { class VaccinationTablePage extends StatelessWidget {
final List_BabyInformationModel babyInfo; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var checkedValue; var checkedValue;
return BaseView<VaccinationTableViewModel>( return BaseView<VaccinationTableViewModel>(
onModelReady: (model) => model.getCreateVaccinationTable(), onModelReady: (model) => model.getCreateVaccinationTable(babyInfo: babyInfo, informationModel: informationModel),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,
@ -37,22 +43,30 @@ class VaccinationTablePage extends StatelessWidget {
Expanded( Expanded(
child: Column( child: Column(
children: [ children: [
Texts(TranslationBase.of(context).childName), Texts(TranslationBase.of(context).childName),
Texts(babyInfo.babyName??'',fontWeight: FontWeight.w600,), Texts(
babyInfo.babyName ?? '',
fontWeight: FontWeight.w600,
),
], ],
), ),
), ),
Expanded( Expanded(
child: Column(children: [ child: Column(
children: [
Texts(TranslationBase.of(context).childDob), Texts(TranslationBase.of(context).childDob),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Icon(FontAwesomeIcons.calendarCheck,color: Colors.red,), Icon(
SizedBox(width: 15,), FontAwesomeIcons.calendarCheck,
Texts(DateUtil.yearMonthDay(babyInfo.dOB)??''), 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(), Divider(),
Column( Column(
children: [ children: [
@ -75,25 +91,19 @@ class VaccinationTablePage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Texts(TranslationBase.of(context).descriptionVaccination), Texts(TranslationBase.of(context)
.descriptionVaccination),
], ],
), ),
), ),
Texts(TranslationBase.of(context).dueDate), Texts(TranslationBase.of(context).dueDate),
], ],
), ),
], ],
), ),
...List.generate( ...List.generate(
model.creteVaccinationTableModelList.length, model.creteVaccinationTableModelList.length,
(index) => Container( (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), padding: EdgeInsets.all(12),
width: double.infinity, width: double.infinity,
child: Column( child: Column(
@ -111,16 +121,21 @@ class VaccinationTablePage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Html( Html(
data: model.creteVaccinationTableModelList[index].vaccinesDescription, data: model
.creteVaccinationTableModelList[index]
.vaccinesDescription,
), ),
], ],
), ),
), ),
Texts(model.creteVaccinationTableModelList[index].givenAt), Texts(model
.creteVaccinationTableModelList[index].givenAt),
], ],
), ),
Divider( 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, textColor: Colors.white,
color: checkedValue == false color: checkedValue == false
? Colors.white24 ? Colors.white24
: Color.fromRGBO(63, 72, 74, 1,), : Color.fromRGBO(
63,
72,
74,
1,
),
label: TranslationBase.of(context).sendEmail, label: TranslationBase.of(context).sendEmail,
onTap: () { onTap: () {
showDialog( showDialog(
context: context, 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);
},
),
); );
}, },
), ),

@ -21,7 +21,7 @@ class DateUtil {
static String convertDateToString(DateTime date) { static String convertDateToString(DateTime date) {
const start = "/Date("; const start = "/Date(";
const end = "+0300)"; const end = "+0300)/";
int milliseconds = date.millisecondsSinceEpoch; int milliseconds = date.millisecondsSinceEpoch;
return start + "$milliseconds" + end; return start + "$milliseconds" + end;

@ -1,7 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:diplomaticquarterapp/config/localized_values.dart'; 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/foundation.dart' show SynchronousFuture;
import 'package:flutter/material.dart'; 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 childName => localizedValues['child-name'][locale.languageCode];
String get childDob => localizedValues['childDob'][locale.languageCode]; String get childDob => localizedValues['childDob'][locale.languageCode];
String get delete => localizedValues['delete'][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 visit => localizedValues['visit'][locale.languageCode];
String get descriptionVaccination => localizedValues['description-vaccination'][locale.languageCode]; String get descriptionVaccination => localizedValues['description-vaccination'][locale.languageCode];
String get dueDate => localizedValues['due-date'][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];
} }

@ -47,7 +47,7 @@ class TextFields extends StatefulWidget {
this.autoFocus, this.autoFocus,
this.onChanged, this.onChanged,
// this.initialValue, this.initialValue,
this.minLines, this.minLines,
this.maxLines, this.maxLines,
this.inputFormatters, this.inputFormatters,
@ -79,7 +79,7 @@ class TextFields extends StatefulWidget {
final String hintText; final String hintText;
// final String initialValue; final String initialValue;
final String type; final String type;
final bool autoFocus; final bool autoFocus;
final IconData suffixIcon; final IconData suffixIcon;
@ -230,7 +230,7 @@ class _TextFieldsState extends State<TextFields> {
minLines: widget.minLines ?? 1, minLines: widget.minLines ?? 1,
maxLines: widget.maxLines ?? 1, maxLines: widget.maxLines ?? 1,
maxLengthEnforced: widget.maxLengthEnforced, maxLengthEnforced: widget.maxLengthEnforced,
// initialValue: widget.initialValue, initialValue: widget.initialValue,
onChanged: widget.onChanged, onChanged: widget.onChanged,
focusNode: _focusNode, focusNode: _focusNode,
maxLength: widget.maxLength ?? null, maxLength: widget.maxLength ?? null,

Loading…
Cancel
Save