show documents in list device of trade lot

This commit is contained in:
Cayo Puigdefabregas 2022-02-21 13:04:56 +01:00
parent bda39d0fc9
commit 83a9c66a46
1 changed files with 246 additions and 191 deletions

View File

@ -42,6 +42,21 @@
<div class="card"> <div class="card">
<div class="card-body pt-3" style="min-height: 650px;"> <div class="card-body pt-3" style="min-height: 650px;">
<!-- Bordered Tabs --> <!-- Bordered Tabs -->
{% if lot and not lot.is_temporary %}
<ul class="nav nav-tabs nav-tabs-bordered">
<li class="nav-item">
<button class="nav-link active" data-bs-toggle="tab" data-bs-target="#devices-list">Devices</button>
</li>
<li class="nav-item">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#trade-documents-list">Documents</button>
</li>
</ul>
{% endif %}
<div class="tab-content pt-5">
<div id="devices-list" class="tab-pane fade devices-list active show">
<div class="btn-group dropdown ml-1"> <div class="btn-group dropdown ml-1">
<button id="btnLots" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <button id="btnLots" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
@ -87,9 +102,17 @@
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if lot and not lot.is_temporary %}
<li>
<a href="{{ url_for('inventory.devices.trade_document_add', lot_id=lot.id)}}" class="dropdown-item">
<i class="bi bi-plus"></i>
Add new document
<span class="caret"></span>
</a>
</li>
{% endif %}
</ul> </ul>
</div> </div>
<div class="btn-group dropdown ml-1" uib-dropdown=""> <div class="btn-group dropdown ml-1" uib-dropdown="">
<button id="btnActions" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <button id="btnActions" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-plus"></i> <i class="bi bi-plus"></i>
@ -235,8 +258,6 @@
<div class="tab-content pt-2"> <div class="tab-content pt-2">
<div class="tab-pane fade show active profile-overview" id="profile-overview">
<h5 class="card-title">Computers</h5> <h5 class="card-title">Computers</h5>
<table class="table"> <table class="table">
<thead> <thead>
@ -284,8 +305,40 @@
</tbody> </tbody>
</table> </table>
</div><!-- End Bordered Tabs --> </div>
</div>
{% if lot and not lot.is_temporary %}
<div id="trade-documents-list" class="tab-pane fade trade-documents-list">
<h5 class="card-title">Documents</h5>
<table class="table">
<thead>
<tr>
<th scope="col">File</th>
<th scope="col" data-type="date" data-format="DD-MM-YYYY">Uploaded on</th>
</tr>
</thead>
<tbody>
{% for doc in lot.trade.documents %}
<tr>
<td>
{% if doc.url.to_text() %}
<a href="{{ doc.url.to_text() }}" target="_blank">{{ doc.file_name}}</a>
{% else %}
{{ doc.file_name}}
{% endif %}
</td>
<td>
{{ doc.created.strftime('%H:%M %d-%m-%Y')}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div><!-- End Bordered Tabs -->
</div>
</div> </div>
</div> </div>
@ -299,7 +352,9 @@
{% include "inventory/actions.html" %} {% include "inventory/actions.html" %}
{% include "inventory/allocate.html" %} {% include "inventory/allocate.html" %}
{% include "inventory/data_wipe.html" %} {% include "inventory/data_wipe.html" %}
{% include "inventory/trade.html" %} {% if lot and lot.is_temporary %}
{% include "inventory/trade.html" %}
{% endif %}
<!-- CDN --> <!-- CDN -->
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest"></script> <script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest"></script>