Settings
This commit is contained in:
parent
d735752f3e
commit
75951bae10
|
|
@ -246,10 +246,10 @@ abstract class CompanyEntity extends Object
|
||||||
|
|
||||||
if (data.length == 1) {
|
if (data.length == 1) {
|
||||||
final first = data.first;
|
final first = data.first;
|
||||||
if (first == kFieldTypeSwitch) {
|
if (first == kFieldTypeSwitch || first == kFieldTypeDate) {
|
||||||
return [getCustomFieldLabel(field)];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (excludeBlank) {
|
if (excludeBlank) {
|
||||||
return data.where((data) => data.isNotEmpty).toList();
|
return data.where((data) => data.isNotEmpty).toList();
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,6 @@ abstract class GroupEntity extends Object
|
||||||
isChanged: false,
|
isChanged: false,
|
||||||
name: '',
|
name: '',
|
||||||
settings: SettingsEntity(),
|
settings: SettingsEntity(),
|
||||||
customValue1: '',
|
|
||||||
customValue2: '',
|
|
||||||
updatedAt: 0,
|
updatedAt: 0,
|
||||||
archivedAt: 0,
|
archivedAt: 0,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
|
|
@ -67,16 +65,6 @@ abstract class GroupEntity extends Object
|
||||||
|
|
||||||
String get name;
|
String get name;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
|
||||||
@BuiltValueField(wireName: 'custom_value1')
|
|
||||||
String get customValue1;
|
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
|
||||||
@BuiltValueField(wireName: 'custom_value2')
|
|
||||||
String get customValue2;
|
|
||||||
|
|
||||||
SettingsEntity get settings;
|
SettingsEntity get settings;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -115,18 +115,6 @@ class _$GroupEntitySerializer implements StructuredSerializer<GroupEntity> {
|
||||||
serializers.serialize(object.settings,
|
serializers.serialize(object.settings,
|
||||||
specifiedType: const FullType(SettingsEntity)),
|
specifiedType: const FullType(SettingsEntity)),
|
||||||
];
|
];
|
||||||
if (object.customValue1 != null) {
|
|
||||||
result
|
|
||||||
..add('custom_value1')
|
|
||||||
..add(serializers.serialize(object.customValue1,
|
|
||||||
specifiedType: const FullType(String)));
|
|
||||||
}
|
|
||||||
if (object.customValue2 != null) {
|
|
||||||
result
|
|
||||||
..add('custom_value2')
|
|
||||||
..add(serializers.serialize(object.customValue2,
|
|
||||||
specifiedType: const FullType(String)));
|
|
||||||
}
|
|
||||||
if (object.isChanged != null) {
|
if (object.isChanged != null) {
|
||||||
result
|
result
|
||||||
..add('isChanged')
|
..add('isChanged')
|
||||||
|
|
@ -193,14 +181,6 @@ class _$GroupEntitySerializer implements StructuredSerializer<GroupEntity> {
|
||||||
result.name = serializers.deserialize(value,
|
result.name = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
break;
|
break;
|
||||||
case 'custom_value1':
|
|
||||||
result.customValue1 = serializers.deserialize(value,
|
|
||||||
specifiedType: const FullType(String)) as String;
|
|
||||||
break;
|
|
||||||
case 'custom_value2':
|
|
||||||
result.customValue2 = serializers.deserialize(value,
|
|
||||||
specifiedType: const FullType(String)) as String;
|
|
||||||
break;
|
|
||||||
case 'settings':
|
case 'settings':
|
||||||
result.settings.replace(serializers.deserialize(value,
|
result.settings.replace(serializers.deserialize(value,
|
||||||
specifiedType: const FullType(SettingsEntity)) as SettingsEntity);
|
specifiedType: const FullType(SettingsEntity)) as SettingsEntity);
|
||||||
|
|
@ -433,10 +413,6 @@ class _$GroupEntity extends GroupEntity {
|
||||||
@override
|
@override
|
||||||
final String name;
|
final String name;
|
||||||
@override
|
@override
|
||||||
final String customValue1;
|
|
||||||
@override
|
|
||||||
final String customValue2;
|
|
||||||
@override
|
|
||||||
final SettingsEntity settings;
|
final SettingsEntity settings;
|
||||||
@override
|
@override
|
||||||
final bool isChanged;
|
final bool isChanged;
|
||||||
|
|
@ -460,8 +436,6 @@ class _$GroupEntity extends GroupEntity {
|
||||||
|
|
||||||
_$GroupEntity._(
|
_$GroupEntity._(
|
||||||
{this.name,
|
{this.name,
|
||||||
this.customValue1,
|
|
||||||
this.customValue2,
|
|
||||||
this.settings,
|
this.settings,
|
||||||
this.isChanged,
|
this.isChanged,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
|
|
@ -492,8 +466,6 @@ class _$GroupEntity extends GroupEntity {
|
||||||
if (identical(other, this)) return true;
|
if (identical(other, this)) return true;
|
||||||
return other is GroupEntity &&
|
return other is GroupEntity &&
|
||||||
name == other.name &&
|
name == other.name &&
|
||||||
customValue1 == other.customValue1 &&
|
|
||||||
customValue2 == other.customValue2 &&
|
|
||||||
settings == other.settings &&
|
settings == other.settings &&
|
||||||
isChanged == other.isChanged &&
|
isChanged == other.isChanged &&
|
||||||
createdAt == other.createdAt &&
|
createdAt == other.createdAt &&
|
||||||
|
|
@ -515,11 +487,7 @@ class _$GroupEntity extends GroupEntity {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc($jc(0, name.hashCode),
|
||||||
$jc(
|
|
||||||
$jc($jc(0, name.hashCode),
|
|
||||||
customValue1.hashCode),
|
|
||||||
customValue2.hashCode),
|
|
||||||
settings.hashCode),
|
settings.hashCode),
|
||||||
isChanged.hashCode),
|
isChanged.hashCode),
|
||||||
createdAt.hashCode),
|
createdAt.hashCode),
|
||||||
|
|
@ -535,8 +503,6 @@ class _$GroupEntity extends GroupEntity {
|
||||||
String toString() {
|
String toString() {
|
||||||
return (newBuiltValueToStringHelper('GroupEntity')
|
return (newBuiltValueToStringHelper('GroupEntity')
|
||||||
..add('name', name)
|
..add('name', name)
|
||||||
..add('customValue1', customValue1)
|
|
||||||
..add('customValue2', customValue2)
|
|
||||||
..add('settings', settings)
|
..add('settings', settings)
|
||||||
..add('isChanged', isChanged)
|
..add('isChanged', isChanged)
|
||||||
..add('createdAt', createdAt)
|
..add('createdAt', createdAt)
|
||||||
|
|
@ -557,14 +523,6 @@ class GroupEntityBuilder implements Builder<GroupEntity, GroupEntityBuilder> {
|
||||||
String get name => _$this._name;
|
String get name => _$this._name;
|
||||||
set name(String name) => _$this._name = name;
|
set name(String name) => _$this._name = name;
|
||||||
|
|
||||||
String _customValue1;
|
|
||||||
String get customValue1 => _$this._customValue1;
|
|
||||||
set customValue1(String customValue1) => _$this._customValue1 = customValue1;
|
|
||||||
|
|
||||||
String _customValue2;
|
|
||||||
String get customValue2 => _$this._customValue2;
|
|
||||||
set customValue2(String customValue2) => _$this._customValue2 = customValue2;
|
|
||||||
|
|
||||||
SettingsEntityBuilder _settings;
|
SettingsEntityBuilder _settings;
|
||||||
SettingsEntityBuilder get settings =>
|
SettingsEntityBuilder get settings =>
|
||||||
_$this._settings ??= new SettingsEntityBuilder();
|
_$this._settings ??= new SettingsEntityBuilder();
|
||||||
|
|
@ -609,8 +567,6 @@ class GroupEntityBuilder implements Builder<GroupEntity, GroupEntityBuilder> {
|
||||||
GroupEntityBuilder get _$this {
|
GroupEntityBuilder get _$this {
|
||||||
if (_$v != null) {
|
if (_$v != null) {
|
||||||
_name = _$v.name;
|
_name = _$v.name;
|
||||||
_customValue1 = _$v.customValue1;
|
|
||||||
_customValue2 = _$v.customValue2;
|
|
||||||
_settings = _$v.settings?.toBuilder();
|
_settings = _$v.settings?.toBuilder();
|
||||||
_isChanged = _$v.isChanged;
|
_isChanged = _$v.isChanged;
|
||||||
_createdAt = _$v.createdAt;
|
_createdAt = _$v.createdAt;
|
||||||
|
|
@ -645,8 +601,6 @@ class GroupEntityBuilder implements Builder<GroupEntity, GroupEntityBuilder> {
|
||||||
_$result = _$v ??
|
_$result = _$v ??
|
||||||
new _$GroupEntity._(
|
new _$GroupEntity._(
|
||||||
name: name,
|
name: name,
|
||||||
customValue1: customValue1,
|
|
||||||
customValue2: customValue2,
|
|
||||||
settings: settings.build(),
|
settings: settings.build(),
|
||||||
isChanged: isChanged,
|
isChanged: isChanged,
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,14 @@ List<String> filteredClientsSelector(
|
||||||
!clientListState.custom2Filters.contains(client.customValue2)) {
|
!clientListState.custom2Filters.contains(client.customValue2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (clientListState.custom3Filters.isNotEmpty &&
|
||||||
|
!clientListState.custom3Filters.contains(client.customValue3)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (clientListState.custom4Filters.isNotEmpty &&
|
||||||
|
!clientListState.custom4Filters.contains(client.customValue4)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!client.matchesFilter(clientListState.filter) &&
|
if (!client.matchesFilter(clientListState.filter) &&
|
||||||
!group.matchesFilter(clientListState.filter)) {
|
!group.matchesFilter(clientListState.filter)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -42,14 +42,6 @@ List<String> filteredGroupsSelector(BuiltMap<String, GroupEntity> groupMap,
|
||||||
if (!group.matchesStates(groupListState.stateFilters)) {
|
if (!group.matchesStates(groupListState.stateFilters)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (groupListState.custom1Filters.isNotEmpty &&
|
|
||||||
!groupListState.custom1Filters.contains(group.customValue1)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (groupListState.custom2Filters.isNotEmpty &&
|
|
||||||
!groupListState.custom2Filters.contains(group.customValue2)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return group.matchesFilter(groupListState.filter);
|
return group.matchesFilter(groupListState.filter);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -392,13 +392,11 @@ class CustomFieldSelector extends StatelessWidget {
|
||||||
converter: (Store<AppState> store) =>
|
converter: (Store<AppState> store) =>
|
||||||
store.state.getListState(entityType).getCustomFilters(customNumber),
|
store.state.getListState(entityType).getCustomFilters(customNumber),
|
||||||
builder: (BuildContext context, customFilters) {
|
builder: (BuildContext context, customFilters) {
|
||||||
print('Store Conecter: $customFilters');
|
|
||||||
return Container(
|
return Container(
|
||||||
color: Theme.of(context).backgroundColor,
|
color: Theme.of(context).backgroundColor,
|
||||||
child: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
child: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
||||||
Column(
|
Column(
|
||||||
children: customValues.map<Widget>((customField) {
|
children: customValues.map<Widget>((customField) {
|
||||||
print('Column: $customFilters');
|
|
||||||
return CheckboxListTile(
|
return CheckboxListTile(
|
||||||
key: Key(customField.toString()),
|
key: Key(customField.toString()),
|
||||||
title: Text(customField),
|
title: Text(customField),
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,6 @@ class _GroupEditState extends State<GroupEdit> {
|
||||||
|
|
||||||
final group = widget.viewModel.group;
|
final group = widget.viewModel.group;
|
||||||
_nameController.text = group.name;
|
_nameController.text = group.name;
|
||||||
_custom1Controller.text = group.customValue1;
|
|
||||||
_custom2Controller.text = group.customValue2;
|
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
||||||
|
|
||||||
|
|
@ -64,8 +62,7 @@ class _GroupEditState extends State<GroupEdit> {
|
||||||
_debouncer.run(() {
|
_debouncer.run(() {
|
||||||
final group = widget.viewModel.group.rebuild((b) => b
|
final group = widget.viewModel.group.rebuild((b) => b
|
||||||
..name = _nameController.text.trim()
|
..name = _nameController.text.trim()
|
||||||
..customValue1 = _custom1Controller.text.trim()
|
);
|
||||||
..customValue2 = _custom2Controller.text.trim());
|
|
||||||
if (group != widget.viewModel.group) {
|
if (group != widget.viewModel.group) {
|
||||||
widget.viewModel.onChanged(group);
|
widget.viewModel.onChanged(group);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/company_model.dart';
|
import 'package:invoiceninja_flutter/data/models/company_model.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/group_model.dart';
|
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/group/group_selectors.dart';
|
import 'package:invoiceninja_flutter/redux/group/group_selectors.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/FieldGrid.dart';
|
import 'package:invoiceninja_flutter/ui/app/FieldGrid.dart';
|
||||||
|
|
@ -43,10 +42,6 @@ class _GroupViewState extends State<GroupView> {
|
||||||
color: Theme.of(context).backgroundColor,
|
color: Theme.of(context).backgroundColor,
|
||||||
height: 12.0,
|
height: 12.0,
|
||||||
),
|
),
|
||||||
FieldGrid({
|
|
||||||
GroupFields.custom1: group.customValue1,
|
|
||||||
GroupFields.custom2: group.customValue2,
|
|
||||||
}),
|
|
||||||
EntityListTile(
|
EntityListTile(
|
||||||
icon: getEntityIcon(EntityType.client),
|
icon: getEntityIcon(EntityType.client),
|
||||||
title: localization.clients,
|
title: localization.clients,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue