Files
growstuff/app/views/harvests/_edit_modal.html.haml
T

26 lines
1.3 KiB
Plaintext

-# Editing a harvest in a dialog over the page, rather than sending the member
-# off to a form of its own. The form posts as it always has, so this needs no
-# JSON endpoint. Large text comes from .plant-dialog-body, as in the React
-# dialogs. The crop isn't offered: a harvest's crop comes from its planting.
= form_modal(harvest, id: 'harvest-edit-modal', title: "Edit #{harvest.crop.name} harvest") do |f|
.mb-3
= f.date_field :harvested_at,
value: harvest.harvested_at ? harvest.harvested_at.to_fs(:ymd) : '',
label: 'When did you harvest it?'
.mb-3
= f.form_group :plant_part_id, label: { text: 'What part did you harvest?' } do
- PlantPart.order(:name).pluck(:name, :id).each do |name, id|
= f.radio_button :plant_part_id, id, label: name, checked: (id == harvest.plant_part_id), inline: true
.row.mb-3
.col-md-5
= f.number_field :quantity, step: 'any', min: 0, label: 'How many?'
.col-md-7
= f.select :unit, Harvest::UNITS_VALUES, { include_blank: false, label: 'Counted as' }
.row.mb-3
.col-md-5
= f.number_field :weight_quantity, step: 'any', min: 0, label: 'Weighing (in total)'
.col-md-7
= f.select :weight_unit, Harvest::WEIGHT_UNITS_VALUES, { include_blank: false, label: 'Weighed in' }
.mb-3
= f.text_area :description, rows: 4, label: 'Notes'