mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
FIX: Remove assets from to-be-audited table when audited
Previously required a page reload
This commit is contained in:
@@ -26,6 +26,7 @@ class AssetAuditForm(AssetForm):
|
||||
# TODO Inherit exlcusions from superclass
|
||||
exclude = ['asset_id_prefix', 'asset_id_number', 'last_audited_at', 'last_audited_by', 'parent']
|
||||
|
||||
|
||||
class AssetSearchForm(forms.Form):
|
||||
query = forms.CharField(required=False)
|
||||
category = forms.ModelMultipleChoiceField(models.AssetCategory.objects.all(), required=False)
|
||||
|
||||
@@ -114,11 +114,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if not request.is_ajax %}
|
||||
<div class="form-group pull-right">
|
||||
<button class="btn btn-success" type="submit" form="asset_audit_form">Mark Audited</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
<div class="form-group">
|
||||
<button class="btn btn-success modal-action" type="submit" form="asset_audit_form">Mark Audited</button>
|
||||
<button class="btn btn-success pull-right" type="submit" form="asset_audit_form" onclick="onAuditClick({{form.asset_id.value}});">Mark Audited</button>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -15,9 +15,12 @@
|
||||
return false;
|
||||
});
|
||||
});
|
||||
function onClick() {
|
||||
function onSearchClick() {
|
||||
$('#searchButton').attr("href", "{% url 'asset_audit' None %}".replace('None', $('#{{form.query.id_for_label}}').val()));
|
||||
}
|
||||
function onAuditClick(assetID) {
|
||||
$('#' + assetID).remove();
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -31,7 +34,7 @@
|
||||
<div class="input-group input-group-lg" style="width: auto;">
|
||||
{% render_field form.query|add_class:'form-control' placeholder='Enter Asset ID' autofocus="true" %}
|
||||
<label for="query" class="sr-only">Asset ID:</label>
|
||||
<span class="input-group-btn"><a id="searchButton" class="btn btn-default modal-href" href="{% url 'asset_audit' None %}" onclick="onClick()" class="submit" type="submit">Search</a></span>
|
||||
<span class="input-group-btn"><a id="searchButton" class="btn btn-default modal-href" href="{% url 'asset_audit' None %}" onclick="onSearchClick()" class="submit" type="submit">Search</a></span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
{% for item in object_list %}
|
||||
{# <li><a href="{% url 'asset_detail' item.pk %}">{{ item.asset_id }} - {{ item.description }}</a></li>#}
|
||||
<!---TODO: When the ability to filter the list is added, remove the colours from the filter - specifically, stop greying out sold/binned stuff if it is being searched for-->
|
||||
<tr class="{{ item.status.display_class|default:'' }} assetRow">
|
||||
<tr class="{{ item.status.display_class|default:'' }} assetRow" id="{{item.asset_id}}">
|
||||
<td style="vertical-align: middle;"><a class="assetID" href="{% url 'asset_detail' item.asset_id %}">{{ item.asset_id }}</a></td>
|
||||
<td class="assetDesc" style="vertical-align: middle; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; max-width: 25vw">{{ item.description }}</td>
|
||||
<td class="assetCategory" style="vertical-align: middle;">{{ item.category }}</td>
|
||||
|
||||
Reference in New Issue
Block a user