<%= form_with model: @job, url: form_target, id: "job_form" do |f| %> <%= error_messages_for @job %>

<%= f.text_field :name, required: true %>

<%= f.label :category %> <%= f.collection_select :category_id, JobCategory.all, :id, :name %>

<%= f.label :starts_on %> <%= f.date_field :starts_on %>

<%= f.label :ends_on %> <%= f.date_field :ends_on %>

<%= f.label :description %> <%= f.text_area :description, required: true, cols: 60, rows: 15, class: "wiki-edit", data: { auto_complete: true }, id: "job_description" %> <%= f.hidden_field :project_id, value: @job.project.id %>

Budget (hours) <%= f.fields_for :time_budgets do |ff| %>

<%= ff.label :hours, ff.object.category&.name || "Unassigned" %> <%= ff.number_field :hours %> <%= ff.hidden_field :category_id %> <%= ff.hidden_field :job_id %> <%= ff.hidden_field :_destroy, value: false %> <% end %>

<%= wikitoolbar_for 'job_description' %>
<% unless @job.new_record? %> <%= f.text_area :notes, cols: 60, rows: 15, class: "wiki-edit", data: { auto_complete: true }, id: "job_notes" %> <%= wikitoolbar_for 'job_notes' %> <% end %> <%= f.submit %> <% end %>