new firebase account

This commit is contained in:
venbaittech 2024-12-05 10:43:21 +05:30
parent 69cc7aeb06
commit 218225722a
11 changed files with 1136 additions and 804 deletions

Binary file not shown.

View File

@ -29,16 +29,13 @@ import 'models/environment.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize Firebase only if it's not already initialized
if (Firebase.apps.isEmpty) {
await Firebase.initializeApp(
options: const FirebaseOptions(
apiKey: 'AIzaSyC4yHbCX4mQu0jO81pJrDwxKLQlTQWofrc',
appId: '1:1084115316849:android:963ff492c3d23ab06c6bd0',
messagingSenderId: '1084115316849',
projectId: 'nhance-ee8d1'));
await dotenv.load(fileName: Environment.fileName);
}
await Firebase.initializeApp(
options: const FirebaseOptions(
apiKey: 'AIzaSyC4yHbCX4mQu0jO81pJrDwxKLQlTQWofrc',
appId: '1:1084115316849:android:963ff492c3d23ab06c6bd0',
messagingSenderId: '1084115316849',
projectId: 'nhance-ee8d1'));
await dotenv.load(fileName: Environment.fileName);
// Load environment variables
await dotenv.load(fileName: Environment.fileName);

File diff suppressed because it is too large Load Diff

View File

@ -28,10 +28,12 @@ class _empReviewDetailsState extends State<empReviewDetails> {
late ApiService apiService;
bool isLoading = true;
bool isChecked = false; // Declare the _isSwitched variable here
bool disclaimeStatus = false; // Declare the _isSwitched variable here
bool topUpSiIsChecked = false; // Declare the _isSwitched variable here
bool topUpParentIsChecked = false; // Declare the _isSwitched variable here
bool addOnsDependentIsChecked =
false; // Declare the _isSwitched variable here
dynamic _token;
dynamic empCodeString;
dynamic empPrimaryId;
@ -50,6 +52,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
dynamic gpaSelfDetails;
dynamic gpaECardDownload;
dynamic gmcECardDownload;
dynamic gmcDisclaimer;
dynamic gmcClintPolicyId = 0;
dynamic gmcMappedFamilyFloaters = [];
dynamic gmcSelfName;
@ -137,6 +140,9 @@ class _empReviewDetailsState extends State<empReviewDetails> {
dynamic topUpParentOpenForEnrollment;
dynamic addOnsDependentOpenForEnrollment;
bool gmcEnrollmentStatus = false;
List<Map<String, dynamic>> allDisclaimer =
[]; // Declare this to store all disclaimers
late List<bool> checkboxValues;
@override
void initState() {
@ -148,6 +154,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
isLoading = false;
});
});
checkboxValues = List<bool>.filled(allDisclaimer.length, false);
}
@override
@ -322,6 +329,48 @@ class _empReviewDetailsState extends State<empReviewDetails> {
setState(() {
gpaPolicies = response['data'];
print('gpaPolicies');
for (var item in gpaPolicies) {
// Extract disclaimer value from each object
dynamic disclaimer = item['disclaimer'];
if (disclaimer != null && disclaimer.isNotEmpty) {
// Temporary list to hold new entries
List<Map<String, dynamic>> newEntries = [];
if (disclaimer is String) {
// Wrap string in a map with id and checked
newEntries.add({
'id': allDisclaimer.length + 1, // Unique ID based on length
'text': disclaimer,
'checked': false,
});
} else if (disclaimer is List) {
// Convert each string in the list to a map with id and checked
newEntries.addAll(
List<Map<String, dynamic>>.from(
disclaimer.map((text) => {
'id': allDisclaimer.length + newEntries.length + 1,
'text': text,
'checked': false,
}),
),
);
} else {
print('Unexpected type for disclaimer');
}
// Add new entries to the main list, ensuring no duplicate texts
newEntries.forEach((entry) {
if (!allDisclaimer
.any((item) => item['text'] == entry['text'])) {
allDisclaimer.add(entry);
}
});
// Update the state
setState(() {});
}
}
});
} else {
setState(() {
@ -350,6 +399,48 @@ class _empReviewDetailsState extends State<empReviewDetails> {
setState(() {
gmcPolicies = response['data'];
print('gmcPolicies');
for (var item in gmcPolicies) {
// Extract disclaimer value from each object
dynamic disclaimer = item['disclaimer'];
if (disclaimer != null && disclaimer.isNotEmpty) {
// Temporary list to hold new entries
List<Map<String, dynamic>> newEntries = [];
if (disclaimer is String) {
// Wrap string in a map with id and checked
newEntries.add({
'id': allDisclaimer.length + 1, // Unique ID based on length
'text': disclaimer,
'checked': false,
});
} else if (disclaimer is List) {
// Convert each string in the list to a map with id and checked
newEntries.addAll(
List<Map<String, dynamic>>.from(
disclaimer.map((text) => {
'id': allDisclaimer.length + newEntries.length + 1,
'text': text,
'checked': false,
}),
),
);
} else {
print('Unexpected type for disclaimer');
}
// Add new entries to the main list, ensuring no duplicate texts
newEntries.forEach((entry) {
if (!allDisclaimer
.any((item) => item['text'] == entry['text'])) {
allDisclaimer.add(entry);
}
});
// Update the state
setState(() {});
}
}
});
// Assuming data is a List
print(gmcPolicies);
@ -417,6 +508,45 @@ class _empReviewDetailsState extends State<empReviewDetails> {
topUpDisclaimer =
await topUpSiPolicies['gmc_si_topup']['disclaimer'];
if (topUpDisclaimer != null && topUpDisclaimer.isNotEmpty) {
// Temporary list to hold new entries
List<Map<String, dynamic>> newEntries = [];
if (topUpDisclaimer is String) {
// Wrap string in a map with id and checked
newEntries.add({
'id': allDisclaimer.length + 1, // Unique ID based on length
'text': topUpDisclaimer,
'checked': false,
});
} else if (topUpDisclaimer is List) {
// Convert each string in the list to a map with id and checked
newEntries.addAll(
List<Map<String, dynamic>>.from(
topUpDisclaimer.map((text) => {
'id': allDisclaimer.length + newEntries.length + 1,
'text': text,
'checked': false,
}),
),
);
} else {
print('Unexpected type for disclaimer');
}
// Add new entries to the main list, ensuring no duplicate texts
newEntries.forEach((entry) {
if (!allDisclaimer
.any((item) => item['text'] == entry['text'])) {
allDisclaimer.add(entry);
}
});
// Update the state
setState(() {});
}
// allDisclaimer = allDisclaimer.toSet().toList();
// });
} else {
print('No data found in the response');
@ -514,6 +644,45 @@ class _empReviewDetailsState extends State<empReviewDetails> {
topUpParentDisclaimer =
await topUpSiParentPolicies['gmc_si_parent_topup']
['disclaimer'];
if (topUpParentDisclaimer != null &&
topUpParentDisclaimer.isNotEmpty) {
// Temporary list to hold new entries
List<Map<String, dynamic>> newEntries = [];
if (topUpParentDisclaimer is String) {
// Wrap string in a map with id and checked
newEntries.add({
'id': allDisclaimer.length + 1, // Unique ID based on length
'text': topUpParentDisclaimer,
'checked': false,
});
} else if (topUpParentDisclaimer is List) {
// Convert each string in the list to a map with id and checked
newEntries.addAll(
List<Map<String, dynamic>>.from(
topUpParentDisclaimer.map((text) => {
'id': allDisclaimer.length + newEntries.length + 1,
'text': text,
'checked': false,
}),
),
);
} else {
print('Unexpected type for disclaimer');
}
// Add new entries to the main list, ensuring no duplicate texts
newEntries.forEach((entry) {
if (!allDisclaimer
.any((item) => item['text'] == entry['text'])) {
allDisclaimer.add(entry);
}
});
// Update the state
setState(() {});
}
} else {
print('No data found in the response');
}
@ -587,6 +756,45 @@ class _empReviewDetailsState extends State<empReviewDetails> {
await addOnsDependentPolicies['gmc_dependent_addon']
['disclaimer'];
if (addOnsDependentDisclaimer != null &&
addOnsDependentDisclaimer.isNotEmpty) {
// Temporary list to hold new entries
List<Map<String, dynamic>> newEntries = [];
if (addOnsDependentDisclaimer is String) {
// Wrap string in a map with id and checked
newEntries.add({
'id': allDisclaimer.length + 1, // Unique ID based on length
'text': addOnsDependentDisclaimer,
'checked': false,
});
} else if (addOnsDependentDisclaimer is List) {
// Convert each string in the list to a map with id and checked
newEntries.addAll(
List<Map<String, dynamic>>.from(
addOnsDependentDisclaimer.map((text) => {
'id': allDisclaimer.length + newEntries.length + 1,
'text': text,
'checked': false,
}),
),
);
} else {
print('Unexpected type for disclaimer');
}
// Add new entries to the main list, ensuring no duplicate texts
newEntries.forEach((entry) {
if (!allDisclaimer
.any((item) => item['text'] == entry['text'])) {
allDisclaimer.add(entry);
}
});
// Update the state
setState(() {});
}
addOnsDependentOpenForEnrollment =
await addOnsDependentPolicies['gmc_dependent_addon']
['OpenForEnrollment'];
@ -795,28 +1003,25 @@ class _empReviewDetailsState extends State<empReviewDetails> {
}
bool isSubmitEnabled() {
print(
'topUpOpenForEnrollment: $topUpOpenForEnrollment (type: ${topUpOpenForEnrollment?.runtimeType})');
print(
'topUpParentOpenForEnrollment: $topUpParentOpenForEnrollment (type: ${topUpParentOpenForEnrollment?.runtimeType})');
print(
'addOnsDependentOpenForEnrollment: $addOnsDependentOpenForEnrollment (type: ${addOnsDependentOpenForEnrollment?.runtimeType})');
// // Convert to integers and handle null values by defaulting to 0
// bool enrollmentConditionsMet =
// (int.tryParse(topUpOpenForEnrollment ?? '0') != 0) &&
// (int.tryParse(topUpParentOpenForEnrollment ?? '0') != 0) &&
// (int.tryParse(addOnsDependentOpenForEnrollment ?? '0') != 0);
//
// print('enrollmentConditionsMet: $enrollmentConditionsMet');
// print('gmcEnrollmentStatus: $gmcEnrollmentStatus');
// Convert to integers and handle null values by defaulting to 0
bool enrollmentConditionsMet =
(int.tryParse(topUpOpenForEnrollment ?? '0') != 0) &&
(int.tryParse(topUpParentOpenForEnrollment ?? '0') != 0) &&
(int.tryParse(addOnsDependentOpenForEnrollment ?? '0') != 0);
// return isChecked &&
// enrollmentConditionsMet &&
// gmcEnrollmentStatus &&
// (activeSiData == 1 ? topUpSiIsChecked : true) &&
// (activeSiParentData == 1 ? topUpParentIsChecked : true) &&
// (activeDependentData == 1 ? addOnsDependentIsChecked : true);
disclaimeStatus = allDisclaimer.every((item) => item['checked'] == true);
print('enrollmentConditionsMet: $enrollmentConditionsMet');
print('gmcEnrollmentStatus: $gmcEnrollmentStatus');
return isChecked &&
enrollmentConditionsMet &&
gmcEnrollmentStatus &&
(activeSiData == 1 ? topUpSiIsChecked : true) &&
(activeSiParentData == 1 ? topUpParentIsChecked : true) &&
(activeDependentData == 1 ? addOnsDependentIsChecked : true);
// Combine the `disclaimeStatus` and `isChecked` conditions
return isChecked && disclaimeStatus;
}
bool isEnrollmentOpen(List<dynamic>? policyList) {
@ -2212,7 +2417,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
Expanded(
flex: 11,
child: Container(
alignment: Alignment.centerRight,
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
@ -2239,168 +2444,53 @@ class _empReviewDetailsState extends State<empReviewDetails> {
],
),
),
SizedBox(height: 15),
if (activeSiData == 1)
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Checkbox(
value: topUpSiIsChecked,
onChanged: (bool? value) {
setState(() {
topUpSiIsChecked = value!;
});
},
activeColor:
Color(0xFFE26728),
),
],
))),
Expanded(
flex: 11,
child: Container(
alignment: Alignment.centerRight,
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
topUpDisclaimer ?? '',
textAlign:
Responsive.isDesktop(
context)
? TextAlign.left
: TextAlign.start,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 15,
color: Color(0xFF292929),
),
),
],
))),
],
),
),
SizedBox(height: 15),
if (activeSiParentData == 1)
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Checkbox(
value: topUpParentIsChecked,
onChanged: (bool? value) {
setState(() {
topUpParentIsChecked =
value!;
});
},
activeColor:
Color(0xFFE26728),
),
],
))),
Expanded(
flex: 11,
child: Container(
alignment: Alignment.centerRight,
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
topUpParentDisclaimer ?? '',
textAlign:
Responsive.isDesktop(
context)
? TextAlign.left
: TextAlign.start,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 15,
color: Color(0xFF292929),
),
),
],
))),
],
),
),
SizedBox(height: 15),
if (activeDependentData == 1)
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Checkbox(
SizedBox(height: 10),
Container(
// padding: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: allDisclaimer.isEmpty
? [] // If allDisclaimer is empty, show nothing
: allDisclaimer.map<Widget>((entry) {
int id =
entry['id']; // ID of disclaimer
String disclaimer =
entry['text']; // Disclaimer text
bool isChecked =
entry['checked']; // Checked state
return Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Container(
alignment: Alignment.centerLeft,
child: Checkbox(
value:
addOnsDependentIsChecked,
isChecked, // Bind to the checked value
onChanged: (bool? value) {
setState(() {
addOnsDependentIsChecked =
value!;
// Update the checked status
allDisclaimer.firstWhere(
(item) =>
item['id'] == id,
)['checked'] = value!;
print(allDisclaimer);
});
},
activeColor:
Color(0xFFE26728),
activeColor: Color(
0xFFE26728), // Custom color
),
],
))),
Expanded(
flex: 11,
child: Container(
alignment: Alignment.centerRight,
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
addOnsDependentDisclaimer ??
'',
),
),
Expanded(
flex: 11,
child: Container(
alignment: Alignment.centerLeft,
child: Text(
disclaimer,
textAlign:
Responsive.isDesktop(
context)
@ -2415,11 +2505,13 @@ class _empReviewDetailsState extends State<empReviewDetails> {
color: Color(0xFF292929),
),
),
],
))),
],
),
),
),
],
);
}).toList(),
),
),
SizedBox(
height: Responsive.isDesktop(context) ? 15 : 0),
Container(
@ -2585,6 +2677,11 @@ class _empReviewDetailsState extends State<empReviewDetails> {
String? gpaPolicyType = item['type'];
String? gpaECardDownload = item['eCardDownload'];
String? gpaSumInsured;
print('GPA Disclaimer $allDisclaimer');
setState(() {
checkboxValues = List.generate(allDisclaimer.length, (_) => false);
});
List<dynamic> gpaMappedFamilyFloaters = [];
if (item['mapped_family_floaters'] != null) {
@ -2777,6 +2874,8 @@ class _empReviewDetailsState extends State<empReviewDetails> {
gmcECardDownload = item['eCardDownload'];
// gmcSumInsured = item['Policy_Terms']['sum_insured'];
gmcMappedFamilyFloaters = item['mapped_family_floaters'];
// allDisclaimer = allDisclaimer.toSet().toList();
print('GPA Disclaimer $allDisclaimer');
dynamic getTrueObjects = gmcMappedFamilyFloaters
.where((element) => element['is_value_exist'] == true)
.toList();

View File

@ -6,13 +6,9 @@
#include "generated_plugin_registrant.h"
#include <smart_auth/smart_auth_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) smart_auth_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SmartAuthPlugin");
smart_auth_plugin_register_with_registrar(smart_auth_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

View File

@ -3,7 +3,6 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
smart_auth
url_launcher_linux
)

View File

@ -12,8 +12,7 @@ import google_sign_in_ios
import local_auth_darwin
import path_provider_foundation
import shared_preferences_foundation
import smart_auth
import sqflite
import sqflite_darwin
import url_launcher_macos
import video_player_avfoundation
@ -25,7 +24,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLALocalAuthPlugin.register(with: registry.registrar(forPlugin: "FLALocalAuthPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SmartAuthPlugin.register(with: registry.registrar(forPlugin: "SmartAuthPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))

View File

@ -36,7 +36,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
animated_bottom_navigation_bar: ^1.3.3
pinput: ^4.0.0
pinput: ^5.0.0
http: ^1.2.1
shared_preferences: ^2.2.3
flutter_dotenv: ^5.1.0
@ -65,7 +65,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^3.0.0
flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

View File

@ -59,14 +59,13 @@
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.12.4/firebase-app.js";
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyDg6lonV9STSIwJ4x261tcTGALEhX98LqY",
authDomain: "nhance-app-4fedb.firebaseapp.com",
projectId: "nhance-app-4fedb",
storageBucket: "nhance-app-4fedb.appspot.com",
messagingSenderId: "508866094093",
appId: "1:508866094093:web:82f8ad47ccb63688366144"
apiKey: "AIzaSyCnxkfRZW6EkON2laovunzYRXgHvHEPo0E",
authDomain: "nhance-ee8d1.firebaseapp.com",
projectId: "nhance-ee8d1",
storageBucket: "nhance-ee8d1.firebasestorage.app",
messagingSenderId: "1084115316849",
appId: "1:1084115316849:web:8fc3b1c886349ae86c6bd0"
};
// Initialize Firebase

View File

@ -9,7 +9,6 @@
#include <firebase_auth/firebase_auth_plugin_c_api.h>
#include <firebase_core/firebase_core_plugin_c_api.h>
#include <local_auth_windows/local_auth_plugin.h>
#include <smart_auth/smart_auth_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
@ -19,8 +18,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
LocalAuthPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("LocalAuthPlugin"));
SmartAuthPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SmartAuthPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}

View File

@ -6,7 +6,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
firebase_auth
firebase_core
local_auth_windows
smart_auth
url_launcher_windows
)