Endorsement full completed

This commit is contained in:
Surendiran 2026-03-07 11:39:46 +05:30
parent ae3875234f
commit 722d8e4904
17 changed files with 7165 additions and 410 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(
'API_URL',
// 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://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: 'http://localhost/nhance_partner_be/', /* localhost build (enable index.html line 19) */
);
// static const String baseUrl = String.fromEnvironment(

View File

@ -12,6 +12,7 @@ import '../../data/services/auth_service.dart';
import '../../presentation/providers/manager_provider.dart';
import '../../presentation/screens/Enquiry/enquiry/tabs.dart';
import '../../presentation/screens/Enquiry/policy_claims_endros/claims.dart';
import '../../presentation/screens/Enquiry/policy_claims_endros/endorsomentUpdateValidation.dart';
import '../../presentation/screens/Enquiry/policy_claims_endros/endrosment.dart';
import '../../presentation/screens/Masters/Brokers/brokerList.dart';
import '../../presentation/screens/Masters/EndorsementType/endorsementList.dart';
@ -188,8 +189,8 @@ final GoRouter appRouter = GoRouter(
builder: (context, state) => const claimList(),
),
GoRoute(
path: AppRoutes.endosement,
builder: (context, state) => const endosement(),
path: AppRoutes.Endorsement,
builder: (context, state) => const Endorsement(),
),
GoRoute(
path: AppRoutes.policylist,
@ -231,6 +232,49 @@ final GoRouter appRouter = GoRouter(
},
),
GoRoute(
path: AppRoutes.endorsomentValidation,
name: "endorsomentValidation",
pageBuilder: (context, state) {
final extra = state.extra as Map<String, dynamic>;
return CustomTransitionPage(
key: state.pageKey,
opaque: true,
barrierColor: Colors.black.withOpacity(0.3),
fullscreenDialog: true,
transitionDuration: const Duration(milliseconds: 1000),
child: endorsomentValidation(
title: extra["title"],
userId: extra["userId"],
managerId: extra["managerId"],
role: extra["role"],
item: extra["item"],
onSubmit: (value) {
debugPrint("Validation Done: $value");
},
),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
final curved = CurvedAnimation(
parent: animation,
curve: Curves.easeOutCubic,
);
return SlideTransition(
position: Tween<Offset>(
begin: const Offset(0, 1),
end: Offset.zero,
).animate(curved),
child: child,
);
},
);
},
),
GoRoute(
path: AppRoutes.quotation,
builder: (context, state) => const QuotationScreen(),

View File

@ -20,9 +20,10 @@ class AppRoutes {
static const String individualAttendance = '/individualAttendance';
static const String claimlist = '/claimList';
static const String endosement = '/endosement';
static const String Endorsement = '/Endorsement';
static const String policylist = '/policylist';
static const String policyValidation = '/policyValidation';
static const String endorsomentValidation = '/endorsomentValidation';
static const String quotation = '/QuotationScreen';
static const String policy = '/PolicyScreen';
static const String policyStaffEnq = '/policyStaffEnq';

View File

@ -1565,37 +1565,52 @@ class ApiService {
// ----------------------------------- ENDORSEMENT -------------------------------------------------
Future<Map<String, dynamic>> fetchEndorsementList(
managerId,
int id,
role,
) async {
// print(_token);
managerId,
int id,
role, {
String? fromDate,
String? toDate,
String? endorsementType,
String? insurerId,
String? status,
String? verification,
}) async {
print('fetchEndorsementList in');
if (_token == null) {
await _initializeToken();
}
print('fetchEndorsementList token');
final url;
Map<String, String> queryParams = {};
if (role == 'manager') {
url = Uri.parse(
'${Env.apiUrl}endorsement/endorsementList?manager_id=$managerId',
);
} else if (role == 'Accounts') {
url = Uri.parse(
'${Env.apiUrl}endorsement/endorsementList?manager_id=$managerId',
);
// 🔹 Role based base params
if (role == 'manager' || role == 'Accounts') {
queryParams['manager_id'] = managerId.toString();
} else if (role == 'agent') {
url = Uri.parse('${Env.apiUrl}endorsement/endorsementList?agent_id=$id');
queryParams['agent_id'] = id.toString();
} else if (role == 'handler') {
url = Uri.parse('${Env.apiUrl}enquiry/enquiryList?handler_id=$id');
queryParams['handler_id'] = id.toString();
} else {
url = Uri.parse('${Env.apiUrl}endorsement/endorsementList?staff_id=$id');
queryParams['staff_id'] = id.toString();
}
queryParams['from_date'] = fromDate ?? '';
queryParams['to_date'] = toDate ?? '';
queryParams['endorsement_type'] = endorsementType ?? '';
queryParams['insurer_id'] = insurerId ?? '';
queryParams['status'] = status ?? '';
queryParams['verification'] = verification ?? '';
print('fetchEndorsementList api');
final url = Uri.parse('${Env.apiUrl}endorsement/endorsementList')
.replace(queryParameters: queryParams);
final headers = {
'Authorization': 'Bearer $_token' ?? '',
'Authorization': 'Bearer $_token',
'app-signature': Env.App_Signature,
};
final response = await _makeGetRequest(url, headers);
return response;
}

View File

@ -84,6 +84,8 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
} else if (currentRoute.contains('invoice') || // ADD THIS
currentRoute.contains('payout')) {
_activeMenu = 'Invoice';
} else if (currentRoute.contains('Endorsement')) {
_activeMenu = 'Endorsement';
}
});
});
@ -268,14 +270,6 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
},
),
const SizedBox(height: 2),
_buildPopupItem(
label: "Endorsement",
onTap: () {
_hidePopup();
context.go(AppRoutes.endosement);
},
),
const SizedBox(height: 2),
_buildPopupItem(
label: "Policy",
onTap: () {
@ -384,6 +378,9 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
const SizedBox(width: 15),
],
SizedBox(width: 8),
// Enquiry
if (role != 'Accounts') ...[
_buildMenuItem(
@ -402,6 +399,21 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
},
),
],
const SizedBox(width: 8),
_buildMenuItem(
isActive: _activeMenu == 'Endorsement',
icon: Icons.checklist_outlined,
label: "Endorsement",
onTap: () async {
_hidePopup();
setState(() => _activeMenu = 'Endorsement');
await _clearDashboardFilters();
context.go(AppRoutes.Endorsement);
},
),
const SizedBox(width: 8),
@ -453,6 +465,7 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
),
],
const Spacer(),
// Raise Enquiry button for agents

View File

@ -191,6 +191,37 @@ class _AddDialogState extends State<AddDialog> {
}
}
Future<void> getVehicleListSearchData(String val) async {
setState(() {
isLoading = true;
});
try {
final response = await apiService.fetchVehicleSearch(val);
if (response['status'] == 'success') {
print('E113 => getStaffListData => ${response['data']}');
setState(() {
getVehicleListData = List<Map<String, dynamic>>.from(
response['data'],
);
originalVehicleData = getVehicleListData;
filteredVehicleData = List.from(originalVehicleData);
// print('originalData - $getClaimPolicies');
});
} else {
getVehicleListData = [];
originalVehicleData = [];
}
} catch (e) {
print('Exception occurred: $e');
} finally {
setState(() {
isLoading = false;
});
}
}
Future<void> getPolicyListSearchData1(val) async {
setState(() {
isLoading = true;
@ -225,36 +256,7 @@ class _AddDialogState extends State<AddDialog> {
}
}
Future<void> getVehicleListSearchData(String val) async {
setState(() {
isLoading = true;
});
try {
final response = await apiService.fetchVehicleSearch(val);
if (response['status'] == 'success') {
print('E113 => getStaffListData => ${response['data']}');
setState(() {
getVehicleListData = List<Map<String, dynamic>>.from(
response['data'],
);
originalVehicleData = getVehicleListData;
filteredVehicleData = List.from(originalVehicleData);
// print('originalData - $getClaimPolicies');
});
} else {
getVehicleListData = [];
originalVehicleData = [];
}
} catch (e) {
print('Exception occurred: $e');
} finally {
setState(() {
isLoading = false;
});
}
}
Future<void> getStaffList(
dynamic managerId,

View File

@ -327,8 +327,8 @@ class AgentListState extends ConsumerState<AgentList> {
'Partner Id',
'Partner Name',
'Email',
'Sales Executive Name',
'Phone Number',
'Retention Rate',
'Address',
'Status',
@ -338,6 +338,7 @@ class AgentListState extends ConsumerState<AgentList> {
"agent_code",
"name",
"email",
"sales_executive_name",
"mobile",
"retention_rate",
"address",

View File

@ -444,6 +444,41 @@ class _policyValidationState extends ConsumerState<policyValidation> {
}
}
Future<void> getPaymentMode() async {
setState(() => isLoadingPaymentMode = true);
try {
final response = await apiService.fetchMasterDropDown('PaymentMode');
if (response['status'] == 200 && response['data'] != null) {
final allData = List<Map<String, dynamic>>.from(response['data']);
final activePaymentMode =
allData.where((item) => item['is_active'] == "1").toList();
setState(() {
getPaymentModeData = activePaymentMode;
filteredPaymentModeData = List.from(getPaymentModeData);
// IMPORTANT: rebind selected value AFTER list is ready
if (selectedPaymentMode != null &&
selectedPaymentMode!.isNotEmpty &&
selectedPaymentMode != '0') {
// nothing else needed rebuild is enough
}
});
} else {
// setState(() {
getPaymentModeData.clear();
filteredPaymentModeData.clear();
// });
}
} catch (e) {
print('Exception occurred: $e');
} finally {
setState(() => isLoadingPaymentMode = false);
}
}
Future<void> getInsurancPlanType() async {
print('getInsurancPlanType called');
setState(() {
@ -478,41 +513,6 @@ class _policyValidationState extends ConsumerState<policyValidation> {
}
}
Future<void> getPaymentMode() async {
setState(() => isLoadingPaymentMode = true);
try {
final response = await apiService.fetchMasterDropDown('PaymentMode');
if (response['status'] == 200 && response['data'] != null) {
final allData = List<Map<String, dynamic>>.from(response['data']);
final activePaymentMode =
allData.where((item) => item['is_active'] == "1").toList();
setState(() {
getPaymentModeData = activePaymentMode;
filteredPaymentModeData = List.from(getPaymentModeData);
// IMPORTANT: rebind selected value AFTER list is ready
if (selectedPaymentMode != null &&
selectedPaymentMode!.isNotEmpty &&
selectedPaymentMode != '0') {
// nothing else needed rebuild is enough
}
});
} else {
// setState(() {
getPaymentModeData.clear();
filteredPaymentModeData.clear();
// });
}
} catch (e) {
print('Exception occurred: $e');
} finally {
setState(() => isLoadingPaymentMode = false);
}
}
Future<void> getEnquiryVehicleTypeForCommission() async {

View File

@ -59,7 +59,7 @@ class DrawerMenuState extends ConsumerState<DrawerMenu> {
const SizedBox(height: 5),
_buildPopupItem(
label: "Endorsement",
onTap: () => context.go(AppRoutes.endosement),
onTap: () => context.go(AppRoutes.Endorsement),
),
const SizedBox(height: 5),
_buildPopupItem(

View File

@ -63,7 +63,7 @@ class DrawerMenuState extends ConsumerState<DrawerMenu> {
const SizedBox(height: 5),
_buildPopupItem(
label: "Endorsement",
onTap: () => context.go(AppRoutes.endosement),
onTap: () => context.go(AppRoutes.Endorsement),
),
const SizedBox(height: 5),
_buildPopupItem(

View File

@ -71,7 +71,7 @@ class _MobileBottomMenuState extends ConsumerState<MobileBottomMenu> {
// Reports tapped show bottom sheet
_showOptionsSheet([
{'label': 'Claims', 'route': AppRoutes.claimlist},
{'label': 'Endorsement', 'route': AppRoutes.endosement},
{'label': 'Endorsement', 'route': AppRoutes.Endorsement},
{'label': 'Policy', 'route': AppRoutes.policylist},
]);
break;

View File

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

View File

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