Fixes fixes fixes

This commit is contained in:
2020-10-09 09:40:53 +01:00
parent f41064abfa
commit 3602da9203
5 changed files with 30 additions and 16 deletions

View File

@@ -1,5 +1,4 @@
{% extends 'base_assets.html' %}
{% block title %}Asset Audit List{% endblock %}
{% load static %}
{% load paginator from filters %}
{% load widget_tweaks %}
@@ -45,17 +44,13 @@
{% endblock %}
{% block content %}
<div class="page-header">
<h1 class="text-center">Asset Audit List</h1>
</div>
<div id="error404" class="alert alert-danger alert-dismissable" hidden=true>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<span>Asset with that ID does not exist!</span>
</div>
<h3>Audit Asset:</h3>
<form id="asset-search-form" class="form-horizontal" method="POST">
<form id="asset-search-form" class="form-horizontal mb-3" method="POST">
<div class="input-group input-group-lg" style="width=auto;">
{% render_field form.q|add_class:'form-control' placeholder='Enter Asset ID' autofocus="true" %}
<div class="input-group-append">

View File

@@ -21,7 +21,7 @@
<div class="input-group px-1 mb-2 mb-sm-0 flex-nowrap">
{% render_field form.q|add_class:'form-control' placeholder='Enter Asset ID/Desc/Serial' %}
<label for="q" class="sr-only">Asset ID/Description/Serial Number:</label>
<span class="input-group-append">{% button 'search' id="id_search" style="width: 6em" %}</span>
<span class="input-group-append">{% button 'search' id="id_search" %}</span>
</div>
<div id="category-group" class="form-group px-1" style="margin-bottom: 0;">
<label for="category" class="sr-only">Category</label>

View File

@@ -1,18 +1,16 @@
<div class="py-2">
{% if edit and object %}
{% load button from filters %}
<div class="text-right py-2">
{% if create or edit and object %}
<!--edit-->
<button type="submit" class="btn btn-success"><i class="fas fa-save"></i> Save</button>
{% button 'submit' %}
{% elif duplicate %}
<!--duplicate-->
<button type="submit" class="btn btn-success"><i class="fas fa-tick"></i> Create Duplicate</button>
{% elif create %}
<!--create-->
<button type="submit" class="btn btn-success"><i class="fas fa-save"></i> Save</button>
{% else %}
<!--detail view-->
<div class="btn-group">
<a href="{% url 'asset_update' object.asset_id %}" class="btn btn-warning"><i class="fas fa-edit"></i> Edit</a>
<a class="btn btn-info" href="{% url 'asset_duplicate' object.asset_id %}"><i class="fas fa-clone"></i> Duplicate</a>
{% button 'edit' url='asset_update' pk=object.asset_id %}
{% button 'duplicate' url='asset_duplicate' pk=object.asset_id %}
<a type="button" class="btn btn-info" href="{% url 'asset_audit' object.asset_id %}"><i class="fas fa-certificate"></i> Audit</a>
</div>
{% endif %}

View File

@@ -152,7 +152,7 @@ class SupplierList(BasePage):
class SupplierForm(FormPage):
_submit_locator = (By.CLASS_NAME, 'btn-primary')
_submit_locator = (By.XPATH, "//button[@type='submit' and contains(., 'Save')]")
form_items = {
'name': (regions.TextBox, (By.ID, 'id_name')),
}

View File

@@ -191,6 +191,11 @@ class AssetAuditList(AssetList):
self.form = forms.AssetSearchForm(data={})
return self.model.objects.filter(Q(last_audited_at__isnull=True))
def get_context_data(self, **kwargs):
context = super(AssetAuditList, self).get_context_data(**kwargs)
context['page_title'] = "Asset Audit List"
return context
class AssetAudit(AssetEdit):
template_name = 'asset_audit.html'
@@ -253,6 +258,14 @@ class SupplierCreate(GenericCreateView, ModalURLMixin):
model = models.Supplier
form_class = forms.SupplierForm
def get_context_data(self, **kwargs):
context = super(SupplierCreate, self).get_context_data(**kwargs)
if self.request.is_ajax():
context['override'] = "base_ajax.html"
else:
context['override'] = 'base_assets.html'
return context
def get_success_url(self):
return self.get_close_url('supplier_update', 'supplier_detail')
@@ -261,6 +274,14 @@ class SupplierUpdate(GenericUpdateView, ModalURLMixin):
model = models.Supplier
form_class = forms.SupplierForm
def get_context_data(self, **kwargs):
context = super(SupplierUpdate, self).get_context_data(**kwargs)
if self.request.is_ajax():
context['override'] = "base_ajax.html"
else:
context['override'] = 'base_assets.html'
return context
def get_success_url(self):
return self.get_close_url('supplier_update', 'supplier_detail')