make prescriptions colored
authorpaul <paul@plutz.net>
Thu, 7 Apr 2016 11:25:26 +0000 (11:25 +0000)
committerpaul <paul@plutz.net>
Thu, 7 Apr 2016 11:25:26 +0000 (11:25 +0000)
svn path=/trunk/; revision=91

templates/edit_prescription.sh
templates/prescriptions.css.sh
templates/view_prescription.sh

index 4701ebb..8ac9bb7 100755 (executable)
 # 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>
index cd87760..49db497 100755 (executable)
@@ -25,11 +25,12 @@ cat <<EOF
   display: inline-block;
   width: 96%; max-width: 460px;
   color: #800;
-  background-color: #CFF;
+  background-color: #DDD;
   margin: 1em -1% 0 2%; padding: 0;
   border: 1px solid #888;
   overflow: hidden;
 }
+form.prescription { padding-top: 1ex;}
 
 .newprescription {
   display: block;
@@ -50,26 +51,6 @@ cat <<EOF
   font-size: .75em;
 }
 
-.prescription table {display: block; width: 100%; border-collapse: collapse;}
-.prescription table tbody {width: 100%; margin: 0 auto;}
-.prescription table tr {display: table-row; width: 100%; margin: 0 auto;}
-.prescription table tr th,
-.prescription table tr td {
-  display: table-cell;
-  text-align: left;
-  padding: .25ex 1ex;
-  border-left: 1px solid red;
-}
-.prescription table tr th { padding: .25em 1ex; border-bottom: 1px solid red;}
-.prescription table tr th:nth-of-type(1),
-.prescription table tr td:nth-of-type(1) { border-left: none;}
-
-td.private  {background-color: #BFB;}
-td.selfpaid {background-color: #FFB;}
-td.compulsory.doctor {background-color: #BBF;}
-td.compulsory.dentist {background-color: #FBB;}
-td.altpractition { background-color: #FBF;}
-
 .prescription fieldset {
   display: inline-block;
   margin: 0; padding: 1ex;
@@ -137,6 +118,37 @@ td.altpractition { background-color: #FBF;}
 
 /* ======== Specific ========== */
 
+.prescription label.presctype,
+.prescription input[name=presctype] + label {
+  font-size: medium;
+  width: 22%;
+  margin: 0; margin-right: -.75ex;
+  vertical-align: bottom;
+  padding: .125em .5ex .25em 3ex;
+}
+.prescription label.presctype {
+  text-align: right;
+  font-weight: bold;
+  padding-right: 1ex;
+  padding-left: 0;
+}
+
+input[name=presctype][value\$=private]:checked  ~ fieldset,
+  input[name=presctype][value\$=private] + label,
+  .prescription.private { background-color: #CFC;}
+input[name=presctype][value\$=selfpaid]:checked  ~ fieldset,
+  input[name=presctype][value\$=selfpaid]         + label,
+  .prescription.selfpaid { background-color: #FFC;}
+input[name=presctype][value=doctor_compulsory]:checked  ~ fieldset,
+  input[name=presctype][value=doctor_compulsory]  + label,
+  .prescription.doctor.compulsory { background-color: #CFF;}
+input[name=presctype][value=dentist_compulsory]:checked  ~ fieldset,
+  input[name=presctype][value=dentist_compulsory] + label,
+  .prescription.dentist.compulsory { background-color: #FCC;}
+input[name=presctype][value^=altpractition]:checked  ~ fieldset,
+  input[name=presctype][value^=altpractition]     + label,
+  .prescription.altpractition { background-color: #FCF;}
+
 .prescription .baseinfo { width: 60%;}
 
   .baseinfo label[for=insurance],
@@ -176,7 +188,7 @@ td.altpractition { background-color: #FBF;}
 .prescription :checked + label[for=prescreviewed] {
   font-weight: normal;
   text-decoration: none;
-  background-color: #CFF;
+  background-color: transparent;
 }
 
 .prescription .catalogue { width: 100%; }
index df89cdb..ce2b496 100755 (executable)
@@ -18,7 +18,7 @@
 check(){ [ "$1" = "$2" ] && printf checked}
 
 cat <<END_HTML
-<div class="prescription">
+<div class="prescription ${mpx[presctype]%_*} ${mpx[presctype]#*_}">
 <fieldset class="baseinfo">
 <label for="insurance">$(l10n insurance)</label>
 <span id="insurance">${mpx[insurance]}</span>