1
0
mirror of https://github.com/24eme/signaturepdf.git synced 2023-08-25 09:33:08 +02:00

get and print nb layers

This commit is contained in:
Jb Lm 2022-04-01 15:43:47 +02:00
parent cf41808878
commit 62615bd649
2 changed files with 20 additions and 0 deletions

View File

@ -976,6 +976,17 @@ var pageUpload = async function() {
}); });
} }
var printNbLayers = function(element) {
const xhr = new XMLHttpRequest();
xhr.open('GET', element.getAttribute('data-ajax'), true);
xhr.onload = function() {
if (xhr.status == 200) {
element.innerHTML = xhr.response;
}
};
xhr.send();
};
var pageSignature = async function(url) { var pageSignature = async function(url) {
modalSharing(); modalSharing();
document.getElementById('page-upload').classList.add('d-none'); document.getElementById('page-upload').classList.add('d-none');
@ -1023,6 +1034,14 @@ var pageSignature = async function(url) {
stateAddLock(); stateAddLock();
createEventsListener(); createEventsListener();
loadPDF(pdfBlob, filename); loadPDF(pdfBlob, filename);
let element = document.getElementById('nblayers');
if(element) {
printNbLayers(element);
setInterval(function() {
printNbLayers(element);
}, 10000);
}
}; };
(function () { (function () {

View File

@ -91,6 +91,7 @@
<button class="btn btn-primary w-100 mt-2" disabled="disabled" type="submit" id="save"><i class="bi bi-download"></i> Télécharger le PDF signé</button> <button class="btn btn-primary w-100 mt-2" disabled="disabled" type="submit" id="save"><i class="bi bi-download"></i> Télécharger le PDF signé</button>
</form> </form>
<?php else: ?> <?php else: ?>
<p>Nombre de signataire : <span id="nblayers" data-ajax="/signature/<?php echo $hash ?>/nblayers">0</span></p>
<a id="btn_download" class="btn btn-outline-dark w-100" href="/signature/<?php echo $hash ?>/pdf"><i class="bi bi-download"></i> Télécharger le PDF</a> <a id="btn_download" class="btn btn-outline-dark w-100" href="/signature/<?php echo $hash ?>/pdf"><i class="bi bi-download"></i> Télécharger le PDF</a>
<form id="form_pdf" action="/signature/<?php echo $hash ?>/save" method="post" enctype="multipart/form-data"> <form id="form_pdf" action="/signature/<?php echo $hash ?>/save" method="post" enctype="multipart/form-data">
<input id="input_svg" name="svg[]" type="file" class="d-none" /> <input id="input_svg" name="svg[]" type="file" class="d-none" />