]> _ Git - ccgm.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 26 Nov 2013 18:12:57 +0000 (18:12 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 26 Nov 2013 18:12:57 +0000 (18:12 +0000)
framework/application/configs/application.ini
framework/application/controllers/AjaxController.php
framework/application/forms/Rendezvous.php
framework/application/views/scripts/templates/rendezvous.phtml
images/closeconf.png [new file with mode: 0644]
js/rendezvous.js [new file with mode: 0644]
less/rendezvous.less

index c67c3e09611c1fb3718182857c7a4ab9cd6cb4a5..2500b57f1538d0adf34bfd584f873f21dc907560 100644 (file)
@@ -45,6 +45,9 @@ acl.roles[] = admin
 
 mail.test = APPLICATION_PATH "/../data/email/test"
 
+mailjet.username = a0efe78a914ae9b7b972618c6c3e1803
+mailjet.password = b4d51c4c1d0193f9b0963c2c374dd882
+
 [testing : production]
 dev = true
 
index 981ceb1d7507b0c712535da89f46a97919e07254..5104783daf6ec3bbf9a2bde9b71be336350c5ce7 100644 (file)
@@ -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);
                }
        }
 
index 5a30f12ec0c24796f1c4d3b5ede78b6595577bfc..004ecf48665be45772db04d99aba537b85516353 100644 (file)
@@ -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');
index 64ce99e4760c4afdc602af7134489467449d4d1b..3b3f6ff3c818456725fbcb9d18eb8f3b4d341555 100644 (file)
@@ -2,13 +2,15 @@
 $this->headScript()
                ->addPolyfill('placeholder')
                ->addScriptAndStyle('rendezvous')
-               ->addCheckbox();
+               ->addCheckbox()
+               ->addScrollTo();
 ?>
 <section id="content">
        <div id="c">
                <?php
                echo $this->markupDotclear($this->text);
                echo '<div id="messageerreur">' . $this->erreur . '</div>';
+               echo '<div id="messageconfirmation"><div class="cont"><a href="#" class="close"></a>' . $this->markupDotclear($this->confirmation) . '</div></div>';
                $form = new CCGM_Form_Rendezvous();
                $form->getElement('page')->setValue($this->currentPage->getId());
                $form->setMedecins($this->medecins);
@@ -16,4 +18,4 @@ $this->headScript()
                ?>
        </div>
        <?php echo $this->rightbar() ?>
-</section>
\ No newline at end of file
+</section> 
\ No newline at end of file
diff --git a/images/closeconf.png b/images/closeconf.png
new file mode 100644 (file)
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 (file)
index 0000000..53627e5
--- /dev/null
@@ -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);
+}
+
+
index 84cbfc36591904862d6b9ea68d3216b6cc448d7f..cef601196f4965f95401f9202918151bb1914b72 100644 (file)
@@ -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;
                }