Lab report download VIDA Plus implementation

merge-update-with-lab-changes
haroon amjad 1 year ago
parent 8b74c9df61
commit 889828d4d4

@ -233,7 +233,7 @@ class LabsService extends BaseService {
// await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) { // await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) {
await baseAppClient.post(isVidaPlus ? SEND_LAB_RESULT_EMAIL : SEND_LAB_RESULT_EMAIL_NEW, onSuccess: (dynamic response, int statusCode) { await baseAppClient.post(isVidaPlus ? SEND_LAB_RESULT_EMAIL : SEND_LAB_RESULT_EMAIL_NEW, onSuccess: (dynamic response, int statusCode) {
if (isDownload) { if (isDownload) {
labReportPDF = response['PdfContent']; labReportPDF = isVidaPlus ? response['LabReportsPDFContent'] : response['PdfContent'];
} }
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;

@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -55,6 +56,7 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
int selectedButtonIndex = 0; int selectedButtonIndex = 0;
int selectedNextDayButtonIndex = -1; int selectedNextDayButtonIndex = -1;
dynamic freeSlotsResponse; dynamic freeSlotsResponse;
// String nextDayAppointmentDate =""; // String nextDayAppointmentDate ="";
late ScrollController _scrollController; late ScrollController _scrollController;
@ -120,7 +122,7 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
_calendarController.selectedDate = day; _calendarController.selectedDate = day;
openTimeSlotsPickerForDate(day, docFreeSlots); openTimeSlotsPickerForDate(day, docFreeSlots);
DocAvailableAppointments.selectedDate = formatter.format(day); DocAvailableAppointments.selectedDate = formatter.format(day);
selectedNextDayButtonIndex =-1; selectedNextDayButtonIndex = -1;
print(_calendarController.selectedDate); print(_calendarController.selectedDate);
}); });
} }
@ -143,45 +145,51 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
), ),
DocAvailableAppointments.areSlotsAvailable DocAvailableAppointments.areSlotsAvailable
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ Container( children: [
height: 40, Container(
child: height: 40,
ListView.builder( child: ListView.builder(
controller: _scrollController, controller: _scrollController,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: dayEvents.length, itemCount: dayEvents.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Container( return Container(
margin: EdgeInsets.only(right: (index == dayEvents.length - 1) ? 16 : 5.0, left: index == 0 ? 16 : 5), margin: EdgeInsets.only(right: (index == dayEvents.length - 1) ? 16 : 5.0, left: index == 0 ? 16 : 5),
child: index == selectedButtonIndex ? getSelectedButton(index) : getNormalButton(index), child: index == selectedButtonIndex ? getSelectedButton(index) : getNormalButton(index),
); );
}, },
), ),
), ),
SizedBox(height: 20,), SizedBox(
nextDayEvents.isNotEmpty ? Container( height: 20,
padding: EdgeInsets.only(left: 20, right: 20, bottom:20), ),
child: Text(selectedNextDate, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: CustomColors.black))) :SizedBox(), nextDayEvents.isNotEmpty && projectViewModel.havePrivilege(110)
Container( ? Container(
height: 40, padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
padding: EdgeInsets.only(left: 0, right: 0), child: Text(
child: selectedNextDate,
ListView.builder( style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: CustomColors.black),
controller: _scrollController, ),
scrollDirection: Axis.horizontal, )
itemCount: nextDayEvents.length, : SizedBox(),
itemBuilder: (context, index) { Container(
return Container( height: 40,
margin: EdgeInsets.only(right: (index == nextDayEvents.length - 1) ? 16 : 5.0, left: index == 0 ? 16 : 5), padding: EdgeInsets.only(left: 0, right: 0),
child: index == selectedNextDayButtonIndex ? getSelectedNextDayButton(index) : getNormalNextDayButton(index), child: ListView.builder(
); controller: _scrollController,
}, scrollDirection: Axis.horizontal,
), itemCount: nextDayEvents.length,
) itemBuilder: (context, index) {
],) return Container(
margin: EdgeInsets.only(right: (index == nextDayEvents.length - 1) ? 16 : 5.0, left: index == 0 ? 16 : 5),
child: index == selectedNextDayButtonIndex ? getSelectedNextDayButton(index) : getNormalNextDayButton(index),
);
},
),
)
],
)
: Center( : Center(
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 12.0, right: 12.0), padding: const EdgeInsets.only(left: 12.0, right: 12.0),
@ -261,20 +269,24 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
} else } else
DocAvailableAppointments.areSlotsAvailable = false; DocAvailableAppointments.areSlotsAvailable = false;
}); });
} }
filterNextDayAppo(List<TimeSlot> freeSlots, Map<String, dynamic> listList){
DateTime dateStart = DateTime.parse(listList['end']).add(Duration(days: 1)); filterNextDayAppo(List<TimeSlot> freeSlots, Map<String, dynamic> listList) {
DateTime dateStart = DateTime.parse(listList['end']).add(Duration(days: 1));
DateTime dateStartObj = new DateTime(dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); DateTime dateStartObj = new DateTime(dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0);
nextDayEvents = []; nextDayEvents = [];
DateTime beforeHour = new DateTime(dateStart.year, dateStart.month, dateStart.day, 6, 0, 0, 0, 0); DateTime beforeHour = new DateTime(dateStart.year, dateStart.month, dateStart.day, 6, 0, 0, 0, 0);
if (projectViewModel.havePrivilege(110)) {
freeSlots.forEach((v) { freeSlots.forEach((v) {
if (v.start == dateStartObj && v.end!.isBefore(beforeHour) ) nextDayEvents.add(v); if (v.start == dateStartObj && v.end!.isBefore(beforeHour)) nextDayEvents.add(v);
}); });
// print(nextDayEvents); } else {
nextDayEvents = [];
}
// print(nextDayEvents);
} }
Future<Map<DateTime, List>> _getJSONSlots() async { Future<Map<DateTime, List>> _getJSONSlots() async {
Map<DateTime, List> _eventsParsed; Map<DateTime, List> _eventsParsed;
List<FreeSlot> slotsList = []; List<FreeSlot> slotsList = [];
@ -299,7 +311,7 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
), ),
), ),
); );
DocAvailableAppointments.selectedAppoDateTime = (isLiveCareSchedule != null && isLiveCareSchedule) DocAvailableAppointments.selectedAppoDateTime = (isLiveCareSchedule != null && isLiveCareSchedule)
? DateUtil.convertStringToDate(freeSlotsResponse[0]) ? DateUtil.convertStringToDate(freeSlotsResponse[0])
: DateUtil.convertStringToDateSaudiTimezone( : DateUtil.convertStringToDateSaudiTimezone(
@ -318,15 +330,15 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
), ),
), ),
language); language);
selectedNextDate = DateUtil.getWeekDayMonthDayYearDateFormatted( selectedNextDate = DateUtil.getWeekDayMonthDayYearDateFormatted(
(isLiveCareSchedule != null && isLiveCareSchedule) (isLiveCareSchedule != null && isLiveCareSchedule)
? DateUtil.convertStringToDate(freeSlotsResponse[0]).add(Duration(days:1)) ? DateUtil.convertStringToDate(freeSlotsResponse[0]).add(Duration(days: 1))
: DateUtil.convertStringToDateSaudiTimezone( : DateUtil.convertStringToDateSaudiTimezone(
freeSlotsResponse[0], freeSlotsResponse[0],
int.parse( int.parse(
widget.doctor.projectID.toString(), widget.doctor.projectID.toString(),
), ),
).add(Duration(days:1)), ).add(Duration(days: 1)),
language); language);
selectedDateJSON = freeSlotsResponse[0]; selectedDateJSON = freeSlotsResponse[0];
}); });
@ -370,13 +382,11 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
DocAvailableAppointments.selectedAppoDateTime = timeslot.end; DocAvailableAppointments.selectedAppoDateTime = timeslot.end;
setState(() { setState(() {
selectedButtonIndex = index; selectedButtonIndex = index;
selectedNextDayButtonIndex =-1; selectedNextDayButtonIndex = -1;
DocAvailableAppointments.selectedTime = dayEvents[index].isoTime; DocAvailableAppointments.selectedTime = dayEvents[index].isoTime;
print(DocAvailableAppointments.selectedTime); print(DocAvailableAppointments.selectedTime);
DocAvailableAppointments.selectedDate = dateFormatter.format(_calendarController.selectedDate!); DocAvailableAppointments.selectedDate = dateFormatter.format(_calendarController.selectedDate!);
}); });
projectViewModel.analytics.appointment.book_appointment_time_selection(appointment_type: 'regular', dateTime: timeslot.end, doctor: widget.doctor); projectViewModel.analytics.appointment.book_appointment_time_selection(appointment_type: 'regular', dateTime: timeslot.end, doctor: widget.doctor);
}, },
@ -404,6 +414,7 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
child: Text(dayEvents[index].isoTime!, style: TextStyle(fontSize: 12.0, color: Colors.white)), child: Text(dayEvents[index].isoTime!, style: TextStyle(fontSize: 12.0, color: Colors.white)),
); );
} }
Widget getNormalNextDayButton(int index) { Widget getNormalNextDayButton(int index) {
return CustomTextButton( return CustomTextButton(
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -412,16 +423,16 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
color: Colors.black, //Color of the border color: Colors.black, //Color of the border
style: BorderStyle.solid, //Style of the border style: BorderStyle.solid, //Style of the border
width: 1.5 //width of the border width: 1.5 //width of the border
), ),
onPressed: () { onPressed: () {
final timeslot = nextDayEvents[index]; final timeslot = nextDayEvents[index];
DocAvailableAppointments.selectedAppoDateTime = timeslot.end; DocAvailableAppointments.selectedAppoDateTime = timeslot.end;
setState(() { setState(() {
selectedButtonIndex = -1; selectedButtonIndex = -1;
selectedNextDayButtonIndex =index; selectedNextDayButtonIndex = index;
DocAvailableAppointments.selectedTime = nextDayEvents[index].isoTime; DocAvailableAppointments.selectedTime = nextDayEvents[index].isoTime;
DocAvailableAppointments.selectedDate = dateFormatter.format(_calendarController.selectedDate!.add(Duration(days:1))); DocAvailableAppointments.selectedDate = dateFormatter.format(_calendarController.selectedDate!.add(Duration(days: 1)));
print(DocAvailableAppointments.selectedTime); print(DocAvailableAppointments.selectedTime);
}); });
projectViewModel.analytics.appointment.book_appointment_time_selection(appointment_type: 'regular', dateTime: timeslot.end, doctor: widget.doctor); projectViewModel.analytics.appointment.book_appointment_time_selection(appointment_type: 'regular', dateTime: timeslot.end, doctor: widget.doctor);
@ -438,13 +449,13 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
color: nextDayEvents[index].isoTime == TranslationBase.of(context).waitingAppointment ? CustomColors.darkOrange : CustomColors.green, //Color of the border color: nextDayEvents[index].isoTime == TranslationBase.of(context).waitingAppointment ? CustomColors.darkOrange : CustomColors.green, //Color of the border
style: BorderStyle.solid, //Style of the border style: BorderStyle.solid, //Style of the border
width: 1.5 //width of the border width: 1.5 //width of the border
), ),
onPressed: () { onPressed: () {
setState(() { setState(() {
selectedButtonIndex =-1; selectedButtonIndex = -1;
selectedNextDayButtonIndex = index; selectedNextDayButtonIndex = index;
DocAvailableAppointments.selectedTime = nextDayEvents[index].isoTime; DocAvailableAppointments.selectedTime = nextDayEvents[index].isoTime;
DocAvailableAppointments.selectedDate =dateFormatter.format(_calendarController.selectedDate!.add(Duration(days:1))); DocAvailableAppointments.selectedDate = dateFormatter.format(_calendarController.selectedDate!.add(Duration(days: 1)));
print(DocAvailableAppointments.selectedTime); print(DocAvailableAppointments.selectedTime);
}); });
}, },

Loading…
Cancel
Save