Skip to content

Commit

Permalink
add item counts to reports
Browse files Browse the repository at this point in the history
  • Loading branch information
mart2070 committed May 1, 2024
1 parent ddca5bf commit e59b166
Showing 1 changed file with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions tdx-enhanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@

/* BEGIN FUNCTIONS */

function getHeadings() {
let headings = document.querySelectorAll(".panel-title")
function updateHeading(mutation,numItems) {
let headings = mutation.querySelectorAll(".panel-title")

for (const heading of headings) {
//color the header if queue name is found
let headingTxt = heading.innerText
let headingFirst = headingTxt.split(" ")[0]
headingFirst = headingFirst.toLowerCase()
Expand All @@ -86,6 +87,25 @@
}

}

//append number of items to title
//let parentDiv = document.createElement("div")

//let header = document.createElement("h4")
//header.innerText = headingTxt

var countSpan = heading.querySelector(".subtitle")

if (!countSpan) {
countSpan = document.createElement("span")
//countSpan.innerText = `${numItems} items`
countSpan.classList.add("subtitle")

heading.innerText = headingTxt
heading.appendChild(countSpan)
}

countSpan.innerText = `${numItems} ${numItems == 1 ? 'item' : 'items'}`
}
}

Expand Down Expand Up @@ -159,11 +179,15 @@
})

item.row = row
items.push(item)
console.log("ITEM:",item)

//being coloring
parseItem(item)
})

//update panel heading above table
updateHeading(t.parentElement,items.length)
}
}

Expand Down Expand Up @@ -305,7 +329,6 @@
}
}

getHeadings()
parseTicket()
changeTitle()

Expand All @@ -315,6 +338,7 @@
:root {
--light-txt-1: #000;
--light-txt-4: #0000008c;
--light-col-1: #897043;
--light-col-2: #635130;
--light-bg-2: #ddd;
Expand All @@ -331,6 +355,7 @@
--dark-txt-1: #fff;
--dark-txt-2: #ececec;
--dark-txt-3: #929292;
--dark-txt-4: #ffffff8c;
--dark-border-0: #2b2b2b;
}
Expand All @@ -353,6 +378,17 @@
box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px var(--dark-col-1);
}
.panel-title {
display: flex;
align-items: baseline;
gap: 4px;
}
.subtitle {
font-size: 14px;
cursor: unset !important;
}
@media (prefers-color-scheme: light) {
:root {
Expand All @@ -367,6 +403,10 @@
color: var(--dark-txt-1) !important;
}
.subtitle {
color: var(--light-txt-4) !important;
}
/* Colors */
a, a.noHover, .blue {
color: var(--light-col-1) !important;
Expand Down Expand Up @@ -428,6 +468,10 @@
color: var(--dark-txt-1) !important;
}
.subtitle {
color: var(--dark-txt-4) !important;
}
/* Body */
html, body {
background-color: var(--dark-bg-0) !important;
Expand Down

0 comments on commit e59b166

Please sign in to comment.