mstenta / farm_crop_plan

Crop plan type and related features for farmOS. (ALPHA 3.x IN DEVELOPMENT)
https://drupal.org/project/farm_crop_plan
GNU General Public License v2.0
5 stars 1 forks source link

Expose log status in planting forms #1

Closed paul121 closed 4 years ago

paul121 commented 4 years ago

It would be nice to be able to mark logs as "done" from the Crop Plan plantings form.

I've added a checkbox for existing Seeding and Transplanting logs that displays the "done" status of the log. When saving the log, if the checkbox value has changed then the log will be updated with the new status

....UNLESS the log timestamp is changed, in this case the form submit function "automatically" sets the log status based on the date being past or future.

I made this so the checkbox is only displayed if there is an existing log for the planting - when adding a planting from scratch, or just adding a new seeding/transplanting log, there is no checkbox.

mstenta commented 4 years ago

@paul121 and I discussed this and the decision was to drop the logic that is currently automatically setting the "done" status from the PHP submit function, and instead add a simple JS behavior to the page that will automatically check/uncheck the "done" box based on the date field.

This should ONLY happen when creating a NEW planting, IMO, and the user should be able to easily override that. Changes to existing logs should be fully manual.

paul121 commented 4 years ago

I added a JS behavior that automatically checks the "Completed" checkbox when the date field is changed: 266d1e3d53216cc6badfa1a660cb2341210817b3