1 # Copyright 2014 - 2016 Paul Hänsch
3 # This file is part of Confetti.
5 # Confetti is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # Confetti is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public License
16 # along with Confetti. If not, see <http://www.gnu.org/licenses/>.
19 [ "$values[GENDER]" = "$1" ] && echo 'selected="selected"'
22 egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && echo 'checked="checked"'
25 n_last="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){0} *([^;]*).*$:\2:p')"
26 n_first="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){1} *([^;]*).*$:\2:p')"
27 n_middle="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){2} *([^;]*).*$:\2:p')"
28 n_pre="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){3} *([^;]*).*$:\2:p')"
29 n_post="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){4} *([^;]*)*$:\2:p')"
31 hi_company="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f1)"
32 hi_number="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f2)"
33 hi_status="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f3)"
35 SUP_FIELDS=(N NICKNAME GENDER BDAY ADR TEL EMAIL X-HEALTH-INSURANCE X-HEALTH-INSURANCE-NOCONTRIB IMPP URL NOTE X-CLIENT-REFERRAL)
37 [ -z "$values[UID]" ] && values[UID]="$(uuidgenerator)"
40 <form id="$id" class="card" action="?action=update_card" method="POST">
41 <input type="hidden" name="card" value="${id}"/>
42 <div class="section basic">
44 <input class="item N" name="3N" placeholder="$(l10n n_pre)" value="$n_pre" />
45 <input class="item N" name="1N" placeholder="$(l10n n_first)" value="$n_first" />
46 <input class="item N" name="2N" placeholder="$(l10n n_middle)" value="$n_middle" />
47 <input class="item N" name="0N" placeholder="$(l10n n_last)" value="$n_last" />
48 <input class="item N" name="4N" placeholder="$(l10n n_post)" value="$n_post" />
50 <select class="item GENDER" name="GENDER">
51 <option value="" disabled="disabled">$(l10n GENDER)</option>
52 <option value="female" $(check_gen female)>$(l10n gender_female)</option>
53 <option value="male" $(check_gen male)>$(l10n gender_male)</option>
54 <option value="other" $(check_gen other)>$(l10n gender_other)</option>
55 <option value="none" $(check_gen none)>$(l10n gender_none)</option>
58 $(for n in NICKNAME NICKNAME{0..10}; do
59 echo "${values[$n]:+<input class="item NICKNAME" name="NICKNAME" placeholder="$(l10n NICKNAME)" value="$values[$n]" />}"
63 <input class="item BDAY" name="BDAY" value="$values[BDAY]" placeholder="YYYY-MM-DD" />
65 $(if [ -n "$values[SOUND]" ]; then
66 echo ' <audio controls="controls" class="item SOUND">'
67 echo ' <source type="audio/ogg" src="data:audio/ogg;base64,'$values[SOUND]'" />'
70 ${values[PHOTO]:+<img class="item PHOTO" src="data:image/$tags[PHOTO_TYPE];base64,$values[PHOTO]" />}
71 ${values[LOGO]:+<img class="item LOGO" src="data:image/$tags[LOGO_TYPE];base64,$values[LOGO]" />}
74 <div class="section address">
76 <textarea class="item ADR" name="ADR">$values[ADR]</textarea>
77 $(for n in ADR{0..10}; do
78 echo "${values[$n]:+<textarea class="item ADR" name="ADR">$values[$n]</textarea>}"
80 ${values[URL]:+<h3>$(l10n URL)</h3>}
81 $(for n in URL URL{0..10}; do
82 echo "${values[$n]:+<input class="item URL" name="URL" value="$values[$n]" />}"
86 <div class="section phone">
88 <input class="item TEL" name="TEL" value="$values[TEL]" />
89 $(for n in TEL{0..10}; do
90 echo "${values[$n]:+<input class="item TEL" name="TEL" value="'$values[$n]'" />}"
92 ${values[EMAIL]:+<h3>$(l10n EMAIL)</h3>}
93 $(for n in EMAIL EMAIL{0..10}; do
94 echo "${values[$n]:+<input class="item EMAIL" name="EMAIL" value="$values[$n]" />}"
96 ${values[IMPP]:+<h3>$(l10n IMPP)</h3>}
97 $(for n in IMPP IMPP{0..10}; do
98 echo "${values[$n]:+<input class="item IMPP" name="IMPP" value="$values[$n]" />}"
102 <div class="section insurance">
103 <h3>$(l10n X-HEALTH-INSURANCE)</h3>
104 <input type="radio" name="hi_select" value="list" id="hi_select_list" checked /><label for="hi_select_list">$(l10n hi_from_list)</label><!--
105 --><input type="radio" name="hi_select" value="other" id="hi_other"><label for="hi_other">$(l10n hi_other)</label>
106 <select class="item" name="hi_company">
107 <option value="" disabled="disabled" ${hi_company:-selected}>$(l10n hi_company)</option>
108 $(list_hi_companies |while read f; do
109 [ "$f" = "$hi_company" ] \
110 && printf '<option value="%s" selected>%s</option>' "$f" "$f" \
111 || printf '<option value="%s">%s</option>' "$f" "$f"
114 <input type="text" name="hi_other" value="$hi_company" placeholder="$(l10n hi_company)" />
115 <input name="hi_number" value="$hi_number" placeholder="$(l10n hi_number)" />
116 <input name="hi_status" value="$hi_status" placeholder="$(l10n hi_status)" />
120 <div class="section note">
121 <h3>$(l10n NOTE)</h3>
122 <textarea class="item NOTE" name="NOTE">$values[NOTE]</textarea>
123 $(for n in NOTE{0..10}; do
124 echo "${values[$n]:+<textarea class="item NOTE" name="NOTE">$values[$n]</textarea>}"
126 <h3>$(l10n X-CLIENT-REFERRAL)</h3>
127 <input class="item X-CLIENT-REFERRAL" name="X-CLIENT-REFERRAL" value="$values[X-CLIENT-REFERRAL]" />
128 $(for n in X-CLIENT-REFERRAL{0..10}; do
129 echo "${values[$n]:+<input class="item X-CLIENT-REFERRAL" name="X-CLIENT-REFERRAL" value="'$values[$n]'" />}"
133 <div class="control">
134 <select class="item" name="newfield">
135 <option value="" disabled="disabled" selected="selected">$(l10n edit_addfieldtext)</option>
136 $(for f in $SUP_FIELDS; do echo "<option value=\"$f\">$(l10n $f)</option>"; done)
138 ><button class="item" type="submit" name="action" value="addfield">$(l10n edit_addfield)</button>
139 <button class="item" type="submit" name="action" value="update">$(l10n edit_update)</button>
140 <button class="item" type="submit" name="action" value="delete">$(l10n edit_delete)</button>
141 <button class="item" type="submit" name="action" value="cancel">$(l10n edit_cancel)</button>
143 <input type="hidden" name="UID" value="$values[UID]"/>