Add button to display original row data

This commit is contained in:
Oliver 2022-02-09 23:49:26 +11:00
parent 383835aa89
commit d38a8adf4c
2 changed files with 31 additions and 2 deletions

View File

@ -78,7 +78,7 @@ function constructBomUploadTable(data, options={}) {
var buttons = `<div class='btn-group float-right' role='group'>`;
// buttons += makeIconButton('fa-file-alt', 'button-row-data', idx, '{% trans "Display row data" %}');
buttons += makeIconButton('fa-info-circle', 'button-row-data', idx, '{% trans "Display row data" %}');
buttons += makeIconButton('fa-times icon-red', 'button-row-remove', idx, '{% trans "Remove row" %}');
buttons += `</div>`;
@ -129,6 +129,29 @@ function constructBomUploadTable(data, options={}) {
$(`#button-row-remove-${idx}`).click(function() {
$(`#items_${idx}`).remove();
});
// Add callback for "show data" button
$(`#button-row-data-${idx}`).click(function() {
var modal = createNewModal({
title: '{% trans "Row Data" %}',
cancelText: '{% trans "Close" %}',
hideSubmitButton: true
});
// Prettify the original import data
var pretty = JSON.stringify(row, undefined, 4);
var html = `
<div class='alert alert-block'>
<pre><code>${pretty}</code></pre>
</div>`;
modalSetContent(modal, html);
$(modal).modal('show');
});
}
// Request API endpoint options

View File

@ -1953,7 +1953,13 @@ function constructField(name, parameters, options) {
html += parameters.before;
}
html += `<div id='div_id_${field_name}' class='${form_classes}'>`;
var hover_title = '';
if (parameters.help_text) {
hover_title = ` title='${parameters.help_text}'`;
}
html += `<div id='div_id_${field_name}' class='${form_classes}' ${hover_title}>`;
// Add a label
if (!options.hideLabels) {