
<%
    var moment = cla_moment(date);
    var date_time = moment.format("YYYY-MM-DD hh:mm:ss");
    var date = moment.format("YYYY-MM-DD");
    var brief_date = moment.format("DD MMM YYYY");
%>

<div id="<%=unique_id + day_id %>" class="calendar-popover" style="">
    <div class="clearfix">
      <div class="header"><%=lmsg('calendar.events_on') + ' ' + brief_date%>
        <a class="close close-popover float-right" href="#">
          <span aria-hidden="true"><ion-icon name="close-outline"></ion-icon></span>
        </a>
      </div>
    </div>
    <div class="popup-body">
        <div datasrc="" class="event-list">
            <% for (j=0; j < events.length; ++j) {
                var event = events[j];
                var style = event['is_full_day']
                        ?"background-color: " + event.color + "; color: white;"
                        :"color: " + event.color + ";";
            %>
            <div class="event" data-event-id="<%=event.id%>" style="<%=style%>"><%-event.body%></div>
            <%}

            if (events.length === 0) {%>
            <div class="no-event"><%=lmsg('calendar.no_events')%></div>
            <%}%>
        </div>

        <a class="btn btn-secondary btn-sm" href="/calendar/#view=day&start=<%=date%>"><%=lmsg('calendar.details_day')%></a>
        <a class="btn btn-success btn-sm float-right" href="/intranet/calendar/calendar_edit_event.php?id=0&type=event&start_date=<%=date_time%>&end_date=<%=date_time%>&full_day=1"><%=lmsg('calendar.mini_calendar.create_event')%></a>
    </div>
</div>
