add auth, format
This commit is contained in:
@@ -27,7 +27,9 @@ class InvoicesLocalDataSource {
|
||||
.map((json) => InvoiceModel.fromJson(json as Map<String, dynamic>))
|
||||
.toList();
|
||||
|
||||
debugPrint('[InvoicesLocalDataSource] Loaded ${invoices.length} invoices');
|
||||
debugPrint(
|
||||
'[InvoicesLocalDataSource] Loaded ${invoices.length} invoices',
|
||||
);
|
||||
return invoices;
|
||||
} catch (e, stackTrace) {
|
||||
debugPrint('[InvoicesLocalDataSource] Error loading invoices: $e');
|
||||
@@ -65,8 +67,11 @@ class InvoicesLocalDataSource {
|
||||
final filtered = allInvoices
|
||||
.where(
|
||||
(invoice) =>
|
||||
invoice.invoiceNumber.toLowerCase().contains(query.toLowerCase()) ||
|
||||
(invoice.orderId?.toLowerCase().contains(query.toLowerCase()) ?? false),
|
||||
invoice.invoiceNumber.toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
) ||
|
||||
(invoice.orderId?.toLowerCase().contains(query.toLowerCase()) ??
|
||||
false),
|
||||
)
|
||||
.toList();
|
||||
|
||||
@@ -89,7 +94,9 @@ class InvoicesLocalDataSource {
|
||||
orElse: () => throw Exception('Invoice not found: $invoiceId'),
|
||||
);
|
||||
|
||||
debugPrint('[InvoicesLocalDataSource] Found invoice: ${invoice.invoiceNumber}');
|
||||
debugPrint(
|
||||
'[InvoicesLocalDataSource] Found invoice: ${invoice.invoiceNumber}',
|
||||
);
|
||||
return invoice;
|
||||
} catch (e) {
|
||||
debugPrint('[InvoicesLocalDataSource] Error getting invoice: $e');
|
||||
@@ -105,10 +112,14 @@ class InvoicesLocalDataSource {
|
||||
.where((invoice) => invoice.isOverdue)
|
||||
.toList();
|
||||
|
||||
debugPrint('[InvoicesLocalDataSource] Found ${overdue.length} overdue invoices');
|
||||
debugPrint(
|
||||
'[InvoicesLocalDataSource] Found ${overdue.length} overdue invoices',
|
||||
);
|
||||
return overdue;
|
||||
} catch (e) {
|
||||
debugPrint('[InvoicesLocalDataSource] Error getting overdue invoices: $e');
|
||||
debugPrint(
|
||||
'[InvoicesLocalDataSource] Error getting overdue invoices: $e',
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
@@ -118,10 +129,14 @@ class InvoicesLocalDataSource {
|
||||
try {
|
||||
final allInvoices = await getAllInvoices();
|
||||
final unpaid = allInvoices
|
||||
.where((invoice) => invoice.status.name == 'issued' && !invoice.isPaid)
|
||||
.where(
|
||||
(invoice) => invoice.status.name == 'issued' && !invoice.isPaid,
|
||||
)
|
||||
.toList();
|
||||
|
||||
debugPrint('[InvoicesLocalDataSource] Found ${unpaid.length} unpaid invoices');
|
||||
debugPrint(
|
||||
'[InvoicesLocalDataSource] Found ${unpaid.length} unpaid invoices',
|
||||
);
|
||||
return unpaid;
|
||||
} catch (e) {
|
||||
debugPrint('[InvoicesLocalDataSource] Error getting unpaid invoices: $e');
|
||||
|
||||
Reference in New Issue
Block a user