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
with a non-timeline option (dead, other, return to clinic)
existing pack dispatch date is adjusted to null date (1999-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
pack return due date is adjusted to reflect the new timeline; no change to pack dispatch date
with a non-timeline selection (dead, other, return to clinic)
pack return date adjusted to null date (1999-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 + n months - 14 days
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 not already sent, pack dispatch date is adjusted, otherwise pack return due date is adjusted
  2. Pack dispatch due date: can only edit a future date
  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 is only displayed if date already calculated during pack dispatch logging, and is always editable