|
|
|
@ -41,21 +41,23 @@ export class WorkPackageCreateService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public createNewWorkPackage(projectIdentifier) { |
|
|
|
|
return this.getForm(projectIdentifier).then(form => { |
|
|
|
|
return this.getEmptyForm(projectIdentifier).then(form => { |
|
|
|
|
return this.WorkPackageResource.fromCreateForm(form); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public copyWorkPackage(copyFromForm, projectIdentifier?) { |
|
|
|
|
return this.getForm(projectIdentifier).then(form => { |
|
|
|
|
var request = copyFromForm.payload.$source; |
|
|
|
|
|
|
|
|
|
return this.apiWorkPackages.emptyCreateForm(request, projectIdentifier).then(form => { |
|
|
|
|
return this.WorkPackageResource.copyFrom(copyFromForm, form); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private getForm(projectIdentifier):ng.IPromise<HalResource> { |
|
|
|
|
private getEmptyForm(projectIdentifier):ng.IPromise<HalResource> { |
|
|
|
|
if (!this.form) { |
|
|
|
|
this.form = this.apiWorkPackages.emptyCreateForm(projectIdentifier); |
|
|
|
|
this.form = this.apiWorkPackages.emptyCreateForm({}, projectIdentifier); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return this.form; |
|
|
|
|