Maj UI Reskreen

This commit is contained in:
Ambulance Clerc
2022-11-26 16:40:41 +01:00
parent 19d456873d
commit d8540c7c1c
6 changed files with 327 additions and 63 deletions

View File

@@ -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)

View File

@@ -26,7 +26,7 @@
}
.ifram_main_div{
color: white
color: var(--main-text-color)
}
table{

View File

@@ -134,8 +134,7 @@
</div>
<div class="div_container">
<div style="" class="div_item main_div">
<p style=""><a href="team_pdf" target="_blank">Équipages</a></p>
<iframe style="border:0;width:100%;height:350px;color:white" src="team"></iframe>
<iframe style="border:0;width:100%;height:350px;color:white;margin-top:17px" src="team"></iframe>
</div>
<div style="" class="div_item main_div">
<p style="">Communications importantes</p>

View File

@@ -3,23 +3,44 @@
<link rel="stylesheet" href="{% static 'mycaldav/style.css' %}">
<div class="ifram_main_div" style="height: 140px; overflow: auto;">
{% if latest_task_list %}
<table>
<table>
{% for task in latest_task_list %}
{% if task.str_start_date == today %}
<tr>
<td style="vertical-align: top;" class="td_key" >
<span style="font-weight: bold;">{{task.key}}</span><br>
{{task.str_start_date}} - {{task.str_end_date}}<br>
</td>&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
<a href="{{task.href}}" target="_blank" style="text-decoration: none;color: white" >{{ task.name }}<br></a>
{{task.desc}}
</td>
</tr>
<tr><td>&nbsp;</td></tr>
{% endif %}
{% endfor %}
</table>
</table>
<table>
{% for task in latest_task_list %}
{% if task.str_start_date != today %}
<tr>
<td style="vertical-align: top;" class="td_key" >
<span style="font-weight: bold;">{{task.key}}</span><br>
{{task.str_start_date}} - {{task.str_end_date}}<br>
</td>
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
<a href="{{task.href}}" target="_blank" style="text-decoration: none;color: white" >{{ task.name }}<br></a>
{{task.desc}}
</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% else %}
<p>Aucune information d'accueil</p>
{% endif %}

View File

@@ -1,57 +1,295 @@
{% load static %}
<style>
.slideshow-container {
max-width: 585px;
position: relative;
margin: auto;
}
.mySlides {
display: none;
}
.prev, .next {
cursor: pointer;
position: absolute;
top: 20px;
width: auto;
margin-top: -22px;
padding: 16px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
z-index: 100;
}
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
.prev:hover, .next:hover {
background-color: rgba(0,0,0,0.8);
}
.dot {
cursor: pointer;
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}
.active, .dot:hover {
background-color: #505050;
}
.fade {
animation-name: fade;
animation-duration: 1.5s;
}
@keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
.title {
color: white;
font-weight: bold;
font-size: 18pt;
text-align: center;
//text-transform: uppercase;
font-family: 'Source Sans Pro', sans-serif;
display: table;
margin: 0px auto;
margin-bottom: 5px;
}
</style>
<script>
let slideIndex = 1;
(function() {
// your page initialization code here
// the DOM will be available here
//showSlides(2);
})();
// Next/previous controls
function plusSlides(n) {
showSlides(slideIndex += n);
timeout = setTimeout(resetSlides, 15000);
}
function resetSlides(){
console.log("pass_reset slide");
showSlides(slideIndex = 2);
}
// Thumbnail image controls
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
let i;
let slides = document.getElementsByClassName("mySlides");
let dots = document.getElementsByClassName("dot");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
}
</script>
<link rel="stylesheet" href="{% static 'mycaldav/style.css' %}">
<div class="ifram_main_div">
{% if latest_task_list %}
<table>
{% for task in latest_task_list %}
<tr style="" title="{{task.desc}}">
<td style="vertical-align: top;font-weight: bold;" class="td_key" >
{{task.key}}
{% if task.team_transfert %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_trans_2.svg' %}#icon"></use>
</svg>
{% endif %}
{% if task.team_manif %}
&nbsp;Manif
{% endif %}
</td>
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
<span style="{% if task.team_1_chef %}color: yellow !important;{% endif %}; width: 150px;display: inline-block">{{ task.team_1 }}</span>&nbsp;
<span style="{% if task.team_2_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_2 }}</span>
</td>
</tr>
{% endfor %}
<tr><td>&nbsp;</td></tr>
<tr>
<td style="border-top: 1px dashed white;font-weight: bold;padding: 5px; text-align: center;" colspan="2">Nuit</td>
</tr>
{% for task in night_task_list %}
{% if task.str_start_date == today %}
<tr style=""><td style="font-weight: bold;vertical-align: top;{% if task.team_transfert %}background-color: orange;{% endif %}" class="td_key" >
{{task.key}}
{% if task.team_transfert %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_trans_2.svg' %}#icon"></use>
</svg>
{% endif %}
{% if task.team_manif %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_manif.svg' %}#icon"></use>
</svg>
{% endif %}
</td>
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
<span style="{% if task.team_1_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_1 }}</span>&nbsp;
<span style="{% if task.team_2_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_2 }}</span>
</td>
</tr>
<a class="prev" onclick="plusSlides(-1)">&#10094;</a>
<a class="next" onclick="plusSlides(1)">&#10095;</a>
<div class="ifram_main_div slideshow-container" style="">
<div class="mySlides fade">
<span class="title" style=""><a href="team_pdf" target="_blank">Équipages</a></span>
<span style="margin: 0 auto;display: table; margin-bottom: 13px"> <b >{{ yesterday }}</b></span>
{% if latest_task_list %}
<table>
{% for task in latest_task_list %}
{% if task.str_start_date == yesterday %}
<tr style="" title="{{task.desc}}">
<td style="vertical-align: top;font-weight: bold;" class="td_key" >
{{task.key}}
{% if task.team_transfert %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_trans_2.svg' %}#icon"></use>
</svg>
{% endif %}
{% if task.team_manif %}
&nbsp;Manif
{% endif %}
</td>
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
<span style="{% if task.team_1_chef %}color: yellow !important;{% endif %}; width: 150px;display: inline-block">{{ task.team_1 }}</span>&nbsp;
<span style="{% if task.team_2_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_2 }}</span>
</td>
</tr>
{% endif %}
{% endfor %}
<tr><td>&nbsp;</td></tr>
<tr>
<td style="border-top: 1px dashed white;font-weight: bold;padding: 5px; text-align: center;" colspan="2">Nuit</td>
</tr>
{% for task in night_task_list %}
{% if task.str_start_date == yesterday %}
<tr style=""><td style="font-weight: bold;vertical-align: top;{% if task.team_transfert %}background-color: orange;{% endif %}" class="td_key" >
{{task.key}}
{% if task.team_transfert %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_trans_2.svg' %}#icon"></use>
</svg>
{% endif %}
{% if task.team_manif %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_manif.svg' %}#icon"></use>
</svg>
{% endif %}
</td>
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
<span style="{% if task.team_1_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_1 }}</span>&nbsp;
<span style="{% if task.team_2_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_2 }}</span>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% else %}
<p>Aucune information d'équipage</p>
{% endif %}
{% endfor %}
</table>
{% else %}
<p>Aucune information d'équipage</p>
{% endif %}
</div>
<div class="mySlides fade" style="display: block;">
<span class="title" style=""><a href="team_pdf" target="_blank">Équipages</a></span>
<span style="margin: 0 auto;display: table; margin-bottom: 13px"> <b >{{ today }}</b></span>
{% if latest_task_list %}
<table>
{% for task in latest_task_list %}
{% if task.str_start_date == today %}
<tr style="" title="{{task.desc}}">
<td style="vertical-align: top;font-weight: bold;" class="td_key" >
{{task.key}}
{% if task.team_transfert %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_trans_2.svg' %}#icon"></use>
</svg>
{% endif %}
{% if task.team_manif %}
&nbsp;Manif
{% endif %}
</td>
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
<span style="{% if task.team_1_chef %}color: yellow !important;{% endif %}; width: 150px;display: inline-block">{{ task.team_1 }}</span>&nbsp;
<span style="{% if task.team_2_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_2 }}</span>
</td>
</tr>
{% endif %}
{% endfor %}
<tr><td>&nbsp;</td></tr>
<tr>
<td style="border-top: 1px dashed white;font-weight: bold;padding: 5px; text-align: center;" colspan="2">Nuit</td>
</tr>
{% for task in night_task_list %}
{% if task.str_start_date == today %}
<tr style=""><td style="font-weight: bold;vertical-align: top;{% if task.team_transfert %}background-color: orange;{% endif %}" class="td_key" >
{{task.key}}
{% if task.team_transfert %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_trans_2.svg' %}#icon"></use>
</svg>
{% endif %}
{% if task.team_manif %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_manif.svg' %}#icon"></use>
</svg>
{% endif %}
</td>
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
<span style="{% if task.team_1_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_1 }}</span>&nbsp;
<span style="{% if task.team_2_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_2 }}</span>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% else %}
<p>Aucune information d'équipage</p>
{% endif %}
</div>
<div class="mySlides fade">
<span class="title" style=""><a href="team_pdf" target="_blank">Équipages</a></span>
<span style="margin: 0 auto;display: table; margin-bottom: 13px"> <b >{{ tomorow }}</b></span>
{% if latest_task_list %}
<table>
{% for task in latest_task_list %}
{% if task.str_start_date == tomorow %}
<tr style="" title="{{task.desc}}">
<td style="vertical-align: top;font-weight: bold;" class="td_key" >
{{task.key}}
{% if task.team_transfert %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_trans_2.svg' %}#icon"></use>
</svg>
{% endif %}
{% if task.team_manif %}
&nbsp;Manif
{% endif %}
</td>
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
<span style="{% if task.team_1_chef %}color: yellow !important;{% endif %}; width: 150px;display: inline-block">{{ task.team_1 }}</span>&nbsp;
<span style="{% if task.team_2_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_2 }}</span>
</td>
</tr>
{% endif %}
{% endfor %}
<tr><td>&nbsp;</td></tr>
<tr>
<td style="border-top: 1px dashed white;font-weight: bold;padding: 5px; text-align: center;" colspan="2">Nuit</td>
</tr>
{% for task in night_task_list %}
{% if task.str_start_date == tomorow %}
<tr style=""><td style="font-weight: bold;vertical-align: top;{% if task.team_transfert %}background-color: orange;{% endif %}" class="td_key" >
{{task.key}}
{% if task.team_transfert %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_trans_2.svg' %}#icon"></use>
</svg>
{% endif %}
{% if task.team_manif %}
<svg class="team_svg_icon" x="0px" y="0px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<use class="team_svg_icon" xlink:href="{% static 'mycaldav/images/team_manif.svg' %}#icon"></use>
</svg>
{% endif %}
</td>
<td style="{% if task.done %}text-decoration:line-through{% endif %}">
<span style="{% if task.team_1_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_1 }}</span>&nbsp;
<span style="{% if task.team_2_chef %}color: yellow !important;{% endif %};width: 150px;display: inline-block">{{ task.team_2 }}</span>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% else %}
<p>Aucune information d'équipage</p>
{% endif %}
</div>
</div>
<div style="text-align:center; margin-top: 55px">
<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot active" onclick="currentSlide(2)"></span>
<span class="dot" onclick="currentSlide(3)"></span>
</div>

View File

@@ -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