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