unic template for device details

This commit is contained in:
Cayo Puigdefabregas 2022-08-11 09:51:17 +02:00
parent f55abc4a7b
commit 7ed2368f02
1 changed files with 43 additions and 62 deletions

View File

@ -18,25 +18,13 @@
<div class="card"> <div class="card">
<div class="card-body pt-3"> <div class="card-body pt-3">
<h3>{{ device.devicehub_id }}</h3> <h3>{{ placeholder.device.devicehub_id }}</h3>
<!-- Bordered Tabs --> <!-- Bordered Tabs -->
<ul class="nav nav-tabs nav-tabs-bordered"> <ul class="nav nav-tabs nav-tabs-bordered">
{% if placeholder %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{{ url_for('inventory.device_details', id=placeholder.device.devicehub_id) }}">Placeholder device</a> <button class="nav-link" data-bs-toggle="tab" data-bs-target="#details">General details</button>
</li> </li>
{% else %}
<li class="nav-item">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#type">General details</button>
</li>
{% endif %}
{% if placeholder.binding %}
<li class="nav-item">
<a class="nav-link" href="{# url_for('inventory.device_details', id=placeholder.binding.devicehub_id) #}">Workbench device</a>
</li>
{% endif %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{{ device.public_link }}" target="_blank">Web</a> <a class="nav-link" href="{{ device.public_link }}" target="_blank">Web</a>
@ -50,10 +38,6 @@
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#status">Status</button> <button class="nav-link" data-bs-toggle="tab" data-bs-target="#status">Status</button>
</li> </li>
<li class="nav-item">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#rate">Rate</button>
</li>
<li class="nav-item"> <li class="nav-item">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#traceability">Traceability log</button> <button class="nav-link" data-bs-toggle="tab" data-bs-target="#traceability">Traceability log</button>
</li> </li>
@ -77,42 +61,59 @@
</ul> </ul>
<div class="tab-content pt-2"> <div class="tab-content pt-2">
<div class="tab-pane fade {% if active_binding %}profile-overview{% else %}show active{% endif %}" id="type"> <div class="tab-pane fade {% if active_binding %}profile-overview{% else %}show active{% endif %}" id="details">
<h5 class="card-title">Details</h5> <h5 class="card-title">Details Real parth</h5>
{% if device.placeholder %}
<div class="row mb-3"> <div class="row mb-3">
<div class="col-lg-3 col-md-4 label "> <div class="col-lg-3 col-md-4 label ">
(<a href="{{ url_for('inventory.device_edit', id=device.devicehub_id)}}">Edit Device</a>) (<a href="{{ url_for('inventory.device_edit', id=placeholder.device.devicehub_id)}}">Edit Device</a>)
</div> </div>
<div class="col-lg-9 col-md-8">{{ device.is_abstract() }}</div> <div class="col-lg-9 col-md-8">{{ placeholder.device.is_abstract() }}</div>
</div> </div>
{% endif %}
{% if device.placeholder %}
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label ">Phid</div> <div class="col-lg-3 col-md-4 label ">Phid</div>
<div class="col-lg-9 col-md-8">{{ device.placeholder.phid }}</div> <div class="col-lg-9 col-md-8">{{ placeholder.phid }}</div>
</div> </div>
{% endif %}
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label ">Type</div> <div class="col-lg-3 col-md-4 label ">Type</div>
<div class="col-lg-9 col-md-8">{{ device.type }}</div> <div class="col-lg-9 col-md-8">{{ placeholder.device.type }}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label">Manufacturer</div> <div class="col-lg-3 col-md-4 label">Manufacturer</div>
<div class="col-lg-9 col-md-8">{{ device.manufacturer or ''}}</div> <div class="col-lg-9 col-md-8">{{ placeholder.device.manufacturer or ''}}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label">Model</div> <div class="col-lg-3 col-md-4 label">Model</div>
<div class="col-lg-9 col-md-8">{{ device.model or ''}}</div> <div class="col-lg-9 col-md-8">{{ placeholder.device.model or ''}}</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label">Serial Number</div> <div class="col-lg-3 col-md-4 label">Serial Number</div>
<div class="col-lg-9 col-md-8">{{ device.serial_number or ''}}</div> <div class="col-lg-9 col-md-8">{{ placeholder.device.serial_number or ''}}</div>
</div>
<h5 class="card-title">Details Abstract parth</h5>
<div class="row">
<div class="col-lg-3 col-md-4 label ">Type</div>
<div class="col-lg-9 col-md-8">{{ placeholder.binding.type }}</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Manufacturer</div>
<div class="col-lg-9 col-md-8">{{ placeholder.binding.manufacturer or ''}}</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Model</div>
<div class="col-lg-9 col-md-8">{{ placeholder.binding.model or ''}}</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Serial Number</div>
<div class="col-lg-9 col-md-8">{{ placeholder.binding.serial_number or ''}}</div>
</div> </div>
</div> </div>
@ -120,7 +121,7 @@
<h5 class="card-title">Incoming Lots</h5> <h5 class="card-title">Incoming Lots</h5>
<div class="row"> <div class="row">
{% for lot in device.lots %} {% for lot in placeholder.device.lots %}
{% if lot.is_incoming %} {% if lot.is_incoming %}
<div class="col"> <div class="col">
<a class="ms-3" href="{{ url_for('inventory.lotdevicelist', lot_id=lot.id) }}"> <a class="ms-3" href="{{ url_for('inventory.lotdevicelist', lot_id=lot.id) }}">
@ -134,7 +135,7 @@
<h5 class="card-title">Outgoing Lots</h5> <h5 class="card-title">Outgoing Lots</h5>
<div class="row"> <div class="row">
{% for lot in device.lots %} {% for lot in placeholder.device.lots %}
{% if lot.is_outgoing %} {% if lot.is_outgoing %}
<div class="col"> <div class="col">
<a class="ms-3" href="{{ url_for('inventory.lotdevicelist', lot_id=lot.id) }}"> <a class="ms-3" href="{{ url_for('inventory.lotdevicelist', lot_id=lot.id) }}">
@ -148,7 +149,7 @@
<h5 class="card-title">Temporary Lots</h5> <h5 class="card-title">Temporary Lots</h5>
<div class="row"> <div class="row">
{% for lot in device.lots %} {% for lot in placeholder.device.lots %}
{% if lot.is_temporary %} {% if lot.is_temporary %}
<div class="col"> <div class="col">
<a class="ms-3" href="{{ url_for('inventory.lotdevicelist', lot_id=lot.id) }}"> <a class="ms-3" href="{{ url_for('inventory.lotdevicelist', lot_id=lot.id) }}">
@ -165,53 +166,33 @@
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label">Physical State</div> <div class="col-lg-3 col-md-4 label">Physical State</div>
<div class="col-lg-9 col-md-8"> <div class="col-lg-9 col-md-8">
{% if device.physical_status %} {% if placeholder.device.physical_status %}
{{ device.physical_status.type }} {{ placeholder.device.physical_status.type }}
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label">Lifecycle State</div> <div class="col-lg-3 col-md-4 label">Lifecycle State</div>
<div class="col-lg-9 col-md-8"> <div class="col-lg-9 col-md-8">
{% if device.status %} {% if placeholder.device.status %}
{{ device.status.type }} {{ placeholder.device.status.type }}
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-4 label">Allocated State</div> <div class="col-lg-3 col-md-4 label">Allocated State</div>
<div class="col-lg-9 col-md-8"> <div class="col-lg-9 col-md-8">
{% if device.allocated_status %} {% if placeholder.device.allocated_status %}
{{ device.allocated_status.type }} {{ placeholder.device.allocated_status.type }}
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
<div class="tab-pane fade profile-overview" id="rate">
<h5 class="card-title">Rate Details</h5>
<div class="row">
<div class="col-lg-3 col-md-4 label">Rating</div>
<div class="col-lg-9 col-md-8">{{ device.rate or '' }}</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Processor</div>
<div class="col-lg-9 col-md-8">{{ device.rate.processor or '' }}</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">RAM</div>
<div class="col-lg-9 col-md-8">{{ device.rate.ram or '' }}</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Data storage</div>
<div class="col-lg-9 col-md-8">{{ device.rate.data_storage or '' }}</div>
</div>
</div>
<div class="tab-pane fade profile-overview" id="traceability"> <div class="tab-pane fade profile-overview" id="traceability">
<h5 class="card-title">Traceability log Details</h5> <h5 class="card-title">Traceability log Details</h5>
<div class="list-group col-6"> <div class="list-group col-6">
{% for action in device.reverse_actions %} {% for action in placeholder.actions %}
<div class="list-group-item d-flex justify-content-between align-items-center"> <div class="list-group-item d-flex justify-content-between align-items-center">
{{ action.type }} {{ action.severity }} {{ action.type }} {{ action.severity }}
<small class="text-muted">{{ action.created.strftime('%H:%M %d-%m-%Y') }}</small> <small class="text-muted">{{ action.created.strftime('%H:%M %d-%m-%Y') }}</small>
@ -258,7 +239,7 @@
</p> </p>
</div> </div>
<div class="list-group col-6"> <div class="list-group col-6">
<form action="{{ url_for('inventory.device_details', id=device.devicehub_id) }}" method="post"> <form action="{{ url_for('inventory.device_details', id=placeholder.device.devicehub_id) }}" method="post">
{{ form_binding.csrf_token }} {{ form_binding.csrf_token }}
{% for field in form_binding %} {% for field in form_binding %}
{% if field != form_binding.csrf_token %} {% if field != form_binding.csrf_token %}