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 '../service/token_storage_service.dart';
|
||||||
import 'branch_card_widget.dart';
|
import 'branch_card_widget.dart';
|
||||||
|
|
||||||
|
|
||||||
class BranchSelectionPage extends StatefulWidget {
|
class BranchSelectionPage extends StatefulWidget {
|
||||||
const BranchSelectionPage({Key? key}) : super(key: key);
|
const BranchSelectionPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@ -65,16 +64,16 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
|||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
//Post Token Decode Details
|
//Post Token Decode Details
|
||||||
final empClientBranchId = decodedToken?['post_branch_id'];
|
final empClientBranchId = decodedToken?['post_branch_id'];
|
||||||
await prefs.setString('empClientBranchId', empClientBranchId);
|
await prefs.setString('empClientBranchId', empClientBranchId);
|
||||||
|
|
||||||
final empPrimaryId = decodedToken?['post_hr_id'];
|
final empPrimaryId = decodedToken?['post_hr_id'];
|
||||||
await prefs.setString('empPrimaryId', empPrimaryId);
|
await prefs.setString('empPrimaryId', empPrimaryId);
|
||||||
|
|
||||||
final empClientId = decodedToken?['post_client_id'];
|
final empClientId = decodedToken?['post_client_id'];
|
||||||
await prefs.setString('empClientId', empClientId);
|
await prefs.setString('empClientId', empClientId);
|
||||||
|
|
||||||
final empHrId = decodedToken?['post_hr_id'];
|
final empHrId = decodedToken?['post_hr_id'];
|
||||||
await prefs.setString('empHrId', empHrId);
|
await prefs.setString('empHrId', empHrId);
|
||||||
|
|
||||||
dynamic allowedModules = decodedToken?['allowed_modules'];
|
dynamic allowedModules = decodedToken?['allowed_modules'];
|
||||||
@ -86,15 +85,16 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
|||||||
|
|
||||||
final empAllowedModules = allowedModules['post'];
|
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'];
|
// final empAllowed_modules = decodedToken?['allowed_modules'][0]['post'];
|
||||||
// await prefs.setString('empAllowed_modules', jsonEncode(empAllowed_modules));
|
// await prefs.setString('empAllowed_modules', jsonEncode(empAllowed_modules));
|
||||||
|
|
||||||
|
|
||||||
//Pre Token Decode Details
|
//Pre Token Decode Details
|
||||||
final enrollmentEmpClientBranchId = decodedToken?['pre_branch_id'];
|
final enrollmentEmpClientBranchId = decodedToken?['pre_branch_id'];
|
||||||
await prefs.setString('enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
await prefs.setString(
|
||||||
|
'enrollmentEmpClientBranchId', enrollmentEmpClientBranchId);
|
||||||
|
|
||||||
final enrollmentEmpPrimaryId = decodedToken?['pre_hr_id'];
|
final enrollmentEmpPrimaryId = decodedToken?['pre_hr_id'];
|
||||||
await prefs.setString('enrollmentEmpPrimaryId', enrollmentEmpPrimaryId);
|
await prefs.setString('enrollmentEmpPrimaryId', enrollmentEmpPrimaryId);
|
||||||
@ -105,20 +105,19 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
|||||||
final enrollmentHrId = decodedToken?['pre_hr_id'];
|
final enrollmentHrId = decodedToken?['pre_hr_id'];
|
||||||
await prefs.setString('enrollmentHrId', enrollmentHrId);
|
await prefs.setString('enrollmentHrId', enrollmentHrId);
|
||||||
|
|
||||||
|
|
||||||
final enrollmentAllowedModules = allowedModules['pre'];
|
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'];
|
// final enrollmentAllowed_modules = decodedToken?['allowed_modules'][1]['pre'];
|
||||||
// await prefs.setString('enrollmentAllowed_modules', jsonEncode(enrollmentAllowed_modules));
|
// await prefs.setString('enrollmentAllowed_modules', jsonEncode(enrollmentAllowed_modules));
|
||||||
|
|
||||||
final token = await tokenStorage.getCurrentToken();
|
final token = await tokenStorage.getCurrentToken();
|
||||||
print('tokenbranch - $token');
|
print('tokenbranch - $token');
|
||||||
await prefs.setString('token', token!);
|
await prefs.setString('token', token!);
|
||||||
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
ToastHelper.showSuccessToast(context, 'Successfully Login');
|
||||||
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
Navigator.pushReplacementNamed(context, 'hrDashboard');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,8 +164,8 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
|||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: horizontalPadding , // Inner horizontal padding
|
horizontal: horizontalPadding, // Inner horizontal padding
|
||||||
vertical: 20, // Inner vertical padding
|
vertical: 20, // Inner vertical padding
|
||||||
), // Outer padding
|
), // Outer padding
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -182,7 +181,7 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
|||||||
),
|
),
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 24.0, // Inner horizontal padding
|
horizontal: 24.0, // Inner horizontal padding
|
||||||
vertical: 28.0, // Inner vertical padding
|
vertical: 28.0, // Inner vertical padding
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -196,41 +195,42 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 25),
|
SizedBox(height: 25),
|
||||||
|
|
||||||
Container(
|
Container(
|
||||||
height: gridHeight, // Shows approximately 3 rows
|
height: gridHeight, // Shows approximately 3 rows
|
||||||
child: branches.isEmpty
|
child: branches.isEmpty
|
||||||
? Center(
|
? Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'No branches available',
|
'No branches available',
|
||||||
style: TextStyle(fontSize: 16, color: Colors.grey),
|
style: TextStyle(
|
||||||
),
|
fontSize: 16, color: Colors.grey),
|
||||||
)
|
),
|
||||||
|
)
|
||||||
: GridView.builder(
|
: GridView.builder(
|
||||||
// Enable scrolling if content exceeds height
|
// Enable scrolling if content exceeds height
|
||||||
physics: ClampingScrollPhysics(),
|
physics: ClampingScrollPhysics(),
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate:
|
||||||
crossAxisCount: crossAxisCount,
|
SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
childAspectRatio: childAspectRatio,
|
crossAxisCount: crossAxisCount,
|
||||||
crossAxisSpacing: 15,
|
childAspectRatio: childAspectRatio,
|
||||||
mainAxisSpacing: 15,
|
crossAxisSpacing: 15,
|
||||||
),
|
mainAxisSpacing: 15,
|
||||||
itemCount: branches.length,
|
),
|
||||||
itemBuilder: (context, index) {
|
itemCount: branches.length,
|
||||||
final branch = branches[index];
|
itemBuilder: (context, index) {
|
||||||
return BranchCard(
|
final branch = branches[index];
|
||||||
clientName: branch['client_name'] ?? 'Unknown Client',
|
return BranchCard(
|
||||||
branchName: branch['branch_name'] ?? 'Unknown Branch',
|
clientName: branch['client_name'] ??
|
||||||
isSelected: selectedIndex == index,
|
'Unknown Client',
|
||||||
onTap: () => _selectBranch(index),
|
branchName: branch['branch_name'] ??
|
||||||
);
|
'Unknown Branch',
|
||||||
},
|
isSelected: selectedIndex == index,
|
||||||
),
|
onTap: () => _selectBranch(index),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(height: 24),
|
SizedBox(height: 24),
|
||||||
|
|
||||||
Center(
|
Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 120,
|
width: 120,
|
||||||
|
|||||||
@ -336,7 +336,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
'Transaction Details - ${widget.insurerName} (${widget.cdMasterAccountNo})',
|
'Transaction Details - ${widget.insurerName} (${widget.cdMasterAccountNo})',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 18,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Color(0xFF101010),
|
color: Color(0xFF101010),
|
||||||
),
|
),
|
||||||
@ -346,7 +346,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 10),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -434,7 +434,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
'Export',
|
'Export',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 16,
|
fontSize: 14,
|
||||||
color: Color(0xFFFFFFFF),
|
color: Color(0xFFFFFFFF),
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
letterSpacing: 1),
|
letterSpacing: 1),
|
||||||
@ -561,7 +561,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
'Date',
|
'Date',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -570,7 +572,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
'Record Date',
|
'Record Date',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -579,7 +583,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
'Unit',
|
'Unit',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -588,16 +594,20 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
'Policy',
|
'Policy',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 3,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Endorsement No',
|
'Endorsement No',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -606,7 +616,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
'Sub Type',
|
'Sub Type',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -615,7 +627,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
'Credit',
|
'Credit',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -624,7 +638,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
'Debit',
|
'Debit',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -633,7 +649,9 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
'Balance',
|
'Balance',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -642,16 +660,20 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
'Description',
|
'Description',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Color(0xFF000000), fontWeight: FontWeight.bold),
|
fontSize: 12,
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
'User',
|
'User',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(
|
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(
|
child: Text(
|
||||||
formatDateNextLine(item['created_at']),
|
formatDateNextLine(item['created_at']),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -691,7 +716,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
item['record_date'] ?? '-',
|
item['record_date'] ?? '-',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -700,7 +728,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
// '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),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -711,18 +742,25 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
item['policy_type'].toString().trim().isNotEmpty &&
|
item['policy_type'].toString().trim().isNotEmpty &&
|
||||||
item['policy_no'] != null &&
|
item['policy_no'] != null &&
|
||||||
item['policy_no'].toString().trim().isNotEmpty
|
item['policy_no'].toString().trim().isNotEmpty
|
||||||
|
// ? '${item['policy_no']}'
|
||||||
? '${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),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 3,
|
||||||
child: Text(
|
child: Text(
|
||||||
item['endorsement_no'] ?? '-',
|
item['endorsement_no'] ?? '-',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -730,7 +768,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
item['sub_type'] ?? '-',
|
item['sub_type'] ?? '-',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -740,7 +781,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
? '₹${item['amount']}'
|
? '₹${item['amount']}'
|
||||||
: '-',
|
: '-',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -750,7 +794,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
? '₹${item['amount']}'
|
? '₹${item['amount']}'
|
||||||
: '-',
|
: '-',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -758,7 +805,10 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
"₹${item['balance'] ?? '-'}",
|
"₹${item['balance'] ?? '-'}",
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -766,15 +816,21 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
item['description'] ?? '-',
|
item['description'] ?? '-',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
style: GoogleFonts.poppins(
|
||||||
|
color: Color(0xFF000000),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
item['username'] ?? '-',
|
item['username'] ?? '-',
|
||||||
textAlign: TextAlign.left,
|
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();
|
// _checkTokens();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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('_postToken');
|
// final String? hrtoken = prefs.getString('_postToken');
|
||||||
@ -43,82 +42,127 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
|||||||
preferredSize: widget.preferredSize,
|
preferredSize: widget.preferredSize,
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: Responsive.isDesktop(context)
|
// padding: Responsive.isDesktop(context)
|
||||||
? EdgeInsets.symmetric(horizontal: 16.0)
|
// ? EdgeInsets.symmetric(horizontal: 46.0)
|
||||||
: EdgeInsets.symmetric(horizontal: 0),
|
// : EdgeInsets.symmetric(horizontal: 0),
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: MediaQuery.of(context).size.width *
|
||||||
|
(Responsive.isDesktop(context) ? 0.03 : 0.02),
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
// Logo Column
|
// Logo Column
|
||||||
Expanded(
|
// Expanded(
|
||||||
flex: Responsive.isDesktop(context) ? 3 : 9,
|
// // flex: Responsive.isDesktop(context) ? 1 : 9,
|
||||||
child: Row(
|
// child:
|
||||||
mainAxisAlignment: Responsive.isDesktop(context)
|
Row(
|
||||||
? MainAxisAlignment.spaceEvenly
|
mainAxisAlignment: Responsive.isDesktop(context)
|
||||||
: MainAxisAlignment.start,
|
? MainAxisAlignment.spaceEvenly
|
||||||
children: [
|
: MainAxisAlignment.start,
|
||||||
Container(
|
children: [
|
||||||
margin: EdgeInsets.only(top: 10, bottom: 10),
|
Container(
|
||||||
width: 150,
|
margin: EdgeInsets.only(top: 10, bottom: 10),
|
||||||
height: 150,
|
width: 150,
|
||||||
child: Image.asset(
|
height: 150,
|
||||||
'assets/nhance_client_logo.png',
|
child: Image.asset(
|
||||||
fit: BoxFit.contain,
|
'assets/nhance_client_logo.png',
|
||||||
),
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
|
// ),
|
||||||
// AdaptiveNavBar Column
|
// AdaptiveNavBar Column
|
||||||
Expanded(
|
|
||||||
flex: Responsive.isDesktop(context) ? 9 : 3,
|
// Expanded(
|
||||||
child: AdaptiveNavBar(
|
// // flex: Responsive.isDesktop(context) ? 1 : 9,
|
||||||
screenWidth: sw,
|
// child:
|
||||||
backgroundColor: Color(0xFFFFFCE5),
|
Row(
|
||||||
leading:
|
mainAxisSize: MainAxisSize.min,
|
||||||
Container(), // Set an empty container as we have the logo separately
|
children: [
|
||||||
title: Text(''),
|
NavBarItem(
|
||||||
navBarItems: [
|
text: "Change Branch",
|
||||||
// if (Responsive.isDesktop(context))
|
onTap: () async {
|
||||||
// if (hideInactiveStatus)
|
final prefs = await SharedPreferences.getInstance();
|
||||||
// NavBarItem(
|
await prefs.remove('selected_branch');
|
||||||
// text: "Inactive Policy",
|
await prefs.remove('decoded_token');
|
||||||
// onTap: () {
|
await prefs.remove('clientLogo');
|
||||||
// Navigator.pushNamed(context, 'oldPolicy');
|
await prefs.remove('clientName');
|
||||||
// },
|
await prefs.remove('empAllowed_modules');
|
||||||
// ),
|
await prefs.remove('empClientBranchId');
|
||||||
// if (showBackToHR)
|
await prefs.remove('empClientId');
|
||||||
NavBarItem(
|
await prefs.remove('empEmail');
|
||||||
text: "Change Branch",
|
await prefs.remove('empHrId');
|
||||||
onTap: () async {
|
await prefs.remove('empPrimaryId');
|
||||||
final prefs = await SharedPreferences.getInstance();
|
await prefs.remove('enrollmentAllowed_modules');
|
||||||
await prefs.remove('selected_branch');
|
await prefs.remove('enrollmentClient_id');
|
||||||
await prefs.remove('decoded_token');
|
await prefs.remove('enrollmentEmpClientBranchId');
|
||||||
await prefs.remove('clientLogo');
|
await prefs.remove('enrollmentEmpPrimaryId');
|
||||||
await prefs.remove('clientName');
|
await prefs.remove('enrollmentHrId');
|
||||||
await prefs.remove('empAllowed_modules');
|
await prefs.remove('token');
|
||||||
await prefs.remove('empClientBranchId');
|
Navigator.pushNamed(context, 'branchSelection');
|
||||||
await prefs.remove('empClientId');
|
},
|
||||||
await prefs.remove('empEmail');
|
),
|
||||||
await prefs.remove('empHrId');
|
const SizedBox(width: 8),
|
||||||
await prefs.remove('empPrimaryId');
|
NavBarItem(
|
||||||
await prefs.remove('enrollmentAllowed_modules');
|
text: "Logout",
|
||||||
await prefs.remove('enrollmentClient_id');
|
onTap: () => logout(context),
|
||||||
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);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
// )
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -486,90 +486,99 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
// if (widget.TokenType != "post")
|
// if (widget.TokenType != "post")
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => widget.TokenType != "post" ? excelVerify(
|
builder: (context) => widget
|
||||||
ClientId:
|
.TokenType !=
|
||||||
widget.ClientId, // <-- from map
|
"post"
|
||||||
policyTypeId: widget.policyTypeId,
|
? excelVerify(
|
||||||
ClientPoliyId: widget.ClientPoliyId,
|
ClientId: widget
|
||||||
clientBranchId:
|
.ClientId, // <-- from map
|
||||||
widget.clientBranchId,
|
policyTypeId:
|
||||||
Token: widget.Token,
|
widget.policyTypeId,
|
||||||
TokenType: widget.TokenType,
|
ClientPoliyId:
|
||||||
cardType: widget.cardType,
|
widget.ClientPoliyId,
|
||||||
cardPolicyNo: widget.cardPolicyNo,
|
clientBranchId:
|
||||||
cardInsurer_name:
|
widget.clientBranchId,
|
||||||
widget.cardInsurer_name,
|
Token: widget.Token,
|
||||||
cardPolicy_name:
|
TokenType: widget.TokenType,
|
||||||
widget.cardPolicy_name,
|
cardType: widget.cardType,
|
||||||
cardPolicy_ExpDate:
|
cardPolicyNo:
|
||||||
widget.cardPolicy_ExpDate,
|
widget.cardPolicyNo,
|
||||||
|
cardInsurer_name:
|
||||||
|
widget.cardInsurer_name,
|
||||||
|
cardPolicy_name:
|
||||||
|
widget.cardPolicy_name,
|
||||||
|
cardPolicy_ExpDate:
|
||||||
|
widget.cardPolicy_ExpDate,
|
||||||
|
|
||||||
// Token: widget.Token,
|
// Token: widget.Token,
|
||||||
// ClientId: widget.ClientId,
|
// ClientId: widget.ClientId,
|
||||||
// ClientPolicyId : widget.ClientPoliyId,
|
// ClientPolicyId : widget.ClientPoliyId,
|
||||||
// PolicyName: widget.cardPolicy_name,
|
// PolicyName: widget.cardPolicy_name,
|
||||||
// PolicyNo: widget.cardPolicyNo,
|
// PolicyNo: widget.cardPolicyNo,
|
||||||
// ClientBranchId: widget.HrId,
|
// ClientBranchId: widget.HrId,
|
||||||
// PolicyType: widget.cardType,
|
// PolicyType: widget.cardType,
|
||||||
) : postFileUpload(
|
)
|
||||||
ClientId:
|
: postFileUpload(
|
||||||
widget.ClientId, // <-- from map
|
ClientId: widget
|
||||||
policyTypeId: widget.policyTypeId,
|
.ClientId, // <-- from map
|
||||||
ClientPoliyId: widget.ClientPoliyId,
|
policyTypeId:
|
||||||
clientBranchId:
|
widget.policyTypeId,
|
||||||
widget.clientBranchId,
|
ClientPoliyId:
|
||||||
Token: widget.Token,
|
widget.ClientPoliyId,
|
||||||
TokenType: widget.TokenType,
|
clientBranchId:
|
||||||
cardType: widget.cardType,
|
widget.clientBranchId,
|
||||||
cardPolicyNo: widget.cardPolicyNo,
|
Token: widget.Token,
|
||||||
cardInsurer_name:
|
TokenType: widget.TokenType,
|
||||||
widget.cardInsurer_name,
|
cardType: widget.cardType,
|
||||||
cardPolicy_name:
|
cardPolicyNo:
|
||||||
widget.cardPolicy_name,
|
widget.cardPolicyNo,
|
||||||
cardPolicy_ExpDate:
|
cardInsurer_name:
|
||||||
widget.cardPolicy_ExpDate,
|
widget.cardInsurer_name,
|
||||||
|
cardPolicy_name:
|
||||||
|
widget.cardPolicy_name,
|
||||||
|
cardPolicy_ExpDate:
|
||||||
|
widget.cardPolicy_ExpDate,
|
||||||
|
|
||||||
// Token: widget.Token,
|
// Token: widget.Token,
|
||||||
// ClientId: widget.ClientId,
|
// ClientId: widget.ClientId,
|
||||||
// ClientPolicyId : widget.ClientPoliyId,
|
// ClientPolicyId : widget.ClientPoliyId,
|
||||||
// PolicyName: widget.cardPolicy_name,
|
// PolicyName: widget.cardPolicy_name,
|
||||||
// PolicyNo: widget.cardPolicyNo,
|
// PolicyNo: widget.cardPolicyNo,
|
||||||
// ClientBranchId: widget.HrId,
|
// ClientBranchId: widget.HrId,
|
||||||
// PolicyType: widget.cardType,
|
// PolicyType: widget.cardType,
|
||||||
)
|
)),
|
||||||
),
|
);
|
||||||
);
|
// exportToCsv(filteredData);
|
||||||
// exportToCsv(filteredData);
|
},
|
||||||
},
|
style: ElevatedButton.styleFrom(
|
||||||
style: ElevatedButton.styleFrom(
|
backgroundColor: Color(0xFFE26728),
|
||||||
backgroundColor: Color(0xFFE26728),
|
padding:
|
||||||
padding: EdgeInsets.all(
|
EdgeInsets.all(10), // Internal padding
|
||||||
10), // Internal padding
|
shape: RoundedRectangleBorder(
|
||||||
shape: RoundedRectangleBorder(
|
borderRadius: BorderRadius.circular(
|
||||||
borderRadius: BorderRadius.circular(
|
10), // Border radius
|
||||||
10), // Border radius
|
side: BorderSide(
|
||||||
side: BorderSide(
|
color: Colors
|
||||||
color: Colors
|
.transparent, // Optional border color
|
||||||
.transparent, // Optional border color
|
width: 1, // Border width
|
||||||
width: 1, // Border width
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
elevation: 0,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'Import',
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Color(0xFFFFFFFF),
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
letterSpacing: 1),
|
|
||||||
),
|
),
|
||||||
|
elevation: 0,
|
||||||
),
|
),
|
||||||
|
child: Text(
|
||||||
|
'Import',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Color(0xFFFFFFFF),
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
letterSpacing: 1),
|
||||||
|
),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
@ -702,17 +711,17 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if(widget.policyTypeId != '6' && widget.policyTypeId != '7')
|
if (widget.policyTypeId != '6' && widget.policyTypeId != '7')
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
'UHID',
|
'UHID',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -803,7 +812,6 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: _paginatedData.mapIndexed((index, item) {
|
children: _paginatedData.mapIndexed((index, item) {
|
||||||
return Container(
|
return Container(
|
||||||
|
|
||||||
// margin: const EdgeInsets.only(bottom: 8),
|
// margin: const EdgeInsets.only(bottom: 8),
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
|
const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
|
||||||
@ -844,17 +852,18 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if(widget.policyTypeId != '6' && widget.policyTypeId != '7')
|
if (widget.policyTypeId != '6' &&
|
||||||
Expanded(
|
widget.policyTypeId != '7')
|
||||||
flex: 2,
|
Expanded(
|
||||||
child: Text(
|
flex: 2,
|
||||||
item['uhid'] ?? '-',
|
child: Text(
|
||||||
style: GoogleFonts.poppins(
|
item['uhid'] ?? '-',
|
||||||
color: Color(0xFF000000),
|
style: GoogleFonts.poppins(
|
||||||
fontWeight: FontWeight.w400,
|
color: Color(0xFF000000),
|
||||||
fontSize: 12),
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 12),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -930,92 +939,92 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (widget.TokenType != "pre" && (hasAnyEcardLink || hasModule))
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Builder(
|
|
||||||
builder: (context) {
|
|
||||||
final isSelf = item['relationship'] == 'Self';
|
|
||||||
final hasEcard = item['ecard_download_link'] != null;
|
|
||||||
final showEcard = isSelf && hasEcard;
|
|
||||||
final showClaim = widget.TokenType == "post" && hasModule;
|
|
||||||
|
|
||||||
if (!showEcard && !showClaim) {
|
if (widget.TokenType != "pre" && (hasAnyEcardLink || hasModule))
|
||||||
return SizedBox(); // No icon to show
|
Expanded(
|
||||||
}
|
flex: 3,
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) {
|
||||||
|
final isSelf = item['relationship'] == 'Self';
|
||||||
|
final hasEcard = item['ecard_download_link'] != null;
|
||||||
|
final showEcard = isSelf && hasEcard;
|
||||||
|
final showClaim = widget.TokenType == "post" && hasModule;
|
||||||
|
|
||||||
return Row(
|
if (!showEcard && !showClaim) {
|
||||||
mainAxisAlignment: showEcard && !showClaim
|
return SizedBox(); // No icon to show
|
||||||
? MainAxisAlignment.start // Only eCard, push to right
|
}
|
||||||
: MainAxisAlignment.end, // eCard + claim OR only claim
|
|
||||||
children: [
|
|
||||||
if (showEcard)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
getEcardDownload(item['emp_code'],item['employee_id'],item['client_policy_id'],item['policy_no']);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
height: 40,
|
|
||||||
width: 40,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0xFFE6F5F6),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/credit_card.png',
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
if (showEcard && showClaim) SizedBox(width: 8),
|
return Row(
|
||||||
|
mainAxisAlignment: showEcard && !showClaim
|
||||||
|
? MainAxisAlignment.start // Only eCard, push to right
|
||||||
|
: MainAxisAlignment.end, // eCard + claim OR only claim
|
||||||
|
children: [
|
||||||
|
if (showEcard)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
getEcardDownload(item['emp_code'],item['employee_id'],item['client_policy_id'],item['policy_no']);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
height: 40,
|
||||||
|
width: 40,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color(0xFFE6F5F6),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(4),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/credit_card.png',
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
if (showClaim)
|
if (showEcard && showClaim) SizedBox(width: 8),
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
if (showClaim)
|
||||||
child: GestureDetector(
|
Padding(
|
||||||
onTap: () {
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
Navigator.push(
|
child: GestureDetector(
|
||||||
context,
|
onTap: () {
|
||||||
MaterialPageRoute(
|
Navigator.push(
|
||||||
builder: (context) => hrDashboard(
|
context,
|
||||||
selectedIndex: 3,
|
MaterialPageRoute(
|
||||||
empCodeFromHrPolicy: item['emp_code']!,
|
builder: (context) => hrDashboard(
|
||||||
isHrcode: 1,
|
selectedIndex: 3,
|
||||||
),
|
empCodeFromHrPolicy: item['emp_code']!,
|
||||||
),
|
isHrcode: 1,
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
height: 40,
|
|
||||||
width: 40,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0xFFE6F5F6),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(4),
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/claim.png',
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
height: 40,
|
||||||
|
width: 40,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color(0xFFE6F5F6),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(4),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/claim.png',
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
// if (widget.TokenType != "pre" &&
|
|
||||||
// (hasAnyEcardLink || hasModule))
|
// (hasAnyEcardLink || hasModule))
|
||||||
// Expanded(
|
// Expanded(
|
||||||
// flex: 3,
|
// flex: 3,
|
||||||
@ -1093,85 +1102,208 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
// ),
|
// ),
|
||||||
|
_buildPagination(context)
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
// mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
// children: [
|
||||||
Padding(
|
// Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
// padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
child: Row(
|
// child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
DropdownButton<int>(
|
// DropdownButton<int>(
|
||||||
value: _rowsPerPage,
|
// value: _rowsPerPage,
|
||||||
items: [5, 10, 15, 20, 50].map((int value) {
|
// items: [5, 10, 15, 20, 50].map((int value) {
|
||||||
return DropdownMenuItem<int>(
|
// return DropdownMenuItem<int>(
|
||||||
value: value,
|
// value: value,
|
||||||
child: Text(
|
// child: Text(
|
||||||
' $value ',
|
// ' $value ',
|
||||||
style: GoogleFonts.poppins(fontSize: 15),
|
// style: GoogleFonts.poppins(fontSize: 15),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}).toList(),
|
// }).toList(),
|
||||||
onChanged: (newValue) {
|
// onChanged: (newValue) {
|
||||||
setState(() {
|
// setState(() {
|
||||||
_rowsPerPage = newValue!;
|
// _rowsPerPage = newValue!;
|
||||||
_currentPage =
|
// _currentPage =
|
||||||
1; // Reset to first page when rows per page changes
|
// 1; // Reset to first page when rows per page changes
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
IconButton(
|
// IconButton(
|
||||||
onPressed: _currentPage > 1
|
// onPressed: _currentPage > 1
|
||||||
? () {
|
// ? () {
|
||||||
setState(() {
|
// setState(() {
|
||||||
_currentPage--;
|
// _currentPage--;
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
: null,
|
// : null,
|
||||||
icon: Icon(Icons.chevron_left),
|
// icon: Icon(Icons.chevron_left),
|
||||||
),
|
// ),
|
||||||
for (int i = 1;
|
// for (int i = 1;
|
||||||
i <= (filteredData.length / _rowsPerPage).ceil();
|
// i <= (filteredData.length / _rowsPerPage).ceil();
|
||||||
i++)
|
// i++)
|
||||||
Padding(
|
// Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
// padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
child: ElevatedButton(
|
// child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
// style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: _currentPage == i
|
// backgroundColor: _currentPage == i
|
||||||
? Color(0xFF00A6A6)
|
// ? Color(0xFF00A6A6)
|
||||||
: Colors.grey[300],
|
// : Colors.grey[300],
|
||||||
foregroundColor:
|
// foregroundColor:
|
||||||
_currentPage == i ? Colors.white : Colors.black,
|
// _currentPage == i ? Colors.white : Colors.black,
|
||||||
minimumSize: Size(36, 36),
|
// minimumSize: Size(36, 36),
|
||||||
padding: EdgeInsets.zero,
|
// padding: EdgeInsets.zero,
|
||||||
),
|
// ),
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
setState(() {
|
// setState(() {
|
||||||
_currentPage = i;
|
// _currentPage = i;
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
child: Text(i.toString()),
|
// child: Text(i.toString()),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
IconButton(
|
// IconButton(
|
||||||
onPressed: _currentPage <
|
// onPressed: _currentPage <
|
||||||
(filteredData.length / _rowsPerPage).ceil()
|
// (filteredData.length / _rowsPerPage).ceil()
|
||||||
? () {
|
// ? () {
|
||||||
setState(() {
|
// setState(() {
|
||||||
_currentPage++;
|
// _currentPage++;
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
: null,
|
// : null,
|
||||||
icon: Icon(Icons.chevron_right),
|
// icon: Icon(Icons.chevron_right),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(
|
||||||
|
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)),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (newValue) {
|
||||||
|
setState(() {
|
||||||
|
_rowsPerPage = newValue!;
|
||||||
|
_currentPage = 1;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
// Previous button
|
||||||
|
IconButton(
|
||||||
|
onPressed: _currentPage > 1
|
||||||
|
? () => setState(() => _currentPage--)
|
||||||
|
: null,
|
||||||
|
icon: const Icon(Icons.chevron_left),
|
||||||
|
),
|
||||||
|
|
||||||
|
// 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 == 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()),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,17 +37,17 @@ class postFileUpload extends StatefulWidget {
|
|||||||
final String cardPolicy_ExpDate;
|
final String cardPolicy_ExpDate;
|
||||||
const postFileUpload(
|
const postFileUpload(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
required this.ClientId,
|
required this.ClientId,
|
||||||
required this.policyTypeId,
|
required this.policyTypeId,
|
||||||
required this.ClientPoliyId,
|
required this.ClientPoliyId,
|
||||||
required this.clientBranchId,
|
required this.clientBranchId,
|
||||||
required this.Token,
|
required this.Token,
|
||||||
required this.TokenType,
|
required this.TokenType,
|
||||||
required this.cardType,
|
required this.cardType,
|
||||||
required this.cardPolicyNo,
|
required this.cardPolicyNo,
|
||||||
required this.cardInsurer_name,
|
required this.cardInsurer_name,
|
||||||
required this.cardPolicy_name,
|
required this.cardPolicy_name,
|
||||||
required this.cardPolicy_ExpDate})
|
required this.cardPolicy_ExpDate})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -81,7 +81,7 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
dynamic empRefId;
|
dynamic empRefId;
|
||||||
dynamic empPrimaryId;
|
dynamic empPrimaryId;
|
||||||
List<Map<String, dynamic>> getFileUploadMasterList = [];
|
List<Map<String, dynamic>> getFileUploadMasterList = [];
|
||||||
dynamic getThrFileList = [];
|
dynamic getThrFileList = [];
|
||||||
late int excelValidationStaus = 1;
|
late int excelValidationStaus = 1;
|
||||||
bool isSuccess = false;
|
bool isSuccess = false;
|
||||||
String successContent = '';
|
String successContent = '';
|
||||||
@ -96,7 +96,7 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
List<dynamic> get _paginatedData {
|
List<dynamic> get _paginatedData {
|
||||||
final startIndex = (_currentPage - 1) * _rowsPerPage;
|
final startIndex = (_currentPage - 1) * _rowsPerPage;
|
||||||
final endIndex =
|
final endIndex =
|
||||||
(_currentPage * _rowsPerPage).clamp(0, filteredData.length);
|
(_currentPage * _rowsPerPage).clamp(0, filteredData.length);
|
||||||
return filteredData.sublist(startIndex, endIndex);
|
return filteredData.sublist(startIndex, endIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,6 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
String? selectedValue;
|
String? selectedValue;
|
||||||
String? _selectedAction;
|
String? _selectedAction;
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -174,7 +173,6 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
Future<void> getFileUploadMasterDetails() async {
|
Future<void> getFileUploadMasterDetails() async {
|
||||||
print('9');
|
print('9');
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final response = await apiService.getFileUploadMastersToApi(widget.Token);
|
final response = await apiService.getFileUploadMastersToApi(widget.Token);
|
||||||
|
|
||||||
if (response['status'] == true) {
|
if (response['status'] == true) {
|
||||||
@ -210,8 +208,8 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
empPrimaryId = prefs.getString('empPrimaryId');
|
empPrimaryId = prefs.getString('empPrimaryId');
|
||||||
print('9');
|
print('9');
|
||||||
try {
|
try {
|
||||||
|
final response = await apiService.getFileListToApi(
|
||||||
final response = await apiService.getFileListToApi(empPrimaryId,widget.cardPolicyNo,widget.Token);
|
empPrimaryId, widget.cardPolicyNo, widget.Token);
|
||||||
|
|
||||||
if (response['status'] == 'success') {
|
if (response['status'] == 'success') {
|
||||||
print('getThrFileList');
|
print('getThrFileList');
|
||||||
@ -237,45 +235,44 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getHrFileDownload(id,file_name) async {
|
Future<void> getHrFileDownload(id, file_name) async {
|
||||||
// final http.Response response = await apiService.getHrFileDownloadToApi(id, widget.Token);
|
// final http.Response response = await apiService.getHrFileDownloadToApi(id, widget.Token);
|
||||||
final apiurl = Environment.apiUrlPost;
|
final apiurl = Environment.apiUrlPost;
|
||||||
final String url = '$apiurl/hrFileDownload?id=$id';
|
final String url = '$apiurl/hrFileDownload?id=$id';
|
||||||
final token = widget.Token;
|
final token = widget.Token;
|
||||||
|
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer $token',
|
'Authorization': 'Bearer $token',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
// 'app-signature': 'ts-traveltool-2025-signature-123456',
|
// 'app-signature': 'ts-traveltool-2025-signature-123456',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
try {
|
||||||
|
print("PDF Downloaded");
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
// ✅ Create a blob from the response body bytes
|
||||||
try {
|
final blob = html.Blob([response.bodyBytes]);
|
||||||
print("PDF Downloaded");
|
|
||||||
|
|
||||||
// ✅ Create a blob from the response body bytes
|
// ✅ Generate a download URL
|
||||||
final blob = html.Blob([response.bodyBytes]);
|
final url = html.Url.createObjectUrlFromBlob(blob);
|
||||||
|
|
||||||
// ✅ Generate a download URL
|
// ✅ Trigger file download automatically
|
||||||
final url = html.Url.createObjectUrlFromBlob(blob);
|
final anchor = html.AnchorElement(href: url)
|
||||||
|
..setAttribute('download', '$file_name')
|
||||||
|
..click();
|
||||||
|
|
||||||
// ✅ Trigger file download automatically
|
// ✅ Revoke the URL to free memory
|
||||||
final anchor = html.AnchorElement(href: url)
|
html.Url.revokeObjectUrl(url);
|
||||||
..setAttribute('download', '$file_name')
|
} catch (e) {
|
||||||
..click();
|
throw Exception('Error parsing response: $e');
|
||||||
|
|
||||||
// ✅ Revoke the URL to free memory
|
|
||||||
html.Url.revokeObjectUrl(url);
|
|
||||||
} catch (e) {
|
|
||||||
throw Exception('Error parsing response: $e');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print("Download failed with status: ${response.statusCode}");
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print("Download failed with status: ${response.statusCode}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _uploadFile() async {
|
void _uploadFile() async {
|
||||||
@ -368,9 +365,9 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
empPrimaryId = prefs.getString('empPrimaryId');
|
empPrimaryId = prefs.getString('empPrimaryId');
|
||||||
// Future.delayed(Duration(seconds: 3), () {
|
// Future.delayed(Duration(seconds: 3), () {
|
||||||
setState(() {
|
setState(() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
});
|
});
|
||||||
// });
|
// });
|
||||||
print('submit');
|
print('submit');
|
||||||
print(fileBytes);
|
print(fileBytes);
|
||||||
@ -415,12 +412,12 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
// request.fields['status'] = selectedKey!;
|
// request.fields['status'] = selectedKey!;
|
||||||
request.fields['created_by'] = empPrimaryId;
|
request.fields['created_by'] = empPrimaryId;
|
||||||
request.fields['policy_id'] = widget.ClientPoliyId;
|
request.fields['policy_id'] = widget.ClientPoliyId;
|
||||||
// "client_id": 1,
|
// "client_id": 1,
|
||||||
// "client_branch_id": 2,
|
// "client_branch_id": 2,
|
||||||
// "policy_no": "POL123456",
|
// "policy_no": "POL123456",
|
||||||
// "file_action": ,
|
// "file_action": ,
|
||||||
// "status": "inception",
|
// "status": "inception",
|
||||||
// "created_by": 10
|
// "created_by": 10
|
||||||
|
|
||||||
print('request : $request');
|
print('request : $request');
|
||||||
// Send the request
|
// Send the request
|
||||||
@ -474,9 +471,9 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
// For example, check if any field in the row contains the query
|
// For example, check if any field in the row contains the query
|
||||||
// Adjust this logic based on your data structure
|
// Adjust this logic based on your data structure
|
||||||
return row['file_name']
|
return row['file_name']
|
||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(query.toLowerCase()) ||
|
.contains(query.toLowerCase()) ||
|
||||||
row['file_action']
|
row['file_action']
|
||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
@ -506,97 +503,98 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
padding: EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50),
|
padding: EdgeInsets.only(top: 30, bottom: 200, left: 50, right: 50),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center, // 👈 fix alignment
|
crossAxisAlignment:
|
||||||
children: [
|
CrossAxisAlignment.center, // 👈 fix alignment
|
||||||
Expanded(
|
|
||||||
flex: 8,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
// back button + texts
|
Expanded(
|
||||||
Row(
|
flex: 8,
|
||||||
children: [
|
child: Column(
|
||||||
IconButton(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
padding: EdgeInsets.zero,
|
children: [
|
||||||
constraints: BoxConstraints(),
|
// back button + texts
|
||||||
onPressed: () {
|
Row(
|
||||||
Navigator.pop(context);
|
children: [
|
||||||
},
|
IconButton(
|
||||||
icon: Icon(
|
padding: EdgeInsets.zero,
|
||||||
Icons.arrow_back_ios,
|
constraints: BoxConstraints(),
|
||||||
color: Colors.grey,
|
onPressed: () {
|
||||||
size: 17,
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.arrow_back_ios,
|
||||||
|
color: Colors.grey,
|
||||||
|
size: 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"${widget.cardType} - ${widget.cardPolicyNo}",
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
widget.TokenType == 'pre'
|
||||||
|
? "${widget.cardPolicy_name} (${widget.cardPolicy_ExpDate})"
|
||||||
|
: "${widget.cardInsurer_name} - ${widget.cardPolicy_name} (${widget.cardPolicy_ExpDate})",
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
color: Colors.grey,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
Column(
|
),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
),
|
||||||
children: [
|
Expanded(
|
||||||
Text(
|
flex: 4,
|
||||||
"${widget.cardType} - ${widget.cardPolicyNo}",
|
child: Container(
|
||||||
style: GoogleFonts.poppins(
|
padding: const EdgeInsets.only(top: 4),
|
||||||
color: Colors.black,
|
child: getFileUploadMasterList.isEmpty
|
||||||
fontSize: 14,
|
? const SizedBox() // 👈 avoid crash on first build
|
||||||
fontWeight: FontWeight.w500,
|
: buildDropdownField<String>(
|
||||||
|
'File Action',
|
||||||
|
(value) {
|
||||||
|
setState(() {
|
||||||
|
selectedKey = value;
|
||||||
|
selectedValue = getFileUploadMasterList
|
||||||
|
.firstWhere((item) =>
|
||||||
|
item['key'] == value)['value'];
|
||||||
|
});
|
||||||
|
debugPrint("Selected Key: $selectedKey");
|
||||||
|
debugPrint(
|
||||||
|
"Selected Value: $selectedValue");
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
getFileUploadMasterList,
|
||||||
|
'value',
|
||||||
|
selectedKey,
|
||||||
|
valueKey: 'key',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
|
||||||
widget.TokenType == 'pre'
|
|
||||||
? "${widget.cardPolicy_name} (${widget.cardPolicy_ExpDate})"
|
|
||||||
: "${widget.cardInsurer_name} - ${widget.cardPolicy_name} (${widget.cardPolicy_ExpDate})",
|
|
||||||
style: GoogleFonts.poppins(
|
|
||||||
color: Colors.grey,
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
SizedBox(
|
||||||
flex: 4,
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.only(top: 4),
|
|
||||||
child: getFileUploadMasterList.isEmpty
|
|
||||||
? const SizedBox() // 👈 avoid crash on first build
|
|
||||||
: buildDropdownField<String>(
|
|
||||||
'File Action',
|
|
||||||
(value) {
|
|
||||||
setState(() {
|
|
||||||
selectedKey = value;
|
|
||||||
selectedValue = getFileUploadMasterList
|
|
||||||
.firstWhere((item) => item['key'] == value)['value'];
|
|
||||||
});
|
|
||||||
debugPrint("Selected Key: $selectedKey");
|
|
||||||
debugPrint("Selected Value: $selectedValue");
|
|
||||||
},
|
|
||||||
false,
|
|
||||||
getFileUploadMasterList,
|
|
||||||
'value',
|
|
||||||
selectedKey,
|
|
||||||
valueKey: 'key',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
|
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(10), // 👈 set your desired radius
|
BorderRadius.circular(10), // 👈 set your desired radius
|
||||||
),
|
),
|
||||||
// height: 400,
|
// height: 400,
|
||||||
// margin: const EdgeInsets.only(left: 40.0, right: 40.0),
|
// margin: const EdgeInsets.only(left: 40.0, right: 40.0),
|
||||||
@ -632,8 +630,7 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
// ),
|
// ),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -643,113 +640,118 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
color: Colors.grey[200],
|
color: Colors.grey[200],
|
||||||
height: 180,
|
height: 180,
|
||||||
child: DragTarget(
|
child: DragTarget(
|
||||||
onAccept: (html.File
|
onAccept: (html.File droppedFile) {
|
||||||
droppedFile) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
fileName =
|
fileName = droppedFile.name;
|
||||||
droppedFile.name;
|
|
||||||
});
|
});
|
||||||
_dragAndDropFile(
|
_dragAndDropFile(droppedFile);
|
||||||
droppedFile);
|
|
||||||
},
|
},
|
||||||
builder:
|
builder: (BuildContext context,
|
||||||
(BuildContext context,
|
List<String?> candidateData,
|
||||||
List<String?>
|
List<dynamic> rejectedData) {
|
||||||
candidateData,
|
|
||||||
List<dynamic>
|
|
||||||
rejectedData) {
|
|
||||||
return Container(
|
return Container(
|
||||||
alignment:
|
alignment: Alignment.center,
|
||||||
Alignment.center,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment
|
MainAxisAlignment.center,
|
||||||
.center,
|
|
||||||
children: [
|
children: [
|
||||||
|
|
||||||
fileName != null
|
fileName != null
|
||||||
? Column(
|
? Column(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment
|
MainAxisAlignment
|
||||||
.center,
|
.center,
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
Icons
|
Icons
|
||||||
.upload_file, // Choose the appropriate icon
|
.upload_file, // Choose the appropriate icon
|
||||||
size:
|
size: 35,
|
||||||
35,
|
color: Color(
|
||||||
color: Color(
|
0xFFE26728), // Adjust the size as needed
|
||||||
0xFFE26728), // Adjust the size as needed
|
),
|
||||||
),
|
SizedBox(
|
||||||
SizedBox(
|
height:
|
||||||
height:
|
15), // Add some space between the icon and text
|
||||||
15), // Add some space between the icon and text
|
Text(
|
||||||
Text(
|
'$fileName',
|
||||||
'$fileName',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize:
|
||||||
fontSize:
|
16),
|
||||||
16),
|
),
|
||||||
),
|
SizedBox(
|
||||||
SizedBox(
|
height:
|
||||||
height:
|
25), // Add some space between the icon and text
|
||||||
25), // Add some space between the icon and text
|
MouseRegion(
|
||||||
MouseRegion(
|
cursor: SystemMouseCursors
|
||||||
cursor:
|
.click, // Set cursor to pointer on hover
|
||||||
SystemMouseCursors.click, // Set cursor to pointer on hover
|
child:
|
||||||
child:
|
GestureDetector(
|
||||||
GestureDetector(
|
onTap: () {
|
||||||
onTap:
|
resetErrorCount();
|
||||||
() {
|
},
|
||||||
resetErrorCount();
|
child:
|
||||||
|
const Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
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
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width:
|
||||||
|
1), // Add some space between the icon and text
|
||||||
|
Text(
|
||||||
|
'Remove',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
13,
|
||||||
|
color:
|
||||||
|
Color(0xFF727272)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ElevatedButton(
|
||||||
|
onPressed: () => {
|
||||||
|
print(
|
||||||
|
'selectedValue $selectedValue'),
|
||||||
|
if (selectedValue !=
|
||||||
|
null)
|
||||||
|
{
|
||||||
|
_uploadFile(),
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ToastHelper
|
||||||
|
.showErrorToast(
|
||||||
|
context,
|
||||||
|
'Please select file action')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child:
|
child: Text(
|
||||||
const Row(
|
'Select File',
|
||||||
mainAxisAlignment:
|
style: TextStyle(
|
||||||
MainAxisAlignment.center,
|
color: Colors
|
||||||
children: [
|
.white),
|
||||||
Icon(
|
),
|
||||||
Icons.delete_forever, // Choose the remove icon
|
style:
|
||||||
size: 20, // Adjust the size as needed
|
ElevatedButton
|
||||||
color: Colors.red, // Set the color of the remove icon
|
.styleFrom(
|
||||||
),
|
backgroundColor:
|
||||||
SizedBox(width: 1), // Add some space between the icon and text
|
Color(
|
||||||
Text(
|
0xFFE26728),
|
||||||
'Remove',
|
|
||||||
style: TextStyle(fontSize: 13, color: Color(0xFF727272)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
SizedBox(height: 20),
|
||||||
],
|
if (fileName == null)
|
||||||
)
|
|
||||||
: ElevatedButton(
|
|
||||||
onPressed: () => {
|
|
||||||
print('selectedValue $selectedValue'),
|
|
||||||
if(selectedValue != null){
|
|
||||||
_uploadFile(),
|
|
||||||
} else {
|
|
||||||
ToastHelper.showErrorToast(context, 'Please select file action')
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
'Select File',
|
|
||||||
style: TextStyle(
|
|
||||||
color:
|
|
||||||
Colors.white),
|
|
||||||
),
|
|
||||||
style: ElevatedButton
|
|
||||||
.styleFrom(
|
|
||||||
backgroundColor:
|
|
||||||
Color(
|
|
||||||
0xFFE26728),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20),
|
|
||||||
if (fileName ==
|
|
||||||
null)
|
|
||||||
Text(
|
Text(
|
||||||
'Supported Files : XLSX')
|
'Supported Files : XLSX')
|
||||||
// Add more Text widgets for additional lines of text
|
// Add more Text widgets for additional lines of text
|
||||||
@ -776,7 +778,7 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(10), // 👈 set your desired radius
|
BorderRadius.circular(10), // 👈 set your desired radius
|
||||||
),
|
),
|
||||||
// width: double.infinity, // take full width
|
// width: double.infinity, // take full width
|
||||||
// height: MediaQuery.of(context).size.height * 0.8, // 80% of screen height
|
// height: MediaQuery.of(context).size.height * 0.8, // 80% of screen height
|
||||||
@ -835,10 +837,10 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
color: Color(0x98FFFCE5), // Semi-transparent background
|
color: Color(0x98FFFCE5), // Semi-transparent background
|
||||||
child: Center(
|
child: Center(
|
||||||
child: // Your GIF loader widget
|
child: // Your GIF loader widget
|
||||||
Image.asset(
|
Image.asset(
|
||||||
height: 60,
|
height: 60,
|
||||||
width: 60,
|
width: 60,
|
||||||
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
|
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Align(
|
Align(
|
||||||
@ -853,14 +855,14 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget buildDropdownField<T>(
|
Widget buildDropdownField<T>(
|
||||||
String label,
|
String label,
|
||||||
void Function(T?) onChanged,
|
void Function(T?) onChanged,
|
||||||
bool readOnly,
|
bool readOnly,
|
||||||
List<Map<String, dynamic>> itemsList,
|
List<Map<String, dynamic>> itemsList,
|
||||||
String displayField,
|
String displayField,
|
||||||
T? selectedValue, {
|
T? selectedValue, {
|
||||||
String valueKey = 'id',
|
String valueKey = 'id',
|
||||||
}) {
|
}) {
|
||||||
return DropdownButtonFormField<T>(
|
return DropdownButtonFormField<T>(
|
||||||
value: selectedValue,
|
value: selectedValue,
|
||||||
decoration: InputDecoration(labelText: label),
|
decoration: InputDecoration(labelText: label),
|
||||||
@ -868,7 +870,7 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
return DropdownMenuItem<T>(
|
return DropdownMenuItem<T>(
|
||||||
value: item[valueKey] as T, // ✅ cast to generic type
|
value: item[valueKey] as T, // ✅ cast to generic type
|
||||||
child:
|
child:
|
||||||
Text(item[displayField].toString()), // always display as String
|
Text(item[displayField].toString()), // always display as String
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged: readOnly ? null : onChanged,
|
onChanged: readOnly ? null : onChanged,
|
||||||
@ -899,14 +901,14 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
itemCount: _paginatedData.length + 2,
|
itemCount: _paginatedData.length + 2,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
if (index == 0) return _buildHeader();
|
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];
|
final item = _paginatedData[index - 1];
|
||||||
return _buildDataRow(item);
|
return _buildDataRow(item);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// return Column(
|
// return Column(
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// children: [
|
// children: [
|
||||||
@ -1047,7 +1049,10 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
message: "Click to Download", // 📝 Tooltip text
|
message: "Click to Download", // 📝 Tooltip text
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
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(
|
child: Text(
|
||||||
item['file_name'] ?? '-',
|
item['file_name'] ?? '-',
|
||||||
@ -1094,13 +1099,9 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
child: const Row(
|
child: const Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(flex: 4, child: Text('File Name', style: _headerStyle)),
|
Expanded(flex: 4, child: Text('File Name', style: _headerStyle)),
|
||||||
Expanded(
|
Expanded(flex: 3, child: Text('File Action', style: _headerStyle)),
|
||||||
flex: 3, child: Text('File Action', style: _headerStyle)),
|
Expanded(flex: 2, child: Text('Created At', style: _headerStyle)),
|
||||||
Expanded(
|
Expanded(flex: 2, child: Text('Status', style: _headerStyle))
|
||||||
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) {
|
Widget _buildPagination(BuildContext context) {
|
||||||
return Row(mainAxisAlignment: MainAxisAlignment.end, children: [
|
final totalPages = (filteredData.length / _rowsPerPage).ceil();
|
||||||
Padding(
|
const visiblePageCount = 5;
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
||||||
child: Row(
|
List<int> getVisiblePages() {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
if (totalPages <= visiblePageCount) {
|
||||||
children: [
|
return List.generate(totalPages, (i) => i + 1);
|
||||||
DropdownButton<int>(
|
}
|
||||||
value: _rowsPerPage,
|
|
||||||
items: [5, 10, 15, 20, 50].map((int value) {
|
if (_currentPage <= 3) {
|
||||||
return DropdownMenuItem<int>(
|
return [1, 2, 3, 4, 5];
|
||||||
value: value,
|
} else if (_currentPage >= totalPages - 2) {
|
||||||
child: Text(
|
return [
|
||||||
' $value ',
|
totalPages - 4,
|
||||||
style: GoogleFonts.poppins(fontSize: 15),
|
totalPages - 3,
|
||||||
),
|
totalPages - 2,
|
||||||
);
|
totalPages - 1,
|
||||||
}).toList(),
|
totalPages
|
||||||
onChanged: (newValue) {
|
];
|
||||||
setState(() {
|
} else {
|
||||||
_rowsPerPage = newValue!;
|
return [
|
||||||
_currentPage =
|
_currentPage - 2,
|
||||||
1; // Reset to first page when rows per page changes
|
_currentPage - 1,
|
||||||
});
|
_currentPage,
|
||||||
},
|
_currentPage + 1,
|
||||||
),
|
_currentPage + 2,
|
||||||
IconButton(
|
];
|
||||||
onPressed: _currentPage > 1
|
}
|
||||||
? () {
|
}
|
||||||
setState(() {
|
|
||||||
_currentPage--;
|
List<int> visiblePages = getVisiblePages();
|
||||||
});
|
|
||||||
}
|
return Row(
|
||||||
: null,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
icon: Icon(Icons.chevron_left),
|
children: [
|
||||||
),
|
Padding(
|
||||||
for (int i = 1;
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
i <= (filteredData.length / _rowsPerPage).ceil();
|
child: Row(
|
||||||
i++)
|
children: [
|
||||||
Padding(
|
// Dropdown for rows per page
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
DropdownButton<int>(
|
||||||
child: ElevatedButton(
|
value: _rowsPerPage,
|
||||||
style: ElevatedButton.styleFrom(
|
items: [5, 10, 15, 20, 50].map((int value) {
|
||||||
backgroundColor: _currentPage == i
|
return DropdownMenuItem<int>(
|
||||||
? Color(0xFF00A6A6)
|
value: value,
|
||||||
: Colors.grey[300],
|
child: Text(' $value ',
|
||||||
foregroundColor:
|
style: GoogleFonts.poppins(fontSize: 15)),
|
||||||
_currentPage == i ? Colors.white : Colors.black,
|
);
|
||||||
minimumSize: Size(36, 36),
|
}).toList(),
|
||||||
padding: EdgeInsets.zero,
|
onChanged: (newValue) {
|
||||||
),
|
setState(() {
|
||||||
onPressed: () {
|
_rowsPerPage = newValue!;
|
||||||
setState(() {
|
_currentPage = 1;
|
||||||
_currentPage = i;
|
});
|
||||||
});
|
},
|
||||||
},
|
|
||||||
child: Text(i.toString()),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
IconButton(
|
|
||||||
onPressed:
|
// Previous button
|
||||||
_currentPage < (filteredData.length / _rowsPerPage).ceil()
|
IconButton(
|
||||||
? () {
|
onPressed: _currentPage > 1
|
||||||
setState(() {
|
? () => setState(() => _currentPage--)
|
||||||
_currentPage++;
|
: null,
|
||||||
});
|
icon: const Icon(Icons.chevron_left),
|
||||||
}
|
),
|
||||||
: null,
|
|
||||||
icon: Icon(Icons.chevron_right),
|
// 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 == 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) {
|
String formatDate(String? dateString) {
|
||||||
@ -1209,9 +1257,4 @@ class _postFileUploadState extends State<postFileUpload> {
|
|||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -268,7 +268,7 @@ class _ActivePolicieState extends State<ActivePolicies> {
|
|||||||
|
|
||||||
print("logicalWidth - $logicalWidth");
|
print("logicalWidth - $logicalWidth");
|
||||||
print("logicalHeight - $logicalHeight");
|
print("logicalHeight - $logicalHeight");
|
||||||
return GestureDetector(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
print("policytab - $policy");
|
print("policytab - $policy");
|
||||||
@ -277,7 +277,8 @@ class _ActivePolicieState extends State<ActivePolicies> {
|
|||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => hrPolicyDetails(
|
builder: (context) => hrPolicyDetails(
|
||||||
ClientId: policy['client_id'].toString(), // <-- from map
|
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(),
|
ClientPoliyId: policy['client_policy_id'].toString(),
|
||||||
clientBranchId: widget.empClientBranchId,
|
clientBranchId: widget.empClientBranchId,
|
||||||
Token: widget.postToken,
|
Token: widget.postToken,
|
||||||
@ -419,7 +420,7 @@ class _ActivePolicieState extends State<ActivePolicies> {
|
|||||||
|
|
||||||
Widget buildTab(String title, int index) {
|
Widget buildTab(String title, int index) {
|
||||||
final isSelected = selectedIndex == index + 1;
|
final isSelected = selectedIndex == index + 1;
|
||||||
return GestureDetector(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedIndex = index + 1;
|
selectedIndex = index + 1;
|
||||||
|
|||||||
@ -161,7 +161,7 @@ class _CdPolicieState extends State<CdPolicies> {
|
|||||||
List<List<String>> rows = [];
|
List<List<String>> rows = [];
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
rows.add(['Insurer Name', 'CD Account number', 'Current Balance']);
|
rows.add(['Insurer Name', 'CD Account Number', 'Current Balance']);
|
||||||
|
|
||||||
// Data rows
|
// Data rows
|
||||||
for (var item in data) {
|
for (var item in data) {
|
||||||
@ -527,7 +527,7 @@ class _CdPolicieState extends State<CdPolicies> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(flex: 4, child: Text('Insurer Name', style: _headerStyle)),
|
Expanded(flex: 4, child: Text('Insurer Name', style: _headerStyle)),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3, child: Text('CD Account number', style: _headerStyle)),
|
flex: 3, child: Text('CD Account Number', style: _headerStyle)),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2, child: Text('Current Balance', style: _headerStyle)),
|
flex: 2, child: Text('Current Balance', style: _headerStyle)),
|
||||||
Expanded(flex: 1, child: Text('Actions', style: _headerStyle)),
|
Expanded(flex: 1, child: Text('Actions', style: _headerStyle)),
|
||||||
@ -554,79 +554,126 @@ class _CdPolicieState extends State<CdPolicies> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildPagination(BuildContext context) {
|
Widget _buildPagination(BuildContext context) {
|
||||||
return Row(mainAxisAlignment: MainAxisAlignment.end, children: [
|
final totalPages = (filteredData.length / _rowsPerPage).ceil();
|
||||||
Padding(
|
const visiblePageCount = 5;
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
||||||
child: Row(
|
List<int> getVisiblePages() {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
if (totalPages <= visiblePageCount) {
|
||||||
children: [
|
return List.generate(totalPages, (i) => i + 1);
|
||||||
DropdownButton<int>(
|
}
|
||||||
value: _rowsPerPage,
|
|
||||||
items: [5, 10, 15, 20, 50].map((int value) {
|
if (_currentPage <= 3) {
|
||||||
return DropdownMenuItem<int>(
|
return [1, 2, 3, 4, 5];
|
||||||
value: value,
|
} else if (_currentPage >= totalPages - 2) {
|
||||||
child: Text(
|
return [
|
||||||
' $value ',
|
totalPages - 4,
|
||||||
style: GoogleFonts.poppins(fontSize: 15),
|
totalPages - 3,
|
||||||
),
|
totalPages - 2,
|
||||||
);
|
totalPages - 1,
|
||||||
}).toList(),
|
totalPages
|
||||||
onChanged: (newValue) {
|
];
|
||||||
setState(() {
|
} else {
|
||||||
_rowsPerPage = newValue!;
|
return [
|
||||||
_currentPage =
|
_currentPage - 2,
|
||||||
1; // Reset to first page when rows per page changes
|
_currentPage - 1,
|
||||||
});
|
_currentPage,
|
||||||
},
|
_currentPage + 1,
|
||||||
),
|
_currentPage + 2,
|
||||||
IconButton(
|
];
|
||||||
onPressed: _currentPage > 1
|
}
|
||||||
? () {
|
}
|
||||||
setState(() {
|
|
||||||
_currentPage--;
|
List<int> visiblePages = getVisiblePages();
|
||||||
});
|
|
||||||
}
|
return Row(
|
||||||
: null,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
icon: Icon(Icons.chevron_left),
|
children: [
|
||||||
),
|
Padding(
|
||||||
for (int i = 1;
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
i <= (filteredData.length / _rowsPerPage).ceil();
|
child: Row(
|
||||||
i++)
|
children: [
|
||||||
Padding(
|
// Dropdown for rows per page
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
DropdownButton<int>(
|
||||||
child: ElevatedButton(
|
value: _rowsPerPage,
|
||||||
style: ElevatedButton.styleFrom(
|
items: [5, 10, 15, 20, 50].map((int value) {
|
||||||
backgroundColor: _currentPage == i
|
return DropdownMenuItem<int>(
|
||||||
? Color(0xFF00A6A6)
|
value: value,
|
||||||
: Colors.grey[300],
|
child: Text(' $value ',
|
||||||
foregroundColor:
|
style: GoogleFonts.poppins(fontSize: 15)),
|
||||||
_currentPage == i ? Colors.white : Colors.black,
|
);
|
||||||
minimumSize: Size(36, 36),
|
}).toList(),
|
||||||
padding: EdgeInsets.zero,
|
onChanged: (newValue) {
|
||||||
),
|
setState(() {
|
||||||
onPressed: () {
|
_rowsPerPage = newValue!;
|
||||||
setState(() {
|
_currentPage = 1;
|
||||||
_currentPage = i;
|
});
|
||||||
});
|
},
|
||||||
},
|
|
||||||
child: Text(i.toString()),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
IconButton(
|
|
||||||
onPressed:
|
// Previous button
|
||||||
_currentPage < (filteredData.length / _rowsPerPage).ceil()
|
IconButton(
|
||||||
? () {
|
onPressed: _currentPage > 1
|
||||||
setState(() {
|
? () => setState(() => _currentPage--)
|
||||||
_currentPage++;
|
: null,
|
||||||
});
|
icon: const Icon(Icons.chevron_left),
|
||||||
}
|
),
|
||||||
: null,
|
|
||||||
icon: Icon(Icons.chevron_right),
|
// 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 == 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,16 +715,20 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 4,
|
||||||
child: Align(
|
child: Row(
|
||||||
alignment: Alignment.bottomLeft,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
child: Container(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
padding:
|
mainAxisSize: MainAxisSize.min,
|
||||||
const EdgeInsets.symmetric(horizontal: 14, vertical: 4),
|
children: [
|
||||||
decoration: BoxDecoration(
|
Container(
|
||||||
color: Color(0xFF7BD9B6),
|
padding:
|
||||||
borderRadius: BorderRadius.circular(6),
|
const EdgeInsets.symmetric(horizontal: 14, vertical: 4),
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
child: Text(item['status'] ?? '-', style: _dataBold)),
|
color: Color(0xFF7BD9B6),
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
),
|
||||||
|
child: Text(item['status'] ?? '-', style: _dataBold)),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -736,7 +740,7 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
|||||||
child: Text(item['ticket_created_date'] ?? '-', style: _dataBold),
|
child: Text(item['ticket_created_date'] ?? '-', style: _dataBold),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 2,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@ -815,79 +819,126 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildPagination(BuildContext context) {
|
Widget _buildPagination(BuildContext context) {
|
||||||
return Row(mainAxisAlignment: MainAxisAlignment.end, children: [
|
final totalPages = (filteredData.length / _rowsPerPage).ceil();
|
||||||
Padding(
|
const visiblePageCount = 5;
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
||||||
child: Row(
|
List<int> getVisiblePages() {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
if (totalPages <= visiblePageCount) {
|
||||||
children: [
|
return List.generate(totalPages, (i) => i + 1);
|
||||||
DropdownButton<int>(
|
}
|
||||||
value: _rowsPerPage,
|
|
||||||
items: [5, 10, 15, 20, 50].map((int value) {
|
if (_currentPage <= 3) {
|
||||||
return DropdownMenuItem<int>(
|
return [1, 2, 3, 4, 5];
|
||||||
value: value,
|
} else if (_currentPage >= totalPages - 2) {
|
||||||
child: Text(
|
return [
|
||||||
' $value ',
|
totalPages - 4,
|
||||||
style: GoogleFonts.poppins(fontSize: 15),
|
totalPages - 3,
|
||||||
),
|
totalPages - 2,
|
||||||
);
|
totalPages - 1,
|
||||||
}).toList(),
|
totalPages
|
||||||
onChanged: (newValue) {
|
];
|
||||||
setState(() {
|
} else {
|
||||||
_rowsPerPage = newValue!;
|
return [
|
||||||
_currentPage =
|
_currentPage - 2,
|
||||||
1; // Reset to first page when rows per page changes
|
_currentPage - 1,
|
||||||
});
|
_currentPage,
|
||||||
},
|
_currentPage + 1,
|
||||||
),
|
_currentPage + 2,
|
||||||
IconButton(
|
];
|
||||||
onPressed: _currentPage > 1
|
}
|
||||||
? () {
|
}
|
||||||
setState(() {
|
|
||||||
_currentPage--;
|
List<int> visiblePages = getVisiblePages();
|
||||||
});
|
|
||||||
}
|
return Row(
|
||||||
: null,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
icon: Icon(Icons.chevron_left),
|
children: [
|
||||||
),
|
Padding(
|
||||||
for (int i = 1;
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
i <= (filteredData.length / _rowsPerPage).ceil();
|
child: Row(
|
||||||
i++)
|
children: [
|
||||||
Padding(
|
// Dropdown for rows per page
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
DropdownButton<int>(
|
||||||
child: ElevatedButton(
|
value: _rowsPerPage,
|
||||||
style: ElevatedButton.styleFrom(
|
items: [5, 10, 15, 20, 50].map((int value) {
|
||||||
backgroundColor: _currentPage == i
|
return DropdownMenuItem<int>(
|
||||||
? Color(0xFF00A6A6)
|
value: value,
|
||||||
: Colors.grey[300],
|
child: Text(' $value ',
|
||||||
foregroundColor:
|
style: GoogleFonts.poppins(fontSize: 15)),
|
||||||
_currentPage == i ? Colors.white : Colors.black,
|
);
|
||||||
minimumSize: Size(36, 36),
|
}).toList(),
|
||||||
padding: EdgeInsets.zero,
|
onChanged: (newValue) {
|
||||||
),
|
setState(() {
|
||||||
onPressed: () {
|
_rowsPerPage = newValue!;
|
||||||
setState(() {
|
_currentPage = 1;
|
||||||
_currentPage = i;
|
});
|
||||||
});
|
},
|
||||||
},
|
|
||||||
child: Text(i.toString()),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
IconButton(
|
|
||||||
onPressed:
|
// Previous button
|
||||||
_currentPage < (filteredData.length / _rowsPerPage).ceil()
|
IconButton(
|
||||||
? () {
|
onPressed: _currentPage > 1
|
||||||
setState(() {
|
? () => setState(() => _currentPage--)
|
||||||
_currentPage++;
|
: null,
|
||||||
});
|
icon: const Icon(Icons.chevron_left),
|
||||||
}
|
),
|
||||||
: null,
|
|
||||||
icon: Icon(Icons.chevron_right),
|
// 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 == 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) {
|
Widget _buildName(BuildContext context) {
|
||||||
|
|||||||
@ -239,7 +239,7 @@ class _PreEnrollmentState extends State<PreEnrollment> {
|
|||||||
|
|
||||||
print("logicalWidth - $logicalWidth");
|
print("logicalWidth - $logicalWidth");
|
||||||
print("logicalHeight - $logicalHeight");
|
print("logicalHeight - $logicalHeight");
|
||||||
return GestureDetector(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
print("policytab - $policy");
|
print("policytab - $policy");
|
||||||
@ -248,7 +248,8 @@ class _PreEnrollmentState extends State<PreEnrollment> {
|
|||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => hrPolicyDetails(
|
builder: (context) => hrPolicyDetails(
|
||||||
ClientId: policy['client_id'].toString(), // <-- from map
|
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(),
|
ClientPoliyId: policy['client_policy_id'].toString(),
|
||||||
clientBranchId: widget.enrollmentClientBranchId,
|
clientBranchId: widget.enrollmentClientBranchId,
|
||||||
Token: widget.enrollToken,
|
Token: widget.enrollToken,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user