mixin daycontent(date, litinfo, last_week, yesterday, tomorrow, next_week, parishcal, messages)
	.new_flex_zero
		.container-fluid(style="margin-bottom: 15px;")
			#daycontrol_parent
				+daycontrol(date, litinfo, last_week, yesterday, tomorrow, next_week)
					+messageview(messages)

	.new_flex_one
		.container-fluid
			.row
				.col-xs-12.col-sm-6
					fieldset(style="margin-bottom: 20px;")
						legend
							table(width="100%")
								tr
									td.
										Meine Termine & Co.
									td(align="right")
										+dropdown_button("Neu erstellen", "new_own", "right")
											- var link = "/" + date.date + "/new/edit";
											//- "/event" + link
											+dropdown_button_element_href("Ereignis", "javascript: pcal_pentry_edit_manager.start(\"event\", \"new\");")
											+dropdown_button_element_href("Zu-Beachten", "javascript: pcal_pentry_edit_manager.start(\"keep_in_mind\", \"new\");")
											+dropdown_button_element_href("Zu-Tun", "javascript: pcal_pentry_edit_manager.start(\"todo\", \"new\");")
											+dropdown_button_element_href("Abwesenheit", "javascript: pcal_pentry_edit_manager.start(\"away\", \"new\");")
											+dropdown_button_element_href("Fahrzeugenutzung", "javascript: pcal_pentry_edit_manager.start(\"vehicle_use\", \"new\");")
											li.divider(role="separator")
											li
												a(href="/pcalpub", target="_blank") Neue Terminveröffentlichung
											li
												a(href="/email", target="_blank") Neue eMail
											li
												a(href="/birthdaycards", target="_blank") Geburtstagskarten erstellen
											li
												a(href="/labelprinter", target="_blank") Etiketten erstellen
											li
												a(href="/patenurkunde", target="_blank") Patenurkunde erstellen
						#activities_own
							+day_activities(date, parishcal, "own")
					
				.col-xs-12.col-sm-6
					fieldset(style="margin-bottom: 20px;")
						legend Andere Termine & Co.
						#activities_other
							+day_activities(date, parishcal, "other")
							
					+day_birthdays(parishcal.birthdays)


mixin daycontrol(date, litinfo, last_week, yesterday, tomorrow, next_week)
	- var red_class = litinfo.decoration_hint_red ? "litpanel_red" : "litpanel_black";
	- litinfo.celebration = litinfo.celebration.replace(/\n/g, "<br/>");
	- litinfo.celebration_add = litinfo.celebration_add.replace(/\n/g, "<br/>");
	- litinfo.infos = litinfo.infos.replace(/\n/g,"<br/>");
	- var celebration_class = "";
	- if(litinfo.decoration_hint == 2) celebration_class = "litpanel_bold";
	- if(litinfo.decoration_hint == 1) celebration_class = "litpanel_italic";
	div(id="control")
		table(width="100%")
			tr
				td(colspan=2, width="25%")
				td(colspan=2, class=["litpanel_day_mobile_littime", red_class], style="text-align: center; width: 50%;") #{litinfo.time}
				td(colspan=2, width="25%")
			tr
				td(colspan=2, width="25%")
					a(href="javascript: day_goto('#{last_week}')", class="litpanel_arrow")
						span(class="glyphicon glyphicon-fast-backward", aria-hidden="true")
					a(href="javascript: day_goto('#{yesterday}')", class="litpanel_arrow", style="margin-left: 20px;")
						span(class="glyphicon glyphicon-step-backward", aria-hidden="true")
				td(colspan=2, style="text-align: center; width: 50%;")
					a(href="#", style="white-space: nowrap;", data-toggle="modal", data-target="#daypickerDialog", data-date="#{date.date}", class=["litpanel_day_mobile", red_class]) #{date.weekday_short}, #{date.day}. #{date.month_short} #{date.year} 
				td(colspan=2, style="text-align: right; width: 25%;")
					a(href="javascript: day_goto('#{tomorrow}')", class="litpanel_arrow", style="margin-right: 20px;")
						span(class="glyphicon glyphicon-step-forward", aria-hidden="true")
					a(href="javascript: day_goto('#{next_week}')", class="litpanel_arrow")
						span(class="glyphicon glyphicon-fast-forward", aria-hidden="true")
			tr
				td(colspan=6, class="litpanel_month_week_weekday litpanel_celebration_parent")
					span(class=["litpanel_celebration", celebration_class, red_class]) !{litinfo.celebration}
			if litinfo.celebration_add != ""
				tr
					td(colspan=6, class=["litpanel_month_week_weekday", "litpanel_celebration_parent", red_class])
						span(class="litpanel_celebration_add") !{litinfo.celebration_add}
			if litinfo.infos != ""
				tr
					td(colspan=6, class="litpanel_month_week_weekday litpanel_celebration_parent")
						span(class="litpanel_infos") !{litinfo.infos}
		block

mixin day_activities(date, parishcal, key)
	each a in parishcal.away[key]
		+day_away(date.date, a, "day")

	each t in parishcal.todo[key]
		+day_todo(date.date, t, "day")

	each k in parishcal.keep_in_mind[key]
		+day_keep_in_mind(date.date, k, "day")

	each v in parishcal.vehicle_use[key]
		+day_vehicle_use(date.date, v, "day")

	each event in parishcal.events[key]
		+pevent_with_thereafter(date.date, event)

mixin pevent_with_thereafter(date, event, options = { details: false, links: false, clickable: true, pcalview: "day" })
	if(options.clickable === false)
		- var onclick_func = ""
		- var cursor = "default"
	else
		- var onclick_func = "day_show_event('" + date + "', '" + event.uuid + "');"
		//- var onclick_func = "location.assign('/event/" + date + "/" + event.uuid + "');"
		- var cursor = "pointer"
	
	.eventbox.pcal_pentry(style='background-color: ' + event.pretty.punit_color + '; cursor: ' + cursor + ';', onclick=onclick_func, data-pentryuuid=event.uuid, data-pentryname=event.name + event.pretty.name_secondary, data-pentryaddname="", data-eventstart=event.start)
		.eventbox_punit_name #{event.punit.name}
		if(event.pretty.involved_backgroundstripes !== "")
			div(style="background: " + event.pretty.involved_backgroundstripes +"; height: 5px; margin-bottom: 2px;")
		div(style="display: flex; justify-content: space-between;")
			.eventbox_time #{event.pretty.time}
			.eventbox_visibility #{event.pretty.visibility_short}
		p.eventbox_name #{event.name}
			span.eventbox_name_secondary #{event.pretty.name_secondary}
		if(event.pretty.locations.length === 0)
			p.eventbox_locations(style='font-size: 8pt;') <i>Keine Orte angegeben.</i>
		else
			p.eventbox_locations !{event.pretty.locations}
		p.eventbox_involved !{event.pretty.involved}
		
		if(options.details === true)
			if event.description.length > 0
				- event.description = event.description.replace(/\n/g, "<br/>");
				p.eventbox_description !{event.description}
			//- else
			//- 	p(style="margin-top: 2px; margin-bottom: 2px;") dESCriptio
			if event.annotations.length > 0
				- event.annotations = event.annotations.replace(/\n/g, "<br/>");
				p.eventbox_annotations !{event.annotations}
			//- else
			//-	p(style="font-size: 90%;") ANN
		if(options.links === true)
			//- location.assign('/event/#{date}/#{event.uuid}/edit?pcalview=#{options.pcalview}');
			button(class="btn btn-default btn-xs", onclick="pcal_pentry_edit_manager.start(\"event\", \"#{event.uuid}\");")
				span(class="glyphicon glyphicon-edit", aria-hidden="true", style="color: blue;")
				span 
				span Bearbeiten
	
			//- location.assign('/pentry/#{date}/event/#{event.uuid}/clone?pcalview=#{options.pcalview}');
			button(class="btn btn-default btn-xs", onclick="pcal_pentry_clone_move_manager.start(\"event\", \"#{event.uuid}\", 'clone');")
				span(class="glyphicon glyphicon-copy", aria-hidden="true", style="color: green;")
				span 
				span Klonen
				
			//- location.assign('/pentry/#{date}/event/#{event.uuid}/move?pcalview=#{options.pcalview}');
			button(class="btn btn-default btn-xs", onclick="pcal_pentry_clone_move_manager.start(\"event\", \"#{event.uuid}\", 'move');")
				span(class="glyphicon glyphicon-transfer", aria-hidden="true", style="color: orange;")
				span 
				span Verschieben
				
			//- /event/#{date}/#{event.uuid}/delete
			form(method="POST", action="", style="display: inline;")
				//- input(type="hidden" name="u" value="#{u}")
				button(type="button", class="btn btn-default btn-xs", data-toggle="modal", data-target="#confirmDelete", data-event-type="Ereignis", data-event-name="#{event.name}", data-date="#{date}", data-pentry-type="event", data-pentry-uuid="#{event.uuid}", data-pentry-title="das Ereignis \"#{event.name}\"")
					span(class="glyphicon glyphicon-trash", aria-hidden="true", style="color: red;")
					span 
					span Löschen
					
			span 
			//- location.assign('/tevent/#{date}/#{event.uuid}/new/edit?pcalview=#{options.pcalview}');
			button(class="btn btn-default btn-xs", onclick="pcal_pentry_edit_manager.start('tevent','new');")
				span(class="glyphicon glyphicon-plus", aria-hidden="true")
				span 
				span Folgeereignis erstellen
	
	div
		- var tev_count = 0
		each tev in event.thereafter
			- tev_count++;
			.eventbox(style='background-color: ' + event.pretty.punit_color + '; margin-left: 20px; margin-right: 0px; cursor: ' + cursor + ';', onclick=onclick_func)
				if(tev.pretty.involved_backgroundstripes !== "")
					div(style="background: " + tev.pretty.involved_backgroundstripes +"; height: 5px; margin-bottom: 2px;")
				div(style="display: flex; justify-content: space-between;")
					.eventbox_time #{tev.pretty.time}
					.eventbox_visibility #{tev.pretty.visibility_short}
					
				p.eventbox_name #{tev.name}
					span.eventbox_name_secondary #{tev.pretty.name_secondary}
				
				if(tev.pretty.locations.length === 0)
					p.eventbox_locations(style='font-size: 8pt;') <i>Keine Orte angegeben.</i>
				else
					p.eventbox_locations !{tev.pretty.locations}
				if tev.pretty.involved != ""
					p.eventbox_involved !{tev.pretty.involved}
				if(options.details === true)
					if(tev.description != "")
						- tev.description = tev.description.replace(/\n/g, "<br/>");
						p.eventbox_description !{tev.description}
					//- else
					//-	span dESCriptio
					//-	br
					if(tev.annotations != "")
						- tev.annotations = tev.annotations.replace(/\n/g, "<br/>");
						p.eventbox_annotations !{tev.annotations}
					//- else
					//-	span(style="font-size: 90%;") ANN
					//-	br
				if(options.links === true)
					div
						//- location.assign('/tevent/#{date}/#{event.uuid}/#{tev.uuid}/edit?pcalview=#{options.pcalview}');
						button(class="btn btn-default btn-xs", onclick="pcal_pentry_edit_manager.start('tevent', '#{tev.uuid}');")
							span(class="glyphicon glyphicon-edit", aria-hidden="true", style="color: blue;")
							span 
							span Bearbeiten
	
						//- if(event.thereafter.length > 1 && tev_count != 1)
						- var disable_up = (event.thereafter.length < 2 ||  tev_count === 1)
						button(class="btn btn-default btn-xs", type="button", onclick="do_tevent_move_updown($(this), '#{date}', '#{event.uuid}', '#{tev.uuid}', 'up');", disabled=disable_up)
							span(class="glyphicon glyphicon-arrow-up", aria-hidden="true", style="color: green;")
							span
							span Nach oben
				
						//- if(event.thereafter.length > 1 && tev_count != event.thereafter.length)
						- var disable_down = (event.thereafter.length < 2 || tev_count === event.thereafter.length);
						button(class="btn btn-default btn-xs", type="button", onclick="do_tevent_move_updown($(this), '#{date}', '#{event.uuid}', '#{tev.uuid}', 'down');", disabled=disable_down)
							span(class="glyphicon glyphicon-arrow-down", aria-hidden="true", style="color: green;")
							span 
							span Nach unten
				
						button(class="btn btn-default btn-xs", type="button", data-toggle="modal", data-target="#confirmDelete", data-event-type="Folgeereignis", data-event-name="#{tev.name}", data-date="#{date}", data-event-uuid="#{event.uuid}", data-tevent-uuid="#{tev.uuid}", data-pentry-type="tevent", data-pentry-uuid="#{tev.uuid}", data-pentry-title="das Folgeereignis \"#{tev.name}\"")
							span(class="glyphicon glyphicon-trash", aria-hidden="true", style="color: red;")
							span 
							span Löschen

mixin pevent_with_thereafter_timeline(date, event, clickable)
	if(typeof clickable === 'undefined' || clickable === true)
		- var onclick_func = "day_show_event('" + date + "', '" + event.uuid + "');"
		- var cursor = "pointer"
	else
		- var onclick_func = ""
		- var cursor = "default"
	
	div(style='height: ' + event.height + 'px; background-color: lightgrey; border-radius: 15px;') 
		.eventbox(style='cursor: ' + cursor + '; background-color: ' + event.pretty.punit_color + ';', onclick=onclick_func)
			if(event.pretty.involved_backgroundstripes !== "")
				div(style="background: " + event.pretty.involved_backgroundstripes +"; height: 5px; margin-bottom: 1px;")
			div(style="display: flex; justify-content: space-between;")
				.timelineevent_time #{event.pretty.time_short}
				.timelineevent_visibility #{event.pretty.visibility_short}
			p.timelineevent_name #{event.name}
				span.timelineevent_name_secondary #{event.pretty.name_secondary}
			if(event.pretty.locations.length > 0)
				p.timelineevent_locations !{event.pretty.locations}
			if(event.pretty.involved.length > 0)
				p.timelineevent_involved !{event.pretty.involved}

		div
			- var tev_count = 0
			each tev in event.thereafter
				- tev_count++;
				.eventbox(style='background-color: ' + event.pretty.punit_color + '; margin-left: 20px; margin-right: 0px; cursor: ' + cursor + ';', onclick=onclick_func)
					if(tev.pretty.involved_backgroundstripes !== "")
						div(style="background: " + tev.pretty.involved_backgroundstripes +"; height: 5px; margin-bottom: 1px;")
					div(style="display: flex; justify-content: space-between;")
						.timelineevent_time #{tev.pretty.time_short}
						.timelineevent_visibility #{tev.pretty.visibility_short}
					p.timelineevent_name #{tev.name}
						span.timelineevent_name_secondary #{tev.pretty.name_secondary}
					if(tev.pretty.locations.length > 0)
						p.timelineevent_locations !{tev.pretty.locations}
					if(tev.pretty.involved.length > 0)
						p.timelineevent_involved !{tev.pretty.involved}

mixin timelinepoints(parishcal)
	.timepoint(style="top: #{parishcal.timeline_positions[0]}px;") 00
	.timepoint(style="top: #{parishcal.timeline_positions[1]}px;") 01
	.timepoint(style="top: #{parishcal.timeline_positions[2]}px;") 02
	.timepoint(style="top: #{parishcal.timeline_positions[3]}px;") 03
	.timepoint(style="top: #{parishcal.timeline_positions[4]}px;") 04
	.timepoint(style="top: #{parishcal.timeline_positions[5]}px;") 05
	.timepoint(style="top: #{parishcal.timeline_positions[6]}px;") 06
	.timepoint(style="top: #{parishcal.timeline_positions[7]}px;") 07
	.timepoint(style="top: #{parishcal.timeline_positions[8]}px;") 08
	.timepoint(style="top: #{parishcal.timeline_positions[9]}px;") 09
	.timepoint(style="top: #{parishcal.timeline_positions[10]}px;") 10
	.timepoint(style="top: #{parishcal.timeline_positions[11]}px;") 11
	.timepoint(style="top: #{parishcal.timeline_positions[12]}px;") 12
	.timepoint(style="top: #{parishcal.timeline_positions[13]}px;") 13
	.timepoint(style="top: #{parishcal.timeline_positions[14]}px;") 14
	.timepoint(style="top: #{parishcal.timeline_positions[15]}px;") 15
	.timepoint(style="top: #{parishcal.timeline_positions[16]}px;") 16
	.timepoint(style="top: #{parishcal.timeline_positions[17]}px;") 17
	.timepoint(style="top: #{parishcal.timeline_positions[18]}px;") 18
	.timepoint(style="top: #{parishcal.timeline_positions[19]}px;") 19
	.timepoint(style="top: #{parishcal.timeline_positions[20]}px;") 20
	.timepoint(style="top: #{parishcal.timeline_positions[21]}px;") 21
	.timepoint(style="top: #{parishcal.timeline_positions[22]}px;") 22
	.timepoint(style="top: #{parishcal.timeline_positions[23]}px;") 23
						
mixin timeline(date, litinfo, last_week, yesterday, tomorrow, next_week, parishcal, messages)
	.new_flex_zero(style="margin-bottom: 15px;")
		.container-fluid
			#daycontrol_parent
				+daycontrol(date, litinfo, last_week, yesterday, tomorrow, next_week)
					+messageview(messages)

	.new_flex_one
		.container-fluid
			#timelinebody
				each a in parishcal.away
					+day_away(date.date, a, "timeline")
				each t in parishcal.todo
					+day_todo(date.date, t, "timeline")
				each k in parishcal.keep_in_mind
					+day_keep_in_mind(date.date, k, "timeline")
				each v in parishcal.vehicle_use
					+day_vehicle_use(date.date, v, "timeline")
				
				- var panelwidth = (parishcal.events.length > 1 ? parishcal.events.length * 110 + "px" : "100%")
				.block-relative(style="min-width: #{panelwidth}; height: #{parishcal.timeline_positions[24]}px; ")
					+timelinepoints(parishcal)
					- var colwidth = (parishcal.events.length > 0 ? 100 / parishcal.events.length : 100);
					- var left = 0;
					each col in parishcal.events
						each event in col
							.block-absolute(style="top: #{event.top}px; height: #{event.height}px; left: #{left}%; width: #{colwidth}%; overflow: hidden;", data-event-uuid="#{event.uuid}")
								+pevent_with_thereafter_timeline(date.date, event)
						- left = left + colwidth;

mixin actors_pfarreien_timeline_scripts
	script.
		function adjust_actorpanel_height() {
			var height = 0;
			$( "#actorpanel > .block-absolute" ).each(function() {
				console.log($(this));
				var my_height = $( this ).height();
				console.log(my_height);
				if(my_height > height)
					height = my_height;
				console.log(height);
			});
			$('#actorpanel').height(height);
			$(".actortrenner").height(height);
		}
		
		adjust_actorpanel_height();
		
		
		// Get the header
		var actorheader = document.getElementById("actorheader");
		
		// Get the offset position of the navbar
		var sticky = actorheader.offsetTop - document.getElementById("timelinescroll").offsetTop;
		
		// When the user scrolls the page, execute myFunction 
		// Add the sticky class to the header when you reach its scroll position. Remove "sticky" when you leave the scroll position
		$("#timelinescroll").on("scroll", function() {
			console.log('onscroll')
			console.log('stick: ', sticky)
			console.log($("#timelinescroll"))
			console.log($("#timelinescroll").scrollTop())
			if ($("#timelinescroll").scrollTop() > sticky) {
				actorheader.classList.add("sticky");
				$(".sticky").css("top", $("#timelinescroll").offset().top);
				$("#actorpanel").css("left", $("#timelinescroll").scrollLeft()*-1)
				console.log($("#timelinescroll").scrollLeft()*-1);

			} else {
				actorheader.classList.remove("sticky");
				$("#actorpanel").css("left", 0)
			}
			
			$("#actorpanel").css("width", $("#timelinepanel").width())
			
		});
		
		$("#timelinepanel").resize(function() {
			$("#actorpanel").css("width", $("#timelinepanel").width())
		});


mixin pastoralteam(date, litinfo, last_week, yesterday, tomorrow, next_week, parishcal, messages)
	.new_flex_zero(style="margin-bottom: 15px;")
		.container-fluid
			#daycontrol_parent
				+daycontrol(date, litinfo, last_week, yesterday, tomorrow, next_week)
					+messageview(messages)

	.new_flex_one#timelinescroll
		.container-fluid
			#timelinebody
				each a in parishcal.away
					+day_away(date.date, a, "timeline")
				each t in parishcal.todo
					+day_todo(date.date, t, "timeline")
				each k in parishcal.keep_in_mind
					+day_keep_in_mind(date.date, k, "timeline")
				each v in parishcal.vehicle_use
					+day_vehicle_use(date.date, v, "timeline")
				
				- var panelwidth = parishcal.number_of_eventcolumns * 110 + "px";
				- var colwidth = 100 / parishcal.number_of_eventcolumns;
				div#actorheader
					.block-relative#actorpanel(style="min-width: #{panelwidth};")
						- var left = 0;
						each actor in parishcal.actors
							//- div(style="width: #{colwidth}%; color: white; display: inline;")
							//-	b #{actor.name}
							.block-absolute(style="top: 0px; left: #{left}%; width: #{colwidth}%; height: auto;")
								b #{actor.name}
							- left = left + (actor.number_of_eventcolumns * colwidth);
							div.actortrenner(style="position: absolute; top: 0px; left: #{left}%; border-left: 1px solid black;")
				div
					.block-relative#timelinepanel(style="min-width: #{panelwidth}; height: #{parishcal.timeline_positions[24]}px;")
						+timelinepoints(parishcal)
						- var left = 0;
						each actor in parishcal.actors
							each col in actor.events
								each event in col
									.block-absolute(style="top: #{event.top}px; height: #{event.height}px; left: #{left}%; width: #{colwidth}%; overflow: hidden;", data-event-uuid="#{event.uuid}")
										+pevent_with_thereafter_timeline(date.date, event)
								- left = left + colwidth;
							div(style="position: absolute; top: 0px; left: #{left}%; height: #{parishcal.timeline_positions[24]}px; border-left: 1px solid black;")
						
				+actors_pfarreien_timeline_scripts


mixin pfarreientimeline(date, litinfo, last_week, yesterday, tomorrow, next_week, parishcal, messages)
	.new_flex_zero(style="margin-bottom: 15px;")
		.container-fluid
			#daycontrol_parent
				+daycontrol(date, litinfo, last_week, yesterday, tomorrow, next_week)
					+messageview(messages)

	.new_flex_one#timelinescroll
		.container-fluid
			#timelinebody
				each a in parishcal.away
					+day_away(date.date, a, "timeline")
				each t in parishcal.todo
					+day_todo(date.date, t, "timeline")
				each k in parishcal.keep_in_mind
					+day_keep_in_mind(date.date, k, "timeline")
				each v in parishcal.vehicle_use
					+day_vehicle_use(date.date, v, "timeline")
				
				- var panelwidth = parishcal.number_of_eventcolumns * 110 + "px";
				- var colwidth = 100 / parishcal.number_of_eventcolumns;
				div#actorheader
					.block-relative#actorpanel(style="min-width: #{panelwidth};")
						- var left = 0;
						each unit in parishcal.units
							.block-absolute(style="top: 0px; left: #{left}%; width: #{colwidth}%; height: auto;")
								b #{unit.name}
							- left = left + (unit.number_of_eventcolumns * colwidth);
							div.actortrenner(style="position: absolute; top: 0px; left: #{left}%; border-left: 1px solid black;")
				div
					.block-relative#timelinepanel(style="min-width: #{panelwidth}; height: #{parishcal.timeline_positions[24]}px;")
						+timelinepoints(parishcal)
						- var left = 0;
						each unit in parishcal.units
							each col in unit.events
								each event in col
									.block-absolute(style="top: #{event.top}px; height: #{event.height}px; left: #{left}%; width: #{colwidth}%; overflow: hidden;", data-event-uuid="#{event.uuid}")
										+pevent_with_thereafter_timeline(date.date, event)
								- left = left + colwidth;
							div(style="position: absolute; top: 0px; left: #{left}%; height: #{parishcal.timeline_positions[24]}px; border-left: 1px solid black;")
				+actors_pfarreien_timeline_scripts


mixin common_pentry_panel(date, pentry, pentrytype, pentrytitle, pcalview)
	.pentry_details(onclick="var event = arguments[0] || window.event; event.stopPropagation();")
		//- location.assign('/#{pentrytype}/#{date}/#{pentry.uuid}/edit?pcalview=#{pcalview}');
		button(class="btn btn-default btn-xs", onclick="pcal_pentry_edit_manager.start(\"#{pentrytype}\", \"#{pentry.uuid}\");")
			span(class="glyphicon glyphicon-edit", aria-hidden="true", style="color: blue;")
			span 
			span Bearbeiten
		//- location.assign('/pentry/#{date}/#{pentrytype}/#{pentry.uuid}/clone?pcalview=#{pcalview}');
		button(class="btn btn-default btn-xs", onclick="pcal_pentry_clone_move_manager.start(\"#{pentrytype}\", \"#{pentry.uuid}\", 'clone');")
			span(class="glyphicon glyphicon-copy", aria-hidden="true", style="color: green;")
			span 
			span Klonen
		//- location.assign('/pentry/#{date}/#{pentrytype}/#{pentry.uuid}/move?pcalview=#{pcalview}');
		button(class="btn btn-default btn-xs", onclick="pcal_pentry_clone_move_manager.start(\"#{pentrytype}\", \"#{pentry.uuid}\", 'move');")
			span(class="glyphicon glyphicon-transfer", aria-hidden="true", style="color: orange;")
			span 
			span Verschieben
			
		button(type="button", class="btn btn-default btn-xs", onclick="$('#confirmDelete').modal('toggle', this);", data-date="#{date}", data-pentry-type="#{pentrytype}", data-pentry-uuid="#{pentry.uuid}", data-pentry-title="#{pentrytitle}")
			//- data-toggle="modal", data-target="#confirmDelete",
			span(class="glyphicon glyphicon-trash", aria-hidden="true", style="color: red;")
			span 
			span Löschen


mixin day_away(date, away, pcalview)
	.away.pcal_pentry(onclick="toggle_pentrydetails_visibility(this);", data-pentryuuid=away.uuid, data-pentryname=away.name, data-pentryaddname="")
		.daymanager_away_headline
			span Abwesend
			br
			span #{away.name}
		if away.reason.length > 0
			div(style="font-size: 9pt;") #{away.reason}
		+common_pentry_panel(date, away, "away", "die Abwesenheit von \"" + away.name + "\"", pcalview)
			
mixin day_todo(date, todo, pcalview)
	.todo.pcal_pentry(onclick="toggle_pentrydetails_visibility(this);", data-pentryuuid=todo.uuid, data-pentryname=todo.name, data-pentryaddname="")
		.daymanager_todo_headline
			span Zu tun
			br
			span #{todo.name}
		if todo.pretty.involved.length > 0
			.daymanager_todo_involved !{todo.pretty.involved}
		if todo.description.length > 0
			div(style="font-size: 9pt;") #{todo.description}
		+common_pentry_panel(date, todo, "todo", "das Zu-Tun \"" + todo.name + "\"", pcalview)
			
mixin day_keep_in_mind(date, kim, pcalview)
	.keep_in_mind.pcal_pentry(onclick="toggle_pentrydetails_visibility(this);", data-pentryuuid=kim.uuid, data-pentryname=kim.name, data-pentryaddname="")
		.daymanager_keep_in_mind_headline
			span Zu beachten
			br
			span #{kim.name}
		if kim.description.length > 0
			div(style="font-size: 9pt;") #{kim.description}
		+common_pentry_panel(date, kim, "keep_in_mind", "das Zu-Beachten \"" + kim.name + "\"", pcalview)
		
mixin day_vehicle_use(date, vu, pcalview)
	.vehicle_use.pcal_pentry(onclick="toggle_pentrydetails_visibility(this);", data-pentryuuid=vu.uuid, data-pentryname=vu.name, data-pentryaddname=vu.pretty.vehicle)
		.daymanager_vehicle_use_headline
			span Fahrzeugbenutzung
			br
			span #{vu.pretty.vehicle}
		span #{vu.name}
		if vu.pretty.involved.length > 0
			.daymanager_vehicle_use_involved !{vu.pretty.involved}
		if vu.description.length > 0
			div(style="font-size: 9pt;") #{vu.description}
		+common_pentry_panel(date, vu, "vehicle_use", "die Fahrzeugbenutzung \"" + vu.name + "\"", pcalview)

mixin day_birthdays_intern(title, bis)
	fieldset.col-sm-12.col-lg-4(style="margin-bottom: 4px;")
		legend(style="font-size: 115%; margin-bottom: 1px; font-style: italic;") #{title}
		if bis.length > 0
			each bi in bis
				p(style="margin-top: 0px; margin-bottom: 0px;") #{bi.name} (#{bi.age})
				p(style="margin-top: 0px; margin-bottom: 4px; font-size: 75%;") #{bi.kontext}
		else
			p(style="margin-top: 0px; margin-bottom: 0px;") Keine Geburtstage

mixin day_birthdays(birthdays)
	if birthdays.yesterday.length > 0 || birthdays.today.length > 0 || birthdays.tomorrow.length > 0
		fieldset(style="margin-top: 20px;")
			legend(style="margin-bottom: 3px;") Geburtstage
			.row(style="margin-bottom: 20px;")
				+day_birthdays_intern("Gestern", birthdays.yesterday)
				+day_birthdays_intern("Heute", birthdays.today)
				+day_birthdays_intern("Morgen", birthdays.tomorrow)

					
