{% set dts = dts %}
{% set startLabel = startLabel|default(null) %}
{% set endLabel = endLabel|default(null) %}
{% set multidayLabel = multidayLabel|default('Multi-Day Event') %}
{% set alldayLabel = alldayLabel|default('All Day Event') %}
{% set separator = separator|default(null) %}
{% set primaryClass = primaryClass|default(null) %}
{% set secondaryClass = [
(dts.multiday) ? 'cs-li-meta-multi-day' : '',
(dts.allday) ? 'cs-li-meta-all-day' : '',
( not dts.multiday and not dts.allday) ? 'cs-li-meta-default' : ''
] %}
{% set showStart = (showStart is defined) ? (showStart is same as(true)) : true %}
{% set showStartDate = (showStartDate is defined) ? (showStartDate is same as(true)) : true %}
{% set showStartTime = (showStartTime is defined) ? (showStartTime is same as(true)) : true %}
{% set showEnd = (showEnd is defined) ? (showEnd is same as(true)) : true %}
{% set showEndDate = (showEndDate is defined) ? (showEndDate is same as(true)) : true %}
{% set showEndTime = (showEndTime is defined) ? (showEndTime is same as(true)) : true %}
{% set showMeta = (showMeta is defined) ? (showMeta is same as(true)) : true %}
<div{% if primaryClass is not empty %} class="{{ primaryClass }} {{ secondaryClass|join(' ')|trim }}"{% endif %}>
{% if showStartDate or dts.hasStartTime or showEndDate or dts.hasEndTime %}
<p class="meta-event-datetime">
{% if showStart and dts.hasStart %}
<span class="meta-event-start">
{% if startLabel is not empty %}
<span class="meta-event-datetime-label">{{ startLabel }}</span>
{% endif %}
{% if showStartDate and dts.hasStartDate %}
<span class="meta-event-date">{{ dts.startDate }}</span>
{% endif %}
{% if showStartTime and dts.hasStartTime %}
<span class="meta-event-time">{{ dts.startTime }}</span>
{% endif %}
</span>
{% endif %}
{% if (showStart and showEnd) and dts.hasStartAndEnd and separator is not empty %}
<span class="meta-event-separator">{{ separator }}</span>
{% endif %}
{% if showEnd and dts.hasEnd %}
<span class="meta-event-end">
{% if endLabel is not empty %}
<span class="meta-event-datetime-label">{{ endLabel }}</span>
{% endif %}
{% if showEndDate and dts.hasEndDate %}
<span class="meta-event-date">{{ dts.endDate }}</span>
{% endif %}
{% if showEndTime and dts.hasEndTime %}
<span class="meta-event-time">{{ dts.endTime }}</span>
{% endif %}
</span>
{% endif %}
</p>
{% endif %}
{% if showMeta and (dts.multiday or dts.allday) %}
<p class="meta-event-type">
{%- if dts.multiday -%}
{{- multidayLabel -}}
{%- elseif dts.allday -%}
{{- alldayLabel -}}
{%- endif -%}
</p>
{% endif %}
{% if item is defined and item is not empty %}
{% if item.data.attachments|default([])|length == 1 %}
{% set attachment = ui_attachment(item.data.attachments[0]) %}
<p class="meta-event-attachment">
<a href="{{ attachment.url }}">{{ attachment.name }}</a>
</p>
{% elseif item.data.attachments|default([])|length > 1 %}
<p class="meta-event-attachment">
<a class="meta-event-attachment-link" data-ajax="{{ cms_path_prefix(containers) }}/calendar/details/{{ item.id }}" href="#">View attachments ({{ item.data.attachments|default([])|length }})</a>
</p>
{% endif %}
{% endif %}
</div>