From 4afdf5545ed28e7a0763255caccab118adb70abf Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 14 Aug 2023 14:05:45 +0300 Subject: [PATCH] Translations added --- lib/config/localized_values.dart | 5 +++ .../general_instructions.dart | 6 +-- .../InPatientServices/inpatient_home.dart | 45 ++++++++++++------- .../medical_instructions.dart | 4 +- lib/uitl/translations_delegate_base.dart | 4 ++ 5 files changed, 43 insertions(+), 21 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0dabcd4b..7e7d6767 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1921,4 +1921,9 @@ const Map localizedValues = { "birthNotificationNotes3": {"en": "For Residents without identification card: Provide marriage contract.", "ar": "للمواطنين الغير حاملين لبطاقة الأحوال : إرفاق صورة من عقد الزواج برقم الحاسب"}, "placeOrder": {"en": "Place Order", "ar": "مكان الامر"}, "isFasting": {"en": "Are you fasting?", "ar": "هل أنت صائم؟"}, + "noGeneralInstructions": {"en": "You do not have any general instructions right now.", "ar": "ليس لديك أي تعليمات عامة في الوقت الحالي."}, + "noMedicalInstructions": {"en": "You do not have any medical instructions right now.", "ar": "ليس لديك أي تعليمات طبية في الوقت الحالي."}, + + "medicalInstructions": {"en": "Medical Instructions:", "ar": "تعليمات طبية:"}, + "generalInstructions": {"en": "General Instructions:", "ar": "تعليمات عامة:"}, }; \ No newline at end of file diff --git a/lib/pages/InPatientServices/general_instructions.dart b/lib/pages/InPatientServices/general_instructions.dart index ead96e42..6a923120 100644 --- a/lib/pages/InPatientServices/general_instructions.dart +++ b/lib/pages/InPatientServices/general_instructions.dart @@ -28,10 +28,10 @@ class GeneralInstructions extends StatelessWidget { children: [ Padding( padding: const EdgeInsets.all(21.0), - child: Text("General Instructions", + child: Text(TranslationBase.of(context).generalInstructions, overflow: TextOverflow.clip, style: TextStyle( - fontSize: 14.0, + fontSize: 21.0, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, @@ -42,7 +42,7 @@ class GeneralInstructions extends StatelessWidget { width: MediaQuery.of(context).size.width, child: Card( elevation: 0.0, - margin: EdgeInsets.all(16), + margin: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 16.0), color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), diff --git a/lib/pages/InPatientServices/inpatient_home.dart b/lib/pages/InPatientServices/inpatient_home.dart index 013bd2d0..711a45df 100644 --- a/lib/pages/InPatientServices/inpatient_home.dart +++ b/lib/pages/InPatientServices/inpatient_home.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/pages/InPatientServices/inpatient_advance_p import 'package:diplomaticquarterapp/pages/InPatientServices/meal_plan.dart'; import 'package:diplomaticquarterapp/pages/InPatientServices/medical_instructions.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; @@ -238,8 +239,12 @@ class InPatientServicesHome extends StatelessWidget { GifLoaderDialogUtils.showMyDialog(context); service.getBirthNotification(projectViewModel.user.patientID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - print(res['birthNotification']); - Navigator.push(context, FadePage(page: BirthNotification())); + if(res["MessageStatus"] == 1) { + print(res['birthNotification']); + Navigator.push(context, FadePage(page: BirthNotification())); + } else { + AppToast.showErrorToast(message: res["endUserMessage"]); + } }).catchError((err) { print(err); }); @@ -249,13 +254,17 @@ class InPatientServicesHome extends StatelessWidget { ClinicListService service = new ClinicListService(); GifLoaderDialogUtils.showMyDialog(context); service.getGeneralInstructions(projectViewModel.inPatientProjectID, context).then((res) { - List getGeneralInstructionsList = []; - res['generalInstructions'].forEach((v) { - getGeneralInstructionsList.add(new GetGeneralInstructions.fromJson(v)); - }); - GifLoaderDialogUtils.hideDialog(context); - print(res['generalInstructions']); - Navigator.push(context, FadePage(page: GeneralInstructions(getGeneralInstructionsList: getGeneralInstructionsList))); + if (res['generalInstructions'].length != 0) { + List getGeneralInstructionsList = []; + res['generalInstructions'].forEach((v) { + getGeneralInstructionsList.add(new GetGeneralInstructions.fromJson(v)); + }); + GifLoaderDialogUtils.hideDialog(context); + print(res['generalInstructions']); + Navigator.push(context, FadePage(page: GeneralInstructions(getGeneralInstructionsList: getGeneralInstructionsList))); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).noGeneralInstructions); + } }).catchError((err) { print(err); }); @@ -265,13 +274,17 @@ class InPatientServicesHome extends StatelessWidget { ClinicListService service = new ClinicListService(); GifLoaderDialogUtils.showMyDialog(context); service.getMedicalInstructions(projectViewModel.inPatientProjectID, context).then((res) { - List getMedicalInstructionsList = []; - res['MedicalInstruction'].forEach((v) { - getMedicalInstructionsList.add(new GetMedicalInstructions.fromJson(v)); - }); - GifLoaderDialogUtils.hideDialog(context); - print(res['MedicalInstruction']); - Navigator.push(context, FadePage(page: MedicalInstructionsPage(getMedicalInstructionsList: getMedicalInstructionsList))); + if (res['MedicalInstruction'].length != 0) { + List getMedicalInstructionsList = []; + res['MedicalInstruction'].forEach((v) { + getMedicalInstructionsList.add(new GetMedicalInstructions.fromJson(v)); + }); + GifLoaderDialogUtils.hideDialog(context); + print(res['MedicalInstruction']); + Navigator.push(context, FadePage(page: MedicalInstructionsPage(getMedicalInstructionsList: getMedicalInstructionsList))); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).noMedicalInstructions); + } }).catchError((err) { print(err); }); diff --git a/lib/pages/InPatientServices/medical_instructions.dart b/lib/pages/InPatientServices/medical_instructions.dart index b5062b9b..099c5558 100644 --- a/lib/pages/InPatientServices/medical_instructions.dart +++ b/lib/pages/InPatientServices/medical_instructions.dart @@ -35,7 +35,7 @@ class _MedicalInstructionsPageState extends State { children: [ Padding( padding: const EdgeInsets.all(21.0), - child: Text("Medical Instructions", + child: Text(TranslationBase.of(context).medicalInstructions, overflow: TextOverflow.clip, style: TextStyle( fontSize: 21.0, @@ -49,7 +49,7 @@ class _MedicalInstructionsPageState extends State { width: MediaQuery.of(context).size.width, child: Card( elevation: 0.0, - margin: EdgeInsets.all(16), + margin: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 16.0), color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 25a41d16..a9b9f334 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2926,6 +2926,10 @@ class TranslationBase { String get birthNotificationNotes3 => localizedValues["birthNotificationNotes3"][locale.languageCode]; String get placeOrder => localizedValues["placeOrder"][locale.languageCode]; String get isFasting => localizedValues["isFasting"][locale.languageCode]; + String get noGeneralInstructions => localizedValues["noGeneralInstructions"][locale.languageCode]; + String get noMedicalInstructions => localizedValues["noMedicalInstructions"][locale.languageCode]; + String get medicalInstructions => localizedValues["medicalInstructions"][locale.languageCode]; + String get generalInstructions => localizedValues["generalInstructions"][locale.languageCode]; }