corrección de plantilla personalizada

This commit is contained in:
Juan Burgos
2026-08-03 23:51:58 +00:00
parent e53e6b3906
commit af738c165b
3 changed files with 37 additions and 184 deletions

View File

@@ -0,0 +1,35 @@
define([
'knockout',
'viewmodels/report',
'templates/views/report-templates/export-pdf-report.htm'
], function(ko, ReportViewModel, exportPdfReportTemplate) {
return ko.components.register('export-pdf-report', {
viewModel: function(params) {
params.configKeys = [];
var self = this;
ReportViewModel.apply(this, [params]);
//console.log('Params:', params);
this.anexarUbic = ko.observable(false);
this.anexarImagenes = ko.observable(false);
this.anexarPdfs = ko.observable(false);
const boolToStr = (bool) => bool ? "1" : "0";
self.resourceId = ko.observable(
params.report?.report_json?.resourceinstanceid || null
);
self.exportPDF = function() {
var id = self.resourceId();
if (id) {
var url = '/export/pdf/' + id + '/' + boolToStr(self.anexarUbic()) + '/' + boolToStr(self.anexarImagenes()) + '/' + boolToStr(self.anexarPdfs()) + '/';
window.open(url, '_blank');
} else {
alert('No se encontró el ID del recurso.');
}
};
},
template: exportPdfReportTemplate,
});
});