diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index dd71b39..7fec512 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_app_check","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_app_check-0.4.0+1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.0.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.1.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_secure_storage","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/home/venba/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_ios-6.1.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_darwin","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_darwin-1.6.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_ios-1.0.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_ios-6.3.4/","native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"firebase_app_check","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_app_check-0.4.0+1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.0.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.1.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_plugin_android_lifecycle","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.30/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/home/venba/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_android","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_android-7.0.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_android","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_android-1.0.52/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"open_file_android","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_android-1.0.6/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_android-2.2.18/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.12/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_android","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_app_check","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_app_check-0.4.0+1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.0.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.1.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_secure_storage_macos","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_ios-6.1.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_darwin","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_darwin-1.6.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_mac","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_mac-1.0.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_macos","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_macos-3.2.3/","native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_linux-0.0.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"path_provider_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false},{"name":"url_launcher_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.1/","native_build":true,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.0.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.1.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_windows-1.0.11/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_windows-0.0.3/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false},{"name":"url_launcher_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.4/","native_build":true,"dependencies":[],"dev_dependency":false}],"web":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","dependencies":[],"dev_dependency":false},{"name":"firebase_app_check_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_app_check_web-0.2.0+16/","dependencies":["firebase_core_web"],"dev_dependency":false},{"name":"firebase_auth_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth_web-6.0.2/","dependencies":["firebase_core_web"],"dev_dependency":false},{"name":"firebase_core_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core_web-3.1.0/","dependencies":[],"dev_dependency":false},{"name":"firebase_messaging_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging_web-4.0.1/","dependencies":["firebase_core_web"],"dev_dependency":false},{"name":"flutter_secure_storage_web","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/","dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/home/venba/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","dependencies":[],"dev_dependency":false},{"name":"google_sign_in_web","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_web-1.0.0/","dependencies":[],"dev_dependency":false},{"name":"open_file_web","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_web-0.0.4/","dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","dependencies":[],"dev_dependency":false},{"name":"shared_preferences_web","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.3/","dependencies":[],"dev_dependency":false},{"name":"url_launcher_web","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_web-2.4.1/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]},{"name":"file_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"firebase_app_check","dependencies":["firebase_app_check_web","firebase_core"]},{"name":"firebase_app_check_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_auth","dependencies":["firebase_auth_web","firebase_core"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_messaging","dependencies":["firebase_core","firebase_messaging_web"]},{"name":"firebase_messaging_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"fluttertoast","dependencies":[]},{"name":"google_sign_in","dependencies":["google_sign_in_android","google_sign_in_ios","google_sign_in_web"]},{"name":"google_sign_in_android","dependencies":[]},{"name":"google_sign_in_ios","dependencies":[]},{"name":"google_sign_in_web","dependencies":[]},{"name":"local_auth","dependencies":["local_auth_android","local_auth_darwin","local_auth_windows"]},{"name":"local_auth_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"local_auth_darwin","dependencies":[]},{"name":"local_auth_windows","dependencies":[]},{"name":"open_file","dependencies":["open_file_android","open_file_web","open_file_ios","open_file_mac","open_file_windows","open_file_linux"]},{"name":"open_file_android","dependencies":[]},{"name":"open_file_ios","dependencies":[]},{"name":"open_file_linux","dependencies":[]},{"name":"open_file_mac","dependencies":[]},{"name":"open_file_web","dependencies":[]},{"name":"open_file_windows","dependencies":[]},{"name":"package_info_plus","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2025-12-01 14:39:08.957318","version":"3.32.1","swift_package_manager_enabled":{"ios":false,"macos":false}} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_app_check","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_app_check-0.4.0+1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.0.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.1.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_secure_storage","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/home/venba/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_ios-6.1.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_darwin","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_darwin-1.6.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_ios-1.0.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_ios-6.3.4/","native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"firebase_app_check","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_app_check-0.4.0+1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.0.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.1.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_plugin_android_lifecycle","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.30/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/home/venba/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_android","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_android-7.0.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_android","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_android-1.0.52/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"open_file_android","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_android-1.0.6/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_android-2.2.18/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.12/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_android","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_app_check","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_app_check-0.4.0+1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.0.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.1.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.1/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_secure_storage_macos","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_ios-6.1.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_darwin","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_darwin-1.6.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_mac","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_mac-1.0.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_macos","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_macos-3.2.3/","native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_linux-0.0.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"path_provider_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false},{"name":"url_launcher_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.1/","native_build":true,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.0.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.1.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_windows-1.0.11/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_windows-0.0.3/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false},{"name":"url_launcher_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.4/","native_build":true,"dependencies":[],"dev_dependency":false}],"web":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.3/","dependencies":[],"dev_dependency":false},{"name":"firebase_app_check_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_app_check_web-0.2.0+16/","dependencies":["firebase_core_web"],"dev_dependency":false},{"name":"firebase_auth_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth_web-6.0.2/","dependencies":["firebase_core_web"],"dev_dependency":false},{"name":"firebase_core_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core_web-3.1.0/","dependencies":[],"dev_dependency":false},{"name":"firebase_messaging_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging_web-4.0.1/","dependencies":["firebase_core_web"],"dev_dependency":false},{"name":"flutter_secure_storage_web","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/","dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/home/venba/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","dependencies":[],"dev_dependency":false},{"name":"google_sign_in_web","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_web-1.0.0/","dependencies":[],"dev_dependency":false},{"name":"open_file_web","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_web-0.0.4/","dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","dependencies":[],"dev_dependency":false},{"name":"shared_preferences_web","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.3/","dependencies":[],"dev_dependency":false},{"name":"url_launcher_web","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_web-2.4.1/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]},{"name":"file_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"firebase_app_check","dependencies":["firebase_app_check_web","firebase_core"]},{"name":"firebase_app_check_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_auth","dependencies":["firebase_auth_web","firebase_core"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_messaging","dependencies":["firebase_core","firebase_messaging_web"]},{"name":"firebase_messaging_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"fluttertoast","dependencies":[]},{"name":"google_sign_in","dependencies":["google_sign_in_android","google_sign_in_ios","google_sign_in_web"]},{"name":"google_sign_in_android","dependencies":[]},{"name":"google_sign_in_ios","dependencies":[]},{"name":"google_sign_in_web","dependencies":[]},{"name":"local_auth","dependencies":["local_auth_android","local_auth_darwin","local_auth_windows"]},{"name":"local_auth_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"local_auth_darwin","dependencies":[]},{"name":"local_auth_windows","dependencies":[]},{"name":"open_file","dependencies":["open_file_android","open_file_web","open_file_ios","open_file_mac","open_file_windows","open_file_linux"]},{"name":"open_file_android","dependencies":[]},{"name":"open_file_ios","dependencies":[]},{"name":"open_file_linux","dependencies":[]},{"name":"open_file_mac","dependencies":[]},{"name":"open_file_web","dependencies":[]},{"name":"open_file_windows","dependencies":[]},{"name":"package_info_plus","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2025-12-03 11:51:56.891228","version":"3.32.1","swift_package_manager_enabled":{"ios":false,"macos":false}} \ No newline at end of file diff --git a/lib/core/services/api_service.dart b/lib/core/services/api_service.dart index d67100d..bd531fc 100644 --- a/lib/core/services/api_service.dart +++ b/lib/core/services/api_service.dart @@ -666,6 +666,7 @@ class ApiService { String? selectedStatus, String? selectedStaffId, }) async { + print("selectedStatusselectedStatus - $selectedStatus"); if (_token == null) { await _initializeToken(); } @@ -692,11 +693,13 @@ class ApiService { if (role == 'staff') { url = Uri.parse( - '${Env.apiUrl}enquiry/enquiryList?$query&from_date=${fromDate ?? ''}&to_date=${toDate ?? ''}&status=$selectedStatus', + '${Env.apiUrl}enquiry/enquiryList?$query&from_date=${fromDate ?? ''}&to_date=${toDate ?? ''}&enquiry_status=$selectedStatus', + // '${Env.apiUrl}enquiry/enquiryList?$query&from_date=${fromDate ?? ''}&to_date=${toDate ?? ''}&status=$selectedStatus', ); } else { url = Uri.parse( - '${Env.apiUrl}enquiry/enquiryList?$query&from_date=${fromDate ?? ''}&to_date=${toDate ?? ''}&status=$selectedStatus&staff_id=$selectedStaffId', + '${Env.apiUrl}enquiry/enquiryList?$query&from_date=${fromDate ?? ''}&to_date=${toDate ?? ''}&enquiry_status=$selectedStatus&staff_id=$selectedStaffId', + // '${Env.apiUrl}enquiry/enquiryList?$query&from_date=${fromDate ?? ''}&to_date=${toDate ?? ''}&status=$selectedStatus&staff_id=$selectedStaffId', ); } @@ -932,7 +935,7 @@ class ApiService { } Future> fetchPolicyDataOnlyList( - int id, + dynamic id, role, { String? fromDate, String? toDate, diff --git a/lib/presentation/layouts/appheader.dart b/lib/presentation/layouts/appheader.dart index 0f81416..34a0a3b 100644 --- a/lib/presentation/layouts/appheader.dart +++ b/lib/presentation/layouts/appheader.dart @@ -376,11 +376,7 @@ class _AppHeaderState extends ConsumerState { ), child: IconButton( padding: EdgeInsets.zero, - icon: const Icon( - Icons.request_quote_outlined, - color: Colors.black87, - size: 20, - ), + icon: const Icon(Icons.quora, color: Colors.black87, size: 20), onPressed: () { SideDrawerPanel.show( context: context, diff --git a/lib/presentation/screens/Enquiry/enquiry/policy_popup.dart b/lib/presentation/screens/Enquiry/enquiry/policy_popup.dart index 67b4f4b..3e90f7e 100644 --- a/lib/presentation/screens/Enquiry/enquiry/policy_popup.dart +++ b/lib/presentation/screens/Enquiry/enquiry/policy_popup.dart @@ -5,6 +5,7 @@ import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:http/http.dart' as http; +import 'package:http/http.dart' as ref; import 'package:toastification/toastification.dart'; import '../../../../core/config/env.dart'; @@ -15,12 +16,15 @@ import '../../../../data/utils/validators.dart'; import '../../../layouts/responsive_layout.dart'; import '../../../themes/indicators/customizd_file_upload.dart'; import '../../../themes/indicators/input_field_decoration.dart'; +import '../../../themes/indicators/search_field_theme.dart'; import '../../../themes/indicators/text_field_theme.dart'; // 🔹 Custom Dialog Widget class AddDialog extends StatefulWidget { final String title; final dynamic userId; + final dynamic managerId; + final dynamic role; final void Function(String value) onSubmit; final dynamic policyNumber; const AddDialog({ @@ -28,6 +32,8 @@ class AddDialog extends StatefulWidget { required this.title, required this.onSubmit, required this.userId, + required this.managerId, + required this.role, this.policyNumber, }); @@ -63,6 +69,8 @@ class _AddDialogState extends State { List tabHeader = ['policyNum', 'claimsDesc', 'remarks']; + final TextEditingController _searchStaffController = TextEditingController(); + List> getClaimsTypeData = []; List> filteredClaimsData = []; @@ -72,6 +80,12 @@ class _AddDialogState extends State { String? selectedClaimsType; String? selectedEndorsement; + dynamic roleId; + + List> getPolicyData = []; + List> originalData = []; + List> filteredData = []; + Map claimsDetails() { final data = { "policy_number": controllers["policyNum"]?.text, @@ -103,12 +117,108 @@ class _AddDialogState extends State { } controllers["policyNum"]?.text = widget.policyNumber; + print('userIFF - ${widget.userId}'); + print('roleIFF - ${widget.role}'); + + Future.microtask(() { + // final id = ref.read(managerIdProvider); + // roleId = ref.read(userRoleProvider); + // userId = ref.read(userIdProvider); + + if (widget.userId != null && widget.managerId != null) { + getStaffList(widget.managerId, widget.userId); + } + }); + // 🔹 Init logic here (API calls, token fetch, etc.) _initializeToken(); getClaimsType(); getEnroementType(); } + Future getStaffList( + dynamic managerId, + role, { + String fromDate = '', + String toDate = '', + }) async { + print('D68 => Fns called => $managerId | $role'); + setState(() { + isLoading = true; + }); + + final id = int.parse(managerId); + // FORCE BOTH VALUES TO STRING + final String managerIdStr = managerId?.toString() ?? ''; + final String roleStr = role?.toString() ?? ''; + + try { + final response = await apiService.fetchPolicyDataOnlyList( + managerIdStr, + roleStr, + fromDate: controllers['startDate']?.text ?? '', + toDate: controllers['endDate']?.text ?? '', + selectedStaffId: widget.userId ?? '', + ); + + if (response['status'] == 'success') { + final data = response['data']; + print('D81 => getStaffListData => ${response['data']}'); + + final fromDate = response['from_date'] ?? ''; + final toDate = response['to_date'] ?? ''; + + print('FromDate : $fromDate'); + print('ToDate : $toDate'); + setState(() { + controllers['startDate']?.text = fromDate; + controllers['endDate']?.text = toDate; + if (data is List) { + // Already a list of maps + getPolicyData = List>.from(data); + } else if (data is Map) { + // Single object, wrap in a list + getPolicyData = [Map.from(data)]; + } else { + getPolicyData = []; + } + // getStaffData = List>.from(response['data']); + originalData = getPolicyData; + filteredData = List.from(originalData); + // print('originalData - $getClaimPolicies'); + }); + } else { + getPolicyData = []; + originalData = []; + } + } catch (e) { + print('Exception occurred: $e'); + } finally { + setState(() { + isLoading = false; + }); + } + } + + void filterData(String query) { + print("FilterDAta - $query"); + setState(() { + filteredData = getPolicyData.where((item) { + // final isActiveStatus = item['is_active'] == "1" ? "active" : "inactive"; + + return (item['agent_name'] ?? '-').toLowerCase().contains( + query.toLowerCase(), + ) || + (item['reg_no'] ?? '-').toLowerCase().contains( + query.toLowerCase(), + ) || + (item['insurer_name'] ?? '-').toLowerCase().contains( + query.toLowerCase(), + ); + }).toList(); + }); + } + Future _initializeToken() async { _token = await AuthService.getToken(); print("APISERTOKEN - $_token"); @@ -362,6 +472,18 @@ class _AddDialogState extends State { ], ), + const SizedBox(height: 16), + ThemedSearchField( + hintText: 'Search', + // backgroundColor: Color(0xFFF6F8F8), + backgroundColor: Color(0xFFFFFFFF), + txtHeight: 30, + onChanged: filterData, + controller: _searchStaffController, + txtwidth: ResponsiveLayout.isMobile(context) + ? MediaQuery.of(context).size.width * 0.7 + : MediaQuery.of(context).size.width * 0.15, + ), const SizedBox(height: 16), // 🔹 Switch content dynamically diff --git a/lib/presentation/screens/Enquiry/enquiry/policy_tab.dart b/lib/presentation/screens/Enquiry/enquiry/policy_tab.dart index ae3f68a..1a96b6b 100644 --- a/lib/presentation/screens/Enquiry/enquiry/policy_tab.dart +++ b/lib/presentation/screens/Enquiry/enquiry/policy_tab.dart @@ -578,6 +578,8 @@ class PolicyTabState extends ConsumerState { context: context, builder: (ctx) => AddDialog( userId: userId, + role: null, + managerId: null, title: "Endorsement", policyNumber: selectedPolicyNumber, onSubmit: (value) { @@ -604,6 +606,8 @@ class PolicyTabState extends ConsumerState { builder: (ctx) => AddDialog( userId: userId, title: "Claims", + role: null, + managerId: null, policyNumber: selectedPolicyNumber, onSubmit: (value) { debugPrint("New Claim: $value"); diff --git a/lib/presentation/screens/Enquiry/policy_claims_endros/claims.dart b/lib/presentation/screens/Enquiry/policy_claims_endros/claims.dart index 9a5b060..c531607 100644 --- a/lib/presentation/screens/Enquiry/policy_claims_endros/claims.dart +++ b/lib/presentation/screens/Enquiry/policy_claims_endros/claims.dart @@ -14,6 +14,7 @@ import '../../../providers/manager_provider.dart'; import '../../../themes/indicators/export_btn.dart'; import '../../../themes/indicators/search_field_theme.dart'; import '../../../widgets/custom_action_popup.dart'; +import '../enquiry/policy_popup.dart'; class claimList extends ConsumerStatefulWidget { const claimList({super.key}); @@ -34,6 +35,10 @@ class claimListState extends ConsumerState { final TextEditingController _searchStaffController = TextEditingController(); + dynamic userId; + dynamic roleId; + dynamic managerId; + @override void initState() { super.initState(); @@ -42,11 +47,15 @@ class claimListState extends ConsumerState { Future.microtask(() { final id = ref.read(managerIdProvider); - final roleId = ref.read(userRoleProvider); - final userId = ref.read(userIdProvider); + managerId = ref.read(managerIdProvider); + + // roleId = ref.read(userRoleProvider); + // roleId = ref.read(userRoleProvider); + + userId = ref.read(userIdProvider); print("G47 => r : $roleId | mId: $id | uId: $userId "); if (userId != null) { - getStaffList(userId, roleId); + getStaffList(id!, userId); } }); } @@ -284,6 +293,48 @@ class claimListState extends ConsumerState { 'claim_status_value', ], ), + SizedBox(width: 10), + InkWell( + onTap: () { + showDialog( + context: context, + builder: (ctx) => AddDialog( + managerId: managerId, + userId: userId, + role: roleId, + title: "Claims", + policyNumber: 'POC_n1', + // policyNumber: selectedPolicyNumber, + onSubmit: (value) { + debugPrint("New Claims: $value"); + // enrollKey.currentState?.getEndrosmentList(selectedPolicyNumber); + + // Update claim list or call API + }, + ), + ); + }, + child: Container( + padding: EdgeInsets.all(4.8), + decoration: BoxDecoration( + color: const Color(0xFF2E7D6E), + borderRadius: BorderRadius.circular(8.0), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Tooltip( + message: 'Create Claims', + child: Icon( + Icons.add, + color: Colors.white, + size: 18, + ), + ), + ], + ), + ), + ), // SizedBox(width: 10), // GestureDetector( diff --git a/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart b/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart index ac8303c..1dbef2a 100644 --- a/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart +++ b/lib/presentation/screens/Enquiry/policy_claims_endros/endrosment.dart @@ -14,6 +14,7 @@ import '../../../providers/manager_provider.dart'; import '../../../themes/indicators/export_btn.dart'; import '../../../themes/indicators/search_field_theme.dart'; import '../../../widgets/custom_action_popup.dart'; +import '../enquiry/policy_popup.dart'; class endosement extends ConsumerStatefulWidget { const endosement({super.key}); @@ -31,6 +32,9 @@ class endosementState extends ConsumerState { List> originalData = []; List> filteredData = []; bool isLoading = false; + dynamic userId; + dynamic roleId; + dynamic managerId; @override void initState() { @@ -40,8 +44,9 @@ class endosementState extends ConsumerState { Future.microtask(() { final id = ref.read(managerIdProvider); - final roleId = ref.read(userRoleProvider); - final userId = ref.read(userIdProvider); + managerId = ref.read(managerIdProvider); + roleId = ref.read(userRoleProvider); + userId = ref.read(userIdProvider); print("F46 => r : $roleId | mId: $id | uId: $userId "); if (userId != null) { getStaffList(userId, roleId); @@ -278,7 +283,48 @@ class endosementState extends ConsumerState { "endorsement_no", ], ), + SizedBox(width: 10), + InkWell( + onTap: () { + showDialog( + context: context, + builder: (ctx) => AddDialog( + managerId: managerId, + userId: userId, + role: roleId, + title: "Endorsement", + policyNumber: '1', + // policyNumber: selectedPolicyNumber, + onSubmit: (value) { + debugPrint("New Endorsement: $value"); + // enrollKey.currentState?.getEndrosmentList(selectedPolicyNumber); + // Update claim list or call API + }, + ), + ); + }, + child: Container( + padding: EdgeInsets.all(4.8), + decoration: BoxDecoration( + color: const Color(0xFF2E7D6E), + borderRadius: BorderRadius.circular(8.0), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Tooltip( + message: 'Create Claims', + child: Icon( + Icons.add, + color: Colors.white, + size: 18, + ), + ), + ], + ), + ), + ), // SizedBox(width: 10), // GestureDetector( // onTap: () { diff --git a/lib/presentation/screens/UserManagement/Agent/agent.dart b/lib/presentation/screens/UserManagement/Agent/agent.dart index 19ea301..9e94de3 100644 --- a/lib/presentation/screens/UserManagement/Agent/agent.dart +++ b/lib/presentation/screens/UserManagement/Agent/agent.dart @@ -122,6 +122,19 @@ class AgentState extends ConsumerState { Future handleSave() async { if (!_formKey.currentState!.validate()) return; + + final email = controllers['email']!.text.trim(); + final phone = controllers['mobile']!.text.trim(); + + // 🔴 Conditional validation: at least one required + if (email.isEmpty && phone.isEmpty) { + ToastHelper.showSuccessToast( + context, + 'Please enter either Email or Phone Number', + ); + return; + } + setState(() { if (_formKey.currentState!.validate()) { dataDetails(); @@ -500,7 +513,16 @@ class AgentState extends ConsumerState { SizedBox(width: 10), ThemedFormField( controller: controllers['email']!, - validator: (value) => Validators.email(value, "email"), + validator: (value) { + final phone = controllers['mobile']!.text.trim(); + + if (value!.isEmpty && phone.isNotEmpty) { + return null; // phone is given → email not required + } + + return Validators.email(value, "email"); + }, + // validator: (value) => Validators.email(value, "email"), borderColor: Color(0xFFE2E8F0), highlightColor: Color(0xFF50A398), inputFormatters: [ @@ -520,11 +542,21 @@ class AgentState extends ConsumerState { SizedBox(width: 10), ThemedFormField( controller: controllers['mobile']!, - validator: (value) => Validators.phone(value, "phNumber"), + validator: (value) { + final email = controllers['email']!.text.trim(); + + if (value!.isEmpty && email.isNotEmpty) { + return null; // email is given → phone not required + } + + return Validators.phone(value, "phNumber"); + }, + + // validator: (value) => Validators.phone(value, "phNumber"), borderColor: Color(0xFFE2E8F0), highlightColor: Color(0xFF50A398), inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[ 0-9]')), + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), ], txtwidth: MediaQuery.of(context).size.width * 0.26, ), diff --git a/lib/presentation/screens/UserManagement/Staff/staff.dart b/lib/presentation/screens/UserManagement/Staff/staff.dart index dcd298a..b7b428c 100644 --- a/lib/presentation/screens/UserManagement/Staff/staff.dart +++ b/lib/presentation/screens/UserManagement/Staff/staff.dart @@ -158,6 +158,19 @@ class StaffState extends ConsumerState { Future handleSave() async { if (!_formKey.currentState!.validate()) return; + + final email = controllers['email']!.text.trim(); + final phone = controllers['mobile']!.text.trim(); + + // 🔴 Conditional validation: at least one required + if (email.isEmpty && phone.isEmpty) { + ToastHelper.showSuccessToast( + context, + 'Please enter either Email or Phone Number', + ); + return; + } + setState(() { if (_formKey.currentState!.validate()) { dataDetails(); @@ -505,7 +518,17 @@ class StaffState extends ConsumerState { controller: controllers['email']!, borderColor: Color(0xFFE2E8F0), highlightColor: Color(0xFF50A398), - validator: (value) => Validators.email(value, "email"), + + // validator: (value) => Validators.email(value, "email"), + validator: (value) { + final phone = controllers['mobile']!.text.trim(); + + if (value!.isEmpty && phone.isNotEmpty) { + return null; // phone is given → email not required + } + + return Validators.email(value, "email"); + }, inputFormatters: [ FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9_@.]')), ], @@ -525,9 +548,20 @@ class StaffState extends ConsumerState { controller: controllers['mobile']!, borderColor: Color(0xFFE2E8F0), highlightColor: Color(0xFF50A398), - validator: (value) => Validators.phone(value, "phNumber"), + + // validator: (value) => Validators.phone(value, "phNumber"), + validator: (value) { + final email = controllers['email']!.text.trim(); + + if (value!.isEmpty && email.isNotEmpty) { + return null; // email is given → phone not required + } + + return Validators.phone(value, "phNumber"); + }, + inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[ 0-9]')), + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), ], txtwidth: MediaQuery.of(context).size.width * 0.26, ), diff --git a/lib/presentation/screens/dashboard/dashboard.dart b/lib/presentation/screens/dashboard/dashboard.dart index ab063e8..106331c 100644 --- a/lib/presentation/screens/dashboard/dashboard.dart +++ b/lib/presentation/screens/dashboard/dashboard.dart @@ -11,6 +11,7 @@ import '../../layouts/main_layout.dart'; import '../../providers/manager_provider.dart'; import '../../providers/quotation_staff_proivder.dart'; import '../../providers/userRoleProvider.dart'; +import '../../themes/charts/barChart.dart'; import '../staff/Enquiry/tabs/tab.dart'; import '../staff/assignStaff.dart'; @@ -365,41 +366,40 @@ class _DashboardScreenState extends ConsumerState { crossAxisAlignment: CrossAxisAlignment.start, children: [ // 🔹 Stats cards stacked - Padding( - padding: const EdgeInsets.all(8.0), - child: StatCard( - title: "Policies Issued", - today: policiesIssuedToday ?? '', - month: policiesIssuedMonth ?? '', - year: policiesIssuedYear ?? '', - imagePath: "assets/dashboard/Policy issue icon.png", - ), - ), - // const SizedBox(height: 12), - Padding( - padding: const EdgeInsets.all(8.0), - child: StatCard( - title: "Premium Value", - today: premiumValueToday ?? '', - month: premiumValueMonth ?? '', - year: premiumValueYear ?? '', - imagePath: "assets/dashboard/Policy issue icon.png", - ), - ), - // const SizedBox(height: 12), - Padding( - padding: const EdgeInsets.all(8.0), - child: StatCard( - title: "Earnings", - today: earningsToday ?? '', - month: earningsMonth ?? '', - year: earningsYear ?? '', - imagePath: "assets/dashboard/Policy issue icon.png", - ), - ), - - const SizedBox(height: 20), - + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: StatCard( + // title: "Policies Issued", + // today: policiesIssuedToday ?? '', + // month: policiesIssuedMonth ?? '', + // year: policiesIssuedYear ?? '', + // imagePath: "assets/dashboard/Policy issue icon.png", + // ), + // ), + // // const SizedBox(height: 12), + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: StatCard( + // title: "Premium Value", + // today: premiumValueToday ?? '', + // month: premiumValueMonth ?? '', + // year: premiumValueYear ?? '', + // imagePath: "assets/dashboard/Policy issue icon.png", + // ), + // ), + // // const SizedBox(height: 12), + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: StatCard( + // title: "Earnings", + // today: earningsToday ?? '', + // month: earningsMonth ?? '', + // year: earningsYear ?? '', + // imagePath: "assets/dashboard/Policy issue icon.png", + // ), + // ), + // + // const SizedBox(height: 20), Container( padding: const EdgeInsets.all(16.0), decoration: BoxDecoration( @@ -536,7 +536,9 @@ class _DashboardScreenState extends ConsumerState { child: Column( children: [ // if (role != 'staff') - if (role != 'staff' && role != 'handler') + if (role != 'staff' && + role != 'handler' && + role != 'manager') Row( children: [ Expanded( @@ -583,7 +585,7 @@ class _DashboardScreenState extends ConsumerState { ? MediaQuery.of(context).size.height * 0.69 //400 : (role == 'manager') - ? MediaQuery.of(context).size.height * 0.5 + ? MediaQuery.of(context).size.height * 0.85 : (role == 'staff' || role == 'handler') ? MediaQuery.of(context).size.height * 0.85 : MediaQuery.of(context).size.height * @@ -594,7 +596,7 @@ class _DashboardScreenState extends ConsumerState { Expanded( child: othersPendings( title: - "Staff Proposal Pending List (${staffQuotationsPendingList.length})", + "Staff Wise Pending(${staffQuotationsPendingList.length})", data: staffQuotationsPendingList, stringFlag: "Proposal", role: role!, @@ -736,6 +738,17 @@ class _DashboardScreenState extends ConsumerState { ), ), const SizedBox(height: 5), + + // Container( + // child: DynamicHorizontalBarChart( + // data: [ + // {"label": "Jan", "value": 30}, + // {"label": "Feb", "value": 45}, + // {"label": "Mar", "value": 20}, + // ], + // ), + // ), + const SizedBox(height: 5), if (role == 'manager') SizedBox( // ✅ replace Expanded @@ -1210,6 +1223,19 @@ class othersPendings extends StatelessWidget { Widget build(BuildContext context) { print(' Data: $data'); + // Compute totals + int totalTodayAssigned = 0; + int totalPending = 0; + int totalInProgress = 0; + int totalCompleted = 0; + + for (var row in data) { + totalTodayAssigned += int.tryParse(row['today_assigned'] ?? '0') ?? 0; + totalPending += int.tryParse(row['pending_assigned'] ?? '0') ?? 0; + totalInProgress += int.tryParse(row['total_in_progress'] ?? '0') ?? 0; + totalCompleted += int.tryParse(row['total_completed'] ?? '0') ?? 0; + } + return Card( color: Colors.white, // color: const Color(0xFFEAF6F4), @@ -1261,11 +1287,44 @@ class othersPendings extends StatelessWidget { ), ), + // Expanded( + // flex: 2, + // child: Text( + // // stringFlag + " Issued", + // 'Total Assigned', + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + // Expanded( + // flex: 2, + // child: Text( + // 'To be assigned', + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + // Expanded( + // flex: 2, + // child: Text( + // 'Total Assigned', + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), Expanded( flex: 2, child: Text( - // stringFlag + " Issued", - 'Total Assigned', + 'Today Assigned', + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + + Expanded( + flex: 2, + child: Text( + 'Pending', textAlign: TextAlign.center, style: _headerStyle, ), @@ -1273,7 +1332,7 @@ class othersPendings extends StatelessWidget { Expanded( flex: 2, child: Text( - 'Awaiting Proposal', + 'In Progress', textAlign: TextAlign.center, style: _headerStyle, ), @@ -1281,15 +1340,7 @@ class othersPendings extends StatelessWidget { Expanded( flex: 2, child: Text( - 'Awaiting Approval', - textAlign: TextAlign.center, - style: _headerStyle, - ), - ), - Expanded( - flex: 2, - child: Text( - 'Awaiting Policy', + 'Completed', textAlign: TextAlign.center, style: _headerStyle, ), @@ -1324,9 +1375,9 @@ class othersPendings extends StatelessWidget { : row['total_premium_value']; return Container( - margin: const EdgeInsets.symmetric(vertical: 5), + margin: const EdgeInsets.symmetric(vertical: 3), padding: const EdgeInsets.symmetric( - vertical: 5, + vertical: 4, horizontal: 12, ), decoration: BoxDecoration( @@ -1341,25 +1392,6 @@ class othersPendings extends StatelessWidget { ), child: Row( children: [ - // Expanded( - // flex: 1, - // child: Text( - // (index + 1).toString(), - // textAlign: TextAlign.center, - // style: _tableDataStyle, - // ), - // ), - // if (role == 'manager') ...[ - // Expanded( - // flex: 2, - // child: Text( - // row['handler_name'] ?? "", - // - // textAlign: TextAlign.center, - // style: _tableDataStyle, - // ), - // ), - // ], Expanded( flex: 2, child: Text( @@ -1372,11 +1404,60 @@ class othersPendings extends StatelessWidget { Expanded( flex: 2, - child: Text( - row['total_assigned'] ?? "", - // row['total_approval_pending'] ?? "", - textAlign: TextAlign.center, - style: _tableDataStyle, + child: Material( + color: Colors.white, + child: Center( + child: InkWell( + hoverColor: Color(0xFFEAF6F4), + onTap: () { + print( + 'total_assigned_today : ${row['total_assigned']}', + ); + + handleDashboardNavigation( + context, + status: "Assigned", + staffId: row['staff_id'] ?? '', + role: role, + ); + }, + child: Text( + row['today_assigned'] ?? "", + // row['total_approval_pending'] ?? "", + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + ), + ), + ), + Expanded( + flex: 2, + child: Material( + color: Colors.white, + child: Center( + child: InkWell( + hoverColor: Color(0xFFEAF6F4), + onTap: () { + print( + 'total_assigned : ${row['total_assigned']}', + ); + + handleDashboardNavigation( + context, + status: "Assigned", + staffId: row['staff_id'] ?? '', + role: role, + ); + }, + child: Text( + row['pending_assigned'] ?? "", + // row['total_approval_pending'] ?? "", + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + ), ), ), Expanded( @@ -1388,19 +1469,19 @@ class othersPendings extends StatelessWidget { // hoverColor: Color(0xFFEAF6F4), onTap: () { print( - 'Awaiting Proposal : ${row['awaiting_quotation']}', + 'Awaiting Proposal : ${row['total_in_progress']}', ); handleDashboardNavigation( context, - status: "Awaiting Proposal", + status: "In progress", staffId: row['staff_id'] ?? '', role: role, ); }, child: Text( - row['awaiting_quotation'] ?? "", + row['total_in_progress'] ?? "", // row['total_approval_pending'] ?? "", textAlign: TextAlign.center, style: _tableDataStyle, @@ -1418,17 +1499,17 @@ class othersPendings extends StatelessWidget { hoverColor: Color(0xFFEAF6F4), onTap: () async { print( - 'Awaiting Approval : ${row['pending_quotation_approval']} - ${row['staff_id']}', + 'Awaiting Approval : ${row['total_completed']} - ${row['staff_id']}', ); handleDashboardNavigation( context, - status: "Proposal Created", + status: "Completed", staffId: row['staff_id'] ?? '', role: role, ); }, child: Text( - row['pending_quotation_approval'] ?? "", + row['total_completed'] ?? "", // row['total_approval_pending'] ?? "", textAlign: TextAlign.center, style: _tableDataStyle, @@ -1437,35 +1518,7 @@ class othersPendings extends StatelessWidget { ), ), ), - Expanded( - flex: 2, - child: Material( - color: Colors.white, - child: Center( - child: InkWell( - hoverColor: Color(0xFFEAF6F4), - onTap: () { - print( - 'Awaiting Policy : ${row['awaiting_policy']}', - ); - handleDashboardNavigation( - context, - status: "Proposal Accepted", - staffId: row['staff_id'] ?? '', - role: role, - ); - }, - child: Text( - row['awaiting_policy'] ?? "", - // row['total_approval_pending'] ?? "", - textAlign: TextAlign.center, - style: _tableDataStyle, - ), - ), - ), - ), - ), // Expanded( // flex: 2, // child: Text( @@ -1481,6 +1534,60 @@ class othersPendings extends StatelessWidget { }, ), ), + const SizedBox(height: 8), + // Header row + Container( + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), + decoration: BoxDecoration( + color: Color(0xFFF1F5F9), + // color: Color(0xFFE3F9F8), + borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + Expanded( + flex: 2, + child: Text( + "Total", + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + flex: 2, + child: Text( + totalTodayAssigned.toString(), + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + flex: 2, + child: Text( + totalPending.toString(), + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + flex: 2, + child: Text( + totalInProgress.toString(), + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + flex: 2, + child: Text( + totalCompleted.toString(), + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + ], + ), + ), ], ), ), @@ -1916,29 +2023,34 @@ class UnassignedEnq extends StatelessWidget { focusColor: Color(0xFF3E5B56), highlightColor: Color(0xFF3E5B56), borderRadius: BorderRadius.circular(2), // for ripple effect - onTap: null, - // onTap: (role == 'handler') - // ? () { - // // Print the id when row is clicked - // print("Clicked ID fd: ${row['id']}"); - // // You can also navigate or perform any action here - // - // showDialog( - // context: context, - // builder: (ctx) => AssignStaffDialog( - // enquiryPrimaryId: row['id'], - // regNum: row['reg_no'], - // userId: 1, - // onSubmit: (value) { - // debugPrint("New assignY: $value"); - // if (onRefresh != null) { - // onRefresh!(); // ✅ call the parent's refresh - // } - // }, - // ), - // ); - // } - // : null, + // onTap: () { + // handleDashboardNavigation( + // context, + // status: "To be assigned", + // staffId: row['staff_id'] ?? '', + // role: role, + // ); + // }, + onTap: () { + // Print the id when row is clicked + print("Clicked ID fd: ${row['id']}"); + // You can also navigate or perform any action here + + showDialog( + context: context, + builder: (ctx) => AssignStaffDialog( + enquiryPrimaryId: row['id'], + regNum: row['reg_no'], + userId: 1, + onSubmit: (value) { + debugPrint("New assignY: $value"); + if (onRefresh != null) { + onRefresh!(); // ✅ call the parent's refresh + } + }, + ), + ); + }, child: Container( // height: 5200, margin: const EdgeInsets.symmetric(vertical: 5), diff --git a/lib/presentation/screens/dashboard/dashboard_old.dart b/lib/presentation/screens/dashboard/dashboard_old.dart new file mode 100644 index 0000000..07ada68 --- /dev/null +++ b/lib/presentation/screens/dashboard/dashboard_old.dart @@ -0,0 +1,2150 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:intl/intl.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import '../../../core/responsive/responsive_builder.dart'; +import '../../../core/routing/routes.dart'; +import '../../../core/services/api_service.dart'; +import '../../layouts/main_layout.dart'; +import '../../providers/manager_provider.dart'; +import '../../providers/quotation_staff_proivder.dart'; +import '../../providers/userRoleProvider.dart'; +import '../staff/Enquiry/tabs/tab.dart'; +import '../staff/assignStaff.dart'; + +final enquiriesProvider = Provider>>((ref) { + return List.generate(5, (i) { + return { + "reg": "rrTN64V4387", + "Insurer": "rrNew India", + "date": "rr09/09/2025", + "time": "rr11:30 AM", + }; + }); +}); + +String formatToCroresLakhsAndThousands(String value) { + double numValue = double.parse(value); + + if (numValue >= 10000000) { + return "₹ ${(numValue / 10000000).toStringAsFixed(2)} Crores"; + } else if (numValue >= 100000) { + return "₹ ${(numValue / 100000).toStringAsFixed(2)} Lakhs"; + } else if (numValue >= 1000) { + return "₹ ${(numValue / 1000).toStringAsFixed(2)} Thousands"; + } else { + return "₹ $numValue"; + } +} + +class DashboardScreen extends ConsumerStatefulWidget { + const DashboardScreen({super.key}); + + @override + ConsumerState createState() => _DashboardScreenState(); +} + +class _DashboardScreenState extends ConsumerState { + int selectedIndex = 1; + int switcherStatus = 1; + late ApiService apiService; + String? policiesIssuedToday; + String? policiesIssuedYear; + String? policiesIssuedMonth; + String? premiumValueToday; + String? premiumValueYear; + String? premiumValueMonth; + String? earningsToday; + String? earningsMonth; + String? earningsYear; + String? quotationsPendingCounts; // cross verify + String? currentKey; // cross verify + + // List> dataVal = []; + List> getStaffData = []; + List> originalData = []; + List> filteredData = []; + int selectedTabIndex = 0; + List> currentList = []; + + List> staffQuotationsPendingList = []; // cross verify + List> quotationsPendingList = []; // cross verify + List> policiesPendingList = []; // cross verify + List> awaitingApprovalList = []; // cross verify + List> unAssignedEnqList = []; // cross verify + List> agentsPerformanceList = []; // cross verify + List> nonAgentsPerformanceList = []; // cross verify + dynamic prefid; + dynamic prefroleId; + bool isLoading = false; + + @override + void initState() { + super.initState(); + + apiService = ApiService(); + + Future.microtask(() { + final prefmanagerid = ref.read(managerIdProvider); + final prefuserid = ref.read(userIdProvider); + final prefroleId = ref.read(userRoleProvider); + + print("B81 => roleId: $prefroleId | userId: $prefuserid "); + if (prefuserid != null) { + getStaffList(prefmanagerid!, prefroleId, prefuserid); + } + }); + } + + void refresh() { + print('___DASHBOARD___'); + final prefmanagerid = ref.read(managerIdProvider); + final prefuserid = ref.read(userIdProvider); + final prefroleId = ref.read(userRoleProvider); + + if (prefuserid != null) { + print("REFRESH- calling getStaffList with $prefmanagerid, $prefuserid"); + getStaffList(prefmanagerid!, prefroleId, prefuserid); + } + } + + Future handleEdit(String id) async { + // Navigator.pop(context); + print('EDITStaff'); + print('EDITStaff - $id'); + // dynamic id = data['id']; + // context.go('/tabEnquiry/$id'); + + final prefs = await SharedPreferences.getInstance(); + // ✅ Remove old value (if any) + await prefs.remove('enqAgentDataId'); + + // setState(() { + // final id = item['id'].toString(); + // ✅ Save the new id + // await prefs.setString('enqAgentDataId', id.toString()); + await prefs.setString('enqAgentDataId', id); + ref.read(enquiryIdProvider.notifier).state = id; + context.go(AppRoutes.tabEnquiry); + } + + Future handleStaffEdit(String id, String? flag) async { + // Navigator.pop(context); ddd + dynamic val; + print('EDITStaff - $id'); + + if (flag == "Policies") { + val = 'Policy'; + } else { + val = ''; + } + + var enqId = id; + + final prefs = await SharedPreferences.getInstance(); + + // ✅ Remove old value (if any) + await prefs.remove('enqStaffDataId'); + + // ✅ Save the new id + await prefs.setString('enqStaffDataId', enqId.toString()); + await prefs.setString('navFromDashboard', 'Dashboard'); + + ref.read(quotationStaffIdProvider.notifier).state = enqId; + ref.read(navFromEnqStaffProvider.notifier).state = 'Dashboard'; + + // showDialog( + // context: context, + // builder: (context) => TabEnquiryStaffList(showKey: val), + // ); + + final result = await showDialog( + context: context, + barrierDismissible: + false, // optional - prevents closing by tapping outside + builder: (context) => TabEnquiryStaffList(showKey: val), + ); + + // ✅ Code here runs *after* the dialog is closed + print("Dialog closed"); + print("Dialog result: $result"); + refresh(); + } + + Future getStaffList(int managerId, role, userId) async { + print('B89 => Fns called => $managerId | $role'); + setState(() { + isLoading = true; + }); + + try { + final response = await apiService.fetchDashboard(managerId, role, userId); + + if (response['status'] == 'success') { + final data = response['data']; + print('B99 => getStaffListData => ${response['data']}'); + setState(() { + // policiesIssuedToday = data['policies_issued']['today'].toString(); + // policiesIssuedYear = data['policies_issued']['year'].toString(); + // policiesIssuedMonth = data['policies_issued']['month'].toString(); + // premiumValueToday = data['premium_value']['today'].toString(); + // premiumValueYear = data['premium_value']['year'].toString(); + // premiumValueMonth = data['premium_value']['month'].toString(); + // earningsToday = data['earnings']['today'].toString(); + // earningsYear = data['earnings']['year'].toString(); + // earningsMonth = data['earnings']['month'].toString(); + + // Policies Issued + if (data['policies_issued'] != null) { + policiesIssuedToday = + data['policies_issued']['today']?.toString() ?? "0"; + policiesIssuedYear = + data['policies_issued']['year']?.toString() ?? "0"; + policiesIssuedMonth = + data['policies_issued']['month']?.toString() ?? "0"; + } else { + policiesIssuedToday = "0"; + policiesIssuedYear = "0"; + policiesIssuedMonth = "0"; + } + + // Premium Value + if (data['premium_value'] != null) { + premiumValueToday = + data['premium_value']['today']?.toString() ?? "0"; + premiumValueYear = data['premium_value']['year']?.toString() ?? "0"; + premiumValueMonth = + data['premium_value']['month']?.toString() ?? "0"; + } else { + premiumValueToday = "0"; + premiumValueYear = "0"; + premiumValueMonth = "0"; + } + + // Earnings + if (data['earnings'] != null) { + earningsToday = data['earnings']['today']?.toString() ?? "0"; + earningsYear = data['earnings']['year']?.toString() ?? "0"; + earningsMonth = data['earnings']['month']?.toString() ?? "0"; + } else { + earningsToday = "0"; + earningsYear = "0"; + earningsMonth = "0"; + } + + // agents_performance + if (data['agents_performance'] != null) { + agentsPerformanceList = List>.from( + (data['agents_performance'] as List).map( + (item) => Map.from(item), + ), + ); + + agentsPerformanceList.sort((a, b) { + // int aValue = a['total_policis_pending'] ?? 0; + // int bValue = b['total_policis_pending'] ?? 0; + + int aValue = (a['total_policis_pending'] ?? 0) is int + ? a['total_policis_pending'] + : int.tryParse( + a['total_policis_pending']?.toString() ?? '0', + ) ?? + 0; + int bValue = (b['total_policis_pending'] ?? 0) is int + ? b['total_policis_pending'] + : int.tryParse( + b['total_policis_pending']?.toString() ?? '0', + ) ?? + 0; + return aValue.compareTo(bValue); + // return aValue.compareTo(bValue); // ascending + }); + } + + //nonAgentsPerformanceList + if (data['agents_performance'] != null) { + nonAgentsPerformanceList = List>.from( + (data['agents_performance'] as List).map( + (item) => Map.from(item), + ), + ); + + // Sort descending + nonAgentsPerformanceList.sort((a, b) { + // int aValue = a['total_policy_pending'] ?? 0; + // int bValue = b['total_policy_pending'] ?? 0; + int aValue = (a['total_policis_pending'] ?? 0) is int + ? a['total_policis_pending'] + : int.tryParse( + a['total_policis_pending']?.toString() ?? '0', + ) ?? + 0; + int bValue = (b['total_policis_pending'] ?? 0) is int + ? b['total_policis_pending'] + : int.tryParse( + b['total_policis_pending']?.toString() ?? '0', + ) ?? + 0; + return bValue.compareTo(aValue); // descending + }); + } + + if (data['staff_level_pending_summary'] != null) { + print('staff_level_pending_summary -'); + staffQuotationsPendingList = List>.from( + (data['staff_level_pending_summary'] as List).map( + (item) => Map.from(item), + ), + ); + print('staff_level_pending_summary - $staffQuotationsPendingList'); + } + + if (data['quotations_pending'] != null) { + quotationsPendingList = List>.from( + (data['quotations_pending'] as List).map( + (item) => Map.from(item), + ), + ); + } + + if (data['quotations_approval_pending'] != null) { + awaitingApprovalList = List>.from( + (data['quotations_approval_pending'] as List).map( + (item) => Map.from(item), + ), + ); + } + if (data['policies_pending'] != null) { + policiesPendingList = List>.from( + (data['policies_pending'] as List).map( + (item) => Map.from(item), + ), + ); + } + + if (data['unassigned_enquiry'] != null) { + unAssignedEnqList = List>.from( + (data['unassigned_enquiry'] as List).map( + (item) => Map.from(item), + ), + ); + } + }); + } else { + getStaffData = []; + originalData = []; + } + } catch (e) { + print('Exception occurred: $e'); + } finally { + setState(() { + isLoading = false; + }); + } + } + + @override + Widget build(BuildContext context) { + final enquiries = ref.watch(enquiriesProvider); + final managerId = ref.watch(managerIdProvider); + final userId = ref.watch(userIdProvider); + final role = ref.watch(userRoleProvider); + + return MainLayout( + title: "Home", + body: ResponsiveBuilder.isMobile(context) + ? Container( + // color: Colors.redAccent, + // height: MediaQuery.of(context).size.height, + // ✅ take available space + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // 🔹 Stats cards stacked + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: StatCard( + // title: "Policies Issued", + // today: policiesIssuedToday ?? '', + // month: policiesIssuedMonth ?? '', + // year: policiesIssuedYear ?? '', + // imagePath: "assets/dashboard/Policy issue icon.png", + // ), + // ), + // // const SizedBox(height: 12), + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: StatCard( + // title: "Premium Value", + // today: premiumValueToday ?? '', + // month: premiumValueMonth ?? '', + // year: premiumValueYear ?? '', + // imagePath: "assets/dashboard/Policy issue icon.png", + // ), + // ), + // // const SizedBox(height: 12), + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: StatCard( + // title: "Earnings", + // today: earningsToday ?? '', + // month: earningsMonth ?? '', + // year: earningsYear ?? '', + // imagePath: "assets/dashboard/Policy issue icon.png", + // ), + // ), + // + // const SizedBox(height: 20), + Container( + padding: const EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: Color(0XFFEDF6F5), + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(50), // adjust radius + topRight: Radius.circular(50), + ), + ), + // 🔹 Tab Switcher + child: Column( + children: [ + Container( + decoration: BoxDecoration( + color: const Color(0xFF425B5B), + borderRadius: BorderRadius.circular(25), + ), + padding: const EdgeInsets.all(6), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: buildTab("Awaiting Proposal", 0), + ), + const SizedBox(width: 10), + Padding( + padding: const EdgeInsets.all(8.0), + child: buildTab("Awaiting Approval", 1), + ), + + const SizedBox(width: 10), + Padding( + padding: const EdgeInsets.all(8.0), + child: buildTab("Awaiting Policy", 2), + ), + ], + ), + ), + ), + + const SizedBox(height: 20), + + // 🔹 Scrollable list + ListView.builder( + itemCount: currentList.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + final item = currentList[index]; + + // Split date & time from created_on + String date = ""; + String time = ""; + if ((item['created_on'] ?? "").isNotEmpty) { + final parts = item['created_on'].split(' '); + date = parts[0]; + if (parts.isNotEmpty) { + DateTime parsedDate = DateTime.parse( + parts[0], + ); + date = DateFormat( + 'dd-MM-yyyy', + ).format(parsedDate); // 19/09/2025 + } + // time = parts.length > 1 ? parts[1] : ""; + // Format the time part (HH:mm) + if (parts.length >= 2) { + final timeParts = parts[1].split(":"); + time = + "${timeParts[0]}:${timeParts[1]}"; // 05:45 + } else { + time = ""; + } + } + + return Card( + elevation: 2, + margin: const EdgeInsets.symmetric(vertical: 8), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + color: Colors.white, + child: ListTile( + onTap: () { + dynamic id = item['id'].toString(); + + print("Tapped ID: ${item['id']}"); + handleEdit(id); + }, + title: Text( + item["reg_no"] ?? "-", // from API + style: GoogleFonts.inter( + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + + subtitle: (currentKey == 'policies') + ? Text( + item["insurer_name"] ?? "-", + style: GoogleFonts.inter( + fontSize: 12, + fontWeight: FontWeight.bold, + ), + ) + : SizedBox.shrink(), + trailing: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + date, + style: GoogleFonts.inter(fontSize: 12), + ), + Text(time, style: _tableDataTimeStyle), + ], + ), + ), + ); + }, + ), + ], + ), + ), + ], + ), + ), + ) + : Container( + height: MediaQuery.of(context).size.height * 0.8, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + // if (role != 'staff') + if (role != 'staff' && + role != 'handler' && + role != 'manager') + Row( + children: [ + Expanded( + child: StatCard( + title: "Policies Issued", + today: policiesIssuedToday ?? '', + month: policiesIssuedMonth ?? '', + year: policiesIssuedYear ?? '', + colorDark: Color(0xFF059669), + imagePath: + "assets/dashboard/Policy issue icon.png", + ), + ), + SizedBox(width: 16), + Expanded( + child: StatCard( + title: "Premium Value", + today: premiumValueToday ?? '', + month: premiumValueMonth ?? '', + year: premiumValueYear ?? '', + colorDark: Color(0XFF1d4ed8), + // colorDark: Color(0xff2563eb), + imagePath: "assets/dashboard/Premium value.png", + ), + ), + SizedBox(width: 16), + Expanded( + child: StatCard( + title: "Earnings", + today: earningsToday ?? '', + month: earningsMonth ?? '', + year: earningsYear ?? '', + colorDark: Color(0xff8b5cf6), + imagePath: "assets/dashboard/Earnings.png", + ), + ), + ], + ), + + const SizedBox(height: 5), + SizedBox( + // ✅ replace Expanded + height: (role == 'agent') + ? MediaQuery.of(context).size.height * + 0.69 //400 + : (role == 'manager') + ? MediaQuery.of(context).size.height * 0.5 + : (role == 'staff' || role == 'handler') + ? MediaQuery.of(context).size.height * 0.85 + : MediaQuery.of(context).size.height * + 0.5, // 350 adjust height as needed + child: (role == 'manager' || role == 'handler') + ? Row( + children: [ + Expanded( + child: othersPendings( + title: + "Staff Wise Pending(${staffQuotationsPendingList.length})", + data: staffQuotationsPendingList, + stringFlag: "Proposal", + role: role!, + ), + ), + if (role == 'handler') ...[ + Expanded( + child: UnassignedEnq( + key: UniqueKey(), + title: "Unassigned Enquiries", + role: role, + data: unAssignedEnqList, + onRefresh: refresh, + ), + ), + ], + ], + ) + : Row( + children: [ + Expanded( + child: (role == 'agent') + ? agentPendings( + title: + "Awaiting Proposal (${quotationsPendingList.length})", + data: quotationsPendingList, + role: role!, + onEdit: (row) { + handleEdit( + row, + ); // parent method is called + }, + onStaffEdit: (row, flag) { + handleStaffEdit(row, flag); + }, + ) + : (role == 'manager') + ? SizedBox.shrink() + : agentPendings( + title: + "Awaiting Proposal (${quotationsPendingList.length})", + data: quotationsPendingList, + role: role!, + onEdit: (row) { + handleEdit( + row, + ); // parent method is called + }, + + onStaffEdit: (row, flag) { + handleStaffEdit(row, flag); + }, + ), + ), + const SizedBox(width: 16), + Expanded( + child: (role == 'agent') + ? agentPendings( + title: + "Awaiting Approval (${awaitingApprovalList.length})", + data: awaitingApprovalList, + role: role!, + onEdit: (row) { + handleEdit( + row, + ); // parent method is called + }, + onStaffEdit: (row, flag) { + handleStaffEdit(row, flag); + }, + ) + : (role == 'manager') + ? SizedBox.shrink() + // othersPendings( + // title: + // "Awaiting Proposal (${quotationsPendingList.length})", + // data: quotationsPendingList, + // stringFlag: "Proposal", + // ) + : agentPendings( + title: + "Awaiting Approval (${awaitingApprovalList.length})", + data: awaitingApprovalList, + role: role!, + onEdit: (row) { + handleEdit( + row, + ); // parent method is called + }, + onStaffEdit: (row, flag) { + handleStaffEdit(row, flag); + }, + ), + ), + const SizedBox(width: 16), + Expanded( + child: (role == 'agent') + ? agentPendings( + title: + "Awaiting Policy (${policiesPendingList.length})", + data: policiesPendingList, + stringFlag: "Policies", + role: role!, + onEdit: (row) { + handleEdit( + row, + ); // parent method is called + }, + onStaffEdit: (row, flag) { + handleStaffEdit(row, flag); + }, + ) + : (role == 'staff') + ? + // ? othersPendings( + // title: + // "Awaiting Proposal (${quotationsPendingList.length})", + // data: quotationsPendingList, + // stringFlag: "Proposal", + // ) + agentPendings( + title: + "Awaiting Policy (${policiesPendingList.length})", + data: policiesPendingList, + stringFlag: "Policies", + role: role!, + onEdit: (row) { + handleEdit( + row, + ); // parent method is called + }, + onStaffEdit: (row, flag) { + handleStaffEdit(row, flag); + }, + ) + : SizedBox.shrink(), + ), + ], + ), + ), + const SizedBox(height: 5), + if (role == 'manager') + SizedBox( + // ✅ replace Expanded + height: 350, // adjust height as needed + child: Row( + children: [ + Expanded( + child: UnassignedEnq( + key: UniqueKey(), + title: "Unassigned Enquiries", + role: role!, + data: unAssignedEnqList, + onRefresh: refresh, + ), + ), + SizedBox(width: 16), + Expanded( + child: Performance( + title: "Performing Partner", + data: agentsPerformanceList, + ), + ), + SizedBox(width: 16), + Expanded( + child: Performance( + title: "Non-Performing Partner", + data: nonAgentsPerformanceList, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + } + + // Widget buildTab(String title, int index) { + // final isSelected = selectedIndex == index + 1; + // return GestureDetector( + // onTap: () { + // print('buildTab - $index'); + // + // setState(() { + // selectedIndex = index + 1; + // print('buildTab1 - $selectedIndex'); + // if (selectedIndex == 2) { + // switcherStatus = 0; + // } else { + // switcherStatus = 1; + // } + // }); + // }, + // child: SizedBox( + // child: Container( + // padding: EdgeInsets.symmetric(vertical: 6, horizontal: 10), + // decoration: BoxDecoration( + // color: isSelected ? const Color(0xFFFFFFFF) : Colors.transparent, + // borderRadius: BorderRadius.circular(16), + // ), + // child: Center( + // child: Text( + // title, + // style: GoogleFonts.poppins( + // fontSize: 12, + // + // color: isSelected ? Colors.black : Colors.white, + // fontWeight: FontWeight.w500, + // ), + // maxLines: 2, + // softWrap: true, + // ), + // ), + // ), + // ), + // ); + // } + + Widget buildTab(String title, int index) { + final isSelected = selectedTabIndex == index; + if (selectedTabIndex == 0) { + currentList = quotationsPendingList; + currentKey = 'pending'; + } else if (selectedTabIndex == 1) { + currentList = awaitingApprovalList; + currentKey = 'approval'; + } else if (selectedTabIndex == 2) { + currentList = policiesPendingList; + currentKey = 'policies'; + } + + return GestureDetector( + onTap: () { + setState(() { + selectedTabIndex = index; + }); + }, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + decoration: BoxDecoration( + color: isSelected ? Colors.white : Colors.transparent, + borderRadius: BorderRadius.circular(20), + ), + child: Text( + title, + style: GoogleFonts.inter( + fontSize: 11, + fontWeight: FontWeight.bold, + color: isSelected ? const Color(0xFF425B5B) : Colors.white, + ), + ), + ), + ); + } +} + +// Stats card widget +class StatCard extends StatelessWidget { + final String title; + final String today; + final String month; + final String year; + final String? imagePath; + final Color? colorDark; + + const StatCard({ + super.key, + required this.title, + required this.today, + required this.month, + required this.year, + this.imagePath, + this.colorDark, + }); + + @override + Widget build(BuildContext context) { + return Card( + color: Colors.white, + // color: Color(0xFFF1F9F8), + // color: Color(0xFFEAF6F4), + elevation: 1, + shadowColor: colorDark ?? null, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Padding( + padding: const EdgeInsets.all(8.0), + + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + children: [ + Container( + padding: EdgeInsets.all(4.0), + height: 28, + width: 28, + decoration: BoxDecoration( + color: colorDark ?? Colors.grey, + borderRadius: BorderRadius.circular(15), + ), + child: Image.asset( + imagePath!, + width: 18, + height: 18, + // color: colorDark ?? Colors.grey, + color: Colors.white, + ), + ), + const SizedBox(width: 8), + Text( + title, + style: GoogleFonts.inter( + fontSize: 12, + fontWeight: FontWeight.w700, + color: Color(0xFF425B5B), + ), + ), + ], + ), + Divider(thickness: 0.1, color: colorDark ?? Colors.grey), + const SizedBox(height: 5), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + today, + textAlign: TextAlign.center, + style: GoogleFonts.inter( + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + ), + Expanded( + child: Text( + month, + textAlign: TextAlign.center, + style: GoogleFonts.inter( + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + ), + Expanded( + child: Text( + year, + textAlign: TextAlign.center, + style: GoogleFonts.inter( + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + "Today", + textAlign: TextAlign.center, + style: topHeaderStyle, + ), + ), + Expanded( + child: Text( + "This Month", + textAlign: TextAlign.center, + style: topHeaderStyle, + ), + ), + Expanded( + child: Text( + "This Year", + textAlign: TextAlign.center, + style: topHeaderStyle, + ), + ), + ], + ), + ], + ), + ), + ); + } +} + +class agentPendings extends StatelessWidget { + final String title; + final String? stringFlag; + String role; + final List> data; + + // final Function(Map)? onEdit; + final Function(String)? onEdit; + // final Function(String)? onStaffEdit; + final Function(String, String?)? onStaffEdit; + + agentPendings({ + Key? key, + required this.title, + required this.data, + this.stringFlag, + required this.onStaffEdit, + required this.role, + required this.onEdit, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + print('-Data: $data'); + + return Card( + color: Colors.white, + // color: const Color(0xFFEAF6F4), + elevation: 1, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title + Text(title, style: _title), + const SizedBox(height: 10), + + // Header row + Container( + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12), + decoration: BoxDecoration( + color: Color(0xFFE3F9F8), + // color: const Color(0xFF3E5B56), + borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + // Expanded( + // flex: 1, + // child: Text( + // "S.No", + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + Expanded( + flex: 2, + child: Text( + "Date & Time", + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + flex: 2, + child: Text( + "Vehicle Number", + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + if (stringFlag == "Policies") ...[ + Expanded( + flex: 2, + child: Text( + "Insurer", + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + ], + ], + ), + ), + const SizedBox(height: 8), + + // List of rows + Flexible( + child: ListView.builder( + itemCount: data.length, + itemBuilder: (context, index) { + final row = data[index]; + + // Split date & time from created_on + String date = ""; + String time = ""; + if ((row['created_on'] ?? "").isNotEmpty) { + final parts = row['created_on'].split(' '); + date = parts[0]; + if (parts.isNotEmpty) { + DateTime parsedDate = DateTime.parse(parts[0]); + date = DateFormat( + 'dd-MM-yyyy', + ).format(parsedDate); // 19/09/2025 + } + // time = parts.length > 1 ? parts[1] : ""; + // Format the time part (HH:mm) + if (parts.length >= 2) { + final timeParts = parts[1].split(":"); + time = "${timeParts[0]}:${timeParts[1]}"; // 05:45 + } else { + time = ""; + } + } + + return InkWell( + focusColor: Color(0xFF3E5B56), + highlightColor: Color(0xFF3E5B56), + borderRadius: BorderRadius.circular(2), + onTap: (role == 'manager') + ? null + : (role == 'agent') + ? () { + print( + "Clicked Partner role : $role - ${row['id']}", + ); + onEdit!(row['id'].toString()); + // onEdit!(row['id']); + } + : () { + print("Clicked Staff role : $role - ${row['id']}"); + print("Clicked Staff stringFlag : $stringFlag"); + onStaffEdit!(row['id'].toString(), stringFlag); + }, + child: Container( + // margin: const EdgeInsets.symmetric(vertical: 5), + padding: const EdgeInsets.symmetric( + vertical: 5, + horizontal: 12, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(2), + border: Border( + bottom: BorderSide(color: Colors.blueGrey.shade50), + ), + ), + child: Row( + children: [ + // Expanded( + // flex: 1, + // child: Text( + // (index + 1).toString(), + // textAlign: TextAlign.center, + // style: _tableDataStyle, + // ), + // ), + // Date & Time + Expanded( + flex: 2, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(date, style: _tableDataStyle), + Text(time, style: _tableDataTimeStyle), + ], + ), + ), + + // Registration number + Expanded( + flex: 2, + child: Text( + row['reg_no'] ?? "", + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + if (stringFlag == "Policies") ...[ + // Insurer company + Expanded( + flex: 2, + child: Text( + row['insurer_short_name'] ?? "", + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + ], + ], + ), + ), + ); + }, + ), + ), + ], + ), + ), + ); + } +} + +class othersPendings extends StatelessWidget { + final String title; + final String stringFlag; + String role; + final List> data; + + othersPendings({ + Key? key, + required this.title, + required this.role, + required this.data, + required this.stringFlag, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + print(' Data: $data'); + + return Card( + color: Colors.white, + // color: const Color(0xFFEAF6F4), + elevation: 1, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title + Text(title, style: _title), + const SizedBox(height: 10), + + // Header row + Container( + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), + decoration: BoxDecoration( + color: Color(0xFFE3F9F8), + // color: const Color(0xFF3E5B56), + borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + // Expanded( + // flex: 1, + // child: Text( + // "S.No", + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + // if (role == 'manager') ...[ + // Expanded( + // flex: 2, + // child: Text( + // "Handler Name", + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + // ], + Expanded( + flex: 2, + child: Text( + "Staff Name", + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + + // Expanded( + // flex: 2, + // child: Text( + // // stringFlag + " Issued", + // 'Total Assigned', + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + // Expanded( + // flex: 2, + // child: Text( + // 'To be assigned', + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + // Expanded( + // flex: 2, + // child: Text( + // 'Total Assigned', + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + Expanded( + flex: 2, + child: Text( + 'Today Assigned', + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + + Expanded( + flex: 2, + child: Text( + 'Pending', + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + flex: 2, + child: Text( + 'In Progress', + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + flex: 2, + child: Text( + 'Completed', + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + // Expanded( + // flex: 2, + // child: Text( + // // stringFlag + " Issued", + // 'Policy Created', + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + ], + ), + ), + const SizedBox(height: 8), + + // List of rows + Flexible( + child: ListView.builder( + itemCount: data.length, + itemBuilder: (context, index) { + final row = data[index]; + + final issuedCount = stringFlag == "Policies" + ? (row['total_policis_pending'] ?? 0).toString() + : (row['total_quotation_pending'] ?? 0).toString(); + + final permiumValue = row['total_premium_value'] == null + ? '0' + : row['total_premium_value']; + + return Container( + margin: const EdgeInsets.symmetric(vertical: 5), + padding: const EdgeInsets.symmetric( + vertical: 5, + horizontal: 12, + ), + decoration: BoxDecoration( + color: Colors.white, + border: Border( + bottom: BorderSide( + color: Colors.blueGrey.shade100, + width: 0.3, + ), + ), + // borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + // Expanded( + // flex: 1, + // child: Text( + // (index + 1).toString(), + // textAlign: TextAlign.center, + // style: _tableDataStyle, + // ), + // ), + // if (role == 'manager') ...[ + // Expanded( + // flex: 2, + // child: Text( + // row['handler_name'] ?? "", + // + // textAlign: TextAlign.center, + // style: _tableDataStyle, + // ), + // ), + // ], + Expanded( + flex: 2, + child: Text( + row['staff_name'] ?? "", + + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + + // Expanded( + // flex: 2, + // child: Text( + // row['total_assigned'] ?? "", + // // row['total_approval_pending'] ?? "", + // textAlign: TextAlign.center, + // style: _tableDataStyle, + // ), + // ), + // Expanded( + // flex: 2, + // child: Material( + // color: Colors.white, + // child: Center( + // child: InkWell( + // hoverColor: Color(0xFFEAF6F4), + // onTap: () { + // print( + // 'total_assigned : ${row['total_assigned']}', + // ); + // + // handleDashboardNavigation( + // context, + // status: "Assigned", + // staffId: row['staff_id'] ?? '', + // role: role, + // ); + // }, + // child: Text( + // row['total_assigned'] ?? "", + // // row['total_approval_pending'] ?? "", + // textAlign: TextAlign.center, + // style: _tableDataStyle, + // ), + // ), + // ), + // ), + // ), + Expanded( + flex: 2, + child: Material( + color: Colors.white, + child: Center( + child: InkWell( + hoverColor: Color(0xFFEAF6F4), + onTap: () { + print( + 'total_assigned_today : ${row['total_assigned']}', + ); + + handleDashboardNavigation( + context, + status: "Assigned", + staffId: row['staff_id'] ?? '', + role: role, + ); + }, + child: Text( + row['today_assigned'] ?? "", + // row['total_approval_pending'] ?? "", + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + ), + ), + ), + Expanded( + flex: 2, + child: Material( + color: Colors.white, + child: Center( + child: InkWell( + hoverColor: Color(0xFFEAF6F4), + onTap: () { + print( + 'total_assigned : ${row['total_assigned']}', + ); + + handleDashboardNavigation( + context, + status: "Assigned", + staffId: row['staff_id'] ?? '', + role: role, + ); + }, + child: Text( + row['pending_assigned'] ?? "", + // row['total_approval_pending'] ?? "", + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + ), + ), + ), + Expanded( + flex: 2, + child: Material( + color: Colors.white, + child: Center( + child: InkWell( + // hoverColor: Color(0xFFEAF6F4), + onTap: () { + print( + 'Awaiting Proposal : ${row['total_in_progress']}', + ); + + handleDashboardNavigation( + context, + status: "In progress", + staffId: row['staff_id'] ?? '', + role: role, + ); + }, + + child: Text( + row['total_in_progress'] ?? "", + // row['total_approval_pending'] ?? "", + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + ), + ), + ), + Expanded( + flex: 2, + child: Material( + color: Colors.white, + child: Center( + child: InkWell( + hoverColor: Color(0xFFEAF6F4), + onTap: () async { + print( + 'Awaiting Approval : ${row['total_completed']} - ${row['staff_id']}', + ); + handleDashboardNavigation( + context, + status: "Completed", + staffId: row['staff_id'] ?? '', + role: role, + ); + }, + child: Text( + row['total_completed'] ?? "", + // row['total_approval_pending'] ?? "", + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + ), + ), + ), + + // Expanded( + // flex: 2, + // child: Text( + // row['policy_created'] ?? "", + // // row['total_approval_pending'] ?? "", + // textAlign: TextAlign.center, + // style: _tableDataStyle, + // ), + // ), + ], + ), + ); + }, + ), + ), + ], + ), + ), + ); + } +} + +class awaitingApproval extends StatelessWidget { + final String title; + final String stringFlag; + final List> data; + + awaitingApproval({ + Key? key, + required this.title, + required this.data, + required this.stringFlag, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + print(' Data: $data'); + + return Card( + color: Colors.white, + // color: const Color(0xFFEAF6F4), + elevation: 1, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title + Text(title, style: _title), + const SizedBox(height: 10), + + // Header row + Container( + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), + decoration: BoxDecoration( + // color: const Color(0xFF3E5B56), + color: Color(0xFFE3F9F8), + borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + // Expanded( + // flex: 1, + // child: Text( + // "S.No", + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + Expanded( + flex: 2, + child: Text( + "Staff Name", + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + flex: 2, + child: Text( + // stringFlag + " Issued", + 'Pending Count', + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + // (stringFlag == "Policies") + // ? Expanded( + // flex: 2, + // child: Text( + // "Total Premium Value", + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ) + // : const SizedBox.shrink(), + ], + ), + ), + const SizedBox(height: 8), + + // List of rows + Flexible( + child: ListView.builder( + itemCount: data.length, + itemBuilder: (context, index) { + final row = data[index]; + + final issuedCount = stringFlag == "Policies" + ? (row['total_policis_pending'] ?? 0).toString() + : (row['total_quotation_pending'] ?? 0).toString(); + + final permiumValue = row['total_premium_value'] == null + ? '0' + : row['total_premium_value']; + + return Container( + margin: const EdgeInsets.symmetric(vertical: 5), + padding: const EdgeInsets.symmetric( + vertical: 5, + horizontal: 12, + ), + decoration: BoxDecoration( + color: Colors.white, + border: Border( + bottom: BorderSide( + color: Colors.blueGrey.shade100, + width: 0.3, + ), + ), + // borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + // Expanded( + // flex: 1, + // child: Text( + // (index + 1).toString(), + // textAlign: TextAlign.center, + // style: _tableDataStyle, + // ), + // ), + Expanded( + flex: 2, + child: Text( + row['staff_name'] ?? "", + + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + + Expanded( + flex: 2, + child: Text( + // issuedCount, + (row['total_approval_pending'] ?? 0).toString(), + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + // stringFlag == "Policies" + // ? Expanded( + // flex: 2, + // child: Text( + // formatToCroresLakhsAndThousands(permiumValue), + // textAlign: TextAlign.center, + // style: GoogleFonts.inter( + // fontSize: 14, + // fontWeight: FontWeight.w500, + // ), + // ), + // ) + // : const SizedBox.shrink(), + ], + ), + ); + }, + ), + ), + ], + ), + ), + ); + } +} + +class Performance extends StatelessWidget { + final String title; + final List> data; + + Performance({Key? key, required this.title, required this.data}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Card( + // color: const Color(0xFFEAF6F4), + color: Colors.white, + elevation: 1, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title + Text(title, style: _title), + const SizedBox(height: 10), + + // Header row + Container( + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), + decoration: BoxDecoration( + color: Color(0xFFE3F9F8), + // color: const Color(0xFF3E5B56), + borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + // Expanded( + // child: Text( + // "S.No", + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + Expanded( + child: Text( + "Partner Name", + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + child: Text( + "Policies Issued", + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + child: Text( + title == "Performing Partners" + ? "Premium Value" + : "Status", + textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + ], + ), + ), + const SizedBox(height: 8), + + // List of rows + Flexible( + child: ListView.builder( + itemCount: data.length, + itemBuilder: (context, index) { + final row = data[index]; + + return Container( + // height: 5200, + margin: const EdgeInsets.symmetric(vertical: 5), + padding: const EdgeInsets.symmetric( + vertical: 5, + horizontal: 12, + ), + decoration: BoxDecoration( + color: Colors.white, + border: Border( + bottom: BorderSide( + color: Colors.blueGrey.shade100, + width: 0.3, + ), + ), + // borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + // Expanded( + // child: Text( + // (index + 1).toString(), // convert int to string + // textAlign: TextAlign.center, + // style: _tableDataStyle, + // ), + // ), + Expanded( + child: Text( + row['agent_name'] ?? "", + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + + Expanded( + child: Text( + row['total_policy_issued'] ?? "", + textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + + Expanded( + child: Text( + title == "Performing Partners" + ? formatToCroresLakhsAndThousands( + row['total_premium_value'] ?? 0, + ) + : (row['status']?.toString() ?? ""), + textAlign: TextAlign.center, + style: GoogleFonts.inter( + fontSize: 11, + fontWeight: FontWeight.w500, + color: title == "Performing Partners" + ? Colors.black + : (row['status']?.toString().toLowerCase() == + "active" + ? Colors.green + : Colors.red), + ), + ), + ), + ], + ), + ); + }, + ), + ), + ], + ), + ), + ); + } +} + +class UnassignedEnq extends StatelessWidget { + final String title; + final List> data; + final VoidCallback? onRefresh; + String role; + + UnassignedEnq({ + Key? key, + required this.title, + required this.data, + this.onRefresh, + required this.role, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Card( + color: Colors.white, + // color: const Color(0xFFEAF6F4), + elevation: 1, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title + Text(title, style: _title), + const SizedBox(height: 10), + + // Header row + Container( + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), + decoration: BoxDecoration( + // color: const Color(0xFF3E5B56), + color: Color(0xFFE3F9F8), + borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + // Expanded( + // child: Text( + // "S.No", + // textAlign: TextAlign.center, + // style: _headerStyle, + // ), + // ), + Expanded( + child: Text( + "Date", + // textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + child: Text( + "Partner", + // textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + child: Text( + "Reg.No.", + // textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + Expanded( + child: Text( + "Insured Name", + // textAlign: TextAlign.center, + style: _headerStyle, + ), + ), + ], + ), + ), + const SizedBox(height: 8), + + // List of rows + Flexible( + child: ListView.builder( + itemCount: data.length, + itemBuilder: (context, index) { + final row = data[index]; + + String date = ""; + String time = ""; + if ((row['created_on'] ?? "").isNotEmpty) { + final parts = row['created_on'].split(' '); + date = parts[0]; + if (parts.isNotEmpty) { + DateTime parsedDate = DateTime.parse(parts[0]); + date = DateFormat( + 'dd-MM-yyyy', + ).format(parsedDate); // 19/09/2025 + } + // time = parts.length > 1 ? parts[1] : ""; + // Format the time part (HH:mm) + if (parts.length >= 2) { + final timeParts = parts[1].split(":"); + time = "${timeParts[0]}:${timeParts[1]}"; // 05:45 + } else { + time = ""; + } + } + + return InkWell( + focusColor: Color(0xFF3E5B56), + highlightColor: Color(0xFF3E5B56), + borderRadius: BorderRadius.circular(2), // for ripple effect + // onTap: () { + // handleDashboardNavigation( + // context, + // status: "To be assigned", + // staffId: row['staff_id'] ?? '', + // role: role, + // ); + // }, + onTap: () { + // Print the id when row is clicked + print("Clicked ID fd: ${row['id']}"); + // You can also navigate or perform any action here + + showDialog( + context: context, + builder: (ctx) => AssignStaffDialog( + enquiryPrimaryId: row['id'], + regNum: row['reg_no'], + userId: 1, + onSubmit: (value) { + debugPrint("New assignY: $value"); + if (onRefresh != null) { + onRefresh!(); // ✅ call the parent's refresh + } + }, + ), + ); + }, + child: Container( + // height: 5200, + margin: const EdgeInsets.symmetric(vertical: 5), + padding: const EdgeInsets.symmetric( + vertical: 5, + horizontal: 12, + ), + decoration: BoxDecoration( + color: Colors.white, + border: Border( + bottom: BorderSide( + color: Colors.blueGrey.shade100, + width: 0.3, + ), + ), + // borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(date, style: _tableDataStyle), + Text(time, style: _tableDataTimeStyle), + ], + ), + ), + Expanded( + child: Text( + row['agent_name'] ?? '', // convert int to string + // textAlign: TextAlign.center, + style: _tableDataStyle, + ), + ), + Expanded( + child: Text( + row['reg_no'] ?? "", + + style: _tableDataStyle, + ), + ), + Expanded( + child: Text( + row['insured_name'] ?? "", + + style: _tableDataStyle, + ), + ), + ], + ), + ), + ); + }, + ), + ), + ], + ), + ), + ); + } +} + +Future handleDashboardNavigation( + BuildContext context, { + required String status, + String? staffId, + required String role, +}) async { + print('Dashboard Tap => Status: $status | Staff: $staffId'); + + final prefs = await SharedPreferences.getInstance(); + + // ✅ Clear any old data + await prefs.remove('dashboardKeyProvider'); + await prefs.remove('dashboardStatusProvider'); + await prefs.remove('dashboardStaffIdProvider'); + + // ✅ Save new values + await prefs.setString('dashboardKeyProvider', 'fromDashboard'); + await prefs.setString('dashboardStatusProvider', status); + await prefs.setString('dashboardStaffIdProvider', staffId!); + + context.go(AppRoutes.enquiryForStaff); + // // ✅ Navigate + // if (role == 'manager') { + // context.go(AppRoutes.enquiryForStaff); + // } else { + // context.go(AppRoutes.enquiryHandlerLst); + // } +} + +final _headerStyle = GoogleFonts.inter( + fontWeight: FontWeight.w600, + fontSize: 11.5, + color: Colors.black, +); + +final _title = GoogleFonts.inter( + fontWeight: FontWeight.bold, + fontSize: 11.5, + // color: Colors.red, + color: const Color(0xff425B5B), +); + +final _tableDataStyle = GoogleFonts.inter( + fontSize: 11, + fontWeight: FontWeight.w500, +); +final _tableDataTimeStyle = GoogleFonts.inter( + fontSize: 10, + fontWeight: FontWeight.w400, +); + +final topHeaderStyle = GoogleFonts.inter( + fontSize: 11, + color: Colors.black, + fontWeight: FontWeight.w500, +); diff --git a/lib/presentation/screens/staff/Enquiry/enquiry_inline_list.dart b/lib/presentation/screens/staff/Enquiry/enquiry_inline_list.dart index 487a59d..4112c96 100644 --- a/lib/presentation/screens/staff/Enquiry/enquiry_inline_list.dart +++ b/lib/presentation/screens/staff/Enquiry/enquiry_inline_list.dart @@ -62,6 +62,8 @@ class EnquiryStaffState extends ConsumerState { dynamic SelectedStatus; dynamic SelectedStaffId; String? selectedFileNames; + String? lastPickedFile; + PlatformFile? docUploadedFile; dynamic handlerId; String? _token; @@ -571,6 +573,9 @@ class EnquiryStaffState extends ConsumerState { print('ToDate : $toDate'); setState(() { + if (SelectedStatus == 'Completed') { + selectedIndex = 1; + } controllers['startDate']?.text = fromDate; controllers['endDate']?.text = toDate; if (data is List) { @@ -1028,13 +1033,13 @@ class EnquiryStaffState extends ConsumerState { return filteredInsurersData; } return filteredInsurersData.where((item) { - return item['name'].toString().toLowerCase().contains( + return item['short_name'].toString().toLowerCase().contains( filter.toLowerCase(), ); }).toList(); }, - itemAsString: (val) => val['name'].toString(), // what to show + itemAsString: (val) => val['short_name'].toString(), // what to show compareFn: (item, selectedItem) => item['id'] == selectedItem['id'], // ✅ compare by id validator: (val) { @@ -1060,7 +1065,9 @@ class EnquiryStaffState extends ConsumerState { dropdownBuilder: (context, selectedItem) => Align( alignment: Alignment.centerLeft, child: Text( - selectedItem != null ? selectedItem['name'].toString() : "", + selectedItem != null + ? selectedItem['short_name'].toString() + : "", style: GoogleFonts.poppins( fontSize: 11, color: Color(0XFF6366F1), @@ -1142,7 +1149,7 @@ class EnquiryStaffState extends ConsumerState { vertical: 3, ), child: Text( - item['name'].toString(), + item['short_name'].toString(), style: GoogleFonts.inter(fontSize: 12, color: Colors.black), ), ); @@ -2516,6 +2523,30 @@ class EnquiryStaffState extends ConsumerState { }, ), ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: IconButton( + tooltip: 'Close', + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: 24, minHeight: 24), + icon: const Icon( + Icons.close, + color: Colors.indigo, + size: 28, // smaller icon + ), + splashRadius: 14, // ripple radius + onPressed: () { + setState(() { + isActionable = false; + bool isOpen = rowExpanded[id] ?? false; + + rowExpanded.clear(); // close all + + // rowExpanded[id] = !(rowExpanded[id] ?? false); + }); + }, + ), + ), ], ); } @@ -2831,6 +2862,9 @@ class EnquiryStaffState extends ConsumerState { if (response.statusCode == 200 || response.statusCode == 201) { ToastHelper.showSuccessToast(context, "Policy PDF Uploaded!"); + setState(() { + docUploadedFile = null; + }); refrshfilterDateRange(); return; } @@ -3067,17 +3101,30 @@ class EnquiryStaffState extends ConsumerState { }); }, ), - ThemedSearchField( - hintText: 'Search', - backgroundColor: Color(0xFFFFFFFF), - txtHeight: 30, - // backgroundColor: Colors.white, - onChanged: filterData, + MouseRegion( + onEnter: (_) { + setState(() { + isActionable = true; + }); + }, + onExit: (_) { + setState(() { + // isActionable = false; + isActionable = _searchStaffController.text.isNotEmpty; + }); + }, + child: ThemedSearchField( + hintText: 'Search', + backgroundColor: Color(0xFFFFFFFF), + txtHeight: 30, + // backgroundColor: Colors.white, + onChanged: filterData, - controller: _searchStaffController, - txtwidth: ResponsiveLayout.isMobile(context) - ? MediaQuery.of(context).size.width * 0.7 - : MediaQuery.of(context).size.width * 0.13, + controller: _searchStaffController, + txtwidth: ResponsiveLayout.isMobile(context) + ? MediaQuery.of(context).size.width * 0.7 + : MediaQuery.of(context).size.width * 0.13, + ), ), SizedBox(width: 10), ExportBtn( @@ -3476,8 +3523,7 @@ class EnquiryStaffState extends ConsumerState { // Group Header // if (status != 'Proposal Accepted' && // status != 'Proposal Rejected') ...[ - if (status != 'Proposal Accepted' && - status != 'Proposal Rejected') ...[ + if (items.isNotEmpty) ...[ Container( // width: double.infinity, width: MediaQuery.of(context).size.width, @@ -3578,22 +3624,21 @@ class EnquiryStaffState extends ConsumerState { ); }).toList(), - if (isExpanded && items.isEmpty) - if (status != 'Proposal Accepted' && - status != 'Proposal Rejected') - Padding( - padding: EdgeInsets.all(5), - child: Center( - child: Text( - 'No enquiries found', - style: GoogleFonts.inter( - fontSize: 12, - color: Colors.grey, - fontStyle: FontStyle.italic, - ), - ), - ), - ), + // if (isExpanded && items.isEmpty) + // + // Padding( + // padding: EdgeInsets.all(5), + // child: Center( + // child: Text( + // 'No enquiries found', + // style: GoogleFonts.inter( + // fontSize: 12, + // color: Colors.grey, + // fontStyle: FontStyle.italic, + // ), + // ), + // ), + // ), ], ); }).toList(), @@ -3750,22 +3795,22 @@ class EnquiryStaffState extends ConsumerState { // color: Colors.white, // ); // }, - child: Tooltip( - message: - 'Click and Download Enquiry Files', // what appears on hover/long press - waitDuration: const Duration(milliseconds: 500), // optional - showDuration: const Duration(seconds: 2), // optional - child: Container( - padding: EdgeInsets.all(4.0), - margin: EdgeInsets.symmetric(vertical: 3, horizontal: 2), - decoration: BoxDecoration( - color: Color(0xFFF9FAFB), - border: Border.all(color: Color(0xFFE2E8F0)), - borderRadius: BorderRadius.circular(5), - ), - child: Text(item['reg_no'] ?? '-', style: _dataBoldthm3), + // child: Tooltip( + // message: + // 'Click and Download Enquiry Files', // what appears on hover/long press + // waitDuration: const Duration(milliseconds: 500), // optional + // showDuration: const Duration(seconds: 2), // optional + child: Container( + padding: EdgeInsets.all(4.0), + margin: EdgeInsets.symmetric(vertical: 3, horizontal: 2), + decoration: BoxDecoration( + color: Color(0xFFF9FAFB), + border: Border.all(color: Color(0xFFE2E8F0)), + borderRadius: BorderRadius.circular(5), ), + child: Text(item['reg_no'] ?? '-', style: _dataBoldthm3), ), + // ), // child: Text(item['reg_no'] ?? '-', style: _dataBold), // ), ), @@ -3914,58 +3959,75 @@ class EnquiryStaffState extends ConsumerState { Material( color: Colors.white, child: InkWell( - // hoverColor: Color(0xFFEAF6F4), onTap: null, - // onTap: () async { - // setState(() { - // isActionable = true; - // }); - // buildPolicyCreatedStatusActions( - // context, - // item['status'], - // item['id'], - // ); - // }, - child: Tooltip( - message: 'Click to View or Process Enquiry', // - waitDuration: const Duration( - milliseconds: 500, - ), // optional - showDuration: const Duration(seconds: 2), // optional - child: Container( - padding: EdgeInsets.symmetric(vertical: 2.0), - margin: EdgeInsets.symmetric(vertical: 2), - decoration: BoxDecoration( - // color: Color(0xFFF9FAFB), - // border: Border.all(color: Color(0xFFE2E8F0)), - color: bgColor, - border: Border.all(color: borderColor), - borderRadius: BorderRadius.circular(5), - ), + // hoverColor: Color(0xFFEAF6F4), + // onTap: (item['enquiry_status'] == 'Completed') + // ? () async { + // final prefs = + // await SharedPreferences.getInstance(); + // + // // ✅ Remove old value (if any) + // await prefs.remove('enqStaffDataId'); + // + // // ✅ Save the new id + // await prefs.setString( + // 'enqStaffDataId', + // id.toString(), + // ); + // + // // Read it back if needed + // final dynamic? enqStaffDataId = prefs.getString( + // 'enqStaffDataId', + // ); + // + // // ✅ Update provider too + // ref + // .read(quotationStaffIdProvider.notifier) + // .state = + // enqStaffDataId; + // + // buildPolicyCreatedStatusActions( + // context, + // status, + // item['id'], + // ); + // } + // : null, + child: Container( + padding: EdgeInsets.symmetric(vertical: 2.0), + margin: EdgeInsets.symmetric(vertical: 2), + decoration: BoxDecoration( + // color: Color(0xFFF9FAFB), + // border: Border.all(color: Color(0xFFE2E8F0)), + color: bgColor, + border: Border.all(color: borderColor), + borderRadius: BorderRadius.circular(5), + ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - item['enquiry_status'] ?? '-', - // item['status'] ?? '-', - style: GoogleFonts.inter( - fontSize: 10, - color: Color(0XFF1e293b), - // color: statusTextColors[status] ?? Colors.black, - fontWeight: FontWeight.w500, - ), - // overflow: TextOverflow.clip, // + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + item['enquiry_status'] ?? '-', + // item['status'] ?? '-', + style: GoogleFonts.inter( + fontSize: 10, + color: Color(0XFF1e293b), + // color: statusTextColors[status] ?? Colors.black, + fontWeight: FontWeight.w500, ), - ], - ), + // overflow: TextOverflow.clip, // + ), + ], ), ), + // child: Text(item['status'] ?? '-', style: _dataBold), ), ), ], - if (item['enquiry_status'] == 'Assigned') ...[ + if ((item['enquiry_status'] == 'Assigned') && + (item['quotation_id'] != null)) ...[ TextButton( onPressed: () async { final res = await apiService.updateEnquiryInProgress(id); @@ -3974,12 +4036,55 @@ class EnquiryStaffState extends ConsumerState { } print('updateEnquiryInProgress - $res'); }, - child: Text( - 'PROCEED', - style: GoogleFonts.poppins( - fontSize: 11, - fontWeight: FontWeight.w500, - color: Colors.green, + + child: Tooltip( + message: 'Click to Proceed', + waitDuration: const Duration( + milliseconds: 500, + ), // optional + showDuration: const Duration(seconds: 2), + child: Text( + 'PROCEED', + style: GoogleFonts.poppins( + fontSize: 11, + fontWeight: FontWeight.w500, + color: Colors.green, + ), + ), + ), + ), + ], + + if ((item['enquiry_status'] == 'Assigned') && + (item['quotation_id'] == null)) ...[ + TextButton( + onPressed: () async { + var status = item['status']; + var enqId = item['id']; + + final prefs = await SharedPreferences.getInstance(); + + // ✅ Remove old value (if any) + await prefs.remove('enqStaffDataId'); + + // ✅ Save the new id + await prefs.setString('enqStaffDataId', enqId.toString()); + ref.read(quotationStaffIdProvider.notifier).state = enqId; + buildStatusActions(context, status, enqId); + }, + child: Tooltip( + message: 'Click to Create Quote', + waitDuration: const Duration( + milliseconds: 500, + ), // optional + showDuration: const Duration(seconds: 2), + child: Text( + 'Create Quote', + style: GoogleFonts.poppins( + fontSize: 11, + fontWeight: FontWeight.w500, + color: Colors.blue, + ), ), ), ), @@ -4047,7 +4152,10 @@ class EnquiryStaffState extends ConsumerState { SizedBox( height: 30, width: 120, - child: (item['status'] == 'Awaiting Proposal') + child: + ((item['enquiry_status'] == 'To be assigned') || + ((item['enquiry_status'] == 'Assigned') && + (item['quotation_id'] == null))) ? Text('-') : Builder( builder: (cellContext) => @@ -4237,7 +4345,10 @@ class EnquiryStaffState extends ConsumerState { SizedBox( width: 120, height: 30, - child: (item['status'] == 'Awaiting Proposal') + child: + ((item['enquiry_status'] == 'To be assigned') || + ((item['enquiry_status'] == 'Assigned') && + (item['quotation_id'] == null))) ? Text('-') : Builder( builder: (cellContext) => DropdownSearch>( @@ -4440,14 +4551,19 @@ class EnquiryStaffState extends ConsumerState { SizedBox( height: 30, width: 90, - child: (item['status'] == 'Awaiting Proposal') + child: + ((item['enquiry_status'] == 'To be assigned') || + ((item['enquiry_status'] == 'Assigned') && + (item['quotation_id'] == null))) ? Text('-') : ThemedUploadField( + // key: ValueKey(selectedFileNames), // hintText: item['policy_pdf_file_name'] ?? "Upload Document", hintText: selectedFileNames ?? item['policy_pdf_file_name'] ?? "Upload Document", + // txtheight: 30, padHorizontal: 4, padVertical: 5, @@ -4463,6 +4579,36 @@ class EnquiryStaffState extends ConsumerState { onFileSelected: (fileName, file) async { print("Picked file: $fileName (${file.size} bytes)"); + if (lastPickedFile == fileName) { + print("❌ Cancel clicked. Ignoring old file."); + setState(() { + print('Clear Fields'); + selectedFileNames = null; // clears the field + docUploadedFile = null; + print('Clear Fields - 1'); + }); + // refrshfilterDateRange(); + return; + } + + lastPickedFile = fileName; + + // setState(() { + // docUploadedFile = null; + // selectedFileNames = null; + // }); + + // ❗ User canceled picker + if (file == null || + fileName == null || + fileName.isEmpty || + file.size == 0) { + print("❌ File selection canceled. No upload."); + return; + } + + print("Picked file: $fileName (${file.size} bytes)"); + if (!fileName.toLowerCase().endsWith('.pdf')) { ToastHelper.showErrorToast( context, @@ -4488,7 +4634,7 @@ class EnquiryStaffState extends ConsumerState { "manager_id": managerId, "created_by": userId, "updated_by": userId, - // "id": item["id"], // ONLY while updating + "id": item["policy_id"], // ONLY while updating }, ); // if (selectedBrokerName == 'Nhance') { @@ -4566,13 +4712,13 @@ class EnquiryStaffState extends ConsumerState { List _buildDataColumns() { return [ DataColumn(label: Text('Received Date', style: _headerStyle)), - DataColumn(label: Text('Assigned To *', style: _headerStyle)), - DataColumn(label: Text('Partner *', style: _headerStyle)), + DataColumn(label: Text('Assigned To', style: _headerStyle)), + DataColumn(label: Text('Partner', style: _headerStyle)), // const DataColumn(label: Text('Broker *', style: _headerStyle)), - DataColumn(label: Text('Insurer *', style: _headerStyle)), - DataColumn(label: Text('Insured Name *', style: _headerStyle)), - DataColumn(label: Text('Vehicle No *', style: _headerStyle)), + DataColumn(label: Text('Insurer', style: _headerStyle)), + DataColumn(label: Text('Insured Name', style: _headerStyle)), + DataColumn(label: Text('Vehicle No', style: _headerStyle)), DataColumn(label: Text('Action', style: _headerStyle)), DataColumn(label: Text('Status', style: _headerStyle)), // const DataColumn(label: Text('Assigned Date', style: _headerStyle)), @@ -4590,13 +4736,13 @@ class EnquiryStaffState extends ConsumerState { child: Row( children: [ _buildHeaderCell('Received Date', 110), - _buildHeaderCell('Assigned To *', 130), - _buildHeaderCell('Partner *', 100), + _buildHeaderCell('Assigned To', 130), + _buildHeaderCell('Partner', 100), // _buildHeaderCell('Broker *', 100), - _buildHeaderCell('Insurer *', 90), - _buildHeaderCell('Insured Name *', 110), - _buildHeaderCell('Vehicle No *', 90), + _buildHeaderCell('Insurer', 90), + _buildHeaderCell('Insured Name', 110), + _buildHeaderCell('Vehicle No ', 90), _buildHeaderCell('Action', 110), _buildHeaderCell('Status', 100), // _buildHeaderCell('Assigned Date', 100), @@ -4670,7 +4816,7 @@ class EnquiryStaffState extends ConsumerState { return Container( padding: const EdgeInsets.symmetric(vertical: 4), decoration: const BoxDecoration( - color: Colors.white, + // color: Colors.white, // color: Colors.amber, // border: Border(bottom: BorderSide(color: Color(0xFFE5E5E5), width: 1)), ), @@ -4691,14 +4837,22 @@ class EnquiryStaffState extends ConsumerState { curve: Curves.easeOut, padding: const EdgeInsets.symmetric( vertical: 5, - horizontal: 20, + horizontal: 10, ), - margin: const EdgeInsets.only(right: 24), + + // margin: const EdgeInsets.only(right: 24), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6), + // borderRadius: BorderRadius.circular(6), color: isSelected + // ? Color(0xFFF1F5F9) ? const Color(0xFF2E7D6E).withOpacity(0.08) : Colors.transparent, + border: Border.all( + color: isSelected + ? Colors.transparent + : Colors.blueGrey.shade50, + width: 1, + ), ), child: Column( // mainAxisSize: MainAxisSize.min, @@ -4707,20 +4861,22 @@ class EnquiryStaffState extends ConsumerState { enquiryTabs[index], style: GoogleFonts.poppins( fontSize: 12, - fontWeight: FontWeight.w600, + fontWeight: isSelected + ? FontWeight.w600 + : FontWeight.w400, color: isSelected ? const Color(0xFF2E7D6E) : Colors.black87, ), ), - // const SizedBox(height: 3), + const SizedBox(height: 1), // ▬▬ Underline Indicator ▬▬ AnimatedContainer( duration: const Duration(milliseconds: 250), - height: 3, - width: isSelected ? 40 : 0, + height: 2, + width: isSelected ? 90 : 0, decoration: BoxDecoration( color: const Color(0xFF2E7D6E), borderRadius: BorderRadius.circular(50), diff --git a/lib/presentation/screens/staff/Enquiry/raise_enq_form.dart b/lib/presentation/screens/staff/Enquiry/raise_enq_form.dart index fe69e60..c9ba735 100644 --- a/lib/presentation/screens/staff/Enquiry/raise_enq_form.dart +++ b/lib/presentation/screens/staff/Enquiry/raise_enq_form.dart @@ -367,6 +367,7 @@ class RaiseEnqFormState extends ConsumerState { padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 25), decoration: BoxDecoration( color: Colors.white, + // color: Colors.amber, borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( @@ -647,12 +648,12 @@ class RaiseEnqFormState extends ConsumerState { return filteredInsurersData; } return filteredInsurersData.where((item) { - return item['name'].toString().toLowerCase().contains( + return item['short_name'].toString().toLowerCase().contains( filter.toLowerCase(), ); }).toList(); }, - itemAsString: (val) => val['name'].toString(), // what to show + itemAsString: (val) => val['short_name'].toString(), // what to show compareFn: (item, selectedItem) => item['id'] == selectedItem['id'], // ✅ compare by id validator: (val) { @@ -678,7 +679,9 @@ class RaiseEnqFormState extends ConsumerState { dropdownBuilder: (context, selectedItem) => Align( alignment: Alignment.centerLeft, child: Text( - selectedItem != null ? selectedItem['name'].toString() : "", + selectedItem != null + ? selectedItem['short_name'].toString() + : "", style: GoogleFonts.poppins(fontSize: 11, color: Colors.black), overflow: TextOverflow.ellipsis, maxLines: 1, @@ -757,7 +760,7 @@ class RaiseEnqFormState extends ConsumerState { vertical: 3, ), child: Text( - item['name'].toString(), + item['short_name'].toString(), style: GoogleFonts.inter(fontSize: 12, color: Colors.black), ), ); @@ -767,7 +770,7 @@ class RaiseEnqFormState extends ConsumerState { onChanged: (val) { if (val != null) { - print("Selected Insurer : ${val['name']}"); + print("Selected Insurer : ${val['short_name']}"); print("Id: ${val['id']}"); selectedInsurer = val['id']; // controllers['agentId']?.text = val['agent_code']; diff --git a/lib/presentation/screens/staff/Enquiry/staff_policy.dart b/lib/presentation/screens/staff/Enquiry/staff_policy.dart index 7b3764f..3e763a6 100644 --- a/lib/presentation/screens/staff/Enquiry/staff_policy.dart +++ b/lib/presentation/screens/staff/Enquiry/staff_policy.dart @@ -322,23 +322,29 @@ class PolicyStaffEnqListState extends ConsumerState { if (response['status'] == 'success') { print('quoationListData - ${response['data']}'); + final data = response['data']; setState(() { - enquiryData = Map.from(response['data']['enquiry']); - print('enquiryData - ${enquiryData}'); - + enquiryData = Map.from(data['enquiry']); + print('ra-1'); + quotationData = List>.from(data['quotations']); + print('ra-2'); + policyData = Map.from(data['policies']); + print('ra-3'); + // enquiryData = Map.from(response['data']['enquiry']); + // print('enquiryData - ${enquiryData}'); + updatePolicyData(policyData); updateEnquiryData(enquiryData); // quotationData = List>.from(response['data']); - quotationData = List>.from( - response['data']['quotations'], - ); + // quotationData = List>.from( + // response['data']['quotations'], + // ); print('quotationData - ${quotationData}'); updateQuotationData(quotationData); - policyData = Map.from(response['data']['policies']); + // policyData = Map.from(response['data']['policies']); print('policyData - ${policyData}'); - updatePolicyData(policyData); originalData = quotationData; filteredData = List.from(originalData); // print('originalData - $getClaimPolicies'); @@ -475,11 +481,12 @@ class PolicyStaffEnqListState extends ConsumerState { setState(() { controllers["insurer"]?.text = quotationAcceptedData?['insurer_name']; acceptedQuotationId = quotationAcceptedData?['id']?.toString() ?? ''; + controllers["idv"]?.text = quotationAcceptedData?['insured_declared_value']?.toString() ?? ''; - controllers["premium_amount"]?.text = - quotationAcceptedData?['premium_amount']?.toString() ?? ''; + // controllers["premium_amount"]?.text = + // quotationAcceptedData?['premium_amount']?.toString() ?? ''; controllers["planType"]?.text = quotationAcceptedData?['insurance_plan_type']?.toString() ?? ''; controllers["policyPaymentMode"]?.text = @@ -512,6 +519,9 @@ class PolicyStaffEnqListState extends ConsumerState { setState(() { hasPolicyData = true; + selectedAgent = policyData['agent_id']?.toString() ?? ''; + selectedPaymentMode = policyData['payment_mode_id']?.toString() ?? ''; + acceptedQuotationId = policyData['quotation_id']?.toString() ?? ''; choosedPolcyId = policyData['id']?.toString() ?? ''; controllers["policyInsName"]?.text = policyData['insured_name']?.toString() ?? ''; @@ -548,6 +558,37 @@ class PolicyStaffEnqListState extends ConsumerState { controllers["premiumTOT"]?.text = policyData['premium_amount']?.toString() ?? ''; + controllers["make"]?.text = policyData['make']?.toString() ?? ''; + controllers["model"]?.text = policyData['model']?.toString() ?? ''; + controllers["vehicle_type"]?.text = + policyData['vehicle_type']?.toString() ?? ''; + controllers["fuel_type"]?.text = + policyData['fuel_type']?.toString() ?? ''; + controllers["engine_no"]?.text = + policyData['engine_no']?.toString() ?? ''; + controllers["chassis_no"]?.text = + policyData['chassis_no']?.toString() ?? ''; + controllers["cubic_capacity"]?.text = + policyData['cubic_capacity']?.toString() ?? ''; + controllers["weight"]?.text = policyData['weight']?.toString() ?? ''; + controllers["year_of_manufacture"]?.text = + policyData['year_of_manufacture']?.toString() ?? ''; + controllers["date_of_registration"]?.text = fixInvalidDate( + policyData['date_of_registration'], + ); + controllers["rto_state_code"]?.text = fixInvalidDate( + policyData['rto_state_code'], + ); + controllers["rto_city_code"]?.text = fixInvalidDate( + policyData['rto_city_code'], + ); + controllers["commission_amount"]?.text = fixInvalidDate( + policyData['commission_amount'], + ); + controllers["commission_applied_rule"]?.text = fixInvalidDate( + policyData['commission_applied_rule'], + ); + selectedBroker = policyData['broker_id'] ?? ''; selectedBrokerName = policyData['broker_name'] ?? ''; // RC FILE @@ -960,9 +1001,34 @@ class PolicyStaffEnqListState extends ConsumerState { Widget build(BuildContext context) { return AlertDialog( backgroundColor: Color(0xfff8fafc), + contentPadding: const EdgeInsets.fromLTRB(24.0, 2.0, 24.0, 24.0), + titlePadding: const EdgeInsets.fromLTRB(24.0, 4.0, 24.0, 2.0), + title: Container( + // color: Colors.blue, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Policy', + style: GoogleFonts.poppins( + fontSize: 14, + // color: Color(0xFF2E7D6E), + fontWeight: FontWeight.w600, + ), + ), + IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: Icon(Icons.close, size: 18), + ), + ], + ), + ), content: Container( - width: MediaQuery.of(context).size.width, + // color: Colors.amber, + width: MediaQuery.of(context).size.width * 0.9, height: MediaQuery.of(context).size.height, child: SingleChildScrollView( scrollDirection: Axis.vertical, @@ -1191,23 +1257,17 @@ class PolicyStaffEnqListState extends ConsumerState { SizedBox(width: 20), buildPremiumAmount(context), SizedBox(width: 20), + Paymentmode(context), + SizedBox(width: 20), + buildInsurer(context), ], ), Row( children: [ - Paymentmode(context), - SizedBox(width: 20), - buildInsurer(context), - SizedBox(width: 20), buildAgentName(context), SizedBox(width: 20), buildBroker(context), SizedBox(width: 20), - ], - ), - - Row( - children: [ policyissuedate(context), SizedBox(width: 20), policystartdate(context), @@ -1218,7 +1278,7 @@ class PolicyStaffEnqListState extends ConsumerState { ], ), ), - SizedBox(height: 10), + SizedBox(height: 20), Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), decoration: BoxDecoration( @@ -1233,39 +1293,53 @@ class PolicyStaffEnqListState extends ConsumerState { ), ], ), - child: Row( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Premium Breakdown', style: headingSTyles), + Row( + children: [Text('Premium Breakdown', style: headingSTyles)], + ), Divider(thickness: 0.1, color: Color(0xFF2E7D6E)), - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - buildThirdParty(context), - buildOwnDamage(context), - buildPersonalAccident(context), - ], - ), + Container( + // color: Colors.blue.shade100, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + // color: Colors.amber, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildThirdParty(context), + buildOwnDamage(context), + buildPersonalAccident(context), + ], + ), + ), - SizedBox(width: 20), - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - buildCGST(context), - buildSGST(context), - buildIGST(context), - buildPremiumTotal(context), - ], + SizedBox(width: 20), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildCGST(context), + buildSGST(context), + buildIGST(context), + buildPremiumTotal(context), + ], + ), + ], + ), ), ], ), ), - SizedBox(height: 10), + SizedBox(height: 20), Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), decoration: BoxDecoration( @@ -1290,95 +1364,111 @@ class PolicyStaffEnqListState extends ConsumerState { crossAxisAlignment: CrossAxisAlignment.start, children: [ buildMake(context), + SizedBox(width: 20), buildModel(context), + SizedBox(width: 20), buildVehicleType(context), + SizedBox(width: 20), buildFuelType(context), - ], - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + SizedBox(width: 20), buildEngineNo(context), + SizedBox(width: 20), buildChassisNo(context), - buildCubicCapacity(context), - buildWeight(context), ], ), + SizedBox(height: 10), Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ + buildCubicCapacity(context), + SizedBox(width: 20), + buildWeight(context), + SizedBox(width: 20), buildYearOfManufacture(context), + SizedBox(width: 20), buildDateOfRegistration(context), ], ), ], ), ), - SizedBox(height: 10), - Container( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - // border: Border.all(color: const Colors.bla), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.2), - blurRadius: 4, - offset: const Offset(0, 2), + SizedBox(height: 20), + + Row( + children: [ + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 14, ), - ], - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('RTO Details', style: headingSTyles), - Divider(thickness: 0.1, color: Color(0xFF2E7D6E)), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - buildRTOStateCode(context), - buildRTOCityCode(context), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + // border: Border.all(color: const Colors.bla), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + blurRadius: 4, + offset: const Offset(0, 2), + ), ], ), - ], - ), - ), - SizedBox(height: 10), - Container( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - // border: Border.all(color: const Colors.bla), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.2), - blurRadius: 4, - offset: const Offset(0, 2), - ), - ], - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('Commission Details', style: headingSTyles), - Divider(thickness: 0.1, color: Color(0xFF2E7D6E)), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - buildCommissonAmount(context), - buildCommissonAppliedRule(context), + Text('RTO Details', style: headingSTyles), + Divider(thickness: 0.1, color: Color(0xFF2E7D6E)), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildRTOStateCode(context), + SizedBox(width: 20), + buildRTOCityCode(context), + ], + ), ], ), - ], - ), + ), + SizedBox(width: 20), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 14, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + // border: Border.all(color: const Colors.bla), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Commission Details', style: headingSTyles), + Divider(thickness: 0.1, color: Color(0xFF2E7D6E)), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildCommissonAmount(context), + SizedBox(width: 20), + buildCommissonAppliedRule(context), + ], + ), + ], + ), + ), + ], ), - SizedBox(height: 10), + Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -2513,7 +2603,7 @@ class PolicyStaffEnqListState extends ConsumerState { Widget buildThirdParty(BuildContext context) { return Row( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( @@ -2521,23 +2611,26 @@ class PolicyStaffEnqListState extends ConsumerState { child: Text('Third Party', style: _textStyle), ), SizedBox(width: 20), - ThemedFormField( - controller: controllers['tp']!, - // backgroundColor: Color(0xffEDF6F5), - errorBorderColor: Color(0xffEDF6F5), - hintText: '0', - // validator: (value) => Validators.requiredField(value, "Third Party"), - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), - ], - // onChanged: (value) => calculateAmount(), - onChanged: (v) { - print('pa onChanged -> $v'); // should show on every keystroke - calculateAmount(); - }, - txtwidth: ResponsiveLayout.isMobile(context) - ? null - : MediaQuery.of(context).size.width * 0.14, + SizedBox( + height: 35, + child: ThemedFormField( + controller: controllers['tp']!, + // backgroundColor: Color(0xffEDF6F5), + errorBorderColor: Color(0xffEDF6F5), + hintText: '0', + // validator: (value) => Validators.requiredField(value, "Third Party"), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), + ], + // onChanged: (value) => calculateAmount(), + onChanged: (v) { + print('pa onChanged -> $v'); // should show on every keystroke + calculateAmount(); + }, + txtwidth: ResponsiveLayout.isMobile(context) + ? null + : MediaQuery.of(context).size.width * 0.12, + ), ), ], ); @@ -2549,23 +2642,26 @@ class PolicyStaffEnqListState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( - width: MediaQuery.of(context).size.width * 0.15, + width: MediaQuery.of(context).size.width * 0.12, child: Text('Own Damage ', style: _textStyle), ), SizedBox(width: 20), - ThemedFormField( - controller: controllers['od']!, - // backgroundColor: Color(0xffEDF6F5), - errorBorderColor: Color(0xffEDF6F5), - hintText: '0', - // validator: (value) => Validators.requiredField(value, "OwnDamage"), - onChanged: (value) => calculateAmount(), - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), - ], - txtwidth: ResponsiveLayout.isMobile(context) - ? null - : MediaQuery.of(context).size.width * 0.14, + SizedBox( + height: 35, + child: ThemedFormField( + controller: controllers['od']!, + // backgroundColor: Color(0xffEDF6F5), + errorBorderColor: Color(0xffEDF6F5), + hintText: '0', + // validator: (value) => Validators.requiredField(value, "OwnDamage"), + onChanged: (value) => calculateAmount(), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), + ], + txtwidth: ResponsiveLayout.isMobile(context) + ? null + : MediaQuery.of(context).size.width * 0.12, + ), ), ], ); @@ -2577,24 +2673,27 @@ class PolicyStaffEnqListState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( - width: MediaQuery.of(context).size.width * 0.15, + width: MediaQuery.of(context).size.width * 0.12, child: Text('Personal Accident', style: _textStyle), ), SizedBox(width: 20), - ThemedFormField( - controller: controllers['pa']!, - // backgroundColor: Color(0xffEDF6F5), - errorBorderColor: Color(0xffEDF6F5), - hintText: '0', - onChanged: (value) => calculateAmount(), - // validator: (value) => - // Validators.requiredField(value, "PersonalAccident"), - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), - ], - txtwidth: ResponsiveLayout.isMobile(context) - ? null - : MediaQuery.of(context).size.width * 0.14, + SizedBox( + height: 35, + child: ThemedFormField( + controller: controllers['pa']!, + // backgroundColor: Color(0xffEDF6F5), + errorBorderColor: Color(0xffEDF6F5), + hintText: '0', + onChanged: (value) => calculateAmount(), + // validator: (value) => + // Validators.requiredField(value, "PersonalAccident"), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), + ], + txtwidth: ResponsiveLayout.isMobile(context) + ? null + : MediaQuery.of(context).size.width * 0.12, + ), ), ], ); @@ -2606,22 +2705,25 @@ class PolicyStaffEnqListState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( - width: MediaQuery.of(context).size.width * 0.15, + width: MediaQuery.of(context).size.width * 0.12, child: Text('CGST', style: _textStyle), ), SizedBox(width: 20), - ThemedFormField( - controller: controllers['cgst']!, - // backgroundColor: Color(0xffEDF6F5), - errorBorderColor: Color(0xffEDF6F5), - hintText: '0', - validator: (value) => Validators.requiredField(value, "CGST"), - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), - ], - txtwidth: ResponsiveLayout.isMobile(context) - ? null - : MediaQuery.of(context).size.width * 0.14, + SizedBox( + height: 35, + child: ThemedFormField( + controller: controllers['cgst']!, + // backgroundColor: Color(0xffEDF6F5), + errorBorderColor: Color(0xffEDF6F5), + hintText: '0', + validator: (value) => Validators.requiredField(value, "CGST"), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), + ], + txtwidth: ResponsiveLayout.isMobile(context) + ? null + : MediaQuery.of(context).size.width * 0.14, + ), ), ], ); @@ -2633,22 +2735,25 @@ class PolicyStaffEnqListState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( - width: MediaQuery.of(context).size.width * 0.15, + width: MediaQuery.of(context).size.width * 0.12, child: Text('SGST', style: _textStyle), ), SizedBox(width: 20), - ThemedFormField( - controller: controllers['sgst']!, - // backgroundColor: Color(0xffEDF6F5), - errorBorderColor: Color(0xffEDF6F5), - hintText: '0', - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), - ], - validator: (value) => Validators.requiredField(value, "SGST"), - txtwidth: ResponsiveLayout.isMobile(context) - ? null - : MediaQuery.of(context).size.width * 0.14, + SizedBox( + height: 35, + child: ThemedFormField( + controller: controllers['sgst']!, + // backgroundColor: Color(0xffEDF6F5), + errorBorderColor: Color(0xffEDF6F5), + hintText: '0', + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), + ], + validator: (value) => Validators.requiredField(value, "SGST"), + txtwidth: ResponsiveLayout.isMobile(context) + ? null + : MediaQuery.of(context).size.width * 0.14, + ), ), ], ); @@ -2660,22 +2765,25 @@ class PolicyStaffEnqListState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( - width: MediaQuery.of(context).size.width * 0.15, + width: MediaQuery.of(context).size.width * 0.12, child: Text('IGST', style: _textStyle), ), SizedBox(width: 20), - ThemedFormField( - controller: controllers['igst']!, - // backgroundColor: Color(0xffEDF6F5), - errorBorderColor: Color(0xffEDF6F5), - hintText: '0', - validator: (value) => Validators.requiredField(value, "IGST"), - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), - ], - txtwidth: ResponsiveLayout.isMobile(context) - ? null - : MediaQuery.of(context).size.width * 0.14, + SizedBox( + height: 35, + child: ThemedFormField( + controller: controllers['igst']!, + // backgroundColor: Color(0xffEDF6F5), + errorBorderColor: Color(0xffEDF6F5), + hintText: '0', + validator: (value) => Validators.requiredField(value, "IGST"), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), + ], + txtwidth: ResponsiveLayout.isMobile(context) + ? null + : MediaQuery.of(context).size.width * 0.14, + ), ), ], ); @@ -2687,22 +2795,25 @@ class PolicyStaffEnqListState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( - width: MediaQuery.of(context).size.width * 0.15, + width: MediaQuery.of(context).size.width * 0.12, child: Text('Total Premium *', style: _textStyle), ), SizedBox(width: 20), - ThemedFormField( - controller: controllers['premiumTOT']!, - // backgroundColor: Color(0xffEDF6F5), - errorBorderColor: Color(0xffEDF6F5), - hintText: '0', - validator: (value) => Validators.requiredField(value, "premium"), - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), - ], - txtwidth: ResponsiveLayout.isMobile(context) - ? null - : MediaQuery.of(context).size.width * 0.14, + SizedBox( + height: 35, + child: ThemedFormField( + controller: controllers['premiumTOT']!, + // backgroundColor: Color(0xffEDF6F5), + errorBorderColor: Color(0xffEDF6F5), + hintText: '0', + validator: (value) => Validators.requiredField(value, "premium"), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')), + ], + txtwidth: ResponsiveLayout.isMobile(context) + ? null + : MediaQuery.of(context).size.width * 0.14, + ), ), ], ); @@ -3020,13 +3131,13 @@ class PolicyStaffEnqListState extends ConsumerState { } } - static final _textStyle = GoogleFonts.inter( + static final _textStyle = GoogleFonts.poppins( fontSize: 11, color: Color(0XFF334155), fontWeight: FontWeight.w500, ); - static final headingSTyles = GoogleFonts.inter( + static final headingSTyles = GoogleFonts.poppins( fontSize: 12.5, // color: Color(0XFF334155), color: Color(0xFF2E7D6E), diff --git a/lib/presentation/screens/staff/Enquiry/tabs/createQuotation.dart b/lib/presentation/screens/staff/Enquiry/tabs/createQuotation.dart index 6be7e41..7db20c8 100644 --- a/lib/presentation/screens/staff/Enquiry/tabs/createQuotation.dart +++ b/lib/presentation/screens/staff/Enquiry/tabs/createQuotation.dart @@ -77,6 +77,10 @@ class CreateProposalFormState extends ConsumerState { final GlobalKey>> dropDownKeyBroker = GlobalKey>>(); + final GlobalKey>> + dropDownKeyInsurerEnqAsgn = + GlobalKey>>(); + final GlobalKey>> dropDownKeyInsurer = GlobalKey>>(); @@ -104,8 +108,8 @@ class CreateProposalFormState extends ConsumerState { final data = { "enquiry_id": widget.selectedEnquiryId, "insured_declared_value": controllers["idv"]?.text, - "insurer_id": widget.selectedInsurdId, - // "insurer_id": selectedInsurer, + // "insurer_id": widget.selectedInsurdId, + "insurer_id": selectedInsurer, "premium_amount": controllers["premium_Amount"]?.text, "insurance_plan_type_id": selectedInsPlanType, "payment_mode_id": selectedPaymentMode, @@ -129,7 +133,7 @@ class CreateProposalFormState extends ConsumerState { _initializeToken(); getInsuranceType(); getPaymentMode(); - // getInsurers(); + getInsurers(); updateData(); getBroker(); } @@ -207,6 +211,10 @@ class CreateProposalFormState extends ConsumerState { } void updateData() { + selectedInsurer = widget.selectedInsurdId; + print('QuickselectedInsurer - $selectedInsurer'); + print('QuickselectedEnquiryId - ${widget.selectedEnquiryId}'); + if (widget.selectedQuotationFrmListId != null && widget.selectedQuotationFrmListdata!.isNotEmpty) { print('checkData -- ${widget.selectedQuotationFrmListdata}'); @@ -223,6 +231,7 @@ class CreateProposalFormState extends ConsumerState { selectedInsPlanType = widget .selectedQuotationFrmListdata!['insurance_plan_type_id'] ?.toString(); + selectedBroker = widget.selectedQuotationFrmListdata!['broker_id'] ?.toString(); @@ -232,8 +241,8 @@ class CreateProposalFormState extends ConsumerState { // controllers["insurer"]?.text = 'LIC'; - // selectedInsurer = - // widget.selectedQuotationFrmListdata!['insurer_id']?.toString() ?? ''; + selectedInsurer = widget.selectedInsurdId; + // widget.selectedQuotationFrmListdata!['insurer_id']?.toString() ?? ''; String? apiDocPath = widget.selectedQuotationFrmListdata!["policy_pdf_file_name"]; @@ -500,7 +509,7 @@ class CreateProposalFormState extends ConsumerState { // 🔹 Switch content dynamically Container( width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height * 0.525, + // height: MediaQuery.of(context).size.height * 0.525, child: buildFormFields(context), ), ], @@ -516,9 +525,9 @@ class CreateProposalFormState extends ConsumerState { crossAxisAlignment: CrossAxisAlignment.end, children: [ - buildIdv(context), + // buildIdv(context), + buildInsurer(context), Spacer(), - // buildInsurer(context), buildInsurancePlanType(context), Spacer(), buildPremiumAmnt(context), @@ -534,21 +543,47 @@ class CreateProposalFormState extends ConsumerState { // ), ], ), - SizedBox(height: 10), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - - children: [ - buildPaymentMode(context), - Spacer(), - // buildInsurer(context), - buildBroker(context), - Spacer(), - buildDocuments(context), Spacer(), - ], - ), + // SizedBox(height: 10), + // Row( + // crossAxisAlignment: CrossAxisAlignment.end, + // + // children: [ + // buildPaymentMode(context), + // Spacer(), + // // buildInsurer(context), + // buildBroker(context), + // Spacer(), + // // buildDocuments(context), + // GestureDetector( + // onTap: () { + // handleDone(); + // // widget.onSubmit(controller.text.trim()); + // // Navigator.of(context).pop(); + // }, + // child: Container( + // padding: const EdgeInsets.symmetric( + // horizontal: 25.0, + // vertical: 10, + // ), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(8.0), + // color: const Color(0xFF2E7D6E), + // ), + // child: Text( + // 'Save', + // style: GoogleFonts.poppins( + // color: Colors.white, + // fontSize: 12, + // fontWeight: FontWeight.w500, + // ), + // ), + // ), + // ), + // Spacer(), + // ], + // ), SizedBox(height: 10), Row( mainAxisAlignment: MainAxisAlignment.end, @@ -566,14 +601,14 @@ class CreateProposalFormState extends ConsumerState { ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8.0), - color: const Color(0xFF425B5B), + color: const Color(0xFF2E7D6E), ), child: Text( 'Save', style: GoogleFonts.poppins( color: Colors.white, fontSize: 12, - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w500, ), ), ), @@ -607,8 +642,8 @@ class CreateProposalFormState extends ConsumerState { // readOnly: true, txtwidth: ResponsiveLayout.isMobile(context) ? null - : MediaQuery.of(context).size.width * 0.18, - // txtheight: 35, + : MediaQuery.of(context).size.width * 0.12, + txtheight: 40, ), ], ); @@ -632,8 +667,8 @@ class CreateProposalFormState extends ConsumerState { // validator: (value) => Validators.number(value, "PremiumAmount "), txtwidth: ResponsiveLayout.isMobile(context) ? null - : MediaQuery.of(context).size.width * 0.18, - // txtheight: 35, + : MediaQuery.of(context).size.width * 0.12, + txtheight: 40, ), ], ); @@ -654,7 +689,7 @@ class CreateProposalFormState extends ConsumerState { color: Colors.white, width: ResponsiveLayout.isMobile(context) ? null - : MediaQuery.of(context).size.width * 0.18, + : MediaQuery.of(context).size.width * 0.12, // height: 35, child: DropdownSearch>( key: dropDownKey, @@ -753,10 +788,11 @@ class CreateProposalFormState extends ConsumerState { ), child: Text( item['insurance_plan_type'].toString(), - style: GoogleFonts.inter(fontSize: 12, color: Colors.black), + style: GoogleFonts.inter(fontSize: 11, color: Colors.black), ), ); }, + // searchFieldProps: TextFieldProps( // decoration: InputDecoration( // filled: true, @@ -793,6 +829,168 @@ class CreateProposalFormState extends ConsumerState { ); } + Widget buildInsurer(BuildContext context) { + Map? selectedInsurerd = filteredInsurersData.firstWhere( + (item) => item['id'].toString() == widget.selectedInsurdId, + // (item) => item['id'].toString() == selectedInsurer, + orElse: () => {}, + ); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Insurer *', style: _textStyle), + + SizedBox(height: 5), + Container( + // height: 30, + width: MediaQuery.of(context).size.width * 0.12, + child: DropdownSearch>( + key: dropDownKeyInsurerEnqAsgn, + selectedItem: selectedInsurerd.isNotEmpty ? selectedInsurerd : null, + // items: (filter, infiniteScrollProps) { + // return filteredInsurersData; + // }, + // 👇 Enable async filtering based on user input + items: (filter, infiniteScrollProps) async { + if (filter.isEmpty) { + return filteredInsurersData; + } + return filteredInsurersData.where((item) { + return item['short_name'].toString().toLowerCase().contains( + filter.toLowerCase(), + ); + }).toList(); + }, + itemAsString: (val) => val['short_name'].toString(), // what to show + compareFn: (item, selectedItem) => + item['id'] == selectedItem['id'], // ✅ compare by id + validator: (val) { + if (val == null) { + return "Required"; // ✅ error message + } + return null; + }, + suffixProps: DropdownSuffixProps( + // make sure the dropdown button is visible + dropdownButtonProps: DropdownButtonProps( + isVisible: true, + padding: EdgeInsets.zero, // remove default padding + constraints: const BoxConstraints( + // shrink icon tap area + minWidth: 12, + minHeight: 12, + ), + iconSize: 15, // smaller icon + // icon: const Icon(Icons.arrow_drop_down), + ), + ), + dropdownBuilder: (context, selectedItem) => Align( + alignment: Alignment.centerLeft, + child: Text( + selectedItem != null + ? selectedItem['short_name'].toString() + : "", + style: GoogleFonts.poppins(fontSize: 11, color: Colors.black), + overflow: TextOverflow.ellipsis, + maxLines: 1, + softWrap: false, + ), + ), + decoratorProps: DropDownDecoratorProps( + decoration: + AppInputDecorations.dropdownDecoration( + label: "Insurer", + ).copyWith( + filled: true, + fillColor: + Colors.white, // 👈 makes the dropdown input white + isDense: true, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(5), + borderSide: const BorderSide( + color: Color(0xFFE2E8F0), + width: 0.5, + ), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(5), + borderSide: const BorderSide( + color: Color(0xFFE2E8F0), + width: 0.5, + ), + ), + contentPadding: EdgeInsets.symmetric( + horizontal: 8, + vertical: 6, + ), + ), + ), + + popupProps: PopupProps.menu( + fit: FlexFit.loose, + searchDelay: Duration(milliseconds: 200), + constraints: BoxConstraints(maxHeight: 250), + menuProps: MenuProps( + backgroundColor: + Colors.white, // 👈 sets dropdown background to white + ), + showSearchBox: true, + searchFieldProps: TextFieldProps( + autofocus: true, + decoration: InputDecoration( + contentPadding: EdgeInsets.all(1), + filled: true, + fillColor: Colors.white, + hintText: "Search Insurer...", + hintStyle: GoogleFonts.inter( + fontSize: 11, + color: Colors.black, + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.white, + ), // 👈 Normal border + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.white, + width: 1.5, + ), // 👈 Focused border + ), + ), + ), + + itemBuilder: (context, item, isDisabled, isSelected) { + return Container( + // color: isSelected ? Colors.blue.withOpacity(0.1) : null, + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 3, + ), + child: Text( + item['short_name'].toString(), + style: GoogleFonts.inter(fontSize: 12, color: Colors.black), + ), + ); + }, + // constraints: BoxConstraints(), + ), + + onChanged: (val) { + if (val != null) { + print("Selected Insurer : ${val['short_name']}"); + print("Id: ${val['id']}"); + selectedInsurer = val['id']; + // controllers['agentId']?.text = val['agent_code']; + // agentId = agent['id']; + } + }, + ), + ), + ], + ); + } + Widget buildPaymentMode(context) { Map? selectedVehicle = filteredPaymentModeData.firstWhere( (item) => item['id'].toString() == selectedPaymentMode, @@ -808,7 +1006,7 @@ class CreateProposalFormState extends ConsumerState { color: Colors.white, width: ResponsiveLayout.isMobile(context) ? null - : MediaQuery.of(context).size.width * 0.18, + : MediaQuery.of(context).size.width * 0.12, // height: 35, child: DropdownSearch>( key: dropDownSelectPaymentModeKey, @@ -942,7 +1140,7 @@ class CreateProposalFormState extends ConsumerState { color: Colors.white, width: ResponsiveLayout.isMobile(context) ? null - : MediaQuery.of(context).size.width * 0.18, + : MediaQuery.of(context).size.width * 0.12, // height: 35, child: DropdownSearch>( key: dropDownKeyBroker, diff --git a/lib/presentation/screens/staff/Enquiry/tabs/quotationTab.dart b/lib/presentation/screens/staff/Enquiry/tabs/quotationTab.dart index 79a4592..6088f48 100644 --- a/lib/presentation/screens/staff/Enquiry/tabs/quotationTab.dart +++ b/lib/presentation/screens/staff/Enquiry/tabs/quotationTab.dart @@ -168,8 +168,10 @@ class QuotationStaffTabState extends ConsumerState { if (!mounted) return; setState(() { selectedInsurdId = enquiryData['insurer_id']; + print('selectedInsurdId- $selectedInsurdId'); selectedEnquiryId = enquiryData['id']; print('selectedEnquiryId- $selectedEnquiryId'); + controllers["regNum"]?.text = enquiryData['reg_no']; // controllers["insurer"]?.text = enquiryData['insurer_name']; }); diff --git a/lib/presentation/screens/staff/Enquiry/tabs/tab.dart b/lib/presentation/screens/staff/Enquiry/tabs/tab.dart index 4d6801d..73c88bd 100644 --- a/lib/presentation/screens/staff/Enquiry/tabs/tab.dart +++ b/lib/presentation/screens/staff/Enquiry/tabs/tab.dart @@ -64,8 +64,8 @@ class TabEnquiryStaffListState extends ConsumerState { setState(() => isLoading = false); tabs = [ // TabItem("Proposal", PropoalStaffTab()), - TabItem("Proposal", QuotationStaffTab()), - TabItem("Policy", PolicyStaffTab()), + TabItem("Quote", QuotationStaffTab()), + // TabItem("Policy", PolicyStaffTab()), ]; } }); @@ -112,8 +112,8 @@ class TabEnquiryStaffListState extends ConsumerState { tabs = [ // TabItem("Proposal", PropoalStaffTab()), - TabItem("Proposal", QuotationStaffTab()), - TabItem("Policy", PolicyStaffTab()), + TabItem("Quote", QuotationStaffTab()), + // TabItem("Policy", PolicyStaffTab()), ]; // if (widget.showKey == "Policy") { @@ -176,8 +176,11 @@ class TabEnquiryStaffListState extends ConsumerState { return AlertDialog( backgroundColor: Colors.white, content: Container( - width: MediaQuery.of(context).size.width * 0.65, - height: MediaQuery.of(context).size.height * 0.9, + width: MediaQuery.of(context).size.width * 0.4, + height: MediaQuery.of(context).size.height * 0.5, + + // width: MediaQuery.of(context).size.width * 0.65, + // height: MediaQuery.of(context).size.height * 0.9, child: isLoading ? const Center(child: CircularProgressIndicator()) : tabs.isEmpty diff --git a/lib/presentation/screens/staff/assignStaff.dart b/lib/presentation/screens/staff/assignStaff.dart index da191ff..e51c6cb 100644 --- a/lib/presentation/screens/staff/assignStaff.dart +++ b/lib/presentation/screens/staff/assignStaff.dart @@ -80,8 +80,8 @@ class _AddDialogState extends ConsumerState { final data = { "id": widget.enquiryPrimaryId, "assigned_to": selectedStaff, - "insurer_id": selectedInsurer, - "broker_id": selectedBroker, + // "insurer_id": selectedInsurer, + // "broker_id": selectedBroker, "updated_by": widget.userId, }; return data; @@ -339,7 +339,7 @@ class _AddDialogState extends ConsumerState { 'Assign Enquiry To Staff', style: GoogleFonts.inter( color: const Color(0xFF374141), - fontSize: 18, + fontSize: 14, fontWeight: FontWeight.bold, ), ), @@ -403,8 +403,8 @@ class _AddDialogState extends ConsumerState { children: [ buildRegistrationNumber(context), buildSelectStaffMem(context), - buildInsurer(context), - buildBroker(context), + // buildInsurer(context), + // buildBroker(context), ], ), ); @@ -493,6 +493,18 @@ class _AddDialogState extends ConsumerState { } return null; }, + + // dropdownBuilder: (context, selectedItem) => Align( + // alignment: Alignment.centerLeft, + // + // child: Text( + // selectedItem != null ? selectedItem['name'].toString() : "", + // style: GoogleFonts.poppins(fontSize: 11, color: Colors.black), + // overflow: TextOverflow.ellipsis, + // maxLines: 1, + // softWrap: false, + // ), + // ), decoratorProps: DropDownDecoratorProps( decoration: AppInputDecorations.dropdownDecoration( @@ -536,7 +548,7 @@ class _AddDialogState extends ConsumerState { return Container( // color: isSelected ? Colors.blue.withOpacity(0.1) : null, padding: const EdgeInsets.symmetric( - horizontal: 8, + horizontal: 12, vertical: 3, ), child: Text( diff --git a/lib/presentation/screens/staff/policy/policy_list.dart b/lib/presentation/screens/staff/policy/policy_list.dart index 1c6146b..ba72e7c 100644 --- a/lib/presentation/screens/staff/policy/policy_list.dart +++ b/lib/presentation/screens/staff/policy/policy_list.dart @@ -18,6 +18,8 @@ import '../../../themes/indicators/export_btn.dart'; import '../../../themes/indicators/search_field_theme.dart'; import '../../../widgets/custom_Stdate_EnDate_Filter.dart'; import '../../../widgets/custom_action_popup.dart'; +import '../../Enquiry/enquiry/policy_popup.dart'; +import '../../Enquiry/policy_claims_endros/sub_claims.dart'; class policylist extends ConsumerStatefulWidget { const policylist({super.key}); @@ -701,7 +703,7 @@ class policylistState extends ConsumerState { child: Text('Policy Number', style: _headerStyle), ), - Expanded(flex: 1, child: Text('Action', style: _headerStyle)), + Expanded(flex: 3, child: Text('Action', style: _headerStyle)), ], ), ), @@ -872,43 +874,51 @@ class policylistState extends ConsumerState { ), ), Expanded( - flex: 1, - child: Tooltip( - message: 'Download', - // color: Colors.white, - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () => apiService.downloadFile( - apiUrl: - 'api/policy/downloadPolicyFile?policy_id=$policyId&file_type=policy_pdf', - apiId: policyId, - localFile: null, - fileName: fileName, - ), + flex: 3, + child: Row( + children: [ + Tooltip( + message: 'Download', + // color: Colors.white, + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: () => apiService.downloadFile( + apiUrl: + 'api/policy/downloadPolicyFile?policy_id=$policyId&file_type=policy_pdf', + apiId: policyId, + localFile: null, + fileName: fileName, + ), - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: 5, - vertical: 6, + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 5, + vertical: 3, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + // color: Color(0xFF425B5B), + // color: const Color(0xFF2E7D6E), + color: Colors.green, + ), + child: Row( + children: const [ + Icon( + Icons.download, + size: 12, + color: Colors.white, + ), + ], + ), + ), ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - // color: Color(0xFF425B5B), - color: const Color(0xFF2E7D6E), - // color: Colors.green.shade300, - ), - child: Row( - children: const [ - Icon(Icons.download, size: 12, color: Colors.white), - ], - ), - ), + ], ), - ], - ), + ), + ], ), ), ], diff --git a/lib/presentation/themes/charts/barChart.dart b/lib/presentation/themes/charts/barChart.dart new file mode 100644 index 0000000..af5d81c --- /dev/null +++ b/lib/presentation/themes/charts/barChart.dart @@ -0,0 +1,87 @@ +// import 'package:fl_chart/fl_chart.dart'; +// import 'package:flutter/material.dart'; +// +// class DynamicHorizontalBarChart extends StatelessWidget { +// final List> data; +// // Example: +// // [ +// // {"label": "Apple", "value": 35}, +// // {"label": "Banana", "value": 20}, +// // {"label": "Orange", "value": 15}, +// // ] +// +// const DynamicHorizontalBarChart({super.key, required this.data}); +// +// @override +// Widget build(BuildContext context) { +// double maxValue = data +// .map((e) => e["value"] as double) +// .reduce((a, b) => a > b ? a : b); +// +// return SizedBox( +// height: data.length * 50, +// child: BarChart( +// BarChartData( +// maxY: maxValue + 10, +// barTouchData: BarTouchData(enabled: false), +// +// titlesData: FlTitlesData( +// leftTitles: AxisTitles( +// sideTitles: SideTitles( +// showTitles: true, +// reservedSize: 100, +// getTitlesWidget: (value, meta) { +// int index = value.toInt(); +// if (index < data.length) { +// return Text( +// data[index]["label"], +// style: const TextStyle(fontSize: 12), +// ); +// } +// return Container(); +// }, +// ), +// ), +// rightTitles: AxisTitles(), +// topTitles: AxisTitles(), +// bottomTitles: AxisTitles(), +// ), +// +// gridData: FlGridData(show: false), +// borderData: FlBorderData(show: false), +// +// barGroups: List.generate(data.length, (index) { +// final item = data[index]; +// final double value = item["value"] * 1.0; +// +// return BarChartGroupData( +// x: index, +// barRods: [ +// BarChartRodData( +// toY: value, +// width: 25, +// color: Colors.teal, +// borderRadius: BorderRadius.circular(5), +// +// // 🟩 LABEL INSIDE THE BAR +// rodStackItems: [ +// BarChartRodStackItem( +// 0, +// value, +// Colors.transparent, +// // BorderSide(), +// // StackItemLabel( +// // label: "${value.toInt()}", +// // labelStyle: const TextStyle(color: Colors.white), +// // ), +// ), +// ], +// ), +// ], +// ); +// }), +// ), +// ), +// ); +// } +// } diff --git a/lib/presentation/themes/indicators/customizd_file_upload.dart b/lib/presentation/themes/indicators/customizd_file_upload.dart index d88bd4a..1837c01 100644 --- a/lib/presentation/themes/indicators/customizd_file_upload.dart +++ b/lib/presentation/themes/indicators/customizd_file_upload.dart @@ -49,9 +49,21 @@ class _ThemedUploadFieldState extends State { String? selectedFileName; String? errorMessage; + // @override + // void didUpdateWidget(covariant ThemedUploadField oldWidget) { + // super.didUpdateWidget(oldWidget); + // + // if (widget.hintText != oldWidget.hintText) { + // setState(() { + // selectedFileName = null; + // errorMessage = null; + // }); + // } + // } + Future _pickFile() async { final error = await fileService.pickSingleFile( - maxFileSizeInMB: 3, + // maxFileSizeInMB: 3, allowedExtensions: widget.allowedExtensions, ); if (error != null) { diff --git a/lib/presentation/themes/indicators/fileUploadService.dart b/lib/presentation/themes/indicators/fileUploadService.dart index 29e2c4d..a06c485 100644 --- a/lib/presentation/themes/indicators/fileUploadService.dart +++ b/lib/presentation/themes/indicators/fileUploadService.dart @@ -26,14 +26,14 @@ class FileUploadService { if (result != null && result.files.isNotEmpty) { final file = result.files.first; final ext = file.extension?.toLowerCase() ?? ''; - final sizeInMB = file.size / (1024 * 1024); + // final sizeInMB = file.size / (1024 * 1024); if (!extensions.contains(ext)) { return "Unsupported format: ${file.name}"; } - if (sizeInMB > maxFileSizeInMB) { - return "File too large (${file.name}). Max $maxFileSizeInMB MB allowed."; - } + // if (sizeInMB > maxFileSizeInMB) { + // return "File too large (${file.name}). Max $maxFileSizeInMB MB allowed."; + // } singleFile = file; } diff --git a/lib/presentation/themes/indicators/search_field_theme.dart b/lib/presentation/themes/indicators/search_field_theme.dart index 13c1d70..3df2101 100644 --- a/lib/presentation/themes/indicators/search_field_theme.dart +++ b/lib/presentation/themes/indicators/search_field_theme.dart @@ -69,10 +69,15 @@ class ThemedSearchField extends HookWidget { borderSide: BorderSide(color: Color(0xFF50A398), width: 2), ), hintText: hintText, - hintStyle: GoogleFonts.inter( + hintStyle: GoogleFonts.poppins( // color: const Color(0xFF686868), color: const Color(0xFF94A3B8), - fontSize: (txtHeight ?? 45) <= 45 ? 12 : 14, + fontSize: (txtHeight ?? 45) <= 45 ? 10 : 11, + ), + labelStyle: GoogleFonts.poppins( + // color: const Color(0xFF686868), + color: const Color(0xFF94A3B8), + fontSize: (txtHeight ?? 45) <= 45 ? 10 : 11, ), // suffixIconConstraints: const BoxConstraints( diff --git a/lib/presentation/themes/indicators/side_Drawer_Panel.dart b/lib/presentation/themes/indicators/side_Drawer_Panel.dart index e5e0005..c4e5d28 100644 --- a/lib/presentation/themes/indicators/side_Drawer_Panel.dart +++ b/lib/presentation/themes/indicators/side_Drawer_Panel.dart @@ -51,12 +51,15 @@ class SideDrawerPanel extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ if (title != null) - Text( - title!, - style: GoogleFonts.poppins( - fontSize: 14, - fontWeight: FontWeight.w600, - color: const Color(0xFF1E293B), + Material( + color: Colors.white, + child: Text( + title!, + style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w600, + color: const Color(0xFF1E293B), + ), ), ), const Spacer(), diff --git a/lib/presentation/widgets/custom_Stdate_EnDate_Filter.dart b/lib/presentation/widgets/custom_Stdate_EnDate_Filter.dart index 837ffcc..7170049 100644 --- a/lib/presentation/widgets/custom_Stdate_EnDate_Filter.dart +++ b/lib/presentation/widgets/custom_Stdate_EnDate_Filter.dart @@ -116,8 +116,11 @@ class _DateFilterRowState extends ConsumerState { }); try { - final response = await apiService.fetchStaffUserList(id, role); - + // final response = await apiService.fetchStaffUserList(id, role); + final response = await apiService.fetchStaffListForEnquiryAssignDropDown( + id, + role, + ); if (response['status'] == 'success') { print('getStaffDetails - ${response['data']}'); setState(() { @@ -329,11 +332,15 @@ class _DateFilterRowState extends ConsumerState { Widget buildStatusSearch(BuildContext context) { final List> statusOptions = [ - {'id': 1, 'status': 'Awaiting Proposal'}, - {'id': 2, 'status': 'Proposal Created'}, - {'id': 3, 'status': 'Proposal Accepted'}, - {'id': 4, 'status': 'Proposal Rejected'}, - {'id': 5, 'status': 'Policy Created'}, + // {'id': 1, 'status': 'Awaiting Proposal'}, + // {'id': 2, 'status': 'Proposal Created'}, + // {'id': 3, 'status': 'Proposal Accepted'}, + // {'id': 4, 'status': 'Proposal Rejected'}, + // {'id': 5, 'status': 'Policy Created'}, + {'id': 1, 'status': 'To be assigned'}, + {'id': 2, 'status': 'Assigned'}, + {'id': 3, 'status': 'In progress'}, + {'id': 4, 'status': 'Completed'}, ]; Map? selectedStatusMap = statusOptions .where((element) => element['status'] == widget.selectedStatusVal) diff --git a/pubspec.yaml b/pubspec.yaml index ed70ebc..890a6c1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -69,6 +69,7 @@ dependencies: dropdown_search: ^6.0.2 file_picker: ^10.3.3 fluttertoast: ^9.0.0 +# fl_chart: ^1.1.0 diff --git a/web/favicon.png b/web/favicon.png index 8aaa46a..6917ff7 100644 Binary files a/web/favicon.png and b/web/favicon.png differ