Edit Outreach Follow Up Decision

Allows editing of ONE of the following, in order of precedence:

Pack sent date is for information only and is not editable.

Rules:

1) Editing of an existing timeline selection (eg one month, six month, etc) where pack dispatch date is in the future:

with another timeline selection
pack dispatch date is adjusted to reflect the new timeline; earliest pack dispatch date is current date
with a non-timeline option (dead, other, return to clinic)
existing pack dispatch date is adjusted to null date (2000-01-01)

2) Editing of an existing timeline selection (eg one month, six month, etc) where pack dispatch date is in the past:

with another timeline selection
not allowed (see Notes)
with a non-timeline selection (dead, other, return to clinic)
pack return date adjusted to null date (2000-01-01); no change to pack dispatch date

3) Editing of an existing non-timeline selection (eg dead, other, return to clinic):

with a timeline option (eg one month, six month, etc)
pack dispatch date calculated as registration date + months - 14 days; earliest pack dispatch date is current date
with a non-timeline option (dead, other, return to clinic)
date fields not involved

Notes:

Rule for setting Outreach pack dispatch due date:
registration date + n months - 14 days

Rules for amending Outreach follow-up value:

  1. Follow-up option: if pack already sent, the only options for change are non-duration ones (eg return to clinic, dead, other), as it doesn't make sense to set another duration if pack already dispatched, as the purpose of setting duration is to set the pack dispatch date. But pack return due date field CAN be edited if pack already dispatched.
  2. Pack dispatch due date: can only edit a future date (ie no edit allowed on past or current date in case pack already dispatched)
  3. Pack sent date: read-only if it exists (set during pack dispatch logging) - for information only, can never be edited
  4. Pack return due date: field only displayed if date already calculated during pack dispatch logging, and is always editable