mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-02-19 12:59:43 +00:00
Compare commits
4 Commits
90ae87b1b2
...
2f5e7b8366
| Author | SHA1 | Date | |
|---|---|---|---|
|
2f5e7b8366
|
|||
|
36b9e40a8c
|
|||
|
3667256245
|
|||
|
a3458cea3d
|
@@ -48,7 +48,7 @@ class Index(generic.TemplateView): # Displays the current rig count along with
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['rig_count'] = models.Event.objects.rig_count()
|
context['rig_count'] = models.Event.objects.rig_count()
|
||||||
context['now'] = models.Event.objects.events_in_bounds(timezone.now(), timezone.now())
|
context['now'] = models.Event.objects.events_in_bounds(timezone.now(), timezone.now()).exclude(dry_hire=True).exclude(status=models.Event.CANCELLED)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ class Event(models.Model, RevisionMixin):
|
|||||||
earliest = datetime.datetime.combine(self.start_date, datetime.time(00, 00))
|
earliest = datetime.datetime.combine(self.start_date, datetime.time(00, 00))
|
||||||
tz = pytz.timezone(settings.TIME_ZONE)
|
tz = pytz.timezone(settings.TIME_ZONE)
|
||||||
earliest = tz.localize(earliest)
|
earliest = tz.localize(earliest)
|
||||||
return not self.dry_hire and earliest <= timezone.now()
|
return not self.dry_hire and not self.status == Event.CANCELLED and earliest <= timezone.now()
|
||||||
|
|
||||||
objects = EventManager()
|
objects = EventManager()
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@
|
|||||||
<div class="col-sm-9 col-md-7 col-lg-8">
|
<div class="col-sm-9 col-md-7 col-lg-8">
|
||||||
<select id="{{ form.venue.id_for_label }}" name="{{ form.venue.name }}" class="selectpicker" data-live-search="true" data-sourceurl="{% url 'api_secure' model='venue' %}">
|
<select id="{{ form.venue.id_for_label }}" name="{{ form.venue.name }}" class="selectpicker" data-live-search="true" data-sourceurl="{% url 'api_secure' model='venue' %}">
|
||||||
{% if venue %}
|
{% if venue %}
|
||||||
<option value="{{venue.value}}" selected="selected" data-update_url="{% url 'venue_update' venue.value %}">{{ venue }}</option>
|
<option value="{{venue.id}}" selected="selected" data-update_url="{% url 'venue_update' venue.id %}">{{ venue }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ class HSList(generic.ListView):
|
|||||||
template_name = 'hs/hs_list.html'
|
template_name = 'hs/hs_list.html'
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return models.Event.objects.all().exclude(status=models.Event.CANCELLED).order_by('-start_date').select_related('riskassessment').prefetch_related('checklists')
|
return models.Event.objects.all().exclude(status=models.Event.CANCELLED).exclude(dry_hire=True).order_by('-start_date').select_related('riskassessment').prefetch_related('checklists')
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
|||||||
@@ -35,6 +35,11 @@
|
|||||||
function onAuditClick(assetID) {
|
function onAuditClick(assetID) {
|
||||||
$('#' + assetID).remove();
|
$('#' + assetID).remove();
|
||||||
}
|
}
|
||||||
|
$('#modal').on('hidden.bs.modal', function (e) {
|
||||||
|
searchbar = document.getElementById('id_q');
|
||||||
|
searchbar.value = "";
|
||||||
|
setTimeout(searchbar.focus(), 2000);
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,12 @@
|
|||||||
setupMDE('#id_comments');
|
setupMDE('#id_comments');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script src="{% static "js/tooltip.js" %}"></script>
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody id="asset_table_body">
|
<tbody id="asset_table_body">
|
||||||
{% for item in object_list %}
|
{% for item in object_list %}
|
||||||
<tr class="table-{{ item.status.display_class|default:'' }} assetRow">
|
<tr class="table-{{ item.status.display_class|default:'' }} assetRow" id="{{ item.asset_id }}">
|
||||||
<th scope="row" class="align-middle"><a class="assetID" href="{% url 'asset_detail' item.asset_id %}">{{ item.asset_id }}</a></th>
|
<th scope="row" class="align-middle"><a class="assetID" href="{% url 'asset_detail' item.asset_id %}">{{ item.asset_id }}</a></th>
|
||||||
<td class="assetDesc"><span class="text-truncate d-inline-block align-middle">{{ item.description }}</span></td>
|
<td class="assetDesc"><span class="text-truncate d-inline-block align-middle">{{ item.description }}</span></td>
|
||||||
<td class="assetCategory align-middle">{{ item.category }}</td>
|
<td class="assetCategory align-middle">{{ item.category }}</td>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<label for="{{ form.purchase_price.id_for_label }}">Purchase Price</label>
|
<label for="{{ form.purchase_price.id_for_label }}">Purchase Price</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend"><span class="input-group-text">£</span></div>
|
<div class="input-group-prepend"><span class="input-group-text">£</span></div>
|
||||||
{% render_field form.purchase_price|add_class:'form-control' value=object.purchase_price %}
|
{% render_field form.purchase_price|add_class:'form-control'|set_data:"toggle:tooltip" value=object.purchase_price title="Ex. VAT" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<label for="{{ form.salvage_value.id_for_label }}">Replacement Cost</label>
|
<label for="{{ form.salvage_value.id_for_label }}">Replacement Cost</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend"><span class="input-group-text">£</span></div>
|
<div class="input-group-prepend"><span class="input-group-text">£</span></div>
|
||||||
{% render_field form.replacement_cost|add_class:'form-control' value=object.replacement_cost %}
|
{% render_field form.replacement_cost|add_class:'form-control'|set_data:"toggle:tooltip" value=object.replacement_cost title="Ex. VAT" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
data = $(this).serialize();
|
data = $(this).serialize();
|
||||||
action = $(this).attr('action');
|
action = $(this).attr('action');
|
||||||
console.log(action)
|
|
||||||
$.post(action, data, function(resp) {
|
$.post(action, data, function(resp) {
|
||||||
$('#modal').html(resp);
|
$('#modal').html(resp);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ def test_add_qualification(logged_in_browser, live_server, trainee, supervisor,
|
|||||||
page.submit()
|
page.submit()
|
||||||
assert page.success
|
assert page.success
|
||||||
qualification = models.TrainingItemQualification.objects.get(trainee=trainee, item=training_item)
|
qualification = models.TrainingItemQualification.objects.get(trainee=trainee, item=training_item)
|
||||||
assert qualification.supervisor.pk == supervisor.pk
|
assert qualification.supervisor_id == supervisor.pk
|
||||||
assert qualification.date == date
|
assert qualification.date == date
|
||||||
assert qualification.notes == "A note"
|
assert qualification.notes == "A note"
|
||||||
assert qualification.depth == models.TrainingItemQualification.STARTED
|
assert qualification.depth == models.TrainingItemQualification.STARTED
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ def test_add_qualification_reversion(admin_client, trainee, training_item, super
|
|||||||
assert response.status_code == 302
|
assert response.status_code == 302
|
||||||
qual = models.TrainingItemQualification.objects.last()
|
qual = models.TrainingItemQualification.objects.last()
|
||||||
assert qual is not None
|
assert qual is not None
|
||||||
assert training_item.pk == qual.item.pk
|
assert training_itempk == qual.item_id
|
||||||
# Ensure only one revision has been created
|
# Ensure only one revision has been created
|
||||||
assert Revision.objects.count() == 1
|
assert Revision.objects.count() == 1
|
||||||
response = admin_client.post(url, {'date': date, 'supervisor': supervisor.pk, 'trainee': trainee.pk, 'item': training_item.pk, 'depth': 1})
|
response = admin_client.post(url, {'date': date, 'supervisor': supervisor.pk, 'trainee': trainee.pk, 'item': training_item.pk, 'depth': 1})
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ for app in [apps.get_app_config(label) for label in ("RIGS", "assets", "training
|
|||||||
else:
|
else:
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
path(f'{appname}/{modelname}/<str:pk>/history/',
|
path(f'{appname}/{modelname}/<str:pk>/history/',
|
||||||
permission_required_with_403('{app.label}.change_{modelname}')(
|
permission_required_with_403(f'{app.label}.change_{modelname}')(
|
||||||
views.VersionHistory.as_view()),
|
views.VersionHistory.as_view()),
|
||||||
name=f'{modelname}_history', kwargs={'model': model, 'app': appname, }),
|
name=f'{modelname}_history', kwargs={'model': model, 'app': appname, }),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user