Adding all versions listing and new version form for description templates
This commit is contained in:
parent
f255f61ee6
commit
fbf5f65318
|
@ -14,7 +14,7 @@ import { IsActive } from '@app/core/common/enum/is-active.enum';
|
|||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||
import { UserDescriptionTemplateRole } from '@app/core/common/enum/user-description-template-role';
|
||||
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
|
||||
import { DescriptionTemplatePersist } from '@app/core/model/description-template/description-template-persist';
|
||||
import { DescriptionTemplatePersist, NewVersionDescriptionTemplatePersist } from '@app/core/model/description-template/description-template-persist';
|
||||
import { LanguageInfo } from '@app/core/model/language-info';
|
||||
import { User } from '@app/core/model/user/user';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
|
@ -201,6 +201,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
}
|
||||
|
||||
persistEntity(onSuccess?: (response) => void): void {
|
||||
if (this.isNew && !this.isClone && !this.isNewVersion){
|
||||
const formData = this.formService.getValue(this.formGroup.value) as DescriptionTemplatePersist;
|
||||
|
||||
this.descriptionTemplateService.persist(formData)
|
||||
|
@ -208,6 +209,15 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
complete => onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
} else if (this.isNewVersion && !this.isNew && !this.isClone) {
|
||||
const formData = this.formService.getValue(this.formGroup.value) as NewVersionDescriptionTemplatePersist;
|
||||
|
||||
this.descriptionTemplateService.newVersion(formData)
|
||||
.pipe(takeUntil(this._destroyed)).subscribe(
|
||||
complete => onSuccess ? onSuccess(complete) : this.onCallbackSuccess(complete),
|
||||
error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
formSubmit(): void {
|
||||
|
|
Loading…
Reference in New Issue