|
|
|
@ -51,8 +51,10 @@ class _SchedulePageState extends State<SchedulePage> {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return BaseView<MedicalViewModel>(
|
|
|
|
return BaseView<MedicalViewModel>(
|
|
|
|
onModelReady: (model) => model.getDoctorSchedule(doctorList),
|
|
|
|
onModelReady: (model) => model.getDoctorSchedule(doctorList),
|
|
|
|
|
|
|
|
allowAny: true,
|
|
|
|
builder: (_, model, widget) => BaseView<MedicalViewModel>(
|
|
|
|
builder: (_, model, widget) => BaseView<MedicalViewModel>(
|
|
|
|
onModelReady: (model2) => model2.getFreeSlots(doctorList),
|
|
|
|
onModelReady: (model2) => model2.getFreeSlots(doctorList),
|
|
|
|
|
|
|
|
allowAny: true,
|
|
|
|
builder: (_, model2, widget2) {
|
|
|
|
builder: (_, model2, widget2) {
|
|
|
|
if (model.freeSlots.length > 0 && isPageChange == false) {
|
|
|
|
if (model.freeSlots.length > 0 && isPageChange == false) {
|
|
|
|
this.freeSlots = model.freeSlots;
|
|
|
|
this.freeSlots = model.freeSlots;
|
|
|
|
@ -84,42 +86,31 @@ class _SchedulePageState extends State<SchedulePage> {
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
child: ListView.builder(
|
|
|
|
child: ListView.builder(
|
|
|
|
itemCount: weeks[index].length,
|
|
|
|
itemCount: weeks[index].length,
|
|
|
|
itemBuilder: (context, index2) =>
|
|
|
|
itemBuilder: (context, index2) => InkWell(
|
|
|
|
InkWell(
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
openBookAppointment(
|
|
|
|
openBookAppointment(weeks[index][index2]);
|
|
|
|
weeks[index][index2]);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
flex: 1,
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding:
|
|
|
|
padding: EdgeInsets.only(left: 20),
|
|
|
|
EdgeInsets.only(
|
|
|
|
child: Row(children: [
|
|
|
|
left: 20),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Column(
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Texts(
|
|
|
|
Texts(
|
|
|
|
weeks[index][index2]
|
|
|
|
weeks[index][index2]['DayName'],
|
|
|
|
[
|
|
|
|
fontSize: 13,
|
|
|
|
'DayName'],
|
|
|
|
|
|
|
|
fontSize:
|
|
|
|
|
|
|
|
13,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Texts(
|
|
|
|
Texts(
|
|
|
|
getDayMonths(
|
|
|
|
getDayMonths(
|
|
|
|
DateUtil
|
|
|
|
DateUtil.convertStringToDate(
|
|
|
|
.convertStringToDate(
|
|
|
|
|
|
|
|
weeks[index][index2]['Date'],
|
|
|
|
weeks[index][index2]['Date'],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
fontWeight:
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
FontWeight.bold,
|
|
|
|
fontSize: 18,
|
|
|
|
fontSize:
|
|
|
|
|
|
|
|
18,
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -128,50 +119,19 @@ class _SchedulePageState extends State<SchedulePage> {
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
flex: 3,
|
|
|
|
flex: 3,
|
|
|
|
child: ClipRRect(
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius:
|
|
|
|
borderRadius: const BorderRadius.all(Radius.circular(20.0)),
|
|
|
|
const BorderRadius
|
|
|
|
|
|
|
|
.all(
|
|
|
|
|
|
|
|
Radius.circular(
|
|
|
|
|
|
|
|
20.0)),
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
padding:
|
|
|
|
padding: EdgeInsets.only(left: 10, right: 10, top: 20, bottom: 20),
|
|
|
|
EdgeInsets.only(
|
|
|
|
margin: EdgeInsets.only(left: 20, right: 20, top: 7, bottom: 7),
|
|
|
|
left:
|
|
|
|
decoration: BoxDecoration(boxShadow: [
|
|
|
|
10,
|
|
|
|
weeks[index][index2]['fullDay'] == false ? BoxShadow(color: Colors.green, offset: Offset(-5, 0)) : BoxShadow(),
|
|
|
|
right:
|
|
|
|
], borderRadius: const BorderRadius.all(Radius.circular(10.0)), color: Colors.white),
|
|
|
|
10,
|
|
|
|
|
|
|
|
top: 20,
|
|
|
|
|
|
|
|
bottom:
|
|
|
|
|
|
|
|
20),
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
|
|
|
left: 20,
|
|
|
|
|
|
|
|
right: 20,
|
|
|
|
|
|
|
|
top: 7,
|
|
|
|
|
|
|
|
bottom: 7),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
boxShadow: [
|
|
|
|
|
|
|
|
weeks[index][index2]['fullDay'] ==
|
|
|
|
|
|
|
|
false
|
|
|
|
|
|
|
|
? BoxShadow(
|
|
|
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
|
|
|
offset: Offset(-5, 0))
|
|
|
|
|
|
|
|
: BoxShadow(),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
borderRadius:
|
|
|
|
|
|
|
|
const BorderRadius.all(Radius.circular(
|
|
|
|
|
|
|
|
10.0)),
|
|
|
|
|
|
|
|
color: Colors
|
|
|
|
|
|
|
|
.white),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child:
|
|
|
|
child: Texts(
|
|
|
|
Texts(
|
|
|
|
weeks[index][index2]['WorkingHours'],
|
|
|
|
weeks[index][index2]
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
[
|
|
|
|
|
|
|
|
'WorkingHours'],
|
|
|
|
|
|
|
|
fontWeight:
|
|
|
|
|
|
|
|
FontWeight.w400,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
@ -213,9 +173,7 @@ class _SchedulePageState extends State<SchedulePage> {
|
|
|
|
var newWeekSchedule = [];
|
|
|
|
var newWeekSchedule = [];
|
|
|
|
for (var workDay in this.doctorScheduleResponse) {
|
|
|
|
for (var workDay in this.doctorScheduleResponse) {
|
|
|
|
Map<String, dynamic> newWorkDay = Map();
|
|
|
|
Map<String, dynamic> newWorkDay = Map();
|
|
|
|
newWorkDay['Date'] = DateUtil.convertDateMSToJsonDate(
|
|
|
|
newWorkDay['Date'] = DateUtil.convertDateMSToJsonDate(DateUtil.convertStringToDate(workDay.date).millisecondsSinceEpoch + weekMSOffset);
|
|
|
|
DateUtil.convertStringToDate(workDay.date).millisecondsSinceEpoch +
|
|
|
|
|
|
|
|
weekMSOffset);
|
|
|
|
|
|
|
|
newWorkDay['DayName'] = workDay.dayName;
|
|
|
|
newWorkDay['DayName'] = workDay.dayName;
|
|
|
|
newWorkDay['WorkingHours'] = workDay.workingHours;
|
|
|
|
newWorkDay['WorkingHours'] = workDay.workingHours;
|
|
|
|
newWeekSchedule.add(newWorkDay);
|
|
|
|
newWeekSchedule.add(newWorkDay);
|
|
|
|
@ -238,8 +196,7 @@ class _SchedulePageState extends State<SchedulePage> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String getDayMonths(DateTime dateTime) {
|
|
|
|
String getDayMonths(DateTime dateTime) {
|
|
|
|
String dateFormat =
|
|
|
|
String dateFormat = '${dateTime.day} ${DateUtil.getMonth(dateTime.month).toString().substring(0, 3)}';
|
|
|
|
'${dateTime.day} ${DateUtil.getMonth(dateTime.month).toString().substring(0, 3)}';
|
|
|
|
|
|
|
|
return dateFormat;
|
|
|
|
return dateFormat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|