1 # Copyright 2016, 2017, 2020 Paul Hänsch
3 # This file is part of Lobster.
5 # Confetti is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # Lobster is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public License
16 # along with Lobster. If not, see <http://www.gnu.org/licenses/>.
22 color=session${session_n}_note${note_n}_color
24 if [ "$note_n" -eq 1 -o "$(TPY "session${session_n}_note${note_n}")" ]; then
25 printf '[input type="checkbox" .trailbtn checked="checked"]'
27 printf '[input type="checkbox" .trailbtn]'
30 check="$(TPY "$color" |grep -xE -m1 '#(888|00A|0A0|0AA|A00|A0A|AA0)' || printf '#FFF')"
32 [fieldset .note .trailbox
33 [radio "$color" "#888" .color #${color}_000 $(checked "$check" '#888') ][label for=${color}_000]
34 [radio "$color" "#00A" .color #${color}_001 $(checked "$check" '#00A') ][label for=${color}_001]
35 [radio "$color" "#0A0" .color #${color}_010 $(checked "$check" '#0A0') ][label for=${color}_010]
36 [radio "$color" "#0AA" .color #${color}_011 $(checked "$check" '#0AA') ][label for=${color}_011]
37 [radio "$color" "#A00" .color #${color}_100 $(checked "$check" '#A00') ][label for=${color}_100]
38 [radio "$color" "#A0A" .color #${color}_101 $(checked "$check" '#A0A') ][label for=${color}_101]
39 [radio "$color" "#AA0" .color #${color}_110 $(checked "$check" '#AA0') ][label for=${color}_110]
40 [radio "$color" "#FFF" .color #${color}_111 $(checked "$check" '#FFF') ][label for=${color}_111]
41 [textarea name="session${session_n}_note${note_n}" . $(TPY "session${session_n}_note${note_n}" |HTML)]
47 n=1; while [ "$(TPY session$n)" ]; do
49 sid=session${session_n}
52 [hidden "$sid" "exists"]
53 [checkbox "${sid}_open" "checked" #${sid}_open .tab $(checked "$(TPY "${sid}_open")" checked)]
54 [label .tab for="${sid}_open"
55 [span .no ${session_n}.]
56 [span .date . $(TPY "${sid}_date" |HTML)]
57 [input .date name="${sid}_date" value="$(TPY "${sid}_date" |HTML)" placeholder="$(l10n date)"]
58 [span .therapist . $(TPY "${sid}_therapist" |HTML)]
59 [input .therapist name="${sid}_therapist" value="$(TPY "${sid}_therapist" |HTML)" placeholder="$(l10n therapist)"]
60 [span .signature [checkbox "${sid}_sigset" "pos" $(checked "$(TPY "${sid}_sigset")" "pos")]]
63 [img .dotmark .ov src="/therapies/${id}_${sid}.png" alt=""]
64 $(n=1; while TPY "session${session_n}_note${n}" >/dev/null; do
65 [ "$(TPY "session${session_n}_note${n}")" ] && x=$n
68 for n in $(seq 1 $((${x:-0} + 3)) ); do
69 t_session_note $session_n $n
72 [button type="submit" .trailbtn $(l10n trailbtn)]
73 [button type="submit" name=delete_session value="$session_n" .delete $(l10n delete_session)]
83 [submit "new_session" "$sid" .no . +]
84 [input .date name="${sid}_date" value="" placeholder=$(l10n date)]
85 [input .therapist name="${sid}_therapist" value="" placeholder=$(l10n therapist)]
87 [hidden "${sid}_note1" ""]
96 [h2 . $(VCF FN |HTML)]
97 [a href="/cards/#${id%.*}.vcf" \< $(l10n client)]
101 [h2 $(l10n therapy_prescription)]
102 [span .insurance . $(MPX insurance |HTML)]
103 [span .date [label $(l10n date):] $(MPX date |HTML)]
106 if [ "$(MPX prescreviewed)" ]; then
107 printf '[label .checkbox .checked for=prescreviewed . %s]' "$(l10n prescreviewed)"
109 printf '[label .checkbox for=prescreviewed . %s]' "$(l10n prescreview)"
112 field="$(MPX prescno)"
113 [ "$field" ] && printf '[span .prescno . %s]' "$(l10n "presc$field")"
114 for field in grouptherapy housecall report; do
115 [ "$(MPX "$field")" ] && printf '[span .catalogue . %s]' "$(l10n "$field")"
119 for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
120 remidy="$(MPX remidy$n)"
121 quantity="$(MPX quantity$n)"
122 quantity_weekly="$(MPX quantity_weekly$n)"
124 if [ "$remidy" -a "$quantity_weekly" ]; then
125 printf '[li %s %s %s]' "$(HTML "$quantity")" "$(HTML "$remidy")" "$(HTML "$quantity_weekly") $(l10n weekly)"
126 elif [ "$remidy" ]; then
127 printf '[li %s %s]' "$(HTML "$quantity")" "$(HTML "$remidy")"
132 for field in indicator icd10; do
133 val="$(MPX "$field")"
134 [ "$val" ] && printf '[span .%s [label . %s:]%s]' "$field" "$(l10n "$field")" "$(HTML "$val")"
137 addcontrib="$(MPX addcontrib)"
138 contribconfirm="$(MPX contribconfirm)"
140 if [ "$addcontrib" -a "$contribconfirm" ]; then
141 printf '[label .checkbox .checked for=addcontrib . %s %s]' "$(l10n contribconfirm)" "$(HTML $contribconfirm)"
142 elif [ "$addcontrib" ]; then
143 printf '[label .checkbox for=addcontrib . %s]' "$(l10n addcontrib)"
147 [input .tab type="checkbox" #indicator_reading][label .tab for=indicator_reading $(l10n indicator_reading)]
148 [div .tab . $(MPX indicator_reading |HTML)]
151 [form #report method=POST action="/therapies/update_therapy.sh"
154 [input .stickynote type=checkbox name=c_stickynote #show_stickynote]
155 [fieldset .stickynote
156 [label for="show_stickynote" $(l10n notes)]
158 [textarea name=stickynote . $(TPY stickynote |HTML)]
159 [button type=submit $(l10n save)]
162 [input .stickynote type=checkbox name=c_timesheet #show_timesheet]
163 [fieldset .stickynote
164 [label for="show_timesheet" $(l10n timesheet)]
165 [h2 $(l10n timesheet)]
167 [th $(l10n time_goal)][th $(l10n time_actual)][th $(l10n time_difference)]
169 $(for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
170 tsgoal="$(TPY tsgoal$n |grep -m1 -xE '[0-9]+')"
171 tsactual="$(TPY tsactual$n |grep -m1 -xE '[0-9]+')"
172 printf '[tr [td [input type=number name=tsgoal value="%s"]][td [input type=number name=tsactual value="%s"]][td %s]]' \
173 "$tsgoal" "$tsactual" "$(( ${tsgoal:-0} - ${tsactual:-0} ))"
176 [button type=submit $(l10n save)]
180 [span .no $(l10n number)][span .date $(l10n date)][span .therapist $(l10n therapist)][span .signature $(l10n signature)]
186 ## ==== Drawing canvas ==== ##
187 ### ====================== ###
189 penwidth="$(TPY penwidth |grep -xE -m1 '(4|12|36)' || printf '4')"
190 color="$(TPY color |grep -xE -m1 '#(000|00A|0A0|0AA|A00|A0A|AA0|FFF)' || printf '#000')"
193 [radio "penwidth" "4" #pw1 $(checked "$penwidth" 4) ][label for="pw2"]
194 [radio "penwidth" "12" #pw2 $(checked "$penwidth" 12)][label for="pw3"]
195 [radio "penwidth" "36" #pw3 $(checked "$penwidth" 36)][label for="pw1"]
198 [radio "color" "#000" .color #c000 $(checked "$color" '#000') ][label for=c000 ]
199 [radio "color" "#00A" .color #c001 $(checked "$color" '#00A') ][label for=c001 ]
200 [radio "color" "#0A0" .color #c010 $(checked "$color" '#0A0') ][label for=c010 ]
201 [radio "color" "#0AA" .color #c011 $(checked "$color" '#0AA') ][label for=c011 ]
202 [radio "color" "#A00" .color #c100 $(checked "$color" '#A00') ][label for=c100 ]
203 [radio "color" "#A0A" .color #c101 $(checked "$color" '#A0A') ][label for=c101 ]
204 [radio "color" "#AA0" .color #c110 $(checked "$color" '#AA0') ][label for=c110 ]
205 [radio "color" "#FFF" .color #c111 $(checked "$color" '#FFF') ][label for=c111 ]
207 [img .dotmark .bg src="/therapies/therapy_background.png" alt="WARNING: Missing background image!"]
208 [canvas #canvas .dotmark .ov width="${bg_dim%x*}" height="${bg_dim#*x}" ]
209 [input type=hidden #image_serialize name=imagedata value=""]
211 [button type=submit $(l10n save)]
214 [span #jsdebug style="display: none; position: fixed; right:0; bottom:0" Debug]
216 [script type="text/javascript" src="/therapies/therapy_draw.js"]