diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index fca9679f..68c5c61e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -64,6 +64,10 @@ const Map> localizedValues = { "en": "Search\nMedicines", "ar": "بحث\nعن الدواء" }, + "interventionPharmacyApproval": { + "en": "Intervention\nPharmacy Approval", + "ar": "التدخل\nموافقة الصيدلية" + }, "searchMedicine": {"en": "Search Medicines", "ar": "بحث عن الدواء"}, "myReferralPatient": {"en": "My Referral Patient", "ar": "مرضى الاحالة"}, "referPatient": {"en": "Referral Patient", "ar": "إحالة مريض"}, @@ -301,6 +305,7 @@ const Map> localizedValues = { "dateTime": {"en": "DATE / TIME:", "ar": "التاريخ / الوقت:"}, "date": {"en": "Date", "ar": "التاريخ"}, "admissionNo": {"en": "ADMISSION #: ", "ar": "قبول #:"}, + "admissionNumber": {"en": "Admission No.", "ar": "رقم القبول"}, "losNo": {"en": "LOS #:", "ar": "LOS #:"}, "area": {"en": "AREA:", "ar": "المنطقة"}, "room": {"en": "ROOM:", "ar": "الغرفة"}, @@ -1157,12 +1162,16 @@ const Map> localizedValues = { "doctorSchedule": {"en": "Doctor Schedule", "ar":"جدول الطبيب"}, "doctorRota": {"en": "Doctor Rota", "ar":"دوران الطبيب"}, "dateFrom": {"en": "Date From", "ar":"التاريخ من"}, + "dateTo": {"en": "Date To", "ar":"التاريخ إلى"}, + "nursingStation": {"en": "Nursing Station", "ar":"محطة التمريض"}, "searchFindSchedule": {"en": "Search and find out the doctor’s schedule ", "ar":"بحث ومعرفة جدول الطبيب"}, "onePrimaryDiagnosis": {"en": "There has to be at-least 1 principal diagnosis", "ar":"يجب أن يكون هناك تشخيص رئيسي واحد على الأقل"}, "principalDiagnosisCannot": {"en": "Principal Diagnosis cannot modify once the order created", "ar":"لا يمكن تعديل التشخيص الرئيسي بمجرد إنشاء الطلب"}, "afterOrderCreation": {"en": "After order created, you cannot modify the principal diagnosis, Do you want to continue?", "ar":"بعد إنشاء الطلب، لا يمكنك تعديل التشخيص الأساسي، هل تريد المتابعة؟"}, "principalCoveredOrNot": {"en": "Principal Diagnosis is not covered for this patient", "ar":"لا يتم تغطية التشخيص الرئيسي لهذا المريض"}, "complexDiagnosis": {"en": "Complex Diagnosis", "ar":"التشخيص المعقد"}, + "pharmacyInterventionApproval": {"en": "Pharmacy Intervention Approval", "ar":"الموافقة على التدخل الصيدلي"}, + "pharmacyApproval": {"en": "Pharmacy Approval", "ar":"موافقة الصيدلية"}, "noComplaintsFound": {"en": "No Chief Complaints added, please add it from the button above", "ar":"لم تتم إضافة شكاوى رئيسية ، يرجى إضافتها من الزر أعلاه"}, "noKnownAllergies": {"en": "No Known Allergies", "ar":"لا يوجد حساسية معروفة"}, diff --git a/lib/screens/home/home_patient_card.dart b/lib/screens/home/home_patient_card.dart index d2050b7e..f5c502a6 100644 --- a/lib/screens/home/home_patient_card.dart +++ b/lib/screens/home/home_patient_card.dart @@ -13,6 +13,7 @@ class HomePatientCard extends StatelessWidget { final VoidCallback? onTap; final double? iconSize; final LinearGradient? gradient; + final double? fontSize; HomePatientCard({ this.backgroundColor, @@ -24,6 +25,7 @@ class HomePatientCard extends StatelessWidget { this.onTap, this.iconSize = 30, this.gradient, + this.fontSize }); @override @@ -40,7 +42,7 @@ class HomePatientCard extends StatelessWidget { gradient: gradient, margin: EdgeInsets.all(SizeConfig.widthMultiplier! * 1.121), child: Container( - padding: EdgeInsets.all(8), + padding: EdgeInsets.only(left : 8 ), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, @@ -105,7 +107,7 @@ class HomePatientCard extends StatelessWidget { letterSpacing: -0.33, fontWeight: FontWeight.w600, fontSize: - SizeConfig.getTextMultiplierBasedOnWidth(width: width) * + fontSize?? SizeConfig.getTextMultiplierBasedOnWidth(width: width) * (SizeConfig.isHeightVeryShort ? 11 : 10), ), ), diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 491efdd1..52655121 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -33,6 +33,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import 'package:sticky_headers/sticky_headers/widget.dart'; +import '../pharmaacy_intervention/PharmacyIntervention.dart'; import 'label.dart'; class HomeScreen extends StatefulWidget { @@ -55,6 +56,12 @@ class _HomeScreenState extends State { var clinicId; AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); int colorIndex = 0; + double width = SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort + ? 16 + : SizeConfig.isHeightLarge + ? 15 + : 13); @override Widget build(BuildContext context) { @@ -473,6 +480,24 @@ class _HomeScreenState extends State { }, )); changeColorIndex(); + patientCards.add(HomePatientCard( + gradient: backgroundColors[2], + backgroundIconColor: backgroundIconColors[2], + cardIcon: DoctorApp.search_medicines, + textColor: textColors[2], + text: TranslationBase.of(context).interventionPharmacyApproval, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: width) * + (SizeConfig.isHeightVeryShort ? 10: 9), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PharmacyIntervention(), + settings: RouteSettings(name: 'PharmacyIntervention'), + )); + }, + )); + changeColorIndex(); return [...List.generate(patientCards.length, (index) => patientCards[index]).toList()]; } diff --git a/lib/screens/patients/patient_search/patient_search_header.dart b/lib/screens/patients/patient_search/patient_search_header.dart index b4276dab..007e8c00 100644 --- a/lib/screens/patients/patient_search/patient_search_header.dart +++ b/lib/screens/patients/patient_search/patient_search_header.dart @@ -1,10 +1,17 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; -class PatientSearchHeader extends StatelessWidget implements PreferredSizeWidget { +class PatientSearchHeader extends StatelessWidget + implements PreferredSizeWidget { final String? title; + final bool showSearchIcon; + final VoidCallback? onSearchPressed; + final double? fontSize; - const PatientSearchHeader({Key? key, this.title}) : super(key: key); + + const PatientSearchHeader( + {Key? key, this.title, this.showSearchIcon = false, this.onSearchPressed, this.fontSize}) + : super(key: key); @override Widget build(BuildContext context) { @@ -26,13 +33,21 @@ class PatientSearchHeader extends StatelessWidget implements PreferredSizeWidget Expanded( child: AppText( title!, - fontSize: 24.0, + fontSize:fontSize ?? 24.0, fontWeight: FontWeight.w700, color: Color(0xFF2B353E), fontFamily: 'Poppins', letterSpacing: -1.44, ), ), + Visibility( + visible: showSearchIcon, + child: IconButton( + icon: Icon(Icons.search), + color: Color(0xFF2B353E), //Colors.black, + onPressed: () => onSearchPressed?.call(), + ), + ), ]), ), ); diff --git a/lib/screens/pharmaacy_intervention/PharmacyIntervention.dart b/lib/screens/pharmaacy_intervention/PharmacyIntervention.dart new file mode 100644 index 00000000..9001080f --- /dev/null +++ b/lib/screens/pharmaacy_intervention/PharmacyIntervention.dart @@ -0,0 +1,300 @@ +import 'dart:ui'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/screens/patients/ReferralDischargedPatientPage.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/refer_details/referred-patient-screen.dart'; +import 'package:doctor_app_flutter/utils/tab_utils.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:intl/intl.dart'; + +import '../../config/config.dart'; + +class PharmacyIntervention extends StatefulWidget { + @override + _PharmacyIntervention createState() => _PharmacyIntervention(); +} + +class _PharmacyIntervention extends State + with SingleTickerProviderStateMixin { + TabController? _tabController; + int index = 0; + List listOfPharmacyIntervention = List.empty(); + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 3, vsync: this); + _tabController!.addListener(_handleTabSelection); + } + + _handleTabSelection() { + setState(() { + index = _tabController!.index; + }); + } + + @override + void dispose() { + super.dispose(); + _tabController!.dispose(); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectsProvider = Provider.of(context); + + return AppScaffold( + isShowAppBar: true, + appBar: PatientSearchHeader( + title: TranslationBase.of(context).pharmacyApproval, + fontSize: 18, + showSearchIcon: true, + onSearchPressed: () { + SearchDialog(); + }, + ), + appBarTitle: TranslationBase.of(context).pharmacyApproval, + body: Column( + children: [ + SizedBox( + height: 56, + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: Container( + decoration: TabUtils.getBoxTabsBoxDecoration( + isActive: index == 0, + isFirst: true, + projectViewModel: projectsProvider), + child: Center( + child: TabUtils.getTabText( + title: TranslationBase.of(context).pending, + isActive: index == 0)), + ), + ), + Expanded( + child: Container( + decoration: TabUtils.getBoxTabsBoxDecoration( + isActive: index == 1, + isMiddle: true, + projectViewModel: projectsProvider), + child: Center( + child: TabUtils.getTabText( + title: TranslationBase.of(context).accepted, + isActive: index == 1)), + ), + ), + Expanded( + child: Container( + decoration: TabUtils.getBoxTabsBoxDecoration( + isActive: index == 2, + isLast: true, + projectViewModel: projectsProvider), + child: Center( + child: TabUtils.getTabText( + title: TranslationBase.of(context).rejected, + isActive: index == 2), + ), + ), + ), + ], + ), + ), + Expanded( + child: ListView.builder( + itemCount: listOfPharmacyIntervention.length, + itemBuilder: (context, item) => SizedBox.shrink()), + ) + ], + )); + } + + void SearchDialog() { + showDialog( + context: context, + barrierDismissible: true, // user must tap button! + builder: (_) { + return PharmacyInterventionDialog( + onDispose: (dateFrom, dateTo, admissionNumber, patientId) {}); + }); + } +} + +class PharmacyInterventionDialog extends StatefulWidget { + final Function( + String, + String, + String, + String, + ) onDispose; + + const PharmacyInterventionDialog({super.key, required this.onDispose}); + + @override + State createState() => + _PharmacyInterventionDialogState(); +} + +class _PharmacyInterventionDialogState + extends State { + final TextEditingController admissionNumber = TextEditingController(); + final TextEditingController nursingStation = TextEditingController(); + + final TextEditingController patientId = TextEditingController(); + + String dateFrom = ''; + + String dateTo = ''; + + @override + void initState() { + super.initState(); + initFromDate(); + } + + @override + Widget build(BuildContext context) { + return Dialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + _titleAndTextField(TranslationBase.of(context).nursingStation, + nursingStation, TextInputType.number), + SizedBox( + height: 4, + ), + _titleAndTextField(TranslationBase.of(context).admissionNumber, + admissionNumber, TextInputType.number), + SizedBox( + height: 4, + ), + _titleAndTextField(TranslationBase.of(context).patientID, patientId, + TextInputType.number), + SizedBox( + height: 4, + ), + _dateSelection(TranslationBase.of(context).dateFrom, (date) { + setState(() { + dateFrom = date; + }); + }, dateFrom), + SizedBox( + height: 4, + ), + _dateSelection(TranslationBase.of(context).dateTo, (date) { + setState(() { + dateTo = date; + }); + }, dateTo), + SizedBox( + height: 8, + ), + Row(children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).search, + hasBorder: true, + borderColor: Color(0xFFB8382B), + color: AppGlobal.appRedColor, + fontColor: Colors.white, + onPressed: () async {}, + ), + ), + ]), + ], + ), + ), + ); + } + + Widget _dateSelection( + String title, Function(String) onDateSelected, String selectedDate) { + return GestureDetector( + onTap: () => _selectDate(onDateSelected), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text(title), + Expanded( + child: ListTile( + title: Text( + selectedDate, + ), + trailing: Icon(Icons.arrow_drop_down_outlined), + ), + ) + ], + ), + ); + } + + Future _selectDate(Function(String) updateDate) async { + final DateTime? picked = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(DateTime.now().year - 150), + lastDate: DateTime(DateTime.now().year + 150), + initialEntryMode: DatePickerEntryMode.calendar, + builder: (_, child) { + return Theme( + data: ThemeData.light().copyWith( + colorScheme: ColorScheme.fromSwatch( + primarySwatch: Colors.red, + accentColor: AppGlobal.appRedColor, + ), + dialogBackgroundColor: Colors.white, + ), + child: child!, + ); + }); + if (picked != null) { + updateDate(getFormattedDate(picked)); + } + // } + } + + Widget _titleAndTextField(String title, TextEditingController controller, + TextInputType? inputType) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.min, + children: [ + Text(title), + Expanded( + child: TextFormField( + keyboardType: inputType, + decoration: InputDecoration( + hintText: '', + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + contentPadding: EdgeInsetsDirectional.only(start: 10.0), + ), + textAlign: TextAlign.end, + controller: controller, + ), + ) + ], + ); + } + + void initFromDate() { + var time = DateTime.now(); + dateFrom = getFormattedDate(time); + } + + String getFormattedDate(DateTime time) { + return DateFormat('MM/dd/yyyy').format(time); + } +} diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 3fa6f0c4..c5e1fc08 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -134,6 +134,7 @@ class TranslationBase { String get searchMedicineDashboard => localizedValues['searchMedicineDashboard']![locale.languageCode]!; + String get interventionPharmacyApproval => localizedValues['interventionPharmacyApproval']![locale.languageCode]!; String get myReferralPatient => localizedValues['myReferralPatient']![locale.languageCode]!; @@ -1855,6 +1856,7 @@ class TranslationBase { String get doctorRota => localizedValues['doctorRota']![locale.languageCode]!; String get dateFrom => localizedValues['dateFrom']![locale.languageCode]!; + String get dateTo => localizedValues['dateTo']![locale.languageCode]!; String get searchFindSchedule => localizedValues['searchFindSchedule']![locale.languageCode]!; @@ -1957,6 +1959,14 @@ class TranslationBase { String get diagnosisAlreadyResolved => localizedValues['diagnosisAlreadyResolved']![locale.languageCode]!; String get diagnosisAlreadyDeleted => localizedValues['diagnosisAlreadyDeleted']![locale.languageCode]!; + String get pharmacyInterventionApproval => + localizedValues['pharmacyInterventionApproval']![locale.languageCode]!; + String get pharmacyApproval => + localizedValues['pharmacyApproval']![locale.languageCode]!; + String get admissionNumber => + localizedValues['admissionNumber']![locale.languageCode]!; + String get nursingStation => + localizedValues['nursingStation']![locale.languageCode]!; } class TranslationBaseDelegate extends LocalizationsDelegate {