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 @@
<div class="card-header">
<div style="float:left;width:90%"> <h4>{{document.name}}</h4></div>
<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}}
</button>
<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 class="dropdown-item btn bg-success" aria-haspopup="true" aria-expanded="false" (click)="moveDocument('FINISHED')">Finish Document</a>
<a *ngFor="let status of nextStatus" class='dropdown-item btn'
[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>
......
......@@ -49,6 +49,7 @@ export class DocumentDetailComponent implements OnInit {
navLinks: any[];
activeLinkIndex = -1;
nextStatus: any[];
static collData: any;
......@@ -170,12 +171,10 @@ export class DocumentDetailComponent implements OnInit {
link: './third',
index: 2
}
//, {
// label: 'Tracking Changes',
// link: './tracking',
// index: 3
// }
];
];
this.nextStatus = ['DRAFT', 'IN_PROGRESS', 'FINISHED'];
;
}
......@@ -187,6 +186,7 @@ export class DocumentDetailComponent implements OnInit {
this.activeLinkIndex = this.navLinks.indexOf(this.navLinks.find(tab => tab.link === '.' + this.router.url));
});
this.getDocument();
}
save(): void {
......@@ -200,6 +200,7 @@ export class DocumentDetailComponent implements OnInit {
this.documentService.getDocument(id)
.subscribe(document => {
this.document = document;
this.setNextStatus(this.document.status);
var data = [];
var data_relevant_sentences = [];
document.findings.forEach(find => {
......@@ -390,12 +391,23 @@ export class DocumentDetailComponent implements OnInit {
});
}
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) {
const id = +this.route.snapshot.paramMap.get('id');
//alert(data.status);
this.documentService.moveDocument(id, status)
.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