allow additional remedies to be prescribed
[confetti] / templates / therapy.html.sh
index 0c91487..05c50fd 100755 (executable)
@@ -147,10 +147,12 @@ cat <<EOF
      ${mpx[housecall]:+<span class="catalogue">$(l10n housecall)</span>}
         ${mpx[report]:+<span class="catalogue">$(l10n report)</span>}
 
-  <ul>
-    ${mpx[remidy]:+ <li>${mpx[quantity]}  ${mpx[remidy]}  ${mpx[quantity_weekly]:+($mpx[quantity_weekly] $(l10n weekly))}</li>}
-    ${mpx[remidy1]:+<li>${mpx[quantity1]} ${mpx[remidy1]} ${mpx[quantity_weekly1]:+($mpx[quantity_weekly1] $(l10n weekly))}</li>}
-  </ul>
+  <ul>$(for n in '' {0..10}; do
+    [ -n "${mpx[remidy$n]}" ] && \
+    printf '<li>%s %s %s</li>' "${mpx[quantity$n]}" \
+                               "${mpx[remidy$n]}" \
+                               "${mpx[quantity_weekly$n]:+($mpx[quantity_weekly$n] $(l10n weekly))}"
+  done)</ul>
 
   ${mpx[indicator]:+<span class="indicator"><label>$(l10n indicator):</label>${mpx[indicator]}</span>}
       ${mpx[icd10]:+<span class="icd10">    <label>$(l10n icd10):</label>${mpx[icd10]}</span>}