Commit 779b3a87 authored by jcorvi's avatar jcorvi
Browse files

Merge branch 'new_version_docs_table' into 'draft_version'

documents tabulator

See merge request !6
parents 1ed7209a 5d5c32a8
Pipeline #25186 passed with stage
in 2 minutes and 37 seconds
......@@ -5,32 +5,7 @@
</h1>
</div>
<div class="w3-container">
<!-- <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand">Toxicology Reports</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</nav> -->
<table class="table">
<thead>
<td>Name</td>
<td>File Name</td>
<td>Process Date</td>
<td>Status</td>
</thead>
<tr *ngFor="let document of documents">
<td>
<a routerLink="/find/{{document.documentId}}">
{{document.name}}
</a>
</td>
<td>{{document.fileName}}</td>
<td>{{document.processDate}}</td>
<td>{{document.status}}</td>
</tr>
</table>
<div id="my-tabular-table-documents"></div>
</div>
import { Component, OnInit, ViewChild} from '@angular/core';
import { Component, Input, OnInit, SimpleChanges, EventEmitter, Output } from '@angular/core';
import Tabulator from 'tabulator-tables';
import { Document } from '../document';
import { DocumentService } from '../document.service';
import { LoginService } from '../login.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-documents',
......@@ -12,25 +13,52 @@ export class DocumentsComponent implements OnInit {
selectedDocument: Document;
documents: Document[];
tableData: any[] = [];
@Input() document: Document;
@Input() height = '100%';
constructor(private documentService: DocumentService, private loginService: LoginService) { }
tab = document.createElement('div');
constructor(private documentService: DocumentService,
private router: Router) { }
ngOnInit() {
//this.loginService.checkCredentials();
this.getDocuments();
}
logout() {
this.loginService.logout();
ngOnChanges(changes: SimpleChanges): void {
this.drawTable(this);
}
onSelect(document: Document): void {
this.selectedDocument = document;
}
getDocuments(): void {
this.documentService.getDocuments().subscribe(documents => this.documents = documents);
this.documentService.getDocuments()
.subscribe(documents => {
this.documents = documents;
var data = [];
documents.forEach(document => {
data.push({
documentId : document.documentId,
name: document.name,
fileName: document.fileName,
processDate: document.processDate,
status:document.status
});
});
this.tableData = data;
this.drawTable(this);
});
}
add(name: string): void {
......@@ -47,4 +75,42 @@ export class DocumentsComponent implements OnInit {
this.documentService.deleteDocument(document).subscribe();
}
openDocument(documentId){
this.router.navigate(['/find/'+documentId]);
}
drawTable(documentTab): void {
const table = new Tabulator(this.tab, {
layout: 'fitColumns',
data:this.tableData,
pagination: 'local',
selectable: 0,
paginationSize: 20,
paginationSizeSelector: [ 10, 20, 40],
rowClick:function(e, row){
var data = row.getData();
documentTab.openDocument(data.documentId);
},
columns:[
{title: 'Name', field: 'name', headerSort: true , headerFilter: true
,
// formatter:function(cell, formatterParams, onRendered){
// return "<span style='text-decoration-color: blue; text-decoration: underline; text-decoration-color: blue; cursor: pointer;'>" + cell.getData().name +"</span>";
// //return "<span style='text-decoration-color: blue; text-decoration: underline; text-decoration-color: blue; cursor: pointer;'>" + cell.getData().name +"</span>";
// },
// cellClick: function(e, cell){
// var data = cell.getRow().getData();
// documentTab.openDocument(data.documentId);
// }
},
{title: 'File Name', field: 'fileName', headerSort: true , headerFilter: true},
{title: 'Process Date', field: 'processDate', headerSort: true , headerFilter: true},
{title: 'Status', field: 'status', headerSort: true , headerFilter: true},
]
});
document.getElementById('my-tabular-table-documents').appendChild(this.tab);
table.redraw(true);
}
}
......@@ -299,54 +299,7 @@ export class FindingTabulatorComponent implements OnChanges {
'U'
]},
//{with:100, title: 'SRRISK', field: 'srrisk', headerSort: false , headerFilter: false},
//{with:100, title: 'SRGRPNAM', field: 'srgrpnam', headerSort: false , headerFilter: false},
//{with:100, title: 'SRSTDY', field: 'srstdy', headerSort: false , headerFilter: false},
//{with:100, title: 'SRENDY', field: 'srendy', headerSort: false , headerFilter: false},
//SRENPHSE -->Study Phase of last Observation
//{with:100, title: 'SRENPHSE', field: 'srenphse', headerSort: false , headerFilter: false},
//SROBSTDY --> Start Phase Day of Observation
//{with:100, title: 'SROBENDY', field: 'srobendy', headerSort: false , headerFilter: false},
//{with:100, title: 'SROBSQ', field: 'srobsq', headerSort: false , headerFilter: false},
//{with:100, title: 'SRSEV', field: 'srsev', headerSort: false , headerFilter: false},
//SRPCNT --> Scale of this Finding
//{with:100, title: 'SRPCNT', field: 'srpcnt', headerSort: false , headerFilter: false},
//SRSIGF --> Statistical Significance
//{with:100, title: 'SRSIGF', field: 'srsigf', headerSort: false , headerFilter: false},
//{ title: 'STUDYID', field: 'studyid', headerSort: false , headerFilter: false},
//{ title: 'DOMAIN', field: 'domain', headerSort: false , headerFilter: false},
// //{ title: 'SRSEQ', field: 'srseq' , headerSort: false , headerFilter: false },
// { title: 'SRRISK', field: 'srrisk', headerSort: false , headerFilter: false},
// { title: 'SPGRPCD', field: 'spgrpcd', headerSort: false , headerFilter: false},
// { title: 'SRGRPNAM', field: 'srgrpnam', headerSort: false , headerFilter: false},
// { title: 'SRGRPDOS', field: 'srgrpdos', headerSort: false , headerFilter: false},
// { title: 'SRSEX', field: 'srsex', headerSort: false , headerFilter: false},
// { title: 'SRSTDY', field: 'srstdy', headerSort: false , headerFilter: false},
// { title: 'SRENDY', field: 'srendy', headerSort: false , headerFilter: false},
// { title: 'SRENPHSE', field: 'srenphse', headerSort: false , headerFilter: false},
// { title: 'SROBENDY', field: 'srobendy', headerSort: false , headerFilter: false},
// { title: 'SRDOMAIN', field: 'srdomain', headerSort: false , headerFilter: false},
// { title: 'SRSPEC', field: 'srspec', headerSort: false , headerFilter: false},
// { title: 'SRTSTCD', field: 'srtstcd', headerSort: false , headerFilter: false},
// { title: 'SRFNDG', field: 'srfndg', headerSort: false , headerFilter: false},
// { title: 'SRORES', field: 'srores', headerSort: false , headerFilter: false},
// { title: 'SROBSV', field: 'srobsv', headerSort: false , headerFilter: false},
// { title: 'SROBSQ', field: 'srobsq', headerSort: false , headerFilter: false},
// { title: 'SRSEV', field: 'srsev', headerSort: false , headerFilter: false},
// { title: 'SRPCNT', field: 'srpcnt', headerSort: false , headerFilter: false},
// { title: 'SRSIGF', field: 'srsigf', headerSort: false , headerFilter: false},
// { title: 'SRTRTEF', field: 'srtrtef', headerSort: false , headerFilter: false},
//{ title: 'SRCOMNT', field: 'srcomnt', headerSort: false , headerFilter: false},
]
})
......@@ -389,14 +342,7 @@ export class FindingTabulatorComponent implements OnChanges {
formatter: function(cell, formatterParams, onRendered){
return '<i class="fa fa-eye" style="color:blue" aria-hidden="true" title="Show Evidence"> </i>';
}},
/* {width: 5, hozAlign: 'center', headerSort: false,
cellClick: function(e, cell){
alert('This will enable the edition');
cell.formatter='<i class="fa fa-edit" style="color:red" aria-hidden="true"> </i>'
},
formatter: function(cell, formatteexport, onRendered){
return '<i class="fa fa-edit" style="color:blue" aria-hidden="true"> </i>';
}},*/
{width: 5, hozAlign: 'center', headerSort: false,
cellClick: function(e, row, formatterParams){
const id = row.getData().id;
......@@ -410,27 +356,7 @@ export class FindingTabulatorComponent implements OnChanges {
formatter: function(cell, formatterParams, onRendered){
return '<i class="fa fa-angle-double-down" style="color:black" aria-hidden="true" title="Expand SR-Domain fields"> </i>';
}},
/*
{width: 5, hozAlign: 'center', headerSort: false, title:"Export", field:"export", editor:true,
cellClick: function(e, cell){
var data = cell.getRow().getData();
if(data.export=="true"){
cell.getRow().getData().export = "false";
cell.getElement().innerHTML='';
}else if (data.export=="false"){
cell.getRow().getData().export = "true";
cell.getElement().innerHTML='<i class="fa fa-check" style="color:blue;align:center" title="This Finding will be exported" aria-hidden="true"> </i>';
};
pretoxSentencesTab.rowClickExportFindingEvent.emit(cell.getData());
},
formatter:function(cell, formatteexport, onRendered){
var data = cell.getRow().getData();
if(data.export=="true"){
return '<i class="fa fa-check" style="color:blue;align:center" title="This Finding will be exported" aria-hidden="true"> </i>';
}else if (data.export=="false" || data.export=="no"){
return '';
}
}},*/
{width: 10, field: 'id' , headerSort: true},
{width: 160, title: 'Finding', field: 'finding', headerSort: false , headerFilter: false, editor: 'input', editable: function(e, cell) {
......
......@@ -33,7 +33,6 @@ export class HistoryTrackingComponent implements OnInit {
.subscribe(documentTracking => {
this.documentTracking = documentTracking;
var data = [];
var data_relevant_sentences = [];
documentTracking.trackings.forEach(tracking => {
data.push({
date : tracking.date,
......@@ -42,9 +41,6 @@ export class HistoryTrackingComponent implements OnInit {
comment: tracking.comment
});
});
//alert(data);
//alert(JSON.stringify(data));
this.tableData = data;
this.drawTable(this);
});
......
......@@ -28,7 +28,6 @@ export class SrdomaintemplateTabulatorComponent implements OnInit {
ngOnInit(): void {
this.getDocument();
//this.drawTable(this);
}
activation(data){
......@@ -56,8 +55,7 @@ export class SrdomaintemplateTabulatorComponent implements OnInit {
is_trf: find.is_treatment_related != null ? find.is_treatment_related.value : ''
});
});
//alert(data);
//alert(JSON.stringify(data));
this.tableData = data;
//this.clear();
......@@ -251,54 +249,7 @@ export class SrdomaintemplateTabulatorComponent implements OnInit {
'U'
]},
//{with:100, title: 'SRRISK', field: 'srrisk', headerSort: false , headerFilter: false},
//{with:100, title: 'SRGRPNAM', field: 'srgrpnam', headerSort: false , headerFilter: false},
//{with:100, title: 'SRSTDY', field: 'srstdy', headerSort: false , headerFilter: false},
//{with:100, title: 'SRENDY', field: 'srendy', headerSort: false , headerFilter: false},
//SRENPHSE -->Study Phase of last Observation
//{with:100, title: 'SRENPHSE', field: 'srenphse', headerSort: false , headerFilter: false},
//SROBSTDY --> Start Phase Day of Observation
//{with:100, title: 'SROBENDY', field: 'srobendy', headerSort: false , headerFilter: false},
//{with:100, title: 'SROBSQ', field: 'srobsq', headerSort: false , headerFilter: false},
//{with:100, title: 'SRSEV', field: 'srsev', headerSort: false , headerFilter: false},
//SRPCNT --> Scale of this Finding
//{with:100, title: 'SRPCNT', field: 'srpcnt', headerSort: false , headerFilter: false},
//SRSIGF --> Statistical Significance
//{with:100, title: 'SRSIGF', field: 'srsigf', headerSort: false , headerFilter: false},
//{ title: 'STUDYID', field: 'studyid', headerSort: false , headerFilter: false},
//{ title: 'DOMAIN', field: 'domain', headerSort: false , headerFilter: false},
// //{ title: 'SRSEQ', field: 'srseq' , headerSort: false , headerFilter: false },
// { title: 'SRRISK', field: 'srrisk', headerSort: false , headerFilter: false},
// { title: 'SPGRPCD', field: 'spgrpcd', headerSort: false , headerFilter: false},
// { title: 'SRGRPNAM', field: 'srgrpnam', headerSort: false , headerFilter: false},
// { title: 'SRGRPDOS', field: 'srgrpdos', headerSort: false , headerFilter: false},
// { title: 'SRSEX', field: 'srsex', headerSort: false , headerFilter: false},
// { title: 'SRSTDY', field: 'srstdy', headerSort: false , headerFilter: false},
// { title: 'SRENDY', field: 'srendy', headerSort: false , headerFilter: false},
// { title: 'SRENPHSE', field: 'srenphse', headerSort: false , headerFilter: false},
// { title: 'SROBENDY', field: 'srobendy', headerSort: false , headerFilter: false},
// { title: 'SRDOMAIN', field: 'srdomain', headerSort: false , headerFilter: false},
// { title: 'SRSPEC', field: 'srspec', headerSort: false , headerFilter: false},
// { title: 'SRTSTCD', field: 'srtstcd', headerSort: false , headerFilter: false},
// { title: 'SRFNDG', field: 'srfndg', headerSort: false , headerFilter: false},
// { title: 'SRORES', field: 'srores', headerSort: false , headerFilter: false},
// { title: 'SROBSV', field: 'srobsv', headerSort: false , headerFilter: false},
// { title: 'SROBSQ', field: 'srobsq', headerSort: false , headerFilter: false},
// { title: 'SRSEV', field: 'srsev', headerSort: false , headerFilter: false},
// { title: 'SRPCNT', field: 'srpcnt', headerSort: false , headerFilter: false},
// { title: 'SRSIGF', field: 'srsigf', headerSort: false , headerFilter: false},
// { title: 'SRTRTEF', field: 'srtrtef', headerSort: false , headerFilter: false},
//{ title: 'SRCOMNT', field: 'srcomnt', headerSort: false , headerFilter: false},
]
});
......
......@@ -16,7 +16,7 @@
<script src="assets/env.js"></script>
<meta charset="utf-8">
<title>Toxicology Reports</title>
<title>PretoxTM 2.0</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="#">
......
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