Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Hide the work package lookup in modal

bsatarnejadc5a14f06c429
diff --git a/frontend/src/app/modules/time_entries/create/create.service.ts b/frontend/src/app/modules/time_entries/create/create.service.ts
index dd8f1d252c5..822e79da088 100644
--- a/frontend/src/app/modules/time_entries/create/create.service.ts
+++ b/frontend/src/app/modules/time_entries/create/create.service.ts
@@ -46,16 +46,17 @@ export class TimeEntryCreateService {
}
public createNewTimeEntry(date:Moment, wp?:WorkPackageResource) {
- // Todo handle case that wp is not given
- let payload = {
- spentOn: date.format('YYYY-MM-DD'),
- '_links': {
- 'workPackage': {
- 'href': wp!.href
+ let payload:any = {
+ spentOn: date.format('YYYY-MM-DD')
+ };
+
+ if(wp) {
+ payload['_links'] = {
+ workPackage: {
+ href: wp.href
}
- }
+ };
}
-
return this.timeEntryDm.createForm(payload).then(form => {
return this.fromCreateForm(form);
diff --git a/frontend/src/app/modules/time_entries/form/form.component.html b/frontend/src/app/modules/time_entries/form/form.component.html
index 5287a47ae7c..3bf2196ff84 100644
--- a/frontend/src/app/modules/time_entries/form/form.component.html
+++ b/frontend/src/app/modules/time_entries/form/form.component.html
@@ -27,11 +27,13 @@
</editable-attribute-field>
</div>
- <div class="attributes-map--key"
+ <div *ngIf="!entry.workPackage"
+ class="attributes-map--key"
[ngClass]="{'-required': isRequired('workPackage')}"
[textContent]="text.attributes.workPackage">
</div>
- <div class="attributes-map--value">
+ <div *ngIf="!entry.workPackage"
+ class="attributes-map--value">
<editable-attribute-field [resource]="entry"
[fieldName]="'workPackage'">
</editable-attribute-field>