Reports
This commit is contained in:
parent
6cfbf3b24a
commit
d67ddcad86
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
|
|
@ -53,8 +52,7 @@ class ReportsScreen extends StatelessWidget {
|
|||
? null
|
||||
: IconButton(
|
||||
icon: Icon(Icons.menu),
|
||||
onPressed: () =>
|
||||
store
|
||||
onPressed: () => store
|
||||
.dispatch(UserSettingsChanged(sidebar: AppSidebar.menu)),
|
||||
),
|
||||
title: Row(
|
||||
|
|
@ -94,8 +92,7 @@ class ReportsScreen extends StatelessWidget {
|
|||
kReportTaxRate,
|
||||
kReportQuote,
|
||||
]
|
||||
.map((report) =>
|
||||
DropdownMenuItem(
|
||||
.map((report) => DropdownMenuItem(
|
||||
value: report,
|
||||
child: Text(localization.lookup(report)),
|
||||
))
|
||||
|
|
@ -238,6 +235,13 @@ class _ReportDataTableState extends State<ReportDataTable> {
|
|||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: DataTable(
|
||||
sortColumnIndex: state.userCompany.settings
|
||||
.reportSettings[state.uiState.reportsUIState.report].sortIndex,
|
||||
sortAscending: state
|
||||
.userCompany
|
||||
.settings
|
||||
.reportSettings[state.uiState.reportsUIState.report]
|
||||
.sortAscending,
|
||||
columns: reportResult.tableColumns(
|
||||
context,
|
||||
(index, ascending) =>
|
||||
|
|
@ -271,8 +275,8 @@ class ReportResult {
|
|||
final List<String> allColumns;
|
||||
final List<List<ReportElement>> data;
|
||||
|
||||
List<DataColumn> tableColumns(BuildContext context,
|
||||
Function(int, bool) onSortCallback) {
|
||||
List<DataColumn> tableColumns(
|
||||
BuildContext context, Function(int, bool) onSortCallback) {
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
return [
|
||||
|
|
@ -288,11 +292,15 @@ class ReportResult {
|
|||
];
|
||||
}
|
||||
|
||||
DataRow tableFilters(BuildContext context,
|
||||
DataRow tableFilters(
|
||||
BuildContext context,
|
||||
Map<String, TextEditingController> textEditingControllers,
|
||||
Function(String, String) onFilterChanged) {
|
||||
return DataRow(cells: [
|
||||
for (String column in columns)
|
||||
if (['updated_at', 'created_at'].contains(column))
|
||||
DataCell(Text(column))
|
||||
else
|
||||
DataCell(TypeAheadFormField(
|
||||
noItemsFoundBuilder: (context) => SizedBox(),
|
||||
suggestionsBoxDecoration: SuggestionsBoxDecoration(
|
||||
|
|
@ -306,10 +314,7 @@ class ReportResult {
|
|||
return data
|
||||
.where((row) =>
|
||||
row[index].sortString().toLowerCase().contains(filter) &&
|
||||
row[index]
|
||||
.sortString()
|
||||
.trim()
|
||||
.isNotEmpty)
|
||||
row[index].sortString().trim().isNotEmpty)
|
||||
.map((row) => row[index].sortString())
|
||||
.toSet()
|
||||
.toList();
|
||||
|
|
@ -327,7 +332,8 @@ class ReportResult {
|
|||
textFieldConfiguration: TextFieldConfiguration<String>(
|
||||
controller: textEditingControllers[column],
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: (textEditingControllers[column]?.text ?? '').isEmpty
|
||||
suffixIcon:
|
||||
(textEditingControllers[column]?.text ?? '').isEmpty
|
||||
? null
|
||||
: IconButton(
|
||||
icon: Icon(
|
||||
|
|
@ -353,8 +359,7 @@ class ReportResult {
|
|||
DataRow(
|
||||
cells: row
|
||||
.map(
|
||||
(row) =>
|
||||
DataCell(
|
||||
(row) => DataCell(
|
||||
row.renderWidget(context),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue