From e75452be58238e3ff873a7fee7d21153b81173dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Tue, 10 Dec 2019 12:12:16 +0100 Subject: [PATCH] (re)introduced widget for health insurance --- cards/update_card.sh | 14 ++++++++++++++ cards/widgets.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/cards/update_card.sh b/cards/update_card.sh index 34db10c..9d56c50 100755 --- a/cards/update_card.sh +++ b/cards/update_card.sh @@ -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")")")" diff --git a/cards/widgets.sh b/cards/widgets.sh index 35086eb..4d0f733 100755 --- a/cards/widgets.sh +++ b/cards/widgets.sh @@ -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]' \ -- 2.39.2