{% assign session_element_type = "a" %}
{% if learning_path.enrolled? and training_session.unlocked? %}
	{% assign session_element_type = "a" %}
{% else %}
	{% assign session_element_type = "div" %}
{% endif %}

{% assign lp_session_required = 1 %}
{% if training_session.optional? %}
	{% assign lp_session_required = 0 %}
{% endif %}

{% assign training_session_time = training_session.time | split: " - " %}

{% assign start_time = training_session_time | slice: 0 | join: "" %}
{% if start_time contains "PM" %}
	{% assign start_time = start_time | remove: " PM" %}
	{% assign split_start_time = start_time | split: ":" %}
	{% assign start_time_hour = split_start_time | slice: 0 | join: "" | abs | plus: 12 %}
	{% assign start_time_mins = split_start_time | slice: 1 | join: "" %}
{% elsif start_time contains "AM" %}
	{% assign start_time = start_time | remove: " AM" %}
{% endif %}

{% assign end_time = training_session_time | slice: 1 | join: "" %}
{% if end_time contains "PM" %}
	{% assign end_time = end_time | remove: " PM" %}
	{% assign split_end_time = end_time | split: ":" %}
	{% assign end_time_hour = split_end_time | slice: 0 | join: "" | abs | plus: 12 %}
	{% assign end_time_mins = split_end_time | slice: 1 | join: "" %}
{% elsif end_time contains "AM" %}
	{% assign end_time = end_time | remove: " AM" %}
{% endif %}


{% if learning_path.enrolled? and training_session.unlocked? %}
	<div class="np-learning-path-outline-bar np-hidden-mobile" style='display: none;'></div>
	<div class="np-card np-learning-path-session-card lp-course" data-required="{{lp_session_required}}">
		<a
		class="np-learning-path-outline-item np-card-container"
		href="{% route training_session, id: training_session.id %}"
	>
			<div class="np-card-content np-card-padding">
				<div class="np-events-content-date-wrapper">
					<div class="np-events-content-date np-button-background-color">
						<div class="np-events-content-month">
							{{ training_session.month }}
						</div>
						<div class="np-events-content-day">
							{{ training_session.day }}
						</div>
					</div>	
					{% if training_session.optional? %}
						<div class="np-optional-ribbon">
							{% t shared.optional %}
						</div>
					{% endif %}				
				</div>
				<div class="np-learning-path-outline-content">
					<div class="np-learning-path-outline-name np-top-title">{{ training_session.name }}</div>
					<div class="np-learning-path-outline-caption">
						{% assign instructor_name = training_session.instructors | split: " " %}
						{{ instructor_name | slice: 0 }}
					</div>
					<div class="np-events-content-time np-learning-path-outline-time np-button-color">
						{{start_time_hour}}:{{start_time_mins}} - {{end_time_hour}}:{{end_time_mins}} Uhr
					</div>
				</div>
				<div class="register-button">
					<span data-lang="DE">Registrieren</span>
					<span data-lang="EN">Register</span>
				</div>
				
			</div>
		</a>
	</div>
{% else %}
	<div class="np-card np-learning-path-session-card lp-course">
		<div class="np-learning-path-outline-item np-card-container np-learning-path-outline-inactive-item">
			<div class="np-card-content np-card-padding">
				<div class="np-events-content-date-wrapper">
					<div class="np-events-content-date np-button-background-color">
						<div class="np-events-content-month">
							{{ training_session.month }}
						</div>
						<div class="np-events-content-day">
							{{ training_session.day }}
						</div>
					</div>	
					{% if training_session.optional? %}
						<div class="np-optional-ribbon">
							{% t shared.optional %}
						</div>
					{% endif %}				
				</div>
				<div class="np-learning-path-outline-content">
					<div class="np-learning-path-outline-name np-top-title">{{ training_session.name }}</div>
					<div class="np-learning-path-outline-caption">{{ training_session.caption }}</div>
				</div>	
			</div>
		</div>
	</div>
{% endif %}

