templates/card/showCardA6.html.twig line 1

Open in your IDE?
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.     <head>
  4.         <meta charset="utf-8">
  5.         <title>Badge - {{ user.reference }} </title>
  6.         <meta name="viewport" content="width=device-width, initial-scale=1">
  7.         {#        <link href="{{ asset('qrcode/styles.css')}}" rel="stylesheet">#}
  8.         <link rel="preconnect" href="https://fonts.googleapis.com">
  9.         <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  10.         <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
  11.         <script src="{{ asset('qrcode/jquery.min.js') }}"></script>
  12.         <script src="{{ asset('qrcode/jquery-qrcode-0.18.0.js')}}"></script>
  13.         {#        <script src="{{ asset('qrcode/scripts.js')}}"></script>#}
  14.         <style>
  15.             @page {
  16.                 /* dimensions for the whole page */
  17.                 size: A5;
  18.                 margin: 0;
  19.             }
  20.             html {
  21.                 /* off-Blanc, so body edge is visible in browser */
  22.                 background: #eee;
  23.             }
  24.             body {
  25.                 /* 9X14 dimensions */
  26.                 height: 2778px;
  27.                 width:  1985px;
  28.                 margin: 0;
  29.             }
  30.             /* fill half the height with each face */
  31.             .face {
  32.                 height: 2778px;
  33.                 width:  1985px;
  34.                 position: relative;
  35.             }
  36.             /* background image of card */
  37.             .face-bg {
  38.                 background-size:  1985px 2778px;
  39.                 background-position: center;
  40.                 background-repeat: no-repeat;
  41.                 position: relative;
  42.             }
  43.             /* the back face */
  44.             .face-back {
  45.                 background: #f6f6f6;
  46.             }
  47.             /* the front face */
  48.             .face-front {
  49.                 background: #fff;
  50.             }
  51.             /* an image that fills the whole of the front face */
  52.             .face-front img {
  53.                 position: absolute;
  54.                 top: 0;
  55.                 left: 0;
  56.                 bottom: 0;
  57.                 right: 0;
  58.                 width: 100%;
  59.                 height: 100%;
  60.             }
  61.             .date{
  62.                 position: absolute;
  63.                 top: 70px;
  64.                 right: 10px;
  65.                 transform: rotate(-90deg);
  66.             }
  67.             .qr-code {
  68.                 position: absolute;
  69.                 overflow: hidden;
  70.                 bottom: 7%;
  71.                 right: 6%;
  72.                 border-radius: 5px;
  73.                 padding: 2px;
  74.                 border: 2px solid {% if user.equipe.badge == "Blanc" or user.equipe.badge == 'GRAY' %}#152032{% else %}#ffffffa1{% endif %};
  75.             }
  76.             .qr-code img{
  77.                 height: auto;
  78.                 width: 100%;
  79.             }
  80.             .txt-content {
  81.                 width: 75%;
  82.                 color: #ffffff;
  83.                 text-align: left;
  84.                 padding: 0 4%;
  85.                 top: 82%;
  86.                 position: absolute;
  87.             }
  88.             .title1 {
  89.                 width: 100%;
  90.                 color: #ffffff;
  91.                 text-align: left;
  92.             }
  93.             .title2 {
  94.                 width: 100%;
  95.                 text-align: left;
  96.                 color: #ffffff;
  97.             }
  98.             .title1 h1 {
  99.                 margin: 10px 0;
  100.                 font-size: 5.7em;
  101.                 font-weight: 500;
  102.                 LINE-HEIGHT: 1em;
  103.                 font-family: "Montserrat", sans-serif;
  104.             }
  105.             {#            {% if user.firstname|lenght%}#}
  106.             .title2 h2{
  107.                 font-size: 5em;
  108.                 font-weight: 300;
  109.                 font-family: "Montserrat", sans-serif;
  110.                 margin: 10px 0;
  111.             }
  112.             .title2 p {
  113.                 font-size: 4.2em;
  114.                 font-weight: 600;
  115.                 font-family: "Montserrat", sans-serif;
  116.                 margin: 10px 0px;
  117.             }
  118.             .code {
  119.                 position: absolute;
  120.                 left: 82%;
  121.                 top: 52%;
  122.             }
  123.             body .code p {
  124.                 margin: 0 65px;
  125.                 color: #b08a89;
  126.                 font-size: 3em !important;
  127.                 margin: 0 45px;
  128.                 font-weight: 300;
  129.                 font-family: "Montserrat", sans-serif;
  130.                 transform: rotate(-0.25turn);
  131.             }
  132.             input#div2{
  133.                 bottom:150px;
  134.                 position: fixed;
  135.                 right: 50px;
  136.                 border-radius: 24px;
  137.                 font-size: 30px;
  138.                 border: none;
  139.                 outline: none;
  140.                 white-space: nowrap;
  141.                 background: #6554C0;
  142.                 padding: 15px 50px;
  143.                 transition: all 0.8s ease-in-out 0s;
  144.                 display: inline-flex;
  145.                 -webkit-box-align: center;
  146.                 align-items: center;
  147.                 overflow: hidden;
  148.                 border: 0;
  149.                 color: #fff;
  150.                 text-align: center;
  151.                 border: 2px solid #fff;
  152.                 cursor: pointer;
  153.             }
  154.             input:hover{
  155.                 background: #fff;
  156.                 color: var(--ds-background-discovery-bold,#6554C0);
  157.                 border: 2px solid #6554C0;
  158.             }
  159.         </style>
  160.     </head>
  161.     <body>
  162.         <div ref='{{ user.reference }}'  id="printableArea" data-id="{{ user.reference }}" data-name="{{ user.reference }}.png" class="face face-bg" style="background-image: url({{asset('apm-26/'~user.equipe.badge~'.jpeg')}});">
  163.             <div  class="txt-content">
  164.                 <div class="title1" style="{% if user.name|length  < 26 %}bottom: 14%;{% elseif user.name|length  < 30 %}bottom: 11%;{% endif %}{% if user.equipe.badge == 'Blanc' or user.equipe.badge == 'GRAY' %} color: #152032;{% endif %}">
  165.                     <h1>
  166.                         {{ user.name }}
  167.                     </h1>
  168.                 </div>
  169.                 <div style="{% if user.title|length  > 33 or user.organization|length > 33 %}bottom: 3.5%;{% endif %} {% if user.equipe.badge == 'Blanc' or user.equipe.badge == 'GRAY' %} color: #152032;{% endif %}" class="title2">
  170.                     <h2>
  171.                         {{ user.title }} 
  172.                     </h2>
  173.                     <p>
  174.                         {{ user.organization }} 
  175.                     </p>
  176.                 </div>
  177.             </div>
  178.             <div  class="qr-code">
  179.                 <div id="badge"></div>
  180.             </div>
  181.             <div class="code">
  182.                 <p>
  183.                     {{ user.reference }}
  184.                 </p>
  185.             </div>
  186.         </div> 
  187.         <input style="margin-top: 150px;font-size: 10em;
  188.                width: 75%;
  189.                height: 10%;" type="button" onclick="printDiv2('printableArea')" value="Download BADGE" id="div1" />
  190.     </body>
  191.     <script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
  192.     <script>
  193.                    jQuery(function () {
  194.                        jQuery('#badge').qrcode({
  195.                            // render method: 'canvas', 'image' or 'div'
  196.                            render: 'canvas',
  197.                            // version range somewhere in 1 .. 40
  198.                            minVersion: 2,
  199.                            maxVersion: 40,
  200.                            // error correction level: 'L', 'M', 'Q' or 'H'
  201.                            ecLevel: 'M',
  202.                            // offset in pixel if drawn onto existing canvas
  203.                            left: 0,
  204.                            top: 0,
  205.                            // size in pixel
  206.                            size: 270,
  207.                            // code color or image element
  208.                            fill: '{% if user.equipe.badge == "Blanc" or user.equipe.badge == 'GRAY' %}#152032{% else %}#fff{% endif %}',
  209.                            // background color or image element, null for transparent background
  210.                            background: null,
  211.                            // content
  212.                            text: '{{user.reference}}',
  213.                            // corner radius relative to module width: 0.0 .. 0.5
  214.                            radius: 0.7,
  215.                            // quiet zone in modules
  216.                            quiet: 1,
  217.                            // modes
  218.                            // 0: normal
  219.                            // 1: label strip
  220.                            // 2: label box
  221.                            // 3: image strip
  222.                            // 4: image box
  223.                            mode: 0,
  224.                            mSize: 0.1,
  225.                            mPosX: 0.5,
  226.                            mPosY: 0.5,
  227.                            label: 'no label',
  228.                            fontname: 'Montserrat',
  229.                            fontcolor: '#000',
  230.                            image: null
  231.                        });
  232.                    });
  233.                    function printDiv2(divName) {
  234.                        html2canvas(document.querySelector("#printableArea")).then(canvas => {
  235.                            let imgName = $('#printableArea').data('name');
  236.                            document.body.appendChild(canvas);
  237.                            const link = document.createElement('a');
  238.                            link.download = imgName;
  239.                            link.href = canvas.toDataURL();
  240.                            link.click();
  241.                            link.delete;
  242.                        });
  243.                    }
  244.     </script>
  245. </html>