dac7270362fcd58998dae5818bf18866380be51f
[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
139 <br>
140 <p class="indicator_codes">
141 <label for="indicator">$(l10n indicator)</label>
142 <input id="indicator" name="indicator" value="${mpx[indicator]}" placeholder="$(l10n indicator)">
143 <br>
144 <label for="icd10">$(l10n icd10)</label>
145 <input id="icd10" name="icd10" value="${mpx[icd10]}" placeholder="$(l10n icd10)">
146 </p>
147 <br>
148 <p class="indicator_reading">
149 <label for="indicator_reading">$(l10n indicator_reading)</label>
150 <textarea id="indicator_reading" name="indicator_reading" placeholder="$(l10n indicator_reading)">${mpx[indicator_reading]}</textarea>
151 </p>
152 </fieldset>
153
154 <fieldset class="controls">
155 <button type="submit" name="action" value="save">$(l10n save)</button>
156 <button type="submit" name="action" value="cancel">$(l10n cancel)</button>
157 <button type="submit" name="action" value="delete">$(l10n delete)</button>
158 </fieldset>
159
160 </form>
161 END_HTML