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 'package:collection/collection.dart';
import 'customAppBar/customAppBar.dart'; import 'customAppBar/customAppBar.dart';
import 'customAppBar/customFooter.dart';
class cdTransactionDetails extends StatefulWidget { class cdTransactionDetails extends StatefulWidget {
final String insurerName; final String insurerName;
@ -63,6 +64,15 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
int inceptionType = 0; int inceptionType = 0;
TextEditingController searchController = TextEditingController(); TextEditingController searchController = TextEditingController();
late ApiService apiService; 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 @override
void initState() { void initState() {
@ -87,7 +97,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
widget.empClientId, widget.insurerId,widget.cd_ac_pk, widget.postToken); widget.empClientId, widget.insurerId,widget.cd_ac_pk, widget.postToken);
if (response['status'] == 'success') { if (response['status'] == 'success') {
setState(() { setState(() {
// isLoading = false; isLoading = false;
}); });
setState(() { setState(() {
getCDTransData = List<Map<String, dynamic>>.from(response['data']['deposit_data']); getCDTransData = List<Map<String, dynamic>>.from(response['data']['deposit_data']);
@ -102,7 +112,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
}); });
} else { } else {
setState(() { setState(() {
// isLoading = false; isLoading = false;
}); });
// ToastHelper.showWarningToast( // ToastHelper.showWarningToast(
@ -111,12 +121,12 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
} }
} catch (e) { } catch (e) {
setState(() { setState(() {
// isLoading = false; isLoading = false;
}); });
print('Exception occurred: $e'); print('Exception occurred: $e');
} finally { } finally {
setState(() { setState(() {
// _isLoading = false; _isLoading = false;
}); });
} }
} }
@ -262,146 +272,164 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
backgroundColor: Color(0xFFEFF3F6), backgroundColor: Color(0xFFEFF3F6),
body: Stack( body: Stack(
children: [ children: [
SingleChildScrollView( SingleChildScrollView(
child: Container( child: Container(
padding: padding:
EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50), EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, 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(
children: [ children: [
Expanded( MouseRegion(
flex: 4, cursor: SystemMouseCursors.click, // 👈 shows pointer on hover
child: Align( child: GestureDetector(
alignment: Alignment.centerLeft, onTap: () {
child: Container( Navigator.pop(context); // or your desired action
width: 400, },
height: 37, child: Row(
decoration: BoxDecoration( children: [
color: Color(0xFFF0F0F0), Icon(Icons.arrow_back_ios_new_outlined, color: Color(0xFF707070)),
borderRadius: BorderRadius.circular(8), SizedBox(width: 8),
), Expanded(
child: TextField( child: Text(
decoration: InputDecoration( 'Transaction Details - ${widget.insurerName} (${widget.cdMasterAccountNo})',
hintText: 'Search', style: GoogleFonts.poppins(
prefixIcon: Icon(Icons.search, size: 18), fontSize: 18,
contentPadding: EdgeInsets.symmetric( fontWeight: FontWeight.w600,
horizontal: 12, vertical: 8), color: Color(0xFF101010),
border: InputBorder ),
.none, // No border since Container handles it ),
), ),
controller: searchController, ],
onChanged: search,
style: GoogleFonts.poppins(fontSize: 14),
),
), ),
), ),
), ),
SizedBox(width: 12), SizedBox(height: 20),
Expanded( Row(
flex: 2, mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Row( children: [
mainAxisAlignment: MainAxisAlignment.end, _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: [ children: [
SizedBox( Row(
width: 116, children: [
height: 37, Expanded(
child: ElevatedButton( flex: 4,
onPressed: () { child: Align(
exportToCsv(filteredData); alignment: Alignment.centerLeft,
}, child: Container(
style: ElevatedButton.styleFrom( width: 400,
backgroundColor: Color(0xFFE26728), height: 37,
padding: EdgeInsets.all(10), // Internal padding decoration: BoxDecoration(
shape: RoundedRectangleBorder( color: Color(0xFFF0F0F0),
borderRadius: borderRadius: BorderRadius.circular(8),
BorderRadius.circular(10), // Border radius ),
side: BorderSide( child: TextField(
color: Colors decoration: InputDecoration(
.transparent, // Optional border color hintText: 'Search',
width: 1, // Border width 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( SizedBox(width: 12),
'Export', Expanded(
style: GoogleFonts.poppins( flex: 2,
fontSize: 16, child: Row(
color: Color(0xFFFFFFFF), mainAxisAlignment: MainAxisAlignment.end,
fontWeight: FontWeight.w700, children: [
letterSpacing: 1), 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), const SizedBox(height: 6),
// Table body rows // Table body rows
...filteredData.mapIndexed((index, item) { ..._paginatedData.mapIndexed((index, item) {
return Container( return Container(
margin: const EdgeInsets.only(bottom: 8), margin: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
@ -619,8 +647,8 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
Expanded( Expanded(
flex: 4, flex: 4,
child: Text( child: Text(
'The Kancheepuram District Consumers Operative Wholesale Stores Limited-5526', // 'The Kancheepuram District Consumers Operative Wholesale Stores Limited-5526',
// item['unit'] ?? '-', item['unit'] ?? '-',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins(color: Color(0xFF000000)), style: GoogleFonts.poppins(color: Color(0xFF000000)),
), ),
@ -628,11 +656,11 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
Expanded( Expanded(
flex: 3, flex: 3,
child: Text( child: Text(
'Motor - 3001/379707905/00/000', // 'Motor - 3001/379707905/00/000',
// item['policy_type'] != null && item['policy_type'].toString().trim().isNotEmpty && item['policy_type'] != null && item['policy_type'].toString().trim().isNotEmpty &&
// item['policy_no'] != null && item['policy_no'].toString().trim().isNotEmpty item['policy_no'] != null && item['policy_no'].toString().trim().isNotEmpty
// ? '${item['policy_type']} - ${item['policy_no']}' ? '${item['policy_type']} - ${item['policy_no']}'
// : '-', : '-',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins(color: Color(0xFF000000)), style: GoogleFonts.poppins(color: Color(0xFF000000)),
), ),
@ -697,6 +725,82 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
), ),
); );
}).toList(), }).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(); // _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 { Future<void> logout(BuildContext context) async {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
final String? hrtoken = prefs.getString('hrtoken'); // final String? hrtoken = prefs.getString('_postToken');
final String? token = prefs.getString('token'); // final String? token = prefs.getString('enrollToken');
prefs.clear();
if (token != null && token.isNotEmpty) { Navigator.pushNamed(context, 'hrLogin');
if (hrtoken != null && hrtoken.isNotEmpty) {
await prefs.clear();
Navigator.pushNamed(context, 'hrLogin');
} else {
await prefs.clear();
Navigator.pushNamed(context, 'phone');
}
} else if (hrtoken != null && hrtoken.isNotEmpty) {
await prefs.clear();
Navigator.pushNamed(context, 'hrLogin');
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final sw = MediaQuery.of(context).size.width; 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( return Scaffold(
backgroundColor: Color(0xFFFFFCE5), // Set background color for AppBar backgroundColor: Color(0xFFFFFCE5), // Set background color for AppBar
appBar: PreferredSize( appBar: PreferredSize(
@ -133,13 +85,13 @@ class _CustomAppBarState extends State<CustomAppBar> {
// Navigator.pushNamed(context, 'oldPolicy'); // Navigator.pushNamed(context, 'oldPolicy');
// }, // },
// ), // ),
if (showBackToHR) // if (showBackToHR)
NavBarItem( // NavBarItem(
text: "Back To HR", // text: "Back To HR",
onTap: () { // onTap: () {
hrLogout(context); // // hrLogout(context);
}, // },
), // ),
NavBarItem( NavBarItem(
text: "Logout", text: "Logout",
onTap: () async { onTap: () async {

View File

@ -431,89 +431,89 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
color: Colors.white, color: Colors.white,
child: Stack( child: Stack(
children: [ children: [
Visibility( // Visibility(
visible: _size.width <= 1100, // visible: _size.width <= 1100,
child: ClipRRect( // child: ClipRRect(
borderRadius: BorderRadius.only( // borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30), // bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30), // bottomRight: Radius.circular(30),
), // ),
child: Container( // child: Container(
height: _size.height / 3, // height: _size.height / 3,
width: double.infinity, // width: double.infinity,
color: Color(0xFFFFFCE5), // color: Color(0xFFFFFCE5),
child: Stack( // child: Stack(
children: [ // children: [
Column( // Column(
children: [ // children: [
SizedBox( // SizedBox(
height: _size.height / // height: _size.height /
6.4), // Adjust the spacing between the rows // 6.4), // Adjust the spacing between the rows
Row( // Row(
mainAxisAlignment: MainAxisAlignment // mainAxisAlignment: MainAxisAlignment
.center, // Align to the center // .center, // Align to the center
children: [ // children: [
Expanded( // Expanded(
flex: Responsive.isDesktop(context) // flex: Responsive.isDesktop(context)
? 10 // ? 10
: 12, // : 12,
child: Align( // child: Align(
alignment: Responsive.isDesktop(context) // alignment: Responsive.isDesktop(context)
? Alignment.centerLeft // ? Alignment.centerLeft
: Alignment.bottomCenter, // : Alignment.bottomCenter,
child: Image.asset( // child: Image.asset(
'assets/nhance_app_logo.png', // 'assets/nhance_app_logo.png',
width: 150, // width: 150,
height: 150, // height: 150,
), // ),
), // ),
), // ),
if (!Responsive.isMobile(context) && // if (!Responsive.isMobile(context) &&
!Responsive.isTablet(context)) // !Responsive.isTablet(context))
Expanded( // Expanded(
flex: 2, // flex: 2,
child: MouseRegion( // child: MouseRegion(
cursor: SystemMouseCursors.click, // cursor: SystemMouseCursors.click,
child: GestureDetector( // child: GestureDetector(
onTap: () { // onTap: () {
// Add your navigation logic here // // Add your navigation logic here
// For example, you can use Navigator.push to navigate to another page // // For example, you can use Navigator.push to navigate to another page
Navigator.pushNamed( // Navigator.pushNamed(
context, 'hrLogin'); // context, 'hrLogin');
}, // },
child: Row( // child: Row(
mainAxisAlignment: MainAxisAlignment // mainAxisAlignment: MainAxisAlignment
.end, // Align to the end (right) // .end, // Align to the end (right)
children: [ // children: [
Text( // Text(
'HR Login', // 'HR Login',
style: GoogleFonts.poppins( // style: GoogleFonts.poppins(
color: Color( // color: Color(
0xFF000000), // Text color // 0xFF000000), // Text color
// Add other text styles as needed // // Add other text styles as needed
), // ),
), // ),
SizedBox(width: 5), // SizedBox(width: 5),
Icon( // Icon(
Icons // Icons
.east, // Icon for customer login // .east, // Icon for customer login
color: Colors // color: Colors
.black, // Adjust color as needed // .black, // Adjust color as needed
), // ),
], // ],
), // ),
), // ),
), // ),
), // ),
], // ],
), // ),
], // ],
), // ),
], // ],
), // ),
), // ),
), // ),
), // ),
Container( Container(
margin: marginInsets, margin: marginInsets,
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
@ -566,18 +566,18 @@ class _MyEmailVerifyState extends State<MyEmailVerify> {
.bottomCenter, // Align to the start .bottomCenter, // Align to the start
child: _size.width <= 1100 child: _size.width <= 1100
? Image.asset( ? Image.asset(
'assets/nhance_app_logo.png', 'assets/Nhance-Logo-Final 1.png',
width: 150, width: 150,
height: 150, height: 150,
) )
: _size.width > 1100 : _size.width > 1100
? Image.asset( ? Image.asset(
'assets/nhance_app_logo.png', 'assets/Nhance-Logo-Final 1.png',
width: 150, width: 150,
height: 150, height: 150,
) )
: Image.asset( : Image.asset(
'assets/nhance_app_logo.png', 'assets/Nhance-Logo-Final 1.png',
width: 150, width: 150,
height: 150, height: 150,
), ),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -60,6 +60,15 @@ class _CdPolicieState extends State<CdPolicies> {
int inceptionType = 0; int inceptionType = 0;
TextEditingController searchController = TextEditingController(); TextEditingController searchController = TextEditingController();
late ApiService apiService; 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 @override
void initState() { void initState() {
@ -76,7 +85,7 @@ class _CdPolicieState extends State<CdPolicies> {
Future<void> getCDPoliciesDetails() async { Future<void> getCDPoliciesDetails() async {
print('9'); print('9');
setState(() { setState(() {
isLoading = true; // isLoading = true;
}); });
try { try {
print('10'); 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( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -325,7 +348,7 @@ class _CdPolicieState extends State<CdPolicies> {
const SizedBox(height: 6), const SizedBox(height: 6),
// Table body rows // Table body rows
...filteredData.mapIndexed((index, item) { ..._paginatedData.mapIndexed((index, item) {
return Container( return Container(
margin: const EdgeInsets.only(bottom: 8), margin: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
@ -390,6 +413,82 @@ class _CdPolicieState extends State<CdPolicies> {
), ),
); );
}).toList(), }).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( builder: (context) => hrPolicyDetails(
ClientId: policy['client_id'].toString(), // <-- from map ClientId: policy['client_id'].toString(), // <-- from map
ClientPoliyId: policy['client_policy_id'].toString(), ClientPoliyId: policy['client_policy_id'].toString(),
HrId: widget.enrollmentClientBranchId, clientBranchId: widget.enrollmentClientBranchId,
Token: widget.enrollToken, Token: widget.enrollToken,
TokenType: "pre", TokenType: "pre",
cardType: policy['type'].toString(), cardType: policy['type'].toString(),

View File

@ -5,7 +5,6 @@
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
@ -15,7 +14,6 @@ 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"))