assure/Vue/Ajaxconnexioncookie/french.php

418 lines
17 KiB
PHP
Executable File

<?php
$maintenance = $societeusersaas['maintenance'];
if($maintenance=='1')
{
$msgErreur = 'Site en maintenance, veuillez vous reconnecter plus tard!';
}
?>
<!-- Tableau desktop (affiché sur les écrans moyens et grands) -->
<div class="d-none d-md-block">
<span class="login100-form-title" style="font-family: Play-Bold; color:#e5e5e5; margin-top: 5px; margin-bottom:10px;">
Portail Assuré
</span>
<?php if (isset($msgErreur) and $msgErreur>" "): ?>
<div class="text-center p-t-10">
<h4 class="txt3">
<div class="col-12 alert alert-danger">
<?= $msgErreur ?>
</div>
</h4>
</div>
<?php else: ?>
<div class="text-center p-t-10" id="div_msgErreur">
</div>
<?php endif; ?>
<?php if($maintenance!='1'): ?>
<div class="wrap-input100">
<label for="langue">Langue</label>
<select class="form-select" id="langue" name="langue"
required autocomplete="off" onchange="javascript:changer_langue_connexion();">
<?php liste_options($langues, $_SESSION['lang'], true); ?>
</select>
</div>
<div class="wrap-input100">
<div class="wrap-input100 validate-input" data-validate="Enter Entity">
<label for="codeSociete">Entité</label>
<input class="input100" type="text" name="codeSociete" id="codeSociete" value="<?= $codeSociete ?>"
placeholder="Entité" style="text-align:center;" required AUTOCOMPLETE="off"
onChange="javascript:changer_entite_portail();" >
</div>
</div>
<div id="div_login_portail" class="wrap-input100">
<div class="wrap-input100 validate-input" data-validate="Enter username">
<label for="login">Identifiant</label>
<input class="input100" type="text" name="login" id="login" value="<?= $codeUtilisateur ?>" placeholder="Identifiant" style="text-align:center;" required AUTOCOMPLETE="off">
</div>
</div>
<div class="wrap-input100 validate-input" data-validate="Enter password">
<label for="mdp">Mot de passe</label>
<input class="input100" type="password" name="mdp" id="mdp" placeholder="Mot de passe" style="text-align:center;" required AUTOCOMPLETE="off">
</div>
<div class="container-login100-form-btn">
<button name="btn_connexion" id="btn_connexion" class="btn login-btn">
Connexion
</button>
</div>
<div class="footer">
Tous droits réservés <a href="https://www.ebene.info/">&copy; EBENE SOLUTIONS INFORMATIQUES</a>
</div>
<?php endif; ?>
</div>
<!-- Affichage mobile (cartes) -->
<div class="d-md-none">
<!-- VERSION MOBILE IDENTIQUE AU DESKTOP MAIS STYLÉE POUR MOBILE -->
<span class="login100-form-title" style="font-family: Play-Bold; color:#e5e5e5; margin: 10px 0 15px 0; display: block; text-align: center; font-size: 20px; width: 100%;">
Portail Assuré
</span>
<?php if (isset($msgErreur) and $msgErreur>" "): ?>
<div class="text-center p-t-10" style="margin-bottom: 15px; width: 100%;">
<h4 class="txt3">
<div class="col-12 alert alert-danger" style="padding: 10px; font-size: 13px; border-radius: 8px; max-width: 300px; margin: 0 auto;">
<?= $msgErreur ?>
</div>
</h4>
</div>
<?php else: ?>
<div class="text-center p-t-10" id="div_msgErreur" style="margin-bottom: 15px;"></div>
<?php endif; ?>
<?php if($maintenance!='1'): ?>
<!-- MÊME STRUCTURE QUE DESKTOP MAIS EN COLONNE -->
<div style="width: 100%; max-width: 100%; overflow: hidden; padding: 0 10px; box-sizing: border-box;">
<!-- Langue -->
<div class="wrap-input100" style="margin-bottom: 15px; text-align: center; width: 100%;">
<label for="langue" style="font-size: 12pt; display: block; margin-bottom: 5px; width: 100%; text-align: center;">Langue</label>
<select class="form-select" id="langue" name="langue"
style="width: 100%; max-width: 300px; height: 40px; margin: 0 auto; border: 2px solid #7D4FFE; border-radius: 9px; background: transparent; font-size: 14px; color: #7D4FFE; text-align: center; padding: 0 10px; box-sizing: border-box; display: block;"
required autocomplete="off" onchange="javascript:changer_langue_connexion();">
<?php liste_options($langues, $_SESSION['lang'], true); ?>
</select>
</div>
<!-- Entité -->
<div class="wrap-input100" style="margin-bottom: 15px; text-align: center; width: 100%;">
<div class="wrap-input100 validate-input">
<label for="codeSociete" style="font-size: 12pt; display: block; margin-bottom: 5px; width: 100%; text-align: center;">Entité</label>
<input class="input100" type="text" name="codeSociete" id="codeSociete" value="<?= $codeSociete ?>"
placeholder="Entité"
style="width: 100%; max-width: 300px; height: 40px; margin: 0 auto; border: 2px solid #7D4FFE; border-radius: 9px; color: #7D4FFE; text-align: center; padding: 0 10px; box-sizing: border-box; display: block;"
required AUTOCOMPLETE="off"
onChange="javascript:changer_entite_portail();">
</div>
</div>
<!-- Identifiant -->
<div id="div_login_portail" class="wrap-input100" style="margin-bottom: 15px; text-align: center; width: 100%;">
<div class="wrap-input100 validate-input">
<label for="login" style="font-size: 12pt; display: block; margin-bottom: 5px; width: 100%; text-align: center;">Identifiant</label>
<input class="input100" type="text" name="login" id="login" value="<?= $codeUtilisateur ?>"
placeholder="Identifiant"
style="width: 100%; max-width: 300px; height: 40px; margin: 0 auto; border: 2px solid #7D4FFE; border-radius: 9px; color: #7D4FFE; text-align: center; padding: 0 10px; box-sizing: border-box; display: block;"
required AUTOCOMPLETE="off">
</div>
</div>
<!-- Mot de passe -->
<div class="wrap-input100 validate-input" style="margin-bottom: 20px; text-align: center; width: 100%;">
<label for="mdp" style="font-size: 12pt; display: block; margin-bottom: 5px; width: 100%; text-align: center;">Mot de passe</label>
<input class="input100" type="password" name="mdp" id="mdp" placeholder="Mot de passe"
style="width: 100%; max-width: 300px; height: 40px; margin: 0 auto; border: 2px solid #7D4FFE; border-radius: 9px; color: #7D4FFE; text-align: center; padding: 0 10px; box-sizing: border-box; display: block;"
required AUTOCOMPLETE="off">
</div>
<!-- Bouton Connexion - MÊME ID ET MÊME COMPORTEMENT -->
<div class="container-login100-form-btn" style="margin-bottom: 20px; text-align: center; width: 100%;">
<button name="btn_connexion" id="btn_connexion" class="btn login-btn"
style="width: 100%; max-width: 300px; height: 45px; margin: 0 auto; background: #7D4FFE; color: white; font-size: 16px; font-weight: 700; border-radius: 9px; border: none; box-sizing: border-box; display: block;">
Connexion
</button>
</div>
</div>
<!-- Footer -->
<div class="footer" style="position: relative; font-size: 11px; text-align: center; padding: 10px 0; width: 100%; max-width: 300px; margin: 10px auto 0; box-sizing: border-box;">
Tous droits réservés <a href="https://www.ebene.info/">&copy; EBENE SOLUTIONS INFORMATIQUES</a>
</div>
<?php endif; ?>
</div>
<!-- STYLES CRITIQUES POUR ÉLIMINER LE DÉBORDEMENT -->
<style>
/* RÈGLES STRICTES POUR ÉVITER TOUT DÉBORDEMENT */
.d-md-none {
width: 100vw !important;
max-width: 100vw !important;
overflow-x: hidden !important;
box-sizing: border-box !important;
display: none; /* Caché par défaut */
}
/* SUR MOBILE SEULEMENT */
@media screen and (max-width: 767px) {
/* FORCE LE VIEWPORT */
body, html {
width: 100vw !important;
max-width: 100vw !important;
overflow-x: hidden !important;
position: relative !important;
}
/* AFFICHER MOBILE, CACHER DESKTOP */
.d-md-none {
display: block !important;
}
.d-none.d-md-block {
display: none !important;
}
/* CORRECTION DU CONTENEUR PRINCIPAL */
.container-fluid {
width: 100vw !important;
max-width: 100vw !important;
overflow-x: hidden !important;
margin: 0 !important;
padding: 0 !important;
}
.content {
width: 100vw !important;
max-width: 100vw !important;
padding: 10px !important;
margin: 0 !important;
overflow-x: hidden !important;
}
/* STYLES SPÉCIFIQUES POUR LES CHAMPS MOBILES */
.d-md-none > div:last-child {
width: 100% !important;
max-width: 100% !important;
overflow: hidden !important;
}
/* TOUS LES ÉLÉMENTS ONT UNE LARGEUR MAX */
.d-md-none input,
.d-md-none select,
.d-md-none .login-btn,
.d-md-none .footer {
max-width: 300px !important;
width: 100% !important;
margin-left: auto !important;
margin-right: auto !important;
}
/* FORCE LE CENTRAGE */
.wrap-input100 {
text-align: center !important;
width: 100% !important;
}
/* POUR LES TRÈS PETITS ÉCRANS */
@media screen and (max-width: 320px) {
.d-md-none input,
.d-md-none select,
.d-md-none .login-btn,
.d-md-none .footer {
max-width: 280px !important;
}
}
}
/* SUR DESKTOP - CACHER MOBILE */
@media screen and (min-width: 768px) {
.d-md-none {
display: none !important;
}
.d-none.d-md-block {
display: block !important;
}
}
</style>
<script>
// ============================================
// SOLUTION SIMPLE POUR LES IDs EN DOUBLE
// ============================================
// 1. AU CHARGEMENT, CACHER LA VERSION INACTIVE
document.addEventListener('DOMContentLoaded', function() {
console.log('Initialisation...');
function gererAffichage() {
const isMobile = window.innerWidth <= 767;
if (isMobile) {
// SUR MOBILE: cacher desktop, montrer mobile
const desktopElements = document.querySelectorAll('.d-none.d-md-block, .d-none.d-md-block *');
const mobileElements = document.querySelectorAll('.d-md-none, .d-md-none *');
desktopElements.forEach(el => {
if (el.id) el.id = el.id + '_desktop_hidden';
el.style.display = 'none';
});
mobileElements.forEach(el => {
el.style.display = '';
});
console.log('Mode mobile activé');
} else {
// SUR DESKTOP: cacher mobile, montrer desktop
const mobileElements = document.querySelectorAll('.d-md-none, .d-md-none *');
const desktopElements = document.querySelectorAll('.d-none.d-md-block, .d-none.d-md-block *');
mobileElements.forEach(el => {
if (el.id) el.id = el.id + '_mobile_hidden';
el.style.display = 'none';
});
desktopElements.forEach(el => {
el.style.display = '';
// Restaurer les IDs originaux
if (el.id && el.id.endsWith('_desktop_hidden')) {
el.id = el.id.replace('_desktop_hidden', '');
}
});
console.log('Mode desktop activé');
}
// FORCER LA SUPPRESSION DU DÉBORDEMENT
document.body.style.overflowX = 'hidden';
document.documentElement.style.overflowX = 'hidden';
}
// 2. SOLUTION DE CONNEXION POUR MOBILE
// Le bouton a le même ID, donc il devrait fonctionner comme le desktop
// Mais au cas où, ajoutons un fallback
function setupConnexionMobile() {
const btnConnexion = document.getElementById('btn_connexion');
if (btnConnexion) {
// Sauvegarder l'original
const originalOnClick = btnConnexion.onclick;
btnConnexion.addEventListener('click', function(e) {
console.log('Bouton connexion cliqué');
if (window.innerWidth <= 767) {
console.log('Mode mobile - validation...');
// Validation des champs
const codeSociete = document.getElementById('codeSociete')?.value.trim();
const login = document.getElementById('login')?.value.trim();
const mdp = document.getElementById('mdp')?.value.trim();
if (!codeSociete || !login || !mdp) {
e.preventDefault();
alert('Veuillez remplir tous les champs');
return false;
}
console.log('Validation OK, soumission...');
// Trouver le formulaire parent
let form = btnConnexion.closest('form');
if (!form) {
// Chercher un formulaire dans la page
form = document.querySelector('form');
}
if (form) {
console.log('Formulaire trouvé, soumission...');
// Laisser le navigateur soumettre normalement
return true;
} else {
console.error('Aucun formulaire trouvé!');
// Fallback: redirection
const params = new URLSearchParams();
params.append('codeSociete', codeSociete);
params.append('login', login);
params.append('mdp', mdp);
params.append('langue', document.getElementById('langue').value);
window.location.href = window.location.pathname + '?' + params.toString();
return false;
}
}
// Sur desktop, laisser le comportement original
if (originalOnClick) {
return originalOnClick.call(this, e);
}
return true;
});
}
}
// Initialiser
gererAffichage();
setupConnexionMobile();
// Ré-initialiser au redimensionnement
window.addEventListener('resize', function() {
setTimeout(gererAffichage, 100);
setTimeout(setupConnexionMobile, 150);
});
// 3. CORRECTION URGENTE DU DÉBORDEMENT
setTimeout(function() {
const allElements = document.querySelectorAll('*');
allElements.forEach(el => {
el.style.maxWidth = '100vw';
el.style.boxSizing = 'border-box';
});
}, 500);
});
// ============================================
// SOLUTION ALTERNATIVE: ATTENDRE QUE LE DESKTOP SOIT CHARGÉ
// ============================================
// Attendre que le JavaScript desktop soit chargé
setTimeout(function() {
console.log('Vérification des fonctions desktop...');
// Si les fonctions desktop existent, les utiliser
if (typeof changer_langue_connexion === 'function') {
console.log('Fonction changer_langue_connexion trouvée');
}
if (typeof changer_entite_portail === 'function') {
console.log('Fonction changer_entite_portail trouvée');
}
// Le bouton devrait déjà fonctionner via le JS desktop
// Mais ajoutons un écouteur de débogage
document.getElementById('btn_connexion')?.addEventListener('click', function() {
console.log('DEBUG - Bouton cliqué, width:', window.innerWidth);
console.log('Champs:', {
codeSociete: document.getElementById('codeSociete')?.value,
login: document.getElementById('login')?.value,
mdp: document.getElementById('mdp')?.value
});
});
}, 1000);
</script>