mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-29 19:32:14 +00:00
Move status color logic back to template
Cause that somehow makes it work better??
This commit is contained in:
@@ -379,13 +379,6 @@ class Event(models.Model, RevisionMixin):
|
|||||||
def confirmed(self):
|
def confirmed(self):
|
||||||
return (self.status == self.BOOKED or self.status == self.CONFIRMED)
|
return (self.status == self.BOOKED or self.status == self.CONFIRMED)
|
||||||
|
|
||||||
@property
|
|
||||||
def authorised(self):
|
|
||||||
if self.internal:
|
|
||||||
return self.authorisation.amount == self.total
|
|
||||||
else:
|
|
||||||
return bool(self.purchase_order)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hs_done(self):
|
def hs_done(self):
|
||||||
return self.riskassessment is not None and len(self.checklists.all()) > 0
|
return self.riskassessment is not None and len(self.checklists.all()) > 0
|
||||||
@@ -455,17 +448,11 @@ class Event(models.Model, RevisionMixin):
|
|||||||
return bool(self.organisation and self.organisation.union_account)
|
return bool(self.organisation and self.organisation.union_account)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def status_color(self):
|
def authorised(self):
|
||||||
if self.cancelled:
|
if self.internal:
|
||||||
return "table-secondary"
|
return self.authorisation.amount == self.total
|
||||||
elif not self.is_rig:
|
|
||||||
return "table-info"
|
|
||||||
elif not self.mic:
|
|
||||||
return "table-danger"
|
|
||||||
elif self.confirmed and self.authorised and (self.dry_hire or self.riskassessment):
|
|
||||||
return "table-success"
|
|
||||||
else:
|
else:
|
||||||
return "table-warning"
|
return bool(self.purchase_order)
|
||||||
|
|
||||||
objects = EventManager()
|
objects = EventManager()
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,21 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for event in events %}
|
{% for event in events %}
|
||||||
<tr class="{{event.status_color}}" id="event_row">
|
<tr class="{% if event.cancelled %}
|
||||||
|
table-secondary
|
||||||
|
{% elif not event.is_rig %}
|
||||||
|
table-info
|
||||||
|
{% elif not event.mic %}
|
||||||
|
table-danger
|
||||||
|
{% elif event.confirmed and event.authorised %}
|
||||||
|
{% if self.dry_hire or self.riskassessment %}
|
||||||
|
table-success
|
||||||
|
{% else %}
|
||||||
|
table-warning
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
table-warning
|
||||||
|
{% endif %}" id="event_row">
|
||||||
<!---Number-->
|
<!---Number-->
|
||||||
<th scope="row" id="event_number">{{ event.display_id }}</th>
|
<th scope="row" id="event_number">{{ event.display_id }}</th>
|
||||||
<!--Dates & Times-->
|
<!--Dates & Times-->
|
||||||
|
|||||||
Reference in New Issue
Block a user