Proposal_API_changes
This commit is contained in:
parent
5fdacc60c9
commit
ef21a4883c
File diff suppressed because one or more lines are too long
@ -342,14 +342,8 @@ class ApiService {
|
||||
final url;
|
||||
|
||||
if (role == 'staff') {
|
||||
// url = Uri.parse(
|
||||
// 'https://venbait.in/nhance/partner/dev/api/staff/changeStaffStatus',
|
||||
// );
|
||||
url = Uri.parse('${Env.apiUrl}staff/changeStaffStatus');
|
||||
} else {
|
||||
// url = Uri.parse(
|
||||
// 'https://venbait.in/nhance/partner/dev/api/agent/changeAgentStatus',
|
||||
// );
|
||||
url = Uri.parse('${Env.apiUrl}/api/agent/changeAgentStatus');
|
||||
}
|
||||
|
||||
@ -372,6 +366,44 @@ class ApiService {
|
||||
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 -------------------------------------------------
|
||||
Future<Map<String, dynamic>> fetchDashboard(int id, role, userId) async {
|
||||
// print(_token);
|
||||
|
||||
@ -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 {
|
||||
final bool isUpdating = selectedId != null;
|
||||
final dynamic id = isUpdating ? int.tryParse(selectedId.toString()) : 0;
|
||||
@ -170,7 +182,8 @@ class BrokerState extends ConsumerState<Broker> {
|
||||
if (response.statusCode == 200) {
|
||||
print("Broker submitted successfully!");
|
||||
print("Response: ${response.body}");
|
||||
widget.onSubmit();
|
||||
|
||||
refresh();
|
||||
isUpdating
|
||||
? ToastHelper.showSuccessToast(
|
||||
context,
|
||||
@ -229,7 +242,7 @@ class BrokerState extends ConsumerState<Broker> {
|
||||
children: [
|
||||
buildFormFields(),
|
||||
SizedBox(width: 5),
|
||||
GestureDetector(
|
||||
InkWell(
|
||||
onTap: () {
|
||||
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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -31,6 +31,7 @@ class BrokerListState extends ConsumerState<BrokerList> {
|
||||
dynamic managerId;
|
||||
dynamic role;
|
||||
dynamic prefid;
|
||||
dynamic userId;
|
||||
// List<Map<String, dynamic>> dataVal = [];
|
||||
List<Map<String, dynamic>> getBrokerData = [];
|
||||
List<Map<String, dynamic>> originalData = [];
|
||||
@ -48,6 +49,7 @@ class BrokerListState extends ConsumerState<BrokerList> {
|
||||
|
||||
Future.microtask(() {
|
||||
final data1 = ref.read(managerIdProvider);
|
||||
userId = ref.watch(userIdProvider);
|
||||
// final data2 = ref.read(handlerIdProvider);
|
||||
print("Edata1 => mId: $data1 -2 :");
|
||||
prefid = data1;
|
||||
@ -168,7 +170,7 @@ class BrokerListState extends ConsumerState<BrokerList> {
|
||||
managerId = ref.watch(managerIdProvider);
|
||||
|
||||
return MainLayout(
|
||||
title: "Staff",
|
||||
title: "Broker",
|
||||
body: Container(
|
||||
// padding: EdgeInsets.all(8.0),
|
||||
// margin: EdgeInsets.all(10.0),
|
||||
@ -223,9 +225,10 @@ class BrokerListState extends ConsumerState<BrokerList> {
|
||||
id: selectedId,
|
||||
onSubmit: () {
|
||||
getBroker();
|
||||
setState(
|
||||
() => selectedBroker = null,
|
||||
); // reset after save
|
||||
setState(() {
|
||||
selectedBroker = null;
|
||||
selectedId = null;
|
||||
}); // reset after save
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
@ -382,10 +385,11 @@ class BrokerListState extends ConsumerState<BrokerList> {
|
||||
setState(() {
|
||||
item['is_active'] = val ? "1" : "0";
|
||||
});
|
||||
final response = apiService.updateStatus(
|
||||
final response = apiService.updateStatusMasters(
|
||||
item['id'],
|
||||
val ? "0" : "1",
|
||||
'staff',
|
||||
'Broker',
|
||||
userId,
|
||||
);
|
||||
print("Response - $response");
|
||||
},
|
||||
|
||||
@ -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 {
|
||||
final bool isUpdating = selectedId != null;
|
||||
final dynamic id = isUpdating ? int.tryParse(selectedId.toString()) : 0;
|
||||
@ -178,7 +190,8 @@ class PaymentState extends ConsumerState<Payment> {
|
||||
if (response.statusCode == 200) {
|
||||
print("Payment submitted successfully!");
|
||||
print("Response: ${response.body}");
|
||||
widget.onSubmit();
|
||||
|
||||
refresh();
|
||||
isUpdating
|
||||
? ToastHelper.showSuccessToast(
|
||||
context,
|
||||
@ -237,7 +250,7 @@ class PaymentState extends ConsumerState<Payment> {
|
||||
children: [
|
||||
buildFormFields(),
|
||||
SizedBox(width: 5),
|
||||
GestureDetector(
|
||||
InkWell(
|
||||
onTap: () {
|
||||
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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -31,6 +31,7 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
|
||||
dynamic managerId;
|
||||
dynamic role;
|
||||
dynamic prefid;
|
||||
dynamic userId;
|
||||
// List<Map<String, dynamic>> dataVal = [];
|
||||
List<Map<String, dynamic>> getPaymentData = [];
|
||||
List<Map<String, dynamic>> originalData = [];
|
||||
@ -52,6 +53,7 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
|
||||
print("Edata1 => mId: $data1 -2 :");
|
||||
prefid = data1;
|
||||
role = ref.read(userRoleProvider);
|
||||
userId = ref.watch(userIdProvider);
|
||||
print("E43 => mId: $prefid");
|
||||
if (prefid != null && role != null) {
|
||||
getPayment();
|
||||
@ -216,9 +218,10 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
|
||||
id: selectedId,
|
||||
onSubmit: () {
|
||||
getPayment();
|
||||
setState(
|
||||
() => selectedPayment = null,
|
||||
); // reset after save
|
||||
setState(() {
|
||||
selectedPayment = null;
|
||||
selectedId = null;
|
||||
}); // reset after save
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
@ -378,10 +381,11 @@ class PaymentLsitState extends ConsumerState<PaymentLsit> {
|
||||
setState(() {
|
||||
item['is_active'] = val ? "1" : "0";
|
||||
});
|
||||
final response = apiService.updateStatus(
|
||||
final response = apiService.updateStatusMasters(
|
||||
item['id'],
|
||||
val ? "0" : "1",
|
||||
'staff',
|
||||
'PaymentMode',
|
||||
userId,
|
||||
);
|
||||
print("Response - $response");
|
||||
},
|
||||
|
||||
@ -3365,33 +3365,34 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
||||
|
||||
// Premium
|
||||
DataCell(
|
||||
(item['status'] == 'Proposal Created' ||
|
||||
item['status'] == 'Proposal Rejected')
|
||||
? SizedBox(
|
||||
width: 80,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
// handle approval logic
|
||||
|
||||
handleProposalAccept(context, item['id']);
|
||||
},
|
||||
child: Text(
|
||||
'Click To\nApprove',
|
||||
style: GoogleFonts.inter(
|
||||
color: Colors.green,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: SizedBox(
|
||||
width: 80,
|
||||
child: Text(
|
||||
item['premium_amount']?.toString() ?? '-',
|
||||
style: _dataBold,
|
||||
),
|
||||
),
|
||||
// (item['status'] == 'Proposal Created' ||
|
||||
// item['status'] == 'Proposal Rejected')
|
||||
// ? SizedBox(
|
||||
// width: 80,
|
||||
// child: InkWell(
|
||||
// onTap: () {
|
||||
// // handle approval logic
|
||||
//
|
||||
// handleProposalAccept(context, item['id']);
|
||||
// },
|
||||
// child: Text(
|
||||
// 'Click To\nApprove',
|
||||
// style: GoogleFonts.inter(
|
||||
// color: Colors.green,
|
||||
// fontSize: 11,
|
||||
// fontWeight: FontWeight.w700,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// :
|
||||
SizedBox(
|
||||
width: 80,
|
||||
child: Text(
|
||||
item['premium_amount']?.toString() ?? '-',
|
||||
style: _dataBold,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Payment Mode
|
||||
|
||||
@ -355,8 +355,13 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
buildInsuredName(context, fromHeader: true),
|
||||
|
||||
buildVehicleNumber(context),
|
||||
|
||||
buildSave(context),
|
||||
Row(
|
||||
children: [
|
||||
buildRefresh(context),
|
||||
SizedBox(width: 5),
|
||||
buildSave(context),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -930,7 +935,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
resetFields();
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
padding: EdgeInsets.all(5.0),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF2E7D6E),
|
||||
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() {
|
||||
print('Field ReSET');
|
||||
// 1. Reset all text controllers
|
||||
|
||||
@ -108,6 +108,8 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
// "insurer_id": selectedInsurer,
|
||||
"premium_amount": controllers["premium_Amount"]?.text,
|
||||
"insurance_plan_type_id": selectedInsPlanType,
|
||||
"payment_mode_id": selectedPaymentMode,
|
||||
"broker_id": selectedBroker,
|
||||
// "additional_uploaded_file_name": "extra_doc.pdf",
|
||||
// "created_by": widget.userId,
|
||||
"manager_id": widget.managerId,
|
||||
@ -221,8 +223,11 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
selectedInsPlanType = widget
|
||||
.selectedQuotationFrmListdata!['insurance_plan_type_id']
|
||||
?.toString();
|
||||
selectedBroker = widget.selectedQuotationFrmListdata!['broker_id']
|
||||
?.toString();
|
||||
|
||||
selectedInsurer = '1';
|
||||
selectedPaymentMode = widget.selectedQuotationFrmListdata!['broker_id']
|
||||
?.toString();
|
||||
|
||||
// controllers["insurer"]?.text = 'LIC';
|
||||
|
||||
@ -230,7 +235,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
// widget.selectedQuotationFrmListdata!['insurer_id']?.toString() ?? '';
|
||||
|
||||
String? apiDocPath =
|
||||
widget.selectedQuotationFrmListdata!["additional_uploaded_file_name"];
|
||||
widget.selectedQuotationFrmListdata!["policy_pdf_file_name"];
|
||||
if (apiDocPath != null && apiDocPath.isNotEmpty) {
|
||||
print('apiDocPath - $apiDocPath');
|
||||
selectedFileNames = apiDocPath.split('/').last;
|
||||
@ -317,7 +322,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
});
|
||||
|
||||
try {
|
||||
final response = await apiService.fetchMasterDropDown('getPaymentMode');
|
||||
final response = await apiService.fetchMasterDropDown('PaymentMode');
|
||||
|
||||
if (response['status'] == 200) {
|
||||
print('getPaymentModeData - ${response['data']}');
|
||||
@ -372,11 +377,9 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
print('id - $id');
|
||||
final uri = Uri.parse(
|
||||
// isUpdating
|
||||
// ? 'https://venbait.in/nhance/partner/dev/api/agent/updateAgent'
|
||||
// : 'https://venbait.in/nhance/partner/dev/api/agent/createAgent',
|
||||
isUpdating
|
||||
? '${Env.apiUrl}quotation/updateQuotation'
|
||||
: '${Env.apiUrl}quotation/createQuotation',
|
||||
// ? '${Env.apiUrl}quotation/updateQuotation'
|
||||
// : '${Env.apiUrl}quotation/createQuotation',
|
||||
'${Env.apiUrl}quotation/proceedQuotation',
|
||||
);
|
||||
if (_token == null) {
|
||||
throw Exception('Token not found. Please log in.');
|
||||
@ -416,14 +419,14 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
try {
|
||||
if (docUploadedFile!.bytes != null) {
|
||||
final multipartFile = http.MultipartFile.fromBytes(
|
||||
'additional_uploaded_file_name',
|
||||
'policy_pdf_file_name',
|
||||
docUploadedFile!.bytes!,
|
||||
filename: docUploadedFile!.name,
|
||||
);
|
||||
request.files.add(multipartFile);
|
||||
} else if (docUploadedFile!.path != null) {
|
||||
final multipartFile = await http.MultipartFile.fromPath(
|
||||
'additional_uploaded_file_name',
|
||||
'policy_pdf_file_name',
|
||||
docUploadedFile!.path!,
|
||||
filename: docUploadedFile!.name,
|
||||
);
|
||||
@ -951,7 +954,7 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
itemAsString: (val) => val['insurance_plan_type'].toString(),
|
||||
itemAsString: (val) => val['name'].toString(),
|
||||
compareFn: (item, selectedItem) =>
|
||||
item['id'] == selectedItem['id'], // ✅ compare by id
|
||||
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) {
|
||||
if (val != null) {
|
||||
print("Selected ClaimsType : ${val['insurance_plan_type']}");
|
||||
print("Selected ClaimsType : ${val['id']}");
|
||||
print("Id: ${val['id']}");
|
||||
selectedInsPlanType = val['id'];
|
||||
// controllers['agentId']?.text = val['agent_code'];
|
||||
// agentId = agent['id'];
|
||||
selectedBroker = val['id'];
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -1097,38 +1079,40 @@ class CreateProposalFormState extends ConsumerState<CreateProposalForm> {
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
|
||||
if (docUploadedFileUrlFromApi != null)
|
||||
Container(
|
||||
// color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => apiService.downloadFile(
|
||||
apiUrl:
|
||||
'api/quotation/downloadAdditionalUploadedFile?id=$selectedId',
|
||||
apiId: selectedId,
|
||||
localFile: docUploadedFile,
|
||||
fileName: selectedFileNames,
|
||||
),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
color: Color(0xFF425B5B),
|
||||
// color: Colors.green.shade300,
|
||||
),
|
||||
child: Row(
|
||||
children: const [
|
||||
Icon(Icons.download, size: 13, color: Colors.white),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// const SizedBox(height: 5),
|
||||
//
|
||||
// if (docUploadedFileUrlFromApi != null)
|
||||
// Container(
|
||||
// // color: Colors.white,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// GestureDetector(
|
||||
// onTap: () => apiService.downloadFile(
|
||||
// // apiUrl:
|
||||
// // 'api/quotation/downloadAdditionalUploadedFile?id=$selectedId',
|
||||
// apiUrl:
|
||||
// 'api/policy/downloadPolicyFile?policy_id=$selectedId&file_type=policy_pdf',
|
||||
// apiId: selectedId,
|
||||
// localFile: docUploadedFile,
|
||||
// fileName: selectedFileNames,
|
||||
// ),
|
||||
// child: Container(
|
||||
// padding: const EdgeInsets.all(5),
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(5),
|
||||
// color: Color(0xFF425B5B),
|
||||
// // color: Colors.green.shade300,
|
||||
// ),
|
||||
// child: Row(
|
||||
// children: const [
|
||||
// Icon(Icons.download, size: 13, color: Colors.white),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@ -160,7 +160,6 @@ class PolicyStaffTabState extends ConsumerState<PolicyStaffTab> {
|
||||
"sgst": controllers["sgst"]?.text,
|
||||
"igst": controllers["igst"]?.text,
|
||||
"premium_amount": controllers["premiumTOT"]?.text,
|
||||
|
||||
"manager_id": managerId,
|
||||
// "policy_pdf_file_name": "policy_doc.pdf",
|
||||
// "policy_payment_receipt_file_name": "receipt_doc.pdf",
|
||||
@ -435,6 +434,7 @@ class PolicyStaffTabState extends ConsumerState<PolicyStaffTab> {
|
||||
policyData['premium_amount']?.toString() ?? '';
|
||||
|
||||
selectedBroker = policyData['broker_id'] ?? '';
|
||||
selectedBrokerName = policyData['broker_name'] ?? '';
|
||||
// RC FILE
|
||||
String? rcPath = policyData["policy_pdf_file_name"];
|
||||
if (rcPath != null && rcPath.isNotEmpty) {
|
||||
@ -1067,13 +1067,14 @@ class PolicyStaffTabState extends ConsumerState<PolicyStaffTab> {
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildBroker(context),
|
||||
if (selectedBrokerName != null) ...[
|
||||
Paymentmode(context),
|
||||
SizedBox(width: 20),
|
||||
buildBroker(context),
|
||||
SizedBox(width: 20),
|
||||
buildUploadPolicyPdf(context),
|
||||
SizedBox(width: 20),
|
||||
|
||||
Paymentmode(context),
|
||||
// SizedBox(width: 20),
|
||||
],
|
||||
],
|
||||
),
|
||||
@ -1413,164 +1414,181 @@ class PolicyStaffTabState extends ConsumerState<PolicyStaffTab> {
|
||||
Text('Broker *', style: _textStyle),
|
||||
SizedBox(width: 15),
|
||||
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'];
|
||||
}
|
||||
},
|
||||
width: MediaQuery.of(context).size.width * 0.095,
|
||||
child: Text(
|
||||
'$selectedBrokerName',
|
||||
style: GoogleFonts.inter(fontSize: 12),
|
||||
),
|
||||
),
|
||||
// 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) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('Payment Mode *', style: _textStyle),
|
||||
SizedBox(width: 25),
|
||||
ThemedFormField(
|
||||
controller: controllers['policyPaymentMode']!,
|
||||
borderColor: Color(0xFFE2E8F0),
|
||||
highlightColor: Color(0xFF50A398),
|
||||
errorBorderColor: Color(0xffEDF6F5),
|
||||
hintText: 'Online / Cash',
|
||||
// borderColor: Color(0xffEDF6F5),
|
||||
validator: (value) =>
|
||||
Validators.requiredField(value, "policyPaymentMode"),
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
: MediaQuery.of(context).size.width * 0.07,
|
||||
SizedBox(width: 15),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.075,
|
||||
child: Text(
|
||||
'${controllers['policyPaymentMode']?.text}',
|
||||
style: GoogleFonts.inter(fontSize: 12),
|
||||
),
|
||||
),
|
||||
// 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(
|
||||
hintText: selectedPDFFileNames ?? "Upload Document",
|
||||
allowedExtensions: ['pdf'],
|
||||
// backgroundColor: Colors.white,
|
||||
backgroundColor: Color(0xffEDF6F5),
|
||||
txtwidth: ResponsiveLayout.isMobile(context)
|
||||
? null
|
||||
|
||||
@ -215,11 +215,32 @@ class QuotationStaffTabState extends ConsumerState<QuotationStaffTab> {
|
||||
originalData = getQuotationData;
|
||||
filteredData = List.from(originalData);
|
||||
|
||||
blockKey = getQuotationData.any(
|
||||
(item) => item['status'] == 'Accepted',
|
||||
);
|
||||
// dynamic data = getQuotationData
|
||||
// .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('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 {
|
||||
getQuotationData = [];
|
||||
@ -275,25 +296,25 @@ class QuotationStaffTabState extends ConsumerState<QuotationStaffTab> {
|
||||
// scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
children: [
|
||||
if (!blockKey) ...[
|
||||
// if (!blockKey && roleId != 'manager') ...[
|
||||
CreateProposalForm(
|
||||
key: ValueKey(selectedQuotationFrmListId ?? "new"),
|
||||
userId: userId,
|
||||
selectedQuotationFrmListdata: selectedQuotationFrmListData,
|
||||
selectedQuotationFrmListId: selectedQuotationFrmListId,
|
||||
managerId: managerId,
|
||||
selectedInsurdId: selectedInsurdId,
|
||||
selectedEnquiryId: selectedEnquiryId,
|
||||
onSubmit: (value) {
|
||||
debugPrint("New Endorsement: $value");
|
||||
if (value == 'Success') {
|
||||
refresh();
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
],
|
||||
// if (!blockKey) ...[
|
||||
// if (!blockKey && roleId != 'manager') ...[
|
||||
CreateProposalForm(
|
||||
key: ValueKey(selectedQuotationFrmListId ?? "new"),
|
||||
userId: userId,
|
||||
selectedQuotationFrmListdata: selectedQuotationFrmListData,
|
||||
selectedQuotationFrmListId: selectedQuotationFrmListId,
|
||||
managerId: managerId,
|
||||
selectedInsurdId: selectedInsurdId,
|
||||
selectedEnquiryId: selectedEnquiryId,
|
||||
onSubmit: (value) {
|
||||
debugPrint("New Endorsement: $value");
|
||||
if (value == 'Success') {
|
||||
refresh();
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
// ],
|
||||
],
|
||||
),
|
||||
// ),
|
||||
|
||||
@ -116,9 +116,9 @@ class TabEnquiryStaffListState extends ConsumerState<TabEnquiryStaffList> {
|
||||
TabItem("Policy", PolicyStaffTab()),
|
||||
];
|
||||
|
||||
if (widget.showKey == "Policy") {
|
||||
tabs.add(TabItem("Policy", PolicyStaffTab()));
|
||||
}
|
||||
// if (widget.showKey == "Policy") {
|
||||
// tabs.add(TabItem("Policy", PolicyStaffTab()));
|
||||
// }
|
||||
|
||||
// if (tabIndex != null) {
|
||||
// selectedIndex = tabIndex;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user