Prechádzať zdrojové kódy

Various improvements

boutils 10 rokov pred
rodič
commit
bf94b2cdcc
7 zmenil súbory, kde vykonal 90 pridanie a 64 odobranie
  1. 7 1
      ajax/datastores.php
  2. 0 0
      css/main.css
  3. 8 1
      css/main.less
  4. 2 1
      data/dictionary.json
  5. 8 0
      html/form.html
  6. 12 10
      index.html
  7. 53 51
      js/app.js

+ 7 - 1
ajax/datastores.php

@@ -1,4 +1,8 @@
 <?php
+
+ini_set("SMTP", "mail.manchenumerique.fr");
+ini_set("sendmail_from", "ftth@manchenumerique.fr");
+
 function connect(){
 
   $link = mysql_connect('127.0.0.1','eligibilite','B3Kg7z6d') or die(mysql_error());
@@ -38,8 +42,10 @@ if($_POST['mail']) {
      $headers  = 'MIME-Version: 1.0' . "\r\n";
      $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
 
+     $email = $_POST['siteEmail'] || 'ftth@manchenumerique.fr';
+
      // En-têtes additionnels
-     $headers .= 'From: Manche Numérique <ffth@manchenumerique.fr>' . "\r\n";
+     $headers .= 'From: Manche Numérique <'.$email.'>' . "\r\n";
 
      // Envoi
      $to=$_POST['mail']['to'];

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
css/main.css


+ 8 - 1
css/main.less

@@ -65,6 +65,14 @@ a {
   box-sizing: border-box;
 }
 
+.note {
+  font-size: 11px;
+}
+
+.modal-dialog {
+  width: 770px !important;
+}
+
 .other-radio {
   border: none;
   border-bottom: 1px solid #ddd;
@@ -99,7 +107,6 @@ a {
 }
 
 .box-eligibilite-title .btn{
-  float: right;
   z-index: 1000;
   position: relative;
 }

+ 2 - 1
data/dictionary.json

@@ -19,5 +19,6 @@
   "DB_MIN"                 : "Affaiblissement minimum (db)",
   "DB_MAX"                 : "Affaiblissement maximum (db)",
   "KM²"                    : "Surface zone (km²))",
-  "CODE_NRA"               : "Identifiant NRA"
+  "CODE_NRA"               : "Identifiant NRA",
+  "ID_ZAPM_PARTIELLE"      : "Identifiant ZAPM partielle"
 }

+ 8 - 0
html/form.html

@@ -87,11 +87,19 @@
             </md-radio-button>
 
             <md-radio-button
+              ng-if     = "ctrl.other"
               value     = "autre"
               class     = "md-primary">
 
               Autre:
             </md-radio-button>
+
+            <div
+              class = "note"
+              ng-if = "ctrl.note">
+                <br><br>
+                {{ctrl.note}}
+            </div>
           </md-radio-group>
 
           <!-- Type checkbox -->

+ 12 - 10
index.html

@@ -268,16 +268,18 @@
                   NON
                 </span>
 
-                <button
-                  ng-if       = "results.ftth.date"
-                  type        = "button"
-                  class       = "btn btn-primary btn-lg"
-                  data-toggle = "modal"
-                  ng-click    = "initPopup()"
-                  data-target = "#mn_inscription">
-
-                  Inscription
-                </button>
+                <div ng-if = "results.ftth.date" style="text-align: center; margin-top: 14px;">
+
+                  <button
+                    type        = "button"
+                    class       = "btn btn-primary btn-lg"
+                    data-toggle = "modal"
+                    ng-click    = "initPopup()"
+                    data-target = "#mn_inscription">
+
+                    Inscription
+                  </button>
+                </div>
               </span>
             </div>
 

+ 53 - 51
js/app.js

@@ -21,6 +21,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
       siteUrl              = 'http://eligibilite.manchenumerique.fr',
       siteEmail            = 'ftth@manchenumerique.fr',
       siteAddresse         = '235, rue Joseph Cugnot Zone Delta, 50000 SAINT LÔ',
+      siteTel              = '02.33.77.83.60',
       layer                = {},
       currentMarker, searchExtent;
 
@@ -117,6 +118,17 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
     }
   ];
 
+  var catAccord = [
+    {
+      "name": "J’ai l’intention de souscrire à une offre Très Haut Débit après \r\n le pré-raccordement",
+      "id"  : "avec_souscription"
+    },
+    {
+      "name": "Je n’ai pas l’intention de souscrire à une offre Très Haut Débit après<br> le pré-raccordement",
+      "id"  : "sans_souscription"
+    }
+  ];
+
   $scope.formulaires = {
     "eligibilite": {
       "sections": [
@@ -315,6 +327,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
                   "type"   : "radio",
                   "width"  : null,
                   "require": true,
+                  "other"  : true,
                   "options": {
                     "categories": catVousEtes,
                     "alertes": {
@@ -336,6 +349,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
                   "type"   : "radio",
                   "width"  : null,
                   "require": true,
+                  "other"  : true,
                   "options": {
                     "categories": catCeLogementEst
                   },
@@ -358,14 +372,18 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
                   {
                     "name"   : "Accord",
                     "id"     : "accord",
-                    "libelle": "Je souhaite être pré-raccordé au réseau de fibre optique et accepte les conditions de paiement de 50€. IMPORTANT : le règlement ne vous sera demandé qu’après travaux effectués",
-                    "type"   : "checkbox",
+                    "options": {
+                      "categories": catAccord,
+                    },
+                    "type"   : "radio",
                     "width"  : null,
                     "require": true,
+                    "other"  : false,
                     "isValid": function(value) {
                       return !!value;
                     },
-                    "msg"    : 'Vous devez doner votre accord.'
+                    "msg"    : 'Choix incorrect.',
+                    "note"   : 'IMPORTANT : le règlement ne vous sera demandé qu’après travaux effectués'
                   }
                ]
             }
@@ -392,34 +410,12 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
                ]
             }
           ]
-        },
-        {
-          "name": "Souscription",
-          "visible": false,
-          "lines": [
-            {
-              "ctrls": [
-                  {
-                    "name"   : "Souscription",
-                    "id"     : "souscription_engagement",
-                    "libelle": 'Vous vous engagez à souscrire un abonnement chez un operateur 50 euros, sinon 400 euros.',
-                    "type"   : "checkbox",
-                    "width"  : null,
-                    "require": true,
-                    "isValid": function(value) {
-                      return !!value;
-                    },
-                    "msg"    : 'Vous devez accepter.'
-                  }
-               ]
-            }
-          ]
         }
       ]
     }
   };
 
-  var addCurrentMarker = function() {
+  var addCurrentMarker = function(withReverse) {
     if(currentMarker) {
       map.removeLayer(currentMarker);
     }
@@ -428,16 +424,16 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
 
     currentMarker.bindPopup("L'adresse que vous nous avez fournie est localisée sur la carte. Il se peut que la position réelle de votre logement soit un peu différente. Dans ce cas, merci de déplacer le pointeur sur la carte pour le positionner à l'emplacement de votre logement.").openPopup();
 
-    reverseLocation($scope.geoCode, null, function(address) {
-      $scope.address = address;
-    });
+     if(withReverse) {
+       reverseLocation($scope.geoCode, null, function(address) {
+        $scope.address = address;
+      });
+    }
 
     currentMarker.on('dragend', function(event) {
       var p = currentMarker.getLatLng();
       //console.log('dragend', p);
 
-
-
       $scope.geoCode = {
         x: p.lng,
         y: p.lat
@@ -560,7 +556,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
         x: p.lng,
         y: p.lat
       };
-      addCurrentMarker();
+      addCurrentMarker(true);
       $scope.showResultPane();
       getResults();
     });
@@ -914,7 +910,8 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
 
     _.each(record, function(value, property) {
       if(property.charAt(0) === '_' ||
-         value === null |
+        (property === 'date' && identifier === 'ftth') ||
+         value === null ||
          typeof value === 'undefined') {
 
         return;
@@ -932,7 +929,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
     });
 
     if(identifier === 'adsl') {
-      tooltip = '<a style="float: right;" href ="http://www.ariase.com" target="_blank">Tester mon éligibilité ADSL avec Ariase.com</a>';
+      tooltip = '<a style="float: right;" href="http://www.ariase.com/fr/eligibilite/test.html" target="_blank">Tester mon éligibilité ADSL avec Ariase.com</a>';
     }
     return tooltip;
   };
@@ -964,22 +961,22 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
       $scope.result = {eligibilite: {}, autres: {}};
 
       // Debug
-      $scope.result.eligibilite.prenom                  = 'Francois';
-      $scope.result.eligibilite.nom                     = 'Beaufils';
-      $scope.result.eligibilite.email                   = 'francoisbeaufils@zeno-labs.com';
-      $scope.result.eligibilite.vous_etes               = 'locataire';
-      $scope.result.eligibilite.ce_logement_est         = 'residence_principale';
-      $scope.result.eligibilite.info_et_libertes        = true;
-      $scope.result.eligibilite.accord                  = true;
-      $scope.result.eligibilite.souscription_engagement = true;
-
-      $scope.result.eligibilite.geo_code            = JSON.stringify($scope.geoCode);
-      $scope.result.eligibilite.code_postal         = address.Postal;
-      $scope.result.eligibilite.complement_addresse = address.Match_addr;
-      $scope.result.eligibilite.nom_voie            = address.Address;
-      $scope.result.eligibilite.numero_voie         = address.StreetNumber;
-      $scope.result.eligibilite.type_voie           = address.StreetType;
-      $scope.result.eligibilite.ville               = address.City;
+      // $scope.result.eligibilite.prenom                  = 'Francois';
+      // $scope.result.eligibilite.nom                     = 'Beaufils';
+      // $scope.result.eligibilite.email                   = 'francoisbeaufils@zeno-labs.com';
+      // $scope.result.eligibilite.vous_etes               = 'locataire';
+      // $scope.result.eligibilite.ce_logement_est         = 'residence_principale';
+      // $scope.result.eligibilite.info_et_libertes        = true;
+      // $scope.result.eligibilite.accord                  = 'avec_souscription';
+      // $scope.result.eligibilite.souscription_engagement = true;
+
+      // $scope.result.eligibilite.geo_code            = JSON.stringify($scope.geoCode);
+      // $scope.result.eligibilite.code_postal         = address.Postal;
+      // $scope.result.eligibilite.complement_addresse = address.Match_addr;
+      // $scope.result.eligibilite.nom_voie            = address.Address;
+      // $scope.result.eligibilite.numero_voie         = address.StreetNumber;
+      // $scope.result.eligibilite.type_voie           = address.StreetType;
+      // $scope.result.eligibilite.ville               = address.City;
     });
   };
 
@@ -1015,6 +1012,8 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
 
     if(!item) {
       item           = $scope.suggestions[0];
+      console.log('3 $scope.address', $scope.address);
+      console.log('3 address', item.text);
       $scope.address = item.text;
     }
     $scope.magicKey = item.magicKey;
@@ -1183,6 +1182,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
                 '<div style="">' +
                 ' Email: ' + siteEmail + '<br>' +
                 ' Adresse: ' + siteAddresse + '<br>' +
+                ' Tel: ' + siteTel + '<br>' +
                 '</div><br><br>';
 
         body += 'A bientôt sur:  <a href="' + siteUrl + '">' + siteName + '</a>';
@@ -1196,7 +1196,9 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
         $.ajax({
           method : "POST",
           url    : "ajax/datastores.php",
-          data   :  {mail: mail}
+          data   :  {
+            siteEmail: siteEmail,
+            mail     : mail}
         })
         .done(function( msg ) {
           console.log('Mail result', msg);

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov