additional prescription fields, improved display of clients and prescriptions
[confetti] / templates / view_client.sh
index c1e3987..4b06268 100755 (executable)
@@ -36,14 +36,10 @@ cat <<END_HTML
     done)
 
     ${values[BDAY]:+<span class="item BDAY"><label>*:</label> ${values[BDAY]}</span>}
-    ${values[X-ZACK-JOINDATE]:+<span class="item X-ZACK-JOINDATE"><label>$(l10n label_join):</label> $values[X-ZACK-JOINDATE]</span>}
-    ${values[X-ZACK-LEAVEDATE]:+<span class="item X-ZACK-LEAVEDATE"><label>$(l10n label_leave):</label> $values[X-ZACK-LEAVEDATE]</span>}
     ${values[SOUND]:+<audio controls="controls" class="item SOUND"><source type="audio/ogg" src="data:audio/ogg;base64,$values[SOUND]" /></audio>}
     ${values[PHOTO]:+<img class="item PHOTO" src="data:image/$tags[PHOTO_TYPE];base64,$values[PHOTO]" />}
     ${values[LOGO]:+<img class="item LOGO" src="data:image/$tags[LOGO_TYPE];base64,$values[LOGO]" />}
-  </div><!--
 
-  --><div class="section address">
     <h3>$(l10n ADR)</h3>
     $(for n in ADR ADR{0..10}; do
       echo "${values[$n]:+<span class="item ADR">$values[$n]</span>}"
@@ -92,12 +88,15 @@ cat <<END_HTML
     <ul>
     $(find "$_DATA/prescriptions/" -name "${id%.vcf}.*.mpx" \
       | while read pfile; do
-        printf '%s\t%s\t%s\n' "$(grep '^date' "$pfile")" "$(sed -nr 's;^icd10:(.*)$;\1;p' "$pfile")"
-      done \
-      | sort -r | cut -f2 \
-      | while read icd; do
-        printf '<li><a href="?p=prescriptions&amp;client=%s" >%s</a></li>' "${id}" "${icd:-$(l10n no_icd)}"
-      done)
+        printf '%s\t%s\t%s\n'  
+        printf '<li><a href="?p=prescriptions&amp;client=%s" >%s: %s - %s%s</a></li>' \
+          "${id}" \
+          "$(sed -nr 's;^date:(.+)$;\1;p' "$pfile")" \
+          "$(sed -nr 's;^indicator:(.+)$;\1;p' "$pfile")" \
+          "$(sed -nr 's;^quantity:(.+) ?$;\1x ;p' "$pfile")$(sed -nr 's;^remidy:(.+)$;\1;p' "$pfile")" \
+          "$(sed -nr 's;^quantity1:(.+) ?$;,\1x ;p' "$pfile")$(sed -nr 's;^remidy1:(.+)$;\1;p' "$pfile")"
+      done |sort -r
+    )
     </ul>
   </div>
 END_HTML