diff --git a/lib/screens/prescription/add_prescription/add_drug_widget.dart b/lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart similarity index 88% rename from lib/screens/prescription/add_prescription/add_drug_widget.dart rename to lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart index ae7b688e..7c99c603 100644 --- a/lib/screens/prescription/add_prescription/add_drug_widget.dart +++ b/lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart @@ -1,19 +1,19 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../core/enum/viewstate.dart'; -import '../../../core/model/Prescriptions/prescription_model.dart'; -import '../../../core/model/patient/patiant_info_model.dart'; -import '../../../core/model/search_drug/get_medication_response_model.dart'; -import '../../../core/viewModel/prescription_view_model.dart'; -import '../../../util/dr_app_toast_msg.dart'; -import '../../../util/helpers.dart'; -import '../../patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart'; import 'drug_to_drug.dart'; class AddDrugWidget extends StatefulWidget { diff --git a/lib/screens/prescription/add_prescription/drug_to_drug.dart b/lib/screens/prescription/add_prescription/add_drug/drug_to_drug.dart similarity index 100% rename from lib/screens/prescription/add_prescription/drug_to_drug.dart rename to lib/screens/prescription/add_prescription/add_drug/drug_to_drug.dart diff --git a/lib/screens/prescription/add_prescription/prescription_form_widget.dart b/lib/screens/prescription/add_prescription/prescription_form_widget.dart index 6bdf447a..d5f146c5 100644 --- a/lib/screens/prescription/add_prescription/prescription_form_widget.dart +++ b/lib/screens/prescription/add_prescription/prescription_form_widget.dart @@ -26,7 +26,7 @@ import 'package:hexcolor/hexcolor.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; import '../../../widgets/transitions/slide_up_page.dart'; -import 'add_drug_widget.dart'; +import 'add_drug/add_drug_widget.dart'; class PrescriptionFormWidget extends StatefulWidget { final PatiantInformtion patient; @@ -122,13 +122,6 @@ class _PrescriptionFormWidgetState extends State { recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....'; } - // void requestPermissions() async { - // void requestPermissions() async { - // Map statuses = await [ - // Permission.microphone, - // ].request(); - // } - void resultListener(result) { recognizedWord = result.recognizedWords; event.setValue({"searchText": recognizedWord}); @@ -514,8 +507,6 @@ class _PrescriptionFormWidgetState extends State { ), ), ); - // Navigator.pop(context); - // openDrugToDrug(model, prescriptionViewModel); } } else { setState(() { diff --git a/lib/screens/prescription/prescriptions_items/prescription_items_in_patient.dart b/lib/screens/prescription/prescriptions_items/prescription_items_in_patient.dart index 787f6853..843377c5 100644 --- a/lib/screens/prescription/prescriptions_items/prescription_items_in_patient.dart +++ b/lib/screens/prescription/prescriptions_items/prescription_items_in_patient.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -84,129 +85,89 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - TranslationBase.of(context).direction, - color: Colors.grey, - ), - Expanded( - child: AppText(" " + - prescriptions - .directionDescription - .toString() ?? - '')), - ], + CustomRow( + label: TranslationBase.of(context).direction + ' :', + value: " " + prescriptions.directionDescription.toString() ?? '', + isCopyable: false, + isExpanded: false, + valueSize: 13, + labelSize: 13, ), - Row( - children: [ - AppText( - TranslationBase.of(context).route, - color: Colors.grey, - ), - AppText(" " + - prescriptions.routeDescription - .toString() ?? - ''), - ], + CustomRow( + label: TranslationBase.of(context).route + ' :', + value: " " + prescriptions.routeDescription ?? '', + isCopyable: false, + isExpanded: false, + valueSize: 13, + labelSize: 13, ), - Row( - children: [ - AppText( - TranslationBase.of(context).refill, - color: Colors.grey, - ), - Expanded( - child: AppText(" " + - prescriptions - .refillDescription - .toString() ?? - '')), - ], + CustomRow( + label: TranslationBase.of(context).refill + ' :', + value: " " + prescriptions.refillDescription ?? '', + isCopyable: false, + isExpanded: false, + valueSize: 13, + labelSize: 13, ), - Row( - children: [ - AppText( - TranslationBase.of(context).startDate, - color: Colors.grey, - ), - Expanded( - child: AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(startOn, isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: FontWeight.w600, - fontSize: 14, - ), - ), - ], + CustomRow( + label: TranslationBase.of(context).startDate + ' :', + value: " " + AppDateUtils.getDayMonthYearDateFormatted(startOn, isArabic: projectViewModel.isArabic) ?? '', + isCopyable: false, + isExpanded: false, + valueSize: 13, + labelSize: 13, ), - Row( - children: [ - AppText( - TranslationBase.of(context).stopDate, - color: Colors.grey, - ), - Expanded( - child: AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(stopOn, isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: FontWeight.w600, - fontSize: 14, - ), - ), - ], + CustomRow( + label: TranslationBase.of(context).stopDate + ' :', + value: " " + AppDateUtils.getDayMonthYearDateFormatted(stopOn, isArabic: projectViewModel.isArabic) ?? '', + isCopyable: false, + isExpanded: false, + valueSize: 13, + labelSize: 13, ), - Row( - children: [ - AppText( - 'UOM', - color: Colors.grey, - ), - AppText(" " + - prescriptions.uomDescription - .toString() ?? - ''), - ], + CustomRow( + label: 'UOM' + ' :', + value: " " + prescriptions.uomDescription.toString() ?? '', + isCopyable: false, + isExpanded: false, + valueSize: 13, + labelSize: 13, ), - Row( - children: [ - AppText( - TranslationBase.of(context).dailyDoses, - color: Colors.grey, - ), - AppText( - " " + prescriptions.dose.toString() ?? - ''), - ], + CustomRow( + label: TranslationBase.of(context).dailyDoses, + value: " " + prescriptions.dose.toString() ?? '', + isCopyable: false, + isExpanded: false, + valueSize: 13, + labelSize: 13, ), - Row( - children: [ - AppText( - TranslationBase.of(context).status, - color: Colors.grey, - ), - AppText(" " + - prescriptions.statusDescription - .toString() ?? - ''), - ], + CustomRow( + label: TranslationBase.of(context).status, + value: " " + prescriptions.statusDescription.toString() ?? '', + isCopyable: false, + isExpanded: false, + valueSize: 13, + labelSize: 13, ), - Row( - children: [ - AppText( - TranslationBase.of(context).processed, - color: Colors.grey, - ), - AppText(" " + - prescriptions.doctorName - .toString() ?? - ''), - ], + CustomRow( + label: TranslationBase.of(context).processed, + value: " " + prescriptions.doctorName.toString() ?? '', + isCopyable: false, + isExpanded: false, + valueSize: 13, + labelSize: 13, ), SizedBox( height: 12, ), - AppText(prescriptions.comments ?? ''), + CustomRow( + label: '', + value: prescriptions.comments ?? '', + isCopyable: false, + isExpanded: false, + valueSize: 13, + labelSize: 13, + ), ], ), ) diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index 30311af2..a7877568 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -13,7 +13,6 @@ import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-prof import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:doctor_app_flutter/widgets/shared/user-guid/in_patient_doctor_card.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:flutter/cupertino.dart'; @@ -121,17 +120,11 @@ class PrescriptionsPage extends StatelessWidget { DoctorCard( doctorName: Helpers.convertToTitleCase(model.prescriptionsList[index].doctorName), - profileUrl: model - .prescriptionsList[index].doctorImageURL, + profileUrl: model.prescriptionsList[index].doctorImageURL, branch: model.prescriptionsList[index].name, - clinic: model.prescriptionsList[index] - .clinicDescription, + clinic: model.prescriptionsList[index].clinicDescription, isPrescriptions: true, - appointmentDate: - AppDateUtils.getDateTimeFromServerFormat( - model.prescriptionsList[index] - .appointmentDate, - ), + appointmentDate: AppDateUtils.getDateTimeFromServerFormat(model.prescriptionsList[index].appointmentDate,), ), ], ))), @@ -160,53 +153,31 @@ class PrescriptionsPage extends StatelessWidget { itemBuilder: (context, index) { //model.medicationForInPatient.length, return InkWell( + child: DoctorCard( + doctorName: Helpers.convertToTitleCase(model.medicationForInPatient[index].pHRItemDescription,), + profileUrl: model.prescriptionsList[index].doctorImageURL, + branch: model.prescriptionsList[index].name, + clinic: model.prescriptionsList[index].clinicDescription, + isPrescriptions: true, + appointmentDate: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].prescriptionDatetime,), + ), onTap: () => Navigator.push( context, FadePage( page: PrescriptionItemsInPatientPage( prescriptionIndex: index, - prescriptions: - model.medicationForInPatient[ - index], + prescriptions: model.medicationForInPatient[index], patient: patient, patientType: patientType, arrivalType: arrivalType, - startOn: AppDateUtils - .getDateTimeFromServerFormat( - model - .medicationForInPatient[ - index] - .startDatetime, - ), - stopOn: AppDateUtils - .getDateTimeFromServerFormat( - model - .medicationForInPatient[ - index] - .stopDatetime, + startOn: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].startDatetime,), + stopOn: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].stopDatetime, ), ), ), ), - child: InPatientDoctorCard( - doctorName: model - .medicationForInPatient[index] - .pHRItemDescription, - profileUrl: 'sss', - branch: 'hamza', - clinic: 'basheer', - isPrescriptions: true, - appointmentDate: AppDateUtils - .getDateTimeFromServerFormat( - model.medicationForInPatient[index] - .prescriptionDatetime, - ), - createdBy: model - .medicationForInPatient[index] - .doctorName - .toString(), - )); + ); }), if (model.medicationForInPatient.length == 0) Center( diff --git a/lib/widgets/shared/user-guid/in_patient_doctor_card.dart b/lib/widgets/shared/user-guid/in_patient_doctor_card.dart deleted file mode 100644 index 9197a4a1..00000000 --- a/lib/widgets/shared/user-guid/in_patient_doctor_card.dart +++ /dev/null @@ -1,196 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class InPatientDoctorCard extends StatelessWidget { - final String doctorName; - final String branch; - final DateTime appointmentDate; - final String profileUrl; - final String invoiceNO; - final String orderNo; - final Function onTap; - final bool isPrescriptions; - final String clinic; - final createdBy; - - InPatientDoctorCard( - {this.doctorName, - this.branch, - this.profileUrl, - this.invoiceNO, - this.onTap, - this.appointmentDate, - this.orderNo, - this.isPrescriptions = false, - this.clinic, - this.createdBy}); - - @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - border: Border.all( - width: 0.5, - color: Colors.white, - ), - borderRadius: BorderRadius.all( - Radius.circular(15.0), - ), - color: Colors.white), - child: Padding( - padding: const EdgeInsets.all(15.0), - child: InkWell( - onTap: onTap, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: AppText( - doctorName, - bold: true, - )), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: FontWeight.w600, - fontSize: 14, - ), - if (!isPrescriptions) - AppText( - '${AppDateUtils.getHour(appointmentDate)}', - fontWeight: FontWeight.w600, - color: Colors.grey[700], - fontSize: 14, - ), - ], - ), - ), - ], - ), - Row( - children: [ - AppText( - 'CreatedBy ', - //bold: true, - ), - Expanded( - child: AppText( - createdBy, - bold: true, - ), - ), - ], - ), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - // Container( - // child: LargeAvatar( - // name: doctorName, - // url: profileUrl, - // ), - // width: 55, - // height: 55, - // ), - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // if (orderNo != null && !isPrescriptions) - // Row( - // children: [ - // AppText( - // TranslationBase.of(context).orderNo + - // ": ", - // color: Colors.grey[500], - // fontSize: 14, - // ), - // AppText( - // orderNo ?? '', - // fontSize: 14, - // ) - // ], - // ), - // if (invoiceNO != null && !isPrescriptions) - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .invoiceNo + - // ": ", - // fontSize: 14, - // color: Colors.grey[500], - // ), - // AppText( - // invoiceNO, - // fontSize: 14, - // ) - // ], - // ), - // if (clinic != null) - // Row( - // children: [ - // AppText( - // TranslationBase.of(context).clinic + - // ": ", - // color: Colors.grey[500], - // fontSize: 14, - // ), - // AppText( - // clinic, - // fontSize: 14, - // ) - // ], - // ), - // if (branch != null) - // Row( - // children: [ - // AppText( - // TranslationBase.of(context).branch + - // ": ", - // fontSize: 14, - // color: Colors.grey[500], - // ), - // AppText( - // branch, - // fontSize: 14, - // ) - // ], - // ) - ]), - ), - ), - Icon( - EvaIcons.eye, - ) - ], - ), - ), - ], - ), - ], - ), - ), - ), - ); - } -}