This commit is contained in:
Hillel Coren 2019-12-15 20:56:21 +02:00
parent 0c2403d17d
commit 0ccd54de86
4 changed files with 139 additions and 26 deletions

View File

@ -213,6 +213,12 @@ abstract class ClientEntity extends Object
@BuiltValueField(wireName: 'custom_value2') @BuiltValueField(wireName: 'custom_value2')
String get customValue2; String get customValue2;
@BuiltValueField(wireName: 'custom_value3')
String get customValue3;
@BuiltValueField(wireName: 'custom_value4')
String get customValue4;
BuiltList<ContactEntity> get contacts; BuiltList<ContactEntity> get contacts;
BuiltList<ActivityEntity> get activities; BuiltList<ActivityEntity> get activities;
@ -524,6 +530,13 @@ abstract class ContactEntity extends Object
@BuiltValueField(wireName: 'custom_value2') @BuiltValueField(wireName: 'custom_value2')
String get customValue2; String get customValue2;
@BuiltValueField(wireName: 'custom_value3')
String get customValue3;
@BuiltValueField(wireName: 'custom_value4')
String get customValue4;
String get fullName { String get fullName {
return (firstName + ' ' + lastName).trim(); return (firstName + ' ' + lastName).trim();
} }

View File

@ -173,6 +173,12 @@ class _$ClientEntitySerializer implements StructuredSerializer<ClientEntity> {
'custom_value2', 'custom_value2',
serializers.serialize(object.customValue2, serializers.serialize(object.customValue2,
specifiedType: const FullType(String)), specifiedType: const FullType(String)),
'custom_value3',
serializers.serialize(object.customValue3,
specifiedType: const FullType(String)),
'custom_value4',
serializers.serialize(object.customValue4,
specifiedType: const FullType(String)),
'contacts', 'contacts',
serializers.serialize(object.contacts, serializers.serialize(object.contacts,
specifiedType: specifiedType:
@ -412,6 +418,14 @@ class _$ClientEntitySerializer implements StructuredSerializer<ClientEntity> {
result.customValue2 = serializers.deserialize(value, result.customValue2 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; break;
case 'custom_value3':
result.customValue3 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'custom_value4':
result.customValue4 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'contacts': case 'contacts':
result.contacts.replace(serializers.deserialize(value, result.contacts.replace(serializers.deserialize(value,
specifiedType: const FullType( specifiedType: const FullType(
@ -506,6 +520,12 @@ class _$ContactEntitySerializer implements StructuredSerializer<ContactEntity> {
'custom_value2', 'custom_value2',
serializers.serialize(object.customValue2, serializers.serialize(object.customValue2,
specifiedType: const FullType(String)), specifiedType: const FullType(String)),
'custom_value3',
serializers.serialize(object.customValue3,
specifiedType: const FullType(String)),
'custom_value4',
serializers.serialize(object.customValue4,
specifiedType: const FullType(String)),
]; ];
if (object.password != null) { if (object.password != null) {
result result
@ -616,6 +636,14 @@ class _$ContactEntitySerializer implements StructuredSerializer<ContactEntity> {
result.customValue2 = serializers.deserialize(value, result.customValue2 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; break;
case 'custom_value3':
result.customValue3 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'custom_value4':
result.customValue4 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'isChanged': case 'isChanged':
result.isChanged = serializers.deserialize(value, result.isChanged = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool; specifiedType: const FullType(bool)) as bool;
@ -904,6 +932,10 @@ class _$ClientEntity extends ClientEntity {
@override @override
final String customValue2; final String customValue2;
@override @override
final String customValue3;
@override
final String customValue4;
@override
final BuiltList<ContactEntity> contacts; final BuiltList<ContactEntity> contacts;
@override @override
final BuiltList<ActivityEntity> activities; final BuiltList<ActivityEntity> activities;
@ -959,6 +991,8 @@ class _$ClientEntity extends ClientEntity {
this.settings, this.settings,
this.customValue1, this.customValue1,
this.customValue2, this.customValue2,
this.customValue3,
this.customValue4,
this.contacts, this.contacts,
this.activities, this.activities,
this.gatewayTokens, this.gatewayTokens,
@ -1034,6 +1068,12 @@ class _$ClientEntity extends ClientEntity {
if (customValue2 == null) { if (customValue2 == null) {
throw new BuiltValueNullFieldError('ClientEntity', 'customValue2'); throw new BuiltValueNullFieldError('ClientEntity', 'customValue2');
} }
if (customValue3 == null) {
throw new BuiltValueNullFieldError('ClientEntity', 'customValue3');
}
if (customValue4 == null) {
throw new BuiltValueNullFieldError('ClientEntity', 'customValue4');
}
if (contacts == null) { if (contacts == null) {
throw new BuiltValueNullFieldError('ClientEntity', 'contacts'); throw new BuiltValueNullFieldError('ClientEntity', 'contacts');
} }
@ -1085,6 +1125,8 @@ class _$ClientEntity extends ClientEntity {
settings == other.settings && settings == other.settings &&
customValue1 == other.customValue1 && customValue1 == other.customValue1 &&
customValue2 == other.customValue2 && customValue2 == other.customValue2 &&
customValue3 == other.customValue3 &&
customValue4 == other.customValue4 &&
contacts == other.contacts && contacts == other.contacts &&
activities == other.activities && activities == other.activities &&
gatewayTokens == other.gatewayTokens && gatewayTokens == other.gatewayTokens &&
@ -1118,15 +1160,15 @@ class _$ClientEntity extends ClientEntity {
$jc( $jc(
$jc( $jc(
$jc( $jc(
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, groupId.hashCode), lastUpdatedActivities.hashCode), name.hashCode), displayName.hashCode), balance.hashCode), paidToDate.hashCode), address1.hashCode), address2.hashCode), city.hashCode), state.hashCode), postalCode.hashCode), countryId.hashCode), phone.hashCode), privateNotes.hashCode), publicNotes.hashCode), website.hashCode), industryId.hashCode), sizeId.hashCode), vatNumber.hashCode), idNumber.hashCode), shippingAddress1.hashCode), $jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, groupId.hashCode), lastUpdatedActivities.hashCode), name.hashCode), displayName.hashCode), balance.hashCode), paidToDate.hashCode), address1.hashCode), address2.hashCode), city.hashCode), state.hashCode), postalCode.hashCode), countryId.hashCode), phone.hashCode), privateNotes.hashCode), publicNotes.hashCode), website.hashCode), industryId.hashCode), sizeId.hashCode), vatNumber.hashCode), idNumber.hashCode), shippingAddress1.hashCode), shippingAddress2.hashCode), shippingCity.hashCode),
shippingAddress2.hashCode), shippingState.hashCode),
shippingCity.hashCode), shippingPostalCode.hashCode),
shippingState.hashCode), shippingCountryId.hashCode),
shippingPostalCode.hashCode), settings.hashCode),
shippingCountryId.hashCode), customValue1.hashCode),
settings.hashCode), customValue2.hashCode),
customValue1.hashCode), customValue3.hashCode),
customValue2.hashCode), customValue4.hashCode),
contacts.hashCode), contacts.hashCode),
activities.hashCode), activities.hashCode),
gatewayTokens.hashCode), gatewayTokens.hashCode),
@ -1172,6 +1214,8 @@ class _$ClientEntity extends ClientEntity {
..add('settings', settings) ..add('settings', settings)
..add('customValue1', customValue1) ..add('customValue1', customValue1)
..add('customValue2', customValue2) ..add('customValue2', customValue2)
..add('customValue3', customValue3)
..add('customValue4', customValue4)
..add('contacts', contacts) ..add('contacts', contacts)
..add('activities', activities) ..add('activities', activities)
..add('gatewayTokens', gatewayTokens) ..add('gatewayTokens', gatewayTokens)
@ -1314,6 +1358,14 @@ class ClientEntityBuilder
String get customValue2 => _$this._customValue2; String get customValue2 => _$this._customValue2;
set customValue2(String customValue2) => _$this._customValue2 = customValue2; set customValue2(String customValue2) => _$this._customValue2 = customValue2;
String _customValue3;
String get customValue3 => _$this._customValue3;
set customValue3(String customValue3) => _$this._customValue3 = customValue3;
String _customValue4;
String get customValue4 => _$this._customValue4;
set customValue4(String customValue4) => _$this._customValue4 = customValue4;
ListBuilder<ContactEntity> _contacts; ListBuilder<ContactEntity> _contacts;
ListBuilder<ContactEntity> get contacts => ListBuilder<ContactEntity> get contacts =>
_$this._contacts ??= new ListBuilder<ContactEntity>(); _$this._contacts ??= new ListBuilder<ContactEntity>();
@ -1399,6 +1451,8 @@ class ClientEntityBuilder
_settings = _$v.settings?.toBuilder(); _settings = _$v.settings?.toBuilder();
_customValue1 = _$v.customValue1; _customValue1 = _$v.customValue1;
_customValue2 = _$v.customValue2; _customValue2 = _$v.customValue2;
_customValue3 = _$v.customValue3;
_customValue4 = _$v.customValue4;
_contacts = _$v.contacts?.toBuilder(); _contacts = _$v.contacts?.toBuilder();
_activities = _$v.activities?.toBuilder(); _activities = _$v.activities?.toBuilder();
_gatewayTokens = _$v.gatewayTokens?.toBuilder(); _gatewayTokens = _$v.gatewayTokens?.toBuilder();
@ -1463,6 +1517,8 @@ class ClientEntityBuilder
settings: settings.build(), settings: settings.build(),
customValue1: customValue1, customValue1: customValue1,
customValue2: customValue2, customValue2: customValue2,
customValue3: customValue3,
customValue4: customValue4,
contacts: contacts.build(), contacts: contacts.build(),
activities: activities.build(), activities: activities.build(),
gatewayTokens: gatewayTokens.build(), gatewayTokens: gatewayTokens.build(),
@ -1519,6 +1575,10 @@ class _$ContactEntity extends ContactEntity {
@override @override
final String customValue2; final String customValue2;
@override @override
final String customValue3;
@override
final String customValue4;
@override
final bool isChanged; final bool isChanged;
@override @override
final int createdAt; final int createdAt;
@ -1549,6 +1609,8 @@ class _$ContactEntity extends ContactEntity {
this.sendInvoice, this.sendInvoice,
this.customValue1, this.customValue1,
this.customValue2, this.customValue2,
this.customValue3,
this.customValue4,
this.isChanged, this.isChanged,
this.createdAt, this.createdAt,
this.updatedAt, this.updatedAt,
@ -1585,6 +1647,12 @@ class _$ContactEntity extends ContactEntity {
if (customValue2 == null) { if (customValue2 == null) {
throw new BuiltValueNullFieldError('ContactEntity', 'customValue2'); throw new BuiltValueNullFieldError('ContactEntity', 'customValue2');
} }
if (customValue3 == null) {
throw new BuiltValueNullFieldError('ContactEntity', 'customValue3');
}
if (customValue4 == null) {
throw new BuiltValueNullFieldError('ContactEntity', 'customValue4');
}
} }
@override @override
@ -1608,6 +1676,8 @@ class _$ContactEntity extends ContactEntity {
sendInvoice == other.sendInvoice && sendInvoice == other.sendInvoice &&
customValue1 == other.customValue1 && customValue1 == other.customValue1 &&
customValue2 == other.customValue2 && customValue2 == other.customValue2 &&
customValue3 == other.customValue3 &&
customValue4 == other.customValue4 &&
isChanged == other.isChanged && isChanged == other.isChanged &&
createdAt == other.createdAt && createdAt == other.createdAt &&
updatedAt == other.updatedAt && updatedAt == other.updatedAt &&
@ -1638,21 +1708,18 @@ class _$ContactEntity extends ContactEntity {
$jc( $jc(
$jc( $jc(
$jc( $jc(
0, $jc($jc(0, firstName.hashCode),
firstName lastName.hashCode),
.hashCode), email.hashCode),
lastName password.hashCode),
.hashCode), phone.hashCode),
email contactKey.hashCode),
.hashCode), isPrimary.hashCode),
password sendInvoice.hashCode),
.hashCode), customValue1.hashCode),
phone.hashCode), customValue2.hashCode),
contactKey.hashCode), customValue3.hashCode),
isPrimary.hashCode), customValue4.hashCode),
sendInvoice.hashCode),
customValue1.hashCode),
customValue2.hashCode),
isChanged.hashCode), isChanged.hashCode),
createdAt.hashCode), createdAt.hashCode),
updatedAt.hashCode), updatedAt.hashCode),
@ -1676,6 +1743,8 @@ class _$ContactEntity extends ContactEntity {
..add('sendInvoice', sendInvoice) ..add('sendInvoice', sendInvoice)
..add('customValue1', customValue1) ..add('customValue1', customValue1)
..add('customValue2', customValue2) ..add('customValue2', customValue2)
..add('customValue3', customValue3)
..add('customValue4', customValue4)
..add('isChanged', isChanged) ..add('isChanged', isChanged)
..add('createdAt', createdAt) ..add('createdAt', createdAt)
..add('updatedAt', updatedAt) ..add('updatedAt', updatedAt)
@ -1732,6 +1801,14 @@ class ContactEntityBuilder
String get customValue2 => _$this._customValue2; String get customValue2 => _$this._customValue2;
set customValue2(String customValue2) => _$this._customValue2 = customValue2; set customValue2(String customValue2) => _$this._customValue2 = customValue2;
String _customValue3;
String get customValue3 => _$this._customValue3;
set customValue3(String customValue3) => _$this._customValue3 = customValue3;
String _customValue4;
String get customValue4 => _$this._customValue4;
set customValue4(String customValue4) => _$this._customValue4 = customValue4;
bool _isChanged; bool _isChanged;
bool get isChanged => _$this._isChanged; bool get isChanged => _$this._isChanged;
set isChanged(bool isChanged) => _$this._isChanged = isChanged; set isChanged(bool isChanged) => _$this._isChanged = isChanged;
@ -1780,6 +1857,8 @@ class ContactEntityBuilder
_sendInvoice = _$v.sendInvoice; _sendInvoice = _$v.sendInvoice;
_customValue1 = _$v.customValue1; _customValue1 = _$v.customValue1;
_customValue2 = _$v.customValue2; _customValue2 = _$v.customValue2;
_customValue3 = _$v.customValue3;
_customValue4 = _$v.customValue4;
_isChanged = _$v.isChanged; _isChanged = _$v.isChanged;
_createdAt = _$v.createdAt; _createdAt = _$v.createdAt;
_updatedAt = _$v.updatedAt; _updatedAt = _$v.updatedAt;
@ -1820,6 +1899,8 @@ class ContactEntityBuilder
sendInvoice: sendInvoice, sendInvoice: sendInvoice,
customValue1: customValue1, customValue1: customValue1,
customValue2: customValue2, customValue2: customValue2,
customValue3: customValue3,
customValue4: customValue4,
isChanged: isChanged, isChanged: isChanged,
createdAt: createdAt, createdAt: createdAt,
updatedAt: updatedAt, updatedAt: updatedAt,

View File

@ -166,7 +166,7 @@ abstract class UserEntity extends Object
} }
} }
if (userCompany.isAdmin && !this.userCompany.isOwner) { if (userCompany.isAdmin || userCompany.isOwner) {
actions.add(EntityAction.remove); actions.add(EntityAction.remove);
} }

View File

@ -31,6 +31,8 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
final _phoneController = TextEditingController(); final _phoneController = TextEditingController();
final _custom1Controller = TextEditingController(); final _custom1Controller = TextEditingController();
final _custom2Controller = TextEditingController(); final _custom2Controller = TextEditingController();
final _custom3Controller = TextEditingController();
final _custom4Controller = TextEditingController();
final _debouncer = Debouncer(); final _debouncer = Debouncer();
List<TextEditingController> _controllers; List<TextEditingController> _controllers;
@ -45,6 +47,8 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
_phoneController, _phoneController,
_custom1Controller, _custom1Controller,
_custom2Controller, _custom2Controller,
_custom3Controller,
_custom4Controller,
]; ];
_controllers _controllers
@ -58,6 +62,8 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
_phoneController.text = client.phone; _phoneController.text = client.phone;
_custom1Controller.text = client.customValue1; _custom1Controller.text = client.customValue1;
_custom2Controller.text = client.customValue2; _custom2Controller.text = client.customValue2;
_custom3Controller.text = client.customValue3;
_custom4Controller.text = client.customValue4;
_controllers _controllers
.forEach((dynamic controller) => controller.addListener(_onChanged)); .forEach((dynamic controller) => controller.addListener(_onChanged));
@ -85,7 +91,10 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
..website = _websiteController.text.trim() ..website = _websiteController.text.trim()
..phone = _phoneController.text.trim() ..phone = _phoneController.text.trim()
..customValue1 = _custom1Controller.text.trim() ..customValue1 = _custom1Controller.text.trim()
..customValue2 = _custom2Controller.text.trim()); ..customValue2 = _custom2Controller.text.trim()
..customValue3 = _custom3Controller.text.trim()
..customValue4 = _custom4Controller.text.trim()
);
if (client != viewModel.client) { if (client != viewModel.client) {
viewModel.onChanged(client); viewModel.onChanged(client);
} }
@ -151,6 +160,16 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
field: CustomFieldType.client2, field: CustomFieldType.client2,
value: client.customValue2, value: client.customValue2,
), ),
CustomField(
controller: _custom3Controller,
field: CustomFieldType.client3,
value: client.customValue3,
),
CustomField(
controller: _custom4Controller,
field: CustomFieldType.client4,
value: client.customValue4,
),
], ],
), ),
], ],