]> git.plutz.net Git - lobster/blobdiff - cards/widgets.sh
provide debug function
[lobster] / cards / widgets.sh
index 4d0f7337cbc22fbab0d6c1f1093caa51d92d43c5..c0ecfb09e5bf78019189325443c320382ab57bca 100755 (executable)
@@ -21,7 +21,7 @@ cat <<EOF
   [fieldset .item
     [legend $(l10n filter_item):]
 
-    $(for field in any name street zip TEL BDAY CATEGORIES; do
+    $(for field in any name street zip TEL BDAY; do
       printf '[input id="%s%i" type="radio" name="filter_type%i" value="%s" %s]
               [label for="%s%i" %s ]' \
               "$field" "$n" "$n" "$field" "$([ "$1" = "$field" ] && printf checked )" \
@@ -132,6 +132,22 @@ card_item(){
                    "$(l10n hi_status)" "$(unescape "$hi_status" |HTML)"
         done
         ;;
+      therapies)
+        client="$(pdi_value "$card" UID)"
+        printf '[h3 %s]' "$(l10n therapies)"
+        (cd "$_DATA/therapies/"; printf '%s\n' "${client}".*.tpy) \
+        | while read tpyfile; do
+          [ "$tpyfile" = "${client}.*.tpy" ] && break
+          tpy="${tpyfile%.tpy}";
+          tpydates="$(sed -En 's;^session[0-9]+_date:;;p;' "$_DATA/therapies/$tpyfile" \
+                      | sort \
+                      | sed -E ':X;N;$!bX; s;^[\n ]+;;; s;[\n ]+$;;; s;(\n.*\n|\n); - ;;'
+                     )"
+          printf '[a .item .therapy href="/therapies/%s" . %s] ' \
+                 "${tpy%.*}/${tpy#*.}" "$(HTML "${tpydates:--}")"
+        done |sort -n
+        printf '[a .item .therapy href="/therapies/%s/new" . +]' "${client}"
+        ;;
       *)[ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n "$item")"
         shy="$(printf '\302\255')"
         seq 1 $cnt |while read c; do