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
23 # unset c0 c1 c2 c3 c4 c5 c6 c7
25 # if [ "$note_n" -eq 1 -o -n "${tpy[session${session_n}_note${note_n}]}" ]; then
26 # printf '<input class="trailbtn" type="checkbox" checked="checked">'
28 # printf '<input class="trailbtn" type="checkbox">'
31 # _checked="$(validate "$tpy[$color]" '#(888|00A|0A0|0AA|A00|A0A|AA0)' '#FFF')"
33 # <fieldset class="note trailbox">
34 # <input class=color type=radio name="$color" value="#888" id=${color}_000 $(checked \#888)><label for=${color}_000></label>
35 # <input class=color type=radio name="$color" value="#00A" id=${color}_001 $(checked \#00A)><label for=${color}_001></label>
36 # <input class=color type=radio name="$color" value="#0A0" id=${color}_010 $(checked \#0A0)><label for=${color}_010></label>
37 # <input class=color type=radio name="$color" value="#0AA" id=${color}_011 $(checked \#0AA)><label for=${color}_011></label>
38 # <input class=color type=radio name="$color" value="#A00" id=${color}_100 $(checked \#A00)><label for=${color}_100></label>
39 # <input class=color type=radio name="$color" value="#A0A" id=${color}_101 $(checked \#A0A)><label for=${color}_101></label>
40 # <input class=color type=radio name="$color" value="#AA0" id=${color}_110 $(checked \#AA0)><label for=${color}_110></label>
41 # <input class=color type=radio name="$color" value="#FFF" id=${color}_111 $(checked \#FFF)><label for=${color}_111></label>
42 # <textarea name="session${session_n}_note${note_n}">${tpy[session${session_n}_note${note_n}]}</textarea>
50 # sid=session${session_n}
52 # if [ "$tpy[${sid}_sigset]" = pos ]; then
59 # <input type=hidden name=$sid value=exists>
60 # <input class="tab" type="checkbox" id=${sid}_open name="${sid}_open" value="checked" ${tpy[${sid}_open]}>
61 # <label class="tab" for="${sid}_open">
62 # <span class=no>${session_n}.</span><!--
63 # --><span class=date>${tpy[${sid}_date]}</span><!--
64 # --><input class="date" name="${sid}_date" value="${tpy[${sid}_date]}" placeholder="$(l10n date)"><!--
65 # --><span class=therapist>${tpy[${sid}_therapist]}</span><!--
66 # --><input class="therapist" name="${sid}_therapist" value="${tpy[${sid}_therapist]}" placeholder="$(l10n therapist)"><!--
67 # --><span class=signature><input type="checkbox" name="${sid}_sigset" value="pos" $sigcheck></span>
70 # <img class="dotmark ov" src="/therapies/${id%.tpy}_${sid}.png" alt="">
72 # while [ -n "${tpy[session${session_n}_note${n}]+x}" ]; do
73 # if [ -n "${tpy[session${session_n}_note${n}]}" ]; then
78 # for n in $(seq 1 $((${x:-0} + 3)) ); do t_session_note $session_n $n; done
80 # <button class="trailbtn" type="submit">$(l10n trailsave)</button>
81 # <button class=delete type=submit name=delete_session value=${session_n}>$(l10n delete_session)</button>
87 # n=1; while [ -n "${tpy[session${n}]}" ]; do
95 # <fieldset class="tab">
96 # <button class=no type=submit name=new_session value=$sid>+</button><!--
97 # --><input class=date name=${sid}_date value="" placeholder="$(l10n date)" /><!--
98 # --><input class=therapist name=${sid}_therapist value="" placeholder="$(l10n therapist)" /><!--
99 # --><span class=signature><span></span>
100 # <input type=hidden name="${sid}_note1" value="">
109 [h2 . $(pdi_value "$vcf" FN)]
110 [a href="/cards/#${id%.*}.vcf" \< $(l10n client)]
114 [h2 $(l10n therapy_prescription)]
115 [span .insurance . $(pdi_value "$mpx" INSURANCE)]
116 [span .date [label $(l10n date):] $(pdi_value "$mpx" DATE)]
119 if [ "$(pdi_value "$mpx" PRESCREVIEWED)" ]; then
120 printf '[label .checkbox .checked for=prescreviewed . %s]' "$(l10n prescreviewed)"
122 printf '[label .checkbox for=prescreviewed . %s]' "$(l10n prescreview)"
125 field="$(pdi_value "$mpx" PRESCNO)"
126 [ "$field" ] && printf '[span .prescno . %s]' "$(l10n "presc$field")"
127 for field in grouptherapy housecall report; do
128 [ "$(pdi_value "$mpx" "$field")" ] && printf '[span .catalogue . %s]' "$(l10n "$field")"
132 for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
133 remidy="$(pdi_value "$mpx" REMIDY$n)"
134 quantity="$(pdi_value "$mpx" QUANTITY$n)"
135 quantity_weekly="$(pdi_value "$mpx" QUANTITY_WEEKLY$n)"
137 if [ "$remidy" -a "$quantity_weekly" ]; then
138 printf '[li %s %s %s]' "$quantity" "$remidy" "$quantity_weekly $(l10n weekly)"
139 elif [ "$remidy" ]; then
140 printf '[li %s %s]' "$quantity" "$remidy"
145 for field in indicator icd10; do
146 val="$(pdi_value "$mpx" "$field")"
147 [ "$val" ] && printf '[span .%s [label . %s:]%s]' "$field" "$(l10n "$field")" "$val"
150 addcontrib="$(pdi_value "$mpx" ADDCONTRIB)"
151 contribconfirm="$(pdi_value "$mpx" CONTRIBCONFIRM)"
153 if [ "$addcontrib" -a "$contribconfirm" ]; then
154 printf '[label .checkbox .checked for=addcontrib . %s %s]' "$(l10n contribconfirm)" "$contribconfirm"
155 elif [ "$addcontrib" ]; then
156 printf '[label .checkbox for=addcontrib . %s]' "$(l10n addcontrib)"
160 [input .tab type="checkbox" #indicator_reading][label .tab for=indicator_reading $(l10n indicator_reading)]
161 [div .tab . $(pdi_value "$mpx" INDICATOR_READING)]
164 [form #report method=POST action="/therapies/update_therapy.sh"
165 [input type=hidden name=id value="$id"]
167 [input .stickynote type=checkbox name=c_stickynote #show_stickynote]
168 [fieldset .stickynote
169 [label for="show_stickynote" $(l10n notes)]
171 [textarea name=stickynote . $(pdi_value "$tpy" STICKYNOTE)]
172 [button type=submit $(l10n save)]
175 [input .stickynote type=checkbox name=c_timesheet #show_timesheet]
176 [fieldset .stickynote
177 [label for="show_timesheet" $(l10n timesheet)]
178 [h2 $(l10n timesheet)]
180 [th $(l10n time_goal)][th $(l10n time_actual)][th $(l10n time_difference)]
182 $(for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
183 tsgoal="$(pdi_value "$tpy" TSGOAL$n)"
184 tsactual="$(pdi_value "$tpy" TSACTUAL$n)"
185 printf '[tr [td [input type=number name=tsgoal value="%s"]][td [input type=number name=tsactual value="%s"]][td %s]]' \
186 "$tsgoal" "$tsactual" "$(( ${tsgoal:-0} - ${tsactual:-0} ))"
189 [button type=submit $(l10n save)]
193 [span .no $(l10n number)][span .date $(l10n date)][span .therapist $(l10n therapist)][span .signature $(l10n signature)]
199 penwith="$(pdi_value "$tpy" PENWITH |grep -xE -m1 '(4|12|36)' || printf '4')"
200 color="$(pdi_value "$tpy" COLOR |grep -xE -m1 '#(000|00A|0A0|0AA|A00|A0A|AA0|FFF)' || printf '#000')"
203 [radio "penwidth" "4" #pw1 $(checked $penwidth 4) ][label for="pw2"]
204 [radio "penwidth" "12" #pw2 $(checked $penwidth 12)][label for="pw3"]
205 [radio "penwidth" "36" #pw3 $(checked $penwidth 36)][label for="pw1"]
208 [radio "color" "#000" .color #c000 $(checked $color '#000') ][label for=c000 ]
209 [radio "color" "#00A" .color #c001 $(checked $color '#00A') ][label for=c001 ]
210 [radio "color" "#0A0" .color #c010 $(checked $color '#0A0') ][label for=c010 ]
211 [radio "color" "#0AA" .color #c011 $(checked $color '#0AA') ][label for=c011 ]
212 [radio "color" "#A00" .color #c100 $(checked $color '#A00') ][label for=c100 ]
213 [radio "color" "#A0A" .color #c101 $(checked $color '#A0A') ][label for=c101 ]
214 [radio "color" "#AA0" .color #c110 $(checked $color '#AA0') ][label for=c110 ]
215 [radio "color" "#FFF" .color #c111 $(checked $color '#FFF') ][label for=c111 ]
217 [img .dotmark .bg src="/therapies/therapy_background.png" alt="WARNING: Missing background image!"]
218 [canvas #canvas .dotmark .ov width="${bg_dim%x*}" height="${bg_dim#*x}" ]
219 [input type=hidden #image_serialize name=imagedata value=""]
221 [button type=submit $(l10n save)]
224 [span #jsdebug style="display: none; position: fixed; right:0; bottom:0" Debug]
226 [script type="text/javascript" src="/therapies/therapy_draw.js"]