From b5851f384d0b20a5b4fd20733f30dd7129068f8c Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Thu, 7 Dec 2023 12:29:19 +0300 Subject: [PATCH] DOCTOR ROTA AND LAB RAD CHANGES --- lib/client/base_app_client.dart | 16 + lib/config/config.dart | 10 +- lib/config/localized_values.dart | 5 + lib/core/model/dashboard/doctor_schedule.dart | 80 +++ lib/core/model/labs/patient_lab_orders.dart | 8 +- lib/core/model/radiology/final_radiology.dart | 6 +- lib/core/service/home/dasboard_service.dart | 4 +- lib/core/service/home/schedule_service.dart | 25 +- .../lab_order/labs_service.dart | 2 +- .../radiology/radiology_service.dart | 4 +- lib/core/viewModel/dashboard_view_model.dart | 4 +- lib/core/viewModel/radiology_view_model.dart | 4 +- lib/core/viewModel/schedule_view_model.dart | 14 + .../doctor_schedule/doctor_schedule.dart | 465 ++++++++++++++++++ .../laboratory_result_page.dart | 1 + .../laboratory_result_widget.dart | 8 +- .../radiology/radiology_details_page.dart | 5 +- .../translations_delegate_base_utils.dart | 5 +- lib/widgets/shared/app_drawer_widget.dart | 24 + lib/widgets/shared/app_scaffold_widget.dart | 6 +- 20 files changed, 674 insertions(+), 22 deletions(-) create mode 100644 lib/core/model/dashboard/doctor_schedule.dart create mode 100644 lib/screens/doctor_schedule/doctor_schedule.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 8e7a227f..2faae2c9 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -167,6 +167,7 @@ class BaseAppClient { } } + postPatient(String endPoint, {Map body, Function(dynamic response, int statusCode) onSuccess, @@ -346,4 +347,19 @@ class BaseAppClient { } return error; } + get({String endPoint, + Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure}) async{ + String token = await sharedPref.getString(TOKEN); + String url = DOCTOR_ROTATION + endPoint+'&token='+token; + + final response = await http.get(Uri.parse(url)); + final int statusCode = response.statusCode; + if (statusCode < 200 || statusCode >= 400) { + onFailure(Utils.generateContactAdminMsg(), statusCode); + } else { + var parsed = json.decode(response.body.toString()); + onSuccess(parsed,statusCode); + } + } } diff --git a/lib/config/config.dart b/lib/config/config.dart index a3a12461..e248f70e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,12 +5,15 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; +const DOCTOR_ROTATION = 'https://doctorrota.hmg.com/'; // const BASE_URL_LIVE_CARE = 'https://livecareuat.hmg.com/'; // const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; //Vida Plus URL +// const BASE_URL = 'https://webservices.hmg.com/'; + +// const BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; //Vida Plus URL // const BASE_URL = 'https://vidamergeuat.cloudsolutions.com.sa/'; //Vida Plus URL @@ -272,6 +275,9 @@ const GET_STP_MASTER_LIST = "Services/DoctorApplication.svc/REST/DoctorApp_GetST const DOCTOR_ER_SIGN_ASSESSMENT = "Services/DoctorApplication.svc/REST/DoctorApp_DoctorERSignAssessment"; + +const DOCTOR_SCHEDULE = "api/ScheduledSchedule/GetallSchedulebyUser"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 1dac83f3..dfdcbd8e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1146,4 +1146,9 @@ const Map> localizedValues = { "yourOrderAddedSuccessfully": {"en": "Your Order Added Successfully", "ar":"تم إضافة طلبك بنجاح"}, "youCannotAddOnlySpaces": {"en": "You Can't Add Only Spaces", "ar":""}, "conditionDescription": {"en": "Condition Description", "ar":"لا يمكنك إضافة مسافات فقط"}, + "doctorSchedule": {"en": "Doctor Schedule", "ar":"جدول الطبيب"}, + "doctorRota": {"en": "Doctor Rota", "ar":"دوران الطبيب"}, + "dateFrom": {"en": "Date From", "ar":"التاريخ من"}, + "searchFindSchedule": {"en": "Search and find out the doctor’s schedule ", "ar":"بحث ومعرفة جدول الطبيب"} + }; diff --git a/lib/core/model/dashboard/doctor_schedule.dart b/lib/core/model/dashboard/doctor_schedule.dart new file mode 100644 index 00000000..ab8cf192 --- /dev/null +++ b/lib/core/model/dashboard/doctor_schedule.dart @@ -0,0 +1,80 @@ +import 'dart:convert'; +List doctorScheduleFromJson(String str) => List.from(json.decode(str).map((x) => DoctorSchedule.fromJson(x))); + +String doctorScheduleToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class DoctorSchedule { + int scheduledid; + int status; + String clinicname; + int clinicid; + List scheduleforuser; + + DoctorSchedule({ + this.scheduledid, + this.status, + this.clinicname, + this.clinicid, + this.scheduleforuser, + }); + + factory DoctorSchedule.fromJson(Map json) => DoctorSchedule( + scheduledid: json["scheduledid"], + status: json["status"], + clinicname: json["clinicname"], + clinicid: json["clinicid"], + scheduleforuser: List.from(json["scheduleforuser"].map((x) => Scheduleforuser.fromJson(x))), + ); + + Map toJson() => { + "scheduledid": scheduledid, + "status": status, + "clinicname": clinicname, + "clinicid": clinicid, + "scheduleforuser": List.from(scheduleforuser.map((x) => x.toJson())), + }; +} + +class Scheduleforuser { + DateTime days; + int duration; + List shiftforuser; + + Scheduleforuser({ + this.days, + this.duration, + this.shiftforuser, + }); + + factory Scheduleforuser.fromJson(Map json) => Scheduleforuser( + days: DateTime.parse(json["days"]), + duration: json["duration"], + shiftforuser: List.from(json["shiftforuser"].map((x) => Shiftforuser.fromJson(x))), + ); + + Map toJson() => { + "days": days.toIso8601String(), + "duration": duration, + "shiftforuser": List.from(shiftforuser.map((x) => x.toJson())), + }; +} + +class Shiftforuser { + int fromtime; + int totime; + + Shiftforuser({ + this.fromtime, + this.totime, + }); + + factory Shiftforuser.fromJson(Map json) => Shiftforuser( + fromtime: json["fromtime"], + totime: json["totime"], + ); + + Map toJson() => { + "fromtime": fromtime, + "totime": totime, + }; +} diff --git a/lib/core/model/labs/patient_lab_orders.dart b/lib/core/model/labs/patient_lab_orders.dart index b481df54..d4d621b0 100644 --- a/lib/core/model/labs/patient_lab_orders.dart +++ b/lib/core/model/labs/patient_lab_orders.dart @@ -36,7 +36,7 @@ class PatientLabOrders { String setupID; List speciality; bool isLiveCareAppointment; - + String invoiceType; PatientLabOrders( {this.actualDoctorRate, this.clinicDescription, @@ -71,7 +71,9 @@ class PatientLabOrders { this.qR, this.setupID, this.speciality, - this.isLiveCareAppointment}); + this.isLiveCareAppointment, + this.invoiceType + }); PatientLabOrders.fromJson(Map json) { actualDoctorRate = json['ActualDoctorRate']; @@ -108,6 +110,7 @@ class PatientLabOrders { qR = json['QR']; setupID = json['SetupID']; isLiveCareAppointment = json['IsLiveCareAppointment']; + invoiceType = json["InvoiceType"]; // speciality = json['Speciality'].cast(); } @@ -147,6 +150,7 @@ class PatientLabOrders { data['SetupID'] = this.setupID; data['Speciality'] = this.speciality; data['IsLiveCareAppointment'] = this.isLiveCareAppointment; + data['InvoiceType'] = this.invoiceType; return data; } } diff --git a/lib/core/model/radiology/final_radiology.dart b/lib/core/model/radiology/final_radiology.dart index 90eb7d18..f5fae7c6 100644 --- a/lib/core/model/radiology/final_radiology.dart +++ b/lib/core/model/radiology/final_radiology.dart @@ -45,7 +45,7 @@ class FinalRadiology { bool isRadMedicalReport; bool isLiveCareAppodynamicment; bool isRecordFromVidaPlus; - + String invoiceType; FinalRadiology( {this.setupID, this.projectID, @@ -89,7 +89,7 @@ class FinalRadiology { this.speciality, this.isCVI, this.isRadMedicalReport, - this.isLiveCareAppodynamicment, this.isRecordFromVidaPlus}); + this.isLiveCareAppodynamicment, this.isRecordFromVidaPlus, this.invoiceType}); FinalRadiology.fromJson(Map json) { try { @@ -137,6 +137,7 @@ class FinalRadiology { isCVI = json['isCVI']; isRadMedicalReport = json['isRadMedicalReport']; isRecordFromVidaPlus = json['IsRecordFromVidaPlus']; + invoiceType = json["InvoiceType"]; } catch (e) { print(e); } @@ -186,6 +187,7 @@ class FinalRadiology { data['isCVI'] = this.isCVI; data['isRadMedicalReport'] = this.isRadMedicalReport; data['IsRecordFromVidaPlus'] = this.isRecordFromVidaPlus; + data["InvoiceType"] =invoiceType; return data; } } diff --git a/lib/core/service/home/dasboard_service.dart b/lib/core/service/home/dasboard_service.dart index 43d76c80..fe664baa 100644 --- a/lib/core/service/home/dasboard_service.dart +++ b/lib/core/service/home/dasboard_service.dart @@ -2,11 +2,13 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/dashboard/dashboard_model.dart'; +import '../../model/dashboard/doctor_schedule.dart'; + class DashboardService extends BaseService { List _dashboardItemsList = []; List get dashboardItemsList => _dashboardItemsList; - + bool hasVirtualClinic = false; String sServiceID; diff --git a/lib/core/service/home/schedule_service.dart b/lib/core/service/home/schedule_service.dart index f884516f..c0167592 100644 --- a/lib/core/service/home/schedule_service.dart +++ b/lib/core/service/home/schedule_service.dart @@ -3,13 +3,17 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/doctor/list_doctor_working_hours_table_model.dart'; import 'package:doctor_app_flutter/core/model/doctor/request_schedule.dart'; +import '../../../config/shared_pref_kay.dart'; +import '../../model/dashboard/doctor_schedule.dart'; + class ScheduleService extends BaseService { List get listDoctorWorkingHoursTable => _listDoctorWorkingHoursTable; List _listDoctorWorkingHoursTable = []; RequestSchedule _requestSchedule = RequestSchedule(); - + List _doctorRota= []; + List get doctorRotation => _doctorRota; Future getDoctorSchedule() async { await baseAppClient.post(GET_DOCTOR_WORKING_HOURS_TABLE, onSuccess: (dynamic response, int statusCode) { @@ -23,4 +27,23 @@ class ScheduleService extends BaseService { super.error = error; }, body: _requestSchedule.toJson(), isFallLanguage: true); } + + + Future getDoctorRota(String fromDate, String toDate,{int pageNo = 1}) async{ + hasError = false; + String doctorId = '7826'; //await sharedPref.getString(DOCTOR_ID); + String url = DOCTOR_SCHEDULE + '?userid='+doctorId+'&fromDate='+fromDate+'&toDate='+toDate+'&pagenumber='+pageNo.toString()+'&pagesize=10'; + await baseAppClient.get( endPoint: url, onSuccess: (dynamic response, int statusCode) { + _doctorRota =[]; + + response['response'].forEach((res){ + _doctorRota.add(DoctorSchedule.fromJson(res)); + }); + print(_doctorRota); + }, onFailure: (String error, int statusCode) { + print(error); + }, + + ); + } } diff --git a/lib/core/service/patient_medical_file/lab_order/labs_service.dart b/lib/core/service/patient_medical_file/lab_order/labs_service.dart index e4cb93bf..0e0e99c0 100644 --- a/lib/core/service/patient_medical_file/lab_order/labs_service.dart +++ b/lib/core/service/patient_medical_file/lab_order/labs_service.dart @@ -112,7 +112,7 @@ class LabsService extends BaseService { body['SetupID'] = patientLabOrder.setupID; body['ProjectID'] = patientLabOrder.projectID; body['ClinicID'] = patientLabOrder.clinicID ?? 0; - + body['InvoiceType'] = patientLabOrder.invoiceType ??""; await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult = []; diff --git a/lib/core/service/patient_medical_file/radiology/radiology_service.dart b/lib/core/service/patient_medical_file/radiology/radiology_service.dart index 22765c6d..1dca2462 100644 --- a/lib/core/service/patient_medical_file/radiology/radiology_service.dart +++ b/lib/core/service/patient_medical_file/radiology/radiology_service.dart @@ -10,14 +10,14 @@ class RadiologyService extends BaseService { String url = ''; bool isRadiologyVIDAPlus = false; - Future getRadImageURL({int invoiceNo, int lineItem, int projectId, bool isVidaPlus, @required PatiantInformtion patient}) async { + Future getRadImageURL({int invoiceNo, int lineItem, int projectId, bool isVidaPlus, @required PatiantInformtion patient,String invoiceType}) async { hasError = false; final Map body = new Map(); body['InvoiceNo'] = isVidaPlus ? "0" : invoiceNo; body['InvoiceNo_VP'] = isVidaPlus ? invoiceNo : "0"; body['LineItemNo'] = lineItem; body['ProjectID'] = projectId; - + body["InvoiceType"] = invoiceType; await baseAppClient.postPatient(GET_RAD_IMAGE_URL, patient: patient, onSuccess: (dynamic response, int statusCode) { url = response['Data']; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 7b1529fd..76e4efcd 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/dashboard/doctor_schedule.dart'; import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; import 'package:doctor_app_flutter/core/service/home/doctor_reply_service.dart'; import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart'; @@ -30,7 +31,6 @@ class DashboardViewModel extends BaseViewModel { List get specialClinicalCareList => _specialClinicsService.specialClinicalCareList; - Future startHomeScreenServices(ProjectViewModel projectsProvider, AuthenticationViewModel authProvider) async { setState(ViewState.Busy); @@ -130,4 +130,6 @@ class DashboardViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + } diff --git a/lib/core/viewModel/radiology_view_model.dart b/lib/core/viewModel/radiology_view_model.dart index e49af610..a5241ed9 100644 --- a/lib/core/viewModel/radiology_view_model.dart +++ b/lib/core/viewModel/radiology_view_model.dart @@ -53,9 +53,9 @@ class RadiologyViewModel extends BaseViewModel { String get radImageURL => _radiologyService.url; - getRadImageURL({int invoiceNo, int lineItem, int projectId, bool isVidaPlus, @required PatiantInformtion patient}) async { + getRadImageURL({int invoiceNo, int lineItem, int projectId, bool isVidaPlus, @required PatiantInformtion patient, String invoiceType}) async { setState(ViewState.Busy); - await _radiologyService.getRadImageURL(invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId, isVidaPlus: isVidaPlus, patient: patient); + await _radiologyService.getRadImageURL(invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId, isVidaPlus: isVidaPlus, patient: patient, invoiceType: invoiceType); if (_radiologyService.hasError) { error = _radiologyService.error; setState(ViewState.Error); diff --git a/lib/core/viewModel/schedule_view_model.dart b/lib/core/viewModel/schedule_view_model.dart index d5bc45b7..234199ea 100644 --- a/lib/core/viewModel/schedule_view_model.dart +++ b/lib/core/viewModel/schedule_view_model.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/dashboard/doctor_schedule.dart'; import 'package:doctor_app_flutter/core/service/home/schedule_service.dart'; import 'package:doctor_app_flutter/core/model/doctor/list_doctor_working_hours_table_model.dart'; @@ -11,6 +12,8 @@ class ScheduleViewModel extends BaseViewModel { List get listDoctorWorkingHoursTable => _scheduleService.listDoctorWorkingHoursTable; + List get getDoctorRotation => + _scheduleService.doctorRotation; Future getDoctorSchedule() async { setState(ViewState.Busy); await _scheduleService.getDoctorSchedule(); @@ -20,4 +23,15 @@ class ScheduleViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getDoctorRota(String fromDate, String toDate,{int pageNo=1}) async { + setState(ViewState.Busy); + await _scheduleService.getDoctorRota(fromDate,toDate,pageNo:pageNo); + if (_scheduleService.hasError) { + error = _scheduleService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/screens/doctor_schedule/doctor_schedule.dart b/lib/screens/doctor_schedule/doctor_schedule.dart new file mode 100644 index 00000000..9bdd4b62 --- /dev/null +++ b/lib/screens/doctor_schedule/doctor_schedule.dart @@ -0,0 +1,465 @@ +import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; +import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import '../../core/viewModel/project_view_model.dart'; +import '../../core/viewModel/schedule_view_model.dart'; +import '../../icons_app/doctor_app_icons.dart'; +import '../../utils/date-utils.dart'; +import '../../utils/dr_app_toast_msg.dart'; +import '../../utils/translations_delegate_base_utils.dart'; +import '../../widgets/shared/app_scaffold_widget.dart'; +import '../../widgets/shared/errors/error_message.dart'; +import '../base/base_view.dart'; +import '../patients/register_patient/CustomEditableText.dart'; + +class DoctorSchedulePage extends StatefulWidget { + @override + _DoctorSchedulePageState createState() => _DoctorSchedulePageState(); +} + +class _DoctorSchedulePageState extends State { + DashboardService service; + PageController _pageController = PageController(); + double currentPage = 0; + int selectedindex = 0; + List weeks = []; + // List doctorScheduleResponse = []; + int weekMS = 604800 * 1000; + // DoctorList? doctorList; + List freeSlots = []; + bool isPageChange = false; + String fromDate = DateFormat('yyyy-MM-dd').format(DateTime.now()); + String toDate = + DateFormat('yyyy-MM-dd').format(DateTime.now().add(Duration(days: 30))); + // AppSharedPreferences sharedPref = AppSharedPreferences(); + + @override + void initState() { + // this.doctorList = widget.doctorList; + + super.initState(); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getDoctorRota(fromDate, toDate), + builder: (_, model, widget2) { + return AppScaffold( + appBarTitle: TranslationBase.of(context).doctorSchedule, + isShowAppBar: true, + baseViewModel: model, + isHomeIcon: false, + isLoading: true, + actionButton: IconButton( + icon: Icon(DoctorApp.search_1), + color: Colors.black, //Colors.black, + onPressed: () => searchSchedule(model), + ), + body: SizedBox( + height: MediaQuery.of(context).size.height, + child: Stack( + children: [ + Column( + children: [ + Padding( + padding: EdgeInsets.only(left: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + TranslationBase.of(context).dateFrom + + " " + + DateFormat("dd-MMM").format( + DateFormat('yyyy-MM-dd') + .parse(fromDate)) + + " " + + TranslationBase.of(context).to + + " " + + DateFormat("dd-MMM").format( + DateFormat('yyyy-MM-dd') + .parse(toDate)), + style: TextStyle(fontWeight: FontWeight.w600), + ), + Row( + children: [ + IconButton( + onPressed: () { + + model.getDoctorRota(fromDate, toDate,); + }, + icon: SvgPicture.asset( + 'assets/images/svgs/prev.svg', + height: 25, + width: 10)), + IconButton( + onPressed: () {}, + icon: SvgPicture.asset( + 'assets/images/svgs/next.svg', + height: 25, + width: 10)) + ], + ), + ], + )), + ], + ), + model.getDoctorRotation.length ==0 ? Center( + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable, + )) : + Container( + margin: EdgeInsets.only(top: 45), + child: PageView.builder( + controller: _pageController, + itemCount: model.getDoctorRotation.length, + onPageChanged: (index) { + setState(() { + isPageChange = true; + this.currentPage = index.toDouble(); + }); + }, + itemBuilder: (context, index) { + return Container( + child: ListView.builder( + itemCount: model.getDoctorRotation[index] + .scheduleforuser.length, + itemBuilder: (context, index2) => InkWell( + onTap: () { + // final weekDay = weeks[index][index2]['DayName']; + }, + child: Row( + children: [ + Expanded( + flex: 1, + child: Padding( + padding: + projectViewModel.isArabic + ? EdgeInsets.only( + right: 17) + : EdgeInsets.only( + left: 17), + child: Row(children: [ + Column( + children: [ + Text(DateFormat('EEEE') + .format(model + .getDoctorRotation[ + index] + .scheduleforuser[ + index2] + .days) + + // fontSize: 13, + // fontWeight: projectViewModel.isArabic ? FontWeight.w600 : FontWeight.w500, + ), + Text(getDayMonths(model + .getDoctorRotation[ + index] + .scheduleforuser[ + index2] + .days)) + + // fontWeight: FontWeight.bold, + // fontSize: 18, + ], + ) + ])), + ), + Expanded( + flex: 3, + child: ClipRRect( + borderRadius: + const BorderRadius.all( + Radius.circular( + 20.0)), + child: Container( + padding: EdgeInsets.only( + left: 10, + right: 10, + top: 15, + bottom: 20), + margin: EdgeInsets.only( + left: 20, + right: 20, + top: 7, + bottom: 7), + decoration: BoxDecoration( + boxShadow: [ + model + .getDoctorRotation[ + index] + .scheduleforuser[ + index2] + .days + .toString() + .substring( + 0, + 10) == + DateTime.now() + .toString() + .substring( + 0, 10) + ? BoxShadow( + color: Colors + .green, + offset: Offset( + projectViewModel.isArabic + ? 5 + : -5, + 0)) + : BoxShadow( + color: Colors + .grey[ + 100], + blurRadius: + 5, + spreadRadius: + 4, + offset: + Offset( + 0, + 10), + ), + ], + borderRadius: + const BorderRadius.all( + Radius.circular( + 10.0)), + color: Colors.white), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + model + .getDoctorRotation[ + index] + .scheduleforuser[ + index2] + .days + .toString() + .substring( + 0, + 10) == + DateTime.now() + .toString() + .substring( + 0, + 10) + ? Text( + TranslationBase.of( + context) + .today, + style: + TextStyle( + color: Colors + .green, + fontWeight: + FontWeight + .w600, + fontSize: + 12, + )) + : SizedBox(), + // : SizedBox(), + Row( + children: [ + Expanded( + child: Text( + model + .getDoctorRotation[ + index] + .clinicname, + style: + TextStyle( + fontWeight: + FontWeight + .w600, + ), + ), + ), + // Icon(Icons.arrow_forward, size: 16.0), + ], + ), + Container( + height: 45, + child: ListView + .builder( + itemCount: model + .getDoctorRotation[ + index] + .scheduleforuser[ + index2] + .shiftforuser + .length, + itemBuilder: (context, + index3) => + Row(children: [ + Text(model.getDoctorRotation[index].scheduleforuser[index2].shiftforuser[index3].fromtime.toString()), + Text(" To "), + Text(model.getDoctorRotation[index].scheduleforuser[index2].shiftforuser[index3].totime.toString()) + ]))) + + // ],) + ]))), + ), + ], + )))); + }, + )), + // PageViewIndicator( + // isActive: true, + // currentPage: this.currentPage, + // length: weeks.length, + // ) + ], + )), + ); + }); + } + + searchSchedule(model) { + showDialog( + context: context, + builder: (BuildContext context) { + return StatefulBuilder( + builder:(context, setState) { + return + AlertDialog( + title: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).search, + style: TextStyle(fontSize: 22), + ), + Text( + TranslationBase.of(context).searchFindSchedule, + style: TextStyle(fontSize: 16), + ) + ], + ), + content: Container( + height: 150, + child: Column(children: [ + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now().add(Duration(days:365)), + onConfirm: (date) { + setState(() { + fromDate = DateFormat('yyyy-MM-dd').format(date); + }); + }, + ); + }, + child: Container( + padding: + EdgeInsets.only(top: 5, left: 12, right: 12, bottom: 5), + width: double.infinity, + height: 55, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + boxShadow: [ + BoxShadow( + blurRadius: .26, + spreadRadius: 1 * 1.5, + color: Colors.black.withOpacity(.05)) + ]), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dateFrom, + style: TextStyle(fontSize: 12), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(fromDate), + Icon(Icons.calendar_month_outlined) + ]) + ], + ))), + SizedBox(height: 20,), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now().add(Duration(days:365)), + onConfirm: (date) { + setState(() { + toDate = DateFormat('yyyy-MM-dd').format(date); + }); + }, + ); + }, + child: Container( + padding: + EdgeInsets.only(top: 5, left: 12, right: 12, bottom: 5), + width: double.infinity, + height: 55, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + boxShadow: [ + BoxShadow( + blurRadius: .26, + spreadRadius: 1 * 1.5, + color: Colors.black.withOpacity(.05)) + ]), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).toDate, + style: TextStyle(fontSize: 12), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(toDate), + Icon(Icons.calendar_month_outlined) + ]) + ], + ))) + ]), + ), + actions: [ + AppButton( + title:TranslationBase.of(context).search, + onPressed: () { + setState((){ + model.getDoctorRota(fromDate, toDate); + Navigator.pop(context); + }); + }, + ) + ], + ); + ; + } + ); + + }, + ); + } + + String getDayMonths(DateTime dateTime) { + String dateFormat = + '${dateTime.day} ${AppDateUtils.getMonth(dateTime.month).toString().substring(0, 3)}'; + return dateFormat; + } +} diff --git a/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_page.dart index c377d04e..29aaf2b5 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_page.dart @@ -58,6 +58,7 @@ class _LaboratoryResultPageState extends State { patientLabOrder: widget.patientLabOrders, patient: widget.patient, isInpatient: widget.patientType == "1", + invoiceType:widget.patientLabOrders.invoiceType ), ), ), diff --git a/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_widget.dart index 97d10d88..2248b4f6 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_widget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_widget.dart @@ -23,8 +23,8 @@ class LaboratoryResultWidget extends StatefulWidget { final PatientLabOrders patientLabOrder; final PatiantInformtion patient; final bool isInpatient; - - const LaboratoryResultWidget( + final String invoiceType; + const LaboratoryResultWidget( {Key key, this.onTap, this.billNo, @@ -32,7 +32,9 @@ class LaboratoryResultWidget extends StatefulWidget { this.orderNo, this.patientLabOrder, this.patient, - this.isInpatient}) + this.isInpatient, + this.invoiceType + }) : super(key: key); @override diff --git a/lib/screens/patients/profile/radiology/radiology_details_page.dart b/lib/screens/patients/profile/radiology/radiology_details_page.dart index a71bc59d..f6989964 100644 --- a/lib/screens/patients/profile/radiology/radiology_details_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_details_page.dart @@ -35,8 +35,11 @@ class RadiologyDetailsPage extends StatelessWidget { patient: patient, projectId: finalRadiology.projectID, lineItem: finalRadiology.invoiceLineItemNo, + invoiceType:finalRadiology.invoiceType, invoiceNo: Utils.isVidaPlusProject(projectViewModel, finalRadiology.projectID) ? finalRadiology.invoiceNo_VP : finalRadiology.invoiceNo, - isVidaPlus: Utils.isVidaPlusProject(projectViewModel, finalRadiology.projectID), + isVidaPlus: Utils.isVidaPlusProject(projectViewModel, finalRadiology.projectID, + + ), ), builder: (_, model, widget) => AppScaffold( appBar: PatientProfileAppBar( diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index ae709ba2..462f6372 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1725,7 +1725,10 @@ class TranslationBase { String get conditionDescription => localizedValues['conditionDescription'][locale.languageCode]; - + String get doctorSchedule => localizedValues['doctorSchedule'][locale.languageCode]; + String get doctorRota => localizedValues['doctorRota'][locale.languageCode]; + String get dateFrom => localizedValues['dateFrom'][locale.languageCode]; + String get searchFindSchedule => localizedValues['searchFindSchedule'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 5700db9c..1e755d6e 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/screens/doctor_schedule/doctor_schedule.dart'; import 'package:doctor_app_flutter/screens/reschedule_leaves/add_reschedule_leave.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; @@ -136,6 +137,28 @@ class _AppDrawerState extends State { }, ), SizedBox(height: 15), + + InkWell( + child: DrawerItem( + TranslationBase.of(context).doctorRota, + icon: Icons.punch_clock, + + // subTitle: , + ), + onTap: () { + Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => DoctorSchedulePage(), + settings: RouteSettings( + name: 'doctorSchedule') + // MyReferredPatient(), + )); + }, + ), + SizedBox(height: 15), + InkWell( child: DrawerItem( TranslationBase.of(context).myQRCode, @@ -143,6 +166,7 @@ class _AppDrawerState extends State { // subTitle: , ), ), + SizedBox(height: MediaQuery.of(context).size.height * 0.02), InkWell( child: Container( diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index c214a040..44106147 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -24,7 +24,7 @@ class AppScaffold extends StatelessWidget { final String subtitle; final bool isHomeIcon; final bool extendBody; - + final Widget actionButton; AppScaffold( {this.appBarTitle = '', this.body, @@ -36,7 +36,7 @@ class AppScaffold extends StatelessWidget { this.isHomeIcon = true, this.appBar, this.subtitle, - this.drawer, + this.drawer, this.actionButton, this.extendBody = false, this.bottomNavigationBar}); @@ -92,7 +92,7 @@ class AppScaffold extends StatelessWidget { onPressed: () => Navigator.pushNamedAndRemoveUntil( context, HOME, (r) => false), ) - : SizedBox() + : actionButton !=null ? actionButton :SizedBox() ], ) : null,