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