<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">

    <title>Pages / Login</title>
    <meta content="" name="description">
    <meta content="" name="keywords">

    <!-- Favicons -->
    <link href="../assets/img/armoiries.png" rel="icon">
    <link href="../assets/img/apple-touch-icon.png" rel="apple-touch-icon">

    <!-- Google Fonts -->
    <link href="https://fonts.gstatic.com" rel="preconnect">
    <link
        href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i"
        rel="stylesheet">

    <!-- Vendor CSS Files -->
      <!-- Favicons -->
      <link href="<?php echo e(asset('assets/img/armoiries.png')); ?>" rel="icon">
      <link href="<?php echo e(asset('assets/img/apple-touch-icon.png')); ?>" rel="apple-touch-icon">

      <!-- Google Fonts -->
      <link href="https://fonts.gstatic.com" rel="preconnect">
      <link
          href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i"
          rel="stylesheet">

      <!-- Vendor CSS Files -->

      <link href="<?php echo e(asset('assets/vendor/bootstrap/css/bootstrap.min.css')); ?>" rel="stylesheet">
      <link href="<?php echo e(asset('assets/vendor/bootstrap-icons/bootstrap-icons.css')); ?>" rel="stylesheet">
      <link href="<?php echo e(asset('assets/vendor/boxicons/css/boxicons.min.css')); ?>" rel="stylesheet">
      <link href="<?php echo e(asset('assets/vendor/quill/quill.snow.css')); ?>" rel="stylesheet">
      <link href="<?php echo e(asset('assets/vendor/quill/quill.bubble.css')); ?>" rel="stylesheet">
      <link href="<?php echo e(asset('assets/vendor/remixicon/remixicon.css')); ?>" rel="stylesheet">
      <link href="<?php echo e(asset('assets/vendor/simple-datatables/style.css')); ?>" rel="stylesheet">

      <!-- Template Main CSS File -->
      <link href="<?php echo e(asset('assets/css/style.css')); ?>" rel="stylesheet">
    <link rel="stylesheet" type="text/css"
        href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.css">
    <script src="<?php echo e(asset('assets/js/jquery.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/js/jquery-ui.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/js/signature.js')); ?>"></script>
    <!-- Template Main CSS File -->
    <link href="<?php echo e(asset('assets/css/style.css')); ?>" rel="stylesheet">

</head>
<style>
    .wrapper {
        position: relative;
        width: 100%;
        height: 200px;
        -moz-user-select: none;
        -webkit-user-select: none;
        -ms-user-select: none;
        user-select: none;

    }
.me{

}
    .signature-pad {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 200px;
        display: inline-block;
        border: 1px solid #a0a0a0;
        background-color: white;

    }
</style>

<body>
    <header class="p-3 text-bg-dark">
        <div class="container">
            <div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
                <a href="#" class="logo d-flex align-items-center me-5">
                    <img src="<?php echo e(asset('assets/img/Ecusson_police_republicaine.png')); ?>" alt="">
                    <span class="d-none d-lg-block text-white">
                       
                        POLICE REPUBLICAINE
                    </span>
                </a>

                <ul class="nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
                    <li><a href="#" class="nav-link px-2 text-secondary"></a></li>

                    <li><a href="#" class="nav-link px-2 text-white"></a></li>
                    <li><a href="#" class="nav-link px-2 text-white"></a></li>
                    <li><a href="#" class="nav-link px-2 text-white"></a></li>
                    <li><a href="#" class="nav-link px-2 text-white"></a></li>
                </ul>

                <form class="col-12 col-lg-auto mb-3 mb-lg-0 me-lg-3" role="search">
                </form>

                <div class="text-end">

                    <div class="nav-item dropdown ">
                        <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
                            <i class="bi bi-gear"></i>
                        </a>

                        <div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
                            <a class="dropdown-item" href="<?php echo e(route('logout')); ?>"
                               onclick="event.preventDefault();
                                             document.getElementById('logout-form').submit();">
                                             <i class="bi bi-box-arrow-right"></i>
                                <?php echo e(__('Déconnexion')); ?>

                            </a>

                            <form id="logout-form" action="<?php echo e(route('logout')); ?>" method="POST" class="d-none">
                                <?php echo csrf_field(); ?>
                            </form>
                        </div>

                    </div>

                </div>
            </div>
        </div>
    </header>
    <main>
        <section class="section register min-vh-100 d-flex flex-column align-items-center  py-4">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-lg-4 col-md-6 d-flex flex-column align-items-center justify-content-center">
                        <div class="d-flex justify-content-center py-4">

                        </div><!-- End Logo -->

                        <div class="card ">

                            <div class="card-body">

                                <div class="pt-2 pb-2">
                                    <h5 class="card-title text-center ">
                                        <img src="<?php echo e(asset('assets/img/title.jpeg')); ?>" width="300px" alt=""
                                            srcset="">
                                    </h5>
                                </div>
                                <form action="<?php echo e(route('signature.update', $first_element->id)); ?>" method="post">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('PUT'); ?>
                                    <div class="col-md-12 ">
                                        <label class="me">Signature:</label>
                                        <br />
                                        <div class="wrapper">
                                            <canvas id="signature-pad" class="signature-pad" width=200
                                                height=200></canvas>
                                            <textarea id="signature" name="signed" style="display:none" required></textarea>
                                        </div>
                                    </div>
                                    <br />
                                    <div class="d-grid gap-2 ml-4 d-md-block">
                                        <button class="btn btn-success" type="submit">Enregistrer</button>
                                        <button  id="clear" class="btn btn-danger" type="button">Effacer</button>
                                      </div>


                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </section>

        </div>

    </main><!-- End #main -->

    <a href="#" class="back-to-top d-flex btn-color align-items-center justify-content-center"><i
            class="bi bi-arrow-up-short"></i></a>

    <!-- Vendor JS Files -->
    <script src="<?php echo e(asset('assets/vendor/apexcharts/apexcharts.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/vendor/bootstrap/js/bootstrap.bundle.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/vendor/chart.js/chart.umd.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/vendor/echarts/echarts.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/vendor/quill/quill.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/vendor/simple-datatables/simple-datatables.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/vendor/tinymce/tinymce.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/vendor/php-email-form/validate.js')); ?>"></script>

    <!-- Template Main JS File -->
    <script src="<?php echo e(asset('assets/js/main.js')); ?>"></script>
    <script src="https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.min.js"></script>
    <script type="text/javascript">
        var canvas = document.getElementById('signature-pad');
        var textarea = document.getElementById('signature');

        // Adjust canvas coordinate space taking into account pixel ratio,
        // to make it look crisp on mobile devices.
        // This also causes canvas to be cleared.
        function resizeCanvas() {
            // When zoomed out to less than 100%, for some very strange reason,
            // some browsers report devicePixelRatio as less than 1
            // and only part of the canvas is cleared then.
            var ratio = Math.max(window.devicePixelRatio || 1, 1);
            canvas.width = canvas.offsetWidth * ratio;
            canvas.height = canvas.offsetHeight * ratio;
            canvas.getContext("2d").scale(ratio, ratio);
        }

        window.onresize = resizeCanvas;
        resizeCanvas();

        var signaturePad = new SignaturePad(canvas, {
            backgroundColor: 'rgb(255, 255, 255)' // necessary for saving image as JPEG; can be removed is only saving as PNG or SVG
        });
        canvas.addEventListener('mouseup', () => {
            // obtenir l'URL de données de l'image au format PNG
            const dataURL = signaturePad.toDataURL('image/png');

            // insérer l'URL de données dans le textarea
            textarea.value = dataURL;
           // console.log(dataURL)
        });

        canvas.addEventListener('touchend', () => {
            // obtenir l'URL de données de l'image au format PNG
            const dataURL = signaturePad.toDataURL('image/png');

            // insérer l'URL de données dans le textarea
            textarea.value = dataURL;
            console.log(dataURL)
        });

        document.getElementById('clear').addEventListener('click', function() {
            signaturePad.clear();
        });

        document.getElementById('draw').addEventListener('click', function() {
            var ctx = canvas.getContext('2d');
            console.log(ctx.globalCompositeOperation);
            ctx.globalCompositeOperation = 'source-over'; // default value
        });

        document.getElementById('erase').addEventListener('click', function() {
            var ctx = canvas.getContext('2d');
            ctx.globalCompositeOperation = 'destination-out';
        });
    </script>
</body>

</html>
<?php /**PATH /home/p59qce1cziqc/public_html/cartepro.bj/polrep/resources/views/user/signature.blade.php ENDPATH**/ ?>