HR_CLAIMS_STEPPER_EXCEPTIONAL

This commit is contained in:
venbaittech 2025-07-16 12:26:49 +05:30
parent dd8e9b5755
commit bc0eaf3027
2 changed files with 95 additions and 19 deletions

View File

@ -317,11 +317,32 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
print('stepData');
print(stepData);
Widget content = _getStepContentFromApi(stepData);
print('check');
print(context);
// // 🟡 Skip step if there's no valid content (e.g., ID NOT GENERATED case)
// if ((content as Column).children.isEmpty) {
// print(
// "Skipping step $stepTitleKey due to no valid content");
// content = Text("No content available",
// style: TextStyle(color: Colors.grey));
// // or `return Container()`
// }
// if (content == null) {
// print(
// "Skipping step: $stepTitleKey due to no valid content");
// return const SizedBox(); // Completely skip step
// }
return _buildStep(
stepNumber: index + 1,
title: _getStepTitleFromApi(
stepTitleKey, stepData),
content: _getStepContentFromApi(stepData),
content: content,
// content: _getStepContentFromApi(stepData),
isLast: index == stepKeys.length - 1,
);
}),
@ -338,7 +359,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
height: 350,
fit: BoxFit.cover,
),
Text(
const Text(
'No Available Claims',
style: TextStyle(
fontWeight: FontWeight.w500,
@ -362,6 +383,14 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
bool isLast = false,
}) {
print(title);
print("contentss - $content");
final noContent;
if ((content as Column).children.isEmpty) {
noContent = 0;
} else {
noContent = 1;
}
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -393,7 +422,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
// Dotted line below circle (except for last step)
if (!isLast)
Container(
height: 70, // increase to extend line
height: noContent == 1 ? 70 : 25, // increase to extend line
width: 2,
margin: EdgeInsets.only(top: 4, bottom: 4),
child: CustomPaint(
@ -406,23 +435,25 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
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)),
if (noContent == 1) SizedBox(height: noContent == 0 ? 0 : 8),
if (noContent == 1)
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,
),
child: content,
),
SizedBox(height: isLast ? 0 : 16),
if (noContent == 1) SizedBox(height: isLast ? 0 : 16),
],
),
),
@ -467,17 +498,59 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
Widget _getStepContentFromApi(Map<String, dynamic> data) {
List<Widget> rows = [];
print("data - $data");
// bool hasDisplayFields(Map<String, dynamic> map) {
// for (var entry in map.entries) {
// if (entry.value is Map<String, dynamic>) {
// final innerMap = entry.value as Map<String, dynamic>;
// if (innerMap.containsKey('display_name') ||
// innerMap.containsKey('display_value')) {
// print("display fields found");
// return true;
// }
// }
// }
// return false;
// }
//
// if (!hasDisplayFields(data)) {
// print("❌ Skipping because no display fields found");
// return SizedBox.shrink(); // or return an empty Container/Spacer if needed
// }
data.forEach((key, value) {
// Skip metadata fields
// Skip metadata
if (key == 'modified_by' || key == 'modified_at') return;
String displayName = value['display_name'] ?? key;
String displayValue = value['display_value'] ?? 'N/A';
if (value is Map<String, dynamic>) {
final displayName = value['display_name'];
final displayValue = value['display_value'];
rows.add(_buildHistoryListData(displayName, displayValue));
rows.add(SizedBox(height: 6));
if (displayName != null && displayValue != null) {
print("✅ displayName - $displayName, displayValue - $displayValue");
rows.add(_buildHistoryListData(displayName, displayValue));
rows.add(SizedBox(height: 6));
}
}
});
// data.forEach((key, value) {
// // Skip metadata fields
// if (key == 'modified_by' || key == 'modified_at') return;
// print("ContentKey - $key");
// print("Content - $value");
// String displayName = value['display_name'] ?? key;
// String displayValue = value['display_value'] ?? 'N/A';
//
// print("displayName - $displayName");
// print("displayValue - $displayValue");
// if (displayName == 'N/A' || displayValue == 'N/A') return;
//
// rows.add(_buildHistoryListData(displayName, displayValue));
// rows.add(SizedBox(height: 6));
// });
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: rows,
@ -512,6 +585,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
}
Widget _buildHistoryListData(String title, String value) {
print("_buildHistoryListData");
final displayValue =
(value == null || value.trim().isEmpty) ? 'N/A' : value;

View File

@ -5,6 +5,7 @@
import FlutterMacOS
import Foundation
import file_picker
import firebase_auth
import firebase_core
import google_sign_in_ios
@ -14,6 +15,7 @@ import smart_auth
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))