hr module new one updated
2
.env.development
Normal file → Executable file
@ -1,3 +1,3 @@
|
|||||||
API_URL=https://venbait.in/nhance/dev/employeeRest/
|
API_URL=https://venbait.in/enrollment/employeeRest/
|
||||||
BASE_HREF=/nhance/app/dev/
|
BASE_HREF=/nhance/app/dev/
|
||||||
ENV=development
|
ENV=development
|
||||||
2
.env.production
Normal file → Executable file
@ -1,3 +1,3 @@
|
|||||||
API_URL=https://app.nhanceindia.in/zenith/employeeRest/
|
API_URL=https://app.nhanceindia.in/zenith/employeeRest/
|
||||||
BASE_HREF=/app/
|
BASE_HREF=/hr/
|
||||||
ENV=production
|
ENV=production
|
||||||
6
.env.test
Normal file → Executable file
@ -1,3 +1,3 @@
|
|||||||
API_URL=https://venbait.in/nhance/test/employeeRest/
|
API_URL=https://app.nhanceindia.in/zenith/employeeRest/
|
||||||
BASE_HREF=/nhance/app/test/
|
BASE_HREF=/hr/
|
||||||
ENV=test
|
ENV=production
|
||||||
6
.env.uat
Normal file → Executable file
@ -1,3 +1,3 @@
|
|||||||
API_URL=https://dev.venbait.in/nhance/uat/employeeRest/
|
API_URL=https://app.nhanceindia.in/zenith/employeeRest/
|
||||||
BASE_HREF=/nhance/app/uat/
|
BASE_HREF=/hr/
|
||||||
ENV=uat
|
ENV=production
|
||||||
|
|||||||
0
.gitignore
vendored
Normal file → Executable file
0
analysis_options.yaml
Normal file → Executable file
0
android/.gitignore
vendored
Normal file → Executable file
0
android/app/build.gradle
Normal file → Executable file
0
android/app/google-services.json
Normal file → Executable file
0
android/app/src/debug/AndroidManifest.xml
Normal file → Executable file
0
android/app/src/main/AndroidManifest.xml
Normal file → Executable file
0
android/app/src/main/kotlin/com/example/nhancepolicy/MainActivity.kt
Normal file → Executable file
0
android/app/src/main/res/drawable-v21/launch_background.xml
Normal file → Executable file
0
android/app/src/main/res/drawable/launch_background.xml
Normal file → Executable file
0
android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
0
android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file → Executable file
|
Before Width: | Height: | Size: 996 B After Width: | Height: | Size: 996 B |
0
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
0
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
0
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file → Executable file
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
0
android/app/src/main/res/values-night/styles.xml
Normal file → Executable file
0
android/app/src/main/res/values/styles.xml
Normal file → Executable file
0
android/app/src/profile/AndroidManifest.xml
Normal file → Executable file
0
android/build.gradle
Normal file → Executable file
0
android/gradle.properties
Normal file → Executable file
0
android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file → Executable file
0
android/settings.gradle
Normal file → Executable file
0
assets/Group_3.png
Normal file → Executable file
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
0
assets/Nhance-Logo-Final 1.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
0
assets/Solid_gray.png
Normal file → Executable file
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 99 B |
0
assets/Template_File.xlsx
Normal file → Executable file
0
assets/Vector.png
Normal file → Executable file
|
Before Width: | Height: | Size: 840 B After Width: | Height: | Size: 840 B |
0
assets/hrLogin.jpg
Normal file → Executable file
|
Before Width: | Height: | Size: 476 KiB After Width: | Height: | Size: 476 KiB |
0
assets/login_web.jpg
Normal file → Executable file
|
Before Width: | Height: | Size: 833 KiB After Width: | Height: | Size: 833 KiB |
0
assets/mobileViewLogo.png
Normal file → Executable file
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
0
assets/navbarLogo.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
0
assets/nhance-loader.gif
Normal file → Executable file
|
Before Width: | Height: | Size: 493 KiB After Width: | Height: | Size: 493 KiB |
0
assets/nhance_client_logo.png
Normal file → Executable file
|
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 145 KiB |
0
assets/policy.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
0
ios/.gitignore
vendored
Normal file → Executable file
0
ios/Flutter/AppFrameworkInfo.plist
Normal file → Executable file
1
ios/Flutter/Debug.xcconfig
Normal file → Executable file
@ -1 +1,2 @@
|
|||||||
|
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
|||||||
1
ios/Flutter/Release.xcconfig
Normal file → Executable file
@ -1 +1,2 @@
|
|||||||
|
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
|||||||
43
ios/Podfile
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Uncomment this line to define a global platform for your project
|
||||||
|
# platform :ios, '12.0'
|
||||||
|
|
||||||
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
|
|
||||||
|
project 'Runner', {
|
||||||
|
'Debug' => :debug,
|
||||||
|
'Profile' => :release,
|
||||||
|
'Release' => :release,
|
||||||
|
}
|
||||||
|
|
||||||
|
def flutter_root
|
||||||
|
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||||
|
unless File.exist?(generated_xcode_build_settings_path)
|
||||||
|
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||||
|
end
|
||||||
|
|
||||||
|
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||||
|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||||
|
return matches[1].strip if matches
|
||||||
|
end
|
||||||
|
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||||
|
end
|
||||||
|
|
||||||
|
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||||
|
|
||||||
|
flutter_ios_podfile_setup
|
||||||
|
|
||||||
|
target 'Runner' do
|
||||||
|
use_frameworks!
|
||||||
|
|
||||||
|
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||||
|
target 'RunnerTests' do
|
||||||
|
inherit! :search_paths
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
post_install do |installer|
|
||||||
|
installer.pods_project.targets.each do |target|
|
||||||
|
flutter_additional_ios_build_settings(target)
|
||||||
|
end
|
||||||
|
end
|
||||||
0
ios/Runner/AppDelegate.swift
Normal file → Executable file
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file → Executable file
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 494 B |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 772 B |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 663 B After Width: | Height: | Size: 663 B |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 772 B |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
0
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
0
ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
vendored
Normal file → Executable file
0
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
0
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
0
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
vendored
Normal file → Executable file
|
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
0
ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
vendored
Normal file → Executable file
0
ios/Runner/Base.lproj/LaunchScreen.storyboard
Normal file → Executable file
0
ios/Runner/Base.lproj/Main.storyboard
Normal file → Executable file
0
ios/Runner/Info.plist
Normal file → Executable file
0
ios/Runner/Runner-Bridging-Header.h
Normal file → Executable file
0
ios/RunnerTests/RunnerTests.swift
Normal file → Executable file
39
lib/addons.dart
Normal file → Executable file
@ -28,6 +28,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
late ApiService apiService;
|
late ApiService apiService;
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
bool isChecked = false;
|
bool isChecked = false;
|
||||||
|
bool login_by_hr = false;
|
||||||
bool _addOnsDependentSwitcher =
|
bool _addOnsDependentSwitcher =
|
||||||
false; // Declare the _isSwitched variable here
|
false; // Declare the _isSwitched variable here
|
||||||
bool _topUpSiSwitcher = false;
|
bool _topUpSiSwitcher = false;
|
||||||
@ -246,8 +247,19 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
empClientBranchId == null) {
|
empClientBranchId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
if (prefs.containsKey('hrtoken')) {
|
||||||
|
setState(() {
|
||||||
|
login_by_hr = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
final response = await apiService.getGpaEmpPolicyDetailsToApi(
|
final response = await apiService.getGpaEmpPolicyDetailsToApi(
|
||||||
empPrimaryId, empCodeString!, client_id!, 'GPA', empClientBranchId!);
|
empPrimaryId,
|
||||||
|
empCodeString!,
|
||||||
|
client_id!,
|
||||||
|
'GPA',
|
||||||
|
empClientBranchId!,
|
||||||
|
login_by_hr);
|
||||||
|
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -275,8 +287,19 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
empClientBranchId == null) {
|
empClientBranchId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
if (prefs.containsKey('hrtoken')) {
|
||||||
|
setState(() {
|
||||||
|
login_by_hr = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
final response = await apiService.getGmcEmpPolicyDetailsToApi(
|
final response = await apiService.getGmcEmpPolicyDetailsToApi(
|
||||||
empPrimaryId, empCodeString!, client_id!, 'GMC', empClientBranchId!);
|
empPrimaryId,
|
||||||
|
empCodeString!,
|
||||||
|
client_id!,
|
||||||
|
'GMC',
|
||||||
|
empClientBranchId!,
|
||||||
|
login_by_hr);
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
// setState(() {
|
// setState(() {
|
||||||
gmcPolicies = response['data'];
|
gmcPolicies = response['data'];
|
||||||
@ -4542,7 +4565,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
|
|
||||||
String? gpaPolicyName = item['Policy_Name'];
|
String? gpaPolicyName = item['Policy_Name'];
|
||||||
String? gpaECardDownload = item['eCardDownload'];
|
String? gpaECardDownload = item['eCardDownload'];
|
||||||
String? gpaSumInsured;
|
String? gpaSumInsured = item['si_value'];
|
||||||
List<dynamic> gpaMappedFamilyFloaters = [];
|
List<dynamic> gpaMappedFamilyFloaters = [];
|
||||||
|
|
||||||
if (item['mapped_family_floaters'] != null) {
|
if (item['mapped_family_floaters'] != null) {
|
||||||
@ -4553,11 +4576,11 @@ class _addOnsDetailsState extends State<addOnsDetails> {
|
|||||||
.where((element) => element['is_value_exist'] == true)
|
.where((element) => element['is_value_exist'] == true)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (getTrueObjects.length > 0) {
|
// if (getTrueObjects.length > 0) {
|
||||||
gpaSumInsured = getTrueObjects[0]["data"]["basic_cover_si"];
|
// gpaSumInsured = getTrueObjects[0]["data"]["basic_cover_si"];
|
||||||
} else {
|
// } else {
|
||||||
gpaSumInsured = item['Policy_Terms']['sumInsured2'];
|
// gpaSumInsured = item['Policy_Terms']['sumInsured2'];
|
||||||
}
|
// }
|
||||||
|
|
||||||
int gpaOpenForEnrollment = int.parse(item['OpenForEnrollment']);
|
int gpaOpenForEnrollment = int.parse(item['OpenForEnrollment']);
|
||||||
List<Widget> familyFloaterContainers = [];
|
List<Widget> familyFloaterContainers = [];
|
||||||
|
|||||||
4
lib/customAppBar/customAppBar.dart
Normal file → Executable file
@ -21,7 +21,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_checkTokens();
|
// _checkTokens();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _checkTokens() async {
|
Future<void> _checkTokens() async {
|
||||||
@ -31,7 +31,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
// showBackToHR = prefs.getBool('showBackToHR')!;
|
// showBackToHR = prefs.getBool('showBackToHR')!;
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
showBackToHR = prefs.getBool('showBackToHR')!;
|
// showBackToHR = prefs.getBool('showBackToHR');
|
||||||
// showBackToHR = (hrtoken != null && hrtoken.isNotEmpty) &&
|
// showBackToHR = (hrtoken != null && hrtoken.isNotEmpty) &&
|
||||||
// (token != null && token.isNotEmpty);
|
// (token != null && token.isNotEmpty);
|
||||||
// print((hrtoken != null && hrtoken.isNotEmpty));
|
// print((hrtoken != null && hrtoken.isNotEmpty));
|
||||||
|
|||||||
88
lib/customAppBar/customAppBarChatbot.dart
Executable file
@ -0,0 +1,88 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:adaptive_navbar/adaptive_navbar.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
import '../responsive.dart';
|
||||||
|
|
||||||
|
class CustomAppBarChatbot extends StatelessWidget
|
||||||
|
implements PreferredSizeWidget {
|
||||||
|
@override
|
||||||
|
Size get preferredSize => Size.fromHeight(kToolbarHeight);
|
||||||
|
|
||||||
|
Future<void> logout(BuildContext context) async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
final String? token = prefs.getString('token');
|
||||||
|
|
||||||
|
if (token != null && token.isNotEmpty) {
|
||||||
|
await prefs.clear();
|
||||||
|
Navigator.pushNamed(context, 'phone');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final sw = MediaQuery.of(context).size.width;
|
||||||
|
final isPoliciesPage = Uri.base.fragment == 'policies';
|
||||||
|
return ClipRRect(
|
||||||
|
borderRadius: Responsive.isDesktop(context) || isPoliciesPage
|
||||||
|
? BorderRadius.zero
|
||||||
|
: BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(32.0),
|
||||||
|
bottomRight: Radius.circular(32.0),
|
||||||
|
),
|
||||||
|
child: AppBar(
|
||||||
|
backgroundColor: const Color(0xFFFFFBDE),
|
||||||
|
elevation: 0, // Set background color for AppBar
|
||||||
|
toolbarHeight: kToolbarHeight,
|
||||||
|
titleSpacing: 0.0,
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
title: Padding(
|
||||||
|
padding: Responsive.isDesktop(context)
|
||||||
|
? EdgeInsets.symmetric(horizontal: 16.0)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
// Logo Column
|
||||||
|
Expanded(
|
||||||
|
flex: Responsive.isDesktop(context) ? 3 : 9,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: Responsive.isDesktop(context)
|
||||||
|
? MainAxisAlignment.spaceEvenly
|
||||||
|
: MainAxisAlignment
|
||||||
|
.start, // Adjust the alignment as needed
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
top: 10, bottom: 10, left: 10, right: 10),
|
||||||
|
width: Responsive.isDesktop(context) ? 230 : 170,
|
||||||
|
height: Responsive.isDesktop(context) ? 230 : 170,
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/nhance_client_logo.png',
|
||||||
|
fit: BoxFit.contain, // Adjust the fit as needed
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// AdaptiveNavBar Column
|
||||||
|
|
||||||
|
Expanded(
|
||||||
|
flex: Responsive.isDesktop(context) ? 9 : 3,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
Icons.close_outlined, // Replace with your desired icon
|
||||||
|
size: 24.0, // Adjust the icon size
|
||||||
|
color: Colors.black, // Adjust the icon color
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
0
lib/customAppBar/customFooter.dart
Normal file → Executable file
160
lib/customAppBar/enrollmentAppBar.dart
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:adaptive_navbar/adaptive_navbar.dart';
|
||||||
|
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||||
|
import 'package:nhancepolicy/responsive.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:nhancepolicy/responsive.dart';
|
||||||
|
|
||||||
|
class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
|
||||||
|
@override
|
||||||
|
_CustomAppBarState createState() => _CustomAppBarState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Size get preferredSize => Size.fromHeight(kToolbarHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CustomAppBarState extends State<CustomAppBar> {
|
||||||
|
bool showBackToHR = false;
|
||||||
|
// bool isLoading = true; // Add a loading state
|
||||||
|
// bool hideInactiveStatus = true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_checkTokens();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _checkTokens() async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
final String? hrtoken = prefs.getString('hrtoken');
|
||||||
|
final String? token = prefs.getString('token');
|
||||||
|
// showBackToHR = prefs.getBool('showBackToHR')!;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
showBackToHR = prefs.getBool('showBackToHR')!;
|
||||||
|
// showBackToHR = (hrtoken != null && hrtoken.isNotEmpty) &&
|
||||||
|
// (token != null && token.isNotEmpty);
|
||||||
|
// print((hrtoken != null && hrtoken.isNotEmpty));
|
||||||
|
// print((token != null && token.isNotEmpty));
|
||||||
|
// print('showBackToHR $showBackToHR');
|
||||||
|
|
||||||
|
// hideInactiveStatus = token != null && token.isNotEmpty;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> hrLogout(BuildContext context) async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
final String? hrtoken = prefs.getString('hrtoken');
|
||||||
|
|
||||||
|
if (hrtoken != null && hrtoken.isNotEmpty) {
|
||||||
|
prefs.setBool('showBackToHR', false);
|
||||||
|
await prefs.remove('hrSelectArgumentsData');
|
||||||
|
prefs.remove('token');
|
||||||
|
Navigator.pushNamed(context, 'hrDashboard');
|
||||||
|
} else {
|
||||||
|
await prefs.clear();
|
||||||
|
Navigator.pushNamed(context, 'phone');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> logout(BuildContext context) async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
final String? hrtoken = prefs.getString('hrtoken');
|
||||||
|
final String? token = prefs.getString('token');
|
||||||
|
|
||||||
|
if (token != null && token.isNotEmpty) {
|
||||||
|
if (hrtoken != null && hrtoken.isNotEmpty) {
|
||||||
|
await prefs.clear();
|
||||||
|
Navigator.pushNamed(context, 'hrLogin');
|
||||||
|
} else {
|
||||||
|
await prefs.clear();
|
||||||
|
Navigator.pushNamed(context, 'phone');
|
||||||
|
}
|
||||||
|
} else if (hrtoken != null && hrtoken.isNotEmpty) {
|
||||||
|
await prefs.clear();
|
||||||
|
Navigator.pushNamed(context, 'hrLogin');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final sw = MediaQuery.of(context).size.width;
|
||||||
|
// if (isLoading) {
|
||||||
|
// // Show a loading indicator or a placeholder AppBar while waiting
|
||||||
|
// return AppBar(
|
||||||
|
// title: Text('Loading...'),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Color(0xFFFFFCE5), // Set background color for AppBar
|
||||||
|
appBar: PreferredSize(
|
||||||
|
preferredSize: widget.preferredSize,
|
||||||
|
child: SafeArea(
|
||||||
|
child: Container(
|
||||||
|
padding: Responsive.isDesktop(context)
|
||||||
|
? EdgeInsets.symmetric(horizontal: 16.0)
|
||||||
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
// Logo Column
|
||||||
|
Expanded(
|
||||||
|
flex: Responsive.isDesktop(context) ? 3 : 9,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: Responsive.isDesktop(context)
|
||||||
|
? MainAxisAlignment.spaceEvenly
|
||||||
|
: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10, bottom: 10),
|
||||||
|
width: 150,
|
||||||
|
height: 150,
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/nhance_client_logo.png',
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// AdaptiveNavBar Column
|
||||||
|
Expanded(
|
||||||
|
flex: Responsive.isDesktop(context) ? 9 : 3,
|
||||||
|
child: AdaptiveNavBar(
|
||||||
|
screenWidth: sw,
|
||||||
|
backgroundColor: Color(0xFFFFFCE5),
|
||||||
|
leading:
|
||||||
|
Container(), // Set an empty container as we have the logo separately
|
||||||
|
title: Text(''),
|
||||||
|
navBarItems: [
|
||||||
|
// if (Responsive.isDesktop(context))
|
||||||
|
// if (hideInactiveStatus)
|
||||||
|
// NavBarItem(
|
||||||
|
// text: "Inactive Policy",
|
||||||
|
// onTap: () {
|
||||||
|
// Navigator.pushNamed(context, 'oldPolicy');
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
if (showBackToHR)
|
||||||
|
NavBarItem(
|
||||||
|
text: "Back To HR",
|
||||||
|
onTap: () {
|
||||||
|
hrLogout(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
NavBarItem(
|
||||||
|
text: "Logout",
|
||||||
|
onTap: () async {
|
||||||
|
logout(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
0
lib/customAppBar/toastHelper.dart
Normal file → Executable file
894
lib/email_verify.dart
Normal file
@ -0,0 +1,894 @@
|
|||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:nhancepolicy/responsive.dart';
|
||||||
|
import 'package:nhancepolicy/service/api_service.dart';
|
||||||
|
import 'package:pinput/pinput.dart';
|
||||||
|
import 'dart:async';
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:jwt_decode/jwt_decode.dart';
|
||||||
|
|
||||||
|
import '../customAppBar/toastHelper.dart';
|
||||||
|
import '../models/environment.dart';
|
||||||
|
import '../models/platform_helper_mobile.dart'
|
||||||
|
if (dart.library.html) '../models/platform_helper_other.dart';
|
||||||
|
|
||||||
|
// import 'dart:html' as html;
|
||||||
|
|
||||||
|
class MyEmailVerify extends StatefulWidget {
|
||||||
|
final String email;
|
||||||
|
|
||||||
|
const MyEmailVerify({
|
||||||
|
Key? key,
|
||||||
|
required this.email,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyEmailVerify> createState() => _MyEmailVerifyState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyEmailVerifyState extends State<MyEmailVerify> {
|
||||||
|
late ApiService apiService;
|
||||||
|
TextEditingController _otpController = TextEditingController();
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
late Timer _timer;
|
||||||
|
int _secondsRemaining = 60;
|
||||||
|
bool _isTimerRunning = false;
|
||||||
|
|
||||||
|
dynamic enrollmentEmpClientBranchId;
|
||||||
|
dynamic enrollmentEmpCodeString;
|
||||||
|
dynamic enrollmentEmpPrimaryId;
|
||||||
|
dynamic enrollmentGpaEmpName;
|
||||||
|
dynamic enrollmentClient_id;
|
||||||
|
dynamic enrollmentEmp_status;
|
||||||
|
|
||||||
|
dynamic empCodeString;
|
||||||
|
dynamic empClientBranchId;
|
||||||
|
dynamic empPrimaryId;
|
||||||
|
dynamic gpaEmpName;
|
||||||
|
dynamic empClientId;
|
||||||
|
dynamic _token;
|
||||||
|
dynamic _postToken;
|
||||||
|
dynamic clientName;
|
||||||
|
dynamic clientLogo;
|
||||||
|
dynamic emp_status;
|
||||||
|
dynamic fCMToken;
|
||||||
|
late String verificationId;
|
||||||
|
final FirebaseAuth _auth = FirebaseAuth.instance;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
late String _verificationId;
|
||||||
|
dynamic empMobileNo;
|
||||||
|
dynamic empEmailid;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
apiService = ApiService(context);
|
||||||
|
startTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_timer.cancel();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void startTimer() {
|
||||||
|
_isTimerRunning = true;
|
||||||
|
_timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
|
||||||
|
setState(() {
|
||||||
|
if (_secondsRemaining > 0) {
|
||||||
|
_secondsRemaining--;
|
||||||
|
} else {
|
||||||
|
_isTimerRunning = false;
|
||||||
|
_timer.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void verifyOTP(String otp) async {
|
||||||
|
try {
|
||||||
|
final response = await http.post(
|
||||||
|
Uri.parse(Environment.apiUrl + 'getVerifiedHrData'),
|
||||||
|
body:
|
||||||
|
json.encode({'email': widget.email, 'otp': _otpController.text}),
|
||||||
|
headers: {
|
||||||
|
HttpHeaders.contentTypeHeader: 'application/json',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
print('data: $data');
|
||||||
|
_token = data['data'];
|
||||||
|
String status = data['status'];
|
||||||
|
|
||||||
|
// Directly access the post_enrollment data
|
||||||
|
Map<String, dynamic> post = data['post_enrollment'];
|
||||||
|
print('post: $post');
|
||||||
|
|
||||||
|
_postToken = post['data'];
|
||||||
|
String postStatus = post['status'];
|
||||||
|
|
||||||
|
if (postStatus == 'success') {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
postSuccessData(post, data);
|
||||||
|
} else if (status == 'success') {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
enrollmentSuccessData(data);
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
||||||
|
// Show a Snackbar if the OTP is invalid
|
||||||
|
print('Invalid OTP. Please try again');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
ToastHelper.showWarningToast(context, 'Something went wrong');
|
||||||
|
throw Exception('Failed to verify OTP');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
print('Error: $e');
|
||||||
|
ToastHelper.showWarningToast(context, 'Something went wrong');
|
||||||
|
// Show a Snackbar if there's an error while verifying OTP
|
||||||
|
print('Failed to verify OTP. Please try again.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void postSuccessData(post, data) async {
|
||||||
|
String status = data['status'];
|
||||||
|
String postStatus = post['status'];
|
||||||
|
|
||||||
|
if (postStatus == 'success') {
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
prefs.setString('_postToken', post['data']);
|
||||||
|
|
||||||
|
// Decode the JWT token received from the API response
|
||||||
|
Map<String, dynamic>? decodedToken = Jwt.parseJwt(post['data']);
|
||||||
|
print('decodedToken : $decodedToken');
|
||||||
|
empClientBranchId = decodedToken['ref_id'];
|
||||||
|
prefs.setString('empClientBranchId', empClientBranchId);
|
||||||
|
empCodeString = decodedToken['emp_code'].toString();
|
||||||
|
prefs.setString('empCode', empCodeString);
|
||||||
|
empPrimaryId = decodedToken['id'];
|
||||||
|
prefs.setString('empPrimaryId', empPrimaryId);
|
||||||
|
gpaEmpName = decodedToken['name'].toString();
|
||||||
|
prefs.setString('gpaEmpName', gpaEmpName);
|
||||||
|
empClientId = decodedToken['client_id'];
|
||||||
|
prefs.setString('empClientId', empClientId);
|
||||||
|
// emp_status = decodedToken['emp_status'];
|
||||||
|
// prefs.setString('emp_status', emp_status);
|
||||||
|
// getClientLogoAndDetails();
|
||||||
|
|
||||||
|
print('Successfully Login');
|
||||||
|
|
||||||
|
// Redirect to another page
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == 'success') {
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
prefs.setString('enrollToken', data['data']);
|
||||||
|
|
||||||
|
// Decode the JWT token received from the API response
|
||||||
|
Map<String, dynamic>? decodedToken = Jwt.parseJwt(data['data']);
|
||||||
|
print('decodedToken : $decodedToken');
|
||||||
|
enrollmentEmpClientBranchId = decodedToken['ref_id'];
|
||||||
|
prefs.setString('enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
||||||
|
enrollmentEmpCodeString = decodedToken['emp_code'].toString();
|
||||||
|
prefs.setString('enrollmentEmpCodeString', enrollmentEmpCodeString);
|
||||||
|
enrollmentEmpPrimaryId = decodedToken['id'];
|
||||||
|
prefs.setString('enrollmentEmpPrimaryId', enrollmentEmpPrimaryId);
|
||||||
|
enrollmentGpaEmpName = decodedToken['name'].toString();
|
||||||
|
prefs.setString('enrollmentGpaEmpName', enrollmentGpaEmpName);
|
||||||
|
enrollmentClient_id = decodedToken['client_id'];
|
||||||
|
prefs.setString('enrollmentClient_id', enrollmentClient_id);
|
||||||
|
// enrollmentEmp_status = decodedToken['emp_status'];
|
||||||
|
// prefs.setString('enrollmentEmp_status', enrollmentEmp_status);
|
||||||
|
}
|
||||||
|
|
||||||
|
getClientLogoAndDetails(empClientId,empClientBranchId,post['data']);
|
||||||
|
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
final _postToken = prefs.getString('_postToken');
|
||||||
|
|
||||||
|
if (_postToken != null && _postToken.isNotEmpty) {
|
||||||
|
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||||
|
// if (emp_status == 'enrolled' || emp_status == 'active') {
|
||||||
|
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
||||||
|
// } else {
|
||||||
|
// Navigator.pushReplacementNamed(context, 'empDetails');
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void enrollmentSuccessData(data) async {
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
prefs.setString('enrollToken', data['data']);
|
||||||
|
|
||||||
|
// Decode the JWT token received from the API response
|
||||||
|
Map<String, dynamic>? decodedToken = Jwt.parseJwt(data['data']);
|
||||||
|
print('decodedToken : $decodedToken');
|
||||||
|
enrollmentEmpClientBranchId = decodedToken['ref_id'];
|
||||||
|
prefs.setString('enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
||||||
|
enrollmentEmpCodeString = decodedToken['emp_code'].toString();
|
||||||
|
prefs.setString('enrollmentEmpCodeString', enrollmentEmpCodeString);
|
||||||
|
enrollmentEmpPrimaryId = decodedToken['id'];
|
||||||
|
prefs.setString('enrollmentEmpPrimaryId', enrollmentEmpPrimaryId);
|
||||||
|
enrollmentGpaEmpName = decodedToken['name'].toString();
|
||||||
|
prefs.setString('enrollmentGpaEmpName', enrollmentGpaEmpName);
|
||||||
|
enrollmentClient_id = decodedToken['client_id'];
|
||||||
|
prefs.setString('enrollmentClient_id', enrollmentClient_id);
|
||||||
|
// enrollmentEmp_status = decodedToken['emp_status'];
|
||||||
|
// prefs.setString('enrollmentEmp_status', enrollmentEmp_status);
|
||||||
|
getClientLogoAndDetails(enrollmentClient_id,enrollmentEmpClientBranchId,data['data']);
|
||||||
|
print('Successfully Login');
|
||||||
|
|
||||||
|
// Redirect to another page
|
||||||
|
final enrollToken = prefs.getString('enrollToken');
|
||||||
|
|
||||||
|
if (enrollToken != null && enrollToken.isNotEmpty) {
|
||||||
|
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||||
|
// if (emp_status == 'enrolled' || emp_status == 'active') {
|
||||||
|
// Navigator.pushReplacementNamed(context, 'home');
|
||||||
|
// } else {
|
||||||
|
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void _resendOTP() {
|
||||||
|
setState(() {
|
||||||
|
_secondsRemaining = 60;
|
||||||
|
_isTimerRunning = true;
|
||||||
|
});
|
||||||
|
startTimer();
|
||||||
|
verifyMobileAndEmailNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> verifyMobileAndEmailNumber() async {
|
||||||
|
try {
|
||||||
|
// var enteredMobileNumber = mobileController.text;
|
||||||
|
final response = await http.post(
|
||||||
|
Uri.parse(Environment.apiUrl + 'verifyEmployeeEmailId'),
|
||||||
|
body: json.encode({'email': widget.email}),
|
||||||
|
headers: {
|
||||||
|
HttpHeaders.contentTypeHeader: 'application/json',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
bool userVerification = data['data']['user_verification'];
|
||||||
|
String message = data['data']['message'];
|
||||||
|
if (userVerification) {
|
||||||
|
ToastHelper.showSuccessToast(
|
||||||
|
context, 'Verification code sent to ${widget.email}');
|
||||||
|
} else {
|
||||||
|
ToastHelper.showErrorToast(context, message);
|
||||||
|
print('Invalid mobile number');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ToastHelper.showErrorToast(context, 'Something went wrong');
|
||||||
|
throw Exception('Failed to verify mobile number');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
ToastHelper.showErrorToast(context, 'Something went wrong');
|
||||||
|
print('Error: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getClientLogoAndDetails(client_id,empRefId,token) async {
|
||||||
|
var url = Uri.parse(Environment.apiUrl +
|
||||||
|
'getClientDetails?client_id=$client_id&client_branch_id=$empRefId');
|
||||||
|
try {
|
||||||
|
var response = await http.get(
|
||||||
|
url,
|
||||||
|
headers: {
|
||||||
|
'Authorization':
|
||||||
|
'Bearer $token', // Add token to the Authorization header
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
// print('response.statusCode == 200');
|
||||||
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
// print(data);
|
||||||
|
|
||||||
|
if (data.containsKey('data')) {
|
||||||
|
dynamic clientDetails = data['data'];
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
prefs.setString('clientLogo', clientDetails['client']['client_logo']);
|
||||||
|
prefs.setString('clientName', clientDetails['client']['client_name']);
|
||||||
|
setState(() {
|
||||||
|
// dynamic clientDetails = data['data'];
|
||||||
|
// print(clientDetails);
|
||||||
|
clientName = clientDetails['client']['client_name'];
|
||||||
|
print(clientName);
|
||||||
|
clientLogo = clientDetails['client']['client_logo'];
|
||||||
|
print(clientLogo);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Handle other status messages if needed
|
||||||
|
// ToastHelper.showErrorToast(
|
||||||
|
// context, 'API request failed with status: ${data['status']}');
|
||||||
|
print('API request failed with status: ${data['status']}');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Handle other status codes
|
||||||
|
// ToastHelper.showErrorToast(
|
||||||
|
// context, 'Request failed with status: ${response.statusCode}');
|
||||||
|
print('Request failed with status: ${response.statusCode}');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Handle exceptions
|
||||||
|
print('Exception occurred: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
// Retrieve the passed mobile number value
|
||||||
|
// final String mobileNumber =
|
||||||
|
// ModalRoute.of(context)!.settings.arguments as String;
|
||||||
|
Size _size = MediaQuery.of(context).size;
|
||||||
|
EdgeInsets marginInsets = EdgeInsets.zero;
|
||||||
|
if (Responsive.isDesktop(context)) {
|
||||||
|
marginInsets = const EdgeInsets.only(
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
top: 0,
|
||||||
|
);
|
||||||
|
} else if (Responsive.isMobile(context)) {
|
||||||
|
marginInsets = const EdgeInsets.only(
|
||||||
|
left: 25, // Example value for mobile
|
||||||
|
right: 25, // Example value for mobile
|
||||||
|
bottom: 0, // Example value for mobile
|
||||||
|
top: 0, // Example value for mobile
|
||||||
|
);
|
||||||
|
} else if (Responsive.isTablet(context)) {
|
||||||
|
marginInsets = const EdgeInsets.only(
|
||||||
|
left: 25, // Example value for mobile
|
||||||
|
right: 25, // Example value for mobile
|
||||||
|
bottom: 0, // Example value for mobile
|
||||||
|
top: 0, // Example value for mobile
|
||||||
|
);
|
||||||
|
}
|
||||||
|
final defaultPinTheme = PinTheme(
|
||||||
|
width: 56,
|
||||||
|
height: 56,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: Color.fromRGBO(30, 60, 87, 1),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Color.fromRGBO(234, 239, 243, 1)),
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final focusedPinTheme = defaultPinTheme.copyDecorationWith(
|
||||||
|
border: Border.all(color: Color.fromRGBO(114, 178, 238, 1)),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
);
|
||||||
|
|
||||||
|
final submittedPinTheme = defaultPinTheme.copyWith(
|
||||||
|
decoration: defaultPinTheme.decoration?.copyWith(
|
||||||
|
color: Color.fromRGBO(234, 239, 243, 1),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pushReplacementNamed(context, 'login');
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||||
|
child: Container(
|
||||||
|
height: _size.height,
|
||||||
|
color: Colors.white,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Visibility(
|
||||||
|
visible: _size.width <= 1100,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(30),
|
||||||
|
bottomRight: Radius.circular(30),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
height: _size.height / 3,
|
||||||
|
width: double.infinity,
|
||||||
|
color: Color(0xFFFFFCE5),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: _size.height /
|
||||||
|
6.4), // Adjust the spacing between the rows
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment
|
||||||
|
.center, // Align to the center
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: Responsive.isDesktop(context)
|
||||||
|
? 10
|
||||||
|
: 12,
|
||||||
|
child: Align(
|
||||||
|
alignment: Responsive.isDesktop(context)
|
||||||
|
? Alignment.centerLeft
|
||||||
|
: Alignment.bottomCenter,
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/nhance_app_logo.png',
|
||||||
|
width: 150,
|
||||||
|
height: 150,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (!Responsive.isMobile(context) &&
|
||||||
|
!Responsive.isTablet(context))
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
// Add your navigation logic here
|
||||||
|
// For example, you can use Navigator.push to navigate to another page
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, 'hrLogin');
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment
|
||||||
|
.end, // Align to the end (right)
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'HR Login',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(
|
||||||
|
0xFF000000), // Text color
|
||||||
|
// Add other text styles as needed
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Icon(
|
||||||
|
Icons
|
||||||
|
.east, // Icon for customer login
|
||||||
|
color: Colors
|
||||||
|
.black, // Adjust color as needed
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: marginInsets,
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Form(
|
||||||
|
key: _formKey,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
if (_size.width > 1100)
|
||||||
|
Expanded(
|
||||||
|
flex: _size.width < 1100 ? 6 : 12,
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (BuildContext context,
|
||||||
|
BoxConstraints constraints) {
|
||||||
|
if (constraints.maxWidth > 600) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/hrLogin.jpg',
|
||||||
|
height: _size.height,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return SizedBox();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: _size.width < 1100 ? 6 : 12,
|
||||||
|
child: Container(
|
||||||
|
margin: _size.width > 1100
|
||||||
|
? EdgeInsets.only(left: 20, right: 20)
|
||||||
|
: EdgeInsets.only(left: 0, right: 0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
if (!Responsive.isMobile(context) &&
|
||||||
|
!Responsive.isTablet(context))
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 10,
|
||||||
|
child: Align(
|
||||||
|
alignment: Responsive
|
||||||
|
.isDesktop(context)
|
||||||
|
? Alignment.centerLeft
|
||||||
|
: Alignment
|
||||||
|
.bottomCenter, // Align to the start
|
||||||
|
child: _size.width <= 1100
|
||||||
|
? Image.asset(
|
||||||
|
'assets/nhance_app_logo.png',
|
||||||
|
width: 150,
|
||||||
|
height: 150,
|
||||||
|
)
|
||||||
|
: _size.width > 1100
|
||||||
|
? Image.asset(
|
||||||
|
'assets/nhance_app_logo.png',
|
||||||
|
width: 150,
|
||||||
|
height: 150,
|
||||||
|
)
|
||||||
|
: Image.asset(
|
||||||
|
'assets/nhance_app_logo.png',
|
||||||
|
width: 150,
|
||||||
|
height: 150,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 10),
|
||||||
|
// SizedBox(
|
||||||
|
// height: Responsive.isDesktop(context)
|
||||||
|
// ? _size.height * 0.1
|
||||||
|
// : 10,
|
||||||
|
// ),
|
||||||
|
Container(
|
||||||
|
margin: Responsive.isDesktop(context)
|
||||||
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(
|
||||||
|
horizontal: 0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Welcome to Nhance",
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10),
|
||||||
|
Container(
|
||||||
|
margin: Responsive.isDesktop(context)
|
||||||
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(
|
||||||
|
horizontal: 0),
|
||||||
|
child: RichText(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
text: TextSpan(
|
||||||
|
text:
|
||||||
|
"Please enter the one-time usage code sent to your mobile number ${widget.email}",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
height: 1.5,
|
||||||
|
color: Color(0xFF000000)),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: " (Change Email)",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Color(
|
||||||
|
0xFFE26728)), // Change color as desired
|
||||||
|
recognizer:
|
||||||
|
TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
// Navigate to the page where the user can change the phone number
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, 'hrLogin');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 15),
|
||||||
|
Container(
|
||||||
|
margin: Responsive.isDesktop(context)
|
||||||
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(
|
||||||
|
horizontal: 0),
|
||||||
|
child: Pinput(
|
||||||
|
length: 6,
|
||||||
|
// defaultPinTheme: defaultPinTheme,
|
||||||
|
// focusedPinTheme: focusedPinTheme,
|
||||||
|
// submittedPinTheme: submittedPinTheme,
|
||||||
|
showCursor: true,
|
||||||
|
controller: _otpController,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10),
|
||||||
|
Container(
|
||||||
|
margin: Responsive.isDesktop(context)
|
||||||
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(
|
||||||
|
horizontal: 0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment
|
||||||
|
.end, // Align text to the right
|
||||||
|
children: [
|
||||||
|
_isTimerRunning
|
||||||
|
? Text(
|
||||||
|
"Resend OTP in $_secondsRemaining seconds",
|
||||||
|
style:
|
||||||
|
GoogleFonts.poppins(
|
||||||
|
color:
|
||||||
|
Colors.black),
|
||||||
|
)
|
||||||
|
: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
_resendOTP();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
"Resend OTP",
|
||||||
|
style:
|
||||||
|
GoogleFonts.poppins(
|
||||||
|
color: Colors
|
||||||
|
.blue),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10),
|
||||||
|
Container(
|
||||||
|
margin: Responsive.isDesktop(context)
|
||||||
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(
|
||||||
|
horizontal: 0),
|
||||||
|
child: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 45,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor:
|
||||||
|
Color(0xFF00989E),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
if (_formKey.currentState!
|
||||||
|
.validate()) {
|
||||||
|
_formKey.currentState!
|
||||||
|
.save(); // Save form fields before calling verifyOTP
|
||||||
|
verifyOTP(
|
||||||
|
_otpController.text);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
"Submit",
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFFFFFFFF)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// _size.width > 1100
|
||||||
|
// ? Container(
|
||||||
|
// margin: EdgeInsets.symmetric(
|
||||||
|
// horizontal: 150),
|
||||||
|
// child: Column(
|
||||||
|
// children: [
|
||||||
|
// SizedBox(height: 20),
|
||||||
|
// Text(
|
||||||
|
// "Benefits of Login",
|
||||||
|
// style:
|
||||||
|
// GoogleFonts.poppins(
|
||||||
|
// fontSize: 20,
|
||||||
|
// fontWeight:
|
||||||
|
// FontWeight.bold,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(height: 15),
|
||||||
|
// ],
|
||||||
|
// ))
|
||||||
|
// : SizedBox(),
|
||||||
|
// _size.width > 1100
|
||||||
|
// ? Container(
|
||||||
|
// margin: EdgeInsets.symmetric(
|
||||||
|
// horizontal: 150),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment:
|
||||||
|
// MainAxisAlignment.center,
|
||||||
|
// children: [
|
||||||
|
// Expanded(
|
||||||
|
// flex: 6,
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets
|
||||||
|
// .symmetric(
|
||||||
|
// vertical: 8),
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment:
|
||||||
|
// MainAxisAlignment
|
||||||
|
// .center,
|
||||||
|
// children: [
|
||||||
|
// Expanded(
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets
|
||||||
|
// .symmetric(
|
||||||
|
// vertical:
|
||||||
|
// 12),
|
||||||
|
// decoration:
|
||||||
|
// BoxDecoration(
|
||||||
|
// border:
|
||||||
|
// Border(
|
||||||
|
// right:
|
||||||
|
// BorderSide(
|
||||||
|
// width: 1,
|
||||||
|
// color: Colors
|
||||||
|
// .black,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// child: Column(
|
||||||
|
// children: [
|
||||||
|
// Icon(
|
||||||
|
// Icons
|
||||||
|
// .policy,
|
||||||
|
// color: Color(
|
||||||
|
// 0xFFE26728)),
|
||||||
|
// SizedBox(
|
||||||
|
// height:
|
||||||
|
// 10),
|
||||||
|
// Text(
|
||||||
|
// "View Policy",
|
||||||
|
// style: GoogleFonts
|
||||||
|
// .poppins()),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Expanded(
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets
|
||||||
|
// .symmetric(
|
||||||
|
// vertical:
|
||||||
|
// 12),
|
||||||
|
// child: Column(
|
||||||
|
// children: [
|
||||||
|
// Icon(
|
||||||
|
// Icons
|
||||||
|
// .edit,
|
||||||
|
// color: Color(
|
||||||
|
// 0xFFE26728)),
|
||||||
|
// SizedBox(
|
||||||
|
// height:
|
||||||
|
// 10),
|
||||||
|
// Text(
|
||||||
|
// "Manage Claims",
|
||||||
|
// style: GoogleFonts
|
||||||
|
// .poppins()),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// : SizedBox(
|
||||||
|
// height: Responsive.isDesktop(
|
||||||
|
// context)
|
||||||
|
// ? _size.height * 0.1
|
||||||
|
// : _size.height * 0.2,
|
||||||
|
// ),
|
||||||
|
SizedBox(
|
||||||
|
height: Responsive.isDesktop(context)
|
||||||
|
? _size.height * 0.3
|
||||||
|
: _size.height * 0.2,
|
||||||
|
),
|
||||||
|
// SizedBox(
|
||||||
|
// height: _size.height * 0.1,
|
||||||
|
// ),
|
||||||
|
Container(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
padding:
|
||||||
|
EdgeInsets.symmetric(vertical: 8),
|
||||||
|
child: RichText(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
text: TextSpan(
|
||||||
|
text:
|
||||||
|
'By continuing, you agree with our ',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 9,
|
||||||
|
),
|
||||||
|
children: <TextSpan>[
|
||||||
|
TextSpan(
|
||||||
|
text: 'privacy policy ',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFF00989E),
|
||||||
|
fontSize: 9,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: 'and ',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 9,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: 'terms of use',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFF00989E),
|
||||||
|
fontSize: 9,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
}
|
||||||
137
lib/empDetails.dart
Normal file → Executable file
@ -5,7 +5,7 @@ import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
|||||||
import 'package:nhancepolicy/models/environment.dart';
|
import 'package:nhancepolicy/models/environment.dart';
|
||||||
import 'package:nhancepolicy/service/api_service.dart';
|
import 'package:nhancepolicy/service/api_service.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'customAppBar/customAppBar.dart';
|
import 'package:nhancepolicy/customAppBar/enrollmentAppBar.dart';
|
||||||
import 'package:jwt_decode/jwt_decode.dart';
|
import 'package:jwt_decode/jwt_decode.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
@ -29,6 +29,7 @@ class empDetails extends StatefulWidget {
|
|||||||
class _empDetailsState extends State<empDetails> {
|
class _empDetailsState extends State<empDetails> {
|
||||||
late ApiService apiService;
|
late ApiService apiService;
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
|
bool login_by_hr = false;
|
||||||
dynamic _token;
|
dynamic _token;
|
||||||
dynamic empCodeString;
|
dynamic empCodeString;
|
||||||
dynamic empPrimaryId;
|
dynamic empPrimaryId;
|
||||||
@ -58,6 +59,7 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
dynamic gmcSelfRelationship;
|
dynamic gmcSelfRelationship;
|
||||||
dynamic gmcSelfDetails;
|
dynamic gmcSelfDetails;
|
||||||
dynamic gmcPolicyName;
|
dynamic gmcPolicyName;
|
||||||
|
dynamic gmc_client_policy_id;
|
||||||
dynamic gmcPolicyType;
|
dynamic gmcPolicyType;
|
||||||
dynamic gmcNotes;
|
dynamic gmcNotes;
|
||||||
dynamic gmcGridMaster;
|
dynamic gmcGridMaster;
|
||||||
@ -94,6 +96,7 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
dynamic hrPrimaryId;
|
dynamic hrPrimaryId;
|
||||||
dynamic empRefId;
|
dynamic empRefId;
|
||||||
dynamic empClientBranchId;
|
dynamic empClientBranchId;
|
||||||
|
dynamic token;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -143,7 +146,10 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
prefs.setString('fromHrLoginMobileNo', mobileNumber);
|
prefs.setString('fromHrLoginMobileNo', mobileNumber);
|
||||||
|
|
||||||
// Retrieve the passed mobile number value
|
// Retrieve the passed mobile number value
|
||||||
dynamic login_by_hr = true;
|
|
||||||
|
setState(() {
|
||||||
|
login_by_hr = true;
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
final response = await http.post(
|
final response = await http.post(
|
||||||
Uri.parse(Environment.apiUrl + 'getVerifiedUserData'),
|
Uri.parse(Environment.apiUrl + 'getVerifiedUserData'),
|
||||||
@ -189,11 +195,11 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
print('Successfully Login');
|
print('Successfully Login');
|
||||||
|
|
||||||
// Redirect to another page
|
// Redirect to another page
|
||||||
final token = prefs.getString('token');
|
token = prefs.getString('token');
|
||||||
print('final $token');
|
print('final $token');
|
||||||
if (token != null && token.isNotEmpty) {
|
if (token != null && token.isNotEmpty) {
|
||||||
// ToastHelper.showSuccessToast(context, 'Successfully Login');
|
// ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||||
await getSelfEmployeeProfile(token);
|
await getTokenLoad(token);
|
||||||
if (prefs.containsKey('clientLogo') &&
|
if (prefs.containsKey('clientLogo') &&
|
||||||
prefs.containsKey('clientName')) {
|
prefs.containsKey('clientName')) {
|
||||||
clientLogo = prefs.getString('clientLogo');
|
clientLogo = prefs.getString('clientLogo');
|
||||||
@ -253,7 +259,7 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
|
|
||||||
// print(empPrimaryId);
|
// print(empPrimaryId);
|
||||||
// Call the API when the page enters
|
// Call the API when the page enters
|
||||||
getSelfEmployeeProfile('');
|
// getSelfEmployeeProfile('');
|
||||||
if (prefs.containsKey('clientLogo') && prefs.containsKey('clientName')) {
|
if (prefs.containsKey('clientLogo') && prefs.containsKey('clientName')) {
|
||||||
clientLogo = prefs.getString('clientLogo');
|
clientLogo = prefs.getString('clientLogo');
|
||||||
clientName = prefs.getString('clientName');
|
clientName = prefs.getString('clientName');
|
||||||
@ -314,15 +320,24 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getSelfEmployeeProfile(token) async {
|
Future<void> getTokenLoad(token) async {
|
||||||
|
try {
|
||||||
|
final response = await apiService.getTokenLoadAPI(token);
|
||||||
|
} catch (e) {
|
||||||
|
// Handle exceptions
|
||||||
|
print('Exception occurred: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getSelfEmployeeProfile(token, client_policy_id) async {
|
||||||
try {
|
try {
|
||||||
if (client_id == null ||
|
if (client_id == null ||
|
||||||
empCodeString == null ||
|
empCodeString == null ||
|
||||||
empClientBranchId == null) {
|
empClientBranchId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final response = await apiService.getSelfEmployeeProfileToApi(
|
final response = await apiService.getSelfEmployeeProfileToApi(token,
|
||||||
token, client_id!, empCodeString!, empClientBranchId!);
|
client_id!, empCodeString!, empClientBranchId!, client_policy_id);
|
||||||
|
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
if (response.containsKey('data')) {
|
if (response.containsKey('data')) {
|
||||||
@ -335,7 +350,8 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
selfMobile = selfDetails['mobile'];
|
selfMobile = selfDetails['mobile'];
|
||||||
selfDesignation = selfDetails['designation'];
|
selfDesignation = selfDetails['designation'];
|
||||||
selfDob = convertDateFormat(selfDetails['dob']);
|
selfDob = convertDateFormat(selfDetails['dob']);
|
||||||
selfDoj = convertDateFormat(selfDetails['doj']);
|
// selfDoj = convertDateFormat(selfDetails['doj']);
|
||||||
|
selfDoj = convertDateFormat(selfDetails['date_coverage']);
|
||||||
selfGender = selfDetails['gender'];
|
selfGender = selfDetails['gender'];
|
||||||
selfEmailCorporate = selfDetails['email_corporate'];
|
selfEmailCorporate = selfDetails['email_corporate'];
|
||||||
selfEmailPersonal = selfDetails['email_personal'];
|
selfEmailPersonal = selfDetails['email_personal'];
|
||||||
@ -386,8 +402,14 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
empClientBranchId == null) {
|
empClientBranchId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final response = await apiService.getGpaEmpPolicyDetailsToApi(
|
final response = await apiService.getGpaEmpPolicyDetailsToApi(
|
||||||
empPrimaryId, empCodeString!, client_id!, 'GPA', empClientBranchId!);
|
empPrimaryId,
|
||||||
|
empCodeString!,
|
||||||
|
client_id!,
|
||||||
|
'GPA',
|
||||||
|
empClientBranchId!,
|
||||||
|
login_by_hr);
|
||||||
|
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -415,8 +437,14 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
empClientBranchId == null) {
|
empClientBranchId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final response = await apiService.getGmcEmpPolicyDetailsToApi(
|
final response = await apiService.getGmcEmpPolicyDetailsToApi(
|
||||||
empPrimaryId, empCodeString!, client_id!, 'GMC', empClientBranchId!);
|
empPrimaryId,
|
||||||
|
empCodeString!,
|
||||||
|
client_id!,
|
||||||
|
'GMC',
|
||||||
|
empClientBranchId!,
|
||||||
|
login_by_hr);
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
setState(() {
|
setState(() {
|
||||||
gmcPolicies = response['data'];
|
gmcPolicies = response['data'];
|
||||||
@ -651,6 +679,35 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
_dobController.clear();
|
_dobController.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> backFunction() async {
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
final String? hrtoken = prefs.getString('hrtoken');
|
||||||
|
|
||||||
|
if (hrtoken != null && hrtoken.isNotEmpty) {
|
||||||
|
prefs.setBool('showBackToHR', false);
|
||||||
|
prefs.remove('token');
|
||||||
|
|
||||||
|
// Retrieve and decode `hrSelectArgumentsData`
|
||||||
|
final String? detailsString = prefs.getString('hrSelectArgumentsData');
|
||||||
|
if (detailsString != null) {
|
||||||
|
final dynamic details = jsonDecode(detailsString);
|
||||||
|
print('Decoded details:');
|
||||||
|
print(details);
|
||||||
|
|
||||||
|
// Ensure that details is a Map<String, dynamic> before passing it
|
||||||
|
if (details is Map<String, dynamic>) {
|
||||||
|
Navigator.pushNamed(context, 'hrPolicyDetails', arguments: details);
|
||||||
|
} else {
|
||||||
|
print('Error: Decoded details is not a Map<String, dynamic>.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print('hrSelectArgumentsData is null.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print('hrtoken is null or empty.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
dynamic arguments = ModalRoute.of(context)!.settings.arguments;
|
dynamic arguments = ModalRoute.of(context)!.settings.arguments;
|
||||||
@ -910,7 +967,33 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 12,
|
flex: 6,
|
||||||
|
child: Container(
|
||||||
|
width: 150,
|
||||||
|
height: 150,
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
backFunction();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Back',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFFE26728)),
|
||||||
|
),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(5),
|
||||||
|
side: BorderSide(
|
||||||
|
color: Color(0xFFE26728)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
flex: 6,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 150,
|
width: 150,
|
||||||
height: 150,
|
height: 150,
|
||||||
@ -1486,8 +1569,8 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
initialValue: selfDoj ?? '',
|
initialValue: selfDoj ?? '',
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
hintText: 'Date of Joining',
|
hintText: 'Date Coverage',
|
||||||
labelText: 'Date of Joining',
|
labelText: 'Date Coverage',
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding: EdgeInsets.symmetric(
|
||||||
vertical: 10, horizontal: 15),
|
vertical: 10, horizontal: 15),
|
||||||
),
|
),
|
||||||
@ -1601,8 +1684,8 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
initialValue: selfDoj ?? '',
|
initialValue: selfDoj ?? '',
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
hintText: 'Date of Joining',
|
hintText: 'Date Coverage',
|
||||||
labelText: 'Date of Joining',
|
labelText: 'Date Coverage',
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding: EdgeInsets.symmetric(
|
||||||
vertical: 10, horizontal: 15),
|
vertical: 10, horizontal: 15),
|
||||||
),
|
),
|
||||||
@ -1658,7 +1741,8 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
|
|
||||||
String? gpaPolicyName = item['Policy_Name'];
|
String? gpaPolicyName = item['Policy_Name'];
|
||||||
String? gpaECardDownload = item['eCardDownload'];
|
String? gpaECardDownload = item['eCardDownload'];
|
||||||
String? gpaSumInsured;
|
String? client_policy_id = item['ClientPolicyId'];
|
||||||
|
String? gpaSumInsured = item['si_value'];
|
||||||
List<dynamic> gpaMappedFamilyFloaters = [];
|
List<dynamic> gpaMappedFamilyFloaters = [];
|
||||||
|
|
||||||
if (item['mapped_family_floaters'] != null) {
|
if (item['mapped_family_floaters'] != null) {
|
||||||
@ -1669,11 +1753,11 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
.where((element) => element['is_value_exist'] == true)
|
.where((element) => element['is_value_exist'] == true)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (getTrueObjects.length > 0) {
|
// if (getTrueObjects.length > 0) {
|
||||||
gpaSumInsured = getTrueObjects[0]["data"]["basic_cover_si"];
|
// gpaSumInsured = getTrueObjects[0]["data"]["basic_cover_si"];
|
||||||
} else {
|
// } else {
|
||||||
gpaSumInsured = item['Policy_Terms']['sumInsured2'];
|
// gpaSumInsured = item['Policy_Terms']['sumInsured2'];
|
||||||
}
|
// }
|
||||||
|
|
||||||
int gpaOpenForEnrollment = int.parse(item['OpenForEnrollment']);
|
int gpaOpenForEnrollment = int.parse(item['OpenForEnrollment']);
|
||||||
List<Widget> familyFloaterContainers = [];
|
List<Widget> familyFloaterContainers = [];
|
||||||
@ -1762,7 +1846,9 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor: SystemMouseCursors.click,
|
cursor: SystemMouseCursors.click,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
|
await getSelfEmployeeProfile(
|
||||||
|
token, client_policy_id);
|
||||||
openSelfForm('View');
|
openSelfForm('View');
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -1907,6 +1993,7 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
print(item);
|
print(item);
|
||||||
setState(() {
|
setState(() {
|
||||||
gmcPolicyName = item['Policy_Name'];
|
gmcPolicyName = item['Policy_Name'];
|
||||||
|
gmc_client_policy_id = item['ClientPolicyId'];
|
||||||
gmcFloaterTextHeading = item['floter_text_heading'];
|
gmcFloaterTextHeading = item['floter_text_heading'];
|
||||||
gmcFloaterTextDescription = item['floter_text_description'];
|
gmcFloaterTextDescription = item['floter_text_description'];
|
||||||
gmcNotes = item['notes'];
|
gmcNotes = item['notes'];
|
||||||
@ -2059,8 +2146,10 @@ class _empDetailsState extends State<empDetails> {
|
|||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor: SystemMouseCursors.click,
|
cursor: SystemMouseCursors.click,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
if (floaterData['relationship'] == 'Self') {
|
if (floaterData['relationship'] == 'Self') {
|
||||||
|
await getSelfEmployeeProfile(
|
||||||
|
token, gmc_client_policy_id);
|
||||||
openSelfForm('View');
|
openSelfForm('View');
|
||||||
} else {
|
} else {
|
||||||
openForm(
|
openForm(
|
||||||
|
|||||||
39
lib/empReview.dart
Normal file → Executable file
@ -28,6 +28,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
late ApiService apiService;
|
late ApiService apiService;
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
bool isChecked = false;
|
bool isChecked = false;
|
||||||
|
bool login_by_hr = false;
|
||||||
bool topUpSiIsChecked = false; // Declare the _isSwitched variable here
|
bool topUpSiIsChecked = false; // Declare the _isSwitched variable here
|
||||||
bool topUpParentIsChecked = false; // Declare the _isSwitched variable here
|
bool topUpParentIsChecked = false; // Declare the _isSwitched variable here
|
||||||
bool addOnsDependentIsChecked =
|
bool addOnsDependentIsChecked =
|
||||||
@ -310,8 +311,19 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
empClientBranchId == null) {
|
empClientBranchId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
if (prefs.containsKey('hrtoken')) {
|
||||||
|
setState(() {
|
||||||
|
login_by_hr = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
final response = await apiService.getGpaEmpPolicyDetailsToApi(
|
final response = await apiService.getGpaEmpPolicyDetailsToApi(
|
||||||
empPrimaryId, empCodeString!, client_id!, 'GPA', empClientBranchId!);
|
empPrimaryId,
|
||||||
|
empCodeString!,
|
||||||
|
client_id!,
|
||||||
|
'GPA',
|
||||||
|
empClientBranchId!,
|
||||||
|
login_by_hr);
|
||||||
|
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -339,8 +351,19 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
empClientBranchId == null) {
|
empClientBranchId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
if (prefs.containsKey('hrtoken')) {
|
||||||
|
setState(() {
|
||||||
|
login_by_hr = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
final response = await apiService.getGmcEmpPolicyDetailsToApi(
|
final response = await apiService.getGmcEmpPolicyDetailsToApi(
|
||||||
empPrimaryId, empCodeString!, client_id!, 'GMC', empClientBranchId!);
|
empPrimaryId,
|
||||||
|
empCodeString!,
|
||||||
|
client_id!,
|
||||||
|
'GMC',
|
||||||
|
empClientBranchId!,
|
||||||
|
login_by_hr);
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
setState(() {
|
setState(() {
|
||||||
gmcPolicies = response['data'];
|
gmcPolicies = response['data'];
|
||||||
@ -2554,7 +2577,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
String? gpaPolicyName = item['Policy_Name'];
|
String? gpaPolicyName = item['Policy_Name'];
|
||||||
String? gpaPolicyType = item['type'];
|
String? gpaPolicyType = item['type'];
|
||||||
String? gpaECardDownload = item['eCardDownload'];
|
String? gpaECardDownload = item['eCardDownload'];
|
||||||
String? gpaSumInsured;
|
String? gpaSumInsured = item['si_value'];
|
||||||
List<dynamic> gpaMappedFamilyFloaters = [];
|
List<dynamic> gpaMappedFamilyFloaters = [];
|
||||||
|
|
||||||
if (item['mapped_family_floaters'] != null) {
|
if (item['mapped_family_floaters'] != null) {
|
||||||
@ -2565,11 +2588,11 @@ class _empReviewDetailsState extends State<empReviewDetails> {
|
|||||||
.where((element) => element['is_value_exist'] == true)
|
.where((element) => element['is_value_exist'] == true)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (getTrueObjects.length > 0) {
|
// if (getTrueObjects.length > 0) {
|
||||||
gpaSumInsured = getTrueObjects[0]["data"]["basic_cover_si"];
|
// gpaSumInsured = getTrueObjects[0]["data"]["basic_cover_si"];
|
||||||
} else {
|
// } else {
|
||||||
gpaSumInsured = item['Policy_Terms']['sumInsured2'];
|
// gpaSumInsured = item['Policy_Terms']['sumInsured2'];
|
||||||
}
|
// }
|
||||||
|
|
||||||
int gpaOpenForEnrollment = int.parse(item['OpenForEnrollment']);
|
int gpaOpenForEnrollment = int.parse(item['OpenForEnrollment']);
|
||||||
List<Widget> familyFloaterContainers = [];
|
List<Widget> familyFloaterContainers = [];
|
||||||
|
|||||||
0
lib/excel_verification.dart
Normal file → Executable file
0
lib/firebase-config.dart
Normal file → Executable file
0
lib/home.dart
Normal file → Executable file
991
lib/hrDashboard.dart
Normal file → Executable file
0
lib/hrHome.dart
Normal file → Executable file
407
lib/hrLogin.dart
Normal file → Executable file
@ -13,6 +13,8 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:flutter_animated_button/flutter_animated_button.dart';
|
import 'package:flutter_animated_button/flutter_animated_button.dart';
|
||||||
|
|
||||||
|
import 'email_verify.dart';
|
||||||
|
|
||||||
class MyHrLogin extends StatefulWidget {
|
class MyHrLogin extends StatefulWidget {
|
||||||
const MyHrLogin({Key? key});
|
const MyHrLogin({Key? key});
|
||||||
|
|
||||||
@ -21,46 +23,53 @@ class MyHrLogin extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MyPhoneState extends State<MyHrLogin> {
|
class _MyPhoneState extends State<MyHrLogin> {
|
||||||
|
final TextEditingController emailController = TextEditingController();
|
||||||
TextEditingController countryController = TextEditingController();
|
TextEditingController countryController = TextEditingController();
|
||||||
TextEditingController mobileController = TextEditingController();
|
TextEditingController mobileController = TextEditingController();
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
bool _isCheckingToken = false;
|
||||||
|
dynamic empMobileNo;
|
||||||
|
dynamic empEmailid;
|
||||||
|
|
||||||
final FirebaseAuth _auth = FirebaseAuth.instance;
|
final FirebaseAuth _auth = FirebaseAuth.instance;
|
||||||
|
|
||||||
late String _verificationId;
|
late String _verificationId;
|
||||||
int? _resendToken;
|
int? _resendToken;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
bool isEmailFieldVisible = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
countryController.text = "+91";
|
countryController.text = "+91";
|
||||||
super.initState();
|
super.initState();
|
||||||
checkTokenAvailability();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> checkTokenAvailability() async {
|
void toggleField() {
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
setState(() {
|
||||||
final String? hrtoken = prefs.getString('hrtoken');
|
isEmailFieldVisible = !isEmailFieldVisible;
|
||||||
|
});
|
||||||
if (hrtoken != null && hrtoken.isNotEmpty) {
|
|
||||||
// Token available, navigate to home page
|
|
||||||
Navigator.pushReplacementNamed(context, 'hrDashboard',
|
|
||||||
arguments: {'mobile': ''});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleLoginType() {
|
Future<void> verifyMobileAndEmailNumber() async {
|
||||||
Navigator.pushNamed(context, 'phone'); // Navigate to another page
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> verifyMobileNumber() async {
|
|
||||||
try {
|
try {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
});
|
});
|
||||||
var enteredMobileNumber = mobileController.text;
|
|
||||||
|
// Determine the API and the payload based on the visible field
|
||||||
|
String apiEndpoint = isEmailFieldVisible
|
||||||
|
? Environment.apiUrl + 'verifyHrWithEmail'
|
||||||
|
: Environment.apiUrl + 'verifyHrWithMobileNumber';
|
||||||
|
|
||||||
|
Map<String, dynamic> payload = isEmailFieldVisible
|
||||||
|
? {'email': emailController.text}
|
||||||
|
: {'mobile_no': mobileController.text};
|
||||||
|
|
||||||
|
// var enteredMobileNumber = mobileController.text;
|
||||||
final response = await http.post(
|
final response = await http.post(
|
||||||
Uri.parse(Environment.apiUrl + 'verifyHrWithMobileNumber'),
|
Uri.parse(apiEndpoint),
|
||||||
body: json.encode({'mobile_number': enteredMobileNumber}),
|
body: json.encode(payload),
|
||||||
headers: {
|
headers: {
|
||||||
HttpHeaders.contentTypeHeader: 'application/json',
|
HttpHeaders.contentTypeHeader: 'application/json',
|
||||||
},
|
},
|
||||||
@ -71,10 +80,29 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
bool userVerification = data['data']['user_verification'];
|
bool userVerification = data['data']['user_verification'];
|
||||||
String message = data['data']['message'];
|
String message = data['data']['message'];
|
||||||
if (userVerification) {
|
if (userVerification) {
|
||||||
|
final SharedPreferences prefs =
|
||||||
|
await SharedPreferences.getInstance();
|
||||||
|
// var enteredMobileNumber = mobileController.text;
|
||||||
|
// prefs.setString('empMobileNo', enteredMobileNumber);
|
||||||
|
if (isEmailFieldVisible) {
|
||||||
|
print('isEmailFieldVisible $isEmailFieldVisible');
|
||||||
|
prefs.setString('empEmail', emailController.text);
|
||||||
|
print('${emailController.text}');
|
||||||
|
ToastHelper.showSuccessToast(
|
||||||
|
context, 'Verification code sent to ${emailController.text}');
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => MyEmailVerify(
|
||||||
|
email: emailController.text, // Pass the phone number
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
_verifyPhoneNumber();
|
_verifyPhoneNumber();
|
||||||
|
}
|
||||||
|
|
||||||
// ToastHelper.showSuccessToast(context, message);
|
// ToastHelper.showSuccessToast(context, message);
|
||||||
// Navigator.pushNamed(context, 'hrVerify',
|
|
||||||
// arguments: enteredMobileNumber);
|
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
@ -86,15 +114,16 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
ToastHelper.showErrorToast(context, 'Failed to verify mobile number');
|
ToastHelper.showErrorToast(context, 'Something went wrong');
|
||||||
throw Exception('Failed to verify mobile number');
|
throw Exception('Failed to verify mobile number');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
print('Error: $e');
|
|
||||||
ToastHelper.showErrorToast(context, 'Something went wrong');
|
ToastHelper.showErrorToast(context, 'Something went wrong');
|
||||||
|
print('Error: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,30 +136,49 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
timeout: const Duration(seconds: 60),
|
timeout: const Duration(seconds: 60),
|
||||||
verificationCompleted: (PhoneAuthCredential credential) async {
|
verificationCompleted: (PhoneAuthCredential credential) async {
|
||||||
await _auth.signInWithCredential(credential);
|
await _auth.signInWithCredential(credential);
|
||||||
ToastHelper.showSuccessToast(context, 'Verified Successfully!');
|
// ToastHelper.showSuccessToast(context, 'Verified Successfully!');
|
||||||
setState(() {
|
// setState(() {
|
||||||
_isLoading = false;
|
// _isLoading = false;
|
||||||
});
|
// });
|
||||||
},
|
},
|
||||||
verificationFailed: (FirebaseAuthException e) {
|
verificationFailed: (FirebaseAuthException e) {
|
||||||
ToastHelper.showSuccessToast(context, 'Verification Failed!');
|
print('Verification Failed: ${e.code} - ${e.message}');
|
||||||
if (e.code == 'invalid-phone-number') {
|
String errorMessage;
|
||||||
print('The provided phone number is not valid.');
|
if (e.code == 'invalid-app-credential') {
|
||||||
|
errorMessage = 'Invalid Credential. Please try again.';
|
||||||
|
} else if (e.code == 'invalid-phone-number') {
|
||||||
|
errorMessage = 'The provided phone number is not valid.';
|
||||||
|
} else if (e.code == 'too-many-requests') {
|
||||||
|
errorMessage = 'Too many requests. Try again later.';
|
||||||
|
} else {
|
||||||
|
errorMessage = 'Verification Failed: ${e.message}';
|
||||||
}
|
}
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(errorMessage),
|
||||||
|
duration: Duration(seconds: 2),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
ToastHelper.showSuccessToast(context, errorMessage);
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
codeSent: (String verificationId, int? resendToken) {
|
codeSent: (String verificationId, int? resendToken) async {
|
||||||
setState(() {
|
setState(() {
|
||||||
_verificationId = verificationId;
|
_verificationId = verificationId;
|
||||||
_resendToken = resendToken;
|
_resendToken = resendToken;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// When getting the verificationId
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
prefs.setString('verificationId', _verificationId);
|
||||||
|
|
||||||
|
|
||||||
ToastHelper.showSuccessToast(
|
ToastHelper.showSuccessToast(
|
||||||
context, 'Verification code sent to ${enteredMobileNumber}');
|
context, 'Verification code sent to ${enteredMobileNumber}');
|
||||||
setState(() {
|
|
||||||
_isLoading = false;
|
|
||||||
});
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
@ -142,11 +190,16 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
codeAutoRetrievalTimeout: (String verificationId) {
|
codeAutoRetrievalTimeout: (String verificationId) async{
|
||||||
setState(() {
|
setState(() {
|
||||||
_verificationId = verificationId;
|
_verificationId = verificationId;
|
||||||
});
|
});
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
await prefs.setString('verificationId', verificationId);
|
||||||
ToastHelper.showSuccessToast(context, 'Code auto-retrieval timed out.');
|
ToastHelper.showSuccessToast(context, 'Code auto-retrieval timed out.');
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
@ -168,7 +221,9 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
print('The provided phone number is not valid.');
|
print('The provided phone number is not valid.');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
codeSent: (String verificationId, int? resendToken) {
|
codeSent: (String verificationId, int? resendToken) async{
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
await prefs.setString('verificationId', verificationId);
|
||||||
setState(() {
|
setState(() {
|
||||||
_verificationId = verificationId;
|
_verificationId = verificationId;
|
||||||
_resendToken = resendToken;
|
_resendToken = resendToken;
|
||||||
@ -187,7 +242,9 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
codeAutoRetrievalTimeout: (String verificationId) {
|
codeAutoRetrievalTimeout: (String verificationId) async{
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
await prefs.setString('verificationId', verificationId);
|
||||||
setState(() {
|
setState(() {
|
||||||
_verificationId = verificationId;
|
_verificationId = verificationId;
|
||||||
});
|
});
|
||||||
@ -254,7 +311,7 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
// Add your navigation logic here
|
// Add your navigation logic here
|
||||||
// For example, you can use Navigator.push to navigate to another page
|
// For example, you can use Navigator.push to navigate to another page
|
||||||
Navigator.pushNamed(context, 'phone');
|
Navigator.pushNamed(context, 'hrLogin');
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@ -388,41 +445,41 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
!Responsive.isTablet(context))
|
!Responsive.isTablet(context))
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
// Expanded(
|
||||||
flex: 4,
|
// flex: 4,
|
||||||
child: Align(
|
// child: Align(
|
||||||
alignment: Alignment.centerLeft,
|
// alignment: Alignment.centerLeft,
|
||||||
child: AnimatedButton(
|
// child: AnimatedButton(
|
||||||
animatedOn:
|
// animatedOn:
|
||||||
AnimatedOn.onHover,
|
// AnimatedOn.onHover,
|
||||||
onPress: () {
|
// onPress: () {
|
||||||
Navigator.pushNamed(
|
// Navigator.pushNamed(
|
||||||
context, 'phone');
|
// context, 'phone');
|
||||||
},
|
// },
|
||||||
onChanges: (change) {},
|
// onChanges: (change) {},
|
||||||
height: 30,
|
// height: 30,
|
||||||
width: 150,
|
// width: 150,
|
||||||
text: 'Member Login',
|
// text: 'Member Login',
|
||||||
isReverse: true,
|
// isReverse: true,
|
||||||
selectedTextColor:
|
// selectedTextColor:
|
||||||
Colors.black,
|
// Colors.black,
|
||||||
transitionType: TransitionType
|
// transitionType: TransitionType
|
||||||
.RIGHT_CENTER_ROUNDER,
|
// .RIGHT_CENTER_ROUNDER,
|
||||||
textStyle:
|
// textStyle:
|
||||||
GoogleFonts.poppins(
|
// GoogleFonts.poppins(
|
||||||
fontSize: 16,
|
// fontSize: 16,
|
||||||
letterSpacing: 0,
|
// letterSpacing: 0,
|
||||||
color: Color(0xFF00989E),
|
// color: Color(0xFF00989E),
|
||||||
fontWeight: FontWeight.w300,
|
// fontWeight: FontWeight.w300,
|
||||||
),
|
// ),
|
||||||
backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
selectedBackgroundColor:
|
// selectedBackgroundColor:
|
||||||
Color(0xFF00989E),
|
// Color(0xFF00989E),
|
||||||
borderColor:
|
// borderColor:
|
||||||
Color(0xFF00989E),
|
// Color(0xFF00989E),
|
||||||
borderWidth: 1,
|
// borderWidth: 1,
|
||||||
),
|
// ),
|
||||||
)),
|
// )),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 8,
|
flex: 8,
|
||||||
child: Align(
|
child: Align(
|
||||||
@ -453,37 +510,16 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
margin: Responsive.isDesktop(context)
|
margin: Responsive.isDesktop(context)
|
||||||
? EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
horizontal: 150)
|
horizontal: 150)
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
: EdgeInsets.symmetric(
|
||||||
child: Row(
|
horizontal: 0),
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Welcome to Nhance",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: Responsive.isDesktop(context)
|
|
||||||
? EdgeInsets.symmetric(
|
|
||||||
horizontal: 150)
|
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
"Login to manage the employee enrollment and overall health insurance programme of your organisation",
|
"Login with your ${isEmailFieldVisible ? 'email' : 'mobile number'} and OTP to review and enroll for exciting health benefits for you and your family",
|
||||||
style: TextStyle(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Color(0xFF000000)),
|
color: Color(0xFF000000)),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -495,32 +531,89 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
Container(
|
Column(
|
||||||
|
children: [
|
||||||
|
isEmailFieldVisible
|
||||||
|
? Container(
|
||||||
height: 55,
|
height: 55,
|
||||||
margin: Responsive.isDesktop(context)
|
margin: Responsive
|
||||||
|
.isDesktop(context)
|
||||||
? EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
horizontal: 150)
|
horizontal: 150)
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
: EdgeInsets.symmetric(
|
||||||
|
horizontal: 0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
width: 1, color: Colors.grey),
|
width: 1,
|
||||||
borderRadius: BorderRadius.circular(10),
|
color: Colors.grey),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(
|
||||||
|
10),
|
||||||
|
),
|
||||||
|
child: TextFormField(
|
||||||
|
controller:
|
||||||
|
emailController,
|
||||||
|
keyboardType:
|
||||||
|
TextInputType
|
||||||
|
.emailAddress,
|
||||||
|
decoration:
|
||||||
|
InputDecoration(
|
||||||
|
border:
|
||||||
|
InputBorder.none,
|
||||||
|
hintText:
|
||||||
|
"Enter your email",
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets
|
||||||
|
.symmetric(
|
||||||
|
horizontal:
|
||||||
|
10),
|
||||||
|
),
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null ||
|
||||||
|
value.isEmpty) {
|
||||||
|
return 'Please enter your email';
|
||||||
|
}
|
||||||
|
if (!RegExp(
|
||||||
|
r'^[^@]+@[^@]+\.[^@]+')
|
||||||
|
.hasMatch(value)) {
|
||||||
|
return 'Please enter a valid email';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
height: 55,
|
||||||
|
margin: Responsive
|
||||||
|
.isDesktop(context)
|
||||||
|
? EdgeInsets.symmetric(
|
||||||
|
horizontal: 150)
|
||||||
|
: EdgeInsets.symmetric(
|
||||||
|
horizontal: 0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
width: 1,
|
||||||
|
color: Colors.grey),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(
|
||||||
|
10),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(width: 10),
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 40,
|
width: 40,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: countryController,
|
controller:
|
||||||
|
countryController,
|
||||||
keyboardType:
|
keyboardType:
|
||||||
TextInputType.number,
|
TextInputType
|
||||||
decoration: InputDecoration(
|
.number,
|
||||||
border: InputBorder.none,
|
decoration:
|
||||||
|
InputDecoration(
|
||||||
|
border:
|
||||||
|
InputBorder
|
||||||
|
.none,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -528,31 +621,40 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
"|",
|
"|",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 33,
|
fontSize: 33,
|
||||||
color: Colors.grey),
|
color:
|
||||||
),
|
Colors.grey),
|
||||||
SizedBox(
|
|
||||||
width: 10,
|
|
||||||
),
|
),
|
||||||
|
SizedBox(width: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: mobileController,
|
controller:
|
||||||
keyboardType: TextInputType.phone,
|
mobileController,
|
||||||
decoration: InputDecoration(
|
keyboardType:
|
||||||
border: InputBorder.none,
|
TextInputType
|
||||||
|
.phone,
|
||||||
|
decoration:
|
||||||
|
InputDecoration(
|
||||||
|
border:
|
||||||
|
InputBorder
|
||||||
|
.none,
|
||||||
hintText:
|
hintText:
|
||||||
"Enter your mobile number",
|
"Enter your mobile number",
|
||||||
),
|
),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null ||
|
if (value ==
|
||||||
value.isEmpty) {
|
null ||
|
||||||
|
value
|
||||||
|
.isEmpty) {
|
||||||
return 'Please enter your mobile number';
|
return 'Please enter your mobile number';
|
||||||
}
|
}
|
||||||
if (value.length != 10) {
|
if (value
|
||||||
|
.length !=
|
||||||
|
10) {
|
||||||
return 'Mobile number must be 10 digits';
|
return 'Mobile number must be 10 digits';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
inputFormatters: <TextInputFormatter>[
|
inputFormatters: [
|
||||||
FilteringTextInputFormatter
|
FilteringTextInputFormatter
|
||||||
.digitsOnly,
|
.digitsOnly,
|
||||||
LengthLimitingTextInputFormatter(
|
LengthLimitingTextInputFormatter(
|
||||||
@ -563,43 +665,76 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(height: 15),
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Container(
|
Container(
|
||||||
margin: Responsive.isDesktop(context)
|
margin:
|
||||||
|
Responsive.isDesktop(context)
|
||||||
? EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
horizontal: 150)
|
horizontal: 150)
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
: EdgeInsets.symmetric(
|
||||||
|
horizontal: 0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 45,
|
height: 45,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style:
|
||||||
backgroundColor: Color(0xFF00989E),
|
ElevatedButton.styleFrom(
|
||||||
shape: RoundedRectangleBorder(
|
backgroundColor:
|
||||||
|
Color(0xFF00989E),
|
||||||
|
shape:
|
||||||
|
RoundedRectangleBorder(
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(10),
|
BorderRadius.circular(
|
||||||
|
10),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: _isLoading
|
onPressed: _isLoading
|
||||||
? null
|
? null
|
||||||
: verifyMobileNumber,
|
: verifyMobileAndEmailNumber,
|
||||||
child: _isLoading
|
child: _isLoading
|
||||||
? CircularProgressIndicator(
|
? CircularProgressIndicator(
|
||||||
valueColor:
|
valueColor:
|
||||||
AlwaysStoppedAnimation<
|
AlwaysStoppedAnimation<
|
||||||
Color>(
|
Color>(
|
||||||
Color(0xFF00989E)),
|
Color(0xFF00989E),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
"Login With OTP",
|
isEmailFieldVisible
|
||||||
|
? "Login with Email OTP"
|
||||||
|
: "Login with Mobile OTP",
|
||||||
|
style: GoogleFonts
|
||||||
|
.poppins(
|
||||||
|
color: Color(
|
||||||
|
0xFFFFFFFF),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 15),
|
||||||
|
MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: toggleField,
|
||||||
|
child: Text(
|
||||||
|
isEmailFieldVisible
|
||||||
|
? "Login with Mobile No"
|
||||||
|
: "Login with Email",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xFFFFFFFF)),
|
color: Color(0xFF00989E),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: _size.width <= 1100 ? 0 : 0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: _size.width <= 1100 ? 0 : 0,
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: _size.width <= 1100 ? 0 : 0,
|
height: _size.width <= 1100 ? 0 : 0,
|
||||||
),
|
),
|
||||||
|
|||||||
40
lib/hrPolicyDetails.dart
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:nhancepolicy/customAppBar/customAppBar.dart';
|
import 'package:nhancepolicy/customAppBar/enrollmentAppBar.dart';
|
||||||
import 'package:nhancepolicy/excel_verification.dart';
|
import 'package:nhancepolicy/excel_verification.dart';
|
||||||
import 'package:nhancepolicy/models/environment.dart';
|
import 'package:nhancepolicy/models/environment.dart';
|
||||||
import 'package:nhancepolicy/service/api_service.dart';
|
import 'package:nhancepolicy/service/api_service.dart';
|
||||||
@ -66,9 +66,11 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _loadToken() async {
|
Future<void> _loadToken() async {
|
||||||
|
print('1');
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
final token = prefs.getString('hrtoken');
|
final token = prefs.getString('hrtoken');
|
||||||
if (token != null && token.isNotEmpty) {
|
if (token != null && token.isNotEmpty) {
|
||||||
|
print('2');
|
||||||
setState(() {
|
setState(() {
|
||||||
_token = token;
|
_token = token;
|
||||||
});
|
});
|
||||||
@ -84,11 +86,24 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _saveArgumentsDataToLocalStorage(argumentsData) async {
|
||||||
|
print('6');
|
||||||
|
print('argumentsData');
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
await prefs.setString('hrSelectArgumentsData', jsonEncode(argumentsData));
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> getPolicyDetails() async {
|
Future<void> getPolicyDetails() async {
|
||||||
|
print('3');
|
||||||
try {
|
try {
|
||||||
|
print('4');
|
||||||
setState(() {
|
setState(() {
|
||||||
if (argumentsData != null && argumentsData is Map<String, dynamic>) {
|
if (argumentsData != null && argumentsData is Map<String, dynamic>) {
|
||||||
|
print('5');
|
||||||
|
_saveArgumentsDataToLocalStorage(argumentsData);
|
||||||
|
print('7');
|
||||||
if (argumentsData['type'] == 'GPA') {
|
if (argumentsData['type'] == 'GPA') {
|
||||||
|
print('8');
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
clientPolicyId = argumentsData['client_policy_id'];
|
clientPolicyId = argumentsData['client_policy_id'];
|
||||||
clientId = argumentsData['client_id'];
|
clientId = argumentsData['client_id'];
|
||||||
@ -165,10 +180,12 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getEmployeeAndDependence(clintID, getPolicyNo) async {
|
Future<void> getEmployeeAndDependence(clintID, getPolicyNo) async {
|
||||||
|
print('9');
|
||||||
setState(() {
|
setState(() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
|
print('10');
|
||||||
final response = await apiService.getEmployeeAndDependenceToApi(
|
final response = await apiService.getEmployeeAndDependenceToApi(
|
||||||
clintID!, getPolicyNo!, empRefId!);
|
clintID!, getPolicyNo!, empRefId!);
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
@ -331,6 +348,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
print(arguments);
|
print(arguments);
|
||||||
if (arguments != null && arguments is Map<String, dynamic>) {
|
if (arguments != null && arguments is Map<String, dynamic>) {
|
||||||
argumentsData = arguments;
|
argumentsData = arguments;
|
||||||
|
print('argumentsData $argumentsData');
|
||||||
}
|
}
|
||||||
if (filteredData == []) {
|
if (filteredData == []) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -426,7 +444,12 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
cursor: SystemMouseCursors
|
cursor: SystemMouseCursors
|
||||||
.click,
|
.click,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
|
final prefs =
|
||||||
|
await SharedPreferences
|
||||||
|
.getInstance();
|
||||||
|
await prefs.remove(
|
||||||
|
'hrSelectArgumentsData');
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context,
|
context,
|
||||||
'hrDashboard');
|
'hrDashboard');
|
||||||
@ -755,12 +778,14 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
rowsPerPage: filteredData.length, // Adjust rows per page as needed
|
rowsPerPage: filteredData.length, // Adjust rows per page as needed
|
||||||
columns: [
|
columns: [
|
||||||
DataColumn(label: Text('Employee ID')),
|
DataColumn(label: Text('Employee ID')),
|
||||||
|
DataColumn(label: Text('TPA ID')),
|
||||||
DataColumn(label: Text('Name')),
|
DataColumn(label: Text('Name')),
|
||||||
DataColumn(label: Text('Relationship')),
|
DataColumn(label: Text('Relationship')),
|
||||||
DataColumn(label: Text('Date of Birth')),
|
DataColumn(label: Text('Date of Birth')),
|
||||||
DataColumn(label: Text('Gender')),
|
DataColumn(label: Text('Gender')),
|
||||||
DataColumn(label: Text('Mobile No')),
|
DataColumn(label: Text('Mobile No')),
|
||||||
DataColumn(label: Text('Date of Joining')),
|
// DataColumn(label: Text('Date of Joining')),
|
||||||
|
DataColumn(label: Text('Date Coverage')),
|
||||||
DataColumn(label: Text('Email')),
|
DataColumn(label: Text('Email')),
|
||||||
DataColumn(label: Text('SI')),
|
DataColumn(label: Text('SI')),
|
||||||
DataColumn(label: Text('Grade')),
|
DataColumn(label: Text('Grade')),
|
||||||
@ -792,7 +817,10 @@ class _DependenceDataSource0 extends DataTableSource {
|
|||||||
}
|
}
|
||||||
// Format date of birth to "July 10, 1996"
|
// Format date of birth to "July 10, 1996"
|
||||||
String dob = row['dob'] != null ? formatDateString(row['dob']) : 'N/A';
|
String dob = row['dob'] != null ? formatDateString(row['dob']) : 'N/A';
|
||||||
String doj = row['doj'] != null ? formatDateString(row['doj']) : 'N/A';
|
// String doj = row['doj'] != null ? formatDateString(row['doj']) : 'N/A';
|
||||||
|
String dateCoverage = row['date_coverage'] != null
|
||||||
|
? formatDateString(row['date_coverage'])
|
||||||
|
: 'N/A';
|
||||||
|
|
||||||
return DataRow(
|
return DataRow(
|
||||||
color: MaterialStateColor.resolveWith(
|
color: MaterialStateColor.resolveWith(
|
||||||
@ -804,12 +832,14 @@ class _DependenceDataSource0 extends DataTableSource {
|
|||||||
? () => _navigateToAnotherPage(row)
|
? () => _navigateToAnotherPage(row)
|
||||||
: null, // Navigation only for 'Self' rows
|
: null, // Navigation only for 'Self' rows
|
||||||
),
|
),
|
||||||
|
DataCell(Text(row['tpa_id'].toString(), style: textStyle)),
|
||||||
DataCell(Text(row['name'].toString(), style: textStyle)),
|
DataCell(Text(row['name'].toString(), style: textStyle)),
|
||||||
DataCell(Text(row['relationship'].toString(), style: textStyle)),
|
DataCell(Text(row['relationship'].toString(), style: textStyle)),
|
||||||
DataCell(Text(dob, style: textStyle)),
|
DataCell(Text(dob, style: textStyle)),
|
||||||
DataCell(Text(row['gender'] ?? 'N/A', style: textStyle)),
|
DataCell(Text(row['gender'] ?? 'N/A', style: textStyle)),
|
||||||
DataCell(Text(row['mobile'] ?? 'N/A', style: textStyle)),
|
DataCell(Text(row['mobile'] ?? 'N/A', style: textStyle)),
|
||||||
DataCell(Text(doj, style: textStyle)),
|
// DataCell(Text(doj, style: textStyle)),
|
||||||
|
DataCell(Text(dateCoverage, style: textStyle)),
|
||||||
DataCell(Text(row['email_corporate'] ?? 'N/A', style: textStyle)),
|
DataCell(Text(row['email_corporate'] ?? 'N/A', style: textStyle)),
|
||||||
DataCell(Text(row['basic_cover_si'] ?? 'N/A', style: textStyle)),
|
DataCell(Text(row['basic_cover_si'] ?? 'N/A', style: textStyle)),
|
||||||
DataCell(Text(row['grade'] ?? 'N/A', style: textStyle)),
|
DataCell(Text(row['grade'] ?? 'N/A', style: textStyle)),
|
||||||
|
|||||||
404
lib/hrVerify.dart
Normal file → Executable file
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
import 'package:nhancepolicy/customAppBar/toastHelper.dart';
|
||||||
import 'package:nhancepolicy/models/environment.dart';
|
import 'package:nhancepolicy/models/environment.dart';
|
||||||
|
import 'package:nhancepolicy/service/api_service.dart';
|
||||||
import 'package:pinput/pinput.dart';
|
import 'package:pinput/pinput.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
@ -32,30 +33,49 @@ class MyHrVerify extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MyVerifyState extends State<MyHrVerify> {
|
class _MyVerifyState extends State<MyHrVerify> {
|
||||||
|
TextEditingController countryController = TextEditingController();
|
||||||
|
late ApiService apiService;
|
||||||
TextEditingController _otpController = TextEditingController();
|
TextEditingController _otpController = TextEditingController();
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
late Timer _timer;
|
late Timer _timer;
|
||||||
int _secondsRemaining = 30;
|
int _secondsRemaining = 60;
|
||||||
bool _isTimerRunning = false;
|
bool _isTimerRunning = false;
|
||||||
dynamic _token;
|
|
||||||
|
dynamic enrollmentEmpClientBranchId;
|
||||||
|
dynamic enrollmentEmpCodeString;
|
||||||
|
dynamic enrollmentEmpPrimaryId;
|
||||||
|
dynamic enrollmentGpaEmpName;
|
||||||
|
dynamic enrollmentClient_id;
|
||||||
|
dynamic enrollmentEmp_status;
|
||||||
|
|
||||||
|
dynamic empClientBranchId;
|
||||||
dynamic empCodeString;
|
dynamic empCodeString;
|
||||||
dynamic empPrimaryId;
|
dynamic empPrimaryId;
|
||||||
dynamic gpaEmpName;
|
dynamic gpaEmpName;
|
||||||
dynamic client_id;
|
dynamic client_id;
|
||||||
|
dynamic emp_status;
|
||||||
|
|
||||||
|
dynamic _token;
|
||||||
|
dynamic _postToken;
|
||||||
dynamic clientName;
|
dynamic clientName;
|
||||||
dynamic clientLogo;
|
dynamic clientLogo;
|
||||||
dynamic empRefId;
|
|
||||||
|
|
||||||
|
dynamic fCMToken;
|
||||||
late String verificationId;
|
late String verificationId;
|
||||||
late String mobileNumber;
|
late String mobileNumber;
|
||||||
final FirebaseAuth _auth = FirebaseAuth.instance;
|
final FirebaseAuth _auth = FirebaseAuth.instance;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
dynamic empMobileNo;
|
||||||
|
dynamic empEmailid;
|
||||||
|
|
||||||
late String _verificationId;
|
late String _verificationId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
checkTokenAvailability();
|
countryController.text = "+91";
|
||||||
|
apiService = ApiService(context);
|
||||||
|
// checkTokenAvailability();
|
||||||
verificationId = widget.verificationId;
|
verificationId = widget.verificationId;
|
||||||
mobileNumber = widget.mobileNumber;
|
mobileNumber = widget.mobileNumber;
|
||||||
print('Received verificationId: $verificationId');
|
print('Received verificationId: $verificationId');
|
||||||
@ -64,8 +84,19 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
// Handle the case where verificationId is not provided
|
// Handle the case where verificationId is not provided
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
// Start the timer when the widget is initialized
|
|
||||||
startTimer();
|
startTimer();
|
||||||
|
// Equivalent to componentDidMount
|
||||||
|
_auth.authStateChanges().listen((User? user) {
|
||||||
|
if (user != null) {
|
||||||
|
// If user is already signed in, log them out
|
||||||
|
logOutFirebase();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void logOutFirebase() async {
|
||||||
|
await _auth.signOut();
|
||||||
|
print('User signed out');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -74,6 +105,7 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void startTimer() {
|
void startTimer() {
|
||||||
_isTimerRunning = true;
|
_isTimerRunning = true;
|
||||||
_timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
|
_timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
|
||||||
@ -88,67 +120,12 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> checkTokenAvailability() async {
|
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
||||||
final String? hrtoken = prefs.getString('hrtoken');
|
|
||||||
|
|
||||||
if (hrtoken != null && hrtoken.isNotEmpty) {
|
|
||||||
// Token available, navigate to home page
|
|
||||||
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> resendOTP(String mobileNumber) async {
|
|
||||||
print(mobileNumber);
|
|
||||||
// Update the UI as needed
|
|
||||||
setState(() {
|
|
||||||
_secondsRemaining = 30;
|
|
||||||
_isTimerRunning = true;
|
|
||||||
});
|
|
||||||
startTimer();
|
|
||||||
try {
|
|
||||||
final response = await http.post(
|
|
||||||
Uri.parse(Environment.apiUrl + 'verifyHrWithMobileNumber'),
|
|
||||||
body: json.encode({'mobile_number': mobileNumber}),
|
|
||||||
headers: {
|
|
||||||
HttpHeaders.contentTypeHeader: 'application/json',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
// Handle successful response
|
|
||||||
ToastHelper.showSuccessToast(context, 'OTP resent successfully.');
|
|
||||||
// ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
// SnackBar(
|
|
||||||
// content: Text('OTP resent successfully.'),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
} else {
|
|
||||||
// Handle other response status codes
|
|
||||||
ToastHelper.showErrorToast(context, 'Failed to resend OTP');
|
|
||||||
throw Exception('Failed to resend OTP');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// Handle API call errors
|
|
||||||
print('Error: $e');
|
|
||||||
ToastHelper.showErrorToast(context, 'Something went wrong');
|
|
||||||
// ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
// SnackBar(
|
|
||||||
// content: Text('Failed to resend OTP. Please try again.'),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void generateToken(bool otpVerifyStatus) async {
|
void generateToken(bool otpVerifyStatus) async {
|
||||||
// Retrieve the passed mobile number value
|
|
||||||
// final String mobileNumber =
|
|
||||||
// ModalRoute.of(context)!.settings.arguments as String;
|
|
||||||
try {
|
try {
|
||||||
final response = await http.post(
|
final response = await http.post(
|
||||||
Uri.parse(Environment.apiUrl + 'getVerifiedHrData'),
|
Uri.parse(Environment.apiUrl + 'getVerifiedHrData'),
|
||||||
body: json.encode({
|
body: json.encode({
|
||||||
'mobile_number': mobileNumber,
|
'mobile_no': mobileNumber,
|
||||||
'otp_verification': otpVerifyStatus
|
'otp_verification': otpVerifyStatus
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
@ -157,23 +134,70 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
Map<String, dynamic> data = json.decode(response.body);
|
Map<String, dynamic> data = json.decode(response.body);
|
||||||
|
print('data: $data');
|
||||||
_token = data['data'];
|
_token = data['data'];
|
||||||
print(data);
|
|
||||||
String status = data['status'];
|
String status = data['status'];
|
||||||
print(status);
|
|
||||||
if (status == 'success') {
|
// Directly access the post_enrollment data
|
||||||
|
Map<String, dynamic> post = data['post_enrollment'];
|
||||||
|
print('post: $post');
|
||||||
|
|
||||||
|
_postToken = post['data'];
|
||||||
|
String postStatus = post['status'];
|
||||||
|
|
||||||
|
if (postStatus == 'success') {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
postSuccessData(post, data);
|
||||||
|
} else if (status == 'success') {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
enrollmentSuccessData(data);
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
||||||
|
// Show a Snackbar if the OTP is invalid
|
||||||
|
print('Invalid OTP. Please try again');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
ToastHelper.showWarningToast(context, 'Something went wrong');
|
||||||
|
throw Exception('Failed to verify OTP');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
print('Error: $e');
|
||||||
|
ToastHelper.showWarningToast(context, 'Something went wrong');
|
||||||
|
// Show a Snackbar if there's an error while verifying OTP
|
||||||
|
print('Failed to verify OTP. Please try again.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void postSuccessData(post, data) async {
|
||||||
|
String status = data['status'];
|
||||||
|
String postStatus = post['status'];
|
||||||
|
|
||||||
|
if (postStatus == 'success') {
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
prefs.setString('hrtoken', data['data']);
|
prefs.setString('_postToken', post['data']);
|
||||||
|
|
||||||
// Decode the JWT token received from the API response
|
// Decode the JWT token received from the API response
|
||||||
Map<String, dynamic>? decodedToken = Jwt.parseJwt(data['data']);
|
Map<String, dynamic>? decodedToken = Jwt.parseJwt(post['data']);
|
||||||
print('decodedToken');
|
print('decodedToken : $decodedToken');
|
||||||
print(decodedToken);
|
empClientBranchId = decodedToken['ref_id'];
|
||||||
empRefId = decodedToken['ref_id'];
|
prefs.setString('empClientBranchId', empClientBranchId);
|
||||||
print('empRefId');
|
|
||||||
print(empRefId);
|
|
||||||
prefs.setString('empRefId', empRefId);
|
|
||||||
empCodeString = decodedToken['emp_code'].toString();
|
empCodeString = decodedToken['emp_code'].toString();
|
||||||
prefs.setString('empCode', empCodeString);
|
prefs.setString('empCode', empCodeString);
|
||||||
empPrimaryId = decodedToken['id'];
|
empPrimaryId = decodedToken['id'];
|
||||||
@ -182,78 +206,157 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
prefs.setString('gpaEmpName', gpaEmpName);
|
prefs.setString('gpaEmpName', gpaEmpName);
|
||||||
client_id = decodedToken['client_id'];
|
client_id = decodedToken['client_id'];
|
||||||
prefs.setString('client_id', client_id);
|
prefs.setString('client_id', client_id);
|
||||||
getClientLogoAndDetails();
|
emp_status = decodedToken['emp_status'];
|
||||||
|
prefs.setString('emp_status', emp_status);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == 'success') {
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
prefs.setString('enrollToken', data['data']);
|
||||||
|
|
||||||
|
// Decode the JWT token received from the API response
|
||||||
|
Map<String, dynamic>? decodedToken = Jwt.parseJwt(data['data']);
|
||||||
|
print('decodedToken : $decodedToken');
|
||||||
|
enrollmentEmpClientBranchId = decodedToken['ref_id'];
|
||||||
|
prefs.setString('enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
||||||
|
enrollmentEmpCodeString = decodedToken['emp_code'].toString();
|
||||||
|
prefs.setString('enrollmentEmpCodeString', enrollmentEmpCodeString);
|
||||||
|
enrollmentEmpPrimaryId = decodedToken['id'];
|
||||||
|
prefs.setString('enrollmentEmpPrimaryId', enrollmentEmpPrimaryId);
|
||||||
|
enrollmentGpaEmpName = decodedToken['name'].toString();
|
||||||
|
prefs.setString('enrollmentGpaEmpName', enrollmentGpaEmpName);
|
||||||
|
enrollmentClient_id = decodedToken['client_id'];
|
||||||
|
prefs.setString('enrollmentClient_id', enrollmentClient_id);
|
||||||
|
// enrollmentEmp_status = decodedToken['emp_status'];
|
||||||
|
// prefs.setString('enrollmentEmp_status', enrollmentEmp_status);
|
||||||
|
}
|
||||||
|
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
final _postToken = prefs.getString('_postToken');
|
||||||
|
|
||||||
|
if (_postToken != null && _postToken.isNotEmpty) {
|
||||||
|
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||||
|
// if (emp_status == 'enrolled' || emp_status == 'active') {
|
||||||
|
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
||||||
|
// } else {
|
||||||
|
// Navigator.pushReplacementNamed(context, 'empDetails');
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void enrollmentSuccessData(data) async {
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
prefs.setString('enrollToken', data['data']);
|
||||||
|
|
||||||
|
// Decode the JWT token received from the API response
|
||||||
|
Map<String, dynamic>? decodedToken = Jwt.parseJwt(data['data']);
|
||||||
|
print('decodedToken : $decodedToken');
|
||||||
|
enrollmentEmpClientBranchId = decodedToken['ref_id'];
|
||||||
|
prefs.setString('enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
||||||
|
enrollmentEmpCodeString = decodedToken['emp_code'].toString();
|
||||||
|
prefs.setString('enrollmentEmpCodeString', enrollmentEmpCodeString);
|
||||||
|
enrollmentEmpPrimaryId = decodedToken['id'];
|
||||||
|
prefs.setString('enrollmentEmpPrimaryId', enrollmentEmpPrimaryId);
|
||||||
|
enrollmentGpaEmpName = decodedToken['name'].toString();
|
||||||
|
prefs.setString('enrollmentGpaEmpName', enrollmentGpaEmpName);
|
||||||
|
enrollmentClient_id = decodedToken['client_id'];
|
||||||
|
prefs.setString('enrollmentClient_id', enrollmentClient_id);
|
||||||
|
// enrollmentEmp_status = decodedToken['emp_status'];
|
||||||
|
// prefs.setString('enrollmentEmp_status', enrollmentEmp_status);
|
||||||
|
|
||||||
print('Successfully Login');
|
print('Successfully Login');
|
||||||
final hrtoken = prefs.getString('hrtoken');
|
|
||||||
if (hrtoken != null && hrtoken.isNotEmpty) {
|
|
||||||
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
|
||||||
Navigator.pushNamed(context, 'hrDashboard');
|
|
||||||
} else {
|
|
||||||
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
|
|
||||||
// For now, let's navigate to the login screen
|
|
||||||
ToastHelper.showErrorToast(context, 'Session Out');
|
|
||||||
Navigator.pushReplacementNamed(context, 'hrLogin');
|
|
||||||
}
|
|
||||||
// Redirect to another page
|
// Redirect to another page
|
||||||
} else {
|
final enrollToken = prefs.getString('enrollToken');
|
||||||
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again.');
|
|
||||||
// Show a Snackbar if the OTP is invalid
|
if (enrollToken != null && enrollToken.isNotEmpty) {
|
||||||
// ScaffoldMessenger.of(context).showSnackBar(
|
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||||
// SnackBar(
|
// if (emp_status == 'enrolled' || emp_status == 'active') {
|
||||||
// content: Text('Invalid OTP. Please try again.'),
|
// Navigator.pushReplacementNamed(context, 'home');
|
||||||
// ),
|
// } else {
|
||||||
// );
|
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
||||||
}
|
// }
|
||||||
} else {
|
|
||||||
ToastHelper.showErrorToast(context, 'Failed to verify OTP');
|
|
||||||
throw Exception('Failed to verify OTP');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
print('Error: $e');
|
|
||||||
ToastHelper.showErrorToast(
|
|
||||||
context, 'Failed to verify OTP. Please try again.');
|
|
||||||
// Show a Snackbar if there's an error while verifying OTP
|
|
||||||
// ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
// SnackBar(
|
|
||||||
// content: Text('Failed to verify OTP. Please try again.'),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void verifyOTP(String otp) async {
|
void verifyOTP(String otp) async {
|
||||||
try {
|
try {
|
||||||
setState(() {
|
// setState(() {
|
||||||
_isLoading = true;
|
// _isLoading = true;
|
||||||
});
|
// });
|
||||||
PhoneAuthCredential credential = PhoneAuthProvider.credential(
|
// Later, in verify screen:
|
||||||
verificationId: verificationId,
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
dynamic verificationId = prefs.getString('verificationId');
|
||||||
|
|
||||||
|
final credential = PhoneAuthProvider.credential(
|
||||||
|
verificationId: verificationId, // Make sure this is up-to-date
|
||||||
smsCode: otp,
|
smsCode: otp,
|
||||||
);
|
);
|
||||||
|
|
||||||
await FirebaseAuth.instance
|
// final userCredential = await FirebaseAuth.instance.signInWithCredential(credential);
|
||||||
.signInWithCredential(credential)
|
// await FirebaseAuth.instance.signInWithCredential(credential);
|
||||||
.then((user) async {
|
|
||||||
if (user != null) {
|
// if (userCredential.user != null) {
|
||||||
// Handle successful verification
|
|
||||||
ToastHelper.showSuccessToast(context, 'Successfully Login...!');
|
|
||||||
bool otpVerifyStatus = true;
|
bool otpVerifyStatus = true;
|
||||||
generateToken(otpVerifyStatus);
|
generateToken(otpVerifyStatus);
|
||||||
|
// } else {
|
||||||
|
// ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again.');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// await FirebaseAuth.instance.signInWithCredential(credential).then((userCredential) async {
|
||||||
|
// if (userCredential.user != null) {
|
||||||
|
// bool otpVerifyStatus = true;
|
||||||
|
// generateToken(otpVerifyStatus);
|
||||||
|
// } else {
|
||||||
|
// setState(() {
|
||||||
|
// _isLoading = false;
|
||||||
|
// });
|
||||||
|
// ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
} on FirebaseAuthException catch (e) {
|
||||||
|
if (e.code == 'code-expired') {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text('OTP expired. Please request a new one.'),
|
||||||
|
duration: Duration(seconds: 2),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
ToastHelper.showErrorToast(context, 'OTP expired. Please request a new one.');
|
||||||
|
} else if (e.code == 'invalid-verification-code') {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text('Invalid OTP entered. Please try again.'),
|
||||||
|
duration: Duration(seconds: 2),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
ToastHelper.showErrorToast(context, 'Invalid OTP entered. Please try again.');
|
||||||
|
} else if (e.code == 'session-expired') {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text('Session expired. Try restarting the verification.'),
|
||||||
|
duration: Duration(seconds: 2),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
ToastHelper.showErrorToast(context, 'Session expired. Try restarting the verification.');
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
_isLoading = false;
|
SnackBar(
|
||||||
});
|
content: Text('Error: ${e.message}'),
|
||||||
ToastHelper.showErrorToast(context, 'Invalid OTP. Please try again');
|
duration: Duration(seconds: 2),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
ToastHelper.showErrorToast(context, 'Error: ${e.message}');
|
||||||
}
|
}
|
||||||
});
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setState(() {
|
// setState(() {
|
||||||
_isLoading = false;
|
// _isLoading = false;
|
||||||
});
|
// });
|
||||||
print('Error: $e');
|
print('Error: $e');
|
||||||
ToastHelper.showErrorToast(
|
ToastHelper.showErrorToast(context, 'Failed to verify OTP. Please try again.');
|
||||||
context, 'Failed to verify OTP. Please try again.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,53 +369,6 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
widget.onResendCode(widget.mobileNumber, widget.resendToken);
|
widget.onResendCode(widget.mobileNumber, widget.resendToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getClientLogoAndDetails() async {
|
|
||||||
var url = Uri.parse(Environment.apiUrl +
|
|
||||||
'getClientDetails?client_id=$client_id&client_branch_id=$empRefId');
|
|
||||||
try {
|
|
||||||
var response = await http.get(
|
|
||||||
url,
|
|
||||||
headers: {
|
|
||||||
'Authorization':
|
|
||||||
'Bearer $_token', // Add token to the Authorization header
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
// print('response.statusCode == 200');
|
|
||||||
Map<String, dynamic> data = json.decode(response.body);
|
|
||||||
// print(data);
|
|
||||||
|
|
||||||
if (data.containsKey('data')) {
|
|
||||||
dynamic clientDetails = data['data'];
|
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
||||||
prefs.setString('clientLogo', clientDetails['client']['client_logo']);
|
|
||||||
prefs.setString('clientName', clientDetails['client']['client_name']);
|
|
||||||
setState(() {
|
|
||||||
// dynamic clientDetails = data['data'];
|
|
||||||
// print(clientDetails);
|
|
||||||
clientName = clientDetails['client']['client_name'];
|
|
||||||
print(clientName);
|
|
||||||
clientLogo = clientDetails['client']['client_logo'];
|
|
||||||
print(clientLogo);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Handle other status messages if needed
|
|
||||||
// ToastHelper.showErrorToast(
|
|
||||||
// context, 'API request failed with status: ${data['status']}');
|
|
||||||
print('API request failed with status: ${data['status']}');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Handle other status codes
|
|
||||||
// ToastHelper.showErrorToast(
|
|
||||||
// context, 'Request failed with status: ${response.statusCode}');
|
|
||||||
print('Request failed with status: ${response.statusCode}');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// Handle exceptions
|
|
||||||
print('Exception occurred: $e');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// Retrieve the passed mobile number value
|
// Retrieve the passed mobile number value
|
||||||
|
|||||||
13
lib/main.dart
Normal file → Executable file
@ -16,15 +16,17 @@ import 'package:nhancepolicy/hrPolicyDetails.dart';
|
|||||||
import 'package:nhancepolicy/oldPolicy.dart';
|
import 'package:nhancepolicy/oldPolicy.dart';
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
|
|
||||||
|
import 'email_verify.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
// await dotenv.load(fileName: Environment.fileName);
|
// await dotenv.load(fileName: Environment.fileName);
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await Firebase.initializeApp(
|
await Firebase.initializeApp(
|
||||||
options: const FirebaseOptions(
|
options: const FirebaseOptions(
|
||||||
apiKey: 'AIzaSyAZdKJco4fe0e1HP1A249BVZzA3WMYb_3g',
|
apiKey: 'AIzaSyCSvDM5fG2blDBE69Cae3S-iYRwwNBy7xo',
|
||||||
appId: '1:508866094093:android:9969e766daa5b770366144',
|
appId: '1:1084115316849:web:ce28f12a426f285d6c6bd0',
|
||||||
messagingSenderId: '508866094093',
|
messagingSenderId: '1084115316849',
|
||||||
projectId: 'nhance-app-4fedb'));
|
projectId: 'nhance-ee8d1'));
|
||||||
await dotenv.load(fileName: Environment.fileName);
|
await dotenv.load(fileName: Environment.fileName);
|
||||||
|
|
||||||
runApp(MaterialApp(
|
runApp(MaterialApp(
|
||||||
@ -32,6 +34,9 @@ Future<void> main() async {
|
|||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
routes: {
|
routes: {
|
||||||
'phone': (context) => MyPhone(),
|
'phone': (context) => MyPhone(),
|
||||||
|
'mailVerify': (context) => MyEmailVerify(
|
||||||
|
email: '',
|
||||||
|
),
|
||||||
'verify': (context) => MyVerify(
|
'verify': (context) => MyVerify(
|
||||||
verificationId: '',
|
verificationId: '',
|
||||||
mobileNumber: '',
|
mobileNumber: '',
|
||||||
|
|||||||
0
lib/models/environment.dart
Normal file → Executable file
5
lib/models/platform_helper_mobile.dart
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
bool isMobilePlatform() {
|
||||||
|
return Platform.isAndroid || Platform.isIOS;
|
||||||
|
}
|
||||||
3
lib/models/platform_helper_other.dart
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
bool isMobilePlatform() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
0
lib/oldPolicy.dart
Normal file → Executable file
0
lib/phone.dart
Normal file → Executable file
0
lib/responsive.dart
Normal file → Executable file
44
lib/service/api_service.dart
Normal file → Executable file
@ -23,6 +23,10 @@ class ApiService {
|
|||||||
_hrtoken = hrprefs.getString('hrtoken') ?? '';
|
_hrtoken = hrprefs.getString('hrtoken') ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> getTokenLoadAPI(token) async {
|
||||||
|
_token = token;
|
||||||
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> getClientLogoAndDetailsToApi(
|
Future<Map<String, dynamic>> getClientLogoAndDetailsToApi(
|
||||||
String clientId, String empCode, String branchID) async {
|
String clientId, String empCode, String branchID) async {
|
||||||
print(_token);
|
print(_token);
|
||||||
@ -39,14 +43,18 @@ class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> getSelfEmployeeProfileToApi(
|
Future<Map<String, dynamic>> getSelfEmployeeProfileToApi(
|
||||||
token, String clientId, String empCode, String branchID) async {
|
token,
|
||||||
|
String clientId,
|
||||||
|
String empCode,
|
||||||
|
String branchID,
|
||||||
|
String client_policy_id) async {
|
||||||
print(_token);
|
print(_token);
|
||||||
_token = await token;
|
_token = await token;
|
||||||
if (_token == null) {
|
if (_token == null) {
|
||||||
await _initializeToken();
|
await _initializeToken();
|
||||||
}
|
}
|
||||||
final url = Uri.parse(
|
final url = Uri.parse(
|
||||||
'${Environment.apiUrl}getEmployeeProfile?emp_code=$empCode&client_id=$clientId&client_branch_id=$branchID');
|
'${Environment.apiUrl}getEmployeeProfile?emp_code=$empCode&client_id=$clientId&client_branch_id=$branchID&client_policy_id=$client_policy_id');
|
||||||
final headers = {
|
final headers = {
|
||||||
'Authorization': 'Bearer $_token' ?? '',
|
'Authorization': 'Bearer $_token' ?? '',
|
||||||
};
|
};
|
||||||
@ -67,14 +75,19 @@ class ApiService {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> getGpaEmpPolicyDetailsToApi(String empPrimaryId,
|
Future<Map<String, dynamic>> getGpaEmpPolicyDetailsToApi(
|
||||||
String empCode, String clientId, String policy, String branchID) async {
|
String empPrimaryId,
|
||||||
|
String empCode,
|
||||||
|
String clientId,
|
||||||
|
String policy,
|
||||||
|
String branchID,
|
||||||
|
login_by_hr) async {
|
||||||
print(_token);
|
print(_token);
|
||||||
if (_token == null) {
|
if (_token == null) {
|
||||||
await _initializeToken();
|
await _initializeToken();
|
||||||
}
|
}
|
||||||
final url = Uri.parse(
|
final url = Uri.parse(
|
||||||
'${Environment.apiUrl}getEmployeePolicy?id=$empPrimaryId&emp_code=$empCode&client_id=$clientId&policy=$policy&client_branch_id=$branchID');
|
'${Environment.apiUrl}getEmployeePolicy?id=$empPrimaryId&emp_code=$empCode&client_id=$clientId&policy=$policy&client_branch_id=$branchID&login_by_hr=$login_by_hr');
|
||||||
final headers = {
|
final headers = {
|
||||||
'Authorization': 'Bearer $_token' ?? '',
|
'Authorization': 'Bearer $_token' ?? '',
|
||||||
};
|
};
|
||||||
@ -82,14 +95,19 @@ class ApiService {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> getGmcEmpPolicyDetailsToApi(String empPrimaryId,
|
Future<Map<String, dynamic>> getGmcEmpPolicyDetailsToApi(
|
||||||
String empCode, String clientId, String policy, String branchID) async {
|
String empPrimaryId,
|
||||||
|
String empCode,
|
||||||
|
String clientId,
|
||||||
|
String policy,
|
||||||
|
String branchID,
|
||||||
|
login_by_hr) async {
|
||||||
print(_token);
|
print(_token);
|
||||||
if (_token == null) {
|
if (_token == null) {
|
||||||
await _initializeToken();
|
await _initializeToken();
|
||||||
}
|
}
|
||||||
final url = Uri.parse(
|
final url = Uri.parse(
|
||||||
'${Environment.apiUrl}getEmployeePolicy?id=$empPrimaryId&emp_code=$empCode&client_id=$clientId&policy=$policy&client_branch_id=$branchID');
|
'${Environment.apiUrl}getEmployeePolicy?id=$empPrimaryId&emp_code=$empCode&client_id=$clientId&policy=$policy&client_branch_id=$branchID&login_by_hr=$login_by_hr');
|
||||||
final headers = {
|
final headers = {
|
||||||
'Authorization': 'Bearer $_token' ?? '',
|
'Authorization': 'Bearer $_token' ?? '',
|
||||||
};
|
};
|
||||||
@ -394,15 +412,15 @@ class ApiService {
|
|||||||
//HR API STARTS
|
//HR API STARTS
|
||||||
|
|
||||||
Future<Map<String, dynamic>> getCashDepositDetailsToApi(
|
Future<Map<String, dynamic>> getCashDepositDetailsToApi(
|
||||||
String clintID, String empRefId) async {
|
String clintID, String empRefId, String token) async {
|
||||||
print(_hrtoken);
|
print(token);
|
||||||
if (_hrtoken == null) {
|
if (token == null) {
|
||||||
await _initializeToken();
|
await _initializeToken();
|
||||||
}
|
}
|
||||||
final url = Uri.parse(
|
final url = Uri.parse(
|
||||||
'${Environment.apiUrl}getCashDepositData?client_id=$clintID&client_branch_id=$empRefId');
|
'${Environment.apiUrl}getPolicyLevelEmployeeSummaryData?client_id=$clintID&client_branch_id=$empRefId');
|
||||||
final headers = {
|
final headers = {
|
||||||
'Authorization': 'Bearer $_hrtoken' ?? '',
|
'Authorization': 'Bearer $token' ?? '',
|
||||||
};
|
};
|
||||||
final response = await _makeGetRequest(url, headers);
|
final response = await _makeGetRequest(url, headers);
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
2
lib/verify.dart
Normal file → Executable file
@ -221,7 +221,7 @@ class _MyVerifyState extends State<MyVerify> {
|
|||||||
.then((user) async {
|
.then((user) async {
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
// Handle successful verification
|
// Handle successful verification
|
||||||
ToastHelper.showSuccessToast(context, 'Successfully Login...!');
|
// ToastHelper.showSuccessToast(context, 'Successfully Login...!');
|
||||||
bool otpVerifyStatus = true;
|
bool otpVerifyStatus = true;
|
||||||
generateToken(otpVerifyStatus);
|
generateToken(otpVerifyStatus);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||