From 90b2d6cfb10e9d219112d4a6ac8c830ad6360c91 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 8 Apr 2017 16:17:16 +0200 Subject: [PATCH] discount --- .../HairCutCommand/BrusherProfileScript.cshtml | 3 ++- Yavsc/Views/HairCutCommand/HairCut.cshtml | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Yavsc/Views/HairCutCommand/BrusherProfileScript.cshtml b/Yavsc/Views/HairCutCommand/BrusherProfileScript.cshtml index 4ff384d0..ca09d94a 100644 --- a/Yavsc/Views/HairCutCommand/BrusherProfileScript.cshtml +++ b/Yavsc/Views/HairCutCommand/BrusherProfileScript.cshtml @@ -14,7 +14,8 @@ var tarifs = brush: [@Model.HalfBrushingPrice, @Model.ShortBrushingPrice, @Model.LongBrushingPrice], multicolor: [@Model.HalfMultiColorPrice, @Model.ShortMultiColorPrice, @Model.LongMultiColorPrice], shampoo: @Model.ShampooPrice, - care: @Model.CarePrice + care: @Model.CarePrice, + feediscount: @Model.FlatFeeDiscount }, { cut: [@Model.ManCutPrice], brush: [@Model.ManBrushPrice], shampoo: @Model.ShampooPrice, diff --git a/Yavsc/Views/HairCutCommand/HairCut.cshtml b/Yavsc/Views/HairCutCommand/HairCut.cshtml index bea94ffc..e8f9192a 100644 --- a/Yavsc/Views/HairCutCommand/HairCut.cshtml +++ b/Yavsc/Views/HairCutCommand/HairCut.cshtml @@ -20,17 +20,22 @@ var gen = $("#Prestation_Gender").prop('selectedIndex'); var tech = $("#Prestation_Tech").prop('selectedIndex'); var dress = $("#Prestation_Dressing").prop('selectedIndex'); + var havecut = false; + var havetech = false; total = 0; if ($('#Prestation_Cut').prop('checked')) { var cutprice = (gen==0) ? gtarif.cut[len] : gtarif.cut[0]; + havecut = true; total += cutprice; displayTarif('CutPrice', cutprice); + } else displayTarif('CutPrice',0); if (gen==0) { if (tech>0) {  var techprice = gtarif.tech[tech-1][len]; total += techprice; displayTarif('TechPrice', techprice); + havetech = true; } else displayTarif('TechPrice',0); if (dress>0) {  var dressprice = gtarif.brush[dress-1]; @@ -50,6 +55,10 @@  total += gtarif.care; displayTarif('CaresPrice', gtarif.care); } else displayTarif('CaresPrice', 0); + if (havetech && havecut) { + total -= gtarif.feediscount; + $('#discount').html( "Remise au forfait coupe+technique: "+gtarif.feediscount+"€" ).removeClass('hidden'); + } else $('#discount').addClass('hidden'); $('.btn-submit').prop('disabled', (total==0)); $('#Total').html( total+"€" ); } @@ -215,7 +224,9 @@ - Total: + + + Total :