update invoice section show download option
This commit is contained in:
@@ -4,55 +4,30 @@ class InvoiceService {
|
||||
final Dio dio;
|
||||
InvoiceService(this.dio);
|
||||
|
||||
// -------------------------------------------------------
|
||||
// ⭐ GET ALL INVOICES
|
||||
// -------------------------------------------------------
|
||||
Future<Map<String, dynamic>> getAllInvoices() async {
|
||||
try {
|
||||
final res = await dio.get("/user/invoices");
|
||||
|
||||
print("🔵 ALL INVOICES RESPONSE:");
|
||||
print(res.data);
|
||||
|
||||
return Map<String, dynamic>.from(res.data);
|
||||
} catch (e) {
|
||||
print("❌ ERROR (All Invoices): $e");
|
||||
return {"success": false, "message": e.toString()};
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
// ⭐ GET INSTALLMENTS
|
||||
// -------------------------------------------------------
|
||||
Future<Map<String, dynamic>> getInstallments(int invoiceId) async {
|
||||
try {
|
||||
final res =
|
||||
await dio.get("/user/invoice/$invoiceId/installments");
|
||||
|
||||
print("🔵 INSTALLMENTS RESPONSE:");
|
||||
print(res.data);
|
||||
|
||||
final res = await dio.get("/user/invoice/$invoiceId/installments");
|
||||
return Map<String, dynamic>.from(res.data);
|
||||
} catch (e) {
|
||||
print("❌ ERROR (Installments): $e");
|
||||
return {"success": false, "message": e.toString()};
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
// ⭐ GET FULL INVOICE DETAILS (PRINT JSON HERE)
|
||||
// -------------------------------------------------------
|
||||
/// 🔵 NEW FUNCTION — Fetch Full Invoice Details
|
||||
Future<Map<String, dynamic>> getInvoiceDetails(int invoiceId) async {
|
||||
try {
|
||||
final res = await dio.get("/user/invoice/$invoiceId/details");
|
||||
|
||||
print("👇👇👇 INVOICE API RESPONSE START 👇👇👇");
|
||||
print(res.data); // <-- THIS IS WHAT YOU NEED
|
||||
print("👆👆👆 INVOICE API RESPONSE END 👆👆👆");
|
||||
|
||||
return Map<String, dynamic>.from(res.data);
|
||||
} catch (e) {
|
||||
print("❌ ERROR (Invoice Details): $e");
|
||||
return {"success": false, "message": e.toString()};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user