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-WHITE, 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 == "WHITE" or user.equipe.badge == 'GRAY' %}#152032{% else %}#ffffffa1{% endif %};
  75.             }
  76.             .qr-code img{
  77.                 height: auto;
  78.                 width: 100%;
  79.             }
  80.             .title1 {
  81.                 position: absolute;
  82.                 bottom: 10%;
  83.                 width: 100%;
  84.                 color: #ffffff;
  85.                 text-align: center;
  86.             }
  87.             .title2 {
  88.                 position: absolute;
  89.                 bottom: 2.5%;
  90.                 width: 100%;
  91.                 text-align: CENTER;
  92.                 color: #ffffff;
  93.             }
  94.             .title1 h1 {
  95.                 margin: 0;
  96.                 font-size: 5.7em;
  97.                 font-weight: 500;
  98.                 LINE-HEIGHT: 1em;
  99.                 font-family: "Montserrat", sans-serif;
  100.                 padding: 0 8.8%;
  101.             }
  102.             {#            {% if user.firstname|lenght%}#}
  103.             .title2 h2{
  104.                 margin: 3px 4% 3px 6.2%;
  105.                 bottom: 6%;
  106.                 font-size: 5.2em;
  107.                 font-weight: 300;
  108.                 font-family: "Montserrat", sans-serif;
  109.             }
  110.             .title2 p {
  111.                 margin: 3px 4% 3px 6.2%;
  112.                 font-size: 4.2em;
  113.                 font-weight: 600;
  114.                 font-family: "Montserrat", sans-serif;
  115.             }
  116.             .code {
  117.                 position: absolute;
  118.                 left: 82%;
  119.                 top: 58%;
  120.             }
  121.             body .code p {
  122.                 margin: 0 65px;
  123.                 color: #b08a89;
  124.                 font-size: 3em !important;
  125.                 margin: 0 45px;
  126.                 font-weight: 300;
  127.                 font-family: "Montserrat", sans-serif;
  128.                 transform: rotate(-0.25turn);
  129.             }
  130.             input#div2{
  131.                 bottom:150px;
  132.                 position: fixed;
  133.                 right: 50px;
  134.                 border-radius: 24px;
  135.                 font-size: 30px;
  136.                 border: none;
  137.                 outline: none;
  138.                 white-space: nowrap;
  139.                 background: #6554C0;
  140.                 padding: 15px 50px;
  141.                 transition: all 0.8s ease-in-out 0s;
  142.                 display: inline-flex;
  143.                 -webkit-box-align: center;
  144.                 align-items: center;
  145.                 overflow: hidden;
  146.                 border: 0;
  147.                 color: #fff;
  148.                 text-align: center;
  149.                 border: 2px solid #fff;
  150.                 cursor: pointer;
  151.             }
  152.             input:hover{
  153.                 background: #fff;
  154.                 color: var(--ds-background-discovery-bold,#6554C0);
  155.                 border: 2px solid #6554C0;
  156.             }
  157.         </style>
  158.     </head>
  159.     <body>
  160.         <div ref='{{ user.reference }}'  id="printableArea" data-id="{{ user.reference }}" data-name="{{ user.reference }}.png" class="face face-bg" style="background-image: url({{asset('senat26/'~user.equipe.badge~'.jpeg')}});">
  161.             <div class="title1" style="{% if user.name|length  < 26 %}bottom: 15%;{% elseif user.name|length  < 30 %}bottom: 11%;{% endif %}{% if user.equipe.badge == 'WHITE' or user.equipe.badge == 'GRAY' %} color: #152032;{% endif %}">
  162.                 <h1>
  163.                     {{ user.name }}
  164.                 </h1>
  165.             </div>
  166.             <div style="{% if user.title|length  > 33 or user.organization|length > 33 %}bottom: 3.5%;{% endif %} {% if user.equipe.badge == 'WHITE' or user.equipe.badge == 'GRAY' %} color: #152032;{% endif %}" class="title2">
  167.                 <h2>
  168.                     {{ user.title }} 
  169.                 </h2>
  170.                 <p>
  171.                     {{ user.organization }} 
  172.                 </p>
  173.             </div>
  174.             {#<div  class="qr-code">
  175.                 <div id="badge"></div>
  176.             </div>#}
  177.             <div class="code">
  178.                 <p>
  179.                     {{ user.reference }}
  180.                 </p>
  181.             </div>
  182.         </div> 
  183.         <input style="margin-top: 150px;font-size: 10em;
  184.                width: 75%;
  185.                height: 10%;" type="button" onclick="printDiv2('printableArea')" value="Download BADGE" id="div1" />
  186.     </body>
  187.     <script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
  188.     <script>
  189.                    jQuery(function () {
  190.                        jQuery('#badge').qrcode({
  191.                            // render method: 'canvas', 'image' or 'div'
  192.                            render: 'canvas',
  193.                            // version range somewhere in 1 .. 40
  194.                            minVersion: 2,
  195.                            maxVersion: 40,
  196.                            // error correction level: 'L', 'M', 'Q' or 'H'
  197.                            ecLevel: 'M',
  198.                            // offset in pixel if drawn onto existing canvas
  199.                            left: 0,
  200.                            top: 0,
  201.                            // size in pixel
  202.                            size: 290,
  203.                            // code color or image element
  204.                            fill: '{% if user.equipe.badge == "WHITE" or user.equipe.badge == 'GRAY' %}#152032{% else %}#fff{% endif %}',
  205.                            // background color or image element, null for transparent background
  206.                            background: null,
  207.                            // content
  208.                            text: '{{user.reference}}',
  209.                            // corner radius relative to module width: 0.0 .. 0.5
  210.                            radius: 0.5,
  211.                            // quiet zone in modules
  212.                            quiet: 1,
  213.                            // modes
  214.                            // 0: normal
  215.                            // 1: label strip
  216.                            // 2: label box
  217.                            // 3: image strip
  218.                            // 4: image box
  219.                            mode: 0,
  220.                            mSize: 0.1,
  221.                            mPosX: 0.5,
  222.                            mPosY: 0.5,
  223.                            label: 'no label',
  224.                            fontname: 'Montserrat',
  225.                            fontcolor: '#000',
  226.                            image: null
  227.                        });
  228.                    });
  229.                    function printDiv2(divName) {
  230.                        html2canvas(document.querySelector("#printableArea")).then(canvas => {
  231.                            let imgName = $('#printableArea').data('name');
  232.                            document.body.appendChild(canvas);
  233.                            const link = document.createElement('a');
  234.                            link.download = imgName;
  235.                            link.href = canvas.toDataURL();
  236.                            link.click();
  237.                            link.delete;
  238.                        });
  239.                    }
  240.     </script>
  241. </html>