Transactions
This commit is contained in:
parent
072cbf92d6
commit
0f7fee4501
|
|
@ -49,7 +49,7 @@ class InvoiceStatusFields {
|
|||
}
|
||||
|
||||
abstract class InvoiceStatusEntity extends Object
|
||||
with EntityStatus
|
||||
with EntityStatus, SelectableEntity
|
||||
implements Built<InvoiceStatusEntity, InvoiceStatusEntityBuilder> {
|
||||
factory InvoiceStatusEntity() {
|
||||
return _$InvoiceStatusEntity._(
|
||||
|
|
|
|||
|
|
@ -249,3 +249,23 @@ abstract class TransactionEntity extends Object
|
|||
static Serializer<TransactionEntity> get serializer =>
|
||||
_$transactionEntitySerializer;
|
||||
}
|
||||
|
||||
abstract class TransactionStatusEntity extends Object
|
||||
with EntityStatus, SelectableEntity
|
||||
implements Built<TransactionStatusEntity, TransactionStatusEntityBuilder> {
|
||||
factory TransactionStatusEntity() {
|
||||
return _$TransactionStatusEntity._(
|
||||
id: '',
|
||||
name: '',
|
||||
);
|
||||
}
|
||||
|
||||
TransactionStatusEntity._();
|
||||
|
||||
@override
|
||||
@memoized
|
||||
int get hashCode;
|
||||
|
||||
static Serializer<TransactionStatusEntity> get serializer =>
|
||||
_$transactionStatusEntitySerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ Serializer<TransactionItemResponse> _$transactionItemResponseSerializer =
|
|||
new _$TransactionItemResponseSerializer();
|
||||
Serializer<TransactionEntity> _$transactionEntitySerializer =
|
||||
new _$TransactionEntitySerializer();
|
||||
Serializer<TransactionStatusEntity> _$transactionStatusEntitySerializer =
|
||||
new _$TransactionStatusEntitySerializer();
|
||||
|
||||
class _$TransactionListResponseSerializer
|
||||
implements StructuredSerializer<TransactionListResponse> {
|
||||
|
|
@ -270,6 +272,57 @@ class _$TransactionEntitySerializer
|
|||
}
|
||||
}
|
||||
|
||||
class _$TransactionStatusEntitySerializer
|
||||
implements StructuredSerializer<TransactionStatusEntity> {
|
||||
@override
|
||||
final Iterable<Type> types = const [
|
||||
TransactionStatusEntity,
|
||||
_$TransactionStatusEntity
|
||||
];
|
||||
@override
|
||||
final String wireName = 'TransactionStatusEntity';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(
|
||||
Serializers serializers, TransactionStatusEntity object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
'id',
|
||||
serializers.serialize(object.id, specifiedType: const FullType(String)),
|
||||
'name',
|
||||
serializers.serialize(object.name, specifiedType: const FullType(String)),
|
||||
];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
TransactionStatusEntity deserialize(
|
||||
Serializers serializers, Iterable<Object> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new TransactionStatusEntityBuilder();
|
||||
|
||||
final iterator = serialized.iterator;
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
switch (key) {
|
||||
case 'id':
|
||||
result.id = serializers.deserialize(value,
|
||||
specifiedType: const FullType(String)) as String;
|
||||
break;
|
||||
case 'name':
|
||||
result.name = serializers.deserialize(value,
|
||||
specifiedType: const FullType(String)) as String;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
||||
class _$TransactionListResponse extends TransactionListResponse {
|
||||
@override
|
||||
final BuiltList<TransactionEntity> data;
|
||||
|
|
@ -777,4 +830,101 @@ class TransactionEntityBuilder
|
|||
}
|
||||
}
|
||||
|
||||
class _$TransactionStatusEntity extends TransactionStatusEntity {
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String name;
|
||||
|
||||
factory _$TransactionStatusEntity(
|
||||
[void Function(TransactionStatusEntityBuilder) updates]) =>
|
||||
(new TransactionStatusEntityBuilder()..update(updates)).build();
|
||||
|
||||
_$TransactionStatusEntity._({this.id, this.name}) : super._() {
|
||||
BuiltValueNullFieldError.checkNotNull(id, 'TransactionStatusEntity', 'id');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
name, 'TransactionStatusEntity', 'name');
|
||||
}
|
||||
|
||||
@override
|
||||
TransactionStatusEntity rebuild(
|
||||
void Function(TransactionStatusEntityBuilder) updates) =>
|
||||
(toBuilder()..update(updates)).build();
|
||||
|
||||
@override
|
||||
TransactionStatusEntityBuilder toBuilder() =>
|
||||
new TransactionStatusEntityBuilder()..replace(this);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(other, this)) return true;
|
||||
return other is TransactionStatusEntity &&
|
||||
id == other.id &&
|
||||
name == other.name;
|
||||
}
|
||||
|
||||
int __hashCode;
|
||||
@override
|
||||
int get hashCode {
|
||||
return __hashCode ??= $jf($jc($jc(0, id.hashCode), name.hashCode));
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (newBuiltValueToStringHelper('TransactionStatusEntity')
|
||||
..add('id', id)
|
||||
..add('name', name))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class TransactionStatusEntityBuilder
|
||||
implements
|
||||
Builder<TransactionStatusEntity, TransactionStatusEntityBuilder> {
|
||||
_$TransactionStatusEntity _$v;
|
||||
|
||||
String _id;
|
||||
String get id => _$this._id;
|
||||
set id(String id) => _$this._id = id;
|
||||
|
||||
String _name;
|
||||
String get name => _$this._name;
|
||||
set name(String name) => _$this._name = name;
|
||||
|
||||
TransactionStatusEntityBuilder();
|
||||
|
||||
TransactionStatusEntityBuilder get _$this {
|
||||
final $v = _$v;
|
||||
if ($v != null) {
|
||||
_id = $v.id;
|
||||
_name = $v.name;
|
||||
_$v = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@override
|
||||
void replace(TransactionStatusEntity other) {
|
||||
ArgumentError.checkNotNull(other, 'other');
|
||||
_$v = other as _$TransactionStatusEntity;
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(TransactionStatusEntityBuilder) updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_$TransactionStatusEntity build() {
|
||||
final _$result = _$v ??
|
||||
new _$TransactionStatusEntity._(
|
||||
id: BuiltValueNullFieldError.checkNotNull(
|
||||
id, 'TransactionStatusEntity', 'id'),
|
||||
name: BuiltValueNullFieldError.checkNotNull(
|
||||
name, 'TransactionStatusEntity', 'name'));
|
||||
replace(_$result);
|
||||
return _$result;
|
||||
}
|
||||
}
|
||||
|
||||
// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new
|
||||
|
|
|
|||
|
|
@ -84,12 +84,18 @@ List<String> filteredTransactionsSelector(
|
|||
final transaction = transactionMap[transactionId];
|
||||
if (filterEntityId != null && transaction.id != filterEntityId) {
|
||||
return false;
|
||||
} else {}
|
||||
} else {
|
||||
//
|
||||
}
|
||||
|
||||
if (!transaction.matchesStates(transactionListState.stateFilters)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!transaction.matchesStatuses(transactionListState.statusFilters)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return transaction.matchesFilter(transactionListState.filter);
|
||||
}).toList();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
|
|
@ -30,6 +31,24 @@ class TransactionScreen extends StatelessWidget {
|
|||
final userCompany = state.userCompany;
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
final statuses = [
|
||||
TransactionStatusEntity().rebuild(
|
||||
(b) => b
|
||||
..id = kTransactionStatusUnmatched
|
||||
..name = localization.unmatched,
|
||||
),
|
||||
TransactionStatusEntity().rebuild(
|
||||
(b) => b
|
||||
..id = kTransactionStatusMatched
|
||||
..name = localization.matched,
|
||||
),
|
||||
TransactionStatusEntity().rebuild(
|
||||
(b) => b
|
||||
..id = kTransactionStatusConverted
|
||||
..name = localization.converted,
|
||||
),
|
||||
];
|
||||
|
||||
return ListScaffold(
|
||||
entityType: EntityType.transaction,
|
||||
onHamburgerLongPress: () => store.dispatch(StartTransactionMultiselect()),
|
||||
|
|
@ -85,6 +104,7 @@ class TransactionScreen extends StatelessWidget {
|
|||
store.dispatch(FilterTransactionsByCustom3(value)),
|
||||
onSelectedCustom4: (value) =>
|
||||
store.dispatch(FilterTransactionsByCustom4(value)),
|
||||
statuses: statuses,
|
||||
),
|
||||
floatingActionButton: state.prefState.isMenuFloated &&
|
||||
userCompany.canCreate(EntityType.transaction)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'matched': 'Matched',
|
||||
'unmatched': 'Unmatched',
|
||||
'create_credit': 'Create Credit',
|
||||
'update_credit': 'Update Credit',
|
||||
'delete_credit': 'Delete Credit',
|
||||
|
|
@ -87302,6 +87304,14 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
_localizedValues[localeCode]['delete_credit'] ??
|
||||
_localizedValues['en']['delete_credit'];
|
||||
|
||||
String get matched =>
|
||||
_localizedValues[localeCode]['matched'] ??
|
||||
_localizedValues['en']['matched'];
|
||||
|
||||
String get unmatched =>
|
||||
_localizedValues[localeCode]['unmatched'] ??
|
||||
_localizedValues['en']['unmatched'];
|
||||
|
||||
// STARTER: lang field - do not remove comment
|
||||
|
||||
String lookup(String key) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue