boutils 9 years ago
parent
commit
41e5438cab
7 changed files with 74 additions and 11 deletions
  1. BIN
      .DS_Store
  2. BIN
      img/comcable.png
  3. BIN
      img/knet.png
  4. BIN
      img/ozone.png
  5. BIN
      img/wibox.png
  6. 37 8
      index.html
  7. 37 3
      js/app.js

BIN
.DS_Store


BIN
img/comcable.png


BIN
img/knet.png


BIN
img/ozone.png


BIN
img/wibox.png


+ 37 - 8
index.html

@@ -220,24 +220,24 @@
 
               éligibilité au pré-raccordement
 
-              <span>
+              <span ng-init = "refreshInscriptionInfo()">
 
                 <span
-                  ng-if = "isInscriptionOpen()"
+                  ng-if = "inscription.open"
                   class = "box-eligibilite-yes">
 
                   OUI
                 </span>
 
                 <span
-                  ng-if = "!isInscriptionOpen()"
+                  ng-if = "!inscription.open"
                   class = "box-eligibilite-no">
 
                   NON
                 </span>
 
                 <div
-                  ng-if = "results.ftth.date && isInscriptionOpen()"
+                  ng-if = "results.ftth.date && inscription.open"
                   style = "text-align: center; margin-top: 14px;">
 
                   <button
@@ -311,9 +311,37 @@
                   </table>
                 </div>
 
-                <div ng-if = "!results.ftth.date">
-
-                  Déploiement prévu ultérieurement.
+                <div ng-if = "inscription.message">
+
+                  {{inscription.message}}
+
+                  <div ng-if = "inscription.cas === 4">
+
+                    <table style="width:100%;">
+                      <tr>
+                        <td style="width:25%;text-align:center;">
+                          <a href = "http://www.comcable.fr" target="_blank">
+                            <img style="width:100%;" src="./img/comcable.png"/>
+                          </a>
+                        </td>
+                        <td style="width:25%;text-align:center;">
+                          <a href = "http://www.k-net.fr" target="_blank">
+                            <img style="width:100%;" src="./img/knet.png"/>
+                          </a>
+                        </td>
+                        <td style="width:25%;text-align:center;">
+                          <a href = "http://www.ozone.net" target="_blank">
+                            <img style="width:100%;" src="./img/ozone.png"/>
+                          </a>
+                        </td>
+                        <td style="width:25%;text-align:center;">
+                          <a href = "http://www.wibox.fr" target="_blank">
+                            <img style="width:100%;" src="./img/wibox.png"/>
+                          </a>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
                 </div>
 
                 <div
@@ -556,7 +584,8 @@
               </div>
 
               <div
-                ng-if = "(!results.ftth.date || !isInscriptionOpen()) && (!results.adsl || results.adsl.LEGENDE === 'Non eligible') && !results.mimo && results.mimo !== undefined">
+                ng-init = "refreshInscriptionInfo()"
+                ng-if   = "(!results.ftth.date || !inscription.open) && (!results.adsl || results.adsl.LEGENDE === 'Non eligible') && !results.mimo && results.mimo !== undefined">
 
                 <p class="bg-warning">Nous vous invitons à contacter les services de <a href="http://www.manchenumerique.fr" >Manche Numérique</a> qui vous indiqueront la procédure pour une connecion internet par satellite et bénéficier d'une prise en charge de l'installation du kit satellitaire par un antenniste.</p>
 

+ 37 - 3
js/app.js

@@ -647,6 +647,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
           $scope.hideResultPane();
         }
       }
+      $scope.refreshInscriptionInfo();
 
       $scope.$apply();
     };
@@ -1001,8 +1002,8 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
     return isValid;
   };
 
-  $scope.isInscriptionOpen = function() {
-    if(!$scope.results.ftth || !$scope.results.ftth.DATE_OUV_BUL_PRERACCO) {return false;}
+  $scope.refreshInscriptionInfo = function() {
+    if(!$scope.results.ftth) {return false;}
 
     var dateDeb = moment($scope.results.ftth.DATE_OUV_BUL_PRERACCO, 'DD/MM/YY');
     var dateFin = moment($scope.results.ftth.DATE_FERM_BUL_PRERACCO, 'DD/MM/YY');
@@ -1010,7 +1011,40 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
     var diffDaysDeb   = now.diff(dateDeb) / 1000 / 3600 / 24;
     var diffDaysFin   = now.diff(dateFin) / 1000 / 3600 / 24;
 
-    return diffDaysDeb > 0 && diffDaysFin < 0;
+    var message = 'Déploiement prévu ultérieurement.';
+    var isOpen = diffDaysDeb > 0 && (!$scope.results.ftth.DATE_FERM_BUL_PRERACCO || diffDaysFin < 0);
+
+    var cas;
+
+    if(isOpen) {
+      message = $scope.results.ftth.DATE_FERM_BUL_PRERACCO ? 'L’inscription au pré-raccordement se termine le ' + dateFin.format('LLL') : '';
+      cas     = 3;
+    }
+    else if($scope.results.ftth.DATE_OUV_BUL_PRERACCO && diffDaysDeb < 0) {
+      message = 'L’inscription au pré-raccordement sera possibe à partir du ' + dateDeb.format('LLL');
+      cas     = 2;
+    }
+    else if(dateFin && diffDaysFin > 0) {
+      message = 'L’inscription au pré-raccordement est terminée. Pour souscrire à une offre internet Très Haut Débit, contactez les fournisseurs d’accès présents sur le réseau:';
+      cas     = 4;
+    }
+    else if($scope.results.ftth.DATE_DEB_TRAV_PREV){
+      var date = moment($scope.results.ftth.DATE_DEB_TRAV_PREV, 'DD/MM/YY').add(12, 'M');
+
+      message = ''; // TODO: should be a semester
+      cas     = 5;
+    }
+    else {
+      cas     = 1;
+    }
+
+    console.log('Cas ' + cas);
+
+    $scope.inscription = {
+      open    : isOpen,
+      message : message,
+      cas     : cas
+    };
   };
 
   $scope.onSubmitAddress = function($item, $model, $label) {