FIX_bug fixes
This commit is contained in:
parent
7f6e79ceb8
commit
35ab0f994b
@ -154,7 +154,7 @@ class ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getPdfDownload(String path, String id) async {
|
||||
Future<void> getPdfDownload(BuildContext context,String path, String id) async {
|
||||
print('getPdfDownload 1');
|
||||
print('getPdfDownload 1 - $path');
|
||||
|
||||
@ -175,7 +175,17 @@ class ApiService {
|
||||
|
||||
final response = await _makeGethttpRequest(url, headers);
|
||||
print('getPdfDownload 3');
|
||||
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final contentType = response.headers['content-type'] ?? '';
|
||||
if (contentType.contains('application/json')) {
|
||||
final jsonResponse = jsonDecode(response.body);
|
||||
if (jsonResponse['code'] == 404 || jsonResponse['code'] == 500)
|
||||
{ ToastHelper.showInfoToast(context, 'File Not Found'); }
|
||||
else { ToastHelper.showInfoToast(context, 'No File Found'); }
|
||||
return;
|
||||
}else{
|
||||
final blob = html.Blob([response.bodyBytes]);
|
||||
final blobUrl = html.Url.createObjectUrlFromBlob(blob);
|
||||
print('getPdfDownload $blobUrl');
|
||||
@ -199,6 +209,7 @@ class ApiService {
|
||||
..click();
|
||||
print('getPdfDownloadcontentDisp..4');
|
||||
html.Url.revokeObjectUrl(blobUrl);
|
||||
}
|
||||
} else if (response.statusCode == 404) {
|
||||
showDialog(
|
||||
context: context,
|
||||
@ -245,7 +256,7 @@ class ApiService {
|
||||
} else if (apiUrl != null) {
|
||||
print("Download from API: $apiUrl");
|
||||
print("Download from API: $apiId!");
|
||||
await getPdfDownload(apiUrl, apiId!);
|
||||
await getPdfDownload(context,apiUrl, apiId!);
|
||||
} else {
|
||||
print("⚠️ No file available to download");
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ class EnquiryTabState extends ConsumerState<EnquiryTab> {
|
||||
|
||||
Map<String, dynamic> dataDetails() {
|
||||
final data = {
|
||||
"agent_id": 1,
|
||||
"agent_id": userId,
|
||||
"name": controllers["name"]?.text,
|
||||
"mobile": controllers["mobile"]?.text,
|
||||
"email": controllers["email"]?.text,
|
||||
@ -282,38 +282,89 @@ class EnquiryTabState extends ConsumerState<EnquiryTab> {
|
||||
}
|
||||
}
|
||||
|
||||
// Future<void> handleSave() async {
|
||||
// if (!_formKey.currentState!.validate()) return;
|
||||
// setState(() {
|
||||
// if (_formKey.currentState!.validate()) {
|
||||
// isSaving = true;
|
||||
// dataDetails();
|
||||
// final dataSet = dataDetails();
|
||||
// print("dataSetAgent - $dataSet");
|
||||
// print("managerId - $managerId ,userId - $userId ");
|
||||
//
|
||||
// if ((docUploadedRCFile == null ||
|
||||
// (docUploadedRCFile?.bytes == null &&
|
||||
// docUploadedRCFile?.path == null)) &&
|
||||
// (rcFileUrlFromApi == null || rcFileUrlFromApi!.isEmpty)) {
|
||||
// ToastHelper.showErrorToast(context, "Please upload RC Document");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if ((docUploadedIDProof == null ||
|
||||
// (docUploadedIDProof?.bytes == null &&
|
||||
// docUploadedIDProof?.path == null)) &&
|
||||
// (idProofFileUrlFromApi == null || idProofFileUrlFromApi!.isEmpty)) {
|
||||
// ToastHelper.showErrorToast(context, "Please upload ID Proof");
|
||||
// return;
|
||||
// }
|
||||
// createUserData(dataSet);
|
||||
// } else {
|
||||
// // isDisable = false;
|
||||
//
|
||||
// setState(() => isSaving = false);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
Future<void> handleSave() async {
|
||||
if (!_formKey.currentState!.validate()) return;
|
||||
|
||||
setState(() {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
isSaving = true;
|
||||
dataDetails();
|
||||
final dataSet = dataDetails();
|
||||
print("dataSetAgent - $dataSet");
|
||||
print("managerId - $managerId ,userId - $userId ");
|
||||
|
||||
if ((docUploadedRCFile == null ||
|
||||
(docUploadedRCFile?.bytes == null &&
|
||||
docUploadedRCFile?.path == null)) &&
|
||||
(rcFileUrlFromApi == null || rcFileUrlFromApi!.isEmpty)) {
|
||||
ToastHelper.showErrorToast(context, "Please upload RC Document");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((docUploadedIDProof == null ||
|
||||
(docUploadedIDProof?.bytes == null &&
|
||||
docUploadedIDProof?.path == null)) &&
|
||||
(idProofFileUrlFromApi == null || idProofFileUrlFromApi!.isEmpty)) {
|
||||
ToastHelper.showErrorToast(context, "Please upload ID Proof");
|
||||
return;
|
||||
}
|
||||
createUserData(dataSet);
|
||||
} else {
|
||||
// isDisable = false;
|
||||
|
||||
setState(() => isSaving = false);
|
||||
}
|
||||
isSaving = true; // start saving
|
||||
});
|
||||
|
||||
final dataSet = dataDetails();
|
||||
|
||||
// check RC file
|
||||
if ((docUploadedRCFile == null ||
|
||||
(docUploadedRCFile?.bytes == null &&
|
||||
docUploadedRCFile?.path == null)) &&
|
||||
(rcFileUrlFromApi == null || rcFileUrlFromApi!.isEmpty)) {
|
||||
setState(() => isSaving = false); // reset button
|
||||
ToastHelper.showErrorToast(context, "Please upload RC Document");
|
||||
return;
|
||||
}
|
||||
|
||||
// check ID proof
|
||||
if ((docUploadedIDProof == null ||
|
||||
(docUploadedIDProof?.bytes == null &&
|
||||
docUploadedIDProof?.path == null)) &&
|
||||
(idProofFileUrlFromApi == null || idProofFileUrlFromApi!.isEmpty)) {
|
||||
setState(() => isSaving = false); // reset button
|
||||
ToastHelper.showErrorToast(context, "Please upload ID Proof");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await createUserData(dataSet); // API call
|
||||
ToastHelper.showInfoToast(context, "Enquiry saved successfully");
|
||||
} catch (e) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text(e.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('OK'),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
setState(() => isSaving = false); // re-enable button after save
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> attachFiles(http.MultipartRequest request) async {
|
||||
|
||||
@ -441,7 +441,7 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
|
||||
// 'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
final path =
|
||||
'api/policy/downloadPolicyFile?policy_id=$selectedId&file_type=policy_pdf';
|
||||
apiService.getPdfDownload(path, selectedId);
|
||||
apiService.getPdfDownload(context,path, selectedId);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@ -480,7 +480,7 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
|
||||
// 'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
final path =
|
||||
'api/policy/downloadPolicyFile?policy_id=$selectedId&file_type=policy_payment_receipt';
|
||||
apiService.getPdfDownload(path, selectedId);
|
||||
apiService.getPdfDownload(context,path, selectedId);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
|
||||
@ -698,6 +698,7 @@ class QuotationTabState extends ConsumerState<QuotationTab> {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget buildDocuments(BuildContext context) {
|
||||
return buildResponsiveUploadField(
|
||||
label: 'Quotation Documents',
|
||||
|
||||
@ -51,11 +51,17 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
Future.microtask(() {
|
||||
final id = ref.read(managerIdProvider);
|
||||
final roleId = ref.read(userRoleProvider);
|
||||
final userId = ref.read(userIdProvider);
|
||||
|
||||
print("A56 => r : $roleId | mId: $id | uId: $userId ");
|
||||
|
||||
// Staff - sanjeev.p@venbainfotech.com - T E S T S - 9 evarukku 8th id is manager
|
||||
// Manager - venbalap08@gmail.com - T E S T M - 8 evarukku 8th id is manager
|
||||
// Agent - venba2026@gmail.com - T E S T A - 5 evarkku 8th id is manager
|
||||
// so here i used userId
|
||||
|
||||
if (userId != null) { getStaffList(userId, roleId); }
|
||||
|
||||
print("ENQroleId - $roleId");
|
||||
if (id != null) {
|
||||
getStaffList(id, roleId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -63,7 +69,7 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
void refrshfilterDateRange() {}
|
||||
|
||||
Future<void> getStaffList(int managerId, role) async {
|
||||
print('getClaimList called MagId - $managerId - $role');
|
||||
print('A72 => Fns called => $managerId | $role');
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
@ -73,7 +79,7 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
|
||||
if (response['status'] == 'success') {
|
||||
final data = response['data'];
|
||||
print('getStaffListData - ${response['data']}');
|
||||
print('A82 => getStaffListData => ${response['data']}');
|
||||
setState(() {
|
||||
if (data is List) {
|
||||
// Already a list of maps
|
||||
@ -159,19 +165,22 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
filteredData = getStaffData.where((item) {
|
||||
// final isActiveStatus = item['is_active'] == "1" ? "active" : "inactive";
|
||||
|
||||
return (_formatDate(item['created_on']) ?? '').toLowerCase().contains(
|
||||
return (_formatDate(item['created_on']) ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['reg_no'] ?? '').toLowerCase().contains(
|
||||
(_formatDate(item['updated_on']) ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['insurer_name'] ?? '').toLowerCase().contains(
|
||||
(item['reg_no'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['status'] ?? '').toLowerCase().contains(
|
||||
(item['insurer_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['remarks'] ?? '').toLowerCase().contains(query.toLowerCase());
|
||||
(item['status'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['remarks'] ?? '-').toLowerCase().contains(query.toLowerCase());
|
||||
}).toList();
|
||||
});
|
||||
}
|
||||
@ -316,6 +325,7 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
headers: [
|
||||
"id",
|
||||
"created_on",
|
||||
"updated_on",
|
||||
"reg_no",
|
||||
"insurer_name",
|
||||
"status",
|
||||
@ -402,7 +412,14 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'Received Date & Time',
|
||||
'Created Date',
|
||||
style: _headerStyle,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'Updated Date',
|
||||
style: _headerStyle,
|
||||
),
|
||||
),
|
||||
@ -521,6 +538,13 @@ class EnquiryListState extends ConsumerState<EnquiryList> {
|
||||
style: _dataBold,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
_formatDate(item['updated_on']) ?? '-',
|
||||
style: _dataBold,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(item['reg_no'] ?? '-', style: _dataBold),
|
||||
|
||||
@ -43,16 +43,15 @@ class claimListState extends ConsumerState<claimList> {
|
||||
Future.microtask(() {
|
||||
final id = ref.read(managerIdProvider);
|
||||
final roleId = ref.read(userRoleProvider);
|
||||
final userId = ref.read(userIdProvider);
|
||||
print("G47 => r : $roleId | mId: $id | uId: $userId ");
|
||||
if (userId != null) { getStaffList(userId, roleId); }
|
||||
|
||||
print("ENQroleId - $roleId");
|
||||
if (id != null) {
|
||||
getStaffList(id, roleId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> getStaffList(int managerId, role) async {
|
||||
print('getClaimList called MagId - $managerId - $role');
|
||||
print('G54 => Fns called => $managerId | $role');
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
@ -62,7 +61,7 @@ class claimListState extends ConsumerState<claimList> {
|
||||
|
||||
if (response['status'] == 'success') {
|
||||
final data = response['data'];
|
||||
print('clImlist - ${response['data']}');
|
||||
print('F64 => clImlist => ${response['data']}');
|
||||
setState(() {
|
||||
if (data is List) {
|
||||
// Already a list of maps
|
||||
@ -114,23 +113,23 @@ class claimListState extends ConsumerState<claimList> {
|
||||
filteredData = getStaffData.where((item) {
|
||||
// final isActiveStatus = item['is_active'] == "1" ? "active" : "inactive";
|
||||
|
||||
return (item['reg_no'] ?? '').toLowerCase().contains(
|
||||
return (item['reg_no'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['insurer_name'] ?? '').toLowerCase().contains(
|
||||
(item['insurer_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['policy_no'] ?? '').toLowerCase().contains(
|
||||
(item['policy_no'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['claim_type_value'] ?? '').toLowerCase().contains(
|
||||
(item['claim_type_value'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['claim_number'] ?? '').toLowerCase().contains(
|
||||
(item['claim_number'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(_formatDate(
|
||||
item['policy_end_date'],
|
||||
item['policy_end_date'] ?? '-',
|
||||
).toLowerCase()).contains(query.toLowerCase());
|
||||
}).toList();
|
||||
});
|
||||
@ -248,7 +247,7 @@ class claimListState extends ConsumerState<claimList> {
|
||||
"policy_no",
|
||||
"policy_end_date",
|
||||
"claim_number",
|
||||
"claim_type",
|
||||
"claim_type_value",
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
@ -41,16 +41,15 @@ class endosementState extends ConsumerState<endosement> {
|
||||
Future.microtask(() {
|
||||
final id = ref.read(managerIdProvider);
|
||||
final roleId = ref.read(userRoleProvider);
|
||||
final userId = ref.read(userIdProvider);
|
||||
print("F46 => r : $roleId | mId: $id | uId: $userId ");
|
||||
if (userId != null) { getStaffList(userId, roleId); }
|
||||
|
||||
print("ENQroleId - $roleId");
|
||||
if (id != null) {
|
||||
getStaffList(id, roleId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> getStaffList(int managerId, role) async {
|
||||
print('getClaimList called MagId - $managerId - $role');
|
||||
print('F53 => Fns called => $managerId | $role');
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
@ -60,7 +59,7 @@ class endosementState extends ConsumerState<endosement> {
|
||||
|
||||
if (response['status'] == 'success') {
|
||||
final data = response['data'];
|
||||
print('getStaffListData - ${response['data']}');
|
||||
print('F62 => End rse mnt List => ${response['data']}');
|
||||
setState(() {
|
||||
if (data is List) {
|
||||
// Already a list of maps
|
||||
@ -112,19 +111,19 @@ class endosementState extends ConsumerState<endosement> {
|
||||
filteredData = getStaffData.where((item) {
|
||||
// final isActiveStatus = item['is_active'] == "1" ? "active" : "inactive";
|
||||
|
||||
return (item['reg_no'] ?? '').toLowerCase().contains(
|
||||
return (item['reg_no'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['insurer_name'] ?? '').toLowerCase().contains(
|
||||
(item['insurer_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['policy_number'] ?? '').toLowerCase().contains(
|
||||
(item['policy_number'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['endorsement_type'] ?? '').toLowerCase().contains(
|
||||
(item['endorsement_type_value'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['endorsement_no'] ?? '').toLowerCase().contains(
|
||||
(item['endorsement_no'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
);
|
||||
}).toList();
|
||||
@ -243,7 +242,7 @@ class endosementState extends ConsumerState<endosement> {
|
||||
"reg_no",
|
||||
"insurer_name",
|
||||
"policy_number",
|
||||
"endorsement_type",
|
||||
"endorsement_type_value",
|
||||
"endorsement_no",
|
||||
],
|
||||
),
|
||||
|
||||
@ -172,10 +172,10 @@ class ClaimsSubListState extends ConsumerState<ClaimsSubList> {
|
||||
child: Text('Status', style: _headerStyle),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('Action', style: _headerStyle),
|
||||
),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Text('Action', style: _headerStyle),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -285,38 +285,38 @@ class ClaimsSubListState extends ConsumerState<ClaimsSubList> {
|
||||
child: Text(item['claim_status_value'] ?? '-', style: _dataBold),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
children: [
|
||||
PopupMenuButton<int>(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.zero,
|
||||
offset: Offset(0, 30),
|
||||
icon: Icon(
|
||||
Icons.more_vert,
|
||||
color: Color(0xFF475569),
|
||||
size: 14,
|
||||
),
|
||||
itemBuilder: (context) => [
|
||||
CustomPopupMenuEntry(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 8,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: _buildPopupMenuActions(context, item),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Expanded(
|
||||
// flex: 1,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// PopupMenuButton<int>(
|
||||
// color: Colors.white,
|
||||
// padding: EdgeInsets.zero,
|
||||
// offset: Offset(0, 30),
|
||||
// icon: Icon(
|
||||
// Icons.more_vert,
|
||||
// color: Color(0xFF475569),
|
||||
// size: 14,
|
||||
// ),
|
||||
// itemBuilder: (context) => [
|
||||
// CustomPopupMenuEntry(
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.symmetric(
|
||||
// horizontal: 8,
|
||||
// vertical: 8,
|
||||
// ),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: _buildPopupMenuActions(context, item),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -134,7 +134,7 @@ class UploadIncentiveModalState extends ConsumerState<UploadIncentiveModal> {
|
||||
print("FilterDAta - $query");
|
||||
setState(() {
|
||||
filteredIncentiveData = getAgentIncentiveFileData.where((item) {
|
||||
return (item['incentive_month'] ?? '').toLowerCase().contains(
|
||||
return (item['incentive_month'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
);
|
||||
}).toList();
|
||||
@ -664,7 +664,7 @@ class UploadIncentiveModalState extends ConsumerState<UploadIncentiveModal> {
|
||||
final selectedId = file['id'];
|
||||
final path =
|
||||
'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
apiService.getPdfDownload(path, selectedId);
|
||||
apiService.getPdfDownload(context,path, selectedId);
|
||||
},
|
||||
onDelete: () async {
|
||||
print("Delete ${file['id']}");
|
||||
|
||||
@ -83,11 +83,11 @@ class AgentListState extends ConsumerState<AgentList> {
|
||||
setState(() {
|
||||
filteredData = getAgentData.where((item) {
|
||||
final isActiveStatus = item['is_active'] == "1" ? "active" : "inactive";
|
||||
return item['name'].toLowerCase().contains(query.toLowerCase()) ||
|
||||
item['email'].toLowerCase().contains(query.toLowerCase()) ||
|
||||
item['mobile'].toLowerCase().contains(query.toLowerCase()) ||
|
||||
item['address'].toLowerCase().contains(query.toLowerCase()) ||
|
||||
item['agent_code'].toLowerCase().contains(query.toLowerCase()) ||
|
||||
return (item['name'] ?? '-').toLowerCase().contains(query.toLowerCase()) ||
|
||||
(item['email'] ?? '-').toLowerCase().contains(query.toLowerCase()) ||
|
||||
(item['mobile'] ?? '-').toLowerCase().contains(query.toLowerCase()) ||
|
||||
(item['address'] ?? '-').toLowerCase().contains(query.toLowerCase()) ||
|
||||
(item['agent_code'] ?? '-').toLowerCase().contains(query.toLowerCase()) ||
|
||||
(isActiveStatus.contains(query.toLowerCase()));
|
||||
}).toList();
|
||||
});
|
||||
|
||||
@ -292,7 +292,7 @@ class ProfileState extends ConsumerState<Profile> {
|
||||
path =
|
||||
'api/agent/downloadAgentIncentiveFile?id=$latestId';
|
||||
}
|
||||
apiService.getPdfDownload(
|
||||
apiService.getPdfDownload(context,
|
||||
path,
|
||||
latestId,
|
||||
);
|
||||
@ -386,7 +386,7 @@ class ProfileState extends ConsumerState<Profile> {
|
||||
path =
|
||||
'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
}
|
||||
apiService.getPdfDownload(
|
||||
apiService.getPdfDownload(context,
|
||||
path,
|
||||
selectedId,
|
||||
);
|
||||
@ -549,7 +549,7 @@ class ProfileState extends ConsumerState<Profile> {
|
||||
path =
|
||||
'api/agent/downloadAgentIncentiveFile?id=$latestId';
|
||||
}
|
||||
apiService.getPdfDownload(
|
||||
apiService.getPdfDownload(context,
|
||||
path,
|
||||
latestId,
|
||||
);
|
||||
@ -643,7 +643,7 @@ class ProfileState extends ConsumerState<Profile> {
|
||||
path =
|
||||
'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
}
|
||||
apiService.getPdfDownload(
|
||||
apiService.getPdfDownload(context,
|
||||
path,
|
||||
selectedId,
|
||||
);
|
||||
|
||||
@ -285,7 +285,7 @@ class ProfilePopUpState extends ConsumerState<ProfilePopUp> {
|
||||
path =
|
||||
'api/agent/downloadAgentIncentiveFile?id=$latestId';
|
||||
}
|
||||
apiService.getPdfDownload(path, latestId);
|
||||
apiService.getPdfDownload(context,path, latestId);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -368,7 +368,7 @@ class ProfilePopUpState extends ConsumerState<ProfilePopUp> {
|
||||
path =
|
||||
'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
}
|
||||
apiService.getPdfDownload(
|
||||
apiService.getPdfDownload(context,
|
||||
path,
|
||||
selectedId,
|
||||
);
|
||||
|
||||
@ -40,6 +40,7 @@ class StaffListState extends ConsumerState<StaffList> {
|
||||
|
||||
Future.microtask(() {
|
||||
final id = ref.read(managerIdProvider);
|
||||
print("E43 => mId: $id");
|
||||
if (id != null) {
|
||||
getStaffList(id);
|
||||
}
|
||||
@ -79,17 +80,17 @@ class StaffListState extends ConsumerState<StaffList> {
|
||||
filteredData = getStaffData.where((item) {
|
||||
final isActiveStatus = item['is_active'] == "1" ? "active" : "inactive";
|
||||
|
||||
return (item['name'] ?? '').toLowerCase().contains(
|
||||
return (item['name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['email'] ?? '').toLowerCase().contains(query.toLowerCase()) ||
|
||||
(item['mobile'] ?? '').toLowerCase().contains(
|
||||
(item['email'] ?? '-').toLowerCase().contains(query.toLowerCase()) ||
|
||||
(item['mobile'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['address'] ?? '').toLowerCase().contains(
|
||||
(item['address'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['emp_id'] ?? item['agent_code'] ?? '').toLowerCase().contains(
|
||||
(item['emp_id'] ?? item['agent_code'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
isActiveStatus.contains(query.toLowerCase());
|
||||
@ -100,7 +101,7 @@ class StaffListState extends ConsumerState<StaffList> {
|
||||
final TextEditingController _searchStaffController = TextEditingController();
|
||||
|
||||
Future<void> getStaffList(int managerId) async {
|
||||
print('getClaimList called MagId - $managerId');
|
||||
print('E104 => Fns called => $managerId');
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
@ -109,7 +110,7 @@ class StaffListState extends ConsumerState<StaffList> {
|
||||
final response = await apiService.fetchStaffUserList(managerId);
|
||||
|
||||
if (response['status'] == 'success') {
|
||||
print('getStaffListData - ${response['data']}');
|
||||
print('E113 => getStaffListData => ${response['data']}');
|
||||
setState(() {
|
||||
getStaffData = List<Map<String, dynamic>>.from(response['data']);
|
||||
originalData = getStaffData;
|
||||
|
||||
@ -78,7 +78,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
final id = ref.read(userIdProvider);
|
||||
final roleId = ref.read(userRoleProvider);
|
||||
|
||||
print("ENQroleId - $roleId");
|
||||
print("B81 => roleId: $roleId | userId: $id ");
|
||||
if (id != null) {
|
||||
getStaffList(id, roleId);
|
||||
}
|
||||
@ -86,7 +86,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
}
|
||||
|
||||
Future<void> getStaffList(int managerId, role) async {
|
||||
print('getClaimList called MagId - $managerId - $role');
|
||||
print('B89 => Fns called => $managerId | $role');
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
@ -96,7 +96,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
|
||||
if (response['status'] == 'success') {
|
||||
final data = response['data'];
|
||||
print('go to 81 - getStaffListData - ${response['data']}');
|
||||
print('B99 => getStaffListData => ${response['data']}');
|
||||
setState(() {
|
||||
policiesIssuedToday = data['policies_issued']['today'].toString();
|
||||
policiesIssuedYear = data['policies_issued']['year'].toString();
|
||||
|
||||
@ -67,25 +67,26 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
Future.microtask(() {
|
||||
final id = ref.read(managerIdProvider);
|
||||
roleId = ref.read(userRoleProvider);
|
||||
final userId = ref.read(userIdProvider);
|
||||
|
||||
print("ENQroleId - $roleId");
|
||||
if (id != null) {
|
||||
getStaffList(id, roleId);
|
||||
}
|
||||
print("C72 => r : $roleId | mId: $id | uId: $userId ");
|
||||
if (userId != null) { getStaffList(userId, roleId); }
|
||||
});
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
final id = ref.read(managerIdProvider);
|
||||
final roleId = ref.read(userRoleProvider);
|
||||
final userId = ref.read(userIdProvider);
|
||||
|
||||
print("C82 => r : $roleId | mId: $id | uId: $userId ");
|
||||
if (userId != null) { getStaffList(userId, roleId); }
|
||||
|
||||
if (id != null) {
|
||||
getStaffList(id, roleId);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getStaffList(int managerId, role) async {
|
||||
print('getClaimList called MagId - $managerId - $role');
|
||||
|
||||
print('C89 => Fns called => $managerId | $role');
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
@ -95,7 +96,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
|
||||
if (response['status'] == 'success') {
|
||||
final data = response['data'];
|
||||
print('getStaffListData - ${response['data']}');
|
||||
print('C99 => getStaffListData => ${response['data']}');
|
||||
setState(() {
|
||||
if (data is List) {
|
||||
// Already a list of maps
|
||||
@ -159,34 +160,37 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
filteredData = getStaffData.where((item) {
|
||||
// final isActiveStatus = item['is_active'] == "1" ? "active" : "inactive";
|
||||
|
||||
return (item['agent_name'] ?? '').toLowerCase().contains(
|
||||
return (item['agent_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['reg_no'] ?? '').toLowerCase().contains(
|
||||
(item['reg_no'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['insurer_name'] ?? '').toLowerCase().contains(
|
||||
(item['insurer_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['assigned_to_name'] ?? '').toLowerCase().contains(
|
||||
(item['assigned_to_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['insured_name'] ?? '').toLowerCase().contains(
|
||||
(item['insured_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['premium_amount'] ?? '').toLowerCase().contains(
|
||||
(item['premium_amount'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['payment_mode'] ?? '').toLowerCase().contains(
|
||||
(item['payment_mode'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(_formatDate(item['updated_on']) ?? '').toLowerCase().contains(
|
||||
(_formatDate(item['created_on']) ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['policy_number'] ?? '').toLowerCase().contains(
|
||||
(_formatDate(item['updated_on']) ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['status'] ?? '').toLowerCase().contains(query.toLowerCase());
|
||||
(item['policy_number'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['status'] ?? '-').toLowerCase().contains(query.toLowerCase());
|
||||
}).toList();
|
||||
});
|
||||
}
|
||||
@ -211,7 +215,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
regNum,
|
||||
) {
|
||||
return [
|
||||
if (roleId == 'manager') ...[
|
||||
if (roleId == 'manager' && data['status'] != 'Quotation Created') ...[
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
@ -424,6 +428,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
? true
|
||||
: false,
|
||||
headers: [
|
||||
"created_on",
|
||||
"updated_on",
|
||||
"reg_no",
|
||||
"agent_name",
|
||||
@ -493,9 +498,12 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text('Date', style: _headerStyle),
|
||||
child: Text('Created Date', style: _headerStyle),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text('Updated Date', style: _headerStyle),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text('Reg.No', style: _headerStyle),
|
||||
@ -630,6 +638,15 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
_formatDate(item['created_on']) ?? '-',
|
||||
style: _dataBold,
|
||||
softWrap: true,
|
||||
maxLines: 3,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
@ -639,7 +656,6 @@ class EnquiryStaffState extends ConsumerState<EnquiryStaff> {
|
||||
maxLines: 3,
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(item['reg_no'] ?? '-', style: _dataBold),
|
||||
|
||||
@ -757,7 +757,7 @@ class PolicyScreenState extends ConsumerState<PolicyScreen> {
|
||||
// 'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
final path =
|
||||
'api/enquiry/downloadEnquiryFile?enquiry_id=$selectedId&file_type=rc';
|
||||
apiService.getPdfDownload(path, selectedId);
|
||||
apiService.getPdfDownload(context,path, selectedId);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@ -798,7 +798,7 @@ class PolicyScreenState extends ConsumerState<PolicyScreen> {
|
||||
// 'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
final path =
|
||||
'api/enquiry/downloadEnquiryFile?enquiry_id=$selectedId&file_type=id_proof';
|
||||
apiService.getPdfDownload(path, selectedId);
|
||||
apiService.getPdfDownload(context,path, selectedId);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@ -835,7 +835,7 @@ class PolicyScreenState extends ConsumerState<PolicyScreen> {
|
||||
// 'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
final path =
|
||||
'api/enquiry/downloadEnquiryFile?enquiry_id=$selectedId&file_type=previous_policy';
|
||||
apiService.getPdfDownload(path, selectedId);
|
||||
apiService.getPdfDownload(context,path, selectedId);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@ -875,7 +875,7 @@ class PolicyScreenState extends ConsumerState<PolicyScreen> {
|
||||
final path =
|
||||
'api/quotation/downloadAdditionalUploadedFile?id=$acceptedQuotationId';
|
||||
|
||||
apiService.getPdfDownload(path, selectedId);
|
||||
apiService.getPdfDownload(context,path, selectedId);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
|
||||
@ -44,10 +44,11 @@ class policylistState extends ConsumerState<policylist> {
|
||||
Future.microtask(() {
|
||||
final id = ref.read(managerIdProvider);
|
||||
roleId = ref.read(userRoleProvider);
|
||||
final userId = ref.read(userIdProvider);
|
||||
|
||||
print("ENQroleId - $roleId");
|
||||
if (id != null) {
|
||||
getStaffList(id, roleId);
|
||||
print("D49 => r : $roleId | mId: $id | uId: $userId ");
|
||||
if (userId != null) {
|
||||
getStaffList(userId, roleId);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -55,14 +56,16 @@ class policylistState extends ConsumerState<policylist> {
|
||||
void refresh() {
|
||||
final id = ref.read(managerIdProvider);
|
||||
final roleId = ref.read(userRoleProvider);
|
||||
final userId = ref.read(userIdProvider);
|
||||
|
||||
if (id != null) {
|
||||
getStaffList(id, roleId);
|
||||
print("D61 => r : $roleId | mId: $id | uId: $userId");
|
||||
if (userId != null) {
|
||||
getStaffList(userId, roleId);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getStaffList(int managerId, role) async {
|
||||
print('getClaimList called MagId - $managerId - $role');
|
||||
print('D68 => Fns called => $managerId | $role');
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
@ -75,7 +78,7 @@ class policylistState extends ConsumerState<policylist> {
|
||||
|
||||
if (response['status'] == 'success') {
|
||||
final data = response['data'];
|
||||
print('getStaffListData - ${response['data']}');
|
||||
print('D81 => getStaffListData => ${response['data']}');
|
||||
setState(() {
|
||||
if (data is List) {
|
||||
// Already a list of maps
|
||||
@ -127,34 +130,34 @@ class policylistState extends ConsumerState<policylist> {
|
||||
filteredData = getStaffData.where((item) {
|
||||
// final isActiveStatus = item['is_active'] == "1" ? "active" : "inactive";
|
||||
|
||||
return (item['agent_name'] ?? '').toLowerCase().contains(
|
||||
return (item['agent_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['reg_no'] ?? '').toLowerCase().contains(
|
||||
(item['reg_no'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['insurer_name'] ?? '').toLowerCase().contains(
|
||||
(item['insurer_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['assigned_to_name'] ?? '').toLowerCase().contains(
|
||||
(item['assigned_to_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['insured_name'] ?? '').toLowerCase().contains(
|
||||
(item['insured_name'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['premium_amount'] ?? '').toLowerCase().contains(
|
||||
(item['premium_amount'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['payment_mode'] ?? '').toLowerCase().contains(
|
||||
(item['payment_mode'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(_formatDate(item['updated_on']) ?? '').toLowerCase().contains(
|
||||
(_formatDate(item['updated_on']) ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['policy_number'] ?? '').toLowerCase().contains(
|
||||
(item['policy_number'] ?? '-').toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(item['status'] ?? '').toLowerCase().contains(query.toLowerCase());
|
||||
(item['status'] ?? '-').toLowerCase().contains(query.toLowerCase());
|
||||
;
|
||||
}).toList();
|
||||
});
|
||||
@ -374,6 +377,7 @@ class policylistState extends ConsumerState<policylist> {
|
||||
"premium_amount",
|
||||
"payment_mode",
|
||||
"updated_on",
|
||||
"policy_number",
|
||||
"status",
|
||||
],
|
||||
),
|
||||
|
||||
@ -522,7 +522,7 @@ class QuotationScreenState extends ConsumerState<QuotationScreen> {
|
||||
// 'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
final path =
|
||||
'api/enquiry/downloadEnquiryFile?enquiry_id=$selectedId&file_type=rc';
|
||||
apiService.getPdfDownload(path, selectedId);
|
||||
apiService.getPdfDownload(context,path, selectedId);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@ -563,7 +563,7 @@ class QuotationScreenState extends ConsumerState<QuotationScreen> {
|
||||
// 'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
final path =
|
||||
'api/enquiry/downloadEnquiryFile?enquiry_id=$selectedId&file_type=id_proof';
|
||||
apiService.getPdfDownload(path, selectedId);
|
||||
apiService.getPdfDownload(context,path, selectedId);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@ -594,13 +594,13 @@ class QuotationScreenState extends ConsumerState<QuotationScreen> {
|
||||
Widget buildDocPrevPolicy(BuildContext context, bool isMobile) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
print("Upload $selectedEnquiryId");
|
||||
print("QD597 Upload $selectedEnquiryId");
|
||||
final selectedId = selectedEnquiryId;
|
||||
// final path =
|
||||
// 'api/agent/downloadAgentIncentiveFile?id=$selectedId';
|
||||
final path =
|
||||
'api/enquiry/downloadEnquiryFile?enquiry_id=$selectedId&file_type=previous_policy';
|
||||
apiService.getPdfDownload(path, selectedId);
|
||||
apiService.getPdfDownload(context,path, selectedId);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user