diff --git a/assets/images/new-design/allergiesDetails.png b/assets/images/new-design/allergiesDetails.png new file mode 100644 index 00000000..fc268c9c Binary files /dev/null and b/assets/images/new-design/allergiesDetails.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index a34848d5..3e58f203 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -226,6 +226,8 @@ const GET_DOCTOR_RESPONSE = 'Services/Patients.svc/REST/GetDoctorResponse'; const UPDATE_READ_STATUS = 'Services/Patients.svc/REST/UpdateReadStatus'; const INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo'; +const GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; + const TIMER_MIN = 10; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 790da29f..027d0e74 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -417,7 +417,7 @@ const Map> localizedValues = { "UpdateInsuranceSubtitle": {"en": "Card", "ar": "التأمين"}, "InsuranceApproval": {"en": "Insurance Approval", "ar": "موافقات"}, "InsuranceApprovalSubtitle": {"en": "Approvals", "ar": "موافقات التأمين"}, - "Allergies": {"en": "Approvals", "ar": "الحساسية"}, + "Allergies": {"en": "Allergies", "ar": "الحساسية"}, "AllergiesSubtitle": {"en": "Diagnosed", "ar": "مسجلة"}, "MyVaccines": {"en": "My Vaccines", "ar": "تطعيماتي"}, "MyVaccinesSubtitle": {"en": "List", "ar": "قائمة"}, @@ -497,10 +497,29 @@ const Map> localizedValues = { "Cylinder":{"en":"Cylinder","ar":"الدائرية"}, "Axis":{"en":"Axis","ar":"المحاور"}, "Prism":{"en":"Prism","ar":"موشور"}, - "VA":{"en":"Prism","VA":"المحاور"}, - "LeftEye":{"en":"Left Eye","VA":"العين اليسرى"}, - "Brand":{"en":"Brand","VA":"النوع"}, - "Power":{"en":"Power","VA":"القوة"}, - "Diameter":{"en":"Diameter","VA":"القطر"}, - "Remarks":{"en":"Remarks","VA":"ملاحضات"}, + "VA":{"en":"Prism","ar":"المحاور"}, + "LeftEye":{"en":"Left Eye","ar":"العين اليسرى"}, + "Brand":{"en":"Brand","ar":"النوع"}, + "Power":{"en":"Power","ar":"القوة"}, + "Diameter":{"en":"Diameter","ar":"القطر"}, + "Remarks":{"en":"Remarks","ar":"ملاحضات"}, + "ActiveMedications":{"en":"Active Medications","ar":"ادويتي النشطة"}, + "ExpDate":{"en":"Active Exp Date :","VA":"تاريخ الإنتهاء"}, + "Route":{"en":"Route :","ar":"الطريقة"}, + "Frequency":{"en":"Frequency :","ar":"المعدل"}, + "DailyQuantity":{"en":"Daily Quantity :","ar":"جرعات يومية"}, + "AddReminder":{"en":"Add Reminder","ar":"إضافة تذكير"}, + "reminderDes":{"en":"Please select treatment start day and time to be notified when it\'s time to take the medicine","ar":" يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء"}, + "StartDay":{"en":"Start Day","ar":"يوم البداية"}, + "EndDay":{"en":"End Day","ar":"يوم الانتهاء"}, + "Days":{"en":"Days ","ar":"أيام"}, + "ScheduleTime":{"en":"Schedule time","ar":"الجدول الزمني"}, + "AskDoctor":{"en":"Ask Doctor","ar":"اسأل طبيبك"}, + "DoctorResponses":{"en":"Doctor Responses","ar":"ردود الأطباء"}, + "New":{"en":"New","ar":"جديد"}, + "All":{"en":"All","ar":"الكل"}, + "QuestionHere":{"en":"Enter the question here...","ar":"اضف الاستفسار هنا"}, + "ViewDoctorResponses":{"en":"View Doctor Responses","ar":"الاطلاع على ردود الأطباء"}, + + }; diff --git a/lib/core/model/Allergy/Allergy.dart b/lib/core/model/Allergy/Allergy.dart new file mode 100644 index 00000000..be71c7fe --- /dev/null +++ b/lib/core/model/Allergy/Allergy.dart @@ -0,0 +1,48 @@ +class Allergy { + int patientID; + int allergyDiseaseType; + int allergyDiseaseID; + String description; + dynamic descriptionN; + dynamic remarks; + dynamic avgDoctorRatingList; + dynamic doctorRatingDetailsList; + dynamic notesDoctorRatingList; + + Allergy( + {this.patientID, + this.allergyDiseaseType, + this.allergyDiseaseID, + this.description, + this.descriptionN, + this.remarks, + this.avgDoctorRatingList, + this.doctorRatingDetailsList, + this.notesDoctorRatingList}); + + Allergy.fromJson(Map json) { + patientID = json['PatientID']; + allergyDiseaseType = json['AllergyDiseaseType']; + allergyDiseaseID = json['AllergyDiseaseID']; + description = json['Description']; + descriptionN = json['DescriptionN']; + remarks = json['Remarks']; + avgDoctorRatingList = json['AvgDoctorRatingList']; + doctorRatingDetailsList = json['DoctorRatingDetailsList']; + notesDoctorRatingList = json['NotesDoctorRatingList']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['AllergyDiseaseType'] = this.allergyDiseaseType; + data['AllergyDiseaseID'] = this.allergyDiseaseID; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + data['Remarks'] = this.remarks; + data['AvgDoctorRatingList'] = this.avgDoctorRatingList; + data['DoctorRatingDetailsList'] = this.doctorRatingDetailsList; + data['NotesDoctorRatingList'] = this.notesDoctorRatingList; + return data; + } +} diff --git a/lib/core/model/prescriptions/prescriptions_order.dart b/lib/core/model/prescriptions/prescriptions_order.dart index db2b1855..fdcbf203 100644 --- a/lib/core/model/prescriptions/prescriptions_order.dart +++ b/lib/core/model/prescriptions/prescriptions_order.dart @@ -2,35 +2,35 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; class PrescriptionsOrder { int iD; - String patientID; + dynamic patientID; bool patientOutSA; bool isOutPatient; int projectID; int nearestProjectID; double longitude; double latitude; - String appointmentNo; - String dischargeID; + dynamic appointmentNo; + dynamic dischargeID; int lineItemNo; int status; - String description; - String descriptionN; + dynamic description; + dynamic descriptionN; DateTime createdOn; int serviceID; int createdBy; DateTime editedOn; int editedBy; int channel; - String clientRequestID; + dynamic clientRequestID; bool returnedToQueue; - Null pickupDateTime; - Null pickupLocationName; - Null dropoffLocationName; + dynamic pickupDateTime; + dynamic pickupLocationName; + dynamic dropoffLocationName; int realRRTHaveTransactions; - String nearestProjectDescription; - String nearestProjectDescriptionN; - String projectDescription; - String projectDescriptionN; + dynamic nearestProjectDescription; + dynamic nearestProjectDescriptionN; + dynamic projectDescription; + dynamic projectDescriptionN; PrescriptionsOrder( {this.iD, diff --git a/lib/core/service/medical/AllergiesService.dart b/lib/core/service/medical/AllergiesService.dart new file mode 100644 index 00000000..d3deae2b --- /dev/null +++ b/lib/core/service/medical/AllergiesService.dart @@ -0,0 +1,25 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/Allergy/Allergy.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class AllergiesService extends BaseService { + List allergies = List(); + + getAllergies() async { + hasError = false; + super.error = ""; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + body['OutSA'] = 0; + await baseAppClient.post(GET_PATIENT_ALLERGIES, + onSuccess: (response, statusCode) async { + allergies.clear(); + response['Patient_Allergies'].forEach((allergy) { + allergies.add(Allergy.fromJson(allergy)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/viewModels/medical/AllergiesViewModel.dart b/lib/core/viewModels/medical/AllergiesViewModel.dart new file mode 100644 index 00000000..bc4666bc --- /dev/null +++ b/lib/core/viewModels/medical/AllergiesViewModel.dart @@ -0,0 +1,22 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/Allergy/Allergy.dart'; +import 'package:diplomaticquarterapp/core/service/medical/AllergiesService.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; + +import '../../../locator.dart'; + +class AllergiesViewModel extends BaseViewModel { + AllergiesService _allergiesService = locator(); + List get allergies => _allergiesService.allergies; + + getAllergies() async { + setState(ViewState.Busy); + await _allergiesService.getAllergies(); + if (_allergiesService.hasError) { + error = _allergiesService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 406dee3e..cf467ac8 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -10,6 +10,7 @@ import 'core/service/er/er_service.dart'; import 'core/service/feedback/feedback_service.dart'; import 'core/service/hospital_service.dart'; import 'core/service/medical/ActiveMedicationsService.dart'; +import 'core/service/medical/AllergiesService.dart'; import 'core/service/medical/BloodPressureService.dart'; import 'core/service/medical/BloodSugarService.dart'; import 'core/service/medical/EyeService.dart'; @@ -31,6 +32,7 @@ import 'core/viewModels/feedback/feedback_view_model.dart'; import 'core/service/medical/reports_service.dart'; import 'core/viewModels/hospital_view_model.dart'; import 'core/viewModels/medical/ActiveMedicationsViewModel.dart'; +import 'core/viewModels/medical/AllergiesViewModel.dart'; import 'core/viewModels/medical/EyeViewModel.dart'; import 'core/viewModels/medical/ask_doctor_view_model.dart'; import 'core/viewModels/medical/blood_pressure_view_model.dart'; @@ -86,6 +88,7 @@ void setupLocator() { locator.registerLazySingleton(() => EyeService()); locator.registerLazySingleton(() => ActiveMedicationsService()); locator.registerLazySingleton(() => AskDoctorService()); + locator.registerLazySingleton(() => AllergiesService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -114,4 +117,5 @@ void setupLocator() { locator.registerFactory(() => EyeViewModel()); locator.registerFactory(() => ActiveMedicationsViewModel()); locator.registerFactory(() => AskDoctorViewModel()); + locator.registerFactory(() => AllergiesViewModel()); } diff --git a/lib/pages/medical/active_medications/ActiveMedicationsPage.dart b/lib/pages/medical/active_medications/ActiveMedicationsPage.dart index 3409c3db..5bc9618d 100644 --- a/lib/pages/medical/active_medications/ActiveMedicationsPage.dart +++ b/lib/pages/medical/active_medications/ActiveMedicationsPage.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/ActiveMedicationsVi import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/active_medications/reminder_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -17,7 +18,7 @@ class ActiveMedicationsPage extends StatelessWidget { onModelReady: (model) => model.getActiveMedication(), builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: 'Active Medications', + appBarTitle: TranslationBase.of(context).activeMedications, isShowAppBar: true, body: Container( child: ListView.builder( @@ -48,7 +49,7 @@ class ActiveMedicationsPage extends StatelessWidget { height: 5, ), Texts( - 'Exp Date :' + + TranslationBase.of(context).expDate+' :' + DateUtil.getDayMonthYearDateFormatted(model .activePrescriptionReport[index].orderDate), ), @@ -56,52 +57,53 @@ class ActiveMedicationsPage extends StatelessWidget { height: 5, ), Texts( - 'Route :' + + TranslationBase.of(context).route+ ' :' + model.activePrescriptionReport[index].route, ), SizedBox( height: 5, ), Texts( - 'Frequency :' + + TranslationBase.of(context).frequency+ ' :' + model.activePrescriptionReport[index].frequency, ), SizedBox( height: 5, ), Texts( - 'Daily Quantity :${model.activePrescriptionReport[index].doseDailyQuantity}', + TranslationBase.of(context).dailyQuantity + ' :${model.activePrescriptionReport[index].doseDailyQuantity}', ), ], ), ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReminderPage( - frequency: model.activePrescriptionReport[index] - .frequencyNumber, - days: model.activePrescriptionReport[index].days, - itemDescription: model - .activePrescriptionReport[index] - .itemDescription, - ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Icon( + Icons.notifications, + color: Colors.red, + size: 28, ), - ); - }, - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Icon( - Icons.notifications, - color: Colors.red, - size: 28, - ), - Row( + SizedBox(height: 25,), + InkWell( + onTap: (){ + Navigator.push( + context, + FadePage( + page: ReminderPage( + frequency: model.activePrescriptionReport[index] + .frequencyNumber, + days: model.activePrescriptionReport[index].days, + itemDescription: model + .activePrescriptionReport[index] + .itemDescription, + ), + ), + ); + }, + child: Row( children: [ Icon( Icons.notifications_active, @@ -109,13 +111,13 @@ class ActiveMedicationsPage extends StatelessWidget { size: 28, ), Texts( - 'Reminder', + TranslationBase.of(context).addReminder, color: Colors.red, ) ], - ) - ], - ), + ), + ) + ], ), ) ], diff --git a/lib/pages/medical/active_medications/DayCheckBoxDialog.dart b/lib/pages/medical/active_medications/DayCheckBoxDialog.dart new file mode 100644 index 00000000..5cb4020c --- /dev/null +++ b/lib/pages/medical/active_medications/DayCheckBoxDialog.dart @@ -0,0 +1,161 @@ +import 'package:device_calendar/device_calendar.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class DayCheckBoxDialog extends StatefulWidget { + final Function(List) onValueSelected; + final String title; + final List selectedDaysOfWeek; + final List daysOfWeek = [ + DayOfWeek.Monday, + DayOfWeek.Tuesday, + DayOfWeek.Wednesday, + DayOfWeek.Thursday, + DayOfWeek.Friday, + DayOfWeek.Saturday, + DayOfWeek.Sunday, + ]; + + DayCheckBoxDialog( + {Key key, this.onValueSelected, this.selectedDaysOfWeek, this.title}); + + @override + _DayCheckBoxDialogState createState() => _DayCheckBoxDialogState(); +} + +class _DayCheckBoxDialogState extends State { + @override + Widget build(BuildContext context) { + return SimpleDialog( + title: Container( + width: double.infinity, + child: Center( + child: Texts( + widget.title, + textAlign: TextAlign.center, + ))), + children: [ + Container( + height: widget.daysOfWeek.length > 3 + ? MediaQuery.of(context).size.height * 0.6 + : null, + child: SingleChildScrollView( + child: Column( + children: [ + Divider(), + ...List.generate( + widget.daysOfWeek.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + if (widget.selectedDaysOfWeek + .contains(widget.daysOfWeek[index])) + widget.selectedDaysOfWeek + .remove(widget.daysOfWeek[index]); + else + widget.selectedDaysOfWeek + .add(widget.daysOfWeek[index]); + }); + }, + child: ListTile( + title: Text(DateUtil.getDay(widget.daysOfWeek[index])), + leading: Checkbox( + value: widget.selectedDaysOfWeek + .contains(widget.daysOfWeek[index]), + onChanged: (value) { + setState(() { + if (widget.selectedDaysOfWeek + .contains(widget.daysOfWeek[index])) + widget.selectedDaysOfWeek + .remove(widget.daysOfWeek[index]); + else + widget.selectedDaysOfWeek + .add(widget.daysOfWeek[index]); + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context) + .cancel + .toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedDaysOfWeek); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + ), + ), + ), + ), + ), + ], + ) + ], + ), + ), + ) + ], + ); + } + + +} diff --git a/lib/pages/medical/active_medications/reminder_page.dart b/lib/pages/medical/active_medications/reminder_page.dart index 72f6c211..7980d941 100644 --- a/lib/pages/medical/active_medications/reminder_page.dart +++ b/lib/pages/medical/active_medications/reminder_page.dart @@ -1,10 +1,10 @@ +import 'package:device_calendar/device_calendar.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/ActiveMedicationsViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; -import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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'; @@ -13,6 +13,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:provider/provider.dart'; +import 'DayCheckBoxDialog.dart'; + // ignore: must_be_immutable class ReminderPage extends StatefulWidget { final int frequency; @@ -20,6 +22,15 @@ class ReminderPage extends StatefulWidget { final String itemDescription; List _scheduleList = List(); + List daysOfWeek = [ + DayOfWeek.Monday, + DayOfWeek.Tuesday, + DayOfWeek.Wednesday, + DayOfWeek.Thursday, + DayOfWeek.Friday, + DayOfWeek.Saturday, + DayOfWeek.Sunday + ]; DateTime startDay; DateTime endDay; @@ -48,7 +59,7 @@ class _ReminderPageState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBarTitle: 'Reminder', + appBarTitle: TranslationBase.of(context).reminder, body: SingleChildScrollView( child: Container( margin: EdgeInsets.all(8.0), @@ -57,14 +68,16 @@ class _ReminderPageState extends State { children: [ Container( width: double.maxFinite, - child: Texts( - 'Please select treatment start day and time to be notified when it\'s time to take the medicine'), + child: Texts(TranslationBase.of(context).reminderDes), ), Divider(), SizedBox( height: 12, ), - Texts('Start day'), + Texts(TranslationBase.of(context).startDay), + SizedBox( + height: 6, + ), InkWell( onTap: () { DatePicker.showDatePicker(context, @@ -72,7 +85,6 @@ class _ReminderPageState extends State { minTime: DateTime( DateTime.now().year, DateTime.now().month - 1, 1), maxTime: DateTime.now(), onConfirm: (date) { - print('confirm $date'); setState(() { widget.startDay = date; }); @@ -102,7 +114,10 @@ class _ReminderPageState extends State { SizedBox( height: 12, ), - Texts('End day'), + Texts(TranslationBase.of(context).endDay), + SizedBox( + height: 6, + ), InkWell( onTap: () { DatePicker.showDatePicker(context, @@ -110,7 +125,6 @@ class _ReminderPageState extends State { minTime: DateTime( DateTime.now().year, DateTime.now().month - 1, 1), maxTime: DateTime.now(), onConfirm: (date) { - print('confirm $date'); setState(() { widget.endDay = date; }); @@ -137,6 +151,37 @@ class _ReminderPageState extends State { ), ), ), + SizedBox( + height: 12, + ), + Texts(TranslationBase.of(context).days), + SizedBox( + height: 6, + ), + InkWell( + onTap: () => confirmSelectDayDialog(), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Texts( + getDays(), + )), + Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + ], + ), + ), + ), ...List.generate( widget._scheduleList.length, (index) => Column( @@ -145,7 +190,7 @@ class _ReminderPageState extends State { SizedBox( height: 7, ), - Texts('Schedule time'), + Texts(TranslationBase.of(context).scheduleTime), SizedBox( height: 7, ), @@ -153,7 +198,6 @@ class _ReminderPageState extends State { onTap: () { DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { - print('confirm $date'); setState(() { widget._scheduleList[index] = date; }); @@ -194,14 +238,31 @@ class _ReminderPageState extends State { ), bottomSheet: Container( width: double.infinity, - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery.of(context).size.height * 0.2, padding: EdgeInsets.all(10), - child: SecondaryButton( - label: 'OK', - color: Colors.grey[800], - onTap: () { - schedule(); - }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SecondaryButton( + label: TranslationBase.of(context).ok, + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + schedule(); + }, + ), + SizedBox( + height: 15, + ), + SecondaryButton( + label: TranslationBase.of(context).cancel, + color: Colors.red[800], + textColor: Colors.white, + onTap: () { + Navigator.pop(context); + }, + ), + ], ), ), ), @@ -212,14 +273,6 @@ class _ReminderPageState extends State { List scheduleDateTime = calculateDaysInterval(widget.startDay, widget.endDay); - // scheduleDateTime.forEach((date) { - // LocalNotification.scheduleNotification( - // scheduledNotificationDateTime: date, - // title: 'Remainder', - // description: widget.itemDescription); - // return; - // }); - CalendarUtils calendarUtils = await CalendarUtils.getInstance(); calendarUtils.createOrUpdateEvents( @@ -228,9 +281,6 @@ class _ReminderPageState extends State { title: widget.itemDescription, scheduleDateTime: scheduleDateTime); - - - var asd = calendarUtils.writableCalendars; Navigator.pop(context); } @@ -258,6 +308,25 @@ class _ReminderPageState extends State { } String getDays() { - return ''; + 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; + }); + }, + ), + ); } } diff --git a/lib/pages/medical/allergies_page.dart b/lib/pages/medical/allergies_page.dart new file mode 100644 index 00000000..ea063e19 --- /dev/null +++ b/lib/pages/medical/allergies_page.dart @@ -0,0 +1,54 @@ +import 'package:diplomaticquarterapp/core/viewModels/medical/AllergiesViewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AllergiesPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getAllergies(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).allergies, + baseViewModel: model, + body: ListView.builder( + itemCount: model.allergies.length, + itemBuilder: (context, index) => Container( + margin: EdgeInsets.all(15), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + ), + child: Row( + children: [ + Image.asset( + 'assets/images/new-design/allergiesDetails.png', + width: 50, + height: 50, + fit: BoxFit.cover, + ), + SizedBox( + width: 15, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).remarks+" :"), + Texts(TranslationBase.of(context).description + model.allergies[index].description ?? ''), + ], + ), + ) + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index 2551ebc9..fc47ed3c 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/model/ask_doctor/DoctorResponse.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -16,7 +17,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { onModelReady: (model) => model.updateReadStatus(transactionNo: doctorResponse.transactionNo), builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: ' View Doctor Responses', + appBarTitle: TranslationBase.of(context).viewDoctorResponses, baseViewModel: model, body: SingleChildScrollView( child: Container( diff --git a/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart index e934c78d..5f1938fd 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart @@ -39,7 +39,7 @@ class _AskDoctorHomPageState extends State Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).prescriptions, + appBarTitle: TranslationBase.of(context).askDoctor, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -87,14 +87,14 @@ class _AskDoctorHomPageState extends State child: Container( width: MediaQuery.of(context).size.width * 0.36, child: Center( - child: Texts('ASK Doctor'), + child: Texts(TranslationBase.of(context).askDoctor), ), ), ), Tab(child: Container( width: MediaQuery.of(context).size.width * 0.36, child: Center( - child: Texts('Doctor Responses',textAlign: TextAlign.start,), + child: Texts(TranslationBase.of(context).doctorResponses,textAlign: TextAlign.start,), ), ),) ], diff --git a/lib/pages/medical/ask_doctor/ask_doctor_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_page.dart index 1aa0004b..6beed0dc 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_page.dart @@ -238,6 +238,3 @@ class AskDoctorPage extends StatelessWidget { } } -/** - * - */ diff --git a/lib/pages/medical/ask_doctor/doctor_response.dart b/lib/pages/medical/ask_doctor/doctor_response.dart index 6993eb5b..b6071a4c 100644 --- a/lib/pages/medical/ask_doctor/doctor_response.dart +++ b/lib/pages/medical/ask_doctor/doctor_response.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -34,7 +35,7 @@ class DoctorResponse extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts('New'), + Texts(TranslationBase.of(context).newDes), Container( width: 30, height: 30, @@ -63,13 +64,15 @@ class DoctorResponse extends StatelessWidget { Navigator.push( context, FadePage( - page: ViewDoctorResponsesPage(doctorResponse: doctor,), + page: ViewDoctorResponsesPage( + doctorResponse: doctor, + ), ), ); }, child: Container( height: 70, - margin: EdgeInsets.only(top: 8,bottom: 8), + margin: EdgeInsets.only(top: 8, bottom: 8), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: Colors.white, @@ -82,11 +85,15 @@ class DoctorResponse extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Texts('${doctor.doctorName}'), - SizedBox(height: 5,), - Texts('${doctor.requestTypeDescription}'), + SizedBox( + height: 5, + ), + Texts( + '${doctor.requestTypeDescription}'), ], ), ), @@ -108,7 +115,7 @@ class DoctorResponse extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts('All'), + Texts(TranslationBase.of(context).all), Container( width: 30, height: 30, @@ -130,12 +137,12 @@ class DoctorResponse extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: model.doctorResponseList.map( - (doctor) { + (doctor) { return InkWell( onTap: () {}, child: Container( height: 70, - margin: EdgeInsets.only(top: 8,bottom: 8), + margin: EdgeInsets.only(top: 8, bottom: 8), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: Colors.white, @@ -148,11 +155,15 @@ class DoctorResponse extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Texts('${doctor.doctorName}'), - SizedBox(height: 5,), - Texts('${doctor.requestTypeDescription}'), + SizedBox( + height: 5, + ), + Texts( + '${doctor.requestTypeDescription}'), ], ), ), diff --git a/lib/pages/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index cbf2e606..55e04a73 100644 --- a/lib/pages/medical/ask_doctor/request_type.dart +++ b/lib/pages/medical/ask_doctor/request_type.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -29,7 +30,7 @@ class _RequestTypePageState extends State { onModelReady: (model) => model.getCallRequestTypeLOVs(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Request Type', + appBarTitle: TranslationBase.of(context).requestType, baseViewModel: model, body: SingleChildScrollView( child: Container( @@ -83,7 +84,7 @@ class _RequestTypePageState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10), child: NewTextFields( - hintText: 'Enter the question here...', + hintText: TranslationBase.of(context).questionHere, minLines: 2, maxLines: 15, onChanged: (value) { @@ -107,19 +108,20 @@ class _RequestTypePageState extends State { child: Padding( padding: const EdgeInsets.all(12.0), child: SecondaryButton( - label: 'Send', + label: TranslationBase.of(context).submit, loading: model.state == ViewState.BusyLocal, textColor: Colors.white, onTap: () { - model.sendRequestLOV( - doctorList: widget.doctorList, - requestType: parameterCode.toString(), - remark: question).then((value) { - if(model.state!=ViewState.ErrorLocal|| model.state!=ViewState.Error){ - Navigator.pop(context); - } - AppToast.showErrorToast(message: "The question add fine "); - + model + .sendRequestLOV( + doctorList: widget.doctorList, + requestType: parameterCode.toString(), + remark: question) + .then((value) { + if (model.state != ViewState.ErrorLocal || + model.state != ViewState.Error) { + Navigator.pop(context); + } }); }, color: Colors.grey[800], diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 2ac3b4de..cec19e8b 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -25,6 +25,7 @@ import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart' import 'package:provider/provider.dart'; import '../../locator.dart'; import 'active_medications/ActiveMedicationsPage.dart'; +import 'allergies_page.dart'; import 'ask_doctor/ask_doctor_home_page.dart'; import 'balance/my_balance_page.dart'; import 'doctor/doctor_home_page.dart'; @@ -294,12 +295,14 @@ class _MedicalProfilePageState extends State { ), Expanded( flex: 1, - child: MedicalProfileItem( - title: - TranslationBase.of(context).allergies, - imagePath: 'medical_history_icon.png', - subTitle: TranslationBase.of(context) - .allergiesSubtitle, + child: InkWell( + onTap:()=> Navigator.push(context, FadePage(page: AllergiesPage())) , + child: MedicalProfileItem( + title: TranslationBase.of(context).allergies, + imagePath: 'medical_history_icon.png', + subTitle: TranslationBase.of(context) + .allergiesSubtitle, + ), ), ), ]), @@ -357,7 +360,6 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( - //TODO onTap: () { Navigator.push( context, diff --git a/lib/uitl/CalendarUtils.dart b/lib/uitl/CalendarUtils.dart index d61a19b6..546d9b2d 100644 --- a/lib/uitl/CalendarUtils.dart +++ b/lib/uitl/CalendarUtils.dart @@ -33,11 +33,13 @@ class CalendarUtils { {List scheduleList, String title, String description, - List scheduleDateTime}) async { + List scheduleDateTime, + List daysOfWeek}) async { List events = List(); scheduleDateTime.forEach((element) { RecurrenceRule recurrenceRule = RecurrenceRule( RecurrenceFrequency.Daily, + daysOfWeek: daysOfWeek, endDate: element, ); Event event = Event(writableCalendars.id, diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 65d018bf..0155ff10 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -1,3 +1,4 @@ +import 'package:device_calendar/device_calendar.dart'; import 'package:intl/intl.dart'; class DateUtil { @@ -26,12 +27,12 @@ class DateUtil { return start + "$milliseconds" + end; } - static String yearMonthDay(DateTime dateTime){ + static String yearMonthDay(DateTime dateTime) { String dateFormat = '${dateTime.year}-${dateTime.month}-${dateTime.day}'; return dateFormat; } - static String time(DateTime dateTime){ + static String time(DateTime dateTime) { String dateFormat = '${dateTime.hour}:${dateTime.minute}:00'; return dateFormat; } @@ -233,4 +234,31 @@ class DateUtil { .toString() + ")/"; } + + static String getDay(DayOfWeek dayOfWeek) { + switch (dayOfWeek) { + case DayOfWeek.Monday: + return "Monday"; + break; + case DayOfWeek.Tuesday: + return "Tuesday"; + break; + case DayOfWeek.Wednesday: + return "Wednesday"; + break; + case DayOfWeek.Thursday: + return "Thursday"; + break; + case DayOfWeek.Friday: + return "Friday"; + break; + case DayOfWeek.Saturday: + return "Saturday"; + break; + case DayOfWeek.Sunday: + return "Sunday"; + break; + } + return ""; + } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index adb1a5fc..28b273e5 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -572,6 +572,23 @@ class TranslationBase { String get power => localizedValues['Power'][locale.languageCode]; String get diameter => localizedValues['Diameter'][locale.languageCode]; String get remarks => localizedValues['Remarks'][locale.languageCode]; + String get activeMedications => localizedValues['ActiveMedications'][locale.languageCode]; + String get expDate => localizedValues['ExpDate'][locale.languageCode]; + String get route => localizedValues['Route'][locale.languageCode]; + String get frequency => localizedValues['Frequency'][locale.languageCode]; + String get dailyQuantity => localizedValues['DailyQuantity'][locale.languageCode]; + String get addReminder => localizedValues['AddReminder'][locale.languageCode]; + String get reminderDes => localizedValues['reminderDes'][locale.languageCode]; + String get startDay => localizedValues['StartDay'][locale.languageCode]; + String get endDay => localizedValues['EndDay'][locale.languageCode]; + String get days => localizedValues['Days'][locale.languageCode]; + String get scheduleTime => localizedValues['ScheduleTime'][locale.languageCode]; + String get askDoctor => localizedValues['AskDoctor'][locale.languageCode]; + String get doctorResponses => localizedValues['DoctorResponses'][locale.languageCode]; + String get newDes => localizedValues['New'][locale.languageCode]; + String get all => localizedValues['All'][locale.languageCode]; + String get questionHere => localizedValues['QuestionHere'][locale.languageCode]; + String get viewDoctorResponses => localizedValues['ViewDoctorResponses'][locale.languageCode]; } diff --git a/pubspec.yaml b/pubspec.yaml index 49710761..1c1106f2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -110,11 +110,16 @@ dependencies: #Popup_window popup_box: ^0.1.0 + #datetime_picker flutter_datetime_picker: ^1.4.0 + #local_notifications flutter_local_notifications: ^1.4.4+4 + + #rxdart rxdart: ^0.24.1 + #device_calendar device_calendar: ^3.1.0 #Handle Geolocation