From 937c4c18b5c2d293c48d89fd404b1dfe4ccf9cb3 Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Sun, 30 Oct 2022 12:31:23 +0300 Subject: [PATCH] Mark Attandence success animation and font settings --- assets/lottie/lt_success.json | 1 + lib/api/dashboard_api_client.dart | 76 +++- lib/config/routes.dart | 2 +- lib/extensions/string_extensions.dart | 158 +++---- lib/models/itg/advertisement.dart | 99 +++++ lib/models/itg/itg_main_response.dart | 195 +++++++++ lib/models/itg/itg_response_model.dart | 159 ++++++++ lib/provider/dashboard_provider_model.dart | 8 + lib/ui/dialogs/success_dialog.dart | 33 ++ lib/ui/landing/dashboard_screen.dart | 429 ++++++-------------- lib/ui/landing/{ => itg}/survey_screen.dart | 74 +++- lib/ui/landing/itg/video_page.dart | 96 +++++ lib/ui/landing/today_attendance_screen.dart | 55 +-- lib/ui/login/login_screen.dart | 2 +- lib/widgets/dialogs/dialogs.dart | 5 +- lib/widgets/mark_attendance_widget.dart | 23 +- pubspec.yaml | 2 + 17 files changed, 956 insertions(+), 461 deletions(-) create mode 100644 assets/lottie/lt_success.json create mode 100644 lib/models/itg/advertisement.dart create mode 100644 lib/models/itg/itg_main_response.dart create mode 100644 lib/models/itg/itg_response_model.dart create mode 100644 lib/ui/dialogs/success_dialog.dart rename lib/ui/landing/{ => itg}/survey_screen.dart (62%) create mode 100644 lib/ui/landing/itg/video_page.dart diff --git a/assets/lottie/lt_success.json b/assets/lottie/lt_success.json new file mode 100644 index 0000000..e20ec96 --- /dev/null +++ b/assets/lottie/lt_success.json @@ -0,0 +1 @@ +{"v":"5.7.12","fr":24,"ip":0,"op":63,"w":520,"h":520,"nm":"Checklist 2","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Checklist","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":50,"s":[100]},{"t":62,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[259.587,260.119,0],"ix":2,"l":2},"a":{"a":0,"k":[297.587,298.119,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[54.754,-36.121],[-17.487,36.12],[-54.754,-1.147]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":23,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[294.971,298.679],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":24,"s":[100]},{"t":36,"s":[0]}],"ix":1},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":720,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Cricle","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":50,"s":[100]},{"t":62,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[260,260,0],"ix":2,"l":2},"a":{"a":0,"k":[-7.627,-7.691,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":18,"s":[124.222,124.222,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":20,"s":[134.222,134.222,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":22,"s":[114.222,114.222,100]},{"t":24,"s":[124.222,124.222,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[178.46,178.46],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.239],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"t":24,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[0.16862745098039217,0.7215686274509804,0.6509803921568628,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":10,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.16862745098039217,0.7215686274509804,0.6509803921568628,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":22,"s":[0]},{"t":24,"s":[100]}],"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-7.627,-7.691],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":720,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Line","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":28,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":39,"s":[100]},{"t":50,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[260,260,0],"ix":2,"l":2},"a":{"a":0,"k":[298,298,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0,0,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":28,"s":[46,46,100]},{"t":50,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-120.208,0],[0,-120.208],[120.207,0],[0,120.208]],"o":[[120.207,0],[0,120.208],[-120.208,0],[0,-120.208]],"v":[[0,-217.655],[217.655,0],[0,217.655],[-217.655,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.7607843137254902,0.9725490196078431,0.9490196078431372,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":10,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[297.587,298.119],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":28,"op":720,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Shadow","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":22,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":33,"s":[100]},{"t":44,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[260,260,0],"ix":2,"l":2},"a":{"a":0,"k":[298,298,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0,0,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":22,"s":[60,60,100]},{"t":44,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-94.797,0],[0,-94.797],[94.797,0],[0,94.798]],"o":[[94.797,0],[0,94.798],[-94.797,0],[0,-94.797]],"v":[[0,-171.646],[171.646,0],[0,171.646],[-171.646,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.8941176470588236,1,0.9882352941176471,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[297.587,298.119],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":22,"op":720,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart index dd3f182..cce2207 100644 --- a/lib/api/dashboard_api_client.dart +++ b/lib/api/dashboard_api_client.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:convert'; import 'package:mohem_flutter_app/api/api_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; @@ -9,8 +10,12 @@ import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_ import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; import 'package:mohem_flutter_app/models/dashboard/list_menu.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/itg/itg_main_response.dart'; +import 'package:mohem_flutter_app/models/itg/itg_response_model.dart'; + import 'package:uuid/uuid.dart'; + class DashboardApiClient { static final DashboardApiClient _instance = DashboardApiClient._internal(); @@ -40,10 +45,7 @@ class DashboardApiClient { Future getCOCNotifications() async { String url = "${ApiConsts.cocRest}Mohemm_ITG_ReviewerAdmin_Pending_Tasks"; - Map postParams = { - "Date": DateUtil.getISODateFormat(DateTime.now()), - "EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER - }; + Map postParams = {"Date": DateUtil.getISODateFormat(DateTime.now()), "EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { @@ -62,8 +64,7 @@ class DashboardApiClient { }, url, postParams); } - Future> getAccrualBalances( - String effectiveDate) async { + Future> getAccrualBalances(String effectiveDate) async { String url = "${ApiConsts.erpRest}GET_ACCRUAL_BALANCES"; Map postParams = {"P_EFFECTIVE_DATE": effectiveDate}; postParams.addAll(AppState().postParamsJson); @@ -97,10 +98,7 @@ class DashboardApiClient { //GET_MENU_ENTRIES Future getGetMenuEntries() async { String url = "${ApiConsts.erpRest}GET_MENU_ENTRIES"; - Map postParams = { - "P_SELECTED_RESP_ID": -999, - "P_MENU_TYPE": "E" - }; + Map postParams = {"P_SELECTED_RESP_ID": -999, "P_MENU_TYPE": "E"}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); @@ -109,13 +107,7 @@ class DashboardApiClient { } //Mark Attendance - Future markAttendance( - {String lat = "0", - String? long = "0", - required int pointType, - String nfcValue = "", - bool isGpsRequired = false, - String QRValue = ""}) async { + Future markAttendance({String lat = "0", String? long = "0", required int pointType, String nfcValue = "", bool isGpsRequired = false, String QRValue = ""}) async { String url = "${ApiConsts.swpRest}AuthenticateAndSwipeUserSupportNFC"; var uuid = Uuid(); // Generate a v4 (random) id @@ -136,4 +128,54 @@ class DashboardApiClient { return responseData; }, url, postParams); } + + //Check ITG Type + Future getITGPageNotification() async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_GetPageNotification"; + + Map postParams = { + "EmployeeNumber": AppState().getUserName, + "ItgEnableAt": "After Service Submission", //Mobile Id + "ItgServiceName": "Login" + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + MohemmItgResponseItem res = MohemmItgResponseItem.fromJson(jsonDecode(responseData.mohemmITGResponseItem ?? "")); + // var jsonDecodedData = jsonDecode(jsonDecode(responseData.mohemmITGResponseItem!)['result']['data']); + return res; + }, url, postParams); + } + + //Submit ITG + Future submitItgForm({required String comment, required String masterId, required List> itgList, required int serviceId}) async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_Survey_Response"; + + Map postParams = { + "EmployeeNumber": AppState().getUserName, + "ItgComments": comment, + "ItgNotificationMasterId": masterId, + "ItgQuestionResponses": itgList, + "ItgSurveyId": serviceId + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + ItgMainRes responseData = ItgMainRes.fromJson(json); + return responseData; + }, url, postParams); + } + + Future getAdvertisementDetail(String masterID) async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_GetPageNotificationDetails"; + + Map postParams = { + "EmployeeNumber": AppState().getUserName, + "ItgNotificationMasterId": masterID, //Mobile Id + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + ItgMainRes responseData = ItgMainRes.fromJson(json); + return responseData; + }, url, postParams); + } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index c647953..9823082 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -6,7 +6,7 @@ import 'package:mohem_flutter_app/ui/bottom_sheets/attendence_details_bottom_she import 'package:mohem_flutter_app/ui/chat/chat_detailed_screen.dart'; import 'package:mohem_flutter_app/ui/chat/chat_home.dart'; import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart'; -import 'package:mohem_flutter_app/ui/landing/survey_screen.dart'; +import 'package:mohem_flutter_app/ui/landing/itg/survey_screen.dart'; import 'package:mohem_flutter_app/ui/landing/today_attendance_screen.dart'; import 'package:mohem_flutter_app/ui/leave_balance/add_leave_balance_screen.dart'; import 'package:mohem_flutter_app/ui/leave_balance/leave_balance_screen.dart'; diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 9ee4546..9bcc984 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -10,36 +10,19 @@ extension CapExtension on String { String get allInCaps => this.toUpperCase(); - String get capitalizeFirstofEach => this.trim().length > 0 - ? this.trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") - : ""; + 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); - Widget toText10( - {Color? color, - bool isBold = false, - int? maxlines, - FontStyle? fontStyle}) => - Text( + Widget toText10({Color? color, bool isBold = false, int? maxlines, FontStyle? fontStyle}) => Text( this, //maxLines: maxlines, - style: TextStyle( - fontSize: 10, - fontStyle: fontStyle ?? FontStyle.normal, - fontWeight: isBold ? FontWeight.bold : FontWeight.w600, - color: color ?? MyColors.darkTextColor, - letterSpacing: -0.4), + style: TextStyle(fontSize: 10, fontStyle: fontStyle ?? FontStyle.normal, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4), ); - Widget toText11( - {Color? color, - FontWeight? weight, - bool isUnderLine = false, - bool isBold = false}) => - Text( + Widget toText11({Color? color, FontWeight? weight, bool isUnderLine = false, bool isBold = false}) => Text( this, style: TextStyle( fontSize: 11, @@ -50,13 +33,7 @@ extension EmailValidator on String { ), ); - Widget toText12( - {Color? color, - bool isUnderLine = false, - bool isBold = false, - bool isCenter = false, - int maxLine = 0}) => - Text( + Widget toText12({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => Text( this, textAlign: isCenter ? TextAlign.center : null, maxLines: (maxLine > 0) ? maxLine : null, @@ -69,13 +46,7 @@ extension EmailValidator on String { ), ); - Widget toText12Auto( - {Color? color, - bool isUnderLine = false, - bool isBold = false, - bool isCenter = false, - int maxLine = 0}) => - AutoSizeText( + Widget toText12Auto({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => AutoSizeText( this, textAlign: isCenter ? TextAlign.center : null, maxLines: (maxLine > 0) ? maxLine : null, @@ -89,28 +60,47 @@ extension EmailValidator on String { ), ); - Widget toText13({Color? color, bool isUnderLine = false}) => Text( + Widget toTextAuto({ + Color? color, + bool isUnderLine = false, + bool isBold = false, + bool isCenter = false, + int maxLine = 0, + double fontSize = 12, + double letterSpacing = -0.72, + double height = 1, + }) => + AutoSizeText( this, + textAlign: isCenter ? TextAlign.center : null, + maxLines: (maxLine > 0) ? maxLine : null, + minFontSize: 8, style: TextStyle( - fontSize: 13, - fontWeight: FontWeight.w600, - color: color ?? MyColors.darkTextColor, - letterSpacing: -0.52, - decoration: isUnderLine ? TextDecoration.underline : null), + fontSize: fontSize, + fontWeight: isBold ? FontWeight.bold : FontWeight.w600, + color: color ?? MyColors.darkTextColor, + letterSpacing: letterSpacing, + decoration: isUnderLine ? TextDecoration.underline : null, + ), + ); + + Widget toText13({Color? color, bool isUnderLine = false}) => Text( + this, + style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.52, decoration: isUnderLine ? TextDecoration.underline : null), ); Widget toText14({Color? color, bool isUnderLine = false, bool isBold = false, FontWeight? weight, int? maxlines}) => Text( this, maxLines: maxlines, - style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 14, letterSpacing: -0.48, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600), decoration: isUnderLine ? TextDecoration.underline : null), + style: TextStyle( + color: color ?? MyColors.darkTextColor, + fontSize: 14, + letterSpacing: -0.48, + fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600), + decoration: isUnderLine ? TextDecoration.underline : null), ); - Widget toText16( - {Color? color, - bool isUnderLine = false, - bool isBold = false, - int? maxlines}) => - Text( + Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines}) => Text( this, maxLines: maxlines, style: TextStyle( @@ -124,97 +114,51 @@ extension EmailValidator on String { Widget toText17({Color? color, bool isBold = false}) => Text( this, - style: TextStyle( - color: color ?? MyColors.darkTextColor, - fontSize: 17, - letterSpacing: -0.68, - fontWeight: isBold ? FontWeight.bold : FontWeight.w600), + style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 17, letterSpacing: -0.68, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); Widget toText18({Color? color, bool isBold = false}) => Text( this, - style: TextStyle( - fontSize: 18, - fontWeight: isBold ? FontWeight.bold : FontWeight.w600, - color: color ?? MyColors.darkTextColor, - letterSpacing: -1.08), + style: TextStyle(fontSize: 18, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -1.08), ); Widget toText19({Color? color, bool isBold = false}) => Text( this, - style: TextStyle( - fontSize: 19, - fontWeight: isBold ? FontWeight.bold : FontWeight.w600, - color: color ?? MyColors.darkTextColor, - letterSpacing: -1.14), + style: TextStyle(fontSize: 19, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -1.14), ); Widget toText20({Color? color, bool isBold = false}) => Text( this, - style: TextStyle( - fontSize: 20, - fontWeight: isBold ? FontWeight.bold : FontWeight.w600, - color: color ?? MyColors.darkTextColor, - letterSpacing: -0.4), + style: TextStyle(fontSize: 20, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4), ); - Widget toText21( - {Color? color, - bool isBold = false, - FontWeight? weight, - int? maxlines}) => - Text( + Widget toText21({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text( this, maxLines: maxlines, - style: TextStyle( - color: color ?? MyColors.grey3AColor, - fontSize: 21, - letterSpacing: -0.31, - fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600)), + style: TextStyle(color: color ?? MyColors.grey3AColor, fontSize: 21, letterSpacing: -0.31, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600)), ); Widget toText22({Color? color, bool isBold = false}) => Text( this, - style: TextStyle( - height: 1, - color: color ?? MyColors.darkTextColor, - fontSize: 22, - letterSpacing: -1.44, - fontWeight: isBold ? FontWeight.bold : FontWeight.w600), + style: TextStyle(height: 1, color: color ?? MyColors.darkTextColor, fontSize: 22, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); Widget toText24({Color? color, bool isBold = false}) => Text( this, - style: TextStyle( - height: 23 / 24, - color: color ?? MyColors.darkTextColor, - fontSize: 24, - letterSpacing: -1.44, - fontWeight: isBold ? FontWeight.bold : FontWeight.w600), + style: TextStyle(height: 23 / 24, color: color ?? MyColors.darkTextColor, fontSize: 24, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); Widget toText32({Color? color, bool isBold = false}) => Text( this, - style: TextStyle( - height: 32 / 32, - color: color ?? MyColors.darkTextColor, - fontSize: 32, - letterSpacing: -1.92, - fontWeight: isBold ? FontWeight.bold : FontWeight.w600), + style: TextStyle(height: 32 / 32, color: color ?? MyColors.darkTextColor, fontSize: 32, letterSpacing: -1.92, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); Widget toText44({Color? color, bool isBold = false}) => Text( this, - style: TextStyle( - height: 32 / 32, - color: color ?? MyColors.darkTextColor, - fontSize: 44, - letterSpacing: -2.64, - fontWeight: isBold ? FontWeight.bold : FontWeight.w600), + style: TextStyle(height: 32 / 32, color: color ?? MyColors.darkTextColor, fontSize: 44, letterSpacing: -2.64, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); - Widget toSectionHeading( - {String upperHeading = "", String lowerHeading = ""}) { + Widget toSectionHeading({String upperHeading = "", String lowerHeading = ""}) { String upper = ""; String lower = ""; String heading = this; @@ -247,9 +191,7 @@ extension EmailValidator on String { } bool isValidEmail() { - return RegExp( - r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$') - .hasMatch(this); + return RegExp(r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$').hasMatch(this); } String toFormattedDate() { diff --git a/lib/models/itg/advertisement.dart b/lib/models/itg/advertisement.dart new file mode 100644 index 0000000..598a248 --- /dev/null +++ b/lib/models/itg/advertisement.dart @@ -0,0 +1,99 @@ +class Advertisement { + Advertisement({ + this.advertisementId, + this.advertisementTitle, + this.durationInSeconds, + this.showDelete, + this.acknowledgment, + this.viewAttachFileColl, + this.isActive, + this.pageSize, + this.pageNo, + this.languageId, + }); + + final int? advertisementId; + final String? advertisementTitle; + final int? durationInSeconds; + final bool? showDelete; + final dynamic acknowledgment; + final List? viewAttachFileColl; + final bool? isActive; + final dynamic pageSize; + final dynamic pageNo; + final dynamic languageId; + + factory Advertisement.fromJson(Map json) => Advertisement( + advertisementId: json["advertisementId"] == null ? null : json["advertisementId"], + advertisementTitle: json["advertisementTitle"] == null ? null : json["advertisementTitle"], + durationInSeconds: json["durationInSeconds"] == null ? null : json["durationInSeconds"], + showDelete: json["showDelete"] == null ? null : json["showDelete"], + acknowledgment: json["acknowledgment"], + viewAttachFileColl: json["viewAttachFileColl"] == null ? null : List.from(json["viewAttachFileColl"].map((x) => ViewAttachFileColl.fromJson(x))), + isActive: json["isActive"] == null ? null : json["isActive"], + pageSize: json["pageSize"], + pageNo: json["pageNo"], + languageId: json["languageId"], + ); + + Map toJson() => { + "advertisementId": advertisementId == null ? null : advertisementId, + "advertisementTitle": advertisementTitle == null ? null : advertisementTitle, + "durationInSeconds": durationInSeconds == null ? null : durationInSeconds, + "showDelete": showDelete == null ? null : showDelete, + "acknowledgment": acknowledgment, + "viewAttachFileColl": viewAttachFileColl == null ? null : List.from(viewAttachFileColl!.map((x) => x.toJson())), + "isActive": isActive == null ? null : isActive, + "pageSize": pageSize, + "pageNo": pageNo, + "languageId": languageId, + }; +} + +class ViewAttachFileColl { + ViewAttachFileColl({ + this.attachmentId, + this.fileName, + this.contentType, + this.attachFileStream, + this.base64String, + this.isActive, + this.referenceItemId, + this.content, + this.filePath, + }); + + final dynamic attachmentId; + final String? fileName; + final String? contentType; + final dynamic attachFileStream; + final String? base64String; + final dynamic isActive; + final dynamic referenceItemId; + final dynamic content; + final dynamic filePath; + + factory ViewAttachFileColl.fromJson(Map json) => ViewAttachFileColl( + attachmentId: json["attachmentId"], + fileName: json["fileName"] == null ? null : json["fileName"], + contentType: json["contentType"] == null ? null : json["contentType"], + attachFileStream: json["attachFileStream"], + base64String: json["base64String"] == null ? null : json["base64String"], + isActive: json["isActive"], + referenceItemId: json["referenceItemId"], + content: json["content"], + filePath: json["filePath"], + ); + + Map toJson() => { + "attachmentId": attachmentId, + "fileName": fileName == null ? null : fileName, + "contentType": contentType == null ? null : contentType, + "attachFileStream": attachFileStream, + "base64String": base64String == null ? null : base64String, + "isActive": isActive, + "referenceItemId": referenceItemId, + "content": content, + "filePath": filePath, + }; +} diff --git a/lib/models/itg/itg_main_response.dart b/lib/models/itg/itg_main_response.dart new file mode 100644 index 0000000..93ea9c8 --- /dev/null +++ b/lib/models/itg/itg_main_response.dart @@ -0,0 +1,195 @@ +// To parse this JSON data, do +// +// final itgRes = itgResFromJson(jsonString); + +import 'dart:convert'; + +import 'package:mohem_flutter_app/models/itg/itg_response_model.dart'; + +ItgMainRes itgResFromJson(String str) => ItgMainRes.fromJson(json.decode(str)); + +String itgResToJson(ItgMainRes data) => json.encode(data.toJson()); + +class ItgMainRes { + ItgMainRes({ + 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.mohemmItgPendingTaskResponseItem, + this.mohemmItgProjectDepartmentsList, + this.mohemmItgResponseItem, + this.mohemmItgSectionTopicsList, + this.mohemmItgTicketDetailsList, + this.mohemmItgTicketTransactionsList, + this.mohemmItgTicketsByEmployeeList, + this.mohemmItgProjectsList, + this.mohemmItgTicketTypesList, + this.referenceNumber, + this.requestType, + this.totalCount, + this.statuseCode, + }); + + final dynamic date; + final int? languageId; + final int? serviceName; + final dynamic time; + final dynamic androidLink; + final dynamic authenticationTokenId; + final dynamic data; + final bool? dataw; + final int? dietType; + final int? dietTypeId; + final dynamic errorCode; + final dynamic errorEndUserMessage; + final dynamic errorEndUserMessageN; + final dynamic errorMessage; + final int? errorType; + final int? foodCategory; + final dynamic iosLink; + final bool? isAuthenticated; + final int? mealOrderStatus; + final int? mealType; + final int? messageStatus; + final int? numberOfResultRecords; + final dynamic patientBlodType; + final dynamic successMsg; + final dynamic successMsgN; + final dynamic vidaUpdatedResponse; + final dynamic itgRequest; + final dynamic itgFormAttachmentsList; + final dynamic message; + final dynamic mohemmItgDepartmentSectionsList; + final dynamic mohemmItgPendingTaskResponseItem; + final dynamic mohemmItgProjectDepartmentsList; + final MohemmItgResponseItem? mohemmItgResponseItem; + final dynamic mohemmItgSectionTopicsList; + final dynamic mohemmItgTicketDetailsList; + final dynamic mohemmItgTicketTransactionsList; + final dynamic mohemmItgTicketsByEmployeeList; + final dynamic mohemmItgProjectsList; + final dynamic mohemmItgTicketTypesList; + final dynamic referenceNumber; + final dynamic requestType; + final int? totalCount; + final int? statuseCode; + + factory ItgMainRes.fromJson(Map json) => ItgMainRes( + 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"], + successMsgN: json["SuccessMsgN"], + vidaUpdatedResponse: json["VidaUpdatedResponse"], + itgRequest: json["ITGRequest"], + itgFormAttachmentsList: json["Itg_FormAttachmentsList"], + message: json["Message"], + mohemmItgDepartmentSectionsList: json["Mohemm_ITG_DepartmentSectionsList"], + mohemmItgPendingTaskResponseItem: json["Mohemm_ITG_Pending_Task_ResponseItem"], + mohemmItgProjectDepartmentsList: json["Mohemm_ITG_ProjectDepartmentsList"], + mohemmItgResponseItem: json["Mohemm_ITG_ResponseItem"] ==null ? null : MohemmItgResponseItem.fromJson(jsonDecode(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"], + requestType: json["RequestType"], + totalCount: json["TotalCount"] == null ? null : json["TotalCount"], + statuseCode: json["statuseCode"] == null ? null : json["statuseCode"], + ); + + Map toJson() => { + "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, + "SuccessMsgN": successMsgN, + "VidaUpdatedResponse": vidaUpdatedResponse, + "ITGRequest": itgRequest, + "Itg_FormAttachmentsList": itgFormAttachmentsList, + "Message": message, + "Mohemm_ITG_DepartmentSectionsList": mohemmItgDepartmentSectionsList, + "Mohemm_ITG_Pending_Task_ResponseItem": mohemmItgPendingTaskResponseItem, + "Mohemm_ITG_ProjectDepartmentsList": mohemmItgProjectDepartmentsList, + "Mohemm_ITG_ResponseItem": mohemmItgResponseItem == null ? null : 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, + "RequestType": requestType, + "TotalCount": totalCount == null ? null : totalCount, + "statuseCode": statuseCode == null ? null : statuseCode, + }; +} diff --git a/lib/models/itg/itg_response_model.dart b/lib/models/itg/itg_response_model.dart new file mode 100644 index 0000000..4dff106 --- /dev/null +++ b/lib/models/itg/itg_response_model.dart @@ -0,0 +1,159 @@ +// To parse this JSON data, do +// +// final mohemmItgResponseItem = mohemmItgResponseItemFromJson(jsonString); + +import 'dart:convert'; + +import 'package:mohem_flutter_app/models/itg/advertisement.dart'; + +MohemmItgResponseItem mohemmItgResponseItemFromJson(String str) => MohemmItgResponseItem.fromJson(json.decode(str)); + +String mohemmItgResponseItemToJson(MohemmItgResponseItem data) => json.encode(data.toJson()); + +class MohemmItgResponseItem { + MohemmItgResponseItem({ + this.statusCode, + this.message, + this.originalErrMsg, + this.result, + }); + + final int? statusCode; + final dynamic? message; + final dynamic? originalErrMsg; + final ItgResponseResult? result; + + factory MohemmItgResponseItem.fromJson(Map json) => MohemmItgResponseItem( + statusCode: json["statusCode"] == null ? null : json["statusCode"], + message: json["message"], + originalErrMsg: json["originalErrMsg"], + result: json["result"] == null ? null : ItgResponseResult.fromJson(json["result"]), + ); + + Map toJson() => { + "statusCode": statusCode == null ? null : statusCode, + "message": message, + "originalErrMsg": originalErrMsg, + "result": result == null ? null : result!.toJson(), + }; +} + +class ItgResponseResult { + ItgResponseResult({ + this.totalItemsCount, + this.data, + this.errormsg, + }); + + final dynamic totalItemsCount; + final ItgResponseData? data; + final dynamic errormsg; + + factory ItgResponseResult.fromJson(Map json) => ItgResponseResult( + totalItemsCount: json["totalItemsCount"], + data: json["data"] == null ? null : ItgResponseData.fromJson(json["data"]), + errormsg: json["errormsg"], + ); + + Map toJson() => { + "totalItemsCount": totalItemsCount, + "data": data == null ? null : data!.toJson(), + "errormsg": errormsg, + }; +} + +class ItgResponseData { + ItgResponseData({ + this.notificationMasterId, + this.notificationType, + this.referenceItemId, + this.notificationTitle, + this.enableAt, + this.applicationItemId, + this.startDate, + this.endDate, + this.isRepeat, + this.channelId, + this.serviceId, + this.channelName, + this.serviceName, + this.isDeleted, + this.showDelete, + this.advertisement, + this.survey, + this.isActive, + this.pageSize, + this.pageNo, + this.languageId, + }); + + final String? notificationMasterId; + final String? notificationType; + final int? referenceItemId; + final String? notificationTitle; + final String? enableAt; + final dynamic applicationItemId; + final dynamic startDate; + final dynamic endDate; + final bool? isRepeat; + final int? channelId; + final int? serviceId; + final String? channelName; + final String? serviceName; + final bool? isDeleted; + final bool? showDelete; + final Advertisement? advertisement; + final dynamic survey; + final dynamic isActive; + final dynamic pageSize; + final dynamic pageNo; + final dynamic languageId; + + factory ItgResponseData.fromJson(Map json) => ItgResponseData( + notificationMasterId: json["notificationMasterId"] == null ? null : json["notificationMasterId"], + notificationType: json["notificationType"] == null ? null : json["notificationType"], + referenceItemId: json["referenceItemId"] == null ? null : json["referenceItemId"], + notificationTitle: json["notificationTitle"] == null ? null : json["notificationTitle"], + enableAt: json["enableAt"] == null ? null : json["enableAt"], + applicationItemId: json["applicationItemId"], + startDate: json["startDate"], + endDate: json["endDate"], + isRepeat: json["isRepeat"] == null ? null : json["isRepeat"], + channelId: json["channelId"] == null ? null : json["channelId"], + serviceId: json["serviceId"] == null ? null : json["serviceId"], + channelName: json["channelName"] == null ? null : json["channelName"], + serviceName: json["serviceName"] == null ? null : json["serviceName"], + isDeleted: json["isDeleted"] == null ? null : json["isDeleted"], + showDelete: json["showDelete"] == null ? null : json["showDelete"], + advertisement: json["advertisement"] == null ? null : Advertisement.fromJson(json["advertisement"]), + survey: json["survey"], + isActive: json["isActive"], + pageSize: json["pageSize"], + pageNo: json["pageNo"], + languageId: json["languageId"], + ); + + Map toJson() => { + "notificationMasterId": notificationMasterId == null ? null : notificationMasterId, + "notificationType": notificationType == null ? null : notificationType, + "referenceItemId": referenceItemId == null ? null : referenceItemId, + "notificationTitle": notificationTitle == null ? null : notificationTitle, + "enableAt": enableAt == null ? null : enableAt, + "applicationItemId": applicationItemId, + "startDate": startDate, + "endDate": endDate, + "isRepeat": isRepeat == null ? null : isRepeat, + "channelId": channelId == null ? null : channelId, + "serviceId": serviceId == null ? null : serviceId, + "channelName": channelName == null ? null : channelName, + "serviceName": serviceName == null ? null : serviceName, + "isDeleted": isDeleted == null ? null : isDeleted, + "showDelete": showDelete == null ? null : showDelete, + "advertisement": advertisement, + "survey": survey, + "isActive": isActive, + "pageSize": pageSize, + "pageNo": pageNo, + "languageId": languageId, + }; +} diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index 964dab8..4e53242 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -17,6 +17,7 @@ import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/dashboard/menus.dart'; import 'package:mohem_flutter_app/models/dashboard/mohemm_itg_pending_task_responseitem.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/itg/itg_response_model.dart'; import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart'; /// Mix-in [DiagnosticableTreeMixin] to have access to [debugFillProperties] for the devtool @@ -248,6 +249,13 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { return menus; } + Future getITGNotification() async { + MohemmItgResponseItem? res = await DashboardApiClient().getITGPageNotification(); + return res; + } + + + void notify() { notifyListeners(); } diff --git a/lib/ui/dialogs/success_dialog.dart b/lib/ui/dialogs/success_dialog.dart new file mode 100644 index 0000000..8e1de54 --- /dev/null +++ b/lib/ui/dialogs/success_dialog.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import 'package:lottie/lottie.dart'; + +class SuccessDialog extends StatelessWidget { + bool isFromDashboard; + + SuccessDialog(this.isFromDashboard); + + @override + Widget build(BuildContext context) { + double size = MediaQuery.of(context).size.width / 1.8; + return Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Container( + width: size, + height: size, + child: Card( + child: Lottie.asset('assets/lottie/lt_success.json', repeat: false, reverse: false, onLoaded: (v) { + print("calling_lottie " + v.seconds.toString()); + Future.delayed(Duration(seconds: 2)).then((value) { + Navigator.pop(context); + if (isFromDashboard) Navigator.pop(context); + }); + }), + ), + ), + ], + ); + } +} diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index c99d2e7..c09c16d 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.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/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; @@ -12,13 +13,17 @@ 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/itg/itg_response_model.dart'; import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/ui/dialogs/success_dialog.dart'; +import 'package:mohem_flutter_app/ui/landing/itg/video_page.dart'; import 'package:mohem_flutter_app/ui/landing/widget/app_drawer.dart'; import 'package:mohem_flutter_app/ui/landing/widget/menus_widget.dart'; import 'package:mohem_flutter_app/ui/landing/widget/services_widget.dart'; import 'package:mohem_flutter_app/ui/marathon/widgets/marathon_banner.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; +import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart'; import 'package:mohem_flutter_app/widgets/mark_attendance_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/offers_shimmer_widget.dart'; @@ -38,8 +43,7 @@ class _DashboardScreenState extends State { late DashboardProviderModel data; final GlobalKey _scaffoldState = GlobalKey(); - final RefreshController _refreshController = - RefreshController(initialRefresh: false); + final RefreshController _refreshController = RefreshController(initialRefresh: false); int currentIndex = 0; @@ -59,6 +63,11 @@ class _DashboardScreenState extends State { void _onRefresh() async { data.initProvider(); + // data.getITGNotification().then((value) { + // print("--------------------detail_1-----------------"); + // print(value!.result!.data!.notificationMasterId); + // print(value.result!.data!.notificationTitle); + // }); data.fetchListMenu(); data.fetchAttendanceTracking(context); data.fetchWorkListCounter(context); @@ -73,6 +82,44 @@ class _DashboardScreenState extends State { Widget build(BuildContext context) { return Scaffold( key: _scaffoldState, + // appBar: AppBar( + // actions: [ + // IconButton( + // onPressed: () { + // data.getITGNotification().then((value) { + // print("--------------------detail_1-----------------"); + // if (value!.result!.data != null) { + // print(value.result!.data!.notificationMasterId); + // print(value.result!.data!.notificationType); + // if (value.result!.data!.notificationType == "Survey") { + // Navigator.pushNamed(context, AppRoutes.survey, arguments: value.result!.data); + // } else { + // DashboardApiClient().getAdvertisementDetail(value.result!.data!.notificationMasterId ?? "").then( + // (value) { + // if (value!.mohemmItgResponseItem!.statusCode == 200) { + // if (value.mohemmItgResponseItem!.result!.data != null) { + // String? image64 = value.mohemmItgResponseItem!.result!.data!.advertisement!.viewAttachFileColl!.first.base64String; + // print(image64); + // var sp = image64!.split("base64,"); + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => MovieTheaterBody( + // encodedBytes: sp[1], + // ), + // ), + // ); + // } + // } + // }, + // ); + // } + // } + // }); + // }, + // icon: Icon(Icons.add)) + // ], + // ), body: Column( children: [ Row( @@ -85,8 +132,7 @@ class _DashboardScreenState extends State { Utils.dataFromBase64String( AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", ), - errorBuilder: (BuildContext context, Object error, - StackTrace? stackTrace) { + errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) { return SvgPicture.asset( "assets/images/user.svg", height: 34, @@ -109,9 +155,7 @@ class _DashboardScreenState extends State { _scaffoldState.currentState!.openDrawer(); }); }), - Image.asset("assets/images/logos/main_mohemm_logo.png", - width: 134, height: 28) - .expanded, + Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 28).expanded, SvgPicture.asset( "assets/images/announcements.svg", ).onPress(() async { @@ -134,11 +178,8 @@ class _DashboardScreenState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.goodMorning - .tr() - .toText14(color: MyColors.grey77Color), - (AppState().memberInformationList!.eMPLOYEENAME ?? "") - .toText24(isBold: true), + LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color), + (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true), 16.height, Row( children: [ @@ -146,223 +187,92 @@ class _DashboardScreenState extends State { child: AspectRatio( aspectRatio: 159 / 159, child: Consumer( - builder: (BuildContext context, - DashboardProviderModel model, - Widget? child) { + builder: (BuildContext context, DashboardProviderModel model, Widget? 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, - ]), + 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"), + if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Column( - mainAxisSize: - MainAxisSize - .min, - crossAxisAlignment: - CrossAxisAlignment - .start, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys - .markAttendance - .tr() - .toText14( - color: Colors - .white, - isBold: - true), - if (model - .isTimeRemainingInSeconds == - 0) - DateTime.now() - .toString() - .split( - " ")[0] - .toText12( - color: Colors - .white), - if (model - .isTimeRemainingInSeconds != - 0) + LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), + if (model.isTimeRemainingInSeconds == 0) DateTime.now().toString().split(" ")[0].toText12(color: Colors.white), + if (model.isTimeRemainingInSeconds != 0) Column( - mainAxisSize: - MainAxisSize - .min, - crossAxisAlignment: - CrossAxisAlignment - .start, + 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: const TextStyle( - color: Colors - .white, - fontSize: - 14, - letterSpacing: - -0.48, - fontWeight: - FontWeight.bold), + endTime: model.endTime, + onEnd: null, + endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), + textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), ), - LocaleKeys - .timeLeftToday - .tr() - .toText12( - color: - Colors.white), + LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), 9.height, ClipRRect( - borderRadius: const BorderRadius - .all( - Radius.circular( - 20)), - child: - LinearProgressIndicator( - value: model - .progress, - minHeight: - 8, - valueColor: - const AlwaysStoppedAnimation(Colors.white), - backgroundColor: - const Color(0xff196D73), + borderRadius: const 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), + ).paddingOnly(top: 12, right: 15, left: 12), ), Row( children: [ Expanded( child: Column( - mainAxisSize: - MainAxisSize - .min, - crossAxisAlignment: - CrossAxisAlignment - .start, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys - .checkIn - .tr() - .toText12( - color: - Colors.white), - (model.attendanceTracking!.pSwipeIn == - null - ? "--:--" - : model - .attendanceTracking! - .pSwipeIn) + LocaleKeys.checkIn.tr().toText12(color: Colors.white), + (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) .toString() - .toText14( - color: Colors - .white, - isBold: - true), + .toText14(color: Colors.white, isBold: true), 4.height, ], - ).paddingOnly( - left: 12, - right: 12), + ).paddingOnly(left: 12, right: 12), ), Container( - margin: EdgeInsets.only( - top: AppState() - .isArabic( - context) - ? 6 - : 0), + margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0), width: 45, height: 45, - padding: - const EdgeInsets - .only( - left: 14, - right: - 14), - decoration: - BoxDecoration( - color: Color( - 0xff259EA4), - borderRadius: - BorderRadius - .only( - bottomRight: AppState() - .isArabic( - context) - ? Radius - .circular( - 0) - : Radius - .circular( - 15), - bottomLeft: AppState() - .isArabic( - context) - ? Radius - .circular( - 15) - : Radius - .circular( - 0), + padding: const EdgeInsets.only(left: 14, right: 14), + decoration: BoxDecoration( + color: Color(0xff259EA4), + borderRadius: BorderRadius.only( + bottomRight: AppState().isArabic(context) ? Radius.circular(0) : Radius.circular(15), + bottomLeft: AppState().isArabic(context) ? Radius.circular(15) : Radius.circular(0), ), ), - child: SvgPicture.asset( - model.isTimeRemainingInSeconds == - 0 - ? "assets/images/play.svg" - : "assets/images/stop.svg"), + child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), ).onPress(() { showMyBottomSheet( - context, - child: - MarkAttendanceWidget( - model)); + context, + child: MarkAttendanceWidget(model, isFromDashboard: true), + ); }), ], ), @@ -372,10 +282,7 @@ class _DashboardScreenState extends State { ), ).onPress( () { - Navigator.pushNamed( - context, - AppRoutes - .todayAttendance); + Navigator.pushNamed(context, AppRoutes.todayAttendance); }, )) .animatedSwither(); @@ -399,11 +306,8 @@ class _DashboardScreenState extends State { padding: const EdgeInsets.only(top: 31), decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.only( - topRight: Radius.circular(50), - topLeft: Radius.circular(50)), - border: Border.all( - color: MyColors.lightGreyEDColor, width: 1), + borderRadius: const BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), + border: Border.all(color: MyColors.lightGreyEDColor, width: 1), ), child: Column( mainAxisSize: MainAxisSize.min, @@ -420,32 +324,22 @@ class _DashboardScreenState extends State { LocaleKeys.offers.tr().toText12(), Row( children: [ - LocaleKeys.discounts - .tr() - .toText24(isBold: true), + LocaleKeys.discounts.tr().toText24(isBold: true), 6.width, Container( - padding: const EdgeInsets.only( - left: 8, right: 8), + padding: const EdgeInsets.only(left: 8, right: 8), decoration: BoxDecoration( color: MyColors.yellowColor, - borderRadius: - BorderRadius.circular(10), + borderRadius: BorderRadius.circular(10), ), - child: LocaleKeys.newString - .tr() - .toText10(isBold: true)), + child: LocaleKeys.newString.tr().toText10(isBold: true)), ], ), ], ), ), - LocaleKeys.viewAllOffers - .tr() - .toText12(isUnderLine: true) - .onPress(() { - Navigator.pushNamed( - context, AppRoutes.offersAndDiscounts); + LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() { + Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); }) ], ).paddingOnly(left: 21, right: 21), @@ -456,56 +350,38 @@ class _DashboardScreenState extends State { child: ListView.separated( shrinkWrap: true, physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.only( - left: 21, right: 21, top: 13), + padding: const EdgeInsets.only(left: 21, right: 21, top: 13), scrollDirection: Axis.horizontal, itemBuilder: (BuildContext cxt, int index) { return model.isOffersLoading ? const OffersShimmerWidget() : InkWell( onTap: () { - navigateToDetails( - data.getOffersList[index]); + navigateToDetails(data.getOffersList[index]); }, child: SizedBox( width: 73, child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: 73, height: 73, decoration: BoxDecoration( - borderRadius: - const BorderRadius - .all( + borderRadius: const BorderRadius.all( Radius.circular(100), ), - border: Border.all( - color: MyColors - .lightGreyE3Color, - width: 1), + border: Border.all(color: MyColors.lightGreyE3Color, width: 1), ), child: ClipRRect( - borderRadius: - const BorderRadius - .all( + borderRadius: const BorderRadius.all( Radius.circular(50), ), child: Hero( - tag: "ItemImage" + - data - .getOffersList[ - index] - .rowID!, - transitionOnUserGestures: - true, + tag: "ItemImage" + data.getOffersList[index].rowID!, + transitionOnUserGestures: true, child: Image.network( - data - .getOffersList[ - index] - .bannerImage!, + data.getOffersList[index].bannerImage!, fit: BoxFit.contain, ), ), @@ -513,33 +389,16 @@ class _DashboardScreenState extends State { ), 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), + child: AppState().isArabic(context) + ? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1) + : data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1), ), ], ), ), ); }, - separatorBuilder: - (BuildContext cxt, int index) => - 8.width, + separatorBuilder: (BuildContext cxt, int index) => 8.width, itemCount: 6), ); }, @@ -564,18 +423,14 @@ class _DashboardScreenState extends State { BottomNavigationBarItem( icon: SvgPicture.asset( "assets/icons/home.svg", - color: currentIndex == 0 - ? MyColors.grey3AColor - : MyColors.grey98Color, + color: currentIndex == 0 ? MyColors.grey3AColor : MyColors.grey98Color, ).paddingAll(4), label: LocaleKeys.home.tr(), ), BottomNavigationBarItem( icon: SvgPicture.asset( "assets/icons/create_req.svg", - color: currentIndex == 1 - ? MyColors.grey3AColor - : MyColors.grey98Color, + color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color, ).paddingAll(4), label: LocaleKeys.createRequest.tr(), ), @@ -585,13 +440,10 @@ class _DashboardScreenState extends State { children: [ SvgPicture.asset( "assets/icons/work_list.svg", - color: currentIndex == 2 - ? MyColors.grey3AColor - : MyColors.grey98Color, + color: currentIndex == 2 ? MyColors.grey3AColor : MyColors.grey98Color, ).paddingAll(4), Consumer( - builder: (BuildContext cxt, DashboardProviderModel data, - Widget? child) { + builder: (BuildContext cxt, DashboardProviderModel data, Widget? child) { if (data.workListCounter == 0) { return const SizedBox(); } @@ -601,12 +453,8 @@ class _DashboardScreenState extends State { child: Container( padding: const EdgeInsets.only(left: 4, right: 4), alignment: Alignment.center, - decoration: BoxDecoration( - color: MyColors.redColor, - borderRadius: BorderRadius.circular(17)), - child: data.workListCounter - .toString() - .toText10(color: Colors.white), + decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), + child: data.workListCounter.toString().toText10(color: Colors.white), ), ); }, @@ -618,38 +466,26 @@ class _DashboardScreenState extends State { BottomNavigationBarItem( icon: SvgPicture.asset( "assets/icons/item_for_sale.svg", - color: currentIndex == 3 - ? MyColors.grey3AColor - : MyColors.grey98Color, + color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color, ).paddingAll(4), label: LocaleKeys.itemsForSale.tr(), ), BottomNavigationBarItem( icon: SvgPicture.asset( "assets/icons/chat/chat.svg", - color: currentIndex == 4 - ? MyColors.grey3AColor - : MyColors.grey98Color, + color: currentIndex == 4 ? MyColors.grey3AColor : MyColors.grey98Color, ).paddingAll(4), label: LocaleKeys.chat.tr(), ), ], currentIndex: currentIndex, - selectedLabelStyle: const TextStyle( - fontSize: 10, - color: MyColors.grey3AColor, - fontWeight: FontWeight.w600), - unselectedLabelStyle: const TextStyle( - fontSize: 10, - color: MyColors.grey98Color, - fontWeight: FontWeight.w600), + selectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey3AColor, fontWeight: FontWeight.w600), + unselectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey98Color, fontWeight: FontWeight.w600), type: BottomNavigationBarType.fixed, selectedItemColor: MyColors.grey3AColor, backgroundColor: MyColors.backgroundColor, - selectedIconTheme: - const IconThemeData(color: MyColors.grey3AColor, size: 28), - unselectedIconTheme: - const IconThemeData(color: MyColors.grey98Color, size: 28), + selectedIconTheme: const IconThemeData(color: MyColors.grey3AColor, size: 28), + unselectedIconTheme: const IconThemeData(color: MyColors.grey98Color, size: 28), onTap: (int index) { if (index == 1) { Navigator.pushNamed(context, AppRoutes.mowadhafhi); @@ -682,7 +518,6 @@ class _DashboardScreenState extends State { } }); - Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, - arguments: getOffersDetailList); + Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList); } } diff --git a/lib/ui/landing/survey_screen.dart b/lib/ui/landing/itg/survey_screen.dart similarity index 62% rename from lib/ui/landing/survey_screen.dart rename to lib/ui/landing/itg/survey_screen.dart index a23733a..ec79d0f 100644 --- a/lib/ui/landing/survey_screen.dart +++ b/lib/ui/landing/itg/survey_screen.dart @@ -1,13 +1,19 @@ +import 'dart:convert'; + import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.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/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/itg/itg_main_response.dart'; +import 'package:mohem_flutter_app/models/itg/itg_response_model.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; @@ -20,10 +26,14 @@ class SurveyScreen extends StatefulWidget { class _SurveyScreenState extends State { String reviewText = ""; - int _selectedIndex = -1; + double starRating = 1; + int _selectedIndex = 5; + + ItgResponseData? itgResponseData; @override Widget build(BuildContext context) { + if (itgResponseData == null) itgResponseData = ModalRoute.of(context)!.settings.arguments as ItgResponseData; return Scaffold( backgroundColor: MyColors.backgroundColor, body: Column( @@ -41,19 +51,23 @@ class _SurveyScreenState extends State { LocaleKeys.rateUI.tr().toText16(), 22.height, Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ RatingBar.builder( initialRating: 3, - minRating: 1, + minRating: starRating, direction: Axis.horizontal, - allowHalfRating: true, + allowHalfRating: false, itemCount: 5, - itemPadding: EdgeInsets.symmetric(horizontal: 12), + itemPadding: EdgeInsets.symmetric(horizontal: 8), itemBuilder: (context, _) => Icon( Icons.star, color: Colors.amber, ), - onRatingUpdate: (rating) {}, + onRatingUpdate: (rating) { + starRating = rating; + }, ) ], ).paddingOnly(left: 22, right: 22, top: 12, bottom: 12).objectContainerView(disablePadding: true), @@ -66,11 +80,11 @@ class _SurveyScreenState extends State { padding: const EdgeInsets.only(top: 0), shrinkWrap: true, children: [ - optionUI("poor.svg", 0), - optionUI("bad.svg", 1), - optionUI("normal.svg", 2), - optionUI("good.svg", 3), - optionUI("xcellent.svg", 4), + optionUI("poor.svg", 1), + optionUI("bad.svg", 2), + optionUI("normal.svg", 3), + optionUI("good.svg", 4), + optionUI("xcellent.svg", 5), ], ), 27.height, @@ -78,13 +92,21 @@ class _SurveyScreenState extends State { LocaleKeys.description.tr(), LocaleKeys.typeHere.tr(), lines: 3, + onChange: (v) { + reviewText = v; + }, ), 150.height ], ).paddingOnly(left: 21, right: 21), ], )), - DefaultButton(LocaleKeys.submitSurvey.tr(), () async {}).insideContainer, + DefaultButton( + LocaleKeys.submitSurvey.tr(), + () { + performAPI(); + }, + ).insideContainer, ], )); } @@ -108,4 +130,34 @@ class _SurveyScreenState extends State { setState(() {}); }); } + + void performAPI() async { + Utils.showLoading(context); + try { + ItgMainRes? res= await DashboardApiClient().submitItgForm( + comment: reviewText, + masterId: itgResponseData!.notificationMasterId ?? "", + itgList: [ + {"questionId": "1", "optionId": null, "starRating": starRating}, + {"questionId": "2", "optionId": "4", "starRating": _selectedIndex} + ], + serviceId: itgResponseData!.serviceId ?? 0); + Utils.hideLoading(context); + + + + if(res!.mohemmItgResponseItem!.statusCode==200){ + Utils.showToast("Survey has been submitted successfully"); + Navigator.pop(context); + }else{ + Utils.showToast(res.mohemmItgResponseItem!.message.toString()); + } + + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, (msg) { + Utils.confirmDialog(context, msg); + }); + } + } } diff --git a/lib/ui/landing/itg/video_page.dart b/lib/ui/landing/itg/video_page.dart new file mode 100644 index 0000000..657d714 --- /dev/null +++ b/lib/ui/landing/itg/video_page.dart @@ -0,0 +1,96 @@ +import 'dart:convert'; +import 'dart:io' as Io; + +import 'package:flutter/material.dart'; +import 'package:video_player/video_player.dart'; + +class MovieTheaterBody extends StatefulWidget { + final String encodedBytes; + + const MovieTheaterBody({required this.encodedBytes}); + + @override + _MovieTheaterBodyState createState() => _MovieTheaterBodyState(); +} + +class _MovieTheaterBodyState extends State { + late Future _futureController; + late VideoPlayerController _controller; + + Future createVideoPlayer() async { + try { + var decodedBytes = base64Decode(widget.encodedBytes); + + var file = Io.File("decodedBezkoder.mp4"); + file.writeAsBytesSync(decodedBytes); + + VideoPlayerController controller = VideoPlayerController.file(file); + await controller.initialize(); + await controller.setLooping(true); + return controller; + } catch (e) { + print("object0000000"); + print(e); + return new VideoPlayerController.asset("dataSource"); + } + } + + @override + void initState() { + _futureController = createVideoPlayer(); + super.initState(); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Expanded( + child: FutureBuilder( + future: _futureController, + builder: (context, snapshot) { + //UST: 05/2021 - MovieTheaterBody - id:11 - 2pts - Criação + if (snapshot.connectionState == ConnectionState.done && snapshot.data != null) { + _controller = snapshot.data as VideoPlayerController; + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AspectRatio( + aspectRatio: _controller.value.aspectRatio, + child: VideoPlayer(_controller), + ), + const SizedBox( + height: 50, + ), + FloatingActionButton( + onPressed: () { + setState(() { + if (_controller.value.isPlaying) { + _controller.pause(); + } else { + // If the video is paused, play it. + _controller.play(); + } + }); + }, + backgroundColor: Colors.green[700], + child: Icon( + _controller.value.isPlaying ? Icons.pause : Icons.play_arrow, + ), + ) + ], + ); + } else { + return const Center(child: CircularProgressIndicator()); + } + }, + ), + ), + ); + } +} diff --git a/lib/ui/landing/today_attendance_screen.dart b/lib/ui/landing/today_attendance_screen.dart index cde099d..54c08e7 100644 --- a/lib/ui/landing/today_attendance_screen.dart +++ b/lib/ui/landing/today_attendance_screen.dart @@ -1,3 +1,4 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; @@ -107,29 +108,37 @@ class _TodayAttendanceScreenState extends State { child: AspectRatio( aspectRatio: 265 / 265, child: CircularStepProgressBar( - totalSteps: 16 * 4, - currentStep: (model.progress * 100).toInt(), - //width: 216, - // height: 216, - selectedColor: MyColors.gradiantEndColor, - unselectedColor: MyColors.grey70Color, - child: Center( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - CountdownTimer( - endTime: model.endTime, - onEnd: null, - endWidget: "00:00:00".toText32(color: Colors.white, isBold: true), - textStyle: TextStyle(color: Colors.white, fontSize: 32, letterSpacing: -1.92, fontWeight: FontWeight.bold, height: 1), - ), - 19.height, - LocaleKeys.shiftTime.tr().tr().toText12(color: MyColors.greyACColor), - (model.attendanceTracking!.pShtName ?? "00:00:00").toString().toText22(color: Colors.white, isBold: true), - ], - ), - ), - ), + totalSteps: 16 * 4, + currentStep: (model.progress * 100).toInt(), + //width: 216, + // height: 216, + selectedColor: MyColors.gradiantEndColor, + unselectedColor: MyColors.grey70Color, + child: Padding( + padding: const EdgeInsets.all(21.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CountdownTimer( + endTime: model.endTime, + widgetBuilder: (context, v) { + return AutoSizeText( + v!.hours.toString() + " : " + v.min.toString() + " : " + v.sec.toString(), + style: TextStyle(color: Colors.white, fontSize: 42, letterSpacing: -1.92, fontWeight: FontWeight.bold, height: 1), + ); + }, + onEnd: null, + endWidget: "00:00:00".toTextAuto(color: Colors.white, isBold: true, fontSize: 30, letterSpacing: -1.92), + textStyle: TextStyle(color: Colors.white, fontSize: 30, letterSpacing: -1.92, fontWeight: FontWeight.bold, height: 1), + ), + 19.height, + LocaleKeys.shiftTime.tr().tr().toTextAuto(color: MyColors.greyACColor, fontSize: 18), + (model.attendanceTracking!.pShtName ?? "00:00:00").toString().toTextAuto(color: Colors.white, isBold: true, fontSize: 26), + ], + ), + )), ).paddingAll(21), ).expanded, ], diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 4a7b659..0e9b454 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -140,7 +140,7 @@ class _LoginScreenState extends State { Widget build(BuildContext context) { if (isAppOpenBySystem == null) { isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; - if (kReleaseMode) { + if (!kReleaseMode) { // username.text = "15444"; // Maha User username.text = "15153"; // Tamer User password.text = "Abcd@12345"; diff --git a/lib/widgets/dialogs/dialogs.dart b/lib/widgets/dialogs/dialogs.dart index 8c65a20..debb147 100644 --- a/lib/widgets/dialogs/dialogs.dart +++ b/lib/widgets/dialogs/dialogs.dart @@ -1,11 +1,12 @@ import 'package:flutter/material.dart'; -void showMDialog(context, {Widget? child}) async { +void showMDialog(context, {Widget? child,Color? backgroundColor,bool isDismissable=true}) async { return showDialog( context: context, - barrierDismissible: true, + barrierDismissible: isDismissable, builder: (context) { return Dialog( + backgroundColor: backgroundColor, child: child, ); }, diff --git a/lib/widgets/mark_attendance_widget.dart b/lib/widgets/mark_attendance_widget.dart index 90c57e3..1780d68 100644 --- a/lib/widgets/mark_attendance_widget.dart +++ b/lib/widgets/mark_attendance_widget.dart @@ -13,6 +13,8 @@ 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/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/ui/dialogs/success_dialog.dart'; +import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart'; import 'package:mohem_flutter_app/widgets/location/Location.dart'; import 'package:mohem_flutter_app/widgets/nfc/nfc_reader_sheet.dart'; import 'package:mohem_flutter_app/widgets/qr_scanner_dialog.dart'; @@ -22,8 +24,9 @@ import 'package:wifi_iot/wifi_iot.dart'; class MarkAttendanceWidget extends StatefulWidget { DashboardProviderModel model; double topPadding; + bool isFromDashboard; - MarkAttendanceWidget(this.model, {Key? key, this.topPadding = 0}) : super(key: key); + MarkAttendanceWidget(this.model, {Key? key, this.topPadding = 0, this.isFromDashboard = false}) : super(key: key); @override _MarkAttendanceWidgetState createState() { @@ -141,6 +144,12 @@ class _MarkAttendanceWidgetState extends State { GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "", isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng); bool status = await model.fetchAttendanceTracking(context); Utils.hideLoading(context); + showMDialog( + context, + backgroundColor: Colors.transparent, + isDismissable: false, + child: SuccessDialog(widget.isFromDashboard), + ); } catch (ex) { print(ex); Utils.hideLoading(context); @@ -175,6 +184,12 @@ class _MarkAttendanceWidgetState extends State { if (Platform.isAndroid) { await closeWifiRequest(); } + showMDialog( + context, + backgroundColor: Colors.transparent, + isDismissable: false, + child: SuccessDialog(widget.isFromDashboard), + ); } catch (ex) { print("performWifiAttendance: " + ex.toString()); await closeWifiRequest(); @@ -208,6 +223,12 @@ class _MarkAttendanceWidgetState extends State { GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 1, isGpsRequired: isQrLocationEnabled, lat: lat, long: lng, QRValue: qrCodeValue); bool status = await model.fetchAttendanceTracking(context); Utils.hideLoading(context); + showMDialog( + context, + backgroundColor: Colors.transparent, + isDismissable: false, + child: SuccessDialog(widget.isFromDashboard), + ); } catch (ex) { print(ex); Utils.hideLoading(context); diff --git a/pubspec.yaml b/pubspec.yaml index e621c50..f66fe24 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -91,6 +91,8 @@ dependencies: + video_player: ^2.4.7 + dev_dependencies: flutter_test: sdk: flutter