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);
}); });
} }
@ -144,10 +146,10 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
DocAvailableAppointments.areSlotsAvailable DocAvailableAppointments.areSlotsAvailable
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ Container( children: [
Container(
height: 40, height: 40,
child: child: ListView.builder(
ListView.builder(
controller: _scrollController, controller: _scrollController,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: dayEvents.length, itemCount: dayEvents.length,
@ -159,15 +161,22 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
}, },
), ),
), ),
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(
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(),
Container( Container(
height: 40, height: 40,
padding: EdgeInsets.only(left: 0, right: 0), padding: EdgeInsets.only(left: 0, right: 0),
child: child: ListView.builder(
ListView.builder(
controller: _scrollController, controller: _scrollController,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: nextDayEvents.length, itemCount: nextDayEvents.length,
@ -179,9 +188,8 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
}, },
), ),
) )
],) ],
)
: 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){
filterNextDayAppo(List<TimeSlot> freeSlots, Map<String, dynamic> listList) {
DateTime dateStart = DateTime.parse(listList['end']).add(Duration(days: 1)); 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);
}); });
} else {
nextDayEvents = [];
}
// print(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 = [];
@ -320,13 +332,13 @@ 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,
@ -419,9 +430,9 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
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);
@ -441,10 +452,10 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
), ),
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