merge
This commit is contained in:
commit
dcea271d7c
@ -21,7 +21,16 @@ import 'package:universal_html/html.dart' as html;
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class hrDashboard extends StatefulWidget {
|
||||
const hrDashboard({Key? key}) : super(key: key);
|
||||
final int selectedIndex;
|
||||
late final int isHrcode;
|
||||
final String empCodeFromHrPolicy;
|
||||
|
||||
hrDashboard({
|
||||
Key? key,
|
||||
required this.selectedIndex,
|
||||
required this.isHrcode,
|
||||
required this.empCodeFromHrPolicy,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<hrDashboard> createState() => _hrDashboardState();
|
||||
@ -32,6 +41,7 @@ class _hrDashboardState extends State<hrDashboard>
|
||||
late ApiService apiService;
|
||||
late TabController _tabController;
|
||||
bool isLoading = false;
|
||||
int isHrcode = 0;
|
||||
late String _token;
|
||||
dynamic getPolicyNo;
|
||||
// bool _isLoading = false;
|
||||
@ -52,6 +62,8 @@ class _hrDashboardState extends State<hrDashboard>
|
||||
dynamic enrollmentEmpClientBranchId;
|
||||
dynamic enrollmentHrId;
|
||||
dynamic empClientId;
|
||||
String empCodeFromHrPolcy = '';
|
||||
|
||||
final List<Color> cardColors = [
|
||||
Color(0xFFFFE3D9),
|
||||
Color(0xFFFFD9EE),
|
||||
@ -66,6 +78,8 @@ class _hrDashboardState extends State<hrDashboard>
|
||||
super.initState();
|
||||
apiService = ApiService(context); // Initialize ApiService here
|
||||
_loadToken();
|
||||
empCodeFromHrPolcy = widget.empCodeFromHrPolicy;
|
||||
|
||||
// _tabController = TabController(length: 4, vsync: this);
|
||||
// _tabController.addListener(() {
|
||||
// setState(() {
|
||||
@ -219,17 +233,22 @@ class _hrDashboardState extends State<hrDashboard>
|
||||
postToken: _postToken,
|
||||
));
|
||||
}
|
||||
print('333');
|
||||
if (empAllowed_modules.contains(4)) {
|
||||
tabData.add({
|
||||
'icon': Icons.receipt_long,
|
||||
'label': 'Claims',
|
||||
});
|
||||
tabViews.add(ClaimsPolicies(
|
||||
empClientId: empClientId,
|
||||
empClientBranchId: empClientBranchId,
|
||||
empHrId: empHrId,
|
||||
postToken: _postToken,
|
||||
));
|
||||
empClientId: empClientId,
|
||||
empClientBranchId: empClientBranchId,
|
||||
empHrId: empHrId,
|
||||
postToken: _postToken,
|
||||
isHrcode: widget.isHrcode == 1 ? 1 : 0,
|
||||
empCodeHrPolicy: empCodeFromHrPolcy
|
||||
// empCodeHrPolicy: widget.empCodeFromHrPolicy
|
||||
|
||||
));
|
||||
}
|
||||
}
|
||||
// getCashDepositDetails(
|
||||
@ -244,9 +263,35 @@ class _hrDashboardState extends State<hrDashboard>
|
||||
}
|
||||
|
||||
_tabController = TabController(length: tabData.length, vsync: this);
|
||||
|
||||
print('selectedIndex ${widget.selectedIndex}');
|
||||
// var isHrcode;
|
||||
print('111');
|
||||
if (widget.selectedIndex == 3) {
|
||||
print("Process1");
|
||||
_tabController.index = 3;
|
||||
setState(() {
|
||||
selectedIndex = 3;
|
||||
isHrcode = 1;
|
||||
empCodeFromHrPolcy = widget.empCodeFromHrPolicy;
|
||||
});
|
||||
print("tabIndexConti11- $selectedIndex - ${_tabController.index}");
|
||||
// print("tabIndexCode11- $isHrcode - ${widget.isHrempcode}");
|
||||
}
|
||||
|
||||
print('222');
|
||||
_tabController.addListener(() {
|
||||
setState(() {
|
||||
selectedIndex = _tabController.index;
|
||||
if (widget.selectedIndex == 3) {
|
||||
isHrcode = 1;
|
||||
} else {
|
||||
isHrcode = 0;
|
||||
}
|
||||
empCodeFromHrPolcy = '';
|
||||
print("Process2");
|
||||
print("tabIndexConti- $selectedIndex - ${_tabController.index}");
|
||||
// print("tabIndexCode11- $isHrcode ");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:nhancepolicy/customAppBar/enrollmentAppBar.dart';
|
||||
import 'package:nhancepolicy/excel_verification.dart';
|
||||
import 'package:nhancepolicy/models/environment.dart';
|
||||
import 'package:nhancepolicy/service/api_service.dart';
|
||||
import 'package:nhancepolicy/service/hrDashboardTabs/claims.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'dart:convert';
|
||||
@ -22,6 +23,7 @@ import 'package:path/path.dart' as path;
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'customAppBar/customFooter.dart';
|
||||
import 'hrDashboard.dart';
|
||||
|
||||
class hrPolicyDetails extends StatefulWidget {
|
||||
final String ClientId;
|
||||
@ -822,7 +824,21 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
|
||||
width: 10,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
setState(() {
|
||||
print("policytabdata - ${item['emp_code']!}");
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => hrDashboard(
|
||||
selectedIndex: 3,
|
||||
empCodeFromHrPolicy:
|
||||
item['emp_code']!,
|
||||
isHrcode: 1),
|
||||
),
|
||||
);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 35,
|
||||
width: 35,
|
||||
|
||||
@ -82,15 +82,19 @@ Future<void> main() async {
|
||||
'empDetails': (context) => empDetails(),
|
||||
'addOnsDetails': (context) => addOnsDetails(),
|
||||
'empReviewDetails': (context) => empReviewDetails(),
|
||||
'hrDashboard': (context) => hrDashboard(),
|
||||
'hrDashboard': (context) => hrDashboard(
|
||||
selectedIndex: 0,
|
||||
isHrcode: 0,
|
||||
empCodeFromHrPolicy: '',
|
||||
),
|
||||
'cdTransactionDetails': (context) => cdTransactionDetails(
|
||||
insurerName: '',
|
||||
cdMasterAccountNo: '',
|
||||
insurerId: '',
|
||||
cd_ac_pk: '',
|
||||
empClientId: '',
|
||||
postToken: '',
|
||||
),
|
||||
insurerName: '',
|
||||
cdMasterAccountNo: '',
|
||||
insurerId: '',
|
||||
cd_ac_pk: '',
|
||||
empClientId: '',
|
||||
postToken: '',
|
||||
),
|
||||
'hrPolicyDetails': (context) => hrPolicyDetails(
|
||||
ClientId: '',
|
||||
ClientPoliyId: '',
|
||||
|
||||
@ -280,13 +280,7 @@ class _CdPolicieState extends State<CdPolicies> {
|
||||
),
|
||||
)
|
||||
: Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
child: _buildCDDataTable(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _buildCDDataTable(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
@ -303,129 +297,131 @@ class _CdPolicieState extends State<CdPolicies> {
|
||||
);
|
||||
}
|
||||
|
||||
// return ListView.builder(
|
||||
// itemCount: _paginatedData.length + 2, // +1 for header, +1 for pagination
|
||||
// itemBuilder: (context, index) {
|
||||
// if (index == 0) return _buildHeader();
|
||||
// if (index == _paginatedData.length + 1)
|
||||
// return _buildPagination(context);
|
||||
//
|
||||
// final item = _paginatedData[index - 1];
|
||||
// return _buildDataRow(item);
|
||||
// },
|
||||
// );
|
||||
return ListView.builder(
|
||||
itemCount: _paginatedData.length + 2, // +1 for header, +1 for pagination
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) return _buildHeader();
|
||||
if (index == _paginatedData.length + 1)
|
||||
return _buildPagination(context);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Header row
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF00A6A6),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
'Insurer Name',
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.white, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
'CD Account number',
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.white, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'Current Balance',
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.white, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
'Action',
|
||||
textAlign: TextAlign.center,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.white, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 6),
|
||||
|
||||
// Table body rows
|
||||
..._paginatedData.mapIndexed((index, item) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 8),
|
||||
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: index % 2 == 0 ? Color(0xFFE6FAFB) : Colors.white,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
item['insurer_name'] ?? '-',
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
item['cd_master_account_no'] ?? '-',
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
"₹${item['balance'] ?? '0'}",
|
||||
style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Center(
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.remove_red_eye_outlined),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => cdTransactionDetails(
|
||||
insurerName: item['insurer_name'],
|
||||
cdMasterAccountNo: item['cd_master_account_no'],
|
||||
insurerId: item['insurer_id'],
|
||||
cd_ac_pk: item['cd_ac_pk'],
|
||||
empClientId: widget.empClientId,
|
||||
postToken: widget.postToken),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
final item = _paginatedData[index - 1];
|
||||
return _buildDataRow(item);
|
||||
},
|
||||
);
|
||||
|
||||
// return Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// // Header row
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: Color(0xFF00A6A6),
|
||||
// borderRadius: BorderRadius.circular(6),
|
||||
// ),
|
||||
// padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// flex: 4,
|
||||
// child: Text(
|
||||
// 'Insurer Name',
|
||||
// style: GoogleFonts.poppins(
|
||||
// color: Colors.white, fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 3,
|
||||
// child: Text(
|
||||
// 'CD Account number',
|
||||
// style: GoogleFonts.poppins(
|
||||
// color: Colors.white, fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 2,
|
||||
// child: Text(
|
||||
// 'Current Balance',
|
||||
// style: GoogleFonts.poppins(
|
||||
// color: Colors.white, fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Text(
|
||||
// 'Action',
|
||||
// textAlign: TextAlign.center,
|
||||
// style: GoogleFonts.poppins(
|
||||
// color: Colors.white, fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// const SizedBox(height: 6),
|
||||
//
|
||||
// // Table body rows
|
||||
// ..._paginatedData.mapIndexed((index, item) {
|
||||
// return Container(
|
||||
// margin: const EdgeInsets.only(bottom: 8),
|
||||
// padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16),
|
||||
// decoration: BoxDecoration(
|
||||
// color: index % 2 == 0 ? Color(0xFFE6FAFB) : Colors.white,
|
||||
// borderRadius: BorderRadius.circular(6),
|
||||
// ),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// flex: 4,
|
||||
// child: Text(
|
||||
// item['insurer_name'] ?? '-',
|
||||
// style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 3,
|
||||
// child: Text(
|
||||
// item['cd_master_account_no'] ?? '-',
|
||||
// style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 2,
|
||||
// child: Text(
|
||||
// "₹${item['balance'] ?? '0'}",
|
||||
// style: GoogleFonts.poppins(color: Color(0xFF000000)),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Center(
|
||||
// child: IconButton(
|
||||
// icon: const Icon(Icons.remove_red_eye_outlined),
|
||||
// onPressed: () {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) => cdTransactionDetails(
|
||||
// insurerName: item['insurer_name'],
|
||||
// cdMasterAccountNo: item['cd_master_account_no'],
|
||||
// insurerId: item['insurer_id'],
|
||||
// cd_ac_pk: item['cd_ac_pk'],
|
||||
// empClientId: widget.empClientId,
|
||||
// postToken: widget.postToken),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }).toList(),
|
||||
//
|
||||
//
|
||||
// ],
|
||||
// );
|
||||
}
|
||||
|
||||
Widget _buildDataRow(Map<String, dynamic> item) {
|
||||
@ -451,7 +447,7 @@ class _CdPolicieState extends State<CdPolicies> {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
flex: 3,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@ -460,7 +456,7 @@ class _CdPolicieState extends State<CdPolicies> {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
flex: 2,
|
||||
child: Text("₹${item['balance'] ?? '0'}", style: _dataBold),
|
||||
),
|
||||
Expanded(
|
||||
@ -501,10 +497,10 @@ class _CdPolicieState extends State<CdPolicies> {
|
||||
children: [
|
||||
Expanded(flex: 4, child: Text('Insurer Name', style: _headerStyle)),
|
||||
Expanded(
|
||||
flex: 4, child: Text('CD Account number', style: _headerStyle)),
|
||||
flex: 3, child: Text('CD Account number', style: _headerStyle)),
|
||||
Expanded(
|
||||
flex: 4, child: Text('Current Balance', style: _headerStyle)),
|
||||
Expanded(flex: 4, child: Text('Actions', style: _headerStyle)),
|
||||
flex: 2, child: Text('Current Balance', style: _headerStyle)),
|
||||
Expanded(flex: 1, child: Text('Actions', style: _headerStyle)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -17,13 +17,18 @@ class ClaimsPolicies extends StatefulWidget {
|
||||
final String empClientBranchId;
|
||||
final String empHrId;
|
||||
final String postToken;
|
||||
final String empCodeHrPolicy;
|
||||
|
||||
final int isHrcode;
|
||||
|
||||
const ClaimsPolicies(
|
||||
{Key? key,
|
||||
required this.empClientId,
|
||||
required this.empClientBranchId,
|
||||
required this.empHrId,
|
||||
required this.postToken});
|
||||
required this.postToken,
|
||||
required this.empCodeHrPolicy,
|
||||
required this.isHrcode});
|
||||
|
||||
@override
|
||||
State<ClaimsPolicies> createState() => _ClaimsPolicieState();
|
||||
@ -86,18 +91,40 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
||||
super.initState();
|
||||
apiService = ApiService(context);
|
||||
|
||||
if (widget.postToken != null && widget.postToken.isNotEmpty) {
|
||||
Map<String, dynamic>? postdecodedToken = Jwt.parseJwt(widget.postToken);
|
||||
|
||||
empClientId = postdecodedToken['client_id'].toString();
|
||||
getClaimList();
|
||||
}
|
||||
for (String field in tabHeader) {
|
||||
controllers[field] = TextEditingController();
|
||||
}
|
||||
|
||||
print("TextCXOnte - $controllers");
|
||||
|
||||
if (widget.postToken != null && widget.postToken.isNotEmpty) {
|
||||
Map<String, dynamic>? postdecodedToken = Jwt.parseJwt(widget.postToken);
|
||||
|
||||
empClientId = postdecodedToken['client_id'].toString();
|
||||
|
||||
print("Empcoed1- ${widget.empCodeHrPolicy}");
|
||||
print("EmpisHrcode- ${widget.isHrcode}");
|
||||
if (widget.empCodeHrPolicy != '') {
|
||||
print("Empcoedbool- ${widget.isHrcode}");
|
||||
controllers['empCode']!.text = widget.empCodeHrPolicy;
|
||||
// if (widget.isHrcode == 0) {
|
||||
// controllers['empCode']?.clear();
|
||||
// } else {
|
||||
// controllers['empCode']!.text = widget.empCodeHrPolicy;
|
||||
// }
|
||||
|
||||
print("Empcoed- ${widget.empCodeHrPolicy}");
|
||||
}
|
||||
|
||||
// if (widget.empCodeHrPolicy != '' && widget.isHrcode) {
|
||||
// print("Empcoedbool- ${widget.isHrcode}");
|
||||
// controllers['empCode']!.text = widget.empCodeHrPolicy;
|
||||
// print("Empcoed- ${widget.empCodeHrPolicy}");
|
||||
// }
|
||||
|
||||
getClaimList();
|
||||
}
|
||||
|
||||
getClaimsPoliciesDetails();
|
||||
// getApiData();
|
||||
}
|
||||
@ -107,6 +134,7 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
||||
for (var controller in controllers.values) {
|
||||
controller.dispose();
|
||||
}
|
||||
controllers['empCode']?.clear();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@ -187,6 +215,7 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
|
||||
}
|
||||
|
||||
void applyFilter() {
|
||||
print("Filtersss");
|
||||
final data = claim_Detials();
|
||||
print("data -- $data");
|
||||
getClaimList();
|
||||
|
||||
@ -139,10 +139,10 @@ class _PreEnrollmentState extends State<PreEnrollment> {
|
||||
final totalSpacing = (crossAxisCount - 1) * spacing;
|
||||
final itemWidth = (screenWidth - totalSpacing) / crossAxisCount;
|
||||
|
||||
// Example: target card height
|
||||
// Example: target card height
|
||||
final itemHeight = screenHeight * 0.2;
|
||||
|
||||
// Dynamic aspect ratio:
|
||||
// Dynamic aspect ratio:
|
||||
final aspectRatio = screenWidth / screenHeight;
|
||||
|
||||
print("_PreEnrollmentState 4");
|
||||
@ -176,7 +176,7 @@ class _PreEnrollmentState extends State<PreEnrollment> {
|
||||
// color: Colors.redAccent.shade100,
|
||||
// color: Colors.white,
|
||||
// color: Colors.white,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||
// padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||
height: MediaQuery.of(context).size.height * 0.45,
|
||||
// height: 400,
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user