--- /dev/null
+# Copyright 2014, 2015 Paul Hänsch
+#
+# This file is part of Confetti.
+#
+# Confetti is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Confetti is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
+
+check_gen() {
+ [ "$values[GENDER]" = "$1" ] && echo 'selected="selected"'
+}
+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')"
+
+SUP_FIELDS=(N NICKNAME GENDER BDAY ADR TEL EMAIL X-HEALTH-INSURANCE X-HEALTH-INSURANCE-NOCONTRIB IMPP URL NOTE X-CLIENT-REFERRAL)
+
+[ -z "$values[UID]" ] && values[UID]="$(uuidgenerator)"
+
+cat <<END_HTML
+<form id="$id" class="card" action="?action=update_card" method="POST">
+ <input type="hidden" name="card" value="${id}"/>
+ <div class="section basic">
+ <h3>$(l10n N)</h3>
+ <input class="item N" name="3N" placeholder="$(l10n n_pre)" value="$n_pre" />
+ <input class="item N" name="1N" placeholder="$(l10n n_first)" value="$n_first" />
+ <input class="item N" name="2N" placeholder="$(l10n n_middle)" value="$n_middle" />
+ <input class="item N" name="0N" placeholder="$(l10n n_last)" value="$n_last" />
+ <input class="item N" name="4N" placeholder="$(l10n n_post)" value="$n_post" />
+
+ <select class="item GENDER" name="GENDER">
+ <option value="" disabled="disabled">$(l10n GENDER)</option>
+ <option value="female" $(check_gen female)>$(l10n gender_female)</option>
+ <option value="male" $(check_gen male)>$(l10n gender_male)</option>
+ <option value="other" $(check_gen other)>$(l10n gender_other)</option>
+ <option value="none" $(check_gen none)>$(l10n gender_none)</option>
+ </select>
+
+ $(for n in NICKNAME NICKNAME{0..10}; do
+ echo "${values[$n]:+<input class="item NICKNAME" name="NICKNAME" placeholder="$(l10n NICKNAME)" value="$values[$n]" />}"
+ done)
+
+ <h3>$(l10n BDAY)</h3>
+ <input class="item BDAY" name="BDAY" value="$values[BDAY]" />
+
+ $(if [ -n "$values[SOUND]" ]; then
+ echo ' <audio controls="controls" class="item SOUND">'
+ echo ' <source type="audio/ogg" src="data:audio/ogg;base64,'$values[SOUND]'" />'
+ echo ' </audio>'
+ fi)
+ ${values[PHOTO]:+<img class="item PHOTO" src="data:image/$tags[PHOTO_TYPE];base64,$values[PHOTO]" />}
+ ${values[LOGO]:+<img class="item LOGO" src="data:image/$tags[LOGO_TYPE];base64,$values[LOGO]" />}
+ </div>
+
+ <div class="section address">
+ <h3>$(l10n ADR)</h3>
+ <textarea class="item ADR" name="ADR">$values[ADR]</textarea>
+ $(for n in ADR{0..10}; do
+ echo "${values[$n]:+<textarea class="item ADR" name="ADR">$values[$n]</textarea>}"
+ done)
+ ${values[URL]:+<h3>$(l10n URL)</h3>}
+ $(for n in URL URL{0..10}; do
+ echo "${values[$n]:+<input class="item URL" name="URL" value="$values[$n]" />}"
+ done)
+ </div>
+
+ <div class="section phone">
+ <h3>$(l10n TEL)</h3>
+ <input class="item TEL" name="TEL" value="$values[TEL]" />
+ $(for n in TEL{0..10}; do
+ echo "${values[$n]:+<input class="item TEL" name="TEL" value="'$values[$n]'" />}"
+ done)
+ ${values[EMAIL]:+<h3>$(l10n EMAIL)</h3>}
+ $(for n in EMAIL EMAIL{0..10}; do
+ echo "${values[$n]:+<input class="item EMAIL" name="EMAIL" value="$values[$n]" />}"
+ done)
+ ${values[IMPP]:+<h3>$(l10n IMPP)</h3>}
+ $(for n in IMPP IMPP{0..10}; do
+ echo "${values[$n]:+<input class="item IMPP" name="IMPP" value="$values[$n]" />}"
+ done)
+ </div>
+
+ <div class="section insurance">
+ <h3>$(l10n X-HEALTH-INSURANCE)</h3>
+ <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)
+ </select>
+ <input class="item hi_number" name="hi_number" value="$values[hi_number]" placeholder="$(l10n hi_number)" />
+
+ </div>
+
+ <div class="section note">
+ <h3>$(l10n NOTE)</h3>
+ <textarea class="item NOTE" name="NOTE">$values[NOTE]</textarea>
+ $(for n in NOTE{0..10}; do
+ echo "${values[$n]:+<textarea class="item NOTE" name="NOTE">$values[$n]</textarea>}"
+ done)
+ <h3>$(l10n X-CLIENT-REFERRAL)</h3>
+ <input class="item X-CLIENT-REFERRAL" name="X-CLIENT-REFERRAL" value="$values[X-CLIENT-REFERRAL]" />
+ $(for n in X-CLIENT-REFERRAL{0..10}; do
+ echo "${values[$n]:+<input class="item X-CLIENT-REFERRAL" name="X-CLIENT-REFERRAL" value="'$values[$n]'" />}"
+ done)
+ </div>
+
+ <div class="control">
+ <select class="item" name="newfield">
+ <option value="" disabled="disabled" selected="selected">$(l10n edit_addfieldtext)</option>
+ $(for f in $SUP_FIELDS; do echo "<option value=\"$f\">$(l10n $f)</option>"; done)
+ </select
+ ><button class="item" type="submit" name="action" value="addfield">$(l10n edit_addfield)</button>
+ <button class="item" type="submit" name="action" value="update">$(l10n edit_update)</button>
+ <button class="item" type="submit" name="action" value="delete">$(l10n edit_delete)</button>
+ <button class="item" type="submit" name="action" value="cancel">$(l10n edit_cancel)</button>
+ </div>
+ <input type="hidden" name="UID" value="$values[UID]"/>
+</form>
+END_HTML
-# Copyright 2014 Paul Hänsch
+# Copyright 2014, 2016 Paul Hänsch
#
# This file is part of Confetti.
#
# You should have received a copy of the GNU Affero General Public License
# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
-declare -A item_name
-
item_name[PHOTO]="Foto"
item_name[LOGO]="Logo"
item_name[FN]="Voller Name"
item_name[VERSION]=""
item_name[XML]=""
+item_name[X-HEALTH-INSURANCE]="Krankenversicherung"
+item_name[hi_company]="Versicherungsgesellschaft"
+item_name[hi_number]="Versichertennummer"
+item_name[hi_status]="Versichertenstatus"
+item_name[X-HEALTH-INSURANCE-NOCONTRIB]="Zuzahlungsbefreiung"
+item_name[X-CLIENT-REFERRAL]="Empfehlung durch"
+item_name[prescriptions]="Verordnungen"
+
item_name[X-ZACK-JOINDATE]="Anmeldedatum"
item_name[X-ZACK-LEAVEDATE]="Abmeldedatum"
item_name[label_join]="Anm."
item_name[male]="♂"
item_name[other]="⚥"
item_name[none]="⚪"
+
--- /dev/null
+# Copyright 2014 - 2016 Paul Hänsch
+#
+# This file is part of Confetti.
+#
+# Confetti is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Confetti is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
+
+cat <<END_HTML
+ <div class="section basic">
+ <h2 class="item FN">$values[FN]</h2>
+ ${values[GENDER]:+<span class="item GENDER">$(l10n $values[GENDER])</span>}
+
+ $(for n in NICKNAME NICKNAME{0..10}; do
+ echo "${values[$n]:+<span class="item NICKNAME">aka. $values[$n]</span>}"
+ done)
+
+ ${values[BDAY]:+<span class="item BDAY"><b>*:</b> $values[BDAY]</span>}
+ ${values[X-ZACK-JOINDATE]:+<span class="item X-ZACK-JOINDATE"><b>$(l10n label_join):</b> $values[X-ZACK-JOINDATE]</span>}
+ ${values[X-ZACK-LEAVEDATE]:+<span class="item X-ZACK-LEAVEDATE"><b>$(l10n label_leave):</b> $values[X-ZACK-LEAVEDATE]</span>}
+ ${values[SOUND]:+<audio controls="controls" class="item SOUND"><source type="audio/ogg" src="data:audio/ogg;base64,$values[SOUND]" /></audio>}
+ ${values[PHOTO]:+<img class="item PHOTO" src="data:image/$tags[PHOTO_TYPE];base64,$values[PHOTO]" />}
+ ${values[LOGO]:+<img class="item LOGO" src="data:image/$tags[LOGO_TYPE];base64,$values[LOGO]" />}
+ </div><!--
+
+ --><div class="section address">
+ <h3>$(l10n ADR)</h3>
+ $(for n in ADR ADR{0..10}; do
+ echo "${values[$n]:+<span class="item ADR">$values[$n]</span>}"
+ done)
+ ${values[URL]:+<h3>$(l10n URL)</h3>}
+ $(for n in URL URL{0..10}; do
+ echo "${values[$n]:+<span class="item URL"><a href="$values[$n]">$values[$n]</a></span>}"
+ done)
+ </div><!--
+
+ --><div class="section phone">
+ <h3>$(l10n TEL)</h3>
+ $(for n in TEL TEL{0..10}; do
+ echo "${values[$n]:+<span class="item TEL">$tags[${n}_TYPE] $values[$n]</span>}"
+ done)
+ ${values[EMAIL]:+<h3>$(l10n EMAIL)</h3>}
+ $(for n in EMAIL EMAIL{0..10}; do
+ echo "${values[$n]:+<span class="item EMAIL"><a href="mailto:$values[$n]">$values[$n]</a></span>}"
+ done)
+ ${values[IMPP]:+<h3>$(l10n IMPP)</h3>}
+ $(for n in IMPP IMPP{0..10}; do
+ echo "${values[$n]:+<span class="item IMPP">$tags[${n}_TYPE] <a href="$values[$n]">$values[$n]</a></span>}"
+ done)
+ </div><!--
+
+ --><div class="section insurance">
+ <h3>$(l10n X-HEALTH-INSURANCE)</h3>
+ </div><!--
+
+ --><div class="section note">
+ ${values[NOTE]:+<h3>$(l10n NOTE)</h3>}
+ $(for n in NOTE NOTE{0..10}; do
+ echo "${values[$n]:+<span class="item NOTE">$values[$n]</span>}"
+ done)
+ ${values[X-CLIENT-REFERRAL]:+<h3>$(l10n X-CLIENT-REFERRAL)</h3>}
+ $(for n in X-CLIENT-REFERRAL X-CLIENT-REFERRAL{0..10}; do
+ echo "${values[$n]:+<span class="item X-CLIENT-REFERRAL">$values[$n]</span>}"
+ done)
+ </div><!--
+
+ --><div class="section prescriptions">
+ <h3>$(l10n prescriptions)</h3>
+ <ul>
+ $(sed -rn 's:(.*)\t'$id'$:\1:p' "$_DATA/mappings/attendance" |while read each; do
+ cname="$(sed -rn 's:^SUMMARY\:(.*)$:\1:p' "$_DATA/ical/$each")"
+ echo ' <li><a class="item attendance" href="?p=courses#'$each'">'$cname'</a></li>'
+ done)
+ </ul>
+ </div>
+END_HTML