-
Your Refral Code for 10% discount is
{{data.referalToken}}
+
Your Refral Code for {{data.discount}}% discount is
{{data.referalToken}}
diff --git a/script.js b/script.js
index 0dc4932..411119f 100644
--- a/script.js
+++ b/script.js
@@ -393,10 +393,12 @@
val = val.toUpperCase();
$http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": {"like":"%25' + val + '%25"}}}')
.then(function(searchResult) {
+ console.log("searchResult",searchResult)
if (searchResult.data.length == 0) {
$scope.tokencheck = false;
$scope.discountAmount = 0;
} else {
+ $scope.discountpercentage = searchResult.data[0].discount;
$scope.tokencheck = true;
}
},function(err){
@@ -500,13 +502,13 @@
var amount = $scope.ticketAmnt * 100
if($scope.tokencheck == true){
var amount = $scope.ticketAmnt
- // $scope.discountAmount = (amount * 10)/100
- console.log("finalAmount====>",$scope.payingAmnt)
+ $scope.discountAmount = (amount * $scope.discountpercentage)/100
+ console.log("finalAmount====>",$scope.discountAmount)
}
- var taxAmount = $scope.ticketAmnt
+ var taxAmount = $scope.ticketAmnt - $scope.discountAmount
$scope.taxTotal = (taxAmount * 18)/100
- $scope.payingAmnt = taxAmount
+ $scope.payingAmnt = taxAmount + $scope.taxTotal
console.log("taxincludedamount----", $scope.payingAmnt)
console.log("$scope.taxTotal----", $scope.taxTotal)
// }
@@ -537,7 +539,8 @@
// data.applicantId = result.data.id;
// $scope.userId = result.data.id;
// console.log("=====data=====", data)
- data.amount = $scope.payingAmnt + $scope.taxTotal;
+ // data.amount = $scope.payingAmnt + $scope.taxTotal;
+ data.amount = $scope.payingAmnt;
console.log("$scope.taxTotal",data.amount)
if ($scope.detail != null) {
$http({
@@ -552,7 +555,9 @@
}, function myError(error) {});
}
var i = 0;
- $scope.payingAmnt = ($scope.payingAmnt + $scope.taxTotal) * 100;
+ //$scope.payingAmnt = ($scope.payingAmnt + $scope.taxTotal) * 100;
+
+ $scope.payingAmnt = $scope.payingAmnt * 100;
var options = {
"key": "rzp_live_mhSE1uOBlXvFyJ",
"amount": $scope.payingAmnt ,
@@ -899,6 +904,15 @@
}
}
+ $scope.discountkeyPress = function(discount) {
+ console.log("lastName==", name);
+ if (discount == undefined) {
+ $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)');
+ } else {
+ $('.icon-circle-o').css('background-color', 'rgb(66, 181, 73)');
+ }
+ }
+
$scope.removeNooError = function() {
$('#invalidIdea').css('display', 'block');
$('#noExist').css('display', 'none');
@@ -1131,6 +1145,7 @@
$scope.data.name = '';
$scope.data.email = '';
$scope.data.mobile = '';
+ $scope.data.discount = '';
}, function myError(error) {
console.log(error)