diff --git a/www/js/travel.js b/www/js/travel.js index 8006a24..fb7c4f3 100644 --- a/www/js/travel.js +++ b/www/js/travel.js @@ -125,6 +125,27 @@ angular.module('app.travel', ['pascalprecht.translate', 'ui-leaflet']) }); }; + $scope.declineJoin = function(joinPetition){ + $http({ + url: urlapi + 'travels/declineJoin/'+ $stateParams.travelid, + method: "POST", + data: {userid: joinPetition._id} + }) + .then(function(data) { + console.log("data: "); + console.log(data); + if(data.success==false){ + $ionicLoading.show({template: 'Error on unjoin', noBackdrop: true, duration: 2000}); + }else{ + $scope.travel=data.data; + console.log("success"); + } + }, + function(response) { // optional + // failed + }); + }; + $scope.acceptJoin = function(joinPetition){ $http({ url: urlapi + 'travels/acceptJoin/'+ $stateParams.travelid, @@ -146,6 +167,26 @@ angular.module('app.travel', ['pascalprecht.translate', 'ui-leaflet']) }); }; + $scope.leaveTravel = function(){ + $http({ + url: urlapi + 'travels/leave/'+ $stateParams.travelid, + method: "POST", + data: {} + }) + .then(function(data) { + console.log("data: "); + console.log(data); + if(data.success==false){ + $ionicLoading.show({template: 'Error on unjoin', noBackdrop: true, duration: 2000}); + }else{ + $scope.travel=data.data; + } + }, + function(response) { // optional + // failed + }); + }; + /* adding comment */ $scope.doingNewComment=false; $scope.newComment={}; diff --git a/www/templates/travel.html b/www/templates/travel.html index 9e2aef3..89d218d 100644 --- a/www/templates/travel.html +++ b/www/templates/travel.html @@ -1,5 +1,9 @@ + +

@@ -60,7 +64,7 @@

- {{'Leave' | translate}} + {{'Leave' | translate}} {{'Leave' | translate}} {{'Leave' | translate}}
@@ -97,7 +101,7 @@
-