]> git.plutz.net Git - confetti/blob - templates/therapy.html.sh
escape " for latex
[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   if [ "$note_n" -eq 1 -o -n "${tpy[session${session_n}_note${note_n}]}" ]; then
26     printf '<input class="trailbtn" type="checkbox" checked="checked">'
27   else
28     printf '<input class="trailbtn" type="checkbox">'
29   fi
30
31   _checked="$(validate "$tpy[$color]" '#(888|00A|0A0|0AA|A00|A0A|AA0)' '#FFF')"
32         cat <<-EOF
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>
43           </fieldset>
44         EOF
45 }
46
47 t_session(){
48   session_n="$1"
49
50   sid=session${session_n}
51
52   if [ "$tpy[${sid}_sigset]" = pos ]; then
53     sigcheck=checked
54   else
55     unset sigcheck
56   fi
57
58         cat <<-EOF
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>
68           </label>
69           <div class=tab>
70             <img class="dotmark ov" src="/therapies/${id%.tpy}_${sid}.png" alt="">
71             $(n=1;
72               while [ -n "${tpy[session${session_n}_note${n}]+x}" ]; do
73                 if [ -n "${tpy[session${session_n}_note${n}]}" ]; then
74                   x=$n
75                 fi
76                 n=$(($n + 1))
77               done
78               for n in $(seq 1 $((${x:-0} + 3)) ); do t_session_note $session_n $n; done
79              )
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>
82           </div>
83         EOF
84 }
85
86 therapy_sessions(){
87   n=1; while [ -n "${tpy[session${n}]}" ]; do
88     t_session $n
89     n=$(($n+1))
90   done
91
92   sid=session$n
93
94         cat <<-EOF
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="">
101           </fieldset>
102         EOF
103 }
104
105 cat <<EOF
106 <h1>$(l10n therapy)</h1>
107
108 <div class="patient">
109   <h2>$client_name</h2>
110   <a href="?p=prescriptions&amp;client=${id%%.*}.vcf">&lt; $(l10n prescriptionlist)</a>
111 </div>
112
113 <div class="prescription">
114   <h2>$(l10n therapy_prescription)</h2>
115   <span class="insurance">${mpx[insurance]}</span>
116   <span class="date"><label>$(l10n date):</label>${mpx[date]}</span>
117
118   <label class="checkbox ${mpx[prescreviewed]:+checked}" for="prescreviewed">
119     $([ -n "${mpx[prescreviewed]}" ] && printf %s "$(l10n prescreviewed)" \
120                                      || printf %s "$(l10n prescreview)" )
121   </label>
122
123        ${mpx[prescno]:+<span class="prescno">$(l10n presc${mpx[prescno]})</span>}
124   ${mpx[grouptherapy]:+<span class="catalogue">$(l10n grouptherapy)</span>}
125      ${mpx[housecall]:+<span class="catalogue">$(l10n housecall)</span>}
126         ${mpx[report]:+<span class="catalogue">$(l10n report)</span>}
127
128   <ul>$(for n in '' {0..10}; do
129     [ -n "${mpx[remidy$n]}" ] && \
130     printf '<li>%s %s %s</li>' "${mpx[quantity$n]}" \
131                                "${mpx[remidy$n]}" \
132                                "${mpx[quantity_weekly$n]:+($mpx[quantity_weekly$n] $(l10n weekly))}"
133   done)</ul>
134
135   ${mpx[indicator]:+<span class="indicator"><label>$(l10n indicator):</label>${mpx[indicator]}</span>}
136       ${mpx[icd10]:+<span class="icd10">    <label>$(l10n icd10):</label>${mpx[icd10]}</span>}
137
138   ${mpx[addcontrib]:+
139   <label class='checkbox ${mpx[contribconfirm]:+checked}' for="addcontrib">
140     $([ -n "${mpx[contribconfirm]}" ] && printf %s "$(l10n contribconfirm)" ${mpx[contribconfirm]} \
141                                       || printf %s "$(l10n addcontrib)" )
142   </label>
143   }
144
145   <input class="tab" type="checkbox" id="indicator_reading">
146   <label class="tab" for="indicator_reading">$(l10n indicator_reading)</label>
147   <div class="tab">${mpx[indicator_reading]}</div>
148 </div>
149
150 <form id="report" method="POST" action="?action=update_therapy">
151   <input type="hidden" name="id" value="${id}">
152
153   <input class="stickynote" type="checkbox" name="c_stickynote" id="show_stickynote">
154   <fieldset class="stickynote">
155     <label for="show_stickynote">$(l10n notes)</label>
156     <textarea name="stickynote">${tpy[stickynote]}</textarea>
157     <button type=submit>$(l10n save)</button>
158   </fieldset>
159
160   <!--input class="tab" type="checkbox" id="lookout">
161   <label class="tab" for="lookout">$(l10n indicator_reading)</label>
162   <div class="tab"><textarea name="lookout">${mpx[lookout]}</textarea -->
163
164   <label class="tab heading">
165     <span class=no>$(l10n number)</span><!--
166  --><span class=date>$(l10n date)</span><!--
167  --><span class=therapist>$(l10n therapist)</span><!--
168  --><span class=signature>$(l10n signature)</span>
169   </label>
170 EOF
171
172 therapy_sessions
173
174 _checked="$(validate "$tpy[penwidth]" '(4|12|36)' '4')"
175 cat <<EOF
176   <fieldset class="penwidth">
177     <input type="radio" name="penwidth" value="4"  id="pw1" $(checked  4)><label for="pw2"></label>
178     <input type="radio" name="penwidth" value="12" id="pw2" $(checked 12)><label for="pw3"></label>
179     <input type="radio" name="penwidth" value="36" id="pw3" $(checked 36)><label for="pw1"></label>
180   </fieldset>
181 EOF
182
183 _checked="$(validate "$tpy[color]" '#(0[0A]{2}|A00|A0A|AA0|FFF)' '#000')"
184 cat <<EOF
185   <fieldset class="color">
186     <input class="color" type="radio" name="color" value="#000" id="c000" $(checked \#000)><label for="c000"></label>
187     <input class="color" type="radio" name="color" value="#00A" id="c001" $(checked \#00A)><label for="c001"></label>
188     <input class="color" type="radio" name="color" value="#0A0" id="c010" $(checked \#0A0)><label for="c010"></label>
189     <input class="color" type="radio" name="color" value="#0AA" id="c011" $(checked \#0AA)><label for="c011"></label>
190     <input class="color" type="radio" name="color" value="#A00" id="c100" $(checked \#A00)><label for="c100"></label>
191     <input class="color" type="radio" name="color" value="#A0A" id="c101" $(checked \#A0A)><label for="c101"></label>
192     <input class="color" type="radio" name="color" value="#AA0" id="c110" $(checked \#AA0)><label for="c110"></label>
193     <input class="color" type="radio" name="color" value="#FFF" id="c111" $(checked \#FFF)><label for="c111"></label>
194   </fieldset>
195   <img class="dotmark bg" src="?static=therapy_background.png" alt="WARNING: Background Image not available!">
196   <canvas id="canvas" class="dotmark ov" width="${bg_dim%x*}" height="${bg_dim#*x}"></canvas>
197
198   <input type=hidden id=image_serialize name=imagedata value="">
199
200   <button type="submit">$(l10n save)</button>
201 </form>
202
203 <span id="jsdebug" style="display: none; position: fixed; right:0; bottom:0">Debug</span>
204
205 <script type="text/javascript" src="?static=therapy_draw.js"></script>
206 EOF
207 # vi:set filetype=html: