]> git.plutz.net Git - lobster/blob - prescriptions/view_prescription.sh
Merge commit '647d09a619f8da6da043f56a64781a69a92265e2' into cgilite
[lobster] / prescriptions / view_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
20 cat <<END_HTML
21 <div class="prescription ${mpx[presctype]%_*} ${mpx[presctype]#*_}">
22 <fieldset class="baseinfo">
23 <label for="insurance">$(l10n insurance)</label>
24 <span id="insurance">${mpx[insurance]}</span>
25 <br>
26 <label for="name">$(l10n name)</label>
27 <label for="bday">$(l10n bday)</label>
28 <span id="name">${mpx[name]}</span>
29 <span id="bday">${mpx[bday]}</span>
30
31 <br>
32 <label for="date">$(l10n date)</label>
33 <span id="date">${mpx[date]}</span>
34 </fieldset>
35
36 <fieldset class="misc">
37 <h1 id="${mpx[prescription]}">$(l10n therapy_prescription)</h1>
38 <br>
39 <label for="addcontrib">$(l10n addcontrib)</label>
40 <span id="addcontrib">${mpx[addcontrib]}</span>
41 <label for="contribconfirm">$(l10n contribconfirm)</label>
42 <span id="contribconfirm">${mpx[contribconfirm]}</span>
43 <label class="checkbox ${mpx[contribreceipt]:+checked}" for="contribreceipt">$(l10n contribreceipt)</label>
44 </fieldset>
45
46 <label class="checkbox ${mpx[prescreviewed]:+checked}" for="prescreviewed">
47   $([ -n "${mpx[prescreviewed]}" ] && printf %s "$(l10n prescreviewed)" \
48                                    || printf %s "$(l10n prescreview)" )
49 </label>
50
51 <fieldset class="catalogue">
52 <h2>$(l10n prescription_by_catalogue)</h2>
53 <label class="radio $(check "$mpx[prescno]" first)" for="prescfirst">$(l10n prescfirst)</label>
54 <br>
55 <label class="radio $(check "$mpx[prescno]" follow1)" for="prescfollow1">$(l10n prescfollow1)</label>
56 <br>
57 <label class="radio $(check "$mpx[prescno]" follow2)" for="prescfollow2">$(l10n prescfollow2)</label>
58 <br>
59 <label class="radio $(check "$mpx[prescno]" other)" for="prescother">$(l10n prescother)</label>
60 <br>
61 <label class="radio $(check "$mpx[prescno]" continual)" for="presccontinual">$(l10n presccontinual)</label>
62
63 <br>
64 <label class="checkbox ${mpx[grouptherapy]:+checked}" for="grouptherapy">$(l10n grouptherapy)</label>
65 <br>
66 <label class="checkbox ${mpx[housecall]:+checked}" for="housecall">$(l10n housecall)</label>
67 <br>
68 <label class="checkbox ${mpx[report]:+checked}" for="report">$(l10n report)</label>
69 </fieldset>
70
71 <fieldset class="description">
72   <label for="quantity">$(l10n quantity)</label>
73   <label for="remidy">$(l10n remidy)</label>
74   <label for="quantity_weekly">$(l10n quantity_weekly)</label>
75   <span id="quantity">${mpx[quantity]}</span>
76   <span id="remidy">${mpx[remidy]}</span>
77   <span id="quantity_weekly">${mpx[quantity_weekly]}</span>
78 $( for n in {0..10}; do
79   [ -n "${mpx[quantity$n]}" -o -n "${mpx[remidy$n]}" -o -n "${mpx[quantity_weekly$n]}" ] \
80   && printf '
81     <span id="quantity">%s</span>
82     <span id="remidy">%s</span>
83     <span id="quantity_weekly">%s</span>
84     ' "${mpx[quantity$n]}" "${mpx[remidy$n]}" "${mpx[quantity_weekly$n]}"
85 done )
86 <br>
87 <p class="indicator_codes">
88   <label for="indicator">$(l10n indicator)</label>
89   <span id="indicator">${mpx[indicator]}</span>
90   <br>
91   <label for="icd10">$(l10n icd10)</label>
92   <span id="icd10">${mpx[icd10]}</span>
93 </p>
94 <br>
95 <p class="indicator_reading">
96   <label for="indicator_reading">$(l10n indicator_reading)</label>
97   <span id="indicator_reading">${mpx[indicator_reading]}</span>
98 </p>
99 </fieldset>
100
101 <p class="therapy_dates">
102   <label>$(l10n therapy_dates):</label>
103   $(therapy_dates "$id" \
104     | while read date; do
105       printf '<span>%s</span>' "$date"
106     done
107   )
108 </p>
109
110 <p class="issuer">
111   <label>$(l10n issuer)</label>
112   <span id="issuer">$mpx[issuer]</span>
113 </p>
114
115 <fieldset class="controls">
116 <a class="button" href="?p=prescriptions&amp;edit=${mpx[prescription]}#${mpx[prescription]}">$(l10n edit)</a>
117 <a class="button" href="?p=therapy&amp;id=${mpx[prescription]%.mpx}.tpy">$(l10n therapy)</a>
118 </fieldset>
119
120 </div>
121 END_HTML