From f1c36b5821b50c7888a404fbe6bd3fc5afbef36e Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 27 Jun 2022 15:29:03 +0300 Subject: [PATCH] monthly pay slip added. --- assets/langs/ar-SA.json | 24 +- assets/langs/en-US.json | 22 +- lib/api/monthlyAttendance_api_client.dart | 2 +- lib/api/monthly_pay_slip_api_client.dart | 68 +++ lib/api/pending_transactions_api_client.dart | 3 +- lib/api/tangheem_user_api_client.dart | 34 -- lib/classes/utils.dart | 62 +- lib/config/routes.dart | 7 +- lib/generated/codegen_loader.g.dart | 40 +- lib/generated/locale_keys.g.dart | 13 +- lib/main.dart | 19 +- lib/models/generic_response_model.dart | 77 ++- .../get_deductions_List_model.dart | 36 ++ .../get_earnings_list_model.dart | 36 ++ .../get_pay_slip_list_model.dart | 36 ++ .../get_payment_information_list_model.dart | 32 + .../get_summary_of_payment_list_model.dart | 36 ++ lib/ui/attendance/monthly_attendance.dart | 2 + lib/ui/landing/dashboard_screen.dart | 568 ++++++++++-------- lib/ui/landing/widget/services_widget.dart | 19 +- .../dynamic_screens/dynamic_input_screen.dart | 57 +- .../my_attendance/my_attendance_screen.dart | 3 +- lib/ui/payslip/monthly_pay_slip_screen.dart | 289 +++++++++ .../announcements/announcement_details.dart | 2 + lib/ui/screens/profile/profile_screen.dart | 1 + .../screens/profile/widgets/profile_info.dart | 2 + 26 files changed, 1102 insertions(+), 388 deletions(-) create mode 100644 lib/api/monthly_pay_slip_api_client.dart delete mode 100644 lib/api/tangheem_user_api_client.dart create mode 100644 lib/models/monthly_pay_slip/get_deductions_List_model.dart create mode 100644 lib/models/monthly_pay_slip/get_earnings_list_model.dart create mode 100644 lib/models/monthly_pay_slip/get_pay_slip_list_model.dart create mode 100644 lib/models/monthly_pay_slip/get_payment_information_list_model.dart create mode 100644 lib/models/monthly_pay_slip/get_summary_of_payment_list_model.dart create mode 100644 lib/ui/payslip/monthly_pay_slip_screen.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 7f22931..f26ddca 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -236,12 +236,12 @@ "year": "سنة", "month": "شهر", "day": "يوم", - "address" : "العنوان", + "address": "العنوان", "phoneNumber": "رقم الجوال", "businessGroup": "مجموعة العمل", "Payroll": "الراتب", "civilIdentityNumber": "رقم الهويه", - "dateOfBirth" : "تاريخ الميلاد", + "dateOfBirth": "تاريخ الميلاد", "maritalStatus ": "الحالة الاجتماعية", "fullName": "الأسم الكامل", "remove": "حذف", @@ -251,6 +251,18 @@ "writeComment": "أكتب تعليقا", "approversList": "قائمة الموافقين", "yourRequestHasBeenSubmittedForApprovals": "تم تقديم طلبك للموافقات", + "monthlyPaySlip": "قسيمة الراتب الشهرية", + "particular": "خاص", + "earnings": "أرباح", + "deductions": "الخصومات", + "paymentMethodName": "اسم طريقة الدفع", + "bankName": "اسم البنك", + "branchCode": "رمز الفرع", + "accountNo": "رقم الحساب", + "summaryOfInformation": "ملخص المعلومات", + "totalPayAmount": "المبلغ الإجمالي للدفع", + "paymentInformation": "معلومات الدفع", + "amount": "مقدار", "profile": { "reset_password": { "label": "Reset Password", @@ -272,14 +284,6 @@ "many": "You clicked {} times!", "other": "You clicked {} times!" }, - "amount": { - "zero": "Your amount : {} ", - "one": "Your amount : {} ", - "two": "Your amount : {} ", - "few": "Your amount : {} ", - "many": "Your amount : {} ", - "other": "Your amount : {} " - }, "gender": { "male": "Hi man ;) ", "female": "Hello girl :)", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 5934ab3..bfcac3c 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -245,13 +245,25 @@ "maritalStatus ": "Marital Status ", "fullName": "Full Name", "remove": "Remove", - "Attendance":"Attendance", + "Attendance": "Attendance", "submit": "Submit", "areYouSureYouWantToSubmit": "Are you sure you want to submit?", "comments": "Comments", "writeComment": "Write a comment", "approversList": "Approvers List", "yourRequestHasBeenSubmittedForApprovals": "Your request has been submitted for approvals", + "monthlyPaySlip": "Monthly Pay Slip", + "particular": "Particular", + "earnings": "Earnings", + "deductions": "Deductions", + "paymentMethodName": "Payment Method Name", + "bankName": "Bank Name", + "branchCode": "Branch Code", + "accountNo": "Account No", + "summaryOfInformation": "Summary of Information", + "totalPayAmount": "Total Pay Amount", + "paymentInformation": "Payment Information", + "amount": "Amount", "profile": { "reset_password": { "label": "Reset Password", @@ -273,14 +285,6 @@ "many": "You clicked {} times!", "other": "You clicked {} times!" }, - "amount": { - "zero": "Your amount : {} ", - "one": "Your amount : {} ", - "two": "Your amount : {} ", - "few": "Your amount : {} ", - "many": "Your amount : {} ", - "other": "Your amount : {} " - }, "gender": { "male": "Hi man ;) ", "female": "Hello girl :)", diff --git a/lib/api/monthlyAttendance_api_client.dart b/lib/api/monthlyAttendance_api_client.dart index bcbf69f..4de2481 100644 --- a/lib/api/monthlyAttendance_api_client.dart +++ b/lib/api/monthlyAttendance_api_client.dart @@ -10,6 +10,7 @@ import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model. import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'api_client.dart'; +// todo '@fatima' change file name according to structure class MonthlyAttendanceApiClient { static final MonthlyAttendanceApiClient _instance = MonthlyAttendanceApiClient._internal(); @@ -17,7 +18,6 @@ class MonthlyAttendanceApiClient { factory MonthlyAttendanceApiClient() => _instance; - Future getTimeCardSummary(String month, int year) async { String url = "${ApiConsts.erpRest}GET_TIME_CARD_SUMMARY"; Map postParams = { diff --git a/lib/api/monthly_pay_slip_api_client.dart b/lib/api/monthly_pay_slip_api_client.dart new file mode 100644 index 0000000..95bf847 --- /dev/null +++ b/lib/api/monthly_pay_slip_api_client.dart @@ -0,0 +1,68 @@ +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/monthly_pay_slip/get_deductions_List_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_earnings_list_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_pay_slip_list_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_payment_information_list_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_summary_of_payment_list_model.dart'; + +class MonthlyPaySlipApiClient { + static final MonthlyPaySlipApiClient _instance = MonthlyPaySlipApiClient._internal(); + + MonthlyPaySlipApiClient._internal(); + + factory MonthlyPaySlipApiClient() => _instance; + + Future> getPaySlip() async { + String url = "${ApiConsts.erpRest}GET_PAYSLIP"; + Map postParams = {"P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": -999}; + postParams.addAll(AppState().postParamsJson); + print(postParams); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getPayslipList ?? []; + }, url, postParams); + } + + Future> getSummaryOfPayment(int pActionContextID) async { + String url = "${ApiConsts.erpRest}GET_SUMMARY_OF_PAYMENT"; + Map postParams = {"P_ACTION_CONTEXT_ID": pActionContextID}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getSummaryOfPaymentList ?? []; + }, url, postParams); + } + + Future> getPaymentInformation(int pActionContextID) async { + String url = "${ApiConsts.erpRest}GET_PAYMENT_INFORMATION"; + Map postParams = {"P_ACTION_CONTEXT_ID": pActionContextID}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getPaymentInformationList ?? []; + }, url, postParams); + } + + Future> getDeductions(int pActionContextID) async { + String url = "${ApiConsts.erpRest}GET_DEDUCTIONS"; + Map postParams = {"P_ACTION_CONTEXT_ID": pActionContextID, "P_PAGE_LIMIT": 100, "P_PAGE_NUM": 1}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getDeductionsList ?? []; + }, url, postParams); + } + + Future> getEarnings(int pActionContextID) async { + String url = "${ApiConsts.erpRest}GET_EARNINGS"; + Map postParams = {"P_ACTION_CONTEXT_ID": pActionContextID, "P_PAGE_LIMIT": 100, "P_PAGE_NUM": 1}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getEarningsList ?? []; + }, url, postParams); + } +} diff --git a/lib/api/pending_transactions_api_client.dart b/lib/api/pending_transactions_api_client.dart index 30c6241..b8ddd60 100644 --- a/lib/api/pending_transactions_api_client.dart +++ b/lib/api/pending_transactions_api_client.dart @@ -5,6 +5,8 @@ import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/pending_transactions/get_pending_transactions_details.dart'; import 'package:mohem_flutter_app/models/pending_transactions/get_req_functions.dart'; +// todo '@haroon' kindly format code + class PendingTransactionsApiClient { static final PendingTransactionsApiClient _instance = PendingTransactionsApiClient._internal(); @@ -37,7 +39,6 @@ class PendingTransactionsApiClient { Future getAnnouncements(int itgAwarenessID, int itgPageNo, int itgRowID) async { String url = "${ApiConsts.cocRest}GetAnnouncementDiscountsConfigData"; Map postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER.toString(), "ItgAwarenessID": itgAwarenessID, "ItgPageNo": itgPageNo, "ItgPageSize": 5, "ItgRowID": itgRowID}; - postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); diff --git a/lib/api/tangheem_user_api_client.dart b/lib/api/tangheem_user_api_client.dart deleted file mode 100644 index 32a5a82..0000000 --- a/lib/api/tangheem_user_api_client.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'dart:async'; - -import 'package:mohem_flutter_app/classes/consts.dart'; -import 'package:mohem_flutter_app/models/content_info_model.dart'; -import 'package:mohem_flutter_app/models/member_login_list_model.dart'; -import 'package:mohem_flutter_app/models/surah_model.dart'; - -import 'api_client.dart'; - -class TangheemUserApiClient { - static final TangheemUserApiClient _instance = TangheemUserApiClient._internal(); - - TangheemUserApiClient._internal(); - - factory TangheemUserApiClient() => _instance; - - // Future getSurahs() async { - // String url = "${ApiConsts.tangheemUsers}AlSuar_Get"; - // var postParams = {}; - // return await ApiClient().postJsonForObject((json) => SurahModel.fromJson(json), url, postParams); - // } - // - // Future getMembers() async { - // String url = "${ApiConsts.tangheemUsers}Committee_Get"; - // var postParams = {}; - // return await ApiClient().postJsonForObject((json) => MemberModel.fromJson(json), url, postParams); - // } - // - // Future getContentInfo(int contentId) async { - // String url = "${ApiConsts.tangheemUsers}ContentInfo_Get"; - // var postParams = {"contentTypeId": contentId}; - // return await ApiClient().postJsonForObject((json) => ContentInfoModel.fromJson(json), url, postParams); - // } -} diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 20d791b..114f32c 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -1,17 +1,24 @@ import 'dart:convert'; import 'dart:typed_data'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/config/routes.dart'; // import 'package:fluttertoast/fluttertoast.dart'; import 'package:mohem_flutter_app/exceptions/api_exception.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/widgets/dialogs/confirm_dialog.dart'; import 'package:mohem_flutter_app/widgets/loading_dialog.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:sizer/sizer.dart'; class Utils { static bool _isLoadingVisible = false; @@ -120,17 +127,13 @@ class Utils { } static Widget getNoDataWidget(BuildContext context) { - return Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset('assets/images/not_found.svg', width: 110.0, height: 110.0), - Container(margin: const EdgeInsets.only(top: 15.0), child: const Text("No Result Found", style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xFFBABABA)))), - ], - ), - ), - ); + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/not_found.svg', width: 110.0, height: 110.0), + Container(margin: const EdgeInsets.only(top: 15.0), child: LocaleKeys.noDataAvailable.tr().toText16().center), + ], + ).center; } static getPostBytes(img) { @@ -157,4 +160,41 @@ class Utils { static Uint8List dataFromBase64String(String base64String) { return base64Decode(base64String); } + + static Widget tableColumnTitle(String? text, {bool showDivider = true}) { + text ??= ""; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + 6.height, + text.toText12(), + 5.height, + if (showDivider) + const Divider( + height: 1, + color: Color(0xff2E303A), + thickness: 1, + ) + ], + ); + } + + static Widget tableColumnValue(String text, {bool isLast = false, bool isCapitable = true}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + 12.height, + (isCapitable ? text.toLowerCase().capitalizeFirstofEach : text).toText12(color: MyColors.normalTextColor), + 12.height, + if (!isLast) + const Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ], + ); + } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 502d852..7733347 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -12,6 +12,7 @@ import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/my_attendance_screen.dart'; +import 'package:mohem_flutter_app/ui/payslip/monthly_pay_slip_screen.dart'; import 'package:mohem_flutter_app/ui/profile/basic_details.dart'; import 'package:mohem_flutter_app/ui/profile/contact_details.dart'; import 'package:mohem_flutter_app/ui/profile/delete_familyMember.dart'; @@ -95,7 +96,8 @@ class AppRoutes { static const String announcements = "/announcements"; static const String announcementsDetails = "/announcementsDetails"; - + //Pay slip + static const String monthlyPaySlip = "/monthlyPaySlip"; static final Map routes = { login: (context) => LoginScreen(), @@ -151,6 +153,7 @@ class AppRoutes { announcements: (context) => Announcements(), announcementsDetails: (context) => AnnouncementDetails(), - + //pay slip + monthlyPaySlip: (context) => MonthlyPaySlipScreen(), }; } diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index ad3a70e..8ab7d0b 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -267,6 +267,18 @@ class CodegenLoader extends AssetLoader{ "writeComment": "أكتب تعليقا", "approversList": "قائمة الموافقين", "yourRequestHasBeenSubmittedForApprovals": "تم تقديم طلبك للموافقات", + "monthlyPaySlip": "قسيمة الراتب الشهرية", + "particular": "خاص", + "earnings": "أرباح", + "deductions": "الخصومات", + "paymentMethodName": "اسم طريقة الدفع", + "bankName": "اسم البنك", + "branchCode": "رمز الفرع", + "accountNo": "رقم الحساب", + "summaryOfInformation": "ملخص المعلومات", + "totalPayAmount": "المبلغ الإجمالي للدفع", + "paymentInformation": "معلومات الدفع", + "amount": "مقدار", "profile": { "reset_password": { "label": "Reset Password", @@ -288,14 +300,6 @@ class CodegenLoader extends AssetLoader{ "many": "You clicked {} times!", "other": "You clicked {} times!" }, - "amount": { - "zero": "Your amount : {} ", - "one": "Your amount : {} ", - "two": "Your amount : {} ", - "few": "Your amount : {} ", - "many": "Your amount : {} ", - "other": "Your amount : {} " - }, "gender": { "male": "Hi man ;) ", "female": "Hello girl :)", @@ -560,6 +564,18 @@ static const Map en_US = { "writeComment": "Write a comment", "approversList": "Approvers List", "yourRequestHasBeenSubmittedForApprovals": "Your request has been submitted for approvals", + "monthlyPaySlip": "Monthly Pay Slip", + "particular": "Particular", + "earnings": "Earnings", + "deductions": "Deductions", + "paymentMethodName": "Payment Method Name", + "bankName": "Bank Name", + "branchCode": "Branch Code", + "accountNo": "Account No", + "summaryOfInformation": "Summary of Information", + "totalPayAmount": "Total Pay Amount", + "paymentInformation": "Payment Information", + "amount": "Amount", "profile": { "reset_password": { "label": "Reset Password", @@ -581,14 +597,6 @@ static const Map en_US = { "many": "You clicked {} times!", "other": "You clicked {} times!" }, - "amount": { - "zero": "Your amount : {} ", - "one": "Your amount : {} ", - "two": "Your amount : {} ", - "few": "Your amount : {} ", - "many": "Your amount : {} ", - "other": "Your amount : {} " - }, "gender": { "male": "Hi man ;) ", "female": "Hello girl :)", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 21d18f5..5271370 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -252,6 +252,18 @@ abstract class LocaleKeys { static const writeComment = 'writeComment'; static const approversList = 'approversList'; static const yourRequestHasBeenSubmittedForApprovals = 'yourRequestHasBeenSubmittedForApprovals'; + static const monthlyPaySlip = 'monthlyPaySlip'; + static const particular = 'particular'; + static const earnings = 'earnings'; + static const deductions = 'deductions'; + static const paymentMethodName = 'paymentMethodName'; + static const bankName = 'bankName'; + static const branchCode = 'branchCode'; + static const accountNo = 'accountNo'; + static const summaryOfInformation = 'summaryOfInformation'; + static const totalPayAmount = 'totalPayAmount'; + static const paymentInformation = 'paymentInformation'; + static const amount = 'amount'; 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'; @@ -264,7 +276,6 @@ abstract class LocaleKeys { static const profile_familyDetails = 'profile.familyDetails'; static const profile = 'profile'; static const clicked = 'clicked'; - static const amount = 'amount'; static const gender_with_arg = 'gender.with_arg'; static const gender = 'gender'; static const reset_locale = 'reset_locale'; diff --git a/lib/main.dart b/lib/main.dart index 77e94e8..39a5f48 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -68,22 +68,17 @@ class MyApp extends StatelessWidget { builder: (context, orientation, deviceType) { print(AppState().postParamsObject?.toJson()); var obj = AppState().postParamsObject; - obj?.languageID = EasyLocalization - .of(context) - ?.locale - .languageCode == "ar" ? 1 : 2; + obj?.languageID = EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2; AppState().setPostParamsModel(obj!); List delegates = context.localizationDelegates; - // delegates.add(GlobalMaterialLocalizations.delegate); - delegates.add(MonthYearPickerLocalizations.delegate,); + // delegates.add(GlobalMaterialLocalizations.delegate); + delegates.add( + MonthYearPickerLocalizations.delegate, + ); return MaterialApp( - theme: AppTheme.getTheme(EasyLocalization - .of(context) - ?.locale - .languageCode == "ar"), + theme: AppTheme.getTheme(EasyLocalization.of(context)?.locale.languageCode == "ar"), debugShowCheckedModeBanner: false, - localizationsDelegates - :delegates, + localizationsDelegates: delegates, supportedLocales: context.supportedLocales, locale: context.locale, initialRoute: AppRoutes.initialRoute, diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 00404f4..5302e64 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -24,6 +24,11 @@ import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_mod import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/member_login_list_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_deductions_List_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_earnings_list_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_pay_slip_list_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_payment_information_list_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_summary_of_payment_list_model.dart'; import 'package:mohem_flutter_app/models/mowadhafhi/get_department_sections.dart'; import 'package:mohem_flutter_app/models/mowadhafhi/get_project_departments.dart'; import 'package:mohem_flutter_app/models/mowadhafhi/get_projects.dart'; @@ -139,12 +144,12 @@ class GenericResponseModel { GetContactNotificationBodyList? getContactNotificationBodyList; List? getCountriesList; List? getDayHoursTypeDetailsList; - List? getDeductionsList; + List? getDeductionsList; GetDefaultValueList? getDefaultValueList; List? getEITCollectionNotificationBodyList; List? getEITDFFStructureList; List? getEITTransactionList; - List? getEarningsList; + List? getEarningsList; List? getEmployeeAddressList; List? getEmployeeBasicDetailsList; List? getEmployeeContactsList; @@ -168,8 +173,9 @@ class GenericResponseModel { List? getOpenNotificationsNumList; List? getOpenPeriodDatesList; List? getOrganizationsSalariesList; - List? getPaymentInformationList; - List? getPayslipList; + List? getPaymentInformationList; + List? getPayslipList; + // List? getPendingReqDetailsList; // List? getPendingReqFunctionsList; List? getPerformanceAppraisalList; @@ -190,7 +196,7 @@ class GenericResponseModel { List? getSubordinatesAttdStatusList; List? getSubordinatesLeavesList; List? getSubordinatesLeavesTotalVacationsList; - List? getSummaryOfPaymentList; + List? getSummaryOfPaymentList; List? getSwipesList; List? getTermColsStructureList; List? getTermDffStructureList; @@ -718,7 +724,13 @@ class GenericResponseModel { getDayHoursTypeDetailsList!.add(new GetDayHoursTypeDetailsList.fromJson(v)); }); } - getDeductionsList = json['GetDeductionsList']; + + if (json['GetDeductionsList'] != null) { + getDeductionsList = []; + json['GetDeductionsList'].forEach((v) { + getDeductionsList!.add(new GetDeductionsList.fromJson(v)); + }); + } getDefaultValueList = json['GetDefaultValueList'] != null ? GetDefaultValueList.fromJson(json['GetDefaultValueList']) : null; getEITCollectionNotificationBodyList = json["GetEITCollectionNotificationBodyList"] == null ? null @@ -735,7 +747,13 @@ class GenericResponseModel { getEITTransactionList!.add(new GetEITTransactionList.fromJson(v)); }); } - getEarningsList = json['GetEarningsList']; + + if (json['GetEarningsList'] != null) { + getEarningsList = []; + json['GetEarningsList'].forEach((v) { + getEarningsList!.add(new GetEarningsList.fromJson(v)); + }); + } if (json['GetEmployeeAddressList'] != null) { getEmployeeAddressList = []; json['GetEmployeeAddressList'].forEach((v) { @@ -804,8 +822,20 @@ class GenericResponseModel { getOpenNotificationsNumList = json['GetOpenNotificationsNumList']; getOpenPeriodDatesList = json['GetOpenPeriodDatesList']; getOrganizationsSalariesList = json['GetOrganizationsSalariesList']; - getPaymentInformationList = json['GetPaymentInformationList']; - getPayslipList = json['GetPayslipList']; + + if (json['GetPaymentInformationList'] != null) { + getPaymentInformationList = []; + json['GetPaymentInformationList'].forEach((v) { + getPaymentInformationList!.add(new GetPaymentInformationList.fromJson(v)); + }); + } + + if (json['GetPayslipList'] != null) { + getPayslipList = []; + json['GetPayslipList'].forEach((v) { + getPayslipList!.add(new GetPayslipList.fromJson(v)); + }); + } // getPendingReqDetailsList = json['GetPendingReqDetailsList']; // getPendingReqFunctionsList = json['GetPendingReqFunctionsList']; getPerformanceAppraisalList = json['GetPerformanceAppraisalList']; @@ -861,7 +891,12 @@ class GenericResponseModel { } getSubordinatesLeavesTotalVacationsList = json['GetSubordinatesLeavesTotalVacationsList']; - getSummaryOfPaymentList = json['GetSummaryOfPaymentList']; + if (json['GetSummaryOfPaymentList'] != null) { + getSummaryOfPaymentList = []; + json['GetSummaryOfPaymentList'].forEach((v) { + getSummaryOfPaymentList!.add(new GetSummaryOfPaymentList.fromJson(v)); + }); + } getSwipesList = json['GetSwipesList']; getTermColsStructureList = json['GetTermColsStructureList']; getTermDffStructureList = json['GetTermDffStructureList']; @@ -1226,7 +1261,10 @@ class GenericResponseModel { if (this.getDayHoursTypeDetailsList != null) { data['GetDayHoursTypeDetailsList'] = this.getDayHoursTypeDetailsList!.map((v) => v.toJson()).toList(); } - data['GetDeductionsList'] = this.getDeductionsList; + + if (this.getDeductionsList != null) { + data['GetDeductionsList'] = this.getDeductionsList!.map((v) => v.toJson()).toList(); + } if (this.getDefaultValueList != null) { data['GetDefaultValueList'] = this.getDefaultValueList!.toJson(); } @@ -1237,7 +1275,10 @@ class GenericResponseModel { if (this.getEITTransactionList != null) { data['GetEITTransactionList'] = this.getEITTransactionList!.map((v) => v.toJson()).toList(); } - data['GetEarningsList'] = this.getEarningsList; + + if (this.getEarningsList != null) { + data['GetEarningsList'] = this.getEarningsList!.map((v) => v.toJson()).toList(); + } if (this.getEmployeeAddressList != null) { data['GetEmployeeAddressList'] = this.getEmployeeAddressList!.map((v) => v.toJson()).toList(); } @@ -1282,8 +1323,12 @@ class GenericResponseModel { data['GetOpenNotificationsNumList'] = this.getOpenNotificationsNumList; data['GetOpenPeriodDatesList'] = this.getOpenPeriodDatesList; data['GetOrganizationsSalariesList'] = this.getOrganizationsSalariesList; - data['GetPaymentInformationList'] = this.getPaymentInformationList; - data['GetPayslipList'] = this.getPayslipList; + if (this.getPaymentInformationList != null) { + data['GetPaymentInformationList'] = this.getPaymentInformationList!.map((v) => v.toJson()).toList(); + } + if (this.getPayslipList != null) { + data['GetPayslipList'] = this.getPayslipList!.map((v) => v.toJson()).toList(); + } // data['GetPendingReqDetailsList'] = this.getPendingReqDetailsList; // data['GetPendingReqFunctionsList'] = this.getPendingReqFunctionsList; data['GetPerformanceAppraisalList'] = this.getPerformanceAppraisalList; @@ -1326,7 +1371,9 @@ class GenericResponseModel { } data['GetSubordinatesLeavesTotalVacationsList'] = this.getSubordinatesLeavesTotalVacationsList; - data['GetSummaryOfPaymentList'] = this.getSummaryOfPaymentList; + if (this.getSummaryOfPaymentList != null) { + data['GetSummaryOfPaymentList'] = this.getSummaryOfPaymentList!.map((v) => v.toJson()).toList(); + } data['GetSwipesList'] = this.getSwipesList; data['GetTermColsStructureList'] = this.getTermColsStructureList; data['GetTermDffStructureList'] = this.getTermDffStructureList; diff --git a/lib/models/monthly_pay_slip/get_deductions_List_model.dart b/lib/models/monthly_pay_slip/get_deductions_List_model.dart new file mode 100644 index 0000000..7a99447 --- /dev/null +++ b/lib/models/monthly_pay_slip/get_deductions_List_model.dart @@ -0,0 +1,36 @@ +class GetDeductionsList { + int? aMOUNT; + String? eLEMENTNAME; + int? fROMROWNUM; + int? nOOFROWS; + int? rOWNUM; + int? tOROWNUM; + + GetDeductionsList( + {this.aMOUNT, + this.eLEMENTNAME, + this.fROMROWNUM, + this.nOOFROWS, + this.rOWNUM, + this.tOROWNUM}); + + GetDeductionsList.fromJson(Map json) { + aMOUNT = json['AMOUNT']; + eLEMENTNAME = json['ELEMENT_NAME']; + fROMROWNUM = json['FROM_ROW_NUM']; + nOOFROWS = json['NO_OF_ROWS']; + rOWNUM = json['ROW_NUM']; + tOROWNUM = json['TO_ROW_NUM']; + } + + Map toJson() { + final Map data = new Map(); + data['AMOUNT'] = this.aMOUNT; + data['ELEMENT_NAME'] = this.eLEMENTNAME; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['ROW_NUM'] = this.rOWNUM; + data['TO_ROW_NUM'] = this.tOROWNUM; + return data; + } +} \ No newline at end of file diff --git a/lib/models/monthly_pay_slip/get_earnings_list_model.dart b/lib/models/monthly_pay_slip/get_earnings_list_model.dart new file mode 100644 index 0000000..4c38fa6 --- /dev/null +++ b/lib/models/monthly_pay_slip/get_earnings_list_model.dart @@ -0,0 +1,36 @@ +class GetEarningsList { + int? aMOUNT; + String? eLEMENTNAME; + int? fROMROWNUM; + int? nOOFROWS; + int? rOWNUM; + int? tOROWNUM; + + GetEarningsList( + {this.aMOUNT, + this.eLEMENTNAME, + this.fROMROWNUM, + this.nOOFROWS, + this.rOWNUM, + this.tOROWNUM}); + + GetEarningsList.fromJson(Map json) { + aMOUNT = json['AMOUNT']; + eLEMENTNAME = json['ELEMENT_NAME']; + fROMROWNUM = json['FROM_ROW_NUM']; + nOOFROWS = json['NO_OF_ROWS']; + rOWNUM = json['ROW_NUM']; + tOROWNUM = json['TO_ROW_NUM']; + } + + Map toJson() { + final Map data = new Map(); + data['AMOUNT'] = this.aMOUNT; + data['ELEMENT_NAME'] = this.eLEMENTNAME; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['ROW_NUM'] = this.rOWNUM; + data['TO_ROW_NUM'] = this.tOROWNUM; + return data; + } +} \ No newline at end of file diff --git a/lib/models/monthly_pay_slip/get_pay_slip_list_model.dart b/lib/models/monthly_pay_slip/get_pay_slip_list_model.dart new file mode 100644 index 0000000..7cf8883 --- /dev/null +++ b/lib/models/monthly_pay_slip/get_pay_slip_list_model.dart @@ -0,0 +1,36 @@ +class GetPayslipList { + int? aCTIONCONTEXTID; + String? pAYMENTDATE; + String? pAYSLIPCHOICE; + String? pERIODENDDATE; + String? pERIODNAME; + String? pERIODSTARTDATE; + + GetPayslipList( + {this.aCTIONCONTEXTID, + this.pAYMENTDATE, + this.pAYSLIPCHOICE, + this.pERIODENDDATE, + this.pERIODNAME, + this.pERIODSTARTDATE}); + + GetPayslipList.fromJson(Map json) { + aCTIONCONTEXTID = json['ACTION_CONTEXT_ID']; + pAYMENTDATE = json['PAYMENT_DATE']; + pAYSLIPCHOICE = json['PAYSLIP_CHOICE']; + pERIODENDDATE = json['PERIOD_END_DATE']; + pERIODNAME = json['PERIOD_NAME']; + pERIODSTARTDATE = json['PERIOD_START_DATE']; + } + + Map toJson() { + final Map data = new Map(); + data['ACTION_CONTEXT_ID'] = this.aCTIONCONTEXTID; + data['PAYMENT_DATE'] = this.pAYMENTDATE; + data['PAYSLIP_CHOICE'] = this.pAYSLIPCHOICE; + data['PERIOD_END_DATE'] = this.pERIODENDDATE; + data['PERIOD_NAME'] = this.pERIODNAME; + data['PERIOD_START_DATE'] = this.pERIODSTARTDATE; + return data; + } +} \ No newline at end of file diff --git a/lib/models/monthly_pay_slip/get_payment_information_list_model.dart b/lib/models/monthly_pay_slip/get_payment_information_list_model.dart new file mode 100644 index 0000000..75ed21c --- /dev/null +++ b/lib/models/monthly_pay_slip/get_payment_information_list_model.dart @@ -0,0 +1,32 @@ +class GetPaymentInformationList { + String? aCCOUNTNUMBER; + String? aMOUNT; + String? bANKNAME; + String? bRANCHNAME; + String? pAYMENTMETHODNAME; + + GetPaymentInformationList( + {this.aCCOUNTNUMBER, + this.aMOUNT, + this.bANKNAME, + this.bRANCHNAME, + this.pAYMENTMETHODNAME}); + + GetPaymentInformationList.fromJson(Map json) { + aCCOUNTNUMBER = json['ACCOUNT_NUMBER']; + aMOUNT = json['AMOUNT']; + bANKNAME = json['BANK_NAME']; + bRANCHNAME = json['BRANCH_NAME']; + pAYMENTMETHODNAME = json['PAYMENT_METHOD_NAME']; + } + + Map toJson() { + final Map data = new Map(); + data['ACCOUNT_NUMBER'] = this.aCCOUNTNUMBER; + data['AMOUNT'] = this.aMOUNT; + data['BANK_NAME'] = this.bANKNAME; + data['BRANCH_NAME'] = this.bRANCHNAME; + data['PAYMENT_METHOD_NAME'] = this.pAYMENTMETHODNAME; + return data; + } +} \ No newline at end of file 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 new file mode 100644 index 0000000..72ee89b --- /dev/null +++ b/lib/models/monthly_pay_slip/get_summary_of_payment_list_model.dart @@ -0,0 +1,36 @@ +class GetSummaryOfPaymentList { + int? tOTALDEDUCTIONSAMOUNT; + int? tOTALDEDUCTIONSPERCENTAGE; + int? tOTALEARNINGSAMOUNT; + int? tOTALEARNINGSPERCENTAGE; + int? tOTALPAYAMOUNT; + int? tOTALPAYPERCENTAGE; + + GetSummaryOfPaymentList( + {this.tOTALDEDUCTIONSAMOUNT, + this.tOTALDEDUCTIONSPERCENTAGE, + this.tOTALEARNINGSAMOUNT, + this.tOTALEARNINGSPERCENTAGE, + this.tOTALPAYAMOUNT, + this.tOTALPAYPERCENTAGE}); + + GetSummaryOfPaymentList.fromJson(Map json) { + tOTALDEDUCTIONSAMOUNT = json['TOTAL_DEDUCTIONS_AMOUNT']; + tOTALDEDUCTIONSPERCENTAGE = json['TOTAL_DEDUCTIONS_PERCENTAGE']; + tOTALEARNINGSAMOUNT = json['TOTAL_EARNINGS_AMOUNT']; + tOTALEARNINGSPERCENTAGE = json['TOTAL_EARNINGS_PERCENTAGE']; + tOTALPAYAMOUNT = json['TOTAL_PAY_AMOUNT']; + tOTALPAYPERCENTAGE = json['TOTAL_PAY_PERCENTAGE']; + } + + Map toJson() { + final Map data = new Map(); + data['TOTAL_DEDUCTIONS_AMOUNT'] = this.tOTALDEDUCTIONSAMOUNT; + data['TOTAL_DEDUCTIONS_PERCENTAGE'] = this.tOTALDEDUCTIONSPERCENTAGE; + data['TOTAL_EARNINGS_AMOUNT'] = this.tOTALEARNINGSAMOUNT; + data['TOTAL_EARNINGS_PERCENTAGE'] = this.tOTALEARNINGSPERCENTAGE; + data['TOTAL_PAY_AMOUNT'] = this.tOTALPAYAMOUNT; + data['TOTAL_PAY_PERCENTAGE'] = this.tOTALPAYPERCENTAGE; + return data; + } +} \ No newline at end of file diff --git a/lib/ui/attendance/monthly_attendance.dart b/lib/ui/attendance/monthly_attendance.dart index 9ec5cdd..7a28c96 100644 --- a/lib/ui/attendance/monthly_attendance.dart +++ b/lib/ui/attendance/monthly_attendance.dart @@ -32,6 +32,8 @@ class MonthlyAttendance extends StatefulWidget { } } +// todo '@fatima' use extension methods for widgets + class _MonthlyAttendanceState extends State { bool isPresent = false; bool isAbsent = false; diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 2e7757c..c125c2d 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -50,276 +50,342 @@ class _DashboardScreenState extends State { List namesD = ["Nostalgia Perfume Perfume", "Al Nafoura", "AlJadi", "Nostalgia Perfume"]; final GlobalKey _key = GlobalKey(); // return Scaffold( - key: _scaffoldState, - body: Column( - children: [ - Row( - children: [ - Builder(builder: (context) { - return Row( - mainAxisSize: MainAxisSize.min, - children: [ - CircularAvatar( - width: 34, - height: 34, - url: "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png", + key: _scaffoldState, + body: Column( + children: [ + Row( + children: [ + Builder(builder: (context) { + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + CircularAvatar( + width: 34, + height: 34, + url: "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png", + ), + 8.width, + SvgPicture.asset("assets/images/side_nav.svg"), + ], + ).onPress(() { + _scaffoldState.currentState!.openDrawer(); + }); + }), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + //AppLogo(), + 8.width, + LocaleKeys.mohemm.tr().toText14() + ], + ), + ), + SizedBox( + width: 36, + height: 36, + child: Stack( + alignment: Alignment.centerLeft, + children: [ + SvgPicture.asset("assets/images/announcements.svg"), + Positioned( + right: 0, + top: 0, + child: Container( + padding: const EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), + child: "3".toText12(color: Colors.white), ), - 8.width, - SvgPicture.asset("assets/images/side_nav.svg"), - ], - ).onPress(() { - _scaffoldState.currentState!.openDrawer(); - }); - }), - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - //AppLogo(), - 8.width, - LocaleKeys.mohemm.tr().toText14() - ], - ), + ) + ], ), - SizedBox( - width: 36, - height: 36, - child: Stack( - alignment: Alignment.centerLeft, + ).onPress(() async { + await Navigator.pushNamed(context, AppRoutes.announcements); + + }) + ], + ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7), + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - SvgPicture.asset("assets/images/announcements.svg"), - Positioned( - right: 0, - top: 0, - child: Container( - padding: const EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), - child: "3".toText12(color: Colors.white), - ), - ) - ], - ), - ).onPress(() async { - // data.update(context); - await Navigator.pushNamed(context, AppRoutes.announcements); - }) - ], - ).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), - "Mahmoud Shrouf".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( + LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color), + "Mahmoud Shrouf".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: [ - Expanded( - child: Column( + 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: [ - LocaleKeys.checkIn.tr().toText12(color: Colors.white), - (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) - .toString() - .toText14(color: Colors.white, isBold: true), - 4.height, + 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(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(() { - Navigator.pushNamed(context, AppRoutes.todayAttendance); - })) - .animatedSwither(); - }, - ), + ).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(() { + 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: EdgeInsets.only(top: 31), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), - border: Border.all(color: MyColors.lightGreyEDColor, width: 1), + ), + 9.width, + Expanded( + child: MenusWidget(), + ), + ], ), - 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), - ], - ).paddingOnly(left: 21, right: 21), - 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 SizedBox( - width: 73, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 73, - height: 73, + ], + ).paddingOnly(left: 21, right: 21, top: 7), + ServicesWidget(), + 8.height, + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 31), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: 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( - borderRadius: const BorderRadius.all( - Radius.circular(100), - ), - border: Border.all(color: MyColors.lightGreyEDColor, width: 1), + color: MyColors.yellowColor, + borderRadius: BorderRadius.circular(10), ), - child: ClipRRect( - borderRadius: const BorderRadius.all( - Radius.circular(50), - ), - child: Image.network( - "https://play-lh.googleusercontent.com/NPo88ojmhah4HDiposucJmfQIop4z4xc8kqJK9ITO9o-yCab2zxIp7PPB_XPj2iUojo", - fit: BoxFit.cover, - ), + child: LocaleKeys.newString.tr().toText10(isBold: true)), + ], + ), + ], + ), + ), + LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true), + ], + ).paddingOnly(left: 21, right: 21), + 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 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.lightGreyEDColor, width: 1), ), - 4.height, - Expanded( - child: namesD[6 % (index + 1)].toText12(isCenter: true, maxLine: 2), + child: ClipRRect( + borderRadius: const BorderRadius.all( + Radius.circular(50), + ), + child: Image.network( + "https://play-lh.googleusercontent.com/NPo88ojmhah4HDiposucJmfQIop4z4xc8kqJK9ITO9o-yCab2zxIp7PPB_XPj2iUojo", + fit: BoxFit.cover, + ), ), - ], - ), - ); - }, - separatorBuilder: (cxt, index) => 8.width, - itemCount: 6), - ), - ], - ), - ) - ], - ), + ), + 4.height, + Expanded( + child: namesD[6 % (index + 1)].toText12(isCenter: true, maxLine: 2), + ), + ], + ), + ); + }, + separatorBuilder: (cxt, index) => 8.width, + itemCount: 6), + ), + ], + ), + ) + ], + ), + ), + ) + ], + ), + drawer: SafeArea( + child: AppDrawer(), + ), + bottomNavigationBar: BottomNavigationBar( + items: [ + BottomNavigationBarItem( + icon: Padding( + padding: const EdgeInsets.all(4.0), + child: SvgPicture.asset( + "assets/icons/home.svg", + width: 20, + height: 20, ), - ) - ], + ), + label: 'Home', + ), + BottomNavigationBarItem( + icon: Padding( + padding: const EdgeInsets.all(4.0), + child: SvgPicture.asset( + "assets/icons/create_req.svg", + width: 20, + height: 20, + ), + ), + label: 'Create Request', + ), + BottomNavigationBarItem( + icon: Padding( + padding: const EdgeInsets.all(4.0), + child: SvgPicture.asset( + "assets/icons/work_list.svg", + width: 20, + height: 20, + ), + ), + label: 'Work List', + ), + BottomNavigationBarItem( + icon: Padding( + padding: const EdgeInsets.all(4.0), + child: SvgPicture.asset( + "assets/icons/item_for_sale.svg", + width: 20, + height: 20, + ), + ), + label: 'Items for Sale', + ), + ], + currentIndex: 0, + selectedLabelStyle: TextStyle( + fontSize: 8, + color: Color(0xff989898), + fontWeight: FontWeight.w600, + ), + unselectedLabelStyle: TextStyle( + fontSize: 8, + color: Color(0xff989898), + fontWeight: FontWeight.w600, ), - drawer: SafeArea(child: AppDrawer())); + type: BottomNavigationBarType.fixed, + selectedItemColor: Colors.black, + backgroundColor: Color(0xffF8F8F8), + onTap: (v) {}, + ), + ); } } diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index fc873cd..ebb564c 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -1,7 +1,6 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.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'; @@ -12,6 +11,8 @@ import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:provider/provider.dart'; +import '../../my_attendance/dynamic_screens/dynamic_listview_screen.dart'; + class ServicesWidget extends StatelessWidget { @override Widget build(BuildContext context) { @@ -109,17 +110,19 @@ class ServicesWidget extends StatelessWidget { void handleOnPress(context, GetMenuEntriesList menuEntry) { var pro = Provider.of(context, listen: false); - List? menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && element.menuEntryType == "FUNCTION").toList(); + List menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && element.menuEntryType == "FUNCTION").toList() ?? []; menuEntry.icon = ""; print(menuEntry.toJson()); - Navigator.pushNamed(context, AppRoutes.myAttendance, arguments: menuList ?? []); - return; - - if (menuEntry.menuName == "HMG_OTL_SS" || menuEntry.menuName == "HMG_PT_OTL_SS") { - Navigator.pushNamed(context, AppRoutes.myAttendance); + if (menuList.isEmpty) { + if (menuEntry.requestType == "EIT") { + Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menuEntry.prompt!, menuEntry.functionName!)); + } else if (menuEntry.requestType == "PAYSLIP") { + Navigator.pushNamed(context, AppRoutes.monthlyPaySlip); + } } else { - Utils.showToast("In Progress"); + Navigator.pushNamed(context, AppRoutes.myAttendance, arguments: menuList); } + return; } String firstWord(String value) { 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 1a430ea..6e020bf 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -121,29 +121,32 @@ class _DynamicInputScreenState extends State { } void getDefaultValues(GetEITDFFStructureList structureList) async { - if ((structureList.cHILDSEGMENTSDVSplited?.length ?? 0) < 1) { - return; - } try { - Utils.showLoading(context); + Utils.showLoading(context); for (int i = 0; i < (structureList.cHILDSEGMENTSDVSplited?.length ?? 0); i++) { String segmentId = structureList.cHILDSEGMENTSDVSplited![i]; - GetEITDFFStructureList? reqObj = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId); - List parentRequired = reqObj.pARENTSEGMENTSDVSplited ?? []; + print("segmentId:${segmentId}"); + print("segmentName:${structureList.sEGMENTNAME}"); + GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId); + List parentRequired = parent.pARENTSEGMENTSDVSplited ?? []; + List filteredList = getEitDffStructureList!.where((outerElement) => parentRequired.any((element) => outerElement.sEGMENTNAME == element.name && element.isRequired == "REQUIRED")).toList(); + + List> values = filteredList .map((e) => GetSetValuesRequestModel( sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME) .toJson()) .toList(); + print("values:${values}"); ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); getEitDffStructureList![index].eSERVICESDV = defaultValue; } - Utils.hideLoading(context); - setState(() {}); + Utils.hideLoading(context); + setState(() {}); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); @@ -228,11 +231,12 @@ class _DynamicInputScreenState extends State { ).paddingOnly(bottom: 12); } else if (model.fORMATTYPE == "X") { String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getEitDffStructureList![index].fieldAnswer ?? ""); + if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { if (displayText.contains(" 00:00:00")) { displayText = displayText.replaceAll(" 00:00:00", ""); } - if (!displayText.contains("-")) { + if (displayText.contains("/")) { displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); } } @@ -268,9 +272,12 @@ class _DynamicInputScreenState extends State { } getEitDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); - if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { calGetValueSetValues(model); } + if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + getDefaultValues(model); + } }, ).paddingOnly(bottom: 12); } else if (model.fORMATTYPE == "Y") { @@ -295,7 +302,12 @@ class _DynamicInputScreenState extends State { if (tempDate.contains("00:00:00")) { tempDate = tempDate.replaceAll("00:00:00", '').trim(); } - selectedDate = DateFormat("yyyy/MM/dd").parse(tempDate); + if(tempDate.contains("/")) { + selectedDate = DateFormat("yyyy/MM/dd").parse(tempDate); + } else { + selectedDate = DateFormat("yyyy-MM-dd").parse(tempDate); + } + } else { selectedDate = DateTime.parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); } @@ -320,10 +332,11 @@ class _DynamicInputScreenState extends State { getEitDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + calGetValueSetValues(model); + } if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { - if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { - calGetValueSetValues(model); - } else {} + getDefaultValues(model); } }, ).paddingOnly(bottom: 12); @@ -349,6 +362,9 @@ class _DynamicInputScreenState extends State { pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME); getEitDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + calGetValueSetValues(model); + } if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { getDefaultValues(model); } @@ -379,6 +395,9 @@ class _DynamicInputScreenState extends State { pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME); getEitDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + calGetValueSetValues(model); + } if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { getDefaultValues(model); } @@ -426,9 +445,12 @@ class _DynamicInputScreenState extends State { pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd hh:mm:ss').format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); getEitDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); - if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { calGetValueSetValues(model); } + if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + getDefaultValues(model); + } }, ).paddingOnly(bottom: 12); } else if (model.fORMATTYPE == "I") { @@ -453,9 +475,12 @@ class _DynamicInputScreenState extends State { ESERVICESDV eservicesdv = ESERVICESDV(pIDCOLUMNNAME: time, pRETURNMSG: "null", pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, pVALUECOLUMNNAME: time); getEitDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); - if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { calGetValueSetValues(model); } + if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + getDefaultValues(model); + } }, ).paddingOnly(bottom: 12); } diff --git a/lib/ui/my_attendance/my_attendance_screen.dart b/lib/ui/my_attendance/my_attendance_screen.dart index 2a337a3..276f2cc 100644 --- a/lib/ui/my_attendance/my_attendance_screen.dart +++ b/lib/ui/my_attendance/my_attendance_screen.dart @@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.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'; @@ -29,7 +30,7 @@ class MyAttendanceScreen extends StatelessWidget { width: double.infinity, height: double.infinity, child: list.isEmpty - ? LocaleKeys.noDataAvailable.tr().toText16().center + ? Utils.getNoDataWidget(context) : Column( children: [ itemView( diff --git a/lib/ui/payslip/monthly_pay_slip_screen.dart b/lib/ui/payslip/monthly_pay_slip_screen.dart new file mode 100644 index 0000000..13a7ee0 --- /dev/null +++ b/lib/ui/payslip/monthly_pay_slip_screen.dart @@ -0,0 +1,289 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/monthly_pay_slip_api_client.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +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/monthly_pay_slip/get_deductions_List_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_earnings_list_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_pay_slip_list_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_payment_information_list_model.dart'; +import 'package:mohem_flutter_app/models/monthly_pay_slip/get_summary_of_payment_list_model.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; + +class MonthlyPaySlipScreen extends StatefulWidget { + MonthlyPaySlipScreen({Key? key}) : super(key: key); + + @override + _MonthlyPaySlipScreenState createState() { + return _MonthlyPaySlipScreenState(); + } +} + +class _MonthlyPaySlipScreenState extends State { + List paySlipList = []; + List summaryOfPaymentList = []; + List paymentInformationList = []; + List deductionList = []; + List earningList = []; + int? selectedMonthIndex; + + @override + void initState() { + super.initState(); + getData(); + } + + void getData() async { + try { + Utils.showLoading(context); + paySlipList = await MonthlyPaySlipApiClient().getPaySlip(); + if (paySlipList.isNotEmpty) { + selectedMonthIndex = 0; + await getDataByActionContextID(paySlipList[selectedMonthIndex!].aCTIONCONTEXTID!); + } + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + Future getDataByActionContextID(int actionContextID, {bool showLoading = false}) async { + try { + if (showLoading) { + Utils.showLoading(context); + } + List results = await Future.wait([ + MonthlyPaySlipApiClient().getSummaryOfPayment(actionContextID), + MonthlyPaySlipApiClient().getPaymentInformation(actionContextID), + MonthlyPaySlipApiClient().getDeductions(actionContextID), + MonthlyPaySlipApiClient().getEarnings(actionContextID), + ]); + summaryOfPaymentList = results[0]; + paymentInformationList = results[1]; + deductionList = results[2]; + earningList = results[3]; + if (showLoading) { + Utils.hideLoading(context); + setState(() {}); + } + } catch (ex) { + if (showLoading) { + Utils.hideLoading(context); + } + Utils.handleException(ex, context, null); + } + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: LocaleKeys.monthlyPaySlip.tr(), + ), + body: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.month.tr().toText17(isBold: true, color: MyColors.darkIconColor), + if (selectedMonthIndex != null) + Row( + children: [ + DateFormat("MMMM-yyyy").format(DateFormat("MM/dd/yyyy").parse(paySlipList[selectedMonthIndex!].pAYMENTDATE!)).toText16(color: MyColors.greyACColor), + const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor), + ], + ).onPress(() async { + int tempIndex = selectedMonthIndex!; + showModalBottomSheet( + context: context, + builder: (cxt) { + return Container( + height: 200, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + LocaleKeys.ok.tr().toText16(color: MyColors.gradiantEndColor).paddingOnly(right: 21, top: 16).onPress(() { + if (selectedMonthIndex != tempIndex) { + selectedMonthIndex = tempIndex; + Navigator.pop(context); + getDataByActionContextID(paySlipList[selectedMonthIndex!].aCTIONCONTEXTID!, showLoading: true); + } + }), + CupertinoPicker( + itemExtent: 40, + onSelectedItemChanged: (index) { + tempIndex = index; + }, + children: [for (int i = 0; i < paySlipList.length; i++) paySlipList[i].pERIODNAME!.toText16().center]).expanded, + ], + ), + ); + }); + }) + ], + ).paddingOnly(left: 21, right: 21), + ListView( + padding: const EdgeInsets.all(21), + children: [ + if (summaryOfPaymentList.isNotEmpty) ...[paymentSummaryData(context)], + if (earningList.isNotEmpty) ...[18.height, earningData(context)], + if (deductionList.isNotEmpty) ...[18.height, deductionData(context)], + if (paymentInformationList.isNotEmpty) ...[12.height, paymentInformationData(context)] + ], + ).expanded, + ], + ), + ); + } + + Widget earningData(context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(LocaleKeys.particular.tr()), + Utils.tableColumnTitle(LocaleKeys.amount.tr()), + ], + ), + ); + for (int i = 0; i < earningList.length; i++) { + tableRow.add( + TableRow(children: [ + Utils.tableColumnValue('${earningList[i].eLEMENTNAME}', isLast: i == earningList.length - 1), + Utils.tableColumnValue('${earningList[i].aMOUNT}', isLast: i == earningList.length - 1), + ]), + ); + } + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.earnings.tr().toSectionHeading(), + 12.height, + Table( + columnWidths: const {0: FlexColumnWidth(1.5), 1: FlexColumnWidth(1.0)}, + children: tableRow, + ).objectContainerView(), + ], + ); + } + + Widget deductionData(context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(LocaleKeys.particular.tr()), + Utils.tableColumnTitle(LocaleKeys.amount.tr()), + ], + ), + ); + for (int i = 0; i < deductionList.length; i++) { + tableRow.add( + TableRow(children: [ + Utils.tableColumnValue('${deductionList[i].eLEMENTNAME}', isLast: i == deductionList.length - 1), + Utils.tableColumnValue('${deductionList[i].aMOUNT}', isLast: i == deductionList.length - 1), + ]), + ); + } + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.deductions.tr().toSectionHeading(), + 12.height, + Table( + columnWidths: const {0: FlexColumnWidth(1.5), 1: FlexColumnWidth(1.0)}, + children: tableRow, + ).objectContainerView(), + ], + ); + } + + Widget paymentSummaryData(context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(LocaleKeys.particular.tr()), + Utils.tableColumnTitle("%"), + Utils.tableColumnTitle(LocaleKeys.amount.tr()), + ], + ), + ); + + tableRow.add( + TableRow(children: [ + Utils.tableColumnValue(LocaleKeys.deductions.tr(), isLast: false), + Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALDEDUCTIONSPERCENTAGE}', isLast: false), + Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALDEDUCTIONSAMOUNT}', isLast: false), + ]), + ); + tableRow.add( + TableRow(children: [ + Utils.tableColumnValue(LocaleKeys.earnings.tr(), isLast: false), + Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALEARNINGSPERCENTAGE}', isLast: false), + Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALEARNINGSAMOUNT}', isLast: false), + ]), + ); + tableRow.add( + TableRow(children: [ + Utils.tableColumnValue(LocaleKeys.totalPayAmount.tr(), isLast: true), + Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALPAYPERCENTAGE}', isLast: true), + Utils.tableColumnValue('${summaryOfPaymentList[0].tOTALPAYAMOUNT}', isLast: true), + ]), + ); + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.summaryOfInformation.tr().toSectionHeading(), + 12.height, + Table( + columnWidths: const {0: FlexColumnWidth(2.0), 1: FlexColumnWidth(1.0), 2: FlexColumnWidth(1.0)}, + children: tableRow, + ).objectContainerView(), + ], + ); + } + + Widget paymentInformationData(context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.paymentInformation.tr().toSectionHeading(), + 12.height, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailView(LocaleKeys.paymentMethodName.tr(), paymentInformationList[0].pAYMENTMETHODNAME ?? ""), + ItemDetailView(LocaleKeys.bankName.tr(), paymentInformationList[0].bANKNAME ?? ""), + ItemDetailView(LocaleKeys.branchCode.tr(), paymentInformationList[0].bRANCHNAME ?? ""), + ItemDetailView(LocaleKeys.accountNo.tr(), paymentInformationList[0].aCCOUNTNUMBER ?? ""), + ItemDetailView(LocaleKeys.amount.tr(), paymentInformationList[0].aMOUNT ?? ""), + ], + ).objectContainerView(), + ], + ); + } +} diff --git a/lib/ui/screens/announcements/announcement_details.dart b/lib/ui/screens/announcements/announcement_details.dart index a3de742..9ff6c36 100644 --- a/lib/ui/screens/announcements/announcement_details.dart +++ b/lib/ui/screens/announcements/announcement_details.dart @@ -92,6 +92,8 @@ class _AnnouncementDetailsState extends State { try { Utils.showLoading(context); jsonResponse = await PendingTransactionsApiClient().getAnnouncements(itgAwarenessID, currentPageNo, itgRowID); + // todo '@haroon' move below post processing code to above method and get exact model which you need, + var jsonDecodedData = jsonDecode(jsonDecode(jsonResponse)['result']['data']); getAnnouncementDetailsObj = GetAnnouncementDetails.fromJson(jsonDecodedData[0]); Utils.hideLoading(context); diff --git a/lib/ui/screens/profile/profile_screen.dart b/lib/ui/screens/profile/profile_screen.dart index 76f8a20..89d4ba6 100644 --- a/lib/ui/screens/profile/profile_screen.dart +++ b/lib/ui/screens/profile/profile_screen.dart @@ -12,6 +12,7 @@ import 'package:mohem_flutter_app/ui/screens/profile/widgets/header.dart'; import 'package:mohem_flutter_app/ui/screens/profile/widgets/profile_panel.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; +// todo '@sultan' kindly follow structure of code written. use extension methods for widgets and dont hard code strings, use localizations class ProfileScreen extends StatefulWidget { const ProfileScreen({Key? key}) : super(key: key); diff --git a/lib/ui/screens/profile/widgets/profile_info.dart b/lib/ui/screens/profile/widgets/profile_info.dart index 6f30b7a..b777b8e 100644 --- a/lib/ui/screens/profile/widgets/profile_info.dart +++ b/lib/ui/screens/profile/widgets/profile_info.dart @@ -9,6 +9,8 @@ import 'package:mohem_flutter_app/models/profile_menu.model.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; +// todo '@sultan' kindly follow structure of code written. use extension methods for widgets, also format code + class ProfileInFo extends StatelessWidget { ProfileInFo(this.memberInfo); MemberInformationListModel memberInfo;