|
|
@@ -121,30 +121,18 @@ $("#qrr-close").on("click", function () {
|
|
|
});
|
|
|
|
|
|
function checkEmagementSalarie(){
|
|
|
- var formData = {
|
|
|
- form: $("#emargementControlFrom").val(),
|
|
|
- event: $("#form-event").val(),
|
|
|
- qRcode: $("#QRCodeRead").val(),
|
|
|
- };
|
|
|
-
|
|
|
if (checkconnection()) {
|
|
|
-
|
|
|
- $.ajax({
|
|
|
- type: "POST",
|
|
|
- url: "json.php?jsonData=check-control-emargement",
|
|
|
- data: formData,
|
|
|
- dataType: "json",
|
|
|
- encode: true,
|
|
|
- }).done(function (data) {
|
|
|
- $('#ResultQRCode').remove();
|
|
|
- $("#confirmationModal").append(getConfirmModal(data));
|
|
|
- $('#ResultQRCode').modal("show");
|
|
|
- if (data["result"] == true) {
|
|
|
- $('#ResultQRCode').on('hidden.bs.modal', function () {
|
|
|
- getEvements();
|
|
|
- });
|
|
|
- }
|
|
|
- }).fail(function () {
|
|
|
+ const currentUrl = window.location;
|
|
|
+ const targetUrl = new URL($("#QRCodeRead").val());
|
|
|
+
|
|
|
+ // Vérifiez si les deux URLs sont du même domaine
|
|
|
+ if (currentUrl.protocol === targetUrl.protocol &&
|
|
|
+ currentUrl.hostname === targetUrl.hostname &&
|
|
|
+ currentUrl.port === targetUrl.port) {
|
|
|
+
|
|
|
+ // Redirigez vers l'URL cible
|
|
|
+ window.location.replace(targetUrl.href);
|
|
|
+ } else {
|
|
|
retour = Array;
|
|
|
retour["result"] = false;
|
|
|
retour["description"] = "Le QR-Code n'est pas valide";
|
|
|
@@ -154,9 +142,7 @@ function checkEmagementSalarie(){
|
|
|
$('#ResultQRCode').remove();
|
|
|
$("#confirmationModal").append(getConfirmModal(retour));
|
|
|
$('#ResultQRCode').modal("show");
|
|
|
- });
|
|
|
- $("#QRCodeRead").removeAttr('value');
|
|
|
-
|
|
|
+ }
|
|
|
} else {
|
|
|
$("#divOffline").empty();
|
|
|
$("#divOffline").append('<div class="alert alert-warning" role="alert">Vous n\'êtes pas connecté à internet</div>');
|