]> git.plutz.net Git - confetti/blob - templates/therapy.html.sh
limit note trail to used + 3 fields
[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             $(n=1;
81               while [ -n "${tpy[session${session_n}_note${n}]+x}" ]; do
82                 if [ -n "${tpy[session${session_n}_note${n}]}" ]; then
83                   x=$n
84                 fi
85                 n=$(($n + 1))
86               done
87               for n in $(seq 1 $((${x:-0} + 3)) ); do t_session_note $session_n $n; done
88              )
89             <button class="trailbtn" type="submit">$(l10n trailsave)</button>
90             <button class=delete type=submit name=delete_session value=${session_n}>$(l10n delete_session)</button>
91           </div>
92         EOF
93 }
94
95 therapy_sessions(){
96   n=1; while [ -n "${tpy[session${n}]}" ]; do
97     t_session $n
98     n=$(($n+1))
99   done
100
101   sid=session$n
102
103         cat <<-EOF
104           <fieldset class="tab">
105             <button class=no type=submit name=new_session value=$sid>+</button><!--
106          --><input class=date name=${sid}_date value="" placeholder="$(l10n date)" /><!--
107          --><input class=therapist name=${sid}_therapist value="" placeholder="$(l10n therapist)" /><!--
108          --><span class=signature><span></span>
109             <input type=hidden name="${sid}_note1" value="">
110           </fieldset>
111         EOF
112 }
113
114 unset c0 c1 c2 c3 c4 c5 c6 c7
115 case "$tpy[color]" in
116   \#00A) c1="checked";;
117   \#0A0) c2="checked";;
118   \#0AA) c3="checked";;
119   \#A00) c4="checked";;
120   \#A0A) c5="checked";;
121   \#AA0) c6="checked";;
122   \#FFF) c7="checked";;
123       *) c0="checked";;
124 esac
125
126 cat <<EOF
127 <h1>$(l10n therapy)</h1>
128
129 <div class="patient">
130   <h2>$client_name</h2>
131   <a href="?p=prescriptions&amp;client=${id%%.*}.vcf">&lt; $(l10n prescriptionlist)</a>
132 </div>
133
134 <div class="prescription">
135   <h2>$(l10n therapy_prescription)</h2>
136   <span class="insurance">${mpx[insurance]}</span>
137   <span class="date"><label>$(l10n date):</label>${mpx[date]}</span>
138
139   <label class="checkbox ${mpx[prescreviewed]:+checked}" for="prescreviewed">
140     $([ -n "${mpx[prescreviewed]}" ] && printf %s "$(l10n prescreviewed)" \
141                                      || printf %s "$(l10n prescreview)" )
142   </label>
143
144        ${mpx[prescno]:+<span class="prescno">$(l10n presc${mpx[prescno]})</span>}
145   ${mpx[grouptherapy]:+<span class="catalogue">$(l10n grouptherapy)</span>}
146      ${mpx[housecall]:+<span class="catalogue">$(l10n housecall)</span>}
147         ${mpx[report]:+<span class="catalogue">$(l10n report)</span>}
148
149   <ul>$(for n in '' {0..10}; do
150     [ -n "${mpx[remidy$n]}" ] && \
151     printf '<li>%s %s %s</li>' "${mpx[quantity$n]}" \
152                                "${mpx[remidy$n]}" \
153                                "${mpx[quantity_weekly$n]:+($mpx[quantity_weekly$n] $(l10n weekly))}"
154   done)</ul>
155
156   ${mpx[indicator]:+<span class="indicator"><label>$(l10n indicator):</label>${mpx[indicator]}</span>}
157       ${mpx[icd10]:+<span class="icd10">    <label>$(l10n icd10):</label>${mpx[icd10]}</span>}
158
159   ${mpx[addcontrib]:+
160   <label class='checkbox ${mpx[contribconfirm]:+checked}' for="addcontrib">
161     $([ -n "${mpx[contribconfirm]}" ] && printf %s "$(l10n contribconfirm)" ${mpx[contribconfirm]} \
162                                       || printf %s "$(l10n addcontrib)" )
163   </label>
164   }
165
166   <input class="tab" type="checkbox" id="indicator_reading">
167   <label class="tab" for="indicator_reading">$(l10n indicator_reading)</label>
168   <div class="tab">${mpx[indicator_reading]}</div>
169 </div>
170
171 <form id="report" method="POST" action="?action=update_therapy">
172   <input type="hidden" name="id" value="${id}">
173
174   <input class="stickynote" type="checkbox" name="c_stickynote" id="show_stickynote">
175   <fieldset class="stickynote">
176     <label for="show_stickynote">$(l10n notes)</label>
177     <textarea name="stickynote">${tpy[stickynote]}</textarea>
178     <button type=submit>$(l10n save)</button>
179   </fieldset>
180
181   <!--input class="tab" type="checkbox" id="lookout">
182   <label class="tab" for="lookout">$(l10n indicator_reading)</label>
183   <div class="tab"><textarea name="lookout">${mpx[lookout]}</textarea -->
184
185   <label class="tab heading">
186     <span class=no>$(l10n number)</span><!--
187  --><span class=date>$(l10n date)</span><!--
188  --><span class=therapist>$(l10n therapist)</span><!--
189  --><span class=signature>$(l10n signature)</span>
190   </label>
191 EOF
192
193 therapy_sessions
194
195 cat <<EOF
196   <fieldset class=color>
197     <input class="color" type="radio" name="color" value="#000" id="c000" $c0><label for="c000"></label>
198     <input class="color" type="radio" name="color" value="#00A" id="c001" $c1><label for="c001"></label>
199     <input class="color" type="radio" name="color" value="#0A0" id="c010" $c2><label for="c010"></label>
200     <input class="color" type="radio" name="color" value="#0AA" id="c011" $c3><label for="c011"></label>
201     <input class="color" type="radio" name="color" value="#A00" id="c100" $c4><label for="c100"></label>
202     <input class="color" type="radio" name="color" value="#A0A" id="c101" $c5><label for="c101"></label>
203     <input class="color" type="radio" name="color" value="#AA0" id="c110" $c6><label for="c110"></label>
204     <input class="color" type="radio" name="color" value="#FFF" id="c111" $c7><label for="c111"></label>
205   </fieldset>
206   <img class="dotmark bg" src="?static=therapy_background.png" alt="WARNING: Background Image not available!">
207   <canvas id="canvas" class="dotmark ov" width="${bg_dim%x*}" height="${bg_dim#*x}"></canvas>
208
209   <input type=hidden id=image_serialize name=imagedata value="">
210
211   <button type="submit">$(l10n save)</button>
212 </form>
213
214 <span id="jsdebug" style="display: none; position: fixed; right:0; bottom:0">Debug</span>
215
216 <script type="text/javascript" src="?static=therapy_draw.js"></script>
217 EOF
218 # vi:set filetype=html: