<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Badge - {{ user.reference }} </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
{# <link href="{{ asset('qrcode/styles.css')}}" rel="stylesheet">#}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<script src="{{ asset('qrcode/jquery.min.js') }}"></script>
<script src="{{ asset('qrcode/jquery-qrcode-0.18.0.js')}}"></script>
{# <script src="{{ asset('qrcode/scripts.js')}}"></script>#}
<style>
@page {
/* dimensions for the whole page */
size: A5;
margin: 0;
}
html {
/* off-WHITE, so body edge is visible in browser */
background: #eee;
}
body {
/* 9X14 dimensions */
height: 2778px;
width: 1985px;
margin: 0;
}
/* fill half the height with each face */
.face {
height: 2778px;
width: 1985px;
position: relative;
}
/* background image of card */
.face-bg {
background-size: 1985px 2778px;
background-position: center;
background-repeat: no-repeat;
position: relative;
}
/* the back face */
.face-back {
background: #f6f6f6;
}
/* the front face */
.face-front {
background: #fff;
}
/* an image that fills the whole of the front face */
.face-front img {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
}
.date{
position: absolute;
top: 70px;
right: 10px;
transform: rotate(-90deg);
}
.qr-code {
position: absolute;
overflow: hidden;
bottom: 7%;
right: 6%;
border-radius: 5px;
padding: 2px;
border: 2px solid {% if user.equipe.badge == "WHITE" or user.equipe.badge == 'GRAY' %}#152032{% else %}#ffffffa1{% endif %};
}
.qr-code img{
height: auto;
width: 100%;
}
.title1 {
position: absolute;
bottom: 10%;
width: 100%;
color: #ffffff;
text-align: center;
}
.title2 {
position: absolute;
bottom: 2.5%;
width: 100%;
text-align: CENTER;
color: #ffffff;
}
.title1 h1 {
margin: 0;
font-size: 5.7em;
font-weight: 500;
LINE-HEIGHT: 1em;
font-family: "Montserrat", sans-serif;
padding: 0 8.8%;
}
{# {% if user.firstname|lenght%}#}
.title2 h2{
margin: 3px 4% 3px 6.2%;
bottom: 6%;
font-size: 5.2em;
font-weight: 300;
font-family: "Montserrat", sans-serif;
}
.title2 p {
margin: 3px 4% 3px 6.2%;
font-size: 4.2em;
font-weight: 600;
font-family: "Montserrat", sans-serif;
}
.code {
position: absolute;
left: 82%;
top: 58%;
}
body .code p {
margin: 0 65px;
color: #b08a89;
font-size: 3em !important;
margin: 0 45px;
font-weight: 300;
font-family: "Montserrat", sans-serif;
transform: rotate(-0.25turn);
}
input#div2{
bottom:150px;
position: fixed;
right: 50px;
border-radius: 24px;
font-size: 30px;
border: none;
outline: none;
white-space: nowrap;
background: #6554C0;
padding: 15px 50px;
transition: all 0.8s ease-in-out 0s;
display: inline-flex;
-webkit-box-align: center;
align-items: center;
overflow: hidden;
border: 0;
color: #fff;
text-align: center;
border: 2px solid #fff;
cursor: pointer;
}
input:hover{
background: #fff;
color: var(--ds-background-discovery-bold,#6554C0);
border: 2px solid #6554C0;
}
</style>
</head>
<body>
<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')}});">
<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 %}">
<h1>
{{ user.name }}
</h1>
</div>
<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">
<h2>
{{ user.title }}
</h2>
<p>
{{ user.organization }}
</p>
</div>
{#<div class="qr-code">
<div id="badge"></div>
</div>#}
<div class="code">
<p>
{{ user.reference }}
</p>
</div>
</div>
<input style="margin-top: 150px;font-size: 10em;
width: 75%;
height: 10%;" type="button" onclick="printDiv2('printableArea')" value="Download BADGE" id="div1" />
</body>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
<script>
jQuery(function () {
jQuery('#badge').qrcode({
// render method: 'canvas', 'image' or 'div'
render: 'canvas',
// version range somewhere in 1 .. 40
minVersion: 2,
maxVersion: 40,
// error correction level: 'L', 'M', 'Q' or 'H'
ecLevel: 'M',
// offset in pixel if drawn onto existing canvas
left: 0,
top: 0,
// size in pixel
size: 290,
// code color or image element
fill: '{% if user.equipe.badge == "WHITE" or user.equipe.badge == 'GRAY' %}#152032{% else %}#fff{% endif %}',
// background color or image element, null for transparent background
background: null,
// content
text: '{{user.reference}}',
// corner radius relative to module width: 0.0 .. 0.5
radius: 0.5,
// quiet zone in modules
quiet: 1,
// modes
// 0: normal
// 1: label strip
// 2: label box
// 3: image strip
// 4: image box
mode: 0,
mSize: 0.1,
mPosX: 0.5,
mPosY: 0.5,
label: 'no label',
fontname: 'Montserrat',
fontcolor: '#000',
image: null
});
});
function printDiv2(divName) {
html2canvas(document.querySelector("#printableArea")).then(canvas => {
let imgName = $('#printableArea').data('name');
document.body.appendChild(canvas);
const link = document.createElement('a');
link.download = imgName;
link.href = canvas.toDataURL();
link.click();
link.delete;
});
}
</script>
</html>