]> git.plutz.net Git - confetti/blobdiff - prescriptions/view_prescription.sh
changed project layout
[confetti] / prescriptions / view_prescription.sh
diff --git a/prescriptions/view_prescription.sh b/prescriptions/view_prescription.sh
new file mode 100755 (executable)
index 0000000..ced7241
--- /dev/null
@@ -0,0 +1,121 @@
+# Copyright 2016 Paul Hänsch
+#
+# This file is part of Confetti.
+# 
+# Confetti is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# Confetti is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
+
+check(){ [ "$1" = "$2" ] && printf checked}
+
+cat <<END_HTML
+<div class="prescription ${mpx[presctype]%_*} ${mpx[presctype]#*_}">
+<fieldset class="baseinfo">
+<label for="insurance">$(l10n insurance)</label>
+<span id="insurance">${mpx[insurance]}</span>
+<br>
+<label for="name">$(l10n name)</label>
+<label for="bday">$(l10n bday)</label>
+<span id="name">${mpx[name]}</span>
+<span id="bday">${mpx[bday]}</span>
+
+<br>
+<label for="date">$(l10n date)</label>
+<span id="date">${mpx[date]}</span>
+</fieldset>
+
+<fieldset class="misc">
+<h1 id="${mpx[prescription]}">$(l10n therapy_prescription)</h1>
+<br>
+<label for="addcontrib">$(l10n addcontrib)</label>
+<span id="addcontrib">${mpx[addcontrib]}</span>
+<label for="contribconfirm">$(l10n contribconfirm)</label>
+<span id="contribconfirm">${mpx[contribconfirm]}</span>
+<label class="checkbox ${mpx[contribreceipt]:+checked}" for="contribreceipt">$(l10n contribreceipt)</label>
+</fieldset>
+
+<label class="checkbox ${mpx[prescreviewed]:+checked}" for="prescreviewed">
+  $([ -n "${mpx[prescreviewed]}" ] && printf %s "$(l10n prescreviewed)" \
+                                   || printf %s "$(l10n prescreview)" )
+</label>
+
+<fieldset class="catalogue">
+<h2>$(l10n prescription_by_catalogue)</h2>
+<label class="radio $(check "$mpx[prescno]" first)" for="prescfirst">$(l10n prescfirst)</label>
+<br>
+<label class="radio $(check "$mpx[prescno]" follow1)" for="prescfollow1">$(l10n prescfollow1)</label>
+<br>
+<label class="radio $(check "$mpx[prescno]" follow2)" for="prescfollow2">$(l10n prescfollow2)</label>
+<br>
+<label class="radio $(check "$mpx[prescno]" other)" for="prescother">$(l10n prescother)</label>
+<br>
+<label class="radio $(check "$mpx[prescno]" continual)" for="presccontinual">$(l10n presccontinual)</label>
+
+<br>
+<label class="checkbox ${mpx[grouptherapy]:+checked}" for="grouptherapy">$(l10n grouptherapy)</label>
+<br>
+<label class="checkbox ${mpx[housecall]:+checked}" for="housecall">$(l10n housecall)</label>
+<br>
+<label class="checkbox ${mpx[report]:+checked}" for="report">$(l10n report)</label>
+</fieldset>
+
+<fieldset class="description">
+  <label for="quantity">$(l10n quantity)</label>
+  <label for="remidy">$(l10n remidy)</label>
+  <label for="quantity_weekly">$(l10n quantity_weekly)</label>
+  <span id="quantity">${mpx[quantity]}</span>
+  <span id="remidy">${mpx[remidy]}</span>
+  <span id="quantity_weekly">${mpx[quantity_weekly]}</span>
+$( for n in {0..10}; do
+  [ -n "${mpx[quantity$n]}" -o -n "${mpx[remidy$n]}" -o -n "${mpx[quantity_weekly$n]}" ] \
+  && printf '
+    <span id="quantity">%s</span>
+    <span id="remidy">%s</span>
+    <span id="quantity_weekly">%s</span>
+    ' "${mpx[quantity$n]}" "${mpx[remidy$n]}" "${mpx[quantity_weekly$n]}"
+done )
+<br>
+<p class="indicator_codes">
+  <label for="indicator">$(l10n indicator)</label>
+  <span id="indicator">${mpx[indicator]}</span>
+  <br>
+  <label for="icd10">$(l10n icd10)</label>
+  <span id="icd10">${mpx[icd10]}</span>
+</p>
+<br>
+<p class="indicator_reading">
+  <label for="indicator_reading">$(l10n indicator_reading)</label>
+  <span id="indicator_reading">${mpx[indicator_reading]}</span>
+</p>
+</fieldset>
+
+<p class="therapy_dates">
+  <label>$(l10n therapy_dates):</label>
+  $(therapy_dates "$id" \
+    | while read date; do
+      printf '<span>%s</span>' "$date"
+    done
+  )
+</p>
+
+<p class="issuer">
+  <label>$(l10n issuer)</label>
+  <span id="issuer">$mpx[issuer]</span>
+</p>
+
+<fieldset class="controls">
+<a class="button" href="?p=prescriptions&amp;edit=${mpx[prescription]}#${mpx[prescription]}">$(l10n edit)</a>
+<a class="button" href="?p=therapy&amp;id=${mpx[prescription]%.mpx}.tpy">$(l10n therapy)</a>
+</fieldset>
+
+</div>
+END_HTML