Proposal_API_changes

This commit is contained in:
venbaittech 2025-11-21 14:59:09 +05:30
parent 5fdacc60c9
commit ef21a4883c
12 changed files with 434 additions and 294 deletions

File diff suppressed because one or more lines are too long

View File

@ -342,14 +342,8 @@ class ApiService {
final url; final url;
if (role == 'staff') { if (role == 'staff') {
// url = Uri.parse(
// 'https://venbait.in/nhance/partner/dev/api/staff/changeStaffStatus',
// );
url = Uri.parse('${Env.apiUrl}staff/changeStaffStatus'); url = Uri.parse('${Env.apiUrl}staff/changeStaffStatus');
} else { } else {
// url = Uri.parse(
// 'https://venbait.in/nhance/partner/dev/api/agent/changeAgentStatus',
// );
url = Uri.parse('${Env.apiUrl}/api/agent/changeAgentStatus'); url = Uri.parse('${Env.apiUrl}/api/agent/changeAgentStatus');
} }
@ -372,6 +366,44 @@ class ApiService {
return response; return response;
} }
Future<Map<String, dynamic>> updateStatusMasters(
id,
status,
masterName,
userId,
) async {
print('updateStatusMaster $id $status $masterName $userId');
final Map<String, dynamic> data = {
"is_active": int.parse(status),
"updated_by": userId,
};
final url;
if (masterName == 'Broker') {
url = Uri.parse('${Env.apiUrl}master/updateBrokerStatus/$id');
} else {
url = Uri.parse('${Env.apiUrl}master/updatePaymentModeStatus/$id');
}
// final token = await getToken(); // Fetch token
if (_token == null) {
throw Exception('Token not found. Please log in.');
}
print("data------- $data}");
final headers = {
'Authorization': 'Bearer $_token',
'Content-Type': 'application/json',
'app-signature': Env.App_Signature,
// 'app-signature': 'nhance-partner-2025-signature-35468846JRhH551HK',
};
final response = await _makePostRequestJson(url, data, headers);
return response;
}
// ----------------------------------- Dashboard ------------------------------------------------- // ----------------------------------- Dashboard -------------------------------------------------
Future<Map<String, dynamic>> fetchDashboard(int id, role, userId) async { Future<Map<String, dynamic>> fetchDashboard(int id, role, userId) async {
// print(_token); // print(_token);

View File

@ -130,6 +130,18 @@ class BrokerState extends ConsumerState<Broker> {
}); });
} }
void refresh() {
print('REfresj');
widget.onSubmit();
setState(() {
// clear all text controllers
for (var controller in controllers.values) {
controller.clear();
} // 👈 clear selected agent
controllers['name']?.clear();
});
}
Future<void> createUserData(data) async { Future<void> createUserData(data) async {
final bool isUpdating = selectedId != null; final bool isUpdating = selectedId != null;
final dynamic id = isUpdating ? int.tryParse(selectedId.toString()) : 0; final dynamic id = isUpdating ? int.tryParse(selectedId.toString()) : 0;
@ -170,7 +182,8 @@ class BrokerState extends ConsumerState<Broker> {
if (response.statusCode == 200) { if (response.statusCode == 200) {
print("Broker submitted successfully!"); print("Broker submitted successfully!");
print("Response: ${response.body}"); print("Response: ${response.body}");
widget.onSubmit();
refresh();
isUpdating isUpdating
? ToastHelper.showSuccessToast( ? ToastHelper.showSuccessToast(
context, context,
@ -229,7 +242,7 @@ class BrokerState extends ConsumerState<Broker> {
children: [ children: [
buildFormFields(), buildFormFields(),
SizedBox(width: 5), SizedBox(width: 5),
GestureDetector( InkWell(
onTap: () { onTap: () {
handleSave(); handleSave();
}, },
@ -246,6 +259,20 @@ class BrokerState extends ConsumerState<Broker> {
), ),
), ),
), ),
SizedBox(width: 5),
InkWell(
onTap: () {
refresh();
},
child: Container(
padding: EdgeInsets.all(6.0),
decoration: BoxDecoration(
color: const Color(0xFF2E7D6E),
borderRadius: BorderRadius.circular(5.0),
),
child: Icon(Icons.refresh, size: 13, color: Colors.white),
),
),
], ],
), ),
); );

View File

@ -31,6 +31,7 @@ class BrokerListState extends ConsumerState<BrokerList> {
dynamic managerId; dynamic managerId;
dynamic role; dynamic role;
dynamic prefid; dynamic prefid;
dynamic userId;
// List<Map<String, dynamic>> dataVal = []; // List<Map<String, dynamic>> dataVal = [];
List<Map<String, dynamic>> getBrokerData = []; List<Map<String, dynamic>> getBrokerData = [];
List<Map<String, dynamic>> originalData = []; List<Map<String, dynamic>> originalData = [];
@ -48,6 +49,7 @@ class BrokerListState extends ConsumerState<BrokerList> {
Future.microtask(() { Future.microtask(() {
final data1 = ref.read(managerIdProvider); final data1 = ref.read(managerIdProvider);
userId = ref.watch(userIdProvider);
// final data2 = ref.read(handlerIdProvider); // final data2 = ref.read(handlerIdProvider);
print("Edata1 => mId: $data1 -2 :"); print("Edata1 => mId: $data1 -2 :");
prefid = data1; prefid = data1;
@ -168,7 +170,7 @@ class BrokerListState extends ConsumerState<BrokerList> {
managerId = ref.watch(managerIdProvider); managerId = ref.watch(managerIdProvider);
return MainLayout( return MainLayout(
title: "Staff", title: "Broker",
body: Container( body: Container(
// padding: EdgeInsets.all(8.0), // padding: EdgeInsets.all(8.0),
// margin: EdgeInsets.all(10.0), // margin: EdgeInsets.all(10.0),
@ -223,9 +225,10 @@ class BrokerListState extends ConsumerState<BrokerList> {
id: selectedId, id: selectedId,
onSubmit: () { onSubmit: () {
getBroker(); getBroker();
setState( setState(() {
() => selectedBroker = null, selectedBroker = null;
); // reset after save selectedId = null;
}); // reset after save
}, },
), ),
Spacer(), Spacer(),
@ -382,10 +385,11 @@ class BrokerListState extends ConsumerState<BrokerList> {
setState(() { setState(() {
item['is_active'] = val ? "1" : "0"; item['is_active'] = val ? "1" : "0";
}); });
final response = apiService.updateStatus( final response = apiService.updateStatusMasters(
item['id'], item['id'],
val ? "0" : "1", val ? "0" : "1",
'staff', 'Broker',
userId,
); );
print("Response - $response"); print("Response - $response");
}, },

View File

@ -130,6 +130,18 @@ class PaymentState extends ConsumerState<Payment> {
}); });
} }
void refresh() {
print('REfresj');
widget.onSubmit();
setState(() {
// clear all text controllers
for (var controller in controllers.values) {
controller.clear();
} // 👈 clear selected agent
controllers['value']?.clear();
});
}
Future<void> createUserData(data) async { Future<void> createUserData(data) async {
final bool isUpdating = selectedId != null; final bool isUpdating = selectedId != null;
final dynamic id = isUpdating ? int.tryParse(selectedId.toString()) : 0; final dynamic id = isUpdating ? int.tryParse(selectedId.toString()) : 0;
@ -178,7 +190,8 @@ class PaymentState extends ConsumerState<Payment> {
if (response.statusCode == 200) { if (response.statusCode == 200) {
print("Payment submitted successfully!"); print("Payment submitted successfully!");
print("Response: ${response.body}"); print("Response: ${response.body}");
widget.onSubmit();
refresh();
isUpdating isUpdating
? ToastHelper.showSuccessToast( ? ToastHelper.showSuccessToast(
context, context,
@ -237,7 +250,7 @@ class PaymentState extends ConsumerState<Payment> {
children: [ children: [
buildFormFields(), buildFormFields(),
SizedBox(width: 5), SizedBox(width: 5),
GestureDetector( InkWell(
onTap: () { onTap: () {
handleSave(); handleSave();
}, },
@ -254,6 +267,20 @@ class PaymentState extends ConsumerState<Payment> {
), ),
), ),
), ),
SizedBox(width: 5),
InkWell(
onTap: () {
refresh();
},
child: Container(
padding: EdgeInsets.all(6.0),
decoration: BoxDecoration(
color: const Color(0xFF2E7D6E),
borderRadius: BorderRadius.circular(5.0),
),
child: Icon(Icons.refresh, size: 13, color: Colors.white),
),
),
], ],
), ),
); );

View File

@ -31,6 +31,7 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
dynamic managerId; dynamic managerId;
dynamic role; dynamic role;
dynamic prefid; dynamic prefid;
dynamic userId;
// List<Map<String, dynamic>> dataVal = []; // List<Map<String, dynamic>> dataVal = [];
List<Map<String, dynamic>> getPaymentData = []; List<Map<String, dynamic>> getPaymentData = [];
List<Map<String, dynamic>> originalData = []; List<Map<String, dynamic>> originalData = [];
@ -52,6 +53,7 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
print("Edata1 => mId: $data1 -2 :"); print("Edata1 => mId: $data1 -2 :");
prefid = data1; prefid = data1;
role = ref.read(userRoleProvider); role = ref.read(userRoleProvider);
userId = ref.watch(userIdProvider);
print("E43 => mId: $prefid"); print("E43 => mId: $prefid");
if (prefid != null && role != null) { if (prefid != null && role != null) {
getPayment(); getPayment();
@ -216,9 +218,10 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
id: selectedId, id: selectedId,
onSubmit: () { onSubmit: () {
getPayment(); getPayment();
setState( setState(() {
() => selectedPayment = null, selectedPayment = null;
); // reset after save selectedId = null;
}); // reset after save
}, },
), ),
Spacer(), Spacer(),
@ -378,10 +381,11 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
setState(() { setState(() {
item['is_active'] = val ? "1" : "0"; item['is_active'] = val ? "1" : "0";
}); });
final response = apiService.updateStatus( final response = apiService.updateStatusMasters(
item['id'], item['id'],
val ? "0" : "1", val ? "0" : "1",
'staff', 'PaymentMode',
userId,
); );
print("Response - $response"); print("Response - $response");
}, },

View File

@ -3365,33 +3365,34 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
// Premium // Premium
DataCell( DataCell(
(item['status'] == 'Proposal Created' || // (item['status'] == 'Proposal Created' ||
item['status'] == 'Proposal Rejected') // item['status'] == 'Proposal Rejected')
? SizedBox( // ? SizedBox(
width: 80, // width: 80,
child: InkWell( // child: InkWell(
onTap: () { // onTap: () {
// handle approval logic // // handle approval logic
//
handleProposalAccept(context, item['id']); // handleProposalAccept(context, item['id']);
}, // },
child: Text( // child: Text(
'Click To\nApprove', // 'Click To\nApprove',
style: GoogleFonts.inter( // style: GoogleFonts.inter(
color: Colors.green, // color: Colors.green,
fontSize: 11, // fontSize: 11,
fontWeight: FontWeight.w700, // fontWeight: FontWeight.w700,
), // ),
), // ),
), // ),
) // )
: SizedBox( // :
width: 80, SizedBox(
child: Text( width: 80,
item['premium_amount']?.toString() ?? '-', child: Text(
style: _dataBold, item['premium_amount']?.toString() ?? '-',
), style: _dataBold,
), ),
),
), ),
// Payment Mode // Payment Mode

View File

@ -355,8 +355,13 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
buildInsuredName(context, fromHeader: true), buildInsuredName(context, fromHeader: true),
buildVehicleNumber(context), buildVehicleNumber(context),
Row(
buildSave(context), children: [
buildRefresh(context),
SizedBox(width: 5),
buildSave(context),
],
),
], ],
), ),
), ),
@ -930,7 +935,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
resetFields(); resetFields();
}, },
child: Container( child: Container(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(5.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFF2E7D6E), color: const Color(0xFF2E7D6E),
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
@ -940,6 +945,22 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
); );
} }
Widget buildRefresh(context) {
return InkWell(
onTap: () {
resetFields();
},
child: Container(
padding: EdgeInsets.all(6.0),
decoration: BoxDecoration(
color: const Color(0xFF2E7D6E),
borderRadius: BorderRadius.circular(5.0),
),
child: Icon(Icons.refresh, size: 18, color: Colors.white),
),
);
}
void resetFields() { void resetFields() {
print('Field ReSET'); print('Field ReSET');
// 1. Reset all text controllers // 1. Reset all text controllers

View File

@ -108,6 +108,8 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
// "insurer_id": selectedInsurer, // "insurer_id": selectedInsurer,
"premium_amount": controllers["premium_Amount"]?.text, "premium_amount": controllers["premium_Amount"]?.text,
"insurance_plan_type_id": selectedInsPlanType, "insurance_plan_type_id": selectedInsPlanType,
"payment_mode_id": selectedPaymentMode,
"broker_id": selectedBroker,
// "additional_uploaded_file_name": "extra_doc.pdf", // "additional_uploaded_file_name": "extra_doc.pdf",
// "created_by": widget.userId, // "created_by": widget.userId,
"manager_id": widget.managerId, "manager_id": widget.managerId,
@ -221,8 +223,11 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
selectedInsPlanType = widget selectedInsPlanType = widget
.selectedQuotationFrmListdata!['insurance_plan_type_id'] .selectedQuotationFrmListdata!['insurance_plan_type_id']
?.toString(); ?.toString();
selectedBroker = widget.selectedQuotationFrmListdata!['broker_id']
?.toString();
selectedInsurer = '1'; selectedPaymentMode = widget.selectedQuotationFrmListdata!['broker_id']
?.toString();
// controllers["insurer"]?.text = 'LIC'; // controllers["insurer"]?.text = 'LIC';
@ -230,7 +235,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
// widget.selectedQuotationFrmListdata!['insurer_id']?.toString() ?? ''; // widget.selectedQuotationFrmListdata!['insurer_id']?.toString() ?? '';
String? apiDocPath = String? apiDocPath =
widget.selectedQuotationFrmListdata!["additional_uploaded_file_name"]; widget.selectedQuotationFrmListdata!["policy_pdf_file_name"];
if (apiDocPath != null && apiDocPath.isNotEmpty) { if (apiDocPath != null && apiDocPath.isNotEmpty) {
print('apiDocPath - $apiDocPath'); print('apiDocPath - $apiDocPath');
selectedFileNames = apiDocPath.split('/').last; selectedFileNames = apiDocPath.split('/').last;
@ -317,7 +322,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
}); });
try { try {
final response = await apiService.fetchMasterDropDown('getPaymentMode'); final response = await apiService.fetchMasterDropDown('PaymentMode');
if (response['status'] == 200) { if (response['status'] == 200) {
print('getPaymentModeData - ${response['data']}'); print('getPaymentModeData - ${response['data']}');
@ -372,11 +377,9 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
print('id - $id'); print('id - $id');
final uri = Uri.parse( final uri = Uri.parse(
// isUpdating // isUpdating
// ? 'https://venbait.in/nhance/partner/dev/api/agent/updateAgent' // ? '${Env.apiUrl}quotation/updateQuotation'
// : 'https://venbait.in/nhance/partner/dev/api/agent/createAgent', // : '${Env.apiUrl}quotation/createQuotation',
isUpdating '${Env.apiUrl}quotation/proceedQuotation',
? '${Env.apiUrl}quotation/updateQuotation'
: '${Env.apiUrl}quotation/createQuotation',
); );
if (_token == null) { if (_token == null) {
throw Exception('Token not found. Please log in.'); throw Exception('Token not found. Please log in.');
@ -416,14 +419,14 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
try { try {
if (docUploadedFile!.bytes != null) { if (docUploadedFile!.bytes != null) {
final multipartFile = http.MultipartFile.fromBytes( final multipartFile = http.MultipartFile.fromBytes(
'additional_uploaded_file_name', 'policy_pdf_file_name',
docUploadedFile!.bytes!, docUploadedFile!.bytes!,
filename: docUploadedFile!.name, filename: docUploadedFile!.name,
); );
request.files.add(multipartFile); request.files.add(multipartFile);
} else if (docUploadedFile!.path != null) { } else if (docUploadedFile!.path != null) {
final multipartFile = await http.MultipartFile.fromPath( final multipartFile = await http.MultipartFile.fromPath(
'additional_uploaded_file_name', 'policy_pdf_file_name',
docUploadedFile!.path!, docUploadedFile!.path!,
filename: docUploadedFile!.name, filename: docUploadedFile!.name,
); );
@ -951,7 +954,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
); );
}).toList(); }).toList();
}, },
itemAsString: (val) => val['insurance_plan_type'].toString(), itemAsString: (val) => val['name'].toString(),
compareFn: (item, selectedItem) => compareFn: (item, selectedItem) =>
item['id'] == selectedItem['id'], // compare by id item['id'] == selectedItem['id'], // compare by id
validator: (val) { validator: (val) {
@ -1036,34 +1039,13 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
), ),
); );
}, },
// searchFieldProps: TextFieldProps(
// decoration: InputDecoration(
// filled: true,
// fillColor: Colors.white,
// hintText: "Search Plan Type...",
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: Colors.white,
// ), // 👈 Normal border
// ),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: Colors.white,
// width: 1.5,
// ), // 👈 Focused border
// ),
// ),
// ),
// constraints: BoxConstraints(),
), ),
onChanged: (val) { onChanged: (val) {
if (val != null) { if (val != null) {
print("Selected ClaimsType : ${val['insurance_plan_type']}"); print("Selected ClaimsType : ${val['id']}");
print("Id: ${val['id']}"); print("Id: ${val['id']}");
selectedInsPlanType = val['id']; selectedBroker = val['id'];
// controllers['agentId']?.text = val['agent_code'];
// agentId = agent['id'];
} }
}, },
), ),
@ -1097,38 +1079,40 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
}); });
}, },
), ),
const SizedBox(height: 5), // const SizedBox(height: 5),
//
if (docUploadedFileUrlFromApi != null) // if (docUploadedFileUrlFromApi != null)
Container( // Container(
// color: Colors.white, // // color: Colors.white,
child: Row( // child: Row(
children: [ // children: [
GestureDetector( // GestureDetector(
onTap: () => apiService.downloadFile( // onTap: () => apiService.downloadFile(
apiUrl: // // apiUrl:
'api/quotation/downloadAdditionalUploadedFile?id=$selectedId', // // 'api/quotation/downloadAdditionalUploadedFile?id=$selectedId',
apiId: selectedId, // apiUrl:
localFile: docUploadedFile, // 'api/policy/downloadPolicyFile?policy_id=$selectedId&file_type=policy_pdf',
fileName: selectedFileNames, // apiId: selectedId,
), // localFile: docUploadedFile,
child: Container( // fileName: selectedFileNames,
padding: const EdgeInsets.all(5), // ),
decoration: BoxDecoration( // child: Container(
borderRadius: BorderRadius.circular(5), // padding: const EdgeInsets.all(5),
color: Color(0xFF425B5B), // decoration: BoxDecoration(
// color: Colors.green.shade300, // borderRadius: BorderRadius.circular(5),
), // color: Color(0xFF425B5B),
child: Row( // // color: Colors.green.shade300,
children: const [ // ),
Icon(Icons.download, size: 13, color: Colors.white), // child: Row(
], // children: const [
), // Icon(Icons.download, size: 13, color: Colors.white),
), // ],
), // ),
], // ),
), // ),
), // ],
// ),
// ),
], ],
), ),
], ],

View File

@ -160,7 +160,6 @@ class PolicyStaffTabState extends ConsumerState<PolicyStaffTab> {
"sgst": controllers["sgst"]?.text, "sgst": controllers["sgst"]?.text,
"igst": controllers["igst"]?.text, "igst": controllers["igst"]?.text,
"premium_amount": controllers["premiumTOT"]?.text, "premium_amount": controllers["premiumTOT"]?.text,
"manager_id": managerId, "manager_id": managerId,
// "policy_pdf_file_name": "policy_doc.pdf", // "policy_pdf_file_name": "policy_doc.pdf",
// "policy_payment_receipt_file_name": "receipt_doc.pdf", // "policy_payment_receipt_file_name": "receipt_doc.pdf",
@ -435,6 +434,7 @@ class PolicyStaffTabState extends ConsumerState<PolicyStaffTab> {
policyData['premium_amount']?.toString() ?? ''; policyData['premium_amount']?.toString() ?? '';
selectedBroker = policyData['broker_id'] ?? ''; selectedBroker = policyData['broker_id'] ?? '';
selectedBrokerName = policyData['broker_name'] ?? '';
// RC FILE // RC FILE
String? rcPath = policyData["policy_pdf_file_name"]; String? rcPath = policyData["policy_pdf_file_name"];
if (rcPath != null && rcPath.isNotEmpty) { if (rcPath != null && rcPath.isNotEmpty) {
@ -1067,13 +1067,14 @@ class PolicyStaffTabState extends ConsumerState<PolicyStaffTab> {
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
buildBroker(context),
if (selectedBrokerName != null) ...[ if (selectedBrokerName != null) ...[
Paymentmode(context),
SizedBox(width: 20),
buildBroker(context),
SizedBox(width: 20), SizedBox(width: 20),
buildUploadPolicyPdf(context), buildUploadPolicyPdf(context),
SizedBox(width: 20),
Paymentmode(context), // SizedBox(width: 20),
], ],
], ],
), ),
@ -1413,164 +1414,181 @@ class PolicyStaffTabState extends ConsumerState<PolicyStaffTab> {
Text('Broker *', style: _textStyle), Text('Broker *', style: _textStyle),
SizedBox(width: 15), SizedBox(width: 15),
SizedBox( SizedBox(
height: 30, width: MediaQuery.of(context).size.width * 0.095,
width: MediaQuery.of(context).size.width * 0.1, child: Text(
child: DropdownSearch<Map<String, dynamic>>( '$selectedBrokerName',
key: dropDownKeyBroker, style: GoogleFonts.inter(fontSize: 12),
selectedItem: selectedBrokers.isNotEmpty ? selectedBrokers : null,
items: (filter, infiniteScrollProps) {
return filteredBrokerData;
},
itemAsString: (val) => val['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['name'].toString() : "",
style: GoogleFonts.poppins(fontSize: 11, color: Colors.black),
overflow: TextOverflow.ellipsis,
maxLines: 1,
softWrap: false,
),
),
decoratorProps: DropDownDecoratorProps(
decoration:
AppInputDecorations.dropdownDecoration(
label: "Select Broker",
).copyWith(
filled: true,
fillColor:
Colors.white, // 👈 makes the dropdown input white
isDense: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: const BorderSide(
color: Colors.black,
width: 0.1,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: const BorderSide(
color: Colors.black,
width: 0.1,
),
),
contentPadding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 6,
),
),
),
popupProps: PopupProps.menu(
fit: FlexFit.loose,
constraints: BoxConstraints(maxHeight: 250),
menuProps: MenuProps(
backgroundColor:
Colors.white, // 👈 sets dropdown background to white
),
showSearchBox: true,
searchFieldProps: TextFieldProps(
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
hintText: "Search Broker...",
hintStyle: GoogleFonts.inter(
fontSize: 12,
color: Colors.black,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
), // 👈 Normal border
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
width: 1.5,
), // 👈 Focused border
),
),
),
itemBuilder: (context, item, isDisabled, isSelected) {
return Container(
// color: isSelected ? Colors.blue.withOpacity(0.1) : null,
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
child: Text(
item['name'].toString(),
style: GoogleFonts.inter(fontSize: 12, color: Colors.black),
),
);
},
// constraints: BoxConstraints(),
),
onChanged: (val) {
if (val != null) {
print("Selected Broker : ${val['name']}");
print("Id: ${val['id']}");
selectedBroker = val['id'];
setState(() {
selectedBrokerName = val['name'];
print('selectedBrokerName - $selectedBrokerName');
});
// controllers['agentId']?.text = val['agent_code'];
// agentId = agent['id'];
}
},
), ),
), ),
// SizedBox(
// height: 30,
// width: MediaQuery.of(context).size.width * 0.1,
// child: DropdownSearch<Map<String, dynamic>>(
// key: dropDownKeyBroker,
// selectedItem: selectedBrokers.isNotEmpty ? selectedBrokers : null,
// items: (filter, infiniteScrollProps) {
// return filteredBrokerData;
// },
//
// itemAsString: (val) => val['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['name'].toString() : "",
// style: GoogleFonts.poppins(fontSize: 11, color: Colors.black),
// overflow: TextOverflow.ellipsis,
// maxLines: 1,
// softWrap: false,
// ),
// ),
// decoratorProps: DropDownDecoratorProps(
// decoration:
// AppInputDecorations.dropdownDecoration(
// label: "Select Broker",
// ).copyWith(
// filled: true,
// fillColor:
// Colors.white, // 👈 makes the dropdown input white
// isDense: true,
// border: OutlineInputBorder(
// borderRadius: BorderRadius.circular(5),
// borderSide: const BorderSide(
// color: Colors.black,
// width: 0.1,
// ),
// ),
// enabledBorder: OutlineInputBorder(
// borderRadius: BorderRadius.circular(5),
// borderSide: const BorderSide(
// color: Colors.black,
// width: 0.1,
// ),
// ),
// contentPadding: EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 6,
// ),
// ),
// ),
//
// popupProps: PopupProps.menu(
// fit: FlexFit.loose,
// constraints: BoxConstraints(maxHeight: 250),
// menuProps: MenuProps(
// backgroundColor:
// Colors.white, // 👈 sets dropdown background to white
// ),
// showSearchBox: true,
// searchFieldProps: TextFieldProps(
// decoration: InputDecoration(
// filled: true,
// fillColor: Colors.white,
// hintText: "Search Broker...",
// hintStyle: GoogleFonts.inter(
// fontSize: 12,
// color: Colors.black,
// ),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: Colors.white,
// ), // 👈 Normal border
// ),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: Colors.white,
// width: 1.5,
// ), // 👈 Focused border
// ),
// ),
// ),
//
// itemBuilder: (context, item, isDisabled, isSelected) {
// return Container(
// // color: isSelected ? Colors.blue.withOpacity(0.1) : null,
// padding: const EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 3,
// ),
// child: Text(
// item['name'].toString(),
// style: GoogleFonts.inter(fontSize: 12, color: Colors.black),
// ),
// );
// },
// // constraints: BoxConstraints(),
// ),
//
// onChanged: (val) {
// if (val != null) {
// print("Selected Broker : ${val['name']}");
// print("Id: ${val['id']}");
// selectedBroker = val['id'];
// setState(() {
// selectedBrokerName = val['name'];
// print('selectedBrokerName - $selectedBrokerName');
// });
// // controllers['agentId']?.text = val['agent_code'];
// // agentId = agent['id'];
// }
// },
// ),
// ),
], ],
); );
} }
Widget Paymentmode(BuildContext context) { Widget Paymentmode(BuildContext context) {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end,
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text('Payment Mode *', style: _textStyle), Text('Payment Mode *', style: _textStyle),
SizedBox(width: 25), SizedBox(width: 15),
ThemedFormField( SizedBox(
controller: controllers['policyPaymentMode']!, width: MediaQuery.of(context).size.width * 0.075,
borderColor: Color(0xFFE2E8F0), child: Text(
highlightColor: Color(0xFF50A398), '${controllers['policyPaymentMode']?.text}',
errorBorderColor: Color(0xffEDF6F5), style: GoogleFonts.inter(fontSize: 12),
hintText: 'Online / Cash', ),
// borderColor: Color(0xffEDF6F5),
validator: (value) =>
Validators.requiredField(value, "policyPaymentMode"),
txtwidth: ResponsiveLayout.isMobile(context)
? null
: MediaQuery.of(context).size.width * 0.07,
), ),
// ThemedFormField(
// controller: controllers['policyPaymentMode']!,
// // borderColor: Color(0xFFE2E8F0),
// borderColor: Colors.white,
// highlightColor: Colors.white,
// // highlightColor: Color(0xFF50A398),
// errorBorderColor: Color(0xffEDF6F5),
// hintText: 'Online / Cash',
// // borderColor: Color(0xffEDF6F5),
// readOnly: true,
// validator: (value) =>
// Validators.requiredField(value, "policyPaymentMode"),
// txtwidth: ResponsiveLayout.isMobile(context)
// ? null
// : MediaQuery.of(context).size.width * 0.07,
// ),
], ],
); );
} }
@ -1751,6 +1769,7 @@ class PolicyStaffTabState extends ConsumerState<PolicyStaffTab> {
ThemedUploadField( ThemedUploadField(
hintText: selectedPDFFileNames ?? "Upload Document", hintText: selectedPDFFileNames ?? "Upload Document",
allowedExtensions: ['pdf'], allowedExtensions: ['pdf'],
// backgroundColor: Colors.white,
backgroundColor: Color(0xffEDF6F5), backgroundColor: Color(0xffEDF6F5),
txtwidth: ResponsiveLayout.isMobile(context) txtwidth: ResponsiveLayout.isMobile(context)
? null ? null

View File

@ -215,11 +215,32 @@ class QuotationStaffTabState extends ConsumerState<QuotationStaffTab> {
originalData = getQuotationData; originalData = getQuotationData;
filteredData = List.from(originalData); filteredData = List.from(originalData);
blockKey = getQuotationData.any( // dynamic data = getQuotationData
(item) => item['status'] == 'Accepted', // .where((item) => item['status'] == 'Accepted')
); // .toList();
// blockKey = getQuotationData.any(
// (item) => item['status'] == 'Accepted',
// );
final acceptedList = getQuotationData
.where((item) => item['status'] == 'Accepted')
.toList();
print('blockKey- $blockKey'); print('blockKey- $blockKey');
// print('originalData - $getClaimPolicies'); print('originalDataData - $acceptedList');
final data = acceptedList.isNotEmpty ? acceptedList.first : null;
final id = selectedQuotationFrmListData?['id'];
handleEdit(id, data);
// selectedQuotationFrmListData = data;
print('originalDatasdata- $data');
print(
'originalDataselectedQuotationFrmListData - $selectedQuotationFrmListData',
);
}); });
} else { } else {
getQuotationData = []; getQuotationData = [];
@ -275,25 +296,25 @@ class QuotationStaffTabState extends ConsumerState<QuotationStaffTab> {
// scrollDirection: Axis.vertical, // scrollDirection: Axis.vertical,
child: Column( child: Column(
children: [ children: [
if (!blockKey) ...[ // if (!blockKey) ...[
// if (!blockKey && roleId != 'manager') ...[ // if (!blockKey && roleId != 'manager') ...[
CreateProposalForm( CreateProposalForm(
key: ValueKey(selectedQuotationFrmListId ?? "new"), key: ValueKey(selectedQuotationFrmListId ?? "new"),
userId: userId, userId: userId,
selectedQuotationFrmListdata: selectedQuotationFrmListData, selectedQuotationFrmListdata: selectedQuotationFrmListData,
selectedQuotationFrmListId: selectedQuotationFrmListId, selectedQuotationFrmListId: selectedQuotationFrmListId,
managerId: managerId, managerId: managerId,
selectedInsurdId: selectedInsurdId, selectedInsurdId: selectedInsurdId,
selectedEnquiryId: selectedEnquiryId, selectedEnquiryId: selectedEnquiryId,
onSubmit: (value) { onSubmit: (value) {
debugPrint("New Endorsement: $value"); debugPrint("New Endorsement: $value");
if (value == 'Success') { if (value == 'Success') {
refresh(); refresh();
} }
}, },
), ),
SizedBox(height: 20), SizedBox(height: 20),
], // ],
], ],
), ),
// ), // ),

View File

@ -116,9 +116,9 @@ class TabEnquiryStaffListState extends ConsumerState<TabEnquiryStaffList> {
TabItem("Policy", PolicyStaffTab()), TabItem("Policy", PolicyStaffTab()),
]; ];
if (widget.showKey == "Policy") { // if (widget.showKey == "Policy") {
tabs.add(TabItem("Policy", PolicyStaffTab())); // tabs.add(TabItem("Policy", PolicyStaffTab()));
} // }
// if (tabIndex != null) { // if (tabIndex != null) {
// selectedIndex = tabIndex; // selectedIndex = tabIndex;