Compare commits
No commits in common. "912d3fe775fe8c19d6d04ec700ef34769a8f86e5" and "e24b6d06bd84e0addb6dfc68f420cd6294ae7311" have entirely different histories.
912d3fe775
...
e24b6d06bd
3 changed files with 28 additions and 31 deletions
|
@ -41,6 +41,12 @@
|
||||||
|
|
||||||
{% 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,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',
|
||||||
|
@ -114,6 +105,23 @@
|
||||||
{% 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(
|
||||||
|
@ -122,6 +130,7 @@
|
||||||
],
|
],
|
||||||
title=title
|
title=title
|
||||||
),
|
),
|
||||||
|
center=middleBar,
|
||||||
right=buttonBar
|
right=buttonBar
|
||||||
) }}
|
) }}
|
||||||
{% if item.condition in ["Removed", "Disposed"] %}
|
{% if item.condition in ["Removed", "Disposed"] %}
|
||||||
|
|
|
@ -125,33 +125,15 @@
|
||||||
<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=inventory_title, per_page=8) }}
|
{{ tables.render_table(headers=inventory_headers, rows=inventory_rows, id='assets', entry_route='inventory_item', title='Assets', 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=worklog_title, per_page=8) }}
|
{{ tables.render_table(headers=worklog_headers, rows=worklog_rows, id='worklog', entry_route='worklog_entry', title='Work Done', per_page=8) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue