{% set apgScThisMonth = apg_sc_get_this_month_days() %}

<table class="apg_sc_table">
    <tbody>
    <tr>
        <th colspan="7" class="apg_sc_header">
            <span class="apg_sc_year">{{ apgScThisMonth['year'] }}</span>年<span
                    class="apg_sc_month">{{ apgScThisMonth['month'] }}</span>月
        </th>
    </tr>
    <tr>
        <th class="apg_sc_sunday_header">日</th>
        <th class="apg_sc_monday_header">月</th>
        <th class="apg_sc_tuesday_header">火</th>
        <th class="apg_sc_wednesday_header">水</th>
        <th class="apg_sc_thursday_header">木</th>
        <th class="apg_sc_friday_header">金</th>
        <th class="apg_sc_saturday_header">土</th>
    </tr>
    {% for tr in apgScThisMonth['days'] %}
        <tr>
            {% for td in tr %}
                {% set apgCalendarClass = '' %}
                {% if loop.index == 7 %}
                    {% set apgCalendarClass = 'apg_sc_saturday' %}
                {% elseif loop.index == 1 %}
                    {% set apgCalendarClass = 'apg_sc_sunday' %}
                {% elseif loop.index == 2 %}
                    {% set apgCalendarClass = 'apg_sc_monday' %}
                {% elseif loop.index == 3 %}
                    {% set apgCalendarClass = 'apg_sc_tuesday' %}
                {% elseif loop.index == 4 %}
                    {% set apgCalendarClass = 'apg_sc_wednesday' %}
                {% elseif loop.index == 5 %}
                    {% set apgCalendarClass = 'apg_sc_thursday' %}
                {% elseif loop.index == 6 %}
                    {% set apgCalendarClass = 'apg_sc_friday' %}
                {% endif %}
                {% if td.day == "now"|date('j') %}
                    {% set apgCalendarClass = apgCalendarClass~' apg_sc_today' %}
                {% endif %}
                {% if td.holiday %}
                    {% set apgCalendarClass = apgCalendarClass~' apg_sc_holiday' %}
                {% endif %}
                {% if td.day is empty %}
                    {% set apgCalendarClass = apgCalendarClass~' apg_sc_non_day' %}
                {% endif %}
                <td title="{{ td.name }}" class="{{ apgCalendarClass }}">{{ td.day }}</td>
            {% endfor %}
        </tr>
    {% endfor %}
</table>

