
<%= for error <- Kaffy.ResourceError.display_errors(@conn, @changeset) do %>
<div><%= error %></div>
<% end %>


<div class="mt-3 grid-margin stretch-card">
    <div class="card shadow <%= Kaffy.ResourceError.form_error_border_class(@changeset, "border-left-primary")%>">
        <div class="card-header">
            <div class="row justify-content-between">
                <div class="col-auto mr-auto">
                    <h1 class="mt-4">New <%= Kaffy.ResourceAdmin.singular_name(@my_resource) %></h1>
                </div>
            </div>
        </div>
        <div class="card-body">
            <%= f = form_for(@changeset, Kaffy.Utils.router().kaffy_resource_path(@conn, :create, @context, @resource), method: :post, multipart: true) %>
                <%= for {field, options} <- Kaffy.ResourceAdmin.form_fields(@my_resource) do %>
                    <%= if options.create != :hidden do %>
                        <%= Kaffy.ResourceForm.kaffy_input @conn, @changeset, f, field, options %>
                    <% end %>
                <% end %>
                <div class="form-group">
                    <%= link "Back", to: Kaffy.Utils.router().kaffy_resource_path(@conn, :index, @context, @resource), class: "btn btn-sm btn-light" %> &nbsp;
                    <input type="submit" name="submit" value="Save" class="btn btn-sm btn-primary" />
                    <input type="submit" name="submit" value="Save and add another" class="btn btn-sm btn-primary" />
                    <input type="submit" name="submit" value="Save and continue editing" class="btn btn-sm btn-primary" />
                </div>
            </form>

        </div>
    </div>

</div>
