<div class="card card-primary card-outline">
  <div class="card-header">
    <h3 class="card-title" style="font-size: 1.5rem;">
      <strong>
        <%= link_to dotation.name, "/dotacja/#{dotation.safe_id}", class: 'text-navy-new' %>
      </strong>
    </h3>
    <div class="card-tools">
    </div>
  </div>
  <div class="card-body">
    <div class="row">
      <div class="col-md-12">
        <h4><i><%= dotation.formal_name %></i></h4>
      </div>
    </div>
    <div class="row">
      <div class="col-md-6">
        <h4><strong><%= dotation.localization %></strong></h4>
      </div>
      <div class="col-md-6">
      <% unless dotation.max_percent.blank? %>
      <div class="row">
        <div class="col-sm-6">
          <h4><strong>Poziom dofinansowania</strong></h4>
        </div>
        <div class="col-sm-6">
          <h4>do <%= dotation.max_percent %>% dotacji</h4>
        </div>
      </div>
      <% end %>
      <% if !dotation.start_date.blank? || !dotation.end_date.blank? %>
        <div class="row">
          <div class="col-sm-6">
            <h4><strong>Składanie wniosków</strong></h4>
          </div>
          <div class="col-sm-6">
            <h4>
              <% unless dotation.start_date.blank? %>od <%= dotation.start_date_ret %><br /><% end %>
              <% unless dotation.end_date.blank? %>do <%= dotation.end_date_ret %><% end %>
            </h4>
          </div>
        </div>
        <% end %>
      </div>
    </div>
    <% unless dotation.max_amount.blank? %>
    <div class="row">
      <div class="col-md-6">
          <div class="row">
            <div class="col-sm-6">
              <h5><strong>Wartość projektu </strong></h5>
            </div>
            <div class="col-sm-6">
              <h5>do <%= change_ammount(dotation.max_amount) %> <%= dotation.max_amount_curr.name %></h5>
            </div>
          </div>
      </div>
    </div>
    <% end %>
    <div class="row">
      <div class="col-md-12">
        <% unless dotation.expenses.blank? %>
          <strong>Co można dofinansować? </strong>
          <% max_expense = dotation.expenses.count %>
          <% dotation.expenses.limit(5).each_with_index do |expense, index| %>
            <%= expense.name %>
            <% if index < max_expense - 1 && index < 4 %>
              <%= ', ' -%>
            <% elsif max_expense > 5 %>
              <%= '...' -%>
            <% end %>
          <% end %>
        <% end %>
      </div>
    </div>
  </div>

  <div class="card-footer">
    <%= link_to 'Zobacz więcej', "/dotacja/#{dotation.safe_id}", class: 'btn-lg btn-navy float-right' %>
  </div>

</div>
