Tasks
This commit is contained in:
parent
3d3a9f8031
commit
dddbb5aa16
|
|
@ -554,6 +554,14 @@ abstract class InvoiceItemEntity extends Object
|
||||||
|
|
||||||
double get discount;
|
double get discount;
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
@BuiltValueField(wireName: 'task_public_id')
|
||||||
|
int get taskId;
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
@BuiltValueField(wireName: 'expense_public_id')
|
||||||
|
int get expenseId;
|
||||||
|
|
||||||
double get total => round(qty * cost, 2);
|
double get total => round(qty * cost, 2);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -560,6 +560,18 @@ class _$InvoiceItemEntitySerializer
|
||||||
serializers.serialize(object.discount,
|
serializers.serialize(object.discount,
|
||||||
specifiedType: const FullType(double)),
|
specifiedType: const FullType(double)),
|
||||||
];
|
];
|
||||||
|
if (object.taskId != null) {
|
||||||
|
result
|
||||||
|
..add('task_public_id')
|
||||||
|
..add(serializers.serialize(object.taskId,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
|
if (object.expenseId != null) {
|
||||||
|
result
|
||||||
|
..add('expense_public_id')
|
||||||
|
..add(serializers.serialize(object.expenseId,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
if (object.createdAt != null) {
|
if (object.createdAt != null) {
|
||||||
result
|
result
|
||||||
..add('created_at')
|
..add('created_at')
|
||||||
|
|
@ -659,6 +671,14 @@ class _$InvoiceItemEntitySerializer
|
||||||
result.discount = serializers.deserialize(value,
|
result.discount = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(double)) as double;
|
specifiedType: const FullType(double)) as double;
|
||||||
break;
|
break;
|
||||||
|
case 'task_public_id':
|
||||||
|
result.taskId = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
break;
|
||||||
|
case 'expense_public_id':
|
||||||
|
result.expenseId = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
break;
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
result.createdAt = serializers.deserialize(value,
|
result.createdAt = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(int)) as int;
|
specifiedType: const FullType(int)) as int;
|
||||||
|
|
@ -1809,6 +1829,10 @@ class _$InvoiceItemEntity extends InvoiceItemEntity {
|
||||||
@override
|
@override
|
||||||
final double discount;
|
final double discount;
|
||||||
@override
|
@override
|
||||||
|
final int taskId;
|
||||||
|
@override
|
||||||
|
final int expenseId;
|
||||||
|
@override
|
||||||
final int createdAt;
|
final int createdAt;
|
||||||
@override
|
@override
|
||||||
final int updatedAt;
|
final int updatedAt;
|
||||||
|
|
@ -1837,6 +1861,8 @@ class _$InvoiceItemEntity extends InvoiceItemEntity {
|
||||||
this.customValue1,
|
this.customValue1,
|
||||||
this.customValue2,
|
this.customValue2,
|
||||||
this.discount,
|
this.discount,
|
||||||
|
this.taskId,
|
||||||
|
this.expenseId,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
this.archivedAt,
|
this.archivedAt,
|
||||||
|
|
@ -1907,6 +1933,8 @@ class _$InvoiceItemEntity extends InvoiceItemEntity {
|
||||||
customValue1 == other.customValue1 &&
|
customValue1 == other.customValue1 &&
|
||||||
customValue2 == other.customValue2 &&
|
customValue2 == other.customValue2 &&
|
||||||
discount == other.discount &&
|
discount == other.discount &&
|
||||||
|
taskId == other.taskId &&
|
||||||
|
expenseId == other.expenseId &&
|
||||||
createdAt == other.createdAt &&
|
createdAt == other.createdAt &&
|
||||||
updatedAt == other.updatedAt &&
|
updatedAt == other.updatedAt &&
|
||||||
archivedAt == other.archivedAt &&
|
archivedAt == other.archivedAt &&
|
||||||
|
|
@ -1935,21 +1963,20 @@ class _$InvoiceItemEntity extends InvoiceItemEntity {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
0,
|
$jc($jc(0, productKey.hashCode),
|
||||||
productKey
|
notes.hashCode),
|
||||||
.hashCode),
|
cost.hashCode),
|
||||||
notes
|
qty.hashCode),
|
||||||
.hashCode),
|
taxName1.hashCode),
|
||||||
cost.hashCode),
|
taxRate1.hashCode),
|
||||||
qty.hashCode),
|
taxName2.hashCode),
|
||||||
taxName1.hashCode),
|
taxRate2.hashCode),
|
||||||
taxRate1.hashCode),
|
invoiceItemTypeId.hashCode),
|
||||||
taxName2.hashCode),
|
customValue1.hashCode),
|
||||||
taxRate2.hashCode),
|
customValue2.hashCode),
|
||||||
invoiceItemTypeId.hashCode),
|
discount.hashCode),
|
||||||
customValue1.hashCode),
|
taskId.hashCode),
|
||||||
customValue2.hashCode),
|
expenseId.hashCode),
|
||||||
discount.hashCode),
|
|
||||||
createdAt.hashCode),
|
createdAt.hashCode),
|
||||||
updatedAt.hashCode),
|
updatedAt.hashCode),
|
||||||
archivedAt.hashCode),
|
archivedAt.hashCode),
|
||||||
|
|
@ -1973,6 +2000,8 @@ class _$InvoiceItemEntity extends InvoiceItemEntity {
|
||||||
..add('customValue1', customValue1)
|
..add('customValue1', customValue1)
|
||||||
..add('customValue2', customValue2)
|
..add('customValue2', customValue2)
|
||||||
..add('discount', discount)
|
..add('discount', discount)
|
||||||
|
..add('taskId', taskId)
|
||||||
|
..add('expenseId', expenseId)
|
||||||
..add('createdAt', createdAt)
|
..add('createdAt', createdAt)
|
||||||
..add('updatedAt', updatedAt)
|
..add('updatedAt', updatedAt)
|
||||||
..add('archivedAt', archivedAt)
|
..add('archivedAt', archivedAt)
|
||||||
|
|
@ -2036,6 +2065,14 @@ class InvoiceItemEntityBuilder
|
||||||
double get discount => _$this._discount;
|
double get discount => _$this._discount;
|
||||||
set discount(double discount) => _$this._discount = discount;
|
set discount(double discount) => _$this._discount = discount;
|
||||||
|
|
||||||
|
int _taskId;
|
||||||
|
int get taskId => _$this._taskId;
|
||||||
|
set taskId(int taskId) => _$this._taskId = taskId;
|
||||||
|
|
||||||
|
int _expenseId;
|
||||||
|
int get expenseId => _$this._expenseId;
|
||||||
|
set expenseId(int expenseId) => _$this._expenseId = expenseId;
|
||||||
|
|
||||||
int _createdAt;
|
int _createdAt;
|
||||||
int get createdAt => _$this._createdAt;
|
int get createdAt => _$this._createdAt;
|
||||||
set createdAt(int createdAt) => _$this._createdAt = createdAt;
|
set createdAt(int createdAt) => _$this._createdAt = createdAt;
|
||||||
|
|
@ -2076,6 +2113,8 @@ class InvoiceItemEntityBuilder
|
||||||
_customValue1 = _$v.customValue1;
|
_customValue1 = _$v.customValue1;
|
||||||
_customValue2 = _$v.customValue2;
|
_customValue2 = _$v.customValue2;
|
||||||
_discount = _$v.discount;
|
_discount = _$v.discount;
|
||||||
|
_taskId = _$v.taskId;
|
||||||
|
_expenseId = _$v.expenseId;
|
||||||
_createdAt = _$v.createdAt;
|
_createdAt = _$v.createdAt;
|
||||||
_updatedAt = _$v.updatedAt;
|
_updatedAt = _$v.updatedAt;
|
||||||
_archivedAt = _$v.archivedAt;
|
_archivedAt = _$v.archivedAt;
|
||||||
|
|
@ -2116,6 +2155,8 @@ class InvoiceItemEntityBuilder
|
||||||
customValue1: customValue1,
|
customValue1: customValue1,
|
||||||
customValue2: customValue2,
|
customValue2: customValue2,
|
||||||
discount: discount,
|
discount: discount,
|
||||||
|
taskId: taskId,
|
||||||
|
expenseId: expenseId,
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
updatedAt: updatedAt,
|
updatedAt: updatedAt,
|
||||||
archivedAt: archivedAt,
|
archivedAt: archivedAt,
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ abstract class TaskEntity extends Object
|
||||||
return updateTaskTime(taskTime, times.length - 1);
|
return updateTaskTime(taskTime, times.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get isPaid => invoiceId != null && invoiceId > 0;
|
bool get isInvoiced => invoiceId != null && invoiceId > 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
EntityType get entityType {
|
EntityType get entityType {
|
||||||
|
|
|
||||||
|
|
@ -80,45 +80,51 @@ class _TaskEditDetailsState extends State<TaskEditDetails> {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
FormCard(
|
FormCard(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
task.invoiceId == null ? EntityDropdown(
|
!task.isInvoiced
|
||||||
key: Key('__client_${task.clientId}__'),
|
? EntityDropdown(
|
||||||
entityType: EntityType.client,
|
key: Key('__client_${task.clientId}__'),
|
||||||
labelText: localization.client,
|
entityType: EntityType.client,
|
||||||
initialValue:
|
labelText: localization.client,
|
||||||
(state.clientState.map[task.clientId] ?? ClientEntity())
|
initialValue:
|
||||||
.displayName,
|
(state.clientState.map[task.clientId] ?? ClientEntity())
|
||||||
entityMap: state.clientState.map,
|
.displayName,
|
||||||
entityList: memoizedDropdownClientList(
|
entityMap: state.clientState.map,
|
||||||
state.clientState.map, state.clientState.list),
|
entityList: memoizedDropdownClientList(
|
||||||
onSelected: (client) {
|
state.clientState.map, state.clientState.list),
|
||||||
viewModel.onChanged(task.rebuild((b) => b
|
onSelected: (client) {
|
||||||
..clientId = client.id
|
viewModel.onChanged(task.rebuild((b) => b
|
||||||
..projectId = 0));
|
..clientId = client.id
|
||||||
},
|
..projectId = 0));
|
||||||
onAddPressed: (completer) {
|
},
|
||||||
viewModel.onAddClientPressed(context, completer);
|
onAddPressed: (completer) {
|
||||||
},
|
viewModel.onAddClientPressed(context, completer);
|
||||||
) : SizedBox(),
|
},
|
||||||
task.invoiceId == null ? EntityDropdown(
|
)
|
||||||
key: Key('__project_${task.clientId}__'),
|
: SizedBox(),
|
||||||
entityType: EntityType.project,
|
!task.isInvoiced
|
||||||
labelText: localization.project,
|
? EntityDropdown(
|
||||||
initialValue:
|
key: Key('__project_${task.clientId}__'),
|
||||||
(state.projectState.map[task.projectId] ?? ProjectEntity())
|
entityType: EntityType.project,
|
||||||
.name,
|
labelText: localization.project,
|
||||||
entityMap: state.projectState.map,
|
initialValue: (state.projectState.map[task.projectId] ??
|
||||||
entityList: memoizedDropdownProjectList(state.projectState.map,
|
ProjectEntity())
|
||||||
state.projectState.list, task.clientId),
|
.name,
|
||||||
onSelected: (selected) {
|
entityMap: state.projectState.map,
|
||||||
final project = selected as ProjectEntity;
|
entityList: memoizedDropdownProjectList(
|
||||||
viewModel.onChanged(task.rebuild((b) => b
|
state.projectState.map,
|
||||||
..projectId = project.id
|
state.projectState.list,
|
||||||
..clientId = project.clientId));
|
task.clientId),
|
||||||
},
|
onSelected: (selected) {
|
||||||
onAddPressed: (completer) {
|
final project = selected as ProjectEntity;
|
||||||
viewModel.onAddProjectPressed(context, completer);
|
viewModel.onChanged(task.rebuild((b) => b
|
||||||
},
|
..projectId = project.id
|
||||||
) : SizedBox(),
|
..clientId = project.clientId));
|
||||||
|
},
|
||||||
|
onAddPressed: (completer) {
|
||||||
|
viewModel.onAddProjectPressed(context, completer);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: SizedBox(),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
maxLines: 4,
|
maxLines: 4,
|
||||||
controller: _descriptionController,
|
controller: _descriptionController,
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ class _TaskViewState extends State<TaskView> {
|
||||||
final widgets = <Widget>[
|
final widgets = <Widget>[
|
||||||
TwoValueHeader(
|
TwoValueHeader(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
task.isPaid ? Colors.green : task.isRunning ? Colors.blue : null,
|
task.isInvoiced ? Colors.green : task.isRunning ? Colors.blue : null,
|
||||||
label1: localization.duration,
|
label1: localization.duration,
|
||||||
value1: formatDuration(task.calculateDuration),
|
value1: formatDuration(task.calculateDuration),
|
||||||
label2: localization.amount,
|
label2: localization.amount,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue