From d8540c7c1c6d983b800c6cd5f2258cc8f834eab6 Mon Sep 17 00:00:00 2001 From: Ambulance Clerc Date: Sat, 26 Nov 2022 16:40:41 +0100 Subject: [PATCH] Maj UI Reskreen --- mycaldav/models.py | 9 +- mycaldav/static/mycaldav/style.css | 2 +- mycaldav/templates/reskreen.html | 3 +- mycaldav/templates/rh/rh_view.html | 29 ++- mycaldav/templates/team/team_view.html | 340 +++++++++++++++++++++---- mycaldav/views.py | 7 +- 6 files changed, 327 insertions(+), 63 deletions(-) diff --git a/mycaldav/models.py b/mycaldav/models.py index ad5d327..ceafb20 100644 --- a/mycaldav/models.py +++ b/mycaldav/models.py @@ -67,6 +67,10 @@ class cls_caldav(): elif periode == 2: tomorow = date + timedelta(days=1) events = recurring_ical_events.of(Calendar.from_ical(self.data)).between(today,tomorow) + elif periode == 3: + today = date + timedelta(days=-1) + tomorow = date + timedelta(days=2) + events = recurring_ical_events.of(Calendar.from_ical(self.data)).between(today,tomorow) elif periode == 7: endweek = date + timedelta(days=7) events = recurring_ical_events.of(Calendar.from_ical(self.data)).between(today,endweek) @@ -113,7 +117,7 @@ class cls_caldav(): item.dtstart = event["DTSTART"].dt.strftime("%d.%m.%Y %H:%M") item.dtstamp = int(event["DTSTART"].dt.strftime("%Y%m%d%H%M")) - print(item.dtstamp) + #print(item.dtstamp) item.dtend = event["DTEND"].dt.strftime("%d.%m.%Y %H:%M") @@ -126,10 +130,11 @@ class cls_caldav(): if type(start) is Datetime.date: start = datetime.combine(start, datetime.min.time()) print("convert Date to datetime") - print(start) + print(f"Parse Data {item.name} start:{start}") if int(start.strftime("%H")) < 19: self.day.append(item) if int(start.strftime("%H")) >= 19: + print("add to night ****") self.night.append(item) diff --git a/mycaldav/static/mycaldav/style.css b/mycaldav/static/mycaldav/style.css index 32f4174..853cc9c 100644 --- a/mycaldav/static/mycaldav/style.css +++ b/mycaldav/static/mycaldav/style.css @@ -26,7 +26,7 @@ } .ifram_main_div{ - color: white + color: var(--main-text-color) } table{ diff --git a/mycaldav/templates/reskreen.html b/mycaldav/templates/reskreen.html index 0728de4..9a8dffd 100644 --- a/mycaldav/templates/reskreen.html +++ b/mycaldav/templates/reskreen.html @@ -134,8 +134,7 @@
-

Équipages

- +

Communications importantes

diff --git a/mycaldav/templates/rh/rh_view.html b/mycaldav/templates/rh/rh_view.html index 4d35aa3..87acc71 100644 --- a/mycaldav/templates/rh/rh_view.html +++ b/mycaldav/templates/rh/rh_view.html @@ -3,23 +3,44 @@
{% if latest_task_list %} - +
{% for task in latest_task_list %} + {% if task.str_start_date == today %}      + - + {% endif %} {% endfor %} -
{{task.key}}
{{task.str_start_date}} - {{task.str_end_date}}
-
{{ task.name }}
{{task.desc}}
 
+ + + {% for task in latest_task_list %} + {% if task.str_start_date != today %} + + + + + + + {% endif %} + {% endfor %} +
+ {{task.key}}
+ {{task.str_start_date}} - {{task.str_end_date}}
+ +
+ {{ task.name }}
+ {{task.desc}} +
+ {% else %}

Aucune information d'accueil

{% endif %} diff --git a/mycaldav/templates/team/team_view.html b/mycaldav/templates/team/team_view.html index 0a43602..549d449 100644 --- a/mycaldav/templates/team/team_view.html +++ b/mycaldav/templates/team/team_view.html @@ -1,57 +1,295 @@ {% load static %} + + -
-{% if latest_task_list %} - - {% for task in latest_task_list %} - - - - - {% endfor %} - - - - - {% for task in night_task_list %} - {% if task.str_start_date == today %} - - - + + +
+
+ Équipages + {{ yesterday }} + {% if latest_task_list %} +
- {{task.key}} - {% if task.team_transfert %} - - - - {% endif %} - {% if task.team_manif %} -  Manif - {% endif %} - - {{ task.team_1 }}  - {{ task.team_2 }} -
 
Nuit
- {{task.key}} - {% if task.team_transfert %} - - - - {% endif %} - {% if task.team_manif %} - - - - {% endif %} - - {{ task.team_1 }}  - {{ task.team_2 }} -
+ {% for task in latest_task_list %} + {% if task.str_start_date == yesterday %} + + + + + {% endif %} + {% endfor %} + + + + + {% for task in night_task_list %} + {% if task.str_start_date == yesterday %} + + + + {% endif %} + {% endfor %} +
+ {{task.key}} + {% if task.team_transfert %} + + + + {% endif %} + {% if task.team_manif %} +  Manif + {% endif %} + + {{ task.team_1 }}  + {{ task.team_2 }} +
 
Nuit
+ {{task.key}} + {% if task.team_transfert %} + + + + {% endif %} + {% if task.team_manif %} + + + + {% endif %} + + {{ task.team_1 }}  + {{ task.team_2 }} +
+ {% else %} +

Aucune information d'équipage

{% endif %} - {% endfor %} - -{% else %} -

Aucune information d'équipage

-{% endif %} +
+
+ Équipages + {{ today }} + {% if latest_task_list %} + + {% for task in latest_task_list %} + {% if task.str_start_date == today %} + + + + + {% endif %} + {% endfor %} + + + + + {% for task in night_task_list %} + {% if task.str_start_date == today %} + + + + {% endif %} + {% endfor %} +
+ {{task.key}} + {% if task.team_transfert %} + + + + {% endif %} + {% if task.team_manif %} +  Manif + {% endif %} + + {{ task.team_1 }}  + {{ task.team_2 }} +
 
Nuit
+ {{task.key}} + {% if task.team_transfert %} + + + + {% endif %} + {% if task.team_manif %} + + + + {% endif %} + + {{ task.team_1 }}  + {{ task.team_2 }} +
+ {% else %} +

Aucune information d'équipage

+ {% endif %} + +
+ +
+ Équipages + {{ tomorow }} + {% if latest_task_list %} + + {% for task in latest_task_list %} + {% if task.str_start_date == tomorow %} + + + + + {% endif %} + {% endfor %} + + + + + {% for task in night_task_list %} + {% if task.str_start_date == tomorow %} + + + + {% endif %} + {% endfor %} +
+ {{task.key}} + {% if task.team_transfert %} + + + + {% endif %} + {% if task.team_manif %} +  Manif + {% endif %} + + {{ task.team_1 }}  + {{ task.team_2 }} +
 
Nuit
+ {{task.key}} + {% if task.team_transfert %} + + + + {% endif %} + {% if task.team_manif %} + + + + {% endif %} + + {{ task.team_1 }}  + {{ task.team_2 }} +
+ {% else %} +

Aucune information d'équipage

+ {% endif %} +
+ +
+
+ + +
\ No newline at end of file diff --git a/mycaldav/views.py b/mycaldav/views.py index 7bd3807..d039b28 100644 --- a/mycaldav/views.py +++ b/mycaldav/views.py @@ -59,7 +59,7 @@ def view_rh_caldav(request): o_caldav = cls_caldav(url=caldav_cfg["rh"]) o_caldav.get_caldav_data(periode=2) template = loader.get_template("rh/rh_view.html") - context = {'latest_task_list': o_caldav.items[::-1]} + context = {'latest_task_list': o_caldav.items[::-1], 'today': datetime.today().strftime('%d.%m')} return HttpResponse(template.render(context, request)) @xframe_options_exempt @@ -80,10 +80,11 @@ def view_op_caldav(request): @xframe_options_exempt def view_team_caldav(request): o_caldav = cls_caldav(url=caldav_cfg["team"]) - o_caldav.get_caldav_data(periode=1) + o_caldav.get_caldav_data(periode=3) template = loader.get_template("team/team_view.html") o_caldav.sort_array_by_key(True) - context = {'latest_task_list': o_caldav.day, 'night_task_list': o_caldav.night, 'today': datetime.today().strftime('%d.%m')} + + context = {'latest_task_list': o_caldav.day, 'night_task_list': o_caldav.night, 'today': datetime.today().strftime('%d.%m'),'yesterday': (datetime.today() + timedelta(days=-1)).strftime('%d.%m'),'tomorow': (datetime.today() + timedelta(days=+1)).strftime('%d.%m')} return HttpResponse(template.render(context, request)) @xframe_options_exempt