<div class="table--edit-record-modal hide">
  <div class="modal--container">
    <div class="modal--content-container">
      <div class="modal--header">
        <div class="row">
          <div class="col-sm-10">
            <h3>Edit record(s)</h3>
          </div>
          <div class="col-sm-2">
            <div class="modal--close-btn">
              <img src="/assets/images/icons/close.png">
            </div>
          </div>
        </div>
      </div>
      <div class="modal--content">

        <% if @inputs.empty? %>
          <h4>Sorry, none of the fields on this table are editable.</h4>
          <br>
          <h4>Please speak to an Administrator to change the settings if you need to edit fields</h4>
        <% else %>

          <%= form_tag("/table/update_record", method: "post", remote: true) do %>
            <% @records.each do |record| %>
              <div class="edit--record-panel panel panel-default show">
                <div class="panel-body row">
                  <% @inputs.each do |input| %>
                    <div class="col-sm-5 table--add-record--field-label">
                      <p>
                        <%= label_tag input[:name], input[:name].humanize %>
                        <% if input[:required] == true %>
                          <span>*</span>
                        <% end %>
                      </p>
                    </div>
                    <div class="col-sm-7 table--add-record--field-input">
                      <div class="">
                        <%= add_record_field_input(input, record[input[:name]], record['id']) %>
                      </div>
                    </div>
                  <% end %>
                </div>
              </div>
            <% end %>
            <div class="row">
              <div class="col-sm-12">
                <p>
                  <%= t('record.mandatory_field_indication') %>
                </p>
              </div>
            </div>
            <div class="row">
              <div class="col-sm-12">
                <div class="record--save-btn">
                  <%= hidden_field_tag(:table, @current_table) %>
                  <%= hidden_field_tag(:database_id, @database.id) %>
                  <%= submit_tag('Save', class: 'btn btn-primary btn--save-record') %>
                </div>
              </div>
            </div>
          <% end %>
        <% end %>
      </div>
    </div>
  </div>
</div>