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