Commit a6052ec7 authored by Javi Corvi's avatar Javi Corvi
Browse files

workflow buttons

parent 779b3a87
Pipeline #25207 passed with stage
in 2 minutes
...@@ -36,12 +36,20 @@ ...@@ -36,12 +36,20 @@
<div class="card-header"> <div class="card-header">
<div style="float:left;width:90%"> <h4>{{document.name}}</h4></div> <div style="float:left;width:90%"> <h4>{{document.name}}</h4></div>
<div class="btn-group" style="float:left;width:10%;"> <div class="btn-group" style="float:left;width:10%;">
<button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="position: absolute; bottom: 100; left: 0;"> <button type="button"
[ngClass]="{'btn-warning': document.status === 'DRAFT',
'btn-primary' : document.status === 'IN_PROGRESS',
'btn-success' : document.status === 'FINISHED'}" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="position: absolute; bottom: 100; left: 0;">
{{document.status}} {{document.status}}
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item btn bg-primary" aria-haspopup="true" aria-expanded="false" (click)="moveDocument('IN_PROGRESS')">Start Working</a> <a *ngFor="let status of nextStatus" class='dropdown-item btn'
<a class="dropdown-item btn bg-success" aria-haspopup="true" aria-expanded="false" (click)="moveDocument('FINISHED')">Finish Document</a> [ngClass]="{'bg-warning': status === 'DRAFT',
'bg-success' : status === 'FINISHED',
'bg-primary' : status === 'IN_PROGRESS'
}"
aria-haspopup="true" aria-expanded="true"
(click)="moveDocument(status)">{{status}}</a>
</div> </div>
</div> </div>
......
...@@ -49,6 +49,7 @@ export class DocumentDetailComponent implements OnInit { ...@@ -49,6 +49,7 @@ export class DocumentDetailComponent implements OnInit {
navLinks: any[]; navLinks: any[];
activeLinkIndex = -1; activeLinkIndex = -1;
nextStatus: any[];
static collData: any; static collData: any;
...@@ -170,12 +171,10 @@ export class DocumentDetailComponent implements OnInit { ...@@ -170,12 +171,10 @@ export class DocumentDetailComponent implements OnInit {
link: './third', link: './third',
index: 2 index: 2
} }
//, { ];
// label: 'Tracking Changes',
// link: './tracking', this.nextStatus = ['DRAFT', 'IN_PROGRESS', 'FINISHED'];
// index: 3 ;
// }
];
} }
...@@ -187,6 +186,7 @@ export class DocumentDetailComponent implements OnInit { ...@@ -187,6 +186,7 @@ export class DocumentDetailComponent implements OnInit {
this.activeLinkIndex = this.navLinks.indexOf(this.navLinks.find(tab => tab.link === '.' + this.router.url)); this.activeLinkIndex = this.navLinks.indexOf(this.navLinks.find(tab => tab.link === '.' + this.router.url));
}); });
this.getDocument(); this.getDocument();
} }
save(): void { save(): void {
...@@ -200,6 +200,7 @@ export class DocumentDetailComponent implements OnInit { ...@@ -200,6 +200,7 @@ export class DocumentDetailComponent implements OnInit {
this.documentService.getDocument(id) this.documentService.getDocument(id)
.subscribe(document => { .subscribe(document => {
this.document = document; this.document = document;
this.setNextStatus(this.document.status);
var data = []; var data = [];
var data_relevant_sentences = []; var data_relevant_sentences = [];
document.findings.forEach(find => { document.findings.forEach(find => {
...@@ -389,13 +390,24 @@ export class DocumentDetailComponent implements OnInit { ...@@ -389,13 +390,24 @@ export class DocumentDetailComponent implements OnInit {
//alert(text); //alert(text);
}); });
} }
setNextStatus(status){
if(status=='DRAFT'){
this.nextStatus = ['IN_PROGRESS','FINISHED'];
}else if(status=='IN_PROGRESS'){
this.nextStatus = ['DRAFT','FINISHED'];
}else {
this.nextStatus = ['DRAFT','IN_PROGRESS'];
}
}
moveDocument(status) { moveDocument(status) {
const id = +this.route.snapshot.paramMap.get('id'); const id = +this.route.snapshot.paramMap.get('id');
//alert(data.status); //alert(data.status);
this.documentService.moveDocument(id, status) this.documentService.moveDocument(id, status)
.subscribe(text => { .subscribe(text => {
this.document.status=status;
this.setNextStatus(status);
}); });
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment