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