tracker items fix

This commit is contained in:
venbaittech 2025-12-11 16:26:54 +05:30
parent 8cc66eb233
commit 4362ffad32
17 changed files with 154 additions and 118 deletions

File diff suppressed because one or more lines are too long

View File

@ -778,38 +778,6 @@ class ApiService {
// ----------------------------------- ENQUIRY -------------------------------------------------
Future<Map<String, dynamic>> fetchEnquiryList1(int id, role) async {
// print(_token);
if (_token == null) {
await _initializeToken();
}
final url;
if (role == 'manager') {
url = Uri.parse(
'${Env.apiUrl}enquiry/enquiryList?manager_id=$id&from_date=&to_date=',
);
} else if (role == 'staff') {
url = Uri.parse(
'${Env.apiUrl}enquiry/enquiryList?staff_id=$id&from_date=&to_date=',
);
} else {
url = Uri.parse(
'${Env.apiUrl}enquiry/enquiryList?agent_id=$id&from_date=&to_date=',
);
}
// final url = Uri.parse(
// 'https://venbait.in/nhance/partner/dev/api/agent/agentList?manager_id=${managerId}',
// );
final headers = {
'Authorization': 'Bearer $_token' ?? '',
'app-signature': Env.App_Signature,
};
final response = await _makeGetRequest(url, headers);
return response;
}
Future<Map<String, dynamic>> fetchEnquiryList(
int managerid,
int id,
@ -1207,23 +1175,26 @@ class ApiService {
return response;
}
Future<Map<String, dynamic>> fetchClaimList(int id, role) async {
Future<Map<String, dynamic>> fetchClaimList(
managerId,
int userId,
role,
) async {
// print(_token);
if (_token == null) {
await _initializeToken();
}
final userId = '1';
final url;
if (role == 'manager') {
url = Uri.parse('${Env.apiUrl}claim/ClaimList?manager_id=$id');
url = Uri.parse('${Env.apiUrl}claim/ClaimList?manager_id=$managerId');
} else if (role == 'agent') {
url = Uri.parse('${Env.apiUrl}claim/ClaimList?agent_id=$id');
url = Uri.parse('${Env.apiUrl}claim/ClaimList?agent_id=$userId');
} else if (role == 'handler') {
url = Uri.parse('${Env.apiUrl}claim/ClaimList?handler_id=$id');
url = Uri.parse('${Env.apiUrl}claim/ClaimList?handler_id=$userId');
} else {
url = Uri.parse('${Env.apiUrl}claim/ClaimList?staff_id=$id');
url = Uri.parse('${Env.apiUrl}claim/ClaimList?staff_id=$userId');
}
// final url = Uri.parse(
@ -1254,18 +1225,21 @@ class ApiService {
// ----------------------------------- ENDORSEMENT -------------------------------------------------
Future<Map<String, dynamic>> fetchEndorsementList(int id, role) async {
Future<Map<String, dynamic>> fetchEndorsementList(
managerId,
int id,
role,
) async {
// print(_token);
if (_token == null) {
await _initializeToken();
}
final userId = '1';
final url;
if (role == 'manager') {
url = Uri.parse(
'${Env.apiUrl}endorsement/endorsementList?manager_id=$id',
'${Env.apiUrl}endorsement/endorsementList?manager_id=$managerId',
);
} else if (role == 'agent') {
url = Uri.parse('${Env.apiUrl}endorsement/endorsementList?agent_id=$id');
@ -1365,6 +1339,7 @@ class ApiService {
}
Future<Map<String, dynamic>> fetchStaffListForEnquiryAssignDropDown(
managerId,
id,
role,
) async {
@ -1378,7 +1353,7 @@ class ApiService {
if (role == 'manager') {
url = Uri.parse(
'${Env.apiUrl}staff/staffListForEnquiryAssignDropdown?manager_id=$id',
'${Env.apiUrl}staff/staffListForEnquiryAssignDropdown?manager_id=$managerId',
);
} else {
url = Uri.parse(

View File

@ -706,11 +706,11 @@ class _HoverableContainerState extends State<_HoverableContainer> {
color: Colors.black87,
),
),
Icon(
Icons.arrow_forward_ios_rounded,
size: 10,
color: Colors.grey.shade600,
),
// Icon(
// Icons.arrow_forward_ios_rounded,
// size: 10,
// color: Colors.grey.shade600,
// ),
],
),
),

View File

@ -16,3 +16,4 @@ final staffIndiviualAttendanceNameIdProvider = StateProvider<String?>(
final dashboardKeyProvider = StateProvider<int?>((ref) => null);
final dashboardStatusProvider = StateProvider<String?>((ref) => null);
final dashboardStaffIdProvider = StateProvider<String?>((ref) => null);
final enquiryRefreshProvider = StateProvider<bool>((ref) => false);

View File

@ -51,23 +51,23 @@ class claimListState extends ConsumerState<claimList> {
// roleId = ref.read(userRoleProvider);
// roleId = ref.read(userRoleProvider);
roleId = ref.read(userRoleProvider);
userId = ref.read(userIdProvider);
print("G47 => r : $roleId | mId: $id | uId: $userId ");
if (userId != null) {
getStaffList(id!, userId);
getStaffList(managerId, userId, roleId);
}
});
}
Future<void> getStaffList(int managerId, role) async {
Future<void> getStaffList(int managerId, int userId, role) async {
print('G54 => Fns called => $managerId | $role');
setState(() {
isLoading = true;
});
try {
final response = await apiService.fetchClaimList(managerId, role);
final response = await apiService.fetchClaimList(managerId, userId, role);
if (response['status'] == 'success') {
final data = response['data'];
@ -176,7 +176,7 @@ class claimListState extends ConsumerState<claimList> {
}
void refresh() {
getStaffList(managerId, userId);
getStaffList(managerId, userId, roleId);
}
@override

View File

@ -49,19 +49,23 @@ class endosementState extends ConsumerState<endosement> {
userId = ref.read(userIdProvider);
print("F46 => r : $roleId | mId: $id | uId: $userId ");
if (userId != null) {
getStaffList(userId, roleId);
getStaffList(managerId, userId, roleId);
}
});
}
Future<void> getStaffList(int managerId, role) async {
Future<void> getStaffList(int managerId, userId, role) async {
print('F53 => Fns called => $managerId | $role');
setState(() {
isLoading = true;
});
try {
final response = await apiService.fetchEndorsementList(managerId, role);
final response = await apiService.fetchEndorsementList(
managerId,
userId,
role,
);
if (response['status'] == 'success') {
final data = response['data'];
@ -112,7 +116,7 @@ class endosementState extends ConsumerState<endosement> {
}
void refresh() {
getStaffList(managerId, roleId);
getStaffList(managerId, userId, roleId);
}
void filterData(String query) {
@ -175,7 +179,7 @@ class endosementState extends ConsumerState<endosement> {
@override
Widget build(BuildContext context) {
return MainLayout(
title: "Endosement",
title: "Endorsement",
body: Container(
// color: Colors.yellow.shade50,
width: MediaQuery.of(context).size.width,

View File

@ -239,62 +239,74 @@ class ProfilePopUpState extends ConsumerState<ProfilePopUp> {
),
),
const SizedBox(height: 26),
Row(
children: [
const Icon(
Icons.phone_outlined,
size: 20,
color: Colors.black,
),
const SizedBox(width: 8),
Text(
profileData?['mobile'] ?? '-',
style: _dataBold,
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(
Icons.email_outlined,
size: 18,
color: Colors.black,
),
const SizedBox(width: 8),
Text(
profileData?['email'] ?? '-',
style: _dataBold,
),
],
),
const SizedBox(height: 16),
if ((roleId != 1) &&
(roleId != 2) &&
(roleId != 3)) ...[
if (profileData?['mobile'] != null ||
profileData?['mobile'] != '') ...[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Icon(
Icons.location_on_outlined,
Icons.phone_outlined,
size: 20,
color: Colors.black,
),
const SizedBox(width: 8),
Text(
profileData?['mobile'] ?? '-',
style: _dataBold,
),
],
),
const SizedBox(height: 8),
],
if (profileData?['email'] != null ||
profileData?['email'] != '') ...[
Row(
children: [
const Icon(
Icons.email_outlined,
size: 18,
color: Colors.black,
),
const SizedBox(width: 8),
Expanded(
child: Text(
profileData?['address'] ?? '-',
style: _dataBold,
softWrap: true,
),
Text(
profileData?['email'] ?? '-',
style: _dataBold,
),
],
),
const SizedBox(height: 20),
const SizedBox(height: 16),
],
if ((roleId != 2) && (roleId != 3)) ...[
if (profileData?['address'] != null ||
profileData?['address'] != '') ...[
if ((roleId != 1) &&
(roleId != 2) &&
(roleId != 3)) ...[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Icon(
Icons.location_on_outlined,
size: 18,
color: Colors.black,
),
const SizedBox(width: 8),
Expanded(
child: Text(
profileData?['address'] ?? '-',
style: _dataBold,
softWrap: true,
),
),
],
),
const SizedBox(height: 20),
],
],
if ((roleId != 1) &&
(roleId != 2) &&
(roleId != 3)) ...[
// Staff, Handler doesn't have this part Only Manager and agent have
Container(
padding: const EdgeInsets.all(6),

View File

@ -93,8 +93,8 @@ class _DashboardState extends ConsumerState<PartnerDashboard> {
final prefroleId = ref.read(userRoleProvider);
print("B81 => roleId: $prefroleId | userId: $prefuserid ");
if (prefuserid != null) {
getParnterDashBrdList(prefuserid);
if (prefmanagerid != null) {
getParnterDashBrdList(prefmanagerid);
// getStaffList(prefmanagerid!, prefroleId, prefuserid);
}
});
@ -504,7 +504,7 @@ class _PerformanceState extends State<Performance> {
Expanded(
flex: 1,
child: Text(
"S.NO",
"S.no.",
textAlign: TextAlign.left,
style: _headerStyle,
),

View File

@ -369,6 +369,7 @@ class EnquiryHandlerState extends ConsumerState<EnquiryListHandler> {
try {
// final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id,
roleId,
);

View File

@ -641,6 +641,7 @@ class CreateProposal_QuickFormState
reset();
getQuickQuotationList(managerId);
// Navigator.of(context).pop();
} else if (response.statusCode == 403) {
await apiService.clearLocalStorageAndRedirect();
@ -700,9 +701,17 @@ class CreateProposal_QuickFormState
print("tre1");
selectedId = null; // just update field
Navigator.of(context).pop();
final prefs = await SharedPreferences.getInstance();
await prefs.setString('QuoteKeyProvider', 'fromQuickQuote');
context.go('/enquiryForStaff');
// final prefs = await SharedPreferences.getInstance();
// await prefs.setString('QuoteKeyProvider', 'fromQuickQuote');
WidgetsBinding.instance.addPostFrameCallback((_) {
// Now safe to do navigation + provider updates
final container = ProviderScope.containerOf(context);
container.read(enquiryRefreshProvider.notifier).state = true;
context.go('/enquiryForStaff');
});
print("tre11");
getQuickQuotationList(managerId);
} else if (response.statusCode == 403) {
@ -1561,7 +1570,8 @@ class CreateProposal_QuickFormState
bordedRad: 5,
// backgroundColor: Color(0xFFEDF6F5),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[0-9.]')),
// FilteringTextInputFormatter.allow(RegExp(r'[0-9.]')),
FilteringTextInputFormatter.allow(RegExp(r'^\d*\.?\d{0,2}$')),
],
// validator: (value) =>
// Validators.doubleNumber(value, "PremiumAmount"),

View File

@ -369,6 +369,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInlineTST> {
try {
// final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id,
roleId,
);

View File

@ -484,6 +484,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
try {
// final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id,
roleId,
);

View File

@ -109,6 +109,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
Map<int, bool> isEditingRow = {};
Map<int, Map<String, TextEditingController>> rowControllers = {};
late ProviderSubscription<bool> refreshSub;
//---------------------- Enquiry TAB Initializations Starts -------------------------------- //
@ -223,6 +224,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
Timer? timer;
int selectedSeconds = 30;
bool isActionable = false;
bool _listened = false;
//---------------------- Assign Staff Ends -------------------------------- //
//---------------------- Enquiry TAB Initializations Ends -------------------------------- //
@ -255,10 +257,6 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
print('handlerIdENQ - $handlerId');
print("C72 => r : $roleId | uId: $userId !mID : $managerId ");
print('quickQuotationKey');
if (quickQuotationKey == 'fromQuickQuote') {
print('quickQuotationKey - $quickQuotationKey');
callRefresh();
}
print('dashboardKey - $dashboardKey');
print('dashboardStatus - $dashboardStatus');
@ -293,6 +291,15 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
print('hansles');
getStaffDetailsForEnquiryAssignment(userID);
}
ref.listen(enquiryRefreshProvider, (prev, next) {
print('quickQuotationKey1');
if (next == true) {
print('quickQuotationKey2 - $next');
callRefresh();
ref.read(enquiryRefreshProvider.notifier).state = false; // reset
}
});
});
getVehicleType();
@ -300,6 +307,18 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
getInsuranceType();
getBroker();
getPaymentMode();
refreshSub = ref.listenManual<bool>(enquiryRefreshProvider, (
previous,
next,
) {
if (next == true) {
print('refresh triggered Quick Creation');
callRefresh();
ref.read(enquiryRefreshProvider.notifier).state = false;
}
});
}
Future<void> loadPreferences() async {
@ -375,6 +394,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
@override
void dispose() {
refreshSub.close();
_horizontalScrollController.dispose();
// ... dispose other controllers ...
super.dispose();
@ -571,6 +591,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
try {
// final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id,
roleId,
);
@ -4111,7 +4132,11 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
border: Border.all(color: Color(0xFFE2E8F0)),
borderRadius: BorderRadius.circular(5),
),
child: Text(item['reg_no'] ?? '-', style: _dataBoldthm3),
child: Text(
item['reg_no'] ?? '-',
textAlign: TextAlign.center,
style: _dataBoldthm3,
),
),
// ),
// child: Text(item['reg_no'] ?? '-', style: _dataBold),

View File

@ -367,6 +367,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
try {
// final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id,
roleId,
);

View File

@ -351,6 +351,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
try {
// final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id,
roleId,
);
@ -413,9 +414,8 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
buildAgentName(context, fromHeader: true),
if (roleId != 'staff') ...[buildSelectStaffMem(context)],
buildAgentName(context, fromHeader: true),
buildBroker(context),
buildInsurer(context, fromHeader: true),

View File

@ -76,6 +76,8 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
String? selectedRegNum;
String? selectedStaffName;
dynamic managerId;
Map<String, dynamic> dataDetails() {
final data = {
"id": widget.enquiryPrimaryId,
@ -104,7 +106,7 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
getInsurers();
getBroker();
Future.microtask(() {
final managerId = ref.watch(managerIdProvider);
managerId = ref.watch(managerIdProvider);
// final handlerId = ref.watch(handlerIdProvider);
role = ref.watch(userRoleProvider);
final userID = ref.watch(userIdProvider);
@ -193,6 +195,7 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
try {
// final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id,
role,
);

View File

@ -80,6 +80,7 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
String? selectedStaff;
String? selectedStaffName;
dynamic role;
dynamic managerId;
bool isLoading = false;
@ -89,7 +90,7 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
apiService = ApiService();
Future.microtask(() {
final managerId = ref.watch(managerIdProvider);
managerId = ref.watch(managerIdProvider);
final userID = ref.watch(userIdProvider);
// final handlerId = ref.watch(handlerIdProvider);
role = ref.watch(userRoleProvider);
@ -118,6 +119,7 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
try {
// final response = await apiService.fetchStaffUserList(id, role);
final response = await apiService.fetchStaffListForEnquiryAssignDropDown(
managerId,
id,
role,
);