<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %>
<%= javascript_include_tag 'survey', :plugin => "redmine_wktime" %>

<% url = url_for(controller: 'wksurvey', action: 'print_survey_result', survey_id: params[:survey_id], groupName: params[:groupName], surveyForID: params[:surveyForID], surveyForType: params[:surveyForType]) %>
<div class ="contextual">
	<%= link_to l(:label_export_invoice), "javascript:void(window.open('#{url}', '_blank', 'location=yes,scrollbars=yes,status=yes'));",
		style: 'color:blue;text-decoration: underline;' %>
</div>
<%= title @survey.name %>
<div style="clear:both;">
<%= form_tag({:controller => "wksurvey", :action => 'survey_result'}, :method => :get, :id => 'result_form') do %>
	<%=h hidden_field_tag('survey_id', params[:survey_id]) %>
	<%=h hidden_field_tag('surveyForID', params[:surveyForID]) %>
  <%=h hidden_field_tag('surveyForType', params[:surveyForType]) %>
	<% if @survey.recur %>
		<table>
			<tr>
				<th style="text-align: left"><%= l(:label_clos_responses) %></th>
				<td><%= select_tag('groupName', options_for_select(get_response_group_items, selected: params[:groupName]), onchange: '$("#result_form").submit()') %>
				<%= link_to_function l(:button_apply), '$("#result_form").submit()', :class => 'icon icon-checked' %></td>
			</tr>
			<% if  params[:groupName].present? && @groupClosedDate.present? %>
				<tr>
					<th style="text-align: left"><%= l(:label_closed_date) %></th>
					<td><%= @groupClosedDate&.to_date %></td>
				</tr>
			<% end %>
		</table>
	<% end %>
<% end %>
</div>
<div>
	<fieldset class="box tabular">
		<%= render :partial => "survey_result" %>
	</fieldset>
</div>