FIX_Broker Code and Policy Validation - Insurer label

This commit is contained in:
sanjeev.p 2026-01-23 14:36:57 +05:30
parent 97759378de
commit 5c8f8f9a8c
6 changed files with 60 additions and 19 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,8 @@ class Env {
); );
static const String apiUrl = String.fromEnvironment( static const String apiUrl = String.fromEnvironment(
'API_URL', 'API_URL',
defaultValue: 'https://partner.nhanceindia.in/partner_api/api/', /* Live build (enable index.html line 18) */ // defaultValue: 'https://partner.nhanceindia.in/partner_api/api/', /* Live build (enable index.html line 18) */
// defaultValue: 'https://venbait.in/nhance/partner/dev/api/', /* Test build (enable index.html line 19) */ defaultValue: 'https://venbait.in/nhance/partner/dev/api/', /* Test build (enable index.html line 19) */
// defaultValue: 'http://localhost/nhance_partner_be/', /* localhost build (enable index.html line 19) */ // defaultValue: 'http://localhost/nhance_partner_be/', /* localhost build (enable index.html line 19) */
); );
// static const String baseUrl = String.fromEnvironment( // static const String baseUrl = String.fromEnvironment(

View File

@ -392,6 +392,10 @@ class BrokerState extends ConsumerState<Broker> {
child: ThemedFormInlineField( child: ThemedFormInlineField(
controller: controllers['code']!, controller: controllers['code']!,
validator: (value) => Validators.requiredField(value, "code"), validator: (value) => Validators.requiredField(value, "code"),
inputFormatters: [
// This line now allows letters, numbers, hyphens, and underscores
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9\-_ ]')),
],
txtwidth: MediaQuery.of(context).size.width * 0.15, txtwidth: MediaQuery.of(context).size.width * 0.15,
borderColor: Color(0xFFE2E8F0), borderColor: Color(0xFFE2E8F0),
highlightColor: Color(0xFF50A398), highlightColor: Color(0xFF50A398),

View File

@ -129,6 +129,8 @@ class _policyValidationState extends ConsumerState<policyValidation> {
String? selectedPaymentMode; String? selectedPaymentMode;
String? selectedFuelType; String? selectedFuelType;
String? selectedBroker; String? selectedBroker;
String? selectedInsurerName;
String? selectedInsurerShortName;
final GlobalKey<DropdownSearchState<Map<String, dynamic>>> dropDownKey = final GlobalKey<DropdownSearchState<Map<String, dynamic>>> dropDownKey =
GlobalKey<DropdownSearchState<Map<String, dynamic>>>(); GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
@ -707,6 +709,8 @@ class _policyValidationState extends ConsumerState<policyValidation> {
if (!mounted) return; if (!mounted) return;
debugPrint('findPolicyApi response2:'); debugPrint('findPolicyApi response2:');
setState(() { setState(() {
selectedInsurerShortName = safeText(data['insurer_short_name']);
selectedInsurerName = safeText(data['insurer_name']);
controllers["policyNumber"]?.text = safeText(data['policy_number']); controllers["policyNumber"]?.text = safeText(data['policy_number']);
controllers["insuredName"]!.text = safeText(data['insured_name']); controllers["insuredName"]!.text = safeText(data['insured_name']);
controllers["premiumAmount"]!.text = safeText(data['premium_amount']); controllers["premiumAmount"]!.text = safeText(data['premium_amount']);
@ -1522,7 +1526,7 @@ class _policyValidationState extends ConsumerState<policyValidation> {
} }
Widget _sectionHeader(String title, {IconData icon = Icons.info}) { Widget _sectionHeader(String title, {IconData icon = Icons.info , String? rightTitle,}) {
return Container( return Container(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12), padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -1544,6 +1548,18 @@ class _policyValidationState extends ConsumerState<policyValidation> {
title, title,
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w600), style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w600),
), ),
// Push right title to end
const Spacer(),
// Right title (optional)
if (rightTitle != null && rightTitle.isNotEmpty)
Text(
rightTitle,
style: GoogleFonts.poppins(
fontWeight: FontWeight.w600,
fontSize: 12,
),
),
], ],
), ),
); );
@ -1559,13 +1575,32 @@ class _policyValidationState extends ConsumerState<policyValidation> {
String? hintText, String? hintText,
List<TextInputFormatter>? inputFormatters, // 👈 ADD THIS List<TextInputFormatter>? inputFormatters, // 👈 ADD THIS
ValueChanged<String>? onChanged, // 👈 ADD THIS ValueChanged<String>? onChanged, // 👈 ADD THIS
String? rightLabel, // 👈 ADD THIS
}) { }) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( // Text(
label, // label,
style: GoogleFonts.poppins(fontWeight: FontWeight.w500, fontSize: 11), // style: GoogleFonts.poppins(fontWeight: FontWeight.w500, fontSize: 11),
// ),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
label,
style: GoogleFonts.poppins(fontWeight: FontWeight.w500, fontSize: 11),
),
if (rightLabel != null)
Text(
rightLabel,
style: GoogleFonts.poppins(
fontWeight: FontWeight.w500,
fontSize: 11,
color: Colors.grey[700],
),
),
],
), ),
const SizedBox(height: 6), const SizedBox(height: 6),
TextFormField( TextFormField(
@ -1822,6 +1857,7 @@ class _policyValidationState extends ConsumerState<policyValidation> {
_sectionHeader( _sectionHeader(
'Policy Details', 'Policy Details',
icon: Icons.policy, icon: Icons.policy,
rightTitle: selectedInsurerShortName?.isNotEmpty == true ? 'INSURER - ${selectedInsurerShortName}' : '',
), ),
SizedBox(height: 10), SizedBox(height: 10),
Row( Row(
@ -1831,6 +1867,7 @@ class _policyValidationState extends ConsumerState<policyValidation> {
'Policy Number *', 'Policy Number *',
controllers['policyNumber']!, controllers['policyNumber']!,
required: true, required: true,
// rightLabel: selectedInsurerName,
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),

View File

@ -700,26 +700,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker name: leak_tracker
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "11.0.2" version: "10.0.9"
leak_tracker_flutter_testing: leak_tracker_flutter_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_flutter_testing name: leak_tracker_flutter_testing
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.10" version: "3.0.9"
leak_tracker_testing: leak_tracker_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_testing name: leak_tracker_testing
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.2" version: "3.0.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
@ -1297,10 +1297,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.6" version: "0.7.4"
toastification: toastification:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1417,10 +1417,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.0" version: "2.1.4"
vm_service: vm_service:
dependency: transitive dependency: transitive
description: description:

View File

@ -15,8 +15,8 @@
the `--base-href` argument provided to `flutter build`. the `--base-href` argument provided to `flutter build`.
--> -->
<!-- <base href="$FLUTTER_BASE_HREF">--> <!-- <base href="$FLUTTER_BASE_HREF">-->
<base href="/partner/"> <!-- Live build: also check env.dart (line 8) --> <!-- <base href="/partner/"> Live build: also check env.dart (line 8) -->
<!--<base href="/nhance/partner/app/"> Testing build: also check env.dart (line 9) --> <base href="/nhance/partner/app/"> <!-- Testing build: also check env.dart (line 9) -->
<meta charset="UTF-8"> <meta charset="UTF-8">