refactoring
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
class BatchCodeDetailsView {
|
||||
|
||||
#uiContainer;
|
||||
#headingElement;
|
||||
#adverseReactionReportsChartView;
|
||||
#histogramChartView;
|
||||
#chartWithSlider;
|
||||
|
||||
constructor(uiContainer) {
|
||||
this.#uiContainer = uiContainer
|
||||
this.#headingElement = this.#uiContainer.querySelector(".heading");
|
||||
this.#adverseReactionReportsChartView = new AdverseReactionReportsChartView(this.#uiContainer.querySelector('#adverseReactionReportsChartView'));
|
||||
this.#chartWithSlider = this.#uiContainer.querySelector('.chartWithSlider');
|
||||
this.#histogramChartView = new HistogramChartView(this.#chartWithSlider.querySelector("canvas"));
|
||||
@@ -39,9 +41,7 @@ class BatchCodeDetailsView {
|
||||
}
|
||||
|
||||
#displayHeading(batchcode) {
|
||||
const h1 = document.createElement("h3");
|
||||
h1.appendChild(document.createTextNode(`Frequencies of reported Symptoms for Batch Code Combinations containing ${batchcode}`));
|
||||
this.#uiContainer.appendChild(h1);
|
||||
this.#headingElement.textContent = `Frequencies of reported Symptoms for Batch Code Combinations containing ${batchcode}`
|
||||
}
|
||||
|
||||
#displayAdverseReactionReportsChart(histoDescrs) {
|
||||
|
||||
@@ -2,7 +2,7 @@ class BatchcodeCombinationSelection {
|
||||
|
||||
static configureSelectBatchcodeCombinationElement({ selectBatchcodeCombinationElement, histograms, onSelect }) {
|
||||
const batchcodesSelect = selectBatchcodeCombinationElement.querySelector('#batchcodesSelect');
|
||||
this.#addBatchcodeCombinationOptions(batchcodesSelect, histograms);
|
||||
this.#setBatchcodeCombinationOptions(batchcodesSelect, histograms);
|
||||
batchcodesSelect.addEventListener(
|
||||
'change',
|
||||
event => {
|
||||
@@ -12,7 +12,8 @@ class BatchcodeCombinationSelection {
|
||||
onSelect(histograms[0]);
|
||||
}
|
||||
|
||||
static #addBatchcodeCombinationOptions(batchcodesSelect, histograms) {
|
||||
static #setBatchcodeCombinationOptions(batchcodesSelect, histograms) {
|
||||
UIUtils.clear(batchcodesSelect);
|
||||
this.#getBatchcodeCombinationOptions(histograms).forEach(option => batchcodesSelect.add(option));
|
||||
}
|
||||
|
||||
|
||||
@@ -49763,6 +49763,7 @@
|
||||
</select>
|
||||
</p>
|
||||
<div id="batchCodeDetails" style="width: 50%">
|
||||
<h3 class="heading"></h3>
|
||||
<div id="selectBatchcodeCombination">
|
||||
<canvas id="adverseReactionReportsChartView"></canvas>
|
||||
<label>Select batchcode combination:
|
||||
|
||||
Reference in New Issue
Block a user