Add total hours to projects
This commit is contained in:
parent
1846211ca9
commit
1b63b65bc5
|
|
@ -66,6 +66,7 @@ class ProjectFields {
|
||||||
static const String archivedAt = 'archived_at';
|
static const String archivedAt = 'archived_at';
|
||||||
static const String isDeleted = 'is_deleted';
|
static const String isDeleted = 'is_deleted';
|
||||||
static const String documents = 'documents';
|
static const String documents = 'documents';
|
||||||
|
static const String totalHours = 'total_hours';
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class ProjectEntity extends Object
|
abstract class ProjectEntity extends Object
|
||||||
|
|
@ -99,6 +100,7 @@ abstract class ProjectEntity extends Object
|
||||||
createdUserId: '',
|
createdUserId: '',
|
||||||
createdAt: 0,
|
createdAt: 0,
|
||||||
assignedUserId: user?.id ?? '',
|
assignedUserId: user?.id ?? '',
|
||||||
|
totalHours: 0.0,
|
||||||
documents: BuiltList<DocumentEntity>(),
|
documents: BuiltList<DocumentEntity>(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -158,6 +160,9 @@ abstract class ProjectEntity extends Object
|
||||||
|
|
||||||
String get number;
|
String get number;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: 'current_hours')
|
||||||
|
double get totalHours;
|
||||||
|
|
||||||
BuiltList<DocumentEntity> get documents;
|
BuiltList<DocumentEntity> get documents;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -254,6 +259,9 @@ abstract class ProjectEntity extends Object
|
||||||
case ProjectFields.budgetedHours:
|
case ProjectFields.budgetedHours:
|
||||||
response = projectA.budgetedHours.compareTo(projectB.budgetedHours);
|
response = projectA.budgetedHours.compareTo(projectB.budgetedHours);
|
||||||
break;
|
break;
|
||||||
|
case ProjectFields.totalHours:
|
||||||
|
response = projectA.totalHours.compareTo(projectB.totalHours);
|
||||||
|
break;
|
||||||
case EntityFields.state:
|
case EntityFields.state:
|
||||||
final stateA =
|
final stateA =
|
||||||
EntityState.valueOf(projectA.entityState) ?? EntityState.active;
|
EntityState.valueOf(projectA.entityState) ?? EntityState.active;
|
||||||
|
|
@ -367,8 +375,9 @@ abstract class ProjectEntity extends Object
|
||||||
FormatNumberType get listDisplayAmountType => FormatNumberType.money;
|
FormatNumberType get listDisplayAmountType => FormatNumberType.money;
|
||||||
|
|
||||||
// ignore: unused_element
|
// ignore: unused_element
|
||||||
static void _initializeBuilder(ProjectEntityBuilder builder) =>
|
static void _initializeBuilder(ProjectEntityBuilder builder) => builder
|
||||||
builder..color = '';
|
..color = ''
|
||||||
|
..totalHours = 0;
|
||||||
|
|
||||||
static Serializer<ProjectEntity> get serializer => _$projectEntitySerializer;
|
static Serializer<ProjectEntity> get serializer => _$projectEntitySerializer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,9 @@ class _$ProjectEntitySerializer implements StructuredSerializer<ProjectEntity> {
|
||||||
'number',
|
'number',
|
||||||
serializers.serialize(object.number,
|
serializers.serialize(object.number,
|
||||||
specifiedType: const FullType(String)),
|
specifiedType: const FullType(String)),
|
||||||
|
'current_hours',
|
||||||
|
serializers.serialize(object.totalHours,
|
||||||
|
specifiedType: const FullType(double)),
|
||||||
'documents',
|
'documents',
|
||||||
serializers.serialize(object.documents,
|
serializers.serialize(object.documents,
|
||||||
specifiedType: const FullType(
|
specifiedType: const FullType(
|
||||||
|
|
@ -268,6 +271,10 @@ class _$ProjectEntitySerializer implements StructuredSerializer<ProjectEntity> {
|
||||||
result.number = serializers.deserialize(value,
|
result.number = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
break;
|
break;
|
||||||
|
case 'current_hours':
|
||||||
|
result.totalHours = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(double)) as double;
|
||||||
|
break;
|
||||||
case 'documents':
|
case 'documents':
|
||||||
result.documents.replace(serializers.deserialize(value,
|
result.documents.replace(serializers.deserialize(value,
|
||||||
specifiedType: const FullType(
|
specifiedType: const FullType(
|
||||||
|
|
@ -538,6 +545,8 @@ class _$ProjectEntity extends ProjectEntity {
|
||||||
@override
|
@override
|
||||||
final String number;
|
final String number;
|
||||||
@override
|
@override
|
||||||
|
final double totalHours;
|
||||||
|
@override
|
||||||
final BuiltList<DocumentEntity> documents;
|
final BuiltList<DocumentEntity> documents;
|
||||||
@override
|
@override
|
||||||
final bool isChanged;
|
final bool isChanged;
|
||||||
|
|
@ -573,6 +582,7 @@ class _$ProjectEntity extends ProjectEntity {
|
||||||
this.customValue3,
|
this.customValue3,
|
||||||
this.customValue4,
|
this.customValue4,
|
||||||
this.number,
|
this.number,
|
||||||
|
this.totalHours,
|
||||||
this.documents,
|
this.documents,
|
||||||
this.isChanged,
|
this.isChanged,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
|
|
@ -605,6 +615,8 @@ class _$ProjectEntity extends ProjectEntity {
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
customValue4, r'ProjectEntity', 'customValue4');
|
customValue4, r'ProjectEntity', 'customValue4');
|
||||||
BuiltValueNullFieldError.checkNotNull(number, r'ProjectEntity', 'number');
|
BuiltValueNullFieldError.checkNotNull(number, r'ProjectEntity', 'number');
|
||||||
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
|
totalHours, r'ProjectEntity', 'totalHours');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
documents, r'ProjectEntity', 'documents');
|
documents, r'ProjectEntity', 'documents');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
|
|
@ -640,6 +652,7 @@ class _$ProjectEntity extends ProjectEntity {
|
||||||
customValue3 == other.customValue3 &&
|
customValue3 == other.customValue3 &&
|
||||||
customValue4 == other.customValue4 &&
|
customValue4 == other.customValue4 &&
|
||||||
number == other.number &&
|
number == other.number &&
|
||||||
|
totalHours == other.totalHours &&
|
||||||
documents == other.documents &&
|
documents == other.documents &&
|
||||||
isChanged == other.isChanged &&
|
isChanged == other.isChanged &&
|
||||||
createdAt == other.createdAt &&
|
createdAt == other.createdAt &&
|
||||||
|
|
@ -669,6 +682,7 @@ class _$ProjectEntity extends ProjectEntity {
|
||||||
_$hash = $jc(_$hash, customValue3.hashCode);
|
_$hash = $jc(_$hash, customValue3.hashCode);
|
||||||
_$hash = $jc(_$hash, customValue4.hashCode);
|
_$hash = $jc(_$hash, customValue4.hashCode);
|
||||||
_$hash = $jc(_$hash, number.hashCode);
|
_$hash = $jc(_$hash, number.hashCode);
|
||||||
|
_$hash = $jc(_$hash, totalHours.hashCode);
|
||||||
_$hash = $jc(_$hash, documents.hashCode);
|
_$hash = $jc(_$hash, documents.hashCode);
|
||||||
_$hash = $jc(_$hash, isChanged.hashCode);
|
_$hash = $jc(_$hash, isChanged.hashCode);
|
||||||
_$hash = $jc(_$hash, createdAt.hashCode);
|
_$hash = $jc(_$hash, createdAt.hashCode);
|
||||||
|
|
@ -698,6 +712,7 @@ class _$ProjectEntity extends ProjectEntity {
|
||||||
..add('customValue3', customValue3)
|
..add('customValue3', customValue3)
|
||||||
..add('customValue4', customValue4)
|
..add('customValue4', customValue4)
|
||||||
..add('number', number)
|
..add('number', number)
|
||||||
|
..add('totalHours', totalHours)
|
||||||
..add('documents', documents)
|
..add('documents', documents)
|
||||||
..add('isChanged', isChanged)
|
..add('isChanged', isChanged)
|
||||||
..add('createdAt', createdAt)
|
..add('createdAt', createdAt)
|
||||||
|
|
@ -768,6 +783,10 @@ class ProjectEntityBuilder
|
||||||
String get number => _$this._number;
|
String get number => _$this._number;
|
||||||
set number(String number) => _$this._number = number;
|
set number(String number) => _$this._number = number;
|
||||||
|
|
||||||
|
double _totalHours;
|
||||||
|
double get totalHours => _$this._totalHours;
|
||||||
|
set totalHours(double totalHours) => _$this._totalHours = totalHours;
|
||||||
|
|
||||||
ListBuilder<DocumentEntity> _documents;
|
ListBuilder<DocumentEntity> _documents;
|
||||||
ListBuilder<DocumentEntity> get documents =>
|
ListBuilder<DocumentEntity> get documents =>
|
||||||
_$this._documents ??= new ListBuilder<DocumentEntity>();
|
_$this._documents ??= new ListBuilder<DocumentEntity>();
|
||||||
|
|
@ -828,6 +847,7 @@ class ProjectEntityBuilder
|
||||||
_customValue3 = $v.customValue3;
|
_customValue3 = $v.customValue3;
|
||||||
_customValue4 = $v.customValue4;
|
_customValue4 = $v.customValue4;
|
||||||
_number = $v.number;
|
_number = $v.number;
|
||||||
|
_totalHours = $v.totalHours;
|
||||||
_documents = $v.documents.toBuilder();
|
_documents = $v.documents.toBuilder();
|
||||||
_isChanged = $v.isChanged;
|
_isChanged = $v.isChanged;
|
||||||
_createdAt = $v.createdAt;
|
_createdAt = $v.createdAt;
|
||||||
|
|
@ -883,6 +903,7 @@ class ProjectEntityBuilder
|
||||||
customValue3: BuiltValueNullFieldError.checkNotNull(customValue3, r'ProjectEntity', 'customValue3'),
|
customValue3: BuiltValueNullFieldError.checkNotNull(customValue3, r'ProjectEntity', 'customValue3'),
|
||||||
customValue4: BuiltValueNullFieldError.checkNotNull(customValue4, r'ProjectEntity', 'customValue4'),
|
customValue4: BuiltValueNullFieldError.checkNotNull(customValue4, r'ProjectEntity', 'customValue4'),
|
||||||
number: BuiltValueNullFieldError.checkNotNull(number, r'ProjectEntity', 'number'),
|
number: BuiltValueNullFieldError.checkNotNull(number, r'ProjectEntity', 'number'),
|
||||||
|
totalHours: BuiltValueNullFieldError.checkNotNull(totalHours, r'ProjectEntity', 'totalHours'),
|
||||||
documents: documents.build(),
|
documents: documents.build(),
|
||||||
isChanged: isChanged,
|
isChanged: isChanged,
|
||||||
createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, r'ProjectEntity', 'createdAt'),
|
createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, r'ProjectEntity', 'createdAt'),
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,10 @@ class ProjectPresenter extends EntityPresenter {
|
||||||
ProjectFields.client,
|
ProjectFields.client,
|
||||||
ProjectFields.taskRate,
|
ProjectFields.taskRate,
|
||||||
ProjectFields.dueDate,
|
ProjectFields.dueDate,
|
||||||
|
ProjectFields.budgetedHours,
|
||||||
|
ProjectFields.totalHours,
|
||||||
ProjectFields.publicNotes,
|
ProjectFields.publicNotes,
|
||||||
ProjectFields.privateNotes,
|
ProjectFields.privateNotes,
|
||||||
ProjectFields.budgetedHours,
|
|
||||||
EntityFields.state,
|
EntityFields.state,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -79,6 +80,9 @@ class ProjectPresenter extends EntityPresenter {
|
||||||
return Text(presentCustomField(context, project.customValue4));
|
return Text(presentCustomField(context, project.customValue4));
|
||||||
case ProjectFields.documents:
|
case ProjectFields.documents:
|
||||||
return Text('${project.documents.length}');
|
return Text('${project.documents.length}');
|
||||||
|
case ProjectFields.totalHours:
|
||||||
|
return Text(formatNumber(project.totalHours, context,
|
||||||
|
formatNumberType: FormatNumberType.double));
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getField(field: field, context: context);
|
return super.getField(field: field, context: context);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
// STARTER: lang key - do not remove comment
|
// STARTER: lang key - do not remove comment
|
||||||
|
'total_hours': 'Total Hours',
|
||||||
'date_picker_hint': 'Use +days to set the date in the future',
|
'date_picker_hint': 'Use +days to set the date in the future',
|
||||||
'browser_pdf_viewer': 'Use Browser PDF Viewer',
|
'browser_pdf_viewer': 'Use Browser PDF Viewer',
|
||||||
'browser_pdf_viewer_help':
|
'browser_pdf_viewer_help':
|
||||||
|
|
@ -98285,6 +98286,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
_localizedValues[localeCode]['date_picker_hint'] ??
|
_localizedValues[localeCode]['date_picker_hint'] ??
|
||||||
_localizedValues['en']['date_picker_hint'];
|
_localizedValues['en']['date_picker_hint'];
|
||||||
|
|
||||||
|
String get totalHours =>
|
||||||
|
_localizedValues[localeCode]['total_hours'] ??
|
||||||
|
_localizedValues['en']['total_hours'];
|
||||||
|
|
||||||
// STARTER: lang field - do not remove comment
|
// STARTER: lang field - do not remove comment
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue