Refactor worklog export button to streamline functionality and remove redundant script
This commit is contained in:
parent
e24b6d06bd
commit
7b908d7fa3
1 changed files with 9 additions and 18 deletions
|
@ -88,6 +88,15 @@
|
|||
}
|
||||
{% endset %}
|
||||
{% set buttonBar %}
|
||||
{% if worklog %}
|
||||
<button class="btn btn-primary" type="button" onclick="export_csv({ids: [{% for row in worklog %}{{ row['id'] }}, {% endfor %}]}, 'worklog', '{{ item.identifier
|
||||
| replace('Name: ', '')
|
||||
| replace('ID:', '')
|
||||
| replace('Serial: ', '')
|
||||
| replace('Barcode: ', '')
|
||||
| lower
|
||||
}}_worklog_export');">Export WorkLog</button>
|
||||
{% endif %}
|
||||
<div class="btn-group">
|
||||
{{ buttons.render_button(
|
||||
id='save',
|
||||
|
@ -105,23 +114,6 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
{% endset %}
|
||||
{% set middleBar %}
|
||||
{% if worklog %}
|
||||
<button class="btn btn-primary" type="button" onclick="export_worklog_csv()">Export WorkLog</button>
|
||||
<script>
|
||||
function export_worklog_csv() {
|
||||
const ids = [{% for row in worklog %}{{ row['id'] }}, {% endfor %}];
|
||||
export_csv({ids: ids}, 'worklog', '{{ item.identifier
|
||||
| replace('Name: ', '')
|
||||
| replace('ID:', '')
|
||||
| replace('Serial: ', '')
|
||||
| replace('Barcode: ', '')
|
||||
| lower
|
||||
}}_worklog_export');
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endset %}
|
||||
{{ toolbars.render_toolbar(
|
||||
id='inventory',
|
||||
left=breadcrumbs.breadcrumb_header(
|
||||
|
@ -130,7 +122,6 @@
|
|||
],
|
||||
title=title
|
||||
),
|
||||
center=middleBar,
|
||||
right=buttonBar
|
||||
) }}
|
||||
{% if item.condition in ["Removed", "Disposed"] %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue