mirror of
https://github.com/24eme/signaturepdf.git
synced 2023-08-25 09:33:08 +02:00
Formatting of the signature counter
This commit is contained in:
parent
487434e8b9
commit
35c31d3d8b
@ -887,6 +887,13 @@ var createEventsListener = function() {
|
|||||||
document.getElementById('btn-zoom-increase').addEventListener('click', function() {
|
document.getElementById('btn-zoom-increase').addEventListener('click', function() {
|
||||||
zoomChange(1)
|
zoomChange(1)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(hash) {
|
||||||
|
updateNbLayers();
|
||||||
|
setInterval(function() {
|
||||||
|
updateNbLayers();
|
||||||
|
}, 10000);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var createSignaturePad = function() {
|
var createSignaturePad = function() {
|
||||||
@ -985,12 +992,19 @@ var pageUpload = async function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var printNbLayers = function(element) {
|
var updateNbLayers = function() {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open('GET', element.getAttribute('data-ajax'), true);
|
xhr.open('GET', '/signature/'+hash+'/nblayers', true);
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
if (xhr.status == 200) {
|
if (xhr.status == 200) {
|
||||||
element.innerHTML = xhr.response;
|
let nblayers = xhr.response;
|
||||||
|
document.querySelectorAll('.nblayers').forEach(function(item) {
|
||||||
|
item.innerHTML = nblayers;
|
||||||
|
});
|
||||||
|
document.querySelector('#nblayers_text').classList.remove('d-none');
|
||||||
|
if(!nblayers) {
|
||||||
|
document.querySelector('#nblayers_text').classList.add('d-none');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.send();
|
xhr.send();
|
||||||
@ -1043,14 +1057,6 @@ 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 () {
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
<div style="height: 55px;" class="d-md-none"></div>
|
<div style="height: 55px;" class="d-md-none"></div>
|
||||||
<div class="offcanvas offcanvas-end show d-none d-md-block shadow-sm" data-bs-backdrop="false" data-bs-scroll="true" data-bs-keyboard="false" tabindex="-1" id="sidebarTools" aria-labelledby="sidebarToolsLabel">
|
<div class="offcanvas offcanvas-end show d-none d-md-block shadow-sm" data-bs-backdrop="false" data-bs-scroll="true" data-bs-keyboard="false" tabindex="-1" id="sidebarTools" aria-labelledby="sidebarToolsLabel">
|
||||||
<div class="offcanvas-header mb-0 pb-0">
|
<div class="offcanvas-header mb-0 pb-0">
|
||||||
<h5 class="mb-1" id="sidebarToolsLabel">Signature du PDF<?php if(isset($hash)): ?> <i class="bi bi-people-fill"></i><?php endif; ?></h5>
|
<h5 class="mb-1 d-block w-100" id="sidebarToolsLabel">Signature du PDF <?php if(isset($hash)): ?><span class="small float-end"><i class="bi bi-people-fill"></i> <span class="nblayers">0</span></span><?php else: ?><span class="float-end opacity-25 small"><i class="bi bi-person-workspace"></i></span></span><?php endif; ?></h5>
|
||||||
<button type="button" class="btn-close text-reset d-md-none" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
<button type="button" class="btn-close text-reset d-md-none" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="offcanvas-body pt-0">
|
<div class="offcanvas-body pt-0">
|
||||||
@ -81,7 +81,7 @@
|
|||||||
<form id="form_sharing" action="/share" method="post" enctype="multipart/form-data">
|
<form id="form_sharing" action="/share" method="post" enctype="multipart/form-data">
|
||||||
<input id="input_pdf_share" name="pdf" type="file" class="d-none" />
|
<input id="input_pdf_share" name="pdf" type="file" class="d-none" />
|
||||||
<input id="input_svg_share" name="svg[]" type="file" class="d-none" />
|
<input id="input_svg_share" name="svg[]" type="file" class="d-none" />
|
||||||
<div class="d-grid gap-2 mt-2">
|
<div class="d-grid gap-2 mb-1">
|
||||||
<button class="btn btn-outline-dark w-100" type="submit" id="save_share"><i class="bi bi-share"></i> Partager pour signer <i class="bi bi-people-fill"></i> à plusieurs </button>
|
<button class="btn btn-outline-dark w-100" type="submit" id="save_share"><i class="bi bi-share"></i> Partager pour signer <i class="bi bi-people-fill"></i> à plusieurs </button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -91,8 +91,8 @@
|
|||||||
<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>
|
<p id="nblayers_text" class="small d-none mb-2 opacity-50">Vous êtes <span class="badge rounded-pill bg-dark text-white"><span class="nblayers">0</span> <i class="bi bi-people-fill"></i></span> à avoir signé ce PDF</p>
|
||||||
<div class="btn-group w-100">
|
<div class="btn-group w-100 mb-1">
|
||||||
<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>
|
||||||
<button class="btn btn-outline-dark" type="button" id="btn_share" data-bs-toggle="modal" data-bs-target="#modal-share-informations"><i class="bi bi-share"></i></button>
|
<button class="btn btn-outline-dark" type="button" id="btn_share" data-bs-toggle="modal" data-bs-target="#modal-share-informations"><i class="bi bi-share"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user