1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
| <?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Ajout nouveau client</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://kit.fontawesome.com/7e006668f2.js" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script language="javascript">
function verifpseudo() {
//alert('bjr') ;
// onblur="verifpseudo(this)"
document.querySelector("form").addEventListener("submit",(e) => {
var code_client = document.getElementById("code_client");
var dataString = "code_client="+code_client.value;
var blocageformulaire = true ;
//alert(code_client);
$.ajax({
type: "POST",
url: "verif_pseudo.php",
async: false,
data: dataString,
success:function(data){
//alert(data) ;
if(data=="ok"){
code_client.style.color='';
document.getElementById('bjr').style.color='';
code_client.style.backgroundColor="#9C6";
return true;
}else{
alert("Code client déja existant, veuillez en saisir un nouveau !");
code_client.style.backgroundColor="red";
code_client.style.color='white';
document.getElementById('bjr').style.color='red';
blocageformulaire = false ;
e.preventDefault();
}
/*
var responseData = jQuery.JSON.parse(data);
if(responseData.status=="erreur")
{
alert(responseData.message) ;
// $('.check_false').text(responseData.message);
}
else
{
alert('ok : '+responseData.message) ;
// $('.check_ok').text(responseData.message);
}
*/
}
});
// alert(blocageformulaire);
//return blocageformulaire;
});
}
</script>
<style>
.crea {
color: #FF5733;
}
</style>
</head>
<body>
<?php if(isset($_GET['creation']) && ($_GET['creation'] == "succes")) { // Affiche l'erreur ?>
<strong class="crea">Client ajouté avec succès.</strong>
<?php } ?>
<?php if(isset($_GET['erreur']) && ($_GET['erreur'] == "doublon")) { // Affiche l'erreur ?>
<strong class="erreur">Cette adresse mail existe déjà dans le système de données. Veuillez recommencer avec une adresse mail différente.</strong>
<?php } ?>
<form class="w3-container w3-card-4 w3-light-grey w3-text-blue w3-margin" id="formuVideo" name="formuVideo" action="envoie_client.php" method="post" onsubmit="verifpseudo()">
<h2 class="w3-center">Nouveau client</h2>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-user"></i></div>
<input class="w3-radio" type="radio" name="type" value="particulier" required checked>
<label>Particulier</label>
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-user-tie"></i></div>
<input class="w3-radio" type="radio" name="type" value="pro">
<label>Pro</label>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-male"></i><i class="w3-xxlarge fa fa-female"></i></div>
<input class="w3-radio" type="radio" name="civilite" value="Madame" required>
<label>Madame</label>
<input class="w3-radio" type="radio" name="civilite" value="Monsieur">
<label>Monsieur</label>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-align-justify"></i></div>
<div class="w3-rest">
<label id="bjr" >Attention, Ne pas saisir un code client déjà existant !</label>
<input class="w3-input w3-border" name="code_client" id="code_client" type="text" required placeholder="Code Client" onblur="verifpseudo(this)">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-user"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="nom" type="text" required placeholder="Nom">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-user"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="prenom" type="text" required placeholder="Prénom">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-building"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="adresse" type="text" placeholder="Adresse">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-home"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="cp" type="text" placeholder="Code Postal">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-home"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="ville" type="text" placeholder="Ville">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-envelope-o"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="email" type="email" required placeholder="Email">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-phone"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="telephone" type="tel" pattern="[0-9]{10}" required placeholder="Téléphone">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-id-card"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="societe" type="text" placeholder="Société">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-user-astronaut"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="fonction" type="text" placeholder="Fonction">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-comment-dots"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="service" type="text" placeholder="Service">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-globe"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="province" type="text" placeholder="Province">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-globe"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="pays" type="text" placeholder="Pays">
</div>
</div>
<div class="w3-row w3-section">
<div class="w3-col" style="width:50px"><i class="w3-xxlarge fa fa-pencil"></i></div>
<div class="w3-rest">
<input class="w3-input w3-border" name="notes" type="text" placeholder="Message">
</div>
</div>
<?php
$login = $_SESSION['login'] ;
?>
<input id="login" name="login" type="hidden" value="<?php echo $login ; ?>">
<button class="w3-button w3-block w3-section w3-blue w3-ripple w3-padding">Ajouter</button>
</form>
</body>
</html> |
Partager