]> git.plutz.net Git - confetti/blobdiff - templates/view_prescription.sh
allow additional remedies to be prescribed
[confetti] / templates / view_prescription.sh
index df89cdba5b2db646fc1aeb666ebb5f4fea45cdf0..78f995b97d425aa22ebe9c5df4354368addc4fd2 100755 (executable)
@@ -18,7 +18,7 @@
 check(){ [ "$1" = "$2" ] && printf checked}
 
 cat <<END_HTML
-<div class="prescription">
+<div class="prescription ${mpx[presctype]%_*} ${mpx[presctype]#*_}">
 <fieldset class="baseinfo">
 <label for="insurance">$(l10n insurance)</label>
 <span id="insurance">${mpx[insurance]}</span>
@@ -69,21 +69,20 @@ cat <<END_HTML
 </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>
-
-<label for="quantity1">$(l10n quantity)</label>
-<label for="remidy1">$(l10n remidy)</label>
-<label for="quantity_weekly1">$(l10n quantity_weekly)</label>
-<span id="quantity1">${mpx[quantity1]}</span>
-<span id="remidy1">${mpx[remidy1]}</span>
-<span id="quantity_weekly1">${mpx[quantity_weekly1]}</span>
-
+  <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>