corrección de plantilla personalizada
This commit is contained in:
35
media_js_reports/export-pdf-report.js
Normal file
35
media_js_reports/export-pdf-report.js
Normal 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,
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user