]> git.plutz.net Git - confetti/blob - templates/therapy.html.sh
externalize drawing script
[confetti] / templates / therapy.html.sh
1 # Copyright 2016 Paul Hänsch
2 #
3 # This file is part of Confetti.
4
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.
9
10 # Confetti 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.
14
15 # You should have received a copy of the GNU Affero General Public License
16 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
17
18 t_session_note(){
19   session_n="$1"
20   note_n="$2"
21   
22   color=session${session_n}_note${note_n}_color
23   unset c0 c1 c2 c3 c4 c5 c6 c7
24   
25   case "$tpy[$color]" in
26     \#888) c0=checked;;
27     \#00A) c1=checked;;
28     \#0A0) c2=checked;;
29     \#0AA) c3=checked;;
30     \#A00) c4=checked;;
31     \#A0A) c5=checked;;
32     \#AA0) c6=checked;;
33     *)    c7=checked;;
34   esac
35
36 if [ "$note_n" -eq 1 -o -n "${tpy[session${session_n}_note${note_n}]}" ]; then
37   printf '<input class="trailbtn" type="checkbox" checked="checked">'
38 else
39   printf '<input class="trailbtn" type="checkbox">'
40 fi
41 cat <<EOF
42   <fieldset class="note trailbox">
43     <input class=color type=radio name="$color" value="#888" id=${color}_000 $c0><label for=${color}_000></label>
44     <input class=color type=radio name="$color" value="#00A" id=${color}_001 $c1><label for=${color}_001></label>
45     <input class=color type=radio name="$color" value="#0A0" id=${color}_010 $c2><label for=${color}_010></label>
46     <input class=color type=radio name="$color" value="#0AA" id=${color}_011 $c3><label for=${color}_011></label>
47     <input class=color type=radio name="$color" value="#A00" id=${color}_100 $c4><label for=${color}_100></label>
48     <input class=color type=radio name="$color" value="#A0A" id=${color}_101 $c5><label for=${color}_101></label>
49     <input class=color type=radio name="$color" value="#AA0" id=${color}_110 $c6><label for=${color}_110></label>
50     <input class=color type=radio name="$color" value="#FFF" id=${color}_111 $c7><label for=${color}_111></label>
51     <textarea name="session${session_n}_note${note_n}">${tpy[session${session_n}_note${note_n}]}</textarea>
52   </fieldset>
53 EOF
54 }
55
56 t_session(){
57   session_n="$1"
58
59   sid=session${session_n}
60
61   if [ "$tpy[${sid}_sigset]" = pos ]; then
62     sigcheck=checked
63   else
64     unset sigcheck
65   fi
66
67 cat <<EOF
68   <input type=hidden name=$sid value=exists>
69   <input class="tab" type="checkbox" id=${sid}_open name="${sid}_open" value="checked" ${tpy[${sid}_open]}>
70   <label class="tab" for="${sid}_open">
71     <span class=no>${session_n}.</span><!--
72  --><span class=date>${tpy[${sid}_date]}</span><!--
73  --><input class="date" name="${sid}_date" value="${tpy[${sid}_date]}" placeholder="$(l10n date)"><!--
74  --><span class=therapist>${tpy[${sid}_therapist]}</span><!--
75  --><input class="therapist" name="${sid}_therapist" value="${tpy[${sid}_therapist]}" placeholder="$(l10n therapist)"><!--
76  --><span class=signature><input type="checkbox" name="${sid}_sigset" value="pos" $sigcheck></span>
77   </label>
78   <div class=tab>
79     <img class="dotmark ov" src="/therapies/${id%.tpy}_${sid}.png" alt="">
80     $( for n in {1..10}; do t_session_note $session_n $n; done )
81
82     <button class=delete type=submit name=delete_session value=${session_n}>$(l10n delete_session)</button>
83   </div>
84 EOF
85 }
86
87 therapy_sessions(){
88   n=1; while [ -n "${tpy[session${n}]}" ]; do
89     t_session $n
90     n=$(($n+1))
91   done
92
93   sid=session$n
94
95 cat <<EOF
96   <fieldset class="tab">
97     <button class=no type=submit name=new_session value=$sid>+</button><!--
98  --><input class=date name=${sid}_date value="" placeholder="$(l10n date)" /><!--
99  --><input class=therapist name=${sid}_therapist value="" placeholder="$(l10n therapist)" /><!--
100  --><span class=signature><span></span>
101     <input type=hidden name="${sid}_note1" value="">
102   </fieldset>
103 EOF
104 }
105
106 unset c0 c1 c2 c3 c4 c5 c6 c7
107 case "$tpy[color]" in
108   \#00A) c1="checked";;
109   \#0A0) c2="checked";;
110   \#0AA) c3="checked";;
111   \#A00) c4="checked";;
112   \#A0A) c5="checked";;
113   \#AA0) c6="checked";;
114   \#FFF) c7="checked";;
115       *) c0="checked";;
116 esac
117
118 cat <<EOF
119 <h1>$(l10n therapy)</h1>
120
121 <div class="patient">
122   <h2>$client_name</h2>
123   <a href="?p=prescriptions&amp;client=${id%%.*}.vcf">&lt; $(l10n prescriptionlist)</a>
124 </div>
125
126 <div class="prescription">
127   <h2>$(l10n therapy_prescription)</h2>
128   <span class="insurance">${mpx[insurance]}</span>
129   <span class="date"><label>$(l10n date):</label>${mpx[date]}</span>
130
131   <label class="checkbox ${mpx[prescreviewed]:+checked}" for="prescreviewed">
132     $([ -n "${mpx[prescreviewed]}" ] && printf %s "$(l10n prescreviewed)" \
133                                      || printf %s "$(l10n prescreview)" )
134   </label>
135
136        ${mpx[prescno]:+<span class="prescno">$(l10n presc${mpx[prescno]})</span>}
137   ${mpx[grouptherapy]:+<span class="catalogue">$(l10n grouptherapy)</span>}
138      ${mpx[housecall]:+<span class="catalogue">$(l10n housecall)</span>}
139         ${mpx[report]:+<span class="catalogue">$(l10n report)</span>}
140
141   <ul>$(for n in '' {0..10}; do
142     [ -n "${mpx[remidy$n]}" ] && \
143     printf '<li>%s %s %s</li>' "${mpx[quantity$n]}" \
144                                "${mpx[remidy$n]}" \
145                                "${mpx[quantity_weekly$n]:+($mpx[quantity_weekly$n] $(l10n weekly))}"
146   done)</ul>
147
148   ${mpx[indicator]:+<span class="indicator"><label>$(l10n indicator):</label>${mpx[indicator]}</span>}
149       ${mpx[icd10]:+<span class="icd10">    <label>$(l10n icd10):</label>${mpx[icd10]}</span>}
150
151   ${mpx[addcontrib]:+
152   <label class='checkbox ${mpx[contribconfirm]:+checked}' for="addcontrib">
153     $([ -n "${mpx[contribconfirm]}" ] && printf %s "$(l10n contribconfirm)" ${mpx[contribconfirm]} \
154                                       || printf %s "$(l10n addcontrib)" )
155   </label>
156   }
157
158   <input class="tab" type="checkbox" id="indicator_reading">
159   <label class="tab" for="indicator_reading">$(l10n indicator_reading)</label>
160   <div class="tab">${mpx[indicator_reading]}</div>
161 </div>
162
163 <form id="report" method="POST" action="?action=update_therapy">
164   <input type="hidden" name="id" value="${id}">
165
166   <input class="stickynote" type="checkbox" name="c_stickynote" id="show_stickynote">
167   <fieldset class="stickynote">
168     <label for="show_stickynote">$(l10n notes)</label>
169     <textarea name="stickynote">${tpy[stickynote]}</textarea>
170     <button type=submit>$(l10n save)</button>
171   </fieldset>
172
173   <!--input class="tab" type="checkbox" id="lookout">
174   <label class="tab" for="lookout">$(l10n indicator_reading)</label>
175   <div class="tab"><textarea name="lookout">${mpx[lookout]}</textarea -->
176
177   <label class="tab heading">
178     <span class=no>$(l10n number)</span><!--
179  --><span class=date>$(l10n date)</span><!--
180  --><span class=therapist>$(l10n therapist)</span><!--
181  --><span class=signature>$(l10n signature)</span>
182   </label>
183 EOF
184
185 therapy_sessions
186
187 cat <<EOF
188   <fieldset class=color>
189     <input class=color type=radio name=color onclick="javascript:setcol('#000')" value="#000" id=c000 $c0><label for=c000></label>
190     <input class=color type=radio name=color onclick="javascript:setcol('#00A')" value="#00A" id=c001 $c1><label for=c001></label>
191     <input class=color type=radio name=color onclick="javascript:setcol('#0A0')" value="#0A0" id=c010 $c2><label for=c010></label>
192     <input class=color type=radio name=color onclick="javascript:setcol('#0AA')" value="#0AA" id=c011 $c3><label for=c011></label>
193     <input class=color type=radio name=color onclick="javascript:setcol('#A00')" value="#A00" id=c100 $c4><label for=c100></label>
194     <input class=color type=radio name=color onclick="javascript:setcol('#A0A')" value="#A0A" id=c101 $c5><label for=c101></label>
195     <input class=color type=radio name=color onclick="javascript:setcol('#AA0')" value="#AA0" id=c110 $c6><label for=c110></label>
196     <input class=color type=radio name=color onclick="javascript:setcol('#FFF')" value="#FFF" id=c111 $c7><label for=c111></label>
197   </fieldset>
198   <img class="dotmark bg" src="?static=therapy_background.png" alt="WARNING: Background Image not available!">
199   <canvas id="canvas" class="dotmark ov" width="${bg_dim%x*}" height="${bg_dim#*x}"></canvas>
200
201   <input type=hidden id=image_serialize name=imagedata value="">
202
203   <button type="submit">$(l10n save)</button>
204 </form>
205
206 <span id="jsdebug" style="display: none; position: fixed; right:0; bottom:0">Debug</span>
207
208 <script type="text/javascript" src="?static=therapy_draw.js"></script>
209 EOF
210 # vi:set filetype=html: