|
395 | 395 | } |
396 | 396 | }); |
397 | 397 | // display the open button normally. |
398 | | - let btn = `<button class="btn" data-id='${rs[0]}' onclick='openView(this)'>Annotate</button>`; |
| 398 | + let btn = `<button class="btn unfinished" data-id='${rs[0]}' onclick='openView(this)'>Annotate</button>`; |
399 | 399 | if (labelingAnnotationCount >= labelingCount){ |
400 | 400 | // if done, just a check. |
401 | 401 | btn = `<div class='material-icons' style='width:48px;color:#008000;' title='Done'>check_circle</div>`; |
|
412 | 412 | perPageSelect: [25, 50, 100], |
413 | 413 | data: { headings, data }, |
414 | 414 | }); |
| 415 | + // check if conditions met to show the report button |
| 416 | + params2 = new URLSearchParams(window.location.search); |
| 417 | + // for now, need to map collections |
| 418 | + let collectionMap = { |
| 419 | + '647f6169a717cc71e7aad9b2': 'Feedback Test 1', |
| 420 | + '6570bc89465283ed7ec3af84': 'Feedback Test 2', |
| 421 | + '647f6169a717cc71e7aad9b1': 'Proficiency Test 1', |
| 422 | + '6570bc89465283ed7ec3af83': 'Proficiency Test 2', |
| 423 | + } |
| 424 | + collectionId = params2.get('collectionId'); |
| 425 | + if ( |
| 426 | + collectionId in collectionMap && |
| 427 | + document.querySelectorAll('button.unfinished').length === 0 |
| 428 | + ) { |
| 429 | + console.log('Condition met', collectionMap[collectionId]); |
| 430 | + const placeholder = document.getElementById("report_placeholder"); |
| 431 | + const link = document.createElement("a"); |
| 432 | + link.href = "../../reports/report?collectionName=" + collectionMap[collectionId]; |
| 433 | + link.textContent = "Study Performance Report"; |
| 434 | + link.target = "_blank"; // open in new tab |
| 435 | + link.style.color = "white"; |
| 436 | + link.style.textDecoration = "none"; |
| 437 | + link.style.fontWeight = "900"; |
| 438 | + link.style.letterSpacing = "0.05em"; |
| 439 | + link.style.textTransform = "uppercase"; |
| 440 | + link.style.fontSize = "0.9em"; |
| 441 | + link.style.paddingLeft = "15px"; |
| 442 | + placeholder.appendChild(link); |
| 443 | + } |
415 | 444 | document.querySelectorAll("#datatables > thead > tr > th").forEach(x=>{ |
416 | 445 | if (tooltips[x.innerText]){ |
417 | 446 | x.setAttribute('title', tooltips[x.innerText]); |
|
0 commit comments