mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 15:36:22 +08:00
Merge pull request #3323 from aignatov-bio/ai-sci-5722-fix-docx-generate-button
Add action to generate docx button [SCI-5722]
This commit is contained in:
commit
5315bf2888
|
@ -89,8 +89,7 @@
|
|||
${I18n.t('projects.reports.index.docx')}
|
||||
</a>`;
|
||||
}
|
||||
|
||||
return `<a href="#" class="generate-docx">${I18n.t('projects.reports.index.generate')}</a>`;
|
||||
return `<a href="#" class="generate-docx docx">${I18n.t('projects.reports.index.generate')}</a>`;
|
||||
}
|
||||
|
||||
function renderPdfFile(data) {
|
||||
|
@ -193,7 +192,6 @@
|
|||
|
||||
function checkProcessingStatus(reportId) {
|
||||
let $row = $('#reports-table').find(`tr[data-id="${reportId}"]`);
|
||||
|
||||
if ($row.length === 0) return;
|
||||
|
||||
$.getJSON($row.data('status-path'), (statusData) => {
|
||||
|
@ -268,9 +266,9 @@
|
|||
updateButtons();
|
||||
}
|
||||
|
||||
function generateReportRequest(pathAttrName) {
|
||||
if (CHECKED_REPORTS.length === 1) {
|
||||
let row = $(".report-row[data-id='" + CHECKED_REPORTS[0] + "']");
|
||||
function generateReportRequest(pathAttrName, id) {
|
||||
if (CHECKED_REPORTS.length === 1 || id) {
|
||||
let row = $(".report-row[data-id='" + (id || CHECKED_REPORTS[0]) + "']");
|
||||
animateSpinner();
|
||||
$.post(row.data(pathAttrName), function(response) {
|
||||
animateSpinner(null, false);
|
||||
|
@ -374,10 +372,18 @@
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
$('.reports-index').on('change', '.report-search', function() {
|
||||
REPORTS_TABLE.search($(this).val()).draw();
|
||||
});
|
||||
|
||||
$('.reports-index').on('click', '.generate-docx', function(e) {
|
||||
var reportId = $(this).closest('.report-row').attr('data-id');
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
generateReportRequest('generate-docx-path', reportId);
|
||||
});
|
||||
|
||||
$('#show_report_preview').click();
|
||||
|
||||
initDatatable();
|
||||
|
|
Loading…
Reference in a new issue