merge
This commit is contained in:
parent
9764747e02
commit
b15ebb3158
@ -8,7 +8,6 @@ import '../customAppBar/toastHelper.dart';
|
||||
import '../service/token_storage_service.dart';
|
||||
import 'branch_card_widget.dart';
|
||||
|
||||
|
||||
class BranchSelectionPage extends StatefulWidget {
|
||||
const BranchSelectionPage({Key? key}) : super(key: key);
|
||||
|
||||
@ -86,15 +85,16 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
||||
|
||||
final empAllowedModules = allowedModules['post'];
|
||||
|
||||
await prefs.setString('empAllowed_modules', jsonEncode(empAllowedModules));
|
||||
await prefs.setString(
|
||||
'empAllowed_modules', jsonEncode(empAllowedModules));
|
||||
|
||||
// final empAllowed_modules = decodedToken?['allowed_modules'][0]['post'];
|
||||
// await prefs.setString('empAllowed_modules', jsonEncode(empAllowed_modules));
|
||||
|
||||
|
||||
//Pre Token Decode Details
|
||||
final enrollmentEmpClientBranchId = decodedToken?['pre_branch_id'];
|
||||
await prefs.setString('enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
||||
await prefs.setString(
|
||||
'enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
||||
|
||||
final enrollmentEmpPrimaryId = decodedToken?['pre_hr_id'];
|
||||
await prefs.setString('enrollmentEmpPrimaryId', enrollmentEmpPrimaryId);
|
||||
@ -105,10 +105,10 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
||||
final enrollmentHrId = decodedToken?['pre_hr_id'];
|
||||
await prefs.setString('enrollmentHrId', enrollmentHrId);
|
||||
|
||||
|
||||
final enrollmentAllowedModules = allowedModules['pre'];
|
||||
|
||||
await prefs.setString('enrollmentAllowed_modules', jsonEncode(enrollmentAllowedModules));
|
||||
await prefs.setString(
|
||||
'enrollmentAllowed_modules', jsonEncode(enrollmentAllowedModules));
|
||||
|
||||
// final enrollmentAllowed_modules = decodedToken?['allowed_modules'][1]['pre'];
|
||||
// await prefs.setString('enrollmentAllowed_modules', jsonEncode(enrollmentAllowed_modules));
|
||||
@ -118,7 +118,6 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
||||
await prefs.setString('token', token!);
|
||||
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,21 +195,22 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
|
||||
Container(
|
||||
height: gridHeight, // Shows approximately 3 rows
|
||||
child: branches.isEmpty
|
||||
? Center(
|
||||
child: Text(
|
||||
'No branches available',
|
||||
style: TextStyle(fontSize: 16, color: Colors.grey),
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: Colors.grey),
|
||||
),
|
||||
)
|
||||
: GridView.builder(
|
||||
// Enable scrolling if content exceeds height
|
||||
physics: ClampingScrollPhysics(),
|
||||
padding: EdgeInsets.zero,
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
gridDelegate:
|
||||
SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: crossAxisCount,
|
||||
childAspectRatio: childAspectRatio,
|
||||
crossAxisSpacing: 15,
|
||||
@ -220,17 +220,17 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
||||
itemBuilder: (context, index) {
|
||||
final branch = branches[index];
|
||||
return BranchCard(
|
||||
clientName: branch['client_name'] ?? 'Unknown Client',
|
||||
branchName: branch['branch_name'] ?? 'Unknown Branch',
|
||||
clientName: branch['client_name'] ??
|
||||
'Unknown Client',
|
||||
branchName: branch['branch_name'] ??
|
||||
'Unknown Branch',
|
||||
isSelected: selectedIndex == index,
|
||||
onTap: () => _selectBranch(index),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 24),
|
||||
|
||||
Center(
|
||||
child: SizedBox(
|
||||
width: 120,
|
||||
|
||||
@ -336,7 +336,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
child: Text(
|
||||
'Transaction Details - ${widget.insurerName} (${widget.cdMasterAccountNo})',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 18,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF101010),
|
||||
),
|
||||
@ -346,7 +346,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -434,7 +434,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
child: Text(
|
||||
'Export',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 16,
|
||||
fontSize: 14,
|
||||
color: Color(0xFFFFFFFF),
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 1),
|
||||
@ -561,7 +561,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
'Date',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -570,7 +572,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
'Record Date',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -579,7 +583,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
'Unit',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -588,16 +594,20 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
'Policy',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
flex: 3,
|
||||
child: Text(
|
||||
'Endorsement No',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -606,7 +616,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
'Sub Type',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -615,7 +627,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
'Credit',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -624,7 +638,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
'Debit',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -633,7 +649,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
'Balance',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -642,16 +660,20 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
'Description',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'User',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
||||
fontSize: 12,
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -683,7 +705,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
child: Text(
|
||||
formatDateNextLine(item['created_at']),
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -691,7 +716,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
child: Text(
|
||||
item['record_date'] ?? '-',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -700,7 +728,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
// 'The Kancheepuram District Consumers Operative Wholesale Stores Limited-5526',
|
||||
item['unit'] ?? '-',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -711,18 +742,25 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
item['policy_type'].toString().trim().isNotEmpty &&
|
||||
item['policy_no'] != null &&
|
||||
item['policy_no'].toString().trim().isNotEmpty
|
||||
// ? '${item['policy_no']}'
|
||||
? '${item['policy_type']} - ${item['policy_no']}'
|
||||
: '-',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
flex: 3,
|
||||
child: Text(
|
||||
item['endorsement_no'] ?? '-',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -730,7 +768,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
child: Text(
|
||||
item['sub_type'] ?? '-',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -740,7 +781,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
? '₹${item['amount']}'
|
||||
: '-',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -750,7 +794,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
? '₹${item['amount']}'
|
||||
: '-',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -758,7 +805,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
child: Text(
|
||||
"₹${item['balance'] ?? '-'}",
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -766,15 +816,21 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
||||
child: Text(
|
||||
item['description'] ?? '-',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
flex: 2,
|
||||
child: Text(
|
||||
item['username'] ?? '-',
|
||||
textAlign: TextAlign.left,
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -24,7 +24,6 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
// _checkTokens();
|
||||
}
|
||||
|
||||
|
||||
Future<void> logout(BuildContext context) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
// final String? hrtoken = prefs.getString('_postToken');
|
||||
@ -43,15 +42,21 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
preferredSize: widget.preferredSize,
|
||||
child: SafeArea(
|
||||
child: Container(
|
||||
padding: Responsive.isDesktop(context)
|
||||
? EdgeInsets.symmetric(horizontal: 16.0)
|
||||
: EdgeInsets.symmetric(horizontal: 0),
|
||||
// padding: Responsive.isDesktop(context)
|
||||
// ? EdgeInsets.symmetric(horizontal: 46.0)
|
||||
// : EdgeInsets.symmetric(horizontal: 0),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
(Responsive.isDesktop(context) ? 0.03 : 0.02),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Logo Column
|
||||
Expanded(
|
||||
flex: Responsive.isDesktop(context) ? 3 : 9,
|
||||
child: Row(
|
||||
// Expanded(
|
||||
// // flex: Responsive.isDesktop(context) ? 1 : 9,
|
||||
// child:
|
||||
Row(
|
||||
mainAxisAlignment: Responsive.isDesktop(context)
|
||||
? MainAxisAlignment.spaceEvenly
|
||||
: MainAxisAlignment.start,
|
||||
@ -67,26 +72,15 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// AdaptiveNavBar Column
|
||||
Expanded(
|
||||
flex: Responsive.isDesktop(context) ? 9 : 3,
|
||||
child: AdaptiveNavBar(
|
||||
screenWidth: sw,
|
||||
backgroundColor: Color(0xFFFFFCE5),
|
||||
leading:
|
||||
Container(), // Set an empty container as we have the logo separately
|
||||
title: Text(''),
|
||||
navBarItems: [
|
||||
// if (Responsive.isDesktop(context))
|
||||
// if (hideInactiveStatus)
|
||||
// NavBarItem(
|
||||
// text: "Inactive Policy",
|
||||
// onTap: () {
|
||||
// Navigator.pushNamed(context, 'oldPolicy');
|
||||
// },
|
||||
// ),
|
||||
// if (showBackToHR)
|
||||
// AdaptiveNavBar Column
|
||||
|
||||
// Expanded(
|
||||
// // flex: Responsive.isDesktop(context) ? 1 : 9,
|
||||
// child:
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
NavBarItem(
|
||||
text: "Change Branch",
|
||||
onTap: () async {
|
||||
@ -110,15 +104,65 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
Navigator.pushNamed(context, 'branchSelection');
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
NavBarItem(
|
||||
text: "Logout",
|
||||
onTap: () async {
|
||||
logout(context);
|
||||
},
|
||||
onTap: () => logout(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// )
|
||||
|
||||
// Expanded(
|
||||
// flex: Responsive.isDesktop(context) ? 9 : 3,
|
||||
// child: AdaptiveNavBar(
|
||||
// screenWidth: sw,
|
||||
// backgroundColor: Color(0xFFFFFCE5),
|
||||
// leading:
|
||||
// Container(), // Set an empty container as we have the logo separately
|
||||
// title: Text(''),
|
||||
// navBarItems: [
|
||||
// // if (Responsive.isDesktop(context))
|
||||
// // if (hideInactiveStatus)
|
||||
// // NavBarItem(
|
||||
// // text: "Inactive Policy",
|
||||
// // onTap: () {
|
||||
// // Navigator.pushNamed(context, 'oldPolicy');
|
||||
// // },
|
||||
// // ),
|
||||
// // if (showBackToHR)
|
||||
// NavBarItem(
|
||||
// text: "Change Branch",
|
||||
// onTap: () async {
|
||||
// final prefs = await SharedPreferences.getInstance();
|
||||
// await prefs.remove('selected_branch');
|
||||
// await prefs.remove('decoded_token');
|
||||
// await prefs.remove('clientLogo');
|
||||
// await prefs.remove('clientName');
|
||||
// await prefs.remove('empAllowed_modules');
|
||||
// await prefs.remove('empClientBranchId');
|
||||
// await prefs.remove('empClientId');
|
||||
// await prefs.remove('empEmail');
|
||||
// await prefs.remove('empHrId');
|
||||
// await prefs.remove('empPrimaryId');
|
||||
// await prefs.remove('enrollmentAllowed_modules');
|
||||
// await prefs.remove('enrollmentClient_id');
|
||||
// await prefs.remove('enrollmentEmpClientBranchId');
|
||||
// await prefs.remove('enrollmentEmpPrimaryId');
|
||||
// await prefs.remove('enrollmentHrId');
|
||||
// await prefs.remove('token');
|
||||
// Navigator.pushNamed(context, 'branchSelection');
|
||||
// },
|
||||
// ),
|
||||
// NavBarItem(
|
||||
// text: "Logout",
|
||||
// onTap: () async {
|
||||
// logout(context);
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -127,3 +171,34 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NavBarItem extends StatelessWidget {
|
||||
final String text;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const NavBarItem({
|
||||
Key? key,
|
||||
required this.text,
|
||||
this.onTap,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
onTap: onTap,
|
||||
hoverColor: const Color(0xFFF4F3E7), // subtle hover background
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -491,42 +491,23 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => widget.TokenType != "post" ? excelVerify(
|
||||
ClientId:
|
||||
widget.ClientId, // <-- from map
|
||||
policyTypeId: widget.policyTypeId,
|
||||
ClientPoliyId: widget.ClientPoliyId,
|
||||
builder: (context) => widget
|
||||
.TokenType !=
|
||||
"post"
|
||||
? excelVerify(
|
||||
ClientId: widget
|
||||
.ClientId, // <-- from map
|
||||
policyTypeId:
|
||||
widget.policyTypeId,
|
||||
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,
|
||||
) : postFileUpload(
|
||||
ClientId:
|
||||
widget.ClientId, // <-- from map
|
||||
policyTypeId: widget.policyTypeId,
|
||||
ClientPoliyId: widget.ClientPoliyId,
|
||||
clientBranchId:
|
||||
widget.clientBranchId,
|
||||
Token: widget.Token,
|
||||
TokenType: widget.TokenType,
|
||||
cardType: widget.cardType,
|
||||
cardPolicyNo: widget.cardPolicyNo,
|
||||
cardPolicyNo:
|
||||
widget.cardPolicyNo,
|
||||
cardInsurer_name:
|
||||
widget.cardInsurer_name,
|
||||
cardPolicy_name:
|
||||
@ -542,14 +523,42 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
// ClientBranchId: widget.HrId,
|
||||
// PolicyType: widget.cardType,
|
||||
)
|
||||
),
|
||||
: postFileUpload(
|
||||
ClientId: widget
|
||||
.ClientId, // <-- from map
|
||||
policyTypeId:
|
||||
widget.policyTypeId,
|
||||
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);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color(0xFFE26728),
|
||||
padding: EdgeInsets.all(
|
||||
10), // Internal padding
|
||||
padding:
|
||||
EdgeInsets.all(10), // Internal padding
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
10), // Border radius
|
||||
@ -803,7 +812,6 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: _paginatedData.mapIndexed((index, item) {
|
||||
return Container(
|
||||
|
||||
// margin: const EdgeInsets.only(bottom: 8),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
|
||||
@ -844,7 +852,8 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
],
|
||||
),
|
||||
),
|
||||
if(widget.policyTypeId != '6' && widget.policyTypeId != '7')
|
||||
if (widget.policyTypeId != '6' &&
|
||||
widget.policyTypeId != '7')
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
@ -930,6 +939,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
if (widget.TokenType != "pre" && (hasAnyEcardLink || hasModule))
|
||||
Expanded(
|
||||
flex: 3,
|
||||
@ -1015,7 +1025,6 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
),
|
||||
),
|
||||
|
||||
// if (widget.TokenType != "pre" &&
|
||||
// (hasAnyEcardLink || hasModule))
|
||||
// Expanded(
|
||||
// flex: 3,
|
||||
@ -1093,84 +1102,207 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
),
|
||||
),
|
||||
// ),
|
||||
_buildPagination(context)
|
||||
// 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; // Reset to first page when rows per page changes
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// 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),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Row(
|
||||
Widget _buildPagination(BuildContext context) {
|
||||
final totalPages = (filteredData.length / _rowsPerPage).ceil();
|
||||
const visiblePageCount = 5;
|
||||
|
||||
List<int> getVisiblePages() {
|
||||
if (totalPages <= visiblePageCount) {
|
||||
return List.generate(totalPages, (i) => i + 1);
|
||||
}
|
||||
|
||||
if (_currentPage <= 3) {
|
||||
return [1, 2, 3, 4, 5];
|
||||
} else if (_currentPage >= totalPages - 2) {
|
||||
return [
|
||||
totalPages - 4,
|
||||
totalPages - 3,
|
||||
totalPages - 2,
|
||||
totalPages - 1,
|
||||
totalPages
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
_currentPage - 2,
|
||||
_currentPage - 1,
|
||||
_currentPage,
|
||||
_currentPage + 1,
|
||||
_currentPage + 2,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
List<int> visiblePages = getVisiblePages();
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Dropdown for rows per page
|
||||
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),
|
||||
),
|
||||
child: Text(' $value ',
|
||||
style: GoogleFonts.poppins(fontSize: 15)),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
_rowsPerPage = newValue!;
|
||||
_currentPage =
|
||||
1; // Reset to first page when rows per page changes
|
||||
_currentPage = 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
// Previous button
|
||||
IconButton(
|
||||
onPressed: _currentPage > 1
|
||||
? () {
|
||||
setState(() {
|
||||
_currentPage--;
|
||||
});
|
||||
}
|
||||
? () => setState(() => _currentPage--)
|
||||
: null,
|
||||
icon: Icon(Icons.chevron_left),
|
||||
icon: const Icon(Icons.chevron_left),
|
||||
),
|
||||
for (int i = 1;
|
||||
i <= (filteredData.length / _rowsPerPage).ceil();
|
||||
i++)
|
||||
Padding(
|
||||
|
||||
// First page + left ellipsis
|
||||
if (!visiblePages.contains(1))
|
||||
Row(children: [
|
||||
_buildPageButton(1),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text("..."),
|
||||
),
|
||||
]),
|
||||
|
||||
// Visible page buttons
|
||||
for (int page in visiblePages) _buildPageButton(page),
|
||||
|
||||
// Right ellipsis + last page
|
||||
if (!visiblePages.contains(totalPages))
|
||||
Row(children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text("..."),
|
||||
),
|
||||
_buildPageButton(totalPages),
|
||||
]),
|
||||
|
||||
// Next button
|
||||
IconButton(
|
||||
onPressed: _currentPage < totalPages
|
||||
? () => setState(() => _currentPage++)
|
||||
: null,
|
||||
icon: const Icon(Icons.chevron_right),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPageButton(int page) {
|
||||
return 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),
|
||||
backgroundColor:
|
||||
_currentPage == page ? const Color(0xFF00A6A6) : Colors.grey[300],
|
||||
foregroundColor: _currentPage == page ? Colors.white : Colors.black,
|
||||
minimumSize: const Size(36, 36),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_currentPage = i;
|
||||
_currentPage = page;
|
||||
});
|
||||
},
|
||||
child: Text(i.toString()),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: _currentPage <
|
||||
(filteredData.length / _rowsPerPage).ceil()
|
||||
? () {
|
||||
setState(() {
|
||||
_currentPage++;
|
||||
});
|
||||
}
|
||||
: null,
|
||||
icon: Icon(Icons.chevron_right),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
child: Text(page.toString()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -109,7 +109,6 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
String? selectedValue;
|
||||
String? _selectedAction;
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -174,7 +173,6 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
Future<void> getFileUploadMasterDetails() async {
|
||||
print('9');
|
||||
try {
|
||||
|
||||
final response = await apiService.getFileUploadMastersToApi(widget.Token);
|
||||
|
||||
if (response['status'] == true) {
|
||||
@ -210,8 +208,8 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
empPrimaryId = prefs.getString('empPrimaryId');
|
||||
print('9');
|
||||
try {
|
||||
|
||||
final response = await apiService.getFileListToApi(empPrimaryId,widget.cardPolicyNo,widget.Token);
|
||||
final response = await apiService.getFileListToApi(
|
||||
empPrimaryId, widget.cardPolicyNo, widget.Token);
|
||||
|
||||
if (response['status'] == 'success') {
|
||||
print('getThrFileList');
|
||||
@ -252,7 +250,6 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
try {
|
||||
print("PDF Downloaded");
|
||||
@ -509,7 +506,8 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center, // 👈 fix alignment
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center, // 👈 fix alignment
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 8,
|
||||
@ -571,10 +569,12 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
setState(() {
|
||||
selectedKey = value;
|
||||
selectedValue = getFileUploadMasterList
|
||||
.firstWhere((item) => item['key'] == value)['value'];
|
||||
.firstWhere((item) =>
|
||||
item['key'] == value)['value'];
|
||||
});
|
||||
debugPrint("Selected Key: $selectedKey");
|
||||
debugPrint("Selected Value: $selectedValue");
|
||||
debugPrint(
|
||||
"Selected Value: $selectedValue");
|
||||
},
|
||||
false,
|
||||
getFileUploadMasterList,
|
||||
@ -584,14 +584,12 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
@ -632,8 +630,7 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
// ),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
@ -643,30 +640,21 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
color: Colors.grey[200],
|
||||
height: 180,
|
||||
child: DragTarget(
|
||||
onAccept: (html.File
|
||||
droppedFile) {
|
||||
onAccept: (html.File droppedFile) {
|
||||
setState(() {
|
||||
fileName =
|
||||
droppedFile.name;
|
||||
fileName = droppedFile.name;
|
||||
});
|
||||
_dragAndDropFile(
|
||||
droppedFile);
|
||||
_dragAndDropFile(droppedFile);
|
||||
},
|
||||
builder:
|
||||
(BuildContext context,
|
||||
List<String?>
|
||||
candidateData,
|
||||
List<dynamic>
|
||||
rejectedData) {
|
||||
builder: (BuildContext context,
|
||||
List<String?> candidateData,
|
||||
List<dynamic> rejectedData) {
|
||||
return Container(
|
||||
alignment:
|
||||
Alignment.center,
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.center,
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
fileName != null
|
||||
? Column(
|
||||
mainAxisAlignment:
|
||||
@ -676,8 +664,7 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
Icon(
|
||||
Icons
|
||||
.upload_file, // Choose the appropriate icon
|
||||
size:
|
||||
35,
|
||||
size: 35,
|
||||
color: Color(
|
||||
0xFFE26728), // Adjust the size as needed
|
||||
),
|
||||
@ -694,28 +681,37 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
height:
|
||||
25), // Add some space between the icon and text
|
||||
MouseRegion(
|
||||
cursor:
|
||||
SystemMouseCursors.click, // Set cursor to pointer on hover
|
||||
cursor: SystemMouseCursors
|
||||
.click, // Set cursor to pointer on hover
|
||||
child:
|
||||
GestureDetector(
|
||||
onTap:
|
||||
() {
|
||||
onTap: () {
|
||||
resetErrorCount();
|
||||
},
|
||||
child:
|
||||
const Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
MainAxisAlignment
|
||||
.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delete_forever, // Choose the remove icon
|
||||
size: 20, // Adjust the size as needed
|
||||
color: Colors.red, // Set the color of the remove icon
|
||||
Icons
|
||||
.delete_forever, // Choose the remove icon
|
||||
size:
|
||||
20, // Adjust the size as needed
|
||||
color: Colors
|
||||
.red, // Set the color of the remove icon
|
||||
),
|
||||
SizedBox(width: 1), // Add some space between the icon and text
|
||||
SizedBox(
|
||||
width:
|
||||
1), // Add some space between the icon and text
|
||||
Text(
|
||||
'Remove',
|
||||
style: TextStyle(fontSize: 13, color: Color(0xFF727272)),
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
13,
|
||||
color:
|
||||
Color(0xFF727272)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -725,31 +721,37 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
)
|
||||
: ElevatedButton(
|
||||
onPressed: () => {
|
||||
print('selectedValue $selectedValue'),
|
||||
if(selectedValue != null){
|
||||
print(
|
||||
'selectedValue $selectedValue'),
|
||||
if (selectedValue !=
|
||||
null)
|
||||
{
|
||||
_uploadFile(),
|
||||
} else {
|
||||
ToastHelper.showErrorToast(context, 'Please select file action')
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ToastHelper
|
||||
.showErrorToast(
|
||||
context,
|
||||
'Please select file action')
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
'Select File',
|
||||
style: TextStyle(
|
||||
color:
|
||||
Colors.white),
|
||||
color: Colors
|
||||
.white),
|
||||
),
|
||||
style: ElevatedButton
|
||||
style:
|
||||
ElevatedButton
|
||||
.styleFrom(
|
||||
backgroundColor:
|
||||
Color(
|
||||
0xFFE26728),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20),
|
||||
if (fileName ==
|
||||
null)
|
||||
SizedBox(height: 20),
|
||||
if (fileName == null)
|
||||
Text(
|
||||
'Supported Files : XLSX')
|
||||
// Add more Text widgets for additional lines of text
|
||||
@ -899,14 +901,14 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
itemCount: _paginatedData.length + 2,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) return _buildHeader();
|
||||
if (index == _paginatedData.length + 1) return _buildPagination(context);
|
||||
if (index == _paginatedData.length + 1)
|
||||
return _buildPagination(context);
|
||||
|
||||
final item = _paginatedData[index - 1];
|
||||
return _buildDataRow(item);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
// return Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
@ -1047,7 +1049,10 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
message: "Click to Download", // 📝 Tooltip text
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
getHrFileDownload(item['id'],item['file_name']); // ✅ Call your API/download logic
|
||||
getHrFileDownload(
|
||||
item['id'],
|
||||
item[
|
||||
'file_name']); // ✅ Call your API/download logic
|
||||
},
|
||||
child: Text(
|
||||
item['file_name'] ?? '-',
|
||||
@ -1094,13 +1099,9 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
child: const Row(
|
||||
children: [
|
||||
Expanded(flex: 4, child: Text('File Name', style: _headerStyle)),
|
||||
Expanded(
|
||||
flex: 3, child: Text('File Action', style: _headerStyle)),
|
||||
Expanded(
|
||||
flex: 2, child: Text('Created At', style: _headerStyle)),
|
||||
Expanded(
|
||||
flex: 2, child: Text('Status', style: _headerStyle))
|
||||
|
||||
Expanded(flex: 3, child: Text('File Action', style: _headerStyle)),
|
||||
Expanded(flex: 2, child: Text('Created At', style: _headerStyle)),
|
||||
Expanded(flex: 2, child: Text('Status', style: _headerStyle))
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -1124,79 +1125,126 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
);
|
||||
|
||||
Widget _buildPagination(BuildContext context) {
|
||||
return Row(mainAxisAlignment: MainAxisAlignment.end, children: [
|
||||
final totalPages = (filteredData.length / _rowsPerPage).ceil();
|
||||
const visiblePageCount = 5;
|
||||
|
||||
List<int> getVisiblePages() {
|
||||
if (totalPages <= visiblePageCount) {
|
||||
return List.generate(totalPages, (i) => i + 1);
|
||||
}
|
||||
|
||||
if (_currentPage <= 3) {
|
||||
return [1, 2, 3, 4, 5];
|
||||
} else if (_currentPage >= totalPages - 2) {
|
||||
return [
|
||||
totalPages - 4,
|
||||
totalPages - 3,
|
||||
totalPages - 2,
|
||||
totalPages - 1,
|
||||
totalPages
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
_currentPage - 2,
|
||||
_currentPage - 1,
|
||||
_currentPage,
|
||||
_currentPage + 1,
|
||||
_currentPage + 2,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
List<int> visiblePages = getVisiblePages();
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Dropdown for rows per page
|
||||
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),
|
||||
),
|
||||
child: Text(' $value ',
|
||||
style: GoogleFonts.poppins(fontSize: 15)),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
_rowsPerPage = newValue!;
|
||||
_currentPage =
|
||||
1; // Reset to first page when rows per page changes
|
||||
_currentPage = 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
// Previous button
|
||||
IconButton(
|
||||
onPressed: _currentPage > 1
|
||||
? () {
|
||||
setState(() {
|
||||
_currentPage--;
|
||||
});
|
||||
}
|
||||
? () => setState(() => _currentPage--)
|
||||
: null,
|
||||
icon: Icon(Icons.chevron_left),
|
||||
icon: const 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()),
|
||||
|
||||
// First page + left ellipsis
|
||||
if (!visiblePages.contains(1))
|
||||
Row(children: [
|
||||
_buildPageButton(1),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text("..."),
|
||||
),
|
||||
]),
|
||||
|
||||
// Visible page buttons
|
||||
for (int page in visiblePages) _buildPageButton(page),
|
||||
|
||||
// Right ellipsis + last page
|
||||
if (!visiblePages.contains(totalPages))
|
||||
Row(children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text("..."),
|
||||
),
|
||||
_buildPageButton(totalPages),
|
||||
]),
|
||||
|
||||
// Next button
|
||||
IconButton(
|
||||
onPressed:
|
||||
_currentPage < (filteredData.length / _rowsPerPage).ceil()
|
||||
? () {
|
||||
setState(() {
|
||||
_currentPage++;
|
||||
});
|
||||
}
|
||||
onPressed: _currentPage < totalPages
|
||||
? () => setState(() => _currentPage++)
|
||||
: null,
|
||||
icon: Icon(Icons.chevron_right),
|
||||
icon: const Icon(Icons.chevron_right),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]);
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPageButton(int page) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
_currentPage == page ? const Color(0xFF00A6A6) : Colors.grey[300],
|
||||
foregroundColor: _currentPage == page ? Colors.white : Colors.black,
|
||||
minimumSize: const Size(36, 36),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_currentPage = page;
|
||||
});
|
||||
},
|
||||
child: Text(page.toString()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String formatDate(String? dateString) {
|
||||
@ -1209,9 +1257,4 @@ class _postFileUploadState extends State<postFileUpload> {
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -268,7 +268,7 @@ class _ActivePolicieState extends State<ActivePolicies> {
|
||||
|
||||
print("logicalWidth - $logicalWidth");
|
||||
print("logicalHeight - $logicalHeight");
|
||||
return GestureDetector(
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
print("policytab - $policy");
|
||||
@ -277,7 +277,8 @@ class _ActivePolicieState extends State<ActivePolicies> {
|
||||
MaterialPageRoute(
|
||||
builder: (context) => hrPolicyDetails(
|
||||
ClientId: policy['client_id'].toString(), // <-- from map
|
||||
policyTypeId: policy['policy_type_id'].toString(), // <-- from map
|
||||
policyTypeId:
|
||||
policy['policy_type_id'].toString(), // <-- from map
|
||||
ClientPoliyId: policy['client_policy_id'].toString(),
|
||||
clientBranchId: widget.empClientBranchId,
|
||||
Token: widget.postToken,
|
||||
@ -419,7 +420,7 @@ class _ActivePolicieState extends State<ActivePolicies> {
|
||||
|
||||
Widget buildTab(String title, int index) {
|
||||
final isSelected = selectedIndex == index + 1;
|
||||
return GestureDetector(
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedIndex = index + 1;
|
||||
|
||||
@ -161,7 +161,7 @@ class _CdPolicieState extends State<CdPolicies> {
|
||||
List<List<String>> rows = [];
|
||||
|
||||
// Header
|
||||
rows.add(['Insurer Name', 'CD Account number', 'Current Balance']);
|
||||
rows.add(['Insurer Name', 'CD Account Number', 'Current Balance']);
|
||||
|
||||
// Data rows
|
||||
for (var item in data) {
|
||||
@ -527,7 +527,7 @@ class _CdPolicieState extends State<CdPolicies> {
|
||||
children: [
|
||||
Expanded(flex: 4, child: Text('Insurer Name', style: _headerStyle)),
|
||||
Expanded(
|
||||
flex: 3, child: Text('CD Account number', style: _headerStyle)),
|
||||
flex: 3, child: Text('CD Account Number', style: _headerStyle)),
|
||||
Expanded(
|
||||
flex: 2, child: Text('Current Balance', style: _headerStyle)),
|
||||
Expanded(flex: 1, child: Text('Actions', style: _headerStyle)),
|
||||
@ -554,79 +554,126 @@ class _CdPolicieState extends State<CdPolicies> {
|
||||
);
|
||||
|
||||
Widget _buildPagination(BuildContext context) {
|
||||
return Row(mainAxisAlignment: MainAxisAlignment.end, children: [
|
||||
final totalPages = (filteredData.length / _rowsPerPage).ceil();
|
||||
const visiblePageCount = 5;
|
||||
|
||||
List<int> getVisiblePages() {
|
||||
if (totalPages <= visiblePageCount) {
|
||||
return List.generate(totalPages, (i) => i + 1);
|
||||
}
|
||||
|
||||
if (_currentPage <= 3) {
|
||||
return [1, 2, 3, 4, 5];
|
||||
} else if (_currentPage >= totalPages - 2) {
|
||||
return [
|
||||
totalPages - 4,
|
||||
totalPages - 3,
|
||||
totalPages - 2,
|
||||
totalPages - 1,
|
||||
totalPages
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
_currentPage - 2,
|
||||
_currentPage - 1,
|
||||
_currentPage,
|
||||
_currentPage + 1,
|
||||
_currentPage + 2,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
List<int> visiblePages = getVisiblePages();
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Dropdown for rows per page
|
||||
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),
|
||||
),
|
||||
child: Text(' $value ',
|
||||
style: GoogleFonts.poppins(fontSize: 15)),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
_rowsPerPage = newValue!;
|
||||
_currentPage =
|
||||
1; // Reset to first page when rows per page changes
|
||||
_currentPage = 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
// Previous button
|
||||
IconButton(
|
||||
onPressed: _currentPage > 1
|
||||
? () {
|
||||
setState(() {
|
||||
_currentPage--;
|
||||
});
|
||||
}
|
||||
? () => setState(() => _currentPage--)
|
||||
: null,
|
||||
icon: Icon(Icons.chevron_left),
|
||||
icon: const 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()),
|
||||
|
||||
// First page + left ellipsis
|
||||
if (!visiblePages.contains(1))
|
||||
Row(children: [
|
||||
_buildPageButton(1),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text("..."),
|
||||
),
|
||||
]),
|
||||
|
||||
// Visible page buttons
|
||||
for (int page in visiblePages) _buildPageButton(page),
|
||||
|
||||
// Right ellipsis + last page
|
||||
if (!visiblePages.contains(totalPages))
|
||||
Row(children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text("..."),
|
||||
),
|
||||
_buildPageButton(totalPages),
|
||||
]),
|
||||
|
||||
// Next button
|
||||
IconButton(
|
||||
onPressed:
|
||||
_currentPage < (filteredData.length / _rowsPerPage).ceil()
|
||||
? () {
|
||||
setState(() {
|
||||
_currentPage++;
|
||||
});
|
||||
}
|
||||
onPressed: _currentPage < totalPages
|
||||
? () => setState(() => _currentPage++)
|
||||
: null,
|
||||
icon: Icon(Icons.chevron_right),
|
||||
icon: const Icon(Icons.chevron_right),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]);
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPageButton(int page) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
_currentPage == page ? const Color(0xFF00A6A6) : Colors.grey[300],
|
||||
foregroundColor: _currentPage == page ? Colors.white : Colors.black,
|
||||
minimumSize: const Size(36, 36),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_currentPage = page;
|
||||
});
|
||||
},
|
||||
child: Text(page.toString()),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -715,9 +715,12 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 14, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
@ -725,6 +728,7 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(item['status'] ?? '-', style: _dataBold)),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@ -736,7 +740,7 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
||||
child: Text(item['ticket_created_date'] ?? '-', style: _dataBold),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
flex: 2,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@ -815,79 +819,126 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
||||
);
|
||||
|
||||
Widget _buildPagination(BuildContext context) {
|
||||
return Row(mainAxisAlignment: MainAxisAlignment.end, children: [
|
||||
final totalPages = (filteredData.length / _rowsPerPage).ceil();
|
||||
const visiblePageCount = 5;
|
||||
|
||||
List<int> getVisiblePages() {
|
||||
if (totalPages <= visiblePageCount) {
|
||||
return List.generate(totalPages, (i) => i + 1);
|
||||
}
|
||||
|
||||
if (_currentPage <= 3) {
|
||||
return [1, 2, 3, 4, 5];
|
||||
} else if (_currentPage >= totalPages - 2) {
|
||||
return [
|
||||
totalPages - 4,
|
||||
totalPages - 3,
|
||||
totalPages - 2,
|
||||
totalPages - 1,
|
||||
totalPages
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
_currentPage - 2,
|
||||
_currentPage - 1,
|
||||
_currentPage,
|
||||
_currentPage + 1,
|
||||
_currentPage + 2,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
List<int> visiblePages = getVisiblePages();
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Dropdown for rows per page
|
||||
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),
|
||||
),
|
||||
child: Text(' $value ',
|
||||
style: GoogleFonts.poppins(fontSize: 15)),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
_rowsPerPage = newValue!;
|
||||
_currentPage =
|
||||
1; // Reset to first page when rows per page changes
|
||||
_currentPage = 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
// Previous button
|
||||
IconButton(
|
||||
onPressed: _currentPage > 1
|
||||
? () {
|
||||
setState(() {
|
||||
_currentPage--;
|
||||
});
|
||||
}
|
||||
? () => setState(() => _currentPage--)
|
||||
: null,
|
||||
icon: Icon(Icons.chevron_left),
|
||||
icon: const 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()),
|
||||
|
||||
// First page + left ellipsis
|
||||
if (!visiblePages.contains(1))
|
||||
Row(children: [
|
||||
_buildPageButton(1),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text("..."),
|
||||
),
|
||||
]),
|
||||
|
||||
// Visible page buttons
|
||||
for (int page in visiblePages) _buildPageButton(page),
|
||||
|
||||
// Right ellipsis + last page
|
||||
if (!visiblePages.contains(totalPages))
|
||||
Row(children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text("..."),
|
||||
),
|
||||
_buildPageButton(totalPages),
|
||||
]),
|
||||
|
||||
// Next button
|
||||
IconButton(
|
||||
onPressed:
|
||||
_currentPage < (filteredData.length / _rowsPerPage).ceil()
|
||||
? () {
|
||||
setState(() {
|
||||
_currentPage++;
|
||||
});
|
||||
}
|
||||
onPressed: _currentPage < totalPages
|
||||
? () => setState(() => _currentPage++)
|
||||
: null,
|
||||
icon: Icon(Icons.chevron_right),
|
||||
icon: const Icon(Icons.chevron_right),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]);
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPageButton(int page) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
_currentPage == page ? const Color(0xFF00A6A6) : Colors.grey[300],
|
||||
foregroundColor: _currentPage == page ? Colors.white : Colors.black,
|
||||
minimumSize: const Size(36, 36),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_currentPage = page;
|
||||
});
|
||||
},
|
||||
child: Text(page.toString()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildName(BuildContext context) {
|
||||
|
||||
@ -239,7 +239,7 @@ class _PreEnrollmentState extends State<PreEnrollment> {
|
||||
|
||||
print("logicalWidth - $logicalWidth");
|
||||
print("logicalHeight - $logicalHeight");
|
||||
return GestureDetector(
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
print("policytab - $policy");
|
||||
@ -248,7 +248,8 @@ class _PreEnrollmentState extends State<PreEnrollment> {
|
||||
MaterialPageRoute(
|
||||
builder: (context) => hrPolicyDetails(
|
||||
ClientId: policy['client_id'].toString(), // <-- from map
|
||||
policyTypeId: policy['policy_type_id'].toString(), // <-- from map
|
||||
policyTypeId:
|
||||
policy['policy_type_id'].toString(), // <-- from map
|
||||
ClientPoliyId: policy['client_policy_id'].toString(),
|
||||
clientBranchId: widget.enrollmentClientBranchId,
|
||||
Token: widget.enrollToken,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user