]> git.plutz.net Git - confetti/blobdiff - templates/edit_client.sh
data retriever for therapy section, some prescription improvements
[confetti] / templates / edit_client.sh
index ddb33c3d352492d886b3e8fd4d191d6ad2ca0ef6..586fa697b074d2d1502f79807ae175ae2438a64b 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2014, 2015 Paul Hänsch
+# Copyright 2014 - 2016 Paul Hänsch
 #
 # This file is part of Confetti.
 # 
@@ -22,11 +22,15 @@ check_a() {
   egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && echo 'checked="checked"'
 }
 
-n_last="$(echo "$values[N]" |sed -rn 's:^([^;]*;){0} *([^;]*).*$:\2:p')"
-n_first="$(echo "$values[N]" |sed -rn 's:^([^;]*;){1} *([^;]*).*$:\2:p')"
-n_middle="$(echo "$values[N]" |sed -rn 's:^([^;]*;){2} *([^;]*).*$:\2:p')"
-n_pre="$(echo "$values[N]" |sed -rn 's:^([^;]*;){3} *([^;]*).*$:\2:p')"
-n_post="$(echo "$values[N]" |sed -rn 's:^([^;]*;){4} *([^;]*)*$:\2:p')"
+n_last="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){0} *([^;]*).*$:\2:p')"
+n_first="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){1} *([^;]*).*$:\2:p')"
+n_middle="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){2} *([^;]*).*$:\2:p')"
+n_pre="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){3} *([^;]*).*$:\2:p')"
+n_post="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){4} *([^;]*)*$:\2:p')"
+
+hi_company="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f1)"
+hi_number="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f2)"
+hi_status="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f3)"
 
 SUP_FIELDS=(N NICKNAME GENDER BDAY ADR TEL EMAIL X-HEALTH-INSURANCE X-HEALTH-INSURANCE-NOCONTRIB IMPP URL NOTE X-CLIENT-REFERRAL)
 
@@ -56,7 +60,7 @@ cat <<END_HTML
     done)
 
     <h3>$(l10n BDAY)</h3>
-    <input class="item BDAY" name="BDAY" value="$values[BDAY]" />
+    <input class="item BDAY" name="BDAY" value="$values[BDAY]" placeholder="YYYY-MM-DD" />
 
     $(if [ -n "$values[SOUND]" ]; then
       echo '    <audio controls="controls" class="item SOUND">'
@@ -97,11 +101,19 @@ cat <<END_HTML
 
   <div class="section insurance">
     <h3>$(l10n X-HEALTH-INSURANCE)</h3>
+    <input type="radio" name="hi_select" value="list" id="hi_select_list" checked /><label for="hi_select_list">$(l10n hi_from_list)</label><!--
+    --><input type="radio" name="hi_select" value="other" id="hi_other"><label for="hi_other">$(l10n hi_other)</label>
     <select class="item" name="hi_company">
-      <option value="" disabled="disabled" selected="selected">$(l10n hi_company)</option>
-      $(list_hi_companies |while read f; do echo "<option value=\"$f\">$(l10n $f)</option>"; done)
+      <option value="" disabled="disabled" ${hi_company:-selected}>$(l10n hi_company)</option>
+      $(list_hi_companies |while read f; do
+        [ "$f" = "$hi_company" ] \
+        && printf '<option value="%s" selected>%s</option>' "$f" "$f" \
+        || printf '<option value="%s">%s</option>' "$f" "$f"
+      done)
     </select>
-    <input class="item hi_number" name="hi_number" value="$values[hi_number]" placeholder="$(l10n hi_number)" />
+    <input type="text" name="hi_other" value="$hi_company" placeholder="$(l10n hi_company)" />
+    <input name="hi_number" value="$hi_number" placeholder="$(l10n hi_number)" />
+    <input name="hi_status" value="$hi_status" placeholder="$(l10n hi_status)" />
 
   </div>