|
|
@ -98,6 +98,7 @@ export class WorkPackageEditForm { |
|
|
|
|
|
|
|
|
|
|
|
public submit() { |
|
|
|
public submit() { |
|
|
|
if (!(this.workPackage.dirty || this.workPackage.isNew)) { |
|
|
|
if (!(this.workPackage.dirty || this.workPackage.isNew)) { |
|
|
|
|
|
|
|
this.stopEditing(); |
|
|
|
return this.$q.when(this.workPackage); |
|
|
|
return this.$q.when(this.workPackage); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -117,8 +118,8 @@ export class WorkPackageEditForm { |
|
|
|
this.wpNotificationsService.showSave(this.workPackage, isInitial); |
|
|
|
this.wpNotificationsService.showSave(this.workPackage, isInitial); |
|
|
|
this.editContext.onSaved(this.workPackage); |
|
|
|
this.editContext.onSaved(this.workPackage); |
|
|
|
|
|
|
|
|
|
|
|
// Destroy this form
|
|
|
|
this.stopEditing(); |
|
|
|
this.states.editing.get(this.workPackageId.toString()).clear('Editing completed'); |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((error) => { |
|
|
|
.catch((error) => { |
|
|
|
this.wpNotificationsService.handleErrorResponse(error, this.workPackage); |
|
|
|
this.wpNotificationsService.handleErrorResponse(error, this.workPackage); |
|
|
@ -130,6 +131,16 @@ export class WorkPackageEditForm { |
|
|
|
return deferred.promise; |
|
|
|
return deferred.promise; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected stopEditing() { |
|
|
|
|
|
|
|
// Close all edit fields
|
|
|
|
|
|
|
|
_.each(this.activeFields, (handler:WorkPackageEditFieldHandler) => { |
|
|
|
|
|
|
|
handler.deactivate(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Destroy this form
|
|
|
|
|
|
|
|
this.states.editing.get(this.workPackageId.toString()).clear('Editing completed'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected handleSubmissionErrors(error: any, deferred: any) { |
|
|
|
protected handleSubmissionErrors(error: any, deferred: any) { |
|
|
|
// Process single API errors
|
|
|
|
// Process single API errors
|
|
|
|
this.handleErroneousAttributes(error); |
|
|
|
this.handleErroneousAttributes(error); |
|
|
|