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

View file

@ -42,202 +42,223 @@
<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">
<div class="btn-group dropdown ml-1"> <li class="nav-item">
<button id="btnLots" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <button class="nav-link active" data-bs-toggle="tab" data-bs-target="#devices-list">Devices</button>
<i class="bi bi-folder2"></i> </li>
Lots
<span class="caret"></span> <li class="nav-item">
</button> <button class="nav-link" data-bs-toggle="tab" data-bs-target="#trade-documents-list">Documents</button>
<span class="d-none" id="activeTradeModal" data-bs-toggle="modal" data-bs-target="#tradeLotModal"></span> </li>
<ul class="dropdown-menu" aria-labelledby="btnLots">
{% if lot and lot.is_temporary and not lot.devices %} </ul>
<li> {% endif %}
<a href="javascript:newAction('Use')" class="dropdown-item" <div class="tab-content pt-5">
data-bs-toggle="modal" data-bs-target="#btnRemoveLots"> <div id="devices-list" class="tab-pane fade devices-list active show">
<i class="bi bi-trash"></i>
Remove Lot <div class="btn-group dropdown ml-1">
<span class="caret"></span> <button id="btnLots" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
</a> <i class="bi bi-folder2"></i>
</li> Lots
{% endif %} <span class="caret"></span>
<li> </button>
<a href="javascript:void()" class="dropdown-item" data-bs-toggle="modal" data-bs-target="#addingLotModal"> <span class="d-none" id="activeTradeModal" data-bs-toggle="modal" data-bs-target="#tradeLotModal"></span>
<i class="bi bi-plus"></i> <ul class="dropdown-menu" aria-labelledby="btnLots">
Add selected Devices to a lot {% if lot and lot.is_temporary and not lot.devices %}
</a> <li>
</li> <a href="javascript:newAction('Use')" class="dropdown-item"
<li> data-bs-toggle="modal" data-bs-target="#btnRemoveLots">
<a href="javascript:void()" class="dropdown-item" data-bs-toggle="modal" data-bs-target="#removeLotModal"> <i class="bi bi-trash"></i>
<i class="bi bi-x"></i> Remove Lot
Remove selected devices from a lot <span class="caret"></span>
</a> </a>
</li> </li>
{% if lot.is_temporary %}
<li>
<a href="javascript:newTrade('user_from')" class="dropdown-item">
<i class="bi bi-plus"></i>
Add supplier
</a>
</li>
<li>
<a href="javascript:newTrade('user_to')" class="dropdown-item">
<i class="bi bi-plus"></i>
Add receiver
</a>
</li>
{% endif %} {% endif %}
</ul> <li>
</div> <a href="javascript:void()" class="dropdown-item" data-bs-toggle="modal" data-bs-target="#addingLotModal">
<i class="bi bi-plus"></i>
<div class="btn-group dropdown ml-1" uib-dropdown=""> Add selected Devices to a lot
<button id="btnActions" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> </a>
<i class="bi bi-plus"></i> </li>
New Actions <li>
</button> <a href="javascript:void()" class="dropdown-item" data-bs-toggle="modal" data-bs-target="#removeLotModal">
<span class="d-none" id="activeActionModal" data-bs-toggle="modal" data-bs-target="#actionModal"></span> <i class="bi bi-x"></i>
<span class="d-none" id="activeAllocateModal" data-bs-toggle="modal" data-bs-target="#allocateModal"></span> Remove selected devices from a lot
<span class="d-none" id="activeDatawipeModal" data-bs-toggle="modal" data-bs-target="#datawipeModal"></span> </a>
<ul class="dropdown-menu" aria-labelledby="btnActions"> </li>
<li> {% if lot.is_temporary %}
Status actions <li>
</li> <a href="javascript:newTrade('user_from')" class="dropdown-item">
<li> <i class="bi bi-plus"></i>
<a href="javascript:newAction('Recycling')" class="dropdown-item"> Add supplier
<i class="bi bi-recycle"></i> </a>
Recycling </li>
</a> <li>
</li> <a href="javascript:newTrade('user_to')" class="dropdown-item">
<li> <i class="bi bi-plus"></i>
<a href="javascript:newAction('Use')" class="dropdown-item"> Add receiver
<i class="bi bi-play-circle-fill"></i> </a>
Use </li>
</a> {% endif %}
</li> {% if lot and not lot.is_temporary %}
<li> <li>
<a href="javascript:newAction('Refurbish')" class="dropdown-item"> <a href="{{ url_for('inventory.devices.trade_document_add', lot_id=lot.id)}}" class="dropdown-item">
<i class="bi bi-tools"></i> <i class="bi bi-plus"></i>
Refurbish Add new document
</a> <span class="caret"></span>
</li> </a>
<li> </li>
<a href="javascript:newAction('Management')" class="dropdown-item"> {% endif %}
<i class="bi bi-mastodon"></i> </ul>
Management </div>
</a> <div class="btn-group dropdown ml-1" uib-dropdown="">
</li> <button id="btnActions" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<li>
Allocation
</li>
<li>
<a href="javascript:newAllocate('Allocate')" class="dropdown-item">
<i class="bi bi-house-fill"></i>
Allocate
</a>
</li>
<li>
<a href="javascript:newAllocate('Deallocate')" class="dropdown-item">
<i class="bi bi-house"></i>
Deallocate
</a>
</li>
<li>
Physical actions
</li>
<li>
<a href="javascript:newAction('ToPrepare')" class="dropdown-item">
<i class="bi bi-tools"></i>
ToPrepare
</a>
</li>
<li>
<a href="javascript:newAction('Prepare')" class="dropdown-item">
<i class="bi bi-egg"></i>
Prepare
</a>
</li>
<li>
<a href="javascript:newDataWipe('DataWipe')" class="dropdown-item">
<i class="bi bi-eraser-fill"></i>
DataWipe
</a>
</li>
<li>
<a href="javascript:newAction('ToRepair')" class="dropdown-item">
<i class="bi bi-screwdriver"></i>
ToRepair
</a>
</li>
<li>
<a href="javascript:newAction('Ready')" class="dropdown-item">
<i class="bi bi-check2-all"></i>
Ready
</a>
</li>
</ul>
</div>
<div class="btn-group dropdown ml-1" uib-dropdown="">
<button id="btnExport" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-reply"></i>
Exports
</button>
<ul class="dropdown-menu" aria-labelledby="btnExport">
<li>
<a href="#" class="dropdown-item">
TODO: Not implemented
</a>
</li>
</ul>
</div>
<div class="btn-group dropdown ml-1" uib-dropdown="">
<button id="btnTags" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-tag"></i>
Tags
</button>
<ul class="dropdown-menu" aria-labelledby="btnTags">
<li>
<a href="javascript:addTag()" class="dropdown-item" data-bs-toggle="modal" data-bs-target="#addingTagModal">
<i class="bi bi-plus"></i> <i class="bi bi-plus"></i>
Add Tag to selected Devices New Actions
</a> </button>
</li> <span class="d-none" id="activeActionModal" data-bs-toggle="modal" data-bs-target="#actionModal"></span>
<li> <span class="d-none" id="activeAllocateModal" data-bs-toggle="modal" data-bs-target="#allocateModal"></span>
<a href="javascript:removeTag()" class="dropdown-item"> <span class="d-none" id="activeDatawipeModal" data-bs-toggle="modal" data-bs-target="#datawipeModal"></span>
<i class="bi bi-x"></i> <ul class="dropdown-menu" aria-labelledby="btnActions">
Remove Tag from selected Devices <li>
</a> Status actions
</li> </li>
</ul> <li>
</div> <a href="javascript:newAction('Recycling')" class="dropdown-item">
<i class="bi bi-recycle"></i>
Recycling
</a>
</li>
<li>
<a href="javascript:newAction('Use')" class="dropdown-item">
<i class="bi bi-play-circle-fill"></i>
Use
</a>
</li>
<li>
<a href="javascript:newAction('Refurbish')" class="dropdown-item">
<i class="bi bi-tools"></i>
Refurbish
</a>
</li>
<li>
<a href="javascript:newAction('Management')" class="dropdown-item">
<i class="bi bi-mastodon"></i>
Management
</a>
</li>
<li>
Allocation
</li>
<li>
<a href="javascript:newAllocate('Allocate')" class="dropdown-item">
<i class="bi bi-house-fill"></i>
Allocate
</a>
</li>
<li>
<a href="javascript:newAllocate('Deallocate')" class="dropdown-item">
<i class="bi bi-house"></i>
Deallocate
</a>
</li>
<li>
Physical actions
</li>
<li>
<a href="javascript:newAction('ToPrepare')" class="dropdown-item">
<i class="bi bi-tools"></i>
ToPrepare
</a>
</li>
<li>
<a href="javascript:newAction('Prepare')" class="dropdown-item">
<i class="bi bi-egg"></i>
Prepare
</a>
</li>
<li>
<a href="javascript:newDataWipe('DataWipe')" class="dropdown-item">
<i class="bi bi-eraser-fill"></i>
DataWipe
</a>
</li>
<li>
<a href="javascript:newAction('ToRepair')" class="dropdown-item">
<i class="bi bi-screwdriver"></i>
ToRepair
</a>
</li>
<li>
<a href="javascript:newAction('Ready')" class="dropdown-item">
<i class="bi bi-check2-all"></i>
Ready
</a>
</li>
</ul>
</div>
<div class="btn-group dropdown ml-1" uib-dropdown=""> <div class="btn-group dropdown ml-1" uib-dropdown="">
<button id="btnSnapshot" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <button id="btnExport" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-tag"></i> <i class="bi bi-reply"></i>
New Device Exports
</button> </button>
<ul class="dropdown-menu" aria-labelledby="btnSnapshot"> <ul class="dropdown-menu" aria-labelledby="btnExport">
<li> <li>
<a href="{{ url_for('inventory.devices.upload_snapshot') }}" class="dropdown-item"> <a href="#" class="dropdown-item">
<i class="bi bi-plus"></i> TODO: Not implemented
Upload a new Snapshot </a>
</a> </li>
</li> </ul>
<li> </div>
<a href="{{ url_for('inventory.devices.device_add') }}" class="dropdown-item">
<i class="bi bi-plus"></i>
Create a new Device
</a>
</li>
</ul>
</div>
<div class="tab-content pt-2"> <div class="btn-group dropdown ml-1" uib-dropdown="">
<button id="btnTags" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-tag"></i>
Tags
</button>
<ul class="dropdown-menu" aria-labelledby="btnTags">
<li>
<a href="javascript:addTag()" class="dropdown-item" data-bs-toggle="modal" data-bs-target="#addingTagModal">
<i class="bi bi-plus"></i>
Add Tag to selected Devices
</a>
</li>
<li>
<a href="javascript:removeTag()" class="dropdown-item">
<i class="bi bi-x"></i>
Remove Tag from selected Devices
</a>
</li>
</ul>
</div>
<div class="tab-pane fade show active profile-overview" id="profile-overview"> <div class="btn-group dropdown ml-1" uib-dropdown="">
<button id="btnSnapshot" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-tag"></i>
New Device
</button>
<ul class="dropdown-menu" aria-labelledby="btnSnapshot">
<li>
<a href="{{ url_for('inventory.devices.upload_snapshot') }}" class="dropdown-item">
<i class="bi bi-plus"></i>
Upload a new Snapshot
</a>
</li>
<li>
<a href="{{ url_for('inventory.devices.device_add') }}" class="dropdown-item">
<i class="bi bi-plus"></i>
Create a new Device
</a>
</li>
</ul>
</div>
<h5 class="card-title">Computers</h5> <div class="tab-content pt-2">
<h5 class="card-title">Computers</h5>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@ -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>