Version DeepSeek corrigée v1.6
This commit is contained in:
parent
df85397526
commit
0b801e3305
|
|
@ -7,220 +7,228 @@
|
|||
?>
|
||||
|
||||
<!-- Tableau desktop (affiché sur les écrans moyens et grands) -->
|
||||
<div class="d-md-none">
|
||||
<!-- VERSION MOBILE PARFAITEMENT HARMONISÉE -->
|
||||
<div style="width: 100%; max-width: 100%; box-sizing: border-box; padding: 15px;">
|
||||
<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>
|
||||
|
||||
<!-- Titre -->
|
||||
<span class="login100-form-title" style="font-family: Play-Bold; color:#e5e5e5; margin: 10px 0 20px 0; display: block; font-size: 20px; text-align: center; line-height: 1.2;">
|
||||
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">
|
||||
|
||||
<?php if (isset($msgErreur) and $msgErreur>" "): ?>
|
||||
<div class="text-center" style="margin-bottom: 15px;">
|
||||
<div style="background-color: #f8d7da; color: #721c24; padding: 10px; border-radius: 8px; font-size: 13px; border: 1px solid #f5c6cb; max-width: 300px; margin: 0 auto;">
|
||||
<?= $msgErreur ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="text-center" id="div_msgErreur_mobile" style="margin-bottom: 15px;"></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($maintenance!='1'): ?>
|
||||
<?php if($maintenance!='1'): ?>
|
||||
<div class="wrap-input100">
|
||||
<label for="langue">Langue</label>
|
||||
<select class="form-select" id="langue" name="langue"
|
||||
|
||||
<!-- CONTENEUR UNIFORME POUR TOUS LES ÉLÉMENTS -->
|
||||
<div style="width: 100%; max-width: 300px; margin: 0 auto;">
|
||||
required autocomplete="off" onchange="javascript:changer_langue_connexion();">
|
||||
<?php liste_options($langues, $_SESSION['lang'], true); ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Langue -->
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label for="langue_mobile" style="font-size: 12pt; display: block; margin-bottom: 5px; text-align: center; width: 100%;">Langue</label>
|
||||
<select id="langue_mobile" name="langue_mobile"
|
||||
style="width: 100%; height: 42px; padding: 0 15px; border: 2px solid #7D4FFE; border-radius: 9px; background: #ffffff; font-size: 14px; color: #7D4FFE; text-align: center; box-sizing: border-box; -webkit-appearance: none; -moz-appearance: none; appearance: none;"
|
||||
required onchange="changerLangueMobile(this.value);">
|
||||
<?php liste_options($langues, $_SESSION['lang'], true); ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Entité -->
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label for="codeSociete_mobile" style="font-size: 12pt; display: block; margin-bottom: 5px; text-align: center; width: 100%;">Entité</label>
|
||||
<input type="text" id="codeSociete_mobile" name="codeSociete_mobile" value="<?= $codeSociete ?>"
|
||||
placeholder="Entité"
|
||||
style="width: 100%; height: 42px; padding: 0 15px; border: 2px solid #7D4FFE; border-radius: 9px; color: #7D4FFE; text-align: center; box-sizing: border-box; font-size: 14px; background: #ffffff;"
|
||||
required autocomplete="off"
|
||||
onchange="changerEntiteMobile(this.value);">
|
||||
</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>
|
||||
|
||||
<!-- Identifiant -->
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label for="login_mobile" style="font-size: 12pt; display: block; margin-bottom: 5px; text-align: center; width: 100%;">Identifiant</label>
|
||||
<input type="text" id="login_mobile" name="login_mobile" value="<?= $codeUtilisateur ?>"
|
||||
placeholder="Identifiant"
|
||||
style="width: 100%; height: 42px; padding: 0 15px; border: 2px solid #7D4FFE; border-radius: 9px; color: #7D4FFE; text-align: center; box-sizing: border-box; font-size: 14px; background: #ffffff;"
|
||||
required autocomplete="off">
|
||||
</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>
|
||||
|
||||
<!-- Mot de passe -->
|
||||
<div style="margin-bottom: 20px;">
|
||||
<label for="mdp_mobile" style="font-size: 12pt; display: block; margin-bottom: 5px; text-align: center; width: 100%;">Mot de passe</label>
|
||||
<input type="password" id="mdp_mobile" name="mdp_mobile" placeholder="Mot de passe"
|
||||
style="width: 100%; height: 42px; padding: 0 15px; border: 2px solid #7D4FFE; border-radius: 9px; color: #7D4FFE; text-align: center; box-sizing: border-box; font-size: 14px; background: #ffffff;"
|
||||
required autocomplete="off">
|
||||
</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>
|
||||
|
||||
<!-- Bouton Connexion - MÊME LARGEUR -->
|
||||
<div style="margin-bottom: 15px;">
|
||||
<button type="button" id="btn_connexion_mobile"
|
||||
style="width: 100%; height: 46px; background: #7D4FFE; color: white; font-size: 16px; font-weight: 700; border-radius: 9px; border: none; box-sizing: border-box; cursor: pointer;">
|
||||
Connexion
|
||||
</button>
|
||||
</div>
|
||||
<div class="container-login100-form-btn">
|
||||
<button name="btn_connexion" id="btn_connexion" class="btn login-btn">
|
||||
Connexion
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div style="font-size: 11px; text-align: center; padding: 10px 0; color: #666; width: 100%; max-width: 300px; margin: 20px auto 0;">
|
||||
Tous droits réservés <a href="https://www.ebene.info/" style="color: #7D4FFE; text-decoration: none;">© EBENE SOLUTIONS INFORMATIQUES</a>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<div class="footer">
|
||||
Tous droits réservés <a href="https://www.ebene.info/">© EBENE SOLUTIONS INFORMATIQUES</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- STYLES POUR HARMONISATION ET CONNEXION -->
|
||||
<!-- Affichage mobile (cartes) -->
|
||||
<div class="d-md-none">
|
||||
<!-- VERSION MOBILE SIMPLE ET PROPRE -->
|
||||
|
||||
<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;">
|
||||
Portail Assuré
|
||||
</span>
|
||||
|
||||
<?php if (isset($msgErreur) and $msgErreur>" "): ?>
|
||||
<div class="text-center p-t-10" style="margin-bottom: 15px;">
|
||||
<h4 class="txt3">
|
||||
<div class="col-12 alert alert-danger" style="padding: 10px; font-size: 13px; border-radius: 8px;">
|
||||
<?= $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'): ?>
|
||||
|
||||
<!-- CONTENEUR MOBILE COMPACT -->
|
||||
<div style="width: 100%; max-width: 300px; margin: 0 auto;">
|
||||
|
||||
<!-- Langue -->
|
||||
<div class="wrap-input100" style="margin-bottom: 15px; text-align: center;">
|
||||
<label for="langue" style="font-size: 12pt; display: block; margin-bottom: 5px;">Langue</label>
|
||||
<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;"
|
||||
required autocomplete="off" onchange="changer_langue_connexion();">
|
||||
<?php liste_options($langues, $_SESSION['lang'], true); ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Entité -->
|
||||
<div class="wrap-input100" style="margin-bottom: 15px; text-align: center;">
|
||||
<div class="wrap-input100 validate-input">
|
||||
<label for="codeSociete" style="font-size: 12pt; display: block; margin-bottom: 5px;">Entité</label>
|
||||
<input class="input100" type="text" name="codeSociete" id="codeSociete" value="<?= $codeSociete ?>"
|
||||
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;"
|
||||
required AUTOCOMPLETE="off" onChange="changer_entite_portail();">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Identifiant -->
|
||||
<div id="div_login_portail" class="wrap-input100" style="margin-bottom: 15px; text-align: center;">
|
||||
<div class="wrap-input100 validate-input">
|
||||
<label for="login" style="font-size: 12pt; display: block; margin-bottom: 5px;">Identifiant</label>
|
||||
<input class="input100" type="text" name="login" id="login" value="<?= $codeUtilisateur ?>"
|
||||
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;"
|
||||
required AUTOCOMPLETE="off">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mot de passe -->
|
||||
<div class="wrap-input100 validate-input" style="margin-bottom: 20px; text-align: center;">
|
||||
<label for="mdp" style="font-size: 12pt; display: block; margin-bottom: 5px;">Mot de passe</label>
|
||||
<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;"
|
||||
required AUTOCOMPLETE="off">
|
||||
</div>
|
||||
|
||||
<!-- Bouton Connexion -->
|
||||
<div class="container-login100-form-btn" style="margin-bottom: 20px; text-align: center;">
|
||||
<button name="btn_connexion" id="btn_connexion" 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
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Footer mobile -->
|
||||
<div class="footer" style="position: relative; bottom: auto; left: auto; font-size: 11px; text-align: center; padding: 10px; width: 100%; margin-top: 10px;">
|
||||
Tous droits réservés <a href="https://www.ebene.info/">© EBENE SOLUTIONS INFORMATIQUES</a>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- STYLES MINIMALISTES POUR MOBILE -->
|
||||
<style>
|
||||
/* STYLES MOBILE HARMONISÉS */
|
||||
/* SEULEMENT POUR MOBILE - NE PAS TOUCHER AU DESKTOP */
|
||||
@media screen and (max-width: 767px) {
|
||||
/* 1. MASQUER DESKTOP, MONTRER MOBILE */
|
||||
.d-none.d-md-block {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Force l'affichage correct du conteneur mobile */
|
||||
.d-md-none {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
overflow: hidden !important;
|
||||
display: block !important;
|
||||
width: 100vw !important;
|
||||
max-width: 100vw !important;
|
||||
overflow-x: hidden !important;
|
||||
padding: 10px !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
|
||||
/* 2. CORRECTIONS GLOBALES */
|
||||
body, html {
|
||||
overflow-x: hidden !important;
|
||||
width: 100vw !important;
|
||||
}
|
||||
|
||||
.container-fluid {
|
||||
width: 100vw !important;
|
||||
max-width: 100vw !important;
|
||||
}
|
||||
|
||||
/* 3. HARMONISATION DES LARGEURS - TOUT À 300px */
|
||||
.d-md-none > div > div:last-child {
|
||||
/* Les champs mobiles ont tous la même largeur */
|
||||
.d-md-none input,
|
||||
.d-md-none select,
|
||||
.d-md-none .login-btn {
|
||||
width: 100% !important;
|
||||
max-width: 300px !important;
|
||||
margin: 0 auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
/* 4. STYLES IDENTIQUES POUR TOUS LES CHAMPS */
|
||||
.d-md-none select,
|
||||
.d-md-none input[type="text"],
|
||||
.d-md-none input[type="password"] {
|
||||
width: 100% !important;
|
||||
max-width: 300px !important;
|
||||
height: 42px !important;
|
||||
/* Harmonisation des hauteurs et styles */
|
||||
.d-md-none input,
|
||||
.d-md-none select {
|
||||
height: 40px !important;
|
||||
font-size: 14px !important;
|
||||
border: 2px solid #7D4FFE !important;
|
||||
border-radius: 9px !important;
|
||||
background: #ffffff !important;
|
||||
color: #7D4FFE !important;
|
||||
font-size: 14px !important;
|
||||
text-align: center !important;
|
||||
padding: 0 15px !important;
|
||||
box-sizing: border-box !important;
|
||||
margin: 0 auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
/* 5. BOUTON - MÊME LARGEUR */
|
||||
#btn_connexion_mobile {
|
||||
/* Bouton avec même largeur */
|
||||
.d-md-none .login-btn {
|
||||
width: 100% !important;
|
||||
max-width: 300px !important;
|
||||
height: 46px !important;
|
||||
background: #7D4FFE !important;
|
||||
color: white !important;
|
||||
border-radius: 9px !important;
|
||||
font-size: 16px !important;
|
||||
margin: 0 auto !important;
|
||||
display: block !important;
|
||||
height: 45px !important;
|
||||
}
|
||||
|
||||
/* 6. HOVER CONSISTANT */
|
||||
#btn_connexion_mobile:hover,
|
||||
#btn_connexion_mobile:active {
|
||||
background: white !important;
|
||||
color: #7D4FFE !important;
|
||||
border: 2px solid #7D4FFE !important;
|
||||
}
|
||||
|
||||
/* 7. FOCUS STYLES */
|
||||
.d-md-none select:focus,
|
||||
.d-md-none input:focus {
|
||||
outline: none !important;
|
||||
box-shadow: 0 0 0 3px rgba(125, 79, 254, 0.2) !important;
|
||||
}
|
||||
|
||||
/* 8. PLACEHOLDER */
|
||||
.d-md-none input::placeholder {
|
||||
font-weight: bold !important;
|
||||
color: #7D4FFE !important;
|
||||
opacity: 0.7 !important;
|
||||
}
|
||||
|
||||
/* 9. LABELS CONSISTANTS */
|
||||
/* Labels centrés */
|
||||
.d-md-none label {
|
||||
font-size: 12pt !important;
|
||||
text-align: center !important;
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
margin-bottom: 5px !important;
|
||||
}
|
||||
|
||||
/* 10. CORRECTION SELECT (supprimer flèche par défaut) */
|
||||
.d-md-none select {
|
||||
-webkit-appearance: none !important;
|
||||
-moz-appearance: none !important;
|
||||
appearance: none !important;
|
||||
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237D4FFE'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e") !important;
|
||||
background-repeat: no-repeat !important;
|
||||
background-position: right 15px center !important;
|
||||
background-size: 20px !important;
|
||||
}
|
||||
|
||||
/* 11. ESPACEMENT UNIFORME */
|
||||
.d-md-none > div > div:last-child > div {
|
||||
margin-bottom: 15px !important;
|
||||
}
|
||||
|
||||
/* 12. FOOTER HARMONISÉ */
|
||||
.d-md-none .footer {
|
||||
/* Conteneur pour centrer tout */
|
||||
.d-md-none > div:last-child {
|
||||
width: 100% !important;
|
||||
max-width: 300px !important;
|
||||
margin: 20px auto 0 !important;
|
||||
font-size: 11px !important;
|
||||
margin: 0 auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* POUR TRÈS PETITS ÉCRANS */
|
||||
@media screen and (max-width: 320px) {
|
||||
.d-md-none > div > div:last-child,
|
||||
.d-md-none select,
|
||||
.d-md-none input,
|
||||
#btn_connexion_mobile,
|
||||
/* Footer mobile */
|
||||
.d-md-none .footer {
|
||||
max-width: 280px !important;
|
||||
position: relative !important;
|
||||
width: 100% !important;
|
||||
text-align: center !important;
|
||||
margin-top: 20px !important;
|
||||
padding: 10px 0 !important;
|
||||
}
|
||||
|
||||
/* Sur très petits écrans */
|
||||
@media screen and (max-width: 320px) {
|
||||
.d-md-none input,
|
||||
.d-md-none select,
|
||||
.d-md-none .login-btn {
|
||||
max-width: 280px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* CACHER MOBILE SUR DESKTOP */
|
||||
/* Sur desktop, cacher la version mobile */
|
||||
@media screen and (min-width: 768px) {
|
||||
.d-md-none {
|
||||
display: none !important;
|
||||
|
|
@ -229,208 +237,34 @@
|
|||
</style>
|
||||
|
||||
<script>
|
||||
// ============================================
|
||||
// LOGIQUE DE CONNEXION FONCTIONNELLE
|
||||
// ============================================
|
||||
// JavaScript simple pour mobile - utilise les mêmes IDs que desktop
|
||||
// donc les fonctions existantes fonctionnent directement
|
||||
|
||||
// 1. SYNCHRONISATION AVEC LE DESKTOP
|
||||
function synchroniserAvecDesktop() {
|
||||
// Synchroniser les valeurs entre mobile et desktop
|
||||
const champs = [
|
||||
{mobile: 'langue_mobile', desktop: 'langue'},
|
||||
{mobile: 'codeSociete_mobile', desktop: 'codeSociete'},
|
||||
{mobile: 'login_mobile', desktop: 'login'},
|
||||
{mobile: 'mdp_mobile', desktop: 'mdp'}
|
||||
];
|
||||
|
||||
champs.forEach(champ => {
|
||||
const champMobile = document.getElementById(champ.mobile);
|
||||
const champDesktop = document.getElementById(champ.desktop);
|
||||
|
||||
if (champMobile && champDesktop) {
|
||||
// Mobile → Desktop
|
||||
champMobile.addEventListener('change', function() {
|
||||
champDesktop.value = this.value;
|
||||
});
|
||||
|
||||
// Desktop → Mobile (au cas où)
|
||||
champDesktop.addEventListener('change', function() {
|
||||
champMobile.value = this.value;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 2. FONCTIONS DE CHANGEMENT
|
||||
function changerLangueMobile(langue) {
|
||||
const desktopLangue = document.getElementById('langue');
|
||||
if (desktopLangue) {
|
||||
desktopLangue.value = langue;
|
||||
// Déclencher l'événement original
|
||||
if (typeof changer_langue_connexion === 'function') {
|
||||
changer_langue_connexion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changerEntiteMobile(entite) {
|
||||
const desktopEntite = document.getElementById('codeSociete');
|
||||
if (desktopEntite) {
|
||||
desktopEntite.value = entite;
|
||||
// Déclencher l'événement original
|
||||
if (typeof changer_entite_portail === 'function') {
|
||||
changer_entite_portail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. FONCTION DE CONNEXION PRINCIPALE
|
||||
function connecterMobile() {
|
||||
// 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();
|
||||
const langue = document.getElementById('langue_mobile').value;
|
||||
|
||||
// Validation
|
||||
if (!codeSociete || !login || !mdp) {
|
||||
alert('Veuillez remplir tous les champs obligatoires');
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log('Tentative de connexion mobile:', {codeSociete, login, mdp, langue});
|
||||
|
||||
// OPTION 1: Utiliser le formulaire desktop existant
|
||||
const formulaireDesktop = document.querySelector('form');
|
||||
if (formulaireDesktop) {
|
||||
// Mettre à jour les champs du formulaire
|
||||
const donnees = {
|
||||
'codeSociete': codeSociete,
|
||||
'login': login,
|
||||
'mdp': mdp,
|
||||
'langue': langue
|
||||
};
|
||||
|
||||
Object.keys(donnees).forEach(nom => {
|
||||
const champ = document.getElementById(nom);
|
||||
if (champ) {
|
||||
champ.value = donnees[nom];
|
||||
}
|
||||
// Vérifier que tout est bien centré sur mobile
|
||||
function ajusterMobile() {
|
||||
if (window.innerWidth <= 767) {
|
||||
// Centrer tous les éléments
|
||||
const elements = document.querySelectorAll('.d-md-none input, .d-md-none select, .d-md-none .login-btn');
|
||||
elements.forEach(el => {
|
||||
el.style.marginLeft = 'auto';
|
||||
el.style.marginRight = 'auto';
|
||||
el.style.display = 'block';
|
||||
});
|
||||
|
||||
// Soumettre le formulaire
|
||||
formulaireDesktop.submit();
|
||||
return true;
|
||||
}
|
||||
|
||||
// OPTION 2: Si pas de formulaire, utiliser fetch/AJAX
|
||||
// (Adaptez cette partie à votre backend)
|
||||
const donnees = new FormData();
|
||||
donnees.append('codeSociete', codeSociete);
|
||||
donnees.append('login', login);
|
||||
donnees.append('mdp', mdp);
|
||||
donnees.append('langue', langue);
|
||||
donnees.append('action', 'connexion_mobile');
|
||||
|
||||
fetch(window.location.href, {
|
||||
method: 'POST',
|
||||
body: donnees,
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
window.location.href = data.redirect || window.location.href;
|
||||
} else {
|
||||
alert(data.message || 'Erreur de connexion');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Erreur:', error);
|
||||
alert('Erreur réseau');
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// 4. INITIALISATION AU CHARGEMENT
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Synchroniser les champs
|
||||
synchroniserAvecDesktop();
|
||||
|
||||
// Gérer le bouton de connexion mobile
|
||||
const btnMobile = document.getElementById('btn_connexion_mobile');
|
||||
if (btnMobile) {
|
||||
btnMobile.addEventListener('click', connecterMobile);
|
||||
}
|
||||
|
||||
// Gérer la touche Entrée
|
||||
document.querySelectorAll('.d-md-none input').forEach(input => {
|
||||
input.addEventListener('keypress', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
connecterMobile();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Gestion responsive
|
||||
function gererAffichageResponsive() {
|
||||
const isMobile = window.innerWidth <= 767;
|
||||
const mobileDiv = document.querySelector('.d-md-none');
|
||||
const desktopDiv = document.querySelector('.d-none.d-md-block');
|
||||
|
||||
if (isMobile) {
|
||||
if (mobileDiv) mobileDiv.style.display = 'block';
|
||||
if (desktopDiv) desktopDiv.style.display = 'none';
|
||||
} else {
|
||||
if (mobileDiv) mobileDiv.style.display = 'none';
|
||||
if (desktopDiv) desktopDiv.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
// Appliquer
|
||||
gererAffichageResponsive();
|
||||
window.addEventListener('resize', gererAffichageResponsive);
|
||||
|
||||
// Forcer l'harmonisation des largeurs
|
||||
setTimeout(function() {
|
||||
if (window.innerWidth <= 767) {
|
||||
const elements = document.querySelectorAll('.d-md-none select, .d-md-none input, #btn_connexion_mobile');
|
||||
elements.forEach(el => {
|
||||
el.style.width = '100%';
|
||||
el.style.maxWidth = '300px';
|
||||
el.style.margin = '0 auto';
|
||||
el.style.display = 'block';
|
||||
});
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
// 5. FALLBACK: Si les fonctions desktop existent, les utiliser
|
||||
function utiliserFonctionsDesktop() {
|
||||
// Bouton de connexion desktop
|
||||
const btnDesktop = document.getElementById('btn_connexion');
|
||||
if (btnDesktop) {
|
||||
btnDesktop.addEventListener('click', function() {
|
||||
// Récupérer les valeurs mobiles
|
||||
const codeSociete = document.getElementById('codeSociete_mobile').value;
|
||||
const login = document.getElementById('login_mobile').value;
|
||||
const mdp = document.getElementById('mdp_mobile').value;
|
||||
|
||||
// Mettre à jour les champs desktop
|
||||
document.getElementById('codeSociete').value = codeSociete;
|
||||
document.getElementById('login').value = login;
|
||||
document.getElementById('mdp').value = mdp;
|
||||
|
||||
// Déclencher le clic sur le bouton desktop
|
||||
this.click();
|
||||
// S'assurer que les labels sont centrés
|
||||
const labels = document.querySelectorAll('.d-md-none label');
|
||||
labels.forEach(label => {
|
||||
label.style.textAlign = 'center';
|
||||
label.style.display = 'block';
|
||||
label.style.width = '100%';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Exécuter le fallback
|
||||
setTimeout(utiliserFonctionsDesktop, 500);
|
||||
// Exécuter au chargement et au redimensionnement
|
||||
document.addEventListener('DOMContentLoaded', ajusterMobile);
|
||||
window.addEventListener('resize', ajusterMobile);
|
||||
|
||||
// Pour le bouton de connexion - même ID que desktop donc même fonction
|
||||
// Pas besoin de code supplémentaire
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user