# 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">
<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: