diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 06aadac0..6b6b6939 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -686,6 +686,11 @@ const Map> localizedValues = { 'months': {'en': "Months", 'ar': "أشهر"}, 'years': {'en': "Years", 'ar': "سنين"}, 'hr': {'en': "HR", 'ar': "س"}, - 'min': {'en': "Min", 'ar': "د"} - // 'icd': {'en': "ICD", 'ar': " "} + 'min': {'en': "Min", 'ar': "د"}, + 'referralStatusHold': {'en': "Hold", 'ar': "معلق"}, + 'referralStatusActive': {'en': "Active", 'ar': "نشط"}, + 'referralStatusCancelled': {'en': "Cancelled", 'ar': "ملغاة"}, + 'referralStatusCompleted': {'en': "Completed", 'ar': "مكتمل"}, + 'referralStatusNotSeen': {'en': "NotSeen", 'ar': "لم يرى"}, + // 'icd': {'en': "ICD", 'ar': " "}, }; diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index b9987601..5771d1db 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -8,6 +8,8 @@ import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/cupertino.dart'; import '../../locator.dart'; @@ -40,8 +42,8 @@ class PatientReferralViewModel extends BaseViewModel { error = _referralPatientService.error; setState(ViewState.Error); } else { - if(patientReferral.length == 0){ - await getMasterLookup(MasterKeysService.physiotherapyGoals); + if (patientReferral.length == 0) { + await getMasterLookup(MasterKeysService.physiotherapyGoals); } else { setState(ViewState.Idle); } @@ -126,7 +128,8 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async { + Future responseReferral( + PendingReferral pendingReferral, bool isAccepted) async { setState(ViewState.Busy); await _referralPatientService.responseReferral(pendingReferral, isAccepted); if (_referralPatientService.hasError) { @@ -136,14 +139,11 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future makeReferral(PatiantInformtion patient, - String isoStringDate, - int projectID, - int clinicID, - int doctorID, - String remarks) async { + Future makeReferral(PatiantInformtion patient, String isoStringDate, + int projectID, int clinicID, int doctorID, String remarks) async { setState(ViewState.Busy); - await _referralPatientService.makeReferral(patient, isoStringDate, projectID, clinicID, doctorID, remarks); + await _referralPatientService.makeReferral( + patient, isoStringDate, projectID, clinicID, doctorID, remarks); if (_referralPatientService.hasError) { error = _referralPatientService.error; setState(ViewState.Error); @@ -152,18 +152,40 @@ class PatientReferralViewModel extends BaseViewModel { } } - Future getPatientDetails(String fromDate, String toDate, int patientMrn, int appointmentNo) async { + Future getPatientDetails( + String fromDate, String toDate, int patientMrn, int appointmentNo) async { setState(ViewState.Busy); - await _referralPatientService.getPatientArrivalList(toDate, fromDate: fromDate, patientMrn: patientMrn, appointmentNo: appointmentNo); + await _referralPatientService.getPatientArrivalList(toDate, + fromDate: fromDate, + patientMrn: patientMrn, + appointmentNo: appointmentNo); if (_referralPatientService.hasError) { - error = _referralPatientService.error; - setState(ViewState.Error); + error = _referralPatientService.error; + setState(ViewState.Error); } else { setState(ViewState.Idle); } } + /* * model .getPatientArrivalList()*/ + + String getReferralStatusNameByCode(int statusCode, BuildContext context) { + switch (statusCode) { + case 1: + return TranslationBase.of(context).referralStatusHold; + case 2: + return TranslationBase.of(context).referralStatusActive; + case 4: + return TranslationBase.of(context).referralStatusCancelled; + case 46: + return TranslationBase.of(context).referralStatusCompleted; + case 63: + return TranslationBase.of(context).referralStatusNotSeen; + default: + return "-"; + } + } } diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 9d3c9f00..b76df591 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -42,7 +42,7 @@ class MyReferralDetailScreen extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, - body: model.patientArrivalList != null + body: model.patientArrivalList != null && model.patientArrivalList.length > 0 ? Column( children: [ Expanded( diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index c1880908..4dc0e647 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -48,7 +48,7 @@ class ReferredPatientScreen extends StatelessWidget { patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", referralStatus: - "${model.getReferredPatientItem(index).referralStatus}", + "${model.getReferralStatusNameByCode(model.getReferredPatientItem(index).referralStatus, context)}", isReferredTo: true, isSameBranch: model .getReferredPatientItem(index) diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index fe2526bc..71409538 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1060,6 +1060,11 @@ String get ICDName => String get min => localizedValues['min'][locale.languageCode]; String get months => localizedValues['months'][locale.languageCode]; String get years => localizedValues['years'][locale.languageCode]; + String get referralStatusHold => localizedValues['referralStatusHold'][locale.languageCode]; + String get referralStatusActive => localizedValues['referralStatusActive'][locale.languageCode]; + String get referralStatusCancelled => localizedValues['referralStatusCancelled'][locale.languageCode]; + String get referralStatusCompleted => localizedValues['referralStatusCompleted'][locale.languageCode]; + String get referralStatusNotSeen => localizedValues['referralStatusNotSeen'][locale.languageCode]; String get patientName => localizedValues['patient-name'][locale.languageCode]; diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index aaaa4e81..db45a015 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -70,7 +70,7 @@ class PatientReferralItemWidget extends StatelessWidget { isReferredTo ? "${TranslationBase.of(context).referTo}: " : "${TranslationBase.of(context).referredFrom}: ", - color: Colors.black, + color: Colors.grey, fontWeight: FontWeight.bold, fontSize: 12, ), @@ -78,8 +78,8 @@ class PatientReferralItemWidget extends StatelessWidget { isSameBranch ? TranslationBase.of(context).sameBranch : TranslationBase.of(context).otherBranch, - color: Colors.grey, - fontWeight: FontWeight.normal, + color: Colors.black, + fontWeight: FontWeight.bold, fontSize: 12, ), ], @@ -116,23 +116,26 @@ class PatientReferralItemWidget extends StatelessWidget { children: [ AppText( "${TranslationBase.of(context).clinic}: ", - color: Colors.black, + color: Colors.grey, fontWeight: FontWeight.bold, fontSize: 12, ), AppText( clinicDescription, - color: Colors.grey, - fontWeight: FontWeight.normal, + color: Colors.black, + fontWeight: FontWeight.bold, fontSize: 12, ), ], ), + SizedBox( + height: 8, + ), Row( children: [ AppText( "${TranslationBase.of(context).patientName}: ", - color: Colors.black, + color: Colors.grey, fontWeight: FontWeight.bold, fontSize: 12, ), @@ -140,7 +143,7 @@ class PatientReferralItemWidget extends StatelessWidget { patientName??'-', color: Colors.black, fontWeight: FontWeight.bold, - fontSize: 16, + fontSize: 12, ), ], ), @@ -157,8 +160,8 @@ class PatientReferralItemWidget extends StatelessWidget { ), AppText( remark, - color: Colors.grey, - fontWeight: FontWeight.normal, + color: Colors.black, + fontWeight: FontWeight.bold, fontSize: 12, ), ], diff --git a/pubspec.lock b/pubspec.lock index 8a1531c1..e51c9489 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -105,7 +105,7 @@ packages: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.10.13" + version: "1.11.0" build_runner_core: dependency: transitive description: @@ -329,21 +329,21 @@ packages: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.5.2" + version: "0.5.3" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "0.2.1" + version: "0.2.1+1" firebase_messaging: dependency: "direct main" description: @@ -510,7 +510,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3-nullsafety.1" + version: "0.6.2" json_annotation: dependency: transitive description: @@ -706,7 +706,7 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "4.3.2+4" + version: "4.3.3" pub_semver: dependency: transitive description: @@ -776,7 +776,7 @@ packages: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+3" + version: "0.0.2+2" shelf: dependency: transitive description: @@ -935,7 +935,7 @@ packages: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" win32: dependency: transitive description: