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