Add number fields

This commit is contained in:
Hillel Coren 2020-10-19 18:12:23 +03:00
parent 9a297a028d
commit 35b090cc79
9 changed files with 130 additions and 39 deletions

View File

@ -45,6 +45,7 @@ abstract class ExpenseItemResponse
}
class ExpenseFields {
static const String number = 'number';
static const String privateNotes = 'private_notes';
static const String publicNotes = 'public_notes';
static const String shouldBeInvoiced = 'should_be_invoiced';
@ -86,6 +87,7 @@ abstract class ExpenseEntity extends Object
final company = state?.company;
return _$ExpenseEntity._(
id: id ?? BaseEntity.nextId,
number: '',
isChanged: false,
privateNotes: '',
publicNotes: '',
@ -249,6 +251,9 @@ abstract class ExpenseEntity extends Object
BuiltList<DocumentEntity> get documents;
@nullable // TODO remove this
String get number;
@override
List<EntityAction> getActions(
{UserCompanyEntity userCompany,

View File

@ -240,6 +240,12 @@ class _$ExpenseEntitySerializer implements StructuredSerializer<ExpenseEntity> {
..add(serializers.serialize(object.customValue4,
specifiedType: const FullType(String)));
}
if (object.number != null) {
result
..add('number')
..add(serializers.serialize(object.number,
specifiedType: const FullType(String)));
}
if (object.isChanged != null) {
result
..add('isChanged')
@ -397,6 +403,10 @@ class _$ExpenseEntitySerializer implements StructuredSerializer<ExpenseEntity> {
BuiltList, const [const FullType(DocumentEntity)]))
as BuiltList<Object>);
break;
case 'number':
result.number = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'isChanged':
result.isChanged = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
@ -861,6 +871,8 @@ class _$ExpenseEntity extends ExpenseEntity {
@override
final BuiltList<DocumentEntity> documents;
@override
final String number;
@override
final bool isChanged;
@override
final int createdAt;
@ -911,6 +923,7 @@ class _$ExpenseEntity extends ExpenseEntity {
this.customValue3,
this.customValue4,
this.documents,
this.number,
this.isChanged,
this.createdAt,
this.updatedAt,
@ -1045,6 +1058,7 @@ class _$ExpenseEntity extends ExpenseEntity {
customValue3 == other.customValue3 &&
customValue4 == other.customValue4 &&
documents == other.documents &&
number == other.number &&
isChanged == other.isChanged &&
createdAt == other.createdAt &&
updatedAt == other.updatedAt &&
@ -1076,8 +1090,7 @@ class _$ExpenseEntity extends ExpenseEntity {
$jc(
$jc(
$jc(
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, privateNotes.hashCode), publicNotes.hashCode), shouldBeInvoiced.hashCode), invoiceDocuments.hashCode), transactionId.hashCode), transactionReference.hashCode), bankId.hashCode), expenseCurrencyId.hashCode), categoryId.hashCode), amount.hashCode), expenseDate.hashCode), paymentDate.hashCode), exchangeRate.hashCode), invoiceCurrencyId.hashCode), paymentTypeId.hashCode), taxName1.hashCode), taxName2.hashCode), taxRate1.hashCode), taxRate2.hashCode),
taxName3.hashCode),
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, privateNotes.hashCode), publicNotes.hashCode), shouldBeInvoiced.hashCode), invoiceDocuments.hashCode), transactionId.hashCode), transactionReference.hashCode), bankId.hashCode), expenseCurrencyId.hashCode), categoryId.hashCode), amount.hashCode), expenseDate.hashCode), paymentDate.hashCode), exchangeRate.hashCode), invoiceCurrencyId.hashCode), paymentTypeId.hashCode), taxName1.hashCode), taxName2.hashCode), taxRate1.hashCode), taxRate2.hashCode), taxName3.hashCode),
taxRate3.hashCode),
clientId.hashCode),
invoiceId.hashCode),
@ -1088,6 +1101,7 @@ class _$ExpenseEntity extends ExpenseEntity {
customValue3.hashCode),
customValue4.hashCode),
documents.hashCode),
number.hashCode),
isChanged.hashCode),
createdAt.hashCode),
updatedAt.hashCode),
@ -1131,6 +1145,7 @@ class _$ExpenseEntity extends ExpenseEntity {
..add('customValue3', customValue3)
..add('customValue4', customValue4)
..add('documents', documents)
..add('number', number)
..add('isChanged', isChanged)
..add('createdAt', createdAt)
..add('updatedAt', updatedAt)
@ -1276,6 +1291,10 @@ class ExpenseEntityBuilder
set documents(ListBuilder<DocumentEntity> documents) =>
_$this._documents = documents;
String _number;
String get number => _$this._number;
set number(String number) => _$this._number = number;
bool _isChanged;
bool get isChanged => _$this._isChanged;
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
@ -1344,6 +1363,7 @@ class ExpenseEntityBuilder
_customValue3 = _$v.customValue3;
_customValue4 = _$v.customValue4;
_documents = _$v.documents?.toBuilder();
_number = _$v.number;
_isChanged = _$v.isChanged;
_createdAt = _$v.createdAt;
_updatedAt = _$v.updatedAt;
@ -1406,6 +1426,7 @@ class ExpenseEntityBuilder
customValue3: customValue3,
customValue4: customValue4,
documents: documents.build(),
number: number,
isChanged: isChanged,
createdAt: createdAt,
updatedAt: updatedAt,

View File

@ -44,6 +44,7 @@ abstract class ProjectItemResponse
}
class ProjectFields {
static const String number = 'number';
static const String name = 'name';
static const String clientId = 'client_id';
static const String client = 'client';
@ -68,6 +69,7 @@ abstract class ProjectEntity extends Object
factory ProjectEntity({String id, AppState state}) {
return _$ProjectEntity._(
id: id ?? BaseEntity.nextId,
number: '',
isChanged: false,
name: '',
clientId: '',
@ -139,6 +141,9 @@ abstract class ProjectEntity extends Object
@BuiltValueField(wireName: 'custom_value4')
String get customValue4;
@nullable // TODO remove this
String get number;
BuiltList<DocumentEntity> get documents;
@override

View File

@ -166,6 +166,12 @@ class _$ProjectEntitySerializer implements StructuredSerializer<ProjectEntity> {
'id',
serializers.serialize(object.id, specifiedType: const FullType(String)),
];
if (object.number != null) {
result
..add('number')
..add(serializers.serialize(object.number,
specifiedType: const FullType(String)));
}
if (object.isChanged != null) {
result
..add('isChanged')
@ -249,6 +255,10 @@ class _$ProjectEntitySerializer implements StructuredSerializer<ProjectEntity> {
result.customValue4 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'number':
result.number = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'documents':
result.documents.replace(serializers.deserialize(value,
specifiedType: const FullType(
@ -509,6 +519,8 @@ class _$ProjectEntity extends ProjectEntity {
@override
final String customValue4;
@override
final String number;
@override
final BuiltList<DocumentEntity> documents;
@override
final bool isChanged;
@ -542,6 +554,7 @@ class _$ProjectEntity extends ProjectEntity {
this.customValue2,
this.customValue3,
this.customValue4,
this.number,
this.documents,
this.isChanged,
this.createdAt,
@ -624,6 +637,7 @@ class _$ProjectEntity extends ProjectEntity {
customValue2 == other.customValue2 &&
customValue3 == other.customValue3 &&
customValue4 == other.customValue4 &&
number == other.number &&
documents == other.documents &&
isChanged == other.isChanged &&
createdAt == other.createdAt &&
@ -656,27 +670,17 @@ class _$ProjectEntity extends ProjectEntity {
$jc(
$jc(
$jc(
$jc(
$jc(
0,
name
.hashCode),
clientId
.hashCode),
taskRate
.hashCode),
dueDate
.hashCode),
privateNotes
.hashCode),
publicNotes
.hashCode),
budgetedHours
.hashCode),
$jc($jc($jc(0, name.hashCode), clientId.hashCode),
taskRate.hashCode),
dueDate.hashCode),
privateNotes.hashCode),
publicNotes.hashCode),
budgetedHours.hashCode),
customValue1.hashCode),
customValue2.hashCode),
customValue3.hashCode),
customValue4.hashCode),
number.hashCode),
documents.hashCode),
isChanged.hashCode),
createdAt.hashCode),
@ -702,6 +706,7 @@ class _$ProjectEntity extends ProjectEntity {
..add('customValue2', customValue2)
..add('customValue3', customValue3)
..add('customValue4', customValue4)
..add('number', number)
..add('documents', documents)
..add('isChanged', isChanged)
..add('createdAt', createdAt)
@ -764,6 +769,10 @@ class ProjectEntityBuilder
String get customValue4 => _$this._customValue4;
set customValue4(String customValue4) => _$this._customValue4 = customValue4;
String _number;
String get number => _$this._number;
set number(String number) => _$this._number = number;
ListBuilder<DocumentEntity> _documents;
ListBuilder<DocumentEntity> get documents =>
_$this._documents ??= new ListBuilder<DocumentEntity>();
@ -819,6 +828,7 @@ class ProjectEntityBuilder
_customValue2 = _$v.customValue2;
_customValue3 = _$v.customValue3;
_customValue4 = _$v.customValue4;
_number = _$v.number;
_documents = _$v.documents?.toBuilder();
_isChanged = _$v.isChanged;
_createdAt = _$v.createdAt;
@ -863,6 +873,7 @@ class ProjectEntityBuilder
customValue2: customValue2,
customValue3: customValue3,
customValue4: customValue4,
number: number,
documents: documents.build(),
isChanged: isChanged,
createdAt: createdAt,

View File

@ -48,7 +48,7 @@ abstract class TaskItemResponse
}
class TaskFields {
static const String name = 'name';
static const String number = 'number';
static const String description = 'description';
static const String duration = 'duration';
static const String invoiceId = 'invoice_id';
@ -150,6 +150,7 @@ abstract class TaskEntity extends Object
final isRunning = state?.prefState?.autoStartTasks ?? false;
return _$TaskEntity._(
id: id ?? BaseEntity.nextId,
number: '',
isChanged: false,
description: '',
duration: 0,
@ -212,6 +213,8 @@ abstract class TaskEntity extends Object
String get description;
String get number;
int get duration;
bool get areTimesValid {

View File

@ -164,6 +164,9 @@ class _$TaskEntitySerializer implements StructuredSerializer<TaskEntity> {
'description',
serializers.serialize(object.description,
specifiedType: const FullType(String)),
'number',
serializers.serialize(object.number,
specifiedType: const FullType(String)),
'duration',
serializers.serialize(object.duration,
specifiedType: const FullType(int)),
@ -285,6 +288,10 @@ class _$TaskEntitySerializer implements StructuredSerializer<TaskEntity> {
result.description = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'number':
result.number = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'duration':
result.duration = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
@ -717,6 +724,8 @@ class _$TaskEntity extends TaskEntity {
@override
final String description;
@override
final String number;
@override
final int duration;
@override
final String invoiceId;
@ -766,6 +775,7 @@ class _$TaskEntity extends TaskEntity {
_$TaskEntity._(
{this.description,
this.number,
this.duration,
this.invoiceId,
this.clientId,
@ -792,6 +802,9 @@ class _$TaskEntity extends TaskEntity {
if (description == null) {
throw new BuiltValueNullFieldError('TaskEntity', 'description');
}
if (number == null) {
throw new BuiltValueNullFieldError('TaskEntity', 'number');
}
if (duration == null) {
throw new BuiltValueNullFieldError('TaskEntity', 'duration');
}
@ -836,6 +849,7 @@ class _$TaskEntity extends TaskEntity {
if (identical(other, this)) return true;
return other is TaskEntity &&
description == other.description &&
number == other.number &&
duration == other.duration &&
invoiceId == other.invoiceId &&
clientId == other.clientId &&
@ -881,7 +895,7 @@ class _$TaskEntity extends TaskEntity {
$jc(
$jc(
$jc(
$jc($jc($jc($jc($jc(0, description.hashCode), duration.hashCode), invoiceId.hashCode), clientId.hashCode),
$jc($jc($jc($jc($jc($jc(0, description.hashCode), number.hashCode), duration.hashCode), invoiceId.hashCode), clientId.hashCode),
projectId.hashCode),
timeLog.hashCode),
isRunning.hashCode),
@ -907,6 +921,7 @@ class _$TaskEntity extends TaskEntity {
String toString() {
return (newBuiltValueToStringHelper('TaskEntity')
..add('description', description)
..add('number', number)
..add('duration', duration)
..add('invoiceId', invoiceId)
..add('clientId', clientId)
@ -940,6 +955,10 @@ class TaskEntityBuilder implements Builder<TaskEntity, TaskEntityBuilder> {
String get description => _$this._description;
set description(String description) => _$this._description = description;
String _number;
String get number => _$this._number;
set number(String number) => _$this._number = number;
int _duration;
int get duration => _$this._duration;
set duration(int duration) => _$this._duration = duration;
@ -1038,6 +1057,7 @@ class TaskEntityBuilder implements Builder<TaskEntity, TaskEntityBuilder> {
TaskEntityBuilder get _$this {
if (_$v != null) {
_description = _$v.description;
_number = _$v.number;
_duration = _$v.duration;
_invoiceId = _$v.invoiceId;
_clientId = _$v.clientId;
@ -1085,6 +1105,7 @@ class TaskEntityBuilder implements Builder<TaskEntity, TaskEntityBuilder> {
_$result = _$v ??
new _$TaskEntity._(
description: description,
number: number,
duration: duration,
invoiceId: invoiceId,
clientId: clientId,

View File

@ -45,6 +45,7 @@ abstract class VendorItemResponse
class VendorFields {
static const String name = 'name';
static const String number = 'number';
static const String balance = 'balance';
static const String address1 = 'address1';
static const String address2 = 'address2';
@ -74,6 +75,7 @@ abstract class VendorEntity extends Object
factory VendorEntity({String id, AppState state}) {
return _$VendorEntity._(
id: id ?? BaseEntity.nextId,
number: '',
isChanged: false,
name: '',
address1: '',
@ -147,6 +149,9 @@ abstract class VendorEntity extends Object
String get website;
@nullable // TODO remove this
String get number;
@BuiltValueField(wireName: 'vat_number')
String get vatNumber;

View File

@ -177,6 +177,12 @@ class _$VendorEntitySerializer implements StructuredSerializer<VendorEntity> {
'id',
serializers.serialize(object.id, specifiedType: const FullType(String)),
];
if (object.number != null) {
result
..add('number')
..add(serializers.serialize(object.number,
specifiedType: const FullType(String)));
}
if (object.documents != null) {
result
..add('documents')
@ -262,6 +268,10 @@ class _$VendorEntitySerializer implements StructuredSerializer<VendorEntity> {
result.website = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'number':
result.number = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'vat_number':
result.vatNumber = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
@ -694,6 +704,8 @@ class _$VendorEntity extends VendorEntity {
@override
final String website;
@override
final String number;
@override
final String vatNumber;
@override
final String idNumber;
@ -742,6 +754,7 @@ class _$VendorEntity extends VendorEntity {
this.phone,
this.privateNotes,
this.website,
this.number,
this.vatNumber,
this.idNumber,
this.currencyId,
@ -849,6 +862,7 @@ class _$VendorEntity extends VendorEntity {
phone == other.phone &&
privateNotes == other.privateNotes &&
website == other.website &&
number == other.number &&
vatNumber == other.vatNumber &&
idNumber == other.idNumber &&
currencyId == other.currencyId &&
@ -889,9 +903,9 @@ class _$VendorEntity extends VendorEntity {
$jc(
$jc(
$jc(
$jc($jc($jc($jc($jc($jc($jc($jc($jc(0, name.hashCode), address1.hashCode), address2.hashCode), city.hashCode), state.hashCode), postalCode.hashCode), countryId.hashCode), phone.hashCode),
privateNotes.hashCode),
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, name.hashCode), address1.hashCode), address2.hashCode), city.hashCode), state.hashCode), postalCode.hashCode), countryId.hashCode), phone.hashCode), privateNotes.hashCode),
website.hashCode),
number.hashCode),
vatNumber.hashCode),
idNumber.hashCode),
currencyId.hashCode),
@ -924,6 +938,7 @@ class _$VendorEntity extends VendorEntity {
..add('phone', phone)
..add('privateNotes', privateNotes)
..add('website', website)
..add('number', number)
..add('vatNumber', vatNumber)
..add('idNumber', idNumber)
..add('currencyId', currencyId)
@ -989,6 +1004,10 @@ class VendorEntityBuilder
String get website => _$this._website;
set website(String website) => _$this._website = website;
String _number;
String get number => _$this._number;
set number(String number) => _$this._number = number;
String _vatNumber;
String get vatNumber => _$this._vatNumber;
set vatNumber(String vatNumber) => _$this._vatNumber = vatNumber;
@ -1077,6 +1096,7 @@ class VendorEntityBuilder
_phone = _$v.phone;
_privateNotes = _$v.privateNotes;
_website = _$v.website;
_number = _$v.number;
_vatNumber = _$v.vatNumber;
_idNumber = _$v.idNumber;
_currencyId = _$v.currencyId;
@ -1128,6 +1148,7 @@ class VendorEntityBuilder
phone: phone,
privateNotes: privateNotes,
website: website,
number: number,
vatNumber: vatNumber,
idNumber: idNumber,
currencyId: currencyId,

View File

@ -266,7 +266,6 @@ void handleProjectAction(
final state = store.state;
final project = projects.first as ProjectEntity;
final projectIds = projects.map((project) => project.id).toList();
final client = state.clientState.get(project.clientId);
switch (action) {
case EntityAction.edit: