diff --git a/assets/audio/success_tone_android.mp3 b/assets/audio/success_tone_android.mp3 new file mode 100644 index 0000000..b8ad93f Binary files /dev/null and b/assets/audio/success_tone_android.mp3 differ diff --git a/assets/audio/success_tone_ios.caf b/assets/audio/success_tone_ios.caf new file mode 100644 index 0000000..f2bcbaf Binary files /dev/null and b/assets/audio/success_tone_ios.caf differ diff --git a/assets/icons/ic_alarm.png b/assets/icons/ic_alarm.png new file mode 100644 index 0000000..5bc71e7 Binary files /dev/null and b/assets/icons/ic_alarm.png differ diff --git a/assets/images/attendance.svg b/assets/images/attendance.svg new file mode 100644 index 0000000..974fba3 --- /dev/null +++ b/assets/images/attendance.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/images/drawer/drawer_marathon.svg b/assets/images/drawer/drawer_marathon.svg new file mode 100644 index 0000000..33b6c02 --- /dev/null +++ b/assets/images/drawer/drawer_marathon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/marathon_banner_bg.svg b/assets/images/marathon_banner_bg.svg index 9053afc..767a78c 100644 --- a/assets/images/marathon_banner_bg.svg +++ b/assets/images/marathon_banner_bg.svg @@ -28,87 +28,91 @@ - + + + + + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - + + - + - + - + @@ -117,121 +121,121 @@ - - + + - + - + - - - - - - - - - - + + + + + + + + + + - - + + - + - - - - + + + + - - + + - + - - + + - + - - - + + + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + - - + + - + - - - + + + - + - + - + @@ -239,19 +243,19 @@ - - - - - - - - + + + + + + + + - - + + - + @@ -271,10 +275,10 @@ - + - - + + @@ -302,8 +306,8 @@ - - + + diff --git a/assets/images/monthly_attendance.svg b/assets/images/monthly_attendance.svg index c84a9a1..b77ccc3 100644 --- a/assets/images/monthly_attendance.svg +++ b/assets/images/monthly_attendance.svg @@ -7,9 +7,9 @@ - - - + + + diff --git a/assets/images/winner_ribbon.svg b/assets/images/winner_ribbon.svg new file mode 100644 index 0000000..7a6fbd7 --- /dev/null +++ b/assets/images/winner_ribbon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 2ba3cdd..f72ea36 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -423,6 +423,7 @@ "skip": "يتخطى", "typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه", "currentPassword": "كلمة المرور الحاليه", + "concurrentReports": "التقارير المتزامنه", "profile": { "reset_password": { "label": "Reset Password", @@ -492,6 +493,10 @@ "winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.", "fingersCrossed": "تشابك الاصابع!!!", "congrats": "مبروك !!!", - "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح." - + "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح.", + "otp": "OTP", + "verification": "تَحَقّق", + "resend": "إعادة إرسال", + "codeExpire": "انتهت صلاحية رمز التحقق", + "typeheretoreply": "اكتب هنا للرد" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 3c3c504..e0b9019 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -284,7 +284,7 @@ "add": "Add", "edit": "Edit", "myProfile": "My Profile", - "mowadhafhi": "Mowadhafhi", + "mowadhafhi": "Mowadhafi", "searchAnnouncements": "Search Announcements", "announcements": "Announcements", "swipeRequest": "Swipe Request", @@ -296,7 +296,7 @@ "relatedTopic": "Related Topic", "selectTopic": "Select Topic", "supportingDocument": "Supporting Document", - "mowadhafhiRequest": "Mowadhafhi Request", + "mowadhafhiRequest": "Mowadhafi Request", "ticketReference": "Ticket Reference", "section": "Section", "topic": "Topic", @@ -423,6 +423,7 @@ "skip": "Skip", "typeCurrentPasswordBelow": "Type Your Current password below", "currentPassword": "Current password", + "concurrentReports": "Concurrent Reports", "profile": { "reset_password": { "label": "Reset Password", @@ -492,5 +493,10 @@ "winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.", "fingersCrossed": "Fingers Crossed!!!", "congrats": "Congratulations!!!", - "allQuestionsCorrect": "You have answered all questions correct" + "otp": "OTP", + "verification": "Verification", + "resend": "Resend", + "codeExpire": "The verification code has been expired", + "allQuestionsCorrect": "You have answered all questions correct", + "typeheretoreply": "Type here to reply" } \ No newline at end of file diff --git a/assets/lottie/loading.json b/assets/lottie/loading.json new file mode 100644 index 0000000..ea7bff3 --- /dev/null +++ b/assets/lottie/loading.json @@ -0,0 +1 @@ +{"v":"5.8.1","fr":30,"ip":0,"op":60,"w":100,"h":100,"nm":"loading_6","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":60,"s":[360]}],"ix":10},"p":{"a":0,"k":[50.00000000000002,50.00000000000002,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[10.000000000000004,10.000000000000004,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[300,300],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.12941176470588237,0.7411764705882353,0.7764705882352941,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":50,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"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":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[0]},{"t":60,"s":[99]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[1]},{"t":50,"s":[100]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":60,"s":[3]}],"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":300,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":30,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50.00000000000002,50.00000000000002,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[10.000000000000004,10.000000000000004,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[300,300],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.7450980392156863,0.9254901960784314,0.9372549019607843,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":50,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"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":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}],"markers":[]} \ No newline at end of file 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/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 2646e3b..9daee21 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -345,6 +345,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -363,7 +364,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -382,11 +383,11 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 99Z3UD3LJM; + DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Mohemm; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -423,6 +424,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -447,7 +449,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -478,6 +480,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -496,10 +499,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -516,11 +520,11 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 99Z3UD3LJM; + DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Mohemm; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -545,11 +549,11 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 99Z3UD3LJM; + DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Mohemm; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 3db53b6..c87d15a 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -27,8 +27,6 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - + + - - ? args) { + dynamic items = args!.toList(); + for (dynamic cItem in items[0]) { + for (SingleUserChatModel chat in userChatHistory) { + if (chat.userChatHistoryId.toString() == cItem["userChatHistoryId"].toString()) { + logger.d(jsonEncode(chat)); + chat.isSeen = cItem["isSeen"]; + chat.isDelivered = cItem["isDelivered"]; + notifyListeners(); + } + } + } + } + void userCountAsync(List? args) { List items = args!.toList(); print("---------------------------------User Count Async -------------------------------------"); @@ -166,7 +182,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void changeStatus(List? args) { // print("================= Status Online // Offline ===================="); List items = args!.toList(); - logger.d(items); + // logger.d(items); for (ChatUser user in searchedChats!) { if (user.id == items.first["id"]) { user.userStatus = items.first["userStatus"]; @@ -192,9 +208,14 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { Future onMsgReceived(List? parameters) async { List data = []; + List temp = []; for (dynamic msg in parameters!) { data = getSingleUserChatModel(jsonEncode(msg)); - logger.d(msg); + temp = getSingleUserChatModel(jsonEncode(msg)); + data.first.targetUserId = temp.first.currentUserId; + data.first.targetUserName = temp.first.currentUserName; + data.first.currentUserId = temp.first.targetUserId; + data.first.currentUserName = temp.first.targetUserName; } userChatHistory.add(data.first); notifyListeners(); @@ -207,11 +228,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { for (ChatUser user in searchedChats!) { if (user.id == parameters![1] && parameters[0] == true) { user.isTyping = parameters[0] as bool?; - } else { + Future.delayed( - const Duration(milliseconds: 500), + const Duration(seconds: 2), () { user.isTyping = false; + notifyListeners(); }, ); } @@ -223,6 +245,17 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { if (chatMessage == null || chatMessage.isEmpty) { return; } + + var contain = searchedChats!.where((ChatUser element) => element.id == targetUserId); + if (contain.isEmpty) { + searchedChats!.add( + ChatUser( + id: targetUserId, + userName: targetUserName, + ), + ); + } + String chatData = '{"contant":"$chatMessage","contantNo":"8a129295-36d7-7185-5d34-cc4eec7bcba4","chatEventId":1,"fileTypeId":null,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"conversationId":"715f8b13-96ee-cd36-cb07-5a982a219982"}'; await hubConnection.invoke("AddChatUserAsync", args: [json.decode(chatData)]); 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/api/my_requests_api_client.dart b/lib/api/my_requests_api_client.dart index 391e297..c9507b9 100644 --- a/lib/api/my_requests_api_client.dart +++ b/lib/api/my_requests_api_client.dart @@ -6,6 +6,7 @@ import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_dff_structure_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_output_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_transactions_model.dart'; +import 'package:mohem_flutter_app/models/my_requests/get_ccp_transations_list_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_concurrent_programs_model.dart'; class MyRequestsApiClient { @@ -59,4 +60,38 @@ class MyRequestsApiClient { }, url, postParams); } + Future getSubmitNewRequest(List> list) async + { + String url = "${ApiConsts.erpRest}SUBMIT_CCP_TRANSACTION"; + Map postParams = { + "P_MENU_TYPE": "E", + "P_SELECTED_RESP_ID": -999, + "P_DESC_FLEX_NAME": "HMG_EMP_BUS_TRIP_SET_SS", + }; + + postParams.addAll(AppState().postParamsJson); + postParams["EITTransactionTBL"] = list; + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.submitCcpTransactionList; + }, url, postParams); + } + + Future> getCcpTransactions(List> list) async + { + String url = "${ApiConsts.erpRest}GET_CCP_TRANSACTIONS"; + Map postParams = { + "P_MENU_TYPE": "E", + "P_SELECTED_RESP_ID": -999, + "P_DESC_FLEX_NAME": "HMG_EMP_BUS_TRIP_SET_SS", + }; + + postParams.addAll(AppState().postParamsJson); + postParams["EITTransactionTBL"] = list; + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getCCPTransactionsModel ?? []; + }, url, postParams); + } + } diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index 832b6d8..d7ceba0 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -97,7 +97,7 @@ class ProfileApiClient { Future getDffStructure(String pFunctionName, String uRL, String requestType) async { String url = ApiConsts.erpRest + uRL; - Map postParams = {"P_SELECTED_RESP_ID": -999, "P_MENU_TYPE": "E", "P_REQUEST_TYPE": pFunctionName, "P_COUNTRY_CODE": "SA"}; + Map postParams = {"P_SELECTED_RESP_ID": -999, "P_MENU_TYPE": "E", "P_REQUEST_TYPE": pFunctionName, "P_FUNCTION_NAME": pFunctionName, "P_COUNTRY_CODE": "SA"}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index e670bbc..b77e7b1 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -29,6 +29,7 @@ class MyColors { static const Color darkWhiteColor = Color(0xffE0E0E0); static const Color redColor = Color(0xffD02127); static const Color pinkColor = Color(0xffEBA9A9); + static const Color pinkDarkColor = Color(0xffe3797d); static const Color yellowColor = Color(0xffF4E31C); static const Color orange = Color(0xFFCC9B14); static const Color yellowFavColor = Color(0xffEAC321); @@ -58,4 +59,5 @@ class MyColors { static const Color greyC4Color = Color(0xffC4C4C4); static const Color grey35Color = Color(0xff535353); static const Color grey9DColor = Color(0xff9D9D9D); + static const Color darkDigitColor = Color(0xff2D2F39); } diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index e82c30a..eea2481 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,7 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server - static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - // static String baseUrl = "https://hmgwebservices.com"; // Live server + // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server + static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; diff --git a/lib/classes/decorations_helper.dart b/lib/classes/decorations_helper.dart index 67139b8..77ea4a4 100644 --- a/lib/classes/decorations_helper.dart +++ b/lib/classes/decorations_helper.dart @@ -14,9 +14,12 @@ class MyDecorations { ], ); - static Decoration answerContainerDecoration = BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: MyColors.greyF7Color, - border: Border.all(width: 1, color: MyColors.lightGreyEFColor), - ); + static Decoration getContainersDecoration(Color color) { + Decoration answerContainerDecoration = BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: color, + border: Border.all(width: 1, color: MyColors.lightGreyEFColor), + ); + return answerContainerDecoration; + } } diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index af9e340..7e7e83c 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -17,6 +17,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/widgets/dialogs/confirm_dialog.dart'; import 'package:mohem_flutter_app/widgets/loading_dialog.dart'; +import 'package:nfc_manager/nfc_manager.dart'; +import 'package:nfc_manager/platform_tags.dart'; import 'package:shared_preferences/shared_preferences.dart'; // ignore_for_file: avoid_annotating_with_dynamic @@ -287,7 +289,9 @@ class Utils { String formattedDate; if (date.isNotEmpty) { formattedDate = date.split('T')[0]; - formattedDate = formattedDate + ' 00:00:00'; + if(!formattedDate.contains("00:00:00")) { + formattedDate = formattedDate + ' 00:00:00'; + } } else { formattedDate = date; } @@ -321,4 +325,22 @@ class Utils { } return selectedDate; } + + static void readNFc({required Function(String) onRead}) { + + NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async { + print(tag.data); + var f; + if (Platform.isAndroid) { + f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22); + } else { + f = MifareUltralight(tag: tag, identifier: tag.data["mifare"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22); + } + String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join(''); + NfcManager.instance.stopSession(); + onRead(identifier); + }).catchError((err) { + print(err); + }); + } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index c647953..1fcbf2e 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -6,8 +6,9 @@ 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/landing/today_attendance_screen2.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'; import 'package:mohem_flutter_app/ui/login/change_password_screen.dart'; @@ -193,7 +194,7 @@ class AppRoutes { subMenuScreen: (BuildContext context) => SubMenuScreen(), newPassword: (BuildContext context) => NewPasswordScreen(), forgotPassword: (BuildContext context) => ForgotPasswordScreen(), - todayAttendance: (BuildContext context) => TodayAttendanceScreen(), + todayAttendance: (BuildContext context) => TodayAttendanceScreen2(), //eit addEitScreen: (BuildContext context) => AddEITScreen(), diff --git a/lib/dialogs/otp_dialog.dart b/lib/dialogs/otp_dialog.dart index 23c7c67..3952e70 100644 --- a/lib/dialogs/otp_dialog.dart +++ b/lib/dialogs/otp_dialog.dart @@ -7,7 +7,9 @@ import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/otp_widget.dart'; +import 'package:sizer/sizer.dart'; class OtpDialog { final int type; @@ -15,6 +17,7 @@ class OtpDialog { final Function(String) onSuccess; final Function onFailure; final BuildContext context; + final Function onResendCode; int remainingTime = 120; @@ -24,13 +27,7 @@ class OtpDialog { static bool? _loading; - OtpDialog( - this.context, - this.type, - this.mobileNo, - this.onSuccess, - this.onFailure, - ); + OtpDialog(this.context, this.type, this.mobileNo, this.onSuccess, this.onFailure, {required this.onResendCode}); GlobalKey? verifyAccountForm = GlobalKey(); @@ -69,7 +66,7 @@ class OtpDialog { // projectProvider = Provider.of(context); return Dialog( backgroundColor: Colors.white, - shape: const RoundedRectangleBorder(), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), insetPadding: const EdgeInsets.only(left: 21, right: 21), child: StatefulBuilder(builder: (context, setState) { if (displayTime == '') { @@ -77,37 +74,26 @@ class OtpDialog { } return Container( - padding: EdgeInsets.only(left: 21, right: 18, top: 39, bottom: 59), + padding: EdgeInsets.all(21), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SvgPicture.asset( - type == 1 - ? "assets/images/login/verify_sms.svg" - : type == 2 - ? "assets/images/login/verify_whatsapp.svg" - : type == 3 - ? "assets/images/login/verify_face.svg" - : 'assets/images/login/verify_thumb.svg', - height: 50, - width: 50, - ), - IconButton( - padding: EdgeInsets.zero, - icon: const Icon(Icons.close), - constraints: const BoxConstraints(), - onPressed: () { - stopTimer = true; - onFailure(); - }) - ], + SvgPicture.asset( + type == 1 + ? "assets/images/login/verify_sms.svg" + : type == 2 + ? "assets/images/login/verify_whatsapp.svg" + : type == 3 + ? "assets/images/login/verify_face.svg" + : 'assets/images/login/verify_thumb.svg', + height: 50, + width: 50, ), - 22.height, + 12.height, + LocaleKeys.otp.tr().toText14(), + LocaleKeys.verification.tr().toText24(isBold: true), + 6.height, (LocaleKeys.pleaseEnterTheVerificationCodeSentTo.tr() + ' xxxxxxxx' + mobileNo.toString().substring(mobileNo.toString().length - 3)).toText16(), 18.height, Directionality( @@ -132,18 +118,55 @@ class OtpDialog { ), ), ), - 30.height, - RichText( - text: TextSpan( - text: LocaleKeys.theVerificationCodeWillExpireIn.tr() + '\n', - style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48), - children: [ - TextSpan( - text: displayTime, - style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.textMixColor, letterSpacing: -0.48), + 10.height, + stopTimer + ? Row( + children: [ + Expanded( + child: LocaleKeys.codeExpire.tr().toText16( + color: MyColors.redColor, + ), + ), + 12.width, + Image.asset( + "assets/icons/ic_alarm.png", + width: 20, + height: 20, + color: MyColors.redColor, + ), + ], + ) + : RichText( + text: TextSpan( + text: LocaleKeys.theVerificationCodeWillExpireIn.tr() + '\n', + style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48), + children: [ + TextSpan( + text: displayTime, + style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.textMixColor, letterSpacing: -0.48), + ), + ], + ), ), - ], - ), + 18.height, + DefaultButton( + stopTimer ? LocaleKeys.resend.tr() : LocaleKeys.cancel.tr(), + () async { + if (stopTimer) { + hideSMSBox(context); + onResendCode(); + } else { + stopTimer = true; + // onFailure(); + hideSMSBox(context); + } + }, + colors: stopTimer + ? null + : [ + MyColors.pinkDarkColor, + MyColors.pinkDarkColor, + ], ), ], ), @@ -208,7 +231,9 @@ class OtpDialog { if (remainingTime > 0) { startTimer(setState); } else { - Navigator.pop(context); + setState(() { + stopTimer = true; + }); } }); } diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 9ee4546..37f41ae 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: 5, 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/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index ad41cfb..64aaae8 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -12,21 +12,14 @@ extension WidgetExtensions on Widget { Widget get center => Center(child: this); - Widget circle(double _value) => - ClipRRect(borderRadius: BorderRadius.circular(_value), child: this); + Widget circle(double _value) => ClipRRect(borderRadius: BorderRadius.circular(_value), child: this); - Widget paddingAll(double _value) => - Padding(padding: EdgeInsets.all(_value), child: this); + Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this); - 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 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 toExpanded({int flex = 1}) => Expanded(flex: flex, child: this); Widget toShimmer({bool isShow = true}) => isShow ? Shimmer.fromColors( @@ -51,15 +44,9 @@ extension WidgetExtensions on Widget { child: this, ); - Widget objectContainerView( - {String title = "", - String note = "", - bool disablePadding = false, - double radius = 15}) { + Widget objectContainerView({String title = "", String note = "", bool disablePadding = false, double radius = 15}) { return Container( - padding: disablePadding - ? EdgeInsets.zero - : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), + padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(radius), @@ -95,9 +82,7 @@ extension WidgetExtensions on Widget { bool disableWidth = false, bool isAlignment = false}) { return Container( - padding: disablePadding - ? EdgeInsets.zero - : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), + padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), decoration: BoxDecoration( borderRadius: BorderRadius.circular(radius), color: color, diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 5da5ba1..e9dd08c 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -439,6 +439,7 @@ class CodegenLoader extends AssetLoader{ "skip": "يتخطى", "typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه", "currentPassword": "كلمة المرور الحاليه", + "concurrentReports": "التقارير المتزامنه", "profile": { "reset_password": { "label": "Reset Password", @@ -508,7 +509,12 @@ class CodegenLoader extends AssetLoader{ "winnerSelectedRandomly": "سيتم اختيار الفائز عشوائياً من بين التصفيات.", "fingersCrossed": "تشابك الاصابع!!!", "congrats": "مبروك !!!", - "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح." + "allQuestionsCorrect": "لقد أجبت على جميع الأسئلة بشكل صحيح.", + "otp": "OTP", + "verification": "تَحَقّق", + "resend": "إعادة إرسال", + "codeExpire": "انتهت صلاحية رمز التحقق", + "typeheretoreply": "اكتب هنا للرد" }; static const Map en_US = { "mohemm": "Mohemm", @@ -796,7 +802,7 @@ static const Map en_US = { "add": "Add", "edit": "Edit", "myProfile": "My Profile", - "mowadhafhi": "Mowadhafhi", + "mowadhafhi": "Mowadhafi", "searchAnnouncements": "Search Announcements", "announcements": "Announcements", "swipeRequest": "Swipe Request", @@ -808,7 +814,7 @@ static const Map en_US = { "relatedTopic": "Related Topic", "selectTopic": "Select Topic", "supportingDocument": "Supporting Document", - "mowadhafhiRequest": "Mowadhafhi Request", + "mowadhafhiRequest": "Mowadhafi Request", "ticketReference": "Ticket Reference", "section": "Section", "topic": "Topic", @@ -932,9 +938,10 @@ static const Map en_US = { "updateMember": "Are You Sure You Want to Update this Member?", "fieldIsEmpty": "'{data}' Field is empty. Please select", "pleaseEnterComments": "Please enter comments", - "skip": "skip", + "skip": "Skip", "typeCurrentPasswordBelow": "Type Your Current password below", "currentPassword": "Current password", + "concurrentReports": "Concurrent Reports", "profile": { "reset_password": { "label": "Reset Password", @@ -1004,7 +1011,12 @@ static const Map en_US = { "winnerSelectedRandomly": "The winner will be selected randomly among the qualifiers.", "fingersCrossed": "Fingers Crossed!!!", "congrats": "Congratulations!!!", - "allQuestionsCorrect": "You have answered all questions correct" + "otp": "OTP", + "verification": "Verification", + "resend": "Resend", + "codeExpire": "The verification code has been expired", + "allQuestionsCorrect": "You have answered all questions correct", + "typeheretoreply": "Type here to reply" }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 76cb286..f52bb89 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -424,6 +424,7 @@ abstract class LocaleKeys { static const skip = 'skip'; static const typeCurrentPasswordBelow = 'typeCurrentPasswordBelow'; static const currentPassword = 'currentPassword'; + static const concurrentReports = 'concurrentReports'; static const profile_reset_password_label = 'profile.reset_password.label'; static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_password = 'profile.reset_password.password'; @@ -479,5 +480,10 @@ abstract class LocaleKeys { static const fingersCrossed = 'fingersCrossed'; static const congrats = 'congrats'; static const allQuestionsCorrect = 'allQuestionsCorrect'; + static const otp = 'otp'; + static const verification = 'verification'; + static const resend = 'resend'; + static const codeExpire = 'codeExpire'; + static const typeheretoreply = 'typeheretoreply'; } diff --git a/lib/main.dart b/lib/main.dart index 9a1ac05..adca4aa 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -28,9 +28,7 @@ Logger logger = Logger( class MyHttpOverrides extends HttpOverrides { @override HttpClient createHttpClient(SecurityContext? context) { - return super.createHttpClient(context) - ..badCertificateCallback = - (X509Certificate cert, String host, int port) => true; + return super.createHttpClient(context)..badCertificateCallback = (X509Certificate cert, String host, int port) => true; } } @@ -86,11 +84,9 @@ class MyApp extends StatelessWidget { DeviceType deviceType, ) { PostParamsModel? obj = AppState().postParamsObject; - obj?.languageID = - EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2; + obj?.languageID = EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2; AppState().setPostParamsModel(obj!); - List> delegates = - context.localizationDelegates; + List> delegates = context.localizationDelegates; // delegates.add(GlobalMaterialLocalizations.delegate); delegates.add( MonthYearPickerLocalizations.delegate, diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 2374fbc..753d2c2 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -61,6 +61,7 @@ import 'package:mohem_flutter_app/models/mowadhafhi/get_tickets_list.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_dff_structure_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_output_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_transactions_model.dart'; +import 'package:mohem_flutter_app/models/my_requests/get_ccp_transations_list_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_concurrent_programs_model.dart'; import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; import 'package:mohem_flutter_app/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart'; @@ -342,7 +343,7 @@ class GenericResponseModel { SubmitAddressTransaction? submitAddressTransactionList; SubmitBasicDetailsTransactionList? submitBasicDetTransactionList; String? submitCEITransactionList; - String? submitCcpTransactionList; + SubmitCcpTransactionList? submitCcpTransactionList; SubmitContactTransactionList? submitContactTransactionList; SubmitEITTransactionList? submitEITTransactionList; String? submitHrTransactionList; @@ -1298,7 +1299,10 @@ class GenericResponseModel { submitAddressTransactionList = json['SubmitAddressTransactionList'] != null ? SubmitAddressTransaction.fromJson(json['SubmitAddressTransactionList']) : null; submitBasicDetTransactionList = json['SubmitBasicDetTransactionList'] != null ? SubmitBasicDetailsTransactionList.fromJson(json['SubmitBasicDetTransactionList']) : null; submitCEITransactionList = json['SubmitCEITransactionList']; - submitCcpTransactionList = json['SubmitCcpTransactionList']; + submitCcpTransactionList = json['SubmitCcpTransactionList'] != null + ? new SubmitCcpTransactionList.fromJson( + json['SubmitCcpTransactionList']) + : null; submitContactTransactionList = json['SubmitContactTransactionList'] != null ? SubmitContactTransactionList.fromJson(json['SubmitContactTransactionList']) : null; submitEITTransactionList = json['SubmitEITTransactionList'] != null ? SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) : null; @@ -1753,7 +1757,10 @@ class GenericResponseModel { } data['SubmitCEITransactionList'] = this.submitCEITransactionList; - data['SubmitCcpTransactionList'] = this.submitCcpTransactionList; + if (this.submitCcpTransactionList != null) { + data['SubmitCcpTransactionList'] = + this.submitCcpTransactionList!.toJson(); + } data['SubmitContactTransactionList'] = this.submitContactTransactionList; if (this.submitEITTransactionList != null) { diff --git a/lib/models/get_item_creation_ntf_body_list_model.dart b/lib/models/get_item_creation_ntf_body_list_model.dart index e4c22e7..6f98ebb 100644 --- a/lib/models/get_item_creation_ntf_body_list_model.dart +++ b/lib/models/get_item_creation_ntf_body_list_model.dart @@ -168,7 +168,7 @@ class ItemCreationLines { int? tOROWNUM; int? tRANSACTIONHEADERID; int? tRANSACTIONLINEID; - int? uNITPRICE; + num? uNITPRICE; String? uSERMANUFACTURERNAME; String? uSERMFGPARTNUM; diff --git a/lib/models/get_po_Item_history_list_model.dart b/lib/models/get_po_Item_history_list_model.dart index 656457d..35e81d6 100644 --- a/lib/models/get_po_Item_history_list_model.dart +++ b/lib/models/get_po_Item_history_list_model.dart @@ -7,11 +7,11 @@ class GetPoItemHistoryList { int? dISCOUNTPERCENTAGE; int? fROMROWNUM; int? iTEMID; - int? nETPRICE; + num? nETPRICE; int? nOOFROWS; String? oUNAME; String? pONUMBER; - int? pURCHASEPRICE; + num? pURCHASEPRICE; int? qUANTITYORDERED; int? qUANTITYRECEIVED; int? rEVISIONNUM; diff --git a/lib/models/get_po_notification_body_list_model.dart b/lib/models/get_po_notification_body_list_model.dart index 3bc92a0..d0473dc 100644 --- a/lib/models/get_po_notification_body_list_model.dart +++ b/lib/models/get_po_notification_body_list_model.dart @@ -160,11 +160,11 @@ class POLines { int? pOHEADERID; String? pROMISEDDATE; String? pRNUM; - int? qUANTITY; + num? qUANTITY; String? rEQUESTOR; int? rOWNUM; int? tOROWNUM; - int? uNITPRICE; + num? uNITPRICE; String? uOM; POLines( diff --git a/lib/models/get_quotation_analysis_list_model.dart b/lib/models/get_quotation_analysis_list_model.dart index 4ceaa96..e041f95 100644 --- a/lib/models/get_quotation_analysis_list_model.dart +++ b/lib/models/get_quotation_analysis_list_model.dart @@ -8,8 +8,8 @@ class GetQuotationAnalysisList { int? qUOTLINETOTAL; String? qUOTMFGPARTNUM; String? qUOTNUM; - int? qUOTQTY; - int? qUOTUNITPRICE; + num? qUOTQTY; + num? qUOTUNITPRICE; String? qUOTUOM; String? rFQNUM; int? rFQQTY; 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/models/itg_forms_models/itg_worklist_table_model.dart b/lib/models/itg_forms_models/itg_worklist_table_model.dart new file mode 100644 index 0000000..e1212ba --- /dev/null +++ b/lib/models/itg_forms_models/itg_worklist_table_model.dart @@ -0,0 +1,21 @@ +class ITGWorkListTableModel { + String? label; + String? isTable; + String? textvalue; + + ITGWorkListTableModel({this.label, this.isTable, this.textvalue}); + + ITGWorkListTableModel.fromJson(Map json) { + label = json['label']; + isTable = json['isTable']; + textvalue = json['textvalue']; + } + + Map toJson() { + Map data = new Map(); + data['label'] = this.label; + data['isTable'] = this.isTable; + data['textvalue'] = this.textvalue; + return data; + } +} diff --git a/lib/models/my_requests/get_ccp_transations_list_model.dart b/lib/models/my_requests/get_ccp_transations_list_model.dart new file mode 100644 index 0000000..2e5191b --- /dev/null +++ b/lib/models/my_requests/get_ccp_transations_list_model.dart @@ -0,0 +1,24 @@ + + +class SubmitCcpTransactionList { + int? pREQUESTID; + String? pRETURNMSG; + String? pRETURNSTATUS; + + SubmitCcpTransactionList( + {this.pREQUESTID, this.pRETURNMSG, this.pRETURNSTATUS}); + + SubmitCcpTransactionList.fromJson(Map json) { + pREQUESTID = json['P_REQUEST_ID']; + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['P_REQUEST_ID'] = this.pREQUESTID; + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} \ No newline at end of file diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index 26060ea..5b9f8f1 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -17,7 +17,9 @@ 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'; +import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart'; /// Mix-in [DiagnosticableTreeMixin] to have access to [debugFillProperties] for the devtool // ignore: prefer_mixin @@ -101,7 +103,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", LocaleKeys.performanceEvaluation.tr(), AppRoutes.performanceEvaluation), DrawerMenuItem("assets/images/drawer/mowadhafi.svg", LocaleKeys.mowadhafhi.tr(), AppRoutes.mowadhafhi), DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions), - DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", LocaleKeys.brainMarathon.tr(), AppRoutes.marathonIntroScreen), + DrawerMenuItem("assets/images/drawer/drawer_marathon.svg", LocaleKeys.brainMarathon.tr(), AppRoutes.marathonIntroScreen), DrawerMenuItem("assets/images/drawer/change_password.svg", LocaleKeys.changePassword.tr(), AppRoutes.changePassword), ]; @@ -123,6 +125,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List? getOpenNotificationsList; MohemmITGPendingTaskResponseItem? cocCount; int cocFinalCount = 0; + //Work List API's & Methods Future fetchWorkListCounter(context, {bool showLoading = false}) async { try { @@ -149,7 +152,18 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { logger.wtf(ex); if (showLoading) Utils.hideLoading(context); notifyListeners(); - Utils.handleException(ex, context, null); + Utils.handleException(ex, context, (err) { + Utils.hideLoading(context); + showDialog( + context: context, + builder: (cxt) => ConfirmDialog( + message: err, + onTap: () { + Navigator.pushNamedAndRemoveUntil(cxt, AppRoutes.login, (Route route) => false); + }, + ), + ); + }); } } @@ -247,6 +261,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/attendance/add_vacation_rule_screen.dart b/lib/ui/attendance/add_vacation_rule_screen.dart index aa48696..a698adc 100644 --- a/lib/ui/attendance/add_vacation_rule_screen.dart +++ b/lib/ui/attendance/add_vacation_rule_screen.dart @@ -430,6 +430,7 @@ class _AddVacationRuleScreenState extends State { onTap: () { showMyBottomSheet( context, + callBackFunc: (){}, child: SearchEmployeeBottomSheet( title: LocaleKeys.searchForEmployee.tr(), apiMode: LocaleKeys.delegate.tr(), diff --git a/lib/ui/attendance/monthly_attendance_screen.dart b/lib/ui/attendance/monthly_attendance_screen.dart index 439a5f4..de35da0 100644 --- a/lib/ui/attendance/monthly_attendance_screen.dart +++ b/lib/ui/attendance/monthly_attendance_screen.dart @@ -287,7 +287,6 @@ class _MonthlyAttendanceScreenState extends State { cellBorderColor: Colors.white, selectionDecoration: BoxDecoration( border: Border.all(color: MyColors.white, width: 10), - borderRadius: const BorderRadius.all(Radius.circular(100)), shape: BoxShape.circle, ), dataSource: MeetingDataSource(_getDataSource()), diff --git a/lib/ui/chat/chat_detailed_screen.dart b/lib/ui/chat/chat_detailed_screen.dart index b647a38..5f2fa97 100644 --- a/lib/ui/chat/chat_detailed_screen.dart +++ b/lib/ui/chat/chat_detailed_screen.dart @@ -1,11 +1,12 @@ import 'dart:async'; - +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:mohem_flutter_app/api/chat/chat_provider_model.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/ui/chat/chat_bubble.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; @@ -19,7 +20,10 @@ class ChatDetailScreen extends StatelessWidget { @override Widget build(BuildContext context) { - userDetails = ModalRoute.of(context)!.settings.arguments; + userDetails = ModalRoute + .of(context)! + .settings + .arguments; data = Provider.of(context, listen: false); data.getSingleUserChatHistory(senderUID: AppState().chatDetails!.response!.id.toString(), receiverUID: userDetails["targetUser"].id, pagination: "0"); Timer(const Duration(seconds: 1), () => data.scrollDown()); @@ -31,56 +35,73 @@ class ChatDetailScreen extends StatelessWidget { return (m.isLoading ? ChatHomeShimmer() : Column( - children: [ - Expanded( - child: ListView.builder( - controller: m.scrollController, - shrinkWrap: true, - itemCount: m.userChatHistory.length, - padding: const EdgeInsets.symmetric(vertical: 10), - itemBuilder: (BuildContext context, int i) { - return ChatBubble( - text: m.userChatHistory[i].contant.toString(), - isSeen: m.userChatHistory[i].isSeen == true ? true : false, - isCurrentUser: m.userChatHistory[i].currentUserId == 42062 ? true : false, - isDelivered: m.userChatHistory[i].currentUserId == 42062 && m.userChatHistory[i].isDelivered == true ? true : false, - dateTime: m.userChatHistory[i].createdDate.toString(), - ); - }, - ), - ), - Card( - margin: EdgeInsets.zero, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 10), - child: TextField( - controller: m.message, - decoration: InputDecoration( - hintText: 'Type here to reply', - hintStyle: const TextStyle(color: MyColors.grey98Color), - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - errorBorder: InputBorder.none, - disabledBorder: InputBorder.none, - contentPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15), - suffixIcon: IconButton( + children: [ + Expanded( + child: ListView.builder( + controller: m.scrollController, + shrinkWrap: true, + itemCount: m.userChatHistory.length, + padding: const EdgeInsets.symmetric(vertical: 10), + itemBuilder: (BuildContext context, int i) { + i == 0 ? m.logger.d(m.userChatHistory.length) : ""; + return ChatBubble( + text: m.userChatHistory[i].contant.toString(), + isSeen: m.userChatHistory[i].isSeen == true ? true : false, + isCurrentUser: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id ? true : false, + isDelivered: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id && m.userChatHistory[i].isDelivered == true ? true : false, + dateTime: m.userChatHistory[i].createdDate.toString(), + ); + }, + ), + ), + Card( + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 10), + child: TextField( + controller: m.message, + decoration: InputDecoration( + hintText: LocaleKeys.typeheretoreply.tr(), + hintStyle: const TextStyle(color: MyColors.grey98Color), + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + errorBorder: InputBorder.none, + disabledBorder: InputBorder.none, + contentPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15), + suffixIcon: SizedBox( + width: 100, + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + IconButton( + icon: const Icon( + Icons.attach_file_rounded, + size: 27, + color: MyColors.lightGreenColor, + ), + onPressed: () {}, + ), + IconButton( icon: SvgPicture.asset( "assets/icons/chat/chat_send_icon.svg", height: 26, width: 35, ), onPressed: () { - // m.logger.d(userDetails); - m.sendChatMessage(m.message.text, userDetails["targetUser"].id, userDetails["targetUser"].userName); + m.sendChatMessage(m.message.text, userDetails["targetUser"].id, userDetails["targetUser"].userName); }, ), - ), + ], ), ), ), - ], - )); + ), + ), + ), + ], + )); }, ), ); diff --git a/lib/ui/chat/chat_home.dart b/lib/ui/chat/chat_home.dart index ef984a3..f6f8e24 100644 --- a/lib/ui/chat/chat_home.dart +++ b/lib/ui/chat/chat_home.dart @@ -45,7 +45,7 @@ class _ChatHomeScreenState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - appBar: AppBarWidget(context, title: "My Chats", showHomeButton: false), + appBar: AppBarWidget(context, title: LocaleKeys.mychats.tr(), showHomeButton: false), body: Consumer(builder: (BuildContext context, ChatProviderModel m, Widget? child) { return m.isLoading ? ChatHomeShimmer() @@ -110,7 +110,7 @@ class _ChatHomeScreenState extends State { ], ), title: (m.searchedChats![index].userName ?? "").toText14(color: MyColors.darkTextColor), - subtitle: (m.searchedChats![index].isTyping == true ? "Something is Typing" : "Last message text").toText11(color: MyColors.normalTextColor), + subtitle: (m.searchedChats![index].isTyping == true ? "Typing ..." : "").toText11(color: MyColors.normalTextColor), trailing: ("Today").toText10(color: MyColors.lightTextColor), minVerticalPadding: 0, onTap: () { @@ -160,6 +160,7 @@ class _ChatHomeScreenState extends State { // .getChatMemberFromSearch("aamir.muhammad", 36239); showMyBottomSheet( context, + callBackFunc: (){}, child: SearchEmployeeBottomSheet( title: LocaleKeys.searchForEmployee.tr(), apiMode: LocaleKeys.delegate.tr(), diff --git a/lib/ui/dialogs/success_dialog.dart b/lib/ui/dialogs/success_dialog.dart new file mode 100644 index 0000000..5150110 --- /dev/null +++ b/lib/ui/dialogs/success_dialog.dart @@ -0,0 +1,72 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:lottie/lottie.dart'; + +class SuccessDialog extends StatefulWidget { + bool isFromDashboard; + + SuccessDialog(this.isFromDashboard); + + @override + State createState() => _SuccessDialogState(); +} + +class _SuccessDialogState extends State with TickerProviderStateMixin { + late AnimationController _controller; + + @override + void initState() { + _controller = AnimationController(vsync: this); + + super.initState(); + } + + Future playSuccessSound() async { + AudioPlayer player = AudioPlayer(); + String audioAsset = ""; + if (Platform.isAndroid) { + audioAsset = "assets/audio/success_tone_android.mp3"; + } else { + audioAsset = "assets/audio/success_tone_ios.caf"; + } + await player.setAsset(audioAsset); + await player.load(); + player.play(); + } + + @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, + controller: _controller, + onLoaded: (LottieComposition v) async { + print("calling_lottie " + v.seconds.toString()); + await playSuccessSound(); + _controller + ..duration = v.duration + ..forward().whenComplete(() async { + Navigator.pop(context); + if (widget.isFromDashboard) Navigator.pop(context); + }); + }, + ), + ), + ), + ], + ); + } +} diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index c99d2e7..d342072 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:io'; + import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; @@ -38,8 +39,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 +59,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 +78,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 +128,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,11 +151,10 @@ 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", + matchTextDirection: true, ).onPress(() async { await Navigator.pushNamed(context, AppRoutes.announcements); }) @@ -134,11 +175,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 +184,93 @@ 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/attendance.svg" : "assets/images/attendance.svg"), ).onPress(() { showMyBottomSheet( - context, - child: - MarkAttendanceWidget( - model)); + context, + callBackFunc: (){}, + child: MarkAttendanceWidget(model, isFromDashboard: true), + ); }), ], ), @@ -372,10 +280,7 @@ class _DashboardScreenState extends State { ), ).onPress( () { - Navigator.pushNamed( - context, - AppRoutes - .todayAttendance); + Navigator.pushNamed(context, AppRoutes.todayAttendance); }, )) .animatedSwither(); @@ -399,11 +304,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 +322,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 +348,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 +387,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 +421,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 +438,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 +451,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 +464,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 +516,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..d23fa10 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'; @@ -94,62 +95,76 @@ class _TodayAttendanceScreenState extends State { ? Center(child: CircularProgressIndicator()) : Column( children: [ - Container( - color: MyColors.backgroundBlackColor, - padding: EdgeInsets.only(top: 4, left: 21, right: 21, bottom: 21), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DateUtil.getWeekDayMonthDayYearDateFormatted(DateTime.now(), "en").toText24(isBold: true, color: Colors.white), - LocaleKeys.timeLeftToday.tr().toText16(color: Color(0xffACACAC)), - //21.height, - Center( - 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), + Expanded( + flex: 2, + child: Container( + width: double.infinity, + color: MyColors.backgroundBlackColor, + padding: EdgeInsets.only(top: 4, left: 21, right: 21, bottom: 21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DateUtil.getWeekDayMonthDayYearDateFormatted(DateTime.now(), "en").toText24(isBold: true, color: Colors.white), + LocaleKeys.timeLeftToday.tr().toText16(color: Color(0xffACACAC)), + Center( + child: AspectRatio( + aspectRatio: 265 / 265, + child: CircularStepProgressBar( + totalSteps: 16 * 4, + currentStep: (model.progress * 100).toInt(), + selectedColor: MyColors.gradiantEndColor, + unselectedColor: MyColors.grey70Color, + child: Center( + child: Padding( + padding: const EdgeInsets.all(21.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + CountdownTimer( + endTime: model.endTime, + widgetBuilder: (context, v) { + return AutoSizeText( + getValue(v?.hours) + " : " + getValue(v?.min) + " : " + getValue(v?.sec), + maxLines: 1, + 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), + ).center.expanded, + LocaleKeys.shiftTime.tr().tr().toTextAuto(color: MyColors.greyACColor, fontSize: 18, maxLine: 1), + (model.attendanceTracking!.pShtName ?? "00:00:00").toString().toTextAuto(color: Colors.white, isBold: true, fontSize: 26, maxLine: 1), + ], ), - 19.height, - LocaleKeys.shiftTime.tr().tr().toText12(color: MyColors.greyACColor), - (model.attendanceTracking!.pShtName ?? "00:00:00").toString().toText22(color: Colors.white, isBold: true), - ], + ), ), ), - ), - ).paddingAll(21), - ).expanded, - ], + ).paddingAll(12), + ).expanded, + ], + ), ), - ).expanded, + ), Center( child: Container( - // color: MyColors.backgroundBlackColor, decoration: const BoxDecoration( borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), - gradient: LinearGradient(transform: GradientRotation(.64), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ - MyColors.gradiantEndColor, - MyColors.gradiantStartColor, - ]), + gradient: LinearGradient( + transform: GradientRotation(.64), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ], + ), ), child: Column( children: [ Container( //height: 187, - padding: const EdgeInsets.only(left: 31, right: 31, top: 31, bottom: 16), + padding: const EdgeInsets.only(left: 21, right: 21, top: 21, bottom: 16), decoration: const BoxDecoration( borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), gradient: LinearGradient(transform: GradientRotation(.64), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ @@ -176,80 +191,7 @@ class _TodayAttendanceScreenState extends State { ), ), //.expanded, - MarkAttendanceWidget(model, topPadding: 24), - // Container( - // width: double.infinity, - // decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), - // // margin: EdgeInsets.only(top: 187 - 31), - // padding: EdgeInsets.only(left: 21, right: 21, top: 24, bottom: 24), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisSize: MainAxisSize.min, - // children: [ - // LocaleKeys.markAttendance.tr().toSectionHeading(), - // LocaleKeys.selectMethodOfAttendance.tr().tr().toText11(color: Color(0xff535353)), - // 24.height, - // GridView( - // physics: const NeverScrollableScrollPhysics(), - // shrinkWrap: true, - // padding: EdgeInsets.zero, - // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), - // children: [ - // if (isNfcEnabled) - // attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { - // if (isNfcLocationEnabled) { - // Location.getCurrentLocation((LatLng? latlng) { - // performNfcAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - // }); - // } else { - // performNfcAttendance(model); - // } - // }), - // if (isWifiEnabled) - // attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () { - // if (isWifiLocationEnabled) { - // Location.getCurrentLocation((LatLng? latlng) { - // performWifiAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - // }); - // } else { - // performWifiAttendance(model); - // } - // // connectWifi(); - // }), - // if (isQrEnabled) - // attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async { - // if (isQrLocationEnabled) { - // Location.getCurrentLocation((LatLng? latlng) { - // performQrCodeAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - // }); - // } else { - // performQrCodeAttendance(model); - // } - // // performQrCodeAttendance(model); - // }), - // ], - // ) - // ], - // ), - // ), - // Positioned( - // top: 187 - 21, - // child: Container( - // padding: EdgeInsets.only(left: 31, right: 31, top: 31, bottom: 16), - // decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), - // child: Column( - // children: [ - // Row( - // children: [commonStatusView("Check In", "09:27"), commonStatusView("Check Out", "- - : - -")], - // ), - // 21.height, - // Row( - // children: [commonStatusView("Late In", "00:27"), commonStatusView("Regular", "08:00")], - // ), - // ], - // ), - // ), - // ), + MarkAttendanceWidget(model, topPadding: 21), ], ), ), @@ -262,59 +204,15 @@ class _TodayAttendanceScreenState extends State { ); } - // Future performNfcAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { - // if (isNfcLocationEnabled) { - // print("nfc location enabled"); - // } else { - // print("nfc not location enabled"); - // } - // - // showNfcReader(context, onNcfScan: (String? nfcId) async { - // print(nfcId); - // Utils.showLoading(context); - // try { - // GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "", isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng); - // bool status = await model.fetchAttendanceTracking(context); - // Utils.hideLoading(context); - // } catch (ex) { - // print(ex); - // Utils.hideLoading(context); - // Utils.handleException(ex, context, (msg) { - // Utils.confirmDialog(context, msg); - // }); - // } - // }); - // } - // - // Future performWifiAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { - // if (isWifiLocationEnabled) { - // print("wifi location enabled"); - // } else { - // print("wifi not location enabled"); - // } - // - // bool v = await WiFiForIoTPlugin.connect(AppState().mohemmWifiSSID ?? "", password: AppState().mohemmWifiPassword ?? "", joinOnce: true, security: NetworkSecurity.WPA, withInternet: false); - // if (v) { - // await WiFiForIoTPlugin.forceWifiUsage(true); - // print("connected"); - // Utils.showLoading(context); - // try { - // GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 3, nfcValue: "", isGpsRequired: isWifiLocationEnabled, lat: lat, long: lng); - // bool status = await model.fetchAttendanceTracking(context); - // Utils.hideLoading(context); - // await closeWifiRequest(); - // } catch (ex) { - // print(ex); - // await closeWifiRequest(); - // Utils.hideLoading(context); - // Utils.handleException(ex, context, (msg) { - // Utils.confirmDialog(context, msg); - // }); - // } - // } else { - // Utils.confirmDialog(context, LocaleKeys.comeNearHMGWifi.tr()); - // } - // } + String getValue(int? v) { + if (v == null) { + return "00"; + } else if (v.toString().length == 1) { + return "0" + v.toString(); + } else { + return v.toString(); + } + } Future closeWifiRequest() async { await WiFiForIoTPlugin.forceWifiUsage(false); @@ -322,63 +220,6 @@ class _TodayAttendanceScreenState extends State { return v; } - // Future performQrCodeAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { - // var qrCodeValue = await Navigator.of(context).push( - // MaterialPageRoute( - // builder: (context) => QrScannerDialog(), - // ), - // ); - // if (qrCodeValue != null) { - // print("qrCode: " + qrCodeValue); - // Utils.showLoading(context); - // try { - // GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 1, isGpsRequired: isQrLocationEnabled, lat: lat, long: lng, QRValue: qrCodeValue); - // bool status = await model.fetchAttendanceTracking(context); - // Utils.hideLoading(context); - // } catch (ex) { - // print(ex); - // Utils.hideLoading(context); - // Utils.handleException(ex, context, (msg) { - // Utils.confirmDialog(context, msg); - // }); - // } - // } - // } - // - // Widget attendanceMethod(String title, String image, bool isEnabled, VoidCallback onPress) => Container( - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(15), - // gradient: const LinearGradient(transform: GradientRotation(.64), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ - // MyColors.gradiantEndColor, - // MyColors.gradiantStartColor, - // ]), - // ), - // clipBehavior: Clip.antiAlias, - // child: Stack( - // children: [ - // Container( - // padding: const EdgeInsets.only(left: 10, right: 10, top: 14, bottom: 14), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // SvgPicture.asset( - // image, - // color: Colors.white, - // ).expanded, - // title.toText17(isBold: true, color: Colors.white), - // ], - // ), - // ), - // if (!isEnabled) - // Container( - // width: double.infinity, - // height: double.infinity, - // color: Colors.grey.withOpacity(0.7), - // ) - // ], - // ), - // ).onPress(onPress); - Widget commonStatusView(String title, String time) => Expanded( child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ title.toText12(color: Colors.white.withOpacity(.69)), diff --git a/lib/ui/landing/today_attendance_screen2.dart b/lib/ui/landing/today_attendance_screen2.dart new file mode 100644 index 0000000..17bb03a --- /dev/null +++ b/lib/ui/landing/today_attendance_screen2.dart @@ -0,0 +1,214 @@ +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'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/date_uitl.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/circular_step_progress_bar.dart'; +import 'package:mohem_flutter_app/widgets/mark_attendance_widget.dart'; +import 'package:nfc_manager/nfc_manager.dart'; +import 'package:provider/provider.dart'; +import 'package:wifi_iot/wifi_iot.dart'; + +class TodayAttendanceScreen2 extends StatefulWidget { + TodayAttendanceScreen2({Key? key}) : super(key: key); + + @override + _TodayAttendanceScreenState createState() { + return _TodayAttendanceScreenState(); + } +} + +class _TodayAttendanceScreenState extends State { + ValueNotifier result = ValueNotifier(null); + late DashboardProviderModel data; + + @override + void initState() { + super.initState(); + data = Provider.of(context, listen: false); + } + + @override + void dispose() { + super.dispose(); + // Stop Session + NfcManager.instance.stopSession(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: MyColors.backgroundBlackColor, + leading: IconButton( + icon: const Icon(Icons.arrow_back_ios, color: Colors.white), + onPressed: () => Navigator.pop(context), + ), + actions: [ + IconButton( + onPressed: () { + data.fetchAttendanceTracking(context); + }, + icon: const Icon( + Icons.ac_unit, + color: Colors.white, + ), + ) + ], + ), + backgroundColor: MyColors.backgroundBlackColor, + body: Consumer( + builder: (context, model, child) { + return (model.isAttendanceTrackingLoading + ? Center(child: CircularProgressIndicator()) + : Column( + children: [ + Container( + width: double.infinity, + color: MyColors.backgroundBlackColor, + padding: EdgeInsets.only(top: 1, left: 21, right: 21, bottom: 21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DateUtil.getWeekDayMonthDayYearDateFormatted(DateTime.now(), "en").toText24(isBold: true, color: Colors.white), + LocaleKeys.timeLeftToday.tr().toText16(color: Color(0xffACACAC)), + Center( + child: Container( + margin: EdgeInsets.only(left: 21, right: 21, top: 18), + child: AspectRatio( + aspectRatio: 1, + child: CircularStepProgressBar( + totalSteps: 16 * 4, + currentStep: (model.progress * 100).toInt(), + selectedColor: MyColors.gradiantEndColor, + unselectedColor: MyColors.grey70Color, + child: Center( + child: Padding( + padding: const EdgeInsets.all(21.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + flex: 1, + child: CountdownTimer( + endTime: model.endTime, + widgetBuilder: (context, v) { + return AutoSizeText( + getValue(v?.hours) + " : " + getValue(v?.min) + " : " + getValue(v?.sec), + maxLines: 1, + style: const 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: const TextStyle(color: Colors.white, fontSize: 30, letterSpacing: -1.92, fontWeight: FontWeight.bold, height: 1), + ).center, + ), + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + LocaleKeys.shiftTime.tr().tr().toTextAuto(color: MyColors.greyACColor, fontSize: 18, maxLine: 1).paddingOnly(left: 21,right: 21), + (model.attendanceTracking!.pShtName ?? "00:00:00").toString().toTextAuto(color: Colors.white, isBold: true, fontSize: 26, maxLine: 1), + ], + ), + ) + ], + ), + ), + ), + ), + ), + ), + ).expanded, + ], + ), + ).toExpanded(flex: 2), + Center( + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), + gradient: LinearGradient( + transform: GradientRotation(.64), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ], + ), + ), + child: Column( + children: [ + Container( + padding: const EdgeInsets.only(left: 21, right: 21, top: 21, bottom: 16), + decoration: const BoxDecoration( + borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), + gradient: LinearGradient(transform: GradientRotation(.64), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + child: Column( + children: [ + Row( + children: [ + commonStatusView(LocaleKeys.checkIn.tr(), (model.attendanceTracking!.pSwipeIn) ?? "- - : - -"), + commonStatusView(LocaleKeys.checkOut.tr(), (model.attendanceTracking!.pSwipeOut) ?? "- - : - -") + ], + ), + 21.height, + Row( + children: [ + commonStatusView(LocaleKeys.lateIn.tr(), (model.attendanceTracking!.pLateInHours) ?? "- - : - -"), + commonStatusView(LocaleKeys.regular.tr(), (model.attendanceTracking!.pScheduledHours) ?? "- - : - -") + ], + ), + ], + ), + ), //.expanded, + + MarkAttendanceWidget(model, topPadding: 21), + ], + ), + ), + ) + ], + )) + .animatedSwither(); + }, + ), + ); + } + + String getValue(int? v) { + if (v == null) { + return "00"; + } else if (v.toString().length == 1) { + return "0" + v.toString(); + } else { + return v.toString(); + } + } + + Future closeWifiRequest() async { + await WiFiForIoTPlugin.forceWifiUsage(false); + bool v = await WiFiForIoTPlugin.disconnect(); + return v; + } + + Widget commonStatusView(String title, String time) => Expanded( + child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ + title.toText12(color: Colors.white.withOpacity(.69)), + time.toText22(color: Colors.white, isBold: true), + ]), + ); +} diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index d822920..0b257c5 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -22,8 +22,8 @@ class ServicesWidget extends StatelessWidget { "assets/images/monthly_attendance.svg", "assets/images/monthly_attendance.svg", "assets/images/ticket_request.svg", - "assets/images/ticket_request.svg", - "assets/images/ticket_request.svg", + "assets/images/ticket_bal.svg", + "assets/images/vacation_rule.svg", "assets/images/ticket_request.svg", "assets/images/ticket_request.svg", "assets/images/ticket_request.svg" diff --git a/lib/ui/leave_balance/add_leave_balance_screen.dart b/lib/ui/leave_balance/add_leave_balance_screen.dart index e1c58c2..85337aa 100644 --- a/lib/ui/leave_balance/add_leave_balance_screen.dart +++ b/lib/ui/leave_balance/add_leave_balance_screen.dart @@ -100,7 +100,8 @@ class _AddLeaveBalanceScreenState extends State { for (int dffIndex = 0; dffIndex < getabsenceDffStructureList.length; dffIndex++) { if ("ATTRIBUTE$i" == getabsenceDffStructureList[dffIndex].aPPLICATIONCOLUMNNAME) { if (getabsenceDffStructureList[dffIndex].fORMATTYPE == "X") { - dffDataMap["P_ATTRIBUTE$i"] = Utils.formatDate(getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME!); + dffDataMap["P_ATTRIBUTE$i"] = + getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME != null ? Utils.formatDate(getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME!) : ""; } else { dffDataMap["P_ATTRIBUTE$i"] = getabsenceDffStructureList[dffIndex].eSERVICESDV?.pIDCOLUMNNAME; } @@ -108,9 +109,17 @@ class _AddLeaveBalanceScreenState extends State { } } } - await LeaveBalanceApiClient().validateAbsenceTransaction(selectedAbsenceType!.dESCFLEXCONTEXTCODE!, "HR_LOA_SS", selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, - selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), -999, dffDataMap, - comments: comment); + await LeaveBalanceApiClient() + .validateAbsenceTransaction( + selectedAbsenceType!.dESCFLEXCONTEXTCODE!, + "HR_LOA_SS", + selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, + selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", + DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), + DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), + -999, + dffDataMap, + comments: comment); SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction( selectedAbsenceType!.dESCFLEXCONTEXTCODE!, @@ -126,9 +135,9 @@ class _AddLeaveBalanceScreenState extends State { Utils.hideLoading(context); await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance")); - // Utils.showLoading(context); + Utils.showLoading(context); await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!); - // Utils.hideLoading(context); + Utils.hideLoading(context); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); @@ -221,6 +230,7 @@ class _AddLeaveBalanceScreenState extends State { onTap: () { showMyBottomSheet( context, + callBackFunc: () {}, child: SearchEmployeeBottomSheet( title: LocaleKeys.searchForEmployee.tr(), apiMode: LocaleKeys.delegate.tr(), diff --git a/lib/ui/login/forgot_password_screen.dart b/lib/ui/login/forgot_password_screen.dart index f058d43..6c1868e 100644 --- a/lib/ui/login/forgot_password_screen.dart +++ b/lib/ui/login/forgot_password_screen.dart @@ -65,11 +65,14 @@ class _ForgotPasswordScreenState extends State { () => { Navigator.pop(context), }, + onResendCode: () { + performForgotPassword(); + }, ).displayDialog(context); } catch (ex) { print(ex); Utils.hideLoading(context); - Utils.handleException(ex, context, null); + Utils.handleException(ex, context, null); } } diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 8cd93e4..20fa8bc 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -140,10 +140,13 @@ class _LoginScreenState extends State { Widget build(BuildContext context) { if (isAppOpenBySystem == null) { isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; - if (kDebugMode) { + if (!kReleaseMode) { // username.text = "15444"; // Maha User - username.text = "15153"; // Tamer User - password.text = "Abcd@12345"; + // username.text = "15153"; // Tamer User + // password.text = "Abcd@12345"; + + // username.text = "206535"; // Hashim User + // password.text = "Namira786"; } if (isAppOpenBySystem!) checkFirebaseToken(); } diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index 4d653ed..6e51e51 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -57,30 +57,21 @@ class _VerifyLastLoginScreenState extends State { @override Widget build(BuildContext context) { - mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments - as GetMobileLoginInfoListModel; - String empName = AppState().isArabic(context) - ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! - : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!; + mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments as GetMobileLoginInfoListModel; + String empName = AppState().isArabic(context) ? AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEAr! : AppState().memberInformationList!.eMPLOYEEDISPLAYNAMEEn!; return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, automaticallyImplyLeading: false, title: (mobileLoginInfoListModel?.businessCardPrivilege ?? false) - ? LocaleKeys.viewBusinessCard - .tr() - .toText12(color: MyColors.textMixColor, isUnderLine: true) - .onPress(() { + ? LocaleKeys.viewBusinessCard.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() { showMDialog(context, child: BusinessCardDialog()); }) : null, actions: [ Center( - child: LocaleKeys.employeeDigitalID - .tr() - .toText12(color: MyColors.textMixColor, isUnderLine: true) - .onPress(() { + child: LocaleKeys.employeeDigitalID.tr().toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() { showMDialog(context, child: EmployeeDigitialIdDialog()); })), 21.width @@ -99,12 +90,9 @@ class _VerifyLastLoginScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ LocaleKeys.welcomeBack.tr().toText12(), - mobileLoginInfoListModel!.employeeName! - .toText24(isBold: true), + mobileLoginInfoListModel!.employeeName!.toText24(isBold: true), 10.height, - LocaleKeys.wouldYouLikeToLoginWithCurrentUsername - .tr() - .toText16(), + LocaleKeys.wouldYouLikeToLoginWithCurrentUsername.tr().toText16(), Container( height: 72, margin: const EdgeInsets.only(top: 23, bottom: 23), @@ -126,42 +114,26 @@ class _VerifyLastLoginScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ LocaleKeys.lastLoginDetails.tr().toText16(), - DateUtil.formatDateToDate( - DateUtil.convertStringToDate( - mobileLoginInfoListModel!.editedOn!), - false) - .toText12(), + DateUtil.formatDateToDate(DateUtil.convertStringToDate(mobileLoginInfoListModel!.editedOn!), false).toText12(), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - LocaleKeys.verificationType - .tr() - .toText10(color: MyColors.grey57Color), - getVerificationType( - mobileLoginInfoListModel!.loginType!) - .toText12(), + LocaleKeys.verificationType.tr().toText10(color: MyColors.grey57Color), + getVerificationType(mobileLoginInfoListModel!.loginType!).toText12(), Expanded(child: SizedBox()), - DateUtil.formatDateToTime( - DateUtil.convertStringToDate( - mobileLoginInfoListModel!.editedOn!)) - .toText12(), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(mobileLoginInfoListModel!.editedOn!)).toText12(), ], ) ], ), ), LocaleKeys.pleaseVerify.tr().toText16(), - if (isNeedVerifyWithFaceIDAndBiometrics) - LocaleKeys.pleaseVerifyForBio.tr().toText12(), + if (isNeedVerifyWithFaceIDAndBiometrics) LocaleKeys.pleaseVerifyForBio.tr().toText12(), GridView( - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 13, - mainAxisSpacing: 9), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), physics: const NeverScrollableScrollPhysics(), padding: const EdgeInsets.only(top: 9), shrinkWrap: true, @@ -214,9 +186,7 @@ class _VerifyLastLoginScreenState extends State { DefaultButton( LocaleKeys.useAnotherAccount.tr(), () { - Navigator.pushNamedAndRemoveUntil( - context, AppRoutes.login, (Route route) => false, - arguments: false); + Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route route) => false, arguments: false); }, ).insideContainer, ], @@ -248,19 +218,11 @@ class _VerifyLastLoginScreenState extends State { } Future loginWithFaceIDAndBiometrics() async { - IOSAuthMessages iosStrings = const IOSAuthMessages( - cancelButton: 'cancel', - goToSettingsButton: 'settings', - goToSettingsDescription: 'Please set up your Touch ID.', - lockOut: 'Please reenable your Touch ID'); + IOSAuthMessages iosStrings = + const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); bool authenticated = false; try { - authenticated = await auth.authenticate( - localizedReason: 'Scan your fingerprint to authenticate', - useErrorDialogs: true, - stickyAuth: true, - biometricOnly: true, - iOSAuthStrings: iosStrings); + authenticated = await auth.authenticate(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, biometricOnly: true, iOSAuthStrings: iosStrings); } on PlatformException catch (e) { print(e); Utils.hideLoading(context); @@ -269,11 +231,8 @@ class _VerifyLastLoginScreenState extends State { return authenticated; } - Widget _loginOptionButton( - String _title, String _icon, int _flag, int? _loginIndex) { - bool isDisable = ((_flag == 3 && - !checkBiometricIsAvailable(BiometricType.face)) || - (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint))); + Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) { + bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 4 && !checkBiometricIsAvailable(BiometricType.fingerprint))); return InkWell( onTap: isDisable ? null @@ -284,21 +243,18 @@ class _VerifyLastLoginScreenState extends State { }); } else { if (_flag == 3 || _flag == 4) { - bool authenticateWithFaceAndTouchID = - await loginWithFaceIDAndBiometrics(); + bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); if (!authenticateWithFaceAndTouchID) { return; } else { - if (mobileLoginInfoListModel!.loginType == 3 || - mobileLoginInfoListModel!.loginType == 4) { + if (mobileLoginInfoListModel!.loginType == 3 || mobileLoginInfoListModel!.loginType == 4) { // bool authenticateWithFaceAndTouchID = await loginWithFaceIDAndBiometrics(); // if (!authenticateWithFaceAndTouchID) { // return; // } else { // performApiCall(_title, _icon, _flag, isDirectLogin: true); // } - performApiCall(_title, _icon, _flag, _flag, - isDirectLogin: true); + performApiCall(_title, _icon, _flag, _flag, isDirectLogin: true); } else { isNeedVerifyWithFaceIDAndBiometrics = true; selectedFlag = _flag; @@ -316,8 +272,7 @@ class _VerifyLastLoginScreenState extends State { } }, child: Container( - padding: - const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + padding: const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), color: isDisable ? Colors.grey.withOpacity(0.3) : Colors.white, @@ -343,23 +298,13 @@ class _VerifyLastLoginScreenState extends State { Widget getButton(int flag) { switch (flag) { case 1: - return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), - 'assets/images/login/verify_sms.svg', flag, null); + return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/login/verify_sms.svg', flag, null); case 2: - return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), - 'assets/images/login/verify_whatsapp.svg', flag, null); + return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), 'assets/images/login/verify_whatsapp.svg', flag, null); case 3: - return _loginOptionButton( - LocaleKeys.verifyThroughFace.tr(), - 'assets/images/login/verify_face.svg', - flag, - BiometricType.face.index); + return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/login/verify_face.svg', flag, BiometricType.face.index); case 4: - return _loginOptionButton( - LocaleKeys.verifyThroughFingerprint.tr(), - 'assets/images/login/verify_thumb.svg', - flag, - BiometricType.fingerprint.index); + return _loginOptionButton(LocaleKeys.verifyThroughFingerprint.tr(), 'assets/images/login/verify_thumb.svg', flag, BiometricType.fingerprint.index); default: return const SizedBox(); } @@ -376,9 +321,7 @@ class _VerifyLastLoginScreenState extends State { return isAvailable; } - Future performApiCall( - String _title, String _icon, int _flag, int sendVerificationFlat, - {bool isDirectLogin = false}) async { + Future performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat, {bool isDirectLogin = false}) async { try { if (isDirectLogin) setState(() { @@ -387,16 +330,10 @@ class _VerifyLastLoginScreenState extends State { else Utils.showLoading(context); await LoginApiClient().checkMobileAppVersion(); - await LoginApiClient() - .memberLogin(AppState().getUserName!, AppState().password!); + await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!); if (!isDirectLogin) BasicMemberInformationModel? memberInformationModel = - await LoginApiClient() - .mohemmSendActivationCodeByOTPNotificationType( - 0, - AppState().memberLoginList?.pMOBILENUMBER, - sendVerificationFlat, - AppState().getUserName); + await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, ""); if (!isDirectLogin) Utils.hideLoading(context); if (!isDirectLogin) @@ -411,6 +348,9 @@ class _VerifyLastLoginScreenState extends State { () => { Navigator.pop(context), }, + onResendCode: () { + performApiCall(_title, _icon, _flag, sendVerificationFlat, isDirectLogin: isDirectLogin); + }, ).displayDialog(context); } catch (ex) { Utils.hideLoading(context); @@ -418,34 +358,26 @@ class _VerifyLastLoginScreenState extends State { } } - Future performDirectApiCall( - String _title, String _icon, int _flag, String value, - {bool isDirectLogin = false}) async { + Future performDirectApiCall(String _title, String _icon, int _flag, String value, {bool isDirectLogin = false}) async { try { - GenericResponseModel? genericResponseModel = await LoginApiClient() - .checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, - value, AppState().getUserName); - GenericResponseModel? genericResponseModel1 = await LoginApiClient() - .insertMobileLoginInfoNEW( - AppState().memberLoginList?.pEMAILADDRESS ?? "", - genericResponseModel?.pSESSIONID ?? 0, - genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? - "", - _flag, - AppState().memberLoginList?.pMOBILENUMBER ?? "", - AppState().getUserName!, - mobileLoginInfoListModel!.deviceToken!, - Platform.isAndroid ? "android" : "ios"); - AppState().setMemberInformationListModel = - genericResponseModel!.memberInformationList?.first; + GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName); + GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW( + AppState().memberLoginList?.pEMAILADDRESS ?? "", + genericResponseModel?.pSESSIONID ?? 0, + genericResponseModel?.memberInformationList![0].eMPLOYEENAME ?? "", + _flag, + AppState().memberLoginList?.pMOBILENUMBER ?? "", + AppState().getUserName!, + mobileLoginInfoListModel!.deviceToken!, + Platform.isAndroid ? "android" : "ios"); + AppState().setMemberInformationListModel = genericResponseModel!.memberInformationList?.first; if (genericResponseModel?.errorMessage != null) { Utils.showToast(genericResponseModel?.errorMessage ?? ""); // Navigator.pop(context); } Utils.hideLoading(context); Navigator.pop(context); - Navigator.pushNamedAndRemoveUntil( - context, AppRoutes.dashboard, (Route route) => false); + Navigator.pushNamedAndRemoveUntil(context, AppRoutes.dashboard, (Route route) => false); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/login/verify_login_screen.dart b/lib/ui/login/verify_login_screen.dart index f31311f..8dba16c 100644 --- a/lib/ui/login/verify_login_screen.dart +++ b/lib/ui/login/verify_login_screen.dart @@ -511,7 +511,6 @@ class _VerifyLoginScreenState extends State { // } // - Future loginWithFaceIDAndBiometrics() async { IOSAuthMessages iosStrings = const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); @@ -550,9 +549,9 @@ class _VerifyLoginScreenState extends State { } } else { if (isNeedVerifyWithFaceIDAndBiometrics) - performApiCall(_title, _icon, selectedFlag,_flag); + performApiCall(_title, _icon, selectedFlag, _flag); else - performApiCall(_title, _icon, _flag,_flag); + performApiCall(_title, _icon, _flag, _flag); } } }, @@ -606,13 +605,13 @@ class _VerifyLoginScreenState extends State { return isAvailable; } - Future performApiCall(String _title, String _icon, int _flag,int sendVerificationFlat) async { + Future performApiCall(String _title, String _icon, int _flag, int sendVerificationFlat) async { try { Utils.showLoading(context); await LoginApiClient().checkMobileAppVersion(); await LoginApiClient().memberLogin(AppState().getUserName!, AppState().password!); - BasicMemberInformationModel? memberInformationModel = await LoginApiClient() - .mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); + BasicMemberInformationModel? memberInformationModel = + await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName); Utils.hideLoading(context); OtpDialog( context, @@ -633,8 +632,6 @@ class _VerifyLoginScreenState extends State { Platform.isAndroid ? "android" : "ios"); if (genericResponseModel?.errorMessage != null) { Utils.showToast(genericResponseModel?.errorMessage ?? ""); - - } else { AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? []; AppState().setMemberInformationListModel = genericResponseModel.memberInformationList?.first; @@ -662,6 +659,9 @@ class _VerifyLoginScreenState extends State { () => { Navigator.pop(context), }, + onResendCode: () { + performApiCall(_title, _icon, _flag, sendVerificationFlat); + }, ).displayDialog(context); } catch (ex) { Utils.hideLoading(context); diff --git a/lib/ui/marathon/marathon_intro_screen.dart b/lib/ui/marathon/marathon_intro_screen.dart index 4a1a2b6..f836229 100644 --- a/lib/ui/marathon/marathon_intro_screen.dart +++ b/lib/ui/marathon/marathon_intro_screen.dart @@ -11,7 +11,7 @@ import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart'; import 'package:mohem_flutter_app/ui/marathon/widgets/countdown_timer.dart'; -import 'package:mohem_flutter_app/ui/marathon/widgets/marathon_header.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:provider/provider.dart'; @@ -24,18 +24,20 @@ class MarathonIntroScreen extends StatelessWidget { Widget build(BuildContext context) { MarathonProvider provider = context.watch(); return Scaffold( + appBar: AppBarWidget(context, title: LocaleKeys.brainMarathon.tr()), body: Stack( children: [ SingleChildScrollView( child: Column( children: [ - const MarathonHeader(), MarathonDetailsCard(provider: provider).paddingAll(15), MarathonTimerCard( provider: provider, timeToMarathon: dummyEndTime, ).paddingOnly(left: 15, right: 15, bottom: 15), - const SizedBox(height: 100,), + const SizedBox( + height: 100, + ), ], ), ), @@ -52,8 +54,7 @@ class MarathonIntroScreen extends StatelessWidget { class MarathonDetailsCard extends StatelessWidget { final MarathonProvider provider; - const MarathonDetailsCard({Key? key, required this.provider}) - : super(key: key); + const MarathonDetailsCard({Key? key, required this.provider}) : super(key: key); @override Widget build(BuildContext context) { @@ -68,17 +69,12 @@ class MarathonDetailsCard extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.contestTopicAbout - .tr() - .toText16(color: MyColors.grey77Color), - "Saudi Arabia" - .toText20(color: MyColors.textMixColor, isBold: true), + LocaleKeys.contestTopicAbout.tr().toText16(color: MyColors.grey77Color), + "Saudi Arabia".toText20(color: MyColors.textMixColor, isBold: true), Row( children: [ Flexible( - child: - "Nam suscipit turpis in pharetra euismsdef. Duis rutrum at nulla id aliquam" - .toText14(color: MyColors.grey77Color), + child: "Nam suscipit turpis in pharetra euismsdef. Duis rutrum at nulla id aliquam".toText14(color: MyColors.grey77Color), ) ], ), @@ -86,31 +82,25 @@ class MarathonDetailsCard extends StatelessWidget { 5.height, Row( children: [ - LocaleKeys.prize - .tr() - .toText16(color: MyColors.grey77Color, isBold: true), - " LED 55\" Android TV" - .toText16(color: MyColors.greenColor, isBold: true), + LocaleKeys.prize.tr().toText16(color: MyColors.grey77Color, isBold: true), + " LED 55\" Android TV".toText16(color: MyColors.greenColor, isBold: true), ], ), Row( children: [ - LocaleKeys.sponsoredBy - .tr() - .toText16(color: MyColors.grey77Color), - " Extra" - .toText16(color: MyColors.darkTextColor, isBold: true), + LocaleKeys.sponsoredBy.tr().toText16(color: MyColors.grey77Color), + " Extra".toText16(color: MyColors.darkTextColor, isBold: true), ], ), 10.height, Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Image.network( - "https://cdn.pixabay.com/photo/2014/08/27/07/53/blog-428950_1280.jpg", - height: 50, + Image.asset( + "assets/images/logos/main_mohemm_logo.png", + height: 40, fit: BoxFit.fill, - width: 120, + width: 150, ) ], ), @@ -144,8 +134,7 @@ class MarathonTimerCard extends StatelessWidget { Row( children: [ LocaleKeys.gameDate.tr().toText16(color: MyColors.grey77Color), - " 10 Oct, 2022" - .toText16(color: MyColors.darkTextColor, isBold: true), + " 10 Oct, 2022".toText16(color: MyColors.darkTextColor, isBold: true), ], ), Row( @@ -156,7 +145,7 @@ class MarathonTimerCard extends StatelessWidget { ), Lottie.asset( MyLottieConsts.hourGlassLottie, - height: 140, + height: 200, ), BuildCountdownTimer( timeToMarathon: timeToMarathon, @@ -178,47 +167,45 @@ class MarathonFooter extends StatelessWidget { }) : super(key: key); Widget buildNoteForDemo() { - return Flexible( - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: LocaleKeys.note.tr(), - style: const TextStyle( - color: MyColors.darkTextColor, - fontSize: 17, - letterSpacing: -0.64, - fontWeight: FontWeight.bold, - ), + return RichText( + text: TextSpan( + children: [ + TextSpan( + text: LocaleKeys.note.tr(), + style: const TextStyle( + color: MyColors.darkTextColor, + fontSize: 17, + letterSpacing: -0.64, + fontWeight: FontWeight.bold, ), - TextSpan( - text: " " + LocaleKeys.demoMarathonNoteP1.tr(), - style: const TextStyle( - color: MyColors.grey77Color, - fontSize: 17, - letterSpacing: -0.64, - fontWeight: FontWeight.w500, - ), + ), + TextSpan( + text: " " + LocaleKeys.demoMarathonNoteP1.tr(), + style: const TextStyle( + color: MyColors.grey77Color, + fontSize: 17, + letterSpacing: -0.64, + fontWeight: FontWeight.w500, ), - TextSpan( - text: " " + LocaleKeys.demoMarathonNoteP2.tr(), - style: const TextStyle( - color: MyColors.darkTextColor, - fontSize: 17, - fontWeight: FontWeight.bold, - ), + ), + TextSpan( + text: " " + LocaleKeys.demoMarathonNoteP2.tr(), + style: const TextStyle( + color: MyColors.darkTextColor, + fontSize: 17, + fontWeight: FontWeight.bold, ), - TextSpan( - text: " " + LocaleKeys.demoMarathonNoteP3.tr(), - style: const TextStyle( - color: MyColors.grey77Color, - fontSize: 17, - letterSpacing: -0.64, - fontWeight: FontWeight.w500, - ), - ) - ], - ), + ), + TextSpan( + text: " " + LocaleKeys.demoMarathonNoteP3.tr(), + style: const TextStyle( + color: MyColors.grey77Color, + fontSize: 17, + letterSpacing: -0.64, + fontWeight: FontWeight.w500, + ), + ) + ], ), ).paddingOnly(right: 21, left: 21, top: 11, bottom: 0); } diff --git a/lib/ui/marathon/marathon_provider.dart b/lib/ui/marathon/marathon_provider.dart index 50a7bd2..5a03b74 100644 --- a/lib/ui/marathon/marathon_provider.dart +++ b/lib/ui/marathon/marathon_provider.dart @@ -2,7 +2,9 @@ import 'dart:async'; import 'package:appinio_swiper/appinio_swiper.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart'; class MarathonProvider extends ChangeNotifier { final AppinioSwiperController swiperController = AppinioSwiperController(); @@ -41,11 +43,18 @@ class MarathonProvider extends ChangeNotifier { notifyListeners(); } + void resetAll() { + isSelectedOptions[0] = false; + isSelectedOptions[1] = false; + isSelectedOptions[2] = false; + isSelectedOptions[3] = false; + } + Timer timerU = Timer.periodic(const Duration(seconds: 1), (Timer timer) {}); - int start = 5; + int start = 8; void startTimer(BuildContext context) { - start = 5; + start = 8; const Duration oneSec = Duration(seconds: 1); timerU = Timer.periodic( oneSec, @@ -55,18 +64,21 @@ class MarathonProvider extends ChangeNotifier { timer.cancel(); cancelTimer(); isMarathonCompleted = true; - await Future.delayed(const Duration(seconds: 3)); - Navigator.pushReplacementNamed( - context, - AppRoutes.marathonWinnerSelection, + await Future.delayed(const Duration(seconds: 3)).whenComplete( + () => Navigator.pushReplacementNamed( + context, + AppRoutes.marathonWinnerSelection, + ), ); + resetValues(); return; } - swipeCardLeft(); + resetAll(); timer.cancel(); cancelTimer(); + swipeCardLeft(); } else { start--; } @@ -77,8 +89,9 @@ class MarathonProvider extends ChangeNotifier { void resetValues() { timerU.cancel(); - isMarathonCompleted = false; - currentQuestionNumber = 1; + _isMarathonCompleted = false; + _currentQuestionNumber = 1; + notifyListeners(); } void cancelTimer() { diff --git a/lib/ui/marathon/marathon_screen.dart b/lib/ui/marathon/marathon_screen.dart index 2d7acee..a02733f 100644 --- a/lib/ui/marathon/marathon_screen.dart +++ b/lib/ui/marathon/marathon_screen.dart @@ -13,9 +13,10 @@ import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart'; import 'package:mohem_flutter_app/ui/marathon/widgets/custom_status_widget.dart'; -import 'package:mohem_flutter_app/ui/marathon/widgets/marathon_header.dart'; import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:provider/provider.dart'; +import 'package:sizer/sizer.dart'; import 'package:steps_indicator/steps_indicator.dart'; class MarathonScreen extends StatelessWidget { @@ -25,13 +26,12 @@ class MarathonScreen extends StatelessWidget { Widget build(BuildContext context) { MarathonProvider provider = context.watch(); return Scaffold( + appBar: AppBarWidget(context, title: LocaleKeys.brainMarathon.tr()), body: SingleChildScrollView( child: Column( children: [ - const MarathonHeader(), 20.height, - MarathonProgressContainer(provider: provider) - .paddingOnly(left: 21, right: 21), + MarathonProgressContainer(provider: provider).paddingOnly(left: 21, right: 21), if (provider.isMarathonCompleted) InkWell( onTap: () { @@ -58,17 +58,12 @@ class MarathonScreen extends StatelessWidget { subTitle: Text( LocaleKeys.allQuestionsCorrect.tr(), textAlign: TextAlign.center, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.w600, - color: MyColors.darkTextColor, - letterSpacing: -1.08), + style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -1.08), ), ).paddingOnly(top: 12, left: 21, right: 21), ) else - QuestionCard(provider: provider) - .paddingOnly(top: 12, left: 21, right: 21), + QuestionCard(provider: provider).paddingOnly(top: 12, left: 21, right: 21), ], ), ), @@ -79,12 +74,10 @@ class MarathonScreen extends StatelessWidget { class MarathonProgressContainer extends StatefulWidget { final MarathonProvider provider; - const MarathonProgressContainer({Key? key, required this.provider}) - : super(key: key); + const MarathonProgressContainer({Key? key, required this.provider}) : super(key: key); @override - State createState() => - _MarathonProgressContainerState(); + State createState() => _MarathonProgressContainerState(); } class _MarathonProgressContainerState extends State { @@ -107,7 +100,7 @@ class _MarathonProgressContainerState extends State { return Container( width: double.infinity, decoration: MyDecorations.shadowDecoration, - padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 20), + padding: const EdgeInsets.all(21), child: Column( mainAxisSize: MainAxisSize.min, children: [ @@ -117,21 +110,18 @@ class _MarathonProgressContainerState extends State { Container( decoration: BoxDecoration( color: MyColors.greenColor, - borderRadius: BorderRadius.circular(12), + borderRadius: BorderRadius.circular(5), ), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 8), - child: - "${widget.provider.currentQuestionNumber.toString()} / ${widget.provider.totalQuestions.toString()} ${LocaleKeys.question.tr()}" - .toText12(color: MyColors.white), + child: "${widget.provider.currentQuestionNumber.toString()} / ${widget.provider.totalQuestions.toString()} ${LocaleKeys.question.tr()}".toText12(color: MyColors.white), ), "23 ${LocaleKeys.marathoners.tr()}".toText14(), - "00:${widget.provider.start < 10 ? "0${widget.provider.start}" : widget.provider.start}" - .toText18(), + "00:${widget.provider.start < 10 ? "0${widget.provider.start}" : widget.provider.start}".toText18(), ], ), 15.height, StepsIndicator( - lineLength: 23, + lineLength: SizerUtil.deviceType == DeviceType.tablet ? MediaQuery.of(context).size.width * 0.077 : MediaQuery.of(context).size.width * 0.054, nbSteps: 10, selectedStep: widget.provider.currentQuestionNumber, doneLineColor: MyColors.greenColor, @@ -141,6 +131,8 @@ class _MarathonProgressContainerState extends State { selectedStepSize: 10, unselectedStepSize: 10, doneStepSize: 10, + selectedStepBorderSize: 0, + unselectedStepBorderSize: 0, selectedStepColorIn: MyColors.greenColor, selectedStepColorOut: MyColors.greenColor, unselectedStepColorIn: MyColors.lightGreyDeColor, @@ -152,8 +144,7 @@ class _MarathonProgressContainerState extends State { 12.height, Row( children: [ - "${widget.provider.currentQuestionNumber * 10}% ${LocaleKeys.completed.tr()}" - .toText14(isBold: true), + "${widget.provider.currentQuestionNumber * 10}% ${LocaleKeys.completed.tr()}".toText14(isBold: true), ], ), ], diff --git a/lib/ui/marathon/marathon_winner_selection.dart b/lib/ui/marathon/marathon_winner_selection.dart index c69f54f..8462ab4 100644 --- a/lib/ui/marathon/marathon_winner_selection.dart +++ b/lib/ui/marathon/marathon_winner_selection.dart @@ -13,7 +13,7 @@ import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart'; import 'package:mohem_flutter_app/ui/marathon/widgets/custom_status_widget.dart'; -import 'package:mohem_flutter_app/ui/marathon/widgets/marathon_header.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:provider/provider.dart'; class MarathonWinnerSelection extends StatelessWidget { @@ -23,13 +23,12 @@ class MarathonWinnerSelection extends StatelessWidget { Widget build(BuildContext context) { MarathonProvider provider = context.read(); return Scaffold( + appBar: AppBarWidget(context, title: LocaleKeys.brainMarathon.tr()), body: SingleChildScrollView( child: Column( children: [ - const MarathonHeader(), 20.height, - QualifiersContainer(provider: provider) - .paddingOnly(left: 21, right: 21), + QualifiersContainer(provider: provider).paddingOnly(left: 21, right: 21), 20.height, InkWell( onTap: () { @@ -53,8 +52,7 @@ class MarathonWinnerSelection extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Muhammad Shrouff" - .toText18(isBold: true, color: MyColors.white), + "Muhammad Shrouff".toText18(isBold: true, color: MyColors.white), "837436".toText18(isBold: true, color: MyColors.white), ], ), @@ -96,8 +94,7 @@ class MarathonWinnerSelection extends StatelessWidget { class QualifiersContainer extends StatefulWidget { final MarathonProvider provider; - const QualifiersContainer({Key? key, required this.provider}) - : super(key: key); + const QualifiersContainer({Key? key, required this.provider}) : super(key: key); @override State createState() => _QualifiersContainerState(); @@ -134,11 +131,8 @@ class _QualifiersContainerState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - LocaleKeys.winnerSelection - .tr() - .toText18(isBold: true, color: MyColors.grey3AColor), - "00:${widget.provider.start < 10 ? "0${widget.provider.start}" : widget.provider.start}" - .toText18(isBold: true, color: MyColors.redColor), + LocaleKeys.winnerSelection.tr().toText18(isBold: true, color: MyColors.grey3AColor), + "00:${widget.provider.start < 10 ? "0${widget.provider.start}" : widget.provider.start}".toText18(isBold: true, color: MyColors.redColor), ], ), 10.height, diff --git a/lib/ui/marathon/widgets/countdown_timer.dart b/lib/ui/marathon/widgets/countdown_timer.dart index 3c4f790..93db057 100644 --- a/lib/ui/marathon/widgets/countdown_timer.dart +++ b/lib/ui/marathon/widgets/countdown_timer.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:auto_size_text/auto_size_text.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_countdown_timer/current_remaining_time.dart'; @@ -13,28 +14,26 @@ class BuildCountdownTimer extends StatelessWidget { final MarathonProvider provider; final int screenFlag; - const BuildCountdownTimer({ + BuildCountdownTimer({ Key? key, required this.provider, required this.timeToMarathon, required this.screenFlag, }) : super(key: key); - final TextStyle styleTextHome = const TextStyle( - fontSize: 7, - color: MyColors.greyACColor, + final TextStyle styleTextHome = TextStyle( + color: MyColors.grey3AColor.withOpacity(0.45), fontStyle: FontStyle.italic, - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w800, letterSpacing: -0.4, ); final TextStyle styleDigitHome = const TextStyle( height: 23 / 27, - color: MyColors.white, - fontSize: 24, + color: MyColors.darkDigitColor, fontStyle: FontStyle.italic, letterSpacing: -1.44, - fontWeight: FontWeight.w600, + fontWeight: FontWeight.bold, ); final TextStyle styleTextMarathon = const TextStyle( @@ -61,12 +60,16 @@ class BuildCountdownTimer extends StatelessWidget { children: [ Column( children: [ - Text( + AutoSizeText( "00", + maxFontSize: 24, + minFontSize: 20, style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ), - Text( + AutoSizeText( LocaleKeys.days.tr(), + minFontSize: 7, + maxFontSize: 8, style: screenFlag == 0 ? styleTextHome : styleTextMarathon, ), ], @@ -74,12 +77,16 @@ class BuildCountdownTimer extends StatelessWidget { buildSeparator(), Column( children: [ - Text( + AutoSizeText( "00", + maxFontSize: 24, + minFontSize: 20, style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ), - Text( + AutoSizeText( LocaleKeys.hours.tr(), + minFontSize: 7, + maxFontSize: 8, style: screenFlag == 0 ? styleTextHome : styleTextMarathon, ), ], @@ -87,12 +94,16 @@ class BuildCountdownTimer extends StatelessWidget { buildSeparator(), Column( children: [ - Text( + AutoSizeText( "00", + maxFontSize: 24, + minFontSize: 20, style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ), - Text( + AutoSizeText( LocaleKeys.minutes.tr(), + minFontSize: 7, + maxFontSize: 8, style: screenFlag == 0 ? styleTextHome : styleTextMarathon, ), ], @@ -100,12 +111,16 @@ class BuildCountdownTimer extends StatelessWidget { buildSeparator(), Column( children: [ - Text( + AutoSizeText( "00", + maxFontSize: 24, + minFontSize: 20, style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ), - Text( + AutoSizeText( LocaleKeys.seconds.tr(), + minFontSize: 7, + maxFontSize: 8, style: screenFlag == 0 ? styleTextHome : styleTextMarathon, ), ], @@ -115,8 +130,10 @@ class BuildCountdownTimer extends StatelessWidget { } Widget buildSeparator() { - return Text( + return AutoSizeText( " : ", + maxFontSize: 24, + minFontSize: 20, style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ); } @@ -139,20 +156,22 @@ class BuildCountdownTimer extends StatelessWidget { Column( children: [ time.days == null - ? Text( + ? AutoSizeText( "00", - style: - screenFlag == 0 ? styleDigitHome : styleDigitMarathon, + maxFontSize: 24, + minFontSize: 20, + style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ) - : Text( - time.days! < 10 - ? "0${time.days.toString()}" - : time.days.toString(), - style: - screenFlag == 0 ? styleDigitHome : styleDigitMarathon, + : AutoSizeText( + time.days! < 10 ? "0${time.days.toString()}" : time.days.toString(), + maxFontSize: 24, + minFontSize: 20, + style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ), - Text( + AutoSizeText( LocaleKeys.days.tr(), + minFontSize: 7, + maxFontSize: 8, style: screenFlag == 0 ? styleTextHome : styleTextMarathon, ), ], @@ -161,20 +180,22 @@ class BuildCountdownTimer extends StatelessWidget { Column( children: [ time.hours == null - ? Text( + ? AutoSizeText( "00", - style: - screenFlag == 0 ? styleDigitHome : styleDigitMarathon, + maxFontSize: 24, + minFontSize: 20, + style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ) - : Text( - time.hours! < 10 - ? "0${time.hours.toString()}" - : time.hours.toString(), - style: - screenFlag == 0 ? styleDigitHome : styleDigitMarathon, + : AutoSizeText( + time.hours! < 10 ? "0${time.hours.toString()}" : time.hours.toString(), + maxFontSize: 24, + minFontSize: 20, + style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ), - Text( + AutoSizeText( LocaleKeys.hours.tr(), + minFontSize: 7, + maxFontSize: 8, style: screenFlag == 0 ? styleTextHome : styleTextMarathon, ), ], @@ -183,20 +204,22 @@ class BuildCountdownTimer extends StatelessWidget { Column( children: [ time.min == null - ? Text( + ? AutoSizeText( "00", - style: - screenFlag == 0 ? styleDigitHome : styleDigitMarathon, + maxFontSize: 24, + minFontSize: 20, + style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ) - : Text( - time.min! < 10 - ? "0${time.min.toString()}" - : time.min.toString(), - style: - screenFlag == 0 ? styleDigitHome : styleDigitMarathon, + : AutoSizeText( + time.min! < 10 ? "0${time.min.toString()}" : time.min.toString(), + maxFontSize: 24, + minFontSize: 20, + style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ), - Text( + AutoSizeText( LocaleKeys.minutes.tr(), + minFontSize: 7, + maxFontSize: 8, style: screenFlag == 0 ? styleTextHome : styleTextMarathon, ), ], @@ -205,20 +228,22 @@ class BuildCountdownTimer extends StatelessWidget { Column( children: [ time.sec == null - ? Text( + ? AutoSizeText( "00", - style: - screenFlag == 0 ? styleDigitHome : styleDigitMarathon, + maxFontSize: 24, + minFontSize: 20, + style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ) - : Text( - time.sec! < 10 - ? "0${time.sec.toString()}" - : time.sec.toString(), - style: - screenFlag == 0 ? styleDigitHome : styleDigitMarathon, + : AutoSizeText( + time.sec! < 10 ? "0${time.sec.toString()}" : time.sec.toString(), + maxFontSize: 24, + minFontSize: 20, + style: screenFlag == 0 ? styleDigitHome : styleDigitMarathon, ), - Text( + AutoSizeText( LocaleKeys.seconds.tr(), + minFontSize: 7, + maxFontSize: 8, style: screenFlag == 0 ? styleTextHome : styleTextMarathon, ), ], diff --git a/lib/ui/marathon/widgets/marathon_banner.dart b/lib/ui/marathon/widgets/marathon_banner.dart index 44bca40..10fe17d 100644 --- a/lib/ui/marathon/widgets/marathon_banner.dart +++ b/lib/ui/marathon/widgets/marathon_banner.dart @@ -1,3 +1,4 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -22,6 +23,8 @@ class MarathonBanner extends StatelessWidget { MarathonProvider provider = context.read(); return Container( decoration: MyDecorations.shadowDecoration, + height: MediaQuery.of(context).size.height * 0.11, + clipBehavior: Clip.antiAlias, child: Stack( children: [ Transform( @@ -31,55 +34,125 @@ class MarathonBanner extends StatelessWidget { ), child: SvgPicture.asset( "assets/images/marathon_banner_bg.svg", - fit: BoxFit.cover, - width: MediaQuery.of(context).size.width - 40, + fit: BoxFit.fill, + width: double.infinity, ), ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - AppState().isArabic(context) ? 0.height : 5.height, - Flexible( - child: Text( - LocaleKeys.getReadyForContest.tr(), - style: const TextStyle( - fontStyle: FontStyle.italic, - fontSize: 12, - fontWeight: FontWeight.w600, - color: MyColors.lightGreyEFColor, - letterSpacing: -0.4, - ), - ), + Positioned( + left: -20, + top: -10, + child: Transform.rotate( + angle: 15, + child: Container( + width: 65, + height: 32, + color: MyColors.darkDigitColor, + ), + ), + ), + SizedBox( + width: double.infinity, + height: double.infinity, + child: Row( + children: [ + const Expanded( + flex: 3, + child: SizedBox( + width: double.infinity, + height: double.infinity, ), - const Flexible( - child: Text( - "Saudi Arabia", - style: TextStyle( - fontStyle: FontStyle.italic, - fontSize: 19, - fontWeight: FontWeight.bold, - color: MyColors.lightGreyEFColor, - height: 32 / 22, - ), + ), + Expanded( + flex: 5, + child: SizedBox( + width: double.infinity, + height: double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + AppState().isArabic(context) ? 0.height : 5.height, + AutoSizeText( + LocaleKeys.getReadyForContest.tr(), + minFontSize: 08, + maxFontSize: 11, + style: TextStyle( + fontStyle: FontStyle.italic, + fontWeight: FontWeight.w600, + color: MyColors.grey3AColor.withOpacity(0.8), + letterSpacing: -0.4, + ), + ), + AutoSizeText( + "Saudi Arabia", + style: TextStyle( + fontStyle: FontStyle.italic, + fontSize: 19, + fontWeight: FontWeight.bold, + color: MyColors.grey3AColor.withOpacity(0.8), + height: 32 / 22, + ), + ), + 3.height, + BuildCountdownTimer( + timeToMarathon: dummyEndTime, + provider: provider, + screenFlag: 0, + ), + ], + ).paddingOnly( + left: AppState().isArabic(context) ? 12 : 3, + right: AppState().isArabic(context) ? 3 : 12, + ) + ], ), ), - 3.height, - BuildCountdownTimer( - timeToMarathon: dummyEndTime, - provider: provider, - screenFlag: 0, - ), - ], - ).paddingOnly( - left: AppState().isArabic(context) ? 12 : 0, - right: AppState().isArabic(context) ? 0 : 12, - ) - ], + ), + ], + ), ), + Align( + alignment: Alignment.topLeft, + child: SizedBox( + height: 20, + width: 35, + child: Transform.rotate( + angle: -math.pi / 4.5, + child: Text( + LocaleKeys.brainMarathon.tr(), + textAlign: TextAlign.center, + maxLines: 2, + style: const TextStyle( + color: MyColors.kWhiteColor, + fontWeight: FontWeight.bold, + fontSize: 6, + height: 1.2, + ), + ), + ), + ), + ).paddingOnly(top: 5), + !AppState().isArabic(context) + ? Positioned( + right: 0, + bottom: 0, + child: RotatedBox( + quarterTurns: 4, + child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkDigitColor), + ).paddingAll(15), + ) + : Positioned( + bottom: 0, + left: 0, + child: RotatedBox( + quarterTurns: 2, + child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkDigitColor), + ).paddingAll(15), + ), ], ).onPress( () => Navigator.pushNamed(context, AppRoutes.marathonIntroScreen), diff --git a/lib/ui/marathon/widgets/question_card.dart b/lib/ui/marathon/widgets/question_card.dart index 08c9e3b..a3fe720 100644 --- a/lib/ui/marathon/widgets/question_card.dart +++ b/lib/ui/marathon/widgets/question_card.dart @@ -4,10 +4,18 @@ import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/decorations_helper.dart'; import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/models/marathon_question_model.dart'; import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart'; import 'package:provider/provider.dart'; +List isSelectedOptions = [ + false, + false, + false, + false, +]; + class QuestionCard extends StatefulWidget { final MarathonProvider provider; @@ -18,7 +26,7 @@ class QuestionCard extends StatefulWidget { } class _QuestionCardState extends State { - final List questionCards = []; + final List questionCards = []; @override void initState() { @@ -29,7 +37,7 @@ class _QuestionCardState extends State { void _loadCards() { for (DummyQuestionModel question in questions) { questionCards.add( - QuestionContent( + CardContent( question: question, provider: widget.provider, ), @@ -41,7 +49,7 @@ class _QuestionCardState extends State { Widget build(BuildContext context) { return CupertinoPageScaffold( child: SizedBox( - height: 420, + height: 440, width: double.infinity, child: Consumer( builder: (BuildContext context, MarathonProvider provider, _) { @@ -64,11 +72,11 @@ class _QuestionCardState extends State { } } -class QuestionContent extends StatelessWidget { +class CardContent extends StatelessWidget { final DummyQuestionModel question; final MarathonProvider provider; - const QuestionContent({ + const CardContent({ Key? key, required this.question, required this.provider, @@ -131,13 +139,37 @@ class QuestionContent extends StatelessWidget { } } -class AnswerContent extends StatelessWidget { +class AnswerContent extends StatefulWidget { final DummyQuestionModel question; final MarathonProvider provider; - const AnswerContent( - {Key? key, required this.question, required this.provider}) - : super(key: key); + const AnswerContent({Key? key, required this.question, required this.provider}) : super(key: key); + + @override + State createState() => _AnswerContentState(); +} + +class _AnswerContentState extends State { + void updateOption(int index, bool value) { + isSelectedOptions[0] = false; + isSelectedOptions[1] = false; + isSelectedOptions[2] = false; + isSelectedOptions[3] = false; + isSelectedOptions[index] = value; + setState(() {}); + } + + Decoration getContainerColor(int index) { + if (!isSelectedOptions[index]) { + return MyDecorations.getContainersDecoration(MyColors.greyF7Color); + } + if (isSelectedOptions[index] && context.watch().start > 0) { + return MyDecorations.getContainersDecoration(MyColors.yellowColorII); + } + return MyDecorations.getContainersDecoration( + isSelectedOptions[index] ? MyColors.greenColor : MyColors.greyF7Color, + ); + } @override Widget build(BuildContext context) { @@ -157,134 +189,116 @@ class AnswerContent extends StatelessWidget { children: [ InkWell( onTap: () { - if (provider.currentQuestionNumber == 9) { - provider.cancelTimer(); - provider.resetValues(); + if (widget.provider.currentQuestionNumber == 9) { + widget.provider.cancelTimer(); + widget.provider.resetValues(); Navigator.pushReplacementNamed( context, AppRoutes.marathonWinnerSelection, ); return; } - provider.cancelTimer(); - provider.startTimer(context); - provider.swipeCardLeft(); + updateOption(0, true); }, - child: Flexible( - child: Container( - height: 60, - width: MediaQuery.of(context).size.width - 75, - alignment: Alignment.centerLeft, - decoration: MyDecorations.answerContainerDecoration, - child: Center( - child: Text( - question.opt1!, - style: const TextStyle( - color: MyColors.darkTextColor, - fontWeight: FontWeight.w600, - fontSize: 16, - ), + child: Container( + alignment: Alignment.centerLeft, + decoration: getContainerColor(0), + child: Center( + child: Text( + widget.question.opt1!, + style: TextStyle( + color: isSelectedOptions[0] ? MyColors.white : MyColors.darkTextColor, + fontWeight: FontWeight.w600, + fontSize: 16, ), - ), + ).paddingOnly(top: 17, bottom: 17), ), ), ), const SizedBox(height: 15), InkWell( onTap: () { - if (provider.currentQuestionNumber == 9) { - provider.cancelTimer(); - provider.resetValues(); + if (widget.provider.currentQuestionNumber == 9) { + widget.provider.cancelTimer(); + widget.provider.resetValues(); Navigator.pushReplacementNamed( context, AppRoutes.marathonWinnerSelection, ); return; } - provider.cancelTimer(); - provider.startTimer(context); - provider.swipeCardLeft(); + updateOption(1, true); }, child: Container( - height: 60, - width: MediaQuery.of(context).size.width - 75, alignment: Alignment.centerLeft, - decoration: MyDecorations.answerContainerDecoration, + decoration: getContainerColor(1), child: Center( child: Text( - question.opt2!, - style: const TextStyle( - color: MyColors.darkTextColor, + widget.question.opt2!, + style: TextStyle( + color: isSelectedOptions[1] ? MyColors.white : MyColors.darkTextColor, fontWeight: FontWeight.w600, fontSize: 16, ), - ), + ).paddingOnly(top: 17, bottom: 17), ), ), ), const SizedBox(height: 15), InkWell( onTap: () { - if (provider.currentQuestionNumber == 9) { - provider.cancelTimer(); - provider.resetValues(); + if (widget.provider.currentQuestionNumber == 9) { + widget.provider.cancelTimer(); + widget.provider.resetValues(); Navigator.pushReplacementNamed( context, AppRoutes.marathonWinnerSelection, ); return; } - provider.cancelTimer(); - provider.startTimer(context); - provider.swipeCardLeft(); + updateOption(2, true); }, child: Container( - height: 60, - width: MediaQuery.of(context).size.width - 75, alignment: Alignment.centerLeft, - decoration: MyDecorations.answerContainerDecoration, + decoration: getContainerColor(2), child: Center( child: Text( - question.opt3!, - style: const TextStyle( - color: MyColors.darkTextColor, + widget.question.opt3!, + style: TextStyle( + color: isSelectedOptions[2] ? MyColors.white : MyColors.darkTextColor, fontWeight: FontWeight.w600, fontSize: 16, ), - ), + ).paddingOnly(top: 17, bottom: 17), ), ), ), const SizedBox(height: 15), InkWell( onTap: () { - if (provider.currentQuestionNumber == 9) { - provider.cancelTimer(); - provider.resetValues(); + if (widget.provider.currentQuestionNumber == 9) { + widget.provider.cancelTimer(); + widget.provider.resetValues(); Navigator.pushReplacementNamed( context, AppRoutes.marathonWinnerSelection, ); return; } - provider.cancelTimer(); - provider.startTimer(context); - provider.swipeCardLeft(); + updateOption(3, true); }, child: Container( - height: 60, - width: MediaQuery.of(context).size.width - 75, alignment: Alignment.centerLeft, - decoration: MyDecorations.answerContainerDecoration, + decoration: getContainerColor(3), child: Center( child: Text( - question.opt3!, - style: const TextStyle( - color: MyColors.darkTextColor, + widget.question.opt3!, + style: TextStyle( + color: isSelectedOptions[3] ? MyColors.white : MyColors.darkTextColor, fontWeight: FontWeight.w600, fontSize: 16, ), - ), + ).paddingOnly(top: 17, bottom: 17), ), ), ), diff --git a/lib/ui/marathon/winner_screen.dart b/lib/ui/marathon/winner_screen.dart index cdd3df0..8d6d171 100644 --- a/lib/ui/marathon/winner_screen.dart +++ b/lib/ui/marathon/winner_screen.dart @@ -1,5 +1,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:lottie/lottie.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/decorations_helper.dart'; @@ -8,7 +9,7 @@ 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/ui/marathon/widgets/marathon_header.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; class WinnerScreen extends StatelessWidget { const WinnerScreen({Key? key}) : super(key: key); @@ -17,10 +18,10 @@ class WinnerScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( backgroundColor: MyColors.backgroundColor, + appBar: AppBarWidget(context, title: LocaleKeys.brainMarathon.tr()), body: SingleChildScrollView( child: Column( children: [ - const MarathonHeader(), 60.height, Container( width: double.infinity, @@ -43,27 +44,43 @@ class WinnerScreen extends StatelessWidget { ], ), ), - 50.height, + 26.height, + SizedBox( + height: 50, + child: Stack( + children: [ + Align( + alignment: Alignment.center, + child: SvgPicture.asset( + "assets/images/winner_ribbon.svg", + height: 50, + ), + ), + Align( + alignment: Alignment.center, + child: "WINNER".toText32(color: MyColors.white, isBold: true).paddingOnly(top: 07), + ) + ], + ), + ), + 12.height, "Muhammad Shrouff".toText22(color: MyColors.grey3AColor), "837436".toText22(color: MyColors.grey57Color), - 90.height, + 80.height, Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - LocaleKeys.sponsoredBy - .tr() - .toText14(color: MyColors.grey77Color), - " Extra".toText14( - color: MyColors.darkTextColor, isBold: true), + LocaleKeys.sponsoredBy.tr().toText14(color: MyColors.grey77Color), + " Extra".toText14(color: MyColors.darkTextColor, isBold: true), ], ), 5.height, - Image.network( - "https://cdn.pixabay.com/photo/2014/08/27/07/53/blog-428950_1280.jpg", - height: 50, + Image.asset( + "assets/images/logos/main_mohemm_logo.png", + height: 40, fit: BoxFit.fill, - width: 120, - ), + width: 150, + ) ], ), ).paddingOnly(left: 21, right: 21), diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart index 01895a7..0e71b09 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -480,7 +480,7 @@ class _DynamicInputScreenState extends State { return DynamicTextFieldWidget( (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), model.eSERVICESDV?.pIDCOLUMNNAME ?? "", - isReadOnly: model.rEADONLY == "Y", + // isReadOnly: model.rEADONLY == "Y", isInputTypeNum: true, onChange: (text) { model.fieldAnswer = text; diff --git a/lib/ui/my_team/view_attendance.dart b/lib/ui/my_team/view_attendance.dart index c77b1b4..90414d1 100644 --- a/lib/ui/my_team/view_attendance.dart +++ b/lib/ui/my_team/view_attendance.dart @@ -283,7 +283,6 @@ class _ViewAttendanceState extends State { cellBorderColor: Colors.white, selectionDecoration: BoxDecoration( border: Border.all(color: MyColors.white, width: 10), - borderRadius: const BorderRadius.all(Radius.circular(100)), shape: BoxShape.circle, ), dataSource: MeetingDataSource(_getDataSource()), diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart index 5c54b6d..6933a28 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart @@ -269,13 +269,13 @@ class _DynamicInputScreenState extends State { if (tempVar.isNotEmpty) { DateTime date = DateFormat('yyyy-MM-dd').parse(tempVar); - tempVar = DateFormat('dd/MMM/yyy').format(date); + tempVar = DateFormat('dd-MMM-yyy').format(date); if (e.aPPLICATIONCOLUMNNAME == null) { effectiveDate = tempVar; } } } else if (e.eSERVICESVS?.isNotEmpty ?? false) { - tempVar = e.getEmployeeAddressList!.vARCHAR2VALUE!; + e.getEmployeeAddressList!.vARCHAR2VALUE != null ? tempVar = e.getEmployeeAddressList!.vARCHAR2VALUE! : tempVar = ""; if (e.aPPLICATIONCOLUMNNAME == null) { countryCode = tempVar; } @@ -283,10 +283,17 @@ class _DynamicInputScreenState extends State { tempVar = e.getEmployeeAddressList!.sEGMENTVALUEDSP ?? ""; } - return ValidateEitTransactionModel(dATEVALUE: null, nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: null, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: tempVar.toString()).toJson(); + return ValidateEitTransactionModel(dATEVALUE: null, nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: null, tRANSACTIONNUMBER: 0, vARCHAR2VALUE: tempVar.toString()).toJson(); }).toList(); - submitPhoneNumbers = await ProfileApiClient().submitAddressTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values, dynamicParams!.correctOrNew, countryCode, effectiveDate); + submitPhoneNumbers = await ProfileApiClient().submitAddressTransaction( + dESCFLEXCONTEXTCODE, + dynamicParams!.dynamicId, + values, + dynamicParams!.correctOrNew, + countryCode, + effectiveDate.isEmpty ? DateFormat('dd-MMM-yyy').format(DateTime.now().add(Duration(days: 35))) : effectiveDate, + ); print(values); Utils.hideLoading(context); diff --git a/lib/ui/profile/profile_screen.dart b/lib/ui/profile/profile_screen.dart index c071d3f..0bf007e 100644 --- a/lib/ui/profile/profile_screen.dart +++ b/lib/ui/profile/profile_screen.dart @@ -112,7 +112,7 @@ class _ProfileScreenState extends State { } void startImageSheet() { - showMyBottomSheet(context, + showMyBottomSheet(context, callBackFunc: (){}, child: Column( children: [ Container( diff --git a/lib/ui/profile/widgets/profile_panel.dart b/lib/ui/profile/widgets/profile_panel.dart index 5018171..440fbb3 100644 --- a/lib/ui/profile/widgets/profile_panel.dart +++ b/lib/ui/profile/widgets/profile_panel.dart @@ -44,12 +44,16 @@ class ProfilePanel extends StatelessWidget { Widget profileImage() => memberInformationList.eMPLOYEEIMAGE == null ? SvgPicture.asset( - "assets/images/user.svg", - height: 68, - width: 68,) - : CircleAvatar( - radius: 68, - backgroundImage: MemoryImage(Utils.dataFromBase64String(memberInformationList.eMPLOYEEIMAGE!)), - backgroundColor: Colors.black, - ); + "assets/images/user.svg", + height: 68, + width: 68, + ) + : ClipOval( + child: Image.memory( + Utils.dataFromBase64String(memberInformationList.eMPLOYEEIMAGE!), + width: 75, + height: 75, + fit: BoxFit.fill, + ), + ); } diff --git a/lib/ui/screens/my_requests/my_requests.dart b/lib/ui/screens/my_requests/my_requests.dart index 65aa534..f9d8d39 100644 --- a/lib/ui/screens/my_requests/my_requests.dart +++ b/lib/ui/screens/my_requests/my_requests.dart @@ -47,7 +47,7 @@ class _MyRequestsState extends State { backgroundColor: Colors.white, appBar: AppBarWidget( context, - title: "Concurrent Reports", + title: LocaleKeys.concurrentReports, ), body: Column( children: [ diff --git a/lib/ui/screens/my_requests/new_request.dart b/lib/ui/screens/my_requests/new_request.dart index 851b82f..7a73497 100644 --- a/lib/ui/screens/my_requests/new_request.dart +++ b/lib/ui/screens/my_requests/new_request.dart @@ -5,11 +5,15 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/my_requests_api_client.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/dyanmic_forms/validate_eit_transaction_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/my_requests/get_ccp_transactions_model.dart'; +import 'package:mohem_flutter_app/models/my_requests/get_ccp_transations_list_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_concurrent_programs_model.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; @@ -25,7 +29,8 @@ class NewRequest extends StatefulWidget { class _NewRequestState extends State { List getConcurrentProgramsList = []; GetConcurrentProgramsModel? selectedConcurrentProgramList; - + SubmitCcpTransactionList? submitCcpTransactionList; + List getCCPTransactionsList = []; List? getCCPDFFStructureModelList; DateTime selectedDate = DateTime.now(); @@ -42,7 +47,7 @@ class _NewRequestState extends State { backgroundColor: Colors.white, appBar: AppBarWidget( context, - title: "Concurrent Reports", + title: LocaleKeys.concurrentReports, ), body: Column( children: [ @@ -84,14 +89,49 @@ class _NewRequestState extends State { 1.divider, DefaultButton(LocaleKeys.submit.tr(), () { // todo need to add submit method - print("hi"); - // openNewRequest(); + openNewRequest(); }).insideContainer, ], ), ); } + void openNewRequest() async { + try { + List> values = getCCPDFFStructureModelList!.map((e) { + String? dateVal = ''; + String? vatcherVal = ''; + int? numberVal; + if (e!.fORMATTYPE == 'N') { + dateVal = null; + vatcherVal = e.eSERVICESDV!.pIDCOLUMNNAME; + numberVal = null; + } else if (e.fORMATTYPE == 'X') { + dateVal = null; + vatcherVal = e.eSERVICESDV!.pIDCOLUMNNAME; + numberVal = null; + } else { + dateVal = null; + numberVal = null; + vatcherVal = null; + } + return ValidateEitTransactionModel(dATEVALUE: dateVal, nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: numberVal, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: vatcherVal.toString()).toJson(); + }).toList(); + Utils.showLoading(context); + submitCcpTransactionList = await MyRequestsApiClient().getSubmitNewRequest(values); + getCCPTransactionsList = await MyRequestsApiClient().getCcpTransactions(values); + Utils.hideLoading(context); + Navigator.pushNamed( + context, + AppRoutes.myRequests, + ); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + void getConcurrentPrograms() async { try { Utils.showLoading(context); diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index 0a74500..84bd9bd 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -66,7 +66,9 @@ class _ItgDetailScreenState extends State { isRejectAvailable = itgRequest!.allowedActions!.any((element) => element.action == "Reject"); } Utils.hideLoading(context); - setState(() {}); + setState(() { + controller.jumpToPage(0); + }); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); @@ -125,7 +127,7 @@ class _ItgDetailScreenState extends State { }, children: [ RequestDetailFragment(fields: itgRequest?.fieldGoups?[1].fields ?? []), - ApprovalLevelfragment(wFHistory: itgRequest?.wFHistory ?? []), + ApprovalLevelfragment(wFHistory: itgRequest?.wFHistory ?? [], voidCallback: reloadITG,), RequestDetailFragment(fields: itgRequest?.fieldGoups?[0].fields ?? []), ], ).expanded, @@ -210,6 +212,7 @@ class _ItgDetailScreenState extends State { AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1; requestDetails = null; itgRequest = null; + tabIndex = 0; showFabOptions = false; getDataFromState(); } else if (AppState().requestAllList!.length - 1 == AppState().itgWorkListIndex!) { @@ -262,13 +265,13 @@ class _ItgDetailScreenState extends State { print(action.toJson()); switch (action.action) { case "Delegate": - showMyBottomSheet(context, - child: DelegateSheet(title: LocaleKeys.delegate.tr(), apiMode: action.action!, notificationID: null, actionHistoryList: null, wFHistory: itgRequest?.wFHistory ?? [])); + showMyBottomSheet(context, callBackFunc: reloadITG, + child: DelegateSheet(title: LocaleKeys.delegate.tr(), apiMode: action.action!, notificationID: null, actionHistoryList: null, wFHistory: itgRequest?.wFHistory ?? [], callBackFunc: reloadITG,)); break; case "RequestInformation": - showMyBottomSheet(context, - child: DelegateSheet(title: LocaleKeys.request_info.tr(), apiMode: action.action!, notificationID: null, actionHistoryList: null, wFHistory: itgRequest?.wFHistory ?? [])); + showMyBottomSheet(context, callBackFunc: reloadITG, + child: DelegateSheet(title: LocaleKeys.request_info.tr(), apiMode: action.action!, notificationID: null, actionHistoryList: null, wFHistory: itgRequest?.wFHistory ?? [], callBackFunc: reloadITG,)); break; case "RFC": @@ -278,6 +281,9 @@ class _ItgDetailScreenState extends State { // do something else break; } + setState(() { + showFabOptions = false; + }); } Widget myTab(String title, int index) { @@ -341,10 +347,12 @@ class _ItgDetailScreenState extends State { } void performAction(String actionMode) { + print(actionMode); showDialog( context: context, builder: (cxt) => ITGCommentsDialog( message: LocaleKeys.writeComment.tr(), + actionMode: actionMode, onTap: (note) { if (actionMode == "APPROVED") { performApproveAction(requestDetails!.requestType!, requestDetails!.iD!, requestDetails!.itemID!, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", note); @@ -403,4 +411,19 @@ class _ItgDetailScreenState extends State { Utils.handleException(ex, context, null); } } + + void reloadITG() { + AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!); + if (AppState().requestAllList!.isEmpty) { + Navigator.pop(context, "delegate_reload"); + } else { + if (AppState().requestAllList!.length <= AppState().itgWorkListIndex!) { + Navigator.pop(context, "delegate_reload"); + } else { + requestDetails = null; + getDataFromState(); + } + } + } + } diff --git a/lib/ui/work_list/itg_fragments/approval_level_fragment.dart b/lib/ui/work_list/itg_fragments/approval_level_fragment.dart index 1d77f2a..eb478af 100644 --- a/lib/ui/work_list/itg_fragments/approval_level_fragment.dart +++ b/lib/ui/work_list/itg_fragments/approval_level_fragment.dart @@ -12,8 +12,9 @@ import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; class ApprovalLevelfragment extends StatelessWidget { List wFHistory; + VoidCallback voidCallback; - ApprovalLevelfragment({Key? key, this.wFHistory = const []}) : super(key: key); + ApprovalLevelfragment({Key? key, this.wFHistory = const [], required this.voidCallback}) : super(key: key); @override Widget build(BuildContext context) { @@ -98,6 +99,7 @@ class ApprovalLevelfragment extends StatelessWidget { LocaleKeys.request_info.tr().toText12(color: MyColors.grey67Color).center.paddingOnly(top: 6, bottom: 6).onPress(() { showMyBottomSheet( context, + callBackFunc: voidCallback, child: SelectedItgItemSheet( LocaleKeys.comments.tr(), wfHistory: history, @@ -109,6 +111,7 @@ class ApprovalLevelfragment extends StatelessWidget { LocaleKeys.delegate.tr().toText12(color: MyColors.gradiantEndColor).center.paddingOnly(top: 6, bottom: 6).onPress(() { showMyBottomSheet( context, + callBackFunc: voidCallback, child: SelectedItgItemSheet( LocaleKeys.comments.tr(), wfHistory: history, @@ -126,18 +129,21 @@ class ApprovalLevelfragment extends StatelessWidget { } Color getStatusColor(String code) { - if (code == "Submit") { + if (code.toLowerCase() == "submit") { return MyColors.grey3AColor; - } else if (code == "Pending") { + } else if (code.toLowerCase() == "pending") { return MyColors.yellowColor; - } else if (code == "Not Doable" || code == "Rejected") { + } else if (code.toLowerCase() == "not doable" || code.toLowerCase() == "rejected") { return MyColors.redColor; - } else if (code == "APPROVED") { + } else if (code.toLowerCase() == "approved" || + code.toLowerCase() == "auto-approve" || + code.toLowerCase() == "auto-approved" || + code.toLowerCase() == "doable") { return MyColors.greenColor; - } else if (code == "Requested Information") { + } else if (code.toLowerCase() == "requested information" || code.toLowerCase() == "assign" || code.toLowerCase() == "reassign") { return MyColors.orange; } else { - return MyColors.yellowColor; + return MyColors.whiteColor; } } } diff --git a/lib/ui/work_list/itg_fragments/request_detail_fragment.dart b/lib/ui/work_list/itg_fragments/request_detail_fragment.dart index 6092bef..72b20d4 100644 --- a/lib/ui/work_list/itg_fragments/request_detail_fragment.dart +++ b/lib/ui/work_list/itg_fragments/request_detail_fragment.dart @@ -51,6 +51,7 @@ class RequestDetailFragment extends StatelessWidget { ? true : false : false, + type: fields[index].type, ); } return ItemDetailViewGridItem( @@ -62,6 +63,7 @@ class RequestDetailFragment extends StatelessWidget { ? true : false : false, + type: fields[index].type, ); }, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( diff --git a/lib/ui/work_list/sheets/delegate_sheet.dart b/lib/ui/work_list/sheets/delegate_sheet.dart index 7417c30..bd3b010 100644 --- a/lib/ui/work_list/sheets/delegate_sheet.dart +++ b/lib/ui/work_list/sheets/delegate_sheet.dart @@ -28,8 +28,9 @@ class DelegateSheet extends StatefulWidget { String title, apiMode; List? actionHistoryList; List? wFHistory; + VoidCallback callBackFunc; - DelegateSheet({required this.title, required this.apiMode, this.notificationID, this.actionHistoryList, this.wFHistory}); + DelegateSheet({required this.title, required this.apiMode, this.notificationID, this.actionHistoryList, this.wFHistory, required this.callBackFunc}); @override State createState() => _DelegateSheetState(); @@ -54,6 +55,12 @@ class _DelegateSheetState extends State { var ids = widget.wFHistory!.map((e) => e.employeeID).toSet(); widget.wFHistory!.retainWhere((x) => ids.remove(x.employeeID)); } + + if (widget.actionHistoryList != null) { + widget.actionHistoryList = widget.actionHistoryList!.reversed.toList(); + var ids = widget.actionHistoryList!.map((e) => e.uSERNAME).toSet(); + widget.actionHistoryList!.retainWhere((x) => ids.remove(x.uSERNAME)); + } } @override @@ -188,6 +195,7 @@ class _DelegateSheetState extends State { ).onPress(() { showMyBottomSheet( context, + callBackFunc: (){}, child: SearchOptionsSheet( selectedType, onSelection: (String value) { @@ -385,7 +393,9 @@ class _DelegateSheetState extends State { Widget showItem(GetActionHistoryList actionHistory) { return InkWell( onTap: () { + Navigator.pop(context); showMyBottomSheet(context, + callBackFunc: widget.callBackFunc, child: SelectedItemSheet( "Comment", apiMode: widget.apiMode, @@ -430,7 +440,9 @@ class _DelegateSheetState extends State { Widget showItgItem(WFHistory wfHistory) { return InkWell( onTap: () { + Navigator.pop(context); showMyBottomSheet(context, + callBackFunc: widget.callBackFunc, child: SelectedItgItemSheet( "Comment", apiMode: widget.apiMode, @@ -454,7 +466,9 @@ class _DelegateSheetState extends State { Widget showFavUserItem(GetFavoriteReplacements actionHistory) { return InkWell( onTap: () { + Navigator.pop(context); showMyBottomSheet(context, + callBackFunc: widget.callBackFunc, child: SelectedItemSheet( "Comment", apiMode: widget.apiMode, @@ -499,7 +513,9 @@ class _DelegateSheetState extends State { Widget showInputUserItem(ReplacementList actionHistory) { return InkWell( onTap: () { + Navigator.pop(context); showMyBottomSheet(context, + callBackFunc: widget.callBackFunc, child: SelectedItemSheet( LocaleKeys.comments.tr(), apiMode: widget.apiMode, diff --git a/lib/ui/work_list/sheets/selected_item_sheet.dart b/lib/ui/work_list/sheets/selected_item_sheet.dart index f3f8f0d..e053218 100644 --- a/lib/ui/work_list/sheets/selected_item_sheet.dart +++ b/lib/ui/work_list/sheets/selected_item_sheet.dart @@ -71,7 +71,7 @@ class SelectedItemSheet extends StatelessWidget { child: DefaultButton( LocaleKeys.cancel.tr(), () { - Navigator.pop(context); + Navigator.pop(context, "cancel"); }, textColor: Colors.black, colors: [ @@ -120,8 +120,8 @@ class SelectedItemSheet extends StatelessWidget { try { await WorkListApiClient().submitComment(comment: comment, email: email, userId: userId, notificationId: notificationID, apiMode: apiMode); Utils.hideLoading(context); - Navigator.pop(context); - Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); Navigator.pop(context, "delegate_reload"); } catch (ex) { Utils.hideLoading(context); @@ -142,7 +142,7 @@ class SelectedItemSheet extends StatelessWidget { padding: EdgeInsets.only(top: 16, bottom: 16, left: 21, right: 21), child: Row( children: [ - actionHistoryList != null + (actionHistoryList != null && actionHistoryList!.eMPLOYEEIMAGE != null) ? CircularAvatar( height: 30, width: 30, diff --git a/lib/ui/work_list/sheets/selected_itg_item_sheet.dart b/lib/ui/work_list/sheets/selected_itg_item_sheet.dart index 7381d59..f44ca04 100644 --- a/lib/ui/work_list/sheets/selected_itg_item_sheet.dart +++ b/lib/ui/work_list/sheets/selected_itg_item_sheet.dart @@ -128,8 +128,8 @@ class SelectedItgItemSheet extends StatelessWidget { .informationITGRequest(requestDetails.requestType!, requestDetails.iD!, requestDetails.itemID!, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", wfHistory.employeeID!, comment); } Utils.hideLoading(context); - Navigator.pop(context); - Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); Navigator.pop(context, "delegate_reload"); } catch (ex) { Utils.hideLoading(context); diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index 7def350..9471568 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -131,16 +131,27 @@ class _WorkListScreenState extends State { } else if (workListElement.key == "COC") { workListElement.value = providerData.cocFinalCount; } else { - var tempList = providerData.getOpenNotificationsList?.where((notificationElement) { - return (notificationElement.itemType == workListItemTypes[workListItemIndex].key) && notificationElement.itemType == workListElement.key; - }).toList(); - if (tempList!.isNotEmpty) { - if ((AppState().workList?.length ?? 0) != (tempList.first.openNtfNumber ?? 0)) { - workListElement.value = AppState().workList?.length ?? 0; - providerData.workListCounter = providerData.workListCounter - ((tempList.first.openNtfNumber ?? 0) - (AppState().workList?.length ?? 0)); - providerData.notify(); + providerData.getOpenNotificationsList?.forEach((element) { + if ((element.itemType == workListItemTypes[workListItemIndex].key) && element.itemType == workListElement.key) { + if ((AppState().workList?.length ?? 0) != (element.openNtfNumber ?? 0)) { + workListElement.value = AppState().workList?.length ?? 0; + providerData.workListCounter = providerData.workListCounter - ((element.openNtfNumber ?? 0) - (AppState().workList?.length ?? 0)); + element.openNtfNumber = workListElement.value; + providerData.notify(); + } } - } + }); + + // var tempList = providerData.getOpenNotificationsList?.where((notificationElement) { + // return (notificationElement.itemType == workListItemTypes[workListItemIndex].key) && notificationElement.itemType == workListElement.key; + // }).toList(); + // if (tempList!.isNotEmpty) { + // if ((AppState().workList?.length ?? 0) != (tempList.first.openNtfNumber ?? 0)) { + // workListElement.value = AppState().workList?.length ?? 0; + // providerData.workListCounter = providerData.workListCounter - ((tempList.first.openNtfNumber ?? 0) - (AppState().workList?.length ?? 0)); + // providerData.notify(); + // } + // } } }); } @@ -418,10 +429,11 @@ class _WorkListScreenState extends State { void openBottomSheet(BuildContext context) { showMyBottomSheet( context, + callBackFunc: (){}, child: WorkListAdvanceSearch((selectedViewID, selectedItemTypeID, searchByInput, searchByDate) async { itgRequestTypeIndex = null; pNotificationType = selectedViewID; - int index = -1; + int index = 0; for (int i = 0; i < workListItemTypes.length; i++) { if (workListItemTypes[i].key == selectedItemTypeID) { index = i; diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 6e4dcb2..de7c152 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:lottie/lottie.dart'; import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; @@ -82,6 +83,9 @@ class _WorkListDetailScreenState extends State { bool isApproveAvailable = false; bool isRejectAvailable = false; + bool isAttachmentLoaded = false; + bool isActionHistoryLoaded = false; + @override void initState() { super.initState(); @@ -136,6 +140,8 @@ class _WorkListDetailScreenState extends State { getPRNotification(); } + controller.jumpToPage(0); + // List dataToFetch = await Future.wait([ // // WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!), @@ -239,8 +245,20 @@ class _WorkListDetailScreenState extends State { itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [], prLinesList: getPrNotificationBody?.pRLines ?? [], ), - actionHistoryList.isEmpty ? Utils.getNoDataWidget(context) : ActionsFragment(workListData!.nOTIFICATIONID, actionHistoryList), - getAttachmentList.isEmpty ? Utils.getNoDataWidget(context) : AttachmentsFragment(getAttachmentList), + isActionHistoryLoaded + ? actionHistoryList.isEmpty + ? Utils.getNoDataWidget(context) + : ActionsFragment( + workListData!.nOTIFICATIONID, + actionHistoryList, + voidCallback: reloadWorkList, + ) + : showLoadingAnimation(), + isAttachmentLoaded + ? getAttachmentList.isEmpty + ? Utils.getNoDataWidget(context) + : AttachmentsFragment(getAttachmentList) + : showLoadingAnimation(), ], ).expanded, if (isApproveAvailable || isRejectAvailable || isCloseAvailable) @@ -312,6 +330,7 @@ class _WorkListDetailScreenState extends State { AppState().setWorkListIndex = AppState().workListIndex! + 1; workListData = null; showFabOptions = false; + tabIndex = 0; getDataFromState(); } else if (AppState().workList!.length - 1 == AppState().workListIndex!) { Navigator.pop(context); @@ -354,25 +373,38 @@ class _WorkListDetailScreenState extends State { if (notificationButtonsList[i].bUTTONACTION! == "REJECTED" || notificationButtonsList[i].bUTTONACTION! == "APPROVED" || notificationButtonsList[i].bUTTONACTION! == "CLOSE") { continue; } - fabs.add(myFab(notificationButtonsList[i].bUTTONLABEL!, notificationButtonsList[i].bUTTONACTION == "DELEGATE" ? "assets/images/delegate.svg" : notificationButtonsList[i].bUTTONICON ?? "", - isIconAsset: notificationButtonsList[i].bUTTONACTION == "DELEGATE" ? true : false,) - .paddingOnly(bottom: 12) - .onPress(() => handleFabAction(notificationButtonsList[i]))); + fabs.add(myFab( + notificationButtonsList[i].bUTTONLABEL!, + notificationButtonsList[i].bUTTONACTION == "DELEGATE" ? "assets/images/delegate.svg" : notificationButtonsList[i].bUTTONICON ?? "", + isIconAsset: notificationButtonsList[i].bUTTONACTION == "DELEGATE" ? true : false, + ).paddingOnly(bottom: 12).onPress(() => handleFabAction(notificationButtonsList[i]))); } return fabs; } void handleFabAction(GetNotificationButtonsList notificationButton) { + print("notificationButton:${notificationButton.bUTTONACTION}"); switch (notificationButton.bUTTONACTION) { case "DELEGATE": showMyBottomSheet(context, - child: DelegateSheet(title: LocaleKeys.delegate.tr(), apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); - + callBackFunc: reloadWorkList, + child: DelegateSheet(title: LocaleKeys.delegate.tr(), apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList, callBackFunc: reloadWorkList,)); break; case "REQUEST_INFO": // do something else showMyBottomSheet(context, - child: DelegateSheet(title: LocaleKeys.request_info.tr(), apiMode: "REQUEST_INFO", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); + callBackFunc: reloadWorkList, + child: DelegateSheet(title: LocaleKeys.request_info.tr(), apiMode: "REQUEST_INFO", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList, callBackFunc: reloadWorkList,)); + break; + case "TRANSFER_INFO": + // do something else + showMyBottomSheet(context, + callBackFunc: reloadWorkList, + child: + DelegateSheet(title: notificationButton.bUTTONLABEL!, apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList, callBackFunc: reloadWorkList,)); + break; + case "ANSWER_INFO": + performAction(notificationButton.bUTTONACTION!, title: notificationButton.bUTTONLABEL); break; case "RFC": // do something else @@ -384,10 +416,13 @@ class _WorkListDetailScreenState extends State { // do something else case "APPROVE_AND_FORWARD": showMyBottomSheet(context, - child: DelegateSheet(title: "Approve and Forward", apiMode: "APPROVE_AND_FORWARD", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); + callBackFunc: reloadWorkList, + child: DelegateSheet(title: "Approve and Forward", apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList, callBackFunc: reloadWorkList,)); break; case "FORWARD": - showMyBottomSheet(context, child: DelegateSheet(title: "Forward", apiMode: "FORWARD", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); + showMyBottomSheet(context, + callBackFunc: reloadWorkList, + child: DelegateSheet(title: "Forward", apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList, callBackFunc: reloadWorkList,)); break; case "REJECT": performNetworkCall(context, email: "", userId: ""); @@ -396,6 +431,9 @@ class _WorkListDetailScreenState extends State { Navigator.pop(context); break; } + setState(() { + showFabOptions = false; + }); } Future performNetworkCall(BuildContext context, {String? email, String? userId}) async { @@ -480,13 +518,14 @@ class _WorkListDetailScreenState extends State { ); } - void performAction(String actionMode) { - TextEditingController textEditingController = TextEditingController(); + void performAction(String actionMode, {String? title}) { showDialog( context: context, builder: (cxt) => AcceptRejectInputDialog( - message: LocaleKeys.requestedItems.tr(), + message: title != null ? null : LocaleKeys.requestedItems.tr(), + title: title, notificationGetRespond: notificationNoteInput, + actionMode: actionMode, onTap: (note) { Map payload = { "P_ACTION_MODE": actionMode, @@ -537,6 +576,20 @@ class _WorkListDetailScreenState extends State { } } + void reloadWorkList() { + AppState().workList!.removeAt(AppState().workListIndex!); + if (AppState().workList!.isEmpty) { + Navigator.pop(context, "delegate_reload"); + } else { + if (AppState().workList!.length <= AppState().workListIndex!) { + Navigator.pop(context, "delegate_reload"); + } else { + workListData = null; + getDataFromState(); + } + } + } + void getEitNotificationBody() async { try { if (apiCallCount == 0) Utils.showLoading(context); @@ -772,13 +825,17 @@ class _WorkListDetailScreenState extends State { void getActionHistory() async { try { + isActionHistoryLoaded = false; + actionHistoryList.clear(); // if (apiCallCount == 0) Utils.showLoading(context); // apiCallCount++; actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!); // apiCallCount--; // if (apiCallCount == 0) { // Utils.hideLoading(context); - setState(() {}); + setState(() { + isActionHistoryLoaded = true; + }); // } } catch (ex) { // apiCallCount--; @@ -789,13 +846,17 @@ class _WorkListDetailScreenState extends State { void getAttachments() async { try { + isAttachmentLoaded = false; + getAttachmentList.clear(); // if (apiCallCount == 0) Utils.showLoading(context); // apiCallCount++; getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!); // apiCallCount--; // if (apiCallCount == 0) { // Utils.hideLoading(context); - setState(() {}); + setState(() { + isAttachmentLoaded = true; + }); // } } catch (ex) { // apiCallCount--; @@ -803,4 +864,12 @@ class _WorkListDetailScreenState extends State { Utils.handleException(ex, context, null); } } + + Widget showLoadingAnimation() { + return Lottie.asset( + 'assets/lottie/loading.json', + repeat: true, + reverse: false, + ); + } } diff --git a/lib/ui/work_list/worklist_fragments/actions_fragment.dart b/lib/ui/work_list/worklist_fragments/actions_fragment.dart index c00f521..8a69599 100644 --- a/lib/ui/work_list/worklist_fragments/actions_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/actions_fragment.dart @@ -7,7 +7,6 @@ import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; -import 'package:mohem_flutter_app/ui/work_list/sheets/delegate_sheet.dart'; import 'package:mohem_flutter_app/ui/work_list/sheets/selected_item_sheet.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; @@ -15,8 +14,9 @@ import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; class ActionsFragment extends StatelessWidget { int? notificationID; List actionHistoryList; + VoidCallback voidCallback; - ActionsFragment(this.notificationID, this.actionHistoryList, {Key? key}) : super(key: key); + ActionsFragment(this.notificationID, this.actionHistoryList, {Key? key, required this.voidCallback}) : super(key: key); @override Widget build(BuildContext context) { @@ -99,13 +99,17 @@ class ActionsFragment extends StatelessWidget { Row( children: [ LocaleKeys.request_info.tr().toText12(color: MyColors.grey67Color).center.paddingOnly(top: 6, bottom: 6).onPress(() { - showMyBottomSheet(context, - child: DelegateSheet(title: LocaleKeys.request_info.tr(), apiMode: "REQUEST_INFO", notificationID: notificationID, actionHistoryList: actionHistoryList)); + showMyBottomSheet( + context, + callBackFunc: voidCallback, + child: SelectedItemSheet(LocaleKeys.request_info.tr(), apiMode: "REQUEST_INFO", notificationID: notificationID, actionHistoryList: actionHistory), + ); }).expanded, Container(width: 1, height: 30, color: MyColors.lightGreyEFColor), LocaleKeys.delegate.tr().toText12(color: MyColors.gradiantEndColor).center.paddingOnly(top: 6, bottom: 6).onPress(() { showMyBottomSheet( context, + callBackFunc: voidCallback, child: SelectedItemSheet( LocaleKeys.comments.tr(), apiMode: "DELEGATE", @@ -124,6 +128,7 @@ class ActionsFragment extends StatelessWidget { } Color getStatusColor(String code) { + print("code:$code"); if (code == "SUBMIT") { return const Color(0xff2E303A); } else if (code == "REJECTED") { @@ -132,12 +137,12 @@ class ActionsFragment extends StatelessWidget { return MyColors.redColor; } else if (code == "PENDING") { return MyColors.orange; - } else if (code == "APPROVED" || code == "APPROVE") { + } else if (code == "APPROVED" || code == "APPROVE" || code == "ANSWER_INFO") { return const Color(0xff1FA269); + } else if (code == "REQUEST_INFO"|| code == "FORWARD") { + return const Color(0xff2E303A); } else if (code != "SUBMIT" && code != "REJECT" && code != "PENDING") { return MyColors.orange; - } else if (code == "REQUEST_INFO") { - return const Color(0xff2E303A); } else { return const Color(0xff2E303A); } diff --git a/lib/widgets/bottom_sheet.dart b/lib/widgets/bottom_sheet.dart index 206d017..a15fc3b 100644 --- a/lib/widgets/bottom_sheet.dart +++ b/lib/widgets/bottom_sheet.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; -void showMyBottomSheet(BuildContext context, {required Widget child}) { - showModalBottomSheet( +void showMyBottomSheet(BuildContext context, {required Widget child, required VoidCallback callBackFunc}) { + showModalBottomSheet( context: context, isScrollControlled: true, backgroundColor: Colors.transparent, @@ -37,7 +37,13 @@ void showMyBottomSheet(BuildContext context, {required Widget child}) { ), ); }, - ); + ).then((value) { + // print("BACK FROM DELEGATE!!!!"); + // print("value: $value"); + if (value == "delegate_reload") { + callBackFunc(); + } + }); } class BottomSheetItem extends StatelessWidget { diff --git a/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart b/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart index face11b..16942c5 100644 --- a/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart +++ b/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart @@ -217,8 +217,8 @@ class _SearchEmployeeBottomSheetState extends State { ], ), title: (chatUsersList![index].userName ?? "").toText14(color: MyColors.darkTextColor), - subtitle: (chatUsersList![index].isTyping == true ? "Something is Typing" : "Last message text").toText11(color: MyColors.normalTextColor), - trailing: ("Today").toText10(color: MyColors.lightTextColor), + // subtitle: (chatUsersList![index].isTyping == true ? "Something is Typing" : "Last message text").toText11(color: MyColors.normalTextColor), + // trailing: ("Today").toText10(color: MyColors.lightTextColor), minVerticalPadding: 0, onTap: () { Navigator.pop(context); @@ -230,7 +230,7 @@ class _SearchEmployeeBottomSheetState extends State { }, ); }, - separatorBuilder: (cxt, index) => Container( + separatorBuilder: (BuildContext cxt, int index) => Container( height: 1, color: MyColors.borderE3Color, ), diff --git a/lib/widgets/circular_avatar.dart b/lib/widgets/circular_avatar.dart index ad94052..a18cf03 100644 --- a/lib/widgets/circular_avatar.dart +++ b/lib/widgets/circular_avatar.dart @@ -25,7 +25,7 @@ class CircularAvatar extends StatelessWidget { image: NetworkImage(url ?? "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png"), ), ), - child: isImageBase64 ? imageFromBase64String(url!) : null, + child: (isImageBase64 && url != null) ? imageFromBase64String(url!) : Container(), ); } diff --git a/lib/widgets/dialogs/accept_reject_input_dialog.dart b/lib/widgets/dialogs/accept_reject_input_dialog.dart index ef2cfaa..db9c5d6 100644 --- a/lib/widgets/dialogs/accept_reject_input_dialog.dart +++ b/lib/widgets/dialogs/accept_reject_input_dialog.dart @@ -2,6 +2,7 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; @@ -13,11 +14,13 @@ class AcceptRejectInputDialog extends StatelessWidget { final String? title; final String? message; final String? okTitle; + final String? actionMode; final NotificationGetRespondAttributesList? notificationGetRespond; final Function(String) onTap; + // final TextEditingController textEditingController; - AcceptRejectInputDialog({Key? key, this.title, @required this.message, this.okTitle, required this.onTap, this.notificationGetRespond}) : super(key: key); + AcceptRejectInputDialog({Key? key, this.title, @required this.message, this.okTitle, required this.onTap, this.notificationGetRespond, this.actionMode}) : super(key: key); String note = ""; @@ -85,15 +88,24 @@ class AcceptRejectInputDialog extends StatelessWidget { ).expanded, 10.width, DefaultButton( - LocaleKeys.ok.tr(), + actionMode == "REJECTED" ? LocaleKeys.reject.tr() : LocaleKeys.ok.tr(), () { - Navigator.pop(context); - onTap(note); + if(note.isNotEmpty) { + Navigator.pop(context); + onTap(note); + } else { + Utils.showToast(LocaleKeys.pleaseEnterComments.tr()); + } }, - colors: const [ - Color(0xff28C884), - Color(0xff1BB271), - ], + colors: actionMode == "REJECTED" + ? const [ + Color(0xffE47A7E), + Color(0xffE47A7E), + ] + : const [ + Color(0xff28C884), + Color(0xff1BB271), + ], ).expanded, ], ), 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/dialogs/itg_comments_dialog.dart b/lib/widgets/dialogs/itg_comments_dialog.dart index b984851..34199ba 100644 --- a/lib/widgets/dialogs/itg_comments_dialog.dart +++ b/lib/widgets/dialogs/itg_comments_dialog.dart @@ -2,6 +2,7 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; @@ -12,9 +13,10 @@ class ITGCommentsDialog extends StatelessWidget { final String? title; final String? message; final String? okTitle; + final String? actionMode; final Function(String) onTap; - ITGCommentsDialog({Key? key, this.title, @required this.message, this.okTitle, required this.onTap}) : super(key: key); + ITGCommentsDialog({Key? key, this.title, @required this.message, this.okTitle, required this.onTap, this.actionMode}) : super(key: key); String note = ""; @@ -82,15 +84,24 @@ class ITGCommentsDialog extends StatelessWidget { ).expanded, 10.width, DefaultButton( - LocaleKeys.ok.tr(), + actionMode == "REJECTED" ? LocaleKeys.reject.tr() : LocaleKeys.approve.tr(), () { - Navigator.pop(context); - onTap(note); + if (actionMode == "REJECTED" && note.isEmpty) { + Utils.showToast(LocaleKeys.pleaseEnterComments.tr()); + } else { + Navigator.pop(context); + onTap(note); + } }, - colors: const [ - Color(0xff28C884), - Color(0xff1BB271), - ], + colors: actionMode == "REJECTED" + ? const [ + Color(0xffE47A7E), + Color(0xffE47A7E), + ] + : const [ + Color(0xff28C884), + Color(0xff1BB271), + ], ).expanded, ], ), diff --git a/lib/widgets/image_picker.dart b/lib/widgets/image_picker.dart index 4a99577..5e5ac01 100644 --- a/lib/widgets/image_picker.dart +++ b/lib/widgets/image_picker.dart @@ -13,6 +13,7 @@ class ImageOptions { static void showImageOptionsNew(BuildContext context, bool showFilesOption, Function(String, File) image) { showMyBottomSheet( context, + callBackFunc: (){}, child: AttachmentOptions( showFilesOption: showFilesOption, onCameraTap: () async { diff --git a/lib/widgets/item_detail_view_widget.dart b/lib/widgets/item_detail_view_widget.dart index 34b2eb3..5148389 100644 --- a/lib/widgets/item_detail_view_widget.dart +++ b/lib/widgets/item_detail_view_widget.dart @@ -1,8 +1,11 @@ +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/models/itg_forms_models/itg_worklist_table_model.dart'; class ItemDetailView extends StatelessWidget { final String title; @@ -46,9 +49,10 @@ class ItemDetailViewGridItem extends StatelessWidget { int index; final String? title; final String? value; + final String? type; final bool isNeedToShowEmptyDivider; - ItemDetailViewGridItem(this.index, this.title, this.value, {Key? key, this.isNeedToShowEmptyDivider = false}) : super(key: key); + ItemDetailViewGridItem(this.index, this.title, this.value, {Key? key, this.isNeedToShowEmptyDivider = false, this.type = ""}) : super(key: key); @override Widget build(BuildContext context) { @@ -76,9 +80,13 @@ class ItemDetailViewGridItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - Flexible(child: "$title:".toText12Auto(isBold: true, color: const Color(0xff2BB8A6))), + title != null ? Flexible(child: "$title:".toText12Auto(isBold: true, color: const Color(0xff2BB8A6))) : Container(), 4.width, - Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor)), + type != null + ? type!.toLowerCase() == "table" + ? getStringFromJSON(value!) + : Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor)) + : Container(), ], ), ); @@ -129,3 +137,14 @@ class ItemDetailGrid extends StatelessWidget { ); } } + +Widget getStringFromJSON(String jsonString) { + var body = json.decode(jsonString); + ITGWorkListTableModel itgWorkListTableModel = ITGWorkListTableModel(); + if (body.length != 0) { + itgWorkListTableModel = ITGWorkListTableModel.fromJson(body[0][0]); + return Flexible(child: (itgWorkListTableModel.textvalue).toString().toText12Auto(color: MyColors.normalTextColor)); + } else { + return Flexible(child: ("-").toString().toText12Auto(color: MyColors.normalTextColor)); + } +} diff --git a/lib/widgets/mark_attendance_widget.dart b/lib/widgets/mark_attendance_widget.dart index 90c57e3..c41b89c 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() { @@ -72,21 +75,23 @@ class _MarkAttendanceWidgetState extends State { @override Widget build(BuildContext context) { + print(MediaQuery.of(context).size.width); return Container( padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding), decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), width: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ LocaleKeys.markAttendance.tr().toSectionHeading(), LocaleKeys.selectMethodOfAttendance.tr().tr().toText11(color: const Color(0xff535353)), GridView( physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, - padding: const EdgeInsets.only(bottom: 14, top: 21), + padding: const EdgeInsets.only(bottom: 0, top: 21), gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: (MediaQuery.of(context).size.width < 400) ? 3 : 5, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), + SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: (MediaQuery.of(context).size.width < 550) ? 3 : 5, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), children: [ // if (isNfcEnabled) attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { @@ -134,21 +139,50 @@ class _MarkAttendanceWidgetState extends State { print("nfc not location enabled"); } - showNfcReader(context, onNcfScan: (String? nfcId) async { - print(nfcId); - Utils.showLoading(context); - try { - GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "", isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng); - bool status = await model.fetchAttendanceTracking(context); - Utils.hideLoading(context); - } catch (ex) { - print(ex); - Utils.hideLoading(context); - Utils.handleException(ex, context, (msg) { - Utils.confirmDialog(context, msg); - }); - } - }); + if (Platform.isIOS) { + Utils.readNFc(onRead: (String nfcId) async { + Utils.showLoading(context); + try { + 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); + Utils.handleException(ex, context, (msg) { + Utils.confirmDialog(context, msg); + }); + } + }); + } else { + showNfcReader(context, onNcfScan: (String? nfcId) async { + print(nfcId); + Utils.showLoading(context); + try { + 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); + Utils.handleException(ex, context, (msg) { + Utils.confirmDialog(context, msg); + }); + } + }); + } } Future performWifiAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { @@ -175,6 +209,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(); @@ -184,6 +224,7 @@ class _MarkAttendanceWidgetState extends State { }); } } else { + Utils.hideLoading(context); Utils.confirmDialog(context, LocaleKeys.comeNearHMGWifi.tr()); } } @@ -208,6 +249,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); @@ -243,8 +290,10 @@ class _MarkAttendanceWidgetState extends State { title.toText17(isBold: true, color: Colors.white), ], ), - ).onPress(() { - if (!isEnabled) return; - onPress(); - }); + ).onPress( + () { + if (!isEnabled) return; + onPress(); + }, + ); } diff --git a/pubspec.yaml b/pubspec.yaml index e621c50..16c5737 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ description: A new Flutter application. publish_to: 'none' # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 +# A version number is three numbers separated by dots, like 1.2.43v # followed by an optional build number separated by a +. # Both the version and the builder number may be overridden in flutter # build by specifying --build-name and --build-number, respectively. @@ -53,7 +53,7 @@ dependencies: shimmer: ^2.0.0 logger: ^1.1.0 flutter_countdown_timer: ^4.1.0 - nfc_manager: ^3.1.1 + nfc_manager: ^3.2.0 uuid: ^3.0.6 image_picker: ^0.8.5+3 file_picker: ^4.6.1 @@ -78,7 +78,7 @@ dependencies: auto_size_text: ^3.0.0 pull_to_refresh: ^2.0.0 # lottie json animations - lottie: ^1.4.3 + lottie: any # Steps Progress steps_indicator: ^1.3.0 # Marathon Card Swipe @@ -91,6 +91,9 @@ dependencies: + video_player: ^2.4.7 + just_audio: ^0.9.30 + dev_dependencies: flutter_test: sdk: flutter @@ -122,6 +125,7 @@ flutter: - assets/langs/ - assets/icons/ - assets/lottie/ + - assets/audio/ - assets/images/ - assets/images/login/ - assets/icons/chat/