Refactor worklog export functionality to use dynamic export links and improve code readability
This commit is contained in:
parent
912d3fe775
commit
34cdc17eee
1 changed files with 18 additions and 10 deletions
|
@ -88,15 +88,6 @@
|
||||||
}
|
}
|
||||||
{% endset %}
|
{% endset %}
|
||||||
{% set buttonBar %}
|
{% 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">
|
<div class="btn-group">
|
||||||
{{ buttons.render_button(
|
{{ buttons.render_button(
|
||||||
id='save',
|
id='save',
|
||||||
|
@ -264,7 +255,24 @@
|
||||||
) }}
|
) }}
|
||||||
</div>
|
</div>
|
||||||
{% if worklog %}
|
{% if worklog %}
|
||||||
<div class="col border overflow-auto" style="max-height: 300px">
|
<div class="col" id="worklog" style="max-height: 300px">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col form-label">
|
||||||
|
Work Log Entries
|
||||||
|
{% set id_list = worklog_rows | map(attribute='id') | list %}
|
||||||
|
{{ links.export_link(
|
||||||
|
id = (item.identifier | replace('Name: ', '')
|
||||||
|
| replace('ID:', '')
|
||||||
|
| replace('Serial: ', '')
|
||||||
|
| replace('Barcode: ', '')
|
||||||
|
| lower) + '_worklog',
|
||||||
|
endpoint = 'worklog',
|
||||||
|
ids = {'ids': id_list}
|
||||||
|
) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row border overflow-auto">
|
||||||
|
<div class="col">
|
||||||
{% for note in notes %}
|
{% for note in notes %}
|
||||||
{% set title %}
|
{% set title %}
|
||||||
{{ note.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}{{ links.entry_link('worklog_entry', note.work_log_id) }}
|
{{ note.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}{{ links.entry_link('worklog_entry', note.work_log_id) }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue