Add 'Backup' status.
This commit is contained in:
parent
027fbb4ab3
commit
a9d9854844
|
@ -162,6 +162,7 @@ CRISPY_TEMPLATE_PACK = "bootstrap4"
|
||||||
DEFAULT_ATTENDANCE = {
|
DEFAULT_ATTENDANCE = {
|
||||||
"NO_RESPONSE": 0.0,
|
"NO_RESPONSE": 0.0,
|
||||||
"SIGNED_OFF": 0.0,
|
"SIGNED_OFF": 0.0,
|
||||||
|
"BACKUP": 0.0,
|
||||||
"SIGNED_UP": 1.0,
|
"SIGNED_UP": 1.0,
|
||||||
"STANDBY": 1.0,
|
"STANDBY": 1.0,
|
||||||
"CONFIRMED": 1.0,
|
"CONFIRMED": 1.0,
|
||||||
|
|
|
@ -142,32 +142,42 @@ a.response-status-signed-off-bg:hover, a.response-status-1-bg:hover {
|
||||||
background-color: #bd2130;
|
background-color: #bd2130;
|
||||||
}
|
}
|
||||||
|
|
||||||
.response-status-signed-up-bg, .response-status-2-bg { /* info */
|
.response-status-backup-bg, .response-status-2-bg { /* warning */
|
||||||
color: #fff;
|
|
||||||
background-color: #17a2b8;
|
|
||||||
}
|
|
||||||
a.response-status-signed-up-bg:focus, a.response-status-2-bg:focus,
|
|
||||||
a.response-status-signed-up-bg:hover, a.response-status-2-bg:hover {
|
|
||||||
color: #fff;
|
|
||||||
background-color: #117a8b;
|
|
||||||
}
|
|
||||||
|
|
||||||
.response-status-standby-bg, .response-status-3-bg { /* warning */
|
|
||||||
color: #212529;
|
color: #212529;
|
||||||
background-color: #ffc107;
|
background-color: #ffc107;
|
||||||
}
|
}
|
||||||
a.response-status-standby-bg:focus, a.response-status-3-bg:focus,
|
a.response-status-backup-bg:focus, a.response-status-2-bg:focus,
|
||||||
a.response-status-standby-bg:hover, a.response-status-3-bg:hover {
|
a.response-status-backup-bg:hover, a.response-status-2-bg:hover {
|
||||||
color: #212529;
|
color: #212529;
|
||||||
background-color: #d39e00;
|
background-color: #d39e00;
|
||||||
}
|
}
|
||||||
|
|
||||||
.response-status-confirmed-bg, .response-status-4-bg { /* success */
|
.response-status-signed-up-bg, .response-status-3-bg { /* info */
|
||||||
|
color: #fff;
|
||||||
|
background-color: #17a2b8;
|
||||||
|
}
|
||||||
|
a.response-status-signed-up-bg:focus, a.response-status-3-bg:focus,
|
||||||
|
a.response-status-signed-up-bg:hover, a.response-status-3-bg:hover {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #117a8b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.response-status-standby-bg, .response-status-4-bg { /* warning */
|
||||||
|
color: #212529;
|
||||||
|
background-color: #ffc107;
|
||||||
|
}
|
||||||
|
a.response-status-standby-bg:focus, a.response-status-4-bg:focus,
|
||||||
|
a.response-status-standby-bg:hover, a.response-status-4-bg:hover {
|
||||||
|
color: #212529;
|
||||||
|
background-color: #d39e00;
|
||||||
|
}
|
||||||
|
|
||||||
|
.response-status-confirmed-bg, .response-status-5-bg { /* success */
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #28a745;
|
background-color: #28a745;
|
||||||
}
|
}
|
||||||
a.response-status-confirmed-bg:focus, a.response-status-4-bg:focus,
|
a.response-status-confirmed-bg:focus, a.response-status-5-bg:focus,
|
||||||
a.response-status-confirmed-bg:hover, a.response-status-4-bg:hover {
|
a.response-status-confirmed-bg:hover, a.response-status-5-bg:hover {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #1e7e34;
|
background-color: #1e7e34;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,29 +18,34 @@ class RaidResponseForm(ModelForm):
|
||||||
self.fields["role"].initial = user.main.role
|
self.fields["role"].initial = user.main.role
|
||||||
self.fields["status"].choices = RaidResponse.UserStatus.choices
|
self.fields["status"].choices = RaidResponse.UserStatus.choices
|
||||||
|
|
||||||
self.helper = FormHelper()
|
is_signed_up = self.instance.status == RaidResponse.Status.SIGNED_UP
|
||||||
|
|
||||||
if self.instance.status <= RaidResponse.Status.SIGNED_OFF:
|
self.helper = FormHelper()
|
||||||
signup_button = StrictButton(
|
|
||||||
"Sign Up",
|
|
||||||
type="submit",
|
|
||||||
name="status",
|
|
||||||
value=RaidResponse.Status.SIGNED_UP,
|
|
||||||
css_class="btn-success btn-block"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
signup_button = StrictButton(
|
|
||||||
"Change",
|
|
||||||
type="submit",
|
|
||||||
name="status",
|
|
||||||
value=RaidResponse.Status.SIGNED_UP,
|
|
||||||
css_class="btn-primary btn-block"
|
|
||||||
)
|
|
||||||
self.helper.layout = Layout(
|
self.helper.layout = Layout(
|
||||||
Row(
|
Row(
|
||||||
Column("character", css_class="col-md-3"),
|
Column("character", css_class="col-md-3"),
|
||||||
Column("role", css_class="col-md-3"),
|
Column("role", css_class="col-md-2"),
|
||||||
Column(signup_button, css_class="col-md-3"),
|
Column(
|
||||||
|
StrictButton(
|
||||||
|
"Sign Up" if not is_signed_up else "Change",
|
||||||
|
type="submit",
|
||||||
|
name="status",
|
||||||
|
value=RaidResponse.Status.SIGNED_UP,
|
||||||
|
css_class=f"btn-block {'btn-success' if not is_signed_up else 'btn-primary'}"
|
||||||
|
),
|
||||||
|
css_class="col-md-3"
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
StrictButton(
|
||||||
|
"Backup",
|
||||||
|
type="submit",
|
||||||
|
name="status",
|
||||||
|
value=RaidResponse.Status.BACKUP,
|
||||||
|
css_class="btn-warning btn-block",
|
||||||
|
disabled=self.instance.pk and self.instance.status == RaidResponse.Status.BACKUP
|
||||||
|
),
|
||||||
|
css_class="col-md-2"
|
||||||
|
),
|
||||||
Column(
|
Column(
|
||||||
StrictButton(
|
StrictButton(
|
||||||
"Sign Off",
|
"Sign Off",
|
||||||
|
@ -50,7 +55,7 @@ class RaidResponseForm(ModelForm):
|
||||||
css_class="btn-danger btn-block",
|
css_class="btn-danger btn-block",
|
||||||
disabled=self.instance.pk and self.instance.status == RaidResponse.Status.SIGNED_OFF
|
disabled=self.instance.pk and self.instance.status == RaidResponse.Status.SIGNED_OFF
|
||||||
),
|
),
|
||||||
css_class="col-md-3"
|
css_class="col-md-2"
|
||||||
),
|
),
|
||||||
css_class="form-row"
|
css_class="form-row"
|
||||||
)
|
)
|
||||||
|
|
20
drakul/raids/migrations/0009_auto_20200528_0410.py
Normal file
20
drakul/raids/migrations/0009_auto_20200528_0410.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 3.0.2 on 2020-05-28 04:10
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('raids', '0008_auto_20200421_1753'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# This migration is not complete, as we're introducing a new status 'backup' with the old value of 'signed up'.
|
||||||
|
# We should probably do a proper migration, but no one else is using this system, so we'll just do it manually.
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='raidresponse',
|
||||||
|
name='status',
|
||||||
|
field=models.PositiveSmallIntegerField(choices=[(0, 'No Response'), (1, 'Signed Off'), (2, 'Backup'), (3, 'Signed Up'), (4, 'Standby'), (5, 'Confirmed')]),
|
||||||
|
),
|
||||||
|
]
|
|
@ -65,9 +65,10 @@ class RaidResponse(models.Model):
|
||||||
class Status(models.IntegerChoices):
|
class Status(models.IntegerChoices):
|
||||||
NO_RESPONSE = 0
|
NO_RESPONSE = 0
|
||||||
SIGNED_OFF = 1
|
SIGNED_OFF = 1
|
||||||
SIGNED_UP = 2
|
BACKUP = 2
|
||||||
STANDBY = 3
|
SIGNED_UP = 3
|
||||||
CONFIRMED = 4
|
STANDBY = 4
|
||||||
|
CONFIRMED = 5
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_attendance(self):
|
def default_attendance(self):
|
||||||
|
@ -75,7 +76,8 @@ class RaidResponse(models.Model):
|
||||||
|
|
||||||
class UserStatus(models.IntegerChoices):
|
class UserStatus(models.IntegerChoices):
|
||||||
SIGNED_OFF = 1
|
SIGNED_OFF = 1
|
||||||
SIGNED_UP = 2
|
BACKUP = 2
|
||||||
|
SIGNED_UP = 3
|
||||||
|
|
||||||
status = models.PositiveSmallIntegerField(
|
status = models.PositiveSmallIntegerField(
|
||||||
choices=Status.choices
|
choices=Status.choices
|
||||||
|
|
|
@ -28,18 +28,20 @@
|
||||||
</div>
|
</div>
|
||||||
<select class="custom-select" id="change-status-from-status-select">
|
<select class="custom-select" id="change-status-from-status-select">
|
||||||
<option value="1">Signed Off</option>
|
<option value="1">Signed Off</option>
|
||||||
<option selected value="2">Signed Up</option>
|
<option value="2">Backup</option>
|
||||||
<option value="3">Standby</option>
|
<option selected value="3">Signed Up</option>
|
||||||
<option value="4">Confirmed</option>
|
<option value="4">Standby</option>
|
||||||
|
<option value="5">Confirmed</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="input-group-append input-group-prepend">
|
<div class="input-group-append input-group-prepend">
|
||||||
<label class="input-group-text" for="change-status-to-status-select">to</label>
|
<label class="input-group-text" for="change-status-to-status-select">to</label>
|
||||||
</div>
|
</div>
|
||||||
<select class="custom-select" id="change-status-to-status-select">
|
<select class="custom-select" id="change-status-to-status-select">
|
||||||
<option value="1">Signed Off</option>
|
<option value="1">Signed Off</option>
|
||||||
<option value="2">Signed Up</option>
|
<option value="2">Backup</option>
|
||||||
<option value="3">Standby</option>
|
<option value="3">Signed Up</option>
|
||||||
<option selected value="4">Confirmed</option>
|
<option value="4">Standby</option>
|
||||||
|
<option selected value="5">Confirmed</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-outline-secondary" type="button"
|
<button class="btn btn-outline-secondary" type="button"
|
||||||
|
@ -59,9 +61,10 @@
|
||||||
</div>
|
</div>
|
||||||
<select class="custom-select" id="set-attendance-status-select">
|
<select class="custom-select" id="set-attendance-status-select">
|
||||||
<option value="1">Signed Off</option>
|
<option value="1">Signed Off</option>
|
||||||
<option value="2">Signed Up</option>
|
<option value="2">Backup</option>
|
||||||
<option value="3">Standby</option>
|
<option value="3">Signed Up</option>
|
||||||
<option selected value="4">Confirmed</option>
|
<option value="4">Standby</option>
|
||||||
|
<option selected value="5">Confirmed</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="number" class="form-control" id="set-attendance-value-input" aria-label="Attendance Input" value="1.0">
|
<input type="number" class="form-control" id="set-attendance-value-input" aria-label="Attendance Input" value="1.0">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
|
@ -77,15 +80,16 @@
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-7">
|
||||||
<div class="alert alert-primary d-flex justify-content-around" role="alert">
|
<div class="alert alert-primary d-flex justify-content-around" role="alert">
|
||||||
<div><span id="total-confirmed" class="font-weight-bold">?</span> Confirmed</div>
|
|
||||||
<div><span id="total-standby" class="font-weight-bold">?</span> Standby</div>
|
|
||||||
<div><span id="total-signed-up" class="font-weight-bold">?</span> Signed Up</div>
|
|
||||||
<div><span id="total-signed-off" class="font-weight-bold">?</span> Signed Off</div>
|
<div><span id="total-signed-off" class="font-weight-bold">?</span> Signed Off</div>
|
||||||
|
<div><span id="total-backup" class="font-weight-bold">?</span> Backup</div>
|
||||||
|
<div><span id="total-signed-up" class="font-weight-bold">?</span> Signed Up</div>
|
||||||
|
<div><span id="total-standby" class="font-weight-bold">?</span> Standby</div>
|
||||||
|
<div><span id="total-confirmed" class="font-weight-bold">?</span> Confirmed</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-5">
|
||||||
<div class="alert alert-success d-flex justify-content-around" role="alert">
|
<div class="alert alert-success d-flex justify-content-around" role="alert">
|
||||||
<div class="font-weight-bolder">Confirmed</div>
|
<div class="font-weight-bolder">Confirmed</div>
|
||||||
<div><span id="total-confirmed-tank" class="font-weight-bold">?</span> Tanks</div>
|
<div><span id="total-confirmed-tank" class="font-weight-bold">?</span> Tanks</div>
|
||||||
|
@ -104,9 +108,10 @@
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script>
|
<script>
|
||||||
const SIGNED_OFF = 1;
|
const SIGNED_OFF = 1;
|
||||||
const SIGNED_UP = 2;
|
const BACKUP = 2;
|
||||||
const STAND_BY = 3;
|
const SIGNED_UP = 3;
|
||||||
const CONFIRMED = 4;
|
const STAND_BY = 4;
|
||||||
|
const CONFIRMED = 5;
|
||||||
|
|
||||||
const TANK = 1;
|
const TANK = 1;
|
||||||
const HEALER = 2;
|
const HEALER = 2;
|
||||||
|
@ -122,6 +127,7 @@
|
||||||
function updateSelectTotals() {
|
function updateSelectTotals() {
|
||||||
let statusTotals = {
|
let statusTotals = {
|
||||||
[SIGNED_OFF]: 0,
|
[SIGNED_OFF]: 0,
|
||||||
|
[BACKUP]: 0,
|
||||||
[SIGNED_UP]: 0,
|
[SIGNED_UP]: 0,
|
||||||
[STAND_BY]: 0,
|
[STAND_BY]: 0,
|
||||||
[CONFIRMED]: 0
|
[CONFIRMED]: 0
|
||||||
|
@ -147,6 +153,7 @@
|
||||||
document.querySelector("#total-confirmed-damage").innerHTML = confirmedTotals[DAMAGE].toString();
|
document.querySelector("#total-confirmed-damage").innerHTML = confirmedTotals[DAMAGE].toString();
|
||||||
|
|
||||||
document.querySelector("#total-signed-off").innerHTML = statusTotals[SIGNED_OFF].toString();
|
document.querySelector("#total-signed-off").innerHTML = statusTotals[SIGNED_OFF].toString();
|
||||||
|
document.querySelector("#total-backup").innerHTML = statusTotals[BACKUP].toString();
|
||||||
document.querySelector("#total-signed-up").innerHTML = statusTotals[SIGNED_UP].toString();
|
document.querySelector("#total-signed-up").innerHTML = statusTotals[SIGNED_UP].toString();
|
||||||
document.querySelector("#total-standby").innerHTML = statusTotals[STAND_BY].toString();
|
document.querySelector("#total-standby").innerHTML = statusTotals[STAND_BY].toString();
|
||||||
document.querySelector("#total-confirmed").innerHTML = statusTotals[CONFIRMED].toString();
|
document.querySelector("#total-confirmed").innerHTML = statusTotals[CONFIRMED].toString();
|
||||||
|
|
Loading…
Reference in a new issue