}
therapy_sessions(){
- n=1; while [ "$(TPY session$n)" ]; do
+ n=1; while [ "$(TPY session$n)" ]; do n=$((n + 1)); done
+
+ sid=session$n
+ cat <<-EOF
+ [fieldset .tab
+ [submit "new_session" "$sid" .no . +]
+ [input .date name="${sid}_date" value="" placeholder=$(l10n date)]
+ [input .therapist name="${sid}_therapist" value="" placeholder=$(l10n therapist)]
+ [span .signature]
+ [hidden "${sid}_note1" ""]
+ ]
+ EOF
+
+ seq $((n - 1)) -1 1 | while read n; do
session_n="$n"
sid=session${session_n}
[span .signature [checkbox "${sid}_sigset" "pos" $(checked "$(TPY "${sid}_sigset")" "pos")]]
]
[div .tab
- [img .dotmark .ov src="/therapies/${id}_${sid}.png" alt=""]
+ [img .dotmark .ov src="/therapies/${id}_${sid}.png?${_DATE}" alt=""]
$(n=1; while TPY "session${session_n}_note${n}" >/dev/null; do
[ "$(TPY "session${session_n}_note${n}")" ] && x=$n
n=$(($n + 1))
[button type="submit" name=delete_session value="$session_n" .delete $(l10n delete_session)]
]
EOF
- n=$(($n+1))
done
-
- sid=session$n
-
- cat <<-EOF
- [fieldset .tab
- [submit "new_session" "$sid" .no . +]
- [input .date name="${sid}_date" value="" placeholder=$(l10n date)]
- [input .therapist name="${sid}_therapist" value="" placeholder=$(l10n therapist)]
- [span .signature]
- [hidden "${sid}_note1" ""]
- ]
- EOF
}
cat <<EOF
[h1 $(l10n therapy)]
[div .patient
- [h2 . $(VCF FN |HTML)]
- [a href="/cards/#${id%.*}.vcf" \< $(l10n client)]
+ [h2 . [a "/cards/#${id%.*}.vcf" ⬅ $(VCF FN |HTML)]]
]
-[div .prescription
- [h2 $(l10n therapy_prescription)]
- [span .insurance . $(MPX insurance |HTML)]
- [span .date [label $(l10n date):] $(MPX date |HTML)]
+[div .therapies
+ [h2 $(l10n therapies)]
+ $(
+ (cd "$_DATA/therapies/"; printf '%s\n' "${id%%.*}".*.tpy) \
+ | while read tpyfile; do
+ [ "$tpyfile" = "${id%%.*}.*.tpy" ] && break
+ tpy="${tpyfile%.tpy}";
+ tpydates="$(sed -En 's;^session[0-9]+_date:;;p;' "$_DATA/therapies/$tpyfile" \
+ | sort \
+ | sed -E ':X;N;$!bX; s;^[\n ]+;;; s;[\n ]+$;;; s;(\n.*\n|\n); - ;;'
+ )"
+ if [ "${tpy%.*}.${tpy#*.}" = "${id}" ]; then
+ printf '[a .item .therapy .current href="/therapies/%s" . %s] ' \
+ "${tpy%.*}/${tpy#*.}" "$(HTML "${tpydates:--}")"
+ else
+ printf '[a .item .therapy href="/therapies/%s" . %s] ' \
+ "${tpy%.*}/${tpy#*.}" "$(HTML "${tpydates:--}")"
+ fi
+ done |sort -n
+ )
+ [a .item .therapy href="/therapies/${id%%.*}/new" . +]
+]
EOF
- if [ "$(MPX prescreviewed)" ]; then
- printf '[label .checkbox .checked for=prescreviewed . %s]' "$(l10n prescreviewed)"
- else
- printf '[label .checkbox for=prescreviewed . %s]' "$(l10n prescreview)"
- fi
-
- field="$(MPX prescno)"
- [ "$field" ] && printf '[span .prescno . %s]' "$(l10n "presc$field")"
- for field in grouptherapy housecall report; do
- [ "$(MPX "$field")" ] && printf '[span .catalogue . %s]' "$(l10n "$field")"
- done
-
+if [ "$mpx" ]; then
+ printf '[div .prescription [h2 %s]' "$(l10n therapy_prescription)"
+
printf '[ul'
for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
remidy="$(MPX remidy$n)"
quantity="$(MPX quantity$n)"
quantity_weekly="$(MPX quantity_weekly$n)"
-
+
if [ "$remidy" -a "$quantity_weekly" ]; then
printf '[li %s %s %s]' "$(HTML "$quantity")" "$(HTML "$remidy")" "$(HTML "$quantity_weekly") $(l10n weekly)"
elif [ "$remidy" ]; then
fi
done
printf ']'
-
+
for field in indicator icd10; do
val="$(MPX "$field")"
[ "$val" ] && printf '[span .%s [label . %s:]%s]' "$field" "$(l10n "$field")" "$(HTML "$val")"
done
-
- addcontrib="$(MPX addcontrib)"
- contribconfirm="$(MPX contribconfirm)"
-
- if [ "$addcontrib" -a "$contribconfirm" ]; then
- printf '[label .checkbox .checked for=addcontrib . %s %s]' "$(l10n contribconfirm)" "$(HTML $contribconfirm)"
- elif [ "$addcontrib" ]; then
- printf '[label .checkbox for=addcontrib . %s]' "$(l10n addcontrib)"
+
+ if [ "$(MPX indicator_reading)" ]; then
+ printf '[h3 %s][p . %s]' \
+ "$(l10n indicator_reading)" "$(MPX indicator_reading |HTML)"
fi
-cat <<EOF
- [input .tab type="checkbox" #indicator_reading][label .tab for=indicator_reading $(l10n indicator_reading)]
- [div .tab . $(MPX indicator_reading |HTML)]
-]
+ printf ']'
+fi
+cat <<EOF
[form #report method=POST action="/therapies/update_therapy.sh"
[hidden "id" "$id"]
[textarea name=stickynote . $(TPY stickynote |HTML)]
[button type=submit $(l10n save)]
]
+EOF
- [input .stickynote type=checkbox name=c_timesheet #show_timesheet]
- [fieldset .stickynote
- [label for="show_timesheet" $(l10n timesheet)]
- [h2 $(l10n timesheet)]
- [table [thead [tr
- [th $(l10n time_goal)][th $(l10n time_actual)][th $(l10n time_difference)]
- ]][tbody
- $(for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
- tsgoal="$(TPY tsgoal$n |grep -m1 -xE '[0-9]+')"
- tsactual="$(TPY tsactual$n |grep -m1 -xE '[0-9]+')"
- printf '[tr [td [input type=number name=tsgoal value="%s"]][td [input type=number name=tsactual value="%s"]][td %s]]' \
- "$tsgoal" "$tsactual" "$(( ${tsgoal:-0} - ${tsactual:-0} ))"
- done)
- ]]
- [button type=submit $(l10n save)]
- ]
+# cat <<EOF
+# [input .stickynote type=checkbox name=c_timesheet #show_timesheet]
+# [fieldset .stickynote
+# [label for="show_timesheet" $(l10n timesheet)]
+# [h2 $(l10n timesheet)]
+# [table [thead [tr
+# [th $(l10n time_goal)][th $(l10n time_actual)][th $(l10n time_difference)]
+# ]][tbody
+# $(for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
+# tsgoal="$(TPY tsgoal$n |grep -m1 -xE '[0-9]+')"
+# tsactual="$(TPY tsactual$n |grep -m1 -xE '[0-9]+')"
+# printf '[tr [td [input type=number name=tsgoal value="%s"]][td [input type=number name=tsactual value="%s"]][td %s]]' \
+# "$tsgoal" "$tsactual" "$(( ${tsgoal:-0} - ${tsactual:-0} ))"
+# done)
+# ]]
+# [button type=submit $(l10n save)]
+# ]
+# EOF
+cat <<EOF
[label .tab .heading
[span .no $(l10n number)][span .date $(l10n date)][span .therapist $(l10n therapist)][span .signature $(l10n signature)]
]
color="$(TPY color |grep -xE -m1 '#(000|00A|0A0|0AA|A00|A0A|AA0|FFF)' || printf '#000')"
cat <<EOF
[fieldset .penwidth
- [radio "penwidth" "4" #pw1 $(selected $penwidth 4) ][label for="pw2"]
- [radio "penwidth" "12" #pw2 $(selected $penwidth 12)][label for="pw3"]
- [radio "penwidth" "36" #pw3 $(selected $penwidth 36)][label for="pw1"]
+ [radio "penwidth" "4" #pw1 $(checked "$penwidth" 4) ][label for="pw2"]
+ [radio "penwidth" "12" #pw2 $(checked "$penwidth" 12)][label for="pw3"]
+ [radio "penwidth" "36" #pw3 $(checked "$penwidth" 36)][label for="pw1"]
]
[fieldset .color
- [radio "color" "#000" .color #c000 $(checked $color '#000') ][label for=c000 ]
- [radio "color" "#00A" .color #c001 $(checked $color '#00A') ][label for=c001 ]
- [radio "color" "#0A0" .color #c010 $(checked $color '#0A0') ][label for=c010 ]
- [radio "color" "#0AA" .color #c011 $(checked $color '#0AA') ][label for=c011 ]
- [radio "color" "#A00" .color #c100 $(checked $color '#A00') ][label for=c100 ]
- [radio "color" "#A0A" .color #c101 $(checked $color '#A0A') ][label for=c101 ]
- [radio "color" "#AA0" .color #c110 $(checked $color '#AA0') ][label for=c110 ]
- [radio "color" "#FFF" .color #c111 $(checked $color '#FFF') ][label for=c111 ]
+ [radio "color" "#000" .color #c000 $(checked "$color" '#000') ][label for=c000 ]
+ [radio "color" "#00A" .color #c001 $(checked "$color" '#00A') ][label for=c001 ]
+ [radio "color" "#0A0" .color #c010 $(checked "$color" '#0A0') ][label for=c010 ]
+ [radio "color" "#0AA" .color #c011 $(checked "$color" '#0AA') ][label for=c011 ]
+ [radio "color" "#A00" .color #c100 $(checked "$color" '#A00') ][label for=c100 ]
+ [radio "color" "#A0A" .color #c101 $(checked "$color" '#A0A') ][label for=c101 ]
+ [radio "color" "#AA0" .color #c110 $(checked "$color" '#AA0') ][label for=c110 ]
+ [radio "color" "#FFF" .color #c111 $(checked "$color" '#FFF') ][label for=c111 ]
]
[img .dotmark .bg src="/therapies/therapy_background.png" alt="WARNING: Missing background image!"]
[canvas #canvas .dotmark .ov width="${bg_dim%x*}" height="${bg_dim#*x}" ]
[input type=hidden #image_serialize name=imagedata value=""]
- [button type=submit $(l10n save)]
+ [button #savebutton type=submit $(l10n save)]
]
[span #jsdebug style="display: none; position: fixed; right:0; bottom:0" Debug]
[script type="text/javascript" src="/therapies/therapy_draw.js"]
+[script type="text/javascript" src="/therapies/autosave.js"]
EOF