|
|
|
|
@ -1,7 +1,10 @@
|
|
|
|
|
import 'package:device_calendar/device_calendar.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.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/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
@ -10,9 +13,7 @@ import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'new_text_Field.dart';
|
|
|
|
|
|
|
|
|
|
@ -20,6 +21,35 @@ enum Gender { Male, Female, NON }
|
|
|
|
|
enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON }
|
|
|
|
|
|
|
|
|
|
class AddNewChildPage extends StatefulWidget {
|
|
|
|
|
final int frequency;
|
|
|
|
|
final int days;
|
|
|
|
|
final String itemDescription;
|
|
|
|
|
|
|
|
|
|
List<DateTime> _scheduleList = List();
|
|
|
|
|
List<DayOfWeek> daysOfWeek = [
|
|
|
|
|
DayOfWeek.Monday,
|
|
|
|
|
DayOfWeek.Tuesday,
|
|
|
|
|
DayOfWeek.Wednesday,
|
|
|
|
|
DayOfWeek.Thursday,
|
|
|
|
|
DayOfWeek.Friday,
|
|
|
|
|
DayOfWeek.Saturday,
|
|
|
|
|
DayOfWeek.Sunday
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
DateTime startDay;
|
|
|
|
|
DateTime endDay;
|
|
|
|
|
|
|
|
|
|
//AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key);
|
|
|
|
|
AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) {
|
|
|
|
|
startDay = DateTime.now();
|
|
|
|
|
endDay = DateTime.now();//endDay = DateTime.now().add(Duration(days: days));
|
|
|
|
|
int hour = 24;//(24 / frequency).round();
|
|
|
|
|
int durations = 24 ~/ hour;
|
|
|
|
|
for (int count = 0; count < durations; count++) {
|
|
|
|
|
_scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month,
|
|
|
|
|
DateTime.now().day, (hour * count)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@override
|
|
|
|
|
_AddNewChildPageState createState() => _AddNewChildPageState();
|
|
|
|
|
}
|
|
|
|
|
@ -39,7 +69,8 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
|
|
|
|
|
TextEditingController _notesTextController = TextEditingController();
|
|
|
|
|
BeneficiaryType beneficiaryType = BeneficiaryType.NON;
|
|
|
|
|
Gender gender = Gender.Male;
|
|
|
|
|
ChildVaccinesViewModel AddvancedModel = ChildVaccinesViewModel();
|
|
|
|
|
//ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel();
|
|
|
|
|
List_BabyInformationModel addvancedModel = List_BabyInformationModel();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -165,14 +196,17 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
|
|
|
|
|
onTap: () {
|
|
|
|
|
DatePicker.showDatePicker(context,
|
|
|
|
|
showTitleActions: true,
|
|
|
|
|
minTime: DateTime(
|
|
|
|
|
DateTime.now().year, DateTime.now().month - 1, 1),
|
|
|
|
|
maxTime: DateTime.now(), onConfirm: (date) {
|
|
|
|
|
// minTime: DateTime(
|
|
|
|
|
// DateTime.now().year, DateTime.now().month - 1, 1),
|
|
|
|
|
minTime: DateTime(
|
|
|
|
|
1, 1, 1),
|
|
|
|
|
maxTime: DateTime.now(),
|
|
|
|
|
onConfirm: (date) {
|
|
|
|
|
setState(() {
|
|
|
|
|
// widget.startDay = date;
|
|
|
|
|
widget.startDay = date;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// currentTime: widget.startDay,
|
|
|
|
|
currentTime: widget.startDay,
|
|
|
|
|
// locale: projectViewModel.localeType
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
@ -186,8 +220,9 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts( DateUtil.yearMonthDay(DateTime.now())
|
|
|
|
|
//getStartDay()
|
|
|
|
|
Texts( //getStartDay()
|
|
|
|
|
// DateUtil.yearMonthDay(DateTime.now())
|
|
|
|
|
getStartDay()
|
|
|
|
|
),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
@ -223,7 +258,23 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
|
|
|
|
|
label: "Add",
|
|
|
|
|
//
|
|
|
|
|
onTap: () {
|
|
|
|
|
// bloodDetails.city=_selectedHospital.toString();
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
// bloodDetails.
|
|
|
|
|
},
|
|
|
|
|
@ -232,4 +283,38 @@ class _AddNewChildPageState extends State<AddNewChildPage> {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
String getStartDay() {
|
|
|
|
|
return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getEndDay() {
|
|
|
|
|
return "${DateUtil.getMonth(widget.endDay.month)} ${widget.endDay.day}, ${widget.endDay.year}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getDateTime(DateTime dateTime) {
|
|
|
|
|
return '${dateTime.hour}:${dateTime.minute}';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getDays() {
|
|
|
|
|
String days = "";
|
|
|
|
|
widget.daysOfWeek.forEach((element) {
|
|
|
|
|
days += "${DateUtil.getDay(element)},";
|
|
|
|
|
});
|
|
|
|
|
return days;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void confirmSelectDayDialog() {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: DayCheckBoxDialog(
|
|
|
|
|
title: 'Select Day',
|
|
|
|
|
selectedDaysOfWeek: widget.daysOfWeek,
|
|
|
|
|
onValueSelected: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.daysOfWeek = value;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|