]> git.plutz.net Git - lobster/blobdiff - therapies/page.sh
top link in client list
[lobster] / therapies / page.sh
index c3d8078567331ca783385b8db8462e38e030c148..a53bb923f7c689888873fac2de87e86a6335c8df 100755 (executable)
@@ -44,7 +44,20 @@ t_session_note(){
 }
 
 therapy_sessions(){
-  n=1; while [ "$(TPY session$n)" ]; do
+  n=1; while [ "$(TPY session$n)" ]; do n=$((n + 1)); done
+
+  sid=session$n
+  cat <<-EOF
+       [fieldset .tab
+         [submit "new_session" "$sid" .no . +]
+         [input .date name="${sid}_date" value="" placeholder=$(l10n date)]
+         [input .therapist name="${sid}_therapist" value="" placeholder=$(l10n therapist)]
+         [span .signature]
+         [hidden "${sid}_note1" ""]
+       ]
+       EOF
+
+  for n in $(seq $((n - 1)) -1 1); do
     session_n="$n"
     sid=session${session_n}
 
@@ -60,7 +73,7 @@ therapy_sessions(){
          [span .signature [checkbox "${sid}_sigset" "pos" $(checked "$(TPY "${sid}_sigset")" "pos")]]
        ]
        [div .tab
-         [img .dotmark .ov src="/therapies/${id}_${sid}.png" alt=""]
+         [img .dotmark .ov src="/therapies/${id}_${sid}.png?${_DATE}" alt=""]
          $(n=1; while TPY "session${session_n}_note${n}" >/dev/null; do
              [ "$(TPY "session${session_n}_note${n}")" ] && x=$n
              n=$(($n + 1))
@@ -73,27 +86,14 @@ therapy_sessions(){
          [button type="submit" name=delete_session value="$session_n" .delete $(l10n delete_session)]
        ]
        EOF
-    n=$(($n+1))
   done
-
-  sid=session$n
-
-  cat <<-EOF
-       [fieldset .tab
-         [submit "new_session" "$sid" .no . +]
-         [input .date name="${sid}_date" value="" placeholder=$(l10n date)]
-         [input .therapist name="${sid}_therapist" value="" placeholder=$(l10n therapist)]
-         [span .signature]
-         [hidden "${sid}_note1" ""]
-       ]
-       EOF
 }
 
 cat <<EOF
 [h1 $(l10n therapy)]
 
 [div .patient
-  [h2 . [a "/cards/#${id%.*}.vcf" &#x2b05; $(VCF FN |HTML)]]
+  [h2 . &#x2b05; $(VCF FN |HTML)]
 ]
 
 [div .therapies
@@ -116,7 +116,7 @@ cat <<EOF
     fi
   done |sort -n
   )
-  [a .item .therapy href="/therapies/${id%%.*}/new" . +]
+  [!-- a .item .therapy href="/therapies/${id%%.*}/new" . + --]
 ]
 EOF
 
@@ -152,7 +152,9 @@ fi
 
 cat <<EOF
 [form #report method=POST action="/therapies/update_therapy.sh"
-  [hidden "id" "$id"]
+  [hidden "id" "$id"][hidden "tid" "$(transid "$tpyfile")"]
+
+  [button #backbutton type=submit name="vcfreturn" value="true" &#x2b05; $(VCF FN |HTML)]
 
   [input .stickynote type=checkbox name=c_stickynote #show_stickynote]
   [fieldset .stickynote
@@ -161,24 +163,28 @@ cat <<EOF
     [textarea name=stickynote . $(TPY stickynote |HTML)]
     [button type=submit $(l10n save)]
   ]
+EOF
 
-  [input .stickynote type=checkbox name=c_timesheet #show_timesheet]
-  [fieldset .stickynote
-    [label for="show_timesheet" $(l10n timesheet)]
-    [h2 $(l10n timesheet)]
-    [table [thead [tr
-      [th $(l10n time_goal)][th $(l10n time_actual)][th $(l10n time_difference)]
-    ]][tbody
-      $(for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
-        tsgoal="$(TPY tsgoal$n |grep -m1 -xE '[0-9]+')"
-        tsactual="$(TPY tsactual$n |grep -m1 -xE '[0-9]+')"
-        printf '[tr [td [input type=number name=tsgoal value="%s"]][td [input type=number name=tsactual value="%s"]][td %s]]' \
-               "$tsgoal" "$tsactual" "$(( ${tsgoal:-0} - ${tsactual:-0} ))"
-      done)
-    ]]
-    [button type=submit $(l10n save)]
-  ]
+# cat <<EOF
+#   [input .stickynote type=checkbox name=c_timesheet #show_timesheet]
+#   [fieldset .stickynote
+#     [label for="show_timesheet" $(l10n timesheet)]
+#     [h2 $(l10n timesheet)]
+#     [table [thead [tr
+#       [th $(l10n time_goal)][th $(l10n time_actual)][th $(l10n time_difference)]
+#     ]][tbody
+#       $(for n in '' 0 1 2 3 4 5 6 7 8 9 10; do
+#         tsgoal="$(TPY tsgoal$n |grep -m1 -xE '[0-9]+')"
+#         tsactual="$(TPY tsactual$n |grep -m1 -xE '[0-9]+')"
+#         printf '[tr [td [input type=number name=tsgoal value="%s"]][td [input type=number name=tsactual value="%s"]][td %s]]' \
+#                "$tsgoal" "$tsactual" "$(( ${tsgoal:-0} - ${tsactual:-0} ))"
+#       done)
+#     ]]
+#     [button type=submit $(l10n save)]
+#   ]
+# EOF
 
+cat <<EOF
   [label .tab .heading
     [span .no $(l10n number)][span .date $(l10n date)][span .therapist $(l10n therapist)][span .signature $(l10n signature)]
   ]
@@ -211,11 +217,12 @@ cat <<EOF
   [canvas #canvas .dotmark .ov width="${bg_dim%x*}" height="${bg_dim#*x}" ]
   [input type=hidden #image_serialize name=imagedata value=""]
 
+  [input type=hidden name=formend value=formend]
   [button #savebutton type=submit $(l10n save)]
 ]
 
 [span #jsdebug style="display: none; position: fixed; right:0; bottom:0" Debug]
 
 [script type="text/javascript" src="/therapies/therapy_draw.js"]
-[script type="text/javascript" src="/therapies/autosave.js"]
+[!-- script type="text/javascript" src="/therapies/autosave.js" --]
 EOF