UI_HR_Dashboard Tab Layout
This commit is contained in:
parent
745af9eb86
commit
a262d702c8
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,10 @@ import 'package:jwt_decode/jwt_decode.dart';
|
|||||||
import 'package:nhancepolicy/models/environment.dart';
|
import 'package:nhancepolicy/models/environment.dart';
|
||||||
import 'package:nhancepolicy/responsive.dart';
|
import 'package:nhancepolicy/responsive.dart';
|
||||||
import 'package:nhancepolicy/service/api_service.dart';
|
import 'package:nhancepolicy/service/api_service.dart';
|
||||||
|
import 'package:nhancepolicy/service/hrDashboardTabs/activePolicies.dart';
|
||||||
|
import 'package:nhancepolicy/service/hrDashboardTabs/cd.dart';
|
||||||
|
import 'package:nhancepolicy/service/hrDashboardTabs/claims.dart';
|
||||||
|
import 'package:nhancepolicy/service/hrDashboardTabs/preEnrollment.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'customAppBar/customAppBar.dart';
|
import 'customAppBar/customAppBar.dart';
|
||||||
@ -23,7 +27,8 @@ class hrDashboard extends StatefulWidget {
|
|||||||
State<hrDashboard> createState() => _hrDashboardState();
|
State<hrDashboard> createState() => _hrDashboardState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStateMixin {
|
class _hrDashboardState extends State<hrDashboard>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
late ApiService apiService;
|
late ApiService apiService;
|
||||||
late TabController _tabController;
|
late TabController _tabController;
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
@ -34,10 +39,16 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
dynamic enrollmentClient_id;
|
dynamic enrollmentClient_id;
|
||||||
dynamic policy_name;
|
dynamic policy_name;
|
||||||
dynamic getCardArrays = [];
|
dynamic getCardArrays = [];
|
||||||
|
List<dynamic> empAllowed_modules = [];
|
||||||
|
|
||||||
|
List<Widget> visibleTabs = [];
|
||||||
|
List<Widget> tabViews = [];
|
||||||
dynamic clientName;
|
dynamic clientName;
|
||||||
dynamic clientLogo;
|
dynamic clientLogo;
|
||||||
dynamic empClientBranchId;
|
dynamic empClientBranchId;
|
||||||
dynamic empHrId;
|
dynamic empHrId;
|
||||||
|
List<dynamic> enrollmentAllowed_modules = [];
|
||||||
|
List<Map<String, dynamic>> tabData = [];
|
||||||
dynamic enrollmentEmpClientBranchId;
|
dynamic enrollmentEmpClientBranchId;
|
||||||
dynamic enrollmentHrId;
|
dynamic enrollmentHrId;
|
||||||
dynamic empClientId;
|
dynamic empClientId;
|
||||||
@ -55,12 +66,12 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
super.initState();
|
super.initState();
|
||||||
apiService = ApiService(context); // Initialize ApiService here
|
apiService = ApiService(context); // Initialize ApiService here
|
||||||
_loadToken();
|
_loadToken();
|
||||||
_tabController = TabController(length: 4, vsync: this);
|
// _tabController = TabController(length: 4, vsync: this);
|
||||||
_tabController.addListener(() {
|
// _tabController.addListener(() {
|
||||||
setState(() {
|
// setState(() {
|
||||||
selectedIndex = _tabController.index;
|
// selectedIndex = _tabController.index;
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
// Future.delayed(Duration(seconds: 3), () {
|
// Future.delayed(Duration(seconds: 3), () {
|
||||||
// setState(() {
|
// setState(() {
|
||||||
// isLoading = false;
|
// isLoading = false;
|
||||||
@ -79,45 +90,169 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
final _postToken = prefs.getString('_postToken');
|
final _postToken = prefs.getString('_postToken');
|
||||||
final enrollToken = prefs.getString('enrollToken');
|
final enrollToken = prefs.getString('enrollToken');
|
||||||
|
|
||||||
|
if (enrollToken != null && enrollToken.isNotEmpty) {
|
||||||
|
|
||||||
|
|
||||||
if (_postToken != null && _postToken.isNotEmpty) {
|
|
||||||
Map<String, dynamic>? decodedToken = Jwt.parseJwt(_postToken);
|
|
||||||
empClientId = decodedToken['client_id'].toString();
|
|
||||||
empClientBranchId = prefs.getString('empClientBranchId');
|
|
||||||
empHrId = prefs.getString('empHrId');
|
|
||||||
print(empClientId);
|
|
||||||
print(empClientBranchId);
|
|
||||||
if (prefs.containsKey('clientLogo') && prefs.containsKey('clientName')) {
|
|
||||||
clientLogo = prefs.getString('clientLogo');
|
|
||||||
clientName = prefs.getString('clientName');
|
|
||||||
} else {
|
|
||||||
getClientLogoAndDetails(empClientBranchId,empClientId,_postToken);
|
|
||||||
}
|
|
||||||
getCashDepositDetails(empClientBranchId,empClientId,empHrId,_postToken);
|
|
||||||
} else if (enrollToken != null && enrollToken.isNotEmpty) {
|
|
||||||
Map<String, dynamic>? decodedToken = Jwt.parseJwt(enrollToken);
|
Map<String, dynamic>? decodedToken = Jwt.parseJwt(enrollToken);
|
||||||
enrollmentClient_id = decodedToken['client_id'].toString();
|
enrollmentClient_id = decodedToken['client_id'].toString();
|
||||||
enrollmentEmpClientBranchId = prefs.getString('enrollmentEmpClientBranchId');
|
enrollmentEmpClientBranchId =
|
||||||
|
prefs.getString('enrollmentEmpClientBranchId');
|
||||||
enrollmentHrId = prefs.getString('enrollmentHrId');
|
enrollmentHrId = prefs.getString('enrollmentHrId');
|
||||||
|
|
||||||
|
print("Pre decodedToken - $decodedToken");
|
||||||
|
print("Pre enrollmentClient_id - $enrollmentClient_id");
|
||||||
|
print("Pre enrollmentEmpClientBranchId - $enrollmentEmpClientBranchId");
|
||||||
|
print("Pre enrollmentHrId - $enrollmentHrId");
|
||||||
|
|
||||||
|
String? modulesString = prefs.getString('enrollmentAllowed_modules');
|
||||||
|
if (modulesString != null) {
|
||||||
|
enrollmentAllowed_modules = jsonDecode(modulesString);
|
||||||
|
print(
|
||||||
|
"enrollmentAllowed_modules - $enrollmentAllowed_modules"); // [2, 3, 4]
|
||||||
|
|
||||||
|
if (enrollmentAllowed_modules.contains(1)) {
|
||||||
|
tabData.add({
|
||||||
|
'icon': Icons.grid_view,
|
||||||
|
'label': 'Pre Enrollment',
|
||||||
|
});
|
||||||
|
print("getCardArrays.length = ${getCardArrays.length}");
|
||||||
|
|
||||||
|
tabViews.add(
|
||||||
|
PreEnrollment(
|
||||||
|
enrollmentClientId: enrollmentClient_id,
|
||||||
|
enrollmentClientBranchId: enrollmentEmpClientBranchId,
|
||||||
|
enrollmentHrId: enrollmentHrId,
|
||||||
|
enrollToken: enrollToken,
|
||||||
|
),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 400,
|
||||||
|
// child: Card(
|
||||||
|
// elevation: 5,
|
||||||
|
// color: Colors.white,
|
||||||
|
// child: SizedBox(
|
||||||
|
// height: 100,
|
||||||
|
// child: GridView.builder(
|
||||||
|
// itemCount: getCardArrays.length,
|
||||||
|
// gridDelegate:
|
||||||
|
// const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
// crossAxisCount: 4,
|
||||||
|
// crossAxisSpacing: 16,
|
||||||
|
// mainAxisSpacing: 0,
|
||||||
|
// childAspectRatio: 2,
|
||||||
|
// ),
|
||||||
|
// itemBuilder: (context, index) {
|
||||||
|
// print("tabIndc- $index");
|
||||||
|
// print("getCardArraystabIndc- $getCardArrays[index]");
|
||||||
|
// return buildPolicyCard(getCardArrays[index]);
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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');
|
||||||
} else {
|
} else {
|
||||||
getClientLogoAndDetails(enrollmentEmpClientBranchId,enrollmentClient_id,enrollToken);
|
getClientLogoAndDetails(
|
||||||
|
enrollmentEmpClientBranchId, enrollmentClient_id, enrollToken);
|
||||||
}
|
}
|
||||||
getCashDepositDetails(enrollmentEmpClientBranchId,enrollmentClient_id,enrollmentHrId,enrollToken);
|
getCashDepositDetails(enrollmentEmpClientBranchId, enrollmentClient_id,
|
||||||
} else {
|
enrollmentHrId, enrollToken);
|
||||||
// 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');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_postToken != null && _postToken.isNotEmpty) {
|
||||||
|
Map<String, dynamic>? postdecodedToken = Jwt.parseJwt(_postToken);
|
||||||
|
|
||||||
|
empClientId = postdecodedToken['client_id'].toString();
|
||||||
|
empClientBranchId = prefs.getString('empClientBranchId');
|
||||||
|
empHrId = prefs.getString('empHrId');
|
||||||
|
|
||||||
|
print('post empHrId- $empHrId');
|
||||||
|
print('postdecodedToken- $postdecodedToken');
|
||||||
|
print('post empClientId- $empClientId');
|
||||||
|
print('post empClientBranchId- $empClientBranchId');
|
||||||
|
|
||||||
|
print('allowed_modules');
|
||||||
|
String? modulesString = prefs.getString('empAllowed_modules');
|
||||||
|
|
||||||
|
String? enrollmodulesString =
|
||||||
|
prefs.getString('enrollmentAllowed_modules');
|
||||||
|
if (modulesString != null || enrollmodulesString != null) {
|
||||||
|
empAllowed_modules = jsonDecode(modulesString!);
|
||||||
|
enrollmentAllowed_modules = jsonDecode(enrollmodulesString!);
|
||||||
|
print("empAllowed_modules - $empAllowed_modules"); // [2, 3, 4]
|
||||||
|
print(
|
||||||
|
"enrollmentAllowed_modules - $enrollmentAllowed_modules"); // [2, 3, 4]
|
||||||
|
|
||||||
|
if (empAllowed_modules.contains(2)) {
|
||||||
|
print("visibleTabs.length2");
|
||||||
|
print(visibleTabs.length);
|
||||||
|
|
||||||
|
tabData.add({
|
||||||
|
'icon': Icons.verified_user,
|
||||||
|
'label': 'Active Policies',
|
||||||
|
});
|
||||||
|
tabViews.add(
|
||||||
|
ActivePolicies(
|
||||||
|
empClientId: empClientId,
|
||||||
|
empClientBranchId: empClientBranchId,
|
||||||
|
empHrId: empHrId,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (empAllowed_modules.contains(3)) {
|
||||||
|
print("visibleTabs.length3");
|
||||||
|
print(visibleTabs.length);
|
||||||
|
|
||||||
|
tabData.add({
|
||||||
|
'icon': Icons.desktop_windows,
|
||||||
|
'label': 'CD',
|
||||||
|
});
|
||||||
|
|
||||||
|
tabViews.add(CdPolicies(
|
||||||
|
empClientId: empClientId,
|
||||||
|
empClientBranchId: empClientBranchId,
|
||||||
|
empHrId: empHrId,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if (empAllowed_modules.contains(4)) {
|
||||||
|
tabData.add({
|
||||||
|
'icon': Icons.receipt_long,
|
||||||
|
'label': 'Claims',
|
||||||
|
});
|
||||||
|
tabViews.add(ClaimsPolicies(
|
||||||
|
empClientId: empClientId,
|
||||||
|
empClientBranchId: empClientBranchId,
|
||||||
|
empHrId: empHrId,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// getCashDepositDetails(
|
||||||
|
// empClientBranchId, empClientId, empHrId, _postToken);
|
||||||
|
if (prefs.containsKey('clientLogo') && prefs.containsKey('clientName')) {
|
||||||
|
clientLogo = prefs.getString('clientLogo');
|
||||||
|
clientName = prefs.getString('clientName');
|
||||||
|
} else {
|
||||||
|
getClientLogoAndDetails(empClientBranchId, empClientId, _postToken);
|
||||||
|
}
|
||||||
|
print("getCashDepositDetails");
|
||||||
|
}
|
||||||
|
|
||||||
|
_tabController = TabController(length: tabData.length, vsync: this);
|
||||||
|
_tabController.addListener(() {
|
||||||
|
setState(() {
|
||||||
|
selectedIndex = _tabController.index;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
setState(() {});
|
||||||
|
|
||||||
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getClientLogoAndDetails(clintBranchId,clintID,token) async {
|
Future<void> getClientLogoAndDetails(clintBranchId, clintID, token) async {
|
||||||
var url = Uri.parse(Environment.apiUrl +
|
var url = Uri.parse(Environment.apiUrl +
|
||||||
'getClientDetails?client_id=$clintID&client_branch_id=$clintBranchId');
|
'getClientDetails?client_id=$clintID&client_branch_id=$clintBranchId');
|
||||||
try {
|
try {
|
||||||
@ -164,10 +299,15 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getCashDepositDetails(clintBranchId,clintID,hr_id,token) async {
|
Future<void> getCashDepositDetails(
|
||||||
|
clintBranchId, clintID, hr_id, token) async {
|
||||||
print('IN');
|
print('IN');
|
||||||
|
print("clintBranchId -$clintBranchId");
|
||||||
|
print("clintID -$clintID");
|
||||||
|
print("hr_id -$hr_id");
|
||||||
|
print("token -$token");
|
||||||
|
|
||||||
isLoading = true;
|
// isLoading = true;
|
||||||
// setState(() {
|
// setState(() {
|
||||||
// _isLoading = true;
|
// _isLoading = true;
|
||||||
// });
|
// });
|
||||||
@ -175,8 +315,12 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
if (clintBranchId == null || clintID == null) {
|
if (clintBranchId == null || clintID == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final response =
|
final response = await apiService.getCashDepositDetailsToApi(
|
||||||
await apiService.getCashDepositDetailsToApi(clintID!, clintBranchId!,hr_id,token);
|
clintID!, clintBranchId!, hr_id, token);
|
||||||
|
|
||||||
|
// final response = await apiService.getCashDepositDetailsToApi(
|
||||||
|
// clintID!, clintBranchId!, hr_id, token);
|
||||||
|
print('IN1');
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -186,6 +330,8 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
print('getCardArrays');
|
print('getCardArrays');
|
||||||
print(getCardArrays);
|
print(getCardArrays);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
print('IN2');
|
||||||
} else {
|
} else {
|
||||||
print('API request failed with status');
|
print('API request failed with status');
|
||||||
}
|
}
|
||||||
@ -267,6 +413,9 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
double policyHeight = MediaQuery.of(context).size.height / 4.5;
|
double policyHeight = MediaQuery.of(context).size.height / 4.5;
|
||||||
double cardWidth = MediaQuery.of(context).size.width / 6;
|
double cardWidth = MediaQuery.of(context).size.width / 6;
|
||||||
|
|
||||||
|
print("visibleTabAll - $visibleTabs");
|
||||||
|
print("tabViewsAll - $tabViews");
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: CustomAppBar(),
|
appBar: CustomAppBar(),
|
||||||
body: Stack(children: [
|
body: Stack(children: [
|
||||||
@ -277,82 +426,81 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
color: Color(0xFFEFF3F6),
|
color: Color(0xFFEFF3F6),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Card(
|
Container(
|
||||||
elevation: 0,
|
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Container(
|
width: double.infinity,
|
||||||
width: double.infinity,
|
height: 75,
|
||||||
height: 75,
|
padding: Responsive.isDesktop(context)
|
||||||
padding: Responsive.isDesktop(context)
|
? EdgeInsets.only(
|
||||||
? EdgeInsets.only(
|
top: 10, bottom: 10, left: 20, right: 20)
|
||||||
top: 10, bottom: 10, left: 20, right: 20)
|
: EdgeInsets.only(
|
||||||
: EdgeInsets.only(
|
top: 12,
|
||||||
top: 12,
|
bottom: 12,
|
||||||
bottom: 12,
|
left: 10,
|
||||||
left: 10,
|
right: 10), // Add padding to the container
|
||||||
right: 10), // Add padding to the container
|
child: Row(
|
||||||
child: Row(
|
children: [
|
||||||
children: [
|
Expanded(
|
||||||
Expanded(
|
flex: 6,
|
||||||
flex: 6,
|
child: Container(
|
||||||
child: Container(
|
width: 150,
|
||||||
width: 150,
|
height: 150,
|
||||||
height: 150,
|
alignment: Alignment.centerLeft,
|
||||||
alignment: Alignment.centerLeft,
|
child: Image.network(
|
||||||
child: Image.network(
|
clientLogo ?? '',
|
||||||
clientLogo ?? '',
|
width: 80, // Set the width here
|
||||||
width: 80, // Set the width here
|
height: 80, // Set the height here
|
||||||
height: 80, // Set the height here
|
loadingBuilder: (BuildContext context,
|
||||||
loadingBuilder: (BuildContext context,
|
Widget child,
|
||||||
Widget child,
|
ImageChunkEvent? loadingProgress) {
|
||||||
ImageChunkEvent? loadingProgress) {
|
if (loadingProgress == null) return child;
|
||||||
if (loadingProgress == null) return child;
|
return Center(
|
||||||
return Center(
|
child: CircularProgressIndicator(
|
||||||
child: CircularProgressIndicator(
|
value:
|
||||||
value: loadingProgress
|
loadingProgress.expectedTotalBytes !=
|
||||||
.expectedTotalBytes !=
|
null
|
||||||
null
|
? loadingProgress
|
||||||
? loadingProgress
|
.cumulativeBytesLoaded /
|
||||||
.cumulativeBytesLoaded /
|
loadingProgress
|
||||||
loadingProgress
|
.expectedTotalBytes!
|
||||||
.expectedTotalBytes!
|
: null,
|
||||||
: null,
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
errorBuilder: (BuildContext context,
|
||||||
errorBuilder: (BuildContext context,
|
Object error, StackTrace? stackTrace) {
|
||||||
Object error, StackTrace? stackTrace) {
|
return Image.asset(
|
||||||
return Image.asset(
|
'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path
|
||||||
'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path
|
width: 80,
|
||||||
width: 80,
|
height: 80,
|
||||||
height: 80,
|
fit: BoxFit.cover,
|
||||||
fit: BoxFit.cover,
|
);
|
||||||
);
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
),
|
||||||
flex: 9,
|
Expanded(
|
||||||
child: Text(
|
flex: 9,
|
||||||
clientName ?? '',
|
child: Text(
|
||||||
textAlign: TextAlign.right,
|
clientName ?? '',
|
||||||
style: GoogleFonts.poppins(
|
textAlign: TextAlign.right,
|
||||||
fontSize:
|
style: GoogleFonts.poppins(
|
||||||
Responsive.isDesktop(context) ? 20 : 18,
|
fontSize:
|
||||||
fontWeight: FontWeight.w600,
|
Responsive.isDesktop(context) ? 20 : 18,
|
||||||
),
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(5),
|
padding: const EdgeInsets.all(5),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(0xFFC4E3E6), // 🔹 Background behind the TabBar
|
color: Color(
|
||||||
|
0xFFC4E3E6), // 🔹 Background behind the TabBar
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
border: Border.all(color: Colors.transparent),
|
border: Border.all(color: Colors.transparent),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
@ -366,7 +514,8 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
child: TabBar(
|
child: TabBar(
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
labelPadding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
|
labelPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 0, vertical: 0),
|
||||||
// indicator: BoxDecoration(
|
// indicator: BoxDecoration(
|
||||||
// color: const Color(0xFF00999E), // Selected tab background
|
// color: const Color(0xFF00999E), // Selected tab background
|
||||||
// borderRadius: BorderRadius.circular(12),
|
// borderRadius: BorderRadius.circular(12),
|
||||||
@ -382,47 +531,75 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
indicatorColor: Colors.transparent,
|
indicatorColor: Colors.transparent,
|
||||||
labelColor: Colors.white,
|
labelColor: Colors.white,
|
||||||
unselectedLabelColor: const Color(0xFF828282),
|
unselectedLabelColor: const Color(0xFF828282),
|
||||||
tabs: [
|
// tabs: visibleTabs,
|
||||||
CustomTab(icon: Icons.grid_view, label: 'Pre Enrollment', isSelected: selectedIndex == 0),
|
tabs: List.generate(tabData.length, (index) {
|
||||||
CustomTab(icon: Icons.verified_user, label: 'Active Policies', isSelected: selectedIndex == 1),
|
final data = tabData[index];
|
||||||
CustomTab(icon: Icons.desktop_windows, label: 'CD', isSelected: selectedIndex == 2),
|
return CustomTab(
|
||||||
CustomTab(icon: Icons.receipt_long, label: 'Claims', isSelected: selectedIndex == 3),
|
icon: data['icon'],
|
||||||
],
|
label: data['label'],
|
||||||
|
isSelected: selectedIndex == index,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
|
||||||
|
// tabs: [
|
||||||
|
// CustomTab(
|
||||||
|
// icon: Icons.grid_view,
|
||||||
|
// label: 'Pre Enrollment',
|
||||||
|
// isSelected: selectedIndex == 0),
|
||||||
|
// CustomTab(
|
||||||
|
// icon: Icons.verified_user,
|
||||||
|
// label: 'Active Policies',
|
||||||
|
// isSelected: selectedIndex == 1),
|
||||||
|
// CustomTab(
|
||||||
|
// icon: Icons.desktop_windows,
|
||||||
|
// label: 'CD',
|
||||||
|
// isSelected: selectedIndex == 2),
|
||||||
|
// CustomTab(
|
||||||
|
// icon: Icons.receipt_long,
|
||||||
|
// label: 'Claims',
|
||||||
|
// isSelected: selectedIndex == 3),
|
||||||
|
// ],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 16),
|
||||||
|
|
||||||
// Expanded TabBarView
|
// Expanded TabBarView
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 400, // Adjust height based on your layout
|
height: 500, // Adjust height based on your layout
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
children: [
|
children: tabViews,
|
||||||
// Pre Enrollment Tab
|
|
||||||
Card(
|
|
||||||
elevation: 5,
|
|
||||||
color: Colors.white,
|
|
||||||
child: Container(
|
|
||||||
child: GridView.builder(
|
|
||||||
itemCount: getCardArrays.length,
|
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 4, // Adjust for screen size (e.g., use 2 or 3 for tablets)
|
|
||||||
crossAxisSpacing: 16,
|
|
||||||
mainAxisSpacing: 0,
|
|
||||||
childAspectRatio: 2,
|
|
||||||
),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return buildPolicyCard(getCardArrays[index]);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
Center(child: Text("Active Policies")),
|
|
||||||
Center(child: Text("CD")),
|
|
||||||
Center(child: Text("Claims")),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// child: TabBarView(
|
||||||
|
// controller: _tabController,
|
||||||
|
// children: [
|
||||||
|
// // Pre Enrollment Tab
|
||||||
|
// Card(
|
||||||
|
// elevation: 5,
|
||||||
|
// color: Colors.white,
|
||||||
|
// child: Container(
|
||||||
|
// child: GridView.builder(
|
||||||
|
// itemCount: getCardArrays.length,
|
||||||
|
// gridDelegate:
|
||||||
|
// const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
// crossAxisCount:
|
||||||
|
// 4, // Adjust for screen size (e.g., use 2 or 3 for tablets)
|
||||||
|
// crossAxisSpacing: 16,
|
||||||
|
// mainAxisSpacing: 0,
|
||||||
|
// childAspectRatio: 2,
|
||||||
|
// ),
|
||||||
|
// itemBuilder: (context, index) {
|
||||||
|
// return buildPolicyCard(
|
||||||
|
// getCardArrays[index]);
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// )),
|
||||||
|
//
|
||||||
|
// Center(child: Text("Active Policies")),
|
||||||
|
// Center(child: Text("CD")),
|
||||||
|
// Center(child: Text("Claims")),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
),
|
),
|
||||||
// if (getCardArrays.length != 0)
|
// if (getCardArrays.length != 0)
|
||||||
// Card(
|
// Card(
|
||||||
@ -817,39 +994,46 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget buildPolicyCard(Map<String, dynamic> policy) {
|
Widget buildPolicyCard(Map<String, dynamic> policy) {
|
||||||
return Card(
|
print("buildPolicyCard - $policy");
|
||||||
elevation: 3,
|
return SizedBox(
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
height: 50,
|
||||||
child: Padding(
|
child: Card(
|
||||||
padding: const EdgeInsets.all(12),
|
elevation: 3,
|
||||||
child: Column(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Padding(
|
||||||
children: [
|
padding: const EdgeInsets.all(12),
|
||||||
Text(
|
child: Column(
|
||||||
policy['type'] ?? '',
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
style: const TextStyle(
|
children: [
|
||||||
fontWeight: FontWeight.w600,
|
Text(
|
||||||
fontSize: 14,
|
policy['type'] ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 4),
|
||||||
const SizedBox(height: 4),
|
Text(
|
||||||
Text(
|
policy['policy_name'] ?? '',
|
||||||
policy['policy_name'] ?? '',
|
style: const TextStyle(
|
||||||
style: const TextStyle(
|
fontSize: 12,
|
||||||
fontSize: 12,
|
color: Colors.grey,
|
||||||
color: Colors.grey,
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 16),
|
||||||
const SizedBox(height: 16),
|
Row(
|
||||||
Row(
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
children: [
|
||||||
children: [
|
_buildCountBox(
|
||||||
_buildCountBox(policy['membersCountOfDraft'].toString(), "Draft"),
|
policy['membersCountOfDraft'].toString(), "Draft"),
|
||||||
_buildCountBox(policy['membersCountOfEnrolled'].toString(), "Enrolled"),
|
_buildCountBox(
|
||||||
_buildCountBox(policy['totalMembersCount'].toString(), "Total"),
|
policy['membersCountOfEnrolled'].toString(), "Enrolled"),
|
||||||
],
|
_buildCountBox(
|
||||||
),
|
policy['totalMembersCount'].toString(), "Total"),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -872,11 +1056,11 @@ class _hrDashboardState extends State<hrDashboard> with SingleTickerProviderStat
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
Text(label, style: const TextStyle(fontSize: 12, color: Colors.black87)),
|
Text(label,
|
||||||
|
style: const TextStyle(fontSize: 12, color: Colors.black87)),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomTab extends StatelessWidget {
|
class CustomTab extends StatelessWidget {
|
||||||
@ -915,9 +1099,12 @@ class CustomTab extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
// mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Icon(icon, size: 18, color: isSelected ? Colors.white : const Color(0xFF828282)),
|
Icon(icon,
|
||||||
|
size: 18,
|
||||||
|
color: isSelected ? Colors.white : const Color(0xFF828282)),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Text(
|
Text(
|
||||||
label,
|
label,
|
||||||
@ -979,4 +1166,4 @@ class PolicyCard extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
287
lib/hrLogin.dart
287
lib/hrLogin.dart
@ -64,7 +64,7 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
|
|
||||||
Map<String, dynamic> payload = isEmailFieldVisible
|
Map<String, dynamic> payload = isEmailFieldVisible
|
||||||
? {'email': emailController.text}
|
? {'email': emailController.text}
|
||||||
: {'mobile_no': mobileController.text};
|
: {'mobile_number': mobileController.text};
|
||||||
|
|
||||||
// var enteredMobileNumber = mobileController.text;
|
// var enteredMobileNumber = mobileController.text;
|
||||||
final response = await http.post(
|
final response = await http.post(
|
||||||
@ -81,7 +81,7 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
String message = data['data']['message'];
|
String message = data['data']['message'];
|
||||||
if (userVerification) {
|
if (userVerification) {
|
||||||
final SharedPreferences prefs =
|
final SharedPreferences prefs =
|
||||||
await SharedPreferences.getInstance();
|
await SharedPreferences.getInstance();
|
||||||
// var enteredMobileNumber = mobileController.text;
|
// var enteredMobileNumber = mobileController.text;
|
||||||
// prefs.setString('empMobileNo', enteredMobileNumber);
|
// prefs.setString('empMobileNo', enteredMobileNumber);
|
||||||
if (isEmailFieldVisible) {
|
if (isEmailFieldVisible) {
|
||||||
@ -175,7 +175,6 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
prefs.setString('verificationId', _verificationId);
|
prefs.setString('verificationId', _verificationId);
|
||||||
|
|
||||||
|
|
||||||
ToastHelper.showSuccessToast(
|
ToastHelper.showSuccessToast(
|
||||||
context, 'Verification code sent to ${enteredMobileNumber}');
|
context, 'Verification code sent to ${enteredMobileNumber}');
|
||||||
|
|
||||||
@ -194,7 +193,7 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
codeAutoRetrievalTimeout: (String verificationId) async{
|
codeAutoRetrievalTimeout: (String verificationId) async {
|
||||||
setState(() {
|
setState(() {
|
||||||
_verificationId = verificationId;
|
_verificationId = verificationId;
|
||||||
});
|
});
|
||||||
@ -221,7 +220,7 @@ 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) async{
|
codeSent: (String verificationId, int? resendToken) async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.setString('verificationId', verificationId);
|
await prefs.setString('verificationId', verificationId);
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -242,7 +241,7 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
codeAutoRetrievalTimeout: (String verificationId) async{
|
codeAutoRetrievalTimeout: (String verificationId) async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.setString('verificationId', verificationId);
|
await prefs.setString('verificationId', verificationId);
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -509,12 +508,11 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
Container(
|
Container(
|
||||||
margin: Responsive.isDesktop(context)
|
margin: Responsive.isDesktop(context)
|
||||||
? EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
horizontal: 150)
|
horizontal: 150)
|
||||||
: EdgeInsets.symmetric(
|
: EdgeInsets.symmetric(horizontal: 0),
|
||||||
horizontal: 0),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -535,157 +533,138 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
children: [
|
children: [
|
||||||
isEmailFieldVisible
|
isEmailFieldVisible
|
||||||
? Container(
|
? Container(
|
||||||
height: 55,
|
height: 55,
|
||||||
margin: Responsive
|
margin: Responsive.isDesktop(
|
||||||
.isDesktop(context)
|
context)
|
||||||
? EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
horizontal: 150)
|
horizontal: 150)
|
||||||
: EdgeInsets.symmetric(
|
: EdgeInsets.symmetric(
|
||||||
horizontal: 0),
|
horizontal: 0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
width: 1,
|
width: 1,
|
||||||
color: Colors.grey),
|
color: Colors.grey),
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(
|
BorderRadius.circular(10),
|
||||||
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(
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 10),
|
|
||||||
SizedBox(
|
|
||||||
width: 40,
|
|
||||||
child: TextField(
|
|
||||||
controller:
|
|
||||||
countryController,
|
|
||||||
keyboardType:
|
|
||||||
TextInputType
|
|
||||||
.number,
|
|
||||||
decoration:
|
|
||||||
InputDecoration(
|
|
||||||
border:
|
|
||||||
InputBorder
|
|
||||||
.none,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"|",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 33,
|
|
||||||
color:
|
|
||||||
Colors.grey),
|
|
||||||
),
|
|
||||||
SizedBox(width: 10),
|
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller:
|
controller: emailController,
|
||||||
mobileController,
|
keyboardType: TextInputType
|
||||||
keyboardType:
|
.emailAddress,
|
||||||
TextInputType
|
decoration: InputDecoration(
|
||||||
.phone,
|
border: InputBorder.none,
|
||||||
decoration:
|
|
||||||
InputDecoration(
|
|
||||||
border:
|
|
||||||
InputBorder
|
|
||||||
.none,
|
|
||||||
hintText:
|
hintText:
|
||||||
"Enter your mobile number",
|
"Enter your email",
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
|
horizontal: 10),
|
||||||
),
|
),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value ==
|
if (value == null ||
|
||||||
null ||
|
value.isEmpty) {
|
||||||
value
|
return 'Please enter your email';
|
||||||
.isEmpty) {
|
|
||||||
return 'Please enter your mobile number';
|
|
||||||
}
|
}
|
||||||
if (value
|
if (!RegExp(
|
||||||
.length !=
|
r'^[^@]+@[^@]+\.[^@]+')
|
||||||
10) {
|
.hasMatch(value)) {
|
||||||
return 'Mobile number must be 10 digits';
|
return 'Please enter a valid email';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
inputFormatters: [
|
),
|
||||||
FilteringTextInputFormatter
|
)
|
||||||
.digitsOnly,
|
: Container(
|
||||||
LengthLimitingTextInputFormatter(
|
height: 55,
|
||||||
10),
|
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(
|
||||||
|
children: [
|
||||||
|
SizedBox(width: 10),
|
||||||
|
SizedBox(
|
||||||
|
width: 40,
|
||||||
|
child: TextField(
|
||||||
|
controller:
|
||||||
|
countryController,
|
||||||
|
keyboardType:
|
||||||
|
TextInputType
|
||||||
|
.number,
|
||||||
|
decoration:
|
||||||
|
InputDecoration(
|
||||||
|
border:
|
||||||
|
InputBorder.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"|",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 33,
|
||||||
|
color: Colors.grey),
|
||||||
|
),
|
||||||
|
SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller:
|
||||||
|
mobileController,
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.phone,
|
||||||
|
decoration:
|
||||||
|
InputDecoration(
|
||||||
|
border:
|
||||||
|
InputBorder.none,
|
||||||
|
hintText:
|
||||||
|
"Enter your mobile number",
|
||||||
|
),
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null ||
|
||||||
|
value.isEmpty) {
|
||||||
|
return 'Please enter your mobile number';
|
||||||
|
}
|
||||||
|
if (value.length !=
|
||||||
|
10) {
|
||||||
|
return 'Mobile number must be 10 digits';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter
|
||||||
|
.digitsOnly,
|
||||||
|
LengthLimitingTextInputFormatter(
|
||||||
|
10),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
Container(
|
Container(
|
||||||
margin:
|
margin: Responsive.isDesktop(context)
|
||||||
Responsive.isDesktop(context)
|
|
||||||
? EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
horizontal: 150)
|
horizontal: 150)
|
||||||
: EdgeInsets.symmetric(
|
: EdgeInsets.symmetric(
|
||||||
horizontal: 0),
|
horizontal: 0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 45,
|
height: 45,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style:
|
style: ElevatedButton.styleFrom(
|
||||||
ElevatedButton.styleFrom(
|
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Color(0xFF00989E),
|
Color(0xFF00989E),
|
||||||
shape:
|
shape: RoundedRectangleBorder(
|
||||||
RoundedRectangleBorder(
|
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(
|
BorderRadius.circular(10),
|
||||||
10),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: _isLoading
|
onPressed: _isLoading
|
||||||
@ -693,22 +672,22 @@ class _MyPhoneState extends State<MyHrLogin> {
|
|||||||
: verifyMobileAndEmailNumber,
|
: verifyMobileAndEmailNumber,
|
||||||
child: _isLoading
|
child: _isLoading
|
||||||
? CircularProgressIndicator(
|
? CircularProgressIndicator(
|
||||||
valueColor:
|
valueColor:
|
||||||
AlwaysStoppedAnimation<
|
AlwaysStoppedAnimation<
|
||||||
Color>(
|
Color>(
|
||||||
Color(0xFF00989E),
|
Color(0xFF00989E),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
isEmailFieldVisible
|
isEmailFieldVisible
|
||||||
? "Login with Email OTP"
|
? "Login with Email OTP"
|
||||||
: "Login with Mobile OTP",
|
: "Login with Mobile OTP",
|
||||||
style: GoogleFonts
|
style:
|
||||||
.poppins(
|
GoogleFonts.poppins(
|
||||||
color: Color(
|
color:
|
||||||
0xFFFFFFFF),
|
Color(0xFFFFFFFF),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -46,6 +46,8 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
dynamic enrollmentEmpPrimaryId;
|
dynamic enrollmentEmpPrimaryId;
|
||||||
dynamic enrollmentGpaEmpName;
|
dynamic enrollmentGpaEmpName;
|
||||||
dynamic enrollmentClient_id;
|
dynamic enrollmentClient_id;
|
||||||
|
dynamic enrollmentHrId;
|
||||||
|
List<dynamic> enrollmentAllowed_modules = [];
|
||||||
dynamic enrollmentEmp_status;
|
dynamic enrollmentEmp_status;
|
||||||
|
|
||||||
dynamic empClientBranchId;
|
dynamic empClientBranchId;
|
||||||
@ -53,6 +55,8 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
dynamic empPrimaryId;
|
dynamic empPrimaryId;
|
||||||
dynamic gpaEmpName;
|
dynamic gpaEmpName;
|
||||||
dynamic client_id;
|
dynamic client_id;
|
||||||
|
dynamic empHrId;
|
||||||
|
List<dynamic> empAllowed_modules = [];
|
||||||
dynamic emp_status;
|
dynamic emp_status;
|
||||||
|
|
||||||
dynamic _token;
|
dynamic _token;
|
||||||
@ -105,7 +109,6 @@ 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) {
|
||||||
@ -124,10 +127,8 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
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_no': mobileNumber,
|
{'mobile_no': mobileNumber, 'otp_verification': otpVerifyStatus}),
|
||||||
'otp_verification': otpVerifyStatus
|
|
||||||
}),
|
|
||||||
headers: {
|
headers: {
|
||||||
HttpHeaders.contentTypeHeader: 'application/json',
|
HttpHeaders.contentTypeHeader: 'application/json',
|
||||||
},
|
},
|
||||||
@ -195,7 +196,7 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
|
|
||||||
// Decode the JWT token received from the API response
|
// Decode the JWT token received from the API response
|
||||||
Map<String, dynamic>? decodedToken = Jwt.parseJwt(post['data']);
|
Map<String, dynamic>? decodedToken = Jwt.parseJwt(post['data']);
|
||||||
print('decodedToken : $decodedToken');
|
print('postdecodedToken : $decodedToken');
|
||||||
empClientBranchId = decodedToken['ref_id'];
|
empClientBranchId = decodedToken['ref_id'];
|
||||||
prefs.setString('empClientBranchId', empClientBranchId);
|
prefs.setString('empClientBranchId', empClientBranchId);
|
||||||
empCodeString = decodedToken['emp_code'].toString();
|
empCodeString = decodedToken['emp_code'].toString();
|
||||||
@ -206,9 +207,12 @@ 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);
|
||||||
|
empHrId = decodedToken['id'];
|
||||||
|
prefs.setString('empHrId', empHrId);
|
||||||
|
empAllowed_modules = decodedToken['allowed_modules'];
|
||||||
|
prefs.setString('empAllowed_modules', jsonEncode(empAllowed_modules));
|
||||||
emp_status = decodedToken['emp_status'];
|
emp_status = decodedToken['emp_status'];
|
||||||
prefs.setString('emp_status', emp_status);
|
prefs.setString('emp_status', emp_status);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == 'success') {
|
if (status == 'success') {
|
||||||
@ -219,7 +223,8 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
Map<String, dynamic>? decodedToken = Jwt.parseJwt(data['data']);
|
Map<String, dynamic>? decodedToken = Jwt.parseJwt(data['data']);
|
||||||
print('decodedToken : $decodedToken');
|
print('decodedToken : $decodedToken');
|
||||||
enrollmentEmpClientBranchId = decodedToken['ref_id'];
|
enrollmentEmpClientBranchId = decodedToken['ref_id'];
|
||||||
prefs.setString('enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
prefs.setString(
|
||||||
|
'enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
||||||
enrollmentEmpCodeString = decodedToken['emp_code'].toString();
|
enrollmentEmpCodeString = decodedToken['emp_code'].toString();
|
||||||
prefs.setString('enrollmentEmpCodeString', enrollmentEmpCodeString);
|
prefs.setString('enrollmentEmpCodeString', enrollmentEmpCodeString);
|
||||||
enrollmentEmpPrimaryId = decodedToken['id'];
|
enrollmentEmpPrimaryId = decodedToken['id'];
|
||||||
@ -228,22 +233,27 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
prefs.setString('enrollmentGpaEmpName', enrollmentGpaEmpName);
|
prefs.setString('enrollmentGpaEmpName', enrollmentGpaEmpName);
|
||||||
enrollmentClient_id = decodedToken['client_id'];
|
enrollmentClient_id = decodedToken['client_id'];
|
||||||
prefs.setString('enrollmentClient_id', enrollmentClient_id);
|
prefs.setString('enrollmentClient_id', enrollmentClient_id);
|
||||||
|
|
||||||
|
enrollmentHrId = decodedToken['id'];
|
||||||
|
prefs.setString('enrollmentHrId', enrollmentHrId);
|
||||||
|
enrollmentAllowed_modules = decodedToken['allowed_modules'];
|
||||||
|
prefs.setString(
|
||||||
|
'enrollmentAllowed_modules', jsonEncode(enrollmentAllowed_modules));
|
||||||
// enrollmentEmp_status = decodedToken['emp_status'];
|
// enrollmentEmp_status = decodedToken['emp_status'];
|
||||||
// prefs.setString('enrollmentEmp_status', enrollmentEmp_status);
|
// prefs.setString('enrollmentEmp_status', enrollmentEmp_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
final _postToken = prefs.getString('_postToken');
|
final _postToken = prefs.getString('_postToken');
|
||||||
|
|
||||||
if (_postToken != null && _postToken.isNotEmpty) {
|
if (_postToken != null && _postToken.isNotEmpty) {
|
||||||
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||||
// if (emp_status == 'enrolled' || emp_status == 'active') {
|
// if (emp_status == 'enrolled' || emp_status == 'active') {
|
||||||
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
||||||
// } else {
|
// } else {
|
||||||
// Navigator.pushReplacementNamed(context, 'empDetails');
|
// Navigator.pushReplacementNamed(context, 'empDetails');
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void enrollmentSuccessData(data) async {
|
void enrollmentSuccessData(data) async {
|
||||||
@ -252,7 +262,7 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
|
|
||||||
// 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(data['data']);
|
||||||
print('decodedToken : $decodedToken');
|
print('enrolldecodedToken : $decodedToken');
|
||||||
enrollmentEmpClientBranchId = decodedToken['ref_id'];
|
enrollmentEmpClientBranchId = decodedToken['ref_id'];
|
||||||
prefs.setString('enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
prefs.setString('enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
||||||
enrollmentEmpCodeString = decodedToken['emp_code'].toString();
|
enrollmentEmpCodeString = decodedToken['emp_code'].toString();
|
||||||
@ -263,6 +273,12 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
prefs.setString('enrollmentGpaEmpName', enrollmentGpaEmpName);
|
prefs.setString('enrollmentGpaEmpName', enrollmentGpaEmpName);
|
||||||
enrollmentClient_id = decodedToken['client_id'];
|
enrollmentClient_id = decodedToken['client_id'];
|
||||||
prefs.setString('enrollmentClient_id', enrollmentClient_id);
|
prefs.setString('enrollmentClient_id', enrollmentClient_id);
|
||||||
|
|
||||||
|
enrollmentHrId = decodedToken['id'];
|
||||||
|
prefs.setString('enrollmentHrId', enrollmentHrId);
|
||||||
|
enrollmentAllowed_modules = decodedToken['allowed_modules'];
|
||||||
|
prefs.setString(
|
||||||
|
'enrollmentAllowed_modules', jsonEncode(enrollmentAllowed_modules));
|
||||||
// enrollmentEmp_status = decodedToken['emp_status'];
|
// enrollmentEmp_status = decodedToken['emp_status'];
|
||||||
// prefs.setString('enrollmentEmp_status', enrollmentEmp_status);
|
// prefs.setString('enrollmentEmp_status', enrollmentEmp_status);
|
||||||
|
|
||||||
@ -271,15 +287,14 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
// Redirect to another page
|
// Redirect to another page
|
||||||
final enrollToken = prefs.getString('enrollToken');
|
final enrollToken = prefs.getString('enrollToken');
|
||||||
|
|
||||||
if (enrollToken != null && enrollToken.isNotEmpty) {
|
if (enrollToken != null && enrollToken.isNotEmpty) {
|
||||||
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||||
// if (emp_status == 'enrolled' || emp_status == 'active') {
|
// if (emp_status == 'enrolled' || emp_status == 'active') {
|
||||||
// Navigator.pushReplacementNamed(context, 'home');
|
// Navigator.pushReplacementNamed(context, 'home');
|
||||||
// } else {
|
// } else {
|
||||||
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void verifyOTP(String otp) async {
|
void verifyOTP(String otp) async {
|
||||||
@ -325,7 +340,8 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
duration: Duration(seconds: 2),
|
duration: Duration(seconds: 2),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
ToastHelper.showErrorToast(context, 'OTP expired. Please request a new one.');
|
ToastHelper.showErrorToast(
|
||||||
|
context, 'OTP expired. Please request a new one.');
|
||||||
} else if (e.code == 'invalid-verification-code') {
|
} else if (e.code == 'invalid-verification-code') {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
@ -333,7 +349,8 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
duration: Duration(seconds: 2),
|
duration: Duration(seconds: 2),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
ToastHelper.showErrorToast(context, 'Invalid OTP entered. Please try again.');
|
ToastHelper.showErrorToast(
|
||||||
|
context, 'Invalid OTP entered. Please try again.');
|
||||||
} else if (e.code == 'session-expired') {
|
} else if (e.code == 'session-expired') {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
@ -341,7 +358,8 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
duration: Duration(seconds: 2),
|
duration: Duration(seconds: 2),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
ToastHelper.showErrorToast(context, 'Session expired. Try restarting the verification.');
|
ToastHelper.showErrorToast(
|
||||||
|
context, 'Session expired. Try restarting the verification.');
|
||||||
} else {
|
} else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
@ -356,7 +374,8 @@ class _MyVerifyState extends State<MyHrVerify> {
|
|||||||
// _isLoading = false;
|
// _isLoading = false;
|
||||||
// });
|
// });
|
||||||
print('Error: $e');
|
print('Error: $e');
|
||||||
ToastHelper.showErrorToast(context, 'Failed to verify OTP. Please try again.');
|
ToastHelper.showErrorToast(
|
||||||
|
context, 'Failed to verify OTP. Please try again.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -412,13 +412,17 @@ class ApiService {
|
|||||||
//HR API STARTS
|
//HR API STARTS
|
||||||
|
|
||||||
Future<Map<String, dynamic>> getCashDepositDetailsToApi(
|
Future<Map<String, dynamic>> getCashDepositDetailsToApi(
|
||||||
String clintID, String empRefId,String hr_id, String token) async {
|
String clintID, String empRefId, String hr_id, String token) async {
|
||||||
print(token);
|
print("getCashDepositDetailsToApi1");
|
||||||
|
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
await _initializeToken();
|
await _initializeToken();
|
||||||
}
|
}
|
||||||
|
// final url = Uri.parse(
|
||||||
|
// '${Environment.apiUrl}getPolicyLevelEmployeeSummaryData?client_id=$clintID&client_branch_id=$empRefId&hr_id=470');
|
||||||
final url = Uri.parse(
|
final url = Uri.parse(
|
||||||
'${Environment.apiUrl}getPolicyLevelEmployeeSummaryData?client_id=$clintID&client_branch_id=$empRefId&hr_id=$hr_id');
|
'${Environment.apiUrl}getPolicyLevelEmployeeSummaryData?client_id=$clintID&client_branch_id=$empRefId&hr_id=$hr_id');
|
||||||
|
|
||||||
final headers = {
|
final headers = {
|
||||||
'Authorization': 'Bearer $token' ?? '',
|
'Authorization': 'Bearer $token' ?? '',
|
||||||
};
|
};
|
||||||
|
|||||||
195
lib/service/hrDashboardTabs/activePolicies.dart
Normal file
195
lib/service/hrDashboardTabs/activePolicies.dart
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import '../api_service.dart';
|
||||||
|
|
||||||
|
class ActivePolicies extends StatefulWidget {
|
||||||
|
final String empClientId;
|
||||||
|
final String empClientBranchId;
|
||||||
|
final String empHrId;
|
||||||
|
|
||||||
|
const ActivePolicies(
|
||||||
|
{Key? key,
|
||||||
|
required this.empClientId,
|
||||||
|
required this.empClientBranchId,
|
||||||
|
required this.empHrId});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ActivePolicies> createState() => _ActivePolicieState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ActivePolicieState extends State<ActivePolicies> {
|
||||||
|
late ApiService apiService;
|
||||||
|
dynamic getCardArrays = [];
|
||||||
|
int selectedIndex = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
apiService = ApiService(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
// TODO: implement build
|
||||||
|
return Container(
|
||||||
|
color: Colors.white,
|
||||||
|
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
// padding: const EdgeInsets.only(left: 16.0, right: 16.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey.shade50,
|
||||||
|
boxShadow: const [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black54, // Grey shadow
|
||||||
|
spreadRadius: 0.2,
|
||||||
|
blurRadius: 6,
|
||||||
|
offset: Offset(0, 1), // Horizontal, Vertical
|
||||||
|
),
|
||||||
|
],
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
),
|
||||||
|
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
buildTab("Active", 0),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
buildTab("Expired", 1),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// Container(
|
||||||
|
// color: Colors.amber,
|
||||||
|
// child: Card(
|
||||||
|
// elevation: 5,
|
||||||
|
// color: Colors.white,
|
||||||
|
// child: GridView.builder(
|
||||||
|
// itemCount: getCardArrays.length,
|
||||||
|
// gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
// crossAxisCount: 4,
|
||||||
|
// crossAxisSpacing: 16,
|
||||||
|
// mainAxisSpacing: 0,
|
||||||
|
// childAspectRatio: 2,
|
||||||
|
// ),
|
||||||
|
// itemBuilder: (context, index) {
|
||||||
|
// return buildPolicyCard(getCardArrays[index]);
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildTab(String title, int index) {
|
||||||
|
final isSelected = selectedIndex == index;
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
selectedIndex = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 6.5, bottom: 6.0, left: 20.0, right: 20.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isSelected ? const Color(0xFF009195) : Colors.transparent,
|
||||||
|
boxShadow: isSelected
|
||||||
|
? [
|
||||||
|
BoxShadow(
|
||||||
|
color: isSelected
|
||||||
|
? const Color(0xFF009195)
|
||||||
|
: Colors.transparent, // Grey shadow
|
||||||
|
spreadRadius: 0.2,
|
||||||
|
blurRadius: 1,
|
||||||
|
offset: const Offset(0, 1), // Horizontal, Vertical
|
||||||
|
),
|
||||||
|
]
|
||||||
|
: [],
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
),
|
||||||
|
child: Text(title,
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: isSelected ? Colors.white : Colors.black,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildPolicyCard(Map<String, dynamic> policy) {
|
||||||
|
return Card(
|
||||||
|
elevation: 3,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
policy['type'] ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
policy['policy_name'] ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
_buildCountBox(
|
||||||
|
policy['membersCountOfDraft'].toString(), "Draft"),
|
||||||
|
_buildCountBox(
|
||||||
|
policy['membersCountOfEnrolled'].toString(), "Enrolled"),
|
||||||
|
_buildCountBox(policy['totalMembersCount'].toString(), "Total"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCountBox(String count, String label) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 50,
|
||||||
|
height: 40,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFDFF1F3),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
count,
|
||||||
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
Text(label,
|
||||||
|
style: const TextStyle(fontSize: 12, color: Colors.black87)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
29
lib/service/hrDashboardTabs/cd.dart
Normal file
29
lib/service/hrDashboardTabs/cd.dart
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
class CdPolicies extends StatefulWidget {
|
||||||
|
final String empClientId;
|
||||||
|
final String empClientBranchId;
|
||||||
|
final String empHrId;
|
||||||
|
const CdPolicies(
|
||||||
|
{Key? key,
|
||||||
|
required this.empClientId,
|
||||||
|
required this.empClientBranchId,
|
||||||
|
required this.empHrId});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<CdPolicies> createState() => _CdPolicieState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CdPolicieState extends State<CdPolicies> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
// TODO: implement build
|
||||||
|
return Container(
|
||||||
|
child: Text("Cd policy data"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
30
lib/service/hrDashboardTabs/claims.dart
Normal file
30
lib/service/hrDashboardTabs/claims.dart
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
class ClaimsPolicies extends StatefulWidget {
|
||||||
|
final String empClientId;
|
||||||
|
final String empClientBranchId;
|
||||||
|
final String empHrId;
|
||||||
|
|
||||||
|
const ClaimsPolicies(
|
||||||
|
{Key? key,
|
||||||
|
required this.empClientId,
|
||||||
|
required this.empClientBranchId,
|
||||||
|
required this.empHrId});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ClaimsPolicies> createState() => _ClaimsPolicieState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
// TODO: implement build
|
||||||
|
return Container(
|
||||||
|
child: Text("Claims policy data"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
225
lib/service/hrDashboardTabs/preEnrollment.dart
Normal file
225
lib/service/hrDashboardTabs/preEnrollment.dart
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import '../api_service.dart';
|
||||||
|
|
||||||
|
class PreEnrollment extends StatefulWidget {
|
||||||
|
final String enrollmentClientId;
|
||||||
|
final String enrollmentClientBranchId;
|
||||||
|
final String enrollmentHrId;
|
||||||
|
final String enrollToken;
|
||||||
|
|
||||||
|
const PreEnrollment(
|
||||||
|
{Key? key,
|
||||||
|
required this.enrollmentClientId,
|
||||||
|
required this.enrollmentClientBranchId,
|
||||||
|
required this.enrollmentHrId,
|
||||||
|
required this.enrollToken});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PreEnrollment> createState() => _PreEnrollmentState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PreEnrollmentState extends State<PreEnrollment> {
|
||||||
|
late ApiService apiService;
|
||||||
|
dynamic getCardArrays = [];
|
||||||
|
int selectedIndex = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
apiService = ApiService(context);
|
||||||
|
_loadData();
|
||||||
|
|
||||||
|
print("_PreEnrollmentState 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _loadData() async {
|
||||||
|
await getCashDepositDetails(widget.enrollmentClientBranchId,
|
||||||
|
widget.enrollmentClientId, widget.enrollmentHrId, widget.enrollToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getCashDepositDetails(
|
||||||
|
clintBranchId, clintID, hr_id, token) async {
|
||||||
|
print("_PreEnrollmentState 2");
|
||||||
|
print('IN');
|
||||||
|
print("clintBranchId -$clintBranchId");
|
||||||
|
print("clintID -$clintID");
|
||||||
|
print("hr_id -$hr_id");
|
||||||
|
print("token -$token");
|
||||||
|
|
||||||
|
// isLoading = true;
|
||||||
|
// setState(() {
|
||||||
|
// _isLoading = true;
|
||||||
|
// });
|
||||||
|
try {
|
||||||
|
if (clintBranchId == null || clintID == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final response = await apiService.getCashDepositDetailsToApi(
|
||||||
|
clintID!, clintBranchId!, hr_id, token);
|
||||||
|
|
||||||
|
// final response = await apiService.getCashDepositDetailsToApi(
|
||||||
|
// clintID!, clintBranchId!, hr_id, token);
|
||||||
|
print('IN1');
|
||||||
|
if (response['status'] == 'success') {
|
||||||
|
// isLoading = false;
|
||||||
|
setState(() {
|
||||||
|
print('response');
|
||||||
|
print(response['data']);
|
||||||
|
|
||||||
|
print("_PreEnrollmentState 3");
|
||||||
|
getCardArrays = List<Map<String, dynamic>>.from(response['data']);
|
||||||
|
print('getCardArrays');
|
||||||
|
print(getCardArrays);
|
||||||
|
});
|
||||||
|
|
||||||
|
print('IN2');
|
||||||
|
} else {
|
||||||
|
print('API request failed with status');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('Exception occurred: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
print("_PreEnrollmentState 4");
|
||||||
|
// TODO: implement build
|
||||||
|
return Container(
|
||||||
|
color: Colors.white,
|
||||||
|
// height: 400,
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
child: SizedBox(
|
||||||
|
height: 400,
|
||||||
|
child: GridView.builder(
|
||||||
|
itemCount: getCardArrays.length,
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 4,
|
||||||
|
crossAxisSpacing: 16,
|
||||||
|
mainAxisSpacing: 0,
|
||||||
|
childAspectRatio: 2,
|
||||||
|
),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return buildPolicyCard(getCardArrays[index]);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildTab(String title, int index) {
|
||||||
|
final isSelected = selectedIndex == index;
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
selectedIndex = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 6.5, bottom: 6.0, left: 20.0, right: 20.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isSelected ? const Color(0xFF009195) : Colors.transparent,
|
||||||
|
boxShadow: isSelected
|
||||||
|
? [
|
||||||
|
BoxShadow(
|
||||||
|
color: isSelected
|
||||||
|
? const Color(0xFF009195)
|
||||||
|
: Colors.transparent, // Grey shadow
|
||||||
|
spreadRadius: 0.2,
|
||||||
|
blurRadius: 1,
|
||||||
|
offset: const Offset(0, 1), // Horizontal, Vertical
|
||||||
|
),
|
||||||
|
]
|
||||||
|
: [],
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
),
|
||||||
|
child: Text(title,
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: isSelected ? Colors.white : Colors.black,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildPolicyCard(Map<String, dynamic> policy) {
|
||||||
|
return Card(
|
||||||
|
color: Colors.white,
|
||||||
|
elevation: 3,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
policy['type'] ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontFamily: "Inter",
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 2),
|
||||||
|
Text(
|
||||||
|
policy['policy_name'] ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
_buildCountBox(
|
||||||
|
policy['membersCountOfDraft'].toString(), "Draft"),
|
||||||
|
_buildCountBox(
|
||||||
|
policy['membersCountOfEnrolled'].toString(), "Enrolled"),
|
||||||
|
_buildCountBox(policy['totalMembersCount'].toString(), "Total"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildCountBox(String count, String label) {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 70,
|
||||||
|
height: 40,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFDFF1F3),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
count,
|
||||||
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(label,
|
||||||
|
style: const TextStyle(fontSize: 10, color: Color(0xFF848484))),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,6 +5,7 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import file_picker
|
||||||
import firebase_auth
|
import firebase_auth
|
||||||
import firebase_core
|
import firebase_core
|
||||||
import google_sign_in_ios
|
import google_sign_in_ios
|
||||||
@ -14,6 +15,7 @@ import smart_auth
|
|||||||
import url_launcher_macos
|
import url_launcher_macos
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
|
||||||
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
|
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
|
||||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||||
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user