From: vincent@cubedesigners.com Date: Tue, 26 Nov 2013 18:12:57 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=01f7ddb533b8a7be91bd4abb525649de66d59354;p=ccgm.git --- diff --git a/framework/application/configs/application.ini b/framework/application/configs/application.ini index c67c3e0..2500b57 100644 --- a/framework/application/configs/application.ini +++ b/framework/application/configs/application.ini @@ -45,6 +45,9 @@ acl.roles[] = admin mail.test = APPLICATION_PATH "/../data/email/test" +mailjet.username = a0efe78a914ae9b7b972618c6c3e1803 +mailjet.password = b4d51c4c1d0193f9b0963c2c374dd882 + [testing : production] dev = true diff --git a/framework/application/controllers/AjaxController.php b/framework/application/controllers/AjaxController.php index 981ceb1..5104783 100644 --- a/framework/application/controllers/AjaxController.php +++ b/framework/application/controllers/AjaxController.php @@ -6,10 +6,40 @@ class AjaxController extends CubeIT_Controller_AjaxController { $data = $this->getCMSDatasOfPage($_POST['page']); $form = new CCGM_Form_Rendezvous(); $form->setMedecins($data['medecins']); + if (!$form->isValid($_POST)) { $this->_datas->refreshForm($form); + $this->_datas->addShow("#messageerreur"); + $this->_datas->addScrollTo("#c", 0.35); } else { - $this->_datas->addAlert('ok!'); + + $mail = new CubeIT_Mail(); + $mail->setFrom('rdv@ccgm.fr'); + $mail->addTo($data['destinataire']); + $mail->addBcc('test@cubedesigners.com'); + $mail->setSubject('Prise de rendez-vous - ' . $form->getValue('prenom') . ' ' . $form->getValue('nom') . ' (' . $form->getValue('naissance') . ')'); + $body = ''; + $fields = array('nom' => 'Nom', 'nom_usage' => 'Nom d\'usage', 'prenom' => 'Prénom', 'naissance' => 'Date de naissance', 'telephone' => 'Téléphone', 'email' => 'E-mail', + 'type' => 'Type de rendez-vous', 'medecin' => 'Médecin', + 'date' => 'Date et et plage horaire'); + foreach ($fields as $f => $label) { + $val = $form->getValue($f); + if (!$val) { + continue; + } + $body.=$label . ' : ' . $val . "\n"; + } + $mail->setBodyText($body); + $mail->send(new CubeIT_Mail_Transport_Mailjet()); + + + $form = new CCGM_Form_Rendezvous(); + $form->setMedecins($data['medecins']); + $form->setDefault('page', $_POST['page']); + $this->_datas->refreshForm($form); + $this->_datas->addHide("#messageerreur"); + $this->_datas->addShow("#messageconfirmation"); + $this->_datas->addScrollTo("#header", 0.35); } } diff --git a/framework/application/forms/Rendezvous.php b/framework/application/forms/Rendezvous.php index 5a30f12..004ecf4 100644 --- a/framework/application/forms/Rendezvous.php +++ b/framework/application/forms/Rendezvous.php @@ -68,6 +68,9 @@ class CCGM_Form_Rendezvous extends CubeIT_Form { $this->addElement($type); $medecin = new Zend_Form_Element_Select('medecin'); + $medecin->addValidator($notempty); + $medecin->setRequired(); + $medecin->setLabel('Médecin'); $this->addElement($medecin); $motif = new Zend_Form_Element_Text('motif'); @@ -80,7 +83,6 @@ class CCGM_Form_Rendezvous extends CubeIT_Form { $date = new Zend_Form_Element_Text('date'); $date->setAttrib('placeholder', 'Merci de noter plusieurs créneaux possibles'); - $date->addValidator($datevalidator); $this->addElement($date); $info = new CubeIT_Form_Element_Html('info'); diff --git a/framework/application/views/scripts/templates/rendezvous.phtml b/framework/application/views/scripts/templates/rendezvous.phtml index 64ce99e..3b3f6ff 100644 --- a/framework/application/views/scripts/templates/rendezvous.phtml +++ b/framework/application/views/scripts/templates/rendezvous.phtml @@ -2,13 +2,15 @@ $this->headScript() ->addPolyfill('placeholder') ->addScriptAndStyle('rendezvous') - ->addCheckbox(); + ->addCheckbox() + ->addScrollTo(); ?>
markupDotclear($this->text); echo '
' . $this->erreur . '
'; + echo '
' . $this->markupDotclear($this->confirmation) . '
'; $form = new CCGM_Form_Rendezvous(); $form->getElement('page')->setValue($this->currentPage->getId()); $form->setMedecins($this->medecins); @@ -16,4 +18,4 @@ $this->headScript() ?>
rightbar() ?> -
\ No newline at end of file + \ No newline at end of file diff --git a/images/closeconf.png b/images/closeconf.png new file mode 100644 index 0000000..2d1dac0 Binary files /dev/null and b/images/closeconf.png differ diff --git a/js/rendezvous.js b/js/rendezvous.js new file mode 100644 index 0000000..53627e5 --- /dev/null +++ b/js/rendezvous.js @@ -0,0 +1,16 @@ +TO_LOAD_ONCE[TO_LOAD_ONCE.length] = 'load_rdv();'; + +function load_rdv() { + $("#messageconfirmation").click(function() { + $(this).fadeOut(); + }); + + resizeconf(); + $(window).on('cubeitresize', resizeconf); +} + +function resizeconf() { + $("#messageconfirmation .cont").css('left', 212+($(window).width() - 981) / 2); +} + + diff --git a/less/rendezvous.less b/less/rendezvous.less index 84cbfc3..cef6011 100644 --- a/less/rendezvous.less +++ b/less/rendezvous.less @@ -1,5 +1,58 @@ @import "constants.less"; +.twocolumns { + #content{ + #c{ + width:540px; + } + } +} + +#messageconfirmation{ + position:fixed; + top:0px; + left:0px; + width:100%; + height:100%; + z-index: 100; + background-color:rgba(255,255,255,0.7); + cursor:pointer; + display:none; + + .cont{ + text-align: center; + color:#fff; + background-color:#0ea6db; + padding:15px 30px; + border-radius: 5px; + position:absolute; + top:424px; + width:540px; + box-sizing: border-box; + + .close{ + position:absolute; + right:5px; + top:5px; + background-image:url("../images/closeconf.png"); + width:13px; + height:13px; + display: block; + } + } + + +} + +#messageerreur{ + background-color: #f8a3a3; + color:#fff; + padding:14px; + border-radius: 5px; + display:none; + margin:-20px 0 0 0; +} + #formRDV{ width:540px; fieldset{ @@ -30,7 +83,6 @@ } input,select{ - .field; }