Version DeepSeek corrigée v1.9
This commit is contained in:
parent
2ac8f83bcb
commit
2326d29102
|
|
@ -72,138 +72,167 @@
|
||||||
|
|
||||||
<!-- Affichage mobile (cartes) -->
|
<!-- Affichage mobile (cartes) -->
|
||||||
<div class="d-md-none">
|
<div class="d-md-none">
|
||||||
<!-- VERSION MOBILE FONCTIONNELLE -->
|
<!-- VERSION MOBILE IDENTIQUE AU DESKTOP MAIS STYLÉE POUR MOBILE -->
|
||||||
|
|
||||||
<span class="login100-form-title" style="font-family: Play-Bold; color:#e5e5e5; margin-top: 5px; margin-bottom:15px; display: block; text-align: center; font-size: 20px;">
|
<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é
|
Portail Assuré
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<?php if (isset($msgErreur) and $msgErreur>" "): ?>
|
<?php if (isset($msgErreur) and $msgErreur>" "): ?>
|
||||||
<div class="text-center p-t-10" style="margin-bottom: 15px;">
|
<div class="text-center p-t-10" style="margin-bottom: 15px; width: 100%;">
|
||||||
<h4 class="txt3">
|
<h4 class="txt3">
|
||||||
<div class="col-12 alert alert-danger" style="padding: 10px; font-size: 13px; border-radius: 8px;">
|
<div class="col-12 alert alert-danger" style="padding: 10px; font-size: 13px; border-radius: 8px; max-width: 300px; margin: 0 auto;">
|
||||||
<?= $msgErreur ?>
|
<?= $msgErreur ?>
|
||||||
</div>
|
</div>
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div class="text-center p-t-10" id="div_msgErreur_mobile" style="margin-bottom: 15px;"></div>
|
<div class="text-center p-t-10" id="div_msgErreur" style="margin-bottom: 15px;"></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if($maintenance!='1'): ?>
|
<?php if($maintenance!='1'): ?>
|
||||||
|
|
||||||
<!-- FORMULAIRE MOBILE AVEC ACTION EXPLICITE -->
|
<!-- MÊME STRUCTURE QUE DESKTOP MAIS EN COLONNE -->
|
||||||
<form id="form_mobile" method="POST" action="" style="width: 100%; max-width: 300px; margin: 0 auto;">
|
<div style="width: 100%; max-width: 100%; overflow: hidden; padding: 0 10px; box-sizing: border-box;">
|
||||||
|
|
||||||
<!-- Langue -->
|
<!-- Langue -->
|
||||||
<div class="wrap-input100" style="margin-bottom: 15px; text-align: center;">
|
<div class="wrap-input100" style="margin-bottom: 15px; text-align: center; width: 100%;">
|
||||||
<label for="langue_mobile" style="font-size: 12pt; display: block; margin-bottom: 5px;">Langue</label>
|
<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_mobile" name="langue"
|
<select class="form-select" id="langue" name="langue"
|
||||||
style="width: 100%; height: 40px; border: 2px solid #7D4FFE; border-radius: 9px; background: transparent; font-size: 14px; color: #7D4FFE; text-align: center; padding: 0 10px; box-sizing: border-box;"
|
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">
|
required autocomplete="off" onchange="javascript:changer_langue_connexion();">
|
||||||
<?php liste_options($langues, $_SESSION['lang'], true); ?>
|
<?php liste_options($langues, $_SESSION['lang'], true); ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Entité -->
|
<!-- Entité -->
|
||||||
<div class="wrap-input100" style="margin-bottom: 15px; text-align: center;">
|
<div class="wrap-input100" style="margin-bottom: 15px; text-align: center; width: 100%;">
|
||||||
<div class="wrap-input100 validate-input">
|
<div class="wrap-input100 validate-input">
|
||||||
<label for="codeSociete_mobile" style="font-size: 12pt; display: block; margin-bottom: 5px;">Entité</label>
|
<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_mobile" value="<?= $codeSociete ?>"
|
<input class="input100" type="text" name="codeSociete" id="codeSociete" value="<?= $codeSociete ?>"
|
||||||
placeholder="Entité"
|
placeholder="Entité"
|
||||||
style="width: 100%; height: 40px; border: 2px solid #7D4FFE; border-radius: 9px; color: #7D4FFE; text-align: center; padding: 0 10px; box-sizing: border-box;"
|
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">
|
required AUTOCOMPLETE="off"
|
||||||
|
onChange="javascript:changer_entite_portail();">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Identifiant -->
|
<!-- Identifiant -->
|
||||||
<div id="div_login_portail_mobile" class="wrap-input100" style="margin-bottom: 15px; text-align: center;">
|
<div id="div_login_portail" class="wrap-input100" style="margin-bottom: 15px; text-align: center; width: 100%;">
|
||||||
<div class="wrap-input100 validate-input">
|
<div class="wrap-input100 validate-input">
|
||||||
<label for="login_mobile" style="font-size: 12pt; display: block; margin-bottom: 5px;">Identifiant</label>
|
<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_mobile" value="<?= $codeUtilisateur ?>"
|
<input class="input100" type="text" name="login" id="login" value="<?= $codeUtilisateur ?>"
|
||||||
placeholder="Identifiant"
|
placeholder="Identifiant"
|
||||||
style="width: 100%; height: 40px; border: 2px solid #7D4FFE; border-radius: 9px; color: #7D4FFE; text-align: center; padding: 0 10px; box-sizing: border-box;"
|
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">
|
required AUTOCOMPLETE="off">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Mot de passe -->
|
<!-- Mot de passe -->
|
||||||
<div class="wrap-input100 validate-input" style="margin-bottom: 20px; text-align: center;">
|
<div class="wrap-input100 validate-input" style="margin-bottom: 20px; text-align: center; width: 100%;">
|
||||||
<label for="mdp_mobile" style="font-size: 12pt; display: block; margin-bottom: 5px;">Mot de passe</label>
|
<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_mobile" placeholder="Mot de passe"
|
<input class="input100" type="password" name="mdp" id="mdp" placeholder="Mot de passe"
|
||||||
style="width: 100%; height: 40px; border: 2px solid #7D4FFE; border-radius: 9px; color: #7D4FFE; text-align: center; padding: 0 10px; box-sizing: border-box;"
|
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">
|
required AUTOCOMPLETE="off">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Champ caché pour l'action -->
|
<!-- Bouton Connexion - MÊME ID ET MÊME COMPORTEMENT -->
|
||||||
<input type="hidden" name="action" value="connexion">
|
<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"
|
||||||
<!-- Bouton Connexion - TYPE SUBMIT -->
|
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;">
|
||||||
<div class="container-login100-form-btn" style="margin-bottom: 20px; text-align: center;">
|
|
||||||
<button type="submit" name="btn_connexion" id="btn_connexion_mobile" class="btn login-btn"
|
|
||||||
style="width: 100%; height: 45px; background: #7D4FFE; color: white; font-size: 16px; font-weight: 700; border-radius: 9px; border: none;">
|
|
||||||
Connexion
|
Connexion
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</div>
|
||||||
|
|
||||||
<!-- Footer mobile -->
|
<!-- Footer -->
|
||||||
<div class="footer" style="position: relative; bottom: auto; left: auto; font-size: 11px; text-align: center; padding: 10px; width: 100%; margin-top: 10px;">
|
<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/">© EBENE SOLUTIONS INFORMATIQUES</a>
|
Tous droits réservés <a href="https://www.ebene.info/">© EBENE SOLUTIONS INFORMATIQUES</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- STYLES ET SCRIPT SIMPLIFIÉS -->
|
<!-- STYLES CRITIQUES POUR ÉLIMINER LE DÉBORDEMENT -->
|
||||||
<style>
|
<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 */
|
/* SUR MOBILE SEULEMENT */
|
||||||
@media screen and (max-width: 767px) {
|
@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 {
|
.d-md-none {
|
||||||
display: block !important;
|
display: block !important;
|
||||||
width: 100% !important;
|
|
||||||
padding: 15px !important;
|
|
||||||
box-sizing: border-box !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.d-none.d-md-block {
|
.d-none.d-md-block {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#form_mobile {
|
/* 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;
|
width: 100% !important;
|
||||||
max-width: 300px !important;
|
max-width: 100% !important;
|
||||||
margin: 0 auto !important;
|
overflow: hidden !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#form_mobile input,
|
/* TOUS LES ÉLÉMENTS ONT UNE LARGEUR MAX */
|
||||||
#form_mobile select,
|
.d-md-none input,
|
||||||
#btn_connexion_mobile {
|
.d-md-none select,
|
||||||
|
.d-md-none .login-btn,
|
||||||
|
.d-md-none .footer {
|
||||||
|
max-width: 300px !important;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
max-width: 300px !important;
|
margin-left: auto !important;
|
||||||
margin: 0 auto !important;
|
margin-right: auto !important;
|
||||||
display: block !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#form_mobile input,
|
/* FORCE LE CENTRAGE */
|
||||||
#form_mobile select {
|
.wrap-input100 {
|
||||||
height: 40px !important;
|
|
||||||
border: 2px solid #7D4FFE !important;
|
|
||||||
border-radius: 9px !important;
|
|
||||||
padding: 0 15px !important;
|
|
||||||
box-sizing: border-box !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#btn_connexion_mobile {
|
|
||||||
height: 45px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#form_mobile label {
|
|
||||||
text-align: center !important;
|
text-align: center !important;
|
||||||
display: block !important;
|
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
margin-bottom: 5px !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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,152 +241,178 @@
|
||||||
.d-md-none {
|
.d-md-none {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.d-none.d-md-block {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// SCRIPT SIMPLE ET FONCTIONNEL POUR MOBILE
|
// ============================================
|
||||||
|
// SOLUTION SIMPLE POUR LES IDs EN DOUBLE
|
||||||
|
// ============================================
|
||||||
|
|
||||||
// 1. Initialisation au chargement
|
// 1. AU CHARGEMENT, CACHER LA VERSION INACTIVE
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
console.log('Initialisation mobile...');
|
console.log('Initialisation...');
|
||||||
|
|
||||||
// Récupérer le formulaire desktop pour copier son action
|
function gererAffichage() {
|
||||||
const formDesktop = document.querySelector('form');
|
|
||||||
const formMobile = document.getElementById('form_mobile');
|
|
||||||
|
|
||||||
if (formDesktop && formMobile) {
|
|
||||||
// Copier l'action du formulaire desktop
|
|
||||||
formMobile.action = formDesktop.action || window.location.href;
|
|
||||||
console.log('Action copiée:', formMobile.action);
|
|
||||||
|
|
||||||
// Copier la méthode
|
|
||||||
formMobile.method = formDesktop.method || 'POST';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Gestion des événements de changement
|
|
||||||
document.getElementById('langue_mobile')?.addEventListener('change', function() {
|
|
||||||
const desktopLangue = document.getElementById('langue');
|
|
||||||
if (desktopLangue) {
|
|
||||||
desktopLangue.value = this.value;
|
|
||||||
if (typeof changer_langue_connexion === 'function') {
|
|
||||||
changer_langue_connexion();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById('codeSociete_mobile')?.addEventListener('change', function() {
|
|
||||||
const desktopEntite = document.getElementById('codeSociete');
|
|
||||||
if (desktopEntite) {
|
|
||||||
desktopEntite.value = this.value;
|
|
||||||
if (typeof changer_entite_portail === 'function') {
|
|
||||||
changer_entite_portail();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 3. Validation avant soumission
|
|
||||||
formMobile?.addEventListener('submit', function(e) {
|
|
||||||
console.log('Soumission du formulaire mobile...');
|
|
||||||
|
|
||||||
// Récupérer les valeurs
|
|
||||||
const codeSociete = document.getElementById('codeSociete_mobile').value.trim();
|
|
||||||
const login = document.getElementById('login_mobile').value.trim();
|
|
||||||
const mdp = document.getElementById('mdp_mobile').value.trim();
|
|
||||||
|
|
||||||
// Validation
|
|
||||||
if (!codeSociete || !login || !mdp) {
|
|
||||||
e.preventDefault();
|
|
||||||
alert('Veuillez remplir tous les champs obligatoires');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Données mobiles:', {codeSociete, login, mdp});
|
|
||||||
|
|
||||||
// OPTION A: Synchroniser avec le desktop avant soumission
|
|
||||||
const desktopForm = document.querySelector('form');
|
|
||||||
if (desktopForm) {
|
|
||||||
// Copier les valeurs dans le formulaire desktop
|
|
||||||
document.getElementById('codeSociete').value = codeSociete;
|
|
||||||
document.getElementById('login').value = login;
|
|
||||||
document.getElementById('mdp').value = mdp;
|
|
||||||
document.getElementById('langue').value = document.getElementById('langue_mobile').value;
|
|
||||||
|
|
||||||
// Soumettre le formulaire desktop
|
|
||||||
e.preventDefault();
|
|
||||||
desktopForm.submit();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// OPTION B: Soumettre le formulaire mobile normalement
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 4. Gestion responsive
|
|
||||||
function gererAffichageResponsive() {
|
|
||||||
const isMobile = window.innerWidth <= 767;
|
const isMobile = window.innerWidth <= 767;
|
||||||
|
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
// Mode mobile
|
// SUR MOBILE: cacher desktop, montrer mobile
|
||||||
document.querySelectorAll('.d-md-none').forEach(el => el.style.display = 'block');
|
const desktopElements = document.querySelectorAll('.d-none.d-md-block, .d-none.d-md-block *');
|
||||||
document.querySelectorAll('.d-none.d-md-block').forEach(el => el.style.display = 'none');
|
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 {
|
} else {
|
||||||
// Mode desktop
|
// SUR DESKTOP: cacher mobile, montrer desktop
|
||||||
document.querySelectorAll('.d-md-none').forEach(el => el.style.display = 'none');
|
const mobileElements = document.querySelectorAll('.d-md-none, .d-md-none *');
|
||||||
document.querySelectorAll('.d-none.d-md-block').forEach(el => el.style.display = 'block');
|
const desktopElements = document.querySelectorAll('.d-none.d-md-block, .d-none.d-md-block *');
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gererAffichageResponsive();
|
mobileElements.forEach(el => {
|
||||||
window.addEventListener('resize', gererAffichageResponsive);
|
if (el.id) el.id = el.id + '_mobile_hidden';
|
||||||
|
el.style.display = 'none';
|
||||||
// 5. Debug: Log quand on clique sur le bouton
|
|
||||||
document.getElementById('btn_connexion_mobile')?.addEventListener('click', function() {
|
|
||||||
console.log('Bouton connexion mobile cliqué!');
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// 6. Fallback ultra simple - déclencher la connexion desktop
|
desktopElements.forEach(el => {
|
||||||
function soumettreConnexionMobile() {
|
el.style.display = '';
|
||||||
console.log('Fonction soumettreConnexionMobile appelée');
|
// 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');
|
||||||
|
}
|
||||||
|
|
||||||
// Trouver le formulaire desktop
|
|
||||||
const form = document.querySelector('form');
|
|
||||||
if (form) {
|
if (form) {
|
||||||
// Copier les valeurs mobiles vers desktop
|
console.log('Formulaire trouvé, soumission...');
|
||||||
const valeurs = {
|
// Laisser le navigateur soumettre normalement
|
||||||
'codeSociete': document.getElementById('codeSociete_mobile')?.value,
|
return true;
|
||||||
'login': document.getElementById('login_mobile')?.value,
|
|
||||||
'mdp': document.getElementById('mdp_mobile')?.value,
|
|
||||||
'langue': document.getElementById('langue_mobile')?.value
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.keys(valeurs).forEach(name => {
|
|
||||||
const input = document.querySelector(`[name="${name}"]`);
|
|
||||||
if (input && valeurs[name]) {
|
|
||||||
input.value = valeurs[name];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log('Soumission du formulaire desktop avec valeurs mobiles');
|
|
||||||
form.submit();
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Aucun formulaire trouvé!');
|
console.error('Aucun formulaire trouvé!');
|
||||||
alert('Erreur: Impossible de trouver le formulaire de connexion');
|
// 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);
|
||||||
|
|
||||||
// 7. Liaison directe au bouton (fallback)
|
window.location.href = window.location.pathname + '?' + params.toString();
|
||||||
setTimeout(function() {
|
|
||||||
const btnMobile = document.getElementById('btn_connexion_mobile');
|
|
||||||
if (btnMobile) {
|
|
||||||
btnMobile.addEventListener('click', function(e) {
|
|
||||||
console.log('Clic sur bouton mobile détecté');
|
|
||||||
// Essayer la méthode simple
|
|
||||||
soumettreConnexionMobile();
|
|
||||||
e.preventDefault();
|
|
||||||
return false;
|
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);
|
}, 1000);
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user