policy pdf dashboard chngs
This commit is contained in:
parent
fcdc9da609
commit
6d7e6f24b9
File diff suppressed because one or more lines are too long
@ -666,6 +666,7 @@ class ApiService {
|
||||
String? selectedStatus,
|
||||
String? selectedStaffId,
|
||||
}) async {
|
||||
print("selectedStatusselectedStatus - $selectedStatus");
|
||||
if (_token == null) {
|
||||
await _initializeToken();
|
||||
}
|
||||
@ -692,11 +693,13 @@ class ApiService {
|
||||
|
||||
if (role == 'staff') {
|
||||
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 {
|
||||
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(
|
||||
int id,
|
||||
dynamic id,
|
||||
role, {
|
||||
String? fromDate,
|
||||
String? toDate,
|
||||
|
||||
@ -376,11 +376,7 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
|
||||
),
|
||||
child: IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
icon: const Icon(
|
||||
Icons.request_quote_outlined,
|
||||
color: Colors.black87,
|
||||
size: 20,
|
||||
),
|
||||
icon: const Icon(Icons.quora, color: Colors.black87, size: 20),
|
||||
onPressed: () {
|
||||
SideDrawerPanel.show(
|
||||
context: context,
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/http.dart' as ref;
|
||||
import 'package:toastification/toastification.dart';
|
||||
|
||||
import '../../../../core/config/env.dart';
|
||||
@ -15,12 +16,15 @@ import '../../../../data/utils/validators.dart';
|
||||
import '../../../layouts/responsive_layout.dart';
|
||||
import '../../../themes/indicators/customizd_file_upload.dart';
|
||||
import '../../../themes/indicators/input_field_decoration.dart';
|
||||
import '../../../themes/indicators/search_field_theme.dart';
|
||||
import '../../../themes/indicators/text_field_theme.dart';
|
||||
|
||||
// 🔹 Custom Dialog Widget
|
||||
class AddDialog extends StatefulWidget {
|
||||
final String title;
|
||||
final dynamic userId;
|
||||
final dynamic managerId;
|
||||
final dynamic role;
|
||||
final void Function(String value) onSubmit;
|
||||
final dynamic policyNumber;
|
||||
const AddDialog({
|
||||
@ -28,6 +32,8 @@ class AddDialog extends StatefulWidget {
|
||||
required this.title,
|
||||
required this.onSubmit,
|
||||
required this.userId,
|
||||
required this.managerId,
|
||||
required this.role,
|
||||
this.policyNumber,
|
||||
});
|
||||
|
||||
@ -63,6 +69,8 @@ class _AddDialogState extends State<AddDialog> {
|
||||
|
||||
List<String> tabHeader = ['policyNum', 'claimsDesc', 'remarks'];
|
||||
|
||||
final TextEditingController _searchStaffController = TextEditingController();
|
||||
|
||||
List<Map<String, dynamic>> getClaimsTypeData = [];
|
||||
List<Map<String, dynamic>> filteredClaimsData = [];
|
||||
|
||||
@ -72,6 +80,12 @@ class _AddDialogState extends State<AddDialog> {
|
||||
String? selectedClaimsType;
|
||||
String? selectedEndorsement;
|
||||
|
||||
dynamic roleId;
|
||||
|
||||
List<Map<String, dynamic>> getPolicyData = [];
|
||||
List<Map<String, dynamic>> originalData = [];
|
||||
List<Map<String, dynamic>> filteredData = [];
|
||||
|
||||
Map<String, dynamic> claimsDetails() {
|
||||
final data = {
|
||||
"policy_number": controllers["policyNum"]?.text,
|
||||
@ -103,12 +117,108 @@ class _AddDialogState extends State<AddDialog> {
|
||||
}
|
||||
|
||||
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.)
|
||||
_initializeToken();
|
||||
getClaimsType();
|
||||
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 {
|
||||
_token = await AuthService.getToken();
|
||||
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),
|
||||
|
||||
// 🔹 Switch content dynamically
|
||||
|
||||
@ -578,6 +578,8 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
|
||||
context: context,
|
||||
builder: (ctx) => AddDialog(
|
||||
userId: userId,
|
||||
role: null,
|
||||
managerId: null,
|
||||
title: "Endorsement",
|
||||
policyNumber: selectedPolicyNumber,
|
||||
onSubmit: (value) {
|
||||
@ -604,6 +606,8 @@ class PolicyTabState extends ConsumerState<PolicyTab> {
|
||||
builder: (ctx) => AddDialog(
|
||||
userId: userId,
|
||||
title: "Claims",
|
||||
role: null,
|
||||
managerId: null,
|
||||
policyNumber: selectedPolicyNumber,
|
||||
onSubmit: (value) {
|
||||
debugPrint("New Claim: $value");
|
||||
|
||||
@ -14,6 +14,7 @@ import '../../../providers/manager_provider.dart';
|
||||
import '../../../themes/indicators/export_btn.dart';
|
||||
import '../../../themes/indicators/search_field_theme.dart';
|
||||
import '../../../widgets/custom_action_popup.dart';
|
||||
import '../enquiry/policy_popup.dart';
|
||||
|
||||
class claimList extends ConsumerStatefulWidget {
|
||||
const claimList({super.key});
|
||||
@ -34,6 +35,10 @@ class claimListState extends ConsumerState<claimList> {
|
||||
|
||||
final TextEditingController _searchStaffController = TextEditingController();
|
||||
|
||||
dynamic userId;
|
||||
dynamic roleId;
|
||||
dynamic managerId;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -42,11 +47,15 @@ class claimListState extends ConsumerState<claimList> {
|
||||
|
||||
Future.microtask(() {
|
||||
final id = ref.read(managerIdProvider);
|
||||
final roleId = ref.read(userRoleProvider);
|
||||
final userId = ref.read(userIdProvider);
|
||||
managerId = ref.read(managerIdProvider);
|
||||
|
||||
// roleId = ref.read(userRoleProvider);
|
||||
// roleId = ref.read(userRoleProvider);
|
||||
|
||||
userId = ref.read(userIdProvider);
|
||||
print("G47 => r : $roleId | mId: $id | uId: $userId ");
|
||||
if (userId != null) {
|
||||
getStaffList(userId, roleId);
|
||||
getStaffList(id!, userId);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -284,6 +293,48 @@ class claimListState extends ConsumerState<claimList> {
|
||||
'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),
|
||||
// GestureDetector(
|
||||
|
||||
@ -14,6 +14,7 @@ import '../../../providers/manager_provider.dart';
|
||||
import '../../../themes/indicators/export_btn.dart';
|
||||
import '../../../themes/indicators/search_field_theme.dart';
|
||||
import '../../../widgets/custom_action_popup.dart';
|
||||
import '../enquiry/policy_popup.dart';
|
||||
|
||||
class endosement extends ConsumerStatefulWidget {
|
||||
const endosement({super.key});
|
||||
@ -31,6 +32,9 @@ class endosementState extends ConsumerState<endosement> {
|
||||
List<Map<String, dynamic>> originalData = [];
|
||||
List<Map<String, dynamic>> filteredData = [];
|
||||
bool isLoading = false;
|
||||
dynamic userId;
|
||||
dynamic roleId;
|
||||
dynamic managerId;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -40,8 +44,9 @@ class endosementState extends ConsumerState<endosement> {
|
||||
|
||||
Future.microtask(() {
|
||||
final id = ref.read(managerIdProvider);
|
||||
final roleId = ref.read(userRoleProvider);
|
||||
final userId = ref.read(userIdProvider);
|
||||
managerId = ref.read(managerIdProvider);
|
||||
roleId = ref.read(userRoleProvider);
|
||||
userId = ref.read(userIdProvider);
|
||||
print("F46 => r : $roleId | mId: $id | uId: $userId ");
|
||||
if (userId != null) {
|
||||
getStaffList(userId, roleId);
|
||||
@ -278,7 +283,48 @@ class endosementState extends ConsumerState<endosement> {
|
||||
"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),
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
|
||||
@ -122,6 +122,19 @@ class AgentState extends ConsumerState<Agent> {
|
||||
|
||||
Future<void> handleSave() async {
|
||||
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(() {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
dataDetails();
|
||||
@ -500,7 +513,16 @@ class AgentState extends ConsumerState<Agent> {
|
||||
SizedBox(width: 10),
|
||||
ThemedFormField(
|
||||
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),
|
||||
highlightColor: Color(0xFF50A398),
|
||||
inputFormatters: [
|
||||
@ -520,11 +542,21 @@ class AgentState extends ConsumerState<Agent> {
|
||||
SizedBox(width: 10),
|
||||
ThemedFormField(
|
||||
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),
|
||||
highlightColor: Color(0xFF50A398),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[ 0-9]')),
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
|
||||
],
|
||||
txtwidth: MediaQuery.of(context).size.width * 0.26,
|
||||
),
|
||||
|
||||
@ -158,6 +158,19 @@ class StaffState extends ConsumerState<Staff> {
|
||||
|
||||
Future<void> handleSave() async {
|
||||
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(() {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
dataDetails();
|
||||
@ -505,7 +518,17 @@ class StaffState extends ConsumerState<Staff> {
|
||||
controller: controllers['email']!,
|
||||
borderColor: Color(0xFFE2E8F0),
|
||||
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: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9_@.]')),
|
||||
],
|
||||
@ -525,9 +548,20 @@ class StaffState extends ConsumerState<Staff> {
|
||||
controller: controllers['mobile']!,
|
||||
borderColor: Color(0xFFE2E8F0),
|
||||
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: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[ 0-9]')),
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
|
||||
],
|
||||
txtwidth: MediaQuery.of(context).size.width * 0.26,
|
||||
),
|
||||
|
||||
@ -11,6 +11,7 @@ import '../../layouts/main_layout.dart';
|
||||
import '../../providers/manager_provider.dart';
|
||||
import '../../providers/quotation_staff_proivder.dart';
|
||||
import '../../providers/userRoleProvider.dart';
|
||||
import '../../themes/charts/barChart.dart';
|
||||
import '../staff/Enquiry/tabs/tab.dart';
|
||||
import '../staff/assignStaff.dart';
|
||||
|
||||
@ -365,41 +366,40 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 🔹 Stats cards stacked
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: StatCard(
|
||||
title: "Policies Issued",
|
||||
today: policiesIssuedToday ?? '',
|
||||
month: policiesIssuedMonth ?? '',
|
||||
year: policiesIssuedYear ?? '',
|
||||
imagePath: "assets/dashboard/Policy issue icon.png",
|
||||
),
|
||||
),
|
||||
// const SizedBox(height: 12),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: StatCard(
|
||||
title: "Premium Value",
|
||||
today: premiumValueToday ?? '',
|
||||
month: premiumValueMonth ?? '',
|
||||
year: premiumValueYear ?? '',
|
||||
imagePath: "assets/dashboard/Policy issue icon.png",
|
||||
),
|
||||
),
|
||||
// const SizedBox(height: 12),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: StatCard(
|
||||
title: "Earnings",
|
||||
today: earningsToday ?? '',
|
||||
month: earningsMonth ?? '',
|
||||
year: earningsYear ?? '',
|
||||
imagePath: "assets/dashboard/Policy issue icon.png",
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: StatCard(
|
||||
// title: "Policies Issued",
|
||||
// today: policiesIssuedToday ?? '',
|
||||
// month: policiesIssuedMonth ?? '',
|
||||
// year: policiesIssuedYear ?? '',
|
||||
// imagePath: "assets/dashboard/Policy issue icon.png",
|
||||
// ),
|
||||
// ),
|
||||
// // const SizedBox(height: 12),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: StatCard(
|
||||
// title: "Premium Value",
|
||||
// today: premiumValueToday ?? '',
|
||||
// month: premiumValueMonth ?? '',
|
||||
// year: premiumValueYear ?? '',
|
||||
// imagePath: "assets/dashboard/Policy issue icon.png",
|
||||
// ),
|
||||
// ),
|
||||
// // const SizedBox(height: 12),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: StatCard(
|
||||
// title: "Earnings",
|
||||
// today: earningsToday ?? '',
|
||||
// month: earningsMonth ?? '',
|
||||
// year: earningsYear ?? '',
|
||||
// imagePath: "assets/dashboard/Policy issue icon.png",
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// const SizedBox(height: 20),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
@ -536,7 +536,9 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
child: Column(
|
||||
children: [
|
||||
// if (role != 'staff')
|
||||
if (role != 'staff' && role != 'handler')
|
||||
if (role != 'staff' &&
|
||||
role != 'handler' &&
|
||||
role != 'manager')
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -583,7 +585,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
? MediaQuery.of(context).size.height *
|
||||
0.69 //400
|
||||
: (role == 'manager')
|
||||
? MediaQuery.of(context).size.height * 0.5
|
||||
? MediaQuery.of(context).size.height * 0.85
|
||||
: (role == 'staff' || role == 'handler')
|
||||
? MediaQuery.of(context).size.height * 0.85
|
||||
: MediaQuery.of(context).size.height *
|
||||
@ -594,7 +596,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
Expanded(
|
||||
child: othersPendings(
|
||||
title:
|
||||
"Staff Proposal Pending List (${staffQuotationsPendingList.length})",
|
||||
"Staff Wise Pending(${staffQuotationsPendingList.length})",
|
||||
data: staffQuotationsPendingList,
|
||||
stringFlag: "Proposal",
|
||||
role: role!,
|
||||
@ -736,6 +738,17 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
),
|
||||
),
|
||||
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')
|
||||
SizedBox(
|
||||
// ✅ replace Expanded
|
||||
@ -1210,6 +1223,19 @@ class othersPendings extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
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(
|
||||
color: Colors.white,
|
||||
// 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(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
// stringFlag + " Issued",
|
||||
'Total Assigned',
|
||||
'Today Assigned',
|
||||
textAlign: TextAlign.center,
|
||||
style: _headerStyle,
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'Pending',
|
||||
textAlign: TextAlign.center,
|
||||
style: _headerStyle,
|
||||
),
|
||||
@ -1273,7 +1332,7 @@ class othersPendings extends StatelessWidget {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'Awaiting Proposal',
|
||||
'In Progress',
|
||||
textAlign: TextAlign.center,
|
||||
style: _headerStyle,
|
||||
),
|
||||
@ -1281,15 +1340,7 @@ class othersPendings extends StatelessWidget {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'Awaiting Approval',
|
||||
textAlign: TextAlign.center,
|
||||
style: _headerStyle,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
'Awaiting Policy',
|
||||
'Completed',
|
||||
textAlign: TextAlign.center,
|
||||
style: _headerStyle,
|
||||
),
|
||||
@ -1324,9 +1375,9 @@ class othersPendings extends StatelessWidget {
|
||||
: row['total_premium_value'];
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
margin: const EdgeInsets.symmetric(vertical: 3),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
vertical: 4,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
@ -1341,25 +1392,6 @@ class othersPendings extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
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(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
@ -1372,11 +1404,60 @@ class othersPendings extends StatelessWidget {
|
||||
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
row['total_assigned'] ?? "",
|
||||
// row['total_approval_pending'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
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(
|
||||
row['today_assigned'] ?? "",
|
||||
// row['total_approval_pending'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
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(
|
||||
@ -1388,19 +1469,19 @@ class othersPendings extends StatelessWidget {
|
||||
// hoverColor: Color(0xFFEAF6F4),
|
||||
onTap: () {
|
||||
print(
|
||||
'Awaiting Proposal : ${row['awaiting_quotation']}',
|
||||
'Awaiting Proposal : ${row['total_in_progress']}',
|
||||
);
|
||||
|
||||
handleDashboardNavigation(
|
||||
context,
|
||||
status: "Awaiting Proposal",
|
||||
status: "In progress",
|
||||
staffId: row['staff_id'] ?? '',
|
||||
role: role,
|
||||
);
|
||||
},
|
||||
|
||||
child: Text(
|
||||
row['awaiting_quotation'] ?? "",
|
||||
row['total_in_progress'] ?? "",
|
||||
// row['total_approval_pending'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
style: _tableDataStyle,
|
||||
@ -1418,17 +1499,17 @@ class othersPendings extends StatelessWidget {
|
||||
hoverColor: Color(0xFFEAF6F4),
|
||||
onTap: () async {
|
||||
print(
|
||||
'Awaiting Approval : ${row['pending_quotation_approval']} - ${row['staff_id']}',
|
||||
'Awaiting Approval : ${row['total_completed']} - ${row['staff_id']}',
|
||||
);
|
||||
handleDashboardNavigation(
|
||||
context,
|
||||
status: "Proposal Created",
|
||||
status: "Completed",
|
||||
staffId: row['staff_id'] ?? '',
|
||||
role: role,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
row['pending_quotation_approval'] ?? "",
|
||||
row['total_completed'] ?? "",
|
||||
// row['total_approval_pending'] ?? "",
|
||||
textAlign: TextAlign.center,
|
||||
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(
|
||||
// flex: 2,
|
||||
// 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),
|
||||
highlightColor: Color(0xFF3E5B56),
|
||||
borderRadius: BorderRadius.circular(2), // for ripple effect
|
||||
onTap: null,
|
||||
// onTap: (role == 'handler')
|
||||
// ? () {
|
||||
// // 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
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// : null,
|
||||
// onTap: () {
|
||||
// handleDashboardNavigation(
|
||||
// context,
|
||||
// status: "To be assigned",
|
||||
// staffId: row['staff_id'] ?? '',
|
||||
// role: role,
|
||||
// );
|
||||
// },
|
||||
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(
|
||||
// height: 5200,
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
|
||||
2150
lib/presentation/screens/dashboard/dashboard_old.dart
Normal file
2150
lib/presentation/screens/dashboard/dashboard_old.dart
Normal file
File diff suppressed because it is too large
Load Diff
@ -62,6 +62,8 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
dynamic SelectedStatus;
|
||||
dynamic SelectedStaffId;
|
||||
String? selectedFileNames;
|
||||
String? lastPickedFile;
|
||||
|
||||
PlatformFile? docUploadedFile;
|
||||
dynamic handlerId;
|
||||
String? _token;
|
||||
@ -571,6 +573,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
print('ToDate : $toDate');
|
||||
|
||||
setState(() {
|
||||
if (SelectedStatus == 'Completed') {
|
||||
selectedIndex = 1;
|
||||
}
|
||||
controllers['startDate']?.text = fromDate;
|
||||
controllers['endDate']?.text = toDate;
|
||||
if (data is List) {
|
||||
@ -1028,13 +1033,13 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
return filteredInsurersData;
|
||||
}
|
||||
return filteredInsurersData.where((item) {
|
||||
return item['name'].toString().toLowerCase().contains(
|
||||
return item['short_name'].toString().toLowerCase().contains(
|
||||
filter.toLowerCase(),
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
|
||||
itemAsString: (val) => val['name'].toString(), // what to show
|
||||
itemAsString: (val) => val['short_name'].toString(), // what to show
|
||||
compareFn: (item, selectedItem) =>
|
||||
item['id'] == selectedItem['id'], // ✅ compare by id
|
||||
validator: (val) {
|
||||
@ -1060,7 +1065,9 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
dropdownBuilder: (context, selectedItem) => Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem != null ? selectedItem['name'].toString() : "",
|
||||
selectedItem != null
|
||||
? selectedItem['short_name'].toString()
|
||||
: "",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 11,
|
||||
color: Color(0XFF6366F1),
|
||||
@ -1142,7 +1149,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
vertical: 3,
|
||||
),
|
||||
child: Text(
|
||||
item['name'].toString(),
|
||||
item['short_name'].toString(),
|
||||
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) {
|
||||
ToastHelper.showSuccessToast(context, "Policy PDF Uploaded!");
|
||||
setState(() {
|
||||
docUploadedFile = null;
|
||||
});
|
||||
refrshfilterDateRange();
|
||||
return;
|
||||
}
|
||||
@ -3067,17 +3101,30 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
});
|
||||
},
|
||||
),
|
||||
ThemedSearchField(
|
||||
hintText: 'Search',
|
||||
backgroundColor: Color(0xFFFFFFFF),
|
||||
txtHeight: 30,
|
||||
// backgroundColor: Colors.white,
|
||||
onChanged: filterData,
|
||||
MouseRegion(
|
||||
onEnter: (_) {
|
||||
setState(() {
|
||||
isActionable = true;
|
||||
});
|
||||
},
|
||||
onExit: (_) {
|
||||
setState(() {
|
||||
// isActionable = false;
|
||||
isActionable = _searchStaffController.text.isNotEmpty;
|
||||
});
|
||||
},
|
||||
child: ThemedSearchField(
|
||||
hintText: 'Search',
|
||||
backgroundColor: Color(0xFFFFFFFF),
|
||||
txtHeight: 30,
|
||||
// backgroundColor: Colors.white,
|
||||
onChanged: filterData,
|
||||
|
||||
controller: _searchStaffController,
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? MediaQuery.of(context).size.width * 0.7
|
||||
: MediaQuery.of(context).size.width * 0.13,
|
||||
controller: _searchStaffController,
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? MediaQuery.of(context).size.width * 0.7
|
||||
: MediaQuery.of(context).size.width * 0.13,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
ExportBtn(
|
||||
@ -3476,8 +3523,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
// Group Header
|
||||
// if (status != 'Proposal Accepted' &&
|
||||
// status != 'Proposal Rejected') ...[
|
||||
if (status != 'Proposal Accepted' &&
|
||||
status != 'Proposal Rejected') ...[
|
||||
if (items.isNotEmpty) ...[
|
||||
Container(
|
||||
// width: double.infinity,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
@ -3578,22 +3624,21 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
);
|
||||
}).toList(),
|
||||
|
||||
if (isExpanded && items.isEmpty)
|
||||
if (status != 'Proposal Accepted' &&
|
||||
status != 'Proposal Rejected')
|
||||
Padding(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'No enquiries found',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
color: Colors.grey,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// if (isExpanded && items.isEmpty)
|
||||
//
|
||||
// Padding(
|
||||
// padding: EdgeInsets.all(5),
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// 'No enquiries found',
|
||||
// style: GoogleFonts.inter(
|
||||
// fontSize: 12,
|
||||
// color: Colors.grey,
|
||||
// fontStyle: FontStyle.italic,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
@ -3750,22 +3795,22 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
// color: Colors.white,
|
||||
// );
|
||||
// },
|
||||
child: Tooltip(
|
||||
message:
|
||||
'Click and Download Enquiry Files', // what appears on hover/long press
|
||||
waitDuration: const Duration(milliseconds: 500), // optional
|
||||
showDuration: const Duration(seconds: 2), // optional
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(4.0),
|
||||
margin: EdgeInsets.symmetric(vertical: 3, horizontal: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF9FAFB),
|
||||
border: Border.all(color: Color(0xFFE2E8F0)),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Text(item['reg_no'] ?? '-', style: _dataBoldthm3),
|
||||
// child: Tooltip(
|
||||
// message:
|
||||
// 'Click and Download Enquiry Files', // what appears on hover/long press
|
||||
// waitDuration: const Duration(milliseconds: 500), // optional
|
||||
// showDuration: const Duration(seconds: 2), // optional
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(4.0),
|
||||
margin: EdgeInsets.symmetric(vertical: 3, horizontal: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF9FAFB),
|
||||
border: Border.all(color: Color(0xFFE2E8F0)),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Text(item['reg_no'] ?? '-', style: _dataBoldthm3),
|
||||
),
|
||||
// ),
|
||||
// child: Text(item['reg_no'] ?? '-', style: _dataBold),
|
||||
// ),
|
||||
),
|
||||
@ -3914,58 +3959,75 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
Material(
|
||||
color: Colors.white,
|
||||
child: InkWell(
|
||||
// hoverColor: Color(0xFFEAF6F4),
|
||||
onTap: null,
|
||||
// onTap: () async {
|
||||
// setState(() {
|
||||
// isActionable = true;
|
||||
// });
|
||||
// buildPolicyCreatedStatusActions(
|
||||
// context,
|
||||
// item['status'],
|
||||
// item['id'],
|
||||
// );
|
||||
// },
|
||||
child: Tooltip(
|
||||
message: 'Click to View or Process Enquiry', //
|
||||
waitDuration: const Duration(
|
||||
milliseconds: 500,
|
||||
), // optional
|
||||
showDuration: const Duration(seconds: 2), // optional
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 2.0),
|
||||
margin: EdgeInsets.symmetric(vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
// color: Color(0xFFF9FAFB),
|
||||
// border: Border.all(color: Color(0xFFE2E8F0)),
|
||||
color: bgColor,
|
||||
border: Border.all(color: borderColor),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
// hoverColor: Color(0xFFEAF6F4),
|
||||
// onTap: (item['enquiry_status'] == 'Completed')
|
||||
// ? () 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(
|
||||
// context,
|
||||
// status,
|
||||
// item['id'],
|
||||
// );
|
||||
// }
|
||||
// : null,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 2.0),
|
||||
margin: EdgeInsets.symmetric(vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
// color: Color(0xFFF9FAFB),
|
||||
// border: Border.all(color: Color(0xFFE2E8F0)),
|
||||
color: bgColor,
|
||||
border: Border.all(color: borderColor),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
item['enquiry_status'] ?? '-',
|
||||
// item['status'] ?? '-',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 10,
|
||||
color: Color(0XFF1e293b),
|
||||
// color: statusTextColors[status] ?? Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
// overflow: TextOverflow.clip, //
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
item['enquiry_status'] ?? '-',
|
||||
// item['status'] ?? '-',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 10,
|
||||
color: Color(0XFF1e293b),
|
||||
// color: statusTextColors[status] ?? Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
],
|
||||
),
|
||||
// overflow: TextOverflow.clip, //
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// child: Text(item['status'] ?? '-', style: _dataBold),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (item['enquiry_status'] == 'Assigned') ...[
|
||||
if ((item['enquiry_status'] == 'Assigned') &&
|
||||
(item['quotation_id'] != null)) ...[
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
final res = await apiService.updateEnquiryInProgress(id);
|
||||
@ -3974,12 +4036,55 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
}
|
||||
print('updateEnquiryInProgress - $res');
|
||||
},
|
||||
child: Text(
|
||||
'PROCEED',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.green,
|
||||
|
||||
child: Tooltip(
|
||||
message: 'Click to Proceed',
|
||||
waitDuration: const Duration(
|
||||
milliseconds: 500,
|
||||
), // optional
|
||||
showDuration: const Duration(seconds: 2),
|
||||
child: Text(
|
||||
'PROCEED',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
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(
|
||||
height: 30,
|
||||
width: 120,
|
||||
child: (item['status'] == 'Awaiting Proposal')
|
||||
child:
|
||||
((item['enquiry_status'] == 'To be assigned') ||
|
||||
((item['enquiry_status'] == 'Assigned') &&
|
||||
(item['quotation_id'] == null)))
|
||||
? Text('-')
|
||||
: Builder(
|
||||
builder: (cellContext) =>
|
||||
@ -4237,7 +4345,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
SizedBox(
|
||||
width: 120,
|
||||
height: 30,
|
||||
child: (item['status'] == 'Awaiting Proposal')
|
||||
child:
|
||||
((item['enquiry_status'] == 'To be assigned') ||
|
||||
((item['enquiry_status'] == 'Assigned') &&
|
||||
(item['quotation_id'] == null)))
|
||||
? Text('-')
|
||||
: Builder(
|
||||
builder: (cellContext) => DropdownSearch<Map<String, dynamic>>(
|
||||
@ -4440,14 +4551,19 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
SizedBox(
|
||||
height: 30,
|
||||
width: 90,
|
||||
child: (item['status'] == 'Awaiting Proposal')
|
||||
child:
|
||||
((item['enquiry_status'] == 'To be assigned') ||
|
||||
((item['enquiry_status'] == 'Assigned') &&
|
||||
(item['quotation_id'] == null)))
|
||||
? Text('-')
|
||||
: ThemedUploadField(
|
||||
// key: ValueKey(selectedFileNames),
|
||||
// hintText: item['policy_pdf_file_name'] ?? "Upload Document",
|
||||
hintText:
|
||||
selectedFileNames ??
|
||||
item['policy_pdf_file_name'] ??
|
||||
"Upload Document",
|
||||
|
||||
// txtheight: 30,
|
||||
padHorizontal: 4,
|
||||
padVertical: 5,
|
||||
@ -4463,6 +4579,36 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
onFileSelected: (fileName, file) async {
|
||||
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')) {
|
||||
ToastHelper.showErrorToast(
|
||||
context,
|
||||
@ -4488,7 +4634,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
"manager_id": managerId,
|
||||
"created_by": userId,
|
||||
"updated_by": userId,
|
||||
// "id": item["id"], // ONLY while updating
|
||||
"id": item["policy_id"], // ONLY while updating
|
||||
},
|
||||
);
|
||||
// if (selectedBrokerName == 'Nhance') {
|
||||
@ -4566,13 +4712,13 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
List<DataColumn> _buildDataColumns() {
|
||||
return [
|
||||
DataColumn(label: Text('Received Date', style: _headerStyle)),
|
||||
DataColumn(label: Text('Assigned To *', style: _headerStyle)),
|
||||
DataColumn(label: Text('Partner *', style: _headerStyle)),
|
||||
DataColumn(label: Text('Assigned To', style: _headerStyle)),
|
||||
DataColumn(label: Text('Partner', style: _headerStyle)),
|
||||
|
||||
// const DataColumn(label: Text('Broker *', style: _headerStyle)),
|
||||
DataColumn(label: Text('Insurer *', style: _headerStyle)),
|
||||
DataColumn(label: Text('Insured Name *', style: _headerStyle)),
|
||||
DataColumn(label: Text('Vehicle No *', style: _headerStyle)),
|
||||
DataColumn(label: Text('Insurer', style: _headerStyle)),
|
||||
DataColumn(label: Text('Insured Name', style: _headerStyle)),
|
||||
DataColumn(label: Text('Vehicle No', style: _headerStyle)),
|
||||
DataColumn(label: Text('Action', style: _headerStyle)),
|
||||
DataColumn(label: Text('Status', style: _headerStyle)),
|
||||
// const DataColumn(label: Text('Assigned Date', style: _headerStyle)),
|
||||
@ -4590,13 +4736,13 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
child: Row(
|
||||
children: [
|
||||
_buildHeaderCell('Received Date', 110),
|
||||
_buildHeaderCell('Assigned To *', 130),
|
||||
_buildHeaderCell('Partner *', 100),
|
||||
_buildHeaderCell('Assigned To', 130),
|
||||
_buildHeaderCell('Partner', 100),
|
||||
|
||||
// _buildHeaderCell('Broker *', 100),
|
||||
_buildHeaderCell('Insurer *', 90),
|
||||
_buildHeaderCell('Insured Name *', 110),
|
||||
_buildHeaderCell('Vehicle No *', 90),
|
||||
_buildHeaderCell('Insurer', 90),
|
||||
_buildHeaderCell('Insured Name', 110),
|
||||
_buildHeaderCell('Vehicle No ', 90),
|
||||
_buildHeaderCell('Action', 110),
|
||||
_buildHeaderCell('Status', 100),
|
||||
// _buildHeaderCell('Assigned Date', 100),
|
||||
@ -4670,7 +4816,7 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
// color: Colors.white,
|
||||
// color: Colors.amber,
|
||||
// border: Border(bottom: BorderSide(color: Color(0xFFE5E5E5), width: 1)),
|
||||
),
|
||||
@ -4691,14 +4837,22 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
curve: Curves.easeOut,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
horizontal: 20,
|
||||
horizontal: 10,
|
||||
),
|
||||
margin: const EdgeInsets.only(right: 24),
|
||||
|
||||
// margin: const EdgeInsets.only(right: 24),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
// borderRadius: BorderRadius.circular(6),
|
||||
color: isSelected
|
||||
// ? Color(0xFFF1F5F9)
|
||||
? const Color(0xFF2E7D6E).withOpacity(0.08)
|
||||
: Colors.transparent,
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? Colors.transparent
|
||||
: Colors.blueGrey.shade50,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
@ -4707,20 +4861,22 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
enquiryTabs[index],
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontWeight: isSelected
|
||||
? FontWeight.w600
|
||||
: FontWeight.w400,
|
||||
color: isSelected
|
||||
? const Color(0xFF2E7D6E)
|
||||
: Colors.black87,
|
||||
),
|
||||
),
|
||||
|
||||
// const SizedBox(height: 3),
|
||||
const SizedBox(height: 1),
|
||||
|
||||
// ▬▬ Underline Indicator ▬▬
|
||||
AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
height: 3,
|
||||
width: isSelected ? 40 : 0,
|
||||
height: 2,
|
||||
width: isSelected ? 90 : 0,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF2E7D6E),
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
|
||||
@ -367,6 +367,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 25),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
// color: Colors.amber,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
@ -647,12 +648,12 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
return filteredInsurersData;
|
||||
}
|
||||
return filteredInsurersData.where((item) {
|
||||
return item['name'].toString().toLowerCase().contains(
|
||||
return item['short_name'].toString().toLowerCase().contains(
|
||||
filter.toLowerCase(),
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
itemAsString: (val) => val['name'].toString(), // what to show
|
||||
itemAsString: (val) => val['short_name'].toString(), // what to show
|
||||
compareFn: (item, selectedItem) =>
|
||||
item['id'] == selectedItem['id'], // ✅ compare by id
|
||||
validator: (val) {
|
||||
@ -678,7 +679,9 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
dropdownBuilder: (context, selectedItem) => Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem != null ? selectedItem['name'].toString() : "",
|
||||
selectedItem != null
|
||||
? selectedItem['short_name'].toString()
|
||||
: "",
|
||||
style: GoogleFonts.poppins(fontSize: 11, color: Colors.black),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
@ -757,7 +760,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
vertical: 3,
|
||||
),
|
||||
child: Text(
|
||||
item['name'].toString(),
|
||||
item['short_name'].toString(),
|
||||
style: GoogleFonts.inter(fontSize: 12, color: Colors.black),
|
||||
),
|
||||
);
|
||||
@ -767,7 +770,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
|
||||
onChanged: (val) {
|
||||
if (val != null) {
|
||||
print("Selected Insurer : ${val['name']}");
|
||||
print("Selected Insurer : ${val['short_name']}");
|
||||
print("Id: ${val['id']}");
|
||||
selectedInsurer = val['id'];
|
||||
// controllers['agentId']?.text = val['agent_code'];
|
||||
|
||||
@ -322,23 +322,29 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
|
||||
if (response['status'] == 'success') {
|
||||
print('quoationListData - ${response['data']}');
|
||||
final data = response['data'];
|
||||
setState(() {
|
||||
enquiryData = Map<String, dynamic>.from(response['data']['enquiry']);
|
||||
print('enquiryData - ${enquiryData}');
|
||||
|
||||
enquiryData = Map<String, dynamic>.from(data['enquiry']);
|
||||
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);
|
||||
// quotationData = List<Map<String, dynamic>>.from(response['data']);
|
||||
quotationData = List<Map<String, dynamic>>.from(
|
||||
response['data']['quotations'],
|
||||
);
|
||||
// quotationData = List<Map<String, dynamic>>.from(
|
||||
// response['data']['quotations'],
|
||||
// );
|
||||
print('quotationData - ${quotationData}');
|
||||
updateQuotationData(quotationData);
|
||||
|
||||
policyData = Map<String, dynamic>.from(response['data']['policies']);
|
||||
// policyData = Map<String, dynamic>.from(response['data']['policies']);
|
||||
|
||||
print('policyData - ${policyData}');
|
||||
|
||||
updatePolicyData(policyData);
|
||||
originalData = quotationData;
|
||||
filteredData = List.from(originalData);
|
||||
// print('originalData - $getClaimPolicies');
|
||||
@ -475,11 +481,12 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
setState(() {
|
||||
controllers["insurer"]?.text = quotationAcceptedData?['insurer_name'];
|
||||
acceptedQuotationId = quotationAcceptedData?['id']?.toString() ?? '';
|
||||
|
||||
controllers["idv"]?.text =
|
||||
quotationAcceptedData?['insured_declared_value']?.toString() ??
|
||||
'';
|
||||
controllers["premium_amount"]?.text =
|
||||
quotationAcceptedData?['premium_amount']?.toString() ?? '';
|
||||
// controllers["premium_amount"]?.text =
|
||||
// quotationAcceptedData?['premium_amount']?.toString() ?? '';
|
||||
controllers["planType"]?.text =
|
||||
quotationAcceptedData?['insurance_plan_type']?.toString() ?? '';
|
||||
controllers["policyPaymentMode"]?.text =
|
||||
@ -512,6 +519,9 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
|
||||
setState(() {
|
||||
hasPolicyData = true;
|
||||
selectedAgent = policyData['agent_id']?.toString() ?? '';
|
||||
selectedPaymentMode = policyData['payment_mode_id']?.toString() ?? '';
|
||||
acceptedQuotationId = policyData['quotation_id']?.toString() ?? '';
|
||||
choosedPolcyId = policyData['id']?.toString() ?? '';
|
||||
controllers["policyInsName"]?.text =
|
||||
policyData['insured_name']?.toString() ?? '';
|
||||
@ -548,6 +558,37 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
controllers["premiumTOT"]?.text =
|
||||
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'] ?? '';
|
||||
selectedBrokerName = policyData['broker_name'] ?? '';
|
||||
// RC FILE
|
||||
@ -960,9 +1001,34 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
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(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
// color: Colors.amber,
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
@ -1191,23 +1257,17 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
SizedBox(width: 20),
|
||||
buildPremiumAmount(context),
|
||||
SizedBox(width: 20),
|
||||
Paymentmode(context),
|
||||
SizedBox(width: 20),
|
||||
buildInsurer(context),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Paymentmode(context),
|
||||
SizedBox(width: 20),
|
||||
buildInsurer(context),
|
||||
SizedBox(width: 20),
|
||||
buildAgentName(context),
|
||||
SizedBox(width: 20),
|
||||
buildBroker(context),
|
||||
SizedBox(width: 20),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
policyissuedate(context),
|
||||
SizedBox(width: 20),
|
||||
policystartdate(context),
|
||||
@ -1218,7 +1278,7 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
SizedBox(height: 20),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
@ -1233,39 +1293,53 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('Premium Breakdown', style: headingSTyles),
|
||||
Row(
|
||||
children: [Text('Premium Breakdown', style: headingSTyles)],
|
||||
),
|
||||
Divider(thickness: 0.1, color: Color(0xFF2E7D6E)),
|
||||
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildThirdParty(context),
|
||||
buildOwnDamage(context),
|
||||
buildPersonalAccident(context),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
// color: Colors.blue.shade100,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
// color: Colors.amber,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildThirdParty(context),
|
||||
buildOwnDamage(context),
|
||||
buildPersonalAccident(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(width: 20),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildCGST(context),
|
||||
buildSGST(context),
|
||||
buildIGST(context),
|
||||
buildPremiumTotal(context),
|
||||
],
|
||||
SizedBox(width: 20),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildCGST(context),
|
||||
buildSGST(context),
|
||||
buildIGST(context),
|
||||
buildPremiumTotal(context),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
SizedBox(height: 20),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
@ -1290,95 +1364,111 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildMake(context),
|
||||
SizedBox(width: 20),
|
||||
buildModel(context),
|
||||
SizedBox(width: 20),
|
||||
buildVehicleType(context),
|
||||
SizedBox(width: 20),
|
||||
buildFuelType(context),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(width: 20),
|
||||
buildEngineNo(context),
|
||||
SizedBox(width: 20),
|
||||
buildChassisNo(context),
|
||||
buildCubicCapacity(context),
|
||||
buildWeight(context),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildCubicCapacity(context),
|
||||
SizedBox(width: 20),
|
||||
buildWeight(context),
|
||||
SizedBox(width: 20),
|
||||
buildYearOfManufacture(context),
|
||||
SizedBox(width: 20),
|
||||
buildDateOfRegistration(context),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
// border: Border.all(color: const Colors.bla),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
SizedBox(height: 20),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('RTO Details', style: headingSTyles),
|
||||
Divider(thickness: 0.1, color: Color(0xFF2E7D6E)),
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildRTOStateCode(context),
|
||||
buildRTOCityCode(context),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
// border: Border.all(color: const Colors.bla),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
// border: Border.all(color: const Colors.bla),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Commission Details', style: headingSTyles),
|
||||
Divider(thickness: 0.1, color: Color(0xFF2E7D6E)),
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildCommissonAmount(context),
|
||||
buildCommissonAppliedRule(context),
|
||||
Text('RTO Details', style: headingSTyles),
|
||||
Divider(thickness: 0.1, color: Color(0xFF2E7D6E)),
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildRTOStateCode(context),
|
||||
SizedBox(width: 20),
|
||||
buildRTOCityCode(context),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 14,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
// border: Border.all(color: const Colors.bla),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Commission Details', style: headingSTyles),
|
||||
Divider(thickness: 0.1, color: Color(0xFF2E7D6E)),
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildCommissonAmount(context),
|
||||
SizedBox(width: 20),
|
||||
buildCommissonAppliedRule(context),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
@ -2513,7 +2603,7 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
|
||||
Widget buildThirdParty(BuildContext context) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
@ -2521,23 +2611,26 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
child: Text('Third Party', style: _textStyle),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
ThemedFormField(
|
||||
controller: controllers['tp']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
// validator: (value) => Validators.requiredField(value, "Third Party"),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
// onChanged: (value) => calculateAmount(),
|
||||
onChanged: (v) {
|
||||
print('pa onChanged -> $v'); // should show on every keystroke
|
||||
calculateAmount();
|
||||
},
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.14,
|
||||
SizedBox(
|
||||
height: 35,
|
||||
child: ThemedFormField(
|
||||
controller: controllers['tp']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
// validator: (value) => Validators.requiredField(value, "Third Party"),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
// onChanged: (value) => calculateAmount(),
|
||||
onChanged: (v) {
|
||||
print('pa onChanged -> $v'); // should show on every keystroke
|
||||
calculateAmount();
|
||||
},
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.12,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -2549,23 +2642,26 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.15,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
child: Text('Own Damage ', style: _textStyle),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
ThemedFormField(
|
||||
controller: controllers['od']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
// validator: (value) => Validators.requiredField(value, "OwnDamage"),
|
||||
onChanged: (value) => calculateAmount(),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.14,
|
||||
SizedBox(
|
||||
height: 35,
|
||||
child: ThemedFormField(
|
||||
controller: controllers['od']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
// validator: (value) => Validators.requiredField(value, "OwnDamage"),
|
||||
onChanged: (value) => calculateAmount(),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.12,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -2577,24 +2673,27 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.15,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
child: Text('Personal Accident', style: _textStyle),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
ThemedFormField(
|
||||
controller: controllers['pa']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
onChanged: (value) => calculateAmount(),
|
||||
// validator: (value) =>
|
||||
// Validators.requiredField(value, "PersonalAccident"),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.14,
|
||||
SizedBox(
|
||||
height: 35,
|
||||
child: ThemedFormField(
|
||||
controller: controllers['pa']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
onChanged: (value) => calculateAmount(),
|
||||
// validator: (value) =>
|
||||
// Validators.requiredField(value, "PersonalAccident"),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.12,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -2606,22 +2705,25 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.15,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
child: Text('CGST', style: _textStyle),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
ThemedFormField(
|
||||
controller: controllers['cgst']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
validator: (value) => Validators.requiredField(value, "CGST"),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.14,
|
||||
SizedBox(
|
||||
height: 35,
|
||||
child: ThemedFormField(
|
||||
controller: controllers['cgst']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
validator: (value) => Validators.requiredField(value, "CGST"),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.14,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -2633,22 +2735,25 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.15,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
child: Text('SGST', style: _textStyle),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
ThemedFormField(
|
||||
controller: controllers['sgst']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
validator: (value) => Validators.requiredField(value, "SGST"),
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.14,
|
||||
SizedBox(
|
||||
height: 35,
|
||||
child: ThemedFormField(
|
||||
controller: controllers['sgst']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
validator: (value) => Validators.requiredField(value, "SGST"),
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.14,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -2660,22 +2765,25 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.15,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
child: Text('IGST', style: _textStyle),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
ThemedFormField(
|
||||
controller: controllers['igst']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
validator: (value) => Validators.requiredField(value, "IGST"),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.14,
|
||||
SizedBox(
|
||||
height: 35,
|
||||
child: ThemedFormField(
|
||||
controller: controllers['igst']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
validator: (value) => Validators.requiredField(value, "IGST"),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.14,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -2687,22 +2795,25 @@ class PolicyStaffEnqListState extends ConsumerState<PolicyStaffEnqList> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.15,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
child: Text('Total Premium *', style: _textStyle),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
ThemedFormField(
|
||||
controller: controllers['premiumTOT']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
validator: (value) => Validators.requiredField(value, "premium"),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.14,
|
||||
SizedBox(
|
||||
height: 35,
|
||||
child: ThemedFormField(
|
||||
controller: controllers['premiumTOT']!,
|
||||
// backgroundColor: Color(0xffEDF6F5),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: '0',
|
||||
validator: (value) => Validators.requiredField(value, "premium"),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[.0-9]')),
|
||||
],
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: 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,
|
||||
color: Color(0XFF334155),
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
|
||||
static final headingSTyles = GoogleFonts.inter(
|
||||
static final headingSTyles = GoogleFonts.poppins(
|
||||
fontSize: 12.5,
|
||||
// color: Color(0XFF334155),
|
||||
color: Color(0xFF2E7D6E),
|
||||
|
||||
@ -77,6 +77,10 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
final GlobalKey<DropdownSearchState<Map<String, dynamic>>> dropDownKeyBroker =
|
||||
GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
|
||||
|
||||
final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
|
||||
dropDownKeyInsurerEnqAsgn =
|
||||
GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
|
||||
|
||||
final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
|
||||
dropDownKeyInsurer = GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
|
||||
|
||||
@ -104,8 +108,8 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
final data = {
|
||||
"enquiry_id": widget.selectedEnquiryId,
|
||||
"insured_declared_value": controllers["idv"]?.text,
|
||||
"insurer_id": widget.selectedInsurdId,
|
||||
// "insurer_id": selectedInsurer,
|
||||
// "insurer_id": widget.selectedInsurdId,
|
||||
"insurer_id": selectedInsurer,
|
||||
"premium_amount": controllers["premium_Amount"]?.text,
|
||||
"insurance_plan_type_id": selectedInsPlanType,
|
||||
"payment_mode_id": selectedPaymentMode,
|
||||
@ -129,7 +133,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
_initializeToken();
|
||||
getInsuranceType();
|
||||
getPaymentMode();
|
||||
// getInsurers();
|
||||
getInsurers();
|
||||
updateData();
|
||||
getBroker();
|
||||
}
|
||||
@ -207,6 +211,10 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
}
|
||||
|
||||
void updateData() {
|
||||
selectedInsurer = widget.selectedInsurdId;
|
||||
print('QuickselectedInsurer - $selectedInsurer');
|
||||
print('QuickselectedEnquiryId - ${widget.selectedEnquiryId}');
|
||||
|
||||
if (widget.selectedQuotationFrmListId != null &&
|
||||
widget.selectedQuotationFrmListdata!.isNotEmpty) {
|
||||
print('checkData -- ${widget.selectedQuotationFrmListdata}');
|
||||
@ -223,6 +231,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
selectedInsPlanType = widget
|
||||
.selectedQuotationFrmListdata!['insurance_plan_type_id']
|
||||
?.toString();
|
||||
|
||||
selectedBroker = widget.selectedQuotationFrmListdata!['broker_id']
|
||||
?.toString();
|
||||
|
||||
@ -232,8 +241,8 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
|
||||
// controllers["insurer"]?.text = 'LIC';
|
||||
|
||||
// selectedInsurer =
|
||||
// widget.selectedQuotationFrmListdata!['insurer_id']?.toString() ?? '';
|
||||
selectedInsurer = widget.selectedInsurdId;
|
||||
// widget.selectedQuotationFrmListdata!['insurer_id']?.toString() ?? '';
|
||||
|
||||
String? apiDocPath =
|
||||
widget.selectedQuotationFrmListdata!["policy_pdf_file_name"];
|
||||
@ -500,7 +509,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
// 🔹 Switch content dynamically
|
||||
Container(
|
||||
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),
|
||||
),
|
||||
],
|
||||
@ -516,9 +525,9 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
|
||||
children: [
|
||||
buildIdv(context),
|
||||
// buildIdv(context),
|
||||
buildInsurer(context),
|
||||
Spacer(),
|
||||
// buildInsurer(context),
|
||||
buildInsurancePlanType(context),
|
||||
Spacer(),
|
||||
buildPremiumAmnt(context),
|
||||
@ -534,21 +543,47 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
// ),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
|
||||
children: [
|
||||
buildPaymentMode(context),
|
||||
Spacer(),
|
||||
// buildInsurer(context),
|
||||
buildBroker(context),
|
||||
Spacer(),
|
||||
buildDocuments(context), Spacer(),
|
||||
],
|
||||
),
|
||||
// SizedBox(height: 10),
|
||||
|
||||
// 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),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
@ -566,14 +601,14 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
color: const Color(0xFF425B5B),
|
||||
color: const Color(0xFF2E7D6E),
|
||||
),
|
||||
child: Text(
|
||||
'Save',
|
||||
style: GoogleFonts.poppins(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -607,8 +642,8 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
// readOnly: true,
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.18,
|
||||
// txtheight: 35,
|
||||
: MediaQuery.of(context).size.width * 0.12,
|
||||
txtheight: 40,
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -632,8 +667,8 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
// validator: (value) => Validators.number(value, "PremiumAmount "),
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.18,
|
||||
// txtheight: 35,
|
||||
: MediaQuery.of(context).size.width * 0.12,
|
||||
txtheight: 40,
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -654,7 +689,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
color: Colors.white,
|
||||
width: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.18,
|
||||
: MediaQuery.of(context).size.width * 0.12,
|
||||
// height: 35,
|
||||
child: DropdownSearch<Map<String, dynamic>>(
|
||||
key: dropDownKey,
|
||||
@ -753,10 +788,11 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
),
|
||||
child: Text(
|
||||
item['insurance_plan_type'].toString(),
|
||||
style: GoogleFonts.inter(fontSize: 12, color: Colors.black),
|
||||
style: GoogleFonts.inter(fontSize: 11, color: Colors.black),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
// searchFieldProps: TextFieldProps(
|
||||
// decoration: InputDecoration(
|
||||
// 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) {
|
||||
Map<String, dynamic>? selectedVehicle = filteredPaymentModeData.firstWhere(
|
||||
(item) => item['id'].toString() == selectedPaymentMode,
|
||||
@ -808,7 +1006,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
color: Colors.white,
|
||||
width: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.18,
|
||||
: MediaQuery.of(context).size.width * 0.12,
|
||||
// height: 35,
|
||||
child: DropdownSearch<Map<String, dynamic>>(
|
||||
key: dropDownSelectPaymentModeKey,
|
||||
@ -942,7 +1140,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
color: Colors.white,
|
||||
width: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.18,
|
||||
: MediaQuery.of(context).size.width * 0.12,
|
||||
// height: 35,
|
||||
child: DropdownSearch<Map<String, dynamic>>(
|
||||
key: dropDownKeyBroker,
|
||||
|
||||
@ -168,8 +168,10 @@ class QuotationStaffTabState extends ConsumerState<QuotationStaffTab> {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
selectedInsurdId = enquiryData['insurer_id'];
|
||||
print('selectedInsurdId- $selectedInsurdId');
|
||||
selectedEnquiryId = enquiryData['id'];
|
||||
print('selectedEnquiryId- $selectedEnquiryId');
|
||||
|
||||
controllers["regNum"]?.text = enquiryData['reg_no'];
|
||||
// controllers["insurer"]?.text = enquiryData['insurer_name'];
|
||||
});
|
||||
|
||||
@ -64,8 +64,8 @@ class TabEnquiryStaffListState extends ConsumerState<TabEnquiryStaffList> {
|
||||
setState(() => isLoading = false);
|
||||
tabs = [
|
||||
// TabItem("Proposal", PropoalStaffTab()),
|
||||
TabItem("Proposal", QuotationStaffTab()),
|
||||
TabItem("Policy", PolicyStaffTab()),
|
||||
TabItem("Quote", QuotationStaffTab()),
|
||||
// TabItem("Policy", PolicyStaffTab()),
|
||||
];
|
||||
}
|
||||
});
|
||||
@ -112,8 +112,8 @@ class TabEnquiryStaffListState extends ConsumerState<TabEnquiryStaffList> {
|
||||
|
||||
tabs = [
|
||||
// TabItem("Proposal", PropoalStaffTab()),
|
||||
TabItem("Proposal", QuotationStaffTab()),
|
||||
TabItem("Policy", PolicyStaffTab()),
|
||||
TabItem("Quote", QuotationStaffTab()),
|
||||
// TabItem("Policy", PolicyStaffTab()),
|
||||
];
|
||||
|
||||
// if (widget.showKey == "Policy") {
|
||||
@ -176,8 +176,11 @@ class TabEnquiryStaffListState extends ConsumerState<TabEnquiryStaffList> {
|
||||
return AlertDialog(
|
||||
backgroundColor: Colors.white,
|
||||
content: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.65,
|
||||
height: MediaQuery.of(context).size.height * 0.9,
|
||||
width: MediaQuery.of(context).size.width * 0.4,
|
||||
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
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: tabs.isEmpty
|
||||
|
||||
@ -80,8 +80,8 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
|
||||
final data = {
|
||||
"id": widget.enquiryPrimaryId,
|
||||
"assigned_to": selectedStaff,
|
||||
"insurer_id": selectedInsurer,
|
||||
"broker_id": selectedBroker,
|
||||
// "insurer_id": selectedInsurer,
|
||||
// "broker_id": selectedBroker,
|
||||
"updated_by": widget.userId,
|
||||
};
|
||||
return data;
|
||||
@ -339,7 +339,7 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
|
||||
'Assign Enquiry To Staff',
|
||||
style: GoogleFonts.inter(
|
||||
color: const Color(0xFF374141),
|
||||
fontSize: 18,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@ -403,8 +403,8 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
|
||||
children: [
|
||||
buildRegistrationNumber(context),
|
||||
buildSelectStaffMem(context),
|
||||
buildInsurer(context),
|
||||
buildBroker(context),
|
||||
// buildInsurer(context),
|
||||
// buildBroker(context),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -493,6 +493,18 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
|
||||
}
|
||||
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(
|
||||
decoration:
|
||||
AppInputDecorations.dropdownDecoration(
|
||||
@ -536,7 +548,7 @@ class _AddDialogState extends ConsumerState<AssignStaffDialog> {
|
||||
return Container(
|
||||
// color: isSelected ? Colors.blue.withOpacity(0.1) : null,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
horizontal: 12,
|
||||
vertical: 3,
|
||||
),
|
||||
child: Text(
|
||||
|
||||
@ -18,6 +18,8 @@ import '../../../themes/indicators/export_btn.dart';
|
||||
import '../../../themes/indicators/search_field_theme.dart';
|
||||
import '../../../widgets/custom_Stdate_EnDate_Filter.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 {
|
||||
const policylist({super.key});
|
||||
@ -701,7 +703,7 @@ class policylistState extends ConsumerState<policylist> {
|
||||
child: Text('Policy Number', style: _headerStyle),
|
||||
),
|
||||
|
||||
Expanded(flex: 1, child: Text('Action', style: _headerStyle)),
|
||||
Expanded(flex: 3, child: Text('Action', style: _headerStyle)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -872,43 +874,51 @@ class policylistState extends ConsumerState<policylist> {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Tooltip(
|
||||
message: 'Download',
|
||||
// color: Colors.white,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => apiService.downloadFile(
|
||||
apiUrl:
|
||||
'api/policy/downloadPolicyFile?policy_id=$policyId&file_type=policy_pdf',
|
||||
apiId: policyId,
|
||||
localFile: null,
|
||||
fileName: fileName,
|
||||
),
|
||||
flex: 3,
|
||||
child: Row(
|
||||
children: [
|
||||
Tooltip(
|
||||
message: 'Download',
|
||||
// color: Colors.white,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => apiService.downloadFile(
|
||||
apiUrl:
|
||||
'api/policy/downloadPolicyFile?policy_id=$policyId&file_type=policy_pdf',
|
||||
apiId: policyId,
|
||||
localFile: null,
|
||||
fileName: fileName,
|
||||
),
|
||||
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 5,
|
||||
vertical: 6,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 5,
|
||||
vertical: 3,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
// color: Color(0xFF425B5B),
|
||||
// color: const Color(0xFF2E7D6E),
|
||||
color: Colors.green,
|
||||
),
|
||||
child: Row(
|
||||
children: const [
|
||||
Icon(
|
||||
Icons.download,
|
||||
size: 12,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
// color: Color(0xFF425B5B),
|
||||
color: const Color(0xFF2E7D6E),
|
||||
// color: Colors.green.shade300,
|
||||
),
|
||||
child: Row(
|
||||
children: const [
|
||||
Icon(Icons.download, size: 12, color: Colors.white),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
87
lib/presentation/themes/charts/barChart.dart
Normal file
87
lib/presentation/themes/charts/barChart.dart
Normal 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),
|
||||
// // ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
@ -49,9 +49,21 @@ class _ThemedUploadFieldState extends State<ThemedUploadField> {
|
||||
String? selectedFileName;
|
||||
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 {
|
||||
final error = await fileService.pickSingleFile(
|
||||
maxFileSizeInMB: 3,
|
||||
// maxFileSizeInMB: 3,
|
||||
allowedExtensions: widget.allowedExtensions,
|
||||
);
|
||||
if (error != null) {
|
||||
|
||||
@ -26,14 +26,14 @@ class FileUploadService {
|
||||
if (result != null && result.files.isNotEmpty) {
|
||||
final file = result.files.first;
|
||||
final ext = file.extension?.toLowerCase() ?? '';
|
||||
final sizeInMB = file.size / (1024 * 1024);
|
||||
// final sizeInMB = file.size / (1024 * 1024);
|
||||
|
||||
if (!extensions.contains(ext)) {
|
||||
return "Unsupported format: ${file.name}";
|
||||
}
|
||||
if (sizeInMB > maxFileSizeInMB) {
|
||||
return "File too large (${file.name}). Max $maxFileSizeInMB MB allowed.";
|
||||
}
|
||||
// if (sizeInMB > maxFileSizeInMB) {
|
||||
// return "File too large (${file.name}). Max $maxFileSizeInMB MB allowed.";
|
||||
// }
|
||||
|
||||
singleFile = file;
|
||||
}
|
||||
|
||||
@ -69,10 +69,15 @@ class ThemedSearchField extends HookWidget {
|
||||
borderSide: BorderSide(color: Color(0xFF50A398), width: 2),
|
||||
),
|
||||
hintText: hintText,
|
||||
hintStyle: GoogleFonts.inter(
|
||||
hintStyle: GoogleFonts.poppins(
|
||||
// color: const Color(0xFF686868),
|
||||
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(
|
||||
|
||||
@ -51,12 +51,15 @@ class SideDrawerPanel extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (title != null)
|
||||
Text(
|
||||
title!,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: const Color(0xFF1E293B),
|
||||
Material(
|
||||
color: Colors.white,
|
||||
child: Text(
|
||||
title!,
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: const Color(0xFF1E293B),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
|
||||
@ -116,8 +116,11 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
|
||||
});
|
||||
|
||||
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') {
|
||||
print('getStaffDetails - ${response['data']}');
|
||||
setState(() {
|
||||
@ -329,11 +332,15 @@ class _DateFilterRowState extends ConsumerState<DateFilterRow> {
|
||||
|
||||
Widget buildStatusSearch(BuildContext context) {
|
||||
final List<Map<String, dynamic>> statusOptions = [
|
||||
{'id': 1, 'status': 'Awaiting Proposal'},
|
||||
{'id': 2, 'status': 'Proposal Created'},
|
||||
{'id': 3, 'status': 'Proposal Accepted'},
|
||||
{'id': 4, 'status': 'Proposal Rejected'},
|
||||
{'id': 5, 'status': 'Policy Created'},
|
||||
// {'id': 1, 'status': 'Awaiting Proposal'},
|
||||
// {'id': 2, 'status': 'Proposal Created'},
|
||||
// {'id': 3, 'status': 'Proposal Accepted'},
|
||||
// {'id': 4, 'status': 'Proposal Rejected'},
|
||||
// {'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
|
||||
.where((element) => element['status'] == widget.selectedStatusVal)
|
||||
|
||||
@ -69,6 +69,7 @@ dependencies:
|
||||
dropdown_search: ^6.0.2
|
||||
file_picker: ^10.3.3
|
||||
fluttertoast: ^9.0.0
|
||||
# fl_chart: ^1.1.0
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
web/favicon.png
BIN
web/favicon.png
Binary file not shown.
|
Before Width: | Height: | Size: 917 B After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in New Issue
Block a user