Compare commits
2 commits
e24b6d06bd
...
912d3fe775
Author | SHA1 | Date | |
---|---|---|---|
![]() |
912d3fe775 | ||
![]() |
7b908d7fa3 |
3 changed files with 31 additions and 28 deletions
|
@ -41,12 +41,6 @@
|
||||||
|
|
||||||
{% macro export_link(id, endpoint, ids) %}
|
{% macro export_link(id, endpoint, ids) %}
|
||||||
<!-- Export Link Fragment -->
|
<!-- Export Link Fragment -->
|
||||||
<a class="link-success link-underline-opacity-0" onclick="export_{{ id }}_csv()">{{ icons.render_icon('box-arrow-up', 12) }}</a>
|
|
||||||
|
<a class="link-success link-underline-opacity-0" onclick="export_csv({{ ids }}, '{{ endpoint }}', '{{ id }}_export');">{{ icons.render_icon('box-arrow-up', 12) }}</a>
|
||||||
<script>
|
|
||||||
function export_{{ id }}_csv() {
|
|
||||||
const payload = {{ ids }};
|
|
||||||
export_csv(payload, '{{ endpoint }}', '{{ id }}_export');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
|
@ -88,6 +88,15 @@
|
||||||
}
|
}
|
||||||
{% 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',
|
||||||
|
@ -105,23 +114,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endset %}
|
{% 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(
|
{{ toolbars.render_toolbar(
|
||||||
id='inventory',
|
id='inventory',
|
||||||
left=breadcrumbs.breadcrumb_header(
|
left=breadcrumbs.breadcrumb_header(
|
||||||
|
@ -130,7 +122,6 @@
|
||||||
],
|
],
|
||||||
title=title
|
title=title
|
||||||
),
|
),
|
||||||
center=middleBar,
|
|
||||||
right=buttonBar
|
right=buttonBar
|
||||||
) }}
|
) }}
|
||||||
{% if item.condition in ["Removed", "Disposed"] %}
|
{% if item.condition in ["Removed", "Disposed"] %}
|
||||||
|
|
|
@ -125,15 +125,33 @@
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
{% if inventory_rows %}
|
{% if inventory_rows %}
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
{% set id_list = inventory_rows | map(attribute='id') | list %}
|
||||||
|
{% set inventory_title %}
|
||||||
|
Assets
|
||||||
|
{{ links.export_link(
|
||||||
|
(user.full_name | lower | replace(' ', '_')) + '_user_inventory',
|
||||||
|
'inventory',
|
||||||
|
{'ids': id_list}
|
||||||
|
) }}
|
||||||
|
{% endset %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ tables.render_table(headers=inventory_headers, rows=inventory_rows, id='assets', entry_route='inventory_item', title='Assets', per_page=8) }}
|
{{ tables.render_table(headers=inventory_headers, rows=inventory_rows, id='assets', entry_route='inventory_item', title=inventory_title, per_page=8) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if worklog_rows %}
|
{% if worklog_rows %}
|
||||||
|
{% set id_list = worklog_rows | map(attribute='id') | list %}
|
||||||
|
{% set worklog_title %}
|
||||||
|
Work Done
|
||||||
|
{{ links.export_link(
|
||||||
|
(user.full_name | lower | replace(' ', '_')) + '_user_worklog',
|
||||||
|
'worklog',
|
||||||
|
{'ids': id_list}
|
||||||
|
) }}
|
||||||
|
{% endset %}
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ tables.render_table(headers=worklog_headers, rows=worklog_rows, id='worklog', entry_route='worklog_entry', title='Work Done', per_page=8) }}
|
{{ tables.render_table(headers=worklog_headers, rows=worklog_rows, id='worklog', entry_route='worklog_entry', title=worklog_title, per_page=8) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue