Schedule reports
This commit is contained in:
parent
7461a02151
commit
ac35e9c031
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'package:invoiceninja_flutter/data/models/import_model.dart';
|
||||||
|
|
||||||
class Constants {
|
class Constants {
|
||||||
//static String get hostedApiUrl => kReleaseMode ? kAppProductionUrl : kAppStagingUrl;
|
//static String get hostedApiUrl => kReleaseMode ? kAppProductionUrl : kAppStagingUrl;
|
||||||
static String get hostedApiUrl => kAppProductionUrl;
|
static String get hostedApiUrl => kAppProductionUrl;
|
||||||
|
|
@ -682,6 +684,32 @@ const String kReportPurchaseOrderItem = 'purchase_order_item';
|
||||||
const String kReportVendor = 'vendor';
|
const String kReportVendor = 'vendor';
|
||||||
const String kReportTransaction = 'transaction';
|
const String kReportTransaction = 'transaction';
|
||||||
|
|
||||||
|
final kReportMap = {
|
||||||
|
kReportClient: ExportType.clients,
|
||||||
|
kReportClientContact: ExportType.client_contacts,
|
||||||
|
kReportCredit: ExportType.credits,
|
||||||
|
kReportCreditItem: null,
|
||||||
|
kReportDocument: ExportType.documents,
|
||||||
|
kReportExpense: ExportType.expenses,
|
||||||
|
kReportInvoice: ExportType.invoices,
|
||||||
|
kReportPayment: ExportType.payments,
|
||||||
|
kReportProduct: ExportType.products,
|
||||||
|
kReportProfitAndLoss: ExportType.profitloss,
|
||||||
|
kReportTask: ExportType.tasks,
|
||||||
|
kReportTaskItem: null,
|
||||||
|
kReportInvoiceTax: ExportType.tax_summary,
|
||||||
|
kReportPaymentTax: null,
|
||||||
|
kReportQuote: ExportType.quotes,
|
||||||
|
kReportInvoiceItem: ExportType.invoice_items,
|
||||||
|
kReportQuoteItem: ExportType.quote_items,
|
||||||
|
kReportRecurringExpense: null,
|
||||||
|
kReportRecurringInvoice: ExportType.recurring_invoices,
|
||||||
|
kReportPurchaseOrder: null,
|
||||||
|
kReportPurchaseOrderItem: null,
|
||||||
|
kReportVendor: null,
|
||||||
|
kReportTransaction: null,
|
||||||
|
};
|
||||||
|
|
||||||
const String kPdfFieldsClientDetails = 'client_details';
|
const String kPdfFieldsClientDetails = 'client_details';
|
||||||
const String kPdfFieldsCompanyDetails = 'company_details';
|
const String kPdfFieldsCompanyDetails = 'company_details';
|
||||||
const String kPdfFieldsCompanyAddress = 'company_address';
|
const String kPdfFieldsCompanyAddress = 'company_address';
|
||||||
|
|
|
||||||
|
|
@ -385,6 +385,13 @@ class ReportsScreen extends StatelessWidget {
|
||||||
viewModel.onExportPressed(context);
|
viewModel.onExportPressed(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
AppTextButton(
|
||||||
|
label: localization.schedule,
|
||||||
|
isInHeader: true,
|
||||||
|
onPressed: () {
|
||||||
|
viewModel.onSchedulePressed(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: 8),
|
padding: const EdgeInsets.only(right: 8),
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ import 'package:flutter/widgets.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/models/import_model.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/models/schedule_model.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/reports/credit_item_report.dart';
|
import 'package:invoiceninja_flutter/ui/reports/credit_item_report.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/reports/purchase_order_item_report.dart';
|
import 'package:invoiceninja_flutter/ui/reports/purchase_order_item_report.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/reports/purchase_order_report.dart';
|
import 'package:invoiceninja_flutter/ui/reports/purchase_order_report.dart';
|
||||||
|
|
@ -81,6 +84,7 @@ class ReportsScreenVM {
|
||||||
required this.onReportColumnsChanged,
|
required this.onReportColumnsChanged,
|
||||||
required this.onReportFiltersChanged,
|
required this.onReportFiltersChanged,
|
||||||
required this.onExportPressed,
|
required this.onExportPressed,
|
||||||
|
required this.onSchedulePressed,
|
||||||
required this.onReportSorted,
|
required this.onReportSorted,
|
||||||
required this.groupTotals,
|
required this.groupTotals,
|
||||||
required this.reportResult,
|
required this.reportResult,
|
||||||
|
|
@ -94,6 +98,7 @@ class ReportsScreenVM {
|
||||||
final GroupTotals groupTotals;
|
final GroupTotals groupTotals;
|
||||||
final Function(BuildContext, List<String>) onReportColumnsChanged;
|
final Function(BuildContext, List<String>) onReportColumnsChanged;
|
||||||
final Function(BuildContext) onExportPressed;
|
final Function(BuildContext) onExportPressed;
|
||||||
|
final Function(BuildContext) onSchedulePressed;
|
||||||
final Function(BuildContext, BuiltMap<String?, String?>)
|
final Function(BuildContext, BuiltMap<String?, String?>)
|
||||||
onReportFiltersChanged;
|
onReportFiltersChanged;
|
||||||
final Function(String?, bool) onReportSorted;
|
final Function(String?, bool) onReportSorted;
|
||||||
|
|
@ -457,6 +462,13 @@ class ReportsScreenVM {
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
onSchedulePressed: (context) async {
|
||||||
|
createEntity(
|
||||||
|
entity: ScheduleEntity(ScheduleEntity.TEMPLATE_EMAIL_REPORT)
|
||||||
|
.rebuild((b) => b
|
||||||
|
..parameters.reportName =
|
||||||
|
kReportMap[report]?.name ?? ExportType.invoices.name));
|
||||||
|
},
|
||||||
onExportPressed: (context) async {
|
onExportPressed: (context) async {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
final reportState = state.uiState.reportsUIState;
|
final reportState = state.uiState.reportsUIState;
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ class ScheduleListItem extends StatelessWidget {
|
||||||
}
|
}
|
||||||
subtitle +=
|
subtitle +=
|
||||||
' • ' + localization.lookup(kFrequencies[schedule.frequencyId]);
|
' • ' + localization.lookup(kFrequencies[schedule.frequencyId]);
|
||||||
|
} else if (schedule.template == ScheduleEntity.TEMPLATE_EMAIL_REPORT) {
|
||||||
|
title += ': ' + localization.lookup(schedule.parameters.reportName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DismissibleEntity(
|
return DismissibleEntity(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue