HR_CLAIMS_STEPPER_EXCEPTIONAL
This commit is contained in:
parent
dd8e9b5755
commit
bc0eaf3027
@ -317,11 +317,32 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
|
|||||||
print('stepData');
|
print('stepData');
|
||||||
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(
|
return _buildStep(
|
||||||
stepNumber: index + 1,
|
stepNumber: index + 1,
|
||||||
title: _getStepTitleFromApi(
|
title: _getStepTitleFromApi(
|
||||||
stepTitleKey, stepData),
|
stepTitleKey, stepData),
|
||||||
content: _getStepContentFromApi(stepData),
|
content: content,
|
||||||
|
|
||||||
|
// content: _getStepContentFromApi(stepData),
|
||||||
isLast: index == stepKeys.length - 1,
|
isLast: index == stepKeys.length - 1,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
@ -338,7 +359,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
|
|||||||
height: 350,
|
height: 350,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
Text(
|
const Text(
|
||||||
'No Available Claims',
|
'No Available Claims',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
@ -362,6 +383,14 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
|
|||||||
bool isLast = false,
|
bool isLast = false,
|
||||||
}) {
|
}) {
|
||||||
print(title);
|
print(title);
|
||||||
|
print("contentss - $content");
|
||||||
|
final noContent;
|
||||||
|
if ((content as Column).children.isEmpty) {
|
||||||
|
noContent = 0;
|
||||||
|
} else {
|
||||||
|
noContent = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -393,7 +422,7 @@ 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: 70, // increase to extend line
|
height: noContent == 1 ? 70 : 25, // 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(
|
||||||
@ -406,12 +435,14 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
|
|||||||
SizedBox(width: 12),
|
SizedBox(width: 12),
|
||||||
|
|
||||||
// Right Side: Step title and content
|
// Right Side: Step title and content
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
title,
|
title,
|
||||||
SizedBox(height: 8),
|
if (noContent == 1) SizedBox(height: noContent == 0 ? 0 : 8),
|
||||||
|
if (noContent == 1)
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: EdgeInsets.all(12),
|
padding: EdgeInsets.all(12),
|
||||||
@ -422,7 +453,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
|
|||||||
),
|
),
|
||||||
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) {
|
Widget _getStepContentFromApi(Map<String, dynamic> data) {
|
||||||
List<Widget> rows = [];
|
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) {
|
data.forEach((key, value) {
|
||||||
// Skip metadata fields
|
// Skip metadata
|
||||||
if (key == 'modified_by' || key == 'modified_at') return;
|
if (key == 'modified_by' || key == 'modified_at') return;
|
||||||
|
|
||||||
String displayName = value['display_name'] ?? key;
|
if (value is Map<String, dynamic>) {
|
||||||
String displayValue = value['display_value'] ?? 'N/A';
|
final displayName = value['display_name'];
|
||||||
|
final displayValue = value['display_value'];
|
||||||
|
|
||||||
|
if (displayName != null && displayValue != null) {
|
||||||
|
print("✅ displayName - $displayName, displayValue - $displayValue");
|
||||||
rows.add(_buildHistoryListData(displayName, displayValue));
|
rows.add(_buildHistoryListData(displayName, displayValue));
|
||||||
rows.add(SizedBox(height: 6));
|
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(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: rows,
|
children: rows,
|
||||||
@ -512,6 +585,7 @@ class _ClaimHistoryPopupState extends State<ClaimHistoryPopup> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildHistoryListData(String title, String value) {
|
Widget _buildHistoryListData(String title, String value) {
|
||||||
|
print("_buildHistoryListData");
|
||||||
final displayValue =
|
final displayValue =
|
||||||
(value == null || value.trim().isEmpty) ? 'N/A' : value;
|
(value == null || value.trim().isEmpty) ? 'N/A' : value;
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import file_picker
|
||||||
import firebase_auth
|
import firebase_auth
|
||||||
import firebase_core
|
import firebase_core
|
||||||
import google_sign_in_ios
|
import google_sign_in_ios
|
||||||
@ -14,6 +15,7 @@ import smart_auth
|
|||||||
import url_launcher_macos
|
import url_launcher_macos
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
|
||||||
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
|
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
|
||||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||||
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user