]> git.plutz.net Git - confetti/blobdiff - templates/therapy.html.sh
dynamic therapy section
[confetti] / templates / therapy.html.sh
index cb3cf26850a0183e2360ce79f7d25f834eb3769e..f6533f74d3dc0ca9a111ce145f7b7615e65321a6 100755 (executable)
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
+t_session_note(){
+  session_n="$1"
+  note_n="$2"
+  
+  color=session${session_n}_note${note_n}_color
+  unset c0 c1 c2 c3 c4 c5 c6 c7
+  
+  case "$tpy[$color]" in
+    c000) c0=checked;;
+    c001) c1=checked;;
+    c010) c2=checked;;
+    c011) c3=checked;;
+    c100) c4=checked;;
+    c101) c5=checked;;
+    c110) c6=checked;;
+    *)    c7=checked;;
+  esac
+
+cat <<EOF
+  <fieldset class=note>
+    <input class=color type=radio name="$color" value="c000" id=${color}_000 $c0><label for=${color}_000></label>
+    <input class=color type=radio name="$color" value="c001" id=${color}_001 $c1><label for=${color}_001></label>
+    <input class=color type=radio name="$color" value="c010" id=${color}_010 $c2><label for=${color}_010></label>
+    <input class=color type=radio name="$color" value="c011" id=${color}_011 $c3><label for=${color}_011></label>
+    <input class=color type=radio name="$color" value="c100" id=${color}_100 $c4><label for=${color}_100></label>
+    <input class=color type=radio name="$color" value="c101" id=${color}_101 $c5><label for=${color}_101></label>
+    <input class=color type=radio name="$color" value="c110" id=${color}_110 $c6><label for=${color}_110></label>
+    <input class=color type=radio name="$color" value="c111" id=${color}_111 $c7><label for=${color}_111></label>
+    <textarea name="session${session_n}_note${note_n}">${tpy[session${session_n}_note${note_n}]}</textarea>
+  </fieldset>
+EOF
+}
+
+t_session(){
+  session_n="$1"
+
+  sid=session${session_n}
+
+  if [ "$tpy[${sid}_sigset]" = pos ]; then
+    sig=neg
+    sigcheck=checked
+  elif [ "$tpy[${sid}_sigset]" = neg ]; then
+    sig=pos
+    unset sigcheck
+  elif [ "$tpy[${sid}_signature]" = pos ]; then
+    sig=neg
+    sigcheck=checked
+  else
+    sig=pos
+    unset sigcheck
+  fi
+
+cat <<EOF
+  <input type=hidden name=$sid value=exists>
+  <input class="tab" type="checkbox" id=${sid}_open name="${sid}_open" value="checked" ${tpy[${sid}_open]}>
+  <label class="tab" for="${sid}_open">
+    <span class=no>${session_n}.</span><!--
+ --><span class=date>${tpy[${sid}_date]}</span><!--
+ --><input class="date" name="${sid}_date" value="${tpy[${sid}_date]}" placeholder="$(l10n date)"><!--
+ --><span class=therapist>${tpy[${sid}_therapist]}</span><!--
+ --><input class="therapist" name="${sid}_therapist" value="${tpy[${sid}_therapist]}" placeholder="$(l10n therapist)"><!--
+ --><span class=signature><input type=checkbox name="${sid}_signature" value=pos $sigcheck><button type=submit name=${sid}_sigset value=$sig></button></span>
+  </label>
+  <div class=tab>
+    <input class="dotmark ov" type="image" name=dotmark value="$sid" src="/therapies/${id%.tpy}_${sid}.png" alt="">
+    $(n=1; while [ -n "${tpy[${sid}_note${n}]+x}" ]; do
+      t_session_note $session_n $n
+      n=$(($n+1))
+    done
+    printf '<button type=submit name=%s_note%s value="">+</button>' "$sid" "$n"
+    )
+
+    <button class=delete type=submit name=delete_session value=${session_n}>$(l10n delete_session)</button>
+    <button type=submit>$(l10n save)</button>
+  </div>
+EOF
+}
+
+therapy_sessions(){
+  n=1; while [ -n "${tpy[session${n}]}" ]; do
+    t_session $n
+    n=$(($n+1))
+  done
+
+  sid=session$n
+
+cat <<EOF
+  <fieldset class="tab">
+    <span class=no>…</span><!--
+ --><input class=date name=${sid}_date value="" placeholder="$(l10n date)" /><!--
+ --><input class=therapist name=${sid}_therapist value="" placeholder="$(l10n therapist)" /><!--
+ --><button type=submit name=new_session value=$sid>+</button></span>
+    <input type=hidden name="${sid}_note1" value="">
+    <input type=hidden name="${sid}_open" value="checked">
+  </fieldset>
+EOF
+}
+
+unset c0 c1 c2 c3 c4 c5 c6 c7
+case "$tpy[color]" in
+  c001) c1=checked;;
+  c010) c2=checked;;
+  c011) c3=checked;;
+  c100) c4=checked;;
+  c101) c5=checked;;
+  c110) c6=checked;;
+  c111) c7=checked;;
+     *) c0=checked;;
+esac
+
 cat <<EOF
-<form method=GET action="">
   <h1>Behandlungen</h1>
 
   <div class="patient">
-    <h2>Flrbrlprrf Zoidberg</h2>
-    <a href="?p=patienten">&lt; zur Patientenliste</a>
-    <span class="insurance">Gemeinsame Betriebskrankenkasse der Gesellschaften der Textilgruppe Hof</span>
+    <h2>$client_name</h2>
+    <a href="?p=prescriptions&amp;client=${id%%.*}.vcf">&lt; $(l10n prescriptionlist)</a>
   </div>
 
   <div class="prescription">
-    <h2>Verordnung</h2>
-    <button type=submit name=prescreviewed value=pos>Verordnung geprüft</button>
+    <h2>$(l10n therapy_prescription)</h2>
+    <span class="insurance">${mpx[insurance]}</span>
+    <label class="checkbox ${mpx[prescreviewed]:+checked}" for="prescreviewed">
+      $([ -n "${mpx[prescreviewed]}" ] && printf %s "$(l10n prescreviewed)" \
+                                       || printf %s "$(l10n prescreview)" )
+    </label>
     <ul>
-      <li>6x MT</li>
-      <li>6x Fango</li>
+      ${mpx[remidy]:+ <li>${mpx[quantity]}  ${mpx[remidy]}</li>}
+      ${mpx[remidy1]:+<li>${mpx[quantity1]} ${mpx[remidy1]}</li>}
     </ul>
-    ???
-    <button type=submit name=extrapay      value=neg>Zuzahlung</button>
+
+    ${mpx[addcontrib]:+
+    <label class='checkbox ${mpx[contribconfirm]:+checked}' for="addcontrib">
+      $([ -n "${mpx[contribconfirm]}" ] && printf %s "$(l10n contribconfirm)" ${mpx[contribconfirm]} \
+                                        || printf %s "$(l10n addcontrib)" )
+    </label>
+    }
   </div>
 
+<form method="POST" action="?action=update_therapy">
+  <input type="hidden" name="id" value="${id}">
+
   <label class="tab heading">
     <span class=no>Nr.</span><!--
  --><span class=date>Datum</span><!--
@@ -43,99 +163,20 @@ cat <<EOF
  --><span class=signature>Sig.</span>
   </label>
 
-  <input class="tab" type="checkbox" id=2015-10-15-1>
-  <label class="tab" for=2015-10-15-1>
-    <span class=no>1.</span><!--
- --><span class=date>15.10.2015</span><!--
- --><span class=therapist>Josh</span><!--
- --><span class=signature><button type=submit name=2015-10-15-1_sig value=pos></button></span>
-  </label>
-  <div class=tab>
-    <img class="dotmark ov" src="therapy_ov2015-10-15-1.png" alt="">
-
-    <fieldset class=note>
-      <input class=color type=radio name=2015-10-15-1_c1 value="c000" id=2015-10-15-1_c1c000><label for=2015-10-15-1_c1c000></label>
-      <input class=color type=radio name=2015-10-15-1_c1 value="c001" id=2015-10-15-1_c1c001><label for=2015-10-15-1_c1c001></label>
-      <input class=color type=radio name=2015-10-15-1_c1 value="c010" id=2015-10-15-1_c1c010><label for=2015-10-15-1_c1c010></label>
-      <input class=color type=radio name=2015-10-15-1_c1 value="c011" id=2015-10-15-1_c1c011 checked><label for=2015-10-15-1_c1c011></label>
-      <input class=color type=radio name=2015-10-15-1_c1 value="c100" id=2015-10-15-1_c1c100><label for=2015-10-15-1_c1c100></label>
-      <input class=color type=radio name=2015-10-15-1_c1 value="c101" id=2015-10-15-1_c1c101><label for=2015-10-15-1_c1c101></label>
-      <input class=color type=radio name=2015-10-15-1_c1 value="c110" id=2015-10-15-1_c1c110><label for=2015-10-15-1_c1c110></label>
-      <input class=color type=radio name=2015-10-15-1_c1 value="c111" id=2015-10-15-1_c1c111><label for=2015-10-15-1_c1c111></label>
-      <textarea name=2015-10-15-1_n1>
-Unfall 3.9.2015
-Bruch Oberarm rechts
-      </textarea>
-    </fieldset>
-
-    <fieldset class=note>
-      <input class=color type=radio name=2015-10-15-1_c2 value="c000" id=2015-10-15-1_c2c000><label for=2015-10-15-1_c2c000></label>
-      <input class=color type=radio name=2015-10-15-1_c2 value="c001" id=2015-10-15-1_c2c001><label for=2015-10-15-1_c2c001></label>
-      <input class=color type=radio name=2015-10-15-1_c2 value="c010" id=2015-10-15-1_c2c010><label for=2015-10-15-1_c2c010></label>
-      <input class=color type=radio name=2015-10-15-1_c2 value="c011" id=2015-10-15-1_c2c011><label for=2015-10-15-1_c2c011></label>
-      <input class=color type=radio name=2015-10-15-1_c2 value="c100" id=2015-10-15-1_c2c100 checked><label for=2015-10-15-1_c2c100></label>
-      <input class=color type=radio name=2015-10-15-1_c2 value="c101" id=2015-10-15-1_c2c101><label for=2015-10-15-1_c2c101></label>
-      <input class=color type=radio name=2015-10-15-1_c2 value="c110" id=2015-10-15-1_c2c110><label for=2015-10-15-1_c2c110></label>
-      <input class=color type=radio name=2015-10-15-1_c2 value="c111" id=2015-10-15-1_c2c111><label for=2015-10-15-1_c2c111></label>
-      <textarea name=2015-10-15-1_n2>
-Medikamentenallergie
-Komplikationen
-6. Rippe instabil
-      </textarea>
-    </fieldset>
-
-    <fieldset class=note>
-      <input class=color type=radio name=2015-10-15-1_c3 value="c000" id=2015-10-15-1_c3c000><label for=2015-10-15-1_c3c000></label>
-      <input class=color type=radio name=2015-10-15-1_c3 value="c001" id=2015-10-15-1_c3c001><label for=2015-10-15-1_c3c001></label>
-      <input class=color type=radio name=2015-10-15-1_c3 value="c010" id=2015-10-15-1_c3c010><label for=2015-10-15-1_c3c010></label>
-      <input class=color type=radio name=2015-10-15-1_c3 value="c011" id=2015-10-15-1_c3c011><label for=2015-10-15-1_c3c011></label>
-      <input class=color type=radio name=2015-10-15-1_c3 value="c100" id=2015-10-15-1_c3c100><label for=2015-10-15-1_c3c100></label>
-      <input class=color type=radio name=2015-10-15-1_c3 value="c101" id=2015-10-15-1_c3c101><label for=2015-10-15-1_c3c101></label>
-      <input class=color type=radio name=2015-10-15-1_c3 value="c110" id=2015-10-15-1_c3c110><label for=2015-10-15-1_c3c110></label>
-      <input class=color type=radio name=2015-10-15-1_c3 value="c111" id=2015-10-15-1_c3c111><label for=2015-10-15-1_c3c111></label>
-      <textarea name=2015-10-15-1_n3>
-      </textarea>
-    </fieldset>
-    <button type=submit name=edit value=2015-10-15-1_note3>Speichern</button>
-  </div>
-
-
-  <input class=tab type="checkbox" id=2015-10-22-1>
-  <label class=tab for=2015-10-22-1>
-    <span class=no>2.</span><!--
- --><span class=date>22.10.2015</span><!--
- --><span class=therapist>Josh</span><!--
- --><span class=signature><button type=submit name=2015-10-22-1_sig value=neg></button></span>
-  </label>
-  <div class=tab>
-    <img class="dotmark ov" src="therapy_ov2015-10-22-1.png" alt="">
-
-    <fieldset class=note>
-      <input class=color type=radio name=2015-10-22-1_c1 value="c000" id=2015-10-22-1_c1c000><label for=2015-10-22-1_c1c000></label>
-      <input class=color type=radio name=2015-10-22-1_c1 value="c001" id=2015-10-22-1_c1c001><label for=2015-10-22-1_c1c001></label>
-      <input class=color type=radio name=2015-10-22-1_c1 value="c010" id=2015-10-22-1_c1c010><label for=2015-10-22-1_c1c010></label>
-      <input class=color type=radio name=2015-10-22-1_c1 value="c011" id=2015-10-22-1_c1c011><label for=2015-10-22-1_c1c011></label>
-      <input class=color type=radio name=2015-10-22-1_c1 value="c100" id=2015-10-22-1_c1c100><label for=2015-10-22-1_c1c100></label>
-      <input class=color type=radio name=2015-10-22-1_c1 value="c101" id=2015-10-22-1_c1c101><label for=2015-10-22-1_c1c101></label>
-      <input class=color type=radio name=2015-10-22-1_c1 value="c110" id=2015-10-22-1_c1c110><label for=2015-10-22-1_c1c110></label>
-      <input class=color type=radio name=2015-10-22-1_c1 value="c111" id=2015-10-22-1_c1c111><label for=2015-10-22-1_c1c111></label>
-      <textarea name=2015-10-22-1_n1>
-      </textarea>
-    </fieldset>
-    <button type=submit name=edit value=2015-10-22-1_note3>Speichern</button>
-  </div>
+  $(therapy_sessions)
 
   <fieldset class=color>
-    <input class=color type=radio name=color value="c000" id=c000><label for=c000></label>
-    <input class=color type=radio name=color value="c001" id=c001><label for=c001></label>
-    <input class=color type=radio name=color value="c010" id=c010><label for=c010></label>
-    <input class=color type=radio name=color value="c011" id=c011><label for=c011></label>
-    <input class=color type=radio name=color value="c100" id=c100 checked><label for=c100></label>
-    <input class=color type=radio name=color value="c101" id=c101><label for=c101></label>
-    <input class=color type=radio name=color value="c110" id=c110><label for=c110></label>
-    <input class=color type=radio name=color value="c111" id=c111><label for=c111></label>
+    <input class=color type=radio name=color value="c000" id=c000 $c0><label for=c000></label>
+    <input class=color type=radio name=color value="c001" id=c001 $c1><label for=c001></label>
+    <input class=color type=radio name=color value="c010" id=c010 $c2><label for=c010></label>
+    <input class=color type=radio name=color value="c011" id=c011 $c3><label for=c011></label>
+    <input class=color type=radio name=color value="c100" id=c100 $c4><label for=c100></label>
+    <input class=color type=radio name=color value="c101" id=c101 $c5><label for=c101></label>
+    <input class=color type=radio name=color value="c110" id=c110 $c6><label for=c110></label>
+    <input class=color type=radio name=color value="c111" id=c111 $c7><label for=c111></label>
   </fieldset>
-  <img class="dotmark bg" src="therapy_background.png" alt="">
+  <img class="dotmark bg" src="?action=static_file&amp;name=therapy_background.png" alt="">
+
 </form>
 
 EOF