Improve documents
This commit is contained in:
parent
aa7496714f
commit
3eac70a4e6
|
|
@ -23,6 +23,7 @@ final forceSelectedReducer = combineReducers<bool>([
|
||||||
TypedReducer<bool, ViewDocument>((completer, action) => true),
|
TypedReducer<bool, ViewDocument>((completer, action) => true),
|
||||||
TypedReducer<bool, ViewDocumentList>((completer, action) => false),
|
TypedReducer<bool, ViewDocumentList>((completer, action) => false),
|
||||||
TypedReducer<bool, FilterDocumentsByState>((completer, action) => false),
|
TypedReducer<bool, FilterDocumentsByState>((completer, action) => false),
|
||||||
|
TypedReducer<bool, FilterDocumentsByStatus>((completer, action) => false),
|
||||||
TypedReducer<bool, FilterDocuments>((completer, action) => false),
|
TypedReducer<bool, FilterDocuments>((completer, action) => false),
|
||||||
TypedReducer<bool, FilterDocumentsByCustom1>((completer, action) => false),
|
TypedReducer<bool, FilterDocumentsByCustom1>((completer, action) => false),
|
||||||
TypedReducer<bool, FilterDocumentsByCustom2>((completer, action) => false),
|
TypedReducer<bool, FilterDocumentsByCustom2>((completer, action) => false),
|
||||||
|
|
@ -43,6 +44,7 @@ Reducer<String> selectedIdReducer = combineReducers([
|
||||||
TypedReducer<String, SortDocuments>((selectedId, action) => ''),
|
TypedReducer<String, SortDocuments>((selectedId, action) => ''),
|
||||||
TypedReducer<String, FilterDocuments>((selectedId, action) => ''),
|
TypedReducer<String, FilterDocuments>((selectedId, action) => ''),
|
||||||
TypedReducer<String, FilterDocumentsByState>((selectedId, action) => ''),
|
TypedReducer<String, FilterDocumentsByState>((selectedId, action) => ''),
|
||||||
|
TypedReducer<String, FilterDocumentsByStatus>((selectedId, action) => ''),
|
||||||
TypedReducer<String, FilterDocumentsByCustom1>((selectedId, action) => ''),
|
TypedReducer<String, FilterDocumentsByCustom1>((selectedId, action) => ''),
|
||||||
TypedReducer<String, FilterDocumentsByCustom2>((selectedId, action) => ''),
|
TypedReducer<String, FilterDocumentsByCustom2>((selectedId, action) => ''),
|
||||||
TypedReducer<String, FilterDocumentsByCustom3>((selectedId, action) => ''),
|
TypedReducer<String, FilterDocumentsByCustom3>((selectedId, action) => ''),
|
||||||
|
|
@ -68,6 +70,7 @@ DocumentEntity _updateEditing(DocumentEntity document, dynamic action) {
|
||||||
final documentListReducer = combineReducers<ListUIState>([
|
final documentListReducer = combineReducers<ListUIState>([
|
||||||
TypedReducer<ListUIState, SortDocuments>(_sortDocuments),
|
TypedReducer<ListUIState, SortDocuments>(_sortDocuments),
|
||||||
TypedReducer<ListUIState, FilterDocumentsByState>(_filterDocumentsByState),
|
TypedReducer<ListUIState, FilterDocumentsByState>(_filterDocumentsByState),
|
||||||
|
TypedReducer<ListUIState, FilterDocumentsByStatus>(_filterDocumentsByStatus),
|
||||||
TypedReducer<ListUIState, FilterDocuments>(_filterDocuments),
|
TypedReducer<ListUIState, FilterDocuments>(_filterDocuments),
|
||||||
TypedReducer<ListUIState, FilterDocumentsByCustom1>(
|
TypedReducer<ListUIState, FilterDocumentsByCustom1>(
|
||||||
_filterDocumentsByCustom1),
|
_filterDocumentsByCustom1),
|
||||||
|
|
@ -125,6 +128,17 @@ ListUIState _filterDocumentsByState(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListUIState _filterDocumentsByStatus(
|
||||||
|
ListUIState documentListState, FilterDocumentsByStatus action) {
|
||||||
|
if (documentListState.statusFilters.contains(action.status)) {
|
||||||
|
return documentListState
|
||||||
|
.rebuild((b) => b..statusFilters.remove(action.status));
|
||||||
|
} else {
|
||||||
|
return documentListState
|
||||||
|
.rebuild((b) => b..statusFilters.add(action.status));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ListUIState _filterDocuments(
|
ListUIState _filterDocuments(
|
||||||
ListUIState documentListState, FilterDocuments action) {
|
ListUIState documentListState, FilterDocuments action) {
|
||||||
return documentListState.rebuild((b) => b
|
return documentListState.rebuild((b) => b
|
||||||
|
|
|
||||||
|
|
@ -142,9 +142,8 @@ class _ListFilterState extends State<ListFilter> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (isDesktop(context) &&
|
if (isDesktop(context) && !isDashboardOrSettings) ...[
|
||||||
!isDashboardOrSettings &&
|
if (widget.onSelectedState != null) ...[
|
||||||
widget.onSelectedState != null) ...[
|
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: DropDownMultiSelect(
|
child: DropDownMultiSelect(
|
||||||
|
|
@ -154,10 +153,10 @@ class _ListFilterState extends State<ListFilter> {
|
||||||
.stateFilters
|
.stateFilters
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final added =
|
final added = selected
|
||||||
selected.where((dynamic e) => !stateFilters.contains(e));
|
.where((dynamic e) => !stateFilters.contains(e));
|
||||||
final removed =
|
final removed = stateFilters
|
||||||
stateFilters.where((dynamic e) => !selected.contains(e));
|
.where((dynamic e) => !selected.contains(e));
|
||||||
|
|
||||||
for (var state in added) {
|
for (var state in added) {
|
||||||
widget.onSelectedState(state, true);
|
widget.onSelectedState(state, true);
|
||||||
|
|
@ -177,8 +176,10 @@ class _ListFilterState extends State<ListFilter> {
|
||||||
contentPadding:
|
contentPadding:
|
||||||
EdgeInsets.symmetric(vertical: 13, horizontal: 10),
|
EdgeInsets.symmetric(vertical: 13, horizontal: 10),
|
||||||
),
|
),
|
||||||
selectedValues:
|
selectedValues: state
|
||||||
state.getListState(widget.entityType).stateFilters.toList(),
|
.getListState(widget.entityType)
|
||||||
|
.stateFilters
|
||||||
|
.toList(),
|
||||||
whenEmpty: localization.all,
|
whenEmpty: localization.all,
|
||||||
menuItembuilder: (dynamic value) {
|
menuItembuilder: (dynamic value) {
|
||||||
final state = value as EntityState;
|
final state = value as EntityState;
|
||||||
|
|
@ -205,6 +206,7 @@ class _ListFilterState extends State<ListFilter> {
|
||||||
alignment: Alignment.centerLeft);
|
alignment: Alignment.centerLeft);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
if (widget.statuses != null) ...[
|
if (widget.statuses != null) ...[
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Flexible(
|
Flexible(
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import 'package:invoiceninja_flutter/constants.dart';
|
||||||
|
|
||||||
// Project imports:
|
// Project imports:
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/models/static/document_status_model.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
|
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
|
||||||
|
|
@ -36,27 +37,27 @@ class DocumentScreen extends StatelessWidget {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
|
||||||
final statuses = [
|
final statuses = [
|
||||||
InvoiceStatusEntity().rebuild(
|
DocumentStatusEntity().rebuild(
|
||||||
(b) => b
|
(b) => b
|
||||||
..id = kDocumentStatusPublic
|
..id = kDocumentStatusPublic
|
||||||
..name = localization.public,
|
..name = localization.public,
|
||||||
),
|
),
|
||||||
InvoiceStatusEntity().rebuild(
|
DocumentStatusEntity().rebuild(
|
||||||
(b) => b
|
(b) => b
|
||||||
..id = kDocumentStatusPrivate
|
..id = kDocumentStatusPrivate
|
||||||
..name = localization.private,
|
..name = localization.private,
|
||||||
),
|
),
|
||||||
InvoiceStatusEntity().rebuild(
|
DocumentStatusEntity().rebuild(
|
||||||
(b) => b
|
(b) => b
|
||||||
..id = kDocumentStatusImage
|
..id = kDocumentStatusImage
|
||||||
..name = localization.image,
|
..name = localization.image,
|
||||||
),
|
),
|
||||||
InvoiceStatusEntity().rebuild(
|
DocumentStatusEntity().rebuild(
|
||||||
(b) => b
|
(b) => b
|
||||||
..id = kDocumentStatusPDF
|
..id = kDocumentStatusPDF
|
||||||
..name = localization.pdf,
|
..name = localization.pdf,
|
||||||
),
|
),
|
||||||
InvoiceStatusEntity().rebuild(
|
DocumentStatusEntity().rebuild(
|
||||||
(b) => b
|
(b) => b
|
||||||
..id = kDocumentStatusOther
|
..id = kDocumentStatusOther
|
||||||
..name = localization.other,
|
..name = localization.other,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue