]> git.plutz.net Git - confetti/blobdiff - templates/cards.html.sh
improved styling for filter input
[confetti] / templates / cards.html.sh
index f1f039a77d81829af470451e327d759e0905f09d..2eca4d15451d74fc97d991cedd33ddb7e55ee42c 100755 (executable)
@@ -1,9 +1,90 @@
-case $PROFILE in
-medical)
-;;
-circus)
-  view_card=${0%/*}/view_attendee.sh
-  edit_card=${0%/*}/edit_attendee.sh
-  . ${0%/*}/attendees.html.sh
-;;
-esac
+# 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/>. 
+
+check_type(){
+  [ "${_GET[filtertype]}" = "$1" ] && echo 'checked="checked"'
+}
+check_order(){
+  [ "${_GET[order]}" = "$1" ] && echo 'checked="checked"'
+}
+
+cat <<EOF
+<form class="filter" action="?action=filter_card" method="POST">
+  <h1>$(l10n filter_label)</h1>
+  <input type="hidden" name="page" value="cards"/>
+  <fieldset class="item">
+  <legend>$(l10n filter_item):</legend>
+    <input  id="any" type="radio" name="filtertype" value="any" $(check_type any)>
+    <label for="any" >$(l10n filter_all)</label>
+
+    <input  id="name" type="radio" name="filtertype" value="name" $(check_type name)>
+    <label for="name">$(l10n filter_name)</label>
+
+    <input  id="street" type="radio" name="filtertype" value="street" $(check_type street)>
+    <label for="street">$(l10n filter_street)</label>
+
+    <input  id="zip" type="radio" name="filtertype" value="zip" $(check_type zip)>
+    <label for="zip">$(l10n filter_zip)</label>
+
+    <input  id="telephone" type="radio" name="filtertype" value="telephone" $(check_type telephone)>
+    <label for="telephone">$(l10n filter_phone)</label>
+
+    <input  id="birth" type="radio" name="filtertype" value="birth" $(check_type birth)>
+    <label for="birth">$(l10n filter_birthyear)</label>
+
+    ${profile_circus:+
+    <input  id="course" type="radio" name="filtertype" value="course" $(check_type course)>
+    <label for="course">$(l10n filter_course)</label>
+    }
+
+    <input type="text" name="filter" value="${_GET[filter]}" placeholder="$(l10n filter_placeholder)"/>
+  </fieldset>
+
+  <fieldset class="order">
+    <legend>$(l10n filter_order):</legend>
+    <label><input type="radio" name="order" value="firstname" $(check_order firstname)>$(l10n filter_firstname)</label>
+    <label><input type="radio" name="order" value="lastname"  $(check_order lastname) >$(l10n filter_lastname)</label>
+    <label><input type="radio" name="order" value="bdate"     $(check_order bdate)    >$(l10n filter_bdate)</label>
+  </fieldset>
+  <button type="submit" name="choice" value="new_filter">$(l10n filter_apply)</button>
+  <button type="submit" name="choice" value="del_filter">$(l10n filter_cancel)</button>
+</form>
+
+<form class="newcard" action="?action=new_card" method="POST">
+  <button type="submit">$(l10n newcard)</button>
+</form>
+
+${edit:+$(edit_card "$edit")}
+EOF
+
+listcards |grep ${edit:+-v} "$edit" \
+| while read card; do
+  cat <<-ENDCARD
+       <div id="${card}" class="card">
+         $(view_card "$card")<!--
+         --><div class="control">
+           <a class="item" href="?action=edit_card&card=${card}">$(l10n edit)</a>
+           <a class="item" href="?action=export_vcard&card=${card}">$(l10n vcf_export)</a>
+            ${profile_medical:+
+           <a class="item" href="?action=new_prescription&client=${card}">$(l10n new_prescription)</a>
+           }
+         </div>
+       </div>
+       ENDCARD
+done
+
+# vi:set filetype=html: