<div class="table-toolbar">

</div>  

<div class="tabbable tabbable-custom tabbable-noborder">
    <ul class="nav nav-tabs" id="rowTab" style="float: right;">
        <li class="fright aw_3d_list active"> <a href="#tab1" data-toggle="tab"> السبت  </a> </li>
        <li class="fright aw_3d_list"> <a href="#tab2" data-toggle="tab"> الأحد  </a> </li>
        <li class="fright aw_3d_list"> <a href="#tab3" data-toggle="tab"> الإثنين </a> </li>
        <li class="fright aw_3d_list"> <a href="#tab4" data-toggle="tab"> الثلاثاء </a> </li>
        <li class="fright aw_3d_list"> <a href="#tab5" data-toggle="tab"> الأربعاء </a> </li>
        <li class="fright aw_3d_list"> <a href="#tab6" data-toggle="tab"> الخميس </a> </li>
        <li class="fright aw_3d_list"> <a href="#tab7" data-toggle="tab"> الجمعة </a> </li>
    </ul>
</div>


<div class="tab-content">
    {foreach $days as $day }
    <div class="tab-pane {if $day.no == 1}active {/if} " id="tab{$day.no}">
        <div class="row">
            <div class="col-md-12">
                <table class="table  table-bordered table-hover">
                    <caption style="text-align: center;font-weight: bolder">ساعات اليوم  
                        <a href="javascript:;"  data-dayNo="{$day.no}"
                           class="btn green-haze btn-block btn-xs fleft wds10 printDay">  طباعة   </a>
                    </caption>
                    <thead>
                        <tr>
                            <th></th>
                            {foreach $rooms as $room}
                            <th>{$room.name} </th>
                            {/foreach}
                        </tr>
                    </thead>
                    <tbody>
                        {foreach $day.hours as $hour}
                        <tr>
                            <td>{$hour} </td>
                            {foreach $rooms as $room}


                            {if $day.no == 1 }
                            {if in_array($hour, $room.resHours1)} 
                            {assign var="key" value=$hour|array_search:$room.resHours1}
                            <td class="dayBusy" data-dayNo="{$day.no}" data-room="{$room.id}"  data-hour="{$hour}" >
                                {if $key !== false}
                                {$room.resNames1[$key]}
                                {/if}
                            </td>
                            {else}
                            <td class="dayFree" data-dayNo="{$day.no}" data-room="{$room.id}"   
                                data-hour="{$hour}" >
                            </td>
                            {/if}
                            <!------------------------------------------------------------------------------------------------------------>
                            {else if $day.no == 2 }
                            {if in_array($hour, $room.resHours2)} 
                            {assign var="key" value=$hour|array_search:$room.resHours2}
                            <td class="dayBusy" data-dayNo="{$day.no}" data-room="{$room.id}"  data-hour="{$hour}" > 
                                {if $key !== false}
                                {$room.resNames2[$key]}
                                {/if}
                            </td>
                            {else}
                            <td class="dayFree" data-dayNo="{$day.no}" data-room="{$room.id}"   
                                data-hour="{$hour}" >
                            </td>
                            {/if}
                            <!------------------------------------------------------------------------------------------------------------>
                            {else if $day.no == 3 }
                            {if in_array($hour, $room.resHours3)} 
                            {assign var="key" value=$hour|array_search:$room.resHours3}
                            <td class="dayBusy" data-dayNo="{$day.no}" data-room="{$room.id}"  data-hour="{$hour}" > 
                                {if $key !== false}
                                {$room.resNames3[$key]}
                                {/if}
                            </td>
                            {else}
                            <td class="dayFree" data-dayNo="{$day.no}" data-room="{$room.id}"   
                                data-hour="{$hour}" >
                            </td>
                            {/if}
                            <!------------------------------------------------------------------------------------------------------------>
                            {else if $day.no == 4 }
                            {if in_array($hour, $room.resHours4)} 
                            {assign var="key" value=$hour|array_search:$room.resHours4}
                            <td class="dayBusy" data-dayNo="{$day.no}" data-room="{$room.id}"  data-hour="{$hour}" > 
                                {if $key !== false}
                                {$room.resNames4[$key]}
                                {/if}
                            </td>
                            {else}
                            <td class="dayFree" data-dayNo="{$day.no}" data-room="{$room.id}"   
                                data-hour="{$hour}" >
                            </td>
                            {/if}
                            <!------------------------------------------------------------------------------------------------------------>
                            {else if $day.no == 5 }
                            {if in_array($hour, $room.resHours5)} 
                            {assign var="key" value=$hour|array_search:$room.resHours5}
                            <td class="dayBusy" data-dayNo="{$day.no}" data-room="{$room.id}"  data-hour="{$hour}" > 
                                {if $key !== false}
                                {$room.resNames5[$key]}
                                {/if}
                            </td>
                            {else}
                            <td class="dayFree" data-dayNo="{$day.no}" data-room="{$room.id}"   
                                data-hour="{$hour}" >
                            </td>
                            {/if}
                            <!------------------------------------------------------------------------------------------------------------>
                            {else if $day.no == 6 }
                            {if in_array($hour, $room.resHours6)} 
                            {assign var="key" value=$hour|array_search:$room.resHours6}
                            <td class="dayBusy" data-dayNo="{$day.no}" data-room="{$room.id}"  data-hour="{$hour}" > 
                                {if $key !== false}
                                {$room.resNames6[$key]}
                                {/if}
                            </td>
                            {else}
                            <td class="dayFree" data-dayNo="{$day.no}" data-room="{$room.id}"   
                                data-hour="{$hour}" >
                            </td>
                            {/if}
                            <!------------------------------------------------------------------------------------------------------------>
                            {else if $day.no == 7 }
                            {if in_array($hour, $room.resHours7)} 
                            {assign var="key" value=$hour|array_search:$room.resHours7}
                            <td class="dayBusy" data-dayNo="{$day.no}" data-room="{$room.id}"  data-hour="{$hour}" > 
                                {if $key !== false}
                                {$room.resNames7[$key]}
                                {/if}
                            </td>
                            {else}
                            <td class="dayFree" data-dayNo="{$day.no}" data-room="{$room.id}"   
                                data-hour="{$hour}" >
                            </td>
                            {/if}
                            <!------------------------------------------------------------------------------------------------------------>
                            {/if}

                            {assign var="i" value="3"}
                            {assign var="k" value=""}
                            {/foreach}
                        </tr>
                        {/foreach}
                    </tbody>
                </table>
            </div>
        </div>

    </div>
    {/foreach}
</div>


{literal}
<style>
    .dayFree  {
        color: black;
        background-color: #a3dfa2;
        text-align: center;
    }

    .daySelected  {
        color: black;
        background-color: #7ac720;
        text-align: center;
    }

    .dayBusy  {
        color: black;
        background-color: #cccccc;
        text-align: center;
    }

    .dayCancel  {
        color: black;
        background-color: #f36a5a;
        text-align: center;
    }


</style>
{/literal}