Move history to activity
This commit is contained in:
parent
5b1c901a20
commit
48788a207b
|
|
@ -632,6 +632,9 @@ abstract class ActivityEntity
|
||||||
@BuiltValueField(wireName: 'token_id')
|
@BuiltValueField(wireName: 'token_id')
|
||||||
String get tokenId;
|
String get tokenId;
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
InvoiceHistoryEntity get history;
|
||||||
|
|
||||||
EntityType get entityType {
|
EntityType get entityType {
|
||||||
if ([
|
if ([
|
||||||
kActivityCreateClient,
|
kActivityCreateClient,
|
||||||
|
|
|
||||||
|
|
@ -609,6 +609,13 @@ class _$ActivityEntitySerializer
|
||||||
..add(serializers.serialize(value,
|
..add(serializers.serialize(value,
|
||||||
specifiedType: const FullType(String)));
|
specifiedType: const FullType(String)));
|
||||||
}
|
}
|
||||||
|
value = object.history;
|
||||||
|
if (value != null) {
|
||||||
|
result
|
||||||
|
..add('history')
|
||||||
|
..add(serializers.serialize(value,
|
||||||
|
specifiedType: const FullType(InvoiceHistoryEntity)));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -700,6 +707,11 @@ class _$ActivityEntitySerializer
|
||||||
result.tokenId = serializers.deserialize(value,
|
result.tokenId = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
break;
|
break;
|
||||||
|
case 'history':
|
||||||
|
result.history.replace(serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(InvoiceHistoryEntity))
|
||||||
|
as InvoiceHistoryEntity);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1028,6 +1040,8 @@ class _$ActivityEntity extends ActivityEntity {
|
||||||
final String vendorId;
|
final String vendorId;
|
||||||
@override
|
@override
|
||||||
final String tokenId;
|
final String tokenId;
|
||||||
|
@override
|
||||||
|
final InvoiceHistoryEntity history;
|
||||||
|
|
||||||
factory _$ActivityEntity([void Function(ActivityEntityBuilder) updates]) =>
|
factory _$ActivityEntity([void Function(ActivityEntityBuilder) updates]) =>
|
||||||
(new ActivityEntityBuilder()..update(updates)).build();
|
(new ActivityEntityBuilder()..update(updates)).build();
|
||||||
|
|
@ -1051,7 +1065,8 @@ class _$ActivityEntity extends ActivityEntity {
|
||||||
this.taskId,
|
this.taskId,
|
||||||
this.projectId,
|
this.projectId,
|
||||||
this.vendorId,
|
this.vendorId,
|
||||||
this.tokenId})
|
this.tokenId,
|
||||||
|
this.history})
|
||||||
: super._() {
|
: super._() {
|
||||||
BuiltValueNullFieldError.checkNotNull(notes, 'ActivityEntity', 'notes');
|
BuiltValueNullFieldError.checkNotNull(notes, 'ActivityEntity', 'notes');
|
||||||
BuiltValueNullFieldError.checkNotNull(key, 'ActivityEntity', 'key');
|
BuiltValueNullFieldError.checkNotNull(key, 'ActivityEntity', 'key');
|
||||||
|
|
@ -1092,7 +1107,8 @@ class _$ActivityEntity extends ActivityEntity {
|
||||||
taskId == other.taskId &&
|
taskId == other.taskId &&
|
||||||
projectId == other.projectId &&
|
projectId == other.projectId &&
|
||||||
vendorId == other.vendorId &&
|
vendorId == other.vendorId &&
|
||||||
tokenId == other.tokenId;
|
tokenId == other.tokenId &&
|
||||||
|
history == other.history;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __hashCode;
|
int __hashCode;
|
||||||
|
|
@ -1116,33 +1132,26 @@ class _$ActivityEntity extends ActivityEntity {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc($jc(0, notes.hashCode),
|
||||||
0,
|
key.hashCode),
|
||||||
notes
|
activityTypeId.hashCode),
|
||||||
.hashCode),
|
clientId.hashCode),
|
||||||
key
|
userId.hashCode),
|
||||||
.hashCode),
|
invoiceId.hashCode),
|
||||||
activityTypeId
|
recurringInvoiceId.hashCode),
|
||||||
.hashCode),
|
quoteId.hashCode),
|
||||||
clientId
|
paymentId.hashCode),
|
||||||
.hashCode),
|
creditId.hashCode),
|
||||||
userId
|
updatedAt.hashCode),
|
||||||
.hashCode),
|
expenseId.hashCode),
|
||||||
invoiceId.hashCode),
|
isSystem.hashCode),
|
||||||
recurringInvoiceId
|
ip.hashCode),
|
||||||
.hashCode),
|
contactId.hashCode),
|
||||||
quoteId.hashCode),
|
taskId.hashCode),
|
||||||
paymentId.hashCode),
|
projectId.hashCode),
|
||||||
creditId.hashCode),
|
vendorId.hashCode),
|
||||||
updatedAt.hashCode),
|
tokenId.hashCode),
|
||||||
expenseId.hashCode),
|
history.hashCode));
|
||||||
isSystem.hashCode),
|
|
||||||
ip.hashCode),
|
|
||||||
contactId.hashCode),
|
|
||||||
taskId.hashCode),
|
|
||||||
projectId.hashCode),
|
|
||||||
vendorId.hashCode),
|
|
||||||
tokenId.hashCode));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -1166,7 +1175,8 @@ class _$ActivityEntity extends ActivityEntity {
|
||||||
..add('taskId', taskId)
|
..add('taskId', taskId)
|
||||||
..add('projectId', projectId)
|
..add('projectId', projectId)
|
||||||
..add('vendorId', vendorId)
|
..add('vendorId', vendorId)
|
||||||
..add('tokenId', tokenId))
|
..add('tokenId', tokenId)
|
||||||
|
..add('history', history))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1253,6 +1263,11 @@ class ActivityEntityBuilder
|
||||||
String get tokenId => _$this._tokenId;
|
String get tokenId => _$this._tokenId;
|
||||||
set tokenId(String tokenId) => _$this._tokenId = tokenId;
|
set tokenId(String tokenId) => _$this._tokenId = tokenId;
|
||||||
|
|
||||||
|
InvoiceHistoryEntityBuilder _history;
|
||||||
|
InvoiceHistoryEntityBuilder get history =>
|
||||||
|
_$this._history ??= new InvoiceHistoryEntityBuilder();
|
||||||
|
set history(InvoiceHistoryEntityBuilder history) => _$this._history = history;
|
||||||
|
|
||||||
ActivityEntityBuilder();
|
ActivityEntityBuilder();
|
||||||
|
|
||||||
ActivityEntityBuilder get _$this {
|
ActivityEntityBuilder get _$this {
|
||||||
|
|
@ -1277,6 +1292,7 @@ class ActivityEntityBuilder
|
||||||
_projectId = $v.projectId;
|
_projectId = $v.projectId;
|
||||||
_vendorId = $v.vendorId;
|
_vendorId = $v.vendorId;
|
||||||
_tokenId = $v.tokenId;
|
_tokenId = $v.tokenId;
|
||||||
|
_history = $v.history?.toBuilder();
|
||||||
_$v = null;
|
_$v = null;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -1295,32 +1311,46 @@ class ActivityEntityBuilder
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_$ActivityEntity build() {
|
_$ActivityEntity build() {
|
||||||
final _$result = _$v ??
|
_$ActivityEntity _$result;
|
||||||
new _$ActivityEntity._(
|
try {
|
||||||
notes: BuiltValueNullFieldError.checkNotNull(
|
_$result = _$v ??
|
||||||
notes, 'ActivityEntity', 'notes'),
|
new _$ActivityEntity._(
|
||||||
key: BuiltValueNullFieldError.checkNotNull(
|
notes: BuiltValueNullFieldError.checkNotNull(
|
||||||
key, 'ActivityEntity', 'key'),
|
notes, 'ActivityEntity', 'notes'),
|
||||||
activityTypeId: BuiltValueNullFieldError.checkNotNull(
|
key: BuiltValueNullFieldError.checkNotNull(
|
||||||
activityTypeId, 'ActivityEntity', 'activityTypeId'),
|
key, 'ActivityEntity', 'key'),
|
||||||
clientId: clientId,
|
activityTypeId: BuiltValueNullFieldError.checkNotNull(
|
||||||
userId: BuiltValueNullFieldError.checkNotNull(
|
activityTypeId, 'ActivityEntity', 'activityTypeId'),
|
||||||
userId, 'ActivityEntity', 'userId'),
|
clientId: clientId,
|
||||||
invoiceId: invoiceId,
|
userId: BuiltValueNullFieldError.checkNotNull(
|
||||||
recurringInvoiceId: recurringInvoiceId,
|
userId, 'ActivityEntity', 'userId'),
|
||||||
quoteId: quoteId,
|
invoiceId: invoiceId,
|
||||||
paymentId: paymentId,
|
recurringInvoiceId: recurringInvoiceId,
|
||||||
creditId: creditId,
|
quoteId: quoteId,
|
||||||
updatedAt: BuiltValueNullFieldError.checkNotNull(
|
paymentId: paymentId,
|
||||||
updatedAt, 'ActivityEntity', 'updatedAt'),
|
creditId: creditId,
|
||||||
expenseId: expenseId,
|
updatedAt: BuiltValueNullFieldError.checkNotNull(
|
||||||
isSystem: isSystem,
|
updatedAt, 'ActivityEntity', 'updatedAt'),
|
||||||
ip: ip,
|
expenseId: expenseId,
|
||||||
contactId: contactId,
|
isSystem: isSystem,
|
||||||
taskId: taskId,
|
ip: ip,
|
||||||
projectId: projectId,
|
contactId: contactId,
|
||||||
vendorId: vendorId,
|
taskId: taskId,
|
||||||
tokenId: tokenId);
|
projectId: projectId,
|
||||||
|
vendorId: vendorId,
|
||||||
|
tokenId: tokenId,
|
||||||
|
history: _history?.build());
|
||||||
|
} catch (_) {
|
||||||
|
String _$failedField;
|
||||||
|
try {
|
||||||
|
_$failedField = 'history';
|
||||||
|
_history?.build();
|
||||||
|
} catch (e) {
|
||||||
|
throw new BuiltValueNestedFieldError(
|
||||||
|
'ActivityEntity', _$failedField, e.toString());
|
||||||
|
}
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
replace(_$result);
|
replace(_$result);
|
||||||
return _$result;
|
return _$result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,6 @@ abstract class InvoiceEntity extends Object
|
||||||
subscriptionId: '',
|
subscriptionId: '',
|
||||||
recurringDates: BuiltList<InvoiceScheduleEntity>(),
|
recurringDates: BuiltList<InvoiceScheduleEntity>(),
|
||||||
lineItems: BuiltList<InvoiceItemEntity>(),
|
lineItems: BuiltList<InvoiceItemEntity>(),
|
||||||
history: BuiltList<InvoiceHistoryEntity>(),
|
|
||||||
usesInclusiveTaxes: company?.settings?.enableInclusiveTaxes ?? false,
|
usesInclusiveTaxes: company?.settings?.enableInclusiveTaxes ?? false,
|
||||||
documents: BuiltList<DocumentEntity>(),
|
documents: BuiltList<DocumentEntity>(),
|
||||||
activities: BuiltList<ActivityEntity>(),
|
activities: BuiltList<ActivityEntity>(),
|
||||||
|
|
@ -461,9 +460,6 @@ abstract class InvoiceEntity extends Object
|
||||||
|
|
||||||
BuiltList<ActivityEntity> get activities;
|
BuiltList<ActivityEntity> get activities;
|
||||||
|
|
||||||
@nullable
|
|
||||||
BuiltList<InvoiceHistoryEntity> get history;
|
|
||||||
|
|
||||||
bool get isApproved => statusId == kQuoteStatusApproved;
|
bool get isApproved => statusId == kQuoteStatusApproved;
|
||||||
|
|
||||||
bool get hasClient => '${clientId ?? ''}'.isNotEmpty;
|
bool get hasClient => '${clientId ?? ''}'.isNotEmpty;
|
||||||
|
|
@ -480,6 +476,11 @@ abstract class InvoiceEntity extends Object
|
||||||
@nullable
|
@nullable
|
||||||
int get loadedAt;
|
int get loadedAt;
|
||||||
|
|
||||||
|
List<InvoiceHistoryEntity> get history => activities
|
||||||
|
.where((activity) => activity.history != null)
|
||||||
|
.map((activity) => activity.history)
|
||||||
|
.toList();
|
||||||
|
|
||||||
bool get isLoaded => loadedAt != null && loadedAt > 0;
|
bool get isLoaded => loadedAt != null && loadedAt > 0;
|
||||||
|
|
||||||
bool get isStale {
|
bool get isStale {
|
||||||
|
|
@ -1517,7 +1518,6 @@ abstract class InvoiceHistoryEntity
|
||||||
htmlBackup: '',
|
htmlBackup: '',
|
||||||
createdAt: 0,
|
createdAt: 0,
|
||||||
activityId: '',
|
activityId: '',
|
||||||
activity: ActivityEntity(),
|
|
||||||
amount: 0,
|
amount: 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -1530,8 +1530,6 @@ abstract class InvoiceHistoryEntity
|
||||||
|
|
||||||
String get id;
|
String get id;
|
||||||
|
|
||||||
ActivityEntity get activity;
|
|
||||||
|
|
||||||
@BuiltValueField(wireName: 'activity_id')
|
@BuiltValueField(wireName: 'activity_id')
|
||||||
String get activityId;
|
String get activityId;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -367,14 +367,6 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
|
||||||
specifiedType: const FullType(
|
specifiedType: const FullType(
|
||||||
BuiltList, const [const FullType(InvoiceScheduleEntity)])));
|
BuiltList, const [const FullType(InvoiceScheduleEntity)])));
|
||||||
}
|
}
|
||||||
value = object.history;
|
|
||||||
if (value != null) {
|
|
||||||
result
|
|
||||||
..add('history')
|
|
||||||
..add(serializers.serialize(value,
|
|
||||||
specifiedType: const FullType(
|
|
||||||
BuiltList, const [const FullType(InvoiceHistoryEntity)])));
|
|
||||||
}
|
|
||||||
value = object.loadedAt;
|
value = object.loadedAt;
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
result
|
result
|
||||||
|
|
@ -677,12 +669,6 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
|
||||||
BuiltList, const [const FullType(ActivityEntity)]))
|
BuiltList, const [const FullType(ActivityEntity)]))
|
||||||
as BuiltList<Object>);
|
as BuiltList<Object>);
|
||||||
break;
|
break;
|
||||||
case 'history':
|
|
||||||
result.history.replace(serializers.deserialize(value,
|
|
||||||
specifiedType: const FullType(
|
|
||||||
BuiltList, const [const FullType(InvoiceHistoryEntity)]))
|
|
||||||
as BuiltList<Object>);
|
|
||||||
break;
|
|
||||||
case 'loadedAt':
|
case 'loadedAt':
|
||||||
result.loadedAt = serializers.deserialize(value,
|
result.loadedAt = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(int)) as int;
|
specifiedType: const FullType(int)) as int;
|
||||||
|
|
@ -1157,9 +1143,6 @@ class _$InvoiceHistoryEntitySerializer
|
||||||
final result = <Object>[
|
final result = <Object>[
|
||||||
'id',
|
'id',
|
||||||
serializers.serialize(object.id, specifiedType: const FullType(String)),
|
serializers.serialize(object.id, specifiedType: const FullType(String)),
|
||||||
'activity',
|
|
||||||
serializers.serialize(object.activity,
|
|
||||||
specifiedType: const FullType(ActivityEntity)),
|
|
||||||
'activity_id',
|
'activity_id',
|
||||||
serializers.serialize(object.activityId,
|
serializers.serialize(object.activityId,
|
||||||
specifiedType: const FullType(String)),
|
specifiedType: const FullType(String)),
|
||||||
|
|
@ -1193,10 +1176,6 @@ class _$InvoiceHistoryEntitySerializer
|
||||||
result.id = serializers.deserialize(value,
|
result.id = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
break;
|
break;
|
||||||
case 'activity':
|
|
||||||
result.activity.replace(serializers.deserialize(value,
|
|
||||||
specifiedType: const FullType(ActivityEntity)) as ActivityEntity);
|
|
||||||
break;
|
|
||||||
case 'activity_id':
|
case 'activity_id':
|
||||||
result.activityId = serializers.deserialize(value,
|
result.activityId = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
|
|
@ -1525,8 +1504,6 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
@override
|
@override
|
||||||
final BuiltList<ActivityEntity> activities;
|
final BuiltList<ActivityEntity> activities;
|
||||||
@override
|
@override
|
||||||
final BuiltList<InvoiceHistoryEntity> history;
|
|
||||||
@override
|
|
||||||
final int loadedAt;
|
final int loadedAt;
|
||||||
@override
|
@override
|
||||||
final bool isChanged;
|
final bool isChanged;
|
||||||
|
|
@ -1610,7 +1587,6 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
this.invitations,
|
this.invitations,
|
||||||
this.documents,
|
this.documents,
|
||||||
this.activities,
|
this.activities,
|
||||||
this.history,
|
|
||||||
this.loadedAt,
|
this.loadedAt,
|
||||||
this.isChanged,
|
this.isChanged,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
|
|
@ -1787,7 +1763,6 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
invitations == other.invitations &&
|
invitations == other.invitations &&
|
||||||
documents == other.documents &&
|
documents == other.documents &&
|
||||||
activities == other.activities &&
|
activities == other.activities &&
|
||||||
history == other.history &&
|
|
||||||
loadedAt == other.loadedAt &&
|
loadedAt == other.loadedAt &&
|
||||||
isChanged == other.isChanged &&
|
isChanged == other.isChanged &&
|
||||||
createdAt == other.createdAt &&
|
createdAt == other.createdAt &&
|
||||||
|
|
@ -1821,16 +1796,16 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
$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($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($jc($jc(0, amount.hashCode), balance.hashCode), paidToDate.hashCode), clientId.hashCode), subscriptionId.hashCode), statusId.hashCode), number.hashCode), discount.hashCode), poNumber.hashCode), date.hashCode), dueDate.hashCode), publicNotes.hashCode), privateNotes.hashCode), terms.hashCode), footer.hashCode), designId.hashCode), usesInclusiveTaxes.hashCode), taxName1.hashCode), taxRate1.hashCode), taxName2.hashCode), taxRate2.hashCode), taxName3.hashCode), taxRate3.hashCode), isAmountDiscount.hashCode), partial.hashCode), taxAmount.hashCode), partialDueDate.hashCode), autoBill.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), customSurcharge1.hashCode), customSurcharge2.hashCode), customSurcharge3.hashCode), customSurcharge4.hashCode), customTaxes1.hashCode), customTaxes2.hashCode), customTaxes3.hashCode), customTaxes4.hashCode), exchangeRate.hashCode), reminder1Sent.hashCode), reminder2Sent.hashCode), reminder3Sent.hashCode), reminderLastSent.hashCode), frequencyId.hashCode), lastSentDate.hashCode), nextSendDate.hashCode), remainingCycles.hashCode), dueDateDays.hashCode), invoiceId.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($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, amount.hashCode), balance.hashCode), paidToDate.hashCode), clientId.hashCode), subscriptionId.hashCode), statusId.hashCode), number.hashCode), discount.hashCode), poNumber.hashCode), date.hashCode), dueDate.hashCode), publicNotes.hashCode), privateNotes.hashCode), terms.hashCode), footer.hashCode), designId.hashCode), usesInclusiveTaxes.hashCode), taxName1.hashCode), taxRate1.hashCode), taxName2.hashCode), taxRate2.hashCode), taxName3.hashCode), taxRate3.hashCode), isAmountDiscount.hashCode), partial.hashCode), taxAmount.hashCode), partialDueDate.hashCode), autoBill.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), customSurcharge1.hashCode), customSurcharge2.hashCode), customSurcharge3.hashCode), customSurcharge4.hashCode), customTaxes1.hashCode), customTaxes2.hashCode), customTaxes3.hashCode), customTaxes4.hashCode), exchangeRate.hashCode), reminder1Sent.hashCode), reminder2Sent.hashCode), reminder3Sent.hashCode), reminderLastSent.hashCode), frequencyId.hashCode), lastSentDate.hashCode), nextSendDate.hashCode), remainingCycles.hashCode), dueDateDays.hashCode),
|
||||||
recurringId.hashCode),
|
invoiceId.hashCode),
|
||||||
autoBillEnabled.hashCode),
|
recurringId.hashCode),
|
||||||
filename.hashCode),
|
autoBillEnabled.hashCode),
|
||||||
recurringDates.hashCode),
|
filename.hashCode),
|
||||||
lineItems.hashCode),
|
recurringDates.hashCode),
|
||||||
invitations.hashCode),
|
lineItems.hashCode),
|
||||||
documents.hashCode),
|
invitations.hashCode),
|
||||||
activities.hashCode),
|
documents.hashCode),
|
||||||
history.hashCode),
|
activities.hashCode),
|
||||||
loadedAt.hashCode),
|
loadedAt.hashCode),
|
||||||
isChanged.hashCode),
|
isChanged.hashCode),
|
||||||
createdAt.hashCode),
|
createdAt.hashCode),
|
||||||
|
|
@ -1905,7 +1880,6 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
..add('invitations', invitations)
|
..add('invitations', invitations)
|
||||||
..add('documents', documents)
|
..add('documents', documents)
|
||||||
..add('activities', activities)
|
..add('activities', activities)
|
||||||
..add('history', history)
|
|
||||||
..add('loadedAt', loadedAt)
|
..add('loadedAt', loadedAt)
|
||||||
..add('isChanged', isChanged)
|
..add('isChanged', isChanged)
|
||||||
..add('createdAt', createdAt)
|
..add('createdAt', createdAt)
|
||||||
|
|
@ -2184,12 +2158,6 @@ class InvoiceEntityBuilder
|
||||||
set activities(ListBuilder<ActivityEntity> activities) =>
|
set activities(ListBuilder<ActivityEntity> activities) =>
|
||||||
_$this._activities = activities;
|
_$this._activities = activities;
|
||||||
|
|
||||||
ListBuilder<InvoiceHistoryEntity> _history;
|
|
||||||
ListBuilder<InvoiceHistoryEntity> get history =>
|
|
||||||
_$this._history ??= new ListBuilder<InvoiceHistoryEntity>();
|
|
||||||
set history(ListBuilder<InvoiceHistoryEntity> history) =>
|
|
||||||
_$this._history = history;
|
|
||||||
|
|
||||||
int _loadedAt;
|
int _loadedAt;
|
||||||
int get loadedAt => _$this._loadedAt;
|
int get loadedAt => _$this._loadedAt;
|
||||||
set loadedAt(int loadedAt) => _$this._loadedAt = loadedAt;
|
set loadedAt(int loadedAt) => _$this._loadedAt = loadedAt;
|
||||||
|
|
@ -2298,7 +2266,6 @@ class InvoiceEntityBuilder
|
||||||
_invitations = $v.invitations.toBuilder();
|
_invitations = $v.invitations.toBuilder();
|
||||||
_documents = $v.documents.toBuilder();
|
_documents = $v.documents.toBuilder();
|
||||||
_activities = $v.activities.toBuilder();
|
_activities = $v.activities.toBuilder();
|
||||||
_history = $v.history?.toBuilder();
|
|
||||||
_loadedAt = $v.loadedAt;
|
_loadedAt = $v.loadedAt;
|
||||||
_isChanged = $v.isChanged;
|
_isChanged = $v.isChanged;
|
||||||
_createdAt = $v.createdAt;
|
_createdAt = $v.createdAt;
|
||||||
|
|
@ -2398,7 +2365,6 @@ class InvoiceEntityBuilder
|
||||||
invitations: invitations.build(),
|
invitations: invitations.build(),
|
||||||
documents: documents.build(),
|
documents: documents.build(),
|
||||||
activities: activities.build(),
|
activities: activities.build(),
|
||||||
history: _history?.build(),
|
|
||||||
loadedAt: loadedAt,
|
loadedAt: loadedAt,
|
||||||
isChanged: isChanged,
|
isChanged: isChanged,
|
||||||
createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, 'InvoiceEntity', 'createdAt'),
|
createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, 'InvoiceEntity', 'createdAt'),
|
||||||
|
|
@ -2422,8 +2388,6 @@ class InvoiceEntityBuilder
|
||||||
documents.build();
|
documents.build();
|
||||||
_$failedField = 'activities';
|
_$failedField = 'activities';
|
||||||
activities.build();
|
activities.build();
|
||||||
_$failedField = 'history';
|
|
||||||
_history?.build();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new BuiltValueNestedFieldError(
|
throw new BuiltValueNestedFieldError(
|
||||||
'InvoiceEntity', _$failedField, e.toString());
|
'InvoiceEntity', _$failedField, e.toString());
|
||||||
|
|
@ -3211,8 +3175,6 @@ class _$InvoiceHistoryEntity extends InvoiceHistoryEntity {
|
||||||
@override
|
@override
|
||||||
final String id;
|
final String id;
|
||||||
@override
|
@override
|
||||||
final ActivityEntity activity;
|
|
||||||
@override
|
|
||||||
final String activityId;
|
final String activityId;
|
||||||
@override
|
@override
|
||||||
final String htmlBackup;
|
final String htmlBackup;
|
||||||
|
|
@ -3226,16 +3188,9 @@ class _$InvoiceHistoryEntity extends InvoiceHistoryEntity {
|
||||||
(new InvoiceHistoryEntityBuilder()..update(updates)).build();
|
(new InvoiceHistoryEntityBuilder()..update(updates)).build();
|
||||||
|
|
||||||
_$InvoiceHistoryEntity._(
|
_$InvoiceHistoryEntity._(
|
||||||
{this.id,
|
{this.id, this.activityId, this.htmlBackup, this.createdAt, this.amount})
|
||||||
this.activity,
|
|
||||||
this.activityId,
|
|
||||||
this.htmlBackup,
|
|
||||||
this.createdAt,
|
|
||||||
this.amount})
|
|
||||||
: super._() {
|
: super._() {
|
||||||
BuiltValueNullFieldError.checkNotNull(id, 'InvoiceHistoryEntity', 'id');
|
BuiltValueNullFieldError.checkNotNull(id, 'InvoiceHistoryEntity', 'id');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
|
||||||
activity, 'InvoiceHistoryEntity', 'activity');
|
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
activityId, 'InvoiceHistoryEntity', 'activityId');
|
activityId, 'InvoiceHistoryEntity', 'activityId');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
|
|
@ -3260,7 +3215,6 @@ class _$InvoiceHistoryEntity extends InvoiceHistoryEntity {
|
||||||
if (identical(other, this)) return true;
|
if (identical(other, this)) return true;
|
||||||
return other is InvoiceHistoryEntity &&
|
return other is InvoiceHistoryEntity &&
|
||||||
id == other.id &&
|
id == other.id &&
|
||||||
activity == other.activity &&
|
|
||||||
activityId == other.activityId &&
|
activityId == other.activityId &&
|
||||||
htmlBackup == other.htmlBackup &&
|
htmlBackup == other.htmlBackup &&
|
||||||
createdAt == other.createdAt &&
|
createdAt == other.createdAt &&
|
||||||
|
|
@ -3272,9 +3226,7 @@ class _$InvoiceHistoryEntity extends InvoiceHistoryEntity {
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return __hashCode ??= $jf($jc(
|
return __hashCode ??= $jf($jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc($jc($jc(0, id.hashCode), activityId.hashCode),
|
||||||
$jc($jc($jc(0, id.hashCode), activity.hashCode),
|
|
||||||
activityId.hashCode),
|
|
||||||
htmlBackup.hashCode),
|
htmlBackup.hashCode),
|
||||||
createdAt.hashCode),
|
createdAt.hashCode),
|
||||||
amount.hashCode));
|
amount.hashCode));
|
||||||
|
|
@ -3284,7 +3236,6 @@ class _$InvoiceHistoryEntity extends InvoiceHistoryEntity {
|
||||||
String toString() {
|
String toString() {
|
||||||
return (newBuiltValueToStringHelper('InvoiceHistoryEntity')
|
return (newBuiltValueToStringHelper('InvoiceHistoryEntity')
|
||||||
..add('id', id)
|
..add('id', id)
|
||||||
..add('activity', activity)
|
|
||||||
..add('activityId', activityId)
|
..add('activityId', activityId)
|
||||||
..add('htmlBackup', htmlBackup)
|
..add('htmlBackup', htmlBackup)
|
||||||
..add('createdAt', createdAt)
|
..add('createdAt', createdAt)
|
||||||
|
|
@ -3301,11 +3252,6 @@ class InvoiceHistoryEntityBuilder
|
||||||
String get id => _$this._id;
|
String get id => _$this._id;
|
||||||
set id(String id) => _$this._id = id;
|
set id(String id) => _$this._id = id;
|
||||||
|
|
||||||
ActivityEntityBuilder _activity;
|
|
||||||
ActivityEntityBuilder get activity =>
|
|
||||||
_$this._activity ??= new ActivityEntityBuilder();
|
|
||||||
set activity(ActivityEntityBuilder activity) => _$this._activity = activity;
|
|
||||||
|
|
||||||
String _activityId;
|
String _activityId;
|
||||||
String get activityId => _$this._activityId;
|
String get activityId => _$this._activityId;
|
||||||
set activityId(String activityId) => _$this._activityId = activityId;
|
set activityId(String activityId) => _$this._activityId = activityId;
|
||||||
|
|
@ -3328,7 +3274,6 @@ class InvoiceHistoryEntityBuilder
|
||||||
final $v = _$v;
|
final $v = _$v;
|
||||||
if ($v != null) {
|
if ($v != null) {
|
||||||
_id = $v.id;
|
_id = $v.id;
|
||||||
_activity = $v.activity.toBuilder();
|
|
||||||
_activityId = $v.activityId;
|
_activityId = $v.activityId;
|
||||||
_htmlBackup = $v.htmlBackup;
|
_htmlBackup = $v.htmlBackup;
|
||||||
_createdAt = $v.createdAt;
|
_createdAt = $v.createdAt;
|
||||||
|
|
@ -3351,32 +3296,18 @@ class InvoiceHistoryEntityBuilder
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_$InvoiceHistoryEntity build() {
|
_$InvoiceHistoryEntity build() {
|
||||||
_$InvoiceHistoryEntity _$result;
|
final _$result = _$v ??
|
||||||
try {
|
new _$InvoiceHistoryEntity._(
|
||||||
_$result = _$v ??
|
id: BuiltValueNullFieldError.checkNotNull(
|
||||||
new _$InvoiceHistoryEntity._(
|
id, 'InvoiceHistoryEntity', 'id'),
|
||||||
id: BuiltValueNullFieldError.checkNotNull(
|
activityId: BuiltValueNullFieldError.checkNotNull(
|
||||||
id, 'InvoiceHistoryEntity', 'id'),
|
activityId, 'InvoiceHistoryEntity', 'activityId'),
|
||||||
activity: activity.build(),
|
htmlBackup: BuiltValueNullFieldError.checkNotNull(
|
||||||
activityId: BuiltValueNullFieldError.checkNotNull(
|
htmlBackup, 'InvoiceHistoryEntity', 'htmlBackup'),
|
||||||
activityId, 'InvoiceHistoryEntity', 'activityId'),
|
createdAt: BuiltValueNullFieldError.checkNotNull(
|
||||||
htmlBackup: BuiltValueNullFieldError.checkNotNull(
|
createdAt, 'InvoiceHistoryEntity', 'createdAt'),
|
||||||
htmlBackup, 'InvoiceHistoryEntity', 'htmlBackup'),
|
amount: BuiltValueNullFieldError.checkNotNull(
|
||||||
createdAt: BuiltValueNullFieldError.checkNotNull(
|
amount, 'InvoiceHistoryEntity', 'amount'));
|
||||||
createdAt, 'InvoiceHistoryEntity', 'createdAt'),
|
|
||||||
amount: BuiltValueNullFieldError.checkNotNull(
|
|
||||||
amount, 'InvoiceHistoryEntity', 'amount'));
|
|
||||||
} catch (_) {
|
|
||||||
String _$failedField;
|
|
||||||
try {
|
|
||||||
_$failedField = 'activity';
|
|
||||||
activity.build();
|
|
||||||
} catch (e) {
|
|
||||||
throw new BuiltValueNestedFieldError(
|
|
||||||
'InvoiceHistoryEntity', _$failedField, e.toString());
|
|
||||||
}
|
|
||||||
rethrow;
|
|
||||||
}
|
|
||||||
replace(_$result);
|
replace(_$result);
|
||||||
return _$result;
|
return _$result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -458,10 +458,6 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
||||||
..addBuilderFactory(
|
..addBuilderFactory(
|
||||||
const FullType(BuiltList, const [const FullType(ActivityEntity)]),
|
const FullType(BuiltList, const [const FullType(ActivityEntity)]),
|
||||||
() => new ListBuilder<ActivityEntity>())
|
() => new ListBuilder<ActivityEntity>())
|
||||||
..addBuilderFactory(
|
|
||||||
const FullType(
|
|
||||||
BuiltList, const [const FullType(InvoiceHistoryEntity)]),
|
|
||||||
() => new ListBuilder<InvoiceHistoryEntity>())
|
|
||||||
..addBuilderFactory(
|
..addBuilderFactory(
|
||||||
const FullType(BuiltList, const [const FullType(LanguageEntity)]),
|
const FullType(BuiltList, const [const FullType(LanguageEntity)]),
|
||||||
() => new ListBuilder<LanguageEntity>())
|
() => new ListBuilder<LanguageEntity>())
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class InvoiceRepository {
|
||||||
Future<InvoiceEntity> loadItem(
|
Future<InvoiceEntity> loadItem(
|
||||||
Credentials credentials, String entityId) async {
|
Credentials credentials, String entityId) async {
|
||||||
final dynamic response = await webClient.get(
|
final dynamic response = await webClient.get(
|
||||||
'${credentials.url}/invoices/$entityId?include=history,activities',
|
'${credentials.url}/invoices/$entityId?include=activities.history',
|
||||||
credentials.token);
|
credentials.token);
|
||||||
|
|
||||||
final InvoiceItemResponse invoiceResponse = await compute<dynamic, dynamic>(
|
final InvoiceItemResponse invoiceResponse = await compute<dynamic, dynamic>(
|
||||||
|
|
@ -67,12 +67,12 @@ class InvoiceRepository {
|
||||||
|
|
||||||
if (invoice.isNew) {
|
if (invoice.isNew) {
|
||||||
response = await webClient.post(
|
response = await webClient.post(
|
||||||
credentials.url + '/invoices?include=history,activities',
|
credentials.url + '/invoices?include=activities.history',
|
||||||
credentials.token,
|
credentials.token,
|
||||||
data: json.encode(data));
|
data: json.encode(data));
|
||||||
} else {
|
} else {
|
||||||
final url =
|
final url =
|
||||||
'${credentials.url}/invoices/${invoice.id}?include=history,activities';
|
'${credentials.url}/invoices/${invoice.id}?include=activities.history';
|
||||||
response =
|
response =
|
||||||
await webClient.put(url, credentials.token, data: json.encode(data));
|
await webClient.put(url, credentials.token, data: json.encode(data));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,17 @@ class _InvoiceViewHistoryState extends State<InvoiceViewHistory> {
|
||||||
return LoadingIndicator();
|
return LoadingIndicator();
|
||||||
}
|
}
|
||||||
|
|
||||||
final historyList = invoice.history.toList();
|
final activityList = invoice.activities
|
||||||
historyList.sort((a, b) => b.createdAt.compareTo(a.createdAt));
|
.where((activity) => activity.history != null)
|
||||||
|
.toList();
|
||||||
|
activityList.sort((a, b) => b.updatedAt.compareTo(a.updatedAt));
|
||||||
|
|
||||||
return ScrollableListViewBuilder(
|
return ScrollableListViewBuilder(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
itemBuilder: (BuildContext context, index) {
|
itemBuilder: (BuildContext context, index) {
|
||||||
final history = historyList[index];
|
final activity = activityList[index];
|
||||||
final user = viewModel.state.userState.get(history.activity.userId);
|
final history = activity.history;
|
||||||
|
final user = viewModel.state.userState.get(activity.userId);
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue