UI_CLAIM_HISTORY_APP
This commit is contained in:
parent
c8ba0f7c41
commit
3ec1bde8b9
BIN
assets/searchData.jpg
Normal file
BIN
assets/searchData.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 285 KiB |
@ -54,47 +54,44 @@ Future<void> main() async {
|
||||
if (kIsWeb) {
|
||||
await Firebase.initializeApp(
|
||||
options: const FirebaseOptions(
|
||||
// apiKey: 'AIzaSyC4yHbCX4mQu0jO81pJrDwxKLQlTQWofrc',
|
||||
// appId: '1:1084115316849:android:68b14c4ff37f4bbc6c6bd0',
|
||||
// messagingSenderId: '1084115316849',
|
||||
// projectId: 'nhance-ee8d1'
|
||||
// apiKey: 'AIzaSyC4yHbCX4mQu0jO81pJrDwxKLQlTQWofrc',
|
||||
// appId: '1:1084115316849:android:68b14c4ff37f4bbc6c6bd0',
|
||||
// messagingSenderId: '1084115316849',
|
||||
// projectId: 'nhance-ee8d1'
|
||||
apiKey: "AIzaSyC4yHbCX4mQu0jO81pJrDwxKLQlTQWofrc",
|
||||
authDomain: "nhance-ee8d1.firebaseapp.com",
|
||||
projectId: "nhance-ee8d1",
|
||||
storageBucket: "nhance-ee8d1.firebasestorage.app",
|
||||
messagingSenderId: "1084115316849",
|
||||
appId: "1:1084115316849:web:8fc3b1c886349ae86c6bd0"
|
||||
)
|
||||
);
|
||||
appId: "1:1084115316849:web:8fc3b1c886349ae86c6bd0"));
|
||||
} else {
|
||||
await Firebase.initializeApp();
|
||||
await FirebaseAppCheck.instance.activate(
|
||||
// webProvider: ReCaptchaV3Provider('recaptcha-v3-site-key'),
|
||||
androidProvider: AndroidProvider.playIntegrity,
|
||||
appleProvider: AppleProvider.appAttest,
|
||||
);
|
||||
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
|
||||
await Firebase.initializeApp();
|
||||
await FirebaseAppCheck.instance.activate(
|
||||
// webProvider: ReCaptchaV3Provider('recaptcha-v3-site-key'),
|
||||
androidProvider: AndroidProvider.playIntegrity,
|
||||
appleProvider: AppleProvider.appAttest,
|
||||
);
|
||||
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
|
||||
|
||||
FirebaseMessaging messaging = FirebaseMessaging.instance;
|
||||
// NotificationSettings settings = await messaging.requestPermission();
|
||||
NotificationSettings settings = await FirebaseMessaging.instance.requestPermission(
|
||||
alert: true,
|
||||
badge: true,
|
||||
sound: true,
|
||||
);
|
||||
print('User granted permission: ${settings.authorizationStatus}');
|
||||
FirebaseMessaging messaging = FirebaseMessaging.instance;
|
||||
// NotificationSettings settings = await messaging.requestPermission();
|
||||
NotificationSettings settings =
|
||||
await FirebaseMessaging.instance.requestPermission(
|
||||
alert: true,
|
||||
badge: true,
|
||||
sound: true,
|
||||
);
|
||||
print('User granted permission: ${settings.authorizationStatus}');
|
||||
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
print('Foreground Message: ${message.notification?.title}');
|
||||
});
|
||||
|
||||
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
|
||||
print('User tapped on notification');
|
||||
});
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
print('Foreground Message: ${message.notification?.title}');
|
||||
});
|
||||
|
||||
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
|
||||
print('User tapped on notification');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
await dotenv.load(fileName: Environment.fileName);
|
||||
|
||||
runApp(MyApp());
|
||||
@ -132,7 +129,8 @@ class MyApp extends StatelessWidget {
|
||||
'claimtracklist': (context) => claimtracklist(),
|
||||
'privacypolicy': (context) => privacypolicy(),
|
||||
'termsofuse': (context) => termsofuse(),
|
||||
'generalExclusionsDeductibles': (context) => generalExclusionsDeductibles(),
|
||||
'generalExclusionsDeductibles': (context) =>
|
||||
generalExclusionsDeductibles(),
|
||||
// 'home': (context) => BotmanScaffold(currentRoute: 'home', child: Home()),
|
||||
// 'policies': (context) => BotmanScaffold(currentRoute: 'policies', child: policies()),
|
||||
// 'claims': (context) => BotmanScaffold(currentRoute: 'claims', child: claims()),
|
||||
@ -213,4 +211,3 @@ class BotmanScaffold extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ import '../../customAppBar/customFooter.dart';
|
||||
import '../../customAppBar/responsive.dart';
|
||||
import '../../customAppBar/tabs.dart';
|
||||
import '../../customAppBar/toastHelper.dart';
|
||||
import 'claimshistory.dart';
|
||||
|
||||
class claims extends StatefulWidget {
|
||||
const claims({Key? key}) : super(key: key);
|
||||
@ -76,7 +77,6 @@ class _claimsState extends State<claims> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
Future<void> _loadToken() async {
|
||||
print('_loadToken');
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
@ -107,7 +107,6 @@ class _claimsState extends State<claims> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> getActiveAndInactivePolicyDetails() async {
|
||||
if (client_id == null || empCodeString == null) {
|
||||
return;
|
||||
@ -120,15 +119,16 @@ class _claimsState extends State<claims> {
|
||||
try {
|
||||
// Call both APIs
|
||||
final responseActive = await apiService.getActiveAndInactivePolicyDetails(
|
||||
client_id!, empCodeString!, 'Active', client_branch_id,mobileNo
|
||||
);
|
||||
client_id!, empCodeString!, 'Active', client_branch_id, mobileNo);
|
||||
|
||||
final responseInactive = await apiService.getActiveAndInactivePolicyDetails(
|
||||
client_id!, empCodeString!, 'Inactive', client_branch_id,mobileNo
|
||||
);
|
||||
final responseInactive =
|
||||
await apiService.getActiveAndInactivePolicyDetails(client_id!,
|
||||
empCodeString!, 'Inactive', client_branch_id, mobileNo);
|
||||
|
||||
final bool isActiveSuccess = responseActive['status'] == 'success' && responseActive['data'] != null;
|
||||
final bool isInactiveSuccess = responseInactive['status'] == 'success' && responseInactive['data'] != null;
|
||||
final bool isActiveSuccess = responseActive['status'] == 'success' &&
|
||||
responseActive['data'] != null;
|
||||
final bool isInactiveSuccess = responseInactive['status'] == 'success' &&
|
||||
responseInactive['data'] != null;
|
||||
|
||||
final List<Map<String, dynamic>> activeData = isActiveSuccess
|
||||
? List<Map<String, dynamic>>.from(responseActive['data'])
|
||||
@ -158,7 +158,6 @@ class _claimsState extends State<claims> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> getTrackClaimsList() async {
|
||||
if (client_id == null || empCodeString == null) {
|
||||
return;
|
||||
@ -585,7 +584,7 @@ class _claimsState extends State<claims> {
|
||||
.isDesktop(
|
||||
context)
|
||||
? 130
|
||||
: 50,
|
||||
: 30,
|
||||
vertical: Responsive
|
||||
.isDesktop(
|
||||
context)
|
||||
@ -818,7 +817,9 @@ class _claimsState extends State<claims> {
|
||||
fontSize:
|
||||
Responsive.isDesktop(context) ? 18 : 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: policyStatus == 'Active' ? Colors.green : Colors.red,
|
||||
color: policyStatus == 'Active'
|
||||
? Colors.green
|
||||
: Colors.red,
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -888,6 +889,7 @@ class _claimsState extends State<claims> {
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var item = data[index];
|
||||
// String claimsName = item['user_name'];
|
||||
String ticketId = item['id'] ?? '';
|
||||
String claimsSubject = item['subject'] ?? '';
|
||||
String claimsDate = item['created_at'] ?? '';
|
||||
String claimStatus = item['claim_status'] ?? '';
|
||||
@ -896,6 +898,8 @@ class _claimsState extends State<claims> {
|
||||
// List<dynamic> messageList = item['message_list'];
|
||||
|
||||
print('generateTrackList');
|
||||
print('generateTrackList- $data');
|
||||
print('generateTrackList- $ticketId');
|
||||
print(claimsSubject);
|
||||
print(claimsDate);
|
||||
print(claimStatus);
|
||||
@ -922,7 +926,32 @@ class _claimsState extends State<claims> {
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
print("Tappp - $ticketId");
|
||||
// Navigator.pushNamed(context, 'claimtracklist', arguments: item);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
insetPadding: EdgeInsets.all(16),
|
||||
child: ClaimHistoryPopup(
|
||||
ticket_id: item['id'],
|
||||
empName: item['emp_name'], // example
|
||||
empCode: item['emp_code'], // example
|
||||
policyType: item['ticket_policy_type']!,
|
||||
// policyType: item['policy_type'],
|
||||
// clientPolicyNo: item['client_policy_no'],
|
||||
clientPolicyNo: item['policy_no']?.toString(),
|
||||
claimAmount: item['claim_amount']?.toString(),
|
||||
// claimNo: item['claim_no'],
|
||||
claimNo: item['claim_number']?.toString(),
|
||||
// postToken: widget.postToken,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
|
||||
694
lib/pages/postEnrollment/claimshistory.dart
Normal file
694
lib/pages/postEnrollment/claimshistory.dart
Normal file
@ -0,0 +1,694 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:nhance_app_pwa/pages/postEnrollment/service/api_service.dart';
|
||||
|
||||
import '../../customAppBar/responsive.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,
|
||||
this.clientPolicyNo,
|
||||
this.claimAmount,
|
||||
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 = [];
|
||||
List<String> stepKeys = [];
|
||||
late Map<String, dynamic> stepMap;
|
||||
int _index = 4;
|
||||
bool isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
apiService = ApiService(context);
|
||||
// print(widget.postToken);
|
||||
print("CLAIMHISTORY");
|
||||
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);
|
||||
if (response['status'] == 'success') {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
print('Claims History List1');
|
||||
// final List<dynamic> ticketDataList = response['data']['ticket_data'];
|
||||
// final Map<String, dynamic> ticketDataMap =
|
||||
// response['data']['ticket_data'];
|
||||
// print('Claims History List12');
|
||||
// print('Claims History List1- $ticketDataMap');
|
||||
|
||||
// getClaimsHistoryList = ticketDataList
|
||||
// .map((item) => Map<String, dynamic>.from(item))
|
||||
// .toList();
|
||||
|
||||
// getClaimsHistoryList = ticketDataMap.entries.map((entry) {
|
||||
// return {
|
||||
// 'status': entry.key,
|
||||
// ...Map<String, dynamic>.from(entry.value),
|
||||
// };
|
||||
// }).toList();
|
||||
//
|
||||
// getClaimsHistoryList = ticketDataMap.entries.map((entry) {
|
||||
// return {
|
||||
// 'status': entry.key,
|
||||
// ...Map<String, dynamic>.from(entry.value),
|
||||
// };
|
||||
// }).toList();
|
||||
|
||||
// if (getClaimsHistoryList.isNotEmpty) {
|
||||
// stepMap = getClaimsHistoryList[0];
|
||||
// stepKeys = stepMap.keys.toList();
|
||||
// }
|
||||
|
||||
print('Claims History List: $getClaimsHistoryList');
|
||||
|
||||
getClaimsHistoryList = [
|
||||
Map<String, dynamic>.from(response['data']['ticket_data'])
|
||||
];
|
||||
stepMap = getClaimsHistoryList[0];
|
||||
stepKeys = stepMap.keys.toList();
|
||||
|
||||
// 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')),
|
||||
// );
|
||||
// }
|
||||
final keyValueWidgets = [
|
||||
_buildKeyValue(
|
||||
'Name',
|
||||
'${widget.empName ?? ''} (${widget.empCode ?? ''})',
|
||||
),
|
||||
SizedBox(
|
||||
width: Responsive.isDesktop(context) ? 16 : 0,
|
||||
height: Responsive.isDesktop(context) ? 0 : 8),
|
||||
_buildKeyValue(
|
||||
'Policy Name',
|
||||
'${widget.policyType ?? ''} - ${widget.clientPolicyNo ?? ''}',
|
||||
),
|
||||
];
|
||||
|
||||
final keyValueWidgetRow = [
|
||||
_buildKeyValue(
|
||||
'Claim Amount',
|
||||
widget.claimAmount == null || widget.claimAmount!.trim().isEmpty
|
||||
? 'N/A'
|
||||
: '₹${widget.claimAmount}',
|
||||
),
|
||||
SizedBox(
|
||||
width: Responsive.isDesktop(context) ? 16 : 0,
|
||||
height: Responsive.isDesktop(context) ? 0 : 8),
|
||||
_buildKeyValue(
|
||||
'Claim Number',
|
||||
widget.claimNo == null || widget.claimNo!.trim().isEmpty
|
||||
? 'N/A'
|
||||
: widget.claimNo!,
|
||||
),
|
||||
];
|
||||
|
||||
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: Responsive.isDesktop(context) ? 20 : 16,
|
||||
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: Responsive.isDesktop(context) ? 10 : 5),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
|
||||
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: Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Responsive.isDesktop(context)
|
||||
? Row(
|
||||
children: keyValueWidgets
|
||||
.map((w) => Expanded(child: w))
|
||||
.toList(),
|
||||
)
|
||||
: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: keyValueWidgets),
|
||||
),
|
||||
// Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: _buildKeyValue('Name',
|
||||
// '${widget.empName ?? ''} (${widget.empCode ?? ''})'),
|
||||
// ),
|
||||
// SizedBox(width: 16),
|
||||
// Expanded(
|
||||
// child: _buildKeyValue('Policy Name',
|
||||
// '${widget.policyType ?? ''} - ${widget.clientPolicyNo ?? ''}')),
|
||||
// ],
|
||||
// ),
|
||||
SizedBox(height: Responsive.isDesktop(context) ? 16 : 8),
|
||||
Responsive.isDesktop(context)
|
||||
? Row(
|
||||
children: keyValueWidgetRow
|
||||
.map((w) => Expanded(child: w))
|
||||
.toList(),
|
||||
)
|
||||
: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: keyValueWidgetRow),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
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,
|
||||
// );
|
||||
// }),
|
||||
// )
|
||||
|
||||
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,
|
||||
children: List.generate(stepKeys.length, (index) {
|
||||
String stepTitleKey = stepKeys[index];
|
||||
Map<String, dynamic> stepData =
|
||||
stepMap[stepTitleKey];
|
||||
|
||||
print('stepTitleKey');
|
||||
print(stepTitleKey);
|
||||
print('stepData');
|
||||
print(stepData);
|
||||
|
||||
return _buildStep(
|
||||
stepNumber: index + 1,
|
||||
title: _getStepTitleFromApi(
|
||||
stepTitleKey, stepData),
|
||||
content: _getStepContentFromApi(stepData),
|
||||
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/searchData.jpg', // Replace 'default_image.png' with your default image asset path
|
||||
width: 200,
|
||||
height: 200,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
Text(
|
||||
'No Claim History',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 15),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStep({
|
||||
required int stepNumber,
|
||||
// required String title,
|
||||
required Widget title,
|
||||
required Widget content,
|
||||
bool isLast = false,
|
||||
}) {
|
||||
print(title);
|
||||
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: Responsive.isDesktop(context) ? 13 : 12,
|
||||
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: [
|
||||
title,
|
||||
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 _getStepTitleFromApi(String status, Map<String, dynamic> data) {
|
||||
// final modifiedBy = data['modified_by'] ?? '';
|
||||
// final modifiedAt = data['modified_at'] ?? '';
|
||||
// return '$status ($modifiedBy – $modifiedAt)';
|
||||
// }
|
||||
|
||||
Widget _getStepTitleFromApi(String status, Map<String, dynamic> data) {
|
||||
final modifiedBy = data['modified_by'] ?? '';
|
||||
final modifiedAt = data['modified_at'] ?? '';
|
||||
final isDesktop = Responsive.isDesktop(context);
|
||||
|
||||
return RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: status + (isDesktop ? ' ' : '\n'),
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: Responsive.isDesktop(context) ? 15 : 11,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF212120), // Status color
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: ' ($modifiedBy – $modifiedAt)',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: Responsive.isDesktop(context) ? 14 : 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF565656), // Subtitle color
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getStepContentFromApi(Map<String, dynamic> data) {
|
||||
List<Widget> rows = [];
|
||||
|
||||
data.forEach((key, value) {
|
||||
// Skip metadata fields
|
||||
if (key == 'modified_by' || key == 'modified_at') return;
|
||||
|
||||
String displayName = value['display_name'] ?? key;
|
||||
String displayValue = value['display_value'] ?? 'N/A';
|
||||
|
||||
rows.add(_buildHistoryListData(displayName, displayValue));
|
||||
rows.add(SizedBox(height: 1));
|
||||
});
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: rows,
|
||||
);
|
||||
}
|
||||
|
||||
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: GoogleFonts.poppins(
|
||||
color: Color(0xFF747474),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: Responsive.isDesktop(context) ? 16 : 13,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Text(
|
||||
displayValue,
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF000000),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: Responsive.isDesktop(context) ? 16 : 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHistoryListData(String title, String value) {
|
||||
final displayValue =
|
||||
(value == null || value.trim().isEmpty) ? 'N/A' : value;
|
||||
|
||||
final titleText = Text(
|
||||
title,
|
||||
style: GoogleFonts.poppins(
|
||||
color: const Color(0xFF747474),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: Responsive.isDesktop(context) ? 14 : 12,
|
||||
),
|
||||
);
|
||||
|
||||
final valueText = Text(
|
||||
displayValue,
|
||||
style: GoogleFonts.poppins(
|
||||
color: const Color(0xFF000000),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: Responsive.isDesktop(context) ? 14 : 12,
|
||||
),
|
||||
textAlign: TextAlign.right,
|
||||
);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 1), // optional spacing
|
||||
child: Responsive.isDesktop(context)
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, child: titleText)),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight, child: valueText)),
|
||||
|
||||
// Title - Align to center left
|
||||
// Expanded(
|
||||
// child: Align(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// child: Text(
|
||||
// title,
|
||||
// style: GoogleFonts.poppins(
|
||||
// color: const Color(0xFF747474),
|
||||
// fontWeight: FontWeight.w400,
|
||||
// fontSize: 14,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
// Value - Align to center right
|
||||
// Expanded(
|
||||
// child: Align(
|
||||
// alignment: Alignment.centerRight,
|
||||
// child: Text(
|
||||
// displayValue,
|
||||
// style: GoogleFonts.poppins(
|
||||
// color: const Color(0xFF000000),
|
||||
// fontWeight: FontWeight.w400,
|
||||
// fontSize: 14,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
titleText,
|
||||
SizedBox(height: 4),
|
||||
valueText,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DottedLinePainter extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
const dashHeight = 2.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;
|
||||
}
|
||||
@ -19,7 +19,11 @@ class ApiService {
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> getActiveAndInactivePolicyDetails(
|
||||
String clientId, String empCode, String status, String branchID,String mobileNo) async {
|
||||
String clientId,
|
||||
String empCode,
|
||||
String status,
|
||||
String branchID,
|
||||
String mobileNo) async {
|
||||
print(_token);
|
||||
if (_token == null) {
|
||||
await _initializeToken();
|
||||
@ -33,6 +37,19 @@ class ApiService {
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> getClaimsHistoryToApi(
|
||||
String ticket_type_id) async {
|
||||
print("getCashDepositDetailsToApi1");
|
||||
final url =
|
||||
Uri.parse('${Environment.apiUrl}claimView?ticket_id=$ticket_type_id');
|
||||
|
||||
final headers = {
|
||||
'Authorization': 'Bearer $_token' ?? '',
|
||||
};
|
||||
final response = await _makeGetRequest(url, headers);
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> getAdvertisementImageToApi() async {
|
||||
print(_token);
|
||||
if (_token == null) {
|
||||
|
||||
@ -25,7 +25,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
||||
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
||||
FLALocalAuthPlugin.register(with: registry.registrar(forPlugin: "FLALocalAuthPlugin"))
|
||||
LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin"))
|
||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user