_POST[2N]="${_POST[2N]//;/,}"
_POST[3N]="${_POST[3N]//;/,}"
_POST[4N]="${_POST[4N]//;/,}"
-[ -n "${_POST[hi_number]}" -o -n "${_POST[hi_company]}" ] \
-&& _POST[X-HEALTH-INSURANCE]="${_POST[hi_number]//;/,};${_POST[hi_company]//;/,}"
+
+[ "$_POST[hi_select]" = "list" ] && hi_company="${_POST[hi_company]}" || hi_company="${_POST[hi_other]}"
+[ -n "${_POST[hi_company]}${_POST[hi_number]}${_POST[hi_status]}" ] \
+&& _POST[X-HEALTH-INSURANCE]="${hi_company//;/,};${_POST[hi_number]//;/,};${_POST[hi_status]//;/,}"
sed -r 's;$;\r;' >"$tempfile" <<EOF
BEGIN:VCARD
done |sort |sed -r 's:^.*\t(.*/)([^/]+)$:\2:'
}
+list_hi_companies(){
+ sed -rn 's;^X-HEALTH-INSURANCE:([^\;]+)\;.*$;\1;p' ${_DATA}/vcard/*vcf
+}
+
listcards() {
case "${_GET[filtertype]}" in
any)
word-wrap: break-word;
}
+form.card .section input[type=text],
+form.card .section input:not([type]),
+form.card .section textarea,
+form.card .section select {width: 100%;}
+
form.card .attendance {
min-width: 66%;
}
margin-left: -3ex;
}
+form.card .insurance input[type=radio] {display: none;}
+form.card .insurance input[type=radio] + label {
+ display: inline-block;
+ width: 50%;
+ padding: .25ex 0;
+ text-align: center;
+ border: 1px solid black;
+
+}
+form.card .insurance input[type=radio]:checked + label {
+ font-weight: bold;
+ background-color: #FFF;
+ border-width: 1px 1px 0 1px;
+}
+form.card .insurance input[type=radio] + label + input + label + select,
+form.card .insurance input[type=radio] + label + select + input {display: none;}
+form.card .insurance input[type=radio]:checked + label + input + label + select,
+form.card .insurance input[type=radio]:checked + label + select + input {
+ display: block;
+ border: 1px solid black;
+ border-width: 0 1px 1px 1px;
+ padding: .25ex 0;
+ margin-top: -1px;
+ background-color: #FFF;
+}
+
.card .section .item {
display: block;
max-width: 100%;
max-height: 10em;
}
-
EOF
# vi:set filetype=css:
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_number="${values[X-HEALTH-INSURANCE]%;*}"
-hi_company="${values[X-HEALTH-INSURANCE]#*;}"
+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)
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">'
<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="$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>
)
fullname="${n:-${values[FN]:-${values[NICKNAME]}}}"
-hi_number="${values[X-HEALTH-INSURANCE]%;*}"
-hi_company="${values[X-HEALTH-INSURANCE]#*;}"
+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)"
+
cat <<END_HTML
<div class="section basic">
<h3>$(l10n X-HEALTH-INSURANCE)</h3>
${hi_company:+<span class="item hi_comapany">${hi_company}</span>}
${hi_number:+<span class="item hi_number"><label>$(l10n hi_number):</label> ${hi_number}</span>}
+ ${hi_status:+<span class="item hi_status"><label>$(l10n hi_status):</label> ${hi_status}</span>}
</div><!--
--><div class="section note">