diff --git a/lib/config/config.dart b/lib/config/config.dart index 1047ec66..96e03819 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -602,6 +602,10 @@ var GET_GENERAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getGeneralInstructions'; var INSERT_INPATIENT_ORDER = 'Services/INPs.svc/REST/Inpcp_insertOrder'; +var GET_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/getBirthNotification_bymothermrn'; + +var SAVE_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/SaveBirthNotification'; + class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 76a758f6..65b2f90b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1911,11 +1911,13 @@ const Map localizedValues = { "birthNotificationSubTitle": {"en": "Notification", "ar": "تبليغ الولادة"}, "admissionNoticeTitle": {"en": "Admission", "ar": "إشعار"}, "admissionNoticeSubTitle": {"en": "Notice", "ar": "تنويم"}, - "mothersMRN": {"en": "Mother's MRN", "ar": "رقم ملف الأم"}, - "mothersName": {"en": "Mother's Name", "ar": "اسم الأم"}, - "fathersName": {"en": "Father's Name", "ar": "اسم الاب"}, - "babysName": {"en": "Baby's Name", "ar": "اسم المولود"}, - "contactNumber": {"en": "Contact Number", "ar": "رقم الاتصال"}, + "mothersMRN": {"en": "Mother's MRN *", "ar": "رقم ملف الأم"}, + "mothersName": {"en": "Mother's name *", "ar": "اسم الأم"}, + "fathersNameEN": {"en": "Father's name english *", "ar": "اسم الاب انجليزي"}, + "fathersNameAR": {"en": "Father's name arabic *", "ar": "اسم الاب عربي"}, + "babysNameEN": {"en": "Baby's name english *", "ar": "اسم المولود انجليزي"}, + "babysNameAR": {"en": "Baby's name arabic *", "ar": "اسم المولود عربي"}, + "contactNumber": {"en": "Contact number *", "ar": "رقم الاتصال"}, "scanID": {"en": "Scan ID", "ar": "معرف المسح"}, "birthNotificationNotes1": { "en": "For Saudis: Provide copy of the identification card for both couples. If the wife doesn't have identification card, The family card must be provided.", diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 9cb81a41..3151bb41 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -149,7 +149,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 2001273; //3844083 + // body['PatientID'] = 3649542; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/InPatientServices/birth_notification.dart b/lib/pages/InPatientServices/birth_notification.dart index 4125261a..3c4d43f9 100644 --- a/lib/pages/InPatientServices/birth_notification.dart +++ b/lib/pages/InPatientServices/birth_notification.dart @@ -2,7 +2,10 @@ import 'dart:convert'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/insurance/AttachInsuranceCardImageDialog.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/theme/colors.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/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; @@ -21,7 +24,9 @@ class _BirthNotificationState extends State { TextEditingController motherMRN = new TextEditingController(); TextEditingController motherName = new TextEditingController(); TextEditingController fatherName = new TextEditingController(); + TextEditingController fatherNameAR = new TextEditingController(); TextEditingController babyName = new TextEditingController(); + TextEditingController babyNameAR = new TextEditingController(); TextEditingController contactNumber = new TextEditingController(); ProjectViewModel projectViewModel; @@ -64,9 +69,13 @@ class _BirthNotificationState extends State { mHeight(16), inputWidget(TranslationBase.of(context).mothersName, "", motherName, isEnable: false), mHeight(16), - inputWidget(TranslationBase.of(context).fathersName, "", fatherName), + inputWidget(TranslationBase.of(context).fathersNameEN, "", fatherName), mHeight(16), - inputWidget(TranslationBase.of(context).babysName, "", babyName), + inputWidget(TranslationBase.of(context).fathersNameAR, "", fatherNameAR), + mHeight(16), + inputWidget(TranslationBase.of(context).babysNameEN, "", babyName), + mHeight(16), + inputWidget(TranslationBase.of(context).babysNameAR, "", babyNameAR), mHeight(16), inputWidget(TranslationBase.of(context).contactNumber, "", contactNumber), mHeight(16), @@ -151,9 +160,21 @@ class _BirthNotificationState extends State { ), ), mHeight(16.0), + // DefaultButton( + // TranslationBase.of(context).submit, + // (fatherNameAR.text.isEmpty || fatherName.text.isEmpty || babyNameAR.text.isEmpty || babyName.text.isEmpty) ? null : () { + // submitBirthNotification(); + // }, + // color: CustomColors.accentColor, + // disabledColor: CustomColors.grey2, + // ), DefaultButton( TranslationBase.of(context).submit, - () {}, + (fatherNameAR.text.isEmpty || fatherName.text.isEmpty || babyNameAR.text.isEmpty || babyName.text.isEmpty || images.isEmpty) + ? null + : () { + submitBirthNotification(); + }, color: CustomColors.accentColor, disabledColor: CustomColors.grey2, ), @@ -164,6 +185,21 @@ class _BirthNotificationState extends State { ); } + void submitBirthNotification() { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service + .submitBirthNotification( + projectViewModel.user.patientID, projectViewModel.inPatientProjectID, fatherNameAR.text, fatherName.text, babyNameAR.text, babyName.text, contactNumber.text, images[0], context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + Navigator.of(context).pop(); + }).catchError((err) { + print(err); + }); + } + void confirmAttachInsuranceCardImageDialogDialog({BuildContext context, String name, String fileNo}) { showDialog( context: context, diff --git a/lib/pages/InPatientServices/inpatient_home.dart b/lib/pages/InPatientServices/inpatient_home.dart index 2098d350..3311a088 100644 --- a/lib/pages/InPatientServices/inpatient_home.dart +++ b/lib/pages/InPatientServices/inpatient_home.dart @@ -122,7 +122,7 @@ class InPatientServicesHome extends StatelessWidget { serviceList.add( InkWell( onTap: () { - Navigator.push(context, FadePage(page: BirthNotification())); + openBirthNotificationsPage(context); }, child: MedicalProfileItem( title: TranslationBase.of(context).birthNotificationTitle, @@ -230,6 +230,18 @@ class InPatientServicesHome extends StatelessWidget { }); } + void openBirthNotificationsPage(BuildContext context) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getBirthNotification(projectViewModel.user.patientID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['birthNotification']); + Navigator.push(context, FadePage(page: BirthNotification())); + }).catchError((err) { + print(err); + }); + } + void openGeneralInstructions(BuildContext context) { ClinicListService service = new ClinicListService(); GifLoaderDialogUtils.showMyDialog(context); diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index d4a4f8ed..276c66eb 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -235,4 +235,43 @@ class ClinicListService extends BaseService { }, body: request, isAllowAny: true); return Future.value(localRes); } + + Future getBirthNotification(num motherMRN, context) async { + Map request; + request = { + "mothermrn": motherMRN, + }; + + dynamic localRes; + + await baseAppClient.post(GET_BIRTH_NOTIFICATION, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future submitBirthNotification(num motherMRN, int projectID, String fatherNameAR, String fatherNameEN, String babyNameAR, String babyNameEN, String contactNum, String idImage, context) async { + Map request; + request = { + "ProjectID": projectID, + "mothermrn": motherMRN, + "fatherName": fatherNameEN, + "fatherNameAr": fatherNameAR, + "babyName": babyNameEN, + "babyNameAr": babyNameEN, + "contactNumber": contactNum, + "iDImage": idImage, + }; + + dynamic localRes; + + await baseAppClient.post(SAVE_BIRTH_NOTIFICATION, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 49eeb8da..4264bbf2 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2909,8 +2909,10 @@ class TranslationBase { String get admissionNoticeSubTitle => localizedValues["admissionNoticeSubTitle"][locale.languageCode]; String get mothersMRN => localizedValues["mothersMRN"][locale.languageCode]; String get mothersName => localizedValues["mothersName"][locale.languageCode]; - String get fathersName => localizedValues["fathersName"][locale.languageCode]; - String get babysName => localizedValues["babysName"][locale.languageCode]; + String get fathersNameEN => localizedValues["fathersNameEN"][locale.languageCode]; + String get fathersNameAR => localizedValues["fathersNameAR"][locale.languageCode]; + String get babysNameEN => localizedValues["babysNameEN"][locale.languageCode]; + String get babysNameAR => localizedValues["babysNameAR"][locale.languageCode]; String get contactNumber => localizedValues["contactNumber"][locale.languageCode]; String get scanID => localizedValues["scanID"][locale.languageCode]; String get birthNotificationNotes1 => localizedValues["birthNotificationNotes1"][locale.languageCode]; diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index f7283d1c..4d7417d6 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -73,6 +73,7 @@ class DefaultButton extends StatelessWidget { style: TextButton.styleFrom( backgroundColor: color ?? const Color(0xffD02127), disabledForegroundColor: disabledColor, + disabledBackgroundColor: disabledColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), ),