<%-# Fedena
#Copyright 2010 Foradian Technologies Private Limited
#
#This product includes software developed at
#Project Fedena - http://www.projectfedena.org/
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing,
#software distributed under the License is distributed on an
#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#KIND, either express or implied.  See the License for the
#specific language governing permissions and limitations
#under the License. -%>

<div id="content-header">
  <%= image_tag("/images/HR/show_hr.png") %>
  <h1><%= t('timetable_text') %></h1>
  <h3><%= t('view') %></h3>
  <div id="app-back-button">
    <%= link_to_function image_tag("/images/buttons/back.png",:border => 0), "history.back()" %>
  </div>
</div>
<div id="inner-tab-menu">
  <ul>
    <li>
      <%= link_to " #{t('pdf_report')}",{:controller => "employee" ,:action => "timetable_pdf" ,:id => @employee.id}, :target => '_blank' %>
    </li>
  </ul>
</div>
<div id="page-yield">
  <div id="register">

    <div class="table">
      <% @weekday.each_with_index do |week,i| %>

      <div class="outer-table">
      <div class="outer-table1">
        <table border="0" align="center" width="100%" id="timing"  cellspacing="0">
          <tr>
            <td class="head">
              <div class="top">
                <%= t('time_text') %>
              </div>
              <div class="bottom">
                <div class="course">
                  <%= week[0,3].upcase %>
                </div>
              </div>
            </td>
            <td class="td-blank"> </td>
            <%unless  @weekday_timetable[i.to_s].nil? %>
            <%@weekday_timetable[i.to_s].each do |tte| %>

              <td>
                <div class="top">
                  <%= (tte.class_timing.start_time.strftime("%I:%M %p")+" to "+tte.class_timing.end_time.strftime("%I:%M %p")) unless tte.class_timing.start_time.nil? %>
                </div>
                <div class="bottom">
                  <div class="subject">
                    <%= tte.subject.batch.full_name %>
                  </div>
                  <div class="employee">
                    <% subject = tte.subject.elective_group.nil? ? tte.subject : (tte.subject.elective_group.subjects.select { |subs| @employee_subjects_ids.include?(subs.id)  }).first %>
                    <%= subject.code unless subject.nil? %>
                  </div>

                </div>
              </td>
            <% end %>
            <% end %>
            <td class="td-blankfill"></td>
          </tr>
        </table>
      </div>
      </div>
      <% end %>

    </div>
  </div>


</div>