Asset list table improvements

This commit is contained in:
2020-04-06 02:43:12 +01:00
parent 4c40226bcf
commit 7aa19cc7ab
8 changed files with 179 additions and 181 deletions

View File

@@ -42,22 +42,7 @@
<a href="{% url 'asset_create' %}" class="btn btn-success float-right my-3">New <i class="fas fa-plus"></i></a>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Asset ID</th>
<th scope="col" class="w-25">Description</th>
<th scope="col">Category</th>
<th scope="col">Status</th>
<th scope="col" class="d-none d-sm-block">Quick Links</th>
</tr>
</thead>
<tbody id="asset_table_body">
{% include 'partials/asset_list_table_body.html' %}
</tbody>
</table>
</div>
{% include 'partials/asset_list_table.html' %}
{% if is_paginated %}
<div class="text-center">

View File

@@ -0,0 +1,36 @@
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Asset ID</th>
<th scope="col" class="w-25">Description</th>
<th scope="col">Category</th>
<th scope="col">Status</th>
<th scope="col" class="d-none d-sm-table-cell">Quick Links</th>
</tr>
</thead>
<tbody id="asset_table_body">
{% for item in object_list %}
<tr class="{{ item.status.display_class|default:'' }} assetRow">
<th scope="row"><a class="assetID" href="{% url 'asset_detail' item.asset_id %}">{{ item.asset_id }}</a></th>
<td class="assetDesc w-25 text-truncate">{{ item.description }}</td>
<td class="assetCategory">{{ item.category }}</td>
<td class="assetStatus">{{ item.status }}</td>
<td class="d-none d-sm-table-cell">
<div class="btn-group" role="group">
<a type="button" class="btn btn-primary btn-sm" href="{% url 'asset_detail' item.asset_id %}"><i class="fas fa-eye fa-fw"></i><span class="d-none d-sm-inline"> View</span></a>
{% if perms.assets.change_asset %}
<a type="button" class="btn btn-warning btn-sm" href="{% url 'asset_update' item.asset_id %}"><i class="fas fa-edit fa-fw"></i><span class="d-none d-sm-inline"> Edit</span></a>
<a type="button" class="btn btn-secondary btn-sm" href="{% url 'asset_duplicate' item.asset_id %}"><i class="fas fa-clone fa-fw"></i><span class="d-none d-sm-inline"> Duplicate</span></a>
{% endif %}
</div>
</td>
</tr>
{% empty %}
<tr>
<td colspan="6">Nothing found</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>

View File

@@ -1,22 +0,0 @@
{% for item in object_list %}
<tr class="{{ item.status.display_class|default:'' }} assetRow">
<th scope="row"><a class="assetID" href="{% url 'asset_detail' item.asset_id %}">{{ item.asset_id }}</a></th>
<td class="assetDesc w-25">{{ item.description }}</td>
<td class="assetCategory">{{ item.category }}</td>
<td class="assetStatus">{{ item.status }}</td>
<td class="d-none d-sm-block">
<div class="btn-group d-flex" role="group">
<a type="button" class="btn btn-primary btn-sm flex-nowrap" href="{% url 'asset_detail' item.asset_id %}"><span class="fas fa-eye fa-fw text-nowrap"></span><span class="d-none d-md-block text-nowrap"> View</span></a>
{% if perms.assets.change_asset %}
<a type="button" style="display: inline !important; white-space: no-wrap !important;" class="btn btn-warning btn-sm text-nowrap flex-nowrap" href="{% url 'asset_update' item.asset_id %}"><span class="fas fa-edit fa-fw" style="display: inline !important;"></span><span class="d-none d-md-block"> Edit</span></a>
<a type="button" class="btn btn-secondary btn-sm text-nowrap" href="{% url 'asset_duplicate' item.asset_id %}"><span class="fas fa-clone fa-fw"></span><span class="d-none d-md-block"> Duplicate</span></a>
{% endif %}
</div>
</td>
</tr>
{% empty %}
<tr>
<td></td>
<td colspan="5">Nothing found</td>
</tr>
{% endfor %}

View File

@@ -1,73 +1,75 @@
{% extends 'base_assets.html' %}
{% extends request.is_ajax|yesno:'base_ajax.html,base_assets.html' %}
{% block title %}Supplier | {{ object.name }}{% endblock %}
{% block content %}
<div class="row">
{% if not request.is_ajax %}
<div class="col-sm-12">
<h1>Supplier | {{ object.name }}</h1>
</div>
<div class="col-sm-12 text-right">
<div class="btn-group btn-page">
<a href="{% url 'supplier_update' object.pk %}" class="btn btn-default"><span
class="glyphicon glyphicon-pencil"></span> Edit</a>
</div>
</div>
{% endif %}
<div class="col-sm-6">
<div class="panel panel-info">
<div class="panel-heading">Supplier Details</div>
<div class="panel-body">
<dl class="dl-horizontal">
<dt>Name</dt>
<dd>{{ object.name }}</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Associated Assets</div>
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th>Asset ID</th>
<th>Description</th>
<th>Category</th>
<th>Status</th>
<th class="hidden-xs">Quick Links</th>
</tr>
</thead>
<tbody id="asset_table_body">
{% with object.assets.all as object_list %}
{% include 'partials/asset_list_table_body.html' %}
{% endwith %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% if not request.is_ajax %}
<div class="row">
<div class="col-sm-12 text-right">
<div class="btn-group btn-page">
<a href="{% url 'supplier_update' object.pk %}" class="btn btn-default"><span
class="glyphicon glyphicon-pencil"></span> Edit</a>
</div>
<div>
<a href="{% url 'supplier_update' object.pk %}" title="View Revision History">
Last edited {{ object.last_edited_at }} by {{ object.last_edited_by.name }}
</a>
</div>
<div class="col-sm-12">
<h1>Supplier | {{ object.name }}</h1>
</div>
<div class="col-sm-12 text-right">
<div class="btn-group btn-page">
<a href="{% url 'supplier_update' object.pk %}" class="btn btn-default"><span
class="glyphicon glyphicon-pencil"></span> Edit</a>
</div>
</div>
{% endif %}
<div class="col pb-3">
<div class="card">
<div class="card-header">Supplier Details</div>
<div class="card-body">
<dl class="row">
<dt class="col-6">Name</dt>
<dd>{{ object.name }}</dd>
<dt class="col-6">Phone</dt>
<dd>{% if object.phone %}<a href="tel:{{ object.phone }}">{% endif %}{{ object.phone }}{% if object.phone %}</a>{% endif %}</dd>
<dt class="col-6">Email</dt>
<dd>{% if object.email %}<a href="mailto:{{ object.email }}">{% endif %}<span class="overflow-ellipsis">{{ object.email }}</span>{% if object.email %}</a>{% endif %}</dd>
<dt class="col-12">Address</dt>
<dd class="col-12">{{ object.address|linebreaksbr }}</dd>
<dt class="col-12">Notes</dt>
<dd class="col-12">{{ object.notes|linebreaksbr }}</dd>
</dl>
</div>
</div>
</div>
<div class="col-12">
<div class="card">
<div class="card-header">Associated Assets</div>
{% with object.assets.all as object_list %}
{% include 'partials/asset_list_table.html' %}
{% endwith %}
</div>
</div>
</div>
{% if not request.is_ajax %}
<div class="row">
<div class="col-sm-12 text-right">
<div class="btn-group btn-page">
<a href="{% url 'supplier_update' object.pk %}" class="btn btn-default"><span
class="glyphicon glyphicon-pencil"></span> Edit</a>
</div>
{% include 'partials/last_edited.html' with target="supplier_history" %}
</div>
</div>
{% endif %}
{% endblock %}
{% if request.is_ajax %}
{% block footer %}
<div class="row">
<div class="col-sm-12">
<div class="btn-group btn-page">
<a href="{% url 'supplier_detail' object.pk %}" class="btn btn-primary"><span
class="fas fa-eye"></span> Open Page</a>
<a href="{% url 'supplier_update' object.pk %}" class="btn btn-light"><span
class="fas fa-edit"></span> Edit</a>
</div>
{% include 'partials/last_edited.html' with target="supplier_history" %}
</div>
</div>
{% endblock %}
{% endif %}