]> git.plutz.net Git - lobster/commitdiff
(re)introduced widget for health insurance
authorPaul Hänsch <paul@plutz.net>
Tue, 10 Dec 2019 11:12:16 +0000 (12:12 +0100)
committerPaul Hänsch <paul@plutz.net>
Tue, 10 Dec 2019 11:12:16 +0000 (12:12 +0100)
cards/update_card.sh
cards/widgets.sh

index 34db10cfb740bdf23493b1590b221c8167b3581a..9d56c50e5de4793c1eec16c1d88630534a9cc996 100755 (executable)
@@ -71,6 +71,20 @@ for field in $(POST_KEYS |grep -xE '[A-Z][A-Z0-9-]*'); do
       # (TEL)
       #   printf '%s;TYPE=%s:%s\r\n' "${field}" "${_POST[phonetype${key#TEL}]}" "$(vcf_escape "$(POST "$field" "$cnt")")"
       #   ;;
+      X-HEALTH-INSURANCE)
+        hi_select="$(POST "$field" "$cnt")"
+        if [ "$hi_select" = list ]; then
+          vcf="$(pdi_update_value "$vcf" "$field" "$cnt" "$(vcf_escape "$(POST "hi_company" "$cnt")" \
+                                                                       "$(POST "hi_number" "$cnt")" \
+                                                                       "$(POST "hi_status" "$cnt")" \
+                                                          )")"
+        elif [ "$hi_select" = other ]; then
+          vcf="$(pdi_update_value "$vcf" "$field" "$cnt" "$(vcf_escape "$(POST "hi_other" "$cnt")" \
+                                                                       "$(POST "hi_number" "$cnt")" \
+                                                                       "$(POST "hi_status" "$cnt")" \
+                                                          )")"
+        fi
+        ;;
       TEL)
          vcf="$(pdi_update_attrib "$vcf" TEL $cnt TYPE="$(POST teltype $cnt |grep -Exm1 'HOME|WORK|CELL|FAX')")"
          vcf="$(pdi_update_value "$vcf" "$field" "$cnt" "$(vcf_escape "$(POST "$field" "$cnt")")")"
index 35086eb6abb4e7cd3d8c857840f9337502ed9214..4d0f7337cbc22fbab0d6c1f1093caa51d92d43c5 100755 (executable)
@@ -230,6 +230,33 @@ edit_item(){
         done
         printf '[button type="submit" name="action" value="addfield %s" %s ]' "$item" "$(l10n edit_addfield)"
         ;;
+      X-HEALTH-INSURANCE)
+        printf '[h3 %s]' "$(l10n "$item")"
+        seq 1 $cnt |while read c; do
+          # printf '[checkbox "%s_delete_%i" "true" .delete #%s_delete_%i][label for="%s_delete_%i" %s]' \
+          #   "$item" $c "$item" $c "$item" $c "$(l10n delete)"
+          IFS=\; read -r hi_name hi_number hi_status <<-EOF
+               $(pdi_value "$card" X-HEALTH-INSURANCE $c)
+               EOF
+          cat <<-EOF
+               [input type="radio" name="$item" value="list" #hi_select_list checked]<!--
+               -->[label for="hi_select_list" $(l10n hi_from_list)]<!--
+               -->[input type="radio" name="$item" value="other" #hi_other checked]<!--
+               -->[label for="hi_other" $(l10n hi_other)]<!--
+               -->[select class="item" name="hi_company"
+                 [option value="" disabled="disabled" $(selected "${hi_name}" "") . $(l10n hi_company)]
+                 $(list_hi_companies |while read f; do
+                   printf '[option value="%s" %s . %s]' "$(unescape "$f" |HTML)" \
+                                                        "$(selected "$f" "$hi_name")" \
+                                                        "$(unescape "$f" |HTML)"
+                 done)
+               ]
+               [input type="text" name="hi_other" value="$hi_name" placeholder="$(l10n hi_company)"]
+               [input name="hi_number" value="$(unescape "$hi_number" |HTML)" placeholder="$(l10n hi_number)"]
+               [input name="hi_status" value="$(unescape "$hi_status" |HTML)" placeholder="$(l10n hi_status)"]
+               EOF
+        done
+        ;;
       *)printf '[h3 %s]' "$(l10n "$item")"
         seq 1 $cnt |while read c; do
           printf '[checkbox "%s_delete_%i" "true" .delete #%s_delete_%i][label for="%s_delete_%i" %s]' \