Add export functionality for worklogs with dynamic filename generation
This commit is contained in:
parent
4061065430
commit
e24b6d06bd
1 changed files with 18 additions and 0 deletions
|
@ -105,6 +105,23 @@
|
|||
{% 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(
|
||||
|
@ -113,6 +130,7 @@
|
|||
],
|
||||
title=title
|
||||
),
|
||||
center=middleBar,
|
||||
right=buttonBar
|
||||
) }}
|
||||
{% if item.condition in ["Removed", "Disposed"] %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue