diff --git a/Patients.php b/Patients.php
index de35b96..f083be0 100755
--- a/Patients.php
+++ b/Patients.php
@@ -3,7 +3,11 @@ require('autoloader.php');
if(!Authentification::checkUser(0)){
header("Location: http://".$_SERVER['HTTP_HOST']."/index.php");
die();
-};?>
+};
+
+// formattage $_GET['type']
+$answerType = (isset($_GET['type'])) ? $_GET['type'] : null;
+?>
@@ -45,8 +49,20 @@ if(!Authentification::checkUser(0)){
+
+ ';
+ switch($answerType){
- ';
+
+ }
+ /*************************************/
/* AJOUTER UN PATIENT */
/*************************************/ ?>
@@ -65,17 +81,17 @@ if(!Authentification::checkUser(0)){
+ medecin_traitant
-->
Ajout d'un nouveau patient
-
-
+
+
Homme
Femme
-
+
- Code postal
-
- Date de naissance
-
- Numéro de sécurité sociale
+ Code postal
+
+ Date de naissance
+
+ Numéro de sécurité sociale
Choix du médecin traitant (optionnel)
span{
+ margin: 1.8em;
+ color: #f00;
+ font-size: 1.1em;
+ font-weight: bold;
+}
/******************************/
/* ARTICLES (cadres internes) */
@@ -470,7 +476,13 @@ body{
/* extra */
cursor: pointer;
-
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+
/* animation */
transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
diff --git a/js/patients.js b/js/patients.js
index dc9c87a..1775645 100755
--- a/js/patients.js
+++ b/js/patients.js
@@ -36,13 +36,13 @@ function checkVARCHAR(pInputElement, pMinLength, pMaxLength, optAlpha){
if( optAlpha ) varcharRegExp = new RegExp('^([a-z]{'+pMinLength+','+pMaxLength+'})$', 'i'); // only alpha characters
else varcharRegExp = new RegExp('^([\\w -]{'+ pMinLength+','+pMaxLength+'})$', 'i'); // any word character
- if( pInputElement.value.match(varcharRegExp) != null ){ // si champ correct
+ if( pInputElement.value.match(varcharRegExp) != null || pInputElement.value == '' ){ // si champ correct
addClass(pInputElement, 'validated');
- remClass(pInputElement, 'invalid');
+ if( pInputElement.required ) remClass(pInputElement, 'invalid');
}else{
remClass(pInputElement, 'validated');
- addClass(pInputElement, 'invalid');
+ if( pInputElement.required ) addClass(pInputElement, 'invalid');
}
}
@@ -133,9 +133,21 @@ inSecu.addEventListener('keyup', function(e){
sbCreer.addEventListener('click', function(e){
e.preventDefault(); // on annule le submit()
+ var formElements = sbCreer.parentNode.children;
+ var checker = true;
+
+ // pour chaque du formulaire (fils direct uniquement)
+ for( var i = 0 ; i < formElements.length ; i++ ){ if( formElements[i] instanceof HTMLInputElement && formElements[i].type == 'text' ){
+ // si le champ est requis (required)
+ if( formElements[i].required )
+ checker = checker && formElements[i].className.indexOf('validated') > -1; // TRUE => validé (niveau interface)
+ // si le champ n'est pas requis et pas vide, on le vide
+ else if( formElements[i].value != '' && formElements[i].className.indexOf('validated') < 0) // si incorrect et pas vide
+ formElements[i].value = ''; // on vide
+ }}
+
var inputCheckerValid = inCk.checkAll();
- var allInputValidated = inPrenom.className.indexOf('validated') > -1 && inNom.className.indexOf('validated') > -1 && inAdr.className.indexOf('validated') > -1 && inAdr2.className.indexOf('validated') > -1 && inCP.className.indexOf('validated') > -1 && inVille.className.indexOf('validated') > -1 && inDN.className.indexOf('validated') > -1 && inLN.className.indexOf('validated') > -1 && inSecu.className.indexOf('validated') > -1;
- if( inputCheckerValid && allInputValidated ) // si tout es ok uniquement, on submit()
+ if( inputCheckerValid && checker ) // si tout es ok uniquement, on submit()
sbCreer.parentNode.submit();
}, false);
\ No newline at end of file