]> git.plutz.net Git - confetti/blobdiff - templates/prescriptions.html.sh
enable drawing via android-4, quicker drawing via lines
[confetti] / templates / prescriptions.html.sh
index 9a0dd480912145e0cf6e5f7f79b77c52c3fc2187..a662c74b229346376b8155acd737a66739762e0e 100755 (executable)
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
-edit="${_GET[edit]}"
 client="${_GET[client]}"
-[ -z "$client" ] && client="${edit%.*.mpx}.vcf"
+edit="${_GET[edit]}"
+[ -n "$edit" ] && client="${edit%.*.mpx}.vcf"
 
 cat <<EOF
 
 <div id="${card}" class="card">$(view_card "$client")</div>
 
-<h1>$(l10n prescriptions_current)</h1>
-
-${edit:+$(edit_prescription "$edit")}
+<!--h1>$(l10n prescriptions_current)</h1-->
 
 <div class="newprescription">
   <form action="?action=new_prescription" method="POST">
@@ -34,13 +32,17 @@ ${edit:+$(edit_prescription "$edit")}
   </form>
 </div>
 
+$(list_prescriptions "$client" |grep -q "$edit" || edit_prescription "$edit")
+
 $(list_prescriptions "$client" \
   |while read pre; do 
-    view_prescription "$pre"
+    [ "$pre" = "$edit" ] \
+    && edit_prescription "$pre" \
+    || view_prescription "$pre"
   done
 )
 
-<h1>$(l10n prescriptions_past)</h1>
+<!--h1>$(l10n prescriptions_past)</h1-->
 
 EOF