]> git.plutz.net Git - confetti/blobdiff - templates/therapy.html.sh
move therapy add button into number field
[confetti] / templates / therapy.html.sh
index e9781e9bc52f7c27ad47b66e112e21b35bab0ac2..fd73e52eea326e97bb846739f571a5ff8ebcd62a 100755 (executable)
@@ -103,10 +103,10 @@ therapy_sessions(){
 
 cat <<EOF
   <fieldset class="tab">
 
 cat <<EOF
   <fieldset class="tab">
-    <span class=no>…</span><!--
+    <button class=no type=submit name=new_session value=$sid>+</button><!--
  --><input class=date name=${sid}_date value="" placeholder="$(l10n date)" /><!--
  --><input class=therapist name=${sid}_therapist value="" placeholder="$(l10n therapist)" /><!--
  --><input class=date name=${sid}_date value="" placeholder="$(l10n date)" /><!--
  --><input class=therapist name=${sid}_therapist value="" placeholder="$(l10n therapist)" /><!--
- --><button type=submit name=new_session value=$sid>+</button></span>
+ --><span class=signature><span></span>
     <input type=hidden name="${sid}_note1" value="">
   </fieldset>
 EOF
     <input type=hidden name="${sid}_note1" value="">
   </fieldset>
 EOF
@@ -135,6 +135,7 @@ cat <<EOF
   <div class="prescription">
     <h2>$(l10n therapy_prescription)</h2>
     <span class="insurance">${mpx[insurance]}</span>
   <div class="prescription">
     <h2>$(l10n therapy_prescription)</h2>
     <span class="insurance">${mpx[insurance]}</span>
+    <span class="date">${mpx[date]}</span>
     <label class="checkbox ${mpx[prescreviewed]:+checked}" for="prescreviewed">
       $([ -n "${mpx[prescreviewed]}" ] && printf %s "$(l10n prescreviewed)" \
                                        || printf %s "$(l10n prescreview)" )
     <label class="checkbox ${mpx[prescreviewed]:+checked}" for="prescreviewed">
       $([ -n "${mpx[prescreviewed]}" ] && printf %s "$(l10n prescreviewed)" \
                                        || printf %s "$(l10n prescreview)" )
@@ -197,32 +198,45 @@ cat <<EOF
   setcol("$tpy[color]")
 
   function circle(x, y) {
   setcol("$tpy[color]")
 
   function circle(x, y) {
-    sx=Math.floor(cscaleW * (x - canvas.offsetLeft + body.scrollLeft))
-    sy=Math.floor(cscaleH * (y - canvas.offsetTop + body.scrollTop))
-
-    image.beginPath()
-    image.arc( sx, sy, 5, 0, 2 * Math.PI )
-    image.fill()
-    image.closePath()
-
-    image_serialize += " circle " + sx + "," + sy + " " + (sx-5) + "," + sy
+    if ( mouse == 1){
+      if ( body.clientWidth >= 800 ){
+        sx=Math.floor(cscaleW * (x - canvas.offsetLeft))
+        sy=Math.floor(cscaleH * (y - canvas.offsetTop))
+      } else { 
+        sx=Math.floor(cscaleW * (x - canvas.offsetLeft + body.scrollLeft))
+        sy=Math.floor(cscaleH * (y - canvas.offsetTop + body.scrollTop))
+      }
+      image.beginPath()
+      image.arc( sx, sy, 5, 0, 2 * Math.PI )
+      image.fill()
+      image.closePath()
+
+      image_serialize += " circle " + sx + "," + sy + " " + (sx-5) + "," + sy
+    }
   }
 
   }
 
-  window.addEventListener( 'mouseup', function() { mouse = 0
-   dbg.innerHTML = image_serialize
-   data.value = image_serialize
-   } )
-  canvas.addEventListener( 'mousedown', function(e) {
+  function drawstart(x, y) {
     mouse = 1
 
     cscaleW = canvas.width / canvas.clientWidth
     cscaleH = canvas.height / canvas.clientHeight
 
     mouse = 1
 
     cscaleW = canvas.width / canvas.clientWidth
     cscaleH = canvas.height / canvas.clientHeight
 
-    circle(e.clientX, e.clientY)
-  } )
-  canvas.addEventListener( 'mousemove', function(e) {
-    if ( mouse == 1 ) { circle(e.clientX, e.clientY) }
-  } )
+    circle(x, y)
+  }
+  function drawstop() {
+   mouse = 0
+   dbg.innerHTML = image_serialize
+   data.value = image_serialize
+  }
+
+  window.addEventListener( 'mouseup',   function()   { drawstop() } )
+  canvas.addEventListener( 'mousedown', function(e)  { drawstart(e.clientX, e.clientY) } )
+  canvas.addEventListener( 'mousemove', function(e)  {    circle(e.clientX, e.clientY) } )
+
+  window.addEventListener( 'touchend',   function()  { drawstop() } )
+  canvas.addEventListener( 'touchstart', function(e) { drawstart(e.touches[0].clientX, e.touches[0].clientY) } )
+  canvas.addEventListener( 'touchmove',  function(e) {    circle(e.touches[0].clientX, e.touches[0].clientY) } )
+
   --></script>
 </form>
 
   --></script>
 </form>