]> git.plutz.net Git - confetti/blob - templates/edit_prescription.sh
js compatibility for firefox and android browser
[confetti] / templates / edit_prescription.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 check(){ [ "$1" = "$2" ] && printf checked}
19 [ -z $mpx[presctype] ] && mpx[presctype]=doctor_compulsory
20
21 cat <<END_HTML
22 <form class="prescription" action="?action=update_prescription" method="POST">
23 <input type="hidden" name="prescription" value="${mpx[prescription]}">
24
25 <label class=presctype>$(l10n doctor):</label>
26 <input type=radio name=presctype id=doctor_selfpaid value=doctor_selfpaid $(check "$mpx[presctype]" doctor_selfpaid)>
27 <label for=doctor_selfpaid>$(l10n selfpaid)</label>
28 <input type=radio name=presctype id=doctor_private value=doctor_private $(check "$mpx[presctype]" doctor_private)>
29 <label for=doctor_private>$(l10n private)</label>
30 <input type=radio name=presctype id=doctor_compulsory value=doctor_compulsory $(check "$mpx[presctype]" doctor_compulsory)>
31 <label for=doctor_compulsory>$(l10n compulsory)</label>
32 <br>
33
34 <label class=presctype>$(l10n dentist):</label>
35 <input type=radio name=presctype id=dentist_selfpaid value=dentist_selfpaid $(check "$mpx[presctype]" dentist_selfpaid)>
36 <label for=dentist_selfpaid>$(l10n selfpaid)</label>
37 <input type=radio name=presctype id=dentist_private value=dentist_private $(check "$mpx[presctype]" dentist_private)>
38 <label for=dentist_private>$(l10n private)</label>
39 <input type=radio name=presctype id=dentist_compulsory value=dentist_compulsory $(check "$mpx[presctype]" dentist_compulsory)>
40 <label for=dentist_compulsory>$(l10n compulsory)</label>
41 <br>
42
43 <label class=presctype>$(l10n noprescription):</label>
44 <input type=radio name=presctype id=noprescription_selfpaid value=noprescription_selfpaid $(check "$mpx[presctype]" noprescription_selfpaid)>
45 <label for=noprescription_selfpaid>$(l10n selfpaid)</label>
46 <br>
47
48 <label class=presctype>$(l10n altpractition):</label>
49 <input type=radio name=presctype id=altpractition_selfpaid value=altpractition_selfpaid $(check "$mpx[presctype]" altpractition_selfpaid)>
50 <label for=altpractition_selfpaid>$(l10n selfpaid)</label>
51 <input type=radio name=presctype id=altpractition_private value=altpractition_private $(check "$mpx[presctype]" altpractition_private)>
52 <label for=altpractition_private>$(l10n private)</label>
53 <br>
54
55 <fieldset class="baseinfo">
56 <label for="insurance">$(l10n insurance)</label>
57 <input id="insurance" name="insurance" value="${mpx[insurance]}" placeholder="$(l10n insurance)">
58 <br>
59 <label for="name">$(l10n name)</label>
60 <label for="bday">$(l10n bday)</label>
61 <br>
62 <textarea id="name" name="name" placeholder="$(l10n name)">${mpx[name]}</textarea>
63 <input id="bday" name="bday" value="${mpx[bday]}" placeholder="$(l10n bday)">
64
65 <br>
66 <label for="date">$(l10n date)</label>
67 <input id="date" name="date" value="${mpx[date]}" placeholder="$(l10n date)">
68 </fieldset>
69
70 <fieldset class="misc">
71 <h1 id="${mpx[prescription]}">$(l10n therapy_prescription)</h1>
72
73 <label for="addcontrib">$(l10n addcontrib)</label>
74 <input id="addcontrib" name="addcontrib" value="${mpx[addcontrib]}" placeholder="$(l10n addcontrib)">
75 <label for="contribconfirm">$(l10n contribconfirm)</label>
76 <input id="contribconfirm" name="contribconfirm" value="${mpx[contribconfirm]}" placeholder="$(l10n contribconfirm)">
77 <input type="checkbox" id="contribreceipt" name="contribreceipt" value="true" ${mpx[contribreceipt]:+checked}>
78 <label for="contribreceipt">$(l10n contribreceipt)</label>
79 </fieldset>
80
81 <input type="checkbox" id="prescreviewed" name="prescreviewed" value="true" ${mpx[prescreviewed]:+checked}>
82 <label for="prescreviewed">$(l10n prescreviewed)</label>
83
84 <fieldset class="catalogue">
85 <h2>$(l10n prescription_by_catalogue)</h2>
86 <input type="radio" id="prescfirst" name="prescno" value="first" $(check "$mpx[prescno]" first)>
87 <label for="prescfirst">$(l10n prescfirst)</label>
88 <br>
89 <input type="radio" id="prescfollow1" name="prescno" value="follow1" $(check "$mpx[prescno]" follow1)>
90 <label for="prescfollow1">$(l10n prescfollow1)</label>
91 <br>
92 <input type="radio" id="prescfollow2" name="prescno" value="follow2" $(check "$mpx[prescno]" follow2)>
93 <label for="prescfollow2">$(l10n prescfollow2)</label>
94 <br>
95 <input type="radio" id="prescother" name="prescno" value="other" $(check "$mpx[prescno]" other)>
96 <label for="prescother">$(l10n prescother)</label>
97 <br>
98 <input type="radio" id="presccontinual" name="prescno" value="continual" $(check "$mpx[prescno]" continual)>
99 <label for="presccontinual">$(l10n presccontinual)</label>
100
101 <br>
102 <input type="checkbox" id="grouptherapy" name="grouptherapy" value="true" ${mpx[grouptherapy]:+checked}>
103 <label for="grouptherapy">$(l10n grouptherapy)</label>
104 <br>
105 <input type="checkbox" id="housecall" name="housecall" value="true" ${mpx[housecall]:+checked}>
106 <label for="housecall">$(l10n housecall)</label>
107 <br>
108 <input type="checkbox" id="report" name="report" value="true" ${mpx[report]:+checked}>
109 <label for="report">$(l10n report)</label>
110 </fieldset>
111
112 <fieldset class="description">
113 <label for="quantity">$(l10n quantity)</label>
114 <label for="remidy">$(l10n remidy)</label>
115 <label for="quantity_weekly">$(l10n quantity_weekly)</label>
116 <p>
117 <input id="quantity" name="quantity" value="${mpx[quantity]}" placeholder="$(l10n quantity)">
118 <textarea id="remidy" name="remidy" placeholder="$(l10n remidy)">${mpx[remidy]}</textarea>
119 <input id="quantity_weekly" name="quantity_weekly" value="${mpx[quantity_weekly]}" placeholder="$(l10n quantity_weekly)">
120 </p>
121
122 $( for n in {0..10}; do
123   if [ "$n" -eq 0 -o -n "${mpx[quantity$n]}" -o -n "${mpx[remidy$n]}" -o -n "${mpx[quantity_weekly$n]}" ]; then
124     printf '<input class="trailbtn" type="checkbox" checked="checked" />'
125   else
126     printf '<input class="trailbtn" type="checkbox" />'
127   fi
128   printf '<p class="trailbox">
129     <input class="quantity" name="quantity" placeholder="%s" value="%s">
130     <textarea class="remidy" name="remidy" placeholder="%s">%s</textarea>
131     <input class="quantity_weekly" name="quantity_weekly" placeholder="%s" value="%s">
132     </p>
133   ' "$(l10n quantity)" "${mpx[quantity$n]}" \
134     "$(l10n remidy)" "${mpx[remidy$n]}" \
135     "$(l10n quantity_weekly)" "${mpx[quantity_weekly$n]}"
136 done )
137
138 <br>
139 <p class="indicator_codes">
140 <label for="indicator">$(l10n indicator)</label>
141 <input id="indicator" name="indicator" value="${mpx[indicator]}" placeholder="$(l10n indicator)">
142 <br>
143 <label for="icd10">$(l10n icd10)</label>
144 <input id="icd10" name="icd10" value="${mpx[icd10]}" placeholder="$(l10n icd10)">
145 </p>
146 <br>
147 <p class="indicator_reading">
148 <label for="indicator_reading">$(l10n indicator_reading)</label>
149 <textarea id="indicator_reading" name="indicator_reading" placeholder="$(l10n indicator_reading)">${mpx[indicator_reading]}</textarea>
150 </p>
151 <br>
152 <p class="issuer">
153   <label>$(l10n issuer)</label>
154   <input type="radio" name="issuer_select" value="list" id="issuer_select_list" checked /><label for="issuer_select_list">$(l10n issuer_from_list)</label><!--
155   --><input type="radio" name="issuer_select" value="other" id="issuer_other"><label for="issuer_other">$(l10n issuer_other)</label>
156   <select class="item" name="issuer">
157     <option value="" disabled="disabled" $([ -z "${mpx[issuer]}" ] && printf 'selected' )>$(l10n issuer)...</option>
158     $(list_prescription_issuers |while read f; do
159       [ "$f" = "$mpx[issuer]" ] \
160       && printf '<option value="%s" selected>%s</option>' "$f" "$f" \
161       || printf '<option value="%s">%s</option>' "$f" "$f"
162     done)
163   </select>
164   <input type="text" name="issuer_other" value="" placeholder="$(l10n issuer)..." />
165 </p>
166 </fieldset>
167
168 <fieldset class="controls">
169 <button type="submit" name="action" value="save">$(l10n save)</button>
170 <button type="submit" name="action" value="cancel">$(l10n cancel)</button>
171 <button type="submit" name="action" value="delete">$(l10n delete)</button>
172 </fieldset>
173
174 </form>
175 END_HTML