<div class="card card-primary card-outline">
  <div class="card-header">
    <h3 class="card-title" style="font-size: 1.5rem;"><strong><%= dotation.name %></strong></h3>
    <div class="card-tools">
    </div>
  </div>
  <div class="card-body">
    <div class="row">
      <div class="col-md-6">
        <h4><%= dotation.formal_name %></h4>
      </div>
      <div class="col-md-6">
        <div class="row">
          <div class="col-sm-6">
            <h4><strong>Składanie wniosków</strong></h4>
          </div>
          <div class="col-sm-6">
            <h4>od <%= dotation.start_date.strftime("%d-%m-%Y") %> do <%= dotation.end_date.strftime("%d-%m-%Y") %></h4>
          </div>
        </div>
      </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_amount.blank? %>
          <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>
          <% end %>
          <% unless dotation.max_amount.blank? %>
          <div class="row">
            <div class="col-sm-6">
              <h5><strong>Poziom dofinansowania</strong></h5>
            </div>
            <div class="col-sm-6">
              <h5>do <%= dotation.max_percent %>% dotacji</h5>
            </div>
          </div>
          <% end %>
      </div>
    </div>
    <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.id}", class: 'btn-lg btn-success float-right' %>
  </div>

</div>
