# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
check(){ [ "$1" = "$2" ] && printf checked}
+[ -z $mpx[presctype] ] && mpx[presctype]=doctor_compulsory
cat <<END_HTML
<form class="prescription" action="?action=update_prescription" method="POST">
<input type="hidden" name="prescription" value="${mpx[prescription]}">
-<table class="type"><tbody>
- <tr>
- <th>$(l10n doctor)</th>
- <th>$(l10n dentist)</th>
- <th>$(l10n noprescription)</th>
- <th>$(l10n altpractition)</th>
- </tr>
- <tr>
- <td class="selfpaid doctor">
- <input type=radio name=presctype id=doctor_selfpaid value=doctor_selfpaid>
- <label for=doctor_selfpaid>$(l10n selfpaid)</label>
- </td>
- <td class="selfpaid dentist">
- <input type=radio name=presctype id=dentist_selfpaid value=dentist_selfpaid>
- <label for=dentist_selfpaid>$(l10n selfpaid)</label>
- </td>
- <td class="selfpaid noprescription">
- <input type=radio name=presctype id=noprescription_selfpaid value=noprescription_selfpaid>
- <label for=noprescription_selfpaid>$(l10n selfpaid)</label>
- </td>
- <td class="selfpaid altpractition">
- <input type=radio name=presctype id=altpractition_selfpaid value=altpractition_selfpaid>
- <label for=altpractition_selfpaid>$(l10n selfpaid)</label>
- </td>
- </tr>
- <tr>
- <td class="private doctor">
- <input type=radio name=presctype id=doctor_private value=doctor_private>
- <label for=doctor_private>$(l10n private)</label>
- </td>
- <td class="private dentist">
- <input type=radio name=presctype id=dentist_private value=dentist_private>
- <label for=dentist_private>$(l10n private)</label>
- </td>
- <td class="private noprescription">
- </td>
- <td class="private altpractition">
- <input type=radio name=presctype id=altpractition_private value=altpractition_private>
- <label for=altpractition_private>$(l10n private)</label>
- </td>
- </tr>
- <tr>
- <td class="compulsory doctor">
- <input type=radio name=presctype id=doctor_compulsory value=doctor_compulsory>
- <label for=doctor_compulsory>$(l10n compulsory)</label>
- </td>
- <td class="compulsory dentist">
- <input type=radio name=presctype id=dentist_compulsory value=dentist_compulsory>
- <label for=dentist_compulsory>$(l10n compulsory)</label>
- </td>
- <td class="compulsory noprescription">
- </td>
- <td class="compulsory altpractition">
- </td>
- </tr>
-</tbody></table>
+<label class=presctype>$(l10n doctor):</label>
+<input type=radio name=presctype id=doctor_selfpaid value=doctor_selfpaid $(check "$mpx[presctype]" doctor_selfpaid)>
+<label for=doctor_selfpaid>$(l10n selfpaid)</label>
+<input type=radio name=presctype id=doctor_private value=doctor_private $(check "$mpx[presctype]" doctor_private)>
+<label for=doctor_private>$(l10n private)</label>
+<input type=radio name=presctype id=doctor_compulsory value=doctor_compulsory $(check "$mpx[presctype]" doctor_compulsory)>
+<label for=doctor_compulsory>$(l10n compulsory)</label>
+<br>
+
+<label class=presctype>$(l10n dentist):</label>
+<input type=radio name=presctype id=dentist_selfpaid value=dentist_selfpaid $(check "$mpx[presctype]" dentist_selfpaid)>
+<label for=dentist_selfpaid>$(l10n selfpaid)</label>
+<input type=radio name=presctype id=dentist_private value=dentist_private $(check "$mpx[presctype]" dentist_private)>
+<label for=dentist_private>$(l10n private)</label>
+<input type=radio name=presctype id=dentist_compulsory value=dentist_compulsory $(check "$mpx[presctype]" dentist_compulsory)>
+<label for=dentist_compulsory>$(l10n compulsory)</label>
+<br>
+
+<label class=presctype>$(l10n noprescription):</label>
+<input type=radio name=presctype id=noprescription_selfpaid value=noprescription_selfpaid $(check "$mpx[presctype]" noprescription_selfpaid)>
+<label for=noprescription_selfpaid>$(l10n selfpaid)</label>
+<br>
+
+<label class=presctype>$(l10n altpractition):</label>
+<input type=radio name=presctype id=altpractition_selfpaid value=altpractition_selfpaid $(check "$mpx[presctype]" altpractition_selfpaid)>
+<label for=altpractition_selfpaid>$(l10n selfpaid)</label>
+<input type=radio name=presctype id=altpractition_private value=altpractition_private $(check "$mpx[presctype]" altpractition_private)>
+<label for=altpractition_private>$(l10n private)</label>
+<br>
<fieldset class="baseinfo">
<label for="insurance">$(l10n insurance)</label>
<label for="quantity">$(l10n quantity)</label>
<label for="remidy">$(l10n remidy)</label>
<label for="quantity_weekly">$(l10n quantity_weekly)</label>
+<p>
<input id="quantity" name="quantity" value="${mpx[quantity]}" placeholder="$(l10n quantity)">
<textarea id="remidy" name="remidy" placeholder="$(l10n remidy)">${mpx[remidy]}</textarea>
<input id="quantity_weekly" name="quantity_weekly" value="${mpx[quantity_weekly]}" placeholder="$(l10n quantity_weekly)">
+</p>
+
+$( for n in {0..10}; do
+ if [ "$n" -eq 0 -o -n "${mpx[quantity$n]}" -o -n "${mpx[remidy$n]}" -o -n "${mpx[quantity_weekly$n]}" ]; then
+ printf '<input class="trailbtn" type="checkbox" checked="checked" />'
+ else
+ printf '<input class="trailbtn" type="checkbox" />'
+ fi
+ printf '<p class="trailbox">
+ <input class="quantity" name="quantity" placeholder="%s" value="%s">
+ <textarea class="remidy" name="remidy" placeholder="%s">%s</textarea>
+ <input class="quantity_weekly" name="quantity_weekly" placeholder="%s" value="%s">
+ </p>
+ ' "$(l10n quantity)" "${mpx[quantity$n]}" \
+ "$(l10n remidy)" "${mpx[remidy$n]}" \
+ "$(l10n quantity_weekly)" "${mpx[quantity_weekly$n]}"
+done )
-<label for="quantity1">$(l10n quantity)</label>
-<label for="remidy1">$(l10n remidy)</label>
-<label for="quantity_weekly1">$(l10n quantity_weekly)</label>
-<input id="quantity1" name="quantity1" value="${mpx[quantity1]}" placeholder="$(l10n quantity)">
-<textarea id="remidy1" name="remidy1" placeholder="$(l10n remidy)">${mpx[remidy1]}</textarea>
-<input id="quantity_weekly1" name="quantity_weekly1" value="${mpx[quantity_weekly1]}" placeholder="$(l10n quantity_weekly)">
<br>
<p class="indicator_codes">