Compare commits
No commits in common. "a2c86b587bb7fe12d04656d7f142e8f5bc1ac066" and "ca11bae56cf26c6e7bda8369650c80289b3073bf" have entirely different histories.
a2c86b587b
...
ca11bae56c
4 changed files with 19 additions and 81 deletions
|
@ -3,40 +3,10 @@
|
|||
<head>
|
||||
<script src="https://unpkg.com/html5-qrcode"></script>
|
||||
</head>
|
||||
<style>
|
||||
#reader {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#qr-reader {
|
||||
position: absolute;
|
||||
width:800px;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
#wave {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
visibility: hidden;
|
||||
width:800px;
|
||||
height: 640px;
|
||||
background-color: #cccccc;
|
||||
background-image: url('wave.gif');
|
||||
background-repeat: no-repeat;
|
||||
background-size: auto;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<H1>Osvobozená základní škola - Docházka</H1>
|
||||
<H2>Ukaž svoji školní průkazku</H2>
|
||||
<div id="reader">
|
||||
<div id="qr-reader" ></div>
|
||||
<div id="wave"></div>
|
||||
</div>
|
||||
<div id="qr-reader" style="width:800px; background-color: #cccccc;"></div>
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -51,7 +21,7 @@
|
|||
var at_school = JSON.parse(at_school_json);
|
||||
console.log(at_school);
|
||||
var result = "<ul>";
|
||||
for(var i in at_school){
|
||||
for (var i = 0; i < at_school.length; i++) {
|
||||
result += "<li>"+ at_school[i] + "</li>";
|
||||
}
|
||||
result += "</ul>";
|
||||
|
@ -59,16 +29,14 @@
|
|||
return result;
|
||||
}
|
||||
function onScanSuccess(decodedText, decodedResult) {
|
||||
const card = JSON.parse(decodedText);
|
||||
var fullname = card.name+" "+card.surname;
|
||||
document.getElementById('qr-reader-results').textContent = fullname;
|
||||
//document.getElementById('qr-reader-results').textContent = decodedText;
|
||||
html5QrcodeScanner.pause();
|
||||
// const card = JSON.parse(decodedText);
|
||||
// document.getElementById('qr-reader-results').textContent = card.salutation;
|
||||
document.getElementById('qr-reader-results').textContent = decodedText;
|
||||
html5QrcodeScanner.clear();
|
||||
document.getElementById('wave').style.visibility = "visible";
|
||||
|
||||
var formData ={};
|
||||
formData.id=card.id;
|
||||
formData.name=fullname;
|
||||
formData.id=33;
|
||||
formData.name=decodedText;
|
||||
formData.direction=document.querySelector('input[name="entrance"]:checked').id;
|
||||
formData.main=true;
|
||||
console.log(JSON.stringify(formData));
|
||||
|
@ -78,13 +46,12 @@
|
|||
},
|
||||
body:JSON.stringify(formData)
|
||||
}).then(response => response.text())
|
||||
.then(data => document.getElementById('qr-reader-results').textContent = data);
|
||||
//.then(data => document.querySelector("p.result").innerHTML = data);
|
||||
.then(data => document.querySelector("p.result").innerHTML = data);
|
||||
|
||||
setTimeout(() => {
|
||||
document.getElementById('qr-reader-results').textContent = "Načítám ...";
|
||||
document.getElementById('wave').style.visibility = "hidden";
|
||||
html5QrcodeScanner.resume();
|
||||
html5QrcodeScanner.render(onScanSuccess);
|
||||
get_at_school();
|
||||
}, 4000);
|
||||
|
||||
|
@ -101,7 +68,9 @@
|
|||
</label>
|
||||
<H3>Kdo jsi? </H3>
|
||||
<p id="qr-reader-results">Načítám ...</p>
|
||||
<p class="result"></p>
|
||||
<H3>Kdo je ve škole</H3>
|
||||
<p id="at-school">Načítám ...</p>
|
||||
<img style = "visibility:hidden" id = "wave" src="giphy.webp"/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -29,16 +29,17 @@ $pozadavek = json_decode($postdata);
|
|||
//check if student is already at school
|
||||
//if not, add him to the list
|
||||
if ($pozadavek->direction == "P") {
|
||||
if( !isset($at_school[$pozadavek->id])) {
|
||||
$at_school[$pozadavek->id] = $pozadavek->name;
|
||||
if( !in_array($pozadavek->name, $at_school)) {
|
||||
$at_school[] = $pozadavek->name;
|
||||
} else {
|
||||
echo $pozadavek->name." už je ve škole";
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
//if student is already at school, remove him from the list
|
||||
if( isset($at_school[$pozadavek->id])) {
|
||||
unset($at_school[$pozadavek->id]);
|
||||
if( in_array($pozadavek->name, $at_school)) {
|
||||
$key = array_search($pozadavek->name, $at_school);
|
||||
unset($at_school[$key]);
|
||||
} else {
|
||||
echo $pozadavek->name." není ve škole";
|
||||
return;
|
||||
|
@ -57,8 +58,8 @@ $pruchod = array(
|
|||
"CteckaId" => "CAM1",
|
||||
"Poznamka" => ""
|
||||
);
|
||||
$payload = json_encode($pruchod);
|
||||
echo $pozadavek->name;
|
||||
$payload = json_encode($pruchod)."<br>";
|
||||
echo $payload;
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url.$cesta);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
include '../src/osvobdoch_vars.php';
|
||||
include '../src/osvobdoch_local_vars.php';
|
||||
$metoda = "GET";
|
||||
$cesta = "/api/dochazka/v2/pracovnici";
|
||||
# cas "2016-09-30 11:54:12.637";
|
||||
date_default_timezone_set('Europe/Prague');
|
||||
$cas= date("Y-m-d H:i:s");
|
||||
$data = $metoda ."+".$cesta . "+" . $cas . "+" . $apiheslo;
|
||||
$hash = hash_hmac("sha1", $data, $key, $raw_output=false);
|
||||
$auth = $apiuser . ":" . $hash;
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url.$cesta);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $metoda);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
"com.edookit.Time: ".$cas,
|
||||
"com.edookit.Auth: ".$auth,
|
||||
"com.edookit.Client: ".$id
|
||||
));
|
||||
$result = curl_exec($ch);
|
||||
echo $result;
|
||||
?>
|
|
@ -1,9 +0,0 @@
|
|||
!#/bin/bash
|
||||
cat students.json | jq -c '.Zaci[]|{id: .PkZak, name: .Jmeno, surname: .Prijmeni }' | while read line; do
|
||||
id=$(echo $line | jq -r '.id')
|
||||
name=$(echo $line | jq -r '.name')
|
||||
surname=$(echo $line | jq -r '.surname')
|
||||
echo "Processing $name $surname "
|
||||
qrencode -o "qrcodes/$id.png" $line
|
||||
convert -size 1000x640 xc:white templates/background.png -geometry 500x460+0+200 -composite templates/logo.png -geometry 420x100+40+40 -composite -background transparent -fill black -size 420x240 -font templates/Quicksand-VariableFont_wght.ttf caption:"$name\n$surname" -geometry +40+220 -composite qrcodes/$id.png -geometry 420x420+540+140 -composite "cards/$name-$surname.png"
|
||||
done
|
Loading…
Reference in a new issue