{% assign training_session_time = training_session.time_period | 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 %}

<div class="np-card-training-session-date">
	{% include "training_session_date", training_session: training_session %}

	{% if training_session.approved? %}
		<div class="session-date__other-info-container np-training-session-cta-note np-alert-success">
			<div class="session-date__other-info-wrapper">
				<i class="far fa-check np-training-session-icon" aria-hidden="true"></i>
				<span>You're registered!</span>
			</div>
		</div>
	{% elsif training_session.pending? %}
		<div class="session-date__other-info np-training-session-cta-note np-alert-error">
			<div class="session-date__other-info-wrapper">
				<span>Pending – waiting approval</span>
			</div>
		</div>
	{% elsif training_session.denied? %}
		<div class="session-date__other-info np-training-session-cta-note np-alert-error">
			<div class="session-date__other-info-wrapper">
				<span>Denied – contact your academy admin</span>
			</div>
		</div>
	{% elsif training_session.too_late? %}
		<div class="session-date__other-info np-training-session-cta-note np-alert-error">
			<div class="session-date__other-info-wrapper">
				<span>Too late – meeting started</span>
			</div>
		</div>
	{% elsif training_session.no_seats? %}
		<div class="session-date__other-info np-training-session-cta-note np-alert-error">
			<div class="session-date__other-info-wrapper">
				<span>No seats available</span>
			</div>
		</div>
	{% endif %}
</div>

<div class="training-session__details">
	<div class="np-training-session-time">
		<i class="fa fa-clock np-training-session-icon" aria-label="Event Time"></i>
			{{start_time_hour}}:{{start_time_mins}} - {{end_time_hour}}:{{end_time_mins}} Uhr
	</div>
	<div class="np-training-session-location">
		{% if training_session.location %}
			<i class="fa fa-map-marker-alt np-training-session-icon" aria-label="Event Location"></i>
			{{ training_session.location }}
		{% elsif training_session.session_url %}
			<i class="fa fa-globe np-training-session-icon"  aria-label="Event URL"></i>
			<a href="{{ training_session.session_url }}" class="np-button-color" target="_blank" >
				{{ training_session.session_url }}
			</a>
		{% endif %}
	</div>
	{% if training_session.instructor and training_session.instructor.size > 0 %}
		<div>
			<i class="fa fa-chalkboard-teacher np-training-session-icon" aria-label="Instructor"></i>
			{% assign instructor_name = training_session.instructor | split: " " %}
			{{ instructor_name | slice: 0 }}
		</div>
	{% endif %}
</div>