policy pdf dashboard chngs

This commit is contained in:
venbaittech 2025-12-03 15:24:40 +05:30
parent fcdc9da609
commit 6d7e6f24b9
27 changed files with 3740 additions and 580 deletions

File diff suppressed because one or more lines are too long

View File

@ -666,6 +666,7 @@ class ApiService {
String? selectedStatus, String? selectedStatus,
String? selectedStaffId, String? selectedStaffId,
}) async { }) async {
print("selectedStatusselectedStatus - $selectedStatus");
if (_token == null) { if (_token == null) {
await _initializeToken(); await _initializeToken();
} }
@ -692,11 +693,13 @@ class ApiService {
if (role == 'staff') { if (role == 'staff') {
url = Uri.parse( 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 { } else {
url = Uri.parse( 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<Map<String, dynamic>> fetchPolicyDataOnlyList( Future<Map<String, dynamic>> fetchPolicyDataOnlyList(
int id, dynamic id,
role, { role, {
String? fromDate, String? fromDate,
String? toDate, String? toDate,

View File

@ -376,11 +376,7 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
), ),
child: IconButton( child: IconButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
icon: const Icon( icon: const Icon(Icons.quora, color: Colors.black87, size: 20),
Icons.request_quote_outlined,
color: Colors.black87,
size: 20,
),
onPressed: () { onPressed: () {
SideDrawerPanel.show( SideDrawerPanel.show(
context: context, context: context,

View File

@ -5,6 +5,7 @@ import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:http/http.dart' as ref;
import 'package:toastification/toastification.dart'; import 'package:toastification/toastification.dart';
import '../../../../core/config/env.dart'; import '../../../../core/config/env.dart';
@ -15,12 +16,15 @@ import '../../../../data/utils/validators.dart';
import '../../../layouts/responsive_layout.dart'; import '../../../layouts/responsive_layout.dart';
import '../../../themes/indicators/customizd_file_upload.dart'; import '../../../themes/indicators/customizd_file_upload.dart';
import '../../../themes/indicators/input_field_decoration.dart'; import '../../../themes/indicators/input_field_decoration.dart';
import '../../../themes/indicators/search_field_theme.dart';
import '../../../themes/indicators/text_field_theme.dart'; import '../../../themes/indicators/text_field_theme.dart';
// 🔹 Custom Dialog Widget // 🔹 Custom Dialog Widget
class AddDialog extends StatefulWidget { class AddDialog extends StatefulWidget {
final String title; final String title;
final dynamic userId; final dynamic userId;
final dynamic managerId;
final dynamic role;
final void Function(String value) onSubmit; final void Function(String value) onSubmit;
final dynamic policyNumber; final dynamic policyNumber;
const AddDialog({ const AddDialog({
@ -28,6 +32,8 @@ class AddDialog extends StatefulWidget {
required this.title, required this.title,
required this.onSubmit, required this.onSubmit,
required this.userId, required this.userId,
required this.managerId,
required this.role,
this.policyNumber, this.policyNumber,
}); });
@ -63,6 +69,8 @@ class _AddDialogState extends State<AddDialog> {
List<String> tabHeader = ['policyNum', 'claimsDesc', 'remarks']; List<String> tabHeader = ['policyNum', 'claimsDesc', 'remarks'];
final TextEditingController _searchStaffController = TextEditingController();
List<Map<String, dynamic>> getClaimsTypeData = []; List<Map<String, dynamic>> getClaimsTypeData = [];
List<Map<String, dynamic>> filteredClaimsData = []; List<Map<String, dynamic>> filteredClaimsData = [];
@ -72,6 +80,12 @@ class _AddDialogState extends State<AddDialog> {
String? selectedClaimsType; String? selectedClaimsType;
String? selectedEndorsement; String? selectedEndorsement;
dynamic roleId;
List<Map<String, dynamic>> getPolicyData = [];
List<Map<String, dynamic>> originalData = [];
List<Map<String, dynamic>> filteredData = [];
Map<String, dynamic> claimsDetails() { Map<String, dynamic> claimsDetails() {
final data = { final data = {
"policy_number": controllers["policyNum"]?.text, "policy_number": controllers["policyNum"]?.text,
@ -103,12 +117,108 @@ class _AddDialogState extends State<AddDialog> {
} }
controllers["policyNum"]?.text = widget.policyNumber; 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.) // 🔹 Init logic here (API calls, token fetch, etc.)
_initializeToken(); _initializeToken();
getClaimsType(); getClaimsType();
getEnroementType(); getEnroementType();
} }
Future<void> 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<Map<String, dynamic>>.from(data);
} else if (data is Map) {
// Single object, wrap in a list
getPolicyData = [Map<String, dynamic>.from(data)];
} else {
getPolicyData = [];
}
// getStaffData = List<Map<String, dynamic>>.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<void> _initializeToken() async { Future<void> _initializeToken() async {
_token = await AuthService.getToken(); _token = await AuthService.getToken();
print("APISERTOKEN - $_token"); print("APISERTOKEN - $_token");
@ -362,6 +472,18 @@ class _AddDialogState extends State<AddDialog> {
], ],
), ),
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), const SizedBox(height: 16),
// 🔹 Switch content dynamically // 🔹 Switch content dynamically

View File

@ -578,6 +578,8 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
context: context, context: context,
builder: (ctx) => AddDialog( builder: (ctx) => AddDialog(
userId: userId, userId: userId,
role: null,
managerId: null,
title: "Endorsement", title: "Endorsement",
policyNumber: selectedPolicyNumber, policyNumber: selectedPolicyNumber,
onSubmit: (value) { onSubmit: (value) {
@ -604,6 +606,8 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
builder: (ctx) => AddDialog( builder: (ctx) => AddDialog(
userId: userId, userId: userId,
title: "Claims", title: "Claims",
role: null,
managerId: null,
policyNumber: selectedPolicyNumber, policyNumber: selectedPolicyNumber,
onSubmit: (value) { onSubmit: (value) {
debugPrint("New Claim: $value"); debugPrint("New Claim: $value");

View File

@ -14,6 +14,7 @@ import '../../../providers/manager_provider.dart';
import '../../../themes/indicators/export_btn.dart'; import '../../../themes/indicators/export_btn.dart';
import '../../../themes/indicators/search_field_theme.dart'; import '../../../themes/indicators/search_field_theme.dart';
import '../../../widgets/custom_action_popup.dart'; import '../../../widgets/custom_action_popup.dart';
import '../enquiry/policy_popup.dart';
class claimList extends ConsumerStatefulWidget { class claimList extends ConsumerStatefulWidget {
const claimList({super.key}); const claimList({super.key});
@ -34,6 +35,10 @@ class claimListState extends ConsumerState<claimList> {
final TextEditingController _searchStaffController = TextEditingController(); final TextEditingController _searchStaffController = TextEditingController();
dynamic userId;
dynamic roleId;
dynamic managerId;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -42,11 +47,15 @@ class claimListState extends ConsumerState<claimList> {
Future.microtask(() { Future.microtask(() {
final id = ref.read(managerIdProvider); final id = ref.read(managerIdProvider);
final roleId = ref.read(userRoleProvider); managerId = ref.read(managerIdProvider);
final userId = ref.read(userIdProvider);
// roleId = ref.read(userRoleProvider);
// roleId = ref.read(userRoleProvider);
userId = ref.read(userIdProvider);
print("G47 => r : $roleId | mId: $id | uId: $userId "); print("G47 => r : $roleId | mId: $id | uId: $userId ");
if (userId != null) { if (userId != null) {
getStaffList(userId, roleId); getStaffList(id!, userId);
} }
}); });
} }
@ -284,6 +293,48 @@ class claimListState extends ConsumerState<claimList> {
'claim_status_value', '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), // SizedBox(width: 10),
// GestureDetector( // GestureDetector(

View File

@ -14,6 +14,7 @@ import '../../../providers/manager_provider.dart';
import '../../../themes/indicators/export_btn.dart'; import '../../../themes/indicators/export_btn.dart';
import '../../../themes/indicators/search_field_theme.dart'; import '../../../themes/indicators/search_field_theme.dart';
import '../../../widgets/custom_action_popup.dart'; import '../../../widgets/custom_action_popup.dart';
import '../enquiry/policy_popup.dart';
class endosement extends ConsumerStatefulWidget { class endosement extends ConsumerStatefulWidget {
const endosement({super.key}); const endosement({super.key});
@ -31,6 +32,9 @@ class endosementState extends ConsumerState<endosement> {
List<Map<String, dynamic>> originalData = []; List<Map<String, dynamic>> originalData = [];
List<Map<String, dynamic>> filteredData = []; List<Map<String, dynamic>> filteredData = [];
bool isLoading = false; bool isLoading = false;
dynamic userId;
dynamic roleId;
dynamic managerId;
@override @override
void initState() { void initState() {
@ -40,8 +44,9 @@ class endosementState extends ConsumerState<endosement> {
Future.microtask(() { Future.microtask(() {
final id = ref.read(managerIdProvider); final id = ref.read(managerIdProvider);
final roleId = ref.read(userRoleProvider); managerId = ref.read(managerIdProvider);
final userId = ref.read(userIdProvider); roleId = ref.read(userRoleProvider);
userId = ref.read(userIdProvider);
print("F46 => r : $roleId | mId: $id | uId: $userId "); print("F46 => r : $roleId | mId: $id | uId: $userId ");
if (userId != null) { if (userId != null) {
getStaffList(userId, roleId); getStaffList(userId, roleId);
@ -278,7 +283,48 @@ class endosementState extends ConsumerState<endosement> {
"endorsement_no", "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), // SizedBox(width: 10),
// GestureDetector( // GestureDetector(
// onTap: () { // onTap: () {

View File

@ -122,6 +122,19 @@ class AgentState extends ConsumerState<Agent> {
Future<void> handleSave() async { Future<void> handleSave() async {
if (!_formKey.currentState!.validate()) return; 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(() { setState(() {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
dataDetails(); dataDetails();
@ -500,7 +513,16 @@ class AgentState extends ConsumerState<Agent> {
SizedBox(width: 10), SizedBox(width: 10),
ThemedFormField( ThemedFormField(
controller: controllers['email']!, 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), borderColor: Color(0xFFE2E8F0),
highlightColor: Color(0xFF50A398), highlightColor: Color(0xFF50A398),
inputFormatters: [ inputFormatters: [
@ -520,11 +542,21 @@ class AgentState extends ConsumerState<Agent> {
SizedBox(width: 10), SizedBox(width: 10),
ThemedFormField( ThemedFormField(
controller: controllers['mobile']!, 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), borderColor: Color(0xFFE2E8F0),
highlightColor: Color(0xFF50A398), highlightColor: Color(0xFF50A398),
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[ 0-9]')), FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
], ],
txtwidth: MediaQuery.of(context).size.width * 0.26, txtwidth: MediaQuery.of(context).size.width * 0.26,
), ),

View File

@ -158,6 +158,19 @@ class StaffState extends ConsumerState<Staff> {
Future<void> handleSave() async { Future<void> handleSave() async {
if (!_formKey.currentState!.validate()) return; 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(() { setState(() {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
dataDetails(); dataDetails();
@ -505,7 +518,17 @@ class StaffState extends ConsumerState<Staff> {
controller: controllers['email']!, controller: controllers['email']!,
borderColor: Color(0xFFE2E8F0), borderColor: Color(0xFFE2E8F0),
highlightColor: Color(0xFF50A398), 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: [ inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9_@.]')), FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9_@.]')),
], ],
@ -525,9 +548,20 @@ class StaffState extends ConsumerState<Staff> {
controller: controllers['mobile']!, controller: controllers['mobile']!,
borderColor: Color(0xFFE2E8F0), borderColor: Color(0xFFE2E8F0),
highlightColor: Color(0xFF50A398), 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: [ inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[ 0-9]')), FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
], ],
txtwidth: MediaQuery.of(context).size.width * 0.26, txtwidth: MediaQuery.of(context).size.width * 0.26,
), ),

View File

@ -11,6 +11,7 @@ import '../../layouts/main_layout.dart';
import '../../providers/manager_provider.dart'; import '../../providers/manager_provider.dart';
import '../../providers/quotation_staff_proivder.dart'; import '../../providers/quotation_staff_proivder.dart';
import '../../providers/userRoleProvider.dart'; import '../../providers/userRoleProvider.dart';
import '../../themes/charts/barChart.dart';
import '../staff/Enquiry/tabs/tab.dart'; import '../staff/Enquiry/tabs/tab.dart';
import '../staff/assignStaff.dart'; import '../staff/assignStaff.dart';
@ -365,41 +366,40 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// 🔹 Stats cards stacked // 🔹 Stats cards stacked
Padding( // Padding(
padding: const EdgeInsets.all(8.0), // padding: const EdgeInsets.all(8.0),
child: StatCard( // child: StatCard(
title: "Policies Issued", // title: "Policies Issued",
today: policiesIssuedToday ?? '', // today: policiesIssuedToday ?? '',
month: policiesIssuedMonth ?? '', // month: policiesIssuedMonth ?? '',
year: policiesIssuedYear ?? '', // year: policiesIssuedYear ?? '',
imagePath: "assets/dashboard/Policy issue icon.png", // imagePath: "assets/dashboard/Policy issue icon.png",
), // ),
), // ),
// const SizedBox(height: 12), // // const SizedBox(height: 12),
Padding( // Padding(
padding: const EdgeInsets.all(8.0), // padding: const EdgeInsets.all(8.0),
child: StatCard( // child: StatCard(
title: "Premium Value", // title: "Premium Value",
today: premiumValueToday ?? '', // today: premiumValueToday ?? '',
month: premiumValueMonth ?? '', // month: premiumValueMonth ?? '',
year: premiumValueYear ?? '', // year: premiumValueYear ?? '',
imagePath: "assets/dashboard/Policy issue icon.png", // imagePath: "assets/dashboard/Policy issue icon.png",
), // ),
), // ),
// const SizedBox(height: 12), // // const SizedBox(height: 12),
Padding( // Padding(
padding: const EdgeInsets.all(8.0), // padding: const EdgeInsets.all(8.0),
child: StatCard( // child: StatCard(
title: "Earnings", // title: "Earnings",
today: earningsToday ?? '', // today: earningsToday ?? '',
month: earningsMonth ?? '', // month: earningsMonth ?? '',
year: earningsYear ?? '', // year: earningsYear ?? '',
imagePath: "assets/dashboard/Policy issue icon.png", // imagePath: "assets/dashboard/Policy issue icon.png",
), // ),
), // ),
//
const SizedBox(height: 20), // const SizedBox(height: 20),
Container( Container(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -536,7 +536,9 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
child: Column( child: Column(
children: [ children: [
// if (role != 'staff') // if (role != 'staff')
if (role != 'staff' && role != 'handler') if (role != 'staff' &&
role != 'handler' &&
role != 'manager')
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -583,7 +585,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
? MediaQuery.of(context).size.height * ? MediaQuery.of(context).size.height *
0.69 //400 0.69 //400
: (role == 'manager') : (role == 'manager')
? MediaQuery.of(context).size.height * 0.5 ? MediaQuery.of(context).size.height * 0.85
: (role == 'staff' || role == 'handler') : (role == 'staff' || role == 'handler')
? MediaQuery.of(context).size.height * 0.85 ? MediaQuery.of(context).size.height * 0.85
: MediaQuery.of(context).size.height * : MediaQuery.of(context).size.height *
@ -594,7 +596,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
Expanded( Expanded(
child: othersPendings( child: othersPendings(
title: title:
"Staff Proposal Pending List (${staffQuotationsPendingList.length})", "Staff Wise Pending(${staffQuotationsPendingList.length})",
data: staffQuotationsPendingList, data: staffQuotationsPendingList,
stringFlag: "Proposal", stringFlag: "Proposal",
role: role!, role: role!,
@ -736,6 +738,17 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
), ),
), ),
const SizedBox(height: 5), 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') if (role == 'manager')
SizedBox( SizedBox(
// replace Expanded // replace Expanded
@ -1210,6 +1223,19 @@ class othersPendings extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
print(' Data: $data'); 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( return Card(
color: Colors.white, color: Colors.white,
// color: const Color(0xFFEAF6F4), // 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( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
// stringFlag + " Issued", 'Today Assigned',
'Total Assigned', textAlign: TextAlign.center,
style: _headerStyle,
),
),
Expanded(
flex: 2,
child: Text(
'Pending',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: _headerStyle, style: _headerStyle,
), ),
@ -1273,7 +1332,7 @@ class othersPendings extends StatelessWidget {
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
'Awaiting Proposal', 'In Progress',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: _headerStyle, style: _headerStyle,
), ),
@ -1281,15 +1340,7 @@ class othersPendings extends StatelessWidget {
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
'Awaiting Approval', 'Completed',
textAlign: TextAlign.center,
style: _headerStyle,
),
),
Expanded(
flex: 2,
child: Text(
'Awaiting Policy',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: _headerStyle, style: _headerStyle,
), ),
@ -1324,9 +1375,9 @@ class othersPendings extends StatelessWidget {
: row['total_premium_value']; : row['total_premium_value'];
return Container( return Container(
margin: const EdgeInsets.symmetric(vertical: 5), margin: const EdgeInsets.symmetric(vertical: 3),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: 5, vertical: 4,
horizontal: 12, horizontal: 12,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -1341,25 +1392,6 @@ class othersPendings extends StatelessWidget {
), ),
child: Row( child: Row(
children: [ 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( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
@ -1372,13 +1404,62 @@ class othersPendings extends StatelessWidget {
Expanded( Expanded(
flex: 2, 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( child: Text(
row['total_assigned'] ?? "", row['today_assigned'] ?? "",
// row['total_approval_pending'] ?? "", // row['total_approval_pending'] ?? "",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: _tableDataStyle, 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( Expanded(
flex: 2, flex: 2,
child: Material( child: Material(
@ -1388,19 +1469,19 @@ class othersPendings extends StatelessWidget {
// hoverColor: Color(0xFFEAF6F4), // hoverColor: Color(0xFFEAF6F4),
onTap: () { onTap: () {
print( print(
'Awaiting Proposal : ${row['awaiting_quotation']}', 'Awaiting Proposal : ${row['total_in_progress']}',
); );
handleDashboardNavigation( handleDashboardNavigation(
context, context,
status: "Awaiting Proposal", status: "In progress",
staffId: row['staff_id'] ?? '', staffId: row['staff_id'] ?? '',
role: role, role: role,
); );
}, },
child: Text( child: Text(
row['awaiting_quotation'] ?? "", row['total_in_progress'] ?? "",
// row['total_approval_pending'] ?? "", // row['total_approval_pending'] ?? "",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: _tableDataStyle, style: _tableDataStyle,
@ -1418,17 +1499,17 @@ class othersPendings extends StatelessWidget {
hoverColor: Color(0xFFEAF6F4), hoverColor: Color(0xFFEAF6F4),
onTap: () async { onTap: () async {
print( print(
'Awaiting Approval : ${row['pending_quotation_approval']} - ${row['staff_id']}', 'Awaiting Approval : ${row['total_completed']} - ${row['staff_id']}',
); );
handleDashboardNavigation( handleDashboardNavigation(
context, context,
status: "Proposal Created", status: "Completed",
staffId: row['staff_id'] ?? '', staffId: row['staff_id'] ?? '',
role: role, role: role,
); );
}, },
child: Text( child: Text(
row['pending_quotation_approval'] ?? "", row['total_completed'] ?? "",
// row['total_approval_pending'] ?? "", // row['total_approval_pending'] ?? "",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: _tableDataStyle, 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( // Expanded(
// flex: 2, // flex: 2,
// child: Text( // 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), focusColor: Color(0xFF3E5B56),
highlightColor: Color(0xFF3E5B56), highlightColor: Color(0xFF3E5B56),
borderRadius: BorderRadius.circular(2), // for ripple effect borderRadius: BorderRadius.circular(2), // for ripple effect
onTap: null, // onTap: () {
// onTap: (role == 'handler') // handleDashboardNavigation(
// ? () { // context,
// // Print the id when row is clicked // status: "To be assigned",
// print("Clicked ID fd: ${row['id']}"); // staffId: row['staff_id'] ?? '',
// // You can also navigate or perform any action here // role: role,
//
// 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: () {
// 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( child: Container(
// height: 5200, // height: 5200,
margin: const EdgeInsets.symmetric(vertical: 5), margin: const EdgeInsets.symmetric(vertical: 5),

File diff suppressed because it is too large Load Diff

View File

@ -62,6 +62,8 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
dynamic SelectedStatus; dynamic SelectedStatus;
dynamic SelectedStaffId; dynamic SelectedStaffId;
String? selectedFileNames; String? selectedFileNames;
String? lastPickedFile;
PlatformFile? docUploadedFile; PlatformFile? docUploadedFile;
dynamic handlerId; dynamic handlerId;
String? _token; String? _token;
@ -571,6 +573,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
print('ToDate : $toDate'); print('ToDate : $toDate');
setState(() { setState(() {
if (SelectedStatus == 'Completed') {
selectedIndex = 1;
}
controllers['startDate']?.text = fromDate; controllers['startDate']?.text = fromDate;
controllers['endDate']?.text = toDate; controllers['endDate']?.text = toDate;
if (data is List) { if (data is List) {
@ -1028,13 +1033,13 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
return filteredInsurersData; return filteredInsurersData;
} }
return filteredInsurersData.where((item) { return filteredInsurersData.where((item) {
return item['name'].toString().toLowerCase().contains( return item['short_name'].toString().toLowerCase().contains(
filter.toLowerCase(), filter.toLowerCase(),
); );
}).toList(); }).toList();
}, },
itemAsString: (val) => val['name'].toString(), // what to show itemAsString: (val) => val['short_name'].toString(), // what to show
compareFn: (item, selectedItem) => compareFn: (item, selectedItem) =>
item['id'] == selectedItem['id'], // compare by id item['id'] == selectedItem['id'], // compare by id
validator: (val) { validator: (val) {
@ -1060,7 +1065,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
dropdownBuilder: (context, selectedItem) => Align( dropdownBuilder: (context, selectedItem) => Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
selectedItem != null ? selectedItem['name'].toString() : "", selectedItem != null
? selectedItem['short_name'].toString()
: "",
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 11, fontSize: 11,
color: Color(0XFF6366F1), color: Color(0XFF6366F1),
@ -1142,7 +1149,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
vertical: 3, vertical: 3,
), ),
child: Text( child: Text(
item['name'].toString(), item['short_name'].toString(),
style: GoogleFonts.inter(fontSize: 12, color: Colors.black), style: GoogleFonts.inter(fontSize: 12, color: Colors.black),
), ),
); );
@ -2516,6 +2523,30 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
}, },
), ),
), ),
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<EnquiryListStaffInline> {
if (response.statusCode == 200 || response.statusCode == 201) { if (response.statusCode == 200 || response.statusCode == 201) {
ToastHelper.showSuccessToast(context, "Policy PDF Uploaded!"); ToastHelper.showSuccessToast(context, "Policy PDF Uploaded!");
setState(() {
docUploadedFile = null;
});
refrshfilterDateRange(); refrshfilterDateRange();
return; return;
} }
@ -3067,7 +3101,19 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
}); });
}, },
), ),
ThemedSearchField( MouseRegion(
onEnter: (_) {
setState(() {
isActionable = true;
});
},
onExit: (_) {
setState(() {
// isActionable = false;
isActionable = _searchStaffController.text.isNotEmpty;
});
},
child: ThemedSearchField(
hintText: 'Search', hintText: 'Search',
backgroundColor: Color(0xFFFFFFFF), backgroundColor: Color(0xFFFFFFFF),
txtHeight: 30, txtHeight: 30,
@ -3079,6 +3125,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
? MediaQuery.of(context).size.width * 0.7 ? MediaQuery.of(context).size.width * 0.7
: MediaQuery.of(context).size.width * 0.13, : MediaQuery.of(context).size.width * 0.13,
), ),
),
SizedBox(width: 10), SizedBox(width: 10),
ExportBtn( ExportBtn(
sheetName: "Enquiry", sheetName: "Enquiry",
@ -3476,8 +3523,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
// Group Header // Group Header
// if (status != 'Proposal Accepted' && // if (status != 'Proposal Accepted' &&
// status != 'Proposal Rejected') ...[ // status != 'Proposal Rejected') ...[
if (status != 'Proposal Accepted' && if (items.isNotEmpty) ...[
status != 'Proposal Rejected') ...[
Container( Container(
// width: double.infinity, // width: double.infinity,
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
@ -3578,22 +3624,21 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
); );
}).toList(), }).toList(),
if (isExpanded && items.isEmpty) // if (isExpanded && items.isEmpty)
if (status != 'Proposal Accepted' && //
status != 'Proposal Rejected') // Padding(
Padding( // padding: EdgeInsets.all(5),
padding: EdgeInsets.all(5), // child: Center(
child: Center( // child: Text(
child: Text( // 'No enquiries found',
'No enquiries found', // style: GoogleFonts.inter(
style: GoogleFonts.inter( // fontSize: 12,
fontSize: 12, // color: Colors.grey,
color: Colors.grey, // fontStyle: FontStyle.italic,
fontStyle: FontStyle.italic, // ),
), // ),
), // ),
), // ),
),
], ],
); );
}).toList(), }).toList(),
@ -3750,11 +3795,11 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
// color: Colors.white, // color: Colors.white,
// ); // );
// }, // },
child: Tooltip( // child: Tooltip(
message: // message:
'Click and Download Enquiry Files', // what appears on hover/long press // 'Click and Download Enquiry Files', // what appears on hover/long press
waitDuration: const Duration(milliseconds: 500), // optional // waitDuration: const Duration(milliseconds: 500), // optional
showDuration: const Duration(seconds: 2), // optional // showDuration: const Duration(seconds: 2), // optional
child: Container( child: Container(
padding: EdgeInsets.all(4.0), padding: EdgeInsets.all(4.0),
margin: EdgeInsets.symmetric(vertical: 3, horizontal: 2), margin: EdgeInsets.symmetric(vertical: 3, horizontal: 2),
@ -3765,7 +3810,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
), ),
child: Text(item['reg_no'] ?? '-', style: _dataBoldthm3), child: Text(item['reg_no'] ?? '-', style: _dataBoldthm3),
), ),
), // ),
// child: Text(item['reg_no'] ?? '-', style: _dataBold), // child: Text(item['reg_no'] ?? '-', style: _dataBold),
// ), // ),
), ),
@ -3914,24 +3959,40 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
Material( Material(
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
// hoverColor: Color(0xFFEAF6F4),
onTap: null, onTap: null,
// onTap: () async { // hoverColor: Color(0xFFEAF6F4),
// setState(() { // onTap: (item['enquiry_status'] == 'Completed')
// isActionable = true; // ? () 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( // buildPolicyCreatedStatusActions(
// context, // context,
// item['status'], // status,
// item['id'], // item['id'],
// ); // );
// }, // }
child: Tooltip( // : null,
message: 'Click to View or Process Enquiry', //
waitDuration: const Duration(
milliseconds: 500,
), // optional
showDuration: const Duration(seconds: 2), // optional
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 2.0), padding: EdgeInsets.symmetric(vertical: 2.0),
margin: EdgeInsets.symmetric(vertical: 2), margin: EdgeInsets.symmetric(vertical: 2),
@ -3960,12 +4021,13 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
], ],
), ),
), ),
),
// child: Text(item['status'] ?? '-', style: _dataBold), // child: Text(item['status'] ?? '-', style: _dataBold),
), ),
), ),
], ],
if (item['enquiry_status'] == 'Assigned') ...[ if ((item['enquiry_status'] == 'Assigned') &&
(item['quotation_id'] != null)) ...[
TextButton( TextButton(
onPressed: () async { onPressed: () async {
final res = await apiService.updateEnquiryInProgress(id); final res = await apiService.updateEnquiryInProgress(id);
@ -3974,6 +4036,13 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
} }
print('updateEnquiryInProgress - $res'); print('updateEnquiryInProgress - $res');
}, },
child: Tooltip(
message: 'Click to Proceed',
waitDuration: const Duration(
milliseconds: 500,
), // optional
showDuration: const Duration(seconds: 2),
child: Text( child: Text(
'PROCEED', 'PROCEED',
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
@ -3983,6 +4052,42 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
), ),
), ),
), ),
),
],
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<EnquiryListStaffInline> {
SizedBox( SizedBox(
height: 30, height: 30,
width: 120, width: 120,
child: (item['status'] == 'Awaiting Proposal') child:
((item['enquiry_status'] == 'To be assigned') ||
((item['enquiry_status'] == 'Assigned') &&
(item['quotation_id'] == null)))
? Text('-') ? Text('-')
: Builder( : Builder(
builder: (cellContext) => builder: (cellContext) =>
@ -4237,7 +4345,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
SizedBox( SizedBox(
width: 120, width: 120,
height: 30, height: 30,
child: (item['status'] == 'Awaiting Proposal') child:
((item['enquiry_status'] == 'To be assigned') ||
((item['enquiry_status'] == 'Assigned') &&
(item['quotation_id'] == null)))
? Text('-') ? Text('-')
: Builder( : Builder(
builder: (cellContext) => DropdownSearch<Map<String, dynamic>>( builder: (cellContext) => DropdownSearch<Map<String, dynamic>>(
@ -4440,14 +4551,19 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
SizedBox( SizedBox(
height: 30, height: 30,
width: 90, width: 90,
child: (item['status'] == 'Awaiting Proposal') child:
((item['enquiry_status'] == 'To be assigned') ||
((item['enquiry_status'] == 'Assigned') &&
(item['quotation_id'] == null)))
? Text('-') ? Text('-')
: ThemedUploadField( : ThemedUploadField(
// key: ValueKey(selectedFileNames),
// hintText: item['policy_pdf_file_name'] ?? "Upload Document", // hintText: item['policy_pdf_file_name'] ?? "Upload Document",
hintText: hintText:
selectedFileNames ?? selectedFileNames ??
item['policy_pdf_file_name'] ?? item['policy_pdf_file_name'] ??
"Upload Document", "Upload Document",
// txtheight: 30, // txtheight: 30,
padHorizontal: 4, padHorizontal: 4,
padVertical: 5, padVertical: 5,
@ -4463,6 +4579,36 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
onFileSelected: (fileName, file) async { onFileSelected: (fileName, file) async {
print("Picked file: $fileName (${file.size} bytes)"); 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')) { if (!fileName.toLowerCase().endsWith('.pdf')) {
ToastHelper.showErrorToast( ToastHelper.showErrorToast(
context, context,
@ -4488,7 +4634,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
"manager_id": managerId, "manager_id": managerId,
"created_by": userId, "created_by": userId,
"updated_by": userId, "updated_by": userId,
// "id": item["id"], // ONLY while updating "id": item["policy_id"], // ONLY while updating
}, },
); );
// if (selectedBrokerName == 'Nhance') { // if (selectedBrokerName == 'Nhance') {
@ -4566,13 +4712,13 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
List<DataColumn> _buildDataColumns() { List<DataColumn> _buildDataColumns() {
return [ return [
DataColumn(label: Text('Received Date', style: _headerStyle)), DataColumn(label: Text('Received Date', style: _headerStyle)),
DataColumn(label: Text('Assigned To *', style: _headerStyle)), DataColumn(label: Text('Assigned To', style: _headerStyle)),
DataColumn(label: Text('Partner *', style: _headerStyle)), DataColumn(label: Text('Partner', style: _headerStyle)),
// const DataColumn(label: Text('Broker *', style: _headerStyle)), // const DataColumn(label: Text('Broker *', style: _headerStyle)),
DataColumn(label: Text('Insurer *', style: _headerStyle)), DataColumn(label: Text('Insurer', style: _headerStyle)),
DataColumn(label: Text('Insured Name *', style: _headerStyle)), DataColumn(label: Text('Insured Name', style: _headerStyle)),
DataColumn(label: Text('Vehicle No *', style: _headerStyle)), DataColumn(label: Text('Vehicle No', style: _headerStyle)),
DataColumn(label: Text('Action', style: _headerStyle)), DataColumn(label: Text('Action', style: _headerStyle)),
DataColumn(label: Text('Status', style: _headerStyle)), DataColumn(label: Text('Status', style: _headerStyle)),
// const DataColumn(label: Text('Assigned Date', style: _headerStyle)), // const DataColumn(label: Text('Assigned Date', style: _headerStyle)),
@ -4590,13 +4736,13 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
child: Row( child: Row(
children: [ children: [
_buildHeaderCell('Received Date', 110), _buildHeaderCell('Received Date', 110),
_buildHeaderCell('Assigned To *', 130), _buildHeaderCell('Assigned To', 130),
_buildHeaderCell('Partner *', 100), _buildHeaderCell('Partner', 100),
// _buildHeaderCell('Broker *', 100), // _buildHeaderCell('Broker *', 100),
_buildHeaderCell('Insurer *', 90), _buildHeaderCell('Insurer', 90),
_buildHeaderCell('Insured Name *', 110), _buildHeaderCell('Insured Name', 110),
_buildHeaderCell('Vehicle No *', 90), _buildHeaderCell('Vehicle No ', 90),
_buildHeaderCell('Action', 110), _buildHeaderCell('Action', 110),
_buildHeaderCell('Status', 100), _buildHeaderCell('Status', 100),
// _buildHeaderCell('Assigned Date', 100), // _buildHeaderCell('Assigned Date', 100),
@ -4670,7 +4816,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
return Container( return Container(
padding: const EdgeInsets.symmetric(vertical: 4), padding: const EdgeInsets.symmetric(vertical: 4),
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Colors.white, // color: Colors.white,
// color: Colors.amber, // color: Colors.amber,
// border: Border(bottom: BorderSide(color: Color(0xFFE5E5E5), width: 1)), // border: Border(bottom: BorderSide(color: Color(0xFFE5E5E5), width: 1)),
), ),
@ -4691,14 +4837,22 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
curve: Curves.easeOut, curve: Curves.easeOut,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: 5, vertical: 5,
horizontal: 20, horizontal: 10,
), ),
margin: const EdgeInsets.only(right: 24),
// margin: const EdgeInsets.only(right: 24),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6), // borderRadius: BorderRadius.circular(6),
color: isSelected color: isSelected
// ? Color(0xFFF1F5F9)
? const Color(0xFF2E7D6E).withOpacity(0.08) ? const Color(0xFF2E7D6E).withOpacity(0.08)
: Colors.transparent, : Colors.transparent,
border: Border.all(
color: isSelected
? Colors.transparent
: Colors.blueGrey.shade50,
width: 1,
),
), ),
child: Column( child: Column(
// mainAxisSize: MainAxisSize.min, // mainAxisSize: MainAxisSize.min,
@ -4707,20 +4861,22 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
enquiryTabs[index], enquiryTabs[index],
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: isSelected
? FontWeight.w600
: FontWeight.w400,
color: isSelected color: isSelected
? const Color(0xFF2E7D6E) ? const Color(0xFF2E7D6E)
: Colors.black87, : Colors.black87,
), ),
), ),
// const SizedBox(height: 3), const SizedBox(height: 1),
// Underline Indicator // Underline Indicator
AnimatedContainer( AnimatedContainer(
duration: const Duration(milliseconds: 250), duration: const Duration(milliseconds: 250),
height: 3, height: 2,
width: isSelected ? 40 : 0, width: isSelected ? 90 : 0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFF2E7D6E), color: const Color(0xFF2E7D6E),
borderRadius: BorderRadius.circular(50), borderRadius: BorderRadius.circular(50),

View File

@ -367,6 +367,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 25), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 25),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
// color: Colors.amber,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
@ -647,12 +648,12 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
return filteredInsurersData; return filteredInsurersData;
} }
return filteredInsurersData.where((item) { return filteredInsurersData.where((item) {
return item['name'].toString().toLowerCase().contains( return item['short_name'].toString().toLowerCase().contains(
filter.toLowerCase(), filter.toLowerCase(),
); );
}).toList(); }).toList();
}, },
itemAsString: (val) => val['name'].toString(), // what to show itemAsString: (val) => val['short_name'].toString(), // what to show
compareFn: (item, selectedItem) => compareFn: (item, selectedItem) =>
item['id'] == selectedItem['id'], // compare by id item['id'] == selectedItem['id'], // compare by id
validator: (val) { validator: (val) {
@ -678,7 +679,9 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
dropdownBuilder: (context, selectedItem) => Align( dropdownBuilder: (context, selectedItem) => Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
selectedItem != null ? selectedItem['name'].toString() : "", selectedItem != null
? selectedItem['short_name'].toString()
: "",
style: GoogleFonts.poppins(fontSize: 11, color: Colors.black), style: GoogleFonts.poppins(fontSize: 11, color: Colors.black),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
@ -757,7 +760,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
vertical: 3, vertical: 3,
), ),
child: Text( child: Text(
item['name'].toString(), item['short_name'].toString(),
style: GoogleFonts.inter(fontSize: 12, color: Colors.black), style: GoogleFonts.inter(fontSize: 12, color: Colors.black),
), ),
); );
@ -767,7 +770,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
onChanged: (val) { onChanged: (val) {
if (val != null) { if (val != null) {
print("Selected Insurer : ${val['name']}"); print("Selected Insurer : ${val['short_name']}");
print("Id: ${val['id']}"); print("Id: ${val['id']}");
selectedInsurer = val['id']; selectedInsurer = val['id'];
// controllers['agentId']?.text = val['agent_code']; // controllers['agentId']?.text = val['agent_code'];

View File

@ -322,23 +322,29 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
if (response['status'] == 'success') { if (response['status'] == 'success') {
print('quoationListData - ${response['data']}'); print('quoationListData - ${response['data']}');
final data = response['data'];
setState(() { setState(() {
enquiryData = Map<String, dynamic>.from(response['data']['enquiry']); enquiryData = Map<String, dynamic>.from(data['enquiry']);
print('enquiryData - ${enquiryData}'); print('ra-1');
quotationData = List<Map<String, dynamic>>.from(data['quotations']);
print('ra-2');
policyData = Map<String, dynamic>.from(data['policies']);
print('ra-3');
// enquiryData = Map<String, dynamic>.from(response['data']['enquiry']);
// print('enquiryData - ${enquiryData}');
updatePolicyData(policyData);
updateEnquiryData(enquiryData); updateEnquiryData(enquiryData);
// quotationData = List<Map<String, dynamic>>.from(response['data']); // quotationData = List<Map<String, dynamic>>.from(response['data']);
quotationData = List<Map<String, dynamic>>.from( // quotationData = List<Map<String, dynamic>>.from(
response['data']['quotations'], // response['data']['quotations'],
); // );
print('quotationData - ${quotationData}'); print('quotationData - ${quotationData}');
updateQuotationData(quotationData); updateQuotationData(quotationData);
policyData = Map<String, dynamic>.from(response['data']['policies']); // policyData = Map<String, dynamic>.from(response['data']['policies']);
print('policyData - ${policyData}'); print('policyData - ${policyData}');
updatePolicyData(policyData);
originalData = quotationData; originalData = quotationData;
filteredData = List.from(originalData); filteredData = List.from(originalData);
// print('originalData - $getClaimPolicies'); // print('originalData - $getClaimPolicies');
@ -475,11 +481,12 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
setState(() { setState(() {
controllers["insurer"]?.text = quotationAcceptedData?['insurer_name']; controllers["insurer"]?.text = quotationAcceptedData?['insurer_name'];
acceptedQuotationId = quotationAcceptedData?['id']?.toString() ?? ''; acceptedQuotationId = quotationAcceptedData?['id']?.toString() ?? '';
controllers["idv"]?.text = controllers["idv"]?.text =
quotationAcceptedData?['insured_declared_value']?.toString() ?? quotationAcceptedData?['insured_declared_value']?.toString() ??
''; '';
controllers["premium_amount"]?.text = // controllers["premium_amount"]?.text =
quotationAcceptedData?['premium_amount']?.toString() ?? ''; // quotationAcceptedData?['premium_amount']?.toString() ?? '';
controllers["planType"]?.text = controllers["planType"]?.text =
quotationAcceptedData?['insurance_plan_type']?.toString() ?? ''; quotationAcceptedData?['insurance_plan_type']?.toString() ?? '';
controllers["policyPaymentMode"]?.text = controllers["policyPaymentMode"]?.text =
@ -512,6 +519,9 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
setState(() { setState(() {
hasPolicyData = true; hasPolicyData = true;
selectedAgent = policyData['agent_id']?.toString() ?? '';
selectedPaymentMode = policyData['payment_mode_id']?.toString() ?? '';
acceptedQuotationId = policyData['quotation_id']?.toString() ?? '';
choosedPolcyId = policyData['id']?.toString() ?? ''; choosedPolcyId = policyData['id']?.toString() ?? '';
controllers["policyInsName"]?.text = controllers["policyInsName"]?.text =
policyData['insured_name']?.toString() ?? ''; policyData['insured_name']?.toString() ?? '';
@ -548,6 +558,37 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
controllers["premiumTOT"]?.text = controllers["premiumTOT"]?.text =
policyData['premium_amount']?.toString() ?? ''; 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'] ?? ''; selectedBroker = policyData['broker_id'] ?? '';
selectedBrokerName = policyData['broker_name'] ?? ''; selectedBrokerName = policyData['broker_name'] ?? '';
// RC FILE // RC FILE
@ -960,9 +1001,34 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AlertDialog( return AlertDialog(
backgroundColor: Color(0xfff8fafc), 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( 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, height: MediaQuery.of(context).size.height,
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
@ -1191,23 +1257,17 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
SizedBox(width: 20), SizedBox(width: 20),
buildPremiumAmount(context), buildPremiumAmount(context),
SizedBox(width: 20), SizedBox(width: 20),
Paymentmode(context),
SizedBox(width: 20),
buildInsurer(context),
], ],
), ),
Row( Row(
children: [ children: [
Paymentmode(context),
SizedBox(width: 20),
buildInsurer(context),
SizedBox(width: 20),
buildAgentName(context), buildAgentName(context),
SizedBox(width: 20), SizedBox(width: 20),
buildBroker(context), buildBroker(context),
SizedBox(width: 20), SizedBox(width: 20),
],
),
Row(
children: [
policyissuedate(context), policyissuedate(context),
SizedBox(width: 20), SizedBox(width: 20),
policystartdate(context), policystartdate(context),
@ -1218,7 +1278,7 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
], ],
), ),
), ),
SizedBox(height: 10), SizedBox(height: 20),
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -1233,15 +1293,25 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
), ),
], ],
), ),
child: Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text('Premium Breakdown', style: headingSTyles), Row(
children: [Text('Premium Breakdown', style: headingSTyles)],
),
Divider(thickness: 0.1, color: Color(0xFF2E7D6E)), Divider(thickness: 0.1, color: Color(0xFF2E7D6E)),
Column( Container(
// color: Colors.blue.shade100,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
// color: Colors.amber,
child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -1250,6 +1320,7 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
buildPersonalAccident(context), buildPersonalAccident(context),
], ],
), ),
),
SizedBox(width: 20), SizedBox(width: 20),
Column( Column(
@ -1265,7 +1336,10 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
], ],
), ),
), ),
SizedBox(height: 10), ],
),
),
SizedBox(height: 20),
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -1290,35 +1364,44 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
buildMake(context), buildMake(context),
SizedBox(width: 20),
buildModel(context), buildModel(context),
SizedBox(width: 20),
buildVehicleType(context), buildVehicleType(context),
SizedBox(width: 20),
buildFuelType(context), buildFuelType(context),
], SizedBox(width: 20),
),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildEngineNo(context), buildEngineNo(context),
SizedBox(width: 20),
buildChassisNo(context), buildChassisNo(context),
buildCubicCapacity(context),
buildWeight(context),
], ],
), ),
SizedBox(height: 10),
Row( Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
buildCubicCapacity(context),
SizedBox(width: 20),
buildWeight(context),
SizedBox(width: 20),
buildYearOfManufacture(context), buildYearOfManufacture(context),
SizedBox(width: 20),
buildDateOfRegistration(context), buildDateOfRegistration(context),
], ],
), ),
], ],
), ),
), ),
SizedBox(height: 10), SizedBox(height: 20),
Row(
children: [
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 14,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
@ -1341,15 +1424,19 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
buildRTOStateCode(context), buildRTOStateCode(context),
SizedBox(width: 20),
buildRTOCityCode(context), buildRTOCityCode(context),
], ],
), ),
], ],
), ),
), ),
SizedBox(height: 10), SizedBox(width: 20),
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 14,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
@ -1372,13 +1459,16 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
buildCommissonAmount(context), buildCommissonAmount(context),
SizedBox(width: 20),
buildCommissonAppliedRule(context), buildCommissonAppliedRule(context),
], ],
), ),
], ],
), ),
), ),
SizedBox(height: 10), ],
),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
@ -2513,7 +2603,7 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
Widget buildThirdParty(BuildContext context) { Widget buildThirdParty(BuildContext context) {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
@ -2521,7 +2611,9 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
child: Text('Third Party', style: _textStyle), child: Text('Third Party', style: _textStyle),
), ),
SizedBox(width: 20), SizedBox(width: 20),
ThemedFormField( SizedBox(
height: 35,
child: ThemedFormField(
controller: controllers['tp']!, controller: controllers['tp']!,
// backgroundColor: Color(0xffEDF6F5), // backgroundColor: Color(0xffEDF6F5),
errorBorderColor: Color(0xffEDF6F5), errorBorderColor: Color(0xffEDF6F5),
@ -2537,7 +2629,8 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
}, },
txtwidth: ResponsiveLayout.isMobile(context) txtwidth: ResponsiveLayout.isMobile(context)
? null ? null
: MediaQuery.of(context).size.width * 0.14, : MediaQuery.of(context).size.width * 0.12,
),
), ),
], ],
); );
@ -2549,11 +2642,13 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.15, width: MediaQuery.of(context).size.width * 0.12,
child: Text('Own Damage ', style: _textStyle), child: Text('Own Damage ', style: _textStyle),
), ),
SizedBox(width: 20), SizedBox(width: 20),
ThemedFormField( SizedBox(
height: 35,
child: ThemedFormField(
controller: controllers['od']!, controller: controllers['od']!,
// backgroundColor: Color(0xffEDF6F5), // backgroundColor: Color(0xffEDF6F5),
errorBorderColor: Color(0xffEDF6F5), errorBorderColor: Color(0xffEDF6F5),
@ -2565,7 +2660,8 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
], ],
txtwidth: ResponsiveLayout.isMobile(context) txtwidth: ResponsiveLayout.isMobile(context)
? null ? null
: MediaQuery.of(context).size.width * 0.14, : MediaQuery.of(context).size.width * 0.12,
),
), ),
], ],
); );
@ -2577,11 +2673,13 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.15, width: MediaQuery.of(context).size.width * 0.12,
child: Text('Personal Accident', style: _textStyle), child: Text('Personal Accident', style: _textStyle),
), ),
SizedBox(width: 20), SizedBox(width: 20),
ThemedFormField( SizedBox(
height: 35,
child: ThemedFormField(
controller: controllers['pa']!, controller: controllers['pa']!,
// backgroundColor: Color(0xffEDF6F5), // backgroundColor: Color(0xffEDF6F5),
errorBorderColor: Color(0xffEDF6F5), errorBorderColor: Color(0xffEDF6F5),
@ -2594,7 +2692,8 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
], ],
txtwidth: ResponsiveLayout.isMobile(context) txtwidth: ResponsiveLayout.isMobile(context)
? null ? null
: MediaQuery.of(context).size.width * 0.14, : MediaQuery.of(context).size.width * 0.12,
),
), ),
], ],
); );
@ -2606,11 +2705,13 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.15, width: MediaQuery.of(context).size.width * 0.12,
child: Text('CGST', style: _textStyle), child: Text('CGST', style: _textStyle),
), ),
SizedBox(width: 20), SizedBox(width: 20),
ThemedFormField( SizedBox(
height: 35,
child: ThemedFormField(
controller: controllers['cgst']!, controller: controllers['cgst']!,
// backgroundColor: Color(0xffEDF6F5), // backgroundColor: Color(0xffEDF6F5),
errorBorderColor: Color(0xffEDF6F5), errorBorderColor: Color(0xffEDF6F5),
@ -2623,6 +2724,7 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
? null ? null
: MediaQuery.of(context).size.width * 0.14, : MediaQuery.of(context).size.width * 0.14,
), ),
),
], ],
); );
} }
@ -2633,11 +2735,13 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.15, width: MediaQuery.of(context).size.width * 0.12,
child: Text('SGST', style: _textStyle), child: Text('SGST', style: _textStyle),
), ),
SizedBox(width: 20), SizedBox(width: 20),
ThemedFormField( SizedBox(
height: 35,
child: ThemedFormField(
controller: controllers['sgst']!, controller: controllers['sgst']!,
// backgroundColor: Color(0xffEDF6F5), // backgroundColor: Color(0xffEDF6F5),
errorBorderColor: Color(0xffEDF6F5), errorBorderColor: Color(0xffEDF6F5),
@ -2650,6 +2754,7 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
? null ? null
: MediaQuery.of(context).size.width * 0.14, : MediaQuery.of(context).size.width * 0.14,
), ),
),
], ],
); );
} }
@ -2660,11 +2765,13 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.15, width: MediaQuery.of(context).size.width * 0.12,
child: Text('IGST', style: _textStyle), child: Text('IGST', style: _textStyle),
), ),
SizedBox(width: 20), SizedBox(width: 20),
ThemedFormField( SizedBox(
height: 35,
child: ThemedFormField(
controller: controllers['igst']!, controller: controllers['igst']!,
// backgroundColor: Color(0xffEDF6F5), // backgroundColor: Color(0xffEDF6F5),
errorBorderColor: Color(0xffEDF6F5), errorBorderColor: Color(0xffEDF6F5),
@ -2677,6 +2784,7 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
? null ? null
: MediaQuery.of(context).size.width * 0.14, : MediaQuery.of(context).size.width * 0.14,
), ),
),
], ],
); );
} }
@ -2687,11 +2795,13 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
width: MediaQuery.of(context).size.width * 0.15, width: MediaQuery.of(context).size.width * 0.12,
child: Text('Total Premium *', style: _textStyle), child: Text('Total Premium *', style: _textStyle),
), ),
SizedBox(width: 20), SizedBox(width: 20),
ThemedFormField( SizedBox(
height: 35,
child: ThemedFormField(
controller: controllers['premiumTOT']!, controller: controllers['premiumTOT']!,
// backgroundColor: Color(0xffEDF6F5), // backgroundColor: Color(0xffEDF6F5),
errorBorderColor: Color(0xffEDF6F5), errorBorderColor: Color(0xffEDF6F5),
@ -2704,6 +2814,7 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
? null ? null
: MediaQuery.of(context).size.width * 0.14, : MediaQuery.of(context).size.width * 0.14,
), ),
),
], ],
); );
} }
@ -3020,13 +3131,13 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
} }
} }
static final _textStyle = GoogleFonts.inter( static final _textStyle = GoogleFonts.poppins(
fontSize: 11, fontSize: 11,
color: Color(0XFF334155), color: Color(0XFF334155),
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
); );
static final headingSTyles = GoogleFonts.inter( static final headingSTyles = GoogleFonts.poppins(
fontSize: 12.5, fontSize: 12.5,
// color: Color(0XFF334155), // color: Color(0XFF334155),
color: Color(0xFF2E7D6E), color: Color(0xFF2E7D6E),

View File

@ -77,6 +77,10 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
final GlobalKey<DropdownSearchState<Map<String, dynamic>>> dropDownKeyBroker = final GlobalKey<DropdownSearchState<Map<String, dynamic>>> dropDownKeyBroker =
GlobalKey<DropdownSearchState<Map<String, dynamic>>>(); GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
dropDownKeyInsurerEnqAsgn =
GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
final GlobalKey<DropdownSearchState<Map<String, dynamic>>> final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
dropDownKeyInsurer = GlobalKey<DropdownSearchState<Map<String, dynamic>>>(); dropDownKeyInsurer = GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
@ -104,8 +108,8 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
final data = { final data = {
"enquiry_id": widget.selectedEnquiryId, "enquiry_id": widget.selectedEnquiryId,
"insured_declared_value": controllers["idv"]?.text, "insured_declared_value": controllers["idv"]?.text,
"insurer_id": widget.selectedInsurdId, // "insurer_id": widget.selectedInsurdId,
// "insurer_id": selectedInsurer, "insurer_id": selectedInsurer,
"premium_amount": controllers["premium_Amount"]?.text, "premium_amount": controllers["premium_Amount"]?.text,
"insurance_plan_type_id": selectedInsPlanType, "insurance_plan_type_id": selectedInsPlanType,
"payment_mode_id": selectedPaymentMode, "payment_mode_id": selectedPaymentMode,
@ -129,7 +133,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
_initializeToken(); _initializeToken();
getInsuranceType(); getInsuranceType();
getPaymentMode(); getPaymentMode();
// getInsurers(); getInsurers();
updateData(); updateData();
getBroker(); getBroker();
} }
@ -207,6 +211,10 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
} }
void updateData() { void updateData() {
selectedInsurer = widget.selectedInsurdId;
print('QuickselectedInsurer - $selectedInsurer');
print('QuickselectedEnquiryId - ${widget.selectedEnquiryId}');
if (widget.selectedQuotationFrmListId != null && if (widget.selectedQuotationFrmListId != null &&
widget.selectedQuotationFrmListdata!.isNotEmpty) { widget.selectedQuotationFrmListdata!.isNotEmpty) {
print('checkData -- ${widget.selectedQuotationFrmListdata}'); print('checkData -- ${widget.selectedQuotationFrmListdata}');
@ -223,6 +231,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
selectedInsPlanType = widget selectedInsPlanType = widget
.selectedQuotationFrmListdata!['insurance_plan_type_id'] .selectedQuotationFrmListdata!['insurance_plan_type_id']
?.toString(); ?.toString();
selectedBroker = widget.selectedQuotationFrmListdata!['broker_id'] selectedBroker = widget.selectedQuotationFrmListdata!['broker_id']
?.toString(); ?.toString();
@ -232,7 +241,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
// controllers["insurer"]?.text = 'LIC'; // controllers["insurer"]?.text = 'LIC';
// selectedInsurer = selectedInsurer = widget.selectedInsurdId;
// widget.selectedQuotationFrmListdata!['insurer_id']?.toString() ?? ''; // widget.selectedQuotationFrmListdata!['insurer_id']?.toString() ?? '';
String? apiDocPath = String? apiDocPath =
@ -500,7 +509,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
// 🔹 Switch content dynamically // 🔹 Switch content dynamically
Container( Container(
width: MediaQuery.of(context).size.width, 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), child: buildFormFields(context),
), ),
], ],
@ -516,9 +525,9 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
buildIdv(context), // buildIdv(context),
buildInsurer(context),
Spacer(), Spacer(),
// buildInsurer(context),
buildInsurancePlanType(context), buildInsurancePlanType(context),
Spacer(), Spacer(),
buildPremiumAmnt(context), buildPremiumAmnt(context),
@ -534,21 +543,47 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
// ), // ),
], ],
), ),
SizedBox(height: 10),
Row( // SizedBox(height: 10),
crossAxisAlignment: CrossAxisAlignment.end,
children: [
buildPaymentMode(context),
Spacer(),
// buildInsurer(context),
buildBroker(context),
Spacer(),
buildDocuments(context), Spacer(),
],
),
// 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), SizedBox(height: 10),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -566,14 +601,14 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
color: const Color(0xFF425B5B), color: const Color(0xFF2E7D6E),
), ),
child: Text( child: Text(
'Save', 'Save',
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
color: Colors.white, color: Colors.white,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w500,
), ),
), ),
), ),
@ -607,8 +642,8 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
// readOnly: true, // readOnly: true,
txtwidth: ResponsiveLayout.isMobile(context) txtwidth: ResponsiveLayout.isMobile(context)
? null ? null
: MediaQuery.of(context).size.width * 0.18, : MediaQuery.of(context).size.width * 0.12,
// txtheight: 35, txtheight: 40,
), ),
], ],
); );
@ -632,8 +667,8 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
// validator: (value) => Validators.number(value, "PremiumAmount "), // validator: (value) => Validators.number(value, "PremiumAmount "),
txtwidth: ResponsiveLayout.isMobile(context) txtwidth: ResponsiveLayout.isMobile(context)
? null ? null
: MediaQuery.of(context).size.width * 0.18, : MediaQuery.of(context).size.width * 0.12,
// txtheight: 35, txtheight: 40,
), ),
], ],
); );
@ -654,7 +689,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
color: Colors.white, color: Colors.white,
width: ResponsiveLayout.isMobile(context) width: ResponsiveLayout.isMobile(context)
? null ? null
: MediaQuery.of(context).size.width * 0.18, : MediaQuery.of(context).size.width * 0.12,
// height: 35, // height: 35,
child: DropdownSearch<Map<String, dynamic>>( child: DropdownSearch<Map<String, dynamic>>(
key: dropDownKey, key: dropDownKey,
@ -753,10 +788,11 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
), ),
child: Text( child: Text(
item['insurance_plan_type'].toString(), item['insurance_plan_type'].toString(),
style: GoogleFonts.inter(fontSize: 12, color: Colors.black), style: GoogleFonts.inter(fontSize: 11, color: Colors.black),
), ),
); );
}, },
// searchFieldProps: TextFieldProps( // searchFieldProps: TextFieldProps(
// decoration: InputDecoration( // decoration: InputDecoration(
// filled: true, // filled: true,
@ -793,6 +829,168 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
); );
} }
Widget buildInsurer(BuildContext context) {
Map<String, dynamic>? 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<Map<String, dynamic>>(
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) { Widget buildPaymentMode(context) {
Map<String, dynamic>? selectedVehicle = filteredPaymentModeData.firstWhere( Map<String, dynamic>? selectedVehicle = filteredPaymentModeData.firstWhere(
(item) => item['id'].toString() == selectedPaymentMode, (item) => item['id'].toString() == selectedPaymentMode,
@ -808,7 +1006,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
color: Colors.white, color: Colors.white,
width: ResponsiveLayout.isMobile(context) width: ResponsiveLayout.isMobile(context)
? null ? null
: MediaQuery.of(context).size.width * 0.18, : MediaQuery.of(context).size.width * 0.12,
// height: 35, // height: 35,
child: DropdownSearch<Map<String, dynamic>>( child: DropdownSearch<Map<String, dynamic>>(
key: dropDownSelectPaymentModeKey, key: dropDownSelectPaymentModeKey,
@ -942,7 +1140,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
color: Colors.white, color: Colors.white,
width: ResponsiveLayout.isMobile(context) width: ResponsiveLayout.isMobile(context)
? null ? null
: MediaQuery.of(context).size.width * 0.18, : MediaQuery.of(context).size.width * 0.12,
// height: 35, // height: 35,
child: DropdownSearch<Map<String, dynamic>>( child: DropdownSearch<Map<String, dynamic>>(
key: dropDownKeyBroker, key: dropDownKeyBroker,

View File

@ -168,8 +168,10 @@ class QuotationStaffTabState extends ConsumerState<QuotationStaffTab> {
if (!mounted) return; if (!mounted) return;
setState(() { setState(() {
selectedInsurdId = enquiryData['insurer_id']; selectedInsurdId = enquiryData['insurer_id'];
print('selectedInsurdId- $selectedInsurdId');
selectedEnquiryId = enquiryData['id']; selectedEnquiryId = enquiryData['id'];
print('selectedEnquiryId- $selectedEnquiryId'); print('selectedEnquiryId- $selectedEnquiryId');
controllers["regNum"]?.text = enquiryData['reg_no']; controllers["regNum"]?.text = enquiryData['reg_no'];
// controllers["insurer"]?.text = enquiryData['insurer_name']; // controllers["insurer"]?.text = enquiryData['insurer_name'];
}); });

View File

@ -64,8 +64,8 @@ class TabEnquiryStaffListState extends ConsumerState<TabEnquiryStaffList> {
setState(() => isLoading = false); setState(() => isLoading = false);
tabs = [ tabs = [
// TabItem("Proposal", PropoalStaffTab()), // TabItem("Proposal", PropoalStaffTab()),
TabItem("Proposal", QuotationStaffTab()), TabItem("Quote", QuotationStaffTab()),
TabItem("Policy", PolicyStaffTab()), // TabItem("Policy", PolicyStaffTab()),
]; ];
} }
}); });
@ -112,8 +112,8 @@ class TabEnquiryStaffListState extends ConsumerState<TabEnquiryStaffList> {
tabs = [ tabs = [
// TabItem("Proposal", PropoalStaffTab()), // TabItem("Proposal", PropoalStaffTab()),
TabItem("Proposal", QuotationStaffTab()), TabItem("Quote", QuotationStaffTab()),
TabItem("Policy", PolicyStaffTab()), // TabItem("Policy", PolicyStaffTab()),
]; ];
// if (widget.showKey == "Policy") { // if (widget.showKey == "Policy") {
@ -176,8 +176,11 @@ class TabEnquiryStaffListState extends ConsumerState<TabEnquiryStaffList> {
return AlertDialog( return AlertDialog(
backgroundColor: Colors.white, backgroundColor: Colors.white,
content: Container( content: Container(
width: MediaQuery.of(context).size.width * 0.65, width: MediaQuery.of(context).size.width * 0.4,
height: MediaQuery.of(context).size.height * 0.9, 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 child: isLoading
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: tabs.isEmpty : tabs.isEmpty

View File

@ -80,8 +80,8 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
final data = { final data = {
"id": widget.enquiryPrimaryId, "id": widget.enquiryPrimaryId,
"assigned_to": selectedStaff, "assigned_to": selectedStaff,
"insurer_id": selectedInsurer, // "insurer_id": selectedInsurer,
"broker_id": selectedBroker, // "broker_id": selectedBroker,
"updated_by": widget.userId, "updated_by": widget.userId,
}; };
return data; return data;
@ -339,7 +339,7 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
'Assign Enquiry To Staff', 'Assign Enquiry To Staff',
style: GoogleFonts.inter( style: GoogleFonts.inter(
color: const Color(0xFF374141), color: const Color(0xFF374141),
fontSize: 18, fontSize: 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -403,8 +403,8 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
children: [ children: [
buildRegistrationNumber(context), buildRegistrationNumber(context),
buildSelectStaffMem(context), buildSelectStaffMem(context),
buildInsurer(context), // buildInsurer(context),
buildBroker(context), // buildBroker(context),
], ],
), ),
); );
@ -493,6 +493,18 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
} }
return null; 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( decoratorProps: DropDownDecoratorProps(
decoration: decoration:
AppInputDecorations.dropdownDecoration( AppInputDecorations.dropdownDecoration(
@ -536,7 +548,7 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
return Container( return Container(
// color: isSelected ? Colors.blue.withOpacity(0.1) : null, // color: isSelected ? Colors.blue.withOpacity(0.1) : null,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 8, horizontal: 12,
vertical: 3, vertical: 3,
), ),
child: Text( child: Text(

View File

@ -18,6 +18,8 @@ import '../../../themes/indicators/export_btn.dart';
import '../../../themes/indicators/search_field_theme.dart'; import '../../../themes/indicators/search_field_theme.dart';
import '../../../widgets/custom_Stdate_EnDate_Filter.dart'; import '../../../widgets/custom_Stdate_EnDate_Filter.dart';
import '../../../widgets/custom_action_popup.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 { class policylist extends ConsumerStatefulWidget {
const policylist({super.key}); const policylist({super.key});
@ -701,7 +703,7 @@ class policylistState extends ConsumerState<policylist> {
child: Text('Policy Number', style: _headerStyle), child: Text('Policy Number', style: _headerStyle),
), ),
Expanded(flex: 1, child: Text('Action', style: _headerStyle)), Expanded(flex: 3, child: Text('Action', style: _headerStyle)),
], ],
), ),
), ),
@ -872,8 +874,10 @@ class policylistState extends ConsumerState<policylist> {
), ),
), ),
Expanded( Expanded(
flex: 1, flex: 3,
child: Tooltip( child: Row(
children: [
Tooltip(
message: 'Download', message: 'Download',
// color: Colors.white, // color: Colors.white,
child: Row( child: Row(
@ -892,17 +896,21 @@ class policylistState extends ConsumerState<policylist> {
child: Container( child: Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 5, horizontal: 5,
vertical: 6, vertical: 3,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
// color: Color(0xFF425B5B), // color: Color(0xFF425B5B),
color: const Color(0xFF2E7D6E), // color: const Color(0xFF2E7D6E),
// color: Colors.green.shade300, color: Colors.green,
), ),
child: Row( child: Row(
children: const [ children: const [
Icon(Icons.download, size: 12, color: Colors.white), Icon(
Icons.download,
size: 12,
color: Colors.white,
),
], ],
), ),
), ),
@ -910,6 +918,8 @@ class policylistState extends ConsumerState<policylist> {
], ],
), ),
), ),
],
),
), ),
], ],
), ),

View File

@ -0,0 +1,87 @@
// import 'package:fl_chart/fl_chart.dart';
// import 'package:flutter/material.dart';
//
// class DynamicHorizontalBarChart extends StatelessWidget {
// final List<Map<String, dynamic>> 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),
// // ),
// ),
// ],
// ),
// ],
// );
// }),
// ),
// ),
// );
// }
// }

View File

@ -49,9 +49,21 @@ class _ThemedUploadFieldState extends State<ThemedUploadField> {
String? selectedFileName; String? selectedFileName;
String? errorMessage; String? errorMessage;
// @override
// void didUpdateWidget(covariant ThemedUploadField oldWidget) {
// super.didUpdateWidget(oldWidget);
//
// if (widget.hintText != oldWidget.hintText) {
// setState(() {
// selectedFileName = null;
// errorMessage = null;
// });
// }
// }
Future<void> _pickFile() async { Future<void> _pickFile() async {
final error = await fileService.pickSingleFile( final error = await fileService.pickSingleFile(
maxFileSizeInMB: 3, // maxFileSizeInMB: 3,
allowedExtensions: widget.allowedExtensions, allowedExtensions: widget.allowedExtensions,
); );
if (error != null) { if (error != null) {

View File

@ -26,14 +26,14 @@ class FileUploadService {
if (result != null && result.files.isNotEmpty) { if (result != null && result.files.isNotEmpty) {
final file = result.files.first; final file = result.files.first;
final ext = file.extension?.toLowerCase() ?? ''; final ext = file.extension?.toLowerCase() ?? '';
final sizeInMB = file.size / (1024 * 1024); // final sizeInMB = file.size / (1024 * 1024);
if (!extensions.contains(ext)) { if (!extensions.contains(ext)) {
return "Unsupported format: ${file.name}"; return "Unsupported format: ${file.name}";
} }
if (sizeInMB > maxFileSizeInMB) { // if (sizeInMB > maxFileSizeInMB) {
return "File too large (${file.name}). Max $maxFileSizeInMB MB allowed."; // return "File too large (${file.name}). Max $maxFileSizeInMB MB allowed.";
} // }
singleFile = file; singleFile = file;
} }

View File

@ -69,10 +69,15 @@ class ThemedSearchField extends HookWidget {
borderSide: BorderSide(color: Color(0xFF50A398), width: 2), borderSide: BorderSide(color: Color(0xFF50A398), width: 2),
), ),
hintText: hintText, hintText: hintText,
hintStyle: GoogleFonts.inter( hintStyle: GoogleFonts.poppins(
// color: const Color(0xFF686868), // color: const Color(0xFF686868),
color: const Color(0xFF94A3B8), 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( // suffixIconConstraints: const BoxConstraints(

View File

@ -51,7 +51,9 @@ class SideDrawerPanel extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
if (title != null) if (title != null)
Text( Material(
color: Colors.white,
child: Text(
title!, title!,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: 14, fontSize: 14,
@ -59,6 +61,7 @@ class SideDrawerPanel extends StatelessWidget {
color: const Color(0xFF1E293B), color: const Color(0xFF1E293B),
), ),
), ),
),
const Spacer(), const Spacer(),
IconButton( IconButton(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),

View File

@ -116,8 +116,11 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
}); });
try { 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') { if (response['status'] == 'success') {
print('getStaffDetails - ${response['data']}'); print('getStaffDetails - ${response['data']}');
setState(() { setState(() {
@ -329,11 +332,15 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
Widget buildStatusSearch(BuildContext context) { Widget buildStatusSearch(BuildContext context) {
final List<Map<String, dynamic>> statusOptions = [ final List<Map<String, dynamic>> statusOptions = [
{'id': 1, 'status': 'Awaiting Proposal'}, // {'id': 1, 'status': 'Awaiting Proposal'},
{'id': 2, 'status': 'Proposal Created'}, // {'id': 2, 'status': 'Proposal Created'},
{'id': 3, 'status': 'Proposal Accepted'}, // {'id': 3, 'status': 'Proposal Accepted'},
{'id': 4, 'status': 'Proposal Rejected'}, // {'id': 4, 'status': 'Proposal Rejected'},
{'id': 5, 'status': 'Policy Created'}, // {'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<String, dynamic>? selectedStatusMap = statusOptions Map<String, dynamic>? selectedStatusMap = statusOptions
.where((element) => element['status'] == widget.selectedStatusVal) .where((element) => element['status'] == widget.selectedStatusVal)

View File

@ -69,6 +69,7 @@ dependencies:
dropdown_search: ^6.0.2 dropdown_search: ^6.0.2
file_picker: ^10.3.3 file_picker: ^10.3.3
fluttertoast: ^9.0.0 fluttertoast: ^9.0.0
# fl_chart: ^1.1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 917 B

After

Width:  |  Height:  |  Size: 1.2 KiB