<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">

  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">

  <link rel="stylesheet" href="signature-pad.css">
  <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css?'.time().'"  >
     <script src="../jquery/jquery-2.1.4.min.js" ></script>
    <script src="../bootstrap/js/bootstrap.min.js" ></script>

</head>
<body >


<div id='signature-pad' class='m-signature-pad'>
    <div class='m-signature-pad--body'>
      <canvas onmouseout="     if (signaturePad.isEmpty()) {    alert('Por favor firme primero.');    } else {       saveViaAJAX();    }"  id='canvas_firma'   ></canvas>
    </div>
    <div class='m-signature-pad--footer'>
      <div class='description'>Firme arriba</div>
      <div class='left'>
        <button type='button' id='clear' class='button clear btn-warning' data-action="clear" onclick="document.getElementById('<?php echo $_REQUEST[campo]?>[<?php echo $_REQUEST[item]?>]').value=''; ">Limpiar</button>
      </div>
      
      <div class='right'>
        <button type='button' class='button save btn-success' data-action='save-data'>Confirmar firma</button>

      </div> 
    </div>
</div>
  <script type="text/javascript">
  		function saveViaAJAX()
{
	var testCanvas = document.getElementById('canvas_firma');
	var canvasData = testCanvas.toDataURL('image/svg+xml');
	var postData = 'canvasData='+canvasData;
	//mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
	var debugConsole= window.parent.document.getElementById('<?php echo $_REQUEST[campo]?>[<?php echo $_REQUEST[item]?>]' );
	debugConsole.value=canvasData;

}
</script>
<script src="signature_pad.js"></script>
<script src="app.js"></script>
</body>
</html>
