forked from MisterDCH/2Doc-generator-Sanitarypass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript-2doc.txt
122 lines (76 loc) · 3.56 KB
/
script-2doc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<meta charset="UTF-8" />
Nom : <input type="text" id="nom"></input> <br>
Prenom : <input type="text" id="prenom"></input> <br>
Date de naissance : <input type="date" id="dateNaiss" placeholder="dd-mm-yyyy"> <br>
Nombre de doses injectées (1 ou 2) : <input type="text" id="nbDose" maxlength="1"></input> <br>
Date de la dernière injection : <input type="date" id="dateInj"></input><br>
Statut du vaccin :
<select id="statut" >
<option valeur="Vaccine">Vaccine</option>
<option valeur="En cours">En cours</option>
</select>
<br>
<br>
<button type="button" onclick="dataMatrix()">
Generer le QR Code
</button>
<br>
<br>
<i>*L'ajout de certificat sur l'appli TousAntiCovid ne fonctionne pas pour IOS</i>
<div id="myDiv"></div>
<script>
function dataMatrix() {
//var name = document.getElementById("dateNaiss").value ;
var name = document.getElementById("nom").value ;
var prename = document.getElementById("prenom").value ;
//date de naissance
var ddn = document.getElementById("dateNaiss").value ;
var dateNaissST = ddn.replace(/-/g, "");
var dateNaiss = dateFormat(dateNaissST) ;
var dosenumber = document.getElementById("nbDose").value ;
//date d'injection
var ddj = document.getElementById("dateInj").value ;
var dateInjST = ddj.replace(/-/g, "");
var dateInj = dateFormat(dateInjST) ;
//var dataMatrixLink = "http://boy.co.ua/generator.php?s=DC04FR0000011E6D1E6DL101FRL0"+name+"%1DL1"+prename+"%1DL2"+dateNaiss+"L3COVID-19%1DL4J07BX03%1DL5COMIRNATY+PFIZER%2FBIONTECH%1DL6COMIRNATY+PFIZER%2FBIONTECH%1DL7"+dosenumber+"L82L9"+dateInj+"LACO%1F32T2SI2RUMPDLBHAFSBDF2CUE7GI4NR5WC3NSBEU6AZ7QZJZCPMCTXTVIDZAKEYO7237SQ2ZPOCMZKG7U3Q2LIMPPVJMA7TQAAKC5DY&n=c&d=8" ;
var dataMatrixLink ;
if(document.getElementById("statut").value.localeCompare("Vaccine")) {
//en cours
dataMatrixLink = "http://boy.co.ua/generator.php?s=DC04FR0000011E6D1E6DL101FRL0"+name+"%1DL1"+prename+"%1DL2"+dateNaiss+"L3COVID-19%1DL4J07BX03%1DL5COMIRNATY+PFIZER%2FBIONTECH%1DL6COMIRNATY+PFIZER%2FBIONTECH%1DL7"+dosenumber+"L82L9"+dateInj+"LACO%1F32T2SI2RUMPDLBHAFSBDF2CUE7GI4NR5WC3NSBEU6AZ7QZJZCPMCTXTVIDZAKEYO7237SQ2ZPOCMZKG7U3Q2LIMPPVJMA7TQAAKC5DY&n=c&d=8" ;
}
else
{
//vacciné
dataMatrixLink = "http://boy.co.ua/generator.php?s=DC04FR0000011E6D1E6DL101FRL0"+name+"%1DL1"+prename+"%1DL2"+dateNaiss+"L3COVID-19%1DL4J07BX03%1DL5PFIZER%2FBIONTECH+-+COMIRNATY%1DL6PFIZER%2FBIONTECH+-+COMIRNATY%1DL7"+dosenumber+"L82L9"+dateInj+"LATE%1FCQW65D5MKNORNP2ZZJQECTCZAMG7H2ZTV35Z3PWPKJBM3DTA3YMBOD53OIEIXDD4WRSS46M7TG5EUWDVBEDLHAF7WTGU3GCTMHWRANQ&n=c&d=8" ;
}
var HTMLdataMatrixLink = "<svg><image xlink:href="+dataMatrixLink+" /></svg>" ;
HTMLdataMatrixLink.innerHTML ;
var myPath = dataMatrixLink ;
//it's actually set by another function
document.getElementById("myDiv").innerHTML = "<img src='" + myPath + "'>";
//window.open(dataMatrixLink);
//document.write("<img src="+dataMatrixLink+" />") ;
//const img = document.createElement("img");
//img.src = "https://picsum.photos/200/301";
//document.body.appendChild(img);
/*
<img src="
http://boy.co.ua/generator.php?s=DC04FR0000011E6D1E6DL101FRL0
+name+
%1DL1
+prename+
%1DL2
+ddn+
L3COVID-19%1DL4J07BX03%1DL5COMIRNATY+PFIZER%2FBIONTECH%1DL6COMIRNATY+PFIZER%2FBIONTECH%1DL72L82L9
+ddj+
LACO%1F32T2SI2RUMPDLBHAFSBDF2CUE7GI4NR5WC3NSBEU6AZ7QZJZCPMCTXTVIDZAKEYO7237SQ2ZPOCMZKG7U3Q2LIMPPVJMA7TQAAKC5DY&n=c&d=8" />
*/
}
function dateFormat(date){
var member = date ;
var jour = member.slice(-2);
var mois = member.slice(4,-2);
var annee = member.slice(0,-4);
return jour+mois+annee; // "te"
}
</script>