{include file="mobile/templates/index_top.tpl"}

<div class="pages navbar-through toolbar-through">
    <!-- Page, "data-page" contains page name -->
    <div data-page="calendars" style="padding-bottom: 69px;" class="page">
        <!-- Scrollable page content -->
        <div class="page-content" style="{if $one_calendar}background: #fff;{/if}">

            {if $error}
                <div class="content-block">
                    <div class="content-block-title">{$error}</div>
                </div>
            {elseif $calendars_arr}
                <div class="list-block" style="margin-top: 66px;">
                    <ul>
                        {foreach from=$calendars_arr item=one_calendar}
                            <li>
                                <a href="m_calendars.php?calendar_id={$one_calendar.id}&back_url={$back_url}"
                                   class="item-link">
                                    <div class="item-content">
                                        <div class="item-inner">
                                            <div class="item-title">{$one_calendar.name}</div>
                                        </div>
                                    </div>
                                </a>
                            </li>
                        {/foreach}
                    </ul>
                </div>
            {elseif $one_calendar}
                {if $one_day}
                    <div class="content-block" style="margin: 7em 0 0 0;">
                        <div class="row no-gutter">
                            <div class="col-20">
                                <a {if ($calendar_info.this_month == '1' and $calendar_info.this_day == '1')}
                                        href="m_calendars.php?calendar_id={$calendar_id}&year={$calendar_info.prev_year}&month=12&day=31"
                                    {else}
                                        href="m_calendars.php?calendar_id={$calendar_id}&year={$year_id}&month={$calendar_info.this_month}&day={$calendar_info.prev_day}"
                                    {/if}
                                   class="link m-cb-cal-prev-day" style="width:60px;display: block;height: 22px;
background-image: url(mobile/ui/img/i-form-back-blue.png);
background-size: 11px 22px;
background-repeat: no-repeat;
background-position: 10px;">
                                </a>
                            </div>
                            <div class="col-60" style="text-align: center;">{$calendar_info.this_day_name}</div>
                            <div class="col-20" style="text-align: right;">
                                <a {if ($calendar_info.this_month == 12) and ($calendar_info.this_day == 31)}
                                        href="m_calendars.php?calendar_id={$calendar_id}&year={$calendar_info.next_year}&month=1&day=1"
                                    {else}
                                        href="m_calendars.php?calendar_id={$calendar_id}&year={$year_id}&month={$calendar_info.this_month}&day={$calendar_info.next_day}"
                                    {/if}
                                   class="link m-cb-cal-next-day" style="width:60px;display: block;float: right;height: 22px;
background-image: url(mobile/ui/img/i-form-back-blue.png);
background-size: 11px 22px;
background-repeat: no-repeat;
background-position: 10px;">
                                </a>
                            </div>
                        </div>
                    </div>
                    <div style="padding-top: 5px; margin-bottom: -11px;; position: relative;">
                        <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                            {foreach from=$events item=one_event}
                                {if $one_event.start == '00:00' && !$one_event.end}
                                    <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                        style="color: black;">
                                        <div style="float: left; padding: 6px; color: black;">
                                            <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                <span>{$one_event.text}</span>
                                            </div>
                                        </div>
                                    </a>
                                {/if}
                            {/foreach}
                        </div>
                    </div>
                    {assign var="prev_count" value=0}
                    <div class="content-block day_view" style="background-color: #fff; margin: 0px;">
                        <br/>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">00:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='00:00' || $one_event.start_time=='00:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='00:00' || $one_event.end_time=='00:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">01:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='01:00' || $one_event.start_time=='01:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='01:00' || $one_event.end_time=='01:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">02:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='02:00' || $one_event.start_time=='02:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='02:00' || $one_event.end_time=='02:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">03:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='03:00' || $one_event.start_time=='03:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='03:00' || $one_event.end_time=='03:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">04:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='04:00' || $one_event.start_time=='04:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='04:00' || $one_event.end_time=='04:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">05:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='05:00' || $one_event.start_time=='05:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='05:00' || $one_event.end_time=='05:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">06:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='06:00' || $one_event.start_time=='06:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='06:00' || $one_event.end_time=='06:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">07:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='07:00' || $one_event.start_time=='07:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='07:00' || $one_event.end_time=='07:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">08:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='08:00' || $one_event.start_time=='08:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='08:00' || $one_event.end_time=='08:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">09:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='09:00' || $one_event.start_time=='09:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='09:00' || $one_event.end_time=='09:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">10:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='10:00' || $one_event.start_time=='10:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='10:00' || $one_event.end_time=='10:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">11:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='11:00' || $one_event.start_time=='11:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='11:00' || $one_event.end_time=='11:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">12:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='12:00' || $one_event.start_time=='12:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='12:00' || $one_event.end_time=='12:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">13:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='13:00' || $one_event.start_time=='13:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='13:00' || $one_event.end_time=='13:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">14:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='14:00' || $one_event.start_time=='14:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='14:00' || $one_event.end_time=='14:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">15:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='15:00' || $one_event.start_time=='15:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='15:00' || $one_event.end_time=='15:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">16:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='16:00' || $one_event.start_time=='16:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='16:00' || $one_event.end_time=='16:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">17:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='17:00' || $one_event.start_time=='17:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='17:00' || $one_event.end_time=='17:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">18:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='18:00' || $one_event.start_time=='18:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='18:00' || $one_event.end_time=='18:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">19:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='19:00' || $one_event.start_time=='19:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='19:00' || $one_event.end_time=='19:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">20:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='20:00' || $one_event.start_time=='20:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='20:00' || $one_event.end_time=='20:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">21:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='21:00' || $one_event.start_time=='21:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='21:00' || $one_event.end_time=='21:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">22:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='22:00' || $one_event.start_time=='22:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='22:00' || $one_event.end_time=='22:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>
                        <div class="row no-gutter"
                             style="border-top: 1px solid #eeeeee; padding: 5px 0 0 0; position: relative;">
                            <div class="col-25" style="width: 50px; line-height: 35px;">23:00</div>
                            <div class="col-75" style="overflow: hidden; height: auto; width: 75%;">
                                {foreach from=$events item=one_event}
                                    {if ($one_event.start_time=='23:00' || $one_event.start_time=='23:30') && $one_event.start != '00:00'}
                                        <a href="view_line2.php?table={$one_event.table_id}&line={$one_event.id}&back_url={$back_url}"
                                           style="color: black;">
                                            <div style="float: left; padding: 6px; color: black;">
                                                <div style="padding-left: 8px; z-index: 10; margin: 0; border-left: 5px {$one_event.color} solid;">
                                                    <div style="font-size: 11px;color: gray;">{$one_event.start}{if $one_event.end} - {$one_event.end}{/if}</div>
                                                    <span>{$one_event.text}</span>
                                                </div>
                                            </div>
                                        </a>
                                        {assign var="prev_left" value=$prev_left + 1}
                                    {/if}
                                    {if $one_event.end_time=='23:00' || $one_event.end_time=='23:30'}
                                        {assign var="prev_left" value=$prev_left - 1}
                                    {/if}
                                {/foreach}
                            </div>
                        </div>

                    </div>
                {else}
                    <div class="content-block"  style="margin: 7em 0 0 0;">
                        <div class="row">
                            <div class="col-25">
                                <a {if $calendar_info.this_month != '1'}
                                    href="m_calendars.php?calendar_id={$calendar_id}&year={$year_id}&month={$calendar_info.prev_month}"
                                    {else}
                                    href="m_calendars.php?calendar_id={$calendar_id}&year={$calendar_info.prev_year}&month=12"
                                    {/if}
                                   class="link m-cb-cal-prev" style="width:60px;display: block;height: 22px;
background-image: url(mobile/ui/img/i-form-back-blue.png);
background-size: 11px 22px;
background-repeat: no-repeat;
background-position: 10px;">
                                </a>
                            </div>
                            <div class="col-50" style="text-align: center;">{$calendar_info.this_month_name}, {$year_id}</div>
                            <div class="col-25" style="text-align: right;">
                                <a {if $calendar_info.this_month != '12'}
                                    href="m_calendars.php?calendar_id={$calendar_id}&year={$year_id}&month={$calendar_info.next_month}"
                                    {else}
                                    href="m_calendars.php?calendar_id={$calendar_id}&year={$calendar_info.next_year}&month=1"
                                    {/if}
                                   class="link m-cb-cal-next" style="width:60px;display: block;float: right;width:60px;display: block;float: right;height: 22px;
background-image: url(mobile/ui/img/i-form-back-blue.png);
background-size: 11px 22px;
background-repeat: no-repeat;
background-position: 10px;">
                                </a>
                            </div>
                        </div>
                    </div>
                    <div class="content-block calendar_div">
                        <table>
                            <thead>
                            <tr>
                                <th><span title="{$lang.Monday}">{$lang.Monday|mb_substr:0:1}</span></th>
                                <th><span title="{$lang.Tuesday}">{$lang.Tuesday|mb_substr:0:1}</span></th>
                                <th><span title="{$lang.Wednesday}">{$lang.Wednesday|mb_substr:0:1}</span></th>
                                <th><span title="{$lang.Thursday}">{$lang.Thursday|mb_substr:0:1}</span></th>
                                <th><span title="{$lang.Friday}">{$lang.Friday|mb_substr:0:1}</span></th>
                                <th><span title="{$lang.Saturday}">{$lang.Saturday|mb_substr:0:1}</span></th>
                                <th><span title="{$lang.Sunday}">{$lang.Sunday|mb_substr:0:1}</span></th>
                            </tr>
                            </thead>
                            <tbody>


                            {foreach from=$generated_calendar item=days name=cycle}
                            <td class="m_cal_{$days.class}">
                                <div class="m_cal_day">
                                    {if $days.class=='next'}
                                        {if $calendar_info.this_month == '12'}
                                        <a href="m_calendars.php?calendar_id={$calendar_id}&year={$calendar_info.next_year}&month=1&day=1&back_url={$back_url}">{$days.int}</a>
                                        {else}
                                        <a href="m_calendars.php?calendar_id={$calendar_id}&year={$year_id}&month={$calendar_info.next_month}&day={$days.int}&back_url={$back_url}">{$days.int}</a>
                                        {/if}
                                    {else if $days.class=='prev'}
                                        {if $calendar_info.this_month == '1'}
                                        <a href="m_calendars.php?calendar_id={$calendar_id}&year={$calendar_info.prev_year}&month=12&day=31&back_url={$back_url}">{$days.int}</a>
                                        {else}
                                        <a href="m_calendars.php?calendar_id={$calendar_id}&year={$year_id}&month={$calendar_info.prev_month}&day={$days.int}&back_url={$back_url}">{$days.int}</a>
                                        {/if}
                                    {else}
                                    <a href="m_calendars.php?calendar_id={$calendar_id}&year={$year_id}&month={$calendar_info.this_month}&day={$days.int}&back_url={$back_url}">{$days.int}</a>
                                    {/if}
                                </div>
                            </td>

                            {if $smarty.foreach.cycle.iteration%7==0}</tr>
                            <tr>{/if}
                                {/foreach}

                            </tbody>
                        </table>
                    </div>
                {/if}
            {/if}

            <div class="add_calendar_event" style="display: none;">
                <div class="content-block-title" style="margin: 0px;">{$lang.Select_event_type}:</div>
                <input type="hidden" name="calendar_id" value="{$calendar_id}" class="get_calendar_id">
                <input type="hidden" name="year_id" value="{$year_id}" class="get_year_id">
                <input type="hidden" name="month_id" value="{$month_id}" class="get_month_id">
                <input type="hidden" name="day_id" value="{$day_id}" class="get_day_id">
                <div class="list-block">
                    <ul>
                        {foreach from=$event_types item=one_type}
                            <li>
                                <label class="label-radio item-content type_event_radio">
                                    <!-- Checked by default -->
                                    <input type="radio" name="type_event" value="{$one_type.id}"
                                           {if $one_type.default}checked="checked"{/if}
                                           class="type_event_radio type_event_radio_value">
                                    <div class="item-inner">
                                        <div class="item-title">{$one_type.name}</div>
                                    </div>
                                </label>
                            </li>
                        {/foreach}
                    </ul>
                </div>
            </div>

            {if $calendar_id}
                {include file="mobile/templates/footer.tpl" set_bt=7}
            {/if}

{* if $one_day}

{else}
  {include file="mobile/templates/footer.tpl" set_bt=0}
{/if *}
