From 9842ccd2733df85e1a24f54f3fbc3240e2e58129 Mon Sep 17 00:00:00 2001 From: palak Date: Thu, 14 Sep 2017 18:05:09 +0530 Subject: [PATCH] changes api call --- script.js | 79 ++++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 26 deletions(-) diff --git a/script.js b/script.js index 7268cc9..eea3b66 100644 --- a/script.js +++ b/script.js @@ -170,6 +170,33 @@ } $scope.calculateAmount = function(){ + + if ($scope.data.stage == undefined || $scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) { + var x = document.getElementById("snackbar") + x.className = "show"; + setTimeout(function() { + x.className = x.className.replace("show", ""); + }, 3000); + } else if ($scope.data.stage != undefined && $scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) { + $scope.infoForm = true; + console.log("sdasdasdsa"); + $scope.data.stage = $scope.data.stage; + $scope.detail = {}; + $scope.data.phone = "+91" + $scope.data.number; + $http({ + method: 'POST', + url: BASE_URL + '/applicants', + data: $scope.data, + headers: {} + }).then(function mySuccess(result) { + console.log("result", result) + $scope.detail = result; + data.applicantId = result.data.id; + $scope.userId = result.data.id; + + }, function myError(error) {}); + } + if ($scope.data.stage == "Idea") { console.log("$scope.data", $scope.data) $scope.ticketAmnt = 500; @@ -197,30 +224,30 @@ /*****THIS IS FOR STEP THREE FORM ******/ $scope.create = function() { - if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) { - var x = document.getElementById("snackbar") - x.className = "show"; - setTimeout(function() { - x.className = x.className.replace("show", ""); - }, 3000); - } else if ($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) { - $scope.infoForm = true; - console.log("sdasdasdsa"); - $scope.data.stage = $scope.data.stage; - $scope.detail = {}; - $scope.data.phone = "+91" + $scope.data.number; - $http({ - method: 'POST', - url: BASE_URL + '/applicants', - data: $scope.data, - headers: {} - }).then(function mySuccess(result) { - - console.log("=====result=====", result) - $scope.detail = result; - data.applicantId = result.data.id; - $scope.userId = result.data.id; - console.log("=====data=====", data) + // if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) { + // var x = document.getElementById("snackbar") + // x.className = "show"; + // setTimeout(function() { + // x.className = x.className.replace("show", ""); + // }, 3000); + // } else if ($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) { + // $scope.infoForm = true; + // console.log("sdasdasdsa"); + // $scope.data.stage = $scope.data.stage; + // $scope.detail = {}; + // $scope.data.phone = "+91" + $scope.data.number; + // $http({ + // method: 'POST', + // url: BASE_URL + '/applicants', + // data: $scope.data, + // headers: {} + // }).then(function mySuccess(result) { + + // console.log("=====result=====", result) + // $scope.detail = result; + // data.applicantId = result.data.id; + // $scope.userId = result.data.id; + // console.log("=====data=====", data) data.amount = $scope.payingAmnt; if ($scope.detail != null) { $http({ @@ -280,8 +307,8 @@ }, function myError(error) {}); } - }, function myError(error) {}); - } + //}, function myError(error) {}); + //} } -- 2.0.0