|
|
|
|
@ -1,7 +1,11 @@
|
|
|
|
|
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/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';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart';
|
|
|
|
|
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';
|
|
|
|
|
@ -14,7 +18,6 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'new_text_Field.dart';
|
|
|
|
|
|
|
|
|
|
enum Gender { Male, Female, NON }
|
|
|
|
|
@ -24,6 +27,7 @@ class AddNewChildPage extends StatefulWidget {
|
|
|
|
|
final int frequency;
|
|
|
|
|
final int days;
|
|
|
|
|
final String itemDescription;
|
|
|
|
|
String dateAdd;
|
|
|
|
|
|
|
|
|
|
List<DateTime> _scheduleList = List();
|
|
|
|
|
List<DayOfWeek> daysOfWeek = [
|
|
|
|
|
@ -41,9 +45,10 @@ class AddNewChildPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
//AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key);
|
|
|
|
|
AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) {
|
|
|
|
|
startDay = DateTime.now();
|
|
|
|
|
endDay = DateTime.now();//endDay = DateTime.now().add(Duration(days: days));
|
|
|
|
|
int hour = 24;//(24 / frequency).round();
|
|
|
|
|
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,
|
|
|
|
|
@ -71,218 +76,236 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
|
|
|
|
|
Gender gender = Gender.Male;
|
|
|
|
|
//ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel();
|
|
|
|
|
List_BabyInformationModel addvancedModel = List_BabyInformationModel();
|
|
|
|
|
CreateNewBaby newChild=CreateNewBaby();
|
|
|
|
|
List_UserInformationModel informationModel =List_UserInformationModel();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBarTitle: "Vaccintion",
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.all(12),
|
|
|
|
|
child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 50,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
"Add the child's information below to recieve the schedule of vaccinations.", //+model.user.firstName,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
NewTextFields(
|
|
|
|
|
hintText: "First Name",
|
|
|
|
|
controller: _firstTextController,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
NewTextFields(
|
|
|
|
|
hintText: "Second Name",
|
|
|
|
|
controller: _secondTextController,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Gender:",
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
|
|
|
|
|
return BaseView<AddNewChildViewModel>(
|
|
|
|
|
builder: (_,model,w)=> AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBarTitle: "Vaccintion",
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.all(12),
|
|
|
|
|
child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 50,
|
|
|
|
|
),
|
|
|
|
|
],),
|
|
|
|
|
Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.12,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Texts(
|
|
|
|
|
"Add the child's information below to recieve the schedule of vaccinations.", //+model.user.firstName,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
NewTextFields(
|
|
|
|
|
hintText: "First Name",
|
|
|
|
|
controller: _firstTextController,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
NewTextFields(
|
|
|
|
|
hintText: "Second Name",
|
|
|
|
|
controller: _secondTextController,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.12,
|
|
|
|
|
width: 170,
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
|
|
|
|
|
textColor: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());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// bloodDetails.
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Gender:",
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.12,
|
|
|
|
|
width: 170,
|
|
|
|
|
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();
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.12,
|
|
|
|
|
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: 170,
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
textColor:
|
|
|
|
|
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());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// bloodDetails.
|
|
|
|
|
},
|
|
|
|
|
// bloodDetails.
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],) ,
|
|
|
|
|
),
|
|
|
|
|
//==========
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 6,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Date Of Birth::",
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.12,
|
|
|
|
|
width: 170,
|
|
|
|
|
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.
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
DatePicker.showDatePicker(context,
|
|
|
|
|
),
|
|
|
|
|
//==========
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 6,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Date Of Birth::",
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
DatePicker.showDatePicker(
|
|
|
|
|
context,
|
|
|
|
|
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(),
|
|
|
|
|
onConfirm: (date) {
|
|
|
|
|
onConfirm: (date) {
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.startDay = date;
|
|
|
|
|
widget.startDay = date;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
currentTime: widget.startDay,
|
|
|
|
|
// locale: projectViewModel.localeType
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts( //getStartDay()
|
|
|
|
|
// DateUtil.yearMonthDay(DateTime.now())
|
|
|
|
|
getStartDay()
|
|
|
|
|
),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
// locale: projectViewModel.localeType
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(//getStartDay()
|
|
|
|
|
// DateUtil.yearMonthDay(DateTime.now())
|
|
|
|
|
getStartDay()
|
|
|
|
|
),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
//=========
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12,
|
|
|
|
|
),
|
|
|
|
|
//=========
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
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",
|
|
|
|
|
//
|
|
|
|
|
onTap: () {
|
|
|
|
|
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",
|
|
|
|
|
//
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
|
|
addvancedModel.babyName=_firstTextController.text + " "+_secondTextController.text;
|
|
|
|
|
addvancedModel.gender=checkedValue;
|
|
|
|
|
addvancedModel.dOB=DateUtil.convertStringToDate(getStartDay()) ;
|
|
|
|
|
addvancedModel.alertBy=2;
|
|
|
|
|
addvancedModel.alertBy=addvancedModel.babyID;
|
|
|
|
|
addvancedModel.genderDescription=checkedValue==1?"Male":"Female";
|
|
|
|
|
addvancedModel.patientID=addvancedModel.patientID;
|
|
|
|
|
addvancedModel.userID=addvancedModel.userID;
|
|
|
|
|
// // advanceModel.fileNumber = _fileTextController.text;
|
|
|
|
|
// // advanceModel.hospitalsModel = _selectedHospital;
|
|
|
|
|
// // advanceModel.note = _notesTextController.text;
|
|
|
|
|
// // advanceModel.email = email ?? model.user.emailAddress;
|
|
|
|
|
// // advanceModel.amount = amount;
|
|
|
|
|
// // bloodDetails.city=_selectedHospital.toString();
|
|
|
|
|
AppToast.showSuccessToast(
|
|
|
|
|
message: "Email updated");
|
|
|
|
|
newChild.babyName =
|
|
|
|
|
_firstTextController.text + " " + _secondTextController.text;
|
|
|
|
|
newChild.gender = checkedValue.toString();
|
|
|
|
|
newChild.strDOB=getStartDay() ;
|
|
|
|
|
newChild.createdBy=informationModel.createdBy ;
|
|
|
|
|
newChild.editedBy=informationModel.createdBy;
|
|
|
|
|
newChild.tempValue=true;
|
|
|
|
|
newChild.userID=addvancedModel.userID;
|
|
|
|
|
newChild.isLogin=true;
|
|
|
|
|
newChild.alertBy=addvancedModel.alertBy;
|
|
|
|
|
|
|
|
|
|
model.getNewBabyOrders(newChild: newChild);
|
|
|
|
|
|
|
|
|
|
// bloodDetails.
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
//DateTime.now();//DateUtil.convertStringToDate(getStartDay());
|
|
|
|
|
// addvancedModel.alertBy = 2;
|
|
|
|
|
// addvancedModel.alertBy = addvancedModel.babyID;
|
|
|
|
|
// addvancedModel.genderDescription =
|
|
|
|
|
// checkedValue == 1 ? "Male" : "Female";
|
|
|
|
|
// addvancedModel.patientID = addvancedModel.patientID;
|
|
|
|
|
// addvancedModel.userID = addvancedModel.userID;
|
|
|
|
|
// // advanceModel.fileNumber = _fileTextController.text;
|
|
|
|
|
// // advanceModel.hospitalsModel = _selectedHospital;
|
|
|
|
|
// // advanceModel.note = _notesTextController.text;
|
|
|
|
|
// // advanceModel.email = email ?? model.user.emailAddress;
|
|
|
|
|
// // advanceModel.amount = amount;
|
|
|
|
|
// // bloodDetails.city=_selectedHospital.toString();
|
|
|
|
|
AppToast.showSuccessToast(message: "Record Added");
|
|
|
|
|
//============
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: ChildPage(),
|
|
|
|
|
|
|
|
|
|
//ChildPage(babyInformationModelList:model.BabyInformationModelList)
|
|
|
|
|
// HospitalsPage(
|
|
|
|
|
// findusHospitalModelList: model.FindusHospitalModelList,
|
|
|
|
|
// )
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
//==============
|
|
|
|
|
|
|
|
|
|
// bloodDetails.
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getStartDay() {
|
|
|
|
|
return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}";
|
|
|
|
|
}
|
|
|
|
|
|