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