From caa7b4619a2339330790fdfc952a6d5c93e1a3bf Mon Sep 17 00:00:00 2001 From: nau Date: Sun, 28 Aug 2016 12:20:55 +0200 Subject: [PATCH] adding new asking package implemented --- app/www/img/settings.png | Bin 0 -> 1375 bytes app/www/js/controllers.js | 44 +++++++++++++++++++ app/www/templates/menu.html | 8 +--- app/www/templates/newaskingpackage.html | 54 ++++++++++++++++++++++++ app/www/templates/travels.html | 2 +- server/models/travelModel.js | 2 +- 6 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 app/www/img/settings.png create mode 100644 app/www/templates/newaskingpackage.html diff --git a/app/www/img/settings.png b/app/www/img/settings.png new file mode 100644 index 0000000000000000000000000000000000000000..fcb0750cb97ca43ecb55d61597d9874c07148596 GIT binary patch literal 1375 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyEa{HEjtmSN`?>!lvVtU&J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+081LKSUpAgso|NndY1$n`d zZy=Z*3=#1T2=MX+vID*Sg1vnMy}hBbo?vCZzM)<~alarR{~#a_*@Uj9(Mo zz>0l*z}g}H1=$YtFWB$?LEu0Gk|3i%E(f|3Y^*2H3;w|n&jMp@ANx#MAk|h9jeoKm6^8I`)qH`^g!<4KrQN*t(y)p}kXR z!Zb6}mMuTk4F2p%ImN(%*R*LRsA2m zKl|80Y|3-%_Mm;ISK1u6JQ_QD;;J1h)+-({`kJt2V{<^AQ}#cDIY1XNCV9KNwEw=z zeHzH&Ebxdd1}4wzAk65bF}ngN$X?><>&pIsLxzW2hVMY03Q*4vPZ!4!i_@(^zoUf$ z1!T7#SbAmA8IC2_0>XQ^oOHdfMCb}Ej9RfpmE*&xz~Jwn@dWWZQWNamT5ix_FbrrEa&lpIV<@8uASH@tiIQ0?xD;@j&l+VUaWZ^ zqx_Da;qbxF;tPzDpC~!iE|zdkxX{E(Dp#R(T2g@~Wx9F) z4Mk_mDPA&AetY4o^xLR;dn>&cS*kpXe$3syBloeS<;|L)ewQyx67&;qD&9XByDlhE zVQ$*qWjjO<&vE8RY^^n3{o&{4n-zSk=R9nTc6opI`p1S$<^HA*HZC*5Js(_rY`Unl z^=a*)9AQiAWIoStU&U_PHC_3<#X$1uJ)t?aM-~>RPMIIND#ZW%(rM>zwd7bS1bZ zJNJG3*86W#@sfErE-~5fl+8>Jas9pTberFY+v@pE2an!dws@&+=+DNv^ToQ>*e~Wd zedXrO)z!U4%)j&Y?T*(Fp89&Gd3o{5YuoA`1526u6_fwC9^IsMnC}Q!>*kacj8Wer^p=gCxj?;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xh Rq=1STJYD@<);T3K0RWpG9PI!A literal 0 HcmV?d00001 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