MOD #133 (à tester)
[cl7.git] / js / cl7.js
index d482fdc..6197569 100644 (file)
--- a/js/cl7.js
+++ b/js/cl7.js
@@ -43,13 +43,17 @@ cl7.verification_formulaire_inscription = function(util) {
    return true;
 };
 
-cl7.maj_prix_inscription = function() {
-   var nbPeriodes = $('#formulaireInscription input[name="periodes[]"]:checked').length;
+cl7.maj_prix_inscription = function() {\r
+   var prixTotal = (int)($('meta[name="cout_total"]').attr('content'));\r
+   var prixPeriode = (int)($('meta[name="cout_periode"]').attr('content'));\r
+   var nbPeriodesTotal = (int)($('meta[name="nb_periodes"]').attr('content'));\r
+   var nbPeriodesCheck = (int)($('#formulaireInscription input[name="periodes[]"]:checked').length);
+   \r
    var prix = 5;
-   if (nbPeriodes === 3) {
-      prix = 40;
-   } else if (nbPeriodes != 0) {
-      prix = 15 * nbPeriodes;
+   if (nbPeriodesCheck === nbPeriodesTotal) {
+      prix = prixTotal;
+   } else if (nbPeriodesCheck != 0) {
+      prix = prixPeriode * nbPeriodesCheck;
    }
    $('#formulaireInscription span#prix').html(prix.toString());   
 };