Fix table rendering in PDF reports [SCI-5709]

This commit is contained in:
Oleksii Kriuchykhin 2021-05-14 12:01:09 +02:00
parent 34c79d66b8
commit 460807b8c3
2 changed files with 12 additions and 5 deletions

View file

@ -8,12 +8,15 @@
var input = el.siblings('input.hot-table-contents');
var inputObj = JSON.parse(input.attr('value'));
var data = inputObj.data;
var headers;
var parentEl;
var order;
// Special handling if this is a repository table
if (input.hasClass('hot-repository-items')) {
let headers = inputObj.headers;
let parentEl = el.closest('.report-module-repository-element');
let order = parentEl.attr('data-order') === 'asc';
headers = inputObj.headers;
parentEl = el.closest('.report-module-repository-element');
order = parentEl.attr('data-order') === 'asc';
el.handsontable({
disableVisualSelection: true,

View file

@ -21,8 +21,12 @@ module Reports
report = Report.find(report_id)
file = Tempfile.new(['report', '.pdf'], binmode: true)
begin
template = Extends::REPORT_TEMPLATES[report.settings[:template]&.to_sym]
template ||= Extends::REPORT_TEMPLATES.values.first
template =
if Extends::REPORT_TEMPLATES.key?(report.settings[:template]&.to_sym)
report.settings[:template]
else
Extends::REPORT_TEMPLATES.keys.first
end
raise StandardError, 'Report template not found!' if template.blank?