<!--
<div class="row">
    <div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
        <%= simple_form_for(@login_form, url: login_path, method: "POST") do |f| %>
          <div class="card">
                <h4 class="card-title text-center" style="margin:10px">Login</h4>
                <div class="content" style="margin:10px">
                    <div class="form-group">
                        <%= f.input :emp_id, required: false, autofocus: true, class: "form-control" %>
                    </div>
                    <div class="form-group">
                        <%= f.input :password, required: false, class: "form-control" %>
                    </div>

                </div>
                <div class="footer text-center" style="margin:10px">
                    <%= f.button :submit, "Log in", class: "form-control btn btn-fill btn-warning btn-wd" %>

                </div>

            </div>

      <% end %>
    </div>
</div> -->
<div class="row">
  <div class="col-md-12 col-lg-12">
    <div class="card-deck">

      <% @employees.each do |employee| %>

        <div data-formid="#form_<%= employee.emp_id %>" class="empBtn card card-inverse card-primary mb-3 text-center" style="width: 15rem;height:15rem;">
            <form id="form_<%=employee.emp_id%>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH"></form>
            <div class="card-block">
              <h4 class="card-title">
                <%= employee.name %>
              </h4>
              <div class="card-content">
                (<%= employee.emp_id%>)
              </div>
              <div class="card-footer">
                    <small><%= employee.role %></small>
              </div>
            </div>
        </div>
        <% end %>
    </div>
  </div>
</div>

<script type="text/javascript">
$(document).on('turbolinks:load', function() {
  $(".empBtn").click(function(event){
    event.preventDefault();
    console.log($(this).data("formid"));
    var item = $(this).data("formid");
    $(item).submit();

  });
});
</script>
