Browse Source

adding new asking package implemented

pull/1/head
nau 8 years ago
parent
commit
caa7b4619a
6 changed files with 102 additions and 8 deletions
  1. BIN
      app/www/img/settings.png
  2. +44
    -0
      app/www/js/controllers.js
  3. +2
    -6
      app/www/templates/menu.html
  4. +54
    -0
      app/www/templates/newaskingpackage.html
  5. +1
    -1
      app/www/templates/travels.html
  6. +1
    -1
      server/models/travelModel.js

BIN
app/www/img/settings.png

Before After
Width: 32  |  Height: 32  |  Size: 1.3 KiB

+ 44
- 0
app/www/js/controllers.js

@ -81,6 +81,12 @@ angular.module('starter.controllers', [])
$scope.modalAsking = modal; $scope.modalAsking = modal;
}); });
$ionicModal.fromTemplateUrl('templates/newaskingpackage.html', {
scope: $scope
}).then(function(modal) {
$scope.modalPackage = modal;
});
// Triggered in the login modal to close it // Triggered in the login modal to close it
$scope.closeNewOfferingTravel = function() { $scope.closeNewOfferingTravel = function() {
$scope.modalOffering.hide(); $scope.modalOffering.hide();
@ -89,6 +95,9 @@ angular.module('starter.controllers', [])
$scope.closeNewAskingTravel = function() { $scope.closeNewAskingTravel = function() {
$scope.modalAsking.hide(); $scope.modalAsking.hide();
}; };
$scope.closeNewAskingPackage = function() {
$scope.modalPackage.hide();
};
// Open the login modal // Open the login modal
$scope.showNewOfferingTravel = function() { $scope.showNewOfferingTravel = function() {
@ -98,6 +107,9 @@ angular.module('starter.controllers', [])
$scope.showNewAskingTravel = function() { $scope.showNewAskingTravel = function() {
$scope.modalAsking.show(); $scope.modalAsking.show();
}; };
$scope.showNewAskingPackage = function() {
$scope.modalPackage.show();
};
// Perform the login action when the user submits the login form // Perform the login action when the user submits the login form
$scope.doNewOfferingTravel = function() { $scope.doNewOfferingTravel = function() {
@ -162,6 +174,38 @@ angular.module('starter.controllers', [])
$scope.closeNewAskingTravel(); $scope.closeNewAskingTravel();
}, 1000); }, 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) { .controller('TravelCtrl', function($scope, $stateParams, $http) {

+ 2
- 6
app/www/templates/menu.html

@ -21,10 +21,6 @@
<ion-item menu-close ng-click="login()"> <ion-item menu-close ng-click="login()">
Login Login
</ion-item> </ion-item>
<ion-item menu-close href="#/app/travels">
<img class='o-imgMenu' src="img/rss-symbol.png" />
Last publications
</ion-item>
<ion-item menu-close href="#/app/travels"> <ion-item menu-close href="#/app/travels">
<img class='o-imgMenu' src="img/road.png" /> <img class='o-imgMenu' src="img/road.png" />
Travels Travels
@ -34,8 +30,8 @@
Users Users
</ion-item> </ion-item>
<ion-item menu-close href="#/app/search"> <ion-item menu-close href="#/app/search">
<img class='o-imgMenu' src="img/carimg/station-wagon.png" />
Available cars
<img class='o-imgMenu' src="img/settings.png" />
Settings
</ion-item> </ion-item>
</ion-list> </ion-list>
</ion-content> </ion-content>

+ 54
- 0
app/www/templates/newaskingpackage.html

@ -0,0 +1,54 @@
<ion-modal-view view-title="Travel">
<ion-content>
<h4>
<img class='o-imgTitle' src="img/package.png" />
New Asking Package {{newtravel.title}}
</h4>
<form class="list">
<label class="item item-input">
<span class="input-label"t>Title</span>
<input ng-model="newtravel.title" class="positive" type="text" placeholder="">
</label>
<label class="item item-input">
<img class='o-imgMenu' src="img/localization.png" />
<span class="input-label">From</span>
<input ng-model="newtravel.from" type="text" placeholder="">
</label>
<label class="item item-input">
<img class='o-imgMenu' src="img/localization.png" />
<span class="input-label">To</span>
<input ng-model="newtravel.to" type="text" placeholder="">
</label>
<label class="item item-input">
<span class="input-label">Date</span>
<input ng-model="newtravel.date" type="date" placeholder="">
</label>
<label class="item item-input">
<span class="input-label">hour</span>
<input ng-model="newtravel.date" type="time" placeholder="">
</label>
<label class="item item-input">
<span class="input-label"><i class="icon ion-iphone"></i> phone contact</span>
<input ng-model="newtravel.phone" type="number" placeholder="">
</label>
<label class="item item-input">
<span class="input-label">telegram user</span>
<input ng-model="newtravel.telegram" type="text" placeholder="">
</label>
<label class="item item-input item-floating-label">
<span class="input-label">Description</span>
<input ng-model="newtravel.description" type="text" placeholder="Description">
</label>
<button ng-click="closeNewAskingPackage()" class="button button-assertive">
Cancel
</button>
<button ng-click="doNewAskingPackage()" class="button button-calm">
Create asking package
</button>
</form>
</ion-content>
</ion-modal-view>

+ 1
- 1
app/www/templates/travels.html

@ -6,7 +6,7 @@
</ion-refresher> </ion-refresher>
<div class="list"> <div class="list">
<div class="o-float-right"> <div class="o-float-right">
<a ng-click="showNewAskingTravel()" class="button icon ion-email"></a>
<a ng-click="showNewAskingPackage()" class="button icon ion-email"></a>
<a ng-click="showNewAskingTravel()" class="button icon ion-help"></a> <a ng-click="showNewAskingTravel()" class="button icon ion-help"></a>
<a ng-click="showNewOfferingTravel()" class="button icon ion-plus"></a> <a ng-click="showNewOfferingTravel()" class="button icon ion-plus"></a>
</div> </div>

+ 1
- 1
server/models/travelModel.js

@ -22,4 +22,4 @@ var travelSchema = new Schema({
module.exports = mongoose.model('travelModel', travelSchema); module.exports = mongoose.model('travelModel', travelSchema);
//modality can be: offering, asking
//modality can be: offering, asking, package

Loading…
Cancel
Save