Commit e284785e4d8638a32044fb09e49227ca3347f4a9

Authored by Palak Handa
1 parent f37435b932
Exists in master and in 1 other branch paytm

update new field

Showing 2 changed files with 28 additions and 7 deletions   Show diff stats
pages/ambassador.html
... ... @@ -47,6 +47,12 @@
47 47 <label ng-if="numberCheck">Contact Number already exist.</label>
48 48 </div>
49 49 <div class="clearfix"></div>
  50 + <div class="col-xs-12 input-wrapper" >
  51 + <div class="icon-circle-o">
  52 + <i class="material-icons" style="line-height: 30px;">confirmation_number</i>
  53 + </div>
  54 + <input type="number" ng-pattern="/^\d*(?:\.\d{1,2})?$/" title="Please enter only numberic numbers" maxlength="10" required class="text-input" ng-model="data.discount" placeholder="Percentage Discount" ng-change="enternumber(data.discount); discountkeyPress(data.discount)">
  55 + </div>
50 56 </div>
51 57 <!-- close step-one-form -->
52 58 </td>
... ... @@ -78,7 +84,7 @@
78 84 <div class="modal-dialog" style="left: auto;">
79 85 <div class="modal-content">
80 86 <div class="modal-body" style="text-align:center;margin-top:5%">
81   - <p style="font-size:22px">Your Refral Code for 10% discount is</p><p style="font-size:24px"><b>{{data.referalToken}}</b></p>
  87 + <p style="font-size:22px">Your Refral Code for {{data.discount}}% discount is</p><p style="font-size:24px"><b>{{data.referalToken}}</b></p>
82 88 </div>
83 89 <div style="text-align:center;margin-bottom:5%">
84 90 <button style="color: #fff;background-color: #4CAF50;" type="button" class="btn btn-default1" data-dismiss="modal">Close</button>
... ...
... ... @@ -393,10 +393,12 @@
393 393 val = val.toUpperCase();
394 394 $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": {"like":"%25' + val + '%25"}}}')
395 395 .then(function(searchResult) {
  396 + console.log("searchResult",searchResult)
396 397 if (searchResult.data.length == 0) {
397 398 $scope.tokencheck = false;
398 399 $scope.discountAmount = 0;
399 400 } else {
  401 + $scope.discountpercentage = searchResult.data[0].discount;
400 402 $scope.tokencheck = true;
401 403 }
402 404 },function(err){
... ... @@ -500,13 +502,13 @@
500 502 var amount = $scope.ticketAmnt * 100
501 503 if($scope.tokencheck == true){
502 504 var amount = $scope.ticketAmnt
503   - // $scope.discountAmount = (amount * 10)/100
504   - console.log("finalAmount====>",$scope.payingAmnt)
  505 + $scope.discountAmount = (amount * $scope.discountpercentage)/100
  506 + console.log("finalAmount====>",$scope.discountAmount)
505 507 }
506 508  
507   - var taxAmount = $scope.ticketAmnt
  509 + var taxAmount = $scope.ticketAmnt - $scope.discountAmount
508 510 $scope.taxTotal = (taxAmount * 18)/100
509   - $scope.payingAmnt = taxAmount
  511 + $scope.payingAmnt = taxAmount + $scope.taxTotal
510 512 console.log("taxincludedamount----", $scope.payingAmnt)
511 513 console.log("$scope.taxTotal----", $scope.taxTotal)
512 514 // }
... ... @@ -537,7 +539,8 @@
537 539 // data.applicantId = result.data.id;
538 540 // $scope.userId = result.data.id;
539 541 // console.log("=====data=====", data)
540   - data.amount = $scope.payingAmnt + $scope.taxTotal;
  542 + // data.amount = $scope.payingAmnt + $scope.taxTotal;
  543 + data.amount = $scope.payingAmnt;
541 544 console.log("$scope.taxTotal",data.amount)
542 545 if ($scope.detail != null) {
543 546 $http({
... ... @@ -552,7 +555,9 @@
552 555 }, function myError(error) {});
553 556 }
554 557 var i = 0;
555   - $scope.payingAmnt = ($scope.payingAmnt + $scope.taxTotal) * 100;
  558 + //$scope.payingAmnt = ($scope.payingAmnt + $scope.taxTotal) * 100;
  559 +
  560 + $scope.payingAmnt = $scope.payingAmnt * 100;
556 561 var options = {
557 562 "key": "rzp_live_mhSE1uOBlXvFyJ",
558 563 "amount": $scope.payingAmnt ,
... ... @@ -899,6 +904,15 @@
899 904 }
900 905 }
901 906  
  907 + $scope.discountkeyPress = function(discount) {
  908 + console.log("lastName==", name);
  909 + if (discount == undefined) {
  910 + $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)');
  911 + } else {
  912 + $('.icon-circle-o').css('background-color', 'rgb(66, 181, 73)');
  913 + }
  914 + }
  915 +
902 916 $scope.removeNooError = function() {
903 917 $('#invalidIdea').css('display', 'block');
904 918 $('#noExist').css('display', 'none');
... ... @@ -1131,6 +1145,7 @@
1131 1145 $scope.data.name = '';
1132 1146 $scope.data.email = '';
1133 1147 $scope.data.mobile = '';
  1148 + $scope.data.discount = '';
1134 1149  
1135 1150 }, function myError(error) {
1136 1151 console.log(error)
... ...