<%= title l(:label_scheduling) %>
<%= render partial: "wkattendance/render_hr_tabs" %>
<script>
  var apply_warn = '<%=l(:warning_schedule_shifts) %>';
</script>

<%= form_tag({:controller => controller_name, :action => 'index', :project_id => @project},  :method => :get, :id => 'schedule_form') do %>
  <%=h hidden_field_tag('tab', "#{controller_name}") %>
  <%= hidden_field_tag 'set_filter', '1' %>
  <%= hidden_field_tag('searchlist', controller_name) %>
  <%=h hidden_field_tag('generate', false) %>
  <fieldset class="box">
    <legend><%= l(:label_filter_plural) %></legend>
    <div style="float:right">
      <%= link_to_previous_month(@year, @month, :accesskey => accesskey(:previous)) %> | <%= link_to_next_month(@year, @month, :accesskey => accesskey(:next)) %>&nbsp;
      <% if validateERPPermission("S_SHIFT") && validateERPPermission("E_SHIFT") %>
        <%= actions_dropdown do %>
          <%= link_to l(:field_shift), url_for(:controller => "wkshift", :tab => "wkscheduling") %>
        <% end %>
      <% end %>
    </div>
    <div>
      <% if @schedulesShift %>
        <%= render :partial => 'wkscheduling/scheduling_filter', :locals => {:isApply => false} %>
      <% end %>
      <%= label_tag('month', l(:label_month)) %>&nbsp;
      <%= select_month(@month, :prefix => "month", :discard_type => true) %>&nbsp;
      <%= label_tag('year', l(:label_year)) %>&nbsp;
      <%= select_year(@year, :prefix => "year", :discard_type => true) %>&nbsp;
    </div>
    <p>
      <%= link_to_function l(:button_apply), '$("#schedule_form").submit()', :class => 'icon icon-checked' %>&nbsp;
      <%= link_to l(:button_clear), {project_id: @project, set_filter: 1, clear: true }, class: 'icon icon-reload' %>&nbsp;
      <% if @schedulesShift %>
        <%= link_to l(:label_schedule_shifts), 'javascript:scheduleFormSubmission();', :name => 'generate', :class => 'icon icon-report' %>
      <% end %>
    </p>
  </fieldset>
<% end %>
<%= render :partial => 'wkscheduling/wk_calendar', :locals => {:calendar => @calendar} %>
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>