FIX_vechiletype in Enquiry inline list
This commit is contained in:
parent
6c92692fa9
commit
42323ed9f7
File diff suppressed because one or more lines are too long
@ -5,8 +5,8 @@ class Env {
|
||||
);
|
||||
static const String apiUrl = String.fromEnvironment(
|
||||
'API_URL',
|
||||
// defaultValue: 'https://partner.nhanceindia.in/partner_api/api/', /* when test build uncomment this. but below line should in comment */
|
||||
defaultValue: 'https://venbait.in/nhance/partner/dev/api/', /* when live build uncomment . but above line should in comment */
|
||||
// defaultValue: 'https://partner.nhanceindia.in/partner_api/api/', /* Live build (enable index.html line 18) */
|
||||
defaultValue: 'https://venbait.in/nhance/partner/dev/api/', /* Test build (enable index.html line 19) */
|
||||
);
|
||||
// static const String baseUrl = String.fromEnvironment(
|
||||
// 'BASE_URL',
|
||||
|
||||
@ -67,7 +67,7 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
apiService = ApiService();
|
||||
|
||||
print("PolicyTab - Called");
|
||||
for (String field in tabHeader) {
|
||||
controllers[field] = TextEditingController();
|
||||
}
|
||||
@ -509,7 +509,10 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
|
||||
|
||||
Widget buildMoreInfoSetClaims(BuildContext context) {
|
||||
if (selectedPolicyNumber == null || selectedPolicyNumber!.isEmpty) {
|
||||
return const Center(child: CircularProgressIndicator()); // or placeholder
|
||||
// return const Center(child: CircularProgressIndicator()); // or placeholder
|
||||
return const Center(
|
||||
child: Text( 'No records available', textAlign: TextAlign.center,),
|
||||
);
|
||||
}
|
||||
return Container(
|
||||
padding: ResponsiveLayout.isMobile(context) ? null : EdgeInsets.all(6.0),
|
||||
@ -538,7 +541,10 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
|
||||
|
||||
Widget buildMoreInfoSetEndrosment(BuildContext context) {
|
||||
if (selectedPolicyNumber == null || selectedPolicyNumber!.isEmpty) {
|
||||
return const Center(child: CircularProgressIndicator()); // or placeholder
|
||||
// return const Center(child: CircularProgressIndicator()); // or placeholder
|
||||
return const Center(
|
||||
child: Text( 'No records available', textAlign: TextAlign.center,),
|
||||
);
|
||||
}
|
||||
return Container(
|
||||
// padding: EdgeInsets.all(8.0),
|
||||
|
||||
@ -1945,14 +1945,36 @@ class Performance extends StatelessWidget {
|
||||
// style: _tableDataStyle,
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// row['agent_name'] ?? "",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: _tableDataStyle,
|
||||
// ),
|
||||
// ),
|
||||
Expanded(
|
||||
child: Text(
|
||||
row['agent_name'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start, // align right
|
||||
children: [
|
||||
// Top: Agent Name
|
||||
Text(
|
||||
row['agent_name'] ?? "",
|
||||
textAlign: TextAlign.left,
|
||||
style: _tableDataStyle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
// Bottom: Agent Code (light weight)
|
||||
Text(
|
||||
row['agent_code'] ?? "",
|
||||
textAlign: TextAlign.left,
|
||||
style: _tableDataTimeStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Text(
|
||||
row['total_policy_issued'] ?? "",
|
||||
@ -2162,11 +2184,34 @@ class UnassignedEnq extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// row['agent_name'] ?? '', // convert int to string
|
||||
// // textAlign: TextAlign.center,
|
||||
// style: _tableDataStyle,
|
||||
// ),
|
||||
// ),
|
||||
Expanded(
|
||||
child: Text(
|
||||
row['agent_name'] ?? '', // convert int to string
|
||||
// textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start, // align right
|
||||
children: [
|
||||
// Top: Agent Name
|
||||
Text(
|
||||
row['agent_name'] ?? "",
|
||||
textAlign: TextAlign.left,
|
||||
style: _tableDataStyle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
// Bottom: Agent Code (light weight)
|
||||
Text(
|
||||
row['agent_code'] ?? "",
|
||||
textAlign: TextAlign.left,
|
||||
style: _tableDataTimeStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
|
||||
@ -130,31 +130,31 @@ class _DashboardState extends ConsumerState<LiveDashboard> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getExportExcel2(String status, String staffId) async {
|
||||
final prefmanagerid = ref.read(managerIdProvider);
|
||||
|
||||
// Use the parameters passed from the widget
|
||||
final path = "staff_pending_summary_by_id";
|
||||
final id = staffId;
|
||||
final month = status;
|
||||
|
||||
try {
|
||||
setState(() => isLoading = true);
|
||||
|
||||
final response = await apiService.generateChartExcel(
|
||||
path,
|
||||
id,
|
||||
month,
|
||||
prefmanagerid
|
||||
);
|
||||
|
||||
return response;
|
||||
} catch (e) {
|
||||
print('Export Error: $e');
|
||||
} finally {
|
||||
if (mounted) setState(() => isLoading = false);
|
||||
}
|
||||
}
|
||||
// Future<void> getExportExcel2(String status, String staffId) async {
|
||||
// final prefmanagerid = ref.read(managerIdProvider);
|
||||
//
|
||||
// // Use the parameters passed from the widget
|
||||
// final path = "staff_pending_summary_by_id";
|
||||
// final id = staffId;
|
||||
// final month = status;
|
||||
//
|
||||
// try {
|
||||
// setState(() => isLoading = true);
|
||||
//
|
||||
// final response = await apiService.generateChartExcel(
|
||||
// path,
|
||||
// id,
|
||||
// month,
|
||||
// prefmanagerid
|
||||
// );
|
||||
//
|
||||
// return response;
|
||||
// } catch (e) {
|
||||
// print('Export Error: $e');
|
||||
// } finally {
|
||||
// if (mounted) setState(() => isLoading = false);
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<void> handleEdit(String id) async {
|
||||
// Navigator.pop(context);
|
||||
@ -608,7 +608,7 @@ class _DashboardState extends ConsumerState<LiveDashboard> {
|
||||
role: role!,
|
||||
onRefresh: refresh,
|
||||
onExportExcel: getExportExcel,
|
||||
onCallExport: getExportExcel2,
|
||||
// onCallExport: getExportExcel2,
|
||||
),
|
||||
),
|
||||
// if (role == 'handler') ...[
|
||||
@ -1212,7 +1212,7 @@ class othersPendings extends StatelessWidget {
|
||||
final List<Map<String, dynamic>> data;
|
||||
final VoidCallback? onRefresh;
|
||||
VoidCallback? onExportExcel;
|
||||
final Future<void> Function(String status, String staffId)? onCallExport;
|
||||
// final Future<void> Function(String status, String staffId)? onCallExport;
|
||||
|
||||
othersPendings({
|
||||
Key? key,
|
||||
@ -1222,7 +1222,7 @@ class othersPendings extends StatelessWidget {
|
||||
required this.stringFlag,
|
||||
required this.onRefresh,
|
||||
this.onExportExcel,
|
||||
this.onCallExport,
|
||||
// this.onCallExport,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -1499,12 +1499,12 @@ class othersPendings extends StatelessWidget {
|
||||
staffId: row['staff_id'] ?? '',
|
||||
role: role,
|
||||
);
|
||||
if (onCallExport != null) {
|
||||
await onCallExport!(
|
||||
"TodayAssigned",
|
||||
row['staff_id'].toString(),
|
||||
);
|
||||
}
|
||||
// if (onCallExport != null) {
|
||||
// await onCallExport!(
|
||||
// "TodayAssigned",
|
||||
// row['staff_id'].toString(),
|
||||
// );
|
||||
// }
|
||||
},
|
||||
child: Text(
|
||||
row['today_assigned'] ?? "",
|
||||
@ -1534,12 +1534,12 @@ class othersPendings extends StatelessWidget {
|
||||
staffId: row['staff_id'] ?? '',
|
||||
role: role,
|
||||
);
|
||||
if (onCallExport != null) {
|
||||
await onCallExport!(
|
||||
"Assigned",
|
||||
row['staff_id'].toString(),
|
||||
);
|
||||
}
|
||||
// if (onCallExport != null) {
|
||||
// await onCallExport!(
|
||||
// "Assigned",
|
||||
// row['staff_id'].toString(),
|
||||
// );
|
||||
// }
|
||||
},
|
||||
child: Text(
|
||||
row['today_pending'] ?? "",
|
||||
@ -1569,12 +1569,12 @@ class othersPendings extends StatelessWidget {
|
||||
staffId: row['staff_id'] ?? '',
|
||||
role: role,
|
||||
);
|
||||
if (onCallExport != null) {
|
||||
await onCallExport!(
|
||||
'InProgress',
|
||||
row['staff_id'].toString(),
|
||||
);
|
||||
}
|
||||
// if (onCallExport != null) {
|
||||
// await onCallExport!(
|
||||
// 'InProgress',
|
||||
// row['staff_id'].toString(),
|
||||
// );
|
||||
// }
|
||||
|
||||
},
|
||||
|
||||
@ -1605,12 +1605,12 @@ class othersPendings extends StatelessWidget {
|
||||
staffId: row['staff_id'] ?? '',
|
||||
role: role,
|
||||
);
|
||||
if (onCallExport != null) {
|
||||
await onCallExport!(
|
||||
'Completed',
|
||||
row['staff_id'].toString(),
|
||||
);
|
||||
}
|
||||
// if (onCallExport != null) {
|
||||
// await onCallExport!(
|
||||
// 'Completed',
|
||||
// row['staff_id'].toString(),
|
||||
// );
|
||||
// }
|
||||
},
|
||||
child: Text(
|
||||
row['today_completed'] ?? "",
|
||||
@ -1642,13 +1642,12 @@ class othersPendings extends StatelessWidget {
|
||||
// 2. Call the Export function
|
||||
// We use await here so the 'isLoading' state is respected
|
||||
// and errors are caught properly.
|
||||
|
||||
if (onCallExport != null) {
|
||||
await onCallExport!(
|
||||
'PrevPending',
|
||||
row['staff_id'].toString(),
|
||||
);
|
||||
}
|
||||
// if (onCallExport != null) {
|
||||
// await onCallExport!(
|
||||
// 'PrevPending',
|
||||
// row['staff_id'].toString(),
|
||||
// );
|
||||
// }
|
||||
},
|
||||
child: Text(
|
||||
safePending.toString() ?? "",
|
||||
@ -2012,14 +2011,39 @@ class Performance extends StatelessWidget {
|
||||
// style: _tableDataStyle,
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// row['agent_name'] ?? "",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: _tableDataStyle,
|
||||
// ),
|
||||
// ),
|
||||
Expanded(
|
||||
child: Text(
|
||||
row['agent_name'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
// Top: Agent Name
|
||||
Text(
|
||||
row['agent_name'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
// Bottom: Agent Code (light weight)
|
||||
Text(
|
||||
row['agent_code'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataTimeStyle.copyWith(
|
||||
fontWeight: FontWeight.w300, // lighter
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Text(
|
||||
row['total_policy_issued'] ?? "",
|
||||
@ -2229,13 +2253,37 @@ class UnassignedEnq extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// row['agent_name'] ?? '', // convert int to string
|
||||
// // textAlign: TextAlign.center,
|
||||
// style: _tableDataStyle,
|
||||
// ),
|
||||
// ),
|
||||
Expanded(
|
||||
child: Text(
|
||||
row['agent_name'] ?? '', // convert int to string
|
||||
// textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start, // align right
|
||||
children: [
|
||||
// Top: Agent Name
|
||||
Text(
|
||||
row['agent_name'] ?? "",
|
||||
textAlign: TextAlign.left,
|
||||
style: _tableDataStyle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
// Bottom: Agent Code (light weight)
|
||||
Text(
|
||||
row['agent_code'] ?? "",
|
||||
textAlign: TextAlign.left,
|
||||
style: _tableDataTimeStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Text(
|
||||
row['reg_no'] ?? "",
|
||||
|
||||
@ -1024,9 +1024,7 @@ class CreateProposal_QuickFormState
|
||||
columnSpacing: 10,
|
||||
columns: [
|
||||
DataColumn(label: Text("Partner", style: _tableHeaderStyle)),
|
||||
DataColumn(
|
||||
label: Text("Vehicle Number", style: _tableHeaderStyle),
|
||||
),
|
||||
DataColumn(label: Text("Vehicle Number", style: _tableHeaderStyle)),
|
||||
DataColumn(label: Text("Insurer", style: _tableHeaderStyle)),
|
||||
DataColumn(label: Text("Plan Type", style: _tableHeaderStyle)),
|
||||
DataColumn(label: Text("Premium", style: _tableHeaderStyle)),
|
||||
@ -1040,10 +1038,35 @@ class CreateProposal_QuickFormState
|
||||
return [
|
||||
DataRow(
|
||||
cells: [
|
||||
// DataCell(
|
||||
// Text(
|
||||
// item["agent_name"] ?? "-",
|
||||
// style: _tableDataStyle,
|
||||
// ),
|
||||
// ),
|
||||
DataCell(
|
||||
Text(
|
||||
item["agent_name"] ?? "-",
|
||||
style: _tableDataStyle,
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Top: Agent Name
|
||||
Text(
|
||||
item['agent_name'] ?? '-',
|
||||
style: _tableDataStyle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
// Bottom: Agent Code (light weight)
|
||||
if (item['agent_code'] != null)
|
||||
Text(
|
||||
item['agent_code'],
|
||||
style: _tableDataStyle.copyWith(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
DataCell(
|
||||
|
||||
@ -33,11 +33,13 @@ class SubRowWidget extends ConsumerStatefulWidget {
|
||||
final String? selectedAgent;
|
||||
final String? selectedInsurer;
|
||||
final String? selectedBroker;
|
||||
// final String? selectedVehicleType;
|
||||
|
||||
final Function(String?)? onStaffChanged;
|
||||
final Function(String?)? onAgentChanged;
|
||||
final Function(String?)? onInsurerChanged;
|
||||
final Function(String?)? onBrokerChanged;
|
||||
// final Function(String?)? onVehicleTypeChanged;
|
||||
|
||||
const SubRowWidget({
|
||||
super.key,
|
||||
@ -52,10 +54,12 @@ class SubRowWidget extends ConsumerStatefulWidget {
|
||||
required this.selectedAgent,
|
||||
required this.selectedInsurer,
|
||||
required this.selectedBroker,
|
||||
// required this.selectedVehicleType,
|
||||
this.onStaffChanged,
|
||||
this.onAgentChanged,
|
||||
this.onInsurerChanged,
|
||||
this.onBrokerChanged,
|
||||
// this.onVehicleTypeChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -106,6 +110,7 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
|
||||
|
||||
List<Map<String, dynamic>> getVehicleTypeData = [];
|
||||
List<Map<String, dynamic>> filteredVechicleData = [];
|
||||
// List<Map<String, dynamic>> filteredVehicleData = [];
|
||||
|
||||
List<Map<String, dynamic>> getAgentListData = [];
|
||||
List<Map<String, dynamic>> filteredAgentData = [];
|
||||
@ -135,6 +140,10 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
|
||||
dropDownKeyInsurerEnqAsgn =
|
||||
GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
|
||||
|
||||
// final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
|
||||
// dropDownKeyVehicleTypeEnqAsgn =
|
||||
// GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
|
||||
|
||||
final GlobalKey<DropdownSearchState<Map<String, dynamic>>> dropDownKeyBroker =
|
||||
GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
|
||||
final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
|
||||
@ -205,6 +214,7 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
|
||||
|
||||
getInsurers();
|
||||
getBroker();
|
||||
// getVehicleType();
|
||||
}
|
||||
|
||||
Future<void> loadPreferences() async {
|
||||
@ -300,6 +310,39 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
|
||||
}
|
||||
}
|
||||
|
||||
// Future<void> getVehicleType() async {
|
||||
// print('EIS 1getVT-called');
|
||||
// setState(() {
|
||||
// isLoadingVehicleType = true;
|
||||
// });
|
||||
//
|
||||
// try {
|
||||
// final response = await apiService.fetchMasterDropDown('vehicleType');
|
||||
//
|
||||
// if (response['status'] == 200) {
|
||||
// print('EIS 2getVT-Data - ${response['data']}');
|
||||
// setState(() {
|
||||
// getVehicleTypeData = List<Map<String, dynamic>>.from(
|
||||
// response['data'],
|
||||
// );
|
||||
// // print('EIL 3getVT-B4filterData : $getVehicleTypeData');
|
||||
//
|
||||
// filteredVehicleData = List.from(getVehicleTypeData);
|
||||
// // print('EIL 3getVT-AftfilterData : $filteredVehicleData');
|
||||
// });
|
||||
// } else {
|
||||
// getVehicleTypeData = [];
|
||||
// filteredVehicleData = [];
|
||||
// }
|
||||
// } catch (e) {
|
||||
// print('EIS 2getVT-Exception occurred: $e');
|
||||
// } finally {
|
||||
// setState(() {
|
||||
// isLoadingVehicleType = false;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<void> getBroker() async {
|
||||
print('getBroker called');
|
||||
setState(() {
|
||||
@ -387,6 +430,7 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
|
||||
buildEmail(context),
|
||||
buildPhNumber(context),
|
||||
buildRemarks(context),
|
||||
// buildVehicleType(context),
|
||||
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@ -1121,6 +1165,174 @@ class _SubRowWidgetState extends ConsumerState<SubRowWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
// Widget buildVehicleType(BuildContext context, {fromHeader = true}) {
|
||||
// Map<String, dynamic>? selectedVehicleTyped = filteredVehicleData.firstWhere(
|
||||
// (item) => item['vehicle_type_id'].toString() == widget.selectedVehicleType,
|
||||
// orElse: () => {},
|
||||
// );
|
||||
//
|
||||
// return Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text('Vehicle Type', style: _subLabelTimeStyle),
|
||||
// SizedBox(height: 5),
|
||||
// Container(
|
||||
// height: 30,
|
||||
// width: fromHeader
|
||||
// ? MediaQuery.of(context).size.width * 0.1
|
||||
// : MediaQuery.of(context).size.width * 0.08,
|
||||
// child: DropdownSearch<Map<String, dynamic>>(
|
||||
// key: dropDownKeyVehicleTypeEnqAsgn,
|
||||
// selectedItem: selectedVehicleTyped.isNotEmpty ? selectedVehicleTyped : null,
|
||||
// // items: (filter, infiniteScrollProps) {
|
||||
// // return filteredInsurersData;
|
||||
// // },
|
||||
// items: (filter, infiniteScrollProps) async {
|
||||
// if (filter.isEmpty) {
|
||||
// return filteredVehicleData;
|
||||
// }
|
||||
// return filteredVehicleData.where((item) {
|
||||
// return item['vehicle_type'].toString().toLowerCase().contains(
|
||||
// filter.toLowerCase(),
|
||||
// );
|
||||
// }).toList();
|
||||
// },
|
||||
//
|
||||
// itemAsString: (val) => val['vehicle_type'].toString(), // what to show
|
||||
// compareFn: (item, selectedItem) =>
|
||||
// item['vehicle_type'].toString() == selectedItem['vehicle_type'].toString(),
|
||||
//
|
||||
// // 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['vehicle_type'].toString()
|
||||
// : "",
|
||||
// style: GoogleFonts.poppins(
|
||||
// fontSize: 11,
|
||||
// color: Color(0XFF6366F1),
|
||||
// ),
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// maxLines: 1,
|
||||
// softWrap: false,
|
||||
// ),
|
||||
// ),
|
||||
// decoratorProps: DropDownDecoratorProps(
|
||||
// decoration:
|
||||
// AppInputDecorations.dropdownDecoration(
|
||||
// label: "Vehicle Type",
|
||||
// ).copyWith(
|
||||
// filled: true,
|
||||
// fillColor:
|
||||
// Colors.white, // 👈 makes the dropdown input white
|
||||
// isDense: true,
|
||||
// border: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(5),
|
||||
// borderSide: const BorderSide(
|
||||
// color: Color(0XFF6366F1),
|
||||
// width: 0.5,
|
||||
// ),
|
||||
// ),
|
||||
// enabledBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(5),
|
||||
// borderSide: const BorderSide(
|
||||
// color: Color(0XFF6366F1),
|
||||
// width: 0.5,
|
||||
// ),
|
||||
// ),
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 8,
|
||||
// vertical: 6,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// popupProps: PopupProps.menu(
|
||||
// fit: FlexFit.loose,
|
||||
// constraints: BoxConstraints(maxHeight: 200),
|
||||
// menuProps: MenuProps(
|
||||
// backgroundColor:
|
||||
// Colors.white, // 👈 sets dropdown background to white
|
||||
// ),
|
||||
// showSearchBox: true,
|
||||
// searchFieldProps: TextFieldProps(
|
||||
// style: GoogleFonts.inter(fontSize: 11, color: Colors.black),
|
||||
//
|
||||
// autofocus: true,
|
||||
// decoration: InputDecoration(
|
||||
// contentPadding: EdgeInsets.all(1),
|
||||
// filled: true,
|
||||
// fillColor: Colors.white,
|
||||
// hintText: "Search Vehicle Type...",
|
||||
// hintStyle: GoogleFonts.inter(
|
||||
// fontSize: 12,
|
||||
// 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['vehicle_type'].toString(),
|
||||
// style: GoogleFonts.inter(fontSize: 12, color: Colors.black),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// // constraints: BoxConstraints(),
|
||||
// ),
|
||||
//
|
||||
// onChanged: (val) {
|
||||
// if (val != null) {
|
||||
// print("Selected vehicle_type : ${val['vehicle_type']}");
|
||||
// print("Id: ${val['id']}");
|
||||
// // selectedInsurer = val['id'];
|
||||
// widget.onVehicleTypeChanged?.call(val['id']);
|
||||
// // controllers['agentId']?.text = val['agent_code'];
|
||||
// // agentId = agent['id'];
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
Widget buildBroker(BuildContext context) {
|
||||
Map<String, dynamic>? selectedBrokers = filteredBrokerData.firstWhere(
|
||||
(item) => item['id'].toString() == widget.selectedBroker,
|
||||
|
||||
@ -56,9 +56,11 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
bool _resetKeyEnable = false; // very first
|
||||
int currentPage = 1;
|
||||
int itemsPerPage = 10;
|
||||
|
||||
// int itemsPerPage = 5;
|
||||
|
||||
int completedCurrentPage = 1;
|
||||
|
||||
// int completedItemsPerPage = 5;
|
||||
int completedItemsPerPage = 50;
|
||||
int totalCompletedPages = 1;
|
||||
@ -128,7 +130,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
//---------------------- Enquiry TAB Initializations Starts -------------------------------- //
|
||||
|
||||
List<Map<String, dynamic>> getVehicleTypeData = [];
|
||||
List<Map<String, dynamic>> filteredVechicleData = [];
|
||||
List<Map<String, dynamic>> filteredVehicleData = [];
|
||||
|
||||
List<Map<String, dynamic>> getAgentListData = [];
|
||||
List<Map<String, dynamic>> filteredAgentData = [];
|
||||
@ -168,6 +170,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
int autoRefreshIndex = 0;
|
||||
|
||||
final List<String> enquiryTabs = ["In Progress", "Completed"];
|
||||
|
||||
int get fullCompletedCount => completedData.length;
|
||||
|
||||
Map<String, dynamic> dataDetails() {
|
||||
@ -207,6 +210,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
|
||||
dropDownSelectPaymentModeKey =
|
||||
GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
|
||||
|
||||
//---------------------- Assign Staff starts -------------------------------- //
|
||||
|
||||
final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
|
||||
@ -228,6 +232,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
String? selectedBroker;
|
||||
|
||||
final ScrollController _horizontalScrollController = ScrollController();
|
||||
|
||||
// late Timer timer;
|
||||
Timer? timer;
|
||||
int selectedSeconds = 30;
|
||||
@ -314,26 +319,29 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
if (next == true) {
|
||||
print('quickQuotationKey2 - $next');
|
||||
callRefresh();
|
||||
ref.read(enquiryRefreshProvider.notifier).state = false; // reset
|
||||
ref
|
||||
.read(enquiryRefreshProvider.notifier)
|
||||
.state = false; // reset
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
getPaymentMode();
|
||||
|
||||
refreshSub = ref.listenManual<bool>(enquiryRefreshProvider, (
|
||||
previous,
|
||||
next,
|
||||
) {
|
||||
refreshSub = ref.listenManual<bool>(enquiryRefreshProvider, (previous,
|
||||
next,) {
|
||||
if (next == true) {
|
||||
print('refresh triggered Quick Creation');
|
||||
autoRefrshfilterDateRange();
|
||||
// callRefresh();
|
||||
|
||||
ref.read(enquiryRefreshProvider.notifier).state = false;
|
||||
ref
|
||||
.read(enquiryRefreshProvider.notifier)
|
||||
.state = false;
|
||||
}
|
||||
});
|
||||
getInsuranceType();
|
||||
getVehicleType();
|
||||
}
|
||||
|
||||
// Future<void> loadPreferences() async {
|
||||
@ -629,8 +637,40 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getStaffList(
|
||||
int managerId,
|
||||
Future<void> getVehicleType() async {
|
||||
print('EIL 1getVT-called');
|
||||
setState(() {
|
||||
isLoadingVehicleType = true;
|
||||
});
|
||||
|
||||
try {
|
||||
final response = await apiService.fetchMasterDropDown('vehicleType');
|
||||
|
||||
if (response['status'] == 200) {
|
||||
print('EIL 2getVT-Data - ${response['data']}');
|
||||
setState(() {
|
||||
getVehicleTypeData = List<Map<String, dynamic>>.from(
|
||||
response['data'],
|
||||
);
|
||||
// print('EIL 3getVT-B4filterData : $getVehicleTypeData');
|
||||
|
||||
filteredVehicleData = List.from(getVehicleTypeData);
|
||||
// print('EIL 3getVT-AftfilterData : $filteredVehicleData');
|
||||
});
|
||||
} else {
|
||||
getVehicleTypeData = [];
|
||||
filteredVehicleData = [];
|
||||
}
|
||||
} catch (e) {
|
||||
print('EIL 2getVT-Exception occurred: $e');
|
||||
} finally {
|
||||
setState(() {
|
||||
isLoadingVehicleType = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getStaffList(int managerId,
|
||||
role, {
|
||||
String fromDate = '',
|
||||
String toDate = '',
|
||||
@ -654,12 +694,16 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
setState(() {
|
||||
_dashboardInitHandled = true;
|
||||
});
|
||||
// For PREV PENDING → set date range until yesterday
|
||||
final today = DateTime.now();
|
||||
print('A813 => Fns called => $managerId | $role');
|
||||
final DateTime yesterday = today.subtract(const Duration(days: 1));
|
||||
final DateTime fromDate = DateTime(2025, 10, 1); // hardcoded Date
|
||||
controllers['startDate']?.text = dateFormat.format(fromDate);
|
||||
controllers['endDate']?.text = dateFormat.format(yesterday);
|
||||
print('UnA813 => Fns called => $managerId | $role');
|
||||
|
||||
// For PREV PENDING → set date range until yesterday
|
||||
// Change to dd-MM-yyyy
|
||||
// final dateFormat = DateFormat('dd-MM-yyyy');
|
||||
//
|
||||
// final yesterday = today.subtract(Duration(days: 1));
|
||||
|
||||
fromDt = _dashboardInitHandled ? controllers['startDate']?.text : '';
|
||||
@ -703,6 +747,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
print('Pre Date its User Choosen Enq Inline list - $fromDt - $toDt');
|
||||
|
||||
if (_resetKeyEnable) {
|
||||
print('A12131 => Fns called => $managerId | $role');
|
||||
final dateFormat = DateFormat('dd-MM-yyyy');
|
||||
final today = DateTime.now();
|
||||
// final yesterday = today.subtract(Duration(days: 1));
|
||||
@ -716,11 +761,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
_resetKeyEnable = false; // ask suren Never forgot
|
||||
});
|
||||
} else {
|
||||
print('A13131 => Fns called => $managerId | $role');
|
||||
fromDt = fromDateVal;
|
||||
toDt = toDateVal;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
print('Enq 2- $fromDt - $toDt');
|
||||
String finalStatus = SelectedStatus;
|
||||
@ -733,7 +777,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
managerId,
|
||||
userId,
|
||||
role,
|
||||
fromDate: _dashboardInitHandled ? controllers['startDate']?.text : fromDt,
|
||||
fromDate: _dashboardInitHandled
|
||||
? controllers['startDate']?.text
|
||||
: fromDt,
|
||||
toDate: _dashboardInitHandled ? controllers['endDate']?.text : toDt,
|
||||
// selectedStatus: (finalStatus != '' && finalStatus != 'PrevPending')
|
||||
// ? finalStatus
|
||||
@ -761,7 +807,6 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
controllers['endDate']?.text = toDate;
|
||||
|
||||
|
||||
|
||||
if (data is List) {
|
||||
getStaffData = List<Map<String, dynamic>>.from(data);
|
||||
|
||||
@ -831,7 +876,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
|
||||
void _applyFilter(String query) {
|
||||
setState(() {
|
||||
final List<dynamic> source = (selectedIndex == 0) ? inProgressData : completedData;
|
||||
final List<dynamic> source = (selectedIndex == 0)
|
||||
? inProgressData
|
||||
: completedData;
|
||||
final String q = query.trim().toLowerCase();
|
||||
completedCurrentPage = 1;
|
||||
|
||||
@ -1106,23 +1153,22 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> handleStaff(
|
||||
BuildContext context,
|
||||
Future<void> handleStaff(BuildContext context,
|
||||
dynamic data,
|
||||
id,
|
||||
regNum,
|
||||
) async {
|
||||
regNum,) async {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AssignStaffDialog(
|
||||
enquiryPrimaryId: id,
|
||||
regNum: regNum,
|
||||
userId: userId,
|
||||
onSubmit: (value) {
|
||||
debugPrint("New assignY: $value");
|
||||
refresh();
|
||||
},
|
||||
),
|
||||
builder: (ctx) =>
|
||||
AssignStaffDialog(
|
||||
enquiryPrimaryId: id,
|
||||
regNum: regNum,
|
||||
userId: userId,
|
||||
onSubmit: (value) {
|
||||
debugPrint("New assignY: $value");
|
||||
refresh();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -1231,6 +1277,26 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> handleVehicleType(VtId, EId) async {
|
||||
print('EIL 1handleVT-called');
|
||||
print('EIL 2handleVT-vtid ${VtId}');
|
||||
print('EIL 3handleVT-eid ${EId}');
|
||||
Map<String, dynamic> data = {
|
||||
"id": EId,
|
||||
"vehicle_type_id": VtId,
|
||||
"updated_by": userId,
|
||||
};
|
||||
|
||||
final path = 'enquiry/setVehicleTypeToEnquiry';
|
||||
|
||||
final res = await apiService.createUserData(data, path);
|
||||
print('EIL 4handleVT-res $res');
|
||||
if (res['status'] == 'success') {
|
||||
print('EIL 5handleVT-res ${res['status']}');
|
||||
refrshfilterDateRange();
|
||||
}
|
||||
}
|
||||
|
||||
void handleSave(dynamic id) {
|
||||
print('SAVE -- $id');
|
||||
// final ids = int.tryParse(id.toString()) ?? 0;
|
||||
@ -1315,12 +1381,16 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
}
|
||||
|
||||
// Validate Insured Name
|
||||
if (controllers['name']?.text.trim().isEmpty ?? true) {
|
||||
if (controllers['name']?.text
|
||||
.trim()
|
||||
.isEmpty ?? true) {
|
||||
fieldErrors['name'] = 'Insured Name is required';
|
||||
}
|
||||
|
||||
// Validate Vehicle Number
|
||||
if (controllers['regNo']?.text.trim().isEmpty ?? true) {
|
||||
if (controllers['regNo']?.text
|
||||
.trim()
|
||||
.isEmpty ?? true) {
|
||||
fieldErrors['regNo'] = 'Vehicle Number is required';
|
||||
}
|
||||
|
||||
@ -1369,16 +1439,17 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
} catch (e) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text(e.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('OK'),
|
||||
builder: (_) =>
|
||||
AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text(e.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
// setState(() => isSaving = false); // re-enable button after save
|
||||
@ -1386,11 +1457,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
}
|
||||
|
||||
Future<void> attachFiles(http.MultipartRequest request) async {
|
||||
Future<void> addFileOrKeepName(
|
||||
PlatformFile? file,
|
||||
Future<void> addFileOrKeepName(PlatformFile? file,
|
||||
String? apiFileName,
|
||||
String fieldName,
|
||||
) async {
|
||||
String fieldName,) async {
|
||||
if (file != null) {
|
||||
// User uploaded a new file → send as multipart
|
||||
if (file.bytes != null) {
|
||||
@ -1626,7 +1695,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
return MainLayout(
|
||||
title: "Enquiries",
|
||||
body: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
width: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width,
|
||||
// height: MediaQuery.of(context).size.height * 0.1,
|
||||
// padding: EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
@ -1652,16 +1724,17 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
} catch (e) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text(e.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('OK'),
|
||||
builder: (_) =>
|
||||
AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text(e.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
@ -1671,7 +1744,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
// SizedBox(height: 5),
|
||||
ResponsiveLayout.isMobile(context)
|
||||
? Container(
|
||||
height: MediaQuery.of(context).size.height * 0.69,
|
||||
height: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.height * 0.69,
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(2),
|
||||
@ -1683,8 +1759,14 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
// Expanded(
|
||||
// child:
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height * 0.69,
|
||||
width: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width,
|
||||
height: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.height * 0.69,
|
||||
// padding: EdgeInsets.symmetric(
|
||||
// horizontal: 8.0,
|
||||
// vertical: 2.0,
|
||||
@ -1719,11 +1801,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
refrshfilterDateRange();
|
||||
}
|
||||
|
||||
Future<void> buildPolicyCreatedStatusActions(
|
||||
BuildContext context,
|
||||
Future<void> buildPolicyCreatedStatusActions(BuildContext context,
|
||||
status,
|
||||
id,
|
||||
) async {
|
||||
id,) async {
|
||||
print("Actionsstatus - $status -$id");
|
||||
dynamic val;
|
||||
if (status == 'Awaiting Proposal' || status == 'Proposal Created') {
|
||||
@ -1839,7 +1919,8 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
bool newValue = !v;
|
||||
setState(() {
|
||||
isActionable = newValue;
|
||||
userPreference = newValue; // Save this as the new "normal"
|
||||
userPreference =
|
||||
newValue; // Save this as the new "normal"
|
||||
});
|
||||
final prefs =
|
||||
await SharedPreferences.getInstance();
|
||||
@ -1916,8 +1997,14 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
txtHeight: 30,
|
||||
controller: _searchStaffController,
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? MediaQuery.of(context).size.width * 0.7
|
||||
: MediaQuery.of(context).size.width * 0.13,
|
||||
? MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width * 0.7
|
||||
: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width * 0.13,
|
||||
|
||||
// Combine the logic into one function block
|
||||
onChanged: (value) {
|
||||
@ -1979,7 +2066,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
ResponsiveLayout.isMobile(context)
|
||||
? _buildDataTable(context)
|
||||
: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.55,
|
||||
height: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.height * 0.55,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white
|
||||
// ),
|
||||
@ -2001,6 +2091,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
'Assigned': 'Assigned',
|
||||
'In progress': 'In Progress',
|
||||
};
|
||||
|
||||
List<Map<String, dynamic>> get filteredDataByTab {
|
||||
final sortedData = [...filteredData]
|
||||
..sort((a, b) => int.parse(b['id']) - int.parse(a['id']));
|
||||
@ -2124,11 +2215,14 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
}
|
||||
|
||||
Widget _buildDataTable(context) {
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
final screenWidth = MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width;
|
||||
final isMobile = ResponsiveLayout.isMobile(context);
|
||||
|
||||
// Calculate minimum width based on screen size
|
||||
double minTableWidth = isMobile ? screenWidth * 1.5 : 1300;
|
||||
double minTableWidth = isMobile ? screenWidth * 1.2 : 1200;
|
||||
return
|
||||
// Expanded(
|
||||
// child:
|
||||
@ -2229,7 +2323,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
if (item['type'] == 'header') {
|
||||
// Render group header
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
width: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width,
|
||||
margin: EdgeInsets.fromLTRB(12, 4, 12, 4),
|
||||
child: _buildGroupHeader(item['status'], item['count']),
|
||||
);
|
||||
@ -2241,7 +2338,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
final selectId = data['id'].toString() ?? '0';
|
||||
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
width: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width,
|
||||
margin: EdgeInsets.fromLTRB(12, 8, 12, 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
@ -2265,7 +2365,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
// Expanded content
|
||||
if (rowExpanded[id] ?? false)
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
width: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Color(0xFFC7D2FE)),
|
||||
color: Color(0xFFF8F9FF),
|
||||
@ -2286,6 +2389,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
selectedStaff: selectedStaff,
|
||||
selectedBroker: selectedBroker,
|
||||
selectedInsurer: selectedInsurer,
|
||||
// selectedVehicleType: selectedVehicleType,
|
||||
filteredAgentData: filteredAgentData,
|
||||
filteredStaffDataEnqAsgn: filteredStaffDataEnqAsgn,
|
||||
onStaffChanged: (val) {
|
||||
@ -2303,6 +2407,11 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
selectedInsurer = val;
|
||||
});
|
||||
},
|
||||
// onVehicleTypeChanged: (val) {
|
||||
// setState(() {
|
||||
// selectedVehicleType = val;
|
||||
// });
|
||||
// },
|
||||
onBrokerChanged: (val) {
|
||||
setState(() {
|
||||
selectedBroker = val;
|
||||
@ -2335,6 +2444,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
// DataColumn(label: Text('Premium', style: _headerStyle)),
|
||||
DataColumn(label: Text('Payment Mode', style: _headerStyle)),
|
||||
DataColumn(label: Text('Plan Type', style: _headerStyle)),
|
||||
DataColumn(label: Text('Vehicle Type', style: _headerStyle)),
|
||||
DataColumn(label: Text('Policy', style: _headerStyle)),
|
||||
];
|
||||
}
|
||||
@ -2345,7 +2455,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
child: Row(
|
||||
children: [
|
||||
_buildHeaderCell('Received Date', 110),
|
||||
_buildHeaderCell('Assigned To', 130),
|
||||
_buildHeaderCell('Assigned To', 110),
|
||||
_buildHeaderCell('Partner', 100),
|
||||
|
||||
// _buildHeaderCell('Broker *', 100),
|
||||
@ -2356,10 +2466,11 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
_buildHeaderCell('Status', 100),
|
||||
// _buildHeaderCell('Assigned Date', 100),
|
||||
// _buildHeaderCell('Premium', 100),
|
||||
_buildHeaderCell('Payment Mode', 130),
|
||||
_buildHeaderCell('Plan Type', 130),
|
||||
_buildHeaderCell('Payment Mode', 100),
|
||||
_buildHeaderCell('Plan Type', 100),
|
||||
_buildHeaderCell('Vehicle Type', 100),
|
||||
|
||||
_buildHeaderCell('Policy', 120),
|
||||
_buildHeaderCell('Policy', 100),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -2706,6 +2817,37 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
);
|
||||
}
|
||||
|
||||
// Helper: Vehicle type dropdown
|
||||
Widget _buildVehicleTypeDropdown(Map<String, dynamic> item) {
|
||||
if (item['enquiry_status'] == 'To be assigned' ||
|
||||
(item['enquiry_status'] == 'Assigned' &&
|
||||
item['quotation_id'] == null)) {
|
||||
return Text('-');
|
||||
}
|
||||
|
||||
return DropdownSearch<Map<String, dynamic>>(
|
||||
key: ValueKey('vehicle_type_${item['id']}'),
|
||||
selectedItem: _getSelectedVehicleType(item),
|
||||
items: (filter, _) async => _filterVehicleType(filter),
|
||||
itemAsString: (val) => val['vehicle_type'].toString(),
|
||||
compareFn: (item, selectedItem) => item['vehicle_type_id'] == selectedItem['id'],
|
||||
suffixProps: _buildDropdownSuffix(),
|
||||
dropdownBuilder: (context, selectedItem) =>
|
||||
_buildDropdownDisplay(selectedItem, 'vehicle_type', 'Select Vehicle Type'),
|
||||
decoratorProps: _buildDropdownDecorator(),
|
||||
popupProps: _buildDropdownPopup('vehicle_type'),
|
||||
onChanged: (val) {
|
||||
if (val != null) {
|
||||
setState(() {
|
||||
item['vehicle_type_id'] = val['id'].toString();
|
||||
item['vehicle_type'] = val['vehicle_type'].toString();
|
||||
});
|
||||
handleVehicleType(val['id'].toString(), item['id']);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// Helper: Policy upload/download
|
||||
Widget _buildPolicyCell(Map<String, dynamic> item) {
|
||||
if (item['enquiry_status'] == 'To be assigned' ||
|
||||
@ -2893,6 +3035,41 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic>? _getSelectedVehicleType(Map<String, dynamic> item) {
|
||||
try {
|
||||
|
||||
print('EIL 1getSVT-called');
|
||||
print('EIL 2getSVT-vehicle_type_id ${item['vehicle_type_id']}');
|
||||
print('EIL 3getSVT-vehicle_type ${item['vehicle_type']}');
|
||||
|
||||
final result = filteredVehicleData.firstWhere(
|
||||
(vt) {
|
||||
final idMatch =
|
||||
vt['id'].toString() == item['vehicle_type_id'].toString();
|
||||
|
||||
final nameMatch =
|
||||
vt['vehicle_type'].toString().trim().toLowerCase() ==
|
||||
item['vehicle_type'].toString().trim().toLowerCase();
|
||||
|
||||
print('EIL 3getSVT-check id O:${vt['id']} | name O:${vt['vehicle_type']} '); // o means original
|
||||
print('EIL 4getSVT-check id M:$idMatch | name M:$nameMatch'); // M means match
|
||||
|
||||
return idMatch || nameMatch;
|
||||
},
|
||||
orElse: () => {},
|
||||
);
|
||||
|
||||
print('EIL 5getSVT-result $result');
|
||||
|
||||
return result.isNotEmpty ? result : null;
|
||||
} catch (e, s) {
|
||||
print('EIL 6getSVT-ERROR $e');
|
||||
print(s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<Map<String, dynamic>> _filterPaymentModes(String filter) {
|
||||
if (filter.isEmpty) return filteredPaymentModeData;
|
||||
return filteredPaymentModeData.where((mode) {
|
||||
@ -2911,6 +3088,23 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<Map<String, dynamic>> _filterVehicleType(String filter) {
|
||||
print('EIL 1filterVT-called');
|
||||
print('EIL 2filterVT-text "$filter" | ${filteredVehicleData.length}');
|
||||
|
||||
if (filter.isEmpty) return filteredVehicleData; // 'Filter EMPTY → returning full list'
|
||||
|
||||
final result = filteredVehicleData.where((vt) {
|
||||
final vehicleType = vt['vehicle_type']?.toString().toLowerCase() ?? '';
|
||||
final match = vehicleType.contains(filter.toLowerCase());
|
||||
print('EIL 3filterVT-Check - id:${vt['id']} | vehicle_type:$vehicleType | match:$match');
|
||||
return match;
|
||||
}).toList();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
DropdownSuffixProps _buildDropdownSuffix() {
|
||||
return DropdownSuffixProps(
|
||||
dropdownButtonProps: DropdownButtonProps(
|
||||
@ -3098,7 +3292,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
// Status
|
||||
DataCell(
|
||||
SizedBox(
|
||||
width: 120,
|
||||
width: 100,
|
||||
child: _buildStatusCell(item, id, bgColor, borderColor),
|
||||
),
|
||||
),
|
||||
@ -3107,7 +3301,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
DataCell(
|
||||
SizedBox(
|
||||
height: 30,
|
||||
width: 120,
|
||||
width: 100,
|
||||
child: _buildPaymentModeDropdown(item),
|
||||
),
|
||||
),
|
||||
@ -3115,12 +3309,21 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
// Plan Type
|
||||
DataCell(
|
||||
SizedBox(
|
||||
width: 120,
|
||||
width: 100,
|
||||
height: 30,
|
||||
child: _buildInsurancePlanDropdown(item),
|
||||
),
|
||||
),
|
||||
|
||||
// Vehicle Type
|
||||
DataCell(
|
||||
SizedBox(
|
||||
width: 100,
|
||||
height: 30,
|
||||
child: _buildVehicleTypeDropdown(item),
|
||||
),
|
||||
),
|
||||
|
||||
// Policy
|
||||
DataCell(
|
||||
SizedBox(height: 30, width: 90, child: _buildPolicyCell(item)),
|
||||
|
||||
@ -722,7 +722,13 @@ class policylistState extends ConsumerState<policylist> {
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(item['agent_name'] ?? '-', style: _dataBold),
|
||||
// child: Text(item['agent_name'] ?? '-', style: _dataBold),
|
||||
child: Text(
|
||||
(item['agent_code'] != null && item['agent_name'] != null)
|
||||
? '${item['agent_code']} - ${item['agent_name']}'
|
||||
: (item['agent_name'] ?? '-'),
|
||||
style: _dataBold,
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
|
||||
20
pubspec.lock
20
pubspec.lock
@ -700,26 +700,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
|
||||
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "11.0.2"
|
||||
version: "10.0.9"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
|
||||
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.10"
|
||||
version: "3.0.9"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_testing
|
||||
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
|
||||
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
version: "3.0.1"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1297,10 +1297,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
|
||||
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.6"
|
||||
version: "0.7.4"
|
||||
toastification:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1417,10 +1417,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
|
||||
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "2.1.4"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -15,8 +15,9 @@
|
||||
the `--base-href` argument provided to `flutter build`.
|
||||
-->
|
||||
<!-- <base href="$FLUTTER_BASE_HREF">-->
|
||||
<!-- <base href="/partner/">-->
|
||||
<base href="/nhance/partner/app/">
|
||||
<!-- <base href="/partner/"> Live build: also check env.dart (line 8)-->
|
||||
<base href="/nhance/partner/app/"> <!-- Testing build: also check env.dart (line 9) -->
|
||||
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user