<% fields_for_header_container1(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">
          <% if current_row_valid?(@current_row, field) %>
            <p class="editable-content header-container1-content" onclick="showEditable(event);">
              <%= @current_row[field["title"]] %>
            </p>
          <% else %>
            <p class="editable-content header-container1-content" onclick="showEditable(event);">--</p>
          <% end %>
        </div>

        <%= render partial: 'tables/layout/editable_input', locals: { field: field } %>
      </div>
    </div>
  <% else %>
    <div class="row">
      <% if @current_row &&  !@current_row[field["title"]].blank? %>
        <div class="col-sm-12">
          <p class="header-container1-content">
            <%= @current_row[field["title"]] %>
          </p>
        </div>
      <% else %>
        <p class="header-container1-content">--</p>
      <% end %>
    </div>
  <% end %>
<% end  %>
