Tab changes

This commit is contained in:
Surendiran 2025-07-05 10:40:41 +05:30
parent 257492be77
commit a2b397dbfb
11 changed files with 534 additions and 352 deletions

View File

@ -15,6 +15,7 @@ import '../../models/environment.dart';
import 'package:collection/collection.dart';
import 'customAppBar/customAppBar.dart';
import 'customAppBar/customFooter.dart';
class cdTransactionDetails extends StatefulWidget {
final String insurerName;
@ -63,6 +64,15 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
int inceptionType = 0;
TextEditingController searchController = TextEditingController();
late ApiService apiService;
int _currentPage = 1;
int _rowsPerPage = 5;
List<dynamic> get _paginatedData {
final startIndex = (_currentPage - 1) * _rowsPerPage;
final endIndex =
(_currentPage * _rowsPerPage).clamp(0, filteredData.length);
return filteredData.sublist(startIndex, endIndex);
}
@override
void initState() {
@ -87,7 +97,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
widget.empClientId, widget.insurerId,widget.cd_ac_pk, widget.postToken);
if (response['status'] == 'success') {
setState(() {
// isLoading = false;
isLoading = false;
});
setState(() {
getCDTransData = List<Map<String, dynamic>>.from(response['data']['deposit_data']);
@ -102,7 +112,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
});
} else {
setState(() {
// isLoading = false;
isLoading = false;
});
// ToastHelper.showWarningToast(
@ -111,12 +121,12 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
}
} catch (e) {
setState(() {
// isLoading = false;
isLoading = false;
});
print('Exception occurred: $e');
} finally {
setState(() {
// _isLoading = false;
_isLoading = false;
});
}
}
@ -262,146 +272,164 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
backgroundColor: Color(0xFFEFF3F6),
body: Stack(
children: [
SingleChildScrollView(
child: Container(
padding:
EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MouseRegion(
cursor: SystemMouseCursors.click, // 👈 shows pointer on hover
child: GestureDetector(
onTap: () {
Navigator.pop(context); // or your desired action
},
child: Row(
children: [
Icon(Icons.arrow_back_ios_new_outlined, color: Color(0xFF707070)),
SizedBox(width: 8),
Expanded(
child: Text(
'Transaction Details - ${widget.insurerName} (${widget.cdMasterAccountNo})',
style: GoogleFonts.poppins(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Color(0xFF101010),
),
),
),
],
),
),
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildInfoCard('Deposits', '$total_deposit', Color(0xFF39D45B), Icons.arrow_upward),
_buildInfoCard('Consumed', '$total_consumed', Color(0xFFED1D24), Icons.arrow_downward),
_buildInfoCard('Refund', '$total_refund', Color(0xFF39D45B), Icons.arrow_upward),
_buildInfoCard('Current Balance', '$currect_balance', Colors.black, null),
],
),
SizedBox(height: 16),
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(10), // 👈 set your desired radius
),
// height: 400,
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Row(
SingleChildScrollView(
child: Container(
padding:
EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 4,
child: Align(
alignment: Alignment.centerLeft,
child: Container(
width: 400,
height: 37,
decoration: BoxDecoration(
color: Color(0xFFF0F0F0),
borderRadius: BorderRadius.circular(8),
),
child: TextField(
decoration: InputDecoration(
hintText: 'Search',
prefixIcon: Icon(Icons.search, size: 18),
contentPadding: EdgeInsets.symmetric(
horizontal: 12, vertical: 8),
border: InputBorder
.none, // No border since Container handles it
MouseRegion(
cursor: SystemMouseCursors.click, // 👈 shows pointer on hover
child: GestureDetector(
onTap: () {
Navigator.pop(context); // or your desired action
},
child: Row(
children: [
Icon(Icons.arrow_back_ios_new_outlined, color: Color(0xFF707070)),
SizedBox(width: 8),
Expanded(
child: Text(
'Transaction Details - ${widget.insurerName} (${widget.cdMasterAccountNo})',
style: GoogleFonts.poppins(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Color(0xFF101010),
),
),
),
controller: searchController,
onChanged: search,
style: GoogleFonts.poppins(fontSize: 14),
),
],
),
),
),
SizedBox(width: 12),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildInfoCard('Deposits', '$total_deposit', Color(0xFF39D45B), Icons.arrow_upward),
_buildInfoCard('Consumed', '$total_consumed', Color(0xFFED1D24), Icons.arrow_downward),
_buildInfoCard('Refund', '$total_refund', Color(0xFF39D45B), Icons.arrow_upward),
_buildInfoCard('Current Balance', '$currect_balance', Colors.black, null),
],
),
SizedBox(height: 16),
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(10), // 👈 set your desired radius
),
// height: 400,
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
SizedBox(
width: 116,
height: 37,
child: ElevatedButton(
onPressed: () {
exportToCsv(filteredData);
},
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFFE26728),
padding: EdgeInsets.all(10), // Internal padding
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10), // Border radius
side: BorderSide(
color: Colors
.transparent, // Optional border color
width: 1, // Border width
Row(
children: [
Expanded(
flex: 4,
child: Align(
alignment: Alignment.centerLeft,
child: Container(
width: 400,
height: 37,
decoration: BoxDecoration(
color: Color(0xFFF0F0F0),
borderRadius: BorderRadius.circular(8),
),
child: TextField(
decoration: InputDecoration(
hintText: 'Search',
prefixIcon: Icon(Icons.search, size: 18),
contentPadding: EdgeInsets.symmetric(
horizontal: 12, vertical: 8),
border: InputBorder
.none, // No border since Container handles it
),
controller: searchController,
onChanged: search,
style: GoogleFonts.poppins(fontSize: 14),
),
),
),
elevation: 0,
),
child: Text(
'Export',
style: GoogleFonts.poppins(
fontSize: 16,
color: Color(0xFFFFFFFF),
fontWeight: FontWeight.w700,
letterSpacing: 1),
SizedBox(width: 12),
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
width: 116,
height: 37,
child: ElevatedButton(
onPressed: () {
exportToCsv(filteredData);
},
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFFE26728),
padding: EdgeInsets.all(10), // Internal padding
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10), // Border radius
side: BorderSide(
color: Colors
.transparent, // Optional border color
width: 1, // Border width
),
),
elevation: 0,
),
child: Text(
'Export',
style: GoogleFonts.poppins(
fontSize: 16,
color: Color(0xFFFFFFFF),
fontWeight: FontWeight.w700,
letterSpacing: 1),
),
),
),
],
),
),
),
],
),
SizedBox(height: 20),
Row(
children: [
Expanded(
child: SingleChildScrollView(
child: _buildCDDataTable(context),
),
)
],
),
],
),
),
],
),
SizedBox(height: 20),
Row(
children: [
Expanded(
child: SingleChildScrollView(
child: _buildCDDataTable(context),
),
)
],
),
],
)
)
),
if (isLoading)
Container(
color: Color(0x98FFFCE5), // Semi-transparent background
child: Center(
child: // Your GIF loader widget
Image.asset(
height: 60,
width: 60,
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double.infinity, // Make the footer full width
child: CustomFooter(),
),
),
)
],
)
)
)
]
)
);
@ -583,7 +611,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
const SizedBox(height: 6),
// Table body rows
...filteredData.mapIndexed((index, item) {
..._paginatedData.mapIndexed((index, item) {
return Container(
margin: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
@ -619,8 +647,8 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
Expanded(
flex: 4,
child: Text(
'The Kancheepuram District Consumers Operative Wholesale Stores Limited-5526',
// item['unit'] ?? '-',
// 'The Kancheepuram District Consumers Operative Wholesale Stores Limited-5526',
item['unit'] ?? '-',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(color: Color(0xFF000000)),
),
@ -628,11 +656,11 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
Expanded(
flex: 3,
child: Text(
'Motor - 3001/379707905/00/000',
// item['policy_type'] != null && item['policy_type'].toString().trim().isNotEmpty &&
// item['policy_no'] != null && item['policy_no'].toString().trim().isNotEmpty
// ? '${item['policy_type']} - ${item['policy_no']}'
// : '-',
// 'Motor - 3001/379707905/00/000',
item['policy_type'] != null && item['policy_type'].toString().trim().isNotEmpty &&
item['policy_no'] != null && item['policy_no'].toString().trim().isNotEmpty
? '${item['policy_type']} - ${item['policy_no']}'
: '-',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(color: Color(0xFF000000)),
),
@ -697,6 +725,82 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
),
);
}).toList(),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
DropdownButton<int>(
value: _rowsPerPage,
items: [5, 10, 15, 20, 50].map((int value) {
return DropdownMenuItem<int>(
value: value,
child: Text(
' $value ',
style: GoogleFonts.poppins(fontSize: 15),
),
);
}).toList(),
onChanged: (newValue) {
setState(() {
_rowsPerPage = newValue!;
_currentPage = 1;
});
},
),
IconButton(
onPressed: _currentPage > 1
? () {
setState(() {
_currentPage--;
});
}
: null,
icon: Icon(Icons.chevron_left),
),
for (int i = 1;
i <= (filteredData.length / _rowsPerPage).ceil();
i++)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: _currentPage == i
? Color(0xFF00A6A6)
: Colors.grey[300],
foregroundColor:
_currentPage == i ? Colors.white : Colors.black,
minimumSize: Size(36, 36),
padding: EdgeInsets.zero,
),
onPressed: () {
setState(() {
_currentPage = i;
});
},
child: Text(i.toString()),
),
),
IconButton(
onPressed: _currentPage <
(filteredData.length / _rowsPerPage).ceil()
? () {
setState(() {
_currentPage++;
});
}
: null,
icon: Icon(Icons.chevron_right),
),
],
),
),
],
),
],
);
}

View File

@ -24,66 +24,18 @@ class _CustomAppBarState extends State<CustomAppBar> {
// _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);
// 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');
}
// final String? hrtoken = prefs.getString('_postToken');
// final String? token = prefs.getString('enrollToken');
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(
@ -133,13 +85,13 @@ class _CustomAppBarState extends State<CustomAppBar> {
// Navigator.pushNamed(context, 'oldPolicy');
// },
// ),
if (showBackToHR)
NavBarItem(
text: "Back To HR",
onTap: () {
hrLogout(context);
},
),
// if (showBackToHR)
// NavBarItem(
// text: "Back To HR",
// onTap: () {
// // hrLogout(context);
// },
// ),
NavBarItem(
text: "Logout",
onTap: () async {

View File

@ -431,89 +431,89 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
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
),
],
),
),
),
),
],
),
],
),
],
),
),
),
),
// 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,
@ -566,18 +566,18 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
.bottomCenter, // Align to the start
child: _size.width <= 1100
? Image.asset(
'assets/nhance_app_logo.png',
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
)
: _size.width > 1100
? Image.asset(
'assets/nhance_app_logo.png',
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
)
: Image.asset(
'assets/nhance_app_logo.png',
'assets/Nhance-Logo-Final 1.png',
width: 150,
height: 150,
),

View File

@ -1,6 +1,7 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:jwt_decode/jwt_decode.dart';
import 'package:nhancepolicy/customAppBar/customAppBar.dart';
import 'dart:convert';
@ -21,8 +22,17 @@ import 'package:spreadsheet_decoder/spreadsheet_decoder.dart';
import 'customAppBar/customFooter.dart';
class excelVerify extends StatefulWidget {
final String ClientId;
final String ClientPoliyId;
final String clientBranchId;
final String Token;
const excelVerify({Key? key, required this.Token}) : super(key: key);
final String TokenType;
final String cardType;
final String cardPolicyNo;
final String cardInsurer_name;
final String cardPolicy_name;
final String cardPolicy_ExpDate;
const excelVerify({Key? key, required this.ClientId, required this.ClientPoliyId, required this.clientBranchId, required this.Token, required this.TokenType, required this.cardType, required this.cardPolicyNo, required this.cardInsurer_name, required this.cardPolicy_name, required this.cardPolicy_ExpDate}) : super(key: key);
@override
State<excelVerify> createState() => _excelVerifyState();
@ -49,10 +59,6 @@ class _excelVerifyState extends State<excelVerify> {
List<Map<String, dynamic>> filteredData = []; // Filtered data source
List<Map<String, dynamic>> tableData = []; // Filtered data source
dynamic policy_name;
dynamic clientPolicyId;
dynamic clientId;
dynamic policyType;
List<Map<String, dynamic>> nonExcelFilteredData = [];
dynamic invalidRelationships = 0;
dynamic dobAgeCheckCount = 0;
@ -85,9 +91,7 @@ class _excelVerifyState extends State<excelVerify> {
_token = token;
});
Map<String, dynamic>? decodedToken = Jwt.parseJwt(token);
clintID = decodedToken['client_id'].toString();
empRefId = prefs.getString('empRefId');
await getPolicyDetails();
print('decodedToken $decodedToken');
} else {
// Token is empty or null, handle accordingly (e.g., navigate to login screen)
// For now, let's navigate to the login screen
@ -96,14 +100,14 @@ class _excelVerifyState extends State<excelVerify> {
}
}
Future<void> getPolicyDetails() async {
setState(() {
clientPolicyId = argumentsData['client_policy_id'];
clientId = argumentsData['client_id'];
policyType = argumentsData['type'];
policy_name = argumentsData['policy_name'];
});
}
// Future<void> getPolicyDetails() async {
// setState(() {
// clientPolicyId = argumentsData['client_policy_id'];
// clientId = argumentsData['client_id'];
// policyType = argumentsData['type'];
// policy_name = argumentsData['policy_name'];
// });
// }
// Future<void> _uploadFile1(importPolicyName) async {
// FilePickerResult? result = await FilePicker.platform.pickFiles(
@ -435,11 +439,10 @@ class _excelVerifyState extends State<excelVerify> {
filename: fileName ?? 'default_filename.xlsx',
));
print('clintID: $clintID');
request.fields['client_id'] = clintID;
print('clientPolicyId: $clientPolicyId');
request.fields['client_id'] = widget.ClientId;
// if (policyFirstPart == 'GPA') {
request.fields['policy_id'] = clientPolicyId;
request.fields['client_branch_id'] = empRefId;
request.fields['policy_id'] = widget.ClientPoliyId;
request.fields['client_branch_id'] = widget.clientBranchId;
// } else {
// request.fields['policy_id'] = '3';
// }
@ -492,6 +495,9 @@ class _excelVerifyState extends State<excelVerify> {
});
}
} else {
setState(() {
isLoading = false;
});
// ToastHelper.showSuccessToast(
// context, 'Failed to upload file: ${response.reasonPhrase}');
ToastHelper.showSuccessToast(context, 'Something went wrong');
@ -553,13 +559,6 @@ class _excelVerifyState extends State<excelVerify> {
@override
Widget build(BuildContext context) {
dynamic arguments = ModalRoute.of(context)!.settings.arguments;
print('arguments');
print(arguments);
if (arguments != null && arguments is Map<String, dynamic>) {
argumentsData = arguments;
}
return Scaffold(
appBar: CustomAppBar(),
body: Stack(children: [
@ -568,16 +567,16 @@ class _excelVerifyState extends State<excelVerify> {
data: ThemeData(
canvasColor: Color(0xFFF4F7FE),
colorScheme: Theme.of(context).colorScheme.copyWith(
primary: Color(0xFFE26728),
primary: Color(0xFF00999E),
background: Colors.red,
secondary: Color(0xFFE26728),
secondary: Color(0xFF00999E),
),
),
child: Container(
padding: const EdgeInsets.all(20),
color: Color(0xFFEFF3F6),
child: Card(
elevation: 1,
elevation: 0,
color: Colors.white,
child: Column(
children: [
@ -776,8 +775,8 @@ class _excelVerifyState extends State<excelVerify> {
title: Container(
child: Text(
'Import Excel',
style: TextStyle(
color: Color(0xFFE26728),
style: GoogleFonts.poppins(
color: Color(0xFF00999E),
),
),
),
@ -795,7 +794,7 @@ class _excelVerifyState extends State<excelVerify> {
children: [
Expanded(
child: Text(
'$policy_name - ($policyType)',
'${widget.cardPolicy_name} - (${widget.cardType})',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
@ -993,7 +992,7 @@ class _excelVerifyState extends State<excelVerify> {
style: TextStyle(
fontSize: 15,
color: Color(
0xFFE26728), // Add underline decoration
0xFF00999E), // Add underline decoration
),
),
),
@ -1012,7 +1011,7 @@ class _excelVerifyState extends State<excelVerify> {
Step(
title: Text(
'Excel Validation',
style: TextStyle(color: Color(0xFFE26728)),
style: TextStyle(color: Color(0xFF00999E)),
),
content: isSuccess
? Center(

View File

@ -499,7 +499,7 @@ class _hrDashboardState extends State<hrDashboard>
SizedBox(height: 16),
Container(
padding: const EdgeInsets.all(5),
height: MediaQuery.of(context).size.height * 0.08,
// height: MediaQuery.of(context).size.height * 0.08,
decoration: BoxDecoration(
color:
Color(0xFFC4E3E6), // 🔹 Background behind the TabBar

View File

@ -26,7 +26,7 @@ class hrPolicyDetails extends StatefulWidget {
final String ClientId;
// final String ClientBranchId;
final String ClientPoliyId;
final String HrId;
final String clientBranchId;
final String Token;
final String TokenType;
final String cardType;
@ -40,7 +40,7 @@ class hrPolicyDetails extends StatefulWidget {
required this.ClientId,
// required this.ClientBranchId,
required this.ClientPoliyId,
required this.HrId,
required this.clientBranchId,
required this.Token,
required this.TokenType,
required this.cardType,
@ -107,9 +107,9 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
final response = widget.TokenType == "post"
? await apiService.getEmployeeAndDependenceToApi(
widget.ClientId, widget.ClientPoliyId, widget.HrId, widget.Token)
widget.ClientId, widget.ClientPoliyId, widget.clientBranchId, widget.Token)
: await apiService.getEmployeeAndDependenceToApiPre(
widget.ClientId, widget.ClientPoliyId, widget.HrId, widget.Token);
widget.ClientId, widget.ClientPoliyId, widget.clientBranchId, widget.Token);
if (response['status'] == 'success') {
setState(() {
@ -379,7 +379,26 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
context,
MaterialPageRoute(
builder: (context) =>
excelVerify(Token: widget.Token),
excelVerify(
ClientId: widget.ClientId, // <-- from map
ClientPoliyId: widget.ClientPoliyId,
clientBranchId: widget.clientBranchId,
Token: widget.Token,
TokenType: widget.TokenType,
cardType: widget.cardType,
cardPolicyNo: widget.cardPolicyNo,
cardInsurer_name: widget.cardInsurer_name,
cardPolicy_name: widget.cardPolicy_name,
cardPolicy_ExpDate: widget.cardPolicy_ExpDate,
// Token: widget.Token,
// ClientId: widget.ClientId,
// ClientPolicyId : widget.ClientPoliyId,
// PolicyName: widget.cardPolicy_name,
// PolicyNo: widget.cardPolicyNo,
// ClientBranchId: widget.HrId,
// PolicyType: widget.cardType,
),
),
);
// exportToCsv(filteredData);
@ -733,18 +752,19 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
GestureDetector(
onTap: () {},
child: Container(
height: 30,
width: 30,
height: 35,
width: 35,
decoration: BoxDecoration(
color: Color(0xFFE6F5F6),
borderRadius: BorderRadius.circular(12)),
child: Icon(Icons.credit_card,
color: Color(0xFF3D3D3D)),
// child: Image.asset(
// 'assets/ecard.jpg',
// height: 20,
// fit: BoxFit.cover,
// ),
color: Color(0xFFE6F5F6),
borderRadius: BorderRadius.circular(8),
),
child: Padding(
padding: EdgeInsets.all(6), // You can adjust this value
child: Image.asset(
'assets/credit_card.png',
fit: BoxFit.contain,
),
),
),
),
SizedBox(
@ -753,21 +773,22 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
GestureDetector(
onTap: () {},
child: Container(
height: 30,
width: 30,
height: 35,
width: 35,
decoration: BoxDecoration(
color: Color(0xFFE6F5F6),
borderRadius: BorderRadius.circular(12)),
// child: Icon(
// Icons.policy,
// color: Color(0xFF3D3D3D),
// ),
child: Image.asset(
'assets/claims.jpg',
height: 20,
fit: BoxFit.cover,
color: Color(0xFFE6F5F6),
borderRadius: BorderRadius.circular(8),
),
child: Padding(
padding: EdgeInsets.all(6), // You can adjust this value
child: Image.asset(
'assets/claim.png',
fit: BoxFit.contain,
),
),
),
),
],
),

View File

@ -68,7 +68,16 @@ Future<void> main() async {
),
'hrHome': (context) => MyHrHome(),
'excelVerify': (context) => excelVerify(
ClientId: '',
ClientPoliyId: '',
clientBranchId: '',
Token: '',
TokenType: '',
cardType: '',
cardPolicyNo: '',
cardInsurer_name: '',
cardPolicy_name: '',
cardPolicy_ExpDate: '',
),
'empDetails': (context) => empDetails(),
'addOnsDetails': (context) => addOnsDetails(),
@ -85,7 +94,7 @@ Future<void> main() async {
'hrPolicyDetails': (context) => hrPolicyDetails(
ClientId: '',
ClientPoliyId: '',
HrId: '',
clientBranchId: '',
Token: '',
TokenType: '',
cardType: '',

View File

@ -276,7 +276,7 @@ class _ActivePolicieState extends State<ActivePolicies> {
builder: (context) => hrPolicyDetails(
ClientId: policy['client_id'].toString(), // <-- from map
ClientPoliyId: policy['client_policy_id'].toString(),
HrId: widget.empClientBranchId,
clientBranchId: widget.empClientBranchId,
Token: widget.postToken,
TokenType: 'post',
cardType: policy['type'].toString(),

View File

@ -60,6 +60,15 @@ class _CdPolicieState extends State<CdPolicies> {
int inceptionType = 0;
TextEditingController searchController = TextEditingController();
late ApiService apiService;
int _currentPage = 1;
int _rowsPerPage = 5;
List<dynamic> get _paginatedData {
final startIndex = (_currentPage - 1) * _rowsPerPage;
final endIndex =
(_currentPage * _rowsPerPage).clamp(0, filteredData.length);
return filteredData.sublist(startIndex, endIndex);
}
@override
void initState() {
@ -76,7 +85,7 @@ class _CdPolicieState extends State<CdPolicies> {
Future<void> getCDPoliciesDetails() async {
print('9');
setState(() {
isLoading = true;
// isLoading = true;
});
try {
print('10');
@ -264,6 +273,7 @@ class _CdPolicieState extends State<CdPolicies> {
)
],
),
],
),
);
@ -277,6 +287,19 @@ class _CdPolicieState extends State<CdPolicies> {
);
}
// Loader overlay
if (isLoading)
return Container(
color: Color(0x98FFFCE5), // semi-transparent overlay
child: Center(
child: Image.asset(
'assets/nhance-loader.gif',
height: 60,
width: 60,
),
),
);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -325,7 +348,7 @@ class _CdPolicieState extends State<CdPolicies> {
const SizedBox(height: 6),
// Table body rows
...filteredData.mapIndexed((index, item) {
..._paginatedData.mapIndexed((index, item) {
return Container(
margin: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
@ -390,6 +413,82 @@ class _CdPolicieState extends State<CdPolicies> {
),
);
}).toList(),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
DropdownButton<int>(
value: _rowsPerPage,
items: [5, 10, 15, 20, 50].map((int value) {
return DropdownMenuItem<int>(
value: value,
child: Text(
' $value ',
style: GoogleFonts.poppins(fontSize: 15),
),
);
}).toList(),
onChanged: (newValue) {
setState(() {
_rowsPerPage = newValue!;
_currentPage = 1;
});
},
),
IconButton(
onPressed: _currentPage > 1
? () {
setState(() {
_currentPage--;
});
}
: null,
icon: Icon(Icons.chevron_left),
),
for (int i = 1;
i <= (filteredData.length / _rowsPerPage).ceil();
i++)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: _currentPage == i
? Color(0xFF00A6A6)
: Colors.grey[300],
foregroundColor:
_currentPage == i ? Colors.white : Colors.black,
minimumSize: Size(36, 36),
padding: EdgeInsets.zero,
),
onPressed: () {
setState(() {
_currentPage = i;
});
},
child: Text(i.toString()),
),
),
IconButton(
onPressed: _currentPage <
(filteredData.length / _rowsPerPage).ceil()
? () {
setState(() {
_currentPage++;
});
}
: null,
icon: Icon(Icons.chevron_right),
),
],
),
),
],
),
],
);
}

View File

@ -215,7 +215,7 @@ class _PreEnrollmentState extends State<PreEnrollment> {
builder: (context) => hrPolicyDetails(
ClientId: policy['client_id'].toString(), // <-- from map
ClientPoliyId: policy['client_policy_id'].toString(),
HrId: widget.enrollmentClientBranchId,
clientBranchId: widget.enrollmentClientBranchId,
Token: widget.enrollToken,
TokenType: "pre",
cardType: policy['type'].toString(),

View File

@ -5,7 +5,6 @@
import FlutterMacOS
import Foundation
import file_picker
import firebase_auth
import firebase_core
import google_sign_in_ios
@ -15,7 +14,6 @@ import smart_auth
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))