mirror of
https://github.com/arnaucube/commonroutesServer.git
synced 2026-02-28 05:26:42 +01:00
adding new asking package implemented
This commit is contained in:
BIN
app/www/img/settings.png
Normal file
BIN
app/www/img/settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -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) {
|
||||
|
||||
@@ -21,10 +21,6 @@
|
||||
<ion-item menu-close ng-click="login()">
|
||||
Login
|
||||
</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">
|
||||
<img class='o-imgMenu' src="img/road.png" />
|
||||
Travels
|
||||
@@ -34,8 +30,8 @@
|
||||
Users
|
||||
</ion-item>
|
||||
<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-list>
|
||||
</ion-content>
|
||||
|
||||
54
app/www/templates/newaskingpackage.html
Normal file
54
app/www/templates/newaskingpackage.html
Normal file
@@ -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>
|
||||
@@ -6,7 +6,7 @@
|
||||
</ion-refresher>
|
||||
<div class="list">
|
||||
<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="showNewOfferingTravel()" class="button icon ion-plus"></a>
|
||||
</div>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user