This commit is contained in:
Surendiran 2025-07-10 18:14:21 +05:30
commit eb3de92345
6 changed files with 288 additions and 187 deletions

BIN
assets/claimsData.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

View File

@ -34,6 +34,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
List<String> stepKeys = []; List<String> stepKeys = [];
late Map<String, dynamic> stepMap; late Map<String, dynamic> stepMap;
int _index = 4; int _index = 4;
bool isLoading = false;
@override @override
void initState() { void initState() {
@ -56,7 +57,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
Future<void> getClaimsHistoryDetails() async { Future<void> getClaimsHistoryDetails() async {
setState(() { setState(() {
// isLoading = true; isLoading = true;
}); });
try { try {
print('10'); print('10');
@ -68,7 +69,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
widget.ticket_id, widget.postToken); widget.ticket_id, widget.postToken);
if (response['status'] == 'success') { if (response['status'] == 'success') {
setState(() { setState(() {
// isLoading = false; isLoading = false;
}); });
setState(() { setState(() {
getClaimsHistoryList = [ getClaimsHistoryList = [
@ -84,7 +85,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
}); });
} else { } else {
setState(() { setState(() {
// isLoading = false; isLoading = false;
}); });
// ToastHelper.showWarningToast( // ToastHelper.showWarningToast(
@ -93,12 +94,12 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
} }
} catch (e) { } catch (e) {
setState(() { setState(() {
// isLoading = false; isLoading = false;
}); });
print('Exception occurred: $e'); print('Exception occurred: $e');
} finally { } finally {
setState(() { setState(() {
// _isLoading = false; isLoading = false;
}); });
} }
} }
@ -149,7 +150,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
border: Border.all(color: Color(0xFFBCBCBC)), border: Border.all(color: Color(0xFFBCBCBC)),
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
child: Icon( child: const Icon(
Icons.close, Icons.close,
size: 25, size: 25,
color: Color(0xFFBCBCBC), color: Color(0xFFBCBCBC),
@ -165,7 +166,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFFFFFF), // White background color: Color(0xFFFFFFFF), // White background
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
boxShadow: [ boxShadow: const [
BoxShadow( BoxShadow(
color: Color(0xFFEBEBEB), // Shadow color color: Color(0xFFEBEBEB), // Shadow color
blurRadius: 14, // How soft the shadow is blurRadius: 14, // How soft the shadow is
@ -290,11 +291,26 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
// ); // );
// }), // }),
// ) // )
Column(
isLoading
? Container(
// color: Color(0x98FFFCE5), // Semi-transparent background
child: Center(
child: // Your GIF loader widget
Image.asset(
height: 60,
width: 60,
'assets/nhance-loader.gif'), // Adjust path to your GIF loader
),
)
: Container(
child: getClaimsHistoryList.isNotEmpty
? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(stepKeys.length, (index) { children: List.generate(stepKeys.length, (index) {
String stepTitleKey = stepKeys[index]; String stepTitleKey = stepKeys[index];
Map<String, dynamic> stepData = stepMap[stepTitleKey]; Map<String, dynamic> stepData =
stepMap[stepTitleKey];
print('stepTitleKey'); print('stepTitleKey');
print(stepTitleKey); print(stepTitleKey);
@ -303,12 +319,35 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
return _buildStep( return _buildStep(
stepNumber: index + 1, stepNumber: index + 1,
title: _getStepTitleFromApi(stepTitleKey, stepData), title: _getStepTitleFromApi(
stepTitleKey, stepData),
content: _getStepContentFromApi(stepData), content: _getStepContentFromApi(stepData),
isLast: index == stepKeys.length - 1, isLast: index == stepKeys.length - 1,
); );
}), }),
) )
: Container(
height: MediaQuery.of(context).size.height * 0.4,
// color: Colors.red,
child: Center(
child: Column(
children: [
Image.asset(
'assets/claimsData.png', // Replace 'default_image.png' with your default image asset path
width: 200,
height: 200,
fit: BoxFit.cover,
),
Text(
'No Available Claims',
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 15),
),
],
)),
),
)
], ],
), ),
), ),
@ -354,9 +393,9 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
// Dotted line below circle (except for last step) // Dotted line below circle (except for last step)
if (!isLast) if (!isLast)
Container( Container(
height: 120, // increase to extend line height: 70, // increase to extend line
width: 2, width: 2,
// margin: EdgeInsets.only(top: 4, bottom: 4), margin: EdgeInsets.only(top: 4, bottom: 4),
child: CustomPaint( child: CustomPaint(
painter: DottedLinePainter(), painter: DottedLinePainter(),
), ),

View File

@ -169,14 +169,14 @@ class _hrDashboardState extends State<hrDashboard>
print('allowed_modules'); print('allowed_modules');
String? modulesString = prefs.getString('empAllowed_modules'); String? modulesString = prefs.getString('empAllowed_modules');
String? enrollmodulesString = // String? enrollmodulesString =
prefs.getString('enrollmentAllowed_modules'); // prefs.getString('enrollmentAllowed_modules');
if (modulesString != null || enrollmodulesString != null) { if (modulesString != null) {
empAllowed_modules = jsonDecode(modulesString!); empAllowed_modules = jsonDecode(modulesString);
enrollmentAllowed_modules = jsonDecode(enrollmodulesString!); // enrollmentAllowed_modules = jsonDecode(enrollmodulesString!);
print("empAllowed_modules - $empAllowed_modules"); // [2, 3, 4] print("empAllowed_modules - $empAllowed_modules"); // [2, 3, 4]
print( // print(
"enrollmentAllowed_modules - $enrollmentAllowed_modules"); // [2, 3, 4] // "enrollmentAllowed_modules - $enrollmentAllowed_modules"); // [2, 3, 4]
if (empAllowed_modules.contains(2)) { if (empAllowed_modules.contains(2)) {
print("visibleTabs.length2"); print("visibleTabs.length2");
@ -215,7 +215,7 @@ class _hrDashboardState extends State<hrDashboard>
if (empAllowed_modules.contains(4)) { if (empAllowed_modules.contains(4)) {
tabData.add({ tabData.add({
'icon': Icons.receipt_long, 'icon': Icons.receipt_long,
'label': 'Claims', 'label': 'Claims', // Label Name Integrated with code (dont change)
}); });
// tabViews.add(ClaimsPolicies( // tabViews.add(ClaimsPolicies(
// empClientId: empClientId, // empClientId: empClientId,
@ -246,9 +246,15 @@ class _hrDashboardState extends State<hrDashboard>
print('111'); print('111');
if (widget.selectedIndex == 3) { if (widget.selectedIndex == 3) {
print("Process1"); print("Process1");
_tabController.index = 3; print("ProcessTAb - $tabData");
final claimsIndex = tabData.indexWhere((tab) => tab['label'] == 'Claims');
print('Claims tab index: $claimsIndex');
_tabController.index = claimsIndex;
// _tabController.index = 3;
setState(() { setState(() {
selectedIndex = 3; selectedIndex = claimsIndex;
// selectedIndex = 3;
isHrcode = 1; isHrcode = 1;
empCodeFromHrPolcy = widget.empCodeFromHrPolicy; empCodeFromHrPolcy = widget.empCodeFromHrPolicy;
}); });
@ -610,9 +616,23 @@ class _hrDashboardState extends State<hrDashboard>
], ],
), ),
) )
: const Center( : Container(
child: Text("No Data Available"), height: MediaQuery.of(context).size.height * 0.6,
// color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/claimsData.png', // Replace 'default_image.png' with your default image asset path
width: 300,
height: 300,
fit: BoxFit.cover,
), ),
const Text("No Data Available"),
],
),
),
SizedBox(height: 16), SizedBox(height: 16),
// Expanded TabBarView // Expanded TabBarView
Expanded( Expanded(
@ -733,6 +753,7 @@ class CustomTab extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
print("isSelected - $isSelected");
return Tab( return Tab(
child: Container( child: Container(
// margin: const EdgeInsets.symmetric(horizontal: 6), // margin: const EdgeInsets.symmetric(horizontal: 6),

View File

@ -61,6 +61,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
with TickerProviderStateMixin { with TickerProviderStateMixin {
Uint8List? fileBytes; Uint8List? fileBytes;
String empCodeFromHrPolcy = ''; String empCodeFromHrPolcy = '';
bool hasAnyEcardLink = false;
late String _token; late String _token;
List<Map<String, dynamic>> getEmpDependenceByClintId = []; List<Map<String, dynamic>> getEmpDependenceByClintId = [];
List<Map<String, dynamic>> getCDPolicies = []; List<Map<String, dynamic>> getCDPolicies = [];
@ -79,6 +80,9 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
dynamic clientPolicyId; dynamic clientPolicyId;
dynamic clientId; dynamic clientId;
dynamic empRefId; dynamic empRefId;
String? modulesString;
final storeModuleId = 4;
bool hasModule = false;
int inceptionType = 0; int inceptionType = 0;
TextEditingController searchController = TextEditingController(); TextEditingController searchController = TextEditingController();
late ApiService apiService; late ApiService apiService;
@ -99,6 +103,8 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
apiService = ApiService(context); // Initialize ApiService here apiService = ApiService(context); // Initialize ApiService here
getCDPoliciesDetails(); getCDPoliciesDetails();
print("_PreEnrollmentState 1"); print("_PreEnrollmentState 1");
print('allowed_modules');
} }
Future<void> getCDPoliciesDetails() async { Future<void> getCDPoliciesDetails() async {
@ -109,6 +115,24 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
try { try {
print('10'); print('10');
final SharedPreferences prefs = await SharedPreferences.getInstance();
modulesString = prefs.getString('empAllowed_modules');
// modulesString = "[2,3]";
print("empmodulesString - $modulesString");
if (modulesString != null && modulesString!.trim().isNotEmpty) {
final List<int>? moduleList = modulesString
?.replaceAll('[', '')
.replaceAll(']', '')
.split(',')
.map((e) => int.tryParse(e.trim()) ?? -1) // convert to int safely
.where((id) => id != -1) // filter out invalid
.toList();
hasModule = moduleList!.contains(storeModuleId);
}
final response = widget.TokenType == "post" final response = widget.TokenType == "post"
? await apiService.getEmployeeAndDependenceToApi(widget.ClientId, ? await apiService.getEmployeeAndDependenceToApi(widget.ClientId,
widget.ClientPoliyId, widget.clientBranchId, widget.Token) widget.ClientPoliyId, widget.clientBranchId, widget.Token)
@ -397,6 +421,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
if (widget.TokenType != "post")
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
@ -406,7 +431,8 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
ClientId: ClientId:
widget.ClientId, // <-- from map widget.ClientId, // <-- from map
ClientPoliyId: widget.ClientPoliyId, ClientPoliyId: widget.ClientPoliyId,
clientBranchId: widget.clientBranchId, clientBranchId:
widget.clientBranchId,
Token: widget.Token, Token: widget.Token,
TokenType: widget.TokenType, TokenType: widget.TokenType,
cardType: widget.cardType, cardType: widget.cardType,
@ -432,8 +458,8 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
}, },
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
@ -534,6 +560,18 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
} }
Widget _buildCDDataTable(BuildContext context) { Widget _buildCDDataTable(BuildContext context) {
if (_paginatedData.isNotEmpty) {
hasAnyEcardLink = _paginatedData.any(
(item) => item['ecard_download_link'] != null,
);
if (widget.TokenType == "post" && hasModule) {
print("paginatTtt - $_paginatedData");
print("📥 Any e-card link present: $hasAnyEcardLink");
}
}
if (filteredData.isEmpty) { if (filteredData.isEmpty) {
return SizedBox( return SizedBox(
// height: 50, // height: 50,
@ -641,6 +679,7 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
), ),
), ),
), ),
if (widget.TokenType != "pre" && (hasAnyEcardLink || hasModule))
Expanded( Expanded(
flex: 3, flex: 3,
child: Text( child: Text(
@ -794,6 +833,8 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
), ),
), ),
), ),
if (widget.TokenType != "pre" &&
(hasAnyEcardLink || hasModule))
Expanded( Expanded(
flex: 3, flex: 3,
child: Row( child: Row(
@ -824,16 +865,19 @@ class _HrPolicyDetailsState extends State<hrPolicyDetails>
SizedBox( SizedBox(
width: 10, width: 10,
), ),
if (widget.TokenType == "post" && hasModule)
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
print("policytabdata - ${item['emp_code']!}"); print(
"policytabdata - ${item['emp_code']!}");
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => hrDashboard( builder: (context) => hrDashboard(
selectedIndex: 3, selectedIndex: 3,
empCodeFromHrPolicy: item['emp_code']!, empCodeFromHrPolicy:
item['emp_code']!,
isHrcode: 1, isHrcode: 1,
), ),
), ),

View File

@ -349,14 +349,18 @@ class _ActivePolicieState extends State<ActivePolicies> {
fontSize: 12, fontSize: 12,
), ),
), ),
Text( policy['insurer_name'] != ''
"${policy['insurer_short_name']} - ${policy['policy_name']} " ?? ? Text(
'', // "${policy['insurer_short_name']} - ${policy['policy_name']} " ??
// '',
policy['insurer_name'] ?? "",
style: const TextStyle( style: const TextStyle(
fontSize: 11, fontSize: 11,
color: Colors.grey, color: Colors.grey,
), ),
), )
: SizedBox.shrink(),
], ],
), ),
], ],

View File

@ -92,10 +92,10 @@ class _PreEnrollmentState extends State<PreEnrollment> {
print("hr_id -$hr_id"); print("hr_id -$hr_id");
print("token -$token"); print("token -$token");
// isLoading = true;
setState(() {
isLoading = true; isLoading = true;
// setState(() { });
// _isLoading = true;
// });
try { try {
if (clintBranchId == null || clintID == null) { if (clintBranchId == null || clintID == null) {
return; return;
@ -159,7 +159,7 @@ class _PreEnrollmentState extends State<PreEnrollment> {
), ),
// //
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
isLoading isLoading
? Container( ? Container(
@ -203,12 +203,12 @@ class _PreEnrollmentState extends State<PreEnrollment> {
: GridView.builder( : GridView.builder(
itemCount: getCardArrays.length, itemCount: getCardArrays.length,
gridDelegate: gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount( const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4, crossAxisCount: 4,
crossAxisSpacing: 20, crossAxisSpacing: 20,
mainAxisSpacing: 20, mainAxisSpacing: 20,
// childAspectRatio: 2, childAspectRatio: 2.6,
childAspectRatio: aspectRatio, // childAspectRatio: aspectRatio,
// childAspectRatio: 2.1, // childAspectRatio: 2.1,
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -225,7 +225,7 @@ class _PreEnrollmentState extends State<PreEnrollment> {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
final devicePixelRatio = mediaQuery.devicePixelRatio; final devicePixelRatio = mediaQuery.devicePixelRatio;
final logicalWidth = 230 / devicePixelRatio; final logicalWidth = 230 / devicePixelRatio;
final logicalHeight = 115 / devicePixelRatio; final logicalHeight = 189 / devicePixelRatio;
print("logicalWidth - $logicalWidth"); print("logicalWidth - $logicalWidth");
print("logicalHeight - $logicalHeight"); print("logicalHeight - $logicalHeight");
@ -280,10 +280,10 @@ class _PreEnrollmentState extends State<PreEnrollment> {
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
height: MediaQuery.of(context).size.height * 0.07, height: MediaQuery.of(context).size.height * 0.03,
// color: Colors.green.shade100, // color: Colors.green.shade100,
child: Row( child: Row(
children: [ children: [
@ -298,22 +298,15 @@ class _PreEnrollmentState extends State<PreEnrollment> {
fontSize: 12, fontSize: 12,
), ),
), ),
Text(
// "${policy['insurer_short_name']} - ${policy['policy_name']} " ??
// '',
policy['insurer_name'] ?? "",
style: const TextStyle(
fontSize: 11,
color: Colors.grey,
),
),
], ],
), ),
], ],
), ),
), ),
// Spacer(), // Spacer(),
SizedBox(
height: 5,
),
Container( Container(
// color: Colors.pink.shade50, // color: Colors.pink.shade50,
height: MediaQuery.of(context).size.height * 0.09, height: MediaQuery.of(context).size.height * 0.09,