From c82d1dcc55003f6962cbdb19fd46f3f13e6877aa Mon Sep 17 00:00:00 2001 From: Mario Romano Date: Fri, 12 Aug 2016 14:22:04 +0100 Subject: [PATCH] #542 form options also in tasklist --- .../src/components/activiti-form.component.ts | 14 +++---- .../activiti-task-details.component.html | 14 ++++++- .../activiti-task-details.component.ts | 38 ++++++++++++++++++- 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts index a1914b1055..b092874ad9 100644 --- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts +++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts @@ -59,7 +59,7 @@ declare var componentHandler; * * @Output * {formLoaded} EventEmitter - This event is fired when the form is loaded, it pass all the value in the form. - * {formsaved} EventEmitter - This event is fired when the form is saved, it pass all the value in the form. + * {formSaved} EventEmitter - This event is fired when the form is saved, it pass all the value in the form. * {formCompleted} EventEmitter - This event is fired when the form is completed, it pass all the value in the form. * * @returns {ActivitiForm} . @@ -102,7 +102,7 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { showRefreshButton: boolean = true; @Output() - formsaved = new EventEmitter(); + formSaved = new EventEmitter(); @Output() formCompleted = new EventEmitter(); @@ -184,12 +184,12 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { } if (outcome.id === '$custom') { - this.formsaved.emit(this.form.values); + this.formSaved.emit(this.form.values); } } else { // Note: Activiti is using NAME field rather than ID for outcomes if (outcome.name) { - this.formsaved.emit(this.form.values); + this.formSaved.emit(this.form.values); return this.completeTaskForm(outcome.name); } } @@ -227,7 +227,7 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { .subscribe( form => { console.log('Get Form By definition Id', form); - this.form = new FormModel(form, this.data, this.formsaved, this.readOnly); + this.form = new FormModel(form, this.data, this.formSaved, this.readOnly); this.formLoaded.emit(this.form.values); }, err => console.log(err) @@ -242,7 +242,7 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { this.formService.getFormDefinitionById(id).subscribe( form => { console.log('Get Form By Form definition Name', form); - this.form = new FormModel(form, this.data, this.formsaved, this.readOnly); + this.form = new FormModel(form, this.data, this.formSaved, this.readOnly); this.formLoaded.emit(this.form.values); }, err => console.log(err) @@ -256,7 +256,7 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { this.formService.saveTaskForm(this.form.taskId, this.form.values).subscribe( (response) => { console.log('Saved task', response); - this.formsaved.emit(this.form.values); + this.formSaved.emit(this.form.values); }, (err) => console.log(err) ); diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html index fd7fdc6d62..ef26457a86 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html @@ -13,5 +13,15 @@ - - \ No newline at end of file + + + + diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.ts index fff24fdde3..4faceefe31 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Component, Input, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, ViewChild, Output, EventEmitter } from '@angular/core'; import { AlfrescoTranslationService, AlfrescoAuthenticationService, AlfrescoPipeTranslate } from 'ng2-alfresco-core'; import { ActivitiTaskListService } from './../services/activiti-tasklist.service'; import { ActivitiTaskHeader } from './activiti-task-header.component'; @@ -51,6 +51,30 @@ export class ActivitiTaskDetails implements OnInit { @ViewChild('activitichecklist') activitichecklist: any; + @Input() + showTitle: boolean = true; + + @Input() + showCompleteButton: boolean = true; + + @Input() + showSaveButton: boolean = true; + + @Input() + readOnly: boolean = false; + + @Input() + showRefreshButton: boolean = true; + + @Output() + formSaved = new EventEmitter(); + + @Output() + formCompleted = new EventEmitter(); + + @Output() + formLoaded = new EventEmitter(); + taskDetails: TaskDetailsModel; taskForm: FormModel; @@ -111,4 +135,16 @@ export class ActivitiTaskDetails implements OnInit { } ); } + + formSavedEmitter(data: any) { + this.formSaved.emit(data); + } + + formCompletedEmitter(data: any) { + this.formCompleted.emit(data); + } + + formLoadedEmitter(data: any) { + this.formLoaded.emit(data); + } }