Stichwort:
-
@@ -34,28 +45,53 @@
let item_div = document.getElementById("fz_"+fzid+"_div")
let item_cb = document.getElementById("fz_"+fzid+"_cb")
if (!item_cb.checked){
- console.log("MOIN NÖ")
item_cb.checked = true;
item_div.classList.add("fz_activ")
} else {
- console.log("MOIN JA")
item_cb.checked = false;
item_div.classList.remove("fz_activ")
}
}
+
+ function allFZ(){
+ let items = Array.from(document.getElementsByClassName("fz_item"))
+ var cb_all = document.getElementById("all_select")
+ var all_checked = false
+ if (cb_all.checked) {
+ all_checked = true
+ cb_all.checked = false
+ document.getElementById("selAll").innerHTML = "Alle Auswählen"
+ } else {
+ all_checked = false
+ cb_all.checked = true
+ document.getElementById("selAll").innerHTML = "Alle Abwählen"
+ }
+ items.forEach(function (item){
+ let item_id = item.id
+ let item_nr = item_id.replace("fz_", "").replace("_div", "")
+ if (all_checked) {
+ document.getElementById(item_id).classList.remove("fz_activ")
+ document.getElementById("fz_"+item_nr+"_cb").checked = false
+ } else {
+ document.getElementById(item_id).classList.add("fz_activ")
+ document.getElementById("fz_"+item_nr+"_cb").checked = true
+ }
+ })
+ }
-
Fahrzeuge
+
FahrzeugeAlle Auswählen
+
diff --git a/leitstelle/views.py b/leitstelle/views.py
index f2116c3..a5a91e0 100755
--- a/leitstelle/views.py
+++ b/leitstelle/views.py
@@ -1,5 +1,5 @@
from django.shortcuts import render
-from main.models import alarmierung_SW, fahrzeug, leitstelle
+from main.models import alarmierung_SW, fahrzeug, leitstelle, alarmierung, feuerwehr
# Create your views here.
def index(request):
@@ -8,6 +8,20 @@ def index(request):
def create(request):
sw_request = alarmierung_SW.objects.all().values_list()
fz_request = fahrzeug.objects.all().order_by('Funkrufname').values_list()
+
+ if request.method == "POST":
+ print(request.POST)
+
+ newAlarm = alarmierung()
+ newAlarm.Stichwort = alarmierung_SW.objects.get(id=int(request.POST.get("stichwort")))
+ newAlarm.ft = request.POST.get("freitext")
+ # HINWEIS - NACHFOLGEND IST DAUERHAFT AUF "ALSFELD" GESTELLT DA NOCH KEINE AUSWAHL MÖGLICH
+ newAlarm.Standort = feuerwehr.objects.get(id=1)
+ fahrzeuge = request.POST.getlist("fz")
+ print(fahrzeuge)
+ newAlarm.fz = str(request.POST.getlist("fz"))
+ newAlarm.save()
+
return render(request, 'leitstelle/create.html', {'sw':sw_request, 'fz':fz_request})
def setStation(request):
diff --git a/main/models.py b/main/models.py
index 3b2f353..64d51ae 100755
--- a/main/models.py
+++ b/main/models.py
@@ -28,7 +28,7 @@ class alarmierung_SW(models.Model):
# ALARMIERUNG
class alarmierung(models.Model):
- timestamp = models.DateTimeField(auto_created=True)
+ timestamp = models.DateTimeField(auto_created=True, auto_now_add=True)
sw = models.ForeignKey(alarmierung_SW, on_delete=models.CASCADE, name="Stichwort")
ft = models.CharField(max_length=100, null=True)
fz = models.CharField(max_length=100, null=True)
diff --git a/main/static/css/styles.css b/main/static/css/styles.css
index fca7d57..176e539 100755
--- a/main/static/css/styles.css
+++ b/main/static/css/styles.css
@@ -34,3 +34,27 @@ img.pb {
.form-control {
height: 2.5rem;
}
+
+.blink {
+ animation-name: animation_blink;
+ animation-timing-function: ease-in;
+ animation-duration: 2s;
+ animation-iteration-count: infinite;
+}
+@keyframes animation_blink {
+ 0% { opacity: 1; }
+ 50% { opacity: 0.1; }
+ 100% { opacity: 1; }
+}
+
+.shadow_blink {
+ animation-name: shadow_blink;
+ animation-timing-function: ease-in;
+ animation-duration: 2s;
+ animation-iteration-count: infinite;
+}
+@keyframes shadow_blink {
+ 0% { box-shadow: 0 0 2rem rgb(255, 0, 0); }
+ 50% { box-shadow: 0 0 2rem rgba(255, 0, 0, 0.109); }
+ 100% { box-shadow: 0 0 2rem rgb(255, 0, 0); }
+}
\ No newline at end of file
diff --git a/main/static/img/alarm.png b/main/static/img/alarm.png
new file mode 100644
index 0000000..6352566
Binary files /dev/null and b/main/static/img/alarm.png differ
diff --git a/main/static/img/clock.png b/main/static/img/clock.png
deleted file mode 100755
index ff09bb3..0000000
Binary files a/main/static/img/clock.png and /dev/null differ
diff --git a/main/static/sounds/Audio13.wav b/main/static/sounds/Audio13.wav
new file mode 100644
index 0000000..dfb4ed1
Binary files /dev/null and b/main/static/sounds/Audio13.wav differ
diff --git a/main/static/sounds/audio6.mp3 b/main/static/sounds/audio6.mp3
new file mode 100644
index 0000000..ed503d8
Binary files /dev/null and b/main/static/sounds/audio6.mp3 differ
diff --git a/monitor/static/css/style.css b/monitor/static/css/style.css
index 4d69ca8..e69de29 100755
--- a/monitor/static/css/style.css
+++ b/monitor/static/css/style.css
@@ -1,3 +0,0 @@
-#einsatz{
-
-}
diff --git a/monitor/templates/monitor/index.html b/monitor/templates/monitor/index.html
index 4c2d05b..18ccd03 100755
--- a/monitor/templates/monitor/index.html
+++ b/monitor/templates/monitor/index.html
@@ -3,101 +3,68 @@
{% block content %}
-
+
-
+
+ {% if alarm is not None %}
+
+ {% endif %}
+
-
+{% if alarm is not None %}
-
-
ALARM
+
- Inhalt Alarm
+{% if alarm.5 is True %}
+
+{% endif %}
+
+
+
NEUER EINSATZ
+
+
+
Stichwort:
+ {{ alarm.2 }}
+
+
+
Infos:
+ {{ alarm.3 }}
+
+
+
+
+ {% for fz in alarm.4 %}
+
+ {{ fz }}
+
+ {% endfor %}
+
+
-
+{% endif %}
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/monitor/views.py b/monitor/views.py
index 1b14d29..0ec811f 100755
--- a/monitor/views.py
+++ b/monitor/views.py
@@ -1,5 +1,27 @@
from django.shortcuts import render
+from main.models import alarmierung, alarmierung_SW, fahrzeug
+from datetime import timedelta
+from django.utils import timezone
+import ast
# Create your views here.
def index(request):
- return render(request, 'monitor/index.html')
\ No newline at end of file
+ now = timezone.now()
+ fifteen_minutes_ago = now - timedelta(minutes=10)
+ fifteen_seconds_ago = now - timedelta(seconds=15)
+ alarm_request = alarmierung.objects.filter(timestamp__gte=fifteen_minutes_ago).order_by("-timestamp").values_list()[0] if alarmierung.objects.filter(timestamp__gte=fifteen_minutes_ago).values_list().__len__() > 0 else None
+ if alarm_request != None:
+ alarm_request = alarm_request[:2] + (alarmierung_SW.objects.get(id=int(alarm_request[2])).kürzel,) + alarm_request[3:]
+ fz_list = []
+ print(alarm_request[4])
+ for i in ast.literal_eval(alarm_request[4]):
+ fz = fahrzeug.objects.get(id=int(i))
+ fz_list.append(fz.Funkrufname + " - " + fz.kürzel)
+ alarm_request = alarm_request[:4] + (fz_list,)
+ if now - alarm_request[1] > timedelta(seconds=25):
+ alarm_request = alarm_request[:5] + (False,)
+ else:
+ alarm_request = alarm_request[:5] + (True,)
+
+
+ return render(request, 'monitor/index.html', {'alarm':alarm_request})
\ No newline at end of file