<% if @project %>
  <div class="project-index-sidebar">
    <%= call_hook(:view_easy_money_project_index_sidebar_top, :project => @project) %>
    <%= call_hook(:view_easy_money_project_index_sidebar_bottom, :project => @project) %>
  </div>
<% else %>
    <%= link_to(l(:label_easy_money_project_cache), {:controller => 'easy_money_project_caches', :action => 'index', :set_filter => '0'}, :class => 'button', :title => l(:label_easy_money_project_cache)) if User.current.allowed_to?(:view_easy_money, nil, :global => true) %>
    <%= link_to(l(:label_easy_money_cash_flow), {:controller => 'easy_money_cash_flow', :action => 'index', :set_filter => '1', :project_id => 'mine'}, :class => 'button', :title => l(:label_easy_money_cash_flow)) if User.current.allowed_to?(:easy_money_cash_flow_prediction, nil, :global => true) || User.current.allowed_to?(:easy_money_cash_flow_history, nil, :global => true) %>
    <%= render_menu_more(nil, @project, :menu_more_class => 'menu-more-sidebar', :menu_expander_class => 'button icon icon-add') do %>
      <ul>
        <% [:expected_expenses, :other_expenses, :expected_revenues, :other_revenues].each do |money| %>
          <% if User.current.allowed_to_globally?(:"easy_money_show_#{money.to_s.singularize}", {}) %>
            <li>
              <%= link_to(l("label_easy_money_#{money}"), send("easy_money_#{money}_path",{:set_filter => 0}), :title => l("label_easy_money_#{money}")) %>
            </li>
          <% end %>
        <% end -%>
        <% [:travel_costs, :travel_expenses].each do |money| %>
          <% if User.current.allowed_to_globally?(:"easy_money_show_#{money.to_s.singularize}", {}) && EasyMoneySettings.where(:name => "use_#{money}", :value => '1').exists? %>
            <li>
              <%= link_to(l("label_easy_money_#{money}"), send("easy_money_#{money}_path",{:set_filter => 0}), :title => l("label_easy_money_#{money}")) %>
            </li>
          <% end %>
        <% end -%>
      </ul>
    <% end -%>
<% end %>
