continuing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class BatchCodeTableInitializer {
|
||||
|
||||
#batchCodeTableElement;
|
||||
#barChartDescriptions;
|
||||
|
||||
constructor(batchCodeTableElement) {
|
||||
this.#batchCodeTableElement = batchCodeTableElement;
|
||||
@@ -8,51 +9,77 @@ class BatchCodeTableInitializer {
|
||||
|
||||
initialize() {
|
||||
const self = this;
|
||||
this.#batchCodeTableElement.DataTable(
|
||||
{
|
||||
ajax: 'data/batchCodeTables/Global.json',
|
||||
initComplete: function (settings) {
|
||||
batchCodeTable = settings.oInstance.api();
|
||||
const columnSearch = new ColumnSearch(batchCodeTable.column(self.#getColumnIndex('Company')));
|
||||
columnSearch.columnContentUpdated();
|
||||
},
|
||||
language:
|
||||
{
|
||||
searchPlaceholder: "Enter Batch Code"
|
||||
},
|
||||
searching: true,
|
||||
search:
|
||||
{
|
||||
return: true
|
||||
},
|
||||
processing: true,
|
||||
deferRender: true,
|
||||
order: [[this.#getColumnIndex('Adverse Reaction Reports'), "desc"]],
|
||||
columnDefs:
|
||||
[
|
||||
BarChartDescriptionsProvider
|
||||
.getBarChartDescriptions()
|
||||
.then(barChartDescriptions => {
|
||||
this.#barChartDescriptions = barChartDescriptions;
|
||||
this.#batchCodeTableElement.DataTable(
|
||||
{
|
||||
ajax: 'data/batchCodeTables/Global.json',
|
||||
initComplete: function (settings) {
|
||||
batchCodeTable = settings.oInstance.api();
|
||||
const columnSearch = new ColumnSearch(batchCodeTable.column(self.#getColumnIndex('Company')));
|
||||
columnSearch.columnContentUpdated();
|
||||
},
|
||||
language:
|
||||
{
|
||||
searchable: false,
|
||||
targets: [
|
||||
this.#getColumnIndex('Adverse Reaction Reports'),
|
||||
this.#getColumnIndex('Deaths'),
|
||||
this.#getColumnIndex('Disabilities'),
|
||||
this.#getColumnIndex('Life Threatening Illnesses'),
|
||||
this.#getColumnIndex('Severe reports'),
|
||||
this.#getColumnIndex('Lethality')
|
||||
searchPlaceholder: "Enter Batch Code"
|
||||
},
|
||||
searching: true,
|
||||
search:
|
||||
{
|
||||
return: true
|
||||
},
|
||||
processing: true,
|
||||
deferRender: true,
|
||||
order: [[this.#getColumnIndex('Adverse Reaction Reports'), "desc"]],
|
||||
columnDefs:
|
||||
[
|
||||
{
|
||||
searchable: false,
|
||||
targets: [
|
||||
this.#getColumnIndex('Adverse Reaction Reports'),
|
||||
this.#getColumnIndex('Deaths'),
|
||||
this.#getColumnIndex('Disabilities'),
|
||||
this.#getColumnIndex('Life Threatening Illnesses'),
|
||||
this.#getColumnIndex('Severe reports'),
|
||||
this.#getColumnIndex('Lethality')
|
||||
]
|
||||
},
|
||||
{
|
||||
orderable: false,
|
||||
targets:
|
||||
[
|
||||
this.#getColumnIndex('Batch'),
|
||||
this.#getColumnIndex('Company'),
|
||||
this.#getColumnIndex('Countries')
|
||||
]
|
||||
},
|
||||
{
|
||||
render: data => {
|
||||
const numberInPercent = parseFloat(data);
|
||||
return !isNaN(numberInPercent) ? numberInPercent.toFixed(2) + "%" : '';
|
||||
},
|
||||
targets: [this.#getColumnIndex('Severe reports'), this.#getColumnIndex('Lethality')]
|
||||
},
|
||||
{
|
||||
width: "1000px",
|
||||
render: function (data, type, row, meta) {
|
||||
return null;
|
||||
},
|
||||
createdCell: (cell, cellData, row, rowIndex, colIndex) => {
|
||||
const batchcode = row[this.#getColumnIndex('Batch')];
|
||||
if (batchcode in this.#barChartDescriptions) {
|
||||
const barChartDescription = this.#barChartDescriptions[batchcode];
|
||||
barChartDescription['batchcode'] = batchcode;
|
||||
new BatchcodeByCountryBarChartView(cell).displayBatchcodeByCountryBarChart(barChartDescription);
|
||||
}
|
||||
},
|
||||
className: "dt-head-center",
|
||||
targets: [this.#getColumnIndex('Countries')]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
orderable: false,
|
||||
targets: [this.#getColumnIndex('Batch'), this.#getColumnIndex('Company')]
|
||||
},
|
||||
{
|
||||
render: (data, type, row) => {
|
||||
const numberInPercent = parseFloat(data);
|
||||
return !isNaN(numberInPercent) ? numberInPercent.toFixed(2) + " %" : '';
|
||||
},
|
||||
targets: [this.#getColumnIndex('Severe reports'), this.#getColumnIndex('Lethality')]
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -74,6 +101,8 @@ class BatchCodeTableInitializer {
|
||||
return 6;
|
||||
case 'Lethality':
|
||||
return 7;
|
||||
case 'Countries':
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user