<%= form_with(model: pdfresource, class: "contents") do |form| %> <% if pdfresource.errors.any? %>

<%= pluralize(pdfresource.errors.count, "error") %> prohibited this pdfresource from being saved:

<% end %>
<%= required_label_tag(form, :name) %> <%= form.text_field :name, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
<%= required_label_tag(form, :description) %> <%= form.textarea :description, rows: 4, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>

Go to two with the description here. THIS WILL BE RICH TEXT.

<%= required_label_tag(form, :card_description) %> <%= form.textarea :card_description, rows: 4, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>

This is a much shorter description that is used inside the "card" boxes on the listings page.

<%= required_label_tag(form, :pdfs) %> <% if pdfresource.pdfs.any? %>

Current PDFs:

<% end %> <%= form.file_field :pdfs, multiple: true, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>

<% if pdfresource.persisted? %> Upload new PDFs only if you want to replace the existing ones. Leave empty to keep current files. <% else %> You can upload up to 10 PDFs per resource. <% end %>

<%= required_label_tag(form, :thumbnails) %> <% if pdfresource.thumbnails.any? && pdfresource.persisted? %>

Current Thumbnails:

<% pdfresource.thumbnails.each do |thumbnail| %>
<% if thumbnail.persisted? %> <%= image_tag url_for(thumbnail), class: "rounded-lg shadow-sm" %>

<%= thumbnail.filename %>

<% end %>
<% end %>
<% end %> <%= form.file_field :thumbnails, multiple: true, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>

<% if pdfresource.persisted? %> Upload new thumbnails only if you want to replace the existing ones. Leave empty to keep current files. <% else %> You can upload up to 10 thumbnails per resource. <% end %>

<%= form.label :price, class: "font-bold" %> <%= form.number_field :price, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>

This is what we will sell it for!

<%= required_label_tag(form, :credits) %> <%= form.number_field :credits, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>

Number of credits required to purchase this resource.

<%= required_label_tag(form, :resource_type) %> <%= form.collection_select :resource_type_id, ResourceType.all, :id, :name, { prompt: "Select resource type" }, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
<%= form.label :stripe_product_id, "Stripe Product ID", class: "font-bold" %> <%= form.text_field :stripe_product_id, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
<%= form.label :age_range, class: "font-bold" %> <%= form.text_field :age_range, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
<%= form.label :curriculum, class: "font-bold" %> <%= form.text_field :curriculum, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
<%= form.label :feature_slot, "Feature Position", class: "font-bold" %> <%= form.select :feature_slot, options_for_select([ ["Not Featured", nil], ["Position 1", 1], ["Position 2", 2], ["Position 3", 3] ], pdfresource.feature_slot), { include_blank: false }, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>

Select a position to feature this resource, or "Not Featured" to remove from featured items. Only three resources can be featured at a time.

<%= form.submit pdfresource.persisted? ? "Update" : "Create", class: "bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-6 rounded-lg cursor-pointer" %> <%= link_to "Cancel", pdfresource.persisted? ? pdfresource_path(pdfresource) : pdfresources_path, class: "bg-gray-500 hover:bg-gray-600 text-white font-semibold py-2 px-6 rounded-lg" %>
<% end %>