diff --git a/README.md b/README.md index c85b79c..9772004 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -# collectivecarApp \ No newline at end of file +# collectivecarApp + +server code: https://github.com/idoctnef/collectivecarServer diff --git a/www/js/controllers.js b/www/js/controllers.js index 46f188a..7ec5fbd 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -314,6 +314,9 @@ angular.module('starter.controllers', []) }) .controller('TravelCtrl', function($scope, $stateParams, $http) { + if(localStorage.getItem('c_token')){// adding token to the headers + $http.defaults.headers.common['X-Access-Token'] = localStorage.getItem('c_token'); + } $scope.storageusername=localStorage.getItem("c_username"); $scope.travel=""; console.log($stateParams.travelId); @@ -329,6 +332,22 @@ angular.module('starter.controllers', []) .then(function(result){ travels = result.data; }); + $scope.deleteTravel = function(){ + console.log("delete travel: " + $stateParams.travelId); + $http({ + url: urlapi + 'travels/' + $stateParams.travelId, + method: "DELETE" + }) + .then(function(response) { + console.log(response); + }, + function(response) { // optional + // failed + }); + }; + $scope.joinTravel = function(){ + + }; }) .controller('UsersCtrl', function($scope, $http, $ionicModal, $timeout) { diff --git a/www/templates/travel.html b/www/templates/travel.html index 8643407..a7b0353 100644 --- a/www/templates/travel.html +++ b/www/templates/travel.html @@ -34,12 +34,12 @@

- Ask to join - Offer car - Offer car + Ask to join + Offer car + Offer car

- Delete + Delete

diff --git a/www/templates/travels.html b/www/templates/travels.html index 9bd26a1..43de040 100644 --- a/www/templates/travels.html +++ b/www/templates/travels.html @@ -19,16 +19,17 @@

{{travel.title}}

-
-
{{travel.date | date:"dd/MM HH:mm a"}}
-
{{travel.owner}}
+
+
{{travel.date | date:"dd/MM"}}
+
{{travel.date | date:"HH:mm"}}h
+

{{travel.description}}

-

nºseats: {{travel.seats}}

-

nºpeople: {{travel.seats}}

- + +

{{travel.from}} - {{travel.to}}