diff --git a/app/www/img/settings.png b/app/www/img/settings.png new file mode 100644 index 0000000..fcb0750 Binary files /dev/null and b/app/www/img/settings.png differ diff --git a/app/www/js/controllers.js b/app/www/js/controllers.js index 88c60b7..5abe9ac 100644 --- a/app/www/js/controllers.js +++ b/app/www/js/controllers.js @@ -81,6 +81,12 @@ angular.module('starter.controllers', []) $scope.modalAsking = modal; }); + $ionicModal.fromTemplateUrl('templates/newaskingpackage.html', { + scope: $scope + }).then(function(modal) { + $scope.modalPackage = modal; + }); + // Triggered in the login modal to close it $scope.closeNewOfferingTravel = function() { $scope.modalOffering.hide(); @@ -89,6 +95,9 @@ angular.module('starter.controllers', []) $scope.closeNewAskingTravel = function() { $scope.modalAsking.hide(); }; + $scope.closeNewAskingPackage = function() { + $scope.modalPackage.hide(); + }; // Open the login modal $scope.showNewOfferingTravel = function() { @@ -98,6 +107,9 @@ angular.module('starter.controllers', []) $scope.showNewAskingTravel = function() { $scope.modalAsking.show(); }; + $scope.showNewAskingPackage = function() { + $scope.modalPackage.show(); + }; // Perform the login action when the user submits the login form $scope.doNewOfferingTravel = function() { @@ -162,6 +174,38 @@ angular.module('starter.controllers', []) $scope.closeNewAskingTravel(); }, 1000); }; + + $scope.doNewAskingPackage = function() { + console.log('Doing new package', $scope.newtravel); + $scope.newtravel.icon="lorry"; + $scope.newtravel.generateddate=$scope.newtravel.date; + $scope.newtravel.owner="user"; + $scope.newtravel.package=true; + + $scope.newtravel.modality="package"; + console.log($scope.newtravel); + $http({ + url: 'http://localhost:3000/api/travels', + method: "POST", + data: $scope.newtravel + }) + .then(function(response) { + // success + console.log("response: "); + console.log(response); + $scope.newtravel._id=response.data._id; + $scope.travels.push($scope.newtravel); + }, + function(response) { // optional + // failed + }); + + // Simulate a login delay. Remove this and replace with your login + // code if using a login system + $timeout(function() { + $scope.closeNewAskingPackage(); + }, 1000); + }; }) .controller('TravelCtrl', function($scope, $stateParams, $http) { diff --git a/app/www/templates/menu.html b/app/www/templates/menu.html index 04631b7..838f5e6 100644 --- a/app/www/templates/menu.html +++ b/app/www/templates/menu.html @@ -21,10 +21,6 @@ Login - - - Last publications - Travels @@ -34,8 +30,8 @@ Users - - Available cars + + Settings diff --git a/app/www/templates/newaskingpackage.html b/app/www/templates/newaskingpackage.html new file mode 100644 index 0000000..37ce55d --- /dev/null +++ b/app/www/templates/newaskingpackage.html @@ -0,0 +1,54 @@ + + + +

+ + New Asking Package {{newtravel.title}} +

+
+ + + + + + + + + + + + +
+ +
+
diff --git a/app/www/templates/travels.html b/app/www/templates/travels.html index 91219c7..e35e3b5 100644 --- a/app/www/templates/travels.html +++ b/app/www/templates/travels.html @@ -6,7 +6,7 @@
- +
diff --git a/server/models/travelModel.js b/server/models/travelModel.js index d0e8f3f..2a99030 100644 --- a/server/models/travelModel.js +++ b/server/models/travelModel.js @@ -22,4 +22,4 @@ var travelSchema = new Schema({ module.exports = mongoose.model('travelModel', travelSchema); -//modality can be: offering, asking +//modality can be: offering, asking, package