]> git.plutz.net Git - confetti/blobdiff - templates/prescriptions.html.sh
reduced latency, sticky note in therapy view
[confetti] / templates / prescriptions.html.sh
index 9a0dd480912145e0cf6e5f7f79b77c52c3fc2187..c4ef19addc060da015f8db7c6954aaebd23a38f1 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">
@@ -33,15 +31,17 @@ ${edit:+$(edit_prescription "$edit")}
     <button type="submit">$(l10n newprescription)</button>
   </form>
 </div>
+EOF
 
-$(list_prescriptions "$client" \
-  |while read pre; do 
-    view_prescription "$pre"
-  done
-)
+list_prescriptions "$client" |grep -q "$edit" || edit_prescription "$edit"
 
-<h1>$(l10n prescriptions_past)</h1>
+list_prescriptions "$client" \
+|while read pre; do 
+  [ "$pre" = "$edit" ] \
+  && edit_prescription "$pre" \
+  || view_prescription "$pre"
+done
 
-EOF
+#<!--h1>$(l10n prescriptions_past)</h1-->
 
 # vi:set filetype=html: