<% content_for(:header_tags) do %> <%= javascript_include_tag :contacts, :plugin => 'redmine_contacts' %> <%= stylesheet_link_tag :contacts_sidebar, :plugin => 'redmine_contacts' %> <% end %> <% content_for :sidebar do %> <%= call_hook(:view_deals_sidebar_top, :deals => @deals) %> <%= render :partial => 'common/sidebar' %> <%= render :partial => 'deals_statistics' %> <%= call_hook(:view_deals_sidebar_after_statistics, :deals => @deals) %> <%= render :partial => 'notes/last_notes', :object => @last_notes %> <%= render :partial => 'common/recently_viewed' %> <%= call_hook(:view_deals_sidebar_bottom, :deals => @deals) %> <% end unless (deals_list_style == 'list_board') %>
<%= link_to l(:label_crm_deal_new), {:controller => 'deals', :action => 'new', :project_id => @project || Deal.allowed_target_projects.first }, :class => 'icon icon-add' if User.current.allowed_to?(:add_deals, @project, {:global => true}) && Deal.allowed_target_projects.any? %> <%= link_to_if_authorized l(:label_crm_import), {:controller => 'deal_imports', :action => 'new', :project_id => @project}, :class => 'icon icon-import', :id => 'import_from_csv' %>
<%= form_tag(params, :method => :get, :id => "query_form") do %> <%= hidden_field_tag('project_id', @project.to_param) if @project %> <% no_filters = ((params[:status_id].blank? || params[:status_id] == 'o') && params[:period].blank? && params[:assigned_to_id].blank? && params[:category_id].blank? && params[:probability].blank?) %>

<%= l(:label_deal_plural) %> <%= text_field_tag(:search, params[:search], :autocomplete => "off", :class => "live_search_field", :placeholder => l(:label_crm_contact_search) ) %>

<%= l(:label_filter_plural) %>

<% if !deal_statuses.empty? %> <%= label_tag l(:label_crm_deal_status) + " " %> <% if deals_list_style == 'list_board' %> <%= select_tag :status_id, options_for_select([[l(:label_open_issues), "o"], [l(:label_all), ""]], params[:status_id]) %> <% else %> <%= select_tag :status_id, options_for_select(collection_for_status_select.insert(0, [l(:label_open_issues), "o"]).insert(0, [l(:label_all), ""]), params[:status_id]) %> <% end %> <% end %> <%= label_tag l(:label_crm_created_on) + " "%> <%= select_tag 'period', options_for_period_select(params[:period]) %> <% if @project && !@project.deal_categories.empty? %> <%= label_tag l(:label_crm_deal_category) + " "%> <%= select_tag 'category_id', options_for_select(@project.deal_categories.collect {|c| [c.name, c.id.to_s]}.insert(0, [""]), params[:category_id]) %> <% end %> <%= label_tag l(:label_crm_assigned_to) + " " %> <%= select_tag :assigned_to_id, options_for_select(Deal.available_users(@project).collect{|u| [u.name, u.id.to_s]}.insert(0, [""]), params[:assigned_to_id]) %> <%= label_tag l(:label_crm_probability) + " " %> <%= select_tag :probability, options_for_select(((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }).insert(0, [""]), params[:probability]) %>

<%= link_to l(:button_apply), "#", :onclick=>"$('#query_form').submit()", :class => 'icon icon-checked' %> <%= link_to l(:button_clear), {:project_id => @project, :set_filter => 1 }, :method => :get, :update => "contact_list", :class => 'icon icon-reload' %>

<% end %>
<% if @deals.empty? %>

<%= l(:label_no_data) %>

<% else %> <%= render :partial => deals_list_style %> <% other_formats_links do |f| %> <%= f.link_to 'CSV', :url => params %> <% end if User.current.allowed_to?(:export_contacts, @project, :global => true) %> <% end %>
<%= context_menu url_for( {:controller => "deals", :action => "context_menu"} )%> <% html_title l(:label_deal_plural) %>