From f6c9b6dce9234065f8b7805a9bcb562e9507a907 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 6 Oct 2022 09:28:13 +0300 Subject: [PATCH 01/20] Updates & fixes --- .../get_po_notification_body_list_model.dart | 18 +++--- .../itg_forms_models/itg_request_model.dart | 2 +- .../get_deductions_List_model.dart | 10 ++-- .../get_earnings_list_model.dart | 10 ++-- .../get_summary_of_payment_list_model.dart | 12 ++-- lib/ui/landing/widget/services_widget.dart | 2 +- lib/ui/misc/request_submit_screen.dart | 10 ++-- lib/ui/payslip/monthly_pay_slip_screen.dart | 24 ++++---- .../fragments/add_details_fragment.dart | 57 ++++++++++--------- lib/ui/work_list/itg_detail_screen.dart | 10 ++-- lib/ui/work_list/worklist_detail_screen.dart | 1 + .../attachments_fragment.dart | 6 +- .../worklist_fragments/detail_fragment.dart | 4 +- .../worklist_fragments/info_fragments.dart | 8 +-- .../bottom_sheets/attachment_options.dart | 37 ++++++------ lib/widgets/image_picker.dart | 26 ++++++++- 16 files changed, 133 insertions(+), 104 deletions(-) diff --git a/lib/models/get_po_notification_body_list_model.dart b/lib/models/get_po_notification_body_list_model.dart index 5d77b68..ff18949 100644 --- a/lib/models/get_po_notification_body_list_model.dart +++ b/lib/models/get_po_notification_body_list_model.dart @@ -44,22 +44,22 @@ class POHeader { String? cOMMENTS; String? cREATIONDATE; String? cURRENCYNAME; - int? cUSTOMDUTY; - int? dISCOUNTAMOUNT; - int? gROSSAMOUNT; + num? cUSTOMDUTY; + num? dISCOUNTAMOUNT; + num? gROSSAMOUNT; String? lOCCUR; - int? lOCCURTOTPOAMT; - int? oTHERCHARGES; + num? lOCCURTOTPOAMT; + num? oTHERCHARGES; String? pAYMENTTERMS; String? pONUMBER; String? pREPARER; String? qUOTATIONDATE; String? qUOTATIONNUMBER; - int? sALESTAX; - int? sHIPHANDLE; + num? sALESTAX; + num? sHIPHANDLE; String? sHIPTOLOCATIONNAME; - int? tOTALPODISCOUNT; - int? tOTPOAMT; + num? tOTALPODISCOUNT; + num? tOTPOAMT; String? tOTPOAMTWORD; String? vENDORNAME; String? vENDORSITECODE; diff --git a/lib/models/itg_forms_models/itg_request_model.dart b/lib/models/itg_forms_models/itg_request_model.dart index 75f6a69..ba10305 100644 --- a/lib/models/itg_forms_models/itg_request_model.dart +++ b/lib/models/itg_forms_models/itg_request_model.dart @@ -4,7 +4,7 @@ import 'package:mohem_flutter_app/models/itg_forms_models/wf_history_model.dart' class ITGRequest { List? allowedActions; - Null? attachments; + List? attachments; List? fieldGoups; Null? grantFields; List? wFHistory; diff --git a/lib/models/monthly_pay_slip/get_deductions_List_model.dart b/lib/models/monthly_pay_slip/get_deductions_List_model.dart index 07bf1ba..a4933c6 100644 --- a/lib/models/monthly_pay_slip/get_deductions_List_model.dart +++ b/lib/models/monthly_pay_slip/get_deductions_List_model.dart @@ -1,10 +1,10 @@ class GetDeductionsList { - int? aMOUNT; + num? aMOUNT; String? eLEMENTNAME; - int? fROMROWNUM; - int? nOOFROWS; - int? rOWNUM; - int? tOROWNUM; + num? fROMROWNUM; + num? nOOFROWS; + num? rOWNUM; + num? tOROWNUM; GetDeductionsList( {this.aMOUNT, diff --git a/lib/models/monthly_pay_slip/get_earnings_list_model.dart b/lib/models/monthly_pay_slip/get_earnings_list_model.dart index f525d16..e4a481f 100644 --- a/lib/models/monthly_pay_slip/get_earnings_list_model.dart +++ b/lib/models/monthly_pay_slip/get_earnings_list_model.dart @@ -1,10 +1,10 @@ class GetEarningsList { - int? aMOUNT; + num? aMOUNT; String? eLEMENTNAME; - int? fROMROWNUM; - int? nOOFROWS; - int? rOWNUM; - int? tOROWNUM; + num? fROMROWNUM; + num? nOOFROWS; + num? rOWNUM; + num? tOROWNUM; GetEarningsList( {this.aMOUNT, diff --git a/lib/models/monthly_pay_slip/get_summary_of_payment_list_model.dart b/lib/models/monthly_pay_slip/get_summary_of_payment_list_model.dart index be65e35..6979593 100644 --- a/lib/models/monthly_pay_slip/get_summary_of_payment_list_model.dart +++ b/lib/models/monthly_pay_slip/get_summary_of_payment_list_model.dart @@ -1,10 +1,10 @@ class GetSummaryOfPaymentList { - int? tOTALDEDUCTIONSAMOUNT; - int? tOTALDEDUCTIONSPERCENTAGE; - int? tOTALEARNINGSAMOUNT; - int? tOTALEARNINGSPERCENTAGE; - int? tOTALPAYAMOUNT; - int? tOTALPAYPERCENTAGE; + num? tOTALDEDUCTIONSAMOUNT; + num? tOTALDEDUCTIONSPERCENTAGE; + num? tOTALEARNINGSAMOUNT; + num? tOTALEARNINGSPERCENTAGE; + num? tOTALPAYAMOUNT; + num? tOTALPAYPERCENTAGE; GetSummaryOfPaymentList( {this.tOTALDEDUCTIONSAMOUNT, diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index 5b2a207..e50ec5c 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -73,7 +73,7 @@ class ServicesWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, children: [ Expanded( - child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true), + child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText10(isBold: true), ), SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4) ], diff --git a/lib/ui/misc/request_submit_screen.dart b/lib/ui/misc/request_submit_screen.dart index ba69ee8..4d3d341 100644 --- a/lib/ui/misc/request_submit_screen.dart +++ b/lib/ui/misc/request_submit_screen.dart @@ -67,7 +67,7 @@ class _RequestSubmitScreenState extends State { } void submitRequest() async { - try { + // try { Utils.showLoading(context); List> list = []; if (attachmentFiles.isNotEmpty) { @@ -134,10 +134,10 @@ class _RequestSubmitScreenState extends State { Utils.showToast(LocaleKeys.yourRequestHasBeenSubmittedForApprovals.tr(), longDuration: true); Navigator.of(context).popUntil((route) => route.settings.name == AppRoutes.dashboard); Navigator.pushNamed(context, AppRoutes.workList); - } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); - } + // } catch (ex) { + // Utils.hideLoading(context); + // Utils.handleException(ex, context, null); + // } } @override diff --git a/lib/ui/payslip/monthly_pay_slip_screen.dart b/lib/ui/payslip/monthly_pay_slip_screen.dart index a277fcd..543d81c 100644 --- a/lib/ui/payslip/monthly_pay_slip_screen.dart +++ b/lib/ui/payslip/monthly_pay_slip_screen.dart @@ -40,7 +40,7 @@ class _MonthlyPaySlipScreenState extends State { } void getData() async { - try { + // try { Utils.showLoading(context); paySlipList = await MonthlyPaySlipApiClient().getPaySlip(); if (paySlipList.isNotEmpty) { @@ -49,14 +49,14 @@ class _MonthlyPaySlipScreenState extends State { } Utils.hideLoading(context); setState(() {}); - } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); - } + // } catch (ex) { + // Utils.hideLoading(context); + // Utils.handleException(ex, context, null); + // } } Future getDataByActionContextID(int actionContextID, {bool showLoading = false}) async { - try { + // try { if (showLoading) { Utils.showLoading(context); } @@ -74,12 +74,12 @@ class _MonthlyPaySlipScreenState extends State { Utils.hideLoading(context); setState(() {}); } - } catch (ex) { - if (showLoading) { - Utils.hideLoading(context); - } - Utils.handleException(ex, context, null); - } + // } catch (ex) { + // if (showLoading) { + // Utils.hideLoading(context); + // } + // Utils.handleException(ex, context, null); + // } } @override diff --git a/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart b/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart index fc655a1..8b2f24e 100644 --- a/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart +++ b/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart @@ -190,9 +190,10 @@ class _AddItemDetailsFragmentState extends State { 6.width, SimpleButton(LocaleKeys.add.tr(), () { ImageOptions.showImageOptionsNew(context, (String image, File file) { - // setState(() { - // images.add(image); - // }); + setState(() { + images.add(image); + Navigator.of(context).pop(); + }); }); }, fontSize: 14), ], @@ -243,41 +244,43 @@ class _AddItemDetailsFragmentState extends State { Future getAdDetails() async { // todo need to change this method later , its not a good approach to do it like this. String details = await Utils.getStringFromPrefs(SharedPrefsConsts.editItemForSale); - var body = json.decode(details); + if(details.isNotEmpty) { + var body = json.decode(details); - GetRegionsList selectedRegionAd = GetRegionsList(); + GetRegionsList selectedRegionAd = GetRegionsList(); - GetSaleCategoriesList selectedSaleCategoryAd = GetSaleCategoriesList(); + GetSaleCategoriesList selectedSaleCategoryAd = GetSaleCategoriesList(); - itemTitle = body["itemTitle"]; - itemDescription = body["itemDescription"]; - selectedItemCondition = body["itemCondition"].toString().toLowerCase(); - selectedRegionAd.regionID = body["selectedRegion"]["regionID"]; - selectedRegionAd.regionName = body["selectedRegion"]["regionName"]; - selectedRegion = selectedRegionAd; - itemPrice = body["itemPrice"]; - selectedSaleCategoryAd.categoryID = body["selectedSaleCategory"]["categoryID"]; - selectedSaleCategoryAd.title = body["selectedSaleCategory"]["title"]; - if (body["itemPhotos"].length != 0) { - images.add(body["itemPhotos"][0]); - } - ItemReviewModel itemReviewModel = - ItemReviewModel(body["itemTitle"], body["itemDescription"], body["itemCondition"].toString().toLowerCase(), selectedRegionAd, body["itemPrice"], images, selectedSaleCategoryAd); + itemTitle = body["itemTitle"]; + itemDescription = body["itemDescription"]; + selectedItemCondition = body["itemCondition"].toString().toLowerCase(); + selectedRegionAd.regionID = body["selectedRegion"]["regionID"]; + selectedRegionAd.regionName = body["selectedRegion"]["regionName"]; + selectedRegion = selectedRegionAd; + itemPrice = body["itemPrice"]; + selectedSaleCategoryAd.categoryID = body["selectedSaleCategory"]["categoryID"]; + selectedSaleCategoryAd.title = body["selectedSaleCategory"]["title"]; + if (body["itemPhotos"].length != 0) { + images.add(body["itemPhotos"][0]); + } + ItemReviewModel itemReviewModel = + ItemReviewModel(body["itemTitle"], body["itemDescription"], body["itemCondition"].toString().toLowerCase(), selectedRegionAd, body["itemPrice"], images, selectedSaleCategoryAd); - AddItemDetailsFragment.itemReviewModel = itemReviewModel; - SelectCategoryFragment.selectedSaleCategory = selectedSaleCategoryAd; + AddItemDetailsFragment.itemReviewModel = itemReviewModel; + SelectCategoryFragment.selectedSaleCategory = selectedSaleCategoryAd; + } } void getRegions() async { - try { + // try { Utils.showLoading(context); getRegionsList = await ItemsForSaleApiClient().getRegions(); await getAdDetails(); Utils.hideLoading(context); setState(() {}); - } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); - } + // } catch (ex) { + // Utils.hideLoading(context); + // Utils.handleException(ex, context, null); + // } } } diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index 454408e..25eced3 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -56,7 +56,7 @@ class _ItgDetailScreenState extends State { ITGRequest? itgRequest; void getItgData() async { - try { + // try { Utils.showLoading(context); itgRequest = await WorkListApiClient().getITGFormDetails(requestDetails!.requestType!, requestDetails!.iD!, requestDetails!.itemID!, ""); allowedActionList = itgRequest?.allowedActions ?? []; @@ -68,10 +68,10 @@ class _ItgDetailScreenState extends State { } Utils.hideLoading(context); setState(() {}); - } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); - } + // } catch (ex) { + // Utils.hideLoading(context); + // Utils.handleException(ex, context, null); + // } } void getDataFromState() { diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index db96c53..07f69da 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -209,6 +209,7 @@ class _WorkListDetailScreenState extends State { workListData: workListData, itemCreationHeader: getItemCreationNtfBody?.itemCreationHeader ?? [], getStampMsNotifications: getStampMsNotifications, + getStampNsNotifications: getStampNsNotifications, getEitCollectionNotificationBodyList: getEitCollectionNotificationBodyList, getPhonesNotificationBodyList: getPhonesNotificationBodyList, getBasicDetNtfBodyList: getBasicDetNtfBodyList, diff --git a/lib/ui/work_list/worklist_fragments/attachments_fragment.dart b/lib/ui/work_list/worklist_fragments/attachments_fragment.dart index 2893229..0497823 100644 --- a/lib/ui/work_list/worklist_fragments/attachments_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/attachments_fragment.dart @@ -28,9 +28,9 @@ class AttachmentsFragment extends StatelessWidget { (getAttachmentList[index].fILENAME?.capitalizeFirstofEach ?? "").toText16().expanded, ], ).objectContainerView().onPress(() async { - print("calling"); - String path = await _createFileFromString(getAttachmentList[index].fILEDATA ?? "", getAttachmentList[index].fILECONTENTTYPE ?? ""); - OpenFile.open(path); + // print("calling"); + // String path = await _createFileFromString(getAttachmentList[index].fILEDATA ?? "", getAttachmentList[index].fILECONTENTTYPE ?? ""); + // OpenFile.open(path); }); }, separatorBuilder: (BuildContext context, int index) => 12.height, diff --git a/lib/ui/work_list/worklist_fragments/detail_fragment.dart b/lib/ui/work_list/worklist_fragments/detail_fragment.dart index 7e2567e..3953a35 100644 --- a/lib/ui/work_list/worklist_fragments/detail_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/detail_fragment.dart @@ -43,12 +43,12 @@ class _DetailFragmentState extends State { mainAxisSize: MainAxisSize.min, children: [ ItemDetailView(LocaleKeys.employeeNumber.tr(), widget.memberInformationListModel!.eMPLOYEENUMBER ?? ""), - ItemDetailView(LocaleKeys.employeeName.tr(), (AppState().isArabic(context) ? widget.memberInformationListModel!.eMPLOYEENAMEAr : widget.memberInformationListModel!.eMPLOYEENAMEEn) ?? ""), + ItemDetailView(LocaleKeys.name.tr(), (AppState().isArabic(context) ? widget.memberInformationListModel!.eMPLOYEENAMEAr : widget.memberInformationListModel!.eMPLOYEENAMEEn) ?? ""), ItemDetailView(LocaleKeys.jobTitle.tr(), makePositionName(widget.memberInformationListModel!.pOSITIONNAME ?? "")), ItemDetailView(LocaleKeys.grade.tr(), widget.memberInformationListModel!.gRADENAME ?? ""), ItemDetailView(LocaleKeys.jobCategory.tr(), makePositionName(widget.memberInformationListModel!.pOSITIONNAME ?? "")), ItemDetailView(LocaleKeys.category.tr(), widget.memberInformationListModel!.eMPLOYMENTCATEGORYMEANING ?? ""), - ItemDetailView(LocaleKeys.employeeEmailAddress.tr(), widget.memberInformationListModel!.eMPLOYEEEMAILADDRESS ?? ""), + ItemDetailView(LocaleKeys.email.tr(), widget.memberInformationListModel!.eMPLOYEEEMAILADDRESS ?? ""), ItemDetailView(LocaleKeys.payrollBranch.tr(), widget.memberInformationListModel!.pAYROLLNAME ?? ""), ], ).objectContainerView(), diff --git a/lib/ui/work_list/worklist_fragments/info_fragments.dart b/lib/ui/work_list/worklist_fragments/info_fragments.dart index bc47989..e7a2787 100644 --- a/lib/ui/work_list/worklist_fragments/info_fragments.dart +++ b/lib/ui/work_list/worklist_fragments/info_fragments.dart @@ -114,7 +114,7 @@ class InfoFragment extends StatelessWidget { ItemDetailView(LocaleKeys.totalPOAmountInWords.tr(), poHeaderList[index].tOTPOAMTWORD ?? ""), ], ).objectContainerView(), - separatorBuilder: (cxt, index) => 4.height, + separatorBuilder: (cxt, index) => 1.divider, itemCount: poHeaderList.length); } @@ -150,7 +150,7 @@ class InfoFragment extends StatelessWidget { ItemDetailView(LocaleKeys.approvedSwipeEndReason.tr(), list[index].aPPROVEDENDREASONDESC.toString()), ], ), - separatorBuilder: (cxt, index) => 18.height, + separatorBuilder: (cxt, index) => 1.divider.paddingOnly(top: 8, bottom: 8), itemCount: list.length); } @@ -163,11 +163,11 @@ class InfoFragment extends StatelessWidget { children: [ ItemDetailView(LocaleKeys.employeeNumber.tr(), list[index].eMPLOYEENUMBER.toString()), ItemDetailView(LocaleKeys.assignmentNumber.tr(), list[index].aSSIGNMENTNUMBER.toString()), - ItemDetailView(LocaleKeys.employeeName.tr(), list[index].eMPLOYEENAME.toString()), + ItemDetailView(LocaleKeys.name.tr(), list[index].eMPLOYEENAME.toString()), ItemDetailView(LocaleKeys.scheduleDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(list[index].sCHEDULEDATE.toString()), false)), ], ), - separatorBuilder: (cxt, index) => 18.height, + separatorBuilder: (cxt, index) => 1.divider.paddingOnly(top: 8, bottom: 8), itemCount: list.length); } diff --git a/lib/widgets/bottom_sheets/attachment_options.dart b/lib/widgets/bottom_sheets/attachment_options.dart index ebcfbe7..83b6d3d 100644 --- a/lib/widgets/bottom_sheets/attachment_options.dart +++ b/lib/widgets/bottom_sheets/attachment_options.dart @@ -26,9 +26,9 @@ class AttachmentOptions extends StatelessWidget { padding: const EdgeInsets.only(top: 21, bottom: 14), shrinkWrap: true, children: [ - itemView("open_camera.svg", "Open\nCamera"), - itemView("gallery.svg", "Upload from\nGallery"), - itemView("files.svg", "Upload from\nFiles"), + itemView("open_camera.svg", "Open\nCamera", onCameraTap), + itemView("gallery.svg", "Upload from\nGallery", onGalleryTap), + itemView("files.svg", "Upload from\nFiles", onFilesTap), ], ) ], @@ -36,19 +36,22 @@ class AttachmentOptions extends StatelessWidget { ); } - Widget itemView(String icon, String title) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SvgPicture.asset("assets/images/$icon"), - title.toText11(isBold: true), - ], - ).paddingOnly(left: 13, right: 13, top: 16, bottom: 12).expanded.objectContainerBorderView( - disablePadding: true, - radius: 10, - color: MyColors.greyF7Color.withOpacity(.48), - borderColor: MyColors.lightGreyE5Color.withOpacity(.48), - ); + Widget itemView(String icon, String title, VoidCallback onTap) { + return InkWell( + onTap: onTap, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset("assets/images/$icon"), + title.toText11(isBold: true), + ], + ).paddingOnly(left: 13, right: 13, top: 16, bottom: 12).expanded.objectContainerBorderView( + disablePadding: true, + radius: 10, + color: MyColors.greyF7Color.withOpacity(.48), + borderColor: MyColors.lightGreyE5Color.withOpacity(.48), + ), + ); } } diff --git a/lib/widgets/image_picker.dart b/lib/widgets/image_picker.dart index 484f0a1..4c17250 100644 --- a/lib/widgets/image_picker.dart +++ b/lib/widgets/image_picker.dart @@ -15,9 +15,31 @@ class ImageOptions { context, child: AttachmentOptions( onCameraTap: () async { - PickedFile? path = await ImagePicker.platform.pickImage(source: ImageSource.camera, imageQuality: 20); + if (Platform.isAndroid) { + cameraImageAndroid(image); + } else { + File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.camera, imageQuality: 20))?.path ?? ""); + String fileName = _image.path; + var bytes = File(fileName).readAsBytesSync(); + String base64Encode = base64.encode(bytes); + if (base64Encode != null) { + image(base64Encode, _image); + } + } + }, + onGalleryTap: () async { + if (Platform.isAndroid) { + galleryImageAndroid(image); + } else { + File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.gallery, imageQuality: 20))?.path ?? ""); + String fileName = _image.path; + var bytes = File(fileName).readAsBytesSync(); + String base64Encode = base64.encode(bytes); + if (base64Encode != null) { + image(base64Encode, _image); + } + } }, - onGalleryTap: () {}, onFilesTap: () async { FilePickerResult? result = await FilePicker.platform.pickFiles(); }, From c05b8eee295cc39433b6d8873769d2c2d7b2984d Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Thu, 6 Oct 2022 09:58:28 +0300 Subject: [PATCH 02/20] Remote Changed --- .../dialogs/id/employee_digital_id_dialog.dart | 18 ++++++++++++------ lib/ui/login/login_screen.dart | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/ui/dialogs/id/employee_digital_id_dialog.dart b/lib/ui/dialogs/id/employee_digital_id_dialog.dart index e0e1054..7ba6131 100644 --- a/lib/ui/dialogs/id/employee_digital_id_dialog.dart +++ b/lib/ui/dialogs/id/employee_digital_id_dialog.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; @@ -35,12 +36,17 @@ class EmployeeDigitialIdDialog extends StatelessWidget { boxShadow: [BoxShadow(color: Colors.white60, blurRadius: 10, spreadRadius: 10)], ), clipBehavior: Clip.antiAlias, - child: Image.memory( - Utils.getPostBytes( - AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", - ), - fit: BoxFit.cover, - ), + child: (AppState().memberInformationList!.eMPLOYEEIMAGE == null || AppState().memberInformationList!.eMPLOYEEIMAGE!.isEmpty) + ? Container( + color: Colors.grey[300], + child: SvgPicture.asset("assets/images/user.svg"), + ) + : Image.memory( + Utils.getPostBytes( + AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", + ), + fit: BoxFit.cover, + ), ), 16.width, (AppState().memberInformationList!.eMPLOYEENUMBER ?? "").toText20(), diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 92a58db..74e8376 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -130,8 +130,8 @@ class _LoginScreenState extends State { if (isAppOpenBySystem == null) { isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; print('isAppOpenBySystem:$isAppOpenBySystem'); - // username.text = "15153"; - // password.text = "Abcd@12345"; + username.text = "15153"; + password.text = "Abcd@12345"; if (isAppOpenBySystem!) checkFirebaseToken(); } From 95b60181b1086777ba90f0101ad2eaeee44a72e4 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 6 Oct 2022 10:25:47 +0300 Subject: [PATCH 03/20] bug fixes --- assets/langs/ar-SA.json | 2 +- assets/langs/en-US.json | 2 +- lib/classes/consts.dart | 4 +-- lib/generated/codegen_loader.g.dart | 10 +++++--- lib/ui/landing/dashboard_screen.dart | 13 +++++----- lib/ui/landing/widget/app_drawer.dart | 2 +- lib/ui/landing/widget/menus_widget.dart | 22 +++++++++++++--- lib/ui/landing/widget/services_widget.dart | 7 +++++- .../services_menu_list_screen.dart | 13 +++++----- lib/ui/work_list/work_list_screen.dart | 2 +- lib/ui/work_list/worklist_detail_screen.dart | 25 ++++++------------- 11 files changed, 56 insertions(+), 46 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 3f1461b..5f40cbc 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -1,7 +1,7 @@ { "mohemm": "Mohemm", "english": "English", - "arabic": "Arabic", + "arabic": "عربي", "login": "تسجيل الدخول", "pleaseEnterLoginDetails": "الرجاء إدخال التفاصيل أدناه لتسجيل الدخول", "username": "اسم المستخدم", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 23b7d3e..c0cf46d 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -1,7 +1,7 @@ { "mohemm": "Mohemm", "english": "English", - "arabic": "Arabic", + "arabic": "عربي", "login": "Login", "pleaseEnterLoginDetails": "Please enter the detail below to login", "username": "Username", diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 564a61f..645aaf8 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,7 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server - // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - static String baseUrl = "https://hmgwebservices.com"; // Live server + static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server + // static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index f48e420..4688cd3 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -17,7 +17,7 @@ class CodegenLoader extends AssetLoader{ static const Map ar_SA = { "mohemm": "Mohemm", "english": "English", - "arabic": "Arabic", + "arabic": "عربي", "login": "تسجيل الدخول", "pleaseEnterLoginDetails": "الرجاء إدخال التفاصيل أدناه لتسجيل الدخول", "username": "اسم المستخدم", @@ -27,6 +27,7 @@ class CodegenLoader extends AssetLoader{ "lastLoginDetails": "تفاصيل تسجيل الدخول الأخير:", "verificationType": "نوع التحقق:", "pleaseVerify": "ارجوك تحقق", + "pleaseVerifyForBio": "الرجاء التحقق من تسجيل الدخول باستخدام أحد هذه الخيارات", "verifyThroughFace": "تحقق من خلال الوجه", "verifyThroughFingerprint": "تحقق من خلال بصمة الإصبع", "verifyThroughSMS": "تحقق من خلال الرسائل القصيرة", @@ -420,7 +421,7 @@ class CodegenLoader extends AssetLoader{ "addFavoriteList": "هل تريد اضافة {name} لقائمة المفضله", "feedbackUserExperience": "هذا للحصول على تعليقات حول تجربة المستخدم", "rateUI": ".1 كيف تريد تقييم التطبيق", - "Submit Survey": "ارسال الاستبيان", + "submitSurvey": "ارسال الاستبيان", "typeHere": "اكتب هنا", "profile": { "reset_password": { @@ -459,7 +460,7 @@ class CodegenLoader extends AssetLoader{ static const Map en_US = { "mohemm": "Mohemm", "english": "English", - "arabic": "Arabic", + "arabic": "عربي", "login": "Login", "pleaseEnterLoginDetails": "Please enter the detail below to login", "username": "Username", @@ -469,6 +470,7 @@ static const Map en_US = { "lastLoginDetails": "Last Login Details:", "verificationType": "Verification Type:", "pleaseVerify": "Please Verify", + "pleaseVerifyForBio": "Please verify login with one of the following options", "verifyThroughFace": "Verify Through Face", "verifyThroughFingerprint": "Verify Through Fingerprint", "verifyThroughSMS": "Verify Through SMS", @@ -862,7 +864,7 @@ static const Map en_US = { "addFavoriteList": "Do you want to add {name} in your favorite list", "feedbackUserExperience": "This is to get the feedback about the user experience", "rateUI": "1. How would you rate this UI?", - "Submit Survey": "Submit Survey", + "submitSurvey": "Submit Survey", "typeHere": "Type here", "profile": { "reset_password": { diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 1d8373e..0ddde2f 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -71,9 +71,7 @@ class _DashboardScreenState extends State { mainAxisSize: MainAxisSize.min, children: [ Image.memory( - Utils.getPostBytes( - AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", - ), + Utils.getPostBytes(AppState().memberInformationList!.eMPLOYEEIMAGE ?? ""), errorBuilder: (BuildContext context, error, stackTrace) { return SvgPicture.asset( "assets/images/user.svg", @@ -205,16 +203,17 @@ class _DashboardScreenState extends State { .toText14(color: Colors.white, isBold: true), 4.height, ], - ).paddingOnly(left: 12), + ).paddingOnly(right: AppState().isArabic(context) ? 12 : 0, left: AppState().isArabic(context) ? 0 : 12), ), Container( width: 45, height: 45, padding: const EdgeInsets.only(left: 14, right: 14), - decoration: const BoxDecoration( - color: Color(0xff259EA4), + decoration: BoxDecoration( + color: const Color(0xff259EA4), borderRadius: BorderRadius.only( - bottomRight: Radius.circular(15), + bottomRight: Radius.circular(AppState().isArabic(context) ? 0 : 15), + bottomLeft: Radius.circular(AppState().isArabic(context) ? 15 : 0), ), ), child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index d2203f9..ea6343b 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -124,7 +124,7 @@ class _AppDrawerState extends State { 9.width, title.toText14(color: color).expanded ], - ).paddingOnly(left: 21, top: 10, bottom: 10).onPress(closeDrawer + ).paddingOnly(left: 21, top: 10, bottom: 10, right: 21).onPress(closeDrawer ? () async { Navigator.pop(context); Future.delayed(const Duration(microseconds: 200), onPress); diff --git a/lib/ui/landing/widget/menus_widget.dart b/lib/ui/landing/widget/menus_widget.dart index 91723ee..6e550ec 100644 --- a/lib/ui/landing/widget/menus_widget.dart +++ b/lib/ui/landing/widget/menus_widget.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; @@ -43,7 +44,11 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.workListCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + RotatedBox( + quarterTurns: AppState().isArabic(context) ? 2:4, + child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ), + ], ) ], @@ -70,7 +75,10 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + RotatedBox( + quarterTurns: AppState().isArabic(context) ? 2:4, + child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ), ], ) ], @@ -97,7 +105,10 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.leaveBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + RotatedBox( + quarterTurns: AppState().isArabic(context) ? 2:4, + child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ), ], ) ], @@ -124,7 +135,10 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.ticketBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + RotatedBox( + quarterTurns: AppState().isArabic(context) ? 2:4, + child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ), ], ) ], diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index 5b2a207..5bdb217 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; @@ -75,7 +76,11 @@ class ServicesWidget extends StatelessWidget { Expanded( child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true), ), - SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4) + RotatedBox( + quarterTurns: AppState().isArabic(context) ? 2:4, + child: SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4) + ), + ], ) ], diff --git a/lib/ui/my_attendance/services_menu_list_screen.dart b/lib/ui/my_attendance/services_menu_list_screen.dart index 4e4745a..fe82058 100644 --- a/lib/ui/my_attendance/services_menu_list_screen.dart +++ b/lib/ui/my_attendance/services_menu_list_screen.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; @@ -39,7 +40,7 @@ class ServicesMenuListScreen extends StatelessWidget { ? Utils.getNoDataWidget(context) : ListView.separated( padding: const EdgeInsets.all(21), - itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", servicesMenuData.list[index].prompt!).onPress(() { + itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", servicesMenuData.list[index].prompt!, context).onPress(() { if (servicesMenuData.list[index].parentMenuName == "MBL_PERINFO_SS") { if (servicesMenuData.list[index].requestType == "BASIC_DETAILS") { Navigator.pushNamed(context, AppRoutes.basicDetails); @@ -63,15 +64,15 @@ class ServicesMenuListScreen extends StatelessWidget { ); } - Widget itemView(String icon, String title) { + Widget itemView(String icon, String title, context) { return Row( children: [ (title).toText16().expanded, 12.width, - SvgPicture.asset( - "assets/images/arrow_next.svg", - color: MyColors.darkIconColor, - ) + RotatedBox( + quarterTurns: AppState().isArabic(context) ? 2 : 4, + child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor), + ), ], ).objectContainerView(); } diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index c3cc9c6..aa4301c 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -34,7 +34,7 @@ class _WorkListScreenState extends State { WorkListItemTypeModelData( value: 0, name: 'HR', fullName: LocaleKeys.humanResource.tr(), active: false, color: [Color(0xff32D892), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'HRSSA', disable: false), WorkListItemTypeModelData( - value: 0, name: 'MO', fullName: LocaleKeys.moveOrder.tr(), active: false, color: [Color(0xff58DCFA), Color(0xff3CB9D5)], icon: "assets/images/miss_swipe.svg", key: 'INVMOA', disable: false), + value: 0, name: 'MR', fullName: LocaleKeys.moveOrder.tr(), active: false, color: [Color(0xff58DCFA), Color(0xff3CB9D5)], icon: "assets/images/miss_swipe.svg", key: 'INVMOA', disable: false), WorkListItemTypeModelData( value: 0, name: 'PR', fullName: LocaleKeys.purchaseRequisition.tr(), active: false, color: [Color(0xff48EACF), Color(0xff3DCAB3)], icon: "assets/images/miss_swipe.svg", key: 'REQAPPRV', disable: false), WorkListItemTypeModelData( diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index db96c53..9a32d30 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -209,6 +209,7 @@ class _WorkListDetailScreenState extends State { workListData: workListData, itemCreationHeader: getItemCreationNtfBody?.itemCreationHeader ?? [], getStampMsNotifications: getStampMsNotifications, + getStampNsNotifications: getStampNsNotifications, getEitCollectionNotificationBodyList: getEitCollectionNotificationBodyList, getPhonesNotificationBodyList: getPhonesNotificationBodyList, getBasicDetNtfBodyList: getBasicDetNtfBodyList, @@ -222,8 +223,8 @@ class _WorkListDetailScreenState extends State { poLinesList: getPoNotificationBody?.pOLines ?? [], itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [], ), - ActionsFragment(workListData!.nOTIFICATIONID, actionHistoryList), - AttachmentsFragment(getAttachmentList), + actionHistoryList.isEmpty ? Utils.getNoDataWidget(context) : ActionsFragment(workListData!.nOTIFICATIONID, actionHistoryList), + getAttachmentList.isEmpty ? Utils.getNoDataWidget(context) : AttachmentsFragment(getAttachmentList), ], ).expanded, if (isApproveAvailable || isRejectAvailable || isCloseAvailable) @@ -232,10 +233,7 @@ class _WorkListDetailScreenState extends State { decoration: const BoxDecoration( color: Colors.white, border: Border( - top: BorderSide( - color: MyColors.lightGreyEFColor, - width: 1.0, - ), + top: BorderSide(color: MyColors.lightGreyEFColor, width: 1.0), ), ), child: Row( @@ -244,29 +242,20 @@ class _WorkListDetailScreenState extends State { DefaultButton( LocaleKeys.reject.tr(), () => performAction("REJECTED"), - colors: const [ - Color(0xffE47A7E), - Color(0xffDE6D71), - ], + colors: const [Color(0xffE47A7E), Color(0xffDE6D71)], ).expanded, if (isApproveAvailable && isRejectAvailable) 8.width, if (isApproveAvailable) DefaultButton( LocaleKeys.approve.tr(), () => performAction("APPROVED"), - colors: const [ - Color(0xff28C884), - Color(0xff1BB271), - ], + colors: const [Color(0xff28C884), Color(0xff1BB271)], ).expanded, if (isCloseAvailable) DefaultButton( LocaleKeys.ok.tr(), () => performAction("CLOSE"), - colors: const [ - Color(0xff32D892), - Color(0xff1AB170), - ], + colors: const [Color(0xff32D892), Color(0xff1AB170)], ).expanded, 8.width, Container( From 0fa88555fb0dd6ca333ea84de66f4ce0215a3f5e Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Thu, 6 Oct 2022 10:36:00 +0300 Subject: [PATCH 04/20] Employee Digital Id Fixed --- lib/classes/consts.dart | 4 ++-- lib/ui/dialogs/id/employee_digital_id_dialog.dart | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 17bd143..12f818e 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,7 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server - // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - static String baseUrl = "https://hmgwebservices.com"; // Live server + static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server + // static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; diff --git a/lib/ui/dialogs/id/employee_digital_id_dialog.dart b/lib/ui/dialogs/id/employee_digital_id_dialog.dart index 7ba6131..da4e2e9 100644 --- a/lib/ui/dialogs/id/employee_digital_id_dialog.dart +++ b/lib/ui/dialogs/id/employee_digital_id_dialog.dart @@ -59,9 +59,9 @@ class EmployeeDigitialIdDialog extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ 12.height, - (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText16(), + (AppState().memberInformationList!.eMPLOYEEDISPLAYNAME ?? "").toText16(), 4.height, - (AppState().memberInformationList!.pOSITIONNAME ?? "").toText12(isBold: false), + (showJobName(AppState().memberInformationList!.pOSITIONNAME ?? "")).toText12(isBold: false), ], ), ), @@ -80,4 +80,14 @@ class EmployeeDigitialIdDialog extends StatelessWidget { ), ); } + + String showJobName(String position){ + try{ + var p=position.split("."); + return p[0]+" "+p[1]; + }catch(e){ + return ""; + } + + } } From e8c8c225c7f4dfd0c737a7e11c58079f07fa34d5 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 6 Oct 2022 10:57:56 +0300 Subject: [PATCH 05/20] icon direction bug fixes --- lib/ui/landing/dashboard_screen.dart | 10 ++- .../screens/mowadhafhi/mowadhafhi_home.dart | 77 ++++++++++--------- lib/ui/work_list/work_list_screen.dart | 17 ++-- 3 files changed, 55 insertions(+), 49 deletions(-) diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 0ddde2f..3722c11 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -18,8 +18,6 @@ import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/landing/widget/app_drawer.dart'; import 'package:mohem_flutter_app/ui/landing/widget/menus_widget.dart'; import 'package:mohem_flutter_app/ui/landing/widget/services_widget.dart'; -import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; -import 'package:mohem_flutter_app/widgets/mark_attendance_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/offers_shimmer_widget.dart'; import 'package:provider/provider.dart'; @@ -218,7 +216,13 @@ class _DashboardScreenState extends State { ), child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), ).onPress(() { - showMyBottomSheet(context, child: MarkAttendanceWidget(model)); + if (AppState().isArabic(context)) { + context.setLocale(const Locale("en", "US")); + } else { + context.setLocale(const Locale("ar", "SA")); + } + + //showMyBottomSheet(context, child: MarkAttendanceWidget(model)); }), ], ), diff --git a/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart b/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart index 0002c51..da54cf7 100644 --- a/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart +++ b/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart @@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:mohem_flutter_app/api/mowadhafhi/mowadhafhi_api_client.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; @@ -53,44 +54,44 @@ class _MowadhafhiHomeState extends State { body: Column( children: [ (getTicketsByEmployeeList == null - ? const SizedBox() - : (getTicketsByEmployeeList!.isEmpty) - ? Utils.getNoDataWidget(context) - : ListView.separated( - physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.all(21), - itemBuilder: (BuildContext context, int index) { - return InkWell( - onTap: () { - Navigator.pushNamed(context, AppRoutes.mowadhafhiDetails, arguments: getTicketsByEmployeeList![index].ticketId); - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - getTicketsByEmployeeList![index].ticketTypeName!.toText14(color: MyColors.darkTextColor).expanded, - getTicketsByEmployeeList![index].created!.split(" ")[0].toText12(color: MyColors.grey70Color), - ], - ), - getTicketsByEmployeeList![index].description!.toText12(color: MyColors.grey57Color), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - getTicketsByEmployeeList![index].ticketStatusInternalName!.toText14(color: MyColors.textMixColor), - SvgPicture.asset( - "assets/images/arrow_next.svg", - color: MyColors.darkIconColor, - ) - ], - ), - ], - ).objectContainerView(), - ); - }, - separatorBuilder: (BuildContext context, int index) => 12.height, - itemCount: getTicketsByEmployeeList!.length)) + ? const SizedBox() + : (getTicketsByEmployeeList!.isEmpty) + ? Utils.getNoDataWidget(context) + : ListView.separated( + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.all(21), + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + Navigator.pushNamed(context, AppRoutes.mowadhafhiDetails, arguments: getTicketsByEmployeeList![index].ticketId); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + getTicketsByEmployeeList![index].ticketTypeName!.toText14(color: MyColors.darkTextColor).expanded, + getTicketsByEmployeeList![index].created!.split(" ")[0].toText12(color: MyColors.grey70Color), + ], + ), + getTicketsByEmployeeList![index].description!.toText12(color: MyColors.grey57Color), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + getTicketsByEmployeeList![index].ticketStatusInternalName!.toText14(color: MyColors.textMixColor), + RotatedBox( + quarterTurns: AppState().isArabic(context) ? 2 : 4, + child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor), + ), + ], + ), + ], + ).objectContainerView(), + ); + }, + separatorBuilder: (BuildContext context, int index) => 12.height, + itemCount: getTicketsByEmployeeList!.length)) .expanded, DefaultButton(LocaleKeys.createRequest.tr(), () async { await Navigator.pushNamed(context, AppRoutes.mowadhafhiHRRequest); diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index aa4301c..8196abb 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -292,10 +292,10 @@ class _WorkListScreenState extends State { Row( children: [ DateUtil.formatDateToDate(DateUtil.convertStringToDate(requestDetails.modifiedDate!), false).toText10(color: MyColors.lightTextColor).expanded, - SvgPicture.asset( - "assets/images/arrow_next.svg", - color: MyColors.darkIconColor, - ) + RotatedBox( + quarterTurns: AppState().isArabic(context) ? 2:4, + child: SvgPicture.asset("assets/images/arrow_next.svg", color:MyColors.darkIconColor) + ), ], ), ], @@ -374,10 +374,11 @@ class _WorkListScreenState extends State { Row( children: [ DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDate(workData.bEGINDATE!), false).toText10(color: MyColors.lightTextColor).expanded, - SvgPicture.asset( - "assets/images/arrow_next.svg", - color: MyColors.darkIconColor, - ) + RotatedBox( + quarterTurns: AppState().isArabic(context) ? 2:4, + child: SvgPicture.asset("assets/images/arrow_next.svg", color:MyColors.darkIconColor) + ), + ], ), ], From 6cd0c4c35817c7b23c6ab3f954287ceb65f95d4d Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 6 Oct 2022 11:12:23 +0300 Subject: [PATCH 06/20] improvement. --- lib/ui/landing/dashboard_screen.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 3722c11..050b78d 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -18,6 +18,8 @@ import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/landing/widget/app_drawer.dart'; import 'package:mohem_flutter_app/ui/landing/widget/menus_widget.dart'; import 'package:mohem_flutter_app/ui/landing/widget/services_widget.dart'; +import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; +import 'package:mohem_flutter_app/widgets/mark_attendance_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/offers_shimmer_widget.dart'; import 'package:provider/provider.dart'; @@ -216,13 +218,13 @@ class _DashboardScreenState extends State { ), child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), ).onPress(() { - if (AppState().isArabic(context)) { - context.setLocale(const Locale("en", "US")); - } else { - context.setLocale(const Locale("ar", "SA")); - } + // if (AppState().isArabic(context)) { + // context.setLocale(const Locale("en", "US")); + // } else { + // context.setLocale(const Locale("ar", "SA")); + // } - //showMyBottomSheet(context, child: MarkAttendanceWidget(model)); + showMyBottomSheet(context, child: MarkAttendanceWidget(model)); }), ], ), From 9f74c3c39adb3e40c19dd7be3350aadf5aa044f9 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 6 Oct 2022 11:54:29 +0300 Subject: [PATCH 07/20] ITG request flow fixed --- lib/api/worklist/worklist_api_client.dart | 34 ++++++- lib/ui/work_list/itg_detail_screen.dart | 53 +++++----- lib/ui/work_list/work_list_screen.dart | 37 ++++++- lib/widgets/dialogs/itg_comments_dialog.dart | 102 +++++++++++++++++++ 4 files changed, 196 insertions(+), 30 deletions(-) create mode 100644 lib/widgets/dialogs/itg_comments_dialog.dart diff --git a/lib/api/worklist/worklist_api_client.dart b/lib/api/worklist/worklist_api_client.dart index f1f9408..91c0db0 100644 --- a/lib/api/worklist/worklist_api_client.dart +++ b/lib/api/worklist/worklist_api_client.dart @@ -296,7 +296,39 @@ class WorkListApiClient { "RequestType": requestType, "TaskID": taskId, "ItemID": itemId, - "EmployeeNumber": "15153", + "EmployeeNumber": employeeNumber, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + ItgFormsModel responseData = ItgFormsModel.fromJson(json); + return responseData.itgRequest; + }, url, postParams); + } + + Future rejectITGRequest(String requestType, int taskId, int itemId, String employeeNumber, String comments) async { + String url = "${ApiConsts.cocRest}ITGRejectRequest"; + Map postParams = { + "RequestType": requestType, + "TaskID": taskId, + "ItemID": itemId, + "EmployeeNumber": employeeNumber, + "Comments": comments, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + ItgFormsModel responseData = ItgFormsModel.fromJson(json); + return responseData.itgRequest; + }, url, postParams); + } + + Future approveITGRequest(String requestType, int taskId, int itemId, String employeeNumber, String comments) async { + String url = "${ApiConsts.cocRest}ITGApproveRequest"; + Map postParams = { + "RequestType": requestType, + "TaskID": taskId, + "ItemID": itemId, + "EmployeeNumber": employeeNumber, + "Comments": comments, }; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index 25eced3..203d6cd 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -16,11 +16,13 @@ import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dar import 'package:mohem_flutter_app/models/itg_forms_models/allowed_actions_model.dart'; import 'package:mohem_flutter_app/models/itg_forms_models/itg_request_model.dart'; import 'package:mohem_flutter_app/models/itg_forms_models/request_detail_model.dart'; +import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/ui/work_list/itg_fragments/approval_level_fragment.dart'; import 'package:mohem_flutter_app/ui/work_list/itg_fragments/request_detail_fragment.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/dialogs/accept_reject_input_dialog.dart'; +import 'package:mohem_flutter_app/widgets/dialogs/itg_comments_dialog.dart'; class ItgDetailScreen extends StatefulWidget { ItgDetailScreen({Key? key}) : super(key: key); @@ -56,22 +58,21 @@ class _ItgDetailScreenState extends State { ITGRequest? itgRequest; void getItgData() async { - // try { + try { Utils.showLoading(context); - itgRequest = await WorkListApiClient().getITGFormDetails(requestDetails!.requestType!, requestDetails!.iD!, requestDetails!.itemID!, ""); + itgRequest = await WorkListApiClient().getITGFormDetails(requestDetails!.requestType!, requestDetails!.iD!, requestDetails!.itemID!, AppState().memberInformationList?.eMPLOYEENUMBER ?? ""); allowedActionList = itgRequest?.allowedActions ?? []; if (allowedActionList.isNotEmpty) { isCloseAvailable = allowedActionList.any((element) => element.action == "CLOSE"); isApproveAvailable = itgRequest!.allowedActions!.any((element) => element.action == "Approve"); - // isAnswerAvailable = itgRequest!.allowedActions!.any((element) => element.action == "Answer"); isRejectAvailable = itgRequest!.allowedActions!.any((element) => element.action == "Reject"); } Utils.hideLoading(context); setState(() {}); - // } catch (ex) { - // Utils.hideLoading(context); - // Utils.handleException(ex, context, null); - // } + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } } void getDataFromState() { @@ -341,37 +342,39 @@ class _ItgDetailScreenState extends State { void performAction(String actionMode) { showDialog( context: context, - builder: (cxt) => AcceptRejectInputDialog( - message: LocaleKeys.requestedItems.tr(), - // notificationGetRespond: notificationNoteInput, + builder: (cxt) => ITGCommentsDialog( + message: LocaleKeys.writeComment.tr(), onTap: (note) { - Map payload = { - "P_ACTION_MODE": actionMode, - "P_APPROVER_INDEX": null, - "P_COMMENTS": "", - "P_FORWARD_TO_USER_NAME": "", - // "P_NOTIFICATION_ID": workListData!.nOTIFICATIONID!, - "RespondAttributeList": [ - // if (notificationNoteInput != null) {notificationNoteInput!.attributeName: note} - ], - }; - - performNotificationAction(payload); + performRejectAction(requestDetails!.requestType!, requestDetails!.iD!, requestDetails!.itemID!, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", note); }, ), ); } - void performNotificationAction(Map payload) async { + void performRejectAction(String requestType, int taskId, int itemId, String employeeNumber, String comments) async { + try { + Utils.showLoading(context); + ITGRequest? itgRequest = await WorkListApiClient().rejectITGRequest(requestType, taskId, itemId, employeeNumber, comments); + Utils.hideLoading(context); + Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); + Navigator.pop(context, "delegate_reload"); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void performApproveAction(String requestType, int taskId, int itemId, String employeeNumber, String comments) async { try { Utils.showLoading(context); - GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload); + ITGRequest? itgRequest = await WorkListApiClient().approveITGRequest(requestType, taskId, itemId, employeeNumber, comments); Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); - Navigator.pop(context, true); + Navigator.pop(context, "delegate_reload"); } 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 c3cc9c6..e3231fa 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -32,17 +32,45 @@ class WorkListScreen extends StatefulWidget { class _WorkListScreenState extends State { List workListItemTypes = [ WorkListItemTypeModelData( - value: 0, name: 'HR', fullName: LocaleKeys.humanResource.tr(), active: false, color: [Color(0xff32D892), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'HRSSA', disable: false), + value: 0, + name: 'HR', + fullName: LocaleKeys.humanResource.tr(), + active: false, + color: [Color(0xff32D892), Color(0xff1AB170)], + icon: "assets/images/miss_swipe.svg", + key: 'HRSSA', + disable: false), WorkListItemTypeModelData( value: 0, name: 'MO', fullName: LocaleKeys.moveOrder.tr(), active: false, color: [Color(0xff58DCFA), Color(0xff3CB9D5)], icon: "assets/images/miss_swipe.svg", key: 'INVMOA', disable: false), WorkListItemTypeModelData( - value: 0, name: 'PR', fullName: LocaleKeys.purchaseRequisition.tr(), active: false, color: [Color(0xff48EACF), Color(0xff3DCAB3)], icon: "assets/images/miss_swipe.svg", key: 'REQAPPRV', disable: false), + value: 0, + name: 'PR', + fullName: LocaleKeys.purchaseRequisition.tr(), + active: false, + color: [Color(0xff48EACF), Color(0xff3DCAB3)], + icon: "assets/images/miss_swipe.svg", + key: 'REQAPPRV', + disable: false), WorkListItemTypeModelData( - value: 0, name: 'PO', fullName: LocaleKeys.purchaseOrder.tr(), active: false, color: [Color(0xff5099E3), Color(0xff3670AA)], icon: "assets/images/miss_swipe.svg", key: 'POAPPRV', disable: false), + value: 0, + name: 'PO', + fullName: LocaleKeys.purchaseOrder.tr(), + active: false, + color: [Color(0xff5099E3), Color(0xff3670AA)], + icon: "assets/images/miss_swipe.svg", + key: 'POAPPRV', + disable: false), WorkListItemTypeModelData( value: 0, name: 'ITG', fullName: LocaleKeys.ITGForms.tr(), active: false, color: [Color(0xffEB8C90), Color(0xffDE6C70)], icon: "assets/images/miss_swipe.svg", key: 'ITG', disable: false), WorkListItemTypeModelData( - value: 0, name: 'IC', fullName: LocaleKeys.itemCreation.tr(), active: false, color: [Color(0xff32D892), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'INVITEM', disable: false), + value: 0, + name: 'IC', + fullName: LocaleKeys.itemCreation.tr(), + active: false, + color: [Color(0xff32D892), Color(0xff1AB170)], + icon: "assets/images/miss_swipe.svg", + key: 'INVITEM', + disable: false), WorkListItemTypeModelData( value: 0, name: 'STAMP', fullName: LocaleKeys.stamp.tr(), active: false, color: [Color(0xff32D892), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'STAMP', disable: false), ]; @@ -232,6 +260,7 @@ class _WorkListScreenState extends State { var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.itgDetail); if (shouldReloadData != null) { if (shouldReloadData.toString() == "delegate_reload") { + providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1; calculateCounter(); getWorkList(); } diff --git a/lib/widgets/dialogs/itg_comments_dialog.dart b/lib/widgets/dialogs/itg_comments_dialog.dart new file mode 100644 index 0000000..b984851 --- /dev/null +++ b/lib/widgets/dialogs/itg_comments_dialog.dart @@ -0,0 +1,102 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/input_widget.dart'; + +class ITGCommentsDialog extends StatelessWidget { + final String? title; + final String? message; + final String? okTitle; + final Function(String) onTap; + + ITGCommentsDialog({Key? key, this.title, @required this.message, this.okTitle, required this.onTap}) : super(key: key); + + String note = ""; + + @override + Widget build(BuildContext context) { + return Dialog( + backgroundColor: Colors.white, + shape: const RoundedRectangleBorder(), + insetPadding: const EdgeInsets.only(left: 21, right: 21), + child: Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.only(top: 16.0), + child: Text( + title ?? LocaleKeys.confirm.tr(), + style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96), + ), + ), + ), + IconButton( + padding: EdgeInsets.zero, + icon: const Icon(Icons.close), + color: const Color(0xff2B353E), + constraints: const BoxConstraints(), + onPressed: () { + Navigator.pop(context); + }, + ) + ], + ), + Text( + message ?? "", + style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff808080), letterSpacing: -0.48), + ), + // if (notificationGetRespond != null) ...[ + 14.height, + InputWidget( + "Enter a Note", + LocaleKeys.comments.tr(), + TextEditingController(), + isBackgroundEnable: true, + isInputTypeNum: false, + lines: 3, + onChange: (String note) { + this.note = note; + }, + ), + // ], + 28.height, + Row( + children: [ + DefaultButton( + LocaleKeys.cancel.tr(), + () => Navigator.pop(context), + colors: const [MyColors.lightGreyEAColor, MyColors.lightGreyEAColor], + textColor: MyColors.darkTextColor, + ).expanded, + 10.width, + DefaultButton( + LocaleKeys.ok.tr(), + () { + Navigator.pop(context); + onTap(note); + }, + colors: const [ + Color(0xff28C884), + Color(0xff1BB271), + ], + ).expanded, + ], + ), + ], + ), + ), + ); + } +} From 4c1927bee503c483cdd6592b69f1bfba610883bd Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 6 Oct 2022 11:55:48 +0300 Subject: [PATCH 08/20] ITG request flow fixed --- lib/ui/work_list/itg_detail_screen.dart | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index 203d6cd..e0c256c 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -11,17 +11,13 @@ import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; -import 'package:mohem_flutter_app/models/generic_response_model.dart'; -import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart'; import 'package:mohem_flutter_app/models/itg_forms_models/allowed_actions_model.dart'; import 'package:mohem_flutter_app/models/itg_forms_models/itg_request_model.dart'; import 'package:mohem_flutter_app/models/itg_forms_models/request_detail_model.dart'; -import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/ui/work_list/itg_fragments/approval_level_fragment.dart'; import 'package:mohem_flutter_app/ui/work_list/itg_fragments/request_detail_fragment.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; -import 'package:mohem_flutter_app/widgets/dialogs/accept_reject_input_dialog.dart'; import 'package:mohem_flutter_app/widgets/dialogs/itg_comments_dialog.dart'; class ItgDetailScreen extends StatefulWidget { @@ -345,7 +341,11 @@ class _ItgDetailScreenState extends State { builder: (cxt) => ITGCommentsDialog( message: LocaleKeys.writeComment.tr(), onTap: (note) { - performRejectAction(requestDetails!.requestType!, requestDetails!.iD!, requestDetails!.itemID!, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", note); + if (actionMode == "APPROVED") { + performApproveAction(requestDetails!.requestType!, requestDetails!.iD!, requestDetails!.itemID!, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", note); + } else { + performRejectAction(requestDetails!.requestType!, requestDetails!.iD!, requestDetails!.itemID!, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", note); + } }, ), ); @@ -376,5 +376,4 @@ class _ItgDetailScreenState extends State { Utils.handleException(ex, context, null); } } - } From 866bb8a29e5faaaec0ce8ea09726b04ec2a0c2aa Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 6 Oct 2022 12:58:03 +0300 Subject: [PATCH 09/20] Pull to refresh, Items for Sale & Offers n Discounts fixes --- lib/provider/dashboard_provider_model.dart | 33 +- lib/ui/landing/dashboard_screen.dart | 454 +++++++++--------- lib/ui/landing/widget/services_widget.dart | 8 +- .../fragments/items_for_sale.dart | 30 +- .../offers_and_discounts_home.dart | 29 +- pubspec.yaml | 1 + 6 files changed, 302 insertions(+), 253 deletions(-) diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index 78ceeaa..b5d5dad 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -72,6 +72,33 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { return true; } + void initProvider() { + isAttendanceTrackingLoading = true; + endTime = 0; + isTimeRemainingInSeconds = 0; + progress = 0.0; + attendanceTracking = null; + + isWorkListLoading = true; + workListCounter = 0; + + isMissingSwipeLoading = true; + missingSwipeCounter = 0; + + isLeaveTicketBalanceLoading = true; + accrualList = null; + leaveBalanceAccrual = null; + + ticketBalance = 0; + isServicesMenusLoading = true; + homeMenus = null; + getMenuEntriesList = null; + isOffersLoading = true; + getOffersList = []; + + notifyListeners(); + } + int calculateSeconds(String time) { int hour = int.parse(time.split(":")[0]); int mints = int.parse(time.split(":")[1]); @@ -81,12 +108,6 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void update(context) { fetchAttendanceTracking(context); - // isAttendanceTrackingLoading = !isAttendanceTrackingLoading; - // isWorkListLoading = !isWorkListLoading; - // attendanceTracking?.pSwipeIn = "a"; - // isTimeRemainingInSeconds = calculateSeconds("00:10:30"); - // endTime = DateTime.now().millisecondsSinceEpoch + Duration(seconds: isTimeRemainingInSeconds).inMilliseconds; - // notifyListeners(); } ItgFormsModel? itgFormsModel; diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 1d8373e..95b39e8 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -23,6 +23,7 @@ import 'package:mohem_flutter_app/widgets/mark_attendance_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/offers_shimmer_widget.dart'; import 'package:provider/provider.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; class DashboardScreen extends StatefulWidget { DashboardScreen({Key? key}) : super(key: key); @@ -37,12 +38,24 @@ class _DashboardScreenState extends State { late DashboardProviderModel data; final GlobalKey _scaffoldState = GlobalKey(); + final RefreshController _refreshController = RefreshController(initialRefresh: false); + int currentIndex = 0; @override void initState() { super.initState(); data = Provider.of(context, listen: false); + _onRefresh(); + } + + @override + void dispose() { + super.dispose(); + } + + void _onRefresh() async { + data.initProvider(); data.fetchListMenu(); data.fetchAttendanceTracking(context); data.fetchWorkListCounter(context); @@ -50,11 +63,7 @@ class _DashboardScreenState extends State { data.fetchLeaveTicketBalance(context, DateTime.now()); data.fetchMenuEntries(); data.getCategoryOffersListAPI(context); - } - - @override - void dispose() { - super.dispose(); + _refreshController.refreshCompleted(); } @override @@ -122,236 +131,243 @@ class _DashboardScreenState extends State { ], ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7), Expanded( - child: SingleChildScrollView( - child: Column( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color), - (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true), - 16.height, - Row( - children: [ - Expanded( - child: AspectRatio( - aspectRatio: 159 / 159, - child: Consumer( - builder: (context, model, child) { - return (model.isAttendanceTrackingLoading - ? GetAttendanceTrackingShimmer() - : Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - gradient: const LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ - MyColors.gradiantEndColor, - MyColors.gradiantStartColor, - ]), - ), - child: Stack( - alignment: Alignment.center, - children: [ - if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), - if (model.isTimeRemainingInSeconds == 0) "01-02-2022".toText12(color: Colors.white), - if (model.isTimeRemainingInSeconds != 0) - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - 9.height, - CountdownTimer( - endTime: model.endTime, - onEnd: null, - endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), - textStyle: TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), - ), - LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), - 9.height, - ClipRRect( - borderRadius: BorderRadius.all( - Radius.circular(20), - ), - child: LinearProgressIndicator( - value: model.progress, - minHeight: 8, - valueColor: const AlwaysStoppedAnimation(Colors.white), - backgroundColor: const Color(0xff196D73), - ), - ), - ], - ), - ], - ).paddingOnly(top: 12, right: 15, left: 12), - ), - Row( + child: SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: const MaterialClassicHeader(color: MyColors.gradiantEndColor,), + controller: _refreshController, + onRefresh: _onRefresh, + child: SingleChildScrollView( + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color), + (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true), + 16.height, + Row( + children: [ + Expanded( + child: AspectRatio( + aspectRatio: 159 / 159, + child: Consumer( + builder: (context, model, child) { + return (model.isAttendanceTrackingLoading + ? GetAttendanceTrackingShimmer() + : Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + gradient: const LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + child: Stack( + alignment: Alignment.center, + children: [ + if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), + if (model.isTimeRemainingInSeconds == 0) "01-02-2022".toText12(color: Colors.white), + if (model.isTimeRemainingInSeconds != 0) + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.checkIn.tr().toText12(color: Colors.white), - (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) - .toString() - .toText14(color: Colors.white, isBold: true), - 4.height, - ], - ).paddingOnly(left: 12), + 9.height, + CountdownTimer( + endTime: model.endTime, + onEnd: null, + endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), + textStyle: TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), ), - Container( - width: 45, - height: 45, - padding: const EdgeInsets.only(left: 14, right: 14), - decoration: const BoxDecoration( - color: Color(0xff259EA4), - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(15), - ), + LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), + 9.height, + ClipRRect( + borderRadius: BorderRadius.all( + Radius.circular(20), ), - child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), - ).onPress(() { - showMyBottomSheet(context, child: MarkAttendanceWidget(model)); - }), + child: LinearProgressIndicator( + value: model.progress, + minHeight: 8, + valueColor: const AlwaysStoppedAnimation(Colors.white), + backgroundColor: const Color(0xff196D73), + ), + ), ], ), - ], + ], + ).paddingOnly(top: 12, right: 15, left: 12), + ), + Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.checkIn.tr().toText12(color: Colors.white), + (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) + .toString() + .toText14(color: Colors.white, isBold: true), + 4.height, + ], + ).paddingOnly(left: 12), ), + Container( + width: 45, + height: 45, + padding: const EdgeInsets.only(left: 14, right: 14), + decoration: const BoxDecoration( + color: Color(0xff259EA4), + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(15), + ), + ), + child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), + ).onPress(() { + showMyBottomSheet(context, child: MarkAttendanceWidget(model)); + }), ], ), - ).onPress( - () { - Navigator.pushNamed(context, AppRoutes.todayAttendance); - }, - )) - .animatedSwither(); - }, + ], + ), + ], + ), + ).onPress( + () { + Navigator.pushNamed(context, AppRoutes.todayAttendance); + }, + )) + .animatedSwither(); + }, + ), ), ), - ), - 9.width, - Expanded( - child: MenusWidget(), - ), - ], - ), - ], - ).paddingOnly(left: 21, right: 21, top: 7), - ServicesWidget(), - // 8.height, - Container( - width: double.infinity, - padding: const EdgeInsets.only(top: 31), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), - border: Border.all(color: MyColors.lightGreyEDColor, width: 1), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ + 9.width, Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - LocaleKeys.offers.tr().toText12(), - Row( - children: [ - LocaleKeys.discounts.tr().toText24(isBold: true), - 6.width, - Container( - padding: const EdgeInsets.only(left: 8, right: 8), - decoration: BoxDecoration( - color: MyColors.yellowColor, - borderRadius: BorderRadius.circular(10), - ), - child: LocaleKeys.newString.tr().toText10(isBold: true)), - ], - ), - ], - ), + child: MenusWidget(), ), - LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() { - Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); - }) ], - ).paddingOnly(left: 21, right: 21), - Consumer( - builder: (context, model, child) { - return SizedBox( - height: 103 + 33, - child: ListView.separated( - shrinkWrap: true, - physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.only(left: 21, right: 21, top: 13), - scrollDirection: Axis.horizontal, - itemBuilder: (cxt, index) { - return model.isOffersLoading - ? const OffersShimmerWidget() - : InkWell( - onTap: () { - navigateToDetails(data.getOffersList[index]); - }, - child: SizedBox( - width: 73, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 73, - height: 73, - decoration: BoxDecoration( - borderRadius: const BorderRadius.all( - Radius.circular(100), - ), - border: Border.all(color: MyColors.lightGreyE3Color, width: 1), - ), - child: ClipRRect( - borderRadius: const BorderRadius.all( - Radius.circular(50), - ), - child: Hero( - tag: "ItemImage" + data.getOffersList[index].rowID!, - transitionOnUserGestures: true, - child: Image.network( - data.getOffersList[index].bannerImage!, - fit: BoxFit.contain, - ), - ), - ), + ), + ], + ).paddingOnly(left: 21, right: 21, top: 7), + ServicesWidget(), + // 8.height, + Container( + width: double.infinity, + padding: const EdgeInsets.only(top: 31), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), + border: Border.all(color: MyColors.lightGreyEDColor, width: 1), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.offers.tr().toText12(), + Row( + children: [ + LocaleKeys.discounts.tr().toText24(isBold: true), + 6.width, + Container( + padding: const EdgeInsets.only(left: 8, right: 8), + decoration: BoxDecoration( + color: MyColors.yellowColor, + borderRadius: BorderRadius.circular(10), + ), + child: LocaleKeys.newString.tr().toText10(isBold: true)), + ], + ), + ], + ), + ), + LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() { + Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); + }) + ], + ).paddingOnly(left: 21, right: 21), + Consumer( + builder: (context, model, child) { + return SizedBox( + height: 103 + 33, + child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.only(left: 21, right: 21, top: 13), + scrollDirection: Axis.horizontal, + itemBuilder: (cxt, index) { + return model.isOffersLoading + ? const OffersShimmerWidget() + : InkWell( + onTap: () { + navigateToDetails(data.getOffersList[index]); + }, + child: SizedBox( + width: 73, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 73, + height: 73, + decoration: BoxDecoration( + borderRadius: const BorderRadius.all( + Radius.circular(100), ), - 4.height, - Expanded( - child: AppState().isArabic(context) - ? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1) - : data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1), + border: Border.all(color: MyColors.lightGreyE3Color, width: 1), + ), + child: ClipRRect( + borderRadius: const BorderRadius.all( + Radius.circular(50), ), - ], + child: Hero( + tag: "ItemImage" + data.getOffersList[index].rowID!, + transitionOnUserGestures: true, + child: Image.network( + data.getOffersList[index].bannerImage!, + fit: BoxFit.contain, + ), + ), + ), ), - ), - ); - }, - separatorBuilder: (cxt, index) => 8.width, - itemCount: 6), - ); - }, - ), - ], - ), - ) - ], + 4.height, + Expanded( + child: AppState().isArabic(context) + ? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1) + : data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1), + ), + ], + ), + ), + ); + }, + separatorBuilder: (cxt, index) => 8.width, + itemCount: 6), + ); + }, + ), + ], + ), + ) + ], + ), ), ), ) diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index e50ec5c..28b505f 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -22,10 +22,10 @@ class ServicesWidget extends StatelessWidget { "assets/images/monthly_attendance.svg", "assets/images/ticket_request.svg", "assets/images/ticket_request.svg", - "assets/images/dynamic_screens.svg", - "assets/images/dynamic_screens.svg", - "assets/images/dynamic_screens.svg", - "assets/images/dynamic_screens.svg" + "assets/images/ticket_request.svg", + "assets/images/ticket_request.svg", + "assets/images/ticket_request.svg", + "assets/images/ticket_request.svg" ]; return Consumer( diff --git a/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart b/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart index 9189f0b..ca75a7a 100644 --- a/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart +++ b/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart @@ -25,6 +25,7 @@ class _ItemsForSaleFragmentState extends State { List getSaleCategoriesList = []; List getItemsForSaleList = []; + List _foundItemsForSaleList = []; ScrollController gridScrollController = ScrollController(); int currentPageNo = 1; @@ -61,20 +62,10 @@ class _ItemsForSaleFragmentState extends State { isInputTypeNum: false, isReadOnly: false, onChange: (String value) { - // _runFilter(value); + _runFilter(value); }, ).paddingOnly(left: 21, right: 21, top: 21), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - LocaleKeys.browseCategories.tr().toText17(), - // todo @haroon define the purpose of this icon button - IconButton( - icon: const Icon(Icons.filter_alt_sharp, color: MyColors.darkIconColor, size: 28.0), - onPressed: () => Navigator.pop(context), - ), - ], - ).paddingOnly(left: 21, right: 21), + LocaleKeys.browseCategories.tr().toText17().paddingOnly(left: 21, right: 21, top: 21), SizedBox( height: 105.0, child: getSaleCategoriesList.isNotEmpty @@ -132,10 +123,22 @@ class _ItemsForSaleFragmentState extends State { ); } + void _runFilter(String enteredKeyword) { + List results = []; + if (enteredKeyword.isEmpty) { + results = getItemsForSaleList; + } else { + results = getItemsForSaleList.where((offer) => offer.title!.toLowerCase().contains(enteredKeyword.toLowerCase())).toList(); + } + setState(() { + _foundItemsForSaleList = results; + }); + } + List getItemsForSaleWidgets() { List itemsList = []; - getItemsForSaleList.forEach((element) { + _foundItemsForSaleList.forEach((element) { itemsList.add(getItemCard(element)); }); @@ -200,6 +203,7 @@ class _ItemsForSaleFragmentState extends State { getItemsForSaleListLocal.clear(); getItemsForSaleListLocal = await ItemsForSaleApiClient().getItemsForSale(itgPageNo, itgCategoryID); getItemsForSaleList.addAll(getItemsForSaleListLocal); + _foundItemsForSaleList = getItemsForSaleList; Utils.hideLoading(context); setState(() {}); } catch (ex) { diff --git a/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart b/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart index fed4583..e33a161 100644 --- a/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart +++ b/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart @@ -25,6 +25,7 @@ class OffersAndDiscountsHome extends StatefulWidget { class _OffersAndDiscountsHomeState extends State { List getCategoriesList = []; List getOffersList = []; + List _foundOffersList = []; int currentCategoryID = 0; @@ -54,18 +55,10 @@ class _OffersAndDiscountsHomeState extends State { isInputTypeNum: false, isReadOnly: false, onChange: (String value) { - // _runFilter(value); + _runFilter(value); }, ).paddingOnly(left: 21, right: 21, top: 21), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - LocaleKeys.browseCategories.tr().toText17(), - const Icon(Icons.filter_alt_sharp, color: MyColors.darkIconColor, size: 28.0).onPress(() { - Navigator.pop(context); - }), - ], - ).paddingOnly(left: 21, right: 21, top: 21), + LocaleKeys.browseCategories.tr().toText17().paddingOnly(left: 21, right: 21, top: 21), SizedBox( height: 110.0, child: getCategoriesList.isNotEmpty @@ -81,6 +74,7 @@ class _OffersAndDiscountsHomeState extends State { onTap: () { setState(() { currentCategoryID = getCategoriesList[index].id!; + getCategoryOffersListAPI(); // getItemsForSaleList.clear(); // currentPageNo = 1; // getItemsForSale(currentPageNo, currentCategoryID); @@ -146,7 +140,7 @@ class _OffersAndDiscountsHomeState extends State { List getItemsForSaleWidgets() { List itemsList = []; - for (var element in getOffersList) { + for (var element in _foundOffersList) { itemsList.add(getItemCard(element)); } @@ -213,6 +207,18 @@ class _OffersAndDiscountsHomeState extends State { ); } + void _runFilter(String enteredKeyword) { + List results = []; + if (enteredKeyword.isEmpty) { + results = getOffersList; + } else { + results = getOffersList.where((offer) => offer.title!.toLowerCase().contains(enteredKeyword.toLowerCase())).toList(); + } + setState(() { + _foundOffersList = results; + }); + } + void navigateToDetails(OffersListModel offersListModelObj) { List getOffersDetailList = []; getOffersDetailList.clear(); @@ -258,6 +264,7 @@ class _OffersAndDiscountsHomeState extends State { try { Utils.showLoading(context); getOffersList = await OffersAndDiscountsApiClient().getOffersList(currentCategoryID, 100); + _foundOffersList = getOffersList; Utils.hideLoading(context); setState(() {}); } catch (ex) { diff --git a/pubspec.yaml b/pubspec.yaml index 14c034a..9a54f6c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -75,6 +75,7 @@ dependencies: url_launcher: ^6.0.15 share: 2.0.4 flutter_rating_bar: ^4.0.1 + pull_to_refresh: ^2.0.0 dev_dependencies: flutter_test: From 13e9c5fa21276db602f97309665e14e35d61b533 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Sun, 9 Oct 2022 11:46:36 +0300 Subject: [PATCH 10/20] centering issue in dynamic list view screen fixed. --- .../dynamic_listview_screen.dart | 67 ++++++++++--------- .../pending_transactions.dart | 5 +- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart index 648f14d..1f03683 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart @@ -60,48 +60,51 @@ class _DynamicListViewScreenState extends State { super.dispose(); } + late bool isTicketRequest; + @override Widget build(BuildContext context) { if (dynamicParams == null) { dynamicParams = ModalRoute.of(context)!.settings.arguments as DynamicListViewParams; + isTicketRequest = dynamicParams!.dynamicId == "HMG_TKT_NEW_EIT_SS"; getTransactions(); } + Widget dataWidget = ListView( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + padding: const EdgeInsets.all(21), + children: [ + // HMG_TKT_NEW_EIT_SS Id used for ticket balance dashboard + if (isTicketRequest) ...[const BalancesDashboardWidget("Current Ticket Balance", false), 12.height], + getEITTransactionList == null + ? const SizedBox() + : (getEITTransactionList!.isEmpty + ? Utils.getNoDataWidget(context).paddingOnly(top: isTicketRequest ? 50 : 0) + : ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (cxt, int parentIndex) => getEITTransactionList![parentIndex].collectionTransaction!.isEmpty + ? const SizedBox() + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + for (int t = 0; t < (getEITTransactionList![parentIndex].collectionTransaction ?? []).length; t++) + if (getEITTransactionList![parentIndex].collectionTransaction![t].dISPLAYFLAG == "Y") + ItemDetailView(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!, + getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""), + ], + ).objectContainerView(), + separatorBuilder: (cxt, index) => 12.height, + itemCount: getEITTransactionList!.length)), + ], + ); + return Scaffold( backgroundColor: Colors.white, appBar: AppBarWidget(context, title: dynamicParams!.title), - body: Center( - child: ListView( - physics: const BouncingScrollPhysics(), - shrinkWrap: true, - padding: const EdgeInsets.all(21), - children: [ - // HMG_TKT_NEW_EIT_SS Id used for ticket balance dashboard - if (dynamicParams!.dynamicId == "HMG_TKT_NEW_EIT_SS") ...[const BalancesDashboardWidget("Current Ticket Balance", false), 12.height], - getEITTransactionList == null - ? const SizedBox() - : (getEITTransactionList!.isEmpty - ? Utils.getNoDataWidget(context) - : ListView.separated( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemBuilder: (cxt, int parentIndex) => getEITTransactionList![parentIndex].collectionTransaction!.isEmpty - ? const SizedBox() - : Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - for (int t = 0; t < (getEITTransactionList![parentIndex].collectionTransaction ?? []).length; t++) - if (getEITTransactionList![parentIndex].collectionTransaction![t].dISPLAYFLAG == "Y") - ItemDetailView(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!, - getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""), - ], - ).objectContainerView(), - separatorBuilder: (cxt, index) => 12.height, - itemCount: getEITTransactionList!.length)), - ], - ), - ), + body: isTicketRequest ? dataWidget : dataWidget.center, floatingActionButton: Container( height: 54, width: 54, diff --git a/lib/ui/screens/pending_transactions/pending_transactions.dart b/lib/ui/screens/pending_transactions/pending_transactions.dart index 0a69c60..da57214 100644 --- a/lib/ui/screens/pending_transactions/pending_transactions.dart +++ b/lib/ui/screens/pending_transactions/pending_transactions.dart @@ -45,7 +45,8 @@ class _PendingTransactionsState extends State { ), body: Column( children: [ - Column( + ListView( + padding: const EdgeInsets.all(21), children: [ PopupMenuButton( child: DynamicTextFieldWidget( @@ -86,7 +87,7 @@ class _PendingTransactionsState extends State { }, ) ], - ).objectContainerView().expanded, + ).expanded, DefaultButton( LocaleKeys.submit.tr(), selectedFunction == null From be506fa0593bd1b59ab47553fd6400a24a210c71 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 9 Oct 2022 14:25:24 +0300 Subject: [PATCH 11/20] fix issues --- assets/langs/ar-SA.json | 11 +++++++- assets/langs/en-US.json | 11 +++++++- lib/generated/codegen_loader.g.dart | 28 ++++++++++++++++--- lib/generated/locale_keys.g.dart | 11 +++++++- lib/models/generic_response_model.dart | 25 +++++++++++++++-- .../add_leave_balance_screen.dart | 2 +- .../leave_balance/leave_balance_screen.dart | 2 +- lib/ui/my_team/team_members.dart | 2 +- lib/ui/profile/add_update_family_member.dart | 15 ++++------ lib/ui/profile/family_members.dart | 4 +-- lib/widgets/balances_dashboard_widget.dart | 21 +++++++------- 11 files changed, 97 insertions(+), 35 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 3f1461b..cf0770b 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -279,7 +279,7 @@ "enterNewInfo": " أدخل معلومات جديدة بسبب تغيير حقيقي في التفاصيل الحالية (على سبيل المثال بسبب تغيير في الحالة الاجتماعية", "endDate": "تاريخ الانتهاء", "removeThisMember": "هل انت متأكد تريد ازالة هذا العضو؟", - "updateThisMember ": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", + "wantUpdateThisMember ": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", "addNewFamilyMember": "اضافة عضو جديد", "addRow": "اضافة صف جديد", "pleaseSelect": "الرجاء اختيار", @@ -407,6 +407,15 @@ "rateUI": ".1 كيف تريد تقييم التطبيق", "submitSurvey":"ارسال الاستبيان", "typeHere": "اكتب هنا", + "currentBalance": "الرصيد الحالي", + "currentLeaveBalance" : "رصيد الاجازات الحالي", + "calculatedDays": "الايام المحسوبه", + "totalDays": "مجموع الأيام", + "usedBalance": "المستخدم", + "infants":"رضيع", + "child":"طفل", + "adult": "بالغ", + "updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 23b7d3e..4208732 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -276,7 +276,7 @@ "enterNewInfo": "Enter new Information because of a real change to the current details (e.g because of a change in marital status)", "endDate": "*End Date", "removeThisMember": "Are You Sure You Want to Remove this Member?", - "updateThisMember": "Are You Sure You Want to Update this Member?", + "wantUpdateThisMember": "Are You Sure You Want to Update this Member?", "addNewFamilyMember": "Add New Family Member", "addRow": "Add new row", "pleaseSelect": "Please Select *", @@ -407,6 +407,15 @@ "rateUI": "1. How would you rate this UI?", "submitSurvey":"Submit Survey", "typeHere": "Type here", + "currentBalance": "Current Balance", + "currentLeaveBalance" : "Current Leave Balance", + "calculatedDays": "Calculated Days", + "totalDays": "Total Days", + "usedBalance": "Used", + "infants":"Infants", + "child":"Child", + "adult": "Adult", + "updateMember": "Are You Sure You Want to Update this Member?", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index f48e420..7cb3e54 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -27,6 +27,7 @@ class CodegenLoader extends AssetLoader{ "lastLoginDetails": "تفاصيل تسجيل الدخول الأخير:", "verificationType": "نوع التحقق:", "pleaseVerify": "ارجوك تحقق", + "pleaseVerifyForBio": "الرجاء التحقق من تسجيل الدخول باستخدام أحد هذه الخيارات", "verifyThroughFace": "تحقق من خلال الوجه", "verifyThroughFingerprint": "تحقق من خلال بصمة الإصبع", "verifyThroughSMS": "تحقق من خلال الرسائل القصيرة", @@ -294,7 +295,7 @@ class CodegenLoader extends AssetLoader{ "enterNewInfo": " أدخل معلومات جديدة بسبب تغيير حقيقي في التفاصيل الحالية (على سبيل المثال بسبب تغيير في الحالة الاجتماعية", "endDate": "تاريخ الانتهاء", "removeThisMember": "هل انت متأكد تريد ازالة هذا العضو؟", - "updateThisMember ": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", + "wantUpdateThisMember ": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", "addNewFamilyMember": "اضافة عضو جديد", "addRow": "اضافة صف جديد", "pleaseSelect": "الرجاء اختيار", @@ -420,8 +421,17 @@ class CodegenLoader extends AssetLoader{ "addFavoriteList": "هل تريد اضافة {name} لقائمة المفضله", "feedbackUserExperience": "هذا للحصول على تعليقات حول تجربة المستخدم", "rateUI": ".1 كيف تريد تقييم التطبيق", - "Submit Survey": "ارسال الاستبيان", + "submitSurvey": "ارسال الاستبيان", "typeHere": "اكتب هنا", + "currentBalance": "الرصيد الحالي", + "currentLeaveBalance": "رصيد الاجازات الحالي", + "calculatedDays": "الايام المحسوبه", + "totalDays": "مجموع الأيام", + "usedBalance": "المستخدم", + "infants": "رضيع", + "child": "طفل", + "adult": "بالغ", + "updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", "profile": { "reset_password": { "label": "Reset Password", @@ -469,6 +479,7 @@ static const Map en_US = { "lastLoginDetails": "Last Login Details:", "verificationType": "Verification Type:", "pleaseVerify": "Please Verify", + "pleaseVerifyForBio": "Please verify login with one of the following options", "verifyThroughFace": "Verify Through Face", "verifyThroughFingerprint": "Verify Through Fingerprint", "verifyThroughSMS": "Verify Through SMS", @@ -733,7 +744,7 @@ static const Map en_US = { "enterNewInfo": "Enter new Information because of a real change to the current details (e.g because of a change in marital status)", "endDate": "*End Date", "removeThisMember": "Are You Sure You Want to Remove this Member?", - "updateThisMember": "Are You Sure You Want to Update this Member?", + "wantUpdateThisMember": "Are You Sure You Want to Update this Member?", "addNewFamilyMember": "Add New Family Member", "addRow": "Add new row", "pleaseSelect": "Please Select *", @@ -862,8 +873,17 @@ static const Map en_US = { "addFavoriteList": "Do you want to add {name} in your favorite list", "feedbackUserExperience": "This is to get the feedback about the user experience", "rateUI": "1. How would you rate this UI?", - "Submit Survey": "Submit Survey", + "submitSurvey": "Submit Survey", "typeHere": "Type here", + "currentBalance": "Current Balance", + "currentLeaveBalance": "Current Leave Balance", + "calculatedDays": "Calculated Days", + "totalDays": "Total Days", + "usedBalance": "Used", + "infants": "Infants", + "child": "Child", + "adult": "Adult", + "updateMember": "Are You Sure You Want to Update this Member?", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 0934ff4..9ede892 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -280,7 +280,7 @@ abstract class LocaleKeys { static const enterNewInfo = 'enterNewInfo'; static const endDate = 'endDate'; static const removeThisMember = 'removeThisMember'; - static const updateThisMember = 'updateThisMember '; + static const wantUpdateThisMember = 'wantUpdateThisMember '; static const addNewFamilyMember = 'addNewFamilyMember'; static const addRow = 'addRow'; static const pleaseSelect = 'pleaseSelect'; @@ -408,6 +408,15 @@ abstract class LocaleKeys { static const rateUI = 'rateUI'; static const submitSurvey = 'submitSurvey'; static const typeHere = 'typeHere'; + static const currentBalance = 'currentBalance'; + static const currentLeaveBalance = 'currentLeaveBalance'; + static const calculatedDays = 'calculatedDays'; + static const totalDays = 'totalDays'; + static const usedBalance = 'usedBalance'; + static const infants = 'infants'; + static const child = 'child'; + static const adult = 'adult'; + static const updateMember = 'updateMember'; 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/models/generic_response_model.dart b/lib/models/generic_response_model.dart index c6c605e..ec37e8f 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -795,9 +795,28 @@ class GenericResponseModel { getContactColsStructureList!.add(GetContactColsStructureList.fromJson(v)); }); } - getContactColsStructureList = json['GetContactColsStructureList']; - getContactDetailsList = json['GetContactDetailsList']; - getContactDffStructureList = json['GetContactDffStructureList']; + + if (json['GetContactColsStructureList'] != null) { + getContactColsStructureList = []; + json['GetContactColsStructureList'].forEach((v) { + getContactColsStructureList!.add(GetContactColsStructureList.fromJson(v)); + }); + } + + if (json['GetContactDetailsList'] != null) { + getContactDetailsList = []; + json['GetContactDetailsList'].forEach((v) { + getContactDetailsList!.add(GetContactDetailsList.fromJson(v)); + }); + } + if (json['GetContactDffStructureList'] != null) { + getContactDffStructureList = []; + json['GetContactDffStructureList'].forEach((v) { + getContactDffStructureList!.add(GetContactDffStructureList.fromJson(v)); + }); + } + // getContactDetailsList = json['GetContactDetailsList']; + // getContactDffStructureList = json['GetContactDffStructureList']; getContactNotificationBodyList = json["GetContactNotificationBodyList"] == null ? null : GetContactNotificationBodyList.fromJson(json["GetContactNotificationBodyList"]); if (json['GetCountriesList'] != null) { diff --git a/lib/ui/leave_balance/add_leave_balance_screen.dart b/lib/ui/leave_balance/add_leave_balance_screen.dart index dc44085..fbb2198 100644 --- a/lib/ui/leave_balance/add_leave_balance_screen.dart +++ b/lib/ui/leave_balance/add_leave_balance_screen.dart @@ -205,7 +205,7 @@ class _AddLeaveBalanceScreenState extends State { ), 12.height, DynamicTextFieldWidget( - "Total Days", + LocaleKeys.totalDays.tr(), totalDays?.toString() ?? "Calculated days", isInputTypeNum: true, isEnable: false, diff --git a/lib/ui/leave_balance/leave_balance_screen.dart b/lib/ui/leave_balance/leave_balance_screen.dart index cb33825..f3a1f91 100644 --- a/lib/ui/leave_balance/leave_balance_screen.dart +++ b/lib/ui/leave_balance/leave_balance_screen.dart @@ -62,7 +62,7 @@ class _LeaveBalanceState extends State { physics: const BouncingScrollPhysics(), padding: const EdgeInsets.all(21), children: [ - const BalancesDashboardWidget("Current Leave Balance", true), + BalancesDashboardWidget(LocaleKeys.currentLeaveBalance.tr(), true), 12.height, absenceTransList == null ? const SizedBox() diff --git a/lib/ui/my_team/team_members.dart b/lib/ui/my_team/team_members.dart index 6240b0e..7ba015f 100644 --- a/lib/ui/my_team/team_members.dart +++ b/lib/ui/my_team/team_members.dart @@ -73,7 +73,7 @@ class _TeamMembersState extends State { var phoneNumber = Uri.parse('tel:${getEmployeeSubordinatesList[index].eMPLOYEEMOBILENUMBER}'); return InkWell( onTap: () async { - // Navigator.pushNamed(context, AppRoutes.employeeDetails, arguments: getEmployeeSubordinatesList[index]); + Navigator.pushNamed(context, AppRoutes.employeeDetails, arguments: getEmployeeSubordinatesList[index]); }, child: Row( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/ui/profile/add_update_family_member.dart b/lib/ui/profile/add_update_family_member.dart index fa01e30..5e5efee 100644 --- a/lib/ui/profile/add_update_family_member.dart +++ b/lib/ui/profile/add_update_family_member.dart @@ -48,7 +48,7 @@ class _AddUpdateFamilyMemberState extends State { } void callAddAndUpdateFamilyMember() async { - try { + try { Utils.showLoading(context); getBasicDetDffStructureList = await ProfileApiClient().getBasicDetDffStructure(); getContactColsStructureList = await ProfileApiClient().getContactColsStructureList(args['actionType']); @@ -199,8 +199,8 @@ class _AddUpdateFamilyMemberState extends State { }); } else { return DynamicTextFieldWidget( - (model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""), - model!.getContactDetailsList!.sEGMENTVALUEDSP ?? "", + (model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : "") , + ( model!.getContactDetailsList!.sEGMENTVALUEDSP ?? "")+ (model!.aPPLICATIONCOLUMNNAME == "NATIONAL_IDENTIFIER" ? "1-1111-1111-1" : ""), onChange: (text) { model!.getContactDetailsList!.sEGMENTVALUEDSP = text; }, @@ -357,7 +357,7 @@ class _AddUpdateFamilyMemberState extends State { void submitUpdateForm() async { - try { + try { List> values1 = getBasicDetDffStructureList!.map((e) { String? dateVal = ''; String? vatcherVal = ''; @@ -418,12 +418,7 @@ class _AddUpdateFamilyMemberState extends State { }).toList(); List> valuesFinal = [...values1, ...values2, ...values3]; Utils.showLoading(context); - if (args['actionType'] == "ADD") { - var relationID = null; - submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(args['actionType'], relationID, valuesFinal); - } else if (args['actionType'] == "UPDATE") { - submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(args['actionType'], args['relationID'], valuesFinal); - } + submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(args['actionType'], args['relationID'] ?? 0, valuesFinal); var transactionId = submitContactTransactionList!.pTRANSACTIONID; var itemKey = submitContactTransactionList!.pITEMKEY; Utils.hideLoading(context); diff --git a/lib/ui/profile/family_members.dart b/lib/ui/profile/family_members.dart index 0a0bb0c..52a6277 100644 --- a/lib/ui/profile/family_members.dart +++ b/lib/ui/profile/family_members.dart @@ -98,7 +98,7 @@ class _FamilyMembersState extends State { recognizer: TapGestureRecognizer() ..onTap = () async { relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt(); - menuEntries.updateButton == 'Y'? showUpdateAlertDialog(context, relationId!.toInt(), 2, LocaleKeys.update.tr()):null; + menuEntries.updateButton == 'Y'? showUpdateAlertDialog(context, relationId!.toInt(), 2, "UPDATE"):null; } ) ], @@ -161,7 +161,7 @@ class _FamilyMembersState extends State { title: Text( LocaleKeys.confirm.tr(), ), - content: Text(LocaleKeys.updateThisMember.tr()), + content: Text(LocaleKeys.updateMember.tr()), actions: [ cancelButton, continueButton, diff --git a/lib/widgets/balances_dashboard_widget.dart b/lib/widgets/balances_dashboard_widget.dart index 2fd4b52..e546acf 100644 --- a/lib/widgets/balances_dashboard_widget.dart +++ b/lib/widgets/balances_dashboard_widget.dart @@ -8,6 +8,7 @@ import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/dashboard/get_accrual_balances_list_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:pie_chart/pie_chart.dart'; @@ -64,14 +65,14 @@ class _BalancesDashboardWidgetState extends State { if (widget.isLeaveBalance) { leaveBalanceAccrual = accrualList[0]; chartModelList = [ - PieChartModel("Current Balance", leaveBalanceAccrual?.accrualNetEntitlement ?? 0, MyColors.textMixColor, titleAppend: ""), - PieChartModel("Used", leaveBalanceAccrual?.accrualUsedEntitlement?.toDouble() ?? 0, MyColors.backgroundBlackColor, titleAppend: ""), + PieChartModel(LocaleKeys.currentBalance.tr(), leaveBalanceAccrual?.accrualNetEntitlement ?? 0, MyColors.textMixColor, titleAppend: ""), + PieChartModel(LocaleKeys.usedBalance.tr(), leaveBalanceAccrual?.accrualUsedEntitlement?.toDouble() ?? 0, MyColors.backgroundBlackColor, titleAppend: ""), ]; } else { chartModelList = [ - PieChartModel("Adult", accrualList[1].accrualNetEntitlement ?? 0, MyColors.textMixColor, titleAppend: ""), - PieChartModel("Child", accrualList[2].accrualNetEntitlement?.toDouble() ?? 0, MyColors.backgroundBlackColor, titleAppend: ""), - PieChartModel("infants", accrualList[3].accrualNetEntitlement?.toDouble() ?? 0, MyColors.pinkColor, titleAppend: ""), + PieChartModel(LocaleKeys.adult.tr(), accrualList[1].accrualNetEntitlement ?? 0, MyColors.textMixColor, titleAppend: ""), + PieChartModel(LocaleKeys.child.tr(), accrualList[2].accrualNetEntitlement?.toDouble() ?? 0, MyColors.backgroundBlackColor, titleAppend: ""), + PieChartModel(LocaleKeys.infants.tr(), accrualList[3].accrualNetEntitlement?.toDouble() ?? 0, MyColors.pinkColor, titleAppend: ""), ]; } } @@ -88,8 +89,8 @@ class _BalancesDashboardWidgetState extends State { if (leaveBalanceAccrual == null && widget.isLeaveBalance) { leaveBalanceAccrual = Provider.of(context, listen: false).leaveBalanceAccrual; chartModelList = [ - PieChartModel("Current Balance", leaveBalanceAccrual?.accrualNetEntitlement ?? 0, MyColors.textMixColor, titleAppend: ""), - PieChartModel("Used", leaveBalanceAccrual?.accrualUsedEntitlement?.toDouble() ?? 0, MyColors.backgroundBlackColor, titleAppend: ""), + PieChartModel(LocaleKeys.currentBalance.tr(), leaveBalanceAccrual?.accrualNetEntitlement ?? 0, MyColors.textMixColor, titleAppend: ""), + PieChartModel(LocaleKeys.usedBalance.tr(), leaveBalanceAccrual?.accrualUsedEntitlement?.toDouble() ?? 0, MyColors.backgroundBlackColor, titleAppend: ""), ]; } @@ -97,9 +98,9 @@ class _BalancesDashboardWidgetState extends State { ticketBalanceAccrualList = Provider.of(context, listen: false).accrualList ?? []; if (ticketBalanceAccrualList!.isNotEmpty) { chartModelList = [ - PieChartModel("Adult", ticketBalanceAccrualList![1].accrualNetEntitlement ?? 0, MyColors.textMixColor, titleAppend: ""), - PieChartModel("Child", ticketBalanceAccrualList![2].accrualNetEntitlement?.toDouble() ?? 0, MyColors.backgroundBlackColor, titleAppend: ""), - PieChartModel("infants", ticketBalanceAccrualList![3].accrualNetEntitlement?.toDouble() ?? 0, MyColors.pinkColor, titleAppend: ""), + PieChartModel(LocaleKeys.adult.tr(), ticketBalanceAccrualList![1].accrualNetEntitlement ?? 0, MyColors.textMixColor, titleAppend: ""), + PieChartModel(LocaleKeys.child.tr(), ticketBalanceAccrualList![2].accrualNetEntitlement?.toDouble() ?? 0, MyColors.backgroundBlackColor, titleAppend: ""), + PieChartModel(LocaleKeys.infants.tr(), ticketBalanceAccrualList![3].accrualNetEntitlement?.toDouble() ?? 0, MyColors.pinkColor, titleAppend: ""), ]; } } From ba8e272885673c0ac3503f92215c3132db3ce485 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 10 Oct 2022 11:17:16 +0300 Subject: [PATCH 12/20] pull to refresh added on worklist screen. --- lib/ui/work_list/work_list_screen.dart | 130 ++++++++++++++----------- 1 file changed, 72 insertions(+), 58 deletions(-) diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index dcdd580..8db019c 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -19,6 +19,7 @@ import 'package:mohem_flutter_app/models/worklist_response_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:provider/provider.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; class WorkListScreen extends StatefulWidget { WorkListScreen({Key? key}) : super(key: key); @@ -82,6 +83,8 @@ class _WorkListScreenState extends State { late DashboardProviderModel providerData; + final RefreshController _refreshController = RefreshController(initialRefresh: false); + @override void initState() { super.initState(); @@ -137,6 +140,11 @@ class _WorkListScreenState extends State { } } + void _onRefresh() async { + getWorkList(); + _refreshController.refreshCompleted(); + } + @override void dispose() { super.dispose(); @@ -177,6 +185,7 @@ class _WorkListScreenState extends State { workListItemIndex = index; if (workListItemTypes[index].value == 0) { workList = []; + itgRequestTypeIndex = null; } else { workList = null; } @@ -195,58 +204,70 @@ class _WorkListScreenState extends State { ), ).paddingOnly(top: 21, bottom: 21), workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21), - if (itgRequestTypeIndex != null) - SizedBox( - height: 40, - child: ListView.separated( - itemBuilder: (context, index) { - RequestType type = itgFormsModel!.requestType![index]; - return Container( - padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8), - alignment: Alignment.center, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor), - child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black), - ).onPress(() { - if (itgRequestTypeIndex != index) { - itgRequestTypeIndex = index; - setState(() {}); - } - }); - }, - separatorBuilder: (context, index) => 8.width, - shrinkWrap: true, - itemCount: itgFormsModel?.requestType?.length ?? 0, - scrollDirection: Axis.horizontal, - padding: const EdgeInsets.only(left: 21, right: 21), + SmartRefresher( + enablePullDown: true, + enablePullUp: false, + header: const MaterialClassicHeader( + color: MyColors.gradiantEndColor, ), - ).paddingOnly(top: 16, bottom: 16), - itgRequestTypeIndex != null - ? Expanded( - child: ListView.separated( - physics: BouncingScrollPhysics(), - itemBuilder: (context, index) { - return itgRowItem(workListItemTypes[workListItemIndex], itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails![index], index); - }, - separatorBuilder: (context, index) => 12.height, - itemCount: itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails?.length ?? 0, - padding: const EdgeInsets.all(21), - ), - ) - : Expanded( - child: workList != null - ? ((workList!).isEmpty - ? LocaleKeys.noHistoryAvailable.tr().toText16().center - : ListView.separated( - physics: const BouncingScrollPhysics(), + controller: _refreshController, + onRefresh: _onRefresh, + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: itgRequestTypeIndex != null + ? Column( + children: [ + SizedBox( + height: 40, + child: ListView.separated( itemBuilder: (context, index) { - return rowItem(workListItemTypes[workListItemIndex], workList![index], index); + RequestType type = itgFormsModel!.requestType![index]; + return Container( + padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8), + alignment: Alignment.center, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor), + child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black), + ).onPress(() { + if (itgRequestTypeIndex != index) { + itgRequestTypeIndex = index; + setState(() {}); + } + }); }, - separatorBuilder: (context, index) => 12.height, - itemCount: workList?.length ?? 0, - padding: const EdgeInsets.all(21), - )) - : const SizedBox(), - ), + separatorBuilder: (context, index) => 8.width, + shrinkWrap: true, + itemCount: itgFormsModel?.requestType?.length ?? 0, + scrollDirection: Axis.horizontal, + padding: const EdgeInsets.only(left: 21, right: 21), + ), + ).paddingOnly(top: 16, bottom: 16), + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + return itgRowItem(workListItemTypes[workListItemIndex], itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails![index], index); + }, + separatorBuilder: (context, index) => 12.height, + itemCount: itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails?.length ?? 0, + padding: const EdgeInsets.all(21), + ), + ], + ) + : workList != null + ? ((workList!).isEmpty + ? Utils.getNoDataWidget(context).paddingOnly(top: 100) + : ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + return rowItem(workListItemTypes[workListItemIndex], workList![index], index); + }, + separatorBuilder: (context, index) => 12.height, + itemCount: workList?.length ?? 0, + padding: const EdgeInsets.all(21), + )) + : const SizedBox(), + )).expanded, ], ), ), @@ -321,10 +342,7 @@ class _WorkListScreenState extends State { Row( children: [ DateUtil.formatDateToDate(DateUtil.convertStringToDate(requestDetails.modifiedDate!), false).toText10(color: MyColors.lightTextColor).expanded, - RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color:MyColors.darkIconColor) - ), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor)), ], ), ], @@ -403,11 +421,7 @@ class _WorkListScreenState extends State { Row( children: [ DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDate(workData.bEGINDATE!), false).toText10(color: MyColors.lightTextColor).expanded, - RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color:MyColors.darkIconColor) - ), - + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor)), ], ), ], From d6315b067423d8c220adec7867fbc277a65d238b Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 10 Oct 2022 12:40:26 +0300 Subject: [PATCH 13/20] fixes. --- lib/ui/work_list/work_list_screen.dart | 6 +- .../attachments_fragment.dart | 10 +- lib/ui/work_list/worklist_settings.dart | 179 ++++++++---------- 3 files changed, 84 insertions(+), 111 deletions(-) diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index 8db019c..2fa5156 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -165,11 +165,7 @@ class _WorkListScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.infinity, - height: 1, - color: MyColors.lightGreyEFColor, - ), + Container(width: double.infinity, height: 1, color: MyColors.lightGreyEFColor), SizedBox( height: 40, child: ListView.separated( diff --git a/lib/ui/work_list/worklist_fragments/attachments_fragment.dart b/lib/ui/work_list/worklist_fragments/attachments_fragment.dart index 0497823..ebc3db9 100644 --- a/lib/ui/work_list/worklist_fragments/attachments_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/attachments_fragment.dart @@ -28,9 +28,12 @@ class AttachmentsFragment extends StatelessWidget { (getAttachmentList[index].fILENAME?.capitalizeFirstofEach ?? "").toText16().expanded, ], ).objectContainerView().onPress(() async { - // print("calling"); - // String path = await _createFileFromString(getAttachmentList[index].fILEDATA ?? "", getAttachmentList[index].fILECONTENTTYPE ?? ""); - // OpenFile.open(path); + try { + String path = await _createFileFromString(getAttachmentList[index].fILEDATA ?? "", getAttachmentList[index].fILECONTENTTYPE ?? ""); + OpenFile.open(path); + } catch (ex) { + debugPrint("FileErorr:$ex"); + } }); }, separatorBuilder: (BuildContext context, int index) => 12.height, @@ -67,7 +70,6 @@ class AttachmentsFragment extends StatelessWidget { String dir = (await getApplicationDocumentsDirectory()).path; File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext); await file.writeAsBytes(bytes); - // print(file.path); return file.path; } } diff --git a/lib/ui/work_list/worklist_settings.dart b/lib/ui/work_list/worklist_settings.dart index 7bdec80..77c1d81 100644 --- a/lib/ui/work_list/worklist_settings.dart +++ b/lib/ui/work_list/worklist_settings.dart @@ -1,4 +1,3 @@ - import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -6,6 +5,7 @@ import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; @@ -15,7 +15,7 @@ import 'package:mohem_flutter_app/models/worklist/update_user_type_list.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; -class WorklistSettings extends StatefulWidget { +class WorklistSettings extends StatefulWidget { const WorklistSettings({Key? key}) : super(key: key); @override @@ -26,7 +26,6 @@ class _WorklistSettingsState extends State { List getUserItemTypesList = []; UpdateUserItemTypesList? updateUserItemTypesList; - void initState() { super.initState(); userItemTypesList(); @@ -47,10 +46,9 @@ class _WorklistSettingsState extends State { void updateUserItem() async { try { Utils.showLoading(context); - List> itemList=[]; + List> itemList = []; for (var element in getUserItemTypesList) { - itemList.add(UpdateUserTypesList(itemID: element.uSERITEMTYPEID, pITEMTYPE: element.iTEMTYPE,pFYAENABLEDFALG: element.fYAENABLEDFALG, pFYIENABLEDFALG: element.fYIENABLEDFLAG).toJson()); - + itemList.add(UpdateUserTypesList(itemID: element.uSERITEMTYPEID, pITEMTYPE: element.iTEMTYPE, pFYAENABLEDFALG: element.fYAENABLEDFALG, pFYIENABLEDFALG: element.fYIENABLEDFLAG).toJson()); } updateUserItemTypesList = await WorkListApiClient().updateUserItemTypes(itemList); Utils.hideLoading(context); @@ -64,115 +62,92 @@ class _WorklistSettingsState extends State { @override Widget build(BuildContext context) { - return Scaffold(backgroundColor: Colors.white, + return Scaffold( + backgroundColor: Colors.white, appBar: AppBarWidget( context, title: LocaleKeys.worklistSettings.tr(), ), - body:ListView( + body: Column( children: [ - Expanded( - child: Container( - margin: const EdgeInsets.only(top: 21, left: 21, right: 21), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + ListView( + padding: const EdgeInsets.only(top: 21, left: 21, right: 21), + children: [ + LocaleKeys.TurnNotificationsFor.tr().toText22(color: MyColors.blackColor), + 16.height, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Container( - child: LocaleKeys.TurnNotificationsFor.tr().toText22(color: MyColors.blackColor), - ).paddingOnly(top: 10, bottom: 50), + LocaleKeys.itemType.tr().toText14(color: MyColors.blackColor), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: LocaleKeys.itemType.tr().toText14(color: MyColors.blackColor) , - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - child: "FYA".tr().toText14(color: MyColors.blackColor) , - ), - Container( - child: "FYI".tr().toText14(color: MyColors.blackColor) , - ).paddingOnly(left: 30, right: 30), - ], - ) - ], - ), - Divider(color: MyColors.greyA5Color,), - SingleChildScrollView( - scrollDirection: Axis.vertical, - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: getUserItemTypesList == null ? 0 : getUserItemTypesList.length, - itemBuilder: (BuildContext context,int index) { - return Column( - children:[ - customSwitch(getUserItemTypesList[index]), - Divider( - color: MyColors.greyC4Color, - thickness: 0.5,), - ]); - } - ), - ), + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: ["FYA".tr().toText14(color: MyColors.blackColor), 30.width, "FYI".tr().toText14(color: MyColors.blackColor), 30.width], + ) ], ), - ), - ), - DefaultButton( - LocaleKeys.save.tr(), () async { + const Divider(color: MyColors.greyA5Color), + SingleChildScrollView( + scrollDirection: Axis.vertical, + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: getUserItemTypesList == null ? 0 : getUserItemTypesList.length, + itemBuilder: (BuildContext context, int index) { + return Column(children: [ + customSwitch(getUserItemTypesList[index]), + Divider( + color: MyColors.greyC4Color, + thickness: 0.5, + ), + ]); + }), + ), + ], + ).expanded, + DefaultButton(LocaleKeys.save.tr(), () async { updateUserItem(); }).insideContainer, ], - ) - - ); + )); } - - Widget customSwitch(GetUserItemTypesList list){ - return Padding( - padding: const EdgeInsets.only(top: 21), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(list.iTEMTYPE.toString(), style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: MyColors.blackColor - ),), - const Spacer(), - Row( - children: [ - CupertinoSwitch( - trackColor: Colors.grey, - activeColor: MyColors.gradiantEndColor, - value: list?.fYAENABLEDFALG =='Y' ?true : false, - onChanged: (value){ - setState(() { - list?.fYAENABLEDFALG = value == true ? 'Y': 'N'; - }); - } - ), - CupertinoSwitch( - trackColor: Colors.grey, - activeColor: MyColors.gradiantEndColor, - value: list?.fYIENABLEDFLAG =='Y' ?true : false, - onChanged: (value){ - setState(() { - // list.isFYI = value; - list?.fYIENABLEDFLAG = value ==true ? 'Y': 'N'; - }); - } - ), - ], - ) - ], - ), - ); + Widget customSwitch(GetUserItemTypesList list) { + return Padding( + padding: const EdgeInsets.only(top: 21), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + list.iTEMTYPE.toString(), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.blackColor), + ), + const Spacer(), + Row( + children: [ + CupertinoSwitch( + trackColor: MyColors.grey57Color, + activeColor: MyColors.textMixColor, + value: list?.fYAENABLEDFALG == 'Y' ? true : false, + onChanged: (value) { + setState(() { + list?.fYAENABLEDFALG = value == true ? 'Y' : 'N'; + }); + }), + CupertinoSwitch( + trackColor: MyColors.grey57Color, + activeColor: MyColors.textMixColor, + value: list?.fYIENABLEDFLAG == 'Y' ? true : false, + onChanged: (value) { + setState(() { + // list.isFYI = value; + list?.fYIENABLEDFLAG = value == true ? 'Y' : 'N'; + }); + }), + ], + ) + ], + ), + ); } - } From 8d9561b570e72a67d2e37f8e6479439d77d46c8e Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Tue, 11 Oct 2022 11:55:47 +0300 Subject: [PATCH 14/20] COC changes --- ios/Runner.xcodeproj/project.pbxproj | 9 + lib/api/api_client.dart | 115 +++- lib/api/dashboard_api_client.dart | 31 +- lib/classes/consts.dart | 2 +- .../mohemm_itg_pending_task_responseitem.dart | 44 ++ lib/models/generic_response_model.dart | 514 +++++++++++++----- lib/provider/dashboard_provider_model.dart | 93 +++- lib/ui/work_list/work_list_screen.dart | 197 +++++-- 8 files changed, 766 insertions(+), 239 deletions(-) create mode 100644 lib/models/dashboard/mohemm_itg_pending_task_responseitem.dart diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index bd3e603..2646e3b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -379,6 +379,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = 99Z3UD3LJM; ENABLE_BITCODE = NO; @@ -391,6 +393,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.cloudsolutions.mohemmtest; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -510,6 +513,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = 99Z3UD3LJM; ENABLE_BITCODE = NO; @@ -522,6 +527,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.cloudsolutions.mohemmtest; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -536,6 +542,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = 99Z3UD3LJM; ENABLE_BITCODE = NO; @@ -548,6 +556,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.cloudsolutions.mohemmtest; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index 1a035a2..7a6f668 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -18,7 +18,8 @@ class APIError { APIError(this.errorCode, this.errorMessage); - Map toJson() => {'errorCode': errorCode, 'errorMessage': errorMessage}; + Map toJson() => + {'errorCode': errorCode, 'errorMessage': errorMessage}; @override String toString() { @@ -53,7 +54,8 @@ APIException _throwAPIException(Response response) { return APIException(APIException.INTERNAL_SERVER_ERROR); case 444: var downloadUrl = response.headers["location"]; - return APIException(APIException.UPGRADE_REQUIRED, arguments: downloadUrl); + return APIException(APIException.UPGRADE_REQUIRED, + arguments: downloadUrl); default: return APIException(APIException.OTHER); } @@ -66,8 +68,13 @@ class ApiClient { factory ApiClient() => _instance; - Future postJsonForObject(FactoryConstructor factoryConstructor, String url, T jsonObject, - {String? token, Map? queryParameters, Map? headers, int retryTimes = 0, bool isFormData = false}) async { + Future postJsonForObject( + FactoryConstructor factoryConstructor, String url, T jsonObject, + {String? token, + Map? queryParameters, + Map? headers, + int retryTimes = 0, + bool isFormData = false}) async { var _headers = {'Accept': 'application/json'}; if (headers != null && headers.isNotEmpty) { _headers.addAll(headers); @@ -77,7 +84,12 @@ class ApiClient { var bodyJson = json.encode(jsonObject); print("body:$bodyJson"); } - var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes, isFormData: isFormData); + var response = await postJsonForResponse(url, jsonObject, + token: token, + queryParameters: queryParameters, + headers: _headers, + retryTimes: retryTimes, + isFormData: isFormData); // try { if (!kReleaseMode) { logger.i("res: " + response.body); @@ -90,7 +102,8 @@ class ApiClient { return factoryConstructor(jsonData); } else { APIError? apiError; - apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage']); + apiError = + APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage']); throw APIException(APIException.BAD_REQUEST, error: apiError); } // } catch (ex) { @@ -103,7 +116,11 @@ class ApiClient { } Future postJsonForResponse(String url, T jsonObject, - {String? token, Map? queryParameters, Map? headers, int retryTimes = 0, bool isFormData = false}) async { + {String? token, + Map? queryParameters, + Map? headers, + int retryTimes = 0, + bool isFormData = false}) async { String? requestBody; late Map stringObj; if (jsonObject != null) { @@ -117,13 +134,22 @@ class ApiClient { if (isFormData) { headers = {'Content-Type': 'application/x-www-form-urlencoded'}; - stringObj = ((jsonObject ?? {}) as Map).map((key, value) => MapEntry(key, value?.toString() ?? "")); + stringObj = ((jsonObject ?? {}) as Map) + .map((key, value) => MapEntry(key, value?.toString() ?? "")); } - return await _postForResponse(url, isFormData ? stringObj : requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes); + return await _postForResponse(url, isFormData ? stringObj : requestBody, + token: token, + queryParameters: queryParameters, + headers: headers, + retryTimes: retryTimes); } - Future _postForResponse(String url, requestBody, {String? token, Map? queryParameters, Map? headers, int retryTimes = 0}) async { + Future _postForResponse(String url, requestBody, + {String? token, + Map? queryParameters, + Map? headers, + int retryTimes = 0}) async { try { var _headers = {}; if (token != null) { @@ -138,7 +164,9 @@ class ApiClient { var queryString = new Uri(queryParameters: queryParameters).query; url = url + '?' + queryString; } - var response = await _post(Uri.parse(url), body: requestBody, headers: _headers).timeout(Duration(seconds: 60)); + var response = + await _post(Uri.parse(url), body: requestBody, headers: _headers) + .timeout(Duration(seconds: 120)); if (response.statusCode >= 200 && response.statusCode < 300) { return response; @@ -149,7 +177,11 @@ class ApiClient { if (retryTimes > 0) { print('will retry after 3 seconds...'); await Future.delayed(Duration(seconds: 3)); - return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + return await _postForResponse(url, requestBody, + token: token, + queryParameters: queryParameters, + headers: headers, + retryTimes: retryTimes - 1); } else { throw APIException(APIException.OTHER, arguments: e); } @@ -157,7 +189,11 @@ class ApiClient { if (retryTimes > 0) { print('will retry after 3 seconds...'); await Future.delayed(Duration(seconds: 3)); - return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + return await _postForResponse(url, requestBody, + token: token, + queryParameters: queryParameters, + headers: headers, + retryTimes: retryTimes - 1); } else { throw APIException(APIException.OTHER, arguments: e); } @@ -167,23 +203,39 @@ class ApiClient { if (retryTimes > 0) { print('will retry after 3 seconds...'); await Future.delayed(Duration(seconds: 3)); - return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + return await _postForResponse(url, requestBody, + token: token, + queryParameters: queryParameters, + headers: headers, + retryTimes: retryTimes - 1); } else { throw APIException(APIException.OTHER, arguments: e); } } } - Future getJsonForResponse(String url, {String? token, Map? queryParameters, Map? headers, int retryTimes = 0}) async { + Future getJsonForResponse(String url, + {String? token, + Map? queryParameters, + Map? headers, + int retryTimes = 0}) async { if (headers == null) { headers = {'Content-Type': 'application/json'}; } else { headers['Content-Type'] = 'application/json'; } - return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes); + return await _getForResponse(url, + token: token, + queryParameters: queryParameters, + headers: headers, + retryTimes: retryTimes); } - Future _getForResponse(String url, {String? token, Map? queryParameters, Map? headers, int retryTimes = 0}) async { + Future _getForResponse(String url, + {String? token, + Map? queryParameters, + Map? headers, + int retryTimes = 0}) async { try { var _headers = {}; if (token != null) { @@ -198,7 +250,8 @@ class ApiClient { var queryString = new Uri(queryParameters: queryParameters).query; url = url + '?' + queryString; } - var response = await _get(Uri.parse(url), headers: _headers).timeout(Duration(seconds: 60)); + var response = await _get(Uri.parse(url), headers: _headers) + .timeout(Duration(seconds: 60)); if (response.statusCode >= 200 && response.statusCode < 300) { return response; @@ -209,7 +262,11 @@ class ApiClient { if (retryTimes > 0) { print('will retry after 3 seconds...'); await Future.delayed(Duration(seconds: 3)); - return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + return await _getForResponse(url, + token: token, + queryParameters: queryParameters, + headers: headers, + retryTimes: retryTimes - 1); } else { throw APIException(APIException.OTHER, arguments: e); } @@ -217,7 +274,11 @@ class ApiClient { if (retryTimes > 0) { print('will retry after 3 seconds...'); await Future.delayed(Duration(seconds: 3)); - return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + return await _getForResponse(url, + token: token, + queryParameters: queryParameters, + headers: headers, + retryTimes: retryTimes - 1); } else { throw APIException(APIException.OTHER, arguments: e); } @@ -227,14 +288,19 @@ class ApiClient { if (retryTimes > 0) { print('will retry after 3 seconds...'); await Future.delayed(Duration(seconds: 3)); - return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + return await _getForResponse(url, + token: token, + queryParameters: queryParameters, + headers: headers, + retryTimes: retryTimes - 1); } else { throw APIException(APIException.OTHER, arguments: e); } } } - Future _get(url, {Map? headers}) => _withClient((client) => client.get(url, headers: headers)); + Future _get(url, {Map? headers}) => + _withClient((client) => client.get(url, headers: headers)); bool _certificateCheck(X509Certificate cert, String host, int port) => true; @@ -248,5 +314,8 @@ class ApiClient { } } - Future _post(url, {Map? headers, body, Encoding? encoding}) => _withClient((client) => client.post(url, headers: headers, body: body, encoding: encoding)); + Future _post(url, + {Map? headers, body, Encoding? encoding}) => + _withClient((client) => + client.post(url, headers: headers, body: body, encoding: encoding)); } diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart index 214ea05..dd3f182 100644 --- a/lib/api/dashboard_api_client.dart +++ b/lib/api/dashboard_api_client.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:mohem_flutter_app/api/api_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/consts.dart'; +import 'package:mohem_flutter_app/classes/date_uitl.dart'; import 'package:mohem_flutter_app/models/dashboard/get_accrual_balances_list_model.dart'; import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; @@ -37,6 +38,20 @@ class DashboardApiClient { }, url, postParams); } + Future getCOCNotifications() async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_ReviewerAdmin_Pending_Tasks"; + Map postParams = { + "Date": DateUtil.getISODateFormat(DateTime.now()), + "EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER + }; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + Future getItgFormsPendingTask() async { String url = "${ApiConsts.cocRest}ITGFormsPendingTasks"; Map postParams = {}; @@ -47,7 +62,8 @@ class DashboardApiClient { }, url, postParams); } - Future> getAccrualBalances(String effectiveDate) async { + Future> getAccrualBalances( + String effectiveDate) async { String url = "${ApiConsts.erpRest}GET_ACCRUAL_BALANCES"; Map postParams = {"P_EFFECTIVE_DATE": effectiveDate}; postParams.addAll(AppState().postParamsJson); @@ -81,7 +97,10 @@ class DashboardApiClient { //GET_MENU_ENTRIES Future getGetMenuEntries() async { String url = "${ApiConsts.erpRest}GET_MENU_ENTRIES"; - Map postParams = {"P_SELECTED_RESP_ID": -999, "P_MENU_TYPE": "E"}; + Map postParams = { + "P_SELECTED_RESP_ID": -999, + "P_MENU_TYPE": "E" + }; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); @@ -90,7 +109,13 @@ class DashboardApiClient { } //Mark Attendance - Future markAttendance({String lat = "0", String? long = "0", required int pointType, String nfcValue = "", bool isGpsRequired = false, String QRValue = ""}) async { + Future markAttendance( + {String lat = "0", + String? long = "0", + required int pointType, + String nfcValue = "", + bool isGpsRequired = false, + String QRValue = ""}) async { String url = "${ApiConsts.swpRest}AuthenticateAndSwipeUserSupportNFC"; var uuid = Uuid(); // Generate a v4 (random) id diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 645aaf8..12f818e 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -23,4 +23,4 @@ class SharedPrefsConsts { static String mohemmWifiSSID = "mohemmWifiSSID"; static String mohemmWifiPassword = "mohemmWifiPassword"; static String editItemForSale = "editItemForSale"; -} \ No newline at end of file +} diff --git a/lib/models/dashboard/mohemm_itg_pending_task_responseitem.dart b/lib/models/dashboard/mohemm_itg_pending_task_responseitem.dart new file mode 100644 index 0000000..c4c300a --- /dev/null +++ b/lib/models/dashboard/mohemm_itg_pending_task_responseitem.dart @@ -0,0 +1,44 @@ +class MohemmITGPendingTaskResponseItem { + int? escalation; + int? exceedTAT; + int? extendTATRequest; + int? open; + int? pendningWithReviewer; + int? waitingForAcceptance; + int? waitingToClose; + int? withInTAT; + + MohemmITGPendingTaskResponseItem( + {this.escalation, + this.exceedTAT, + this.extendTATRequest, + this.open, + this.pendningWithReviewer, + this.waitingForAcceptance, + this.waitingToClose, + this.withInTAT}); + + MohemmITGPendingTaskResponseItem.fromJson(Map json) { + escalation = json['escalation']; + exceedTAT = json['exceedTAT']; + extendTATRequest = json['extendTATRequest']; + open = json['open']; + pendningWithReviewer = json['pendningWithReviewer']; + waitingForAcceptance = json['waitingForAcceptance']; + waitingToClose = json['waitingToClose']; + withInTAT = json['withInTAT']; + } + + Map toJson() { + Map data = new Map(); + data['escalation'] = this.escalation; + data['exceedTAT'] = this.exceedTAT; + data['extendTATRequest'] = this.extendTATRequest; + data['open'] = this.open; + data['pendningWithReviewer'] = this.pendningWithReviewer; + data['waitingForAcceptance'] = this.waitingForAcceptance; + data['waitingToClose'] = this.waitingToClose; + data['withInTAT'] = this.withInTAT; + return data; + } +} diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index c6c605e..bca78fe 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -7,6 +7,7 @@ import 'package:mohem_flutter_app/models/dashboard/get_open_missing_swipes_list_ import 'package:mohem_flutter_app/models/dashboard/get_open_notifications_list.dart'; import 'package:mohem_flutter_app/models/dashboard/list_menu.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; +import 'package:mohem_flutter_app/models/dashboard/mohemm_itg_pending_task_responseitem.dart'; import 'package:mohem_flutter_app/models/get_absence_collection_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_approves_list_model.dart'; @@ -153,7 +154,8 @@ class GenericResponseModel { List? getConcurrentProgramsList; List? getAbsenceAttachmentsList; List? getAbsenceAttendanceTypesList; - List? getAbsenceCollectionNotificationBodyList; + List? + getAbsenceCollectionNotificationBodyList; List? getAbsenceDffStructureList; List? getAbsenceTransactionList; List? getAccrualBalancesList; @@ -178,7 +180,8 @@ class GenericResponseModel { List? getDayHoursTypeDetailsList; List? getDeductionsList; GetDefaultValueList? getDefaultValueList; - List? getEITCollectionNotificationBodyList; + List? + getEITCollectionNotificationBodyList; List? getEITDFFStructureList; List? getEITTransactionList; List? getEarningsList; @@ -232,7 +235,8 @@ class GenericResponseModel { List? getCCPDFFStructureModel; List? getSubordinatesAttdStatusList; List? getSubordinatesLeavesList; - List? getSubordinatesLeavesTotalVacationsList; + List? + getSubordinatesLeavesTotalVacationsList; List? getSummaryOfPaymentList; List? getSwipesList; List? getTermColsStructureList; @@ -247,6 +251,7 @@ class GenericResponseModel { List? getMowadhafhiProjects; List? getProjectDepartments; List? getDepartmentSections; + MohemmITGPendingTaskResponseItem? mohemmITGPendingTaskResponseItem; List? getPendingTransactionsFunctions; List? getPendingTransactionsDetails; List? getUserItemTypesList; @@ -293,7 +298,8 @@ class GenericResponseModel { String? mohemmWifiPassword; String? mohemmWifiSSID; NotificationAction? notificationAction; - List? notificationGetRespondAttributesList; + List? + notificationGetRespondAttributesList; List? notificationRespondRolesList; int? oracleOutPutNumber; String? pASSWORDEXPIREDMSG; @@ -664,13 +670,22 @@ class GenericResponseModel { addAttSuccessList!.add(AddAttSuccessList.fromJson(v)); }); } - addAttachmentList = json['AddAttachment_List'] != null ? AddAttachmentList.fromJson(json['AddAttachment_List']) : null; + addAttachmentList = json['AddAttachment_List'] != null + ? AddAttachmentList.fromJson(json['AddAttachment_List']) + : null; bCDomain = json['BC_Domain']; bCLogo = json['BC_Logo']; - basicMemberInformation = json['BasicMemberInformation'] != null ? BasicMemberInformationModel.fromJson(json['BasicMemberInformation']) : null; + basicMemberInformation = json['BasicMemberInformation'] != null + ? BasicMemberInformationModel.fromJson(json['BasicMemberInformation']) + : null; businessCardPrivilege = json['BusinessCardPrivilege']; - calculateAbsenceDuration = json['CalculateAbsenceDuration'] != null ? new CalculateAbsenceDuration.fromJson(json['CalculateAbsenceDuration']) : null; - cancelHRTransactionLIst = json['CancelHRTransactionLIst'] != null ? new CancelHRTransactionLIst.fromJson(json['CancelHRTransactionLIst']) : null; + calculateAbsenceDuration = json['CalculateAbsenceDuration'] != null + ? new CalculateAbsenceDuration.fromJson( + json['CalculateAbsenceDuration']) + : null; + cancelHRTransactionLIst = json['CancelHRTransactionLIst'] != null + ? new CancelHRTransactionLIst.fromJson(json['CancelHRTransactionLIst']) + : null; chatEmployeeLoginList = json['Chat_EmployeeLoginList']; companyBadge = json['CompanyBadge']; companyImage = json['CompanyImage']; @@ -685,7 +700,9 @@ class GenericResponseModel { }); } - createVacationRuleList = json['CreateVacationRuleList'] != null ? CreateVacationRuleList.fromJson(json['CreateVacationRuleList']) : null; + createVacationRuleList = json['CreateVacationRuleList'] != null + ? CreateVacationRuleList.fromJson(json['CreateVacationRuleList']) + : null; deleteAttachmentList = json['DeleteAttachmentList']; deleteVacationRuleList = json['DeleteVacationRuleList']; disableSessionList = json['DisableSessionList']; @@ -696,14 +713,17 @@ class GenericResponseModel { if (json['GetAbsenceAttendanceTypesList'] != null) { getAbsenceAttendanceTypesList = []; json['GetAbsenceAttendanceTypesList'].forEach((v) { - getAbsenceAttendanceTypesList!.add(GetAbsenceAttendanceTypesList.fromJson(v)); + getAbsenceAttendanceTypesList! + .add(GetAbsenceAttendanceTypesList.fromJson(v)); }); } if (json['GetAbsenceCollectionNotificationBodyList'] != null) { - getAbsenceCollectionNotificationBodyList = []; + getAbsenceCollectionNotificationBodyList = + []; json['GetAbsenceCollectionNotificationBodyList'].forEach((v) { - getAbsenceCollectionNotificationBodyList!.add(GetAbsenceCollectionNotificationBodyList.fromJson(v)); + getAbsenceCollectionNotificationBodyList! + .add(GetAbsenceCollectionNotificationBodyList.fromJson(v)); }); } @@ -721,7 +741,10 @@ class GenericResponseModel { }); } - getAccrualBalancesList = json["GetAccrualBalancesList"] == null ? null : List.from(json["GetAccrualBalancesList"].map((x) => GetAccrualBalancesList.fromJson(x))); + getAccrualBalancesList = json["GetAccrualBalancesList"] == null + ? null + : List.from(json["GetAccrualBalancesList"] + .map((x) => GetAccrualBalancesList.fromJson(x))); if (json['GetActionHistoryList'] != null) { getActionHistoryList = []; @@ -751,18 +774,22 @@ class GenericResponseModel { getAttachementList!.add(GetAttachementList.fromJson(v)); }); } - getAttendanceTrackingList = json["GetAttendanceTrackingList"] == null ? null : GetAttendanceTracking.fromMap(json["GetAttendanceTrackingList"]); + getAttendanceTrackingList = json["GetAttendanceTrackingList"] == null + ? null + : GetAttendanceTracking.fromMap(json["GetAttendanceTrackingList"]); if (json['GetBasicDetColsStructureList'] != null) { getBasicDetColsStructureList = []; json['GetBasicDetColsStructureList'].forEach((v) { - getBasicDetColsStructureList!.add(GetBasicDetColsStructureList.fromJson(v)); + getBasicDetColsStructureList! + .add(GetBasicDetColsStructureList.fromJson(v)); }); } // getBasicDetDffStructureList = json['GetBasicDetDffStructureList']; if (json['GetBasicDetDffStructureList'] != null) { getBasicDetDffStructureList = []; json['GetBasicDetDffStructureList'].forEach((v) { - getBasicDetDffStructureList!.add(GetBasicDetDffStructureList.fromJson(v)); + getBasicDetDffStructureList! + .add(GetBasicDetDffStructureList.fromJson(v)); }); } if (json['GetContactDffStructureList'] != null) { @@ -779,7 +806,8 @@ class GenericResponseModel { }); } - getCEICollectionNotificationBodyList = json['GetCEICollectionNotificationBodyList']; + getCEICollectionNotificationBodyList = + json['GetCEICollectionNotificationBodyList']; getCEIDFFStructureList = json['GetCEIDFFStructureList']; getCEITransactionList = json['GetCEITransactionList']; getCcpTransactionsList = json['GetCcpTransactionsList']; @@ -792,13 +820,18 @@ class GenericResponseModel { if (json['GetContactColsStructureList'] != null) { getContactColsStructureList = []; json['GetContactColsStructureList'].forEach((v) { - getContactColsStructureList!.add(GetContactColsStructureList.fromJson(v)); + getContactColsStructureList! + .add(GetContactColsStructureList.fromJson(v)); }); } getContactColsStructureList = json['GetContactColsStructureList']; getContactDetailsList = json['GetContactDetailsList']; getContactDffStructureList = json['GetContactDffStructureList']; - getContactNotificationBodyList = json["GetContactNotificationBodyList"] == null ? null : GetContactNotificationBodyList.fromJson(json["GetContactNotificationBodyList"]); + getContactNotificationBodyList = + json["GetContactNotificationBodyList"] == null + ? null + : GetContactNotificationBodyList.fromJson( + json["GetContactNotificationBodyList"]); if (json['GetCountriesList'] != null) { getCountriesList = []; @@ -820,10 +853,15 @@ class GenericResponseModel { getDeductionsList!.add(GetDeductionsList.fromJson(v)); }); } - getDefaultValueList = json['GetDefaultValueList'] != null ? GetDefaultValueList.fromJson(json['GetDefaultValueList']) : null; - getEITCollectionNotificationBodyList = json["GetEITCollectionNotificationBodyList"] == null - ? null - : List.from(json["GetEITCollectionNotificationBodyList"].map((x) => GetEitCollectionNotificationBodyList.fromJson(x))); + getDefaultValueList = json['GetDefaultValueList'] != null + ? GetDefaultValueList.fromJson(json['GetDefaultValueList']) + : null; + getEITCollectionNotificationBodyList = + json["GetEITCollectionNotificationBodyList"] == null + ? null + : List.from( + json["GetEITCollectionNotificationBodyList"].map( + (x) => GetEitCollectionNotificationBodyList.fromJson(x))); if (json['GetEITDFFStructureList'] != null) { getEITDFFStructureList = []; json['GetEITDFFStructureList'].forEach((v) { @@ -852,7 +890,8 @@ class GenericResponseModel { if (json['GetEmployeeBasicDetailsList'] != null) { getEmployeeBasicDetailsList = []; json['GetEmployeeBasicDetailsList'].forEach((v) { - getEmployeeBasicDetailsList!.add(GetEmployeeBasicDetailsList.fromJson(v)); + getEmployeeBasicDetailsList! + .add(GetEmployeeBasicDetailsList.fromJson(v)); }); } if (json['GetEmployeeContactsList'] != null) { @@ -870,25 +909,34 @@ class GenericResponseModel { if (json['GetEmployeeSubordinatesList'] != null) { getEmployeeSubordinatesList = []; json['GetEmployeeSubordinatesList'].forEach((v) { - getEmployeeSubordinatesList!.add(new GetEmployeeSubordinatesList.fromJson(v)); + getEmployeeSubordinatesList! + .add(new GetEmployeeSubordinatesList.fromJson(v)); }); } getFliexfieldStructureList = json['GetFliexfieldStructureList']; - getHrCollectionNotificationBodyList = json['GetHrCollectionNotificationBodyList']; + getHrCollectionNotificationBodyList = + json['GetHrCollectionNotificationBodyList']; getHrTransactionList = json['GetHrTransactionList']; - getItemCreationNtfBodyList = json['GetItemCreationNtfBodyList'] != null ? GetItemCreationNtfBodyList.fromJson(json['GetItemCreationNtfBodyList']) : null; + getItemCreationNtfBodyList = json['GetItemCreationNtfBodyList'] != null + ? GetItemCreationNtfBodyList.fromJson( + json['GetItemCreationNtfBodyList']) + : null; if (json['GetItemTypeNotificationsList'] != null) { getItemTypeNotificationsList = []; json['GetItemTypeNotificationsList'].forEach((v) { - getItemTypeNotificationsList!.add(GetItemTypeNotificationsList.fromJson(v)); + getItemTypeNotificationsList! + .add(GetItemTypeNotificationsList.fromJson(v)); }); } getItemTypesList = json['GetItemTypesList']; getLookupValuesList = json['GetLookupValuesList']; - getMenuEntriesList = json["GetMenuEntriesList"] == null ? null : List.from(json["GetMenuEntriesList"].map((x) => GetMenuEntriesList.fromJson(x))); + getMenuEntriesList = json["GetMenuEntriesList"] == null + ? null + : List.from(json["GetMenuEntriesList"] + .map((x) => GetMenuEntriesList.fromJson(x))); if (json['GetMoItemHistoryList'] != null) { getMoItemHistoryList = []; json['GetMoItemHistoryList'].forEach((v) { @@ -913,7 +961,8 @@ class GenericResponseModel { if (json['GetNotificationReassignModeList'] != null) { getNotificationReassignModeList = []; json['GetNotificationReassignModeList'].forEach((v) { - getNotificationReassignModeList!.add(GetNotificationReassignModeList.fromJson(v)); + getNotificationReassignModeList! + .add(GetNotificationReassignModeList.fromJson(v)); }); } @@ -924,8 +973,13 @@ class GenericResponseModel { }); } - getOpenMissingSwipesList = json["GetOpenMissingSwipesList"] == null ? null : GetOpenMissingSwipesList.fromJson(json["GetOpenMissingSwipesList"]); - getOpenNotificationsList = json["GetOpenNotificationsList"] == null ? null : List.from(json["GetOpenNotificationsList"].map((x) => GetOpenNotificationsList.fromMap(x))); + getOpenMissingSwipesList = json["GetOpenMissingSwipesList"] == null + ? null + : GetOpenMissingSwipesList.fromJson(json["GetOpenMissingSwipesList"]); + getOpenNotificationsList = json["GetOpenNotificationsList"] == null + ? null + : List.from(json["GetOpenNotificationsList"] + .map((x) => GetOpenNotificationsList.fromMap(x))); getOpenNotificationsNumList = json['GetOpenNotificationsNumList']; getOpenPeriodDatesList = json['GetOpenPeriodDatesList']; getOrganizationsSalariesList = json['GetOrganizationsSalariesList']; @@ -945,17 +999,26 @@ class GenericResponseModel { } // getPendingReqDetailsList = json['GetPendingReqDetailsList']; // getPendingReqFunctionsList = json['GetPendingReqFunctionsList']; - getPerformanceAppraisalList = - json['GetPerformanceAppraisalList'] == null ? null : List.from(json["GetPerformanceAppraisalList"].map((x) => GetPerformanceAppraisalList.fromJson(x))); + getPerformanceAppraisalList = json['GetPerformanceAppraisalList'] == null + ? null + : List.from( + json["GetPerformanceAppraisalList"] + .map((x) => GetPerformanceAppraisalList.fromJson(x))); getPhonesNotificationBodyList = - json["GetPhonesNotificationBodyList"] == null ? null : List.from(json["GetPhonesNotificationBodyList"].map((x) => GetPhonesNotificationBodyList.fromJson(x))); + json["GetPhonesNotificationBodyList"] == null + ? null + : List.from( + json["GetPhonesNotificationBodyList"] + .map((x) => GetPhonesNotificationBodyList.fromJson(x))); if (json['GetPoItemHistoryList'] != null) { getPoItemHistoryList = []; json['GetPoItemHistoryList'].forEach((v) { getPoItemHistoryList!.add(GetPoItemHistoryList.fromJson(v)); }); } - getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null; + getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null + ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) + : null; getPrNotificationBodyList = json['GetPrNotificationBodyList']; if (json['GetQuotationAnalysisList'] != null) { getQuotationAnalysisList = []; @@ -965,13 +1028,15 @@ class GenericResponseModel { } getRFCEmployeeListList = json['GetRFCEmployeeListList']; getRespondAttributeValueList = json['GetRespondAttributeValueList']; - getSITCollectionNotificationBodyList = json['GetSITCollectionNotificationBodyList']; + getSITCollectionNotificationBodyList = + json['GetSITCollectionNotificationBodyList']; getSITDFFStructureList = json['GetSITDFFStructureList']; getSITTransactionList = json['GetSITTransactionList']; if (json['GetScheduleShiftsDetailsList'] != null) { getScheduleShiftsDetailsList = []; json['GetScheduleShiftsDetailsList'].forEach((v) { - getScheduleShiftsDetailsList!.add(GetScheduleShiftsDetailsList.fromJson(v)); + getScheduleShiftsDetailsList! + .add(GetScheduleShiftsDetailsList.fromJson(v)); }); } getShiftTypesList = json['GetShiftTypesList']; @@ -979,13 +1044,15 @@ class GenericResponseModel { if (json['GetStampMsNotificationBodyList'] != null) { getStampMsNotificationBodyList = []; json['GetStampMsNotificationBodyList'].forEach((v) { - getStampMsNotificationBodyList!.add(GetStampMsNotificationBodyList.fromJson(v)); + getStampMsNotificationBodyList! + .add(GetStampMsNotificationBodyList.fromJson(v)); }); } if (json['GetStampNsNotificationBodyList'] != null) { getStampNsNotificationBodyList = []; json['GetStampNsNotificationBodyList'].forEach((v) { - getStampNsNotificationBodyList!.add(GetStampNsNotificationBodyList.fromJson(v)); + getStampNsNotificationBodyList! + .add(GetStampNsNotificationBodyList.fromJson(v)); }); } @@ -999,9 +1066,11 @@ class GenericResponseModel { } if (json['GetSubordinatesLeavesTotalVacationsList'] != null) { - getSubordinatesLeavesTotalVacationsList = []; + getSubordinatesLeavesTotalVacationsList = + []; json['GetSubordinatesLeavesTotalVacationsList'].forEach((v) { - getSubordinatesLeavesTotalVacationsList!.add(new GetSubordinatesLeavesTotalVacationsList.fromJson(v)); + getSubordinatesLeavesTotalVacationsList! + .add(new GetSubordinatesLeavesTotalVacationsList.fromJson(v)); }); } if (json['GetSummaryOfPaymentList'] != null) { @@ -1070,7 +1139,11 @@ class GenericResponseModel { getDepartmentSections!.add(GetDepartmentSections.fromJson(v)); }); } - + if (json['Mohemm_ITG_Pending_Task_ResponseItem'] != null) { + mohemmITGPendingTaskResponseItem = + MohemmITGPendingTaskResponseItem.fromJson( + json['Mohemm_ITG_Pending_Task_ResponseItem']); + } if (json['Mohemm_ITG_SectionTopicsList'] != null) { getSectionTopics = []; json['Mohemm_ITG_SectionTopicsList'].forEach((v) { @@ -1081,14 +1154,16 @@ class GenericResponseModel { if (json['GetPendingReqFunctionsList'] != null) { getPendingTransactionsFunctions = []; json['GetPendingReqFunctionsList'].forEach((v) { - getPendingTransactionsFunctions!.add(GetPendingTransactionsFunctions.fromJson(v)); + getPendingTransactionsFunctions! + .add(GetPendingTransactionsFunctions.fromJson(v)); }); } if (json['GetPendingReqDetailsList'] != null) { getPendingTransactionsDetails = []; json['GetPendingReqDetailsList'].forEach((v) { - getPendingTransactionsDetails!.add(GetPendingTransactionsDetails.fromJson(v)); + getPendingTransactionsDetails! + .add(GetPendingTransactionsDetails.fromJson(v)); }); } @@ -1167,7 +1242,10 @@ class GenericResponseModel { listItemImagesDetails = json['List_ItemImagesDetails']; listItemMaster = json['List_ItemMaster']; listMedicineDetails = json['List_MedicineDetails']; - listMenu = json["List_Menu"] == null ? [] : List.from(json["List_Menu"].map((x) => ListMenu.fromJson(x))); + listMenu = json["List_Menu"] == null + ? [] + : List.from( + json["List_Menu"].map((x) => ListMenu.fromJson(x))); listNewEmployees = json['List_NewEmployees']; listRadScreen = json['List_RadScreen']; logInTokenID = json['LogInTokenID']; @@ -1177,29 +1255,44 @@ class GenericResponseModel { memberInformationList!.add(MemberInformationListModel.fromJson(v)); }); } - memberLoginList = json['MemberLoginList'] != null ? MemberLoginListModel.fromJson(json['MemberLoginList']) : null; - mohemmGetBusinessCardEnabledList = json['Mohemm_GetBusinessCardEnabledList']; + memberLoginList = json['MemberLoginList'] != null + ? MemberLoginListModel.fromJson(json['MemberLoginList']) + : null; + mohemmGetBusinessCardEnabledList = + json['Mohemm_GetBusinessCardEnabledList']; mohemmGetFavoriteReplacementsList = - json["Mohemm_GetFavoriteReplacementsList"] == null ? null : List.from(json["Mohemm_GetFavoriteReplacementsList"].map((x) => GetFavoriteReplacements.fromJson(x))); - - mohemmGetMobileDeviceInfobyEmpInfoList = json['Mohemm_GetMobileDeviceInfobyEmpInfoList']; + json["Mohemm_GetFavoriteReplacementsList"] == null + ? null + : List.from( + json["Mohemm_GetFavoriteReplacementsList"] + .map((x) => GetFavoriteReplacements.fromJson(x))); + + mohemmGetMobileDeviceInfobyEmpInfoList = + json['Mohemm_GetMobileDeviceInfobyEmpInfoList']; if (json['Mohemm_GetMobileLoginInfoList'] != null) { mohemmGetMobileLoginInfoList = []; json['Mohemm_GetMobileLoginInfoList'].forEach((v) { - mohemmGetMobileLoginInfoList!.add(GetMobileLoginInfoListModel.fromJson(v)); + mohemmGetMobileLoginInfoList! + .add(GetMobileLoginInfoListModel.fromJson(v)); }); } mohemmGetPatientIDList = json['Mohemm_GetPatientID_List']; mohemmITGResponseItem = json['Mohemm_ITG_ResponseItem']; - mohemmIsChangeIsActiveBusinessCardEnable = json['Mohemm_IsChangeIsActiveBusinessCardEnable']; - mohemmIsInsertBusinessCardEnable = json['Mohemm_IsInsertBusinessCardEnable']; + mohemmIsChangeIsActiveBusinessCardEnable = + json['Mohemm_IsChangeIsActiveBusinessCardEnable']; + mohemmIsInsertBusinessCardEnable = + json['Mohemm_IsInsertBusinessCardEnable']; mohemmWifiPassword = json['Mohemm_Wifi_Password']; mohemmWifiSSID = json['Mohemm_Wifi_SSID']; - notificationAction = json['NotificationAction'] != null ? NotificationAction.fromJson(json['NotificationAction']) : null; + notificationAction = json['NotificationAction'] != null + ? NotificationAction.fromJson(json['NotificationAction']) + : null; if (json['NotificationGetRespondAttributesList'] != null) { - notificationGetRespondAttributesList = []; + notificationGetRespondAttributesList = + []; json['NotificationGetRespondAttributesList'].forEach((v) { - notificationGetRespondAttributesList!.add(NotificationGetRespondAttributesList.fromJson(v)); + notificationGetRespondAttributesList! + .add(NotificationGetRespondAttributesList.fromJson(v)); }); } @@ -1224,7 +1317,8 @@ class GenericResponseModel { pQUESTION = json['P_QUESTION']; pSESSIONID = json['P_SESSION_ID']; pSchema = json['P_Schema']; - pharmacyStockAddPharmacyStockList = json['PharmacyStock_AddPharmacyStockList']; + pharmacyStockAddPharmacyStockList = + json['PharmacyStock_AddPharmacyStockList']; pharmacyStockGetOnHandList = json['PharmacyStock_GetOnHandList']; if (json['Privilege_List'] != null) { @@ -1236,7 +1330,10 @@ class GenericResponseModel { processTransactions = json['ProcessTransactions']; registerUserNameList = json['RegisterUserNameList']; - replacementList = json["ReplacementList"] == null ? null : List.from(json["ReplacementList"].map((x) => ReplacementList.fromJson(x))); + replacementList = json["ReplacementList"] == null + ? null + : List.from( + json["ReplacementList"].map((x) => ReplacementList.fromJson(x))); if (json['RespondAttributesList'] != null) { respondAttributesList = []; @@ -1255,26 +1352,51 @@ class GenericResponseModel { resubmitHrTransactionList = json['ResubmitHrTransactionList']; sFHGetPoNotificationBodyList = json['SFH_GetPoNotificationBodyList']; sFHGetPrNotificationBodyList = json['SFH_GetPrNotificationBodyList']; - startAbsenceApprovalProccess = json['StartAbsenceApprovalProccess'] != null ? StartAbsenceApprovalProccess.fromJson(json['StartAbsenceApprovalProccess']) : null; - startAddressApprovalProcessList = json['StartAddressApprovalProcessList'] != null ? StartAddressApprovalProcess.fromJson(json['StartAddressApprovalProcessList']) : null; + startAbsenceApprovalProccess = json['StartAbsenceApprovalProccess'] != null + ? StartAbsenceApprovalProccess.fromJson( + json['StartAbsenceApprovalProccess']) + : null; + startAddressApprovalProcessList = + json['StartAddressApprovalProcessList'] != null + ? StartAddressApprovalProcess.fromJson( + json['StartAddressApprovalProcessList']) + : null; startBasicDetApprProcessList = json['StartBasicDetApprProcessList']; startCeiApprovalProcess = json['StartCeiApprovalProcess']; startContactApprovalProcessList = json['StartContactApprovalProcessList']; - startEitApprovalProcess = json['StartEitApprovalProcess'] != null ? StartEitApprovalProcess.fromJson(json['StartEitApprovalProcess']) : null; + startEitApprovalProcess = json['StartEitApprovalProcess'] != null + ? StartEitApprovalProcess.fromJson(json['StartEitApprovalProcess']) + : null; startHrApprovalProcessList = json['StartHrApprovalProcessList']; - startPhonesApprovalProcessList = json['StartPhonesApprovalProcessList'] != null ? StartPhoneApprovalProcess.fromJson(json['startPhonesApprovalProcessList']) : null; + startPhonesApprovalProcessList = + json['StartPhonesApprovalProcessList'] != null + ? StartPhoneApprovalProcess.fromJson( + json['startPhonesApprovalProcessList']) + : null; startSitApprovalProcess = json['StartSitApprovalProcess']; startTermApprovalProcessList = json['StartTermApprovalProcessList']; - submitAddressTransactionList = json['SubmitAddressTransactionList'] != null ? SubmitAddressTransaction.fromJson(json['SubmitAddressTransactionList']) : null; - submitBasicDetTransactionList = json['SubmitBasicDetTransactionList'] != null ? SubmitBasicDetailsTransactionList.fromJson(json['SubmitBasicDetTransactionList']) : null; + submitAddressTransactionList = json['SubmitAddressTransactionList'] != null + ? SubmitAddressTransaction.fromJson( + json['SubmitAddressTransactionList']) + : null; + submitBasicDetTransactionList = + json['SubmitBasicDetTransactionList'] != null + ? SubmitBasicDetailsTransactionList.fromJson( + json['SubmitBasicDetTransactionList']) + : null; submitCEITransactionList = json['SubmitCEITransactionList']; submitCcpTransactionList = json['SubmitCcpTransactionList']; - submitContactTransactionList = json['SubmitContactTransactionList'] != null ? SubmitContactTransactionList.fromJson(json['SubmitContactTransactionList']) : null; - submitEITTransactionList = json['SubmitEITTransactionList'] != null ? SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) : null; + submitContactTransactionList = json['SubmitContactTransactionList'] != null + ? SubmitContactTransactionList.fromJson( + json['SubmitContactTransactionList']) + : null; + submitEITTransactionList = json['SubmitEITTransactionList'] != null + ? SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) + : null; submitHrTransactionList = json['SubmitHrTransactionList']; submitPhonesTransactionList = json['SubmitPhonesTransactionList']; @@ -1289,7 +1411,10 @@ class GenericResponseModel { }); } - sumbitAbsenceTransactionList = json['SumbitAbsenceTransactionList'] != null ? new SumbitAbsenceTransactionList.fromJson(json['SumbitAbsenceTransactionList']) : null; + sumbitAbsenceTransactionList = json['SumbitAbsenceTransactionList'] != null + ? new SumbitAbsenceTransactionList.fromJson( + json['SumbitAbsenceTransactionList']) + : null; tokenID = json['TokenID']; updateAttachmentList = json['UpdateAttachmentList']; @@ -1297,10 +1422,13 @@ class GenericResponseModel { if (json['UpdateItemTypeSuccessList'] != null) { updateItemTypeSuccessList = []; json['UpdateItemTypeSuccessList'].forEach((v) { - updateItemTypeSuccessList!.add(new UpdateItemTypeSuccessList.fromJson(v)); + updateItemTypeSuccessList! + .add(new UpdateItemTypeSuccessList.fromJson(v)); }); } - updateUserItemTypesList = json['UpdateUserItemTypesList'] != null ? new UpdateUserItemTypesList.fromJson(json['UpdateUserItemTypesList']) : null; + updateUserItemTypesList = json['UpdateUserItemTypesList'] != null + ? new UpdateUserItemTypesList.fromJson(json['UpdateUserItemTypesList']) + : null; updateVacationRuleList = json['UpdateVacationRuleList']; vHREmployeeLoginList = json['VHR_EmployeeLoginList']; vHRGetEmployeeDetailsList = json['VHR_GetEmployeeDetailsList']; @@ -1308,9 +1436,16 @@ class GenericResponseModel { vHRGetProjectByCodeList = json['VHR_GetProjectByCodeList']; vHRIsVerificationCodeValid = json['VHR_IsVerificationCodeValid']; - validateAbsenceTransactionList = json['ValidateAbsenceTransactionList'] != null ? ValidateAbsenceTransactionList.fromJson(json['ValidateAbsenceTransactionList']) : null; + validateAbsenceTransactionList = + json['ValidateAbsenceTransactionList'] != null + ? ValidateAbsenceTransactionList.fromJson( + json['ValidateAbsenceTransactionList']) + : null; - validateEITTransactionList = json['ValidateEITTransactionList'] != null ? ValidateEITTransactionList.fromJson(json['ValidateEITTransactionList']) : null; + validateEITTransactionList = json['ValidateEITTransactionList'] != null + ? ValidateEITTransactionList.fromJson( + json['ValidateEITTransactionList']) + : null; validatePhonesTransactionList = json['ValidatePhonesTransactionList']; if (json['VrItemTypesList'] != null) { @@ -1325,7 +1460,8 @@ class GenericResponseModel { wFLookUpList!.add(WFLookUpList.fromJson(v)); }); } - eLearningGETEMPLOYEEPROFILEList = json['eLearning_GET_EMPLOYEE_PROFILEList']; + eLearningGETEMPLOYEEPROFILEList = + json['eLearning_GET_EMPLOYEE_PROFILEList']; eLearningLOGINList = json['eLearning_LOGINList']; eLearningValidateLoginList = json['eLearning_ValidateLoginList']; eLearningValidate_LoginList = json['eLearning_Validate_LoginList']; @@ -1364,7 +1500,8 @@ class GenericResponseModel { data['VidaUpdatedResponse'] = this.vidaUpdatedResponse; if (this.addAttSuccessList != null) { - data['AddAttSuccessList'] = this.addAttSuccessList!.map((v) => v.toJson()).toList(); + data['AddAttSuccessList'] = + this.addAttSuccessList!.map((v) => v.toJson()).toList(); } if (this.addAttachmentList != null) { data['AddAttachment_List'] = this.addAttachmentList!.toJson(); @@ -1377,7 +1514,8 @@ class GenericResponseModel { } data['BusinessCardPrivilege'] = this.businessCardPrivilege; if (this.calculateAbsenceDuration != null) { - data['CalculateAbsenceDuration'] = this.calculateAbsenceDuration!.toJson(); + data['CalculateAbsenceDuration'] = + this.calculateAbsenceDuration!.toJson(); } if (this.cancelHRTransactionLIst != null) { data['CancelHRTransactionLIst'] = this.calculateAbsenceDuration!.toJson(); @@ -1403,35 +1541,45 @@ class GenericResponseModel { data['GetAbsenceAttachmentsList'] = this.getAbsenceAttachmentsList; if (this.getAbsenceAttendanceTypesList != null) { - data['GetAbsenceAttendanceTypesList'] = this.getAbsenceAttendanceTypesList!.map((v) => v.toJson()).toList(); + data['GetAbsenceAttendanceTypesList'] = + this.getAbsenceAttendanceTypesList!.map((v) => v.toJson()).toList(); } if (this.getAbsenceCollectionNotificationBodyList != null) { - data['GetAbsenceCollectionNotificationBodyList'] = this.getAbsenceCollectionNotificationBodyList!.map((v) => v.toJson()).toList(); + data['GetAbsenceCollectionNotificationBodyList'] = this + .getAbsenceCollectionNotificationBodyList! + .map((v) => v.toJson()) + .toList(); } if (this.getAbsenceDffStructureList != null) { - data['GetAbsenceDffStructureList'] = this.getAbsenceDffStructureList!.map((v) => v.toJson()).toList(); + data['GetAbsenceDffStructureList'] = + this.getAbsenceDffStructureList!.map((v) => v.toJson()).toList(); } if (this.getAbsenceTransactionList != null) { - data['GetAbsenceTransactionList'] = this.getAbsenceTransactionList!.map((v) => v.toJson()).toList(); + data['GetAbsenceTransactionList'] = + this.getAbsenceTransactionList!.map((v) => v.toJson()).toList(); } data['GetAccrualBalancesList'] = this.getAccrualBalancesList; if (this.getActionHistoryList != null) { - data['GetActionHistoryList'] = this.getActionHistoryList!.map((v) => v.toJson()).toList(); + data['GetActionHistoryList'] = + this.getActionHistoryList!.map((v) => v.toJson()).toList(); } data['GetAddressDffStructureList'] = this.getAddressDffStructureList; - data['GetAddressNotificationBodyList'] = this.getAddressNotificationBodyList; + data['GetAddressNotificationBodyList'] = + this.getAddressNotificationBodyList; if (this.getApprovesList != null) { - data['GetApprovesList'] = this.getApprovesList!.map((v) => v.toJson()).toList(); + data['GetApprovesList'] = + this.getApprovesList!.map((v) => v.toJson()).toList(); } if (this.getAttachementList != null) { - data['GetAttachementList'] = this.getAttachementList!.map((v) => v.toJson()).toList(); + data['GetAttachementList'] = + this.getAttachementList!.map((v) => v.toJson()).toList(); } data['GetAttendanceTrackingList'] = this.getAttendanceTrackingList; @@ -1439,92 +1587,116 @@ class GenericResponseModel { data['GetBasicDetDffStructureList'] = this.getBasicDetDffStructureList; if (this.getBasicDetNtfBodyList != null) { - data['GetBasicDetNtfBodyList'] = this.getBasicDetNtfBodyList!.map((v) => v.toJson()).toList(); + data['GetBasicDetNtfBodyList'] = + this.getBasicDetNtfBodyList!.map((v) => v.toJson()).toList(); } - data['GetCEICollectionNotificationBodyList'] = this.getCEICollectionNotificationBodyList; + data['GetCEICollectionNotificationBodyList'] = + this.getCEICollectionNotificationBodyList; data['GetCEIDFFStructureList'] = this.getCEIDFFStructureList; data['GetCEITransactionList'] = this.getCEITransactionList; data['GetCcpTransactionsList'] = this.getCcpTransactionsList; if (this.getContactDetailsList != null) { - data['GetContactDetailsList'] = this.getContactDetailsList!.map((v) => v.toJson()).toList(); + data['GetContactDetailsList'] = + this.getContactDetailsList!.map((v) => v.toJson()).toList(); } if (this.getContactColsStructureList != null) { - data['GetContactColsStructureList'] = this.getContactColsStructureList!.map((v) => v.toJson()).toList(); + data['GetContactColsStructureList'] = + this.getContactColsStructureList!.map((v) => v.toJson()).toList(); } if (this.getContactDffStructureList != null) { - data['GetContactDffStructureList'] = this.getContactDffStructureList!.map((v) => v.toJson()).toList(); + data['GetContactDffStructureList'] = + this.getContactDffStructureList!.map((v) => v.toJson()).toList(); } data['GetContactColsStructureList'] = this.getContactColsStructureList; data['GetContactDetailsList'] = this.getContactDetailsList; data['GetContactDffStructureList'] = this.getContactDffStructureList; - data['GetContactNotificationBodyList'] = this.getContactNotificationBodyList; + data['GetContactNotificationBodyList'] = + this.getContactNotificationBodyList; data['GetCountriesList'] = this.getCountriesList; if (this.getDayHoursTypeDetailsList != null) { - data['GetDayHoursTypeDetailsList'] = this.getDayHoursTypeDetailsList!.map((v) => v.toJson()).toList(); + data['GetDayHoursTypeDetailsList'] = + this.getDayHoursTypeDetailsList!.map((v) => v.toJson()).toList(); } if (this.getDeductionsList != null) { - data['GetDeductionsList'] = this.getDeductionsList!.map((v) => v.toJson()).toList(); + data['GetDeductionsList'] = + this.getDeductionsList!.map((v) => v.toJson()).toList(); } if (this.getDefaultValueList != null) { data['GetDefaultValueList'] = this.getDefaultValueList!.toJson(); } - data['GetEITCollectionNotificationBodyList'] = this.getEITCollectionNotificationBodyList; + data['GetEITCollectionNotificationBodyList'] = + this.getEITCollectionNotificationBodyList; if (this.getEITDFFStructureList != null) { - data['GetEITDFFStructureList'] = this.getEITDFFStructureList!.map((v) => v.toJson()).toList(); + data['GetEITDFFStructureList'] = + this.getEITDFFStructureList!.map((v) => v.toJson()).toList(); } if (this.getEITTransactionList != null) { - data['GetEITTransactionList'] = this.getEITTransactionList!.map((v) => v.toJson()).toList(); + data['GetEITTransactionList'] = + this.getEITTransactionList!.map((v) => v.toJson()).toList(); } if (this.getEarningsList != null) { - data['GetEarningsList'] = this.getEarningsList!.map((v) => v.toJson()).toList(); + data['GetEarningsList'] = + this.getEarningsList!.map((v) => v.toJson()).toList(); } if (this.getEmployeeAddressList != null) { - data['GetEmployeeAddressList'] = this.getEmployeeAddressList!.map((v) => v.toJson()).toList(); + data['GetEmployeeAddressList'] = + this.getEmployeeAddressList!.map((v) => v.toJson()).toList(); } if (this.getEmployeeBasicDetailsList != null) { - data['GetEmployeeBasicDetailsList'] = this.getEmployeeBasicDetailsList!.map((v) => v.toJson()).toList(); + data['GetEmployeeBasicDetailsList'] = + this.getEmployeeBasicDetailsList!.map((v) => v.toJson()).toList(); } if (this.getEmployeeContactsList != null) { - data['GetEmployeeContactsList'] = this.getEmployeeContactsList!.map((v) => v.toJson()).toList(); + data['GetEmployeeContactsList'] = + this.getEmployeeContactsList!.map((v) => v.toJson()).toList(); } if (this.getEmployeePhonesList != null) { - data['GetEmployeePhonesList'] = this.getEmployeePhonesList!.map((v) => v.toJson()).toList(); + data['GetEmployeePhonesList'] = + this.getEmployeePhonesList!.map((v) => v.toJson()).toList(); } if (this.getEmployeeSubordinatesList != null) { - data['GetEmployeeSubordinatesList'] = this.getEmployeeSubordinatesList!.map((v) => v.toJson()).toList(); + data['GetEmployeeSubordinatesList'] = + this.getEmployeeSubordinatesList!.map((v) => v.toJson()).toList(); } data['GetFliexfieldStructureList'] = this.getFliexfieldStructureList; - data['GetHrCollectionNotificationBodyList'] = this.getHrCollectionNotificationBodyList; + data['GetHrCollectionNotificationBodyList'] = + this.getHrCollectionNotificationBodyList; data['GetHrTransactionList'] = this.getHrTransactionList; if (this.getItemCreationNtfBodyList != null) { - data['GetItemCreationNtfBodyList'] = this.getItemCreationNtfBodyList!.toJson(); + data['GetItemCreationNtfBodyList'] = + this.getItemCreationNtfBodyList!.toJson(); } if (this.getItemTypeNotificationsList != null) { - data['GetItemTypeNotificationsList'] = this.getItemTypeNotificationsList!.map((v) => v.toJson()).toList(); + data['GetItemTypeNotificationsList'] = + this.getItemTypeNotificationsList!.map((v) => v.toJson()).toList(); } data['GetItemTypesList'] = this.getItemTypesList; data['GetLookupValuesList'] = this.getLookupValuesList; data['GetMenuEntriesList'] = this.getMenuEntriesList; if (this.getMoItemHistoryList != null) { - data['GetMoItemHistoryList'] = this.getMoItemHistoryList!.map((v) => v.toJson()).toList(); + data['GetMoItemHistoryList'] = + this.getMoItemHistoryList!.map((v) => v.toJson()).toList(); } if (this.getMoNotificationBodyList != null) { - data['GetMoNotificationBodyList'] = this.getMoNotificationBodyList!.map((v) => v.toJson()).toList(); + data['GetMoNotificationBodyList'] = + this.getMoNotificationBodyList!.map((v) => v.toJson()).toList(); } if (this.getNotificationButtonsList != null) { - data['GetNotificationButtonsList'] = this.getNotificationButtonsList!.map((v) => v.toJson()).toList(); + data['GetNotificationButtonsList'] = + this.getNotificationButtonsList!.map((v) => v.toJson()).toList(); } if (getNotificationReassignModeList != null) { - data['GetNotificationReassignModeList'] = getNotificationReassignModeList!.map((v) => v.toJson()).toList(); + data['GetNotificationReassignModeList'] = + getNotificationReassignModeList!.map((v) => v.toJson()).toList(); } data['GetObjectValuesList'] = this.getObjectValuesList; @@ -1534,73 +1706,91 @@ class GenericResponseModel { data['GetOpenPeriodDatesList'] = this.getOpenPeriodDatesList; data['GetOrganizationsSalariesList'] = this.getOrganizationsSalariesList; if (this.getPaymentInformationList != null) { - data['GetPaymentInformationList'] = this.getPaymentInformationList!.map((v) => v.toJson()).toList(); + data['GetPaymentInformationList'] = + this.getPaymentInformationList!.map((v) => v.toJson()).toList(); } if (this.getPayslipList != null) { - data['GetPayslipList'] = this.getPayslipList!.map((v) => v.toJson()).toList(); + data['GetPayslipList'] = + this.getPayslipList!.map((v) => v.toJson()).toList(); } // data['GetPendingReqDetailsList'] = this.getPendingReqDetailsList; // data['GetPendingReqFunctionsList'] = this.getPendingReqFunctionsList; data['GetPerformanceAppraisalList'] = this.getPerformanceAppraisalList; data['GetPhonesNotificationBodyList'] = this.getPhonesNotificationBodyList; if (this.getPoItemHistoryList != null) { - data['GetPoItemHistoryList'] = this.getPoItemHistoryList!.map((v) => v.toJson()).toList(); + data['GetPoItemHistoryList'] = + this.getPoItemHistoryList!.map((v) => v.toJson()).toList(); } if (this.getPoNotificationBodyList != null) { - data['GetPoNotificationBodyList'] = this.getPoNotificationBodyList!.toJson(); + data['GetPoNotificationBodyList'] = + this.getPoNotificationBodyList!.toJson(); } data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList; if (this.getQuotationAnalysisList != null) { - data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList(); + data['GetQuotationAnalysisList'] = + this.getQuotationAnalysisList!.map((v) => v.toJson()).toList(); } data['GetRFCEmployeeListList'] = this.getRFCEmployeeListList; data['GetRespondAttributeValueList'] = this.getRespondAttributeValueList; - data['GetSITCollectionNotificationBodyList'] = this.getSITCollectionNotificationBodyList; + data['GetSITCollectionNotificationBodyList'] = + this.getSITCollectionNotificationBodyList; data['GetSITDFFStructureList'] = this.getSITDFFStructureList; data['GetSITTransactionList'] = this.getSITTransactionList; if (this.getScheduleShiftsDetailsList != null) { - data['GetScheduleShiftsDetailsList'] = this.getScheduleShiftsDetailsList!.map((v) => v.toJson()).toList(); + data['GetScheduleShiftsDetailsList'] = + this.getScheduleShiftsDetailsList!.map((v) => v.toJson()).toList(); } data['GetShiftTypesList'] = this.getShiftTypesList; if (this.getStampMsNotificationBodyList != null) { - data['GetStampMsNotificationBodyList'] = this.getStampMsNotificationBodyList!.map((v) => v.toJson()).toList(); + data['GetStampMsNotificationBodyList'] = + this.getStampMsNotificationBodyList!.map((v) => v.toJson()).toList(); } if (this.getStampNsNotificationBodyList != null) { - data['GetStampNsNotificationBodyList'] = this.getStampNsNotificationBodyList!.map((v) => v.toJson()).toList(); + data['GetStampNsNotificationBodyList'] = + this.getStampNsNotificationBodyList!.map((v) => v.toJson()).toList(); } - data['GetStampNsNotificationBodyList'] = this.getStampNsNotificationBodyList; + data['GetStampNsNotificationBodyList'] = + this.getStampNsNotificationBodyList; data['GetSubordinatesAttdStatusList'] = this.getSubordinatesAttdStatusList; data['GetSubordinatesLeavesList'] = this.getSubordinatesLeavesList; if (this.getSubordinatesLeavesList != null) { - data['GetSubordinatesLeavesList'] = this.getSubordinatesLeavesList!.map((v) => v.toJson()).toList(); + data['GetSubordinatesLeavesList'] = + this.getSubordinatesLeavesList!.map((v) => v.toJson()).toList(); } if (this.getSubordinatesLeavesTotalVacationsList != null) { - data['GetSubordinatesLeavesTotalVacationsList'] = this.getSubordinatesLeavesTotalVacationsList!.map((v) => v.toJson()).toList(); + data['GetSubordinatesLeavesTotalVacationsList'] = this + .getSubordinatesLeavesTotalVacationsList! + .map((v) => v.toJson()) + .toList(); } if (this.getSummaryOfPaymentList != null) { - data['GetSummaryOfPaymentList'] = this.getSummaryOfPaymentList!.map((v) => v.toJson()).toList(); + data['GetSummaryOfPaymentList'] = + this.getSummaryOfPaymentList!.map((v) => v.toJson()).toList(); } data['GetSwipesList'] = this.getSwipesList; data['GetTermColsStructureList'] = this.getTermColsStructureList; data['GetTermDffStructureList'] = this.getTermDffStructureList; data['GetTermNotificationBodyList'] = this.getTermNotificationBodyList; if (this.getTimeCardSummaryList != null) { - data['GetTimeCardSummaryList'] = this.getTimeCardSummaryList!.map((v) => v.toJson()).toList(); + data['GetTimeCardSummaryList'] = + this.getTimeCardSummaryList!.map((v) => v.toJson()).toList(); } data['GetUserItemTypesList'] = this.getUserItemTypesList; if (this.getVacationRulesList != null) { - data['GetVacationRulesList'] = this.getVacationRulesList!.map((v) => v.toJson()).toList(); + data['GetVacationRulesList'] = + this.getVacationRulesList!.map((v) => v.toJson()).toList(); } data['GetVaccinationOnHandList'] = this.getVaccinationOnHandList; data['GetVaccinationsList'] = this.getVaccinationsList; if (getValueSetValuesList != null) { - data['GetValueSetValuesList'] = getValueSetValuesList!.map((v) => v.toJson()).toList(); + data['GetValueSetValuesList'] = + getValueSetValuesList!.map((v) => v.toJson()).toList(); } if (getWorkList != null) { data['GetWorkList'] = getWorkList!.map((v) => v.toJson()).toList(); @@ -1631,19 +1821,26 @@ class GenericResponseModel { data['List_RadScreen'] = this.listRadScreen; data['LogInTokenID'] = this.logInTokenID; if (this.memberInformationList != null) { - data['MemberInformationList'] = this.memberInformationList!.map((v) => v.toJson()).toList(); + data['MemberInformationList'] = + this.memberInformationList!.map((v) => v.toJson()).toList(); } data['MemberLoginList'] = this.memberLoginList; - data['Mohemm_GetBusinessCardEnabledList'] = this.mohemmGetBusinessCardEnabledList; - data['Mohemm_GetFavoriteReplacementsList'] = this.mohemmGetFavoriteReplacementsList; - data['Mohemm_GetMobileDeviceInfobyEmpInfoList'] = this.mohemmGetMobileDeviceInfobyEmpInfoList; + data['Mohemm_GetBusinessCardEnabledList'] = + this.mohemmGetBusinessCardEnabledList; + data['Mohemm_GetFavoriteReplacementsList'] = + this.mohemmGetFavoriteReplacementsList; + data['Mohemm_GetMobileDeviceInfobyEmpInfoList'] = + this.mohemmGetMobileDeviceInfobyEmpInfoList; if (this.mohemmGetMobileLoginInfoList != null) { - data['Mohemm_GetMobileLoginInfoList'] = this.mohemmGetMobileLoginInfoList!.map((v) => v.toJson()).toList(); + data['Mohemm_GetMobileLoginInfoList'] = + this.mohemmGetMobileLoginInfoList!.map((v) => v.toJson()).toList(); } data['Mohemm_GetPatientID_List'] = this.mohemmGetPatientIDList; data['Mohemm_ITG_ResponseItem'] = this.mohemmITGResponseItem; - data['Mohemm_IsChangeIsActiveBusinessCardEnable'] = this.mohemmIsChangeIsActiveBusinessCardEnable; - data['Mohemm_IsInsertBusinessCardEnable'] = this.mohemmIsInsertBusinessCardEnable; + data['Mohemm_IsChangeIsActiveBusinessCardEnable'] = + this.mohemmIsChangeIsActiveBusinessCardEnable; + data['Mohemm_IsInsertBusinessCardEnable'] = + this.mohemmIsInsertBusinessCardEnable; data['Mohemm_Wifi_Password'] = this.mohemmWifiPassword; data['Mohemm_Wifi_SSID'] = this.mohemmWifiSSID; @@ -1652,11 +1849,13 @@ class GenericResponseModel { } if (notificationGetRespondAttributesList != null) { - data['NotificationGetRespondAttributesList'] = notificationGetRespondAttributesList!.map((v) => v.toJson()).toList(); + data['NotificationGetRespondAttributesList'] = + notificationGetRespondAttributesList!.map((v) => v.toJson()).toList(); } if (notificationRespondRolesList != null) { - data['NotificationRespondRolesList'] = notificationRespondRolesList!.map((v) => v).toList(); + data['NotificationRespondRolesList'] = + notificationRespondRolesList!.map((v) => v).toList(); } data['OracleOutPutNumber'] = this.oracleOutPutNumber; @@ -1673,45 +1872,55 @@ class GenericResponseModel { data['P_QUESTION'] = this.pQUESTION; data['P_SESSION_ID'] = this.pSESSIONID; data['P_Schema'] = this.pSchema; - data['PharmacyStock_AddPharmacyStockList'] = this.pharmacyStockAddPharmacyStockList; + data['PharmacyStock_AddPharmacyStockList'] = + this.pharmacyStockAddPharmacyStockList; data['PharmacyStock_GetOnHandList'] = this.pharmacyStockGetOnHandList; if (this.privilegeList != null) { - data['Privilege_List'] = this.privilegeList!.map((v) => v.toJson()).toList(); + data['Privilege_List'] = + this.privilegeList!.map((v) => v.toJson()).toList(); } data['ProcessTransactions'] = this.processTransactions; data['RegisterUserNameList'] = this.registerUserNameList; data['ReplacementList'] = this.replacementList; if (respondAttributesList != null) { - data['RespondAttributesList'] = respondAttributesList!.map((v) => v.toJson()).toList(); + data['RespondAttributesList'] = + respondAttributesList!.map((v) => v.toJson()).toList(); } data['RespondRolesList'] = this.respondRolesList; - data['ResubmitAbsenceTransactionList'] = this.resubmitAbsenceTransactionList; + data['ResubmitAbsenceTransactionList'] = + this.resubmitAbsenceTransactionList; data['ResubmitEITTransactionList'] = this.resubmitEITTransactionList; data['ResubmitHrTransactionList'] = this.resubmitHrTransactionList; data['SFH_GetPoNotificationBodyList'] = this.sFHGetPoNotificationBodyList; data['SFH_GetPrNotificationBodyList'] = this.sFHGetPrNotificationBodyList; if (this.startAbsenceApprovalProccess != null) { - data['StartAbsenceApprovalProccess'] = this.startAbsenceApprovalProccess!.toJson(); + data['StartAbsenceApprovalProccess'] = + this.startAbsenceApprovalProccess!.toJson(); } - data['StartAddressApprovalProcessList'] = this.startAddressApprovalProcessList; + data['StartAddressApprovalProcessList'] = + this.startAddressApprovalProcessList; data['StartBasicDetApprProcessList'] = this.startBasicDetApprProcessList; data['StartCeiApprovalProcess'] = this.startCeiApprovalProcess; - data['StartContactApprovalProcessList'] = this.startContactApprovalProcessList; + data['StartContactApprovalProcessList'] = + this.startContactApprovalProcessList; if (this.startEitApprovalProcess != null) { data['StartEitApprovalProcess'] = this.startEitApprovalProcess!.toJson(); } data['StartHrApprovalProcessList'] = this.startHrApprovalProcessList; - data['StartPhonesApprovalProcessList'] = this.startPhonesApprovalProcessList; + data['StartPhonesApprovalProcessList'] = + this.startPhonesApprovalProcessList; data['StartSitApprovalProcess'] = this.startSitApprovalProcess; data['StartTermApprovalProcessList'] = this.startTermApprovalProcessList; if (this.submitAddressTransactionList != null) { - data['SubmitAddressTransactionList'] = this.submitAddressTransactionList!.toJson(); + data['SubmitAddressTransactionList'] = + this.submitAddressTransactionList!.toJson(); } if (this.submitBasicDetTransactionList != null) { - data['SubmitBasicDetTransactionList'] = this.submitBasicDetTransactionList!.toJson(); + data['SubmitBasicDetTransactionList'] = + this.submitBasicDetTransactionList!.toJson(); } data['SubmitCEITransactionList'] = this.submitCEITransactionList; @@ -1719,7 +1928,8 @@ class GenericResponseModel { data['SubmitContactTransactionList'] = this.submitContactTransactionList; if (this.submitEITTransactionList != null) { - data['SubmitEITTransactionList'] = this.submitEITTransactionList!.toJson(); + data['SubmitEITTransactionList'] = + this.submitEITTransactionList!.toJson(); } data['SubmitHrTransactionList'] = this.submitHrTransactionList; @@ -1729,17 +1939,20 @@ class GenericResponseModel { data['SubordinatesOnLeavesList'] = this.subordinatesOnLeavesList; if (this.subordinatesOnLeavesList != null) { - data['SubordinatesOnLeavesList'] = this.subordinatesOnLeavesList!.map((v) => v.toJson()).toList(); + data['SubordinatesOnLeavesList'] = + this.subordinatesOnLeavesList!.map((v) => v.toJson()).toList(); } if (this.sumbitAbsenceTransactionList != null) { - data['SumbitAbsenceTransactionList'] = this.sumbitAbsenceTransactionList!.toJson(); + data['SumbitAbsenceTransactionList'] = + this.sumbitAbsenceTransactionList!.toJson(); } data['TokenID'] = this.tokenID; data['UpdateAttachmentList'] = this.updateAttachmentList; data['UpdateEmployeeImageList'] = this.updateEmployeeImageList; if (this.updateItemTypeSuccessList != null) { - data['UpdateItemTypeSuccessList'] = this.updateItemTypeSuccessList!.map((v) => v.toJson()).toList(); + data['UpdateItemTypeSuccessList'] = + this.updateItemTypeSuccessList!.map((v) => v.toJson()).toList(); } if (this.updateUserItemTypesList != null) { data['UpdateUserItemTypesList'] = this.updateUserItemTypesList!.toJson(); @@ -1752,19 +1965,22 @@ class GenericResponseModel { data['VHR_IsVerificationCodeValid'] = this.vHRIsVerificationCodeValid; if (validateAbsenceTransactionList != null) { - data['ValidateAbsenceTransactionList'] = validateAbsenceTransactionList!.toJson(); + data['ValidateAbsenceTransactionList'] = + validateAbsenceTransactionList!.toJson(); } if (validateEITTransactionList != null) { data['ValidateEITTransactionList'] = validateEITTransactionList!.toJson(); } data['ValidatePhonesTransactionList'] = this.validatePhonesTransactionList; if (vrItemTypesList != null) { - data['VrItemTypesList'] = vrItemTypesList!.map((v) => v.toJson()).toList(); + data['VrItemTypesList'] = + vrItemTypesList!.map((v) => v.toJson()).toList(); } if (wFLookUpList != null) { data['WFLookUpList'] = wFLookUpList!.map((v) => v.toJson()).toList(); } - data['eLearning_GET_EMPLOYEE_PROFILEList'] = this.eLearningGETEMPLOYEEPROFILEList; + data['eLearning_GET_EMPLOYEE_PROFILEList'] = + this.eLearningGETEMPLOYEEPROFILEList; data['eLearning_LOGINList'] = this.eLearningLOGINList; data['eLearning_ValidateLoginList'] = this.eLearningValidateLoginList; data['eLearning_Validate_LoginList'] = this.eLearningValidateLoginList; diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index b5d5dad..40e1ab5 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -15,6 +15,7 @@ import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; import 'package:mohem_flutter_app/models/dashboard/list_menu.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/dashboard/menus.dart'; +import 'package:mohem_flutter_app/models/dashboard/mohemm_itg_pending_task_responseitem.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart'; @@ -59,10 +60,13 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isAttendanceTrackingLoading = false; // isTimeRemainingInSeconds = calculateSeconds( "00:00:00"); if (attendanceTracking?.pSwipeIn != null) { - isTimeRemainingInSeconds = calculateSeconds(attendanceTracking!.pRemainingHours ?? "00:00:00"); - int totalShiftTimeInSeconds = calculateSeconds(attendanceTracking!.pScheduledHours ?? "00:00:00"); + isTimeRemainingInSeconds = + calculateSeconds(attendanceTracking!.pRemainingHours ?? "00:00:00"); + int totalShiftTimeInSeconds = + calculateSeconds(attendanceTracking!.pScheduledHours ?? "00:00:00"); progress = (isTimeRemainingInSeconds / totalShiftTimeInSeconds); - endTime = DateTime.now().millisecondsSinceEpoch + Duration(seconds: isTimeRemainingInSeconds).inMilliseconds; + endTime = DateTime.now().millisecondsSinceEpoch + + Duration(seconds: isTimeRemainingInSeconds).inMilliseconds; } notifyListeners(); @@ -112,17 +116,32 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { ItgFormsModel? itgFormsModel; List? getOpenNotificationsList; - + MohemmITGPendingTaskResponseItem? cocCount; + int cocFinalCount = 0; //Work List API's & Methods Future fetchWorkListCounter(context, {bool showLoading = false}) async { try { if (showLoading) Utils.showLoading(context); - GenericResponseModel? genericResponseModel = await DashboardApiClient().getOpenNotifications(); + GenericResponseModel? genericResponseModel = + await DashboardApiClient().getOpenNotifications(); + isWorkListLoading = false; getOpenNotificationsList = genericResponseModel?.getOpenNotificationsList; + workListCounter = genericResponseModel?.pOPENNTFNUMBER ?? 0; + itgFormsModel = await DashboardApiClient().getItgFormsPendingTask(); workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0); + GenericResponseModel? cocGenericResponseModel = + await DashboardApiClient().getCOCNotifications(); + cocCount = cocGenericResponseModel?.mohemmITGPendingTaskResponseItem; + if (cocCount != null) { + cocFinalCount = (cocCount?.escalation ?? 0) + + (cocCount?.waitingToClose ?? 0) + + (cocCount?.waitingForAcceptance ?? 0) + + (cocCount?.extendTATRequest ?? 0); + workListCounter += cocFinalCount; + } if (showLoading) Utils.hideLoading(context); notifyListeners(); } catch (ex) { @@ -137,9 +156,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //Missing Siwpe API's & Methods Future fetchMissingSwipe(context) async { try { - GenericResponseModel? genericResponseModel = await DashboardApiClient().getOpenMissingSwipes(); + GenericResponseModel? genericResponseModel = + await DashboardApiClient().getOpenMissingSwipes(); isMissingSwipeLoading = false; - missingSwipeCounter = genericResponseModel!.getOpenMissingSwipesList!.pOpenMissingSwipes ?? 0; + missingSwipeCounter = + genericResponseModel!.getOpenMissingSwipesList!.pOpenMissingSwipes ?? + 0; notifyListeners(); } catch (ex) { isMissingSwipeLoading = false; @@ -152,10 +174,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //Leave and Ticket Balance API's & Methods Future fetchLeaveTicketBalance(context, DateTime date) async { try { - accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(date)); + accrualList = await DashboardApiClient() + .getAccrualBalances(DateFormat("MM/dd/yyyy").format(date)); isLeaveTicketBalanceLoading = false; leaveBalanceAccrual = accrualList![0]; - ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0); + ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + + (accrualList![2].accrualNetEntitlement ?? 0.0); notifyListeners(); } catch (ex) { isLeaveTicketBalanceLoading = false; @@ -168,23 +192,36 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //List Menu API's & Methods List drawerMenuItemList = [ - DrawerMenuItem("assets/images/drawer/my_profile.svg", LocaleKeys.myProfile.tr(), AppRoutes.profile), - DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", LocaleKeys.performanceEvaluation.tr(), AppRoutes.performanceEvaluation), - DrawerMenuItem("assets/images/drawer/mowadhafi.svg", LocaleKeys.mowadhafhi.tr(), AppRoutes.mowadhafhi), - DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions), - DrawerMenuItem("assets/images/drawer/change_password.svg", LocaleKeys.changePassword.tr(), AppRoutes.changePassword), + DrawerMenuItem("assets/images/drawer/my_profile.svg", + LocaleKeys.myProfile.tr(), AppRoutes.profile), + DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", + LocaleKeys.performanceEvaluation.tr(), AppRoutes.performanceEvaluation), + DrawerMenuItem("assets/images/drawer/mowadhafi.svg", + LocaleKeys.mowadhafhi.tr(), AppRoutes.mowadhafhi), + DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", + LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions), + DrawerMenuItem("assets/images/drawer/change_password.svg", + LocaleKeys.changePassword.tr(), AppRoutes.changePassword), ]; void fetchListMenu() async { try { List menuList = await DashboardApiClient().getListMenu(); - List findMyRequest = menuList.where((element) => element.menuType == "E").toList(); + List findMyRequest = + menuList.where((element) => element.menuType == "E").toList(); if (findMyRequest.isNotEmpty) { - drawerMenuItemList.insert(3, DrawerMenuItem("assets/images/drawer/my_requests.svg", LocaleKeys.myRequest.tr(), AppRoutes.myRequests)); + drawerMenuItemList.insert( + 3, + DrawerMenuItem("assets/images/drawer/my_requests.svg", + LocaleKeys.myRequest.tr(), AppRoutes.myRequests)); } - List findMyTeam = menuList.where((element) => element.menuType == "M").toList(); + List findMyTeam = + menuList.where((element) => element.menuType == "M").toList(); if (findMyTeam.isNotEmpty) { - drawerMenuItemList.insert(2, DrawerMenuItem("assets/images/drawer/my_team.svg", LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam)); + drawerMenuItemList.insert( + 2, + DrawerMenuItem("assets/images/drawer/my_team.svg", + LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam)); } } catch (ex) { logger.wtf(ex); @@ -195,12 +232,19 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //Menu Entries API's & Methods void fetchMenuEntries() async { try { - GenericResponseModel? genericResponseModel = await DashboardApiClient().getGetMenuEntries(); + GenericResponseModel? genericResponseModel = + await DashboardApiClient().getGetMenuEntries(); getMenuEntriesList = genericResponseModel!.getMenuEntriesList; homeMenus = parseMenus(getMenuEntriesList ?? []); if (homeMenus!.isNotEmpty) { - homeMenus!.first.menuEntiesList.insert(0, GetMenuEntriesList(requestType: "MONTHLY_ATTENDANCE", prompt: LocaleKeys.monthlyAttendance.tr())); - homeMenus!.first.menuEntiesList.add(GetMenuEntriesList(requestType: "VACATION_RULE", prompt: LocaleKeys.vacationRule.tr())); + homeMenus!.first.menuEntiesList.insert( + 0, + GetMenuEntriesList( + requestType: "MONTHLY_ATTENDANCE", + prompt: LocaleKeys.monthlyAttendance.tr())); + homeMenus!.first.menuEntiesList.add(GetMenuEntriesList( + requestType: "VACATION_RULE", + prompt: LocaleKeys.vacationRule.tr())); } isServicesMenusLoading = false; notifyListeners(); @@ -228,7 +272,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List menus = []; for (int i = 0; i < getMenuEntriesList.length; i++) { if (getMenuEntriesList[i].parentMenuName!.isEmpty) { - menus.add(Menus(getMenuEntriesList[i], getMenuEntriesList.where((element) => getMenuEntriesList[i].menuName == element.parentMenuName).toList())); + menus.add(Menus( + getMenuEntriesList[i], + getMenuEntriesList + .where((element) => + getMenuEntriesList[i].menuName == element.parentMenuName) + .toList())); } } return menus; diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index dcdd580..0f30b84 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -41,7 +41,14 @@ class _WorkListScreenState extends State { key: 'HRSSA', disable: false), WorkListItemTypeModelData( - value: 0, name: 'MR', fullName: LocaleKeys.moveOrder.tr(), active: false, color: [Color(0xff58DCFA), Color(0xff3CB9D5)], icon: "assets/images/miss_swipe.svg", key: 'INVMOA', disable: false), + value: 0, + name: 'MR', + fullName: LocaleKeys.moveOrder.tr(), + active: false, + color: [Color(0xff58DCFA), Color(0xff3CB9D5)], + icon: "assets/images/miss_swipe.svg", + key: 'INVMOA', + disable: false), WorkListItemTypeModelData( value: 0, name: 'PR', @@ -61,7 +68,14 @@ class _WorkListScreenState extends State { key: 'POAPPRV', disable: false), WorkListItemTypeModelData( - value: 0, name: 'ITG', fullName: LocaleKeys.ITGForms.tr(), active: false, color: [Color(0xffEB8C90), Color(0xffDE6C70)], icon: "assets/images/miss_swipe.svg", key: 'ITG', disable: false), + value: 0, + name: 'ITG', + fullName: LocaleKeys.ITGForms.tr(), + active: false, + color: [Color(0xffEB8C90), Color(0xffDE6C70)], + icon: "assets/images/miss_swipe.svg", + key: 'ITG', + disable: false), WorkListItemTypeModelData( value: 0, name: 'IC', @@ -72,7 +86,23 @@ class _WorkListScreenState extends State { key: 'INVITEM', disable: false), WorkListItemTypeModelData( - value: 0, name: 'STAMP', fullName: LocaleKeys.stamp.tr(), active: false, color: [Color(0xff32D892), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'STAMP', disable: false), + value: 0, + name: 'STAMP', + fullName: LocaleKeys.stamp.tr(), + active: false, + color: [Color(0xff32D892), Color(0xff1AB170)], + icon: "assets/images/miss_swipe.svg", + key: 'STAMP', + disable: false), + WorkListItemTypeModelData( + value: 0, + name: 'COC', + fullName: LocaleKeys.itemCreation.tr(), + active: false, + color: [Color(0xff787299), Color(0xff1AB170)], + icon: "assets/images/miss_swipe.svg", + key: 'COC', + disable: true) ]; int workListItemIndex = 0; @@ -95,8 +125,13 @@ class _WorkListScreenState extends State { workListItemTypes.forEach((workListElement) { if (workListElement.key == "ITG") { workListElement.value = providerData.itgFormsModel?.totalCount ?? 0; + } else if (workListElement.key == "COC") { + workListElement.value = providerData.cocFinalCount; } else { - var tempList = providerData.getOpenNotificationsList?.where((notificationElement) => notificationElement.itemType == workListElement.key).toList(); + var tempList = providerData.getOpenNotificationsList + ?.where((notificationElement) => + notificationElement.itemType == workListElement.key) + .toList(); if (tempList!.isNotEmpty) { workListElement.value = tempList.first.openNtfNumber ?? 0; } @@ -115,18 +150,26 @@ class _WorkListScreenState extends State { List requestAllList = []; for (int i = 0; i < (itgFormsModel?.requestType!.length ?? 0); i++) { itgFormsModel?.requestType![i].requestDetails?.forEach((element) { - element.requestType = itgFormsModel?.requestType![i].requestTypeCode; + element.requestType = + itgFormsModel?.requestType![i].requestTypeCode; }); - requestAllList = requestAllList + (itgFormsModel?.requestType![i].requestDetails ?? []); + requestAllList = requestAllList + + (itgFormsModel?.requestType![i].requestDetails ?? []); } AppState().setRequestAllList = requestAllList; - itgFormsModel?.requestType!.insert(0, RequestType(requestDetails: requestAllList, requestTypeCode: "all", requestTypeName: "All")); + itgFormsModel?.requestType!.insert( + 0, + RequestType( + requestDetails: requestAllList, + requestTypeCode: "all", + requestTypeName: "All")); if ((itgFormsModel?.requestType?.length ?? 0) > 0) { itgRequestTypeIndex = 0; } } else { itgRequestTypeIndex = null; - workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key); + workList = await WorkListApiClient() + .getWorkList(pageNumber, workListItemTypes[workListItemIndex].key); AppState().setWorkList = workList; } Utils.hideLoading(context); @@ -167,13 +210,23 @@ class _WorkListScreenState extends State { child: ListView.separated( itemBuilder: (context, index) { return Container( - padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8), + padding: const EdgeInsets.only( + left: 21, right: 21, top: 8, bottom: 8), alignment: Alignment.center, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(6), color: workListItemIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor), - child: ("${workListItemTypes[index].name} ${workListItemTypes[index].value > 0 ? "(${workListItemTypes[index].value})" : ""}") - .toText12(color: workListItemIndex == index ? MyColors.white : MyColors.black), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + color: workListItemIndex == index + ? MyColors.darkIconColor + : MyColors.lightGreyEAColor), + child: + ("${workListItemTypes[index].name} ${workListItemTypes[index].value > 0 ? "(${workListItemTypes[index].value})" : ""}") + .toText12( + color: workListItemIndex == index + ? MyColors.white + : MyColors.black), ).onPress(() { - if (workListItemIndex != index) { + if (workListItemIndex != index && + !workListItemTypes[index].disable) { workListItemIndex = index; if (workListItemTypes[index].value == 0) { workList = []; @@ -194,7 +247,10 @@ class _WorkListScreenState extends State { padding: const EdgeInsets.only(left: 21, right: 21), ), ).paddingOnly(top: 21, bottom: 21), - workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21), + workListItemTypes[workListItemIndex] + .fullName + .toSectionHeading() + .paddingOnly(left: 21, right: 21), if (itgRequestTypeIndex != null) SizedBox( height: 40, @@ -202,10 +258,18 @@ class _WorkListScreenState extends State { itemBuilder: (context, index) { RequestType type = itgFormsModel!.requestType![index]; return Container( - padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8), + padding: const EdgeInsets.only( + left: 21, right: 21, top: 8, bottom: 8), alignment: Alignment.center, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor), - child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + color: itgRequestTypeIndex == index + ? MyColors.darkIconColor + : MyColors.lightGreyEAColor), + child: ("${type.requestTypeName}").toText12( + color: itgRequestTypeIndex == index + ? MyColors.white + : MyColors.black), ).onPress(() { if (itgRequestTypeIndex != index) { itgRequestTypeIndex = index; @@ -225,21 +289,35 @@ class _WorkListScreenState extends State { child: ListView.separated( physics: BouncingScrollPhysics(), itemBuilder: (context, index) { - return itgRowItem(workListItemTypes[workListItemIndex], itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails![index], index); + return itgRowItem( + workListItemTypes[workListItemIndex], + itgFormsModel!.requestType![itgRequestTypeIndex!] + .requestDetails![index], + index); }, separatorBuilder: (context, index) => 12.height, - itemCount: itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails?.length ?? 0, + itemCount: itgFormsModel! + .requestType![itgRequestTypeIndex!] + .requestDetails + ?.length ?? + 0, padding: const EdgeInsets.all(21), ), ) : Expanded( child: workList != null ? ((workList!).isEmpty - ? LocaleKeys.noHistoryAvailable.tr().toText16().center + ? LocaleKeys.noHistoryAvailable + .tr() + .toText16() + .center : ListView.separated( physics: const BouncingScrollPhysics(), itemBuilder: (context, index) { - return rowItem(workListItemTypes[workListItemIndex], workList![index], index); + return rowItem( + workListItemTypes[workListItemIndex], + workList![index], + index); }, separatorBuilder: (context, index) => 12.height, itemCount: workList?.length ?? 0, @@ -253,14 +331,17 @@ class _WorkListScreenState extends State { ); } - Widget itgRowItem(WorkListItemTypeModelData data, RequestDetails requestDetails, int index) { + Widget itgRowItem(WorkListItemTypeModelData data, + RequestDetails requestDetails, int index) { return InkWell( onTap: () async { AppState().setItgWorkListIndex = index; - var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.itgDetail); + var shouldReloadData = + await Navigator.pushNamed(context, AppRoutes.itgDetail); if (shouldReloadData != null) { if (shouldReloadData.toString() == "delegate_reload") { - providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1; + providerData.itgFormsModel!.totalCount = + providerData.itgFormsModel!.totalCount! - 1; calculateCounter(); getWorkList(); } @@ -284,7 +365,8 @@ class _WorkListScreenState extends State { }, child: Container( width: double.infinity, - padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + padding: + const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), @@ -303,11 +385,20 @@ class _WorkListScreenState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), - gradient: LinearGradient(transform: GradientRotation(.218), begin: Alignment.topRight, end: Alignment.bottomRight, colors: data.color), + gradient: LinearGradient( + transform: GradientRotation(.218), + begin: Alignment.topRight, + end: Alignment.bottomRight, + colors: data.color), ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, - children: [SvgPicture.asset("assets/images/miss_swipe.svg", width: 20, height: 20, color: Colors.white), 2.height, data.name.toText10(color: Colors.white)], + children: [ + SvgPicture.asset("assets/images/miss_swipe.svg", + width: 20, height: 20, color: Colors.white), + 2.height, + data.name.toText10(color: Colors.white) + ], ).paddingAll(6), ), 8.width, @@ -320,11 +411,17 @@ class _WorkListScreenState extends State { 10.height, Row( children: [ - DateUtil.formatDateToDate(DateUtil.convertStringToDate(requestDetails.modifiedDate!), false).toText10(color: MyColors.lightTextColor).expanded, + DateUtil.formatDateToDate( + DateUtil.convertStringToDate( + requestDetails.modifiedDate!), + false) + .toText10(color: MyColors.lightTextColor) + .expanded, RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color:MyColors.darkIconColor) - ), + quarterTurns: AppState().isArabic(context) ? 2 : 4, + child: SvgPicture.asset( + "assets/images/arrow_next.svg", + color: MyColors.darkIconColor)), ], ), ], @@ -336,12 +433,15 @@ class _WorkListScreenState extends State { ); } - Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, int index) { + Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, + int index) { return InkWell( onTap: () async { AppState().setWorkListIndex = index; var data = workList![index]; - var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.workListDetail, arguments: workData); + var shouldReloadData = await Navigator.pushNamed( + context, AppRoutes.workListDetail, + arguments: workData); if (shouldReloadData != null) { if (shouldReloadData.toString() == "delegate_reload") { calculateCounter(); @@ -366,7 +466,8 @@ class _WorkListScreenState extends State { }, child: Container( width: double.infinity, - padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + padding: + const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), @@ -385,11 +486,20 @@ class _WorkListScreenState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), - gradient: LinearGradient(transform: GradientRotation(.218), begin: Alignment.topRight, end: Alignment.bottomRight, colors: data.color), + gradient: LinearGradient( + transform: GradientRotation(.218), + begin: Alignment.topRight, + end: Alignment.bottomRight, + colors: data.color), ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, - children: [SvgPicture.asset("assets/images/miss_swipe.svg", width: 20, height: 20, color: Colors.white), 2.height, data.name.toText10(color: Colors.white)], + children: [ + SvgPicture.asset("assets/images/miss_swipe.svg", + width: 20, height: 20, color: Colors.white), + 2.height, + data.name.toText10(color: Colors.white) + ], ).paddingAll(6), ), 8.width, @@ -402,12 +512,17 @@ class _WorkListScreenState extends State { 10.height, Row( children: [ - DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDate(workData.bEGINDATE!), false).toText10(color: MyColors.lightTextColor).expanded, + DateUtil.formatDateToDate( + DateUtil.convertSimpleStringDateToDate( + workData.bEGINDATE!), + false) + .toText10(color: MyColors.lightTextColor) + .expanded, RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color:MyColors.darkIconColor) - ), - + quarterTurns: AppState().isArabic(context) ? 2 : 4, + child: SvgPicture.asset( + "assets/images/arrow_next.svg", + color: MyColors.darkIconColor)), ], ), ], From 06810486e32501ee46e0e3787d697c1c30931a0d Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 11 Oct 2022 12:32:22 +0300 Subject: [PATCH 15/20] dynamic list center issue fixed. --- .../leave_balance/calculate_absence_duration_model.dart | 4 ++-- lib/ui/leave_balance/add_leave_balance_screen.dart | 4 ++-- .../dynamic_screens/dynamic_listview_screen.dart | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/models/leave_balance/calculate_absence_duration_model.dart b/lib/models/leave_balance/calculate_absence_duration_model.dart index b16b4c3..0f0a48b 100644 --- a/lib/models/leave_balance/calculate_absence_duration_model.dart +++ b/lib/models/leave_balance/calculate_absence_duration_model.dart @@ -1,6 +1,6 @@ class CalculateAbsenceDuration { - int? pABSENCEDAYS; - int? pABSENCEHOURS; + num? pABSENCEDAYS; + num? pABSENCEHOURS; String? pRETURNMSG; String? pRETURNSTATUS; diff --git a/lib/ui/leave_balance/add_leave_balance_screen.dart b/lib/ui/leave_balance/add_leave_balance_screen.dart index dc44085..477f978 100644 --- a/lib/ui/leave_balance/add_leave_balance_screen.dart +++ b/lib/ui/leave_balance/add_leave_balance_screen.dart @@ -81,8 +81,8 @@ class _AddLeaveBalanceScreenState extends State { Utils.showLoading(context); CalculateAbsenceDuration duration = await LeaveBalanceApiClient() .calculateAbsenceDuration(selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, Utils.getMonthNamedFormat(startDateTime!), Utils.getMonthNamedFormat(endDateTime!), -999); - print(duration.toJson()); - totalDays = duration.pABSENCEDAYS; + + totalDays = duration.pABSENCEDAYS?.toInt(); Utils.hideLoading(context); setState(() {}); } catch (ex) { diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart index 1f03683..57b61d9 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart @@ -69,10 +69,8 @@ class _DynamicListViewScreenState extends State { isTicketRequest = dynamicParams!.dynamicId == "HMG_TKT_NEW_EIT_SS"; getTransactions(); } - Widget dataWidget = ListView( physics: const BouncingScrollPhysics(), - shrinkWrap: true, padding: const EdgeInsets.all(21), children: [ // HMG_TKT_NEW_EIT_SS Id used for ticket balance dashboard From bf7a18b91cf334195fe3f2e856280082324972c1 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 11 Oct 2022 16:34:46 +0300 Subject: [PATCH 16/20] action colors added. contact details improvement --- lib/ui/profile/contact_details.dart | 64 ++---- lib/ui/profile/phone_numbers.dart | 193 ++++++------------ .../worklist_fragments/actions_fragment.dart | 8 +- 3 files changed, 82 insertions(+), 183 deletions(-) diff --git a/lib/ui/profile/contact_details.dart b/lib/ui/profile/contact_details.dart index eb23a93..d64eeb4 100644 --- a/lib/ui/profile/contact_details.dart +++ b/lib/ui/profile/contact_details.dart @@ -84,24 +84,8 @@ class _ContactDetailsState extends State { if (getEmployeePhonesList.isNotEmpty) Stack( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - menuEntriesPhone.updateButton == 'Y' - ? IconButton( - icon: Icon( - Icons.edit_location_alt_outlined, - size: 20, - ), - onPressed: () { - updatePhone(); - }, - ) - : Container() - ], - ), ListView.separated( - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, padding: EdgeInsets.zero, itemBuilder: (cxt, index) => Column( @@ -113,38 +97,20 @@ class _ContactDetailsState extends State { ), separatorBuilder: (cxt, index) => 12.height, itemCount: getEmployeePhonesList.length), - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: getEmployeePhonesList - // .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - // "${e.pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), - // "${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), - // ])) - // .toList()) + if (menuEntriesPhone.updateButton == 'Y') + Positioned( + top: 1, + right: 1, + child: const Icon(Icons.edit_location_alt_outlined, size: 20).onPress(updatePhone), + ), ], ).objectContainerView(), 12.height, if (getEmployeeAddressList.isNotEmpty) Stack( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - menuEntriesAddress.updateButton == 'Y' - ? IconButton( - icon: Icon( - Icons.edit_location_alt_outlined, - size: 20, - ), - onPressed: () { - addUpdateAddress(); - }, - ) - : Container() - ], - ), ListView.separated( - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, padding: EdgeInsets.zero, itemBuilder: (cxt, index) => Column( @@ -156,14 +122,12 @@ class _ContactDetailsState extends State { ), separatorBuilder: (cxt, index) => 12.height, itemCount: getEmployeeAddressList.length), - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: getEmployeeAddressList - // .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - // "${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), - // "${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), - // ])) - // .toList()) + if (menuEntriesAddress.updateButton == 'Y') + Positioned( + top: 1, + right: 1, + child: const Icon(Icons.edit_location_alt_outlined, size: 20).onPress(addUpdateAddress), + ), ], ).objectContainerView() ], diff --git a/lib/ui/profile/phone_numbers.dart b/lib/ui/profile/phone_numbers.dart index 4b27b19..f4be007 100644 --- a/lib/ui/profile/phone_numbers.dart +++ b/lib/ui/profile/phone_numbers.dart @@ -4,6 +4,8 @@ import 'package:mohem_flutter_app/api/profile_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; @@ -26,6 +28,7 @@ class PhoneNumbers extends StatefulWidget { class _PhoneNumbersState extends State { List getPhoneNumberTypesList = []; SubmitPhonesTransactionList submitPhoneNumbers = SubmitPhonesTransactionList(); + @override void initState() { super.initState(); @@ -46,129 +49,66 @@ class _PhoneNumbersState extends State { title: LocaleKeys.profile_contactDetails.tr(), ), backgroundColor: MyColors.backgroundColor, - bottomSheet: footer(), - body: SingleChildScrollView( - child: Column( - children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(left: 25, right: 25, top: 25), - padding: EdgeInsets.all(20), - // height: 400, - decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10.0), border: Border.all(color: Color.fromARGB(255, 209, 207, 207))), - child: InkWell( - child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon( - Icons.add, - color: Color(0xff259CB8), - ), - Text( - LocaleKeys.addRow.tr(), - style: TextStyle(color: Color(0xff259CB8), fontWeight: FontWeight.bold), - ) - ]), - onTap: () { - addNewRow(); - }, - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: widget.getEmployeePhonesList - .map((e) => e.aCTION != 'DELETE_ROW' - ? Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 20, - left: 26, - right: 26, - ), - padding: EdgeInsets.only(left: 14, right: 14, top: 15, bottom: 15), - // height: 400, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 26, - offset: Offset(0, 3), - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(10.0), - ), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - PopupMenuButton( - child: DynamicTextFieldWidget( - LocaleKeys.pleaseSelect.tr(), - e.pHONETYPEMEANING ?? "", - isEnable: false, - isPopup: true, - ).paddingOnly(bottom: 12), - itemBuilder: (_) => >[ - for (int i = 0; i < getPhoneNumberTypesList.length; i++) PopupMenuItem(child: Text(getPhoneNumberTypesList![i].mEANING!), value: i), - ], - onSelected: (int index) { - e.pHONETYPEMEANING = getPhoneNumberTypesList[index].mEANING; - e.pHONETYPE = getPhoneNumberTypesList[index].cODE; - setState(() {}); - }), - DynamicTextFieldWidget( - "", - e.pHONENUMBER ?? "", - isReadOnly: false, - onChange: (text) { - e.pHONENUMBER = text; - }, - ).paddingOnly(bottom: 12), - InkWell( - child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [ - Icon( - Icons.delete, - color: Colors.red, - size: 18, - ), - Text( - LocaleKeys.delete.tr(), - style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold), - ) - ]), - onTap: () { - // widget.getEmployeePhonesList.removeWhere((item) => item.pHONEID == e.pHONEID); - setState(() { - deleteRow(e); - }); - }, - ), - SizedBox( - height: 10, - ), - ])) - : Container()) - .toList()), - SizedBox( - height: 80, - ) - ], - ), - ), - ); - } - - Widget footer() { - return Container( - decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(10), - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), + body: Column( + children: [ + ListView( + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.all(21), + children: [ + DefaultButton("+ ${LocaleKeys.addRow.tr()}", () { + widget.getEmployeePhonesList.add(GetEmployeePhonesList(aCTION: 'NEW_ROW')); + setState(() {}); + }), + 12.height, + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) { + var element = widget.getEmployeePhonesList[index]; + return element.aCTION != 'DELETE_ROW' + ? Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + PopupMenuButton( + child: DynamicTextFieldWidget( + LocaleKeys.selectTypeT.tr(), + element.pHONETYPEMEANING ?? LocaleKeys.pleaseSelect.tr(), + isEnable: false, + isPopup: true, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < getPhoneNumberTypesList.length; i++) PopupMenuItem(child: Text(getPhoneNumberTypesList![i].mEANING!), value: i), + ], + onSelected: (int index) { + element.pHONETYPEMEANING = getPhoneNumberTypesList[index].mEANING; + element.pHONETYPE = getPhoneNumberTypesList[index].cODE; + setState(() {}); + }), + DynamicTextFieldWidget( + "Value", + element.pHONENUMBER ?? "", + isReadOnly: false, + onChange: (text) { + element.pHONENUMBER = text; + }, + ).paddingOnly(bottom: 12), + Row(mainAxisAlignment: MainAxisAlignment.end, children: [ + Icon(Icons.delete, color: MyColors.redColor, size: 18), + LocaleKeys.delete.tr().toText14(color: MyColors.redColor), + ]).onPress(() { + element.aCTION = 'DELETE_ROW'; + setState(() {}); + }), + ]).objectContainerView().paddingOnly(bottom: 12) + : Container(); + }, + separatorBuilder: (cxt, index) => 0.height, + itemCount: widget.getEmployeePhonesList.length) + ], + ).expanded, + DefaultButton(LocaleKeys.update.tr(), () async { + updatePhone(); + }).insideContainer ], ), - child: DefaultButton(LocaleKeys.update.tr(), () async { - updatePhone(); - // context.setLocale(const Locale("en", "US")); // to change Loacle - // Profile(); - }).insideContainer, ); } @@ -176,7 +116,6 @@ class _PhoneNumbersState extends State { Utils.showLoading(context); setUpdateStatus(); submitPhoneNumbers = await ProfileApiClient().submitPhoneNumbers(widget.getEmployeePhonesList); - Utils.hideLoading(context); Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.profile_contactDetails.tr(), submitPhoneNumbers.pTRANSACTIONID!, submitPhoneNumbers.pITEMKEY!, 'phone_numbers')); @@ -191,14 +130,4 @@ class _PhoneNumbersState extends State { } }); } - - void addNewRow() { - setState(() { - widget.getEmployeePhonesList.add(GetEmployeePhonesList(aCTION: 'NEW_ROW')); - }); - } - - void deleteRow(GetEmployeePhonesList row) { - row.aCTION = 'DELETE_ROW'; - } } diff --git a/lib/ui/work_list/worklist_fragments/actions_fragment.dart b/lib/ui/work_list/worklist_fragments/actions_fragment.dart index db40be1..bc97c79 100644 --- a/lib/ui/work_list/worklist_fragments/actions_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/actions_fragment.dart @@ -115,9 +115,15 @@ class ActionsFragment extends StatelessWidget { if (code == "SUBMIT") { return const Color(0xff2E303A); } else if (code == "REJECTED") { - return const Color(0xffD02127); + return MyColors.redColor; + } else if (code == "REJECT") { + return MyColors.redColor; + } else if (code == "PENDING") { + return MyColors.orange; } else if (code == "APPROVED") { return const Color(0xff1FA269); + } else if (code != "SUBMIT" && code != "REJECT" && code != "PENDING") { + return const Color(0xff1FA269); } else if (code == "REQUEST_INFO") { return const Color(0xff2E303A); } else { From 116175efaaeac701eb3432d7616b6bd91a05c8d9 Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Wed, 12 Oct 2022 15:30:11 +0300 Subject: [PATCH 17/20] Work list UI Change --- assets/langs/ar-SA.json | 2 + assets/langs/en-US.json | 2 + lib/extensions/int_extensions.dart | 2 + lib/extensions/string_extensions.dart | 15 + lib/generated/locale_keys.g.dart | 2 + lib/models/get_page_notification.dart | 157 ++++++++ .../request_detail_fragment.dart | 43 +- .../worklist_fragments/detail_fragment.dart | 81 ++-- .../worklist_fragments/info_fragments.dart | 380 ++++++++++++++---- .../worklist_fragments/request_fragment.dart | 170 +++++--- lib/widgets/item_detail_view_widget.dart | 108 +++++ pubspec.yaml | 1 + 12 files changed, 789 insertions(+), 174 deletions(-) create mode 100644 lib/models/get_page_notification.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 3f1461b..c2acece 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -407,6 +407,8 @@ "rateUI": ".1 كيف تريد تقييم التطبيق", "submitSurvey":"ارسال الاستبيان", "typeHere": "اكتب هنا", + "info_detail": "تفاصيل المعلومات", + "amount_detail": "تفاصيل المبلغ", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 23b7d3e..9e635ae 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -407,6 +407,8 @@ "rateUI": "1. How would you rate this UI?", "submitSurvey":"Submit Survey", "typeHere": "Type here", + "info_detail": "Info Detail", + "amount_detail": "Amount Detail", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/extensions/int_extensions.dart b/lib/extensions/int_extensions.dart index f46d5bb..16bdd29 100644 --- a/lib/extensions/int_extensions.dart +++ b/lib/extensions/int_extensions.dart @@ -10,4 +10,6 @@ extension IntExtensions on int { Widget get divider => Divider(height: toDouble(), thickness: toDouble(), color: MyColors.lightGreyEFColor); Widget get makeItSquare => SizedBox(width: toDouble(), height: toDouble()); + + } diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 5fa9f8b..a9075c7 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -1,3 +1,4 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:intl/intl.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; @@ -45,6 +46,20 @@ extension EmailValidator on String { ), ); + Widget toText12Auto({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => AutoSizeText( + this, + textAlign: isCenter ? TextAlign.center : null, + maxLines: (maxLine > 0) ? maxLine : null, + minFontSize: 8, + style: TextStyle( + fontSize: 12, + fontWeight: isBold ? FontWeight.bold : FontWeight.w600, + color: color ?? MyColors.darkTextColor, + letterSpacing: -0.72, + decoration: isUnderLine ? TextDecoration.underline : null, + ), + ); + Widget toText13({Color? color, bool isUnderLine = false}) => Text( this, style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.52, decoration: isUnderLine ? TextDecoration.underline : null), diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 0934ff4..8b1f7ab 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -408,6 +408,8 @@ abstract class LocaleKeys { static const rateUI = 'rateUI'; static const submitSurvey = 'submitSurvey'; static const typeHere = 'typeHere'; + static const info_detail = 'info_detail'; + static const amount_detail = 'amount_detail'; 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/models/get_page_notification.dart b/lib/models/get_page_notification.dart new file mode 100644 index 0000000..2209a87 --- /dev/null +++ b/lib/models/get_page_notification.dart @@ -0,0 +1,157 @@ +// To parse this JSON data, do +// +// final getPageNotification = getPageNotificationFromJson(jsonString); + +import 'dart:convert'; + +GetPageNotification getPageNotificationFromJson(String str) => GetPageNotification.fromJson(json.decode(str)); + +String getPageNotificationToJson(GetPageNotification data) => json.encode(data.toJson()); + +class GetPageNotification { + GetPageNotification({ + this.statusCode, + this.message, + this.originalErrMsg, + this.result, + }); + + final int? statusCode; + final dynamic message; + final dynamic originalErrMsg; + final GetPageNotificationResult? result; + + factory GetPageNotification.fromJson(Map json) => GetPageNotification( + statusCode: json["statusCode"] == null ? null : json["statusCode"], + message: json["message"], + originalErrMsg: json["originalErrMsg"], + result: json["result"] == null ? null : GetPageNotificationResult.fromJson(json["result"]), + ); + + Map toJson() => { + "statusCode": statusCode == null ? null : statusCode, + "message": message, + "originalErrMsg": originalErrMsg, + "result": result == null ? null : result!.toJson(), + }; +} + +class GetPageNotificationResult { + GetPageNotificationResult({ + this.totalItemsCount, + this.data, + this.errormsg, + }); + + final dynamic totalItemsCount; + final GetPageNotificationData? data; + final dynamic errormsg; + + factory GetPageNotificationResult.fromJson(Map json) => GetPageNotificationResult( + totalItemsCount: json["totalItemsCount"], + data: json["data"] == null ? null : GetPageNotificationData.fromJson(json["data"]), + errormsg: json["errormsg"], + ); + + Map toJson() => { + "totalItemsCount": totalItemsCount, + "data": data == null ? null : data!.toJson(), + "errormsg": errormsg, + }; +} + +class GetPageNotificationData { + GetPageNotificationData({ + this.notificationMasterId, + this.notificationType, + this.referenceItemId, + this.notificationTitle, + this.enableAt, + this.applicationItemId, + this.startDate, + this.endDate, + this.isRepeat, + this.channelId, + this.serviceId, + this.channelName, + this.serviceName, + this.isDeleted, + this.showDelete, + this.advertisement, + this.survey, + this.isActive, + this.pageSize, + this.pageNo, + this.languageId, + }); + + final String? notificationMasterId; + final String? notificationType; + final int? referenceItemId; + final String? notificationTitle; + final String? enableAt; + final dynamic applicationItemId; + final dynamic startDate; + final dynamic endDate; + final bool? isRepeat; + final int? channelId; + final int? serviceId; + final String? channelName; + final String? serviceName; + final bool? isDeleted; + final bool? showDelete; + final dynamic advertisement; + final dynamic survey; + final dynamic isActive; + final dynamic pageSize; + final dynamic pageNo; + final dynamic languageId; + + factory GetPageNotificationData.fromJson(Map json) => GetPageNotificationData( + notificationMasterId: json["notificationMasterId"] == null ? null : json["notificationMasterId"], + notificationType: json["notificationType"] == null ? null : json["notificationType"], + referenceItemId: json["referenceItemId"] == null ? null : json["referenceItemId"], + notificationTitle: json["notificationTitle"] == null ? null : json["notificationTitle"], + enableAt: json["enableAt"] == null ? null : json["enableAt"], + applicationItemId: json["applicationItemId"], + startDate: json["startDate"], + endDate: json["endDate"], + isRepeat: json["isRepeat"] == null ? null : json["isRepeat"], + channelId: json["channelId"] == null ? null : json["channelId"], + serviceId: json["serviceId"] == null ? null : json["serviceId"], + channelName: json["channelName"] == null ? null : json["channelName"], + serviceName: json["serviceName"] == null ? null : json["serviceName"], + isDeleted: json["isDeleted"] == null ? null : json["isDeleted"], + showDelete: json["showDelete"] == null ? null : json["showDelete"], + advertisement: json["advertisement"], + survey: json["survey"], + isActive: json["isActive"], + pageSize: json["pageSize"], + pageNo: json["pageNo"], + languageId: json["languageId"], + ); + + Map toJson() => { + "notificationMasterId": notificationMasterId == null ? null : notificationMasterId, + "notificationType": notificationType == null ? null : notificationType, + "referenceItemId": referenceItemId == null ? null : referenceItemId, + "notificationTitle": notificationTitle == null ? null : notificationTitle, + "enableAt": enableAt == null ? null : enableAt, + "applicationItemId": applicationItemId, + "startDate": startDate, + "endDate": endDate, + "isRepeat": isRepeat == null ? null : isRepeat, + "channelId": channelId == null ? null : channelId, + "serviceId": serviceId == null ? null : serviceId, + "channelName": channelName == null ? null : channelName, + "serviceName": serviceName == null ? null : serviceName, + "isDeleted": isDeleted == null ? null : isDeleted, + "showDelete": showDelete == null ? null : showDelete, + "advertisement": advertisement, + "survey": survey, + "isActive": isActive, + "pageSize": pageSize, + "pageNo": pageNo, + "languageId": languageId, + }; +} diff --git a/lib/ui/work_list/itg_fragments/request_detail_fragment.dart b/lib/ui/work_list/itg_fragments/request_detail_fragment.dart index 6c69c47..6092bef 100644 --- a/lib/ui/work_list/itg_fragments/request_detail_fragment.dart +++ b/lib/ui/work_list/itg_fragments/request_detail_fragment.dart @@ -11,9 +11,13 @@ class RequestDetailFragment extends StatelessWidget { List fields; RequestDetailFragment({Key? key, this.fields = const []}) : super(key: key); - + double itemHeight = 0; + double itemWidth = 0; @override Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + itemHeight = (size.height - kToolbarHeight - 24) / 9; + itemWidth = size.width / 2; List uiList = [detailView()]; return Container( width: double.infinity, @@ -28,6 +32,43 @@ class RequestDetailFragment extends StatelessWidget { } Widget detailView() { + bool isOdd = false; + if (fields.length % 2 != 0) { + isOdd = true; + fields.add(new Fields()); + } + return GridView.builder( + itemCount: fields.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + if (fields[index].value == null) { + return ItemDetailViewGridItem( + index, + fields[index].title, fields[index].multipleValue?.join(", ") ?? "", + isNeedToShowEmptyDivider: (fields.length == index + 1) + ? isOdd + ? true + : false + : false, + ); + } + return ItemDetailViewGridItem( + index, + fields[index].title, + fields[index].value ?? "", + isNeedToShowEmptyDivider: (fields.length == index + 1) + ? isOdd + ? true + : false + : false, + ); + }, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + ), + ).objectContainerView(); return ListView.separated( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), diff --git a/lib/ui/work_list/worklist_fragments/detail_fragment.dart b/lib/ui/work_list/worklist_fragments/detail_fragment.dart index 7e2567e..43b5d7d 100644 --- a/lib/ui/work_list/worklist_fragments/detail_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/detail_fragment.dart @@ -23,37 +23,56 @@ class _DetailFragmentState extends State { @override Widget build(BuildContext context) { - return Column( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - ItemDetailView(LocaleKeys.from.tr(), widget.workListData!.fROMUSER ?? ""), - ItemDetailView(LocaleKeys.to.tr(), widget.workListData!.tOUSER ?? ""), - ItemDetailView(LocaleKeys.sent.tr(), widget.workListData!.bEGINDATE ?? ""), - ItemDetailView(LocaleKeys.closed.tr(), widget.workListData!.eNDDATE ?? ""), - ItemDetailView(LocaleKeys.id.tr(), widget.workListData!.nOTIFICATIONID?.toString() ?? ""), - ItemDetailView(LocaleKeys.responder.tr(), widget.workListData!.rESPONDER ?? ""), - ], - ).objectContainerView(), - 12.height, - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - ItemDetailView(LocaleKeys.employeeNumber.tr(), widget.memberInformationListModel!.eMPLOYEENUMBER ?? ""), - ItemDetailView(LocaleKeys.employeeName.tr(), (AppState().isArabic(context) ? widget.memberInformationListModel!.eMPLOYEENAMEAr : widget.memberInformationListModel!.eMPLOYEENAMEEn) ?? ""), - ItemDetailView(LocaleKeys.jobTitle.tr(), makePositionName(widget.memberInformationListModel!.pOSITIONNAME ?? "")), - ItemDetailView(LocaleKeys.grade.tr(), widget.memberInformationListModel!.gRADENAME ?? ""), - ItemDetailView(LocaleKeys.jobCategory.tr(), makePositionName(widget.memberInformationListModel!.pOSITIONNAME ?? "")), - ItemDetailView(LocaleKeys.category.tr(), widget.memberInformationListModel!.eMPLOYMENTCATEGORYMEANING ?? ""), - ItemDetailView(LocaleKeys.employeeEmailAddress.tr(), widget.memberInformationListModel!.eMPLOYEEEMAILADDRESS ?? ""), - ItemDetailView(LocaleKeys.payrollBranch.tr(), widget.memberInformationListModel!.pAYROLLNAME ?? ""), - ], - ).objectContainerView(), - ], - ).paddingAll(21); + return SingleChildScrollView( + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.from.tr(), widget.workListData!.fROMUSER ?? ""), + ItemDetailViewCol(LocaleKeys.to.tr(), widget.workListData!.tOUSER ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.sent.tr(), widget.workListData!.bEGINDATE ?? ""), + ItemDetailViewCol(LocaleKeys.closed.tr(), widget.workListData!.eNDDATE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.id.tr(), widget.workListData!.nOTIFICATIONID?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.responder.tr(), widget.workListData!.rESPONDER ?? ""), + isItLast: true, + ), + ], + ).objectContainerView(), + 12.height, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.employeeNumber.tr(), widget.memberInformationListModel!.eMPLOYEENUMBER ?? ""), + ItemDetailViewCol( + LocaleKeys.employeeName.tr(), (AppState().isArabic(context) ? widget.memberInformationListModel!.eMPLOYEENAMEAr : widget.memberInformationListModel!.eMPLOYEENAMEEn) ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.jobTitle.tr(), makePositionName(widget.memberInformationListModel!.pOSITIONNAME ?? "")), + ItemDetailViewCol(LocaleKeys.grade.tr(), widget.memberInformationListModel!.gRADENAME ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.jobCategory.tr(), makePositionName(widget.memberInformationListModel!.pOSITIONNAME ?? "")), + ItemDetailViewCol(LocaleKeys.category.tr(), widget.memberInformationListModel!.eMPLOYMENTCATEGORYMEANING ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.employeeEmailAddress.tr(), widget.memberInformationListModel!.eMPLOYEEEMAILADDRESS ?? ""), + ItemDetailViewCol(LocaleKeys.payrollBranch.tr(), widget.memberInformationListModel!.pAYROLLNAME ?? ""), + isItLast: true, + ), + ], + ).objectContainerView(), + ], + ).paddingAll(21), + ); } String makePositionName(String job) { diff --git a/lib/ui/work_list/worklist_fragments/info_fragments.dart b/lib/ui/work_list/worklist_fragments/info_fragments.dart index bc47989..b221563 100644 --- a/lib/ui/work_list/worklist_fragments/info_fragments.dart +++ b/lib/ui/work_list/worklist_fragments/info_fragments.dart @@ -42,21 +42,38 @@ class InfoFragment extends StatelessWidget { this.getContactNotificationBodyList, }); + double itemHeight = 0; + double itemWidth = 0; + @override Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + itemHeight = (size.height - kToolbarHeight - 24) / 9; + itemWidth = size.width / 2; + List uiList = [ if ((workListData?.iTEMTYPE ?? "") == "INVMOA") Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - ItemDetailView(LocaleKeys.from.tr(), workListData!.fROMUSER ?? ""), - ItemDetailView(LocaleKeys.to.tr(), workListData!.tOUSER ?? ""), - ItemDetailView(LocaleKeys.sent.tr(), workListData!.bEGINDATE ?? ""), - ItemDetailView(LocaleKeys.closed.tr(), workListData!.eNDDATE ?? ""), - ItemDetailView(LocaleKeys.id.tr(), workListData!.nOTIFICATIONID?.toString() ?? ""), - ItemDetailView(LocaleKeys.responder.tr(), workListData!.rESPONDER ?? ""), - ItemDetailView(LocaleKeys.subject.tr(), workListData!.sUBJECT ?? ""), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.from.tr(), workListData!.fROMUSER ?? ""), + ItemDetailViewCol(LocaleKeys.to.tr(), workListData!.tOUSER ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.sent.tr(), workListData!.bEGINDATE ?? ""), + ItemDetailViewCol(LocaleKeys.closed.tr(), workListData!.eNDDATE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.id.tr(), workListData!.nOTIFICATIONID?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.responder.tr(), workListData!.rESPONDER ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.subject.tr(), workListData!.sUBJECT ?? ""), + Container(), + isItLast: true, + ), ], ).objectContainerView(), if (getStampMsNotifications?.isNotEmpty ?? false) getStampMsNotificationsListView(getStampMsNotifications ?? []).objectContainerView(title: "Stamp Notifications"), @@ -89,31 +106,67 @@ class InfoFragment extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - ItemDetailView(LocaleKeys.description.tr(), workListData!.fROMUSER ?? ""), - ItemDetailView(LocaleKeys.from.tr(), workListData!.fROMUSER ?? ""), - ItemDetailView(LocaleKeys.to.tr(), workListData!.tOUSER ?? ""), - ItemDetailView(LocaleKeys.sent.tr(), workListData!.bEGINDATE ?? ""), - ItemDetailView(LocaleKeys.closed.tr(), workListData!.eNDDATE ?? ""), - ItemDetailView(LocaleKeys.id.tr(), workListData!.nOTIFICATIONID?.toString() ?? ""), - ItemDetailView(LocaleKeys.supplier.tr(), poHeaderList[index].vENDORNAME ?? ""), - ItemDetailView(LocaleKeys.site.tr(), poHeaderList[index].vENDORSITECODE ?? ""), - ItemDetailView(LocaleKeys.buyer.tr(), poHeaderList[index].bUYER ?? ""), - ItemDetailView(LocaleKeys.preparer.tr(), poHeaderList[index].pREPARER ?? ""), - ItemDetailView(LocaleKeys.creationDate.tr(), poHeaderList[index].cREATIONDATE ?? ""), - ItemDetailView(LocaleKeys.shipToLocation.tr(), poHeaderList[index].sHIPTOLOCATIONNAME ?? ""), - ItemDetailView(LocaleKeys.quotationNumber.tr(), poHeaderList[index].qUOTATIONNUMBER ?? ""), - ItemDetailView(LocaleKeys.quotationDate.tr(), poHeaderList[index].qUOTATIONDATE ?? ""), - ItemDetailView(LocaleKeys.paymentTerms.tr(), poHeaderList[index].pAYMENTTERMS ?? ""), - ItemDetailView(LocaleKeys.currency.tr(), poHeaderList[index].cURRENCYNAME ?? ""), - ItemDetailView(LocaleKeys.grossAmount.tr(), poHeaderList[index].gROSSAMOUNT?.toString() ?? ""), - ItemDetailView(LocaleKeys.discountAmount.tr(), poHeaderList[index].dISCOUNTAMOUNT?.toString() ?? ""), - ItemDetailView(LocaleKeys.customDuty.tr(), poHeaderList[index].cUSTOMDUTY?.toString() ?? ""), - ItemDetailView(LocaleKeys.shipHandle.tr(), poHeaderList[index].sHIPHANDLE?.toString() ?? ""), - ItemDetailView(LocaleKeys.otherCharges.tr(), poHeaderList[index].oTHERCHARGES?.toString() ?? ""), - ItemDetailView(LocaleKeys.totalPOAmountWithVAT.tr(), poHeaderList[index].qUOTATIONDATE ?? ""), - ItemDetailView(LocaleKeys.totalPOAmountInWords.tr(), poHeaderList[index].tOTPOAMTWORD ?? ""), + Column( + children: [ + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.description.tr(), workListData!.fROMUSER ?? ""), + ItemDetailViewCol(LocaleKeys.from.tr(), workListData!.fROMUSER ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.to.tr(), workListData!.tOUSER ?? ""), + ItemDetailViewCol(LocaleKeys.sent.tr(), workListData!.bEGINDATE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.closed.tr(), workListData!.eNDDATE ?? ""), + ItemDetailViewCol(LocaleKeys.id.tr(), workListData!.nOTIFICATIONID?.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.supplier.tr(), poHeaderList[index].vENDORNAME ?? ""), + ItemDetailViewCol(LocaleKeys.site.tr(), poHeaderList[index].vENDORSITECODE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.buyer.tr(), poHeaderList[index].bUYER ?? ""), + ItemDetailViewCol(LocaleKeys.preparer.tr(), poHeaderList[index].pREPARER ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.creationDate.tr(), poHeaderList[index].cREATIONDATE ?? ""), + ItemDetailViewCol(LocaleKeys.shipToLocation.tr(), poHeaderList[index].sHIPTOLOCATIONNAME ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.quotationNumber.tr(), poHeaderList[index].qUOTATIONNUMBER ?? ""), + ItemDetailViewCol(LocaleKeys.quotationDate.tr(), poHeaderList[index].qUOTATIONDATE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.paymentTerms.tr(), poHeaderList[index].pAYMENTTERMS ?? ""), + ItemDetailViewCol(LocaleKeys.currency.tr(), poHeaderList[index].cURRENCYNAME ?? ""), + isItLast: true, + ), + ], + ).objectContainerView(title: LocaleKeys.info_detail.tr()), + 12.height, + Column( + children: [ + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.grossAmount.tr(), poHeaderList[index].gROSSAMOUNT?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.discountAmount.tr(), poHeaderList[index].dISCOUNTAMOUNT?.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.customDuty.tr(), poHeaderList[index].cUSTOMDUTY?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.shipHandle.tr(), poHeaderList[index].sHIPHANDLE?.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.otherCharges.tr(), poHeaderList[index].oTHERCHARGES?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.totalPOAmountWithVAT.tr(), poHeaderList[index].qUOTATIONDATE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.totalPOAmountInWords.tr(), poHeaderList[index].tOTPOAMTWORD ?? ""), + Container(), + isItLast: true, + ), + ], + ).objectContainerView(title: LocaleKeys.amount_detail.tr()), ], - ).objectContainerView(), + ), separatorBuilder: (cxt, index) => 4.height, itemCount: poHeaderList.length); } @@ -135,19 +188,35 @@ class InfoFragment extends StatelessWidget { itemBuilder: (cxt, index) => Column( mainAxisSize: MainAxisSize.min, children: [ - ItemDetailView(LocaleKeys.employeeNumber.tr(), list[index].eMPLOYEENUMBER.toString()), - ItemDetailView(LocaleKeys.assignmentNumber.tr(), list[index].aSSIGNMENTNUMBER.toString()), - ItemDetailView(LocaleKeys.employeeName.tr(), list[index].eMPLOYEENAME.toString()), - ItemDetailView(LocaleKeys.scheduleDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(list[index].sCHEDULEDATE.toString()), false)), - ItemDetailView(LocaleKeys.shiftType.tr(), list[index].sHTTYPEDESC.toString()), - ItemDetailView(LocaleKeys.shift.tr(), list[index].sHTNAME.toString()), - ItemDetailView(LocaleKeys.breakText.tr(), list[index].bREAKNAME.toString()), - ItemDetailView(LocaleKeys.actualSwipeStart.tr(), list[index].sHTACTUALSTARTTIME.toString()), - ItemDetailView(LocaleKeys.actualSwipeEnd.tr(), list[index].sHTACTUALENDTIME.toString()), - ItemDetailView(LocaleKeys.approvedSwipeStart.tr(), list[index].aPPROVEDSTARTTIME.toString()), - ItemDetailView(LocaleKeys.approvedSwipeStartReason.tr(), list[index].aPPROVEDSTARTREASON.toString()), - ItemDetailView(LocaleKeys.approvedSwipeEnd.tr(), ""), - ItemDetailView(LocaleKeys.approvedSwipeEndReason.tr(), list[index].aPPROVEDENDREASONDESC.toString()), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.employeeNumber.tr(), list[index].eMPLOYEENUMBER.toString()), + ItemDetailViewCol(LocaleKeys.assignmentNumber.tr(), list[index].aSSIGNMENTNUMBER.toString()), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.employeeName.tr(), list[index].eMPLOYEENAME.toString()), + ItemDetailViewCol(LocaleKeys.scheduleDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(list[index].sCHEDULEDATE.toString()), false)), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.shiftType.tr(), list[index].sHTTYPEDESC.toString()), + ItemDetailViewCol(LocaleKeys.shift.tr(), list[index].sHTNAME.toString()), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.breakText.tr(), list[index].bREAKNAME.toString()), + ItemDetailViewCol(LocaleKeys.actualSwipeStart.tr(), list[index].sHTACTUALSTARTTIME.toString()), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.actualSwipeEnd.tr(), list[index].sHTACTUALENDTIME.toString()), + ItemDetailViewCol(LocaleKeys.approvedSwipeStart.tr(), list[index].aPPROVEDSTARTTIME.toString()), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.approvedSwipeStartReason.tr(), list[index].aPPROVEDSTARTREASON.toString()), + ItemDetailViewCol(LocaleKeys.approvedSwipeEnd.tr(), ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.approvedSwipeEndReason.tr(), list[index].aPPROVEDENDREASONDESC.toString()), + Container(), + isItLast: true, + ), ], ), separatorBuilder: (cxt, index) => 18.height, @@ -161,10 +230,15 @@ class InfoFragment extends StatelessWidget { itemBuilder: (cxt, index) => Column( mainAxisSize: MainAxisSize.min, children: [ - ItemDetailView(LocaleKeys.employeeNumber.tr(), list[index].eMPLOYEENUMBER.toString()), - ItemDetailView(LocaleKeys.assignmentNumber.tr(), list[index].aSSIGNMENTNUMBER.toString()), - ItemDetailView(LocaleKeys.employeeName.tr(), list[index].eMPLOYEENAME.toString()), - ItemDetailView(LocaleKeys.scheduleDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(list[index].sCHEDULEDATE.toString()), false)), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.employeeNumber.tr(), list[index].eMPLOYEENUMBER.toString()), + ItemDetailViewCol(LocaleKeys.assignmentNumber.tr(), list[index].aSSIGNMENTNUMBER.toString()), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.employeeName.tr(), list[index].eMPLOYEENAME.toString()), + ItemDetailViewCol(LocaleKeys.scheduleDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(list[index].sCHEDULEDATE.toString()), false)), + isItLast: true, + ), ], ), separatorBuilder: (cxt, index) => 18.height, @@ -178,16 +252,26 @@ class InfoFragment extends StatelessWidget { itemBuilder: (cxt, index) => Column( mainAxisSize: MainAxisSize.min, children: [ - ItemDetailView(LocaleKeys.operatingUnit.tr(), itemCreationHeader[index].oPERATINGUNIT?.toString() ?? ""), - ItemDetailView(LocaleKeys.category.tr(), itemCreationHeader[index].cATEGORY?.toString() ?? ""), - ItemDetailView(LocaleKeys.requester.tr(), itemCreationHeader[index].rEQUESTER?.toString() ?? ""), - ItemDetailView(LocaleKeys.analyzedBy.tr(), itemCreationHeader[index].aNALYZEDBY?.toString() ?? ""), - ItemDetailView(LocaleKeys.approvedDate.tr(), itemCreationHeader[index].aPPROVEDDATE?.toString() ?? ""), - ItemDetailView(LocaleKeys.itemType.tr(), itemCreationHeader[index].iTEMTYPE?.toString() ?? ""), - ItemDetailView(LocaleKeys.relatedTo.tr(), itemCreationHeader[index].rELATEDTO?.toString() ?? ""), - ItemDetailView(LocaleKeys.requestDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(itemCreationHeader[index].rEQUESTDATE.toString()), false)), - ItemDetailView(LocaleKeys.analyzedDate.tr(), itemCreationHeader[index].aNALYZEDDATE?.toString() ?? ""), - ItemDetailView(LocaleKeys.urgent.tr(), itemCreationHeader[index].uRGENTFLAGDISP?.toString() ?? ""), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.operatingUnit.tr(), itemCreationHeader[index].oPERATINGUNIT?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.category.tr(), itemCreationHeader[index].cATEGORY?.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.requester.tr(), itemCreationHeader[index].rEQUESTER?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.analyzedBy.tr(), itemCreationHeader[index].aNALYZEDBY?.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.approvedDate.tr(), itemCreationHeader[index].aPPROVEDDATE?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.itemType.tr(), itemCreationHeader[index].iTEMTYPE?.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.relatedTo.tr(), itemCreationHeader[index].rELATEDTO?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.requestDate.tr(), DateUtil.formatDateToDate(DateUtil.convertStringToDate(itemCreationHeader[index].rEQUESTDATE.toString()), false)), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.analyzedDate.tr(), itemCreationHeader[index].aNALYZEDDATE?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.urgent.tr(), itemCreationHeader[index].uRGENTFLAGDISP?.toString() ?? ""), + ), ], ).objectContainerView(), separatorBuilder: (cxt, index) => 18.height, @@ -201,13 +285,31 @@ class InfoFragment extends StatelessWidget { physics: const NeverScrollableScrollPhysics(), itemBuilder: (cxt, index) { List dataList = list.isEmpty ? [] : (list[index].collectionNotification ?? []); - return ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (cxt, index) => dataList[index].displayFlag == "Y" ? ItemDetailView(dataList[index].segmentPrompt!, dataList[index].segmentValueDsp!) : Container(), - separatorBuilder: (cxt, index) => dataList[index].displayFlag == "Y" ? 4.height : 0.height, - itemCount: dataList.length) - .objectContainerView(); + dataList = dataList.where((o) => o.displayFlag == "Y").toList(); + bool isOdd = false; + if (dataList.length % 2 != 0) { + isOdd = true; + dataList.add(new CollectionNotificationEit()); + } + return GridView.builder( + itemCount: dataList.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => ItemDetailViewGridItem( + index, + dataList[index].segmentPrompt, + dataList[index].segmentValueDsp, + isNeedToShowEmptyDivider: (dataList.length == index + 1) + ? isOdd + ? true + : false + : false, + ), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + ), + ).objectContainerView(); }, separatorBuilder: (cxt, index) => 12.height, itemCount: list.length, @@ -215,21 +317,75 @@ class InfoFragment extends StatelessWidget { } Widget getPhonesNotificationBodyListWidget(List list) { - return ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (cxt, index) => ItemDetailView(LocaleKeys.subject.tr(), list[index].proposedPhoneNumber ?? ""), - separatorBuilder: (cxt, index) => 4.height, - itemCount: list.length); + bool isOdd = false; + if (list.length % 2 != 0) { + isOdd = true; + list.add(new GetPhonesNotificationBodyList()); + } + return GridView.builder( + itemCount: list.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => ItemDetailViewGridItem( + index, + LocaleKeys.subject.tr(), + list[index].proposedPhoneNumber ?? "", + isNeedToShowEmptyDivider: (list.length == index + 1) + ? isOdd + ? true + : false + : false, + ), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + ), + ); + return Container( + color: Colors.yellow, + child: ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => ItemDetailViewCol(LocaleKeys.subject.tr(), list[index].proposedPhoneNumber ?? ""), + separatorBuilder: (cxt, index) => 4.height, + itemCount: list.length), + ); } Widget getBasicDetNtfBodyListWidget(List list) { - return ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (cxt, index) => ItemDetailView(list[index].segmentPrompt!, list[index].segmentValueDsp!), - separatorBuilder: (cxt, index) => 4.height, - itemCount: list.length); + bool isOdd = false; + if (list.length % 2 != 0) { + isOdd = true; + list.add(new GetBasicDetNtfBodyList()); + } + return GridView.builder( + itemCount: list.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => ItemDetailViewGridItem( + index, + list[index].segmentPrompt, + list[index].segmentValueDsp, + isNeedToShowEmptyDivider: (list.length == index + 1) + ? isOdd + ? true + : false + : false, + ), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + ), + ); + return Container( + color: Colors.pink, + child: ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => ItemDetailViewCol(list[index].segmentPrompt!, list[index].segmentValueDsp!), + separatorBuilder: (cxt, index) => 4.height, + itemCount: list.length), + ); } Widget getAbsenceCollectionNotificationBodyListWidget(List list) { @@ -238,10 +394,36 @@ class InfoFragment extends StatelessWidget { physics: const NeverScrollableScrollPhysics(), itemBuilder: (cxt, index) { List dataList = list.isEmpty ? [] : (list[index].collectionNotification ?? []); + dataList = dataList.where((o) => o.dISPLAYFLAG == "Y").toList(); + bool isOdd = false; + if (dataList.length % 2 != 0) { + isOdd = true; + dataList.add(new CollectionNotificationAbsence()); + } + + return GridView.builder( + itemCount: dataList.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => ItemDetailViewGridItem( + index, + dataList[index].sEGMENTPROMPT, + dataList[index].sEGMENTVALUEDSP, + isNeedToShowEmptyDivider: (dataList.length == index + 1) + ? isOdd + ? true + : false + : false, + ), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + ), + ).objectContainerView(); return ListView.separated( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), - itemBuilder: (cxt, index) => dataList[index].dISPLAYFLAG == "Y" ? ItemDetailView(dataList[index].sEGMENTPROMPT!, dataList[index].sEGMENTVALUEDSP!) : Container(), + itemBuilder: (cxt, index) => dataList[index].dISPLAYFLAG == "Y" ? ItemDetailViewCol(dataList[index].sEGMENTPROMPT!, dataList[index].sEGMENTVALUEDSP!) : Container(), separatorBuilder: (cxt, index) => dataList[index].dISPLAYFLAG == "Y" ? 4.height : 0.height, itemCount: dataList.length) .objectContainerView(); @@ -252,11 +434,41 @@ class InfoFragment extends StatelessWidget { } Widget getContactNotificationBodyListWidget(GetContactNotificationBodyList data) { - return ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (cxt, index) => ItemDetailView(data.contactNotificationBody![index].segmentPrompt!, data.contactNotificationBody![index].segmentValueDsp!), - separatorBuilder: (cxt, index) => 4.height, - itemCount: data.contactNotificationBody!.length); + bool isOdd = false; + try { + if (data.contactNotificationBody!.length % 2 != 0) { + isOdd = true; + data.contactNotificationBody!.add(new ContactNotificationBody()); + } + } catch (e) {} + + return GridView.builder( + itemCount: data.contactNotificationBody!.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => ItemDetailViewGridItem( + index, + data.contactNotificationBody![index].segmentPrompt, + data.contactNotificationBody![index].segmentValueDsp, + isNeedToShowEmptyDivider: (data.contactNotificationBody!.length == index + 1) + ? isOdd + ? true + : false + : false, + ), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + ), + ).objectContainerView(); + return Container( + color: Colors.orange, + child: ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => ItemDetailViewCol(data.contactNotificationBody![index].segmentPrompt!, data.contactNotificationBody![index].segmentValueDsp!), + separatorBuilder: (cxt, index) => 4.height, + itemCount: data.contactNotificationBody!.length), + ); } } diff --git a/lib/ui/work_list/worklist_fragments/request_fragment.dart b/lib/ui/work_list/worklist_fragments/request_fragment.dart index 5773ffa..27b1c29 100644 --- a/lib/ui/work_list/worklist_fragments/request_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/request_fragment.dart @@ -25,14 +25,16 @@ class RequestFragment extends StatelessWidget { @override Widget build(BuildContext context) { - return ListView( - physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.all(21), - children: [ - if (moNotificationBodyList.isNotEmpty) moNotificationDataView(), - if (poLinesList.isNotEmpty) poLinesDataView(), - if (itemCreationLines.isNotEmpty) itemCreationLinesView(), - ], + return Container( + child: ListView( + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.all(21), + children: [ + if (moNotificationBodyList.isNotEmpty) moNotificationDataView(), + if (poLinesList.isNotEmpty) poLinesDataView(), + if (itemCreationLines.isNotEmpty) itemCreationLinesView(), + ], + ), ); } @@ -44,19 +46,34 @@ class RequestFragment extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - ItemDetailView(LocaleKeys.code.tr(), poLinesList[index].iTEMCODE ?? ""), - ItemDetailView(LocaleKeys.mfg.tr(), poLinesList[index].uOM ?? ""), - ItemDetailView(LocaleKeys.lineType.tr(), poLinesList[index].qUANTITY?.toString() ?? ""), - ItemDetailView(LocaleKeys.unit.tr(), poLinesList[index].uOM ?? ""), - ItemDetailView(LocaleKeys.price.tr(), poLinesList[index].uNITPRICE?.toString() ?? ""), - ItemDetailView(LocaleKeys.lineAmount.tr(), poLinesList[index].lINEAMOUNT?.toString() ?? ""), - ItemDetailView(LocaleKeys.quantity.tr(), poLinesList[index].qUANTITY?.toString() ?? ""), - ItemDetailView(LocaleKeys.lineDiscount.tr(), poLinesList[index].lINEDISCPERCENTAGE?.toString() ?? ""), - ItemDetailView(LocaleKeys.needByDate.tr(), poLinesList[index].nEEDBYDATE ?? ""), - ItemDetailView(LocaleKeys.promisedDate.tr(), poLinesList[index].pROMISEDDATE ?? ""), - ItemDetailView(LocaleKeys.deliverToLocation.tr(), poLinesList[index].dELIVERTOLOCATION ?? ""), - ItemDetailView(LocaleKeys.requisitionNumber.tr(), poLinesList[index].rEQUESTOR ?? ""), - ItemDetailView(LocaleKeys.requester.tr(), poLinesList[index].pRNUM ?? ""), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.code.tr(), poLinesList[index].iTEMCODE ?? ""), + ItemDetailViewCol(LocaleKeys.mfg.tr(), poLinesList[index].uOM ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.lineType.tr(), poLinesList[index].qUANTITY?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.unit.tr(), poLinesList[index].uOM ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.price.tr(), poLinesList[index].uNITPRICE?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.lineAmount.tr(), poLinesList[index].lINEAMOUNT?.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.quantity.tr(), poLinesList[index].qUANTITY?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.lineDiscount.tr(), poLinesList[index].lINEDISCPERCENTAGE?.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.needByDate.tr(), poLinesList[index].nEEDBYDATE ?? ""), + ItemDetailViewCol(LocaleKeys.promisedDate.tr(), poLinesList[index].pROMISEDDATE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.deliverToLocation.tr(), poLinesList[index].dELIVERTOLOCATION ?? ""), + ItemDetailViewCol(LocaleKeys.requisitionNumber.tr(), poLinesList[index].rEQUESTOR ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.requester.tr(), poLinesList[index].pRNUM ?? ""), + Container(), + ), 12.height, Row( children: [ @@ -92,21 +109,35 @@ class RequestFragment extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - ItemDetailView(LocaleKeys.code.tr(), moNotificationBodyList[index].iTEMCODE ?? ""), - ItemDetailView(LocaleKeys.unit.tr(), moNotificationBodyList[index].uOM ?? ""), - ItemDetailView(LocaleKeys.quantity.tr(), moNotificationBodyList[index].qUANTITY?.toString() ?? ""), - ItemDetailView(LocaleKeys.dateRequired.tr(), moNotificationBodyList[index].dATEREQUIRED ?? ""), - ItemDetailView(LocaleKeys.lineStatus.tr(), moNotificationBodyList[index].lINESTATUS ?? ""), - ItemDetailView(LocaleKeys.statusDate.tr(), moNotificationBodyList[index].sTATUSDATE ?? ""), - ItemDetailView(LocaleKeys.transactionType.tr(), moNotificationBodyList[index].tRANSACTIONTYPENAME ?? ""), - ItemDetailView(LocaleKeys.operatingUnit.tr(), moNotificationBodyList[index].oPERATINGUNIT ?? ""), - ItemDetailView(LocaleKeys.organizationCode.tr(), moNotificationBodyList[index].oRGANIZATIONCODE ?? ""), - ItemDetailView(LocaleKeys.organization.tr(), moNotificationBodyList[index].oRGANIZATIONNAME ?? ""), - ItemDetailView(LocaleKeys.fromSubInventory.tr(), moNotificationBodyList[index].fROMSUBINVENTORY ?? ""), - ItemDetailView(LocaleKeys.fromLocator.tr(), moNotificationBodyList[index].fROMLOCATOR ?? ""), - ItemDetailView(LocaleKeys.toSubInventory.tr(), moNotificationBodyList[index].tOSUBINVENTORY ?? ""), - ItemDetailView(LocaleKeys.toLocator.tr(), moNotificationBodyList[index].tOLOCATOR ?? ""), - ItemDetailView(LocaleKeys.shipToLocator.tr(), moNotificationBodyList[index].sHIPTOLOCATION ?? ""), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.code.tr(), moNotificationBodyList[index].iTEMCODE ?? ""), + ItemDetailViewCol(LocaleKeys.unit.tr(), moNotificationBodyList[index].uOM ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.quantity.tr(), moNotificationBodyList[index].qUANTITY?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.dateRequired.tr(), moNotificationBodyList[index].dATEREQUIRED ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.lineStatus.tr(), moNotificationBodyList[index].lINESTATUS ?? ""), + ItemDetailViewCol(LocaleKeys.statusDate.tr(), moNotificationBodyList[index].sTATUSDATE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.transactionType.tr(), moNotificationBodyList[index].tRANSACTIONTYPENAME ?? ""), + ItemDetailViewCol(LocaleKeys.operatingUnit.tr(), moNotificationBodyList[index].oPERATINGUNIT ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.organizationCode.tr(), moNotificationBodyList[index].oRGANIZATIONCODE ?? ""), + ItemDetailViewCol(LocaleKeys.organization.tr(), moNotificationBodyList[index].oRGANIZATIONNAME ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.fromSubInventory.tr(), moNotificationBodyList[index].fROMSUBINVENTORY ?? ""), + ItemDetailViewCol(LocaleKeys.fromLocator.tr(), moNotificationBodyList[index].fROMLOCATOR ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.toSubInventory.tr(), moNotificationBodyList[index].tOSUBINVENTORY ?? ""), + ItemDetailViewCol(LocaleKeys.toLocator.tr(), moNotificationBodyList[index].tOLOCATOR ?? ""), + ), + ItemDetailGrid(ItemDetailViewCol(LocaleKeys.shipToLocator.tr(), moNotificationBodyList[index].sHIPTOLOCATION ?? ""), Container()), 12.height, DefaultButton(LocaleKeys.itemHistory.tr(), () { Navigator.pushNamed( @@ -129,28 +160,51 @@ class RequestFragment extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - ItemDetailView(LocaleKeys.productName.tr(), itemCreationLines[index].pRODUCTNAME ?? ""), - ItemDetailView(LocaleKeys.productDescription.tr(), itemCreationLines[index].pRODUCTDESCRIPTION ?? ""), - ItemDetailView(LocaleKeys.unitPrice.tr(), itemCreationLines[index].uNITPRICE?.toString() ?? ""), - ItemDetailView(LocaleKeys.manufacturerName.tr(), itemCreationLines[index].uSERMANUFACTURERNAME ?? ""), - ItemDetailView(LocaleKeys.manufacturerPartName.tr(), itemCreationLines[index].uSERMFGPARTNUM ?? ""), - ItemDetailView(LocaleKeys.supplierName.tr(), itemCreationLines[index].sUPPLIERNAME ?? ""), - ItemDetailView(LocaleKeys.supplierContact.tr(), itemCreationLines[index].sUPPLIERCONTACT ?? ""), - ItemDetailView(LocaleKeys.chargeToPatient.tr(), itemCreationLines[index].cHARGETOPATIENT ?? ""), - ItemDetailView(LocaleKeys.justification.tr(), itemCreationLines[index].jUSTIFICATION ?? ""), - ItemDetailView(LocaleKeys.itemCode.tr(), itemCreationLines[index].iTEMCODE ?? ""), - ItemDetailView(LocaleKeys.itemDescription.tr(), itemCreationLines[index].iTEMDESCRIPTION ?? ""), - ItemDetailView(LocaleKeys.groupCode.tr(), itemCreationLines[index].iTEMGROUPCODE ?? ""), - ItemDetailView(LocaleKeys.groupDescription.tr(), itemCreationLines[index].iTEMGROUP ?? ""), - ItemDetailView(LocaleKeys.subgroupCode.tr(), itemCreationLines[index].iTEMSUBGROUPCODE ?? ""), - ItemDetailView(LocaleKeys.subgroupDescription.tr(), itemCreationLines[index].iTEMSUBGROUP ?? ""), - ItemDetailView(LocaleKeys.primaryUOM.tr(), itemCreationLines[index].pRIMARYUOM ?? ""), - ItemDetailView(LocaleKeys.manufacturerName.tr(), itemCreationLines[index].sTANDARDMANUFACTURERNAME ?? ""), - ItemDetailView(LocaleKeys.manufacturerPartName.tr(), itemCreationLines[index].sTANDARDMFGPARTNUM ?? ""), - ItemDetailView(LocaleKeys.templateName.tr(), itemCreationLines[index].tEMPLATENAME ?? ""), - ItemDetailView(LocaleKeys.itemCreationStatus.tr(), itemCreationLines[index].iTEMCREATIONSTATUS ?? ""), - ItemDetailView(LocaleKeys.standardizationApprovalStatus.tr(), itemCreationLines[index].sTANDARDSTATUS ?? ""), - ItemDetailView(LocaleKeys.standardizationApprovalRejectionReason.tr(), itemCreationLines[index].sTANDARDREJECTREASON ?? ""), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.productName.tr(), itemCreationLines[index].pRODUCTNAME ?? ""), + ItemDetailViewCol(LocaleKeys.productDescription.tr(), itemCreationLines[index].pRODUCTDESCRIPTION ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.unitPrice.tr(), itemCreationLines[index].uNITPRICE?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.manufacturerName.tr(), itemCreationLines[index].uSERMANUFACTURERNAME ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.manufacturerPartName.tr(), itemCreationLines[index].uSERMFGPARTNUM ?? ""), + ItemDetailViewCol(LocaleKeys.supplierName.tr(), itemCreationLines[index].sUPPLIERNAME ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.supplierContact.tr(), itemCreationLines[index].sUPPLIERCONTACT ?? ""), + ItemDetailViewCol(LocaleKeys.chargeToPatient.tr(), itemCreationLines[index].cHARGETOPATIENT ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.justification.tr(), itemCreationLines[index].jUSTIFICATION ?? ""), + ItemDetailViewCol(LocaleKeys.itemCode.tr(), itemCreationLines[index].iTEMCODE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.itemDescription.tr(), itemCreationLines[index].iTEMDESCRIPTION ?? ""), + ItemDetailViewCol(LocaleKeys.groupCode.tr(), itemCreationLines[index].iTEMGROUPCODE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.groupDescription.tr(), itemCreationLines[index].iTEMGROUP ?? ""), + ItemDetailViewCol(LocaleKeys.subgroupCode.tr(), itemCreationLines[index].iTEMSUBGROUPCODE ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.subgroupDescription.tr(), itemCreationLines[index].iTEMSUBGROUP ?? ""), + ItemDetailViewCol(LocaleKeys.primaryUOM.tr(), itemCreationLines[index].pRIMARYUOM ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.manufacturerName.tr(), itemCreationLines[index].sTANDARDMANUFACTURERNAME ?? ""), + ItemDetailViewCol(LocaleKeys.manufacturerPartName.tr(), itemCreationLines[index].sTANDARDMFGPARTNUM ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.templateName.tr(), itemCreationLines[index].tEMPLATENAME ?? ""), + ItemDetailViewCol(LocaleKeys.itemCreationStatus.tr(), itemCreationLines[index].iTEMCREATIONSTATUS ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.standardizationApprovalStatus.tr(), itemCreationLines[index].sTANDARDSTATUS ?? ""), + ItemDetailViewCol(LocaleKeys.standardizationApprovalRejectionReason.tr(), itemCreationLines[index].sTANDARDREJECTREASON ?? ""), + isItLast: true, + ), ], ).objectContainerView(title: itemCreationLines[index].iTEMDESCRIPTION!), separatorBuilder: (cxt, index) => 12.height, diff --git a/lib/widgets/item_detail_view_widget.dart b/lib/widgets/item_detail_view_widget.dart index 99f77d7..34b2eb3 100644 --- a/lib/widgets/item_detail_view_widget.dart +++ b/lib/widgets/item_detail_view_widget.dart @@ -7,6 +7,7 @@ import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; class ItemDetailView extends StatelessWidget { final String title; final String value; + const ItemDetailView(this.title, this.value, {Key? key}) : super(key: key); @override @@ -21,3 +22,110 @@ class ItemDetailView extends StatelessWidget { ); } } + +class ItemDetailViewCol extends StatelessWidget { + final String title; + final String value; + + const ItemDetailViewCol(this.title, this.value, {Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "$title:".toText12(isBold: true, color: const Color(0xff2BB8A6)), + 4.width, + (value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor), + ], + ); + } +} + +class ItemDetailViewGridItem extends StatelessWidget { + int index; + final String? title; + final String? value; + final bool isNeedToShowEmptyDivider; + + ItemDetailViewGridItem(this.index, this.title, this.value, {Key? key, this.isNeedToShowEmptyDivider = false}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.only(left: index % 2 != 0 ? 12 : 0), + decoration: BoxDecoration( + color: Colors.transparent, + border: Border( + left: BorderSide( + //MyColors.lightGreyEFColor + // <--- left side + color: index % 2 != 0 ? MyColors.lightGreyEFColor : Colors.transparent, + width: 1.5, + ), + top: BorderSide( + // <--- left side + color: index > 1 ? MyColors.lightGreyEFColor : Colors.transparent, + width: 1.5, + ), + ), + ), + child: isNeedToShowEmptyDivider + ? Container() + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Flexible(child: "$title:".toText12Auto(isBold: true, color: const Color(0xff2BB8A6))), + 4.width, + Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor)), + ], + ), + ); + } +} + +class ItemDetailGrid extends StatelessWidget { + Widget child1, child2; + + bool isItLast; + + ItemDetailGrid(this.child1, this.child2, {this.isItLast = false}); + + @override + Widget build(BuildContext context) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + IntrinsicHeight( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + flex: 1, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: child1, + ), + ), + Container( + width: 1, + height: double.infinity, + color: MyColors.lightGreyEFColor, + margin: EdgeInsets.symmetric(horizontal: 8), + ), + Expanded( + flex: 1, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: child2, + ), + ), + ], + ), + ), + if (!isItLast) 1.divider, + ], + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 14c034a..6ea2d48 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -75,6 +75,7 @@ dependencies: url_launcher: ^6.0.15 share: 2.0.4 flutter_rating_bar: ^4.0.1 + auto_size_text: ^3.0.0 dev_dependencies: flutter_test: From 398880c4ad4bd8b8c5c4023ff3018c5237202bef Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Thu, 13 Oct 2022 11:24:42 +0300 Subject: [PATCH 18/20] bug fixes --- lib/classes/consts.dart | 4 +- lib/provider/dashboard_provider_model.dart | 90 +--- lib/ui/landing/dashboard_screen.dart | 492 ++++++++++++------ lib/ui/login/verify_last_login_screen.dart | 154 ++++-- lib/ui/my_team/my_team.dart | 24 +- .../dynamic_input_basic_details_screen.dart | 14 +- 6 files changed, 507 insertions(+), 271 deletions(-) diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 12f818e..17bd143 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,7 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server - static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - // static String baseUrl = "https://hmgwebservices.com"; // Live server + // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server + static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index 40e1ab5..c5286ef 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -60,13 +60,10 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isAttendanceTrackingLoading = false; // isTimeRemainingInSeconds = calculateSeconds( "00:00:00"); if (attendanceTracking?.pSwipeIn != null) { - isTimeRemainingInSeconds = - calculateSeconds(attendanceTracking!.pRemainingHours ?? "00:00:00"); - int totalShiftTimeInSeconds = - calculateSeconds(attendanceTracking!.pScheduledHours ?? "00:00:00"); + isTimeRemainingInSeconds = calculateSeconds(attendanceTracking!.pRemainingHours ?? "00:00:00"); + int totalShiftTimeInSeconds = calculateSeconds(attendanceTracking!.pScheduledHours ?? "00:00:00"); progress = (isTimeRemainingInSeconds / totalShiftTimeInSeconds); - endTime = DateTime.now().millisecondsSinceEpoch + - Duration(seconds: isTimeRemainingInSeconds).inMilliseconds; + endTime = DateTime.now().millisecondsSinceEpoch + Duration(seconds: isTimeRemainingInSeconds).inMilliseconds; } notifyListeners(); @@ -100,6 +97,14 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isOffersLoading = true; getOffersList = []; + drawerMenuItemList = [ + DrawerMenuItem("assets/images/drawer/my_profile.svg", LocaleKeys.myProfile.tr(), AppRoutes.profile), + DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", LocaleKeys.performanceEvaluation.tr(), AppRoutes.performanceEvaluation), + DrawerMenuItem("assets/images/drawer/mowadhafi.svg", LocaleKeys.mowadhafhi.tr(), AppRoutes.mowadhafhi), + DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions), + DrawerMenuItem("assets/images/drawer/change_password.svg", LocaleKeys.changePassword.tr(), AppRoutes.changePassword), + ]; + notifyListeners(); } @@ -122,8 +127,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { Future fetchWorkListCounter(context, {bool showLoading = false}) async { try { if (showLoading) Utils.showLoading(context); - GenericResponseModel? genericResponseModel = - await DashboardApiClient().getOpenNotifications(); + GenericResponseModel? genericResponseModel = await DashboardApiClient().getOpenNotifications(); isWorkListLoading = false; getOpenNotificationsList = genericResponseModel?.getOpenNotificationsList; @@ -132,14 +136,10 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { itgFormsModel = await DashboardApiClient().getItgFormsPendingTask(); workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0); - GenericResponseModel? cocGenericResponseModel = - await DashboardApiClient().getCOCNotifications(); + GenericResponseModel? cocGenericResponseModel = await DashboardApiClient().getCOCNotifications(); cocCount = cocGenericResponseModel?.mohemmITGPendingTaskResponseItem; if (cocCount != null) { - cocFinalCount = (cocCount?.escalation ?? 0) + - (cocCount?.waitingToClose ?? 0) + - (cocCount?.waitingForAcceptance ?? 0) + - (cocCount?.extendTATRequest ?? 0); + cocFinalCount = (cocCount?.escalation ?? 0) + (cocCount?.waitingToClose ?? 0) + (cocCount?.waitingForAcceptance ?? 0) + (cocCount?.extendTATRequest ?? 0); workListCounter += cocFinalCount; } if (showLoading) Utils.hideLoading(context); @@ -156,12 +156,9 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //Missing Siwpe API's & Methods Future fetchMissingSwipe(context) async { try { - GenericResponseModel? genericResponseModel = - await DashboardApiClient().getOpenMissingSwipes(); + GenericResponseModel? genericResponseModel = await DashboardApiClient().getOpenMissingSwipes(); isMissingSwipeLoading = false; - missingSwipeCounter = - genericResponseModel!.getOpenMissingSwipesList!.pOpenMissingSwipes ?? - 0; + missingSwipeCounter = genericResponseModel!.getOpenMissingSwipesList!.pOpenMissingSwipes ?? 0; notifyListeners(); } catch (ex) { isMissingSwipeLoading = false; @@ -174,12 +171,10 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //Leave and Ticket Balance API's & Methods Future fetchLeaveTicketBalance(context, DateTime date) async { try { - accrualList = await DashboardApiClient() - .getAccrualBalances(DateFormat("MM/dd/yyyy").format(date)); + accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(date)); isLeaveTicketBalanceLoading = false; leaveBalanceAccrual = accrualList![0]; - ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + - (accrualList![2].accrualNetEntitlement ?? 0.0); + ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0); notifyListeners(); } catch (ex) { isLeaveTicketBalanceLoading = false; @@ -191,37 +186,18 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //List Menu API's & Methods - List drawerMenuItemList = [ - DrawerMenuItem("assets/images/drawer/my_profile.svg", - LocaleKeys.myProfile.tr(), AppRoutes.profile), - DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", - LocaleKeys.performanceEvaluation.tr(), AppRoutes.performanceEvaluation), - DrawerMenuItem("assets/images/drawer/mowadhafi.svg", - LocaleKeys.mowadhafhi.tr(), AppRoutes.mowadhafhi), - DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", - LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions), - DrawerMenuItem("assets/images/drawer/change_password.svg", - LocaleKeys.changePassword.tr(), AppRoutes.changePassword), - ]; + List drawerMenuItemList = []; void fetchListMenu() async { try { List menuList = await DashboardApiClient().getListMenu(); - List findMyRequest = - menuList.where((element) => element.menuType == "E").toList(); + List findMyRequest = menuList.where((element) => element.menuType == "E").toList(); if (findMyRequest.isNotEmpty) { - drawerMenuItemList.insert( - 3, - DrawerMenuItem("assets/images/drawer/my_requests.svg", - LocaleKeys.myRequest.tr(), AppRoutes.myRequests)); + drawerMenuItemList.insert(3, DrawerMenuItem("assets/images/drawer/my_requests.svg", LocaleKeys.myRequest.tr(), AppRoutes.myRequests)); } - List findMyTeam = - menuList.where((element) => element.menuType == "M").toList(); + List findMyTeam = menuList.where((element) => element.menuType == "M").toList(); if (findMyTeam.isNotEmpty) { - drawerMenuItemList.insert( - 2, - DrawerMenuItem("assets/images/drawer/my_team.svg", - LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam)); + drawerMenuItemList.insert(2, DrawerMenuItem("assets/images/drawer/my_team.svg", LocaleKeys.myTeamMembers.tr(), AppRoutes.myTeam)); } } catch (ex) { logger.wtf(ex); @@ -232,19 +208,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //Menu Entries API's & Methods void fetchMenuEntries() async { try { - GenericResponseModel? genericResponseModel = - await DashboardApiClient().getGetMenuEntries(); + GenericResponseModel? genericResponseModel = await DashboardApiClient().getGetMenuEntries(); getMenuEntriesList = genericResponseModel!.getMenuEntriesList; homeMenus = parseMenus(getMenuEntriesList ?? []); if (homeMenus!.isNotEmpty) { - homeMenus!.first.menuEntiesList.insert( - 0, - GetMenuEntriesList( - requestType: "MONTHLY_ATTENDANCE", - prompt: LocaleKeys.monthlyAttendance.tr())); - homeMenus!.first.menuEntiesList.add(GetMenuEntriesList( - requestType: "VACATION_RULE", - prompt: LocaleKeys.vacationRule.tr())); + homeMenus!.first.menuEntiesList.insert(0, GetMenuEntriesList(requestType: "MONTHLY_ATTENDANCE", prompt: LocaleKeys.monthlyAttendance.tr())); + homeMenus!.first.menuEntiesList.add(GetMenuEntriesList(requestType: "VACATION_RULE", prompt: LocaleKeys.vacationRule.tr())); } isServicesMenusLoading = false; notifyListeners(); @@ -272,12 +241,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List menus = []; for (int i = 0; i < getMenuEntriesList.length; i++) { if (getMenuEntriesList[i].parentMenuName!.isEmpty) { - menus.add(Menus( - getMenuEntriesList[i], - getMenuEntriesList - .where((element) => - getMenuEntriesList[i].menuName == element.parentMenuName) - .toList())); + menus.add(Menus(getMenuEntriesList[i], getMenuEntriesList.where((element) => getMenuEntriesList[i].menuName == element.parentMenuName).toList())); } } return menus; diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 95b39e8..0d8cdfd 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -38,7 +38,8 @@ class _DashboardScreenState extends State { late DashboardProviderModel data; final GlobalKey _scaffoldState = GlobalKey(); - final RefreshController _refreshController = RefreshController(initialRefresh: false); + final RefreshController _refreshController = + RefreshController(initialRefresh: false); int currentIndex = 0; @@ -106,7 +107,9 @@ class _DashboardScreenState extends State { _scaffoldState.currentState!.openDrawer(); }); }), - Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 28).expanded, + Image.asset("assets/images/logos/main_mohemm_logo.png", + width: 134, height: 28) + .expanded, SizedBox( width: 36, height: 36, @@ -119,7 +122,9 @@ class _DashboardScreenState extends State { top: 0, child: Container( padding: const EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), + decoration: BoxDecoration( + color: MyColors.redColor, + borderRadius: BorderRadius.circular(17)), child: "3".toText12(color: Colors.white), ), ) @@ -134,7 +139,9 @@ class _DashboardScreenState extends State { child: SmartRefresher( enablePullDown: true, enablePullUp: false, - header: const MaterialClassicHeader(color: MyColors.gradiantEndColor,), + header: const MaterialClassicHeader( + color: MyColors.gradiantEndColor, + ), controller: _refreshController, onRefresh: _onRefresh, child: SingleChildScrollView( @@ -143,8 +150,11 @@ class _DashboardScreenState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color), - (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true), + LocaleKeys.goodMorning + .tr() + .toText14(color: MyColors.grey77Color), + (AppState().memberInformationList!.eMPLOYEENAME ?? "") + .toText24(isBold: true), 16.height, Row( children: [ @@ -154,99 +164,210 @@ class _DashboardScreenState extends State { child: Consumer( builder: (context, model, child) { return (model.isAttendanceTrackingLoading - ? GetAttendanceTrackingShimmer() - : Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - gradient: const LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ - MyColors.gradiantEndColor, - MyColors.gradiantStartColor, - ]), - ), - child: Stack( - alignment: Alignment.center, - children: [ - if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + ? GetAttendanceTrackingShimmer() + : Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(15), + gradient: + const LinearGradient( + transform: + GradientRotation( + .46), + begin: Alignment + .topRight, + end: Alignment + .bottomLeft, + colors: [ + MyColors + .gradiantEndColor, + MyColors + .gradiantStartColor, + ]), + ), + child: Stack( + alignment: Alignment.center, children: [ - LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), - if (model.isTimeRemainingInSeconds == 0) "01-02-2022".toText12(color: Colors.white), - if (model.isTimeRemainingInSeconds != 0) - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - 9.height, - CountdownTimer( - endTime: model.endTime, - onEnd: null, - endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), - textStyle: TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), - ), - LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), - 9.height, - ClipRRect( - borderRadius: BorderRadius.all( - Radius.circular(20), - ), - child: LinearProgressIndicator( - value: model.progress, - minHeight: 8, - valueColor: const AlwaysStoppedAnimation(Colors.white), - backgroundColor: const Color(0xff196D73), - ), - ), - ], - ), - ], - ).paddingOnly(top: 12, right: 15, left: 12), - ), - Row( - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + if (model + .isTimeRemainingInSeconds == + 0) + SvgPicture.asset( + "assets/images/thumb.svg"), + Column( + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ - LocaleKeys.checkIn.tr().toText12(color: Colors.white), - (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) - .toString() - .toText14(color: Colors.white, isBold: true), - 4.height, + Expanded( + child: Column( + mainAxisSize: + MainAxisSize + .min, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + LocaleKeys + .markAttendance + .tr() + .toText14( + color: Colors + .white, + isBold: + true), + if (model + .isTimeRemainingInSeconds == + 0) + "01-02-2022".toText12( + color: Colors + .white), + if (model + .isTimeRemainingInSeconds != + 0) + Column( + mainAxisSize: + MainAxisSize + .min, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + 9.height, + CountdownTimer( + endTime: model + .endTime, + onEnd: + null, + endWidget: "00:00:00".toText14( + color: Colors + .white, + isBold: + true), + textStyle: TextStyle( + color: Colors + .white, + fontSize: + 14, + letterSpacing: + -0.48, + fontWeight: + FontWeight.bold), + ), + LocaleKeys + .timeLeftToday + .tr() + .toText12( + color: + Colors.white), + 9.height, + ClipRRect( + borderRadius: + BorderRadius + .all( + Radius.circular( + 20), + ), + child: + LinearProgressIndicator( + value: model + .progress, + minHeight: + 8, + valueColor: + const AlwaysStoppedAnimation(Colors.white), + backgroundColor: + const Color(0xff196D73), + ), + ), + ], + ), + ], + ).paddingOnly( + top: 12, + right: 15, + left: 12), + ), + Row( + children: [ + Expanded( + child: Column( + mainAxisSize: + MainAxisSize + .min, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + LocaleKeys + .checkIn + .tr() + .toText12( + color: + Colors.white), + (model.attendanceTracking!.pSwipeIn == + null + ? "--:--" + : model + .attendanceTracking! + .pSwipeIn) + .toString() + .toText14( + color: Colors + .white, + isBold: + true), + 4.height, + ], + ).paddingOnly( + left: 12), + ), + Container( + width: 45, + height: 45, + padding: + const EdgeInsets + .only( + left: 14, + right: + 14), + decoration: + const BoxDecoration( + color: Color( + 0xff259EA4), + borderRadius: + BorderRadius + .only( + bottomRight: Radius + .circular( + 15), + ), + ), + child: SvgPicture.asset( + model.isTimeRemainingInSeconds == + 0 + ? "assets/images/play.svg" + : "assets/images/stop.svg"), + ).onPress(() { + showMyBottomSheet( + context, + child: + MarkAttendanceWidget( + model)); + }), + ], + ), ], - ).paddingOnly(left: 12), - ), - Container( - width: 45, - height: 45, - padding: const EdgeInsets.only(left: 14, right: 14), - decoration: const BoxDecoration( - color: Color(0xff259EA4), - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(15), - ), ), - child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), - ).onPress(() { - showMyBottomSheet(context, child: MarkAttendanceWidget(model)); - }), - ], - ), - ], - ), - ], - ), - ).onPress( - () { - Navigator.pushNamed(context, AppRoutes.todayAttendance); - }, - )) + ], + ), + ).onPress( + () { + Navigator.pushNamed( + context, + AppRoutes + .todayAttendance); + }, + )) .animatedSwither(); }, ), @@ -267,8 +388,11 @@ class _DashboardScreenState extends State { padding: const EdgeInsets.only(top: 31), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), - border: Border.all(color: MyColors.lightGreyEDColor, width: 1), + borderRadius: const BorderRadius.only( + topRight: Radius.circular(50), + topLeft: Radius.circular(50)), + border: Border.all( + color: MyColors.lightGreyEDColor, width: 1), ), child: Column( mainAxisSize: MainAxisSize.min, @@ -284,22 +408,32 @@ class _DashboardScreenState extends State { LocaleKeys.offers.tr().toText12(), Row( children: [ - LocaleKeys.discounts.tr().toText24(isBold: true), + LocaleKeys.discounts + .tr() + .toText24(isBold: true), 6.width, Container( - padding: const EdgeInsets.only(left: 8, right: 8), + padding: const EdgeInsets.only( + left: 8, right: 8), decoration: BoxDecoration( color: MyColors.yellowColor, - borderRadius: BorderRadius.circular(10), + borderRadius: + BorderRadius.circular(10), ), - child: LocaleKeys.newString.tr().toText10(isBold: true)), + child: LocaleKeys.newString + .tr() + .toText10(isBold: true)), ], ), ], ), ), - LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() { - Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); + LocaleKeys.viewAllOffers + .tr() + .toText12(isUnderLine: true) + .onPress(() { + Navigator.pushNamed( + context, AppRoutes.offersAndDiscounts); }) ], ).paddingOnly(left: 21, right: 21), @@ -310,53 +444,86 @@ class _DashboardScreenState extends State { child: ListView.separated( shrinkWrap: true, physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.only(left: 21, right: 21, top: 13), + padding: const EdgeInsets.only( + left: 21, right: 21, top: 13), scrollDirection: Axis.horizontal, itemBuilder: (cxt, index) { return model.isOffersLoading ? const OffersShimmerWidget() : InkWell( - onTap: () { - navigateToDetails(data.getOffersList[index]); - }, - child: SizedBox( - width: 73, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( + onTap: () { + navigateToDetails( + data.getOffersList[index]); + }, + child: SizedBox( width: 73, - height: 73, - decoration: BoxDecoration( - borderRadius: const BorderRadius.all( - Radius.circular(100), - ), - border: Border.all(color: MyColors.lightGreyE3Color, width: 1), - ), - child: ClipRRect( - borderRadius: const BorderRadius.all( - Radius.circular(50), - ), - child: Hero( - tag: "ItemImage" + data.getOffersList[index].rowID!, - transitionOnUserGestures: true, - child: Image.network( - data.getOffersList[index].bannerImage!, - fit: BoxFit.contain, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Container( + width: 73, + height: 73, + decoration: BoxDecoration( + borderRadius: + const BorderRadius + .all( + Radius.circular(100), + ), + border: Border.all( + color: MyColors + .lightGreyE3Color, + width: 1), + ), + child: ClipRRect( + borderRadius: + const BorderRadius + .all( + Radius.circular(50), + ), + child: Hero( + tag: "ItemImage" + + data + .getOffersList[ + index] + .rowID!, + transitionOnUserGestures: + true, + child: Image.network( + data + .getOffersList[ + index] + .bannerImage!, + fit: BoxFit.contain, + ), + ), + ), ), - ), + 4.height, + Expanded( + child: AppState() + .isArabic(context) + ? data + .getOffersList[ + index] + .titleAR! + .toText12( + isCenter: + true, + maxLine: 1) + : data + .getOffersList[ + index] + .title! + .toText12( + isCenter: + true, + maxLine: 1), + ), + ], ), ), - 4.height, - Expanded( - child: AppState().isArabic(context) - ? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1) - : data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1), - ), - ], - ), - ), - ); + ); }, separatorBuilder: (cxt, index) => 8.width, itemCount: 6), @@ -383,14 +550,18 @@ class _DashboardScreenState extends State { BottomNavigationBarItem( icon: SvgPicture.asset( "assets/icons/home.svg", - color: currentIndex == 0 ? MyColors.grey3AColor : MyColors.grey98Color, + color: currentIndex == 0 + ? MyColors.grey3AColor + : MyColors.grey98Color, ).paddingAll(4), label: LocaleKeys.home.tr(), ), BottomNavigationBarItem( icon: SvgPicture.asset( "assets/icons/create_req.svg", - color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color, + color: currentIndex == 1 + ? MyColors.grey3AColor + : MyColors.grey98Color, ).paddingAll(4), label: LocaleKeys.createRequest.tr(), ), @@ -400,7 +571,9 @@ class _DashboardScreenState extends State { children: [ SvgPicture.asset( "assets/icons/work_list.svg", - color: currentIndex == 2 ? MyColors.grey3AColor : MyColors.grey98Color, + color: currentIndex == 2 + ? MyColors.grey3AColor + : MyColors.grey98Color, ).paddingAll(4), Consumer( builder: (cxt, data, child) { @@ -413,8 +586,12 @@ class _DashboardScreenState extends State { child: Container( padding: const EdgeInsets.only(left: 4, right: 4), alignment: Alignment.center, - decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), - child: data.workListCounter.toString().toText10(color: Colors.white), + decoration: BoxDecoration( + color: MyColors.redColor, + borderRadius: BorderRadius.circular(17)), + child: data.workListCounter + .toString() + .toText10(color: Colors.white), ), ); }, @@ -426,19 +603,29 @@ class _DashboardScreenState extends State { BottomNavigationBarItem( icon: SvgPicture.asset( "assets/icons/item_for_sale.svg", - color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color, + color: currentIndex == 3 + ? MyColors.grey3AColor + : MyColors.grey98Color, ).paddingAll(4), label: LocaleKeys.itemsForSale.tr(), ), ], currentIndex: currentIndex, - selectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey3AColor, fontWeight: FontWeight.w600), - unselectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey98Color, fontWeight: FontWeight.w600), + selectedLabelStyle: const TextStyle( + fontSize: 10, + color: MyColors.grey3AColor, + fontWeight: FontWeight.w600), + unselectedLabelStyle: const TextStyle( + fontSize: 10, + color: MyColors.grey98Color, + fontWeight: FontWeight.w600), type: BottomNavigationBarType.fixed, selectedItemColor: MyColors.grey3AColor, backgroundColor: MyColors.backgroundColor, - selectedIconTheme: const IconThemeData(color: MyColors.grey3AColor, size: 28), - unselectedIconTheme: const IconThemeData(color: MyColors.grey98Color, size: 28), + selectedIconTheme: + const IconThemeData(color: MyColors.grey3AColor, size: 28), + unselectedIconTheme: + const IconThemeData(color: MyColors.grey98Color, size: 28), onTap: (int index) { if (index == 1) { Navigator.pushNamed(context, AppRoutes.mowadhafhi); @@ -469,6 +656,7 @@ class _DashboardScreenState extends State { } }); - Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList); + Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, + arguments: getOffersDetailList); } } diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index 6dfaaae..4d653ed 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -57,21 +57,30 @@ class _VerifyLastLoginScreenState extends State { @override Widget build(BuildContext context) { - mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments as GetMobileLoginInfoListModel; - String empName = AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!; + mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments + as GetMobileLoginInfoListModel; + String empName = AppState().isArabic(context) + ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! + : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!; return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, automaticallyImplyLeading: false, title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false) - ? LocaleKeys.viewBusinessCard.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() { + ? LocaleKeys.viewBusinessCard + .tr() + .toText12(color: MyColors.textMixColor, isUnderLine: true) + .onPress(() { showMDialog(context, child: BusinessCardDialog()); }) : null, actions: [ Center( - child: LocaleKeys.employeeDigitalID.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() { + child: LocaleKeys.employeeDigitalID + .tr() + .toText12(color: MyColors.textMixColor, isUnderLine: true) + .onPress(() { showMDialog(context, child: EmployeeDigitialIdDialog()); })), 21.width @@ -90,9 +99,12 @@ class _VerifyLastLoginScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ LocaleKeys.welcomeBack.tr().toText12(), - mobileLoginInfoListModel!.employeeName!.toText24(isBold: true), + mobileLoginInfoListModel!.employeeName! + .toText24(isBold: true), 10.height, - LocaleKeys.wouldYouLikeToLoginWithCurrentUsername.tr().toText16(), + LocaleKeys.wouldYouLikeToLoginWithCurrentUsername + .tr() + .toText16(), Container( height: 72, margin: const EdgeInsets.only(top: 23, bottom: 23), @@ -114,26 +126,42 @@ class _VerifyLastLoginScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ LocaleKeys.lastLoginDetails.tr().toText16(), - DateUtil.formatDateToDate(DateUtil.convertStringToDate(mobileLoginInfoListModel!.editedOn!), false).toText12(), + DateUtil.formatDateToDate( + DateUtil.convertStringToDate( + mobileLoginInfoListModel!.editedOn!), + false) + .toText12(), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - LocaleKeys.verificationType.tr().toText10(color: MyColors.grey57Color), - getVerificationType(mobileLoginInfoListModel!.loginType!).toText12(), + LocaleKeys.verificationType + .tr() + .toText10(color: MyColors.grey57Color), + getVerificationType( + mobileLoginInfoListModel!.loginType!) + .toText12(), Expanded(child: SizedBox()), - DateUtil.formatDateToTime(DateUtil.convertStringToDate(mobileLoginInfoListModel!.editedOn!)).toText12(), + DateUtil.formatDateToTime( + DateUtil.convertStringToDate( + mobileLoginInfoListModel!.editedOn!)) + .toText12(), ], ) ], ), ), LocaleKeys.pleaseVerify.tr().toText16(), - if (isNeedVerifyWithFaceIDAndBiometrics) LocaleKeys.pleaseVerifyForBio.tr().toText12(), + if (isNeedVerifyWithFaceIDAndBiometrics) + LocaleKeys.pleaseVerifyForBio.tr().toText12(), GridView( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 13, + mainAxisSpacing: 9), physics: const NeverScrollableScrollPhysics(), padding: const EdgeInsets.only(top: 9), shrinkWrap: true, @@ -186,7 +214,9 @@ class _VerifyLastLoginScreenState extends State { DefaultButton( LocaleKeys.useAnotherAccount.tr(), () { - Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route route) => false, arguments: false); + Navigator.pushNamedAndRemoveUntil( + context, AppRoutes.login, (Route route) => false, + arguments: false); }, ).insideContainer, ], @@ -218,11 +248,19 @@ class _VerifyLastLoginScreenState extends State { } Future loginWithFaceIDAndBiometrics() async { - IOSAuthMessages iosStrings = - const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); + IOSAuthMessages iosStrings = const IOSAuthMessages( + cancelButton: 'cancel', + goToSettingsButton: 'settings', + goToSettingsDescription: 'Please set up your Touch ID.', + lockOut: 'Please reenable your Touch ID'); bool authenticated = false; try { - authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings); + authenticated = await auth.authenticate( + localizedReason: 'Scan your fingerprint to authenticate', + useErrorDialogs: true, + stickyAuth: true, + biometricOnly: true, + iOSAuthStrings: iosStrings); } on PlatformException catch (e) { print(e); Utils.hideLoading(context); @@ -231,8 +269,11 @@ class _VerifyLastLoginScreenState extends State { return authenticated; } - Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) { - bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint))); + Widget _loginOptionButton( + String _title, String _icon, int _flag, int? _loginIndex) { + bool isDisable = ((_flag == 3 && + !checkBiometricIsAvailable(BiometricType.face)) || + (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint))); return InkWell( onTap: isDisable ? null @@ -243,18 +284,21 @@ class _VerifyLastLoginScreenState extends State { }); } else { if (_flag == 3 || _flag == 4) { - bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); + bool authenticateWithFaceAndTouchID = + await loginWithFaceIDAndBiometrics(); if (!authenticateWithFaceAndTouchID) { return; } else { - if (mobileLoginInfoListModel!.loginType == 3 || mobileLoginInfoListModel!.loginType == 4) { + if (mobileLoginInfoListModel!.loginType == 3 || + mobileLoginInfoListModel!.loginType == 4) { // bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); // if (!authenticateWithFaceAndTouchID) { // return; // } else { // performApiCall(_title, _icon, _flag, isDirectLogin: true); // } - performApiCall(_title, _icon, _flag, _flag, isDirectLogin: true); + performApiCall(_title, _icon, _flag, _flag, + isDirectLogin: true); } else { isNeedVerifyWithFaceIDAndBiometrics = true; selectedFlag = _flag; @@ -272,7 +316,8 @@ class _VerifyLastLoginScreenState extends State { } }, child: Container( - padding: const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + padding: + const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), color: isDisable ? Colors.grey.withOpacity(0.3) : Colors.white, @@ -298,13 +343,23 @@ class _VerifyLastLoginScreenState extends State { Widget getButton(int flag) { switch (flag) { case 1: - return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/login/verify_sms.svg', flag, null); + return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), + 'assets/images/login/verify_sms.svg', flag, null); case 2: - return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), 'assets/images/login/verify_whatsapp.svg', flag, null); + return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), + 'assets/images/login/verify_whatsapp.svg', flag, null); case 3: - return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/login/verify_face.svg', flag, BiometricType.face.index); + return _loginOptionButton( + LocaleKeys.verifyThroughFace.tr(), + 'assets/images/login/verify_face.svg', + flag, + BiometricType.face.index); case 4: - return _loginOptionButton(LocaleKeys.verifyThroughFingerprint.tr(), 'assets/images/login/verify_thumb.svg', flag, BiometricType.fingerprint.index); + return _loginOptionButton( + LocaleKeys.verifyThroughFingerprint.tr(), + 'assets/images/login/verify_thumb.svg', + flag, + BiometricType.fingerprint.index); default: return const SizedBox(); } @@ -321,7 +376,9 @@ class _VerifyLastLoginScreenState extends State { return isAvailable; } - Future performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat, {bool isDirectLogin = false}) async { + Future performApiCall( + String _title, String _icon, int _flag, int sendVerificationFlat, + {bool isDirectLogin = false}) async { try { if (isDirectLogin) setState(() { @@ -330,10 +387,16 @@ class _VerifyLastLoginScreenState extends State { else Utils.showLoading(context); await LoginApiClient().checkMobileAppVersion(); - await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!); + await LoginApiClient() + .memberLogin(AppState().getUserName!, AppState().password!); if (!isDirectLogin) BasicMemberInformationModel? memberInformationModel = - await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); + await LoginApiClient() + .mohemmSendActivationCodeByOTPNotificationType( + 0, + AppState().memberLoginList?.pMOBILENUMBER, + sendVerificationFlat, + AppState().getUserName); if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, ""); if (!isDirectLogin) Utils.hideLoading(context); if (!isDirectLogin) @@ -355,25 +418,34 @@ class _VerifyLastLoginScreenState extends State { } } - Future performDirectApiCall(String _title, String _icon, int _flag, String value, {bool isDirectLogin = false}) async { + Future performDirectApiCall( + String _title, String _icon, int _flag, String value, + {bool isDirectLogin = false}) async { try { - GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName); - GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW( - AppState().memberLoginList?.pEMAILADDRESS ?? "", - genericResponseModel?.pSESSIONID ?? 0, - genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? "", - _flag, - AppState().memberLoginList?.pMOBILENUMBER ?? "", - AppState().getUserName!, - mobileLoginInfoListModel!.deviceToken!, - Platform.isAndroid ? "android" : "ios"); + GenericResponseModel? genericResponseModel = await LoginApiClient() + .checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, + value, AppState().getUserName); + GenericResponseModel? genericResponseModel1 = await LoginApiClient() + .insertMobileLoginInfoNEW( + AppState().memberLoginList?.pEMAILADDRESS ?? "", + genericResponseModel?.pSESSIONID ?? 0, + genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? + "", + _flag, + AppState().memberLoginList?.pMOBILENUMBER ?? "", + AppState().getUserName!, + mobileLoginInfoListModel!.deviceToken!, + Platform.isAndroid ? "android" : "ios"); + AppState().setMemberInformationListModel = + genericResponseModel!.memberInformationList?.first; if (genericResponseModel?.errorMessage != null) { Utils.showToast(genericResponseModel?.errorMessage ?? ""); // Navigator.pop(context); } Utils.hideLoading(context); Navigator.pop(context); - Navigator.pushNamedAndRemoveUntil(context, AppRoutes.dashboard, (Route route) => false); + Navigator.pushNamedAndRemoveUntil( + context, AppRoutes.dashboard, (Route route) => false); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/my_team/my_team.dart b/lib/ui/my_team/my_team.dart index 2187960..bbdce84 100644 --- a/lib/ui/my_team/my_team.dart +++ b/lib/ui/my_team/my_team.dart @@ -67,17 +67,23 @@ class _MyTeamState extends State { Row( children: [ TextField( - onChanged: dropdownValue == "name" + onChanged: dropdownValue.toLowerCase() == "name" ? (String value) { getEmployeeSListOnSearch = getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEENAME!.toLowerCase().contains(value.toLowerCase())).toList(); setState(() {}); } - : (String value) { - getEmployeeSListOnSearch = - getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList(); - setState(() {}); - }, + : dropdownValue.toLowerCase() == "username" + ? (String value) { + getEmployeeSListOnSearch = + getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEENUMBER!.toLowerCase().contains(value.toLowerCase())).toList(); + setState(() {}); + } + : (String value) { + getEmployeeSListOnSearch = + getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList(); + setState(() {}); + }, style: const TextStyle( fontSize: 14.0, color: MyColors.grey3AColor, @@ -113,9 +119,9 @@ class _MyTeamState extends State { shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), padding: const EdgeInsets.only(top: 12), - separatorBuilder: (BuildContext cxt,int index) => 12.height, + separatorBuilder: (BuildContext cxt, int index) => 12.height, itemCount: _textEditingController!.text.isNotEmpty ? getEmployeeSListOnSearch.length : getEmployeeSubordinatesList.length, - itemBuilder: (BuildContext cxt,int index) { + itemBuilder: (BuildContext cxt, int index) { var phoneNumber = Uri.parse('tel:${getEmployeeSListOnSearch[index].eMPLOYEEMOBILENUMBER}'); return InkWell( onTap: () async { @@ -177,7 +183,7 @@ class _MyTeamState extends State { } // todo @fatima add translation for below list - List list = [LocaleKeys.name.tr(), LocaleKeys.email.tr()]; + List list = [LocaleKeys.name.tr(), LocaleKeys.email.tr(), LocaleKeys.username.tr()]; Widget dropDown() { return PopupMenuButton( itemBuilder: (_) => >[ diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart index 923d3a8..3127bec 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart @@ -67,11 +67,17 @@ class _DynamicInputScreenState extends State { getBasicDetColsStructureList = genericResponseModel?.getBasicDetColsStructureList ?? []; if (dynamicParams!.correctOrNew == 1) { - getBasicDetDffStructureList?.forEach((element) { - element.userBasicDetail = dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME); + getBasicDetDffStructureList?.forEach((GetBasicDetDffStructureList element) { + element.userBasicDetail = + dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((GetEmployeeBasicDetailsList userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME); }); - getBasicDetColsStructureList?.forEach((element) { - element.userBasicDetail = dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME); + getBasicDetColsStructureList?.forEach((GetBasicDetColsStructureList element) { + element.userBasicDetail = + dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((GetEmployeeBasicDetailsList userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME); + if (element.objectValuesList != null) { + ObjectValuesList dropDownListValue = element.objectValuesList!.singleWhere((ObjectValuesList dropdown) => dropdown.cODE == element.userBasicDetail!.vARCHAR2VALUE); + element.userBasicDetail!.sEGMENTVALUEDSP = dropDownListValue.mEANING; + } }); } else { getBasicDetDffStructureList?.forEach((element) { From eaae618f25e09233b27ffe3ab11e638b250b57e1 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Thu, 13 Oct 2022 15:41:44 +0300 Subject: [PATCH 19/20] bug fixes --- lib/ui/profile/widgets/profile_info.dart | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/ui/profile/widgets/profile_info.dart b/lib/ui/profile/widgets/profile_info.dart index 1ac5f93..73635d8 100644 --- a/lib/ui/profile/widgets/profile_info.dart +++ b/lib/ui/profile/widgets/profile_info.dart @@ -42,23 +42,23 @@ class ProfileInFo extends StatelessWidget { appreciationTime(LocaleKeys.day.tr(), memberInfo.sERVICEDAYS.toString()), ]).paddingOnly(bottom: 12, top: 12), const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), - Column( - // mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - (LocaleKeys.profile_profileCompletionPer.tr() + ' 75%').toText16(), - 8.height, - Row( - children: [ - for (var i = 0; i < 4; i++) - if (i < 3) Expanded(child: drawSlider(Color(0xff2BB8A6))) else Expanded(child: drawSlider(const Color(0xffefefef))) - ], - ), - 14.height, - LocaleKeys.profile_completeProfile.tr().toText16(color: MyColors.textMixColor, isUnderLine: true), - ], - ).paddingOnly(left: 21, right: 21, bottom: 18, top: 12), - const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), + // Column( + // // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // (LocaleKeys.profile_profileCompletionPer.tr() + ' 75%').toText16(), + // 8.height, + // Row( + // children: [ + // for (var i = 0; i < 4; i++) + // if (i < 3) Expanded(child: drawSlider(Color(0xff2BB8A6))) else Expanded(child: drawSlider(const Color(0xffefefef))) + // ], + // ), + // 14.height, + // LocaleKeys.profile_completeProfile.tr().toText16(color: MyColors.textMixColor, isUnderLine: true), + // ], + // ).paddingOnly(left: 21, right: 21, bottom: 18, top: 12), + // const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), ListView.separated( padding: EdgeInsets.zero, shrinkWrap: true, From f0ec4843b4c6b3523d8fc81e71e3d4750128fddd Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 13 Oct 2022 16:37:10 +0300 Subject: [PATCH 20/20] end employment dynamic forms added. exit-reEntry getvaluesSetvalues issue fixed. request submit screen title issue fixed. --- assets/langs/ar-SA.json | 1 + assets/langs/en-US.json | 1 + lib/api/termination_dff_api_client.dart | 74 +++ lib/classes/utils.dart | 2 +- lib/config/routes.dart | 7 + lib/generated/codegen_loader.g.dart | 2 + lib/generated/locale_keys.g.dart | 1 + lib/models/generic_response_model.dart | 574 ++++++---------- .../submit_term_transaction_list_model.dart | 24 + .../get_term_cols_structure_list_model.dart | 85 +++ .../get_term_dff_structure_list_model.dart | 280 ++++++++ ...tart_term_approval_process_list_model.dart | 18 + lib/ui/misc/request_submit_screen.dart | 18 +- .../dynamic_screens/dynamic_input_screen.dart | 47 +- .../services_menu_list_screen.dart | 9 +- lib/ui/termination/end_employement.dart | 625 ++++++++++++++++++ 16 files changed, 1360 insertions(+), 408 deletions(-) create mode 100644 lib/api/termination_dff_api_client.dart create mode 100644 lib/models/submit_term_transaction_list_model.dart create mode 100644 lib/models/termination/get_term_cols_structure_list_model.dart create mode 100644 lib/models/termination/get_term_dff_structure_list_model.dart create mode 100644 lib/start_term_approval_process_list_model.dart create mode 100644 lib/ui/termination/end_employement.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index dc2b5d5..b8a7eb4 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -416,6 +416,7 @@ "child":"طفل", "adult": "بالغ", "updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", + "fieldIsEmpty": "'{data}' الحقل فارغ. الرجاء التحديد", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index ec30ecc..14f05c3 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -416,6 +416,7 @@ "child":"Child", "adult": "Adult", "updateMember": "Are You Sure You Want to Update this Member?", + "fieldIsEmpty": "'{data}' Field is empty. Please select", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/api/termination_dff_api_client.dart b/lib/api/termination_dff_api_client.dart new file mode 100644 index 0000000..0933dea --- /dev/null +++ b/lib/api/termination_dff_api_client.dart @@ -0,0 +1,74 @@ +import 'dart:async'; + +import 'package:mohem_flutter_app/api/api_client.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/classes/consts.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/submit_term_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/termination/get_term_cols_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/termination/get_term_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/start_term_approval_process_list_model.dart'; + +class TerminationDffApiClient { + static final TerminationDffApiClient _instance = TerminationDffApiClient._internal(); + + TerminationDffApiClient._internal(); + + factory TerminationDffApiClient() => _instance; + + Future?> getTermColsStructure() async { + String url = "${ApiConsts.erpRest}GET_TERM_COLS_STRUCTURE"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel genericResponseModel = GenericResponseModel.fromJson(json); + return genericResponseModel.getTermColsStructureList ?? []; + }, url, postParams); + } + + Future?> getTermDffStructure(String functionName, String? pDescFlexContextCode) async { + String url = "${ApiConsts.erpRest}GET_TERM_DFF_STRUCTURE"; + Map postParams = {'P_FUNCTION_NAME': functionName, "P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel genericResponseModel = GenericResponseModel.fromJson(json); + return genericResponseModel.getTermDffStructureList ?? []; + }, url, postParams); + } + + Future submitTermTransaction(String functionName, List> list) async { + String url = "${ApiConsts.erpRest}SUBMIT_TERM_TRANSACTION"; + Map postParams = { + "P_SELECTED_RESP_ID": -999, + "P_MENU_TYPE": "E", + "P_FUNCTION_NAME": functionName, + "EITTransactionTBL": list, + }; + postParams.addAll(AppState().postParamsJson); + + for (var abc in list) { + print(abc); + } + return await ApiClient().postJsonForObject((json) { + GenericResponseModel genericResponseModel = GenericResponseModel.fromJson(json); + return genericResponseModel.submitTermTransactionList!; + }, url, postParams); + } + + Future startTermApprovalProcess(String action, String comments, String itemKey, int transactionId) async { + String url = "${ApiConsts.erpRest}START_TERM_APPROVAL_PROCESS"; + Map postParams = { + "P_SELECTED_RESP_ID": -999, + "P_MENU_TYPE": "E", + "P_ACTION_MODE": action, + "P_COMMENTS": comments, + "P_ITEM_KEY": itemKey, + "P_TRANSACTION_ID": transactionId, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel genericResponseModel = GenericResponseModel.fromJson(json); + return genericResponseModel.startTermApprovalProcessList!; + }, url, postParams); + } +} diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 94bcc18..098f65c 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -25,7 +25,7 @@ class Utils { static bool get isLoading => _isLoadingVisible; - static void showToast(String message, {bool longDuration = false}) { + static void showToast(String message, {bool longDuration = true}) { Fluttertoast.showToast( msg: message, toastLength: longDuration ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT, diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 099342b..21058ad 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -56,6 +56,7 @@ import 'package:mohem_flutter_app/ui/screens/offers_and_discounts/offers_and_dis import 'package:mohem_flutter_app/ui/screens/pending_transactions/pending_transactions.dart'; import 'package:mohem_flutter_app/ui/screens/pending_transactions/pending_transactions_details.dart'; import 'package:mohem_flutter_app/ui/screens/submenu_screen.dart'; +import 'package:mohem_flutter_app/ui/termination/end_employement.dart'; import 'package:mohem_flutter_app/ui/work_list/item_history_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/itg_detail_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/work_list_screen.dart'; @@ -151,6 +152,9 @@ class AppRoutes { static const String performanceEvaluation = "/performanceEvaluation"; + + static const String endEmploymentScreen = "/endEmploymentScreen"; + //My Team static const String myTeam = "/myTeam"; static const String employeeDetails = "/employeeDetails"; @@ -245,6 +249,9 @@ class AppRoutes { monthlyPaySlip: (context) => MonthlyPaySlipScreen(), performanceEvaluation: (context) => PerformanceAppraisal(), + + endEmploymentScreen: (context) => EndEmploymentScreen(), + //My Team myTeam: (context) => MyTeam(), employeeDetails: (context) => EmployeeDetails(), diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 117011b..b35e780 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -432,6 +432,7 @@ class CodegenLoader extends AssetLoader{ "child": "طفل", "adult": "بالغ", "updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", + "fieldIsEmpty": "'{data}' الحقل فارغ. الرجاء التحديد", "profile": { "reset_password": { "label": "Reset Password", @@ -884,6 +885,7 @@ static const Map en_US = { "child": "Child", "adult": "Adult", "updateMember": "Are You Sure You Want to Update this Member?", + "fieldIsEmpty": "'{data}' Field is empty. Please select", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 9ede892..9f6195b 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -417,6 +417,7 @@ abstract class LocaleKeys { static const child = 'child'; static const adult = 'adult'; static const updateMember = 'updateMember'; + static const fieldIsEmpty = 'fieldIsEmpty'; 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/models/generic_response_model.dart b/lib/models/generic_response_model.dart index d12cb09..b96098e 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -83,7 +83,10 @@ import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list import 'package:mohem_flutter_app/models/start_eit_approval_process_model.dart'; import 'package:mohem_flutter_app/models/start_phone_approval_process_model.dart'; import 'package:mohem_flutter_app/models/submit_eit_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/submit_term_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/subordinates_on_leaves_model.dart'; +import 'package:mohem_flutter_app/models/termination/get_term_cols_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/termination/get_term_dff_structure_list_model.dart'; import 'package:mohem_flutter_app/models/update_item_type_success_list.dart'; import 'package:mohem_flutter_app/models/update_user_item_type_list.dart'; import 'package:mohem_flutter_app/models/vacation_rule/create_vacation_rule_list_model.dart'; @@ -101,6 +104,7 @@ import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_bo import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; +import 'package:mohem_flutter_app/start_term_approval_process_list_model.dart'; class GenericResponseModel { String? date; @@ -154,8 +158,7 @@ class GenericResponseModel { List? getConcurrentProgramsList; List? getAbsenceAttachmentsList; List? getAbsenceAttendanceTypesList; - List? - getAbsenceCollectionNotificationBodyList; + List? getAbsenceCollectionNotificationBodyList; List? getAbsenceDffStructureList; List? getAbsenceTransactionList; List? getAccrualBalancesList; @@ -180,8 +183,7 @@ class GenericResponseModel { List? getDayHoursTypeDetailsList; List? getDeductionsList; GetDefaultValueList? getDefaultValueList; - List? - getEITCollectionNotificationBodyList; + List? getEITCollectionNotificationBodyList; List? getEITDFFStructureList; List? getEITTransactionList; List? getEarningsList; @@ -235,12 +237,11 @@ class GenericResponseModel { List? getCCPDFFStructureModel; List? getSubordinatesAttdStatusList; List? getSubordinatesLeavesList; - List? - getSubordinatesLeavesTotalVacationsList; + List? getSubordinatesLeavesTotalVacationsList; List? getSummaryOfPaymentList; List? getSwipesList; - List? getTermColsStructureList; - List? getTermDffStructureList; + List? getTermColsStructureList; + List? getTermDffStructureList; List? getTermNotificationBodyList; List? getTimeCardSummaryList; List? getTicketsByEmployeeList; @@ -298,8 +299,7 @@ class GenericResponseModel { String? mohemmWifiPassword; String? mohemmWifiSSID; NotificationAction? notificationAction; - List? - notificationGetRespondAttributesList; + List? notificationGetRespondAttributesList; List? notificationRespondRolesList; int? oracleOutPutNumber; String? pASSWORDEXPIREDMSG; @@ -337,7 +337,7 @@ class GenericResponseModel { String? startHrApprovalProcessList; StartPhoneApprovalProcess? startPhonesApprovalProcessList; String? startSitApprovalProcess; - String? startTermApprovalProcessList; + StartTermApprovalProcessList? startTermApprovalProcessList; SubmitAddressTransaction? submitAddressTransactionList; SubmitBasicDetailsTransactionList? submitBasicDetTransactionList; String? submitCEITransactionList; @@ -347,7 +347,7 @@ class GenericResponseModel { String? submitHrTransactionList; Map? submitPhonesTransactionList; String? submitSITTransactionList; - String? submitTermTransactionList; + SubmitTermTransactionList? submitTermTransactionList; List? subordinatesOnLeavesList; SumbitAbsenceTransactionList? sumbitAbsenceTransactionList; String? tokenID; @@ -670,22 +670,13 @@ class GenericResponseModel { addAttSuccessList!.add(AddAttSuccessList.fromJson(v)); }); } - addAttachmentList = json['AddAttachment_List'] != null - ? AddAttachmentList.fromJson(json['AddAttachment_List']) - : null; + addAttachmentList = json['AddAttachment_List'] != null ? AddAttachmentList.fromJson(json['AddAttachment_List']) : null; bCDomain = json['BC_Domain']; bCLogo = json['BC_Logo']; - basicMemberInformation = json['BasicMemberInformation'] != null - ? BasicMemberInformationModel.fromJson(json['BasicMemberInformation']) - : null; + basicMemberInformation = json['BasicMemberInformation'] != null ? BasicMemberInformationModel.fromJson(json['BasicMemberInformation']) : null; businessCardPrivilege = json['BusinessCardPrivilege']; - calculateAbsenceDuration = json['CalculateAbsenceDuration'] != null - ? new CalculateAbsenceDuration.fromJson( - json['CalculateAbsenceDuration']) - : null; - cancelHRTransactionLIst = json['CancelHRTransactionLIst'] != null - ? new CancelHRTransactionLIst.fromJson(json['CancelHRTransactionLIst']) - : null; + calculateAbsenceDuration = json['CalculateAbsenceDuration'] != null ? new CalculateAbsenceDuration.fromJson(json['CalculateAbsenceDuration']) : null; + cancelHRTransactionLIst = json['CancelHRTransactionLIst'] != null ? new CancelHRTransactionLIst.fromJson(json['CancelHRTransactionLIst']) : null; chatEmployeeLoginList = json['Chat_EmployeeLoginList']; companyBadge = json['CompanyBadge']; companyImage = json['CompanyImage']; @@ -700,9 +691,7 @@ class GenericResponseModel { }); } - createVacationRuleList = json['CreateVacationRuleList'] != null - ? CreateVacationRuleList.fromJson(json['CreateVacationRuleList']) - : null; + createVacationRuleList = json['CreateVacationRuleList'] != null ? CreateVacationRuleList.fromJson(json['CreateVacationRuleList']) : null; deleteAttachmentList = json['DeleteAttachmentList']; deleteVacationRuleList = json['DeleteVacationRuleList']; disableSessionList = json['DisableSessionList']; @@ -713,17 +702,14 @@ class GenericResponseModel { if (json['GetAbsenceAttendanceTypesList'] != null) { getAbsenceAttendanceTypesList = []; json['GetAbsenceAttendanceTypesList'].forEach((v) { - getAbsenceAttendanceTypesList! - .add(GetAbsenceAttendanceTypesList.fromJson(v)); + getAbsenceAttendanceTypesList!.add(GetAbsenceAttendanceTypesList.fromJson(v)); }); } if (json['GetAbsenceCollectionNotificationBodyList'] != null) { - getAbsenceCollectionNotificationBodyList = - []; + getAbsenceCollectionNotificationBodyList = []; json['GetAbsenceCollectionNotificationBodyList'].forEach((v) { - getAbsenceCollectionNotificationBodyList! - .add(GetAbsenceCollectionNotificationBodyList.fromJson(v)); + getAbsenceCollectionNotificationBodyList!.add(GetAbsenceCollectionNotificationBodyList.fromJson(v)); }); } @@ -741,10 +727,7 @@ class GenericResponseModel { }); } - getAccrualBalancesList = json["GetAccrualBalancesList"] == null - ? null - : List.from(json["GetAccrualBalancesList"] - .map((x) => GetAccrualBalancesList.fromJson(x))); + getAccrualBalancesList = json["GetAccrualBalancesList"] == null ? null : List.from(json["GetAccrualBalancesList"].map((x) => GetAccrualBalancesList.fromJson(x))); if (json['GetActionHistoryList'] != null) { getActionHistoryList = []; @@ -774,22 +757,18 @@ class GenericResponseModel { getAttachementList!.add(GetAttachementList.fromJson(v)); }); } - getAttendanceTrackingList = json["GetAttendanceTrackingList"] == null - ? null - : GetAttendanceTracking.fromMap(json["GetAttendanceTrackingList"]); + getAttendanceTrackingList = json["GetAttendanceTrackingList"] == null ? null : GetAttendanceTracking.fromMap(json["GetAttendanceTrackingList"]); if (json['GetBasicDetColsStructureList'] != null) { getBasicDetColsStructureList = []; json['GetBasicDetColsStructureList'].forEach((v) { - getBasicDetColsStructureList! - .add(GetBasicDetColsStructureList.fromJson(v)); + getBasicDetColsStructureList!.add(GetBasicDetColsStructureList.fromJson(v)); }); } // getBasicDetDffStructureList = json['GetBasicDetDffStructureList']; if (json['GetBasicDetDffStructureList'] != null) { getBasicDetDffStructureList = []; json['GetBasicDetDffStructureList'].forEach((v) { - getBasicDetDffStructureList! - .add(GetBasicDetDffStructureList.fromJson(v)); + getBasicDetDffStructureList!.add(GetBasicDetDffStructureList.fromJson(v)); }); } if (json['GetContactDffStructureList'] != null) { @@ -806,8 +785,7 @@ class GenericResponseModel { }); } - getCEICollectionNotificationBodyList = - json['GetCEICollectionNotificationBodyList']; + getCEICollectionNotificationBodyList = json['GetCEICollectionNotificationBodyList']; getCEIDFFStructureList = json['GetCEIDFFStructureList']; getCEITransactionList = json['GetCEITransactionList']; getCcpTransactionsList = json['GetCcpTransactionsList']; @@ -820,24 +798,18 @@ class GenericResponseModel { if (json['GetContactColsStructureList'] != null) { getContactColsStructureList = []; json['GetContactColsStructureList'].forEach((v) { - getContactColsStructureList! - .add(GetContactColsStructureList.fromJson(v)); + getContactColsStructureList!.add(GetContactColsStructureList.fromJson(v)); }); } getContactColsStructureList = json['GetContactColsStructureList']; getContactDetailsList = json['GetContactDetailsList']; getContactDffStructureList = json['GetContactDffStructureList']; - getContactNotificationBodyList = - json["GetContactNotificationBodyList"] == null - ? null - : GetContactNotificationBodyList.fromJson( - json["GetContactNotificationBodyList"]); + getContactNotificationBodyList = json["GetContactNotificationBodyList"] == null ? null : GetContactNotificationBodyList.fromJson(json["GetContactNotificationBodyList"]); if (json['GetContactColsStructureList'] != null) { getContactColsStructureList = []; json['GetContactColsStructureList'].forEach((v) { - getContactColsStructureList! - .add(GetContactColsStructureList.fromJson(v)); + getContactColsStructureList!.add(GetContactColsStructureList.fromJson(v)); }); } @@ -855,11 +827,7 @@ class GenericResponseModel { } // getContactDetailsList = json['GetContactDetailsList']; // getContactDffStructureList = json['GetContactDffStructureList']; - getContactNotificationBodyList = - json["GetContactNotificationBodyList"] == null - ? null - : GetContactNotificationBodyList.fromJson( - json["GetContactNotificationBodyList"]); + getContactNotificationBodyList = json["GetContactNotificationBodyList"] == null ? null : GetContactNotificationBodyList.fromJson(json["GetContactNotificationBodyList"]); if (json['GetCountriesList'] != null) { getCountriesList = []; @@ -881,15 +849,10 @@ class GenericResponseModel { getDeductionsList!.add(GetDeductionsList.fromJson(v)); }); } - getDefaultValueList = json['GetDefaultValueList'] != null - ? GetDefaultValueList.fromJson(json['GetDefaultValueList']) - : null; - getEITCollectionNotificationBodyList = - json["GetEITCollectionNotificationBodyList"] == null - ? null - : List.from( - json["GetEITCollectionNotificationBodyList"].map( - (x) => GetEitCollectionNotificationBodyList.fromJson(x))); + getDefaultValueList = json['GetDefaultValueList'] != null ? GetDefaultValueList.fromJson(json['GetDefaultValueList']) : null; + getEITCollectionNotificationBodyList = json["GetEITCollectionNotificationBodyList"] == null + ? null + : List.from(json["GetEITCollectionNotificationBodyList"].map((x) => GetEitCollectionNotificationBodyList.fromJson(x))); if (json['GetEITDFFStructureList'] != null) { getEITDFFStructureList = []; json['GetEITDFFStructureList'].forEach((v) { @@ -918,8 +881,7 @@ class GenericResponseModel { if (json['GetEmployeeBasicDetailsList'] != null) { getEmployeeBasicDetailsList = []; json['GetEmployeeBasicDetailsList'].forEach((v) { - getEmployeeBasicDetailsList! - .add(GetEmployeeBasicDetailsList.fromJson(v)); + getEmployeeBasicDetailsList!.add(GetEmployeeBasicDetailsList.fromJson(v)); }); } if (json['GetEmployeeContactsList'] != null) { @@ -937,34 +899,25 @@ class GenericResponseModel { if (json['GetEmployeeSubordinatesList'] != null) { getEmployeeSubordinatesList = []; json['GetEmployeeSubordinatesList'].forEach((v) { - getEmployeeSubordinatesList! - .add(new GetEmployeeSubordinatesList.fromJson(v)); + getEmployeeSubordinatesList!.add(new GetEmployeeSubordinatesList.fromJson(v)); }); } getFliexfieldStructureList = json['GetFliexfieldStructureList']; - getHrCollectionNotificationBodyList = - json['GetHrCollectionNotificationBodyList']; + getHrCollectionNotificationBodyList = json['GetHrCollectionNotificationBodyList']; getHrTransactionList = json['GetHrTransactionList']; - getItemCreationNtfBodyList = json['GetItemCreationNtfBodyList'] != null - ? GetItemCreationNtfBodyList.fromJson( - json['GetItemCreationNtfBodyList']) - : null; + getItemCreationNtfBodyList = json['GetItemCreationNtfBodyList'] != null ? GetItemCreationNtfBodyList.fromJson(json['GetItemCreationNtfBodyList']) : null; if (json['GetItemTypeNotificationsList'] != null) { getItemTypeNotificationsList = []; json['GetItemTypeNotificationsList'].forEach((v) { - getItemTypeNotificationsList! - .add(GetItemTypeNotificationsList.fromJson(v)); + getItemTypeNotificationsList!.add(GetItemTypeNotificationsList.fromJson(v)); }); } getItemTypesList = json['GetItemTypesList']; getLookupValuesList = json['GetLookupValuesList']; - getMenuEntriesList = json["GetMenuEntriesList"] == null - ? null - : List.from(json["GetMenuEntriesList"] - .map((x) => GetMenuEntriesList.fromJson(x))); + getMenuEntriesList = json["GetMenuEntriesList"] == null ? null : List.from(json["GetMenuEntriesList"].map((x) => GetMenuEntriesList.fromJson(x))); if (json['GetMoItemHistoryList'] != null) { getMoItemHistoryList = []; json['GetMoItemHistoryList'].forEach((v) { @@ -989,8 +942,7 @@ class GenericResponseModel { if (json['GetNotificationReassignModeList'] != null) { getNotificationReassignModeList = []; json['GetNotificationReassignModeList'].forEach((v) { - getNotificationReassignModeList! - .add(GetNotificationReassignModeList.fromJson(v)); + getNotificationReassignModeList!.add(GetNotificationReassignModeList.fromJson(v)); }); } @@ -1001,13 +953,8 @@ class GenericResponseModel { }); } - getOpenMissingSwipesList = json["GetOpenMissingSwipesList"] == null - ? null - : GetOpenMissingSwipesList.fromJson(json["GetOpenMissingSwipesList"]); - getOpenNotificationsList = json["GetOpenNotificationsList"] == null - ? null - : List.from(json["GetOpenNotificationsList"] - .map((x) => GetOpenNotificationsList.fromMap(x))); + getOpenMissingSwipesList = json["GetOpenMissingSwipesList"] == null ? null : GetOpenMissingSwipesList.fromJson(json["GetOpenMissingSwipesList"]); + getOpenNotificationsList = json["GetOpenNotificationsList"] == null ? null : List.from(json["GetOpenNotificationsList"].map((x) => GetOpenNotificationsList.fromMap(x))); getOpenNotificationsNumList = json['GetOpenNotificationsNumList']; getOpenPeriodDatesList = json['GetOpenPeriodDatesList']; getOrganizationsSalariesList = json['GetOrganizationsSalariesList']; @@ -1027,26 +974,17 @@ class GenericResponseModel { } // getPendingReqDetailsList = json['GetPendingReqDetailsList']; // getPendingReqFunctionsList = json['GetPendingReqFunctionsList']; - getPerformanceAppraisalList = json['GetPerformanceAppraisalList'] == null - ? null - : List.from( - json["GetPerformanceAppraisalList"] - .map((x) => GetPerformanceAppraisalList.fromJson(x))); + getPerformanceAppraisalList = + json['GetPerformanceAppraisalList'] == null ? null : List.from(json["GetPerformanceAppraisalList"].map((x) => GetPerformanceAppraisalList.fromJson(x))); getPhonesNotificationBodyList = - json["GetPhonesNotificationBodyList"] == null - ? null - : List.from( - json["GetPhonesNotificationBodyList"] - .map((x) => GetPhonesNotificationBodyList.fromJson(x))); + json["GetPhonesNotificationBodyList"] == null ? null : List.from(json["GetPhonesNotificationBodyList"].map((x) => GetPhonesNotificationBodyList.fromJson(x))); if (json['GetPoItemHistoryList'] != null) { getPoItemHistoryList = []; json['GetPoItemHistoryList'].forEach((v) { getPoItemHistoryList!.add(GetPoItemHistoryList.fromJson(v)); }); } - getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null - ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) - : null; + getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null; getPrNotificationBodyList = json['GetPrNotificationBodyList']; if (json['GetQuotationAnalysisList'] != null) { getQuotationAnalysisList = []; @@ -1056,15 +994,13 @@ class GenericResponseModel { } getRFCEmployeeListList = json['GetRFCEmployeeListList']; getRespondAttributeValueList = json['GetRespondAttributeValueList']; - getSITCollectionNotificationBodyList = - json['GetSITCollectionNotificationBodyList']; + getSITCollectionNotificationBodyList = json['GetSITCollectionNotificationBodyList']; getSITDFFStructureList = json['GetSITDFFStructureList']; getSITTransactionList = json['GetSITTransactionList']; if (json['GetScheduleShiftsDetailsList'] != null) { getScheduleShiftsDetailsList = []; json['GetScheduleShiftsDetailsList'].forEach((v) { - getScheduleShiftsDetailsList! - .add(GetScheduleShiftsDetailsList.fromJson(v)); + getScheduleShiftsDetailsList!.add(GetScheduleShiftsDetailsList.fromJson(v)); }); } getShiftTypesList = json['GetShiftTypesList']; @@ -1072,15 +1008,13 @@ class GenericResponseModel { if (json['GetStampMsNotificationBodyList'] != null) { getStampMsNotificationBodyList = []; json['GetStampMsNotificationBodyList'].forEach((v) { - getStampMsNotificationBodyList! - .add(GetStampMsNotificationBodyList.fromJson(v)); + getStampMsNotificationBodyList!.add(GetStampMsNotificationBodyList.fromJson(v)); }); } if (json['GetStampNsNotificationBodyList'] != null) { getStampNsNotificationBodyList = []; json['GetStampNsNotificationBodyList'].forEach((v) { - getStampNsNotificationBodyList! - .add(GetStampNsNotificationBodyList.fromJson(v)); + getStampNsNotificationBodyList!.add(GetStampNsNotificationBodyList.fromJson(v)); }); } @@ -1094,11 +1028,9 @@ class GenericResponseModel { } if (json['GetSubordinatesLeavesTotalVacationsList'] != null) { - getSubordinatesLeavesTotalVacationsList = - []; + getSubordinatesLeavesTotalVacationsList = []; json['GetSubordinatesLeavesTotalVacationsList'].forEach((v) { - getSubordinatesLeavesTotalVacationsList! - .add(new GetSubordinatesLeavesTotalVacationsList.fromJson(v)); + getSubordinatesLeavesTotalVacationsList!.add(new GetSubordinatesLeavesTotalVacationsList.fromJson(v)); }); } if (json['GetSummaryOfPaymentList'] != null) { @@ -1108,8 +1040,20 @@ class GenericResponseModel { }); } getSwipesList = json['GetSwipesList']; - getTermColsStructureList = json['GetTermColsStructureList']; - getTermDffStructureList = json['GetTermDffStructureList']; + if (json['GetTermColsStructureList'] != null) { + getTermColsStructureList = []; + json['GetTermColsStructureList'].forEach((v) { + getTermColsStructureList!.add(GetTermColsStructureList.fromJson(v)); + }); + } + + if (json['GetTermDffStructureList'] != null) { + getTermDffStructureList = []; + json['GetTermDffStructureList'].forEach((v) { + getTermDffStructureList!.add(new GetTermDffStructureList.fromJson(v)); + }); + } + getTermNotificationBodyList = json['GetTermNotificationBodyList']; if (json['GetTimeCardSummaryList'] != null) { @@ -1168,9 +1112,7 @@ class GenericResponseModel { }); } if (json['Mohemm_ITG_Pending_Task_ResponseItem'] != null) { - mohemmITGPendingTaskResponseItem = - MohemmITGPendingTaskResponseItem.fromJson( - json['Mohemm_ITG_Pending_Task_ResponseItem']); + mohemmITGPendingTaskResponseItem = MohemmITGPendingTaskResponseItem.fromJson(json['Mohemm_ITG_Pending_Task_ResponseItem']); } if (json['Mohemm_ITG_SectionTopicsList'] != null) { getSectionTopics = []; @@ -1182,16 +1124,14 @@ class GenericResponseModel { if (json['GetPendingReqFunctionsList'] != null) { getPendingTransactionsFunctions = []; json['GetPendingReqFunctionsList'].forEach((v) { - getPendingTransactionsFunctions! - .add(GetPendingTransactionsFunctions.fromJson(v)); + getPendingTransactionsFunctions!.add(GetPendingTransactionsFunctions.fromJson(v)); }); } if (json['GetPendingReqDetailsList'] != null) { getPendingTransactionsDetails = []; json['GetPendingReqDetailsList'].forEach((v) { - getPendingTransactionsDetails! - .add(GetPendingTransactionsDetails.fromJson(v)); + getPendingTransactionsDetails!.add(GetPendingTransactionsDetails.fromJson(v)); }); } @@ -1270,10 +1210,7 @@ class GenericResponseModel { listItemImagesDetails = json['List_ItemImagesDetails']; listItemMaster = json['List_ItemMaster']; listMedicineDetails = json['List_MedicineDetails']; - listMenu = json["List_Menu"] == null - ? [] - : List.from( - json["List_Menu"].map((x) => ListMenu.fromJson(x))); + listMenu = json["List_Menu"] == null ? [] : List.from(json["List_Menu"].map((x) => ListMenu.fromJson(x))); listNewEmployees = json['List_NewEmployees']; listRadScreen = json['List_RadScreen']; logInTokenID = json['LogInTokenID']; @@ -1283,44 +1220,29 @@ class GenericResponseModel { memberInformationList!.add(MemberInformationListModel.fromJson(v)); }); } - memberLoginList = json['MemberLoginList'] != null - ? MemberLoginListModel.fromJson(json['MemberLoginList']) - : null; - mohemmGetBusinessCardEnabledList = - json['Mohemm_GetBusinessCardEnabledList']; + memberLoginList = json['MemberLoginList'] != null ? MemberLoginListModel.fromJson(json['MemberLoginList']) : null; + mohemmGetBusinessCardEnabledList = json['Mohemm_GetBusinessCardEnabledList']; mohemmGetFavoriteReplacementsList = - json["Mohemm_GetFavoriteReplacementsList"] == null - ? null - : List.from( - json["Mohemm_GetFavoriteReplacementsList"] - .map((x) => GetFavoriteReplacements.fromJson(x))); - - mohemmGetMobileDeviceInfobyEmpInfoList = - json['Mohemm_GetMobileDeviceInfobyEmpInfoList']; + json["Mohemm_GetFavoriteReplacementsList"] == null ? null : List.from(json["Mohemm_GetFavoriteReplacementsList"].map((x) => GetFavoriteReplacements.fromJson(x))); + + mohemmGetMobileDeviceInfobyEmpInfoList = json['Mohemm_GetMobileDeviceInfobyEmpInfoList']; if (json['Mohemm_GetMobileLoginInfoList'] != null) { mohemmGetMobileLoginInfoList = []; json['Mohemm_GetMobileLoginInfoList'].forEach((v) { - mohemmGetMobileLoginInfoList! - .add(GetMobileLoginInfoListModel.fromJson(v)); + mohemmGetMobileLoginInfoList!.add(GetMobileLoginInfoListModel.fromJson(v)); }); } mohemmGetPatientIDList = json['Mohemm_GetPatientID_List']; mohemmITGResponseItem = json['Mohemm_ITG_ResponseItem']; - mohemmIsChangeIsActiveBusinessCardEnable = - json['Mohemm_IsChangeIsActiveBusinessCardEnable']; - mohemmIsInsertBusinessCardEnable = - json['Mohemm_IsInsertBusinessCardEnable']; + mohemmIsChangeIsActiveBusinessCardEnable = json['Mohemm_IsChangeIsActiveBusinessCardEnable']; + mohemmIsInsertBusinessCardEnable = json['Mohemm_IsInsertBusinessCardEnable']; mohemmWifiPassword = json['Mohemm_Wifi_Password']; mohemmWifiSSID = json['Mohemm_Wifi_SSID']; - notificationAction = json['NotificationAction'] != null - ? NotificationAction.fromJson(json['NotificationAction']) - : null; + notificationAction = json['NotificationAction'] != null ? NotificationAction.fromJson(json['NotificationAction']) : null; if (json['NotificationGetRespondAttributesList'] != null) { - notificationGetRespondAttributesList = - []; + notificationGetRespondAttributesList = []; json['NotificationGetRespondAttributesList'].forEach((v) { - notificationGetRespondAttributesList! - .add(NotificationGetRespondAttributesList.fromJson(v)); + notificationGetRespondAttributesList!.add(NotificationGetRespondAttributesList.fromJson(v)); }); } @@ -1345,8 +1267,7 @@ class GenericResponseModel { pQUESTION = json['P_QUESTION']; pSESSIONID = json['P_SESSION_ID']; pSchema = json['P_Schema']; - pharmacyStockAddPharmacyStockList = - json['PharmacyStock_AddPharmacyStockList']; + pharmacyStockAddPharmacyStockList = json['PharmacyStock_AddPharmacyStockList']; pharmacyStockGetOnHandList = json['PharmacyStock_GetOnHandList']; if (json['Privilege_List'] != null) { @@ -1358,10 +1279,7 @@ class GenericResponseModel { processTransactions = json['ProcessTransactions']; registerUserNameList = json['RegisterUserNameList']; - replacementList = json["ReplacementList"] == null - ? null - : List.from( - json["ReplacementList"].map((x) => ReplacementList.fromJson(x))); + replacementList = json["ReplacementList"] == null ? null : List.from(json["ReplacementList"].map((x) => ReplacementList.fromJson(x))); if (json['RespondAttributesList'] != null) { respondAttributesList = []; @@ -1380,57 +1298,33 @@ class GenericResponseModel { resubmitHrTransactionList = json['ResubmitHrTransactionList']; sFHGetPoNotificationBodyList = json['SFH_GetPoNotificationBodyList']; sFHGetPrNotificationBodyList = json['SFH_GetPrNotificationBodyList']; - startAbsenceApprovalProccess = json['StartAbsenceApprovalProccess'] != null - ? StartAbsenceApprovalProccess.fromJson( - json['StartAbsenceApprovalProccess']) - : null; - startAddressApprovalProcessList = - json['StartAddressApprovalProcessList'] != null - ? StartAddressApprovalProcess.fromJson( - json['StartAddressApprovalProcessList']) - : null; + startAbsenceApprovalProccess = json['StartAbsenceApprovalProccess'] != null ? StartAbsenceApprovalProccess.fromJson(json['StartAbsenceApprovalProccess']) : null; + startAddressApprovalProcessList = json['StartAddressApprovalProcessList'] != null ? StartAddressApprovalProcess.fromJson(json['StartAddressApprovalProcessList']) : null; startBasicDetApprProcessList = json['StartBasicDetApprProcessList']; startCeiApprovalProcess = json['StartCeiApprovalProcess']; startContactApprovalProcessList = json['StartContactApprovalProcessList']; - startEitApprovalProcess = json['StartEitApprovalProcess'] != null - ? StartEitApprovalProcess.fromJson(json['StartEitApprovalProcess']) - : null; + startEitApprovalProcess = json['StartEitApprovalProcess'] != null ? StartEitApprovalProcess.fromJson(json['StartEitApprovalProcess']) : null; startHrApprovalProcessList = json['StartHrApprovalProcessList']; - startPhonesApprovalProcessList = - json['StartPhonesApprovalProcessList'] != null - ? StartPhoneApprovalProcess.fromJson( - json['startPhonesApprovalProcessList']) - : null; + startPhonesApprovalProcessList = json['StartPhonesApprovalProcessList'] != null ? StartPhoneApprovalProcess.fromJson(json['startPhonesApprovalProcessList']) : null; startSitApprovalProcess = json['StartSitApprovalProcess']; - startTermApprovalProcessList = json['StartTermApprovalProcessList']; - - submitAddressTransactionList = json['SubmitAddressTransactionList'] != null - ? SubmitAddressTransaction.fromJson( - json['SubmitAddressTransactionList']) - : null; - submitBasicDetTransactionList = - json['SubmitBasicDetTransactionList'] != null - ? SubmitBasicDetailsTransactionList.fromJson( - json['SubmitBasicDetTransactionList']) - : null; + + startTermApprovalProcessList = json['StartTermApprovalProcessList'] != null ? StartTermApprovalProcessList.fromJson(json['StartTermApprovalProcessList']) : null; + + submitAddressTransactionList = json['SubmitAddressTransactionList'] != null ? SubmitAddressTransaction.fromJson(json['SubmitAddressTransactionList']) : null; + submitBasicDetTransactionList = json['SubmitBasicDetTransactionList'] != null ? SubmitBasicDetailsTransactionList.fromJson(json['SubmitBasicDetTransactionList']) : null; submitCEITransactionList = json['SubmitCEITransactionList']; submitCcpTransactionList = json['SubmitCcpTransactionList']; - submitContactTransactionList = json['SubmitContactTransactionList'] != null - ? SubmitContactTransactionList.fromJson( - json['SubmitContactTransactionList']) - : null; - submitEITTransactionList = json['SubmitEITTransactionList'] != null - ? SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) - : null; + submitContactTransactionList = json['SubmitContactTransactionList'] != null ? SubmitContactTransactionList.fromJson(json['SubmitContactTransactionList']) : null; + submitEITTransactionList = json['SubmitEITTransactionList'] != null ? SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) : null; submitHrTransactionList = json['SubmitHrTransactionList']; submitPhonesTransactionList = json['SubmitPhonesTransactionList']; submitSITTransactionList = json['SubmitSITTransactionList']; - submitTermTransactionList = json['SubmitTermTransactionList']; + submitTermTransactionList = json['SubmitTermTransactionList'] != null ? SubmitTermTransactionList.fromJson(json['SubmitTermTransactionList']) : null; if (json['SubordinatesOnLeavesList'] != null) { subordinatesOnLeavesList = []; @@ -1439,10 +1333,7 @@ class GenericResponseModel { }); } - sumbitAbsenceTransactionList = json['SumbitAbsenceTransactionList'] != null - ? new SumbitAbsenceTransactionList.fromJson( - json['SumbitAbsenceTransactionList']) - : null; + sumbitAbsenceTransactionList = json['SumbitAbsenceTransactionList'] != null ? new SumbitAbsenceTransactionList.fromJson(json['SumbitAbsenceTransactionList']) : null; tokenID = json['TokenID']; updateAttachmentList = json['UpdateAttachmentList']; @@ -1450,13 +1341,10 @@ class GenericResponseModel { if (json['UpdateItemTypeSuccessList'] != null) { updateItemTypeSuccessList = []; json['UpdateItemTypeSuccessList'].forEach((v) { - updateItemTypeSuccessList! - .add(new UpdateItemTypeSuccessList.fromJson(v)); + updateItemTypeSuccessList!.add(new UpdateItemTypeSuccessList.fromJson(v)); }); } - updateUserItemTypesList = json['UpdateUserItemTypesList'] != null - ? new UpdateUserItemTypesList.fromJson(json['UpdateUserItemTypesList']) - : null; + updateUserItemTypesList = json['UpdateUserItemTypesList'] != null ? new UpdateUserItemTypesList.fromJson(json['UpdateUserItemTypesList']) : null; updateVacationRuleList = json['UpdateVacationRuleList']; vHREmployeeLoginList = json['VHR_EmployeeLoginList']; vHRGetEmployeeDetailsList = json['VHR_GetEmployeeDetailsList']; @@ -1464,16 +1352,9 @@ class GenericResponseModel { vHRGetProjectByCodeList = json['VHR_GetProjectByCodeList']; vHRIsVerificationCodeValid = json['VHR_IsVerificationCodeValid']; - validateAbsenceTransactionList = - json['ValidateAbsenceTransactionList'] != null - ? ValidateAbsenceTransactionList.fromJson( - json['ValidateAbsenceTransactionList']) - : null; + validateAbsenceTransactionList = json['ValidateAbsenceTransactionList'] != null ? ValidateAbsenceTransactionList.fromJson(json['ValidateAbsenceTransactionList']) : null; - validateEITTransactionList = json['ValidateEITTransactionList'] != null - ? ValidateEITTransactionList.fromJson( - json['ValidateEITTransactionList']) - : null; + validateEITTransactionList = json['ValidateEITTransactionList'] != null ? ValidateEITTransactionList.fromJson(json['ValidateEITTransactionList']) : null; validatePhonesTransactionList = json['ValidatePhonesTransactionList']; if (json['VrItemTypesList'] != null) { @@ -1488,8 +1369,7 @@ class GenericResponseModel { wFLookUpList!.add(WFLookUpList.fromJson(v)); }); } - eLearningGETEMPLOYEEPROFILEList = - json['eLearning_GET_EMPLOYEE_PROFILEList']; + eLearningGETEMPLOYEEPROFILEList = json['eLearning_GET_EMPLOYEE_PROFILEList']; eLearningLOGINList = json['eLearning_LOGINList']; eLearningValidateLoginList = json['eLearning_ValidateLoginList']; eLearningValidate_LoginList = json['eLearning_Validate_LoginList']; @@ -1528,8 +1408,7 @@ class GenericResponseModel { data['VidaUpdatedResponse'] = this.vidaUpdatedResponse; if (this.addAttSuccessList != null) { - data['AddAttSuccessList'] = - this.addAttSuccessList!.map((v) => v.toJson()).toList(); + data['AddAttSuccessList'] = this.addAttSuccessList!.map((v) => v.toJson()).toList(); } if (this.addAttachmentList != null) { data['AddAttachment_List'] = this.addAttachmentList!.toJson(); @@ -1542,8 +1421,7 @@ class GenericResponseModel { } data['BusinessCardPrivilege'] = this.businessCardPrivilege; if (this.calculateAbsenceDuration != null) { - data['CalculateAbsenceDuration'] = - this.calculateAbsenceDuration!.toJson(); + data['CalculateAbsenceDuration'] = this.calculateAbsenceDuration!.toJson(); } if (this.cancelHRTransactionLIst != null) { data['CancelHRTransactionLIst'] = this.calculateAbsenceDuration!.toJson(); @@ -1569,45 +1447,35 @@ class GenericResponseModel { data['GetAbsenceAttachmentsList'] = this.getAbsenceAttachmentsList; if (this.getAbsenceAttendanceTypesList != null) { - data['GetAbsenceAttendanceTypesList'] = - this.getAbsenceAttendanceTypesList!.map((v) => v.toJson()).toList(); + data['GetAbsenceAttendanceTypesList'] = this.getAbsenceAttendanceTypesList!.map((v) => v.toJson()).toList(); } if (this.getAbsenceCollectionNotificationBodyList != null) { - data['GetAbsenceCollectionNotificationBodyList'] = this - .getAbsenceCollectionNotificationBodyList! - .map((v) => v.toJson()) - .toList(); + data['GetAbsenceCollectionNotificationBodyList'] = this.getAbsenceCollectionNotificationBodyList!.map((v) => v.toJson()).toList(); } if (this.getAbsenceDffStructureList != null) { - data['GetAbsenceDffStructureList'] = - this.getAbsenceDffStructureList!.map((v) => v.toJson()).toList(); + data['GetAbsenceDffStructureList'] = this.getAbsenceDffStructureList!.map((v) => v.toJson()).toList(); } if (this.getAbsenceTransactionList != null) { - data['GetAbsenceTransactionList'] = - this.getAbsenceTransactionList!.map((v) => v.toJson()).toList(); + data['GetAbsenceTransactionList'] = this.getAbsenceTransactionList!.map((v) => v.toJson()).toList(); } data['GetAccrualBalancesList'] = this.getAccrualBalancesList; if (this.getActionHistoryList != null) { - data['GetActionHistoryList'] = - this.getActionHistoryList!.map((v) => v.toJson()).toList(); + data['GetActionHistoryList'] = this.getActionHistoryList!.map((v) => v.toJson()).toList(); } data['GetAddressDffStructureList'] = this.getAddressDffStructureList; - data['GetAddressNotificationBodyList'] = - this.getAddressNotificationBodyList; + data['GetAddressNotificationBodyList'] = this.getAddressNotificationBodyList; if (this.getApprovesList != null) { - data['GetApprovesList'] = - this.getApprovesList!.map((v) => v.toJson()).toList(); + data['GetApprovesList'] = this.getApprovesList!.map((v) => v.toJson()).toList(); } if (this.getAttachementList != null) { - data['GetAttachementList'] = - this.getAttachementList!.map((v) => v.toJson()).toList(); + data['GetAttachementList'] = this.getAttachementList!.map((v) => v.toJson()).toList(); } data['GetAttendanceTrackingList'] = this.getAttendanceTrackingList; @@ -1615,116 +1483,92 @@ class GenericResponseModel { data['GetBasicDetDffStructureList'] = this.getBasicDetDffStructureList; if (this.getBasicDetNtfBodyList != null) { - data['GetBasicDetNtfBodyList'] = - this.getBasicDetNtfBodyList!.map((v) => v.toJson()).toList(); + data['GetBasicDetNtfBodyList'] = this.getBasicDetNtfBodyList!.map((v) => v.toJson()).toList(); } - data['GetCEICollectionNotificationBodyList'] = - this.getCEICollectionNotificationBodyList; + data['GetCEICollectionNotificationBodyList'] = this.getCEICollectionNotificationBodyList; data['GetCEIDFFStructureList'] = this.getCEIDFFStructureList; data['GetCEITransactionList'] = this.getCEITransactionList; data['GetCcpTransactionsList'] = this.getCcpTransactionsList; if (this.getContactDetailsList != null) { - data['GetContactDetailsList'] = - this.getContactDetailsList!.map((v) => v.toJson()).toList(); + data['GetContactDetailsList'] = this.getContactDetailsList!.map((v) => v.toJson()).toList(); } if (this.getContactColsStructureList != null) { - data['GetContactColsStructureList'] = - this.getContactColsStructureList!.map((v) => v.toJson()).toList(); + data['GetContactColsStructureList'] = this.getContactColsStructureList!.map((v) => v.toJson()).toList(); } if (this.getContactDffStructureList != null) { - data['GetContactDffStructureList'] = - this.getContactDffStructureList!.map((v) => v.toJson()).toList(); + data['GetContactDffStructureList'] = this.getContactDffStructureList!.map((v) => v.toJson()).toList(); } data['GetContactColsStructureList'] = this.getContactColsStructureList; data['GetContactDetailsList'] = this.getContactDetailsList; data['GetContactDffStructureList'] = this.getContactDffStructureList; - data['GetContactNotificationBodyList'] = - this.getContactNotificationBodyList; + data['GetContactNotificationBodyList'] = this.getContactNotificationBodyList; data['GetCountriesList'] = this.getCountriesList; if (this.getDayHoursTypeDetailsList != null) { - data['GetDayHoursTypeDetailsList'] = - this.getDayHoursTypeDetailsList!.map((v) => v.toJson()).toList(); + data['GetDayHoursTypeDetailsList'] = this.getDayHoursTypeDetailsList!.map((v) => v.toJson()).toList(); } if (this.getDeductionsList != null) { - data['GetDeductionsList'] = - this.getDeductionsList!.map((v) => v.toJson()).toList(); + data['GetDeductionsList'] = this.getDeductionsList!.map((v) => v.toJson()).toList(); } if (this.getDefaultValueList != null) { data['GetDefaultValueList'] = this.getDefaultValueList!.toJson(); } - data['GetEITCollectionNotificationBodyList'] = - this.getEITCollectionNotificationBodyList; + data['GetEITCollectionNotificationBodyList'] = this.getEITCollectionNotificationBodyList; if (this.getEITDFFStructureList != null) { - data['GetEITDFFStructureList'] = - this.getEITDFFStructureList!.map((v) => v.toJson()).toList(); + data['GetEITDFFStructureList'] = this.getEITDFFStructureList!.map((v) => v.toJson()).toList(); } if (this.getEITTransactionList != null) { - data['GetEITTransactionList'] = - this.getEITTransactionList!.map((v) => v.toJson()).toList(); + data['GetEITTransactionList'] = this.getEITTransactionList!.map((v) => v.toJson()).toList(); } if (this.getEarningsList != null) { - data['GetEarningsList'] = - this.getEarningsList!.map((v) => v.toJson()).toList(); + data['GetEarningsList'] = this.getEarningsList!.map((v) => v.toJson()).toList(); } if (this.getEmployeeAddressList != null) { - data['GetEmployeeAddressList'] = - this.getEmployeeAddressList!.map((v) => v.toJson()).toList(); + data['GetEmployeeAddressList'] = this.getEmployeeAddressList!.map((v) => v.toJson()).toList(); } if (this.getEmployeeBasicDetailsList != null) { - data['GetEmployeeBasicDetailsList'] = - this.getEmployeeBasicDetailsList!.map((v) => v.toJson()).toList(); + data['GetEmployeeBasicDetailsList'] = this.getEmployeeBasicDetailsList!.map((v) => v.toJson()).toList(); } if (this.getEmployeeContactsList != null) { - data['GetEmployeeContactsList'] = - this.getEmployeeContactsList!.map((v) => v.toJson()).toList(); + data['GetEmployeeContactsList'] = this.getEmployeeContactsList!.map((v) => v.toJson()).toList(); } if (this.getEmployeePhonesList != null) { - data['GetEmployeePhonesList'] = - this.getEmployeePhonesList!.map((v) => v.toJson()).toList(); + data['GetEmployeePhonesList'] = this.getEmployeePhonesList!.map((v) => v.toJson()).toList(); } if (this.getEmployeeSubordinatesList != null) { - data['GetEmployeeSubordinatesList'] = - this.getEmployeeSubordinatesList!.map((v) => v.toJson()).toList(); + data['GetEmployeeSubordinatesList'] = this.getEmployeeSubordinatesList!.map((v) => v.toJson()).toList(); } data['GetFliexfieldStructureList'] = this.getFliexfieldStructureList; - data['GetHrCollectionNotificationBodyList'] = - this.getHrCollectionNotificationBodyList; + data['GetHrCollectionNotificationBodyList'] = this.getHrCollectionNotificationBodyList; data['GetHrTransactionList'] = this.getHrTransactionList; if (this.getItemCreationNtfBodyList != null) { - data['GetItemCreationNtfBodyList'] = - this.getItemCreationNtfBodyList!.toJson(); + data['GetItemCreationNtfBodyList'] = this.getItemCreationNtfBodyList!.toJson(); } if (this.getItemTypeNotificationsList != null) { - data['GetItemTypeNotificationsList'] = - this.getItemTypeNotificationsList!.map((v) => v.toJson()).toList(); + data['GetItemTypeNotificationsList'] = this.getItemTypeNotificationsList!.map((v) => v.toJson()).toList(); } data['GetItemTypesList'] = this.getItemTypesList; data['GetLookupValuesList'] = this.getLookupValuesList; data['GetMenuEntriesList'] = this.getMenuEntriesList; if (this.getMoItemHistoryList != null) { - data['GetMoItemHistoryList'] = - this.getMoItemHistoryList!.map((v) => v.toJson()).toList(); + data['GetMoItemHistoryList'] = this.getMoItemHistoryList!.map((v) => v.toJson()).toList(); } if (this.getMoNotificationBodyList != null) { - data['GetMoNotificationBodyList'] = - this.getMoNotificationBodyList!.map((v) => v.toJson()).toList(); + data['GetMoNotificationBodyList'] = this.getMoNotificationBodyList!.map((v) => v.toJson()).toList(); } if (this.getNotificationButtonsList != null) { - data['GetNotificationButtonsList'] = - this.getNotificationButtonsList!.map((v) => v.toJson()).toList(); + data['GetNotificationButtonsList'] = this.getNotificationButtonsList!.map((v) => v.toJson()).toList(); } if (getNotificationReassignModeList != null) { - data['GetNotificationReassignModeList'] = - getNotificationReassignModeList!.map((v) => v.toJson()).toList(); + data['GetNotificationReassignModeList'] = getNotificationReassignModeList!.map((v) => v.toJson()).toList(); } data['GetObjectValuesList'] = this.getObjectValuesList; @@ -1734,91 +1578,80 @@ class GenericResponseModel { data['GetOpenPeriodDatesList'] = this.getOpenPeriodDatesList; data['GetOrganizationsSalariesList'] = this.getOrganizationsSalariesList; if (this.getPaymentInformationList != null) { - data['GetPaymentInformationList'] = - this.getPaymentInformationList!.map((v) => v.toJson()).toList(); + data['GetPaymentInformationList'] = this.getPaymentInformationList!.map((v) => v.toJson()).toList(); } if (this.getPayslipList != null) { - data['GetPayslipList'] = - this.getPayslipList!.map((v) => v.toJson()).toList(); + data['GetPayslipList'] = this.getPayslipList!.map((v) => v.toJson()).toList(); } // data['GetPendingReqDetailsList'] = this.getPendingReqDetailsList; // data['GetPendingReqFunctionsList'] = this.getPendingReqFunctionsList; data['GetPerformanceAppraisalList'] = this.getPerformanceAppraisalList; data['GetPhonesNotificationBodyList'] = this.getPhonesNotificationBodyList; if (this.getPoItemHistoryList != null) { - data['GetPoItemHistoryList'] = - this.getPoItemHistoryList!.map((v) => v.toJson()).toList(); + data['GetPoItemHistoryList'] = this.getPoItemHistoryList!.map((v) => v.toJson()).toList(); } if (this.getPoNotificationBodyList != null) { - data['GetPoNotificationBodyList'] = - this.getPoNotificationBodyList!.toJson(); + data['GetPoNotificationBodyList'] = this.getPoNotificationBodyList!.toJson(); } data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList; if (this.getQuotationAnalysisList != null) { - data['GetQuotationAnalysisList'] = - this.getQuotationAnalysisList!.map((v) => v.toJson()).toList(); + data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList(); } data['GetRFCEmployeeListList'] = this.getRFCEmployeeListList; data['GetRespondAttributeValueList'] = this.getRespondAttributeValueList; - data['GetSITCollectionNotificationBodyList'] = - this.getSITCollectionNotificationBodyList; + data['GetSITCollectionNotificationBodyList'] = this.getSITCollectionNotificationBodyList; data['GetSITDFFStructureList'] = this.getSITDFFStructureList; data['GetSITTransactionList'] = this.getSITTransactionList; if (this.getScheduleShiftsDetailsList != null) { - data['GetScheduleShiftsDetailsList'] = - this.getScheduleShiftsDetailsList!.map((v) => v.toJson()).toList(); + data['GetScheduleShiftsDetailsList'] = this.getScheduleShiftsDetailsList!.map((v) => v.toJson()).toList(); } data['GetShiftTypesList'] = this.getShiftTypesList; if (this.getStampMsNotificationBodyList != null) { - data['GetStampMsNotificationBodyList'] = - this.getStampMsNotificationBodyList!.map((v) => v.toJson()).toList(); + data['GetStampMsNotificationBodyList'] = this.getStampMsNotificationBodyList!.map((v) => v.toJson()).toList(); } if (this.getStampNsNotificationBodyList != null) { - data['GetStampNsNotificationBodyList'] = - this.getStampNsNotificationBodyList!.map((v) => v.toJson()).toList(); + data['GetStampNsNotificationBodyList'] = this.getStampNsNotificationBodyList!.map((v) => v.toJson()).toList(); } - data['GetStampNsNotificationBodyList'] = - this.getStampNsNotificationBodyList; + data['GetStampNsNotificationBodyList'] = this.getStampNsNotificationBodyList; data['GetSubordinatesAttdStatusList'] = this.getSubordinatesAttdStatusList; data['GetSubordinatesLeavesList'] = this.getSubordinatesLeavesList; if (this.getSubordinatesLeavesList != null) { - data['GetSubordinatesLeavesList'] = - this.getSubordinatesLeavesList!.map((v) => v.toJson()).toList(); + data['GetSubordinatesLeavesList'] = this.getSubordinatesLeavesList!.map((v) => v.toJson()).toList(); } if (this.getSubordinatesLeavesTotalVacationsList != null) { - data['GetSubordinatesLeavesTotalVacationsList'] = this - .getSubordinatesLeavesTotalVacationsList! - .map((v) => v.toJson()) - .toList(); + data['GetSubordinatesLeavesTotalVacationsList'] = this.getSubordinatesLeavesTotalVacationsList!.map((v) => v.toJson()).toList(); } if (this.getSummaryOfPaymentList != null) { - data['GetSummaryOfPaymentList'] = - this.getSummaryOfPaymentList!.map((v) => v.toJson()).toList(); + data['GetSummaryOfPaymentList'] = this.getSummaryOfPaymentList!.map((v) => v.toJson()).toList(); } data['GetSwipesList'] = this.getSwipesList; - data['GetTermColsStructureList'] = this.getTermColsStructureList; - data['GetTermDffStructureList'] = this.getTermDffStructureList; + + if (this.getTermColsStructureList != null) { + data['GetTermColsStructureList'] = this.getTermColsStructureList!.map((v) => v.toJson()).toList(); + } + + if (this.getTermDffStructureList != null) { + data['GetTermDffStructureList'] = this.getTermDffStructureList!.map((v) => v.toJson()).toList(); + } + data['GetTermNotificationBodyList'] = this.getTermNotificationBodyList; if (this.getTimeCardSummaryList != null) { - data['GetTimeCardSummaryList'] = - this.getTimeCardSummaryList!.map((v) => v.toJson()).toList(); + data['GetTimeCardSummaryList'] = this.getTimeCardSummaryList!.map((v) => v.toJson()).toList(); } data['GetUserItemTypesList'] = this.getUserItemTypesList; if (this.getVacationRulesList != null) { - data['GetVacationRulesList'] = - this.getVacationRulesList!.map((v) => v.toJson()).toList(); + data['GetVacationRulesList'] = this.getVacationRulesList!.map((v) => v.toJson()).toList(); } data['GetVaccinationOnHandList'] = this.getVaccinationOnHandList; data['GetVaccinationsList'] = this.getVaccinationsList; if (getValueSetValuesList != null) { - data['GetValueSetValuesList'] = - getValueSetValuesList!.map((v) => v.toJson()).toList(); + data['GetValueSetValuesList'] = getValueSetValuesList!.map((v) => v.toJson()).toList(); } if (getWorkList != null) { data['GetWorkList'] = getWorkList!.map((v) => v.toJson()).toList(); @@ -1849,26 +1682,19 @@ class GenericResponseModel { data['List_RadScreen'] = this.listRadScreen; data['LogInTokenID'] = this.logInTokenID; if (this.memberInformationList != null) { - data['MemberInformationList'] = - this.memberInformationList!.map((v) => v.toJson()).toList(); + data['MemberInformationList'] = this.memberInformationList!.map((v) => v.toJson()).toList(); } data['MemberLoginList'] = this.memberLoginList; - data['Mohemm_GetBusinessCardEnabledList'] = - this.mohemmGetBusinessCardEnabledList; - data['Mohemm_GetFavoriteReplacementsList'] = - this.mohemmGetFavoriteReplacementsList; - data['Mohemm_GetMobileDeviceInfobyEmpInfoList'] = - this.mohemmGetMobileDeviceInfobyEmpInfoList; + data['Mohemm_GetBusinessCardEnabledList'] = this.mohemmGetBusinessCardEnabledList; + data['Mohemm_GetFavoriteReplacementsList'] = this.mohemmGetFavoriteReplacementsList; + data['Mohemm_GetMobileDeviceInfobyEmpInfoList'] = this.mohemmGetMobileDeviceInfobyEmpInfoList; if (this.mohemmGetMobileLoginInfoList != null) { - data['Mohemm_GetMobileLoginInfoList'] = - this.mohemmGetMobileLoginInfoList!.map((v) => v.toJson()).toList(); + data['Mohemm_GetMobileLoginInfoList'] = this.mohemmGetMobileLoginInfoList!.map((v) => v.toJson()).toList(); } data['Mohemm_GetPatientID_List'] = this.mohemmGetPatientIDList; data['Mohemm_ITG_ResponseItem'] = this.mohemmITGResponseItem; - data['Mohemm_IsChangeIsActiveBusinessCardEnable'] = - this.mohemmIsChangeIsActiveBusinessCardEnable; - data['Mohemm_IsInsertBusinessCardEnable'] = - this.mohemmIsInsertBusinessCardEnable; + data['Mohemm_IsChangeIsActiveBusinessCardEnable'] = this.mohemmIsChangeIsActiveBusinessCardEnable; + data['Mohemm_IsInsertBusinessCardEnable'] = this.mohemmIsInsertBusinessCardEnable; data['Mohemm_Wifi_Password'] = this.mohemmWifiPassword; data['Mohemm_Wifi_SSID'] = this.mohemmWifiSSID; @@ -1877,13 +1703,11 @@ class GenericResponseModel { } if (notificationGetRespondAttributesList != null) { - data['NotificationGetRespondAttributesList'] = - notificationGetRespondAttributesList!.map((v) => v.toJson()).toList(); + data['NotificationGetRespondAttributesList'] = notificationGetRespondAttributesList!.map((v) => v.toJson()).toList(); } if (notificationRespondRolesList != null) { - data['NotificationRespondRolesList'] = - notificationRespondRolesList!.map((v) => v).toList(); + data['NotificationRespondRolesList'] = notificationRespondRolesList!.map((v) => v).toList(); } data['OracleOutPutNumber'] = this.oracleOutPutNumber; @@ -1900,55 +1724,47 @@ class GenericResponseModel { data['P_QUESTION'] = this.pQUESTION; data['P_SESSION_ID'] = this.pSESSIONID; data['P_Schema'] = this.pSchema; - data['PharmacyStock_AddPharmacyStockList'] = - this.pharmacyStockAddPharmacyStockList; + data['PharmacyStock_AddPharmacyStockList'] = this.pharmacyStockAddPharmacyStockList; data['PharmacyStock_GetOnHandList'] = this.pharmacyStockGetOnHandList; if (this.privilegeList != null) { - data['Privilege_List'] = - this.privilegeList!.map((v) => v.toJson()).toList(); + data['Privilege_List'] = this.privilegeList!.map((v) => v.toJson()).toList(); } data['ProcessTransactions'] = this.processTransactions; data['RegisterUserNameList'] = this.registerUserNameList; data['ReplacementList'] = this.replacementList; if (respondAttributesList != null) { - data['RespondAttributesList'] = - respondAttributesList!.map((v) => v.toJson()).toList(); + data['RespondAttributesList'] = respondAttributesList!.map((v) => v.toJson()).toList(); } data['RespondRolesList'] = this.respondRolesList; - data['ResubmitAbsenceTransactionList'] = - this.resubmitAbsenceTransactionList; + data['ResubmitAbsenceTransactionList'] = this.resubmitAbsenceTransactionList; data['ResubmitEITTransactionList'] = this.resubmitEITTransactionList; data['ResubmitHrTransactionList'] = this.resubmitHrTransactionList; data['SFH_GetPoNotificationBodyList'] = this.sFHGetPoNotificationBodyList; data['SFH_GetPrNotificationBodyList'] = this.sFHGetPrNotificationBodyList; if (this.startAbsenceApprovalProccess != null) { - data['StartAbsenceApprovalProccess'] = - this.startAbsenceApprovalProccess!.toJson(); + data['StartAbsenceApprovalProccess'] = this.startAbsenceApprovalProccess!.toJson(); } - data['StartAddressApprovalProcessList'] = - this.startAddressApprovalProcessList; + data['StartAddressApprovalProcessList'] = this.startAddressApprovalProcessList; data['StartBasicDetApprProcessList'] = this.startBasicDetApprProcessList; data['StartCeiApprovalProcess'] = this.startCeiApprovalProcess; - data['StartContactApprovalProcessList'] = - this.startContactApprovalProcessList; + data['StartContactApprovalProcessList'] = this.startContactApprovalProcessList; if (this.startEitApprovalProcess != null) { data['StartEitApprovalProcess'] = this.startEitApprovalProcess!.toJson(); } data['StartHrApprovalProcessList'] = this.startHrApprovalProcessList; - data['StartPhonesApprovalProcessList'] = - this.startPhonesApprovalProcessList; + data['StartPhonesApprovalProcessList'] = this.startPhonesApprovalProcessList; data['StartSitApprovalProcess'] = this.startSitApprovalProcess; - data['StartTermApprovalProcessList'] = this.startTermApprovalProcessList; + if (this.startTermApprovalProcessList != null) { + data['StartTermApprovalProcessList'] = this.startTermApprovalProcessList!.toJson(); + } if (this.submitAddressTransactionList != null) { - data['SubmitAddressTransactionList'] = - this.submitAddressTransactionList!.toJson(); + data['SubmitAddressTransactionList'] = this.submitAddressTransactionList!.toJson(); } if (this.submitBasicDetTransactionList != null) { - data['SubmitBasicDetTransactionList'] = - this.submitBasicDetTransactionList!.toJson(); + data['SubmitBasicDetTransactionList'] = this.submitBasicDetTransactionList!.toJson(); } data['SubmitCEITransactionList'] = this.submitCEITransactionList; @@ -1956,31 +1772,32 @@ class GenericResponseModel { data['SubmitContactTransactionList'] = this.submitContactTransactionList; if (this.submitEITTransactionList != null) { - data['SubmitEITTransactionList'] = - this.submitEITTransactionList!.toJson(); + data['SubmitEITTransactionList'] = this.submitEITTransactionList!.toJson(); } data['SubmitHrTransactionList'] = this.submitHrTransactionList; data['SubmitPhonesTransactionList'] = this.submitPhonesTransactionList; data['SubmitSITTransactionList'] = this.submitSITTransactionList; data['SubmitTermTransactionList'] = this.submitTermTransactionList; + + if (this.submitTermTransactionList != null) { + data['SubmitTermTransactionList'] = this.submitTermTransactionList!.toJson(); + } + data['SubordinatesOnLeavesList'] = this.subordinatesOnLeavesList; if (this.subordinatesOnLeavesList != null) { - data['SubordinatesOnLeavesList'] = - this.subordinatesOnLeavesList!.map((v) => v.toJson()).toList(); + data['SubordinatesOnLeavesList'] = this.subordinatesOnLeavesList!.map((v) => v.toJson()).toList(); } if (this.sumbitAbsenceTransactionList != null) { - data['SumbitAbsenceTransactionList'] = - this.sumbitAbsenceTransactionList!.toJson(); + data['SumbitAbsenceTransactionList'] = this.sumbitAbsenceTransactionList!.toJson(); } data['TokenID'] = this.tokenID; data['UpdateAttachmentList'] = this.updateAttachmentList; data['UpdateEmployeeImageList'] = this.updateEmployeeImageList; if (this.updateItemTypeSuccessList != null) { - data['UpdateItemTypeSuccessList'] = - this.updateItemTypeSuccessList!.map((v) => v.toJson()).toList(); + data['UpdateItemTypeSuccessList'] = this.updateItemTypeSuccessList!.map((v) => v.toJson()).toList(); } if (this.updateUserItemTypesList != null) { data['UpdateUserItemTypesList'] = this.updateUserItemTypesList!.toJson(); @@ -1993,22 +1810,19 @@ class GenericResponseModel { data['VHR_IsVerificationCodeValid'] = this.vHRIsVerificationCodeValid; if (validateAbsenceTransactionList != null) { - data['ValidateAbsenceTransactionList'] = - validateAbsenceTransactionList!.toJson(); + data['ValidateAbsenceTransactionList'] = validateAbsenceTransactionList!.toJson(); } if (validateEITTransactionList != null) { data['ValidateEITTransactionList'] = validateEITTransactionList!.toJson(); } data['ValidatePhonesTransactionList'] = this.validatePhonesTransactionList; if (vrItemTypesList != null) { - data['VrItemTypesList'] = - vrItemTypesList!.map((v) => v.toJson()).toList(); + data['VrItemTypesList'] = vrItemTypesList!.map((v) => v.toJson()).toList(); } if (wFLookUpList != null) { data['WFLookUpList'] = wFLookUpList!.map((v) => v.toJson()).toList(); } - data['eLearning_GET_EMPLOYEE_PROFILEList'] = - this.eLearningGETEMPLOYEEPROFILEList; + data['eLearning_GET_EMPLOYEE_PROFILEList'] = this.eLearningGETEMPLOYEEPROFILEList; data['eLearning_LOGINList'] = this.eLearningLOGINList; data['eLearning_ValidateLoginList'] = this.eLearningValidateLoginList; data['eLearning_Validate_LoginList'] = this.eLearningValidateLoginList; diff --git a/lib/models/submit_term_transaction_list_model.dart b/lib/models/submit_term_transaction_list_model.dart new file mode 100644 index 0000000..84c310a --- /dev/null +++ b/lib/models/submit_term_transaction_list_model.dart @@ -0,0 +1,24 @@ +class SubmitTermTransactionList { + String? pITEMKEY; + String? pRETURNMSG; + String? pRETURNSTATUS; + int? pTRANSACTIONID; + + SubmitTermTransactionList({this.pITEMKEY, this.pRETURNMSG, this.pRETURNSTATUS, this.pTRANSACTIONID}); + + SubmitTermTransactionList.fromJson(Map json) { + pITEMKEY = json['P_ITEM_KEY']; + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + pTRANSACTIONID = json['P_TRANSACTION_ID']; + } + + Map toJson() { + Map data = new Map(); + data['P_ITEM_KEY'] = this.pITEMKEY; + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + data['P_TRANSACTION_ID'] = this.pTRANSACTIONID; + return data; + } +} diff --git a/lib/models/termination/get_term_cols_structure_list_model.dart b/lib/models/termination/get_term_cols_structure_list_model.dart new file mode 100644 index 0000000..68fd349 --- /dev/null +++ b/lib/models/termination/get_term_cols_structure_list_model.dart @@ -0,0 +1,85 @@ +class GetTermColsStructureList { + String? aPPLICATIONCOLUMNNAME; + String? dATATYPE; + String? dISPLAYFLAG; + int? mAXIMUMSIZE; + String? oBJECTNAME; + String? oBJECTTYPE; + List? objectValuesList; + String? rEQUIREDFLAG; + String? sEGMENTPROMPT; + int? sEGMENTSEQNUM; + String? selectedValue; + ObjectValuesList? selectedObjectValue; + + GetTermColsStructureList( + {this.aPPLICATIONCOLUMNNAME, + this.dATATYPE, + this.dISPLAYFLAG, + this.mAXIMUMSIZE, + this.oBJECTNAME, + this.oBJECTTYPE, + this.objectValuesList, + this.rEQUIREDFLAG, + this.sEGMENTPROMPT, + this.selectedValue, + this.selectedObjectValue, + this.sEGMENTSEQNUM}); + + GetTermColsStructureList.fromJson(Map json) { + aPPLICATIONCOLUMNNAME = json['APPLICATION_COLUMN_NAME']; + dATATYPE = json['DATATYPE']; + dISPLAYFLAG = json['DISPLAY_FLAG']; + mAXIMUMSIZE = json['MAXIMUM_SIZE']; + oBJECTNAME = json['OBJECT_NAME']; + oBJECTTYPE = json['OBJECT_TYPE']; + objectValuesList = []; + if (json['ObjectValuesList'] != null) { + json['ObjectValuesList'].forEach((v) { + objectValuesList!.add(new ObjectValuesList.fromJson(v)); + }); + } + rEQUIREDFLAG = json['REQUIRED_FLAG']; + sEGMENTPROMPT = json['SEGMENT_PROMPT']; + sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM']; + } + + Map toJson() { + Map data = new Map(); + data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; + data['DATATYPE'] = this.dATATYPE; + data['DISPLAY_FLAG'] = this.dISPLAYFLAG; + data['MAXIMUM_SIZE'] = this.mAXIMUMSIZE; + data['OBJECT_NAME'] = this.oBJECTNAME; + data['OBJECT_TYPE'] = this.oBJECTTYPE; + if (this.objectValuesList != null) { + data['ObjectValuesList'] = this.objectValuesList!.map((v) => v.toJson()).toList(); + } + data['REQUIRED_FLAG'] = this.rEQUIREDFLAG; + data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT; + data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM; + return data; + } +} + +class ObjectValuesList { + String? cODE; + String? dESCRIPTION; + String? mEANING; + + ObjectValuesList({this.cODE, this.dESCRIPTION, this.mEANING}); + + ObjectValuesList.fromJson(Map json) { + cODE = json['CODE']; + dESCRIPTION = json['DESCRIPTION']; + mEANING = json['MEANING']; + } + + Map toJson() { + Map data = new Map(); + data['CODE'] = this.cODE; + data['DESCRIPTION'] = this.dESCRIPTION; + data['MEANING'] = this.mEANING; + return data; + } +} diff --git a/lib/models/termination/get_term_dff_structure_list_model.dart b/lib/models/termination/get_term_dff_structure_list_model.dart new file mode 100644 index 0000000..3217acf --- /dev/null +++ b/lib/models/termination/get_term_dff_structure_list_model.dart @@ -0,0 +1,280 @@ +import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; + +class GetTermDffStructureList { + String? aLPHANUMERICALLOWEDFLAG; + String? aPPLICATIONCOLUMNNAME; + String? cHILDSEGMENTSVS; + List? cHILDSEGMENTSVSSplited; + String? dEFAULTTYPE; + String? dEFAULTVALUE; + String? dESCFLEXCONTEXTCODE; + String? dESCFLEXCONTEXTNAME; + String? dESCFLEXNAME; + String? dISPLAYFLAG; + String? eNABLEDFLAG; + ESERVICESDV? eSERVICESDV; + List? eSERVICESVS; + String? fLEXVALUESETNAME; + String? fORMATTYPE; + String? fORMATTYPEDSP; + String? lONGLISTFLAG; + int? mAXIMUMSIZE; + String? mAXIMUMVALUE; + String? mINIMUMVALUE; + String? mOBILEENABLED; + String? nUMBERPRECISION; + String? nUMERICMODEENABLEDFLAG; + String? pARENTSEGMENTSDV; + List? pARENTSEGMENTSDVSplited; + String? pARENTSEGMENTSVS; + List? pARENTSEGMENTSVSSplitedVS; + String? rEADONLY; + String? rEQUIREDFLAG; + String? sEGMENTNAME; + String? sEGMENTPROMPT; + int? sEGMENTSEQNUM; + String? uPPERCASEONLYFLAG; + String? uSEDFLAG; + String? vALIDATIONTYPE; + String? vALIDATIONTYPEDSP; + + GetTermDffStructureList( + {this.aLPHANUMERICALLOWEDFLAG, + this.aPPLICATIONCOLUMNNAME, + this.cHILDSEGMENTSVS, + this.cHILDSEGMENTSVSSplited, + this.dEFAULTTYPE, + this.dEFAULTVALUE, + this.dESCFLEXCONTEXTCODE, + this.dESCFLEXCONTEXTNAME, + this.dESCFLEXNAME, + this.dISPLAYFLAG, + this.eNABLEDFLAG, + this.eSERVICESDV, + this.eSERVICESVS, + this.fLEXVALUESETNAME, + this.fORMATTYPE, + this.fORMATTYPEDSP, + this.lONGLISTFLAG, + this.mAXIMUMSIZE, + this.mAXIMUMVALUE, + this.mINIMUMVALUE, + this.mOBILEENABLED, + this.nUMBERPRECISION, + this.nUMERICMODEENABLEDFLAG, + this.pARENTSEGMENTSDV, + this.pARENTSEGMENTSDVSplited, + this.pARENTSEGMENTSVS, + this.pARENTSEGMENTSVSSplitedVS, + this.rEADONLY, + this.rEQUIREDFLAG, + this.sEGMENTNAME, + this.sEGMENTPROMPT, + this.sEGMENTSEQNUM, + this.uPPERCASEONLYFLAG, + this.uSEDFLAG, + this.vALIDATIONTYPE, + this.vALIDATIONTYPEDSP}); + + GetTermDffStructureList.fromJson(Map json) { + aLPHANUMERICALLOWEDFLAG = json['ALPHANUMERIC_ALLOWED_FLAG']; + aPPLICATIONCOLUMNNAME = json['APPLICATION_COLUMN_NAME']; + cHILDSEGMENTSVS = json['CHILD_SEGMENTS_VS']; + cHILDSEGMENTSVSSplited = json['CHILD_SEGMENTS_VS_Splited'] == null ? [] : json['CHILD_SEGMENTS_VS_Splited'].cast(); + dEFAULTTYPE = json['DEFAULT_TYPE']; + dEFAULTVALUE = json['DEFAULT_VALUE']; + dESCFLEXCONTEXTCODE = json['DESC_FLEX_CONTEXT_CODE']; + dESCFLEXCONTEXTNAME = json['DESC_FLEX_CONTEXT_NAME']; + dESCFLEXNAME = json['DESC_FLEX_NAME']; + dISPLAYFLAG = json['DISPLAY_FLAG']; + eNABLEDFLAG = json['ENABLED_FLAG']; + eSERVICESDV = json['E_SERVICES_DV'] != null ? new ESERVICESDV.fromJson(json['E_SERVICES_DV']) : null; + if (json['E_SERVICES_VS'] != null) { + eSERVICESVS = []; + json['E_SERVICES_VS'].forEach((v) { + eSERVICESVS!.add(ESERVICESVS.fromJson(v)); + }); + } + fLEXVALUESETNAME = json['FLEX_VALUE_SET_NAME']; + fORMATTYPE = json['FORMAT_TYPE']; + fORMATTYPEDSP = json['FORMAT_TYPE_DSP']; + lONGLISTFLAG = json['LONGLIST_FLAG']; + mAXIMUMSIZE = json['MAXIMUM_SIZE']; + mAXIMUMVALUE = json['MAXIMUM_VALUE']; + mINIMUMVALUE = json['MINIMUM_VALUE']; + mOBILEENABLED = json['MOBILE_ENABLED']; + nUMBERPRECISION = json['NUMBER_PRECISION']; + nUMERICMODEENABLEDFLAG = json['NUMERIC_MODE_ENABLED_FLAG']; + pARENTSEGMENTSDV = json['PARENT_SEGMENTS_DV']; + if (json['PARENT_SEGMENTS_DV_Splited'] != null) { + pARENTSEGMENTSDVSplited = []; + json['PARENT_SEGMENTS_DV_Splited'].forEach((v) { + pARENTSEGMENTSDVSplited!.add(PARENTSEGMENTSDVSplited.fromJson(v)); + }); + } + pARENTSEGMENTSVS = json['PARENT_SEGMENTS_VS']; + if (json['PARENT_SEGMENTS_VS_SplitedVS'] != null) { + pARENTSEGMENTSVSSplitedVS = []; + json['PARENT_SEGMENTS_VS_SplitedVS'].forEach((v) { + pARENTSEGMENTSVSSplitedVS!.add(PARENTSEGMENTSVSSplitedVS.fromJson(v)); + }); + } + rEADONLY = json['READ_ONLY']; + rEQUIREDFLAG = json['REQUIRED_FLAG']; + sEGMENTNAME = json['SEGMENT_NAME']; + sEGMENTPROMPT = json['SEGMENT_PROMPT']; + sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM']; + uPPERCASEONLYFLAG = json['UPPERCASE_ONLY_FLAG']; + uSEDFLAG = json['USED_FLAG']; + vALIDATIONTYPE = json['VALIDATION_TYPE']; + vALIDATIONTYPEDSP = json['VALIDATION_TYPE_DSP']; + } + + Map toJson() { + Map data = new Map(); + data['ALPHANUMERIC_ALLOWED_FLAG'] = this.aLPHANUMERICALLOWEDFLAG; + data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; + data['CHILD_SEGMENTS_VS'] = this.cHILDSEGMENTSVS; + data['CHILD_SEGMENTS_VS_Splited'] = this.cHILDSEGMENTSVSSplited; + data['DEFAULT_TYPE'] = this.dEFAULTTYPE; + data['DEFAULT_VALUE'] = this.dEFAULTVALUE; + data['DESC_FLEX_CONTEXT_CODE'] = this.dESCFLEXCONTEXTCODE; + data['DESC_FLEX_CONTEXT_NAME'] = this.dESCFLEXCONTEXTNAME; + data['DESC_FLEX_NAME'] = this.dESCFLEXNAME; + data['DISPLAY_FLAG'] = this.dISPLAYFLAG; + data['ENABLED_FLAG'] = this.eNABLEDFLAG; + if (this.eSERVICESDV != null) { + data['E_SERVICES_DV'] = this.eSERVICESDV!.toJson(); + } + if (this.eSERVICESVS != null) { + data['E_SERVICES_VS'] = this.eSERVICESVS!.map((v) => v.toJson()).toList(); + } + data['FLEX_VALUE_SET_NAME'] = this.fLEXVALUESETNAME; + data['FORMAT_TYPE'] = this.fORMATTYPE; + data['FORMAT_TYPE_DSP'] = this.fORMATTYPEDSP; + data['LONGLIST_FLAG'] = this.lONGLISTFLAG; + data['MAXIMUM_SIZE'] = this.mAXIMUMSIZE; + data['MAXIMUM_VALUE'] = this.mAXIMUMVALUE; + data['MINIMUM_VALUE'] = this.mINIMUMVALUE; + data['MOBILE_ENABLED'] = this.mOBILEENABLED; + data['NUMBER_PRECISION'] = this.nUMBERPRECISION; + data['NUMERIC_MODE_ENABLED_FLAG'] = this.nUMERICMODEENABLEDFLAG; + data['PARENT_SEGMENTS_DV'] = this.pARENTSEGMENTSDV; + if (this.pARENTSEGMENTSDVSplited != null) { + data['PARENT_SEGMENTS_DV_Splited'] = this.pARENTSEGMENTSDVSplited!.map((v) => v.toJson()).toList(); + } + data['PARENT_SEGMENTS_VS'] = this.pARENTSEGMENTSVS; + if (this.pARENTSEGMENTSVSSplitedVS != null) { + data['PARENT_SEGMENTS_VS_SplitedVS'] = this.pARENTSEGMENTSVSSplitedVS!.map((v) => v.toJson()).toList(); + } + data['READ_ONLY'] = this.rEADONLY; + data['REQUIRED_FLAG'] = this.rEQUIREDFLAG; + data['SEGMENT_NAME'] = this.sEGMENTNAME; + data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT; + data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM; + data['UPPERCASE_ONLY_FLAG'] = this.uPPERCASEONLYFLAG; + data['USED_FLAG'] = this.uSEDFLAG; + data['VALIDATION_TYPE'] = this.vALIDATIONTYPE; + data['VALIDATION_TYPE_DSP'] = this.vALIDATIONTYPEDSP; + return data; + } + + bool get isDefaultTypeIsCDPS => (dEFAULTTYPE == "C" || dEFAULTTYPE == "D" || dEFAULTTYPE == "P" || dEFAULTTYPE == "S"); +} + +class ESERVICESDV { + String? pIDCOLUMNNAME; + String? pRETURNMSG; + String? pRETURNSTATUS; + String? pVALUECOLUMNNAME; + + ESERVICESDV({this.pIDCOLUMNNAME, this.pRETURNMSG, this.pRETURNSTATUS, this.pVALUECOLUMNNAME}); + + ESERVICESDV.fromJson(Map json) { + pIDCOLUMNNAME = json['P_ID_COLUMN_NAME']; + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + pVALUECOLUMNNAME = json['P_VALUE_COLUMN_NAME']; + } + + Map toJson() { + Map data = new Map(); + data['P_ID_COLUMN_NAME'] = this.pIDCOLUMNNAME; + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + data['P_VALUE_COLUMN_NAME'] = this.pVALUECOLUMNNAME; + return data; + } +} + +// class ESERVICESVS { +// String? dESCRIPTION; +// int? fROMROWNUM; +// String? iDCOLUMNNAME; +// int? nOOFROWS; +// int? rOWNUM; +// int? tOROWNUM; +// String? vALUECOLUMNNAME; +// +// ESERVICESVS({this.dESCRIPTION, this.fROMROWNUM, this.iDCOLUMNNAME, this.nOOFROWS, this.rOWNUM, this.tOROWNUM, this.vALUECOLUMNNAME}); +// +// ESERVICESVS.fromJson(Map json) { +// dESCRIPTION = json['DESCRIPTION']; +// fROMROWNUM = json['FROM_ROW_NUM']; +// iDCOLUMNNAME = json['ID_COLUMN_NAME']; +// nOOFROWS = json['NO_OF_ROWS']; +// rOWNUM = json['ROW_NUM']; +// tOROWNUM = json['TO_ROW_NUM']; +// vALUECOLUMNNAME = json['VALUE_COLUMN_NAME']; +// } +// +// Map toJson() { +// Map data = new Map(); +// data['DESCRIPTION'] = this.dESCRIPTION; +// data['FROM_ROW_NUM'] = this.fROMROWNUM; +// data['ID_COLUMN_NAME'] = this.iDCOLUMNNAME; +// data['NO_OF_ROWS'] = this.nOOFROWS; +// data['ROW_NUM'] = this.rOWNUM; +// data['TO_ROW_NUM'] = this.tOROWNUM; +// data['VALUE_COLUMN_NAME'] = this.vALUECOLUMNNAME; +// return data; +// } +// } + +class PARENTSEGMENTSDVSplited { + String? isRequired; + String? name; + + PARENTSEGMENTSDVSplited({this.isRequired, this.name}); + + PARENTSEGMENTSDVSplited.fromJson(Map json) { + isRequired = json['IsRequired']; + name = json['Name']; + } + + Map toJson() { + Map data = new Map(); + data['IsRequired'] = this.isRequired; + data['Name'] = this.name; + return data; + } +} + +class PARENTSEGMENTSVSSplitedVS { + String? isRequired; + String? name; + + PARENTSEGMENTSVSSplitedVS({this.isRequired, this.name}); + + PARENTSEGMENTSVSSplitedVS.fromJson(Map json) { + isRequired = json['IsRequired']; + name = json['Name']; + } + + Map toJson() { + Map data = new Map(); + data['IsRequired'] = this.isRequired; + data['Name'] = this.name; + return data; + } +} diff --git a/lib/start_term_approval_process_list_model.dart b/lib/start_term_approval_process_list_model.dart new file mode 100644 index 0000000..060a875 --- /dev/null +++ b/lib/start_term_approval_process_list_model.dart @@ -0,0 +1,18 @@ +class StartTermApprovalProcessList { + String? pRETURNMSG; + String? pRETURNSTATUS; + + StartTermApprovalProcessList({this.pRETURNMSG, this.pRETURNSTATUS}); + + StartTermApprovalProcessList.fromJson(Map json) { + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} diff --git a/lib/ui/misc/request_submit_screen.dart b/lib/ui/misc/request_submit_screen.dart index 4d3d341..8ca9a0c 100644 --- a/lib/ui/misc/request_submit_screen.dart +++ b/lib/ui/misc/request_submit_screen.dart @@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/leave_balance_api_client.dart'; import 'package:mohem_flutter_app/api/my_attendance_api_client.dart'; import 'package:mohem_flutter_app/api/profile_api_client.dart'; +import 'package:mohem_flutter_app/api/termination_dff_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; @@ -67,7 +68,7 @@ class _RequestSubmitScreenState extends State { } void submitRequest() async { - // try { + try { Utils.showLoading(context); List> list = []; if (attachmentFiles.isNotEmpty) { @@ -128,16 +129,23 @@ class _RequestSubmitScreenState extends State { params!.pItemId, params!.transactionId, ); + }else if (params!.approvalFlag == 'endEmployment') { + await TerminationDffApiClient().startTermApprovalProcess( + LocaleKeys.submit.tr(), + comments.text, + params!.pItemId, + params!.transactionId, + ); } else {} Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourRequestHasBeenSubmittedForApprovals.tr(), longDuration: true); Navigator.of(context).popUntil((route) => route.settings.name == AppRoutes.dashboard); Navigator.pushNamed(context, AppRoutes.workList); - // } catch (ex) { - // Utils.hideLoading(context); - // Utils.handleException(ex, context, null); - // } + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } } @override diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart index 17c5f7d..0a6c9d4 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/leave_balance_api_client.dart'; import 'package:mohem_flutter_app/api/my_attendance_api_client.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; @@ -92,7 +93,11 @@ class _DynamicInputScreenState extends State { genericResponseModel = await MyAttendanceApiClient().validateEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values); SubmitEITTransactionList submitEITTransactionList = await MyAttendanceApiClient().submitEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values); Utils.hideLoading(context); - Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams("title", submitEITTransactionList.pTRANSACTIONID!, submitEITTransactionList.pITEMKEY!, 'eit')); + await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, + arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submitEITTransactionList.pTRANSACTIONID!, submitEITTransactionList.pITEMKEY!, 'eit')); + Utils.showLoading(context); + await LeaveBalanceApiClient().cancelHrTransaction(submitEITTransactionList.pTRANSACTIONID!); + Utils.hideLoading(context); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); @@ -104,26 +109,26 @@ class _DynamicInputScreenState extends State { Future calGetValueSetValues(GetEITDFFStructureList structureList) async { try { - Utils.showLoading(context); - String segmentId = structureList.cHILDSEGMENTSVS!; - if (dESCFLEXCONTEXTCODE.isEmpty) dESCFLEXCONTEXTCODE = structureList.dESCFLEXCONTEXTCODE!; - - List filteredList = getEitDffStructureList?.where((element) => element.cHILDSEGMENTSVS == segmentId).toList() ?? []; - List> values = filteredList - .map((e) => GetSetValuesRequestModel( - sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME) - .toJson()) - .toList(); - List eServicesResponseModel = await MyAttendanceApiClient().getValueSetValues(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); - List abc = genericResponseModel?.getEITDFFStructureList ?? []; - getEitDffStructureList = abc; - int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == structureList.cHILDSEGMENTSVS); - getEitDffStructureList![index].eSERVICESVS!.clear(); - if (eServicesResponseModel.isNotEmpty) getEitDffStructureList![index].eSERVICESVS!.addAll(eServicesResponseModel); - // getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; - //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); - Utils.hideLoading(context); - setState(() {}); + Utils.showLoading(context); + String segmentId = structureList.cHILDSEGMENTSVS!; + if (dESCFLEXCONTEXTCODE.isEmpty) dESCFLEXCONTEXTCODE = structureList.dESCFLEXCONTEXTCODE!; + + List filteredList = getEitDffStructureList?.where((element) => element.cHILDSEGMENTSVSSplited!.contains(segmentId)).toList() ?? []; + List> values = filteredList + .map((e) => GetSetValuesRequestModel( + sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME) + .toJson()) + .toList(); + List eServicesResponseModel = await MyAttendanceApiClient().getValueSetValues(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); + List abc = genericResponseModel?.getEITDFFStructureList ?? []; + getEitDffStructureList = abc; + int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == structureList.cHILDSEGMENTSVS); + getEitDffStructureList![index].eSERVICESVS!.clear(); + if (eServicesResponseModel.isNotEmpty) getEitDffStructureList![index].eSERVICESVS!.addAll(eServicesResponseModel); + // getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; + //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); + Utils.hideLoading(context); + setState(() {}); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/my_attendance/services_menu_list_screen.dart b/lib/ui/my_attendance/services_menu_list_screen.dart index fe82058..4e0c584 100644 --- a/lib/ui/my_attendance/services_menu_list_screen.dart +++ b/lib/ui/my_attendance/services_menu_list_screen.dart @@ -56,7 +56,14 @@ class ServicesMenuListScreen extends StatelessWidget { Navigator.pushNamed(context, AppRoutes.leaveBalance); return; } - Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!)); + if (servicesMenuData.list[index].requestType == "EIT") { + Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!)); + } else { + if (servicesMenuData.list[index].requestType == "TERMINATION") { + Navigator.pushNamed(context, AppRoutes.endEmploymentScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!)); + + } + } }), separatorBuilder: (cxt, index) => 12.height, itemCount: servicesMenuData.list.length), diff --git a/lib/ui/termination/end_employement.dart b/lib/ui/termination/end_employement.dart new file mode 100644 index 0000000..6fbfa61 --- /dev/null +++ b/lib/ui/termination/end_employement.dart @@ -0,0 +1,625 @@ +import 'dart:io'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/leave_balance_api_client.dart'; +import 'package:mohem_flutter_app/api/my_attendance_api_client.dart'; +import 'package:mohem_flutter_app/api/termination_dff_api_client.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/dyanmic_forms/get_set_values_request_model.dart'; +import 'package:mohem_flutter_app/models/dyanmic_forms/validate_eit_transaction_model.dart'; +import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart' as dff; +import 'package:mohem_flutter_app/models/submit_term_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/termination/get_term_cols_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/termination/get_term_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; +import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; + +class EndEmploymentScreen extends StatefulWidget { + EndEmploymentScreen({Key? key}) : super(key: key); + + @override + _EndEmploymentScreenState createState() { + return _EndEmploymentScreenState(); + } +} + +class _EndEmploymentScreenState extends State { + List? termColsList; + List? termDffList; + DynamicListViewParams? dynamicParams; + + @override + void initState() { + super.initState(); + } + + void getTerminationDffStructure() async { + try { + Utils.showLoading(context); + List results = await Future.wait([ + TerminationDffApiClient().getTermColsStructure(), + TerminationDffApiClient().getTermDffStructure(dynamicParams!.dynamicId, null), + ]); + termColsList = results[0]; + termDffList = results[1]; + termColsList = termColsList?.where((element) => element.dISPLAYFLAG == 'Y').toList() ?? []; + termDffList = termDffList?.where((element) => element.dISPLAYFLAG == 'Y').toList() ?? []; + + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void validateTransaction() { + String errorMessage = ""; + for (var element in termColsList!) { + if (element.rEQUIREDFLAG == "Y") { + if (element.objectValuesList!.isEmpty) { + if ((element.selectedValue ?? "").isEmpty) { + errorMessage = element.sEGMENTPROMPT!; + break; + } + } else { + if (element.selectedObjectValue == null) { + errorMessage = element.sEGMENTPROMPT!; + break; + } + } + } + } + if (errorMessage.isEmpty) { + for (var element in termDffList!) { + if (element.rEQUIREDFLAG == "Y") { + if (element.eSERVICESDV?.pVALUECOLUMNNAME == null) { + errorMessage = element.sEGMENTPROMPT!; + break; + } + } + } + } + if (errorMessage.isNotEmpty) { + Utils.showToast(LocaleKeys.fieldIsEmpty.tr(namedArgs: {'data': errorMessage})); + } else { + submitTransaction(); + } + } + + void submitTransaction() async { + try { + Utils.showLoading(context); + List> values = termDffList!.map((e) { + String tempVar = e.eSERVICESDV?.pIDCOLUMNNAME ?? ""; + if (e.fORMATTYPE == "X") { + // for date format type, date format is changed + tempVar = e.eSERVICESDV?.pIDCOLUMNNAME ?? ""; + if (tempVar.isNotEmpty) { + if (!tempVar.contains("/")) { + DateTime date = DateFormat('yyyy-MM-dd').parse(tempVar); + tempVar = DateFormat('yyyy/MM/dd HH:mm:ss').format(date); + } + } + } + return ValidateEitTransactionModel(dATEVALUE: null, nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: null, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: tempVar.toString()).toJson(); + }).toList(); + termColsList!.forEach((element) { + String? value = ""; + ValidateEitTransactionModel model = ValidateEitTransactionModel(nAME: element.aPPLICATIONCOLUMNNAME, nUMBERVALUE: null, tRANSACTIONNUMBER: 1); + if (element.dATATYPE == "DATE") { + value = element.selectedValue == null ? null : Utils.formatDate(DateTime.parse(element.selectedValue!).toString()); + model.dATEVALUE = value; + } else if (element.dATATYPE == "VARCHAR2") { + if (element.objectValuesList!.isEmpty) { + value = element.selectedValue; + } else { + value = element.selectedObjectValue?.cODE; + } + model.vARCHAR2VALUE = value; + } + + values.add(model.toJson()); + }); + + SubmitTermTransactionList submitTermTransaction = await TerminationDffApiClient().submitTermTransaction(dynamicParams!.dynamicId, values); + Utils.hideLoading(context); + await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, + arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submitTermTransaction.pTRANSACTIONID!, submitTermTransaction.pITEMKEY!, "endEmployment")); + Utils.showLoading(context); + await LeaveBalanceApiClient().cancelHrTransaction(submitTermTransaction.pTRANSACTIONID!); + Utils.hideLoading(context); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + void dispose() { + super.dispose(); + } + + String dESCFLEXCONTEXTCODE = ""; + String descFlexConTextTitle = ""; + + Future calGetValueSetValues(GetTermDffStructureList structureList) async { + try { + Utils.showLoading(context); + String segmentId = structureList.cHILDSEGMENTSVS!; + if (dESCFLEXCONTEXTCODE.isEmpty) dESCFLEXCONTEXTCODE = structureList.dESCFLEXCONTEXTCODE!; + + List filteredList = termDffList?.where((element) => element.cHILDSEGMENTSVS == segmentId).toList() ?? []; + List> values = filteredList + .map((e) => GetSetValuesRequestModel( + sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME) + .toJson()) + .toList(); + + List eServicesResponseModel = await MyAttendanceApiClient().getValueSetValues(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); + List abc = termDffList ?? []; + termDffList = abc; + int index = termDffList!.indexWhere((element) => element.sEGMENTNAME == structureList.cHILDSEGMENTSVS); + termDffList![index].eSERVICESVS!.clear(); + if (eServicesResponseModel.isNotEmpty) termDffList![index].eSERVICESVS!.addAll(eServicesResponseModel); + // getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; + //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + Widget build(BuildContext context) { + if (dynamicParams == null) { + dynamicParams = ModalRoute.of(context)!.settings.arguments as DynamicListViewParams; + getTerminationDffStructure(); + } + + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget(context, title: dynamicParams!.title), + body: Column( + children: [ + (termColsList == null && termDffList == null + ? const SizedBox() + : (((termColsList?.length ?? 0) + (termDffList?.length ?? 0)) < 1 + ? Utils.getNoDataWidget(context) + : ListView( + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.all(21), + children: [ + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, int index) => termColWidget(termColsList![index]), + separatorBuilder: (cxt, index) => 12.height, + itemCount: termColsList!.length, + ), + 12.height, + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, int index) => dffColWidget(termDffList![index], index), + separatorBuilder: (cxt, index) => 12.height, + itemCount: termDffList!.length, + ), + ], + ))) + .expanded, + DefaultButton( + LocaleKeys.next.tr(), + (((termColsList?.length ?? 0) + (termDffList?.length ?? 0)) < 1) + ? null + : () { + validateTransaction(); + }, + ).insideContainer, + ], + ), + ); + } + + Widget termColWidget(GetTermColsStructureList termColObject) { + if (termColObject.dATATYPE == "VARCHAR2") { + if (termColObject.objectValuesList!.isEmpty) { + return DynamicTextFieldWidget( + (termColObject.sEGMENTPROMPT ?? "") + (termColObject.rEQUIREDFLAG == "Y" ? "*" : ""), + termColObject.selectedValue ?? "", + onChange: (text) { + termColObject.selectedValue = text; + }, + ); + } + return PopupMenuButton( + child: DynamicTextFieldWidget( + (termColObject.sEGMENTPROMPT ?? "") + (termColObject.rEQUIREDFLAG == "Y" ? "*" : ""), + termColObject.selectedObjectValue?.mEANING ?? LocaleKeys.pleaseSelect.tr(), + isEnable: false, + isPopup: true, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < termColObject.objectValuesList!.length; i++) PopupMenuItem(value: i, child: Text(termColObject.objectValuesList![i].mEANING ?? "")), + ], + onSelected: (int popipIndex) async { + termColObject.selectedObjectValue = termColObject.objectValuesList![popipIndex]; + print(termColObject.selectedObjectValue?.toJson()); + setState(() {}); + }); + } + if (termColObject.dATATYPE == "DATE") { + return DynamicTextFieldWidget( + (termColObject.sEGMENTPROMPT ?? "") + (termColObject.rEQUIREDFLAG == "Y" ? "*" : ""), + (termColObject.selectedValue != null) ? Utils.getMonthNamedFormat(DateTime.parse(termColObject.selectedValue!)) : LocaleKeys.pleaseSelectDate.tr(), + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + DateTime? selectedDate; + if (termColObject.selectedValue == null) { + selectedDate = DateTime.now(); + } else { + selectedDate = DateTime.parse(termColObject.selectedValue!); + } + DateTime date = await Utils.selectDate(context, selectedDate); + termColObject.selectedValue = date.toString(); + setState(() {}); + }, + ); + } + return const SizedBox(); + } + + Widget dffColWidget(GetTermDffStructureList model, int index) { + if (model.dISPLAYFLAG != "N") { + if (model.vALIDATIONTYPE == "N") { + if (model.fORMATTYPE == "C") { + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + isReadOnly: model.rEADONLY == "Y", + onChange: (text) { + model.eSERVICESDV ??= ESERVICESDV(); + model.eSERVICESDV!.pIDCOLUMNNAME = text; + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "N") { + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + isReadOnly: model.rEADONLY == "Y", + isInputTypeNum: true, + onChange: (text) { + model.eSERVICESDV ??= ESERVICESDV(); + model.eSERVICESDV!.pIDCOLUMNNAME = text; + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "X") { + String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (""); + + if (termDffList![index].isDefaultTypeIsCDPS) { + if (displayText.contains(" 00:00:00")) { + displayText = displayText.replaceAll(" 00:00:00", ""); + } + if (displayText.contains("/")) { + displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); + } + } + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + displayText, + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + if ((termDffList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + if (termDffList![index].isDefaultTypeIsCDPS) { + selectedDate = DateFormat("yyyy/MM/dd").parse(termDffList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", "")); + } else { + selectedDate = DateTime.parse(termDffList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + } + } + DateTime date = await _selectDate(context); + String dateString = date.toString().split(' ').first; + // DateTime date1 = DateTime(date.year, date.month, date.day); + // getEitDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv; + if (termDffList![index].isDefaultTypeIsCDPS) { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: Utils.formatDate(dateString), + pRETURNMSG: "null", + pRETURNSTATUS: termDffList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: termDffList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } else { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: dateString, + pRETURNMSG: "null", + pRETURNSTATUS: termDffList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: termDffList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } + termDffList![index].eSERVICESDV = eservicesdv; + setState(() {}); + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + await calGetValueSetValues(model); + } + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "Y") { + String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? ""; + // if (termDffList![index].isDefaultTypeIsCDPS) { + // displayText = Utils.reverseFormatDate(displayText); + // // if (displayText.contains(" 00:00:00")) { + // // displayText = displayText.replaceAll(" 00:00:00", ""); + // // } + // // if (!displayText.contains("-")) { + // // displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); + // // } + // } + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + displayText, + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + if ((termDffList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + if (termDffList![index].isDefaultTypeIsCDPS) { + String tempDate = termDffList![index].eSERVICESDV!.pVALUECOLUMNNAME!; + if (tempDate.contains("00:00:00")) { + tempDate = tempDate.replaceAll("00:00:00", '').trim(); + } + if (tempDate.contains("/")) { + selectedDate = DateFormat("yyyy/MM/dd").parse(tempDate); + } else { + selectedDate = DateFormat("yyyy-MM-dd").parse(tempDate); + } + } else { + selectedDate = DateTime.parse(termDffList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + } + } + DateTime date = await _selectDate(context); + String dateString = date.toString().split(' ').first; + // getEitDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv; + if (termDffList![index].isDefaultTypeIsCDPS) { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: Utils.formatDate(dateString), + pRETURNMSG: "null", + pRETURNSTATUS: termDffList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: termDffList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } else { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: dateString, + pRETURNMSG: "null", + pRETURNSTATUS: termDffList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: termDffList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } + + termDffList![index].eSERVICESDV = eservicesdv; + setState(() {}); + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + await calGetValueSetValues(model); + } + }, + ).paddingOnly(bottom: 12); + } + } else { + return PopupMenuButton( + child: DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pVALUECOLUMNNAME ?? LocaleKeys.pleaseSelect.tr(), + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: model.rEADONLY == "Y", + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + if (model.rEADONLY != "Y") + for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem(child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!), value: i), + ], + onSelected: (int popipIndex) async { + ESERVICESDV eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: model.eSERVICESVS![popipIndex].iDCOLUMNNAME, + pRETURNMSG: "null", + pRETURNSTATUS: "null", //getEitDffStructureList![popipIndex].dEFAULTVALUE, + pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME); + termDffList![index].eSERVICESDV = eservicesdv; + setState(() {}); + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + await calGetValueSetValues(model); + } + }); + } + } else { + return const SizedBox(); + } + if (model.fORMATTYPE == "N") { + if (model.eSERVICESVS?.isNotEmpty ?? false) { + return PopupMenuButton( + child: DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pVALUECOLUMNNAME ?? "", + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: model.rEADONLY == "Y", + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + if (model.rEADONLY != "Y") + for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem(value: i, child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!)), + ], + onSelected: (int popipIndex) async { + ESERVICESDV eservicesdv = + ESERVICESDV(pIDCOLUMNNAME: model.eSERVICESVS![popipIndex].iDCOLUMNNAME, pRETURNMSG: "null", pRETURNSTATUS: "null", pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME); + termDffList![index].eSERVICESDV = eservicesdv; + setState(() {}); + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + await calGetValueSetValues(model); + } + }); + } + + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + isReadOnly: model.rEADONLY == "Y", + onChange: (text) { + //model.fieldAnswer = text; + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "X" || model.fORMATTYPE == "Y") { + String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? ""; + if (termDffList![index].isDefaultTypeIsCDPS) { + if (displayText.contains(" 00:00:00")) { + displayText = displayText.replaceAll(" 00:00:00", ""); + } + if (!displayText.contains("-")) { + displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); + } + } + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + displayText, + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + if ((termDffList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + if (termDffList![index].isDefaultTypeIsCDPS) { + selectedDate = DateFormat("yyyy/MM/dd").parse(termDffList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", "")); + } else { + selectedDate = DateTime.parse(termDffList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + } + } + DateTime date = await _selectDate(context); + String dateString = date.toString().split(' ').first; + // termDffList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: dateString, + pRETURNMSG: "null", + pRETURNSTATUS: termDffList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: termDffList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + termDffList![index].eSERVICESDV = eservicesdv; + setState(() {}); + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + await calGetValueSetValues(model); + } + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "I") { + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + suffixIconData: Icons.access_time_filled_rounded, + isEnable: false, + onTap: () async { + if ((termDffList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + var timeString = termDffList![index].eSERVICESDV!.pVALUECOLUMNNAME!.split(":"); + selectedDate = DateTime(0, 0, 0, int.parse(timeString[0]), int.parse(timeString[1])); + + //DateTime.parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + } + TimeOfDay _time = await _selectTime(context); + DateTime tempTime = DateTime(0, 1, 1, _time.hour, _time.minute); + String time = DateFormat('HH:mm').format(tempTime).trim(); + + // DateTime date1 = DateTime(date.year, date.month, date.day); + // getEitDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv = ESERVICESDV(pIDCOLUMNNAME: time, pRETURNMSG: "null", pRETURNSTATUS: termDffList![index].dEFAULTVALUE, pVALUECOLUMNNAME: time); + termDffList![index].eSERVICESDV = eservicesdv; + setState(() {}); + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + await calGetValueSetValues(model); + } + }, + ).paddingOnly(bottom: 12); + } + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [], + ).objectContainerView(); + } + + DateTime selectedDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day); + + Future _selectDate(BuildContext context) async { + DateTime time = selectedDate; + if (Platform.isIOS) { + await showCupertinoModalPopup( + context: context, + builder: (cxt) => Container( + height: 250, + color: Colors.white, + child: CupertinoDatePicker( + backgroundColor: Colors.white, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (value) { + if (value != null && value != selectedDate) { + time = value; + } + }, + initialDateTime: selectedDate, + ), + ), + ); + } else { + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + if (picked != null && picked != selectedDate) { + time = picked; + } + } + time = DateTime(time.year, time.month, time.day); + return time; + } + + Future _selectTime(BuildContext context) async { + TimeOfDay time = TimeOfDay(hour: selectedDate.hour, minute: selectedDate.minute); + if (Platform.isIOS) { + await showCupertinoModalPopup( + context: context, + builder: (cxt) => Container( + height: 250, + color: Colors.white, + child: CupertinoDatePicker( + backgroundColor: Colors.white, + mode: CupertinoDatePickerMode.time, + use24hFormat: true, + onDateTimeChanged: (value) { + if (value != null && value != selectedDate) { + time = TimeOfDay(hour: value.hour, minute: value.minute); + } + }, + initialDateTime: selectedDate, + ), + ), + ); + } else { + TimeOfDay? picked = await showTimePicker( + context: context, + initialTime: time, + builder: (cxt, child) { + return MediaQuery(data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true), child: child ?? Container()); + }); + + if (picked != null && picked != time) { + time = picked; + } + // final DateTime? picked = + // await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + // if (picked != null && picked != selectedDate) { + // time = picked; + // } + } + return time; + } +}