|
|
@@ -9,21 +9,17 @@ $("#qrr-close").on("click", function () {
|
|
|
|
|
|
function checkEmagementControl() {
|
|
|
if (checkconnection()) {
|
|
|
+ const currentUrl = window.location;
|
|
|
+ const targetUrl = new URL($("#QRCodeRead").val());
|
|
|
|
|
|
- $.ajax({
|
|
|
- url: $("#QRCodeRead").val(),
|
|
|
- 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 (xhr, status, error) {
|
|
|
+ // 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";
|
|
|
@@ -33,19 +29,11 @@ function checkEmagementControl() {
|
|
|
$('#ResultQRCode').remove();
|
|
|
$("#confirmationModal").append(getConfirmModal(retour));
|
|
|
$('#ResultQRCode').modal("show");
|
|
|
- });
|
|
|
- $("#QRCodeRead").removeAttr('value');
|
|
|
-
|
|
|
+ }
|
|
|
} else {
|
|
|
$("#divOffline").empty();
|
|
|
- $("#divOffline").append('<div class="alert alert-warning alertLogin" role="alert">Vous n\'êtes pas connecté à internet</div>');
|
|
|
+ $("#divOffline").append('<div class="alert alert-warning" role="alert">Vous n\'êtes pas connecté à internet</div>');
|
|
|
$("#divOffline").show();
|
|
|
- window.setTimeout(function () {
|
|
|
- $("#divOffline").fadeTo(600, 0).slideUp(600, function () {
|
|
|
- $(this).hide();
|
|
|
- $(this).css('opacity', '1');
|
|
|
- });
|
|
|
- }, 1000);
|
|
|
}
|
|
|
}
|
|
|
|