diff --git a/android/app/build.gradle b/android/app/build.gradle index 7792554..9cd8b0e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -44,7 +44,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "hmg.cloudSolutions.mohem" + applicationId "com.cloudSolutions.mohemmtest" minSdkVersion 21 targetSdkVersion 32 versionCode flutterVersionCode.toInteger() diff --git a/android/app/google-services.json b/android/app/google-services.json index 62fbaea..5befc36 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -10,7 +10,7 @@ "client_info": { "mobilesdk_app_id": "1:679409052782:android:dba155ac0859d7fea78a7f", "android_client_info": { - "package_name": "hmg.cloudSolutions.mohem" + "package_name": "com.cloudSolutions.mohemmtest" } }, "oauth_client": [ diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index cf0770b..dc2b5d5 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 4208732..ec30ecc 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/api/login_api_client.dart b/lib/api/login_api_client.dart index 3cdda6d..7da7754 100644 --- a/lib/api/login_api_client.dart +++ b/lib/api/login_api_client.dart @@ -91,7 +91,7 @@ class LoginApiClient { AppState().postParamsObject?.pSelectedEmployeeNumber = AppState().getUserName; AppState().postParamsObject?.setPLegislationCode = responseData.basicMemberInformation!.pLEGISLATIONCODE; AppState().postParamsObject?.setPayrollCodeStr = responseData.memberInformationList!.first.pAYROLLCODE; - + AppState().setBusinessCardPrivilege = responseData.businessCardPrivilege ?? false; return responseData; }, url, postParams); } diff --git a/lib/api/my_attendance_api_client.dart b/lib/api/my_attendance_api_client.dart index 9e58b9b..eb66a8b 100644 --- a/lib/api/my_attendance_api_client.dart +++ b/lib/api/my_attendance_api_client.dart @@ -37,7 +37,7 @@ class MyAttendanceApiClient { }, url, postParams); } - Future getValueSetValues(String pSegmentName, String pDescFlexContextCode, String pDescFlexName, List> list) async { + Future> getValueSetValues(String pSegmentName, String pDescFlexContextCode, String pDescFlexName, List> list) async { String url = "${ApiConsts.erpRest}GET_VALUE_SET_VALUES"; Map postParams = { "P_SELECTED_RESP_ID": -999, @@ -53,7 +53,7 @@ class MyAttendanceApiClient { postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - return responseData.getValueSetValuesList!.first; + return responseData.getValueSetValuesList ?? []; }, url, postParams); } diff --git a/lib/api/my_team/my_team_api_client.dart b/lib/api/my_team/my_team_api_client.dart index c5a78c6..17a0a90 100644 --- a/lib/api/my_team/my_team_api_client.dart +++ b/lib/api/my_team/my_team_api_client.dart @@ -1,5 +1,3 @@ - - 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'; @@ -19,7 +17,6 @@ class MyTeamApiClient { factory MyTeamApiClient() => _instance; - Future> getEmployeeSubordinates(String searchEmpEmail, String searchEmpName, String searchEmpNo) async { String url = "${ApiConsts.erpRest}GET_EMPLOYEE_SUBORDINATES"; Map postParams = { @@ -72,7 +69,6 @@ class MyTeamApiClient { }, url, postParams); } - Future getAttendanceTracking(String? empID) async { String url = "${ApiConsts.erpRest}GET_Attendance_Tracking"; Map postParams = {}; @@ -104,10 +100,7 @@ class MyTeamApiClient { Future> employeeSubordinatesRequest(String? empID) async { String url = "${ApiConsts.erpRest}GET_MENU_ENTRIES"; - Map postParams = { - "P_MENU_TYPE": "M", - "P_SELECTED_RESP_ID": -999, - }; + Map postParams = {"P_MENU_TYPE": "M", "P_SELECTED_RESP_ID": -999}; postParams.addAll(AppState().postParamsJson); postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; return await ApiClient().postJsonForObject((json) { @@ -118,8 +111,7 @@ class MyTeamApiClient { Future?> getFavoriteReplacement() async { String url = "${ApiConsts.erpRest}Mohemm_GetFavoriteReplacements"; - Map postParams = { - }; + Map postParams = {}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); @@ -138,7 +130,7 @@ class MyTeamApiClient { }; Map postParams = { "Mohemm_ChangeReplacementsInputList": [postParamsObj], - //postParams["Mohemm_ChangeReplacementsInputList"] = list; + //postParams["Mohemm_ChangeReplacementsInputList"] = list; }; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { @@ -151,7 +143,7 @@ class MyTeamApiClient { String url = "${ApiConsts.erpRest}GET_SUBORDINATES_LEAVES_TOTAL_VACATIONS"; Map postParams = { "P_DATE_FROM": dateFrom, - "P_DATE_TO": dateTo, + "P_DATE_TO": dateTo, }; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { @@ -160,4 +152,3 @@ class MyTeamApiClient { }, url, postParams); } } - 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/app_state/app_state.dart b/lib/app_state/app_state.dart index 9d9dc21..d7f6a9d 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -25,6 +25,12 @@ class AppState { bool? get getIsLogged => isLogged; + bool businessCardPrivilege = false; + + set setBusinessCardPrivilege(bool v) => businessCardPrivilege = v; + + bool? get getBusinessCardPrivilege => businessCardPrivilege; + String? forgetPasswordTokenID; set setForgetPasswordTokenID(token) => forgetPasswordTokenID = token; diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 7cb3e54..117011b 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": "اسم المستخدم", @@ -469,7 +469,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", diff --git a/lib/models/dashboard/get_accrual_balances_list_model.dart b/lib/models/dashboard/get_accrual_balances_list_model.dart index a53133e..e69c181 100644 --- a/lib/models/dashboard/get_accrual_balances_list_model.dart +++ b/lib/models/dashboard/get_accrual_balances_list_model.dart @@ -10,7 +10,7 @@ class GetAccrualBalancesList { }); double? accrualNetEntitlement; - int? accrualUsedEntitlement; + num? accrualUsedEntitlement; //Todo: Add function dynamic accrualYearlyEntitlement; String? accuralPlanName; String? endDate; 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/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 70b3ce0..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), + ); + }, + ), + ], + ), + ) + ], + ), ), ), ) @@ -424,9 +440,13 @@ class _DashboardScreenState extends State { selectedIconTheme: const IconThemeData(color: MyColors.grey3AColor, size: 28), unselectedIconTheme: const IconThemeData(color: MyColors.grey98Color, size: 28), onTap: (int index) { - // currentIndex = index; - // setState(() {}); - Navigator.pushNamed(context, AppRoutes.itemsForSale); + if (index == 1) { + Navigator.pushNamed(context, AppRoutes.mowadhafhi); + } else if (index == 2) { + Navigator.pushNamed(context, AppRoutes.workList); + } else if (index == 3) { + Navigator.pushNamed(context, AppRoutes.itemsForSale); + } }, ), ), diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index 523c1cc..ea6343b 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -16,7 +16,6 @@ import 'package:mohem_flutter_app/ui/dialogs/id/business_card_dialog.dart'; import 'package:mohem_flutter_app/ui/dialogs/id/employee_digital_id_dialog.dart'; import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart'; import 'package:provider/provider.dart'; -import 'package:shared_preferences/shared_preferences.dart'; class AppDrawer extends StatefulWidget { @override @@ -85,7 +84,8 @@ class _AppDrawerState extends State { }); }), menuItem("assets/images/drawer/employee_id.svg", LocaleKeys.employeeDigitalID.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: EmployeeDigitialIdDialog())), - menuItem("assets/images/drawer/view_business_card.svg", LocaleKeys.viewBusinessCard.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: BusinessCardDialog())), + if (AppState().businessCardPrivilege) + menuItem("assets/images/drawer/view_business_card.svg", LocaleKeys.viewBusinessCard.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: BusinessCardDialog())), menuItem("assets/images/drawer/logout.svg", LocaleKeys.logout.tr(), "", color: MyColors.redA3Color, closeDrawer: false, onPress: performLogout), // menuItem("assets/images/drawer/logout.svg", LocaleKeys.logout.tr(), "", color: MyColors.redA3Color, closeDrawer: false, onPress: () {Navigator.pushNamed(context, AppRoutes.survey,); ], @@ -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..7a6e976 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'; @@ -22,10 +23,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( @@ -73,9 +74,13 @@ 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) + RotatedBox( + quarterTurns: AppState().isArabic(context) ? 2:4, + child: SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4) + ), + ], ) ], diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 92a58db..ba90fbf 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -113,7 +113,7 @@ class _LoginScreenState extends State { } Utils.hideLoading(context); if (_autoLogin) { - Navigator.pushNamed(context, AppRoutes.verifyLastLogin, arguments: loginInfo); + Navigator.pushReplacementNamed(context, AppRoutes.verifyLastLogin, arguments: loginInfo); } else { Navigator.pushNamed(context, AppRoutes.verifyLogin, arguments: "$firebaseToken"); } diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index d4c874d..6dfaaae 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -20,6 +20,7 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/basic_member_information_model.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart'; +import 'package:mohem_flutter_app/ui/dialogs/id/business_card_dialog.dart'; import 'package:mohem_flutter_app/ui/dialogs/id/employee_digital_id_dialog.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart'; @@ -58,15 +59,23 @@ class _VerifyLastLoginScreenState extends State { Widget build(BuildContext context) { mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments as GetMobileLoginInfoListModel; String empName = AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!; - print("selectedFlag1: " + mobileLoginInfoListModel!.loginType.toString()); + return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, - // leading: IconButton( - // icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor), - // onPressed: () => Navigator.pop(context), - // ), - actions: [Center(child: "Employee Digital ID".toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {showMDialog(context, child: EmployeeDigitialIdDialog());})), 21.width], + automaticallyImplyLeading: false, + title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false) + ? 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(() { + showMDialog(context, child: EmployeeDigitialIdDialog()); + })), + 21.width + ], ), body: Column( children: [ @@ -224,7 +233,6 @@ class _VerifyLastLoginScreenState extends State { Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) { bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint))); - print("$_title:$isDisable"); return InkWell( onTap: isDisable ? null 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/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart index 4f6e527..17c5f7d 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -104,26 +104,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(); - ESERVICESVS 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(); - getEitDffStructureList![index].eSERVICESVS!.add(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.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(() {}); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); 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 af22703..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,45 +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: ListView( - physics: const BouncingScrollPhysics(), - 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/my_attendance/services_menu_list_screen.dart b/lib/ui/my_attendance/services_menu_list_screen.dart index eac127d..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); @@ -51,8 +52,10 @@ class ServicesMenuListScreen extends StatelessWidget { Navigator.pushNamed(context, AppRoutes.familyMembers); } return; + } else if (servicesMenuData.list[index].requestType == "ABSENCE") { + Navigator.pushNamed(context, AppRoutes.leaveBalance); + return; } - Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!)); }), separatorBuilder: (cxt, index) => 12.height, @@ -61,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/my_team/create_request.dart b/lib/ui/my_team/create_request.dart index 5044c22..a4c6c83 100644 --- a/lib/ui/my_team/create_request.dart +++ b/lib/ui/my_team/create_request.dart @@ -1,5 +1,3 @@ - -import 'dart:ui'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -12,32 +10,34 @@ 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/menu_entries.dart'; +import 'package:mohem_flutter_app/models/dashboard/menus.dart'; import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; -import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; +import 'package:mohem_flutter_app/ui/my_attendance/services_menu_list_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; class CreateRequest extends StatefulWidget { - const CreateRequest ({Key? key}) : super(key: key); + const CreateRequest({Key? key}) : super(key: key); @override _CreateRequestState createState() => _CreateRequestState(); } class _CreateRequestState extends State { - String searchEmpEmail =""; - String searchEmpName =""; + String searchEmpEmail = ""; + String searchEmpName = ""; String searchEmpNo = ""; String? empId; List getEmployeeSubordinatesList = []; + // late DashboardProviderModel data; List getMenuEntriesList = []; GetEmployeeSubordinatesList? getEmployeeSubordinates; + List? homeMenus; @override void initState() { super.initState(); - // data.fetchMenuEntries(); employeeSubRequest(); } @@ -46,6 +46,7 @@ class _CreateRequestState extends State { Utils.showLoading(context); getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString()); getMenuEntriesList = await MyTeamApiClient().employeeSubordinatesRequest(getEmployeeSubordinates?.eMPLOYEENUMBER); + homeMenus = parseMenus(getMenuEntriesList); Utils.hideLoading(context); setState(() {}); } catch (ex) { @@ -54,42 +55,65 @@ class _CreateRequestState extends State { } } + List parseMenus(List getMenuEntriesList) { + 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())); + } + } + return menus; + } + + void handleOnPress(context, Menus menu) { + if (menu.menuEntry.menuEntryType == "FUNCTION") { + if (menu.menuEntry.requestType == "EIT") { + Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menu.menuEntry.prompt!, menu.menuEntry.functionName!)); + } else {} + } else { + Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen, arguments: ServicesMenuListScreenParams(menu.menuEntry.prompt!, menu.menuEntiesList)); + } + return; + } + @override Widget build(BuildContext context) { getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; - print(getMenuEntriesList.length); + return Scaffold( backgroundColor: Colors.white, appBar: AppBarWidget( context, title: LocaleKeys.createRequest.tr(), ), - body: SizedBox( - width: double.infinity, - height: double.infinity, - child: getMenuEntriesList.isEmpty - ? Utils.getNoDataWidget(context) - : ListView.separated( - padding: const EdgeInsets.all(21), - itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", getMenuEntriesList[index].prompt!, index).onPress(() { - Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(getMenuEntriesList[index].prompt!, getMenuEntriesList[index].functionName!)); - }), - separatorBuilder: (cxt, index) => 12.height, - itemCount: getMenuEntriesList.length), - ), - + body: SizedBox( + width: double.infinity, + height: double.infinity, + child: homeMenus == null + ? const SizedBox() + : (homeMenus!.isEmpty + ? Utils.getNoDataWidget(context) + : ListView.separated( + padding: const EdgeInsets.all(21), + itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", homeMenus![index].menuEntry.prompt!, index).onPress(() { + handleOnPress(context, homeMenus![index]); + }), + separatorBuilder: (cxt, index) => 12.height, + itemCount: homeMenus!.length)), + ), ); } Widget itemView(String icon, String title, index) { - return getMenuEntriesList[index].parentMenuName !=""? Row( + return Row( children: [ - (title).toText16().expanded, 12.width, + (title).toText16().expanded, + 12.width, SvgPicture.asset( "assets/images/arrow_next.svg", color: MyColors.darkIconColor, ) ], - ).objectContainerView() : SizedBox(); + ).objectContainerView(); } } 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/profile/dynamic_screens/dynamic_input_address_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart index 815db77..5c54b6d 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart @@ -16,15 +16,10 @@ import 'package:mohem_flutter_app/models/dyanmic_forms/validate_eit_transaction_ import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; import 'package:mohem_flutter_app/models/get_employee_address_model.dart'; -import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; -import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; -import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart'; -import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; import 'package:mohem_flutter_app/models/profile/get_address_dff_structure_list.dart'; import 'package:mohem_flutter_app/models/profile/get_countries_list_model.dart'; import 'package:mohem_flutter_app/models/profile/submit_address_transaction.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'; @@ -60,6 +55,7 @@ class _DynamicInputScreenState extends State { String dESCFLEXCONTEXTCODE = ""; String countryCode = 'SA'; String effectiveDate = ''; + @override void initState() { super.initState(); @@ -116,10 +112,10 @@ class _DynamicInputScreenState extends State { sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME) .toJson()) .toList(); - ESERVICESVS genericResponseModel = await MyAttendanceApiClient().getValueSetValues(structureList.cHILDSEGMENTSVS!, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); + List genericResponseModel = await MyAttendanceApiClient().getValueSetValues(structureList.cHILDSEGMENTSVS!, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); int index = getAddressDffStructureList!.indexWhere((element) => element.sEGMENTNAME == structureList.cHILDSEGMENTSVS); - getAddressDffStructureList![index].eSERVICESVS!.add(genericResponseModel); + if (genericResponseModel.isNotEmpty) getAddressDffStructureList![index].eSERVICESVS!.addAll(genericResponseModel); // getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); Utils.hideLoading(context); @@ -325,8 +321,7 @@ class _DynamicInputScreenState extends State { ), ); } else { - DateTime? picked = - await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + 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; } 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 422d67b..923d3a8 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 @@ -8,7 +8,6 @@ import 'package:mohem_flutter_app/api/profile_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/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/dyanmic_forms/get_set_values_request_model.dart'; @@ -16,12 +15,10 @@ import 'package:mohem_flutter_app/models/dyanmic_forms/validate_eit_transaction_ import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; -import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; import 'package:mohem_flutter_app/models/profile/submit_basic_details_transaction_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'; @@ -55,6 +52,7 @@ class _DynamicInputScreenState extends State { DynamicProfileParams? dynamicParams; String dESCFLEXCONTEXTCODE = ""; + @override void initState() { super.initState(); @@ -102,12 +100,10 @@ class _DynamicInputScreenState extends State { sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME) .toJson()) .toList(); - ESERVICESVS genericResponseModel = await MyAttendanceApiClient().getValueSetValues(structureList.cHILDSEGMENTSVS!, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); + List genericResponseModel = await MyAttendanceApiClient().getValueSetValues(structureList.cHILDSEGMENTSVS!, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); int index = getBasicDetDffStructureList!.indexWhere((element) => element.sEGMENTNAME == structureList.cHILDSEGMENTSVS); - getBasicDetDffStructureList![index].eSERVICESVS!.add(genericResponseModel); - // getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; - //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); + if (genericResponseModel.isNotEmpty) getBasicDetDffStructureList![index].eSERVICESVS!.addAll(genericResponseModel); Utils.hideLoading(context); setState(() {}); } catch (ex) { @@ -336,8 +332,7 @@ class _DynamicInputScreenState extends State { ), ); } else { - DateTime? picked = - await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + 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; } 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/screens/items_for_sale/fragments/items_for_sale.dart b/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart index 89bf7ce..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)); }); @@ -167,7 +170,7 @@ class _ItemsForSaleFragmentState extends State { ), 10.height, getItemsForSaleList.title!.toText16(maxlines: 1), - getItemsForSaleList.description!.toText12(maxLine: 3, color: MyColors.grey57Color).expanded, + getItemsForSaleList.description!.toText12(maxLine: 2, color: MyColors.grey57Color).expanded, // 8.height, getItemsForSaleList.status!.toText14(color: getItemsForSaleList.status == 'Approved' ? MyColors.greenColor : MyColors.yellowColor), Row( @@ -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/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/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/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 diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index 454408e..e0c256c 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -11,8 +11,6 @@ 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'; @@ -20,7 +18,7 @@ import 'package:mohem_flutter_app/ui/work_list/itg_fragments/approval_level_frag 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); @@ -58,12 +56,11 @@ class _ItgDetailScreenState extends State { void getItgData() async { 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); @@ -341,34 +338,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); + 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); + } }, ), ); } - 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..dcdd580 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), + 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), + 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(); } @@ -292,10 +321,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 +403,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) + ), + ], ), ], diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index d2a0e0b..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( @@ -487,10 +476,13 @@ class _WorkListDetailScreenState extends State { "P_FORWARD_TO_USER_NAME": "", "P_NOTIFICATION_ID": workListData!.nOTIFICATIONID, "RespondAttributeList": [ - if (notificationNoteInput != null) {notificationNoteInput!.attributeName: note} + if (notificationNoteInput != null) + { + "ATTRIBUTE_NAME": notificationNoteInput!.attributeName, + if (notificationNoteInput!.attributeType == "number") "ATTRIBUTE_NUMBER_VALUE": note else if (notificationNoteInput!.attributeType == "VARCHAR2") "ATTRIBUTE_TEXT_VALUE": note + } ], }; - performNotificationAction(payload); }, ), 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/dialogs/accept_reject_input_dialog.dart b/lib/widgets/dialogs/accept_reject_input_dialog.dart index 479a47b..3b644b9 100644 --- a/lib/widgets/dialogs/accept_reject_input_dialog.dart +++ b/lib/widgets/dialogs/accept_reject_input_dialog.dart @@ -66,6 +66,7 @@ class AcceptRejectInputDialog extends StatelessWidget { notificationGetRespond!.attributeDisplayName!, TextEditingController(), isBackgroundEnable: true, + isInputTypeNum: notificationGetRespond!.attributeType == "number", lines: 3, onChange: (String note) { this.note = note; 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, + ], + ), + ], + ), + ), + ); + } +} 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(); }, 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: