diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 161bde6..f5d9495 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -419,6 +419,8 @@ "adult": "بالغ", "updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", "fieldIsEmpty": "'{data}' الحقل فارغ. الرجاء التحديد", + "pleaseEnterComments": "الرجاء إدخال التعليقات", + "skip": "يتخطى", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index b88b14c..640afdb 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -419,6 +419,8 @@ "adult": "Adult", "updateMember": "Are You Sure You Want to Update this Member?", "fieldIsEmpty": "'{data}' Field is empty. Please select", + "pleaseEnterComments": "Please enter comments", + "skip": "skip", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index b17f5ba..d2fae58 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -420,6 +420,8 @@ abstract class LocaleKeys { static const adult = 'adult'; static const updateMember = 'updateMember'; static const fieldIsEmpty = 'fieldIsEmpty'; + static const pleaseEnterComments = 'pleaseEnterComments'; + static const skip = 'skip'; static const profile_reset_password_label = 'profile.reset_password.label'; static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_password = 'profile.reset_password.password'; diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 476abd1..beaf2d3 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -262,7 +262,7 @@ class _DashboardScreenState extends State { border: Border.all(color: MyColors.lightGreyEDColor, width: 1), ), child: Column( - mainAxisSize: MainAxisSize.min, + mainAxisSize: MainAxisSize.min,crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index 491672f..c9329a1 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -203,7 +203,7 @@ class _ItgDetailScreenState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.end, children: [ - myFab("Skip", "assets/images/skip.svg").onPress(() { + myFab(LocaleKeys.pleaseEnterComments.tr(), "assets/images/skip.svg").onPress(() { if (AppState().requestAllList!.length - 1 > AppState().itgWorkListIndex!) { AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1; requestDetails = null; @@ -356,7 +356,18 @@ class _ItgDetailScreenState extends State { ITGRequest? itgRequest = await WorkListApiClient().rejectITGRequest(requestType, taskId, itemId, employeeNumber, comments); Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); - Navigator.pop(context, "delegate_reload"); + // Navigator.pop(context, "delegate_reload"); + AppState().workList!.removeAt(AppState().workListIndex!); + if (AppState().workList!.isEmpty) { + Navigator.pop(context, "delegate_reload"); + } else { + if (AppState().workList!.length <= AppState().workListIndex!) { + Navigator.pop(context, "delegate_reload"); + } else { + requestDetails = null; + getDataFromState(); + } + } } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); @@ -369,7 +380,18 @@ class _ItgDetailScreenState extends State { ITGRequest? itgRequest = await WorkListApiClient().approveITGRequest(requestType, taskId, itemId, employeeNumber, comments); Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); - Navigator.pop(context, "delegate_reload"); + // Navigator.pop(context, "delegate_reload"); + AppState().workList!.removeAt(AppState().workListIndex!); + if (AppState().workList!.isEmpty) { + Navigator.pop(context, "delegate_reload"); + } else { + if (AppState().workList!.length <= AppState().workListIndex!) { + Navigator.pop(context, "delegate_reload"); + } else { + requestDetails = null; + getDataFromState(); + } + } } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index 35c3c17..369bf0c 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -442,6 +442,8 @@ class _WorkListScreenState extends State { calculateCounter(); if (mounted) setState(() {}); } + } else { + if (mounted) setState(() {}); } }, child: Container( diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 4494eb6..7aea35e 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -307,7 +307,7 @@ class _WorkListDetailScreenState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.end, children: [ - myFab("Skip", "assets/images/skip.svg").onPress(() { + myFab(LocaleKeys.pleaseEnterComments.tr(), "assets/images/skip.svg").onPress(() { if (AppState().workList!.length - 1 > AppState().workListIndex!) { AppState().setWorkListIndex = AppState().workListIndex! + 1; workListData = null; @@ -481,6 +481,7 @@ class _WorkListDetailScreenState extends State { void performAction(String actionMode) { TextEditingController textEditingController = TextEditingController(); + print("actionMode:$actionMode"); showDialog( context: context, builder: (cxt) => AcceptRejectInputDialog( @@ -488,24 +489,26 @@ class _WorkListDetailScreenState extends State { notificationGetRespond: notificationNoteInput, textEditingController: textEditingController, onTap: (note) { - if (note.isNotEmpty && (actionMode == "APPROVED" || actionMode == "APPROVE")) { - Map payload = { - "P_ACTION_MODE": actionMode, - "P_APPROVER_INDEX": null, - "P_COMMENTS": note, - "P_FORWARD_TO_USER_NAME": "", - "P_NOTIFICATION_ID": workListData!.nOTIFICATIONID, - "RespondAttributeList": [ - if (notificationNoteInput != null) - { - "ATTRIBUTE_NAME": notificationNoteInput!.attributeName, - if (notificationNoteInput!.attributeType == "number") "ATTRIBUTE_NUMBER_VALUE": note else if (notificationNoteInput!.attributeType == "VARCHAR2") "ATTRIBUTE_TEXT_VALUE": note - } - ], - }; + Map payload = { + "P_ACTION_MODE": actionMode, + "P_APPROVER_INDEX": null, + "P_COMMENTS": note, + "P_FORWARD_TO_USER_NAME": "", + "P_NOTIFICATION_ID": workListData!.nOTIFICATIONID, + "RespondAttributeList": [ + if (notificationNoteInput != null) + { + "ATTRIBUTE_NAME": notificationNoteInput!.attributeName, + if (notificationNoteInput!.attributeType == "number") "ATTRIBUTE_NUMBER_VALUE": note else if (notificationNoteInput!.attributeType == "VARCHAR2") "ATTRIBUTE_TEXT_VALUE": note + } + ], + }; + if (actionMode == "APPROVED" || actionMode == "APPROVE") { + performNotificationAction(payload); + } else if (note.isNotEmpty && (actionMode != "APPROVED" || actionMode != "APPROVE")) { performNotificationAction(payload); } else { - Utils.showToast("Please enter comments"); + Utils.showToast(LocaleKeys.pleaseEnterComments.tr()); } }, ), @@ -518,7 +521,17 @@ class _WorkListDetailScreenState extends State { GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload); Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); - Navigator.pop(context, true); + AppState().workList!.removeAt(AppState().workListIndex!); + if (AppState().workList!.isEmpty) { + Navigator.pop(context, "delegate_reload"); + } else { + if (AppState().workList!.length <= AppState().workListIndex!) { + Navigator.pop(context, "delegate_reload"); + } else { + workListData = null; + getDataFromState(); + } + } } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/widgets/mark_attendance_widget.dart b/lib/widgets/mark_attendance_widget.dart index 2ccd98b..90c57e3 100644 --- a/lib/widgets/mark_attendance_widget.dart +++ b/lib/widgets/mark_attendance_widget.dart @@ -85,7 +85,8 @@ class _MarkAttendanceWidgetState extends State { physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, padding: const EdgeInsets.only(bottom: 14, top: 21), - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: (MediaQuery.of(context).size.width < 400) ? 3 : 5, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), children: [ // if (isNfcEnabled) attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { @@ -238,7 +239,7 @@ class _MarkAttendanceWidgetState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SvgPicture.asset(image, color: Colors.white).expanded, + SvgPicture.asset(image, color: Colors.white, alignment: Alignment.topLeft).expanded, title.toText17(isBold: true, color: Colors.white), ], ),