diff --git a/README.md b/README.md index 8468efc..4dadb64 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,93 @@ # mohem_flutter_app -A new Flutter application. -## Getting Started -This project is a starting point for a Flutter application. +## Getting started -A few resources to get you started if this is your first Flutter project: +To make it easy for you to get started with GitLab, here's a list of recommended next steps. -- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) +Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! + +## Add your files + +- [ ] [Create](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files +- [ ] [Add files using the command line](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: + +``` +cd existing_repo +git remote add origin https://gitlab.com/mirza.shafique/mohem_flutter_app.git +git branch -M main +git push -uf origin main +``` + +## Integrate with your tools + +- [ ] [Set up project integrations](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://gitlab.com/mirza.shafique/mohem_flutter_app/-/settings/integrations) + +## Collaborate with your team + +- [ ] [Invite team members and collaborators](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/user/project/members/) +- [ ] [Create a new merge request](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) +- [ ] [Automatically close issues from merge requests](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) +- [ ] [Enable merge request approvals](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) +- [ ] [Automatically merge when pipeline succeeds](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) + +## Test and Deploy + +Use the built-in continuous integration in GitLab. + +- [ ] [Get started with GitLab CI/CD](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/ci/quick_start/index.html) +- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/user/application_security/sast/) +- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/topics/autodevops/requirements.html) +- [ ] [Use pull-based deployments for improved Kubernetes management](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/user/clusters/agent/) +- [ ] [Set up protected environments](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://docs.gitlab.com/ee/ci/environments/protected_environments.html) + +*** + +# Editing this README + +When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://gitlab.com/-/experiment/new_project_readme_content:9529efb8c774508b24431e4d43ca8b4e?https://www.makeareadme.com/) for this template. + +## Suggestions for a good README +Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. + +## Name +Choose a self-explaining name for your project. + +## Description +Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. + +## Badges +On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. + +## Visuals +Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. + +## Installation +Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. + +## Usage +Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. + +## Support +Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. + +## Roadmap +If you have ideas for releases in the future, it is a good idea to list them in the README. + +## Contributing +State if you are open to contributions and what your requirements are for accepting them. + +For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. + +You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. + +## Authors and acknowledgment +Show your appreciation to those who have contributed to the project. + +## License +For open source projects, say how it is licensed. + +## Project status +If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. diff --git a/assets/images/play.svg b/assets/images/play.svg new file mode 100644 index 0000000..1608b2e --- /dev/null +++ b/assets/images/play.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/thumb.svg b/assets/images/thumb.svg new file mode 100644 index 0000000..855ba71 --- /dev/null +++ b/assets/images/thumb.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index dcd184e..609aca9 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -7,6 +7,8 @@ import 'package:http/http.dart'; import 'package:http/io_client.dart'; import 'package:mohem_flutter_app/exceptions/api_exception.dart'; +import '../main.dart'; + typedef FactoryConstructor = U Function(dynamic); class APIError { @@ -75,6 +77,9 @@ class ApiClient { } var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes); try { + if (!kReleaseMode) { + logger.i("res: " + response.body); + } var jsonData = jsonDecode(response.body); if (jsonData["ErrorMessage"] == null) { return factoryConstructor(jsonData); diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart new file mode 100644 index 0000000..b98a777 --- /dev/null +++ b/lib/api/dashboard_api_client.dart @@ -0,0 +1,92 @@ +import 'dart:async'; + +import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/classes/consts.dart'; +import 'package:mohem_flutter_app/models/basic_member_information_model.dart'; +import 'package:mohem_flutter_app/models/check_mobile_app_version_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/member_login_list_model.dart'; + +import 'api_client.dart'; + +class DashbaordApiClient { + static final DashbaordApiClient _instance = DashbaordApiClient._internal(); + + DashbaordApiClient._internal(); + + factory DashbaordApiClient() => _instance; + + Future getAttendanceTracking() async { + String url = "${ApiConsts.erpRest}GET_Attendance_Tracking"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getAttendanceTrackingList; + }, url, postParams); + } + + Future getOpenNotifications() async { + String url = "${ApiConsts.erpRest}GET_OPEN_NOTIFICATIONS"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future getItgFormsPendingTask() async { + String url = "${ApiConsts.cocRest}ITGFormsPendingTasks"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + ItgFormsModel responseData = ItgFormsModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future getAccrualBalances() async { + String url = "${ApiConsts.erpRest}GET_ACCRUAL_BALANCES"; + Map postParams = {"P_EFFECTIVE_DATE": "1/30/2022"}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future getOpenMissingSwipes() async { + String url = "${ApiConsts.erpRest}GET_OPEN_MISSING_SWIPES"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + //Menus List + Future getListMenu() async { + String url = "${ApiConsts.erpRest}GET_MENU"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + //GET_MENU_ENTRIES + Future getGetMenuEntries() async { + String url = "${ApiConsts.erpRest}GET_MENU_ENTRIES"; + Map postParams = {"P_SELECTED_RESP_ID": -999,"P_MENU_TYPE":"E"}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } +} diff --git a/lib/api/login_api_client.dart b/lib/api/login_api_client.dart index 1c4376b..f69e317 100644 --- a/lib/api/login_api_client.dart +++ b/lib/api/login_api_client.dart @@ -82,7 +82,15 @@ class LoginApiClient { postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); + AppState().setLogged = true; AppState().postParamsObject?.setTokenID = responseData.tokenID; + AppState().postParamsObject?.mobileNumber = responseData.basicMemberInformation!.pMOBILENUMBER; + AppState().postParamsObject?.userName = AppState().getUserName; + AppState().postParamsObject?.pEmailAddress = responseData.basicMemberInformation!.pEMAILADDRESS; + AppState().postParamsObject?.pSessionId = responseData.pSESSIONID; + AppState().postParamsObject?.pUserName = AppState().getUserName; + AppState().postParamsObject?.pSelectedEmployeeNumber = AppState().getUserName; + return responseData; }, url, postParams); } diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index 1c7f5b0..50aff0a 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -11,6 +11,12 @@ class AppState { factory AppState() => _instance; + bool isLogged = false; + + set setLogged(v) => isLogged = v; + + bool? get getIsLogged => isLogged; + String? forgetPasswordTokenID; set setForgetPasswordTokenID(token) => forgetPasswordTokenID = token; @@ -21,7 +27,7 @@ class AppState { PostParamsModel? get postParamsObject => _postParams; - Map get postParamsJson => _postParams?.toJson() ?? {}; + Map get postParamsJson => isLogged ? (_postParams?.toJsonAfterLogin() ?? {}) : (_postParams?.toJson() ?? {}); void setPostParamsModel(PostParamsModel _postParams) { this._postParams = _postParams; @@ -29,11 +35,15 @@ class AppState { bool isArabic(context) => EasyLocalization.of(context)?.locale.languageCode == "ar"; - String? username; + String? _username; // todo ''sikander' added password for now, later will remove & improve String? password; - set setUserName(_username) => username = _username; + set setUserName(v) => _username = v; + + String? get getUserName => _username; + + set setUserPassword(_password) => password = _password; MemberLoginListModel? _memberLoginList; diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 8177750..a11edec 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -6,6 +6,7 @@ class ApiConsts { static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; static String erpRest = baseUrlServices + "ERP.svc/REST/"; static String user = baseUrlServices + "api/User/"; + static String cocRest = baseUrlServices + "COCWS.svc/REST/"; } class SharedPrefsConsts { diff --git a/lib/config/routes.dart b/lib/config/routes.dart index f0362d9..3eba985 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:mohem_flutter_app/ui/landing/dashboard.dart'; +import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart'; import 'package:mohem_flutter_app/ui/landing/today_attendance_screen.dart'; import 'package:mohem_flutter_app/ui/login/forgot_password_screen.dart'; import 'package:mohem_flutter_app/ui/login/login_screen.dart'; @@ -31,7 +31,7 @@ class AppRoutes { login: (context) => LoginScreen(), verifyLogin: (context) => VerifyLoginScreen(), verifyLastLogin: (context) => VerifyLastLoginScreen(), - dashboard: (context) => Dashboard(), + dashboard: (context) => DashboardScreen(), newPassword: (context) => NewPasswordScreen(), forgotPassword: (context) => ForgotPasswordScreen(), todayAttendance: (context) => TodayAttendanceScreen(), diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 9db4829..5d4f8cd 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -2,6 +2,14 @@ import 'package:flutter/cupertino.dart'; import 'package:intl/intl.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; +extension CapExtension on String { + String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; + String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; + String get allInCaps => this.toUpperCase(); + String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : ""; +} + + extension EmailValidator on String { Widget get toWidget => Text(this); diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index 787894d..130c867 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; +import 'package:shimmer/shimmer.dart'; extension WidgetExtensions on Widget { Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this); @@ -8,4 +9,23 @@ extension WidgetExtensions on Widget { Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) => Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this); + + Widget toShimmer({bool isShow=true}) =>isShow? Shimmer.fromColors( + baseColor: Color(0xffe8eff0), + highlightColor: Colors.white, + child: Container( + child: this, + color: Colors.white, + ), + ):Container(child: this,); + + Widget animatedSwither() => AnimatedSwitcher( + duration: const Duration(milliseconds: 500), + // transitionBuilder: (Widget child, Animation animation) { + // return ScaleTransition(scale: animation, child: child); + // }, + switchInCurve: Curves.linearToEaseOut, + switchOutCurve: Curves.linearToEaseOut, + child: this, + ); } diff --git a/lib/main.dart b/lib/main.dart index 7276ac0..49b0e35 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,10 +6,21 @@ import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/config/app_provider.dart'; import 'package:mohem_flutter_app/generated/codegen_loader.g.dart'; import 'package:mohem_flutter_app/models/post_params_model.dart'; +import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/theme/app_theme.dart'; +import 'package:provider/provider.dart'; import 'package:sizer/sizer.dart'; import 'package:firebase_core/firebase_core.dart'; import 'config/routes.dart'; +import 'package:logger/logger.dart'; + + +var logger = Logger( + // filter: null, // Use the default LogFilter (-> only log in debug mode) + printer: PrettyPrinter(lineLength: 0), // Use the PrettyPrinter to format and print log + // output: null, // U +); + Future main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -23,7 +34,12 @@ Future main() async { ], path: 'assets/langs', assetLoader: CodegenLoader(), - child: MyApp(), + child: MultiProvider( + providers: [ + ChangeNotifierProvider(create: (_) => DashboardProviderModel()), + ], + child: MyApp(), + ), ), ); } diff --git a/lib/models/dashboard/get_accrual_balances_list_model.dart b/lib/models/dashboard/get_accrual_balances_list_model.dart new file mode 100644 index 0000000..a53133e --- /dev/null +++ b/lib/models/dashboard/get_accrual_balances_list_model.dart @@ -0,0 +1,39 @@ +class GetAccrualBalancesList { + GetAccrualBalancesList({ + this.accrualNetEntitlement, + this.accrualUsedEntitlement, + this.accrualYearlyEntitlement, + this.accuralPlanName, + this.endDate, + this.lastAccrualDate, + this.startDate, + }); + + double? accrualNetEntitlement; + int? accrualUsedEntitlement; + dynamic accrualYearlyEntitlement; + String? accuralPlanName; + String? endDate; + String? lastAccrualDate; + String? startDate; + + factory GetAccrualBalancesList.fromJson(Map json) => GetAccrualBalancesList( + accrualNetEntitlement: json["ACCRUAL_NET_ENTITLEMENT"] == null ? null : json["ACCRUAL_NET_ENTITLEMENT"].toDouble(), + accrualUsedEntitlement: json["ACCRUAL_USED_ENTITLEMENT"] == null ? null : json["ACCRUAL_USED_ENTITLEMENT"], + accrualYearlyEntitlement: json["ACCRUAL_YEARLY_ENTITLEMENT"], + accuralPlanName: json["ACCURAL_PLAN_NAME"] == null ? null : json["ACCURAL_PLAN_NAME"], + endDate: json["END_DATE"] == null ? null : json["END_DATE"], + lastAccrualDate: json["LAST_ACCRUAL_DATE"] == null ? null : json["LAST_ACCRUAL_DATE"], + startDate: json["START_DATE"] == null ? null : json["START_DATE"], + ); + + Map toJson() => { + "ACCRUAL_NET_ENTITLEMENT": accrualNetEntitlement == null ? null : accrualNetEntitlement, + "ACCRUAL_USED_ENTITLEMENT": accrualUsedEntitlement == null ? null : accrualUsedEntitlement, + "ACCRUAL_YEARLY_ENTITLEMENT": accrualYearlyEntitlement, + "ACCURAL_PLAN_NAME": accuralPlanName == null ? null : accuralPlanName, + "END_DATE": endDate == null ? null : endDate, + "LAST_ACCRUAL_DATE": lastAccrualDate == null ? null : lastAccrualDate, + "START_DATE": startDate == null ? null : startDate, + }; +} diff --git a/lib/models/dashboard/get_attendance_tracking_list_model.dart b/lib/models/dashboard/get_attendance_tracking_list_model.dart new file mode 100644 index 0000000..fb415b0 --- /dev/null +++ b/lib/models/dashboard/get_attendance_tracking_list_model.dart @@ -0,0 +1,55 @@ +class GetAttendanceTracking { + GetAttendanceTracking({ + this.pBreakHours, + this.pLateInHours, + this.pRemainingHours, + this.pReturnMsg, + this.pReturnStatus, + this.pScheduledHours, + this.pShtName, + this.pSpentHours, + this.pSwipesExemptedFlag, + this.pSwipeIn, + this.pSwipeOut, + }); + + String? pBreakHours; + String? pLateInHours; + String? pRemainingHours; + String? pReturnMsg; + String? pReturnStatus; + String? pScheduledHours; + String? pShtName; + String? pSpentHours; + String? pSwipesExemptedFlag; + dynamic pSwipeIn; + dynamic pSwipeOut; + + factory GetAttendanceTracking.fromMap(Map json) => GetAttendanceTracking( + pBreakHours: json["P_BREAK_HOURS"] == null ? null : json["P_BREAK_HOURS"], + pLateInHours: json["P_LATE_IN_HOURS"] == null ? null : json["P_LATE_IN_HOURS"], + pRemainingHours: json["P_REMAINING_HOURS"] == null ? null : json["P_REMAINING_HOURS"], + pReturnMsg: json["P_RETURN_MSG"] == null ? null : json["P_RETURN_MSG"], + pReturnStatus: json["P_RETURN_STATUS"] == null ? null : json["P_RETURN_STATUS"], + pScheduledHours: json["P_SCHEDULED_HOURS"] == null ? null : json["P_SCHEDULED_HOURS"], + pShtName: json["P_SHT_NAME"] == null ? null : json["P_SHT_NAME"], + pSpentHours: json["P_SPENT_HOURS"] == null ? null : json["P_SPENT_HOURS"], + pSwipesExemptedFlag: json["P_SWIPES_EXEMPTED_FLAG"] == null ? null : json["P_SWIPES_EXEMPTED_FLAG"], + pSwipeIn: json["P_SWIPE_IN"], + pSwipeOut: json["P_SWIPE_OUT"], + ); + + Map toMap() => { + "P_BREAK_HOURS": pBreakHours == null ? null : pBreakHours, + "P_LATE_IN_HOURS": pLateInHours == null ? null : pLateInHours, + "P_REMAINING_HOURS": pRemainingHours == null ? null : pRemainingHours, + "P_RETURN_MSG": pReturnMsg == null ? null : pReturnMsg, + "P_RETURN_STATUS": pReturnStatus == null ? null : pReturnStatus, + "P_SCHEDULED_HOURS": pScheduledHours == null ? null : pScheduledHours, + "P_SHT_NAME": pShtName == null ? null : pShtName, + "P_SPENT_HOURS": pSpentHours == null ? null : pSpentHours, + "P_SWIPES_EXEMPTED_FLAG": pSwipesExemptedFlag == null ? null : pSwipesExemptedFlag, + "P_SWIPE_IN": pSwipeIn, + "P_SWIPE_OUT": pSwipeOut, + }; +} diff --git a/lib/models/dashboard/get_open_missing_swipes_list_model.dart b/lib/models/dashboard/get_open_missing_swipes_list_model.dart new file mode 100644 index 0000000..86ac6a9 --- /dev/null +++ b/lib/models/dashboard/get_open_missing_swipes_list_model.dart @@ -0,0 +1,24 @@ + +class GetOpenMissingSwipesList { + GetOpenMissingSwipesList({ + this.pOpenMissingSwipes, + this.pReturnMsg, + this.pReturnStatus, + }); + + int? pOpenMissingSwipes; + String? pReturnMsg; + String? pReturnStatus; + + factory GetOpenMissingSwipesList.fromJson(Map json) => GetOpenMissingSwipesList( + pOpenMissingSwipes: json["P_OPEN_MISSING_SWIPES"] == null ? null : json["P_OPEN_MISSING_SWIPES"], + pReturnMsg: json["P_RETURN_MSG"] == null ? null : json["P_RETURN_MSG"], + pReturnStatus: json["P_RETURN_STATUS"] == null ? null : json["P_RETURN_STATUS"], + ); + + Map toJson() => { + "P_OPEN_MISSING_SWIPES": pOpenMissingSwipes == null ? null : pOpenMissingSwipes, + "P_RETURN_MSG": pReturnMsg == null ? null : pReturnMsg, + "P_RETURN_STATUS": pReturnStatus == null ? null : pReturnStatus, + }; +} diff --git a/lib/models/dashboard/get_open_notifications_list.dart b/lib/models/dashboard/get_open_notifications_list.dart new file mode 100644 index 0000000..854b62a --- /dev/null +++ b/lib/models/dashboard/get_open_notifications_list.dart @@ -0,0 +1,23 @@ +class GetOpenNotificationsList { + GetOpenNotificationsList({ + this.itemType, + this.itemTypeDisplayName, + this.openNtfNumber, + }); + + String? itemType; + String? itemTypeDisplayName; + int? openNtfNumber; + + factory GetOpenNotificationsList.fromMap(Map json) => GetOpenNotificationsList( + itemType: json["ITEM_TYPE"] == null ? null : json["ITEM_TYPE"], + itemTypeDisplayName: json["ITEM_TYPE_DISPLAY_NAME"] == null ? null : json["ITEM_TYPE_DISPLAY_NAME"], + openNtfNumber: json["OPEN_NTF_NUMBER"] == null ? null : json["OPEN_NTF_NUMBER"], + ); + + Map toMap() => { + "ITEM_TYPE": itemType == null ? null : itemType, + "ITEM_TYPE_DISPLAY_NAME": itemTypeDisplayName == null ? null : itemTypeDisplayName, + "OPEN_NTF_NUMBER": openNtfNumber == null ? null : openNtfNumber, + }; +} diff --git a/lib/models/dashboard/itg_forms_model.dart b/lib/models/dashboard/itg_forms_model.dart new file mode 100644 index 0000000..c5a0145 --- /dev/null +++ b/lib/models/dashboard/itg_forms_model.dart @@ -0,0 +1,189 @@ +// To parse this JSON data, do +// +// final itgFormsModel = itgFormsModelFromMap(jsonString); + +import 'dart:convert'; + +ItgFormsModel itgFormsModelFromMap(String str) => ItgFormsModel.fromJson(json.decode(str)); + +String itgFormsModelToMap(ItgFormsModel data) => json.encode(data.toMap()); + +class ItgFormsModel { + ItgFormsModel({ + this.date, + this.languageId, + this.serviceName, + this.time, + this.androidLink, + this.authenticationTokenId, + this.data, + this.dataw, + this.dietType, + this.dietTypeId, + this.errorCode, + this.errorEndUserMessage, + this.errorEndUserMessageN, + this.errorMessage, + this.errorType, + this.foodCategory, + this.iosLink, + this.isAuthenticated, + this.mealOrderStatus, + this.mealType, + this.messageStatus, + this.numberOfResultRecords, + this.patientBlodType, + this.successMsg, + this.successMsgN, + this.vidaUpdatedResponse, + this.itgRequest, + this.itgFormAttachmentsList, + this.message, + this.mohemmItgDepartmentSectionsList, + this.mohemmItgProjectDepartmentsList, + this.mohemmItgResponseItem, + this.mohemmItgSectionTopicsList, + this.mohemmItgTicketDetailsList, + this.mohemmItgTicketTransactionsList, + this.mohemmItgTicketsByEmployeeList, + this.mohemmItgProjectsList, + this.mohemmItgTicketTypesList, + this.referenceNumber, + this.requestType, + this.totalCount, + this.statuseCode, + }); + + dynamic date; + int? languageId; + int? serviceName; + dynamic time; + dynamic androidLink; + dynamic authenticationTokenId; + dynamic data; + bool? dataw; + int? dietType; + int? dietTypeId; + dynamic errorCode; + dynamic errorEndUserMessage; + dynamic errorEndUserMessageN; + dynamic errorMessage; + int? errorType; + int? foodCategory; + dynamic iosLink; + bool? isAuthenticated; + int? mealOrderStatus; + int? mealType; + int? messageStatus; + int? numberOfResultRecords; + dynamic patientBlodType; + String? successMsg; + dynamic successMsgN; + dynamic vidaUpdatedResponse; + dynamic itgRequest; + dynamic itgFormAttachmentsList; + String? message; + dynamic mohemmItgDepartmentSectionsList; + dynamic mohemmItgProjectDepartmentsList; + dynamic mohemmItgResponseItem; + dynamic mohemmItgSectionTopicsList; + dynamic mohemmItgTicketDetailsList; + dynamic mohemmItgTicketTransactionsList; + dynamic mohemmItgTicketsByEmployeeList; + dynamic mohemmItgProjectsList; + dynamic mohemmItgTicketTypesList; + DateTime? referenceNumber; + dynamic requestType; + int? totalCount; + int? statuseCode; + + factory ItgFormsModel.fromJson(Map json) => ItgFormsModel( + date: json["Date"], + languageId: json["LanguageID"] == null ? null : json["LanguageID"], + serviceName: json["ServiceName"] == null ? null : json["ServiceName"], + time: json["Time"], + androidLink: json["AndroidLink"], + authenticationTokenId: json["AuthenticationTokenID"], + data: json["Data"], + dataw: json["Dataw"] == null ? null : json["Dataw"], + dietType: json["DietType"] == null ? null : json["DietType"], + dietTypeId: json["DietTypeID"] == null ? null : json["DietTypeID"], + errorCode: json["ErrorCode"], + errorEndUserMessage: json["ErrorEndUserMessage"], + errorEndUserMessageN: json["ErrorEndUserMessageN"], + errorMessage: json["ErrorMessage"], + errorType: json["ErrorType"] == null ? null : json["ErrorType"], + foodCategory: json["FoodCategory"] == null ? null : json["FoodCategory"], + iosLink: json["IOSLink"], + isAuthenticated: json["IsAuthenticated"] == null ? null : json["IsAuthenticated"], + mealOrderStatus: json["MealOrderStatus"] == null ? null : json["MealOrderStatus"], + mealType: json["MealType"] == null ? null : json["MealType"], + messageStatus: json["MessageStatus"] == null ? null : json["MessageStatus"], + numberOfResultRecords: json["NumberOfResultRecords"] == null ? null : json["NumberOfResultRecords"], + patientBlodType: json["PatientBlodType"], + successMsg: json["SuccessMsg"] == null ? null : json["SuccessMsg"], + successMsgN: json["SuccessMsgN"], + vidaUpdatedResponse: json["VidaUpdatedResponse"], + itgRequest: json["ITGRequest"], + itgFormAttachmentsList: json["Itg_FormAttachmentsList"], + message: json["Message"] == null ? null : json["Message"], + mohemmItgDepartmentSectionsList: json["Mohemm_ITG_DepartmentSectionsList"], + mohemmItgProjectDepartmentsList: json["Mohemm_ITG_ProjectDepartmentsList"], + mohemmItgResponseItem: json["Mohemm_ITG_ResponseItem"], + mohemmItgSectionTopicsList: json["Mohemm_ITG_SectionTopicsList"], + mohemmItgTicketDetailsList: json["Mohemm_ITG_TicketDetailsList"], + mohemmItgTicketTransactionsList: json["Mohemm_ITG_TicketTransactionsList"], + mohemmItgTicketsByEmployeeList: json["Mohemm_ITG_TicketsByEmployeeList"], + mohemmItgProjectsList: json["Mohemm_Itg_ProjectsList"], + mohemmItgTicketTypesList: json["Mohemm_Itg_TicketTypesList"], + referenceNumber: json["ReferenceNumber"] == null ? null : DateTime.parse(json["ReferenceNumber"]), + requestType: json["RequestType"], + totalCount: json["TotalCount"] == null ? null : json["TotalCount"], + statuseCode: json["statuseCode"] == null ? null : json["statuseCode"], + ); + + Map toMap() => { + "Date": date, + "LanguageID": languageId == null ? null : languageId, + "ServiceName": serviceName == null ? null : serviceName, + "Time": time, + "AndroidLink": androidLink, + "AuthenticationTokenID": authenticationTokenId, + "Data": data, + "Dataw": dataw == null ? null : dataw, + "DietType": dietType == null ? null : dietType, + "DietTypeID": dietTypeId == null ? null : dietTypeId, + "ErrorCode": errorCode, + "ErrorEndUserMessage": errorEndUserMessage, + "ErrorEndUserMessageN": errorEndUserMessageN, + "ErrorMessage": errorMessage, + "ErrorType": errorType == null ? null : errorType, + "FoodCategory": foodCategory == null ? null : foodCategory, + "IOSLink": iosLink, + "IsAuthenticated": isAuthenticated == null ? null : isAuthenticated, + "MealOrderStatus": mealOrderStatus == null ? null : mealOrderStatus, + "MealType": mealType == null ? null : mealType, + "MessageStatus": messageStatus == null ? null : messageStatus, + "NumberOfResultRecords": numberOfResultRecords == null ? null : numberOfResultRecords, + "PatientBlodType": patientBlodType, + "SuccessMsg": successMsg == null ? null : successMsg, + "SuccessMsgN": successMsgN, + "VidaUpdatedResponse": vidaUpdatedResponse, + "ITGRequest": itgRequest, + "Itg_FormAttachmentsList": itgFormAttachmentsList, + "Message": message == null ? null : message, + "Mohemm_ITG_DepartmentSectionsList": mohemmItgDepartmentSectionsList, + "Mohemm_ITG_ProjectDepartmentsList": mohemmItgProjectDepartmentsList, + "Mohemm_ITG_ResponseItem": mohemmItgResponseItem, + "Mohemm_ITG_SectionTopicsList": mohemmItgSectionTopicsList, + "Mohemm_ITG_TicketDetailsList": mohemmItgTicketDetailsList, + "Mohemm_ITG_TicketTransactionsList": mohemmItgTicketTransactionsList, + "Mohemm_ITG_TicketsByEmployeeList": mohemmItgTicketsByEmployeeList, + "Mohemm_Itg_ProjectsList": mohemmItgProjectsList, + "Mohemm_Itg_TicketTypesList": mohemmItgTicketTypesList, + "ReferenceNumber": referenceNumber == null ? null : referenceNumber!.toIso8601String(), + "RequestType": requestType, + "TotalCount": totalCount == null ? null : totalCount, + "statuseCode": statuseCode == null ? null : statuseCode, + }; +} diff --git a/lib/models/dashboard/list_menu.dart b/lib/models/dashboard/list_menu.dart new file mode 100644 index 0000000..ba327c2 --- /dev/null +++ b/lib/models/dashboard/list_menu.dart @@ -0,0 +1,39 @@ +class ListMenu { + ListMenu({ + this.menuId, + this.menuName, + this.menuType, + this.requestGroupId, + this.requestGroupName, + this.respId, + this.subMenuName, + }); + + int? menuId; + String? menuName; + String? menuType; + int? requestGroupId; + String? requestGroupName; + dynamic? respId; + String? subMenuName; + + factory ListMenu.fromJson(Map json) => ListMenu( + menuId: json["MENU_ID"] == null ? null : json["MENU_ID"], + menuName: json["MENU_NAME"] == null ? null : json["MENU_NAME"], + menuType: json["MENU_TYPE"] == null ? null : json["MENU_TYPE"], + requestGroupId: json["REQUEST_GROUP_ID"] == null ? null : json["REQUEST_GROUP_ID"], + requestGroupName: json["REQUEST_GROUP_NAME"] == null ? null : json["REQUEST_GROUP_NAME"], + respId: json["RESP_ID"], + subMenuName: json["SUB_MENU_NAME"] == null ? null : json["SUB_MENU_NAME"], + ); + + Map toJson() => { + "MENU_ID": menuId == null ? null : menuId, + "MENU_NAME": menuName == null ? null : menuName, + "MENU_TYPE": menuType == null ? null : menuType, + "REQUEST_GROUP_ID": requestGroupId == null ? null : requestGroupId, + "REQUEST_GROUP_NAME": requestGroupName == null ? null : requestGroupName, + "RESP_ID": respId, + "SUB_MENU_NAME": subMenuName == null ? null : subMenuName, + }; +} diff --git a/lib/models/dashboard/menu_entries.dart b/lib/models/dashboard/menu_entries.dart new file mode 100644 index 0000000..7678ad8 --- /dev/null +++ b/lib/models/dashboard/menu_entries.dart @@ -0,0 +1,60 @@ +class GetMenuEntriesList { + GetMenuEntriesList({ + this.addButton, + this.deleteButton, + this.entrySequence, + this.functionName, + this.icon, + this.lvl, + this.menuEntryType, + this.menuName, + this.parentMenuName, + this.prompt, + this.requestType, + this.updateButton, + }); + + String? addButton; + String? deleteButton; + int? entrySequence; + String? functionName; + String? icon; + int? lvl; + String? menuEntryType; + String? menuName; + String? parentMenuName; + String? prompt; + String? requestType; + String? updateButton; + + factory GetMenuEntriesList.fromJson(Map json) => GetMenuEntriesList( + addButton: json["ADD_BUTTON"] == null ? null : json["ADD_BUTTON"], + deleteButton: json["DELETE_BUTTON"] == null ? null : json["DELETE_BUTTON"], + entrySequence: json["ENTRY_SEQUENCE"] == null ? null : json["ENTRY_SEQUENCE"], + functionName: json["FUNCTION_NAME"] == null ? null : json["FUNCTION_NAME"], + icon: json["ICON"] == null ? null : json["ICON"], + lvl: json["LVL"] == null ? null : json["LVL"], + menuEntryType: json["MENU_ENTRY_TYPE"] == null ? null : json["MENU_ENTRY_TYPE"], + menuName: json["MENU_NAME"] == null ? null : json["MENU_NAME"], + parentMenuName: json["PARENT_MENU_NAME"] == null ? null : json["PARENT_MENU_NAME"], + prompt: json["PROMPT"] == null ? null : json["PROMPT"], + requestType: json["REQUEST_TYPE"] == null ? null : json["REQUEST_TYPE"], + updateButton: json["UPDATE_BUTTON"] == null ? null :json["UPDATE_BUTTON"], + ); + + Map toJson() => { + "ADD_BUTTON": addButton == null ? null :addButton, + "DELETE_BUTTON": deleteButton == null ? null : deleteButton, + "ENTRY_SEQUENCE": entrySequence == null ? null : entrySequence, + "FUNCTION_NAME": functionName == null ? null : functionName, + "ICON": icon == null ? null : icon, + "LVL": lvl == null ? null : lvl, + "MENU_ENTRY_TYPE": menuEntryType == null ? null : menuEntryType, + "MENU_NAME": menuName == null ? null : menuName, + "PARENT_MENU_NAME": parentMenuName == null ? null : parentMenuName, + "PROMPT": prompt == null ? null : prompt, + "REQUEST_TYPE": requestType == null ? null : requestType, + "UPDATE_BUTTON": updateButton == null ? null : updateButton, + }; +} + diff --git a/lib/models/dashboard/menus.dart b/lib/models/dashboard/menus.dart new file mode 100644 index 0000000..7b88a33 --- /dev/null +++ b/lib/models/dashboard/menus.dart @@ -0,0 +1,10 @@ +import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; + +class Menus { + GetMenuEntriesList menuEntry; + List menuEntiesList; + + Menus(this.menuEntry, this.menuEntiesList); + + +} diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 8e60858..a9781d1 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -2,6 +2,12 @@ import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'basic_member_information_model.dart'; import 'get_mobile_login_info_list_model.dart'; +import 'dashboard/get_accrual_balances_list_model.dart'; +import 'dashboard/get_attendance_tracking_list_model.dart'; +import 'dashboard/get_open_missing_swipes_list_model.dart'; +import 'dashboard/get_open_notifications_list.dart'; +import 'dashboard/list_menu.dart'; +import 'dashboard/menu_entries.dart'; import 'member_information_list_model.dart'; import 'privilege_list_model.dart'; @@ -58,13 +64,13 @@ class GenericResponseModel { List? getAbsenceCollectionNotificationBodyList; List? getAbsenceDffStructureList; List? getAbsenceTransactionList; - List? getAccrualBalancesList; + List? getAccrualBalancesList; List? getActionHistoryList; List? getAddressDffStructureList; List? getAddressNotificationBodyList; List? getApprovesList; List? getAttachementList; - List? getAttendanceTrackingList; + GetAttendanceTracking? getAttendanceTrackingList; List? getBasicDetColsStructureList; List? getBasicDetDffStructureList; List? getBasicDetNtfBodyList; @@ -100,14 +106,14 @@ class GenericResponseModel { List? getItemTypeNotificationsList; List? getItemTypesList; List? getLookupValuesList; - List? getMenuEntriesList; + List? getMenuEntriesList; List? getMoItemHistoryList; List? getMoNotificationBodyList; List? getNotificationButtonsList; List? getNotificationReassignModeList; List? getObjectValuesList; - List? getOpenMissingSwipesList; - List? getOpenNotificationsList; + GetOpenMissingSwipesList? getOpenMissingSwipesList; + List? getOpenNotificationsList; List? getOpenNotificationsNumList; List? getOpenPeriodDatesList; List? getOrganizationsSalariesList; @@ -166,7 +172,7 @@ class GenericResponseModel { String? listItemImagesDetails; String? listItemMaster; String? listMedicineDetails; - String? listMenu; + List? listMenu; String? listNewEmployees; String? listRadScreen; String? logInTokenID; @@ -195,7 +201,7 @@ class GenericResponseModel { String? pINFORMATION; int? pMBLID; String? pNUMOFSUBORDINATES; - String? pOPENNTFNUMBER; + int? pOPENNTFNUMBER; String? pQUESTION; int? pSESSIONID; String? pSchema; @@ -564,13 +570,13 @@ class GenericResponseModel { getAbsenceCollectionNotificationBodyList = json['GetAbsenceCollectionNotificationBodyList']; getAbsenceDffStructureList = json['GetAbsenceDffStructureList']; getAbsenceTransactionList = json['GetAbsenceTransactionList']; - getAccrualBalancesList = json['GetAccrualBalancesList']; + getAccrualBalancesList = json["GetAccrualBalancesList"] == null ? null : List.from(json["GetAccrualBalancesList"].map((x) => GetAccrualBalancesList.fromJson(x))); getActionHistoryList = json['GetActionHistoryList']; getAddressDffStructureList = json['GetAddressDffStructureList']; getAddressNotificationBodyList = json['GetAddressNotificationBodyList']; getApprovesList = json['GetApprovesList']; getAttachementList = json['GetAttachementList']; - getAttendanceTrackingList = json['GetAttendanceTrackingList']; + getAttendanceTrackingList = json["GetAttendanceTrackingList"] == null ? null : GetAttendanceTracking.fromMap(json["GetAttendanceTrackingList"]); getBasicDetColsStructureList = json['GetBasicDetColsStructureList']; getBasicDetDffStructureList = json['GetBasicDetDffStructureList']; getBasicDetNtfBodyList = json['GetBasicDetNtfBodyList']; @@ -606,14 +612,14 @@ class GenericResponseModel { getItemTypeNotificationsList = json['GetItemTypeNotificationsList']; getItemTypesList = json['GetItemTypesList']; getLookupValuesList = json['GetLookupValuesList']; - getMenuEntriesList = json['GetMenuEntriesList']; + getMenuEntriesList= json["GetMenuEntriesList"] == null ? null : List.from(json["GetMenuEntriesList"].map((x) => GetMenuEntriesList.fromJson(x))); getMoItemHistoryList = json['GetMoItemHistoryList']; getMoNotificationBodyList = json['GetMoNotificationBodyList']; getNotificationButtonsList = json['GetNotificationButtonsList']; getNotificationReassignModeList = json['GetNotificationReassignModeList']; getObjectValuesList = json['GetObjectValuesList']; - getOpenMissingSwipesList = json['GetOpenMissingSwipesList']; - getOpenNotificationsList = json['GetOpenNotificationsList']; + getOpenMissingSwipesList = json["GetOpenMissingSwipesList"] == null ? null : GetOpenMissingSwipesList.fromJson(json["GetOpenMissingSwipesList"]); + getOpenNotificationsList = json["GetOpenNotificationsList"] == null ? null : List.from(json["GetOpenNotificationsList"].map((x) => GetOpenNotificationsList.fromMap(x))); getOpenNotificationsNumList = json['GetOpenNotificationsNumList']; getOpenPeriodDatesList = json['GetOpenPeriodDatesList']; getOrganizationsSalariesList = json['GetOrganizationsSalariesList']; @@ -672,7 +678,7 @@ class GenericResponseModel { listItemImagesDetails = json['List_ItemImagesDetails']; listItemMaster = json['List_ItemMaster']; listMedicineDetails = json['List_MedicineDetails']; - listMenu = json['List_Menu']; + listMenu = json["List_Menu"] == null ? null : List.from(json["List_Menu"].map((x) => ListMenu.fromJson(x))); listNewEmployees = json['List_NewEmployees']; listRadScreen = json['List_RadScreen']; logInTokenID = json['LogInTokenID']; diff --git a/lib/models/post_params_model.dart b/lib/models/post_params_model.dart index cd6dd72..1ab86f7 100644 --- a/lib/models/post_params_model.dart +++ b/lib/models/post_params_model.dart @@ -5,8 +5,27 @@ class PostParamsModel { String? mobileType; String? logInTokenID; String? tokenID; + String? mobileNumber; + String? pEmailAddress; + String? pUserName; + String? pSelectedEmployeeNumber; + int? pSessionId; + String? userName; - PostParamsModel({this.versionID, this.channel, this.languageID, this.mobileType, this.logInTokenID, this.tokenID}); + PostParamsModel({ + this.versionID, + this.channel, + this.languageID, + this.mobileType, + this.logInTokenID, + this.tokenID, + this.mobileNumber, + this.userName, + this.pEmailAddress, + this.pSessionId, + this.pUserName, + this.pSelectedEmployeeNumber, + }); PostParamsModel.fromJson(Map json) { versionID = json['VersionID']; @@ -28,7 +47,37 @@ class PostParamsModel { return data; } + Map toJsonAfterLogin() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['MobileType'] = this.mobileType; + data['LogInTokenID'] = this.logInTokenID; + data['TokenID'] = this.tokenID; + data['MobileNumber'] = this.mobileNumber; + data['UserName'] = this.userName; + data['P_EMAIL_ADDRESS'] = this.pEmailAddress; + data['P_SESSION_ID'] = this.pSessionId; + data['P_SELECTED_EMPLOYEE_NUMBER'] = this.pSelectedEmployeeNumber; + data['P_USER_NAME'] = this.pUserName; + + return data; + } + set setLogInTokenID(String? token) => logInTokenID = token; set setTokenID(String? token) => tokenID = token; + + set setMobileNumer(String? v) => mobileNumber = v; + + set setUserName(String? v) => userName = v; + + set setPEmailAddress(String? v) => pEmailAddress = v; + + set setPSessionId(int? v) => pSessionId = v; + + set setPUserName(String? v) => pUserName = v; + + set setPSelectedEmployeeNumber(String? v) => pSelectedEmployeeNumber = v; } diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart new file mode 100644 index 0000000..b52448e --- /dev/null +++ b/lib/provider/dashboard_provider_model.dart @@ -0,0 +1,173 @@ +import 'dart:convert'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/main.dart'; +import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; +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/generic_response_model.dart'; +import 'package:mohem_flutter_app/widgets/Updater.dart'; + +/// Mix-in [DiagnosticableTreeMixin] to have access to [debugFillProperties] for the devtool +// ignore: prefer_mixin +class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { + //Attendance Tracking + bool isAttendanceTrackingLoading = true; + int endTime = 0, isTimeRemainingInSeconds = 0; + GetAttendanceTracking? attendanceTracking; + + //Work List + bool isWorkListLoading = true; + int workListCounter = 0; + + //Misssing Swipe + bool isMissingSwipeLoading = true; + int missingSwipeCounter = 0; + + //Leave and Ticket Balance + bool isLeaveTicketBalanceLoading = true; + double leaveBalance = 0; + double ticketBalance = 0; + + //Menu Entries + bool isServicesMenusLoading = true; + List? homeMenus; + List? getMenuEntriesList; + + //Attendance Tracking API's & Methods + fetchAttendanceTracking() async { + try { + attendanceTracking = await DashbaordApiClient().getAttendanceTracking(); + isAttendanceTrackingLoading = false; + isTimeRemainingInSeconds = calculateSeconds("00:00:00"); + endTime = DateTime.now().millisecondsSinceEpoch + Duration(seconds: isTimeRemainingInSeconds).inMilliseconds; + print("isTimeRemainingInSeconds " + isTimeRemainingInSeconds.toString()); + print("endTime " + endTime.toString()); + + // notifyListeners(); + } catch (ex) { + Utils.handleException(ex, null); + } + } + + int calculateSeconds(String time) { + int hour = int.parse(time.split(":")[0]); + int mints = int.parse(time.split(":")[1]); + int seconds = int.parse(time.split(":")[2]); + return ((hour * 60 * 60) + (mints * 60) + seconds); + } + + update() { + isAttendanceTrackingLoading = !isAttendanceTrackingLoading; + isWorkListLoading = !isWorkListLoading; + attendanceTracking?.pSwipeIn = "a"; + isTimeRemainingInSeconds = calculateSeconds("00:10:30"); + endTime = DateTime.now().millisecondsSinceEpoch + Duration(seconds: isTimeRemainingInSeconds).inMilliseconds; + + notifyListeners(); + } + + //Work List API's & Methods + fetchWorkListCounter() async { + try { + GenericResponseModel? genericResponseModel = await DashbaordApiClient().getOpenNotifications(); + isWorkListLoading = false; + workListCounter = genericResponseModel?.pOPENNTFNUMBER ?? 0; + ItgFormsModel? itgFormsModel = await DashbaordApiClient().getItgFormsPendingTask(); + workListCounter = workListCounter + (itgFormsModel?.totalCount ?? 0); + notifyListeners(); + } catch (ex) { + isWorkListLoading = false; + logger.wtf(ex); + notifyListeners(); + Utils.handleException(ex, null); + } + } + + //Missing Siwpe API's & Methods + fetchMissingSwipe() async { + try { + GenericResponseModel? genericResponseModel = await DashbaordApiClient().getOpenMissingSwipes(); + isMissingSwipeLoading = false; + missingSwipeCounter = genericResponseModel!.getOpenMissingSwipesList!.pOpenMissingSwipes ?? 0; + notifyListeners(); + } catch (ex) { + isMissingSwipeLoading = false; + logger.wtf(ex); + notifyListeners(); + Utils.handleException(ex, null); + } + } + + //Leave and Ticket Balance API's & Methods + fetchLeaveTicketBalance() async { + try { + GenericResponseModel? genericResponseModel = await DashbaordApiClient().getAccrualBalances(); + isLeaveTicketBalanceLoading = false; + leaveBalance = genericResponseModel?.getAccrualBalancesList![0].accrualNetEntitlement ?? 0.0; + ticketBalance = (genericResponseModel?.getAccrualBalancesList![1].accrualNetEntitlement ?? 0.0) + (genericResponseModel?.getAccrualBalancesList![2].accrualNetEntitlement ?? 0.0); + notifyListeners(); + } catch (ex) { + isLeaveTicketBalanceLoading = false; + logger.wtf(ex); + notifyListeners(); + Utils.handleException(ex, null); + } + } + + //List Menu API's & Methods + fetchListMenu() async { + try { + GenericResponseModel? genericResponseModel = await DashbaordApiClient().getListMenu(); + Map map = {}; + print(jsonEncode(genericResponseModel!.listMenu)); + for (int i = 0; i < genericResponseModel!.listMenu!.length; i++) { + print(genericResponseModel!.listMenu![i]!.menuName ?? ""); + map[genericResponseModel!.listMenu![i]!.menuName ?? ""] = i.toString(); + } + logger.i(map); + notifyListeners(); + } catch (ex) { + logger.wtf(ex); + notifyListeners(); + Utils.handleException(ex, null); + } + } + + //Menu Entries API's & Methods + fetchMenuEntries() async { + try { + GenericResponseModel? genericResponseModel = await DashbaordApiClient().getGetMenuEntries(); + getMenuEntriesList = genericResponseModel!.getMenuEntriesList; + homeMenus = parseMenues(getMenuEntriesList ?? []); + isServicesMenusLoading = false; + notifyListeners(); + } catch (ex) { + logger.wtf(ex); + notifyListeners(); + Utils.handleException(ex, null); + } + } + + List parseMenues(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())); + } + } + + //Verify Menus by printing in log + // for(int i=0;i { - @override - void initState() { - super.initState(); - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget build(BuildContext context) { - List names = [ - LocaleKeys.workList.tr(), - LocaleKeys.missingSwipes.tr(), - LocaleKeys.leaveBalance.tr(), - LocaleKeys.ticketBalance.tr() - ]; - List namesInt = [118, 02, 18.5, 03]; - List namesColor = [0xff125765, 0xff239D8F, 0xff2BB8A8, 0xff1D92AA]; - - List namesT = [ - LocaleKeys.monthlyAttendance.tr(), - LocaleKeys.workFromHome.tr(), - LocaleKeys.ticketRequest.tr(), - LocaleKeys.monthlyAttendance.tr() - ]; - List iconT = [ - "assets/images/monthly_attendance.svg", - "assets/images/work_from_home.svg", - "assets/images/ticket_request.svg", - "assets/images/work_from_home.svg" - ]; - - List namesD = [ - "Nostalgia Perfume Perfume", - "Al Nafoura", - "AlJadi", - "Nostalgia Perfume" - ]; - - return Scaffold( - body: Column( - children: [ - Row( - children: [ - Row( - mainAxisSize: MainAxisSize.min, - children: [ - CircularAvatar( - width: 34, - height: 34, - url: - "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png", - ), - 8.width, - SvgPicture.asset("assets/images/side_nav.svg"), - ], - ).onPress(() {}), - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - //AppLogo(), - 8.width, - LocaleKeys.mohemm.tr().toText14() - ], - ), - ), - SizedBox( - width: 36, - height: 36, - child: Stack( - alignment: Alignment.centerLeft, - children: [ - SvgPicture.asset("assets/images/announcements.svg"), - Positioned( - right: 0, - top: 0, - child: Container( - padding: const EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration( - color: MyColors.redColor, - borderRadius: BorderRadius.circular(17)), - child: "3".toText12(color: Colors.white), - ), - ) - ], - ), - ) - ], - ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7), - Expanded( - child: ListView( - padding: EdgeInsets.zero, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.goodMorning - .tr() - .toText14(color: MyColors.grey77Color), - "Mahmoud Shrouf".toText24(isBold: true), - 16.height, - Row( - children: [ - Expanded( - child: AspectRatio( - aspectRatio: 159 / 159, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - gradient: const LinearGradient( - transform: GradientRotation(.46), - begin: Alignment.topRight, - end: Alignment.bottomRight, - colors: [ - MyColors.gradiantEndColor, - MyColors.gradiantStartColor, - ]), - ), - child: Stack( - alignment: Alignment.center, - children: [ - SvgPicture.asset("assets/images/"), - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - LocaleKeys.markAttendance - .tr() - .toText14( - color: Colors.white, - isBold: true), - 9.height, - "07:55:12".toText14( - color: Colors.white, - isBold: true), - LocaleKeys.timeLeftToday - .tr() - .toText12(color: Colors.white), - 9.height, - const ClipRRect( - borderRadius: BorderRadius.all( - Radius.circular(20), - ), - child: LinearProgressIndicator( - value: 0.7, - minHeight: 8, - valueColor: - const AlwaysStoppedAnimation< - Color>(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), - "09:00".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( - "assets/images/stop.svg"), - ), - ], - ), - ], - ), - ], - ), - ).onPress(() { - Navigator.pushNamed( - context, AppRoutes.todayAttendance); - }), - ), - ), - 9.width, - Expanded( - child: GridView.builder( - shrinkWrap: true, - primary: false, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - childAspectRatio: 2 / 2, - crossAxisSpacing: 9, - mainAxisSpacing: 9), - padding: EdgeInsets.zero, - itemCount: 4, - itemBuilder: (BuildContext context, int index) { - return Container( - decoration: BoxDecoration( - color: Color(namesColor[index]), - borderRadius: BorderRadius.circular(10), - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - names[index].toText12(color: Colors.white), - Row( - children: [ - Expanded( - child: namesInt[index] - .toStringAsFixed(1) - .toText16( - color: Colors.white, - isBold: true), - ), - SvgPicture.asset( - "assets/images/arrow_next.svg", - color: Colors.white) - ], - ) - ], - ).paddingOnly( - left: 10, right: 10, bottom: 6, top: 6), - ).onPress(() { - Navigator.pushNamed( - context, AppRoutes.workList); - }); - }, - ), - ), - ], - ), - 20.height, - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - "Other".tr().toText12(), - LocaleKeys.services.tr().toText24(isBold: true), - ], - ), - ), - LocaleKeys.viewAllServices - .tr() - .toText12(isUnderLine: true), - ], - ), - ], - ).paddingOnly(left: 21, right: 21, top: 7), - SizedBox( - height: 105 + 26, - child: ListView.separated( - shrinkWrap: true, - physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.only( - left: 21, right: 21, top: 13, bottom: 13), - scrollDirection: Axis.horizontal, - itemBuilder: (cxt, index) { - return AspectRatio( - aspectRatio: 105 / 105, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [ - BoxShadow( - color: - const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SvgPicture.asset(iconT[index]), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - child: - namesT[index].toText11(isBold: true), - ), - SvgPicture.asset( - "assets/images/arrow_next.svg") - .paddingOnly(bottom: 4) - ], - ) - ], - ).paddingOnly( - left: 10, right: 10, bottom: 10, top: 12), - ), - ); - }, - separatorBuilder: (cxt, index) => 9.width, - itemCount: 4), - ), - 8.height, - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 31), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topRight: Radius.circular(50), - topLeft: Radius.circular(50)), - border: - Border.all(color: MyColors.lightGreyEDColor, width: 1), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - LocaleKeys.offers.tr().toText12(), - Row( - children: [ - LocaleKeys.discounts - .tr() - .toText24(isBold: true), - 6.width, - Container( - padding: const EdgeInsets.only( - left: 8, right: 8), - decoration: BoxDecoration( - color: MyColors.yellowColor, - borderRadius: - BorderRadius.circular(10), - ), - child: LocaleKeys.newString - .tr() - .toText10(isBold: true)), - ], - ), - ], - ), - ), - LocaleKeys.viewAllOffers - .tr() - .toText12(isUnderLine: true), - ], - ).paddingOnly(left: 21, right: 21), - SizedBox( - height: 103 + 33, - child: ListView.separated( - shrinkWrap: true, - physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.only( - left: 21, right: 21, top: 13), - scrollDirection: Axis.horizontal, - itemBuilder: (cxt, index) { - return SizedBox( - width: 73, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 73, - height: 73, - decoration: BoxDecoration( - borderRadius: const BorderRadius.all( - Radius.circular(100), - ), - border: Border.all( - color: MyColors.lightGreyEDColor, - width: 1), - ), - child: ClipRRect( - borderRadius: const BorderRadius.all( - Radius.circular(50), - ), - child: Image.network( - "https://play-lh.googleusercontent.com/NPo88ojmhah4HDiposucJmfQIop4z4xc8kqJK9ITO9o-yCab2zxIp7PPB_XPj2iUojo", - fit: BoxFit.cover, - ), - ), - ), - 4.height, - Expanded( - child: namesD[6 % (index + 1)].toText12( - isCenter: true, maxLine: 2)), - ], - ), - ); - }, - separatorBuilder: (cxt, index) => 8.width, - itemCount: 6), - ), - ], - ), - ) - ], - ), - ) - ], - ), - ); - } -} diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart new file mode 100644 index 0000000..92ea49d --- /dev/null +++ b/lib/ui/landing/dashboard_screen.dart @@ -0,0 +1,334 @@ +import 'dart:convert'; + +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; +import 'package:mohem_flutter_app/classes/colors.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/dashboard/get_attendance_tracking_list_model.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/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/theme/colors.dart'; +import 'package:mohem_flutter_app/ui/landing/widget/menus_widget.dart'; +import 'package:mohem_flutter_app/ui/landing/widget/services_widget.dart'; +import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; +import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; +import 'package:provider/provider.dart'; +import 'package:shimmer/shimmer.dart'; + +import '../../main.dart'; + +class DashboardScreen extends StatefulWidget { + DashboardScreen({Key? key}) : super(key: key); + + @override + _DashboardScreenState createState() { + return _DashboardScreenState(); + } +} + +class _DashboardScreenState extends State { + late var data; + + @override + void initState() { + super.initState(); + data = Provider.of(context, listen: false); + data.fetchAttendanceTracking(); + data.fetchWorkListCounter(); + data.fetchMissingSwipe(); + data.fetchLeaveTicketBalance(); + // data.fetchMenuEntries(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + List namesD = ["Nostalgia Perfume Perfume", "Al Nafoura", "AlJadi", "Nostalgia Perfume"]; + + return Scaffold( + body: Column( + children: [ + Row( + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + CircularAvatar( + width: 34, + height: 34, + url: "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png", + ), + 8.width, + SvgPicture.asset("assets/images/side_nav.svg"), + ], + ).onPress(() {}), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + //AppLogo(), + 8.width, + LocaleKeys.mohemm.tr().toText14() + ], + ), + ), + SizedBox( + width: 36, + height: 36, + child: Stack( + alignment: Alignment.centerLeft, + children: [ + SvgPicture.asset("assets/images/announcements.svg"), + Positioned( + right: 0, + top: 0, + child: Container( + padding: const EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), + child: "3".toText12(color: Colors.white), + ), + ) + ], + ), + ).onPress(() { + data.update(); + }) + ], + ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7), + Expanded( + child: Column( + // padding: EdgeInsets.zero, + // physics: NeverScrollableScrollPhysics(), + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color), + "Mahmoud Shrouf".toText24(isBold: true), + 16.height, + Row( + children: [ + Expanded( + child: AspectRatio( + aspectRatio: 159 / 159, + child: Consumer( + builder: (context, model, child) { + return (model.isAttendanceTrackingLoading + ? GetAttendanceTrackingShimmer() + : Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + gradient: const LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomRight, 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, + const ClipRRect( + borderRadius: BorderRadius.all( + Radius.circular(20), + ), + child: LinearProgressIndicator( + value: 0.7, + 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.isTimeRemainingInSeconds == 0 ? "--:--" : "09:00").toText14(color: Colors.white, isBold: true), + 4.height + ], + ).paddingOnly(left: 12), + ), + Container( + width: 45, + height: 45, + padding: const EdgeInsets.only(left: 14, right: 14), + decoration: const BoxDecoration( + color: Color(0xff259EA4), + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(15), + ), + ), + child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), + ), + ], + ), + ], + ), + ], + ), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.todayAttendance); + })) + .animatedSwither(); + }, + )), + ), + 9.width, + Expanded( + child: MenusWidget(), + ), + ], + ), + 20.height, + ], + ).paddingOnly(left: 21, right: 21, top: 7), + ServicesWidget(), + 8.height, + ], + ), + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 31), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), + border: Border.all(color: MyColors.lightGreyEDColor, width: 1), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.offers.tr().toText12(), + Row( + children: [ + LocaleKeys.discounts.tr().toText24(isBold: true), + 6.width, + Container( + padding: const EdgeInsets.only(left: 8, right: 8), + decoration: BoxDecoration( + color: MyColors.yellowColor, + borderRadius: BorderRadius.circular(10), + ), + child: LocaleKeys.newString.tr().toText10(isBold: true)), + ], + ), + ], + ), + ), + LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true), + ], + ).paddingOnly(left: 21, right: 21), + SizedBox( + height: 103 + 33, + child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.only(left: 21, right: 21, top: 13), + scrollDirection: Axis.horizontal, + itemBuilder: (cxt, index) { + return SizedBox( + width: 73, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 73, + height: 73, + decoration: BoxDecoration( + borderRadius: const BorderRadius.all( + Radius.circular(100), + ), + border: Border.all(color: MyColors.lightGreyEDColor, width: 1), + ), + child: ClipRRect( + borderRadius: const BorderRadius.all( + Radius.circular(50), + ), + child: Image.network( + "https://play-lh.googleusercontent.com/NPo88ojmhah4HDiposucJmfQIop4z4xc8kqJK9ITO9o-yCab2zxIp7PPB_XPj2iUojo", + fit: BoxFit.cover, + ), + ), + ), + 4.height, + Expanded( + child: namesD[6 % (index + 1)].toText12(isCenter: true, maxLine: 2), + ), + ], + ), + ); + }, + separatorBuilder: (cxt, index) => 8.width, + itemCount: 6), + ), + ], + ), + ) + ], + ), + ) + ], + ), + ); + } +} diff --git a/lib/ui/landing/widget/menus_widget.dart b/lib/ui/landing/widget/menus_widget.dart new file mode 100644 index 0000000..4d13775 --- /dev/null +++ b/lib/ui/landing/widget/menus_widget.dart @@ -0,0 +1,138 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.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'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; +import 'package:provider/provider.dart'; + +class MenusWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + List namesColor = [0xff125765, 0xff239D8F, 0xff2BB8A8, 0xff1D92AA]; + + return Consumer(builder: (context, data, child) { + return GridView( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 2 / 2, crossAxisSpacing: 9, mainAxisSpacing: 9), + padding: EdgeInsets.zero, + shrinkWrap: true, + primary: false, + physics: const NeverScrollableScrollPhysics(), + children: [ + data.isWorkListLoading + ? MenuShimmer().onPress(() { + data.fetchWorkListCounter(); + }) + : Container( + decoration: BoxDecoration( + color: Color(namesColor[0]), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.workList.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded( + child: data.workListCounter.toString().toText16(color: Colors.white, isBold: true), + ), + SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + // Navigator.pushNamed(context, AppRoutes.workList); + data.fetchWorkListCounter(); + }), + data.isMissingSwipeLoading + ? MenuShimmer().onPress(() { + data.fetchWorkListCounter(); + }) + : Container( + decoration: BoxDecoration( + color: Color(namesColor[1]), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.missingSwipes.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded( + child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true), + ), + SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.workList); + }), + data.isLeaveTicketBalanceLoading + ? MenuShimmer().onPress(() { + data.fetchWorkListCounter(); + }) + : Container( + decoration: BoxDecoration( + color: Color(namesColor[2]), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.leaveBalance.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded( + child: data.leaveBalance.toString().toText16(color: Colors.white, isBold: true), + ), + SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.workList); + }), + data.isLeaveTicketBalanceLoading + ? MenuShimmer().onPress(() { + data.fetchWorkListCounter(); + }) + : Container( + decoration: BoxDecoration( + color: Color(namesColor[3]), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.ticketBalance.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded( + child: data.ticketBalance.toString().toText16(color: Colors.white, isBold: true), + ), + SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.workList); + }) + ], + ); + }); + } +} diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart new file mode 100644 index 0000000..f397a4c --- /dev/null +++ b/lib/ui/landing/widget/services_widget.dart @@ -0,0 +1,147 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.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/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; +import 'package:provider/provider.dart'; + +class ServicesWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + List namesT = [LocaleKeys.monthlyAttendance.tr(), LocaleKeys.workFromHome.tr(), LocaleKeys.ticketRequest.tr(), LocaleKeys.monthlyAttendance.tr()]; + List iconT = [ + "assets/images/monthly_attendance.svg", + "assets/images/work_from_home.svg", + "assets/images/ticket_request.svg", + "assets/images/work_from_home.svg", + "assets/images/work_from_home.svg", + "assets/images/work_from_home.svg", + "assets/images/work_from_home.svg", + "assets/images/work_from_home.svg" + ]; + + return Consumer( + builder: (context, data, child) { + return data.isServicesMenusLoading + ? whileLoading() + : ListView.separated( + itemBuilder: (context, parentIndex) { + return Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + firstWord(data.homeMenus![parentIndex].menuEntry.prompt!).toText12(), + lastWord(data.homeMenus![parentIndex].menuEntry.prompt!).toText24(isBold: true), + ], + ), + ), + LocaleKeys.viewAllServices.tr().toText12(isUnderLine: true), + ], + ).paddingOnly(left: 21, right: 21), + SizedBox( + height: 105 + 26, + child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13), + scrollDirection: Axis.horizontal, + itemBuilder: (cxt, index) { + return AspectRatio( + aspectRatio: 105 / 105, + child: data.isServicesMenusLoading + ? ServicesMenuShimmer() + : Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SvgPicture.asset(iconT[index]), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true), + ), + SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12), + ), + ); + }, + separatorBuilder: (cxt, index) => 9.width, + itemCount: data.homeMenus![parentIndex].menuEntiesList.length), + ), + ], + ); + }, + separatorBuilder: (context, index) { + return 12.height; + }, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: data.homeMenus!.length); + }, + ); + } + + String firstWord(String value) { + return value.split(" ").length > 1 ? value.split(" ")[0] : ""; + } + + String lastWord(String value) { + var parts = value.split(" "); + if (parts.length == 1) { + return value; + } else { + int i = value.indexOf(" "); + return value.substring(i + 1).toCamelCase; + } + } + + Widget whileLoading() { + return Column( + children: [ + ServicesHeaderShimmer().paddingOnly(left: 21, right: 21), + SizedBox( + height: 105 + 26, + child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13), + scrollDirection: Axis.horizontal, + itemBuilder: (cxt, index) { + return AspectRatio( + aspectRatio: 105 / 105, + child: ServicesMenuShimmer(), + ); + }, + separatorBuilder: (cxt, index) => 9.width, + itemCount: 4), + ), + ], + ); + } +} diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index d7c91ee..533e9ee 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -104,7 +104,7 @@ class _LoginScreenState extends State { _checkMobileAppVersion = await LoginApiClient().checkMobileAppVersion(); _memberLoginList = await LoginApiClient().memberLogin(username.text, password.text); AppState().setMemberLoginListModel = _memberLoginList; - AppState().username = username.text; + AppState().setUserName = username.text; AppState().password = password.text; if (_autoLogin) { AppState().setMemberInformationListModel = (await MemberInformationListModel.getFromPrefs()).first; @@ -127,6 +127,8 @@ class _LoginScreenState extends State { @override Widget build(BuildContext context) { + username.text="15153"; + password.text="Riyadh@1234"; return Scaffold( body: Column( children: [ diff --git a/lib/widgets/Updater.dart b/lib/widgets/Updater.dart new file mode 100644 index 0000000..154173d --- /dev/null +++ b/lib/widgets/Updater.dart @@ -0,0 +1,39 @@ +/* ZiK */ + +import 'dart:async'; +import 'package:flutter/cupertino.dart'; + +typedef ChildProvider = Widget Function(BuildContext context, E? data); + +class Updater extends StatelessWidget{ + final ChildProvider childProvider; + StreamController? sink; + T? initialData; + List _history = []; + + Stream? _stream; + Updater({T? initialData, required this.childProvider}){ + this.sink = StreamController(); + this.initialData = initialData; + _stream = this.sink?.stream; + } + + @override + Widget build(BuildContext context) { + return StreamBuilder( + initialData: this.initialData, + stream: _stream, + builder: (ctx, snapshot){ + return childProvider(context, snapshot.data); + }); + } + + pushData(T? data) { + _history.add(data); + sink?.sink.add(data); + } + + List getDataHistory() => _history; + T? getLatestData() => _history.last; + +} \ No newline at end of file diff --git a/lib/widgets/shimmer/dashboard_shimmer_widget.dart b/lib/widgets/shimmer/dashboard_shimmer_widget.dart new file mode 100644 index 0000000..5b5bd60 --- /dev/null +++ b/lib/widgets/shimmer/dashboard_shimmer_widget.dart @@ -0,0 +1,189 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.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:shimmer/shimmer.dart'; + +class GetAttendanceTrackingShimmer extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Stack( + alignment: Alignment.center, + children: [ + // SvgPicture.asset("assets/images/"), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true).toShimmer(), + 16.height, + "07:55:12".toText10(color: Colors.white, isBold: true).toShimmer(), + 3.height, + LocaleKeys.timeLeftToday.tr().toText10(color: Colors.white).toShimmer(), + 9.height, + const ClipRRect( + borderRadius: BorderRadius.all( + Radius.circular(20), + ), + child: LinearProgressIndicator( + value: 0.7, + minHeight: 8, + valueColor: const AlwaysStoppedAnimation(Colors.white), + backgroundColor: const Color(0xff196D73), + ), + ).toShimmer(), + ], + ).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).toShimmer(), + ], + ).paddingOnly(left: 12), + ), + Container( + width: 45, + height: 45, + // color: Colors.blue, + padding: const EdgeInsets.only(left: 14, right: 14), + ).toShimmer(), + ], + ), + ], + ), + ], + ), + ); + } +} + +class MenuShimmer extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.workList.tr().toText12(color: Colors.white).toShimmer(), + Row( + children: [ + Expanded( + flex: 3, + child: 123.toString().toText10(color: Colors.white, isBold: true).toShimmer(), + ), + 12.width, + SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white).toShimmer() + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ); + } +} + +class ServicesHeaderShimmer extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + "Other".tr().toText10().toShimmer(), + 6.height, + LocaleKeys.services.tr().toText12(isBold: true).toShimmer(), + ], + ), + ), + LocaleKeys.viewAllServices.tr().toText12(isUnderLine: true).toShimmer(), + ], + ); + } +} + +class ServicesMenuShimmer extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SvgPicture.asset("assets/images/monthly_attendance.svg").toShimmer(), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Attendan".toText11(isBold: false).toShimmer(), + 5.height, + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: "Attendance".toText11(isBold: false).toShimmer(), + ), + 6.width, + SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4).toShimmer() + ], + ), + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 56d2f3f..58ce64a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -28,7 +28,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -104,6 +104,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_countdown_timer: + dependency: "direct main" + description: + name: flutter_countdown_timer + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.0" flutter_lints: dependency: "direct dev" description: @@ -196,13 +203,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.9" + logger: + dependency: "direct main" + description: + name: logger + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: @@ -392,6 +406,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.3" + shimmer: + dependency: "direct main" + description: + name: shimmer + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" sizer: dependency: "direct main" description: @@ -445,7 +466,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.3" typed_data: dependency: transitive description: @@ -466,7 +487,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" win32: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 611dbf1..ca8fe9c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -46,6 +46,9 @@ dependencies: fluttertoast: ^8.0.8 shared_preferences: ^2.0.12 firebase_messaging: ^11.2.6 + shimmer: ^2.0.0 + logger: ^1.1.0 + flutter_countdown_timer: ^4.1.0 dev_dependencies: