From 605f02afe2fec1025bd6a832787bdc18ad97706b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 24 Oct 2024 10:33:47 +0300 Subject: [PATCH] Sickleave CR updates & changes --- lib/config/localized_values.dart | 9 ++++-- lib/core/service/medical/labs_service.dart | 4 ++- .../sickleave_workplace_update_page.dart | 28 +++++++++++++------ lib/uitl/translations_delegate_base.dart | 6 ++-- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index a962e009..54fff1b7 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1872,8 +1872,13 @@ const Map localizedValues = { "insuranceClassName": {"en": "Insurance Class", "ar": "فئة التأمين"}, "insuranceRequestSubmit": {"en": "Your insurance update request has been submitted successfully.", "ar": "تم تقديم طلب تحديث التأمين الخاص بك بنجاح."}, "NFCNotSupported": {"en": "Your device does not support NFC. Please visit reception to Check-In", "ar": "جهازك لا يدعم NFC. يرجى زيارة مكتب الاستقبال لتسجيل الوصول"}, - "enter-workplace-name": {"en": "Please enter your workplace name:", "ar": "رجاء إدخال مكان العمل:"}, - "workplaceName": {"en": "Workplace name:", "ar": "مكان العمل:"}, + "enter-workplace-name": {"en": "Please enter your workplace details:", "ar": "الرجاء إدخال تفاصيل مكان عملك:"}, + + "workplaceName": {"en": "Workplace name English:", "ar": "مكان العمل انجليزي:"}, + "workplaceNameAr": {"en": "Workplace name Arabic:", "ar": "مكان العمل عربي:"}, + "occupationNameEn": {"en": "Occupation name English:", "ar": "مكان العمل انجليزي:"}, + "occupationNameAr": {"en": "Occupation name Arabic:", "ar": "مكان العمل عربي:"}, + "callLiveCareSupport": {"en": "Call LiveCare Support", "ar": "اتصل بدعم اللايف كير"}, "needApproval": { "en": "Your sick leave is under process in medical administration, you will be notified once approved.", diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 77ea728e..671cc90f 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -124,12 +124,14 @@ class LabsService extends BaseService { return Future.value(localRes); } - Future updateWorkplaceName(String workplaceName, String workplaceNameAR, int requestNumber, String setupID, int projectID) async { + Future updateWorkplaceName(String workplaceName, String workplaceNameAR, String occupation, String occupationAR, int requestNumber, String setupID, int projectID) async { hasError = false; Map body = Map(); body['Placeofwork'] = workplaceName; body['Placeofworkar'] = workplaceNameAR; + body['Occupation'] = occupation; + body['Occupationar'] = occupationAR; body['Req_ID'] = requestNumber; body['TargetSetupID'] = setupID; body['ProjectID'] = projectID; diff --git a/lib/pages/medical/sickleave_workplace_update_page.dart b/lib/pages/medical/sickleave_workplace_update_page.dart index 0e555bab..f818021f 100644 --- a/lib/pages/medical/sickleave_workplace_update_page.dart +++ b/lib/pages/medical/sickleave_workplace_update_page.dart @@ -25,6 +25,10 @@ class WorkplaceUpdatePage extends StatefulWidget { class _WorkplaceUpdatePageState extends State { TextEditingController workplaceName = new TextEditingController(); + + TextEditingController workplaceNameAr = new TextEditingController(); + TextEditingController occupationNameEn = new TextEditingController(); + TextEditingController occupationNameAr = new TextEditingController(); bool? _isButtonDisabled; ProjectViewModel? projectViewModel; @@ -66,7 +70,13 @@ class _WorkplaceUpdatePageState extends State { ), ), mHeight(8), - inputWidget(TranslationBase.of(context).workplaceName, "", workplaceName), + inputWidget(TranslationBase.of(context).workplaceName, "", workplaceName, FilteringTextInputFormatter.allow(RegExp("[a-zA-Z ]"))), + mHeight(8), + inputWidget(TranslationBase.of(context).workplaceNameAr, "", workplaceNameAr, FilteringTextInputFormatter.allow(RegExp("[ء-ي ]"))), + mHeight(8), + inputWidget(TranslationBase.of(context).occupationNameEn, "", occupationNameEn, FilteringTextInputFormatter.allow(RegExp("[a-zA-Z ]"))), + mHeight(8), + inputWidget(TranslationBase.of(context).occupationNameAr, "", occupationNameAr, FilteringTextInputFormatter.allow(RegExp("[ء-ي ]"))), ], ), ), @@ -83,7 +93,7 @@ class _WorkplaceUpdatePageState extends State { height: 50, elevation: 0, color: CustomColors.accentColor, - disabledColor:Colors.grey.withOpacity(0.25), + disabledColor: Colors.grey.withOpacity(0.25), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), child: Text( TranslationBase.of(context).submit, @@ -94,10 +104,11 @@ class _WorkplaceUpdatePageState extends State { ), ), onPressed: () { - if (_isButtonDisabled == false) + // if (_isButtonDisabled == false) + if (workplaceName.text.isNotEmpty && workplaceNameAr.text.isNotEmpty && occupationNameEn.text.isNotEmpty && occupationNameAr.text.isNotEmpty) updateWorkplaceNameDialog(); else - AppToast.showErrorToast(message: TranslationBase.of(context).enterWorkplaceName); + AppToast.showErrorToast(message: TranslationBase.of(context).enterDetailBelow); }, ), ), @@ -109,7 +120,7 @@ class _WorkplaceUpdatePageState extends State { ); } - Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String? prefix, bool isEnable = true, bool hasSelection = false}) { + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, TextInputFormatter inputFormatter, {String? prefix, bool isEnable = true, bool hasSelection = false}) { return Container( padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), alignment: Alignment.center, @@ -145,7 +156,8 @@ class _WorkplaceUpdatePageState extends State { keyboardType: TextInputType.name, controller: _controller, inputFormatters: [ - projectViewModel!.isArabic ? FilteringTextInputFormatter.allow(RegExp("[ء-ي ]")) : FilteringTextInputFormatter.allow(RegExp("[a-zA-Z ]")), + // projectViewModel!.isArabic ? FilteringTextInputFormatter.allow(RegExp("[ء-ي ]")) : FilteringTextInputFormatter.allow(RegExp("[a-zA-Z ]")), + inputFormatter ], onChanged: (value) => {_onPassportTextChanged(value)}, style: TextStyle( @@ -226,9 +238,7 @@ class _WorkplaceUpdatePageState extends State { LabsService service = new LabsService(); GifLoaderDialogUtils.showMyDialog(context); - service - .updateWorkplaceName(projectViewModel!.isArabic ? "-" : workplaceName.text, projectViewModel!.isArabic ? workplaceName.text : "-", widget.requestNumber, widget.setupID, widget.projectID) - .then((res) { + service.updateWorkplaceName(workplaceName.text, workplaceNameAr.text, occupationNameEn.text, occupationNameAr.text, widget.requestNumber, widget.setupID, widget.projectID).then((res) { GifLoaderDialogUtils.hideDialog(context); Navigator.of(context).pop(true); }).catchError((err) { diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index db5033e2..be20b67a 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2978,14 +2978,16 @@ class TranslationBase { String get searchClinic => localizedValues["searchClinic"][locale.languageCode]; String get selectBranch => localizedValues["selectBranch"][locale.languageCode]; String get searchByBranch => localizedValues["searchByBranch"][locale.languageCode]; - String get existingPackage => localizedValues["existingPackage"][locale.languageCode]; String get continueOrbookNew => localizedValues["continueOrbookNew"][locale.languageCode]; String get newAppointment => localizedValues["newAppointment"][locale.languageCode]; String get proceedPackage => localizedValues["proceedPackage"][locale.languageCode]; - String get hospitalNavigationTitle => localizedValues["hospitalNavigationTitle"][locale.languageCode]; String get hospitalNavigationSubtitle => localizedValues["hospitalNavigationSubtitle"][locale.languageCode]; + + String get workplaceNameAr => localizedValues["workplaceNameAr"][locale.languageCode]; + String get occupationNameEn => localizedValues["occupationNameEn"][locale.languageCode]; + String get occupationNameAr => localizedValues["occupationNameAr"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {