]> git.plutz.net Git - confetti/blobdiff - templates/edit_prescription.sh
support for prescriptions
[confetti] / templates / edit_prescription.sh
index d4dce32e36f9c50f8a065a48af86ec47c5e6996a..cfd2b5be8dcfd141cb263d659e5b62ddb87c8dbb 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/>. 
 
+check(){ [ "$1" = "$2" ] && printf checked}
+
 cat <<END_HTML
 <form class="prescription" action="?action=update_prescription" method="POST">
+<input type="hidden" name="prescription" value="${mpx[prescription]}">
+
+<h1>$(l10n therapy_prescription)</h1>
 
 <label for="insurance">$(l10n insurance)</label>
-<input id="insurance" name="insurance" value="" placeholder="$(l10n insurance)">
+<input id="insurance" name="insurance" value="${mpx[insurance]}" placeholder="$(l10n insurance)">
+<br>
 <label for="name">$(l10n name)</label>
-<textarea id="name" name="name" placeholder="$(l10n name)"></textarea>
+<textarea id="name" name="name" placeholder="$(l10n name)">${mpx[name]}</textarea>
+<br>
 <label for="bday">$(l10n bday)</label>
-<input id="bday" name="bday" value="" placeholder="$(l10n bday)">
+<input id="bday" name="bday" value="${mpx[bday]}" placeholder="$(l10n bday)">
 
+<br>
 <label for="date">$(l10n date)</label>
-<input id="date" name="date" value="" placeholder="$(l10n date)">
+<input id="date" name="date" value="${mpx[date]}" placeholder="$(l10n date)">
 
+<br>
 <label for="addcontrib">$(l10n addcontrib)</label>
-<input id="addcontrib" name="addcontrib" value="" placeholder="$(l10n addcontrib)">
-<input type="checkbox" id="contribconfirm" name="contribconfirm" value="true">
+<input id="addcontrib" name="addcontrib" value="${mpx[addcontrib]}" placeholder="$(l10n addcontrib)">
+<input type="checkbox" id="contribconfirm" name="contribconfirm" value="true" ${mpx[contribconfirm]:+checked}>
 <label for="contribconfirm">$(l10n contribconfirm)</label>
 
 <h2>$(l10n prescription_by_catalogue)</h2>
-<input type="radio" id="prescfirst" name="prescno" value="first">
+<input type="radio" id="prescfirst" name="prescno" value="first" $(check "$mpx[prescno]" first)>
 <label for="prescfirst">$(l10n prescfirst)</label>
-<input type="radio" id="prescfollow1" name="prescno" value="follow1">
+<br>
+<input type="radio" id="prescfollow1" name="prescno" value="follow1" $(check "$mpx[prescno]" follow1)>
 <label for="prescfollow1">$(l10n prescfollow1)</label>
-<input type="radio" id="prescfollow2" name="prescno" value="follow2">
+<br>
+<input type="radio" id="prescfollow2" name="prescno" value="follow2" $(check "$mpx[prescno]" follow2)>
 <label for="prescfollow2">$(l10n prescfollow2)</label>
-<input type="radio" id="prescother" name="prescno" value="other">
+<br>
+<input type="radio" id="prescother" name="prescno" value="other" $(check "$mpx[prescno]" other)>
 <label for="prescother">$(l10n prescother)</label>
-<input type="radio" id="presccontinual" name="prescno" value="continual">
+<br>
+<input type="radio" id="presccontinual" name="prescno" value="continual" $(check "$mpx[prescno]" continual)>
 <label for="presccontinual">$(l10n presccontinual)</label>
 
-<input type="checkbox" id="grouptherapy" name="grouptherapy" value="true">
+<br>
+<input type="checkbox" id="grouptherapy" name="grouptherapy" value="true" ${mpx[grouptherapy]:+checked}>
 <label for="grouptherapy">$(l10n grouptherapy)</label>
-<input type="checkbox" id="housecall" name="housecall" value="true">
+<br>
+<input type="checkbox" id="housecall" name="housecall" value="true" ${mpx[housecall]:+checked}>
 <label for="housecall">$(l10n housecall)</label>
-<input type="checkbox" id="report" name="report" value="true">
+<br>
+<input type="checkbox" id="report" name="report" value="true" ${mpx[report]:+checked}>
 <label for="report">$(l10n report)</label>
 
-<label for="quantity">$(l10n quantity)</label>
-<input id="quantity" name="quantity" value="" placeholder="$(l10n quantity)">
+<br>
 <label for="remidy">$(l10n remidy)</label>
-<textarea id="remidy" name="remidy" placeholder="$(l10n remidy)"></textarea>
+<textarea id="remidy" name="remidy" placeholder="$(l10n remidy)">${mpx[remidy]}</textarea>
+<br>
+<label for="quantity">$(l10n quantity)</label>
+<input id="quantity" name="quantity" value="${mpx[quantity]}" placeholder="$(l10n quantity)">
+<br>
 <label for="quantity_weekly">$(l10n quantity_weekly)</label>
-<input id="quantity_weekly" name="quantity_weekly" value="" placeholder="$(l10n quantity_weekly)">
+<input id="quantity_weekly" name="quantity_weekly" value="${mpx[quantity_weekly]}" placeholder="$(l10n quantity_weekly)">
+
+<br>
+<label for="remidy1">$(l10n remidy)</label>
+<textarea id="remidy1" name="remidy1" placeholder="$(l10n remidy)">${mpx[remidy1]}</textarea>
+<br>
+<label for="quantity1">$(l10n quantity)</label>
+<input id="quantity1" name="quantity1" value="${mpx[quantity1]}" placeholder="$(l10n quantity)">
+<br>
+<label for="quantity_weekly1">$(l10n quantity_weekly)</label>
+<input id="quantity_weekly1" name="quantity_weekly1" value="${mpx[quantity_weekly1]}" placeholder="$(l10n quantity_weekly)">
 
+<br>
 <label for="indicator">$(l10n indicator)</label>
-<input id="indicator" name="indicator" value="" placeholder="$(l10n indicator)">
+<input id="indicator" name="indicator" value="${mpx[indicator]}" placeholder="$(l10n indicator)">
+<br>
 <label for="icd10">$(l10n icd10)</label>
-<input id="icd10" name="icd10" value="" placeholder="$(l10n icd10)">
+<input id="icd10" name="icd10" value="${mpx[icd10]}" placeholder="$(l10n icd10)">
 
-<input type="checkbox" id="prescreviewed" name="prescreviewed" value="true">
+<br>
+<input type="checkbox" id="prescreviewed" name="prescreviewed" value="true" ${mpx[prescreviewed]:+checked}>
 <label for="prescreviewed">$(l10n prescreviewed)</label>
 
+<br>
+<button type="submit" name="action" value="save">$(l10n save)</button>
+<button type="submit" name="action" value="cancel">$(l10n cancel)</button>
+<button type="submit" name="action" value="delete">$(l10n delete)</button>
 
 </form>
 END_HTML