Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions previewers/betatest/css/refiqdas.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@

.tooltip-text {
margin-top: 5px;
}

label {
margin-left:5px;
}
100 changes: 89 additions & 11 deletions previewers/betatest/js/refiqdacore.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,26 +295,33 @@ function parseData2(data) {
let pdfSel = selection.pdfSelection;
let textSel = selection.plainTextSelection;
let selectionName = pdfSel.getAttribute("name");
if(!selectionName) {
selectionName = "(Hover for more info)";
}
guid = pdfSel.getAttribute("guid");
codes = getCodeNames(pdfSel); // Codes are on the PDF selection

let sourceGuid = source.getAttribute("guid");

selectionMatches = sourceMatches +
pdfSel.getAttribute("creatingUser") + pdfSel.getAttribute("modifyingUser") +
textSel.getAttribute("creatingUser") + textSel.getAttribute("modifyingUser") +
getCodeRelatedGUIDs(pdfSel);

let sourceGuid = source.getAttribute("guid");
getCodeRelatedGUIDs(pdfSel) + sourceGuid;

displayName = createMergedSelectionWithTooltip(selectionName, pdfSel, textSel, sourceGuid);

} else {
// Handle regular selection node
let selectionName = selection.getAttribute("name");
if(!selectionName) {
selectionName = "(Hover for more info)";
}
guid = selection.getAttribute("guid");
codes = getCodeNames(selection);
selectionMatches = sourceMatches + selection.getAttribute("creatingUser") + selection.getAttribute("modifyingUser") + getCodeRelatedGUIDs(selection);

let sourceGuid = source.getAttribute("guid");

selectionMatches = sourceMatches + selection.getAttribute("creatingUser") + selection.getAttribute("modifyingUser") + getCodeRelatedGUIDs(selection) + sourceGuid;

displayName = selectionName; // Default display name

if (selection.nodeName === "PDFSelection") {
Expand Down Expand Up @@ -446,14 +453,29 @@ function parseData2(data) {
desc = desc[0].childNodes[0];
}
let matches = '';
if (note.getAttribute("creatingUser")) {
matches = matches + note.getAttribute("creatingUser");
let name = '';
let creatingUserGuid = note.getAttribute("creatingUser");
let modifyingUserGuid = note.getAttribute("modifyingUser");
let userNames = new Set();

if (creatingUserGuid) {
matches += creatingUserGuid;
let user = userMap.get(creatingUserGuid);
if (user) {
userNames.add(user.getAttribute("name"));
}
}
if (note.getAttribute("modifyingUser")) {
matches = matches + note.getAttribute("modifyingUser");

if (modifyingUserGuid) {
matches += modifyingUserGuid;
let user = userMap.get(modifyingUserGuid);
if (user) {
userNames.add(user.getAttribute("name"));
}
}
name = Array.from(userNames).join(', ');

let tr = addRow(noteTable, note.getAttribute("name"), ptc, desc, userMap.get(note.getAttribute("creatingUser")).getAttribute("name"));
let tr = addRow(noteTable, note.getAttribute("name"), ptc, desc, name);
tr.attr('data-guid', note.getAttribute("guid"));
tr.attr('data-matches', matches);

Expand All @@ -468,6 +490,62 @@ function parseData2(data) {
tables.push(noteDataTable);
}

let variables = xmlDoc.getElementsByTagName("Variable");
let cases = xmlDoc.getElementsByTagName("Case");

if (variables.length > 0 && cases.length > 0) {
let variableMap = new Map();
let variableHeaders = ["Source"]; // First column is the source document

for (let variable of variables) {
let guid = variable.getAttribute("guid");
let name = variable.getAttribute("name");
// Store the variable name and its column index in the table
variableMap.set(guid, { name: name, index: variableHeaders.length });
variableHeaders.push(name);
}

let caseBlock = $('<div/>').width(tableWidth).appendTo($(".preview"));
caseBlock.append($("<h2/>").html("Cases"));
let caseTable = createTable("Cases", ...variableHeaders).appendTo(caseBlock);
caseTable.addClass("casetable compact stripe");

for (let caseNode of cases) {
let rowData = new Array(variableHeaders.length).fill(""); // Initialize row with empty strings

// Find the source document for the case
let sourceRef = caseNode.getElementsByTagName("SourceRef")[0];
if (sourceRef) {
let sourceGuid = sourceRef.getAttribute("targetGUID");
let source = sourceMap.get(sourceGuid);
if (source) {
rowData[0] = createSourceReference(source, zipUrl);
}
}

// Populate variable values for the case
let variableValues = caseNode.getElementsByTagName("VariableValue");
for (let varValue of variableValues) {
let varRef = varValue.getElementsByTagName("VariableRef")[0];
let textValue = varValue.getElementsByTagName("TextValue")[0];
if (varRef && textValue) {
let varGuid = varRef.getAttribute("targetGUID");
let variableInfo = variableMap.get(varGuid);
if (variableInfo) {
rowData[variableInfo.index] = textValue.textContent;
}
}
}
addRow(caseTable, ...rowData);
}

// Initialize DataTable for cases, but don't add to filterable tables
new DataTable(".casetable", {
select: false // This table should not be selectable
});
}


let sets = xmlDoc.getElementsByTagName("Set");
if (sets != null && sets.length > 0) {
$('#filterby').append($('<option/>').prop('value', 'Sets').text('Sets'));
Expand All @@ -487,7 +565,7 @@ function parseData2(data) {
let codeId = member.getAttribute('targetGUID');
let code = codeMap.get(codeId);
if (code != null) {
codeNames = codeNames + ' ' + code.getAttribute("name");
codeNames = codeNames + '; ' + code.getAttribute("name");
}
matches += codeId;
}
Expand Down