diff --git a/RIGS/models.py b/RIGS/models.py index 09c68890..c628e1d8 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -378,7 +378,10 @@ class Event(models.Model, RevisionMixin): @property def authorised(self): - return not self.internal and self.purchase_order or self.authorisation.amount == self.total + if self.internal: + return self.authorisation.amount == self.total + else: + return bool(self.purchase_order) @property def has_start_time(self): @@ -444,6 +447,17 @@ class Event(models.Model, RevisionMixin): def internal(self): return self.organisation and self.organisation.union_account + @property + def status_color(self): + if self.cancelled: + return "text-muted table-secondary" + elif not self.is_rig: + return "table-info" + elif self.authorised and self.mic and (self.dry_hire or self.riskassessment): + return "table-success" + else: + return "table-warning" + objects = EventManager() def get_absolute_url(self): diff --git a/RIGS/templates/event_table.html b/RIGS/templates/event_table.html index d00207b2..29ed0e54 100644 --- a/RIGS/templates/event_table.html +++ b/RIGS/templates/event_table.html @@ -12,7 +12,7 @@
{% for event in events %} -