item ui vaguely working

This commit is contained in:
2021-07-06 00:09:46 +01:00
parent dff5ac2308
commit d26c1b535e
3 changed files with 18 additions and 15 deletions

View File

@@ -6,7 +6,7 @@ from RIGS.models import Profile
class SessionLogForm(forms.Form): class SessionLogForm(forms.Form):
pass pass
# TODO Validation that dates cannot be in the future
class QualificationForm(forms.ModelForm): class QualificationForm(forms.ModelForm):
class Meta: class Meta:
model = models.TrainingItemQualification model = models.TrainingItemQualification
@@ -18,3 +18,4 @@ class QualificationForm(forms.ModelForm):
super(QualificationForm, self).__init__(*args, **kwargs) super(QualificationForm, self).__init__(*args, **kwargs)
self.fields['trainee'].initial = Profile.objects.get(pk=pk) self.fields['trainee'].initial = Profile.objects.get(pk=pk)

View File

@@ -26,7 +26,6 @@ class TrainingItem(models.Model):
return "{}.{} {}".format(self.category.reference_number, self.reference_number, self.name) return "{}.{} {}".format(self.category.reference_number, self.reference_number, self.name)
# TODO Validation that dates cannot be in the future
class TrainingItemQualification(models.Model): class TrainingItemQualification(models.Model):
STARTED = 0 STARTED = 0
COMPLETE = 1 COMPLETE = 1
@@ -44,10 +43,13 @@ class TrainingItemQualification(models.Model):
supervisor = models.ForeignKey('Trainee', related_name='qualifications_granted', on_delete=models.RESTRICT) supervisor = models.ForeignKey('Trainee', related_name='qualifications_granted', on_delete=models.RESTRICT)
notes = models.TextField(blank=True) notes = models.TextField(blank=True)
def __str__(self):
return "{} in {} on {}".format(self.depth, self.item, self.date)
# Levels # Levels
# FIXME Common Competencies...
class TrainingLevel(models.Model, RevisionMixin): class TrainingLevel(models.Model, RevisionMixin):
description = models.CharField(max_length=120)
CHOICES = ( CHOICES = (
(0, 'Technical Assistant'), (0, 'Technical Assistant'),
(1, 'Technician'), (1, 'Technician'),
@@ -56,6 +58,7 @@ class TrainingLevel(models.Model, RevisionMixin):
department = models.CharField(max_length=50, null=True) # N.B. Technical Assistant does not have a department department = models.CharField(max_length=50, null=True) # N.B. Technical Assistant does not have a department
level = models.IntegerField(choices=CHOICES) level = models.IntegerField(choices=CHOICES)
# FIXME Common Competencies... have levels able to depend on other ones - but supervisors need to depend on both common and technican?
class TrainingLevelQualification(models.Model): class TrainingLevelQualification(models.Model):
trainee = models.ForeignKey('Trainee', related_name='levels', on_delete=models.RESTRICT) trainee = models.ForeignKey('Trainee', related_name='levels', on_delete=models.RESTRICT)

View File

@@ -1,19 +1,14 @@
{% extends 'base_rigs.html' %} {% extends 'base_rigs.html' %}
{% block content %} {% block content %}
<button type="button" class="btn btn-success btn-sm item-add" <a type="button" class="btn btn-success" href="{% url 'edit_record' pk=request.user.pk %}">
data-toggle="modal"
data-target="#record_modal">
<i class="fas fa-plus"></i> Add New Training Record <i class="fas fa-plus"></i> Add New Training Record
</button> </a>
<div class="row mb-3"> <div class="row mb-3">
<h2 class="col-12">Training Levels</h2> <h2 class="col-12">Training Levels</h2>
<p>{{ user.name }} is a...<br></p> {% for level in levels %}
<div class="col">
<h2><div class="badge badge-success">Sound Supervisor <span class="fas fa-volume-up"></span></div><h2> {% endfor %}
<h3><div class="badge badge-danger">Power Technician <span class="fas fa-plug"></span></div></h3>
<h4><div class="badge badge-primary">Technical Assistant <span class="fas fa-wrench"></span></div></h4>
</div>
</div> </div>
<div class="row"> <div class="row">
<h2 class="col-12">Training Items</h2><br> <h2 class="col-12">Training Items</h2><br>
@@ -24,7 +19,11 @@
<div class="list-group list-group-flush"> <div class="list-group list-group-flush">
{% for depth in depths %} {% for depth in depths %}
<li class="list-group-item {% if depth.0 == 0 %}list-group-item-warning{%elif depth.0 == 1%}list-group-item-success{%else%}list-group-item-info{%endif%}">{{depth.1}}</li> <li class="list-group-item {% if depth.0 == 0 %}list-group-item-warning{%elif depth.0 == 1%}list-group-item-success{%else%}list-group-item-info{%endif%}">{{depth.1}}</li>
<li class="list-group-item">Dummy Item</li> {% for q in object.qualifications_obtained.all %}
{% if q.depth == depth.0 and q.item.category == category %}
<li class="list-group-item">{{q.item}} ({{q.date}})</li>
{% endif %}
{% endfor %}
{% endfor %} {% endfor %}
</div> </div>
</div> </div>