fixed the make expense button display issue on creaying expense also

This commit is contained in:
Vaibhav Surve 2025-11-11 19:34:54 +05:30
parent 44bbbf9bfb
commit be2f97cc0e

View File

@ -333,32 +333,35 @@ class PaymentRequestDetailController extends GetxController {
isSubmitting.value = true; isSubmitting.value = true;
try { try {
// Prepare attachments with all required fields // prepare attachments
final attachmentsPayload = attachments.map((file) { final success = await ApiService.createExpenseForPRApi(
final bytes = file.readAsBytesSync();
final mimeType =
lookupMimeType(file.path) ?? 'application/octet-stream';
return {
"fileName": file.path.split('/').last,
"base64Data": base64Encode(bytes),
"contentType": mimeType,
"description": "",
"fileSize": bytes.length,
"isActive": true,
};
}).toList();
// Call API
return await ApiService.createExpenseForPRApi(
paymentModeId: selectedPaymentMode.value!.id, paymentModeId: selectedPaymentMode.value!.id,
location: locationController.text, location: locationController.text,
gstNumber: gstNumberController.text, gstNumber: gstNumberController.text,
paymentRequestId: _requestId, paymentRequestId: _requestId,
billAttachments: attachmentsPayload, billAttachments: attachments.map((file) {
final bytes = file.readAsBytesSync();
final mimeType =
lookupMimeType(file.path) ?? 'application/octet-stream';
return {
"fileName": file.path.split('/').last,
"base64Data": base64Encode(bytes),
"contentType": mimeType,
"description": "",
"fileSize": bytes.length,
"isActive": true,
};
}).toList(),
statusId: statusId, statusId: statusId,
comment: comment ?? '', comment: comment ?? '',
); );
if (success) {
// Refresh the payment request details so the UI updates
await fetchPaymentRequestDetail();
}
return success;
} finally { } finally {
isSubmitting.value = false; isSubmitting.value = false;
} }