claims history page
This commit is contained in:
parent
4e85d3d73f
commit
0a66595130
469
lib/claimshistory.dart
Normal file
469
lib/claimshistory.dart
Normal file
@ -0,0 +1,469 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:nhancepolicy/service/api_service.dart';
|
||||||
|
|
||||||
|
class ClaimHistoryPopup extends StatefulWidget {
|
||||||
|
final String ticket_id;
|
||||||
|
final String empName;
|
||||||
|
final String empCode;
|
||||||
|
final String policyType;
|
||||||
|
final String clientPolicyNo;
|
||||||
|
final String claimAmount;
|
||||||
|
final String claimNo;
|
||||||
|
final String postToken;
|
||||||
|
|
||||||
|
const ClaimHistoryPopup({
|
||||||
|
Key? key,
|
||||||
|
required this.ticket_id,
|
||||||
|
required this.empName,
|
||||||
|
required this.empCode,
|
||||||
|
required this.policyType,
|
||||||
|
required this.clientPolicyNo,
|
||||||
|
required this.claimAmount,
|
||||||
|
required this.claimNo,
|
||||||
|
required this.postToken,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ClaimHistoryPopup> createState() => _ClaimHistoryPopupState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
|
||||||
|
late ApiService apiService;
|
||||||
|
List<Map<String, dynamic>> getClaimsHistoryList = [];
|
||||||
|
int _index = 4;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
apiService = ApiService(context);
|
||||||
|
print(widget.postToken);
|
||||||
|
print(widget.claimAmount);
|
||||||
|
print(widget.claimNo);
|
||||||
|
print(widget.clientPolicyNo);
|
||||||
|
print(widget.empCode);
|
||||||
|
print(widget.policyType);
|
||||||
|
print(widget.ticket_id);
|
||||||
|
// getClaimsHistoryDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getClaimsHistoryDetails() async {
|
||||||
|
setState(() {
|
||||||
|
// isLoading = true;
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
print('10');
|
||||||
|
final ticketID = widget.ticket_id;
|
||||||
|
if(ticketID != '' || ticketID != null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final response = await apiService.getClaimsHistoryToApi(
|
||||||
|
widget.ticket_id, widget.postToken);
|
||||||
|
if (response['status'] == 'success') {
|
||||||
|
setState(() {
|
||||||
|
// isLoading = false;
|
||||||
|
});
|
||||||
|
setState(() {
|
||||||
|
getClaimsHistoryList = List<Map<String, dynamic>>.from(response['data']);
|
||||||
|
// originalData = getCDPolicies;
|
||||||
|
// filteredData = List.from(originalData);
|
||||||
|
// print('filteredData');
|
||||||
|
// print(filteredData);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
// isLoading = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// ToastHelper.showWarningToast(
|
||||||
|
// context, 'Request failed with status: ${response.statusCode}');
|
||||||
|
print('Request failed with status: ${response['code']}');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setState(() {
|
||||||
|
// isLoading = false;
|
||||||
|
});
|
||||||
|
print('Exception occurred: $e');
|
||||||
|
} finally {
|
||||||
|
setState(() {
|
||||||
|
// _isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (getClaimsHistoryList.isEmpty) {
|
||||||
|
return SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Center(child: Text('No available Claims')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
|
constraints: BoxConstraints(maxWidth: 800, maxHeight: 800),
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
'Claim History',
|
||||||
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Color(0xFF101010),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click, // Show pointer cursor
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => Navigator.of(context).pop(),
|
||||||
|
child: Container(
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: Border.all(color: Color(0xFFBCBCBC)),
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.close,
|
||||||
|
size: 25,
|
||||||
|
color: Color(0xFFBCBCBC),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 10),
|
||||||
|
// Container(
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: Color(0xFFFFFFFF), // White background
|
||||||
|
// borderRadius: BorderRadius.circular(12),
|
||||||
|
// boxShadow: [
|
||||||
|
// BoxShadow(
|
||||||
|
// color: Color(0xFFEBEBEB), // Shadow color
|
||||||
|
// blurRadius: 14, // How soft the shadow is
|
||||||
|
// spreadRadius: 2, // How much it spreads
|
||||||
|
// offset: Offset(0, 1), // X and Y offset
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// padding: const EdgeInsets.all(16),
|
||||||
|
// child: Column(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// children: [
|
||||||
|
// Row(
|
||||||
|
// children: [
|
||||||
|
// Expanded(
|
||||||
|
// child: _buildKeyValue(
|
||||||
|
// 'Name', '${widget.empName ?? ''} (${widget.empCode ?? ''})'),
|
||||||
|
// ),
|
||||||
|
// SizedBox(width: 16),
|
||||||
|
// Expanded(
|
||||||
|
// child: _buildKeyValue('Policy Name',
|
||||||
|
// '${widget.policyType ?? ''} - ${widget.clientPolicyNo ?? ''}')),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// SizedBox(height: 16),
|
||||||
|
// Row(
|
||||||
|
// children: [
|
||||||
|
// Expanded(
|
||||||
|
// child: _buildKeyValue(
|
||||||
|
// 'Claim Amount', '₹${widget.claimAmount ?? ''}'),
|
||||||
|
// ),
|
||||||
|
// SizedBox(width: 16),
|
||||||
|
// Expanded(
|
||||||
|
// child: _buildKeyValue('Claim Number', widget.claimNo ?? ''),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(height: 10),
|
||||||
|
// // Container(
|
||||||
|
// // padding: const EdgeInsets.all(16),
|
||||||
|
// // child: Stepper(
|
||||||
|
// // currentStep: _index,
|
||||||
|
// // onStepCancel: () {
|
||||||
|
// // if (_index > 0) {
|
||||||
|
// // setState(() {
|
||||||
|
// // _index -= 1;
|
||||||
|
// // });
|
||||||
|
// // }
|
||||||
|
// // },
|
||||||
|
// // onStepContinue: () {
|
||||||
|
// // if (_index < 4) {
|
||||||
|
// // setState(() {
|
||||||
|
// // _index += 1;
|
||||||
|
// // });
|
||||||
|
// // }
|
||||||
|
// // },
|
||||||
|
// // onStepTapped: (int index) {
|
||||||
|
// // setState(() {
|
||||||
|
// // _index = index;
|
||||||
|
// // });
|
||||||
|
// // },
|
||||||
|
// // steps: <Step>[
|
||||||
|
// // Step(
|
||||||
|
// // title: Text('Step 1: PAYMENT INITIATED'),
|
||||||
|
// // content: Text('Pay Initiate Date: 05-05-2025'),
|
||||||
|
// // isActive: true,
|
||||||
|
// // state: StepState.complete,
|
||||||
|
// // ),
|
||||||
|
// // Step(
|
||||||
|
// // title: Text('Step 2: INFORMATION REQUIRED'),
|
||||||
|
// // content: Text('Raised Date: 05-05-2025'),
|
||||||
|
// // isActive: true,
|
||||||
|
// // state: StepState.complete,
|
||||||
|
// // ),
|
||||||
|
// // Step(
|
||||||
|
// // title: Text('Step 3: CLAIM NO. UPDATION'),
|
||||||
|
// // content: Column(
|
||||||
|
// // crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// // children: [
|
||||||
|
// // Text('Claim Number: 4315440'),
|
||||||
|
// // Text('Registration Date: 05-05-2025'),
|
||||||
|
// // ],
|
||||||
|
// // ),
|
||||||
|
// // isActive: true,
|
||||||
|
// // state: StepState.complete,
|
||||||
|
// // ),
|
||||||
|
// // Step(
|
||||||
|
// // title: Text('Step 4: QUERY DOCUMENT REQUIRED'),
|
||||||
|
// // content: Text('Query Received Date: 05-05-2025'),
|
||||||
|
// // isActive: true,
|
||||||
|
// // state: StepState.complete,
|
||||||
|
// // ),
|
||||||
|
// // Step(
|
||||||
|
// // title: Text('Step 5: APPROVED'),
|
||||||
|
// // content: Column(
|
||||||
|
// // crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// // children: [
|
||||||
|
// // Text('Approved Amount: 4315440'),
|
||||||
|
// // Text('Approved Date: 05-05-2025'),
|
||||||
|
// // Text('Approved Letter: Lorem ipsum...'),
|
||||||
|
// // Text('Description: Lorem ipsum...'),
|
||||||
|
// // ],
|
||||||
|
// // ),
|
||||||
|
// // isActive: true,
|
||||||
|
// // state: StepState.complete,
|
||||||
|
// // ),
|
||||||
|
// // ],
|
||||||
|
// // ),
|
||||||
|
// // )
|
||||||
|
// Column(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// children: List.generate(5, (index) {
|
||||||
|
// return _buildStep(
|
||||||
|
// stepNumber: index + 1,
|
||||||
|
// title: _getStepTitle(index),
|
||||||
|
// content: _getStepContent(index),
|
||||||
|
// isLast: index == 4,
|
||||||
|
// );
|
||||||
|
// }),
|
||||||
|
// )
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildStep({
|
||||||
|
required int stepNumber,
|
||||||
|
required String title,
|
||||||
|
required Widget content,
|
||||||
|
bool isLast = false,
|
||||||
|
}) {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Left Column with circle + line
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
// Add top spacing before circle
|
||||||
|
SizedBox(height: stepNumber == 1 ? 0 : 4),
|
||||||
|
|
||||||
|
// Step number circle
|
||||||
|
Container(
|
||||||
|
height: 28,
|
||||||
|
width: 28,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color(0xFF00A5A8),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'$stepNumber',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Dotted line below circle (except for last step)
|
||||||
|
if (!isLast)
|
||||||
|
Container(
|
||||||
|
height: 50, // increase to extend line
|
||||||
|
width: 2,
|
||||||
|
margin: EdgeInsets.only(top: 4, bottom: 4),
|
||||||
|
child: CustomPaint(
|
||||||
|
painter: DottedLinePainter(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(width: 12),
|
||||||
|
|
||||||
|
// Right Side: Step title and content
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color(0xFFF7F7F7),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(color: Color(0xFFE0E0E0)),
|
||||||
|
),
|
||||||
|
child: content,
|
||||||
|
),
|
||||||
|
SizedBox(height: isLast ? 0 : 16),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String _getStepTitle(int index) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
return 'PAYMENT INITIATED (Nalini – 21–06–2025 / 11:20:02 AM)';
|
||||||
|
case 1:
|
||||||
|
return 'INFORMATION REQUIRED (Nalini – 21–06–2025 / 11:20:02 AM)';
|
||||||
|
case 2:
|
||||||
|
return 'UNDER PROCESS – CLAIM NO. UPDATION (Nalini – 21–06–2025 / 11:20:02 AM)';
|
||||||
|
case 3:
|
||||||
|
return 'UNDER PROCESS – QUERY DOCUMENT REQUIRED (Nalini – 21–06–2025 / 11:20:02 AM)';
|
||||||
|
case 4:
|
||||||
|
return 'APPROVED (Nalini – 21–06–2025 / 11:20:02 AM)';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _getStepContent(int index) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
return Text('Pay Initiate Date: 05-05-2025');
|
||||||
|
case 1:
|
||||||
|
return Text('Raised Date: 05-05-2025');
|
||||||
|
case 2:
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('Claim Number: 4315440'),
|
||||||
|
Text('Registration Date: 05-05-2025'),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
case 3:
|
||||||
|
return Text('Query Received Date: 05-05-2025');
|
||||||
|
case 4:
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('Approved Amount: 4315440'),
|
||||||
|
Text('Approved Date: 05-05-2025'),
|
||||||
|
Text('Approved Letter: Lorem ipsum...'),
|
||||||
|
Text('Description: Lorem ipsum...'),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return SizedBox.shrink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Widget _buildKeyValue(String title, String value) {
|
||||||
|
final displayValue = (value == null || value.trim().isEmpty) ? 'N/A' : value;
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey[600],
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
displayValue,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DottedLinePainter extends CustomPainter {
|
||||||
|
@override
|
||||||
|
void paint(Canvas canvas, Size size) {
|
||||||
|
const dashHeight = 4.0;
|
||||||
|
const dashSpace = 3.0;
|
||||||
|
double startY = 0;
|
||||||
|
final paint = Paint()
|
||||||
|
..color = Colors.grey.shade400
|
||||||
|
..strokeWidth = 1;
|
||||||
|
|
||||||
|
while (startY < size.height) {
|
||||||
|
canvas.drawLine(
|
||||||
|
Offset(0, startY),
|
||||||
|
Offset(0, startY + dashHeight),
|
||||||
|
paint,
|
||||||
|
);
|
||||||
|
startY += dashHeight + dashSpace;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldRepaint(CustomPainter oldDelegate) => false;
|
||||||
|
}
|
||||||
|
|
||||||
@ -507,6 +507,19 @@ class ApiService {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<Map<String, dynamic>> getClaimsHistoryToApi(
|
||||||
|
String ticket_type_id,String token) async {
|
||||||
|
print("getCashDepositDetailsToApi1");
|
||||||
|
final url = Uri.parse(
|
||||||
|
'${Environment.apiUrlPost}claimView?ticket_id=$ticket_type_id');
|
||||||
|
|
||||||
|
final headers = {
|
||||||
|
'Authorization': 'Bearer $token' ?? '',
|
||||||
|
};
|
||||||
|
final response = await _makeGetRequest(url, headers);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> getEmployeeAndDependenceToApi(
|
Future<Map<String, dynamic>> getEmployeeAndDependenceToApi(
|
||||||
String clintID, String getPolicyNo, String empRefId, String token) async {
|
String clintID, String getPolicyNo, String empRefId, String token) async {
|
||||||
print(_hrtoken);
|
print(_hrtoken);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user