mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-25 09:22:21 +00:00
Various UX Improvements
Also rearranged asset detail/edit to be more space efficient
This commit is contained in:
@@ -20,6 +20,12 @@ class AssetForm(forms.ModelForm):
|
|||||||
self.fields['date_acquired'].widget.format = '%Y-%m-%d'
|
self.fields['date_acquired'].widget.format = '%Y-%m-%d'
|
||||||
|
|
||||||
|
|
||||||
|
# Needed to prevent assets losing parent data on audit
|
||||||
|
class AssetAuditForm(AssetForm):
|
||||||
|
class Meta(AssetForm.Meta):
|
||||||
|
# TODO Inherit exlcusions from superclass
|
||||||
|
exclude = ['asset_id_prefix', 'asset_id_number', 'last_audited_at', 'last_audited_by', 'parent']
|
||||||
|
|
||||||
class AssetSearchForm(forms.Form):
|
class AssetSearchForm(forms.Form):
|
||||||
query = forms.CharField(required=False)
|
query = forms.CharField(required=False)
|
||||||
category = forms.ModelMultipleChoiceField(models.AssetCategory.objects.all(), required=False)
|
category = forms.ModelMultipleChoiceField(models.AssetCategory.objects.all(), required=False)
|
||||||
|
|||||||
@@ -54,6 +54,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--- TODO Add buttons for 'today' and 'unknown' (sets to beginning of time)--->
|
<!--- TODO Add buttons for 'today' and 'unknown' (sets to beginning of time)--->
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="{{ form.salvage_value.id_for_label }}" class="col-sm-2 control-label">Salvage Value</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-addon">£</span>
|
||||||
|
{% render_field form.salvage_value|add_class:'form-control' value=object.salvage_value %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{{ form.is_cable.id_for_label }}" class="col-sm-2 control-label">Cable?</label>
|
<label for="{{ form.is_cable.id_for_label }}" class="col-sm-2 control-label">Cable?</label>
|
||||||
|
|||||||
@@ -23,15 +23,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% if perms.assets.asset_finance %}
|
<div class="col-md-4"
|
||||||
<div class="col-md-6">
|
|
||||||
{% include 'partials/purchasedetails_form.html' %}
|
|
||||||
</div>
|
|
||||||
{%endif%}
|
|
||||||
<div class="col-md-6"
|
|
||||||
{% if not object.is_cable %} hidden="true" {% endif %} id="cable-table">
|
{% if not object.is_cable %} hidden="true" {% endif %} id="cable-table">
|
||||||
{% include 'partials/cable_form.html' %}
|
{% include 'partials/cable_form.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
{% if perms.assets.asset_finance %}
|
||||||
|
<div class="col-md-4">
|
||||||
|
{% include 'partials/purchasedetails_form.html' %}
|
||||||
|
</div>
|
||||||
|
{%endif%}
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
{% include 'partials/parent_form.html' %}
|
{% include 'partials/parent_form.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a href="{% url 'asset_update' object.asset_id %}" class="btn btn-default"><i class="glyphicon glyphicon-edit"></i> Edit</a>
|
<a href="{% url 'asset_update' object.asset_id %}" class="btn btn-default"><i class="glyphicon glyphicon-edit"></i> Edit</a>
|
||||||
<a class="btn btn-default" href="{% url 'asset_duplicate' object.asset_id %}"><i class="glyphicon glyphicon-duplicate"></i> Duplicate</a>
|
<a class="btn btn-default" href="{% url 'asset_duplicate' object.asset_id %}"><i class="glyphicon glyphicon-duplicate"></i> Duplicate</a>
|
||||||
|
<a type="button" class="btn btn-info modal-href" href="{% url 'asset_audit' object.asset_id %}"><i class="glyphicon glyphicon-object-align-left"></i> Audit</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if create or edit or duplicate %}
|
{% if create or edit or duplicate %}
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
<td class="assetCategory" style="vertical-align: middle;">{{ item.category }}</td>
|
<td class="assetCategory" style="vertical-align: middle;">{{ item.category }}</td>
|
||||||
<td class="assetStatus" style="vertical-align: middle;">{{ item.status }}</td>
|
<td class="assetStatus" style="vertical-align: middle;">{{ item.status }}</td>
|
||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
{% if audit %}
|
|
||||||
<a type="button" class="btn btn-info" href="{% url 'asset_audit' item.asset_id %}"><i class="glyphicon glyphicon-object-align-left"></i> Audit</a>
|
|
||||||
{% else %}
|
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
|
{% if audit %}
|
||||||
|
<a type="button" class="btn btn-info modal-href" href="{% url 'asset_audit' item.asset_id %}"><i class="glyphicon glyphicon-object-align-left"></i> Audit</a>
|
||||||
|
{% else %}
|
||||||
<a type="button" class="btn btn-default btn-sm" href="{% url 'asset_detail' item.asset_id %}"><i class="glyphicon glyphicon-eye-open"></i> View</a>
|
<a type="button" class="btn btn-default btn-sm" href="{% url 'asset_detail' item.asset_id %}"><i class="glyphicon glyphicon-eye-open"></i> View</a>
|
||||||
{% if perms.assets.change_asset %}
|
{% if perms.assets.change_asset %}
|
||||||
<a type="button" class="btn btn-default btn-sm" href="{% url 'asset_update' item.asset_id %}"><i class="glyphicon glyphicon-edit"></i> Edit</a>
|
<a type="button" class="btn btn-default btn-sm" href="{% url 'asset_update' item.asset_id %}"><i class="glyphicon glyphicon-edit"></i> Edit</a>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="panel {% if object.last_audited_at is not None %} panel-success {% else %} panel-default {% endif %}">
|
<div class="panel {% if object.last_audited_at is not None %} panel-success {% else %} panel-warning {% endif %}">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
Audit Details
|
Audit Details
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -193,8 +193,10 @@ class AssetAuditList(AssetList):
|
|||||||
self.form = forms.AssetSearchForm(data={})
|
self.form = forms.AssetSearchForm(data={})
|
||||||
return self.model.objects.filter(Q(last_audited_at__isnull=True))
|
return self.model.objects.filter(Q(last_audited_at__isnull=True))
|
||||||
|
|
||||||
|
|
||||||
class AssetAudit(AssetEdit):
|
class AssetAudit(AssetEdit):
|
||||||
template_name = 'asset_audit.html'
|
template_name = 'asset_audit.html'
|
||||||
|
form_class = forms.AssetAuditForm
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
# TODO For some reason this doesn't stick when done in form_valid??
|
# TODO For some reason this doesn't stick when done in form_valid??
|
||||||
|
|||||||
Reference in New Issue
Block a user