<% fields_for_side_container(layout_builder).each do |index, field| %>
  <% if field["table"] == @current_table %>
    <% @current_row = @row %>
  <% else %>
    <% @current_row = get_related_row(@current_table, field["table"], @row["id"]) %>
  <% end %>

  <% if field["editable"] == "true" %>
    <div class="row editable-row">
      <div class="col-xs-12">
        <div class="editable-content-wrapper">
          <p class="side-container-content">
            <b><%= field["title"] %></b>:

            <span class="editable-content" onclick="showEditable(event);">
              <% if current_row_valid?(@current_row, field) %>
                <%= @current_row[field["title"]] %>
              <% else %>
                --
              <% end %>
            </span>
          </p>
        </div>

        <%= render partial: 'tables/layout/editable_input', locals: { field: field } %>
      </div>
    </div>
  <% else %>
    <div class="">
      <p class="side-container-content">
        <b><%= field["title"].humanize %></b>:

        <span class="">
          <% if @current_row &&  !@current_row[field["title"]].blank? %>
            <%= @current_row[field["title"]] %>
          <% else %>
              --
          <% end %>
        </span>
      </p>
    </div>
  <% end %>
<% end  %>
