offering travel model changed, adding askingtravel functionallity to the app
@@ -13,3 +13,10 @@
|
|||||||
.o-float-right{
|
.o-float-right{
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
.o-text-right{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.o-mini-text{
|
||||||
|
font-size: 12px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|||||||
BIN
app/www/img/asking.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
app/www/img/collectivized.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/www/img/localization.png
Normal file
|
After Width: | Height: | Size: 891 B |
BIN
app/www/img/offering.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 555 B |
BIN
app/www/img/telegram.png
Normal file
|
After Width: | Height: | Size: 1013 B |
@@ -61,26 +61,45 @@ angular.module('starter.controllers', [])
|
|||||||
$scope.newtravel={};
|
$scope.newtravel={};
|
||||||
|
|
||||||
// Create the login modal that we will use later
|
// Create the login modal that we will use later
|
||||||
$ionicModal.fromTemplateUrl('templates/newtravel.html', {
|
$ionicModal.fromTemplateUrl('templates/newofferingtravel.html', {
|
||||||
scope: $scope
|
scope: $scope
|
||||||
}).then(function(modal) {
|
}).then(function(modal) {
|
||||||
$scope.modal = modal;
|
$scope.modalOffering = modal;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Create the login modal that we will use later
|
||||||
|
$ionicModal.fromTemplateUrl('templates/newaskingtravel.html', {
|
||||||
|
scope: $scope
|
||||||
|
}).then(function(modal) {
|
||||||
|
$scope.modalAsking = modal;
|
||||||
|
});
|
||||||
|
|
||||||
// Triggered in the login modal to close it
|
// Triggered in the login modal to close it
|
||||||
$scope.closeNewTravel = function() {
|
$scope.closeNewOfferingTravel = function() {
|
||||||
$scope.modal.hide();
|
$scope.modalOffering.hide();
|
||||||
|
};
|
||||||
|
// Triggered in the login modal to close it
|
||||||
|
$scope.closeNewAskingTravel = function() {
|
||||||
|
$scope.modalAsking.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Open the login modal
|
// Open the login modal
|
||||||
$scope.showNewTravel = function() {
|
$scope.showNewOfferingTravel = function() {
|
||||||
$scope.modal.show();
|
$scope.modalOffering.show();
|
||||||
};
|
};
|
||||||
|
// Open the login modal
|
||||||
|
$scope.showNewAskingTravel = function() {
|
||||||
|
$scope.modalAsking.show();
|
||||||
|
};
|
||||||
|
|
||||||
// Perform the login action when the user submits the login form
|
// Perform the login action when the user submits the login form
|
||||||
$scope.doNewTravel = function() {
|
$scope.doNewOfferingTravel = function() {
|
||||||
console.log('Doing new travel', $scope.newtravel);
|
console.log('Doing new travel', $scope.newtravel);
|
||||||
$scope.newtravel.icon="lorry";
|
$scope.newtravel.icon="lorry";
|
||||||
$scope.newtravel.generateddate=$scope.newtravel.date;
|
$scope.newtravel.generateddate=$scope.newtravel.date;
|
||||||
$scope.newtravel.owner="user";
|
$scope.newtravel.owner="user";
|
||||||
|
|
||||||
|
$scope.newtravel.modality="offering";
|
||||||
console.log($scope.newtravel);
|
console.log($scope.newtravel);
|
||||||
$http({
|
$http({
|
||||||
url: 'http://localhost:3000/api/travels',
|
url: 'http://localhost:3000/api/travels',
|
||||||
@@ -101,7 +120,7 @@ angular.module('starter.controllers', [])
|
|||||||
// Simulate a login delay. Remove this and replace with your login
|
// Simulate a login delay. Remove this and replace with your login
|
||||||
// code if using a login system
|
// code if using a login system
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.closeNewTravel();
|
$scope.closeNewOfferingTravel();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -30,16 +30,13 @@
|
|||||||
Travels
|
Travels
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item menu-close href="#/app/browse">
|
<ion-item menu-close href="#/app/browse">
|
||||||
<img class='o-imgMenu' src="img/box.png" />
|
<img class='o-imgMenu' src="img/package.png" />
|
||||||
Transport material
|
Transport material
|
||||||
</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" />
|
<img class='o-imgMenu' src="img/carimg/station-wagon.png" />
|
||||||
Available cars
|
Available cars
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item menu-close href="#/app/browse">
|
|
||||||
Ask for a car
|
|
||||||
</ion-item>
|
|
||||||
<ion-item menu-close href="#/app/browse">
|
<ion-item menu-close href="#/app/browse">
|
||||||
<img class='o-imgMenu' src="img/community.png" />
|
<img class='o-imgMenu' src="img/community.png" />
|
||||||
Users
|
Users
|
||||||
|
|||||||
66
app/www/templates/newaskingtravel.html
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<ion-modal-view view-title="Travel">
|
||||||
|
<ion-content>
|
||||||
|
|
||||||
|
<h4>
|
||||||
|
<img class='o-imgTitle' src="img/road.png" />
|
||||||
|
New Asking Travel {{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">nºSeats</span>
|
||||||
|
<input ng-model="newtravel.seats" type="number" placeholder="">
|
||||||
|
</label>
|
||||||
|
<ion-toggle ng-model="newtravel.package" toggle-class="toggle-calm">
|
||||||
|
<img class='o-imgMenu' src="img/package.png" />
|
||||||
|
Can carry package
|
||||||
|
</ion-toggle>
|
||||||
|
<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>
|
||||||
|
<ion-toggle ng-model="newtravel.collectivized" toggle-class="toggle-calm">
|
||||||
|
Collectivized car
|
||||||
|
</ion-toggle>
|
||||||
|
|
||||||
|
<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="closeNewOfferingTravel()" class="button button-assertive">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
<button ng-click="doNewOfferingTravel()" class="button button-calm">
|
||||||
|
Create travel
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</ion-content>
|
||||||
|
</ion-modal-view>
|
||||||
@@ -12,10 +12,12 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="item item-input">
|
<label class="item item-input">
|
||||||
|
<img class='o-imgMenu' src="img/localization.png" />
|
||||||
<span class="input-label">From</span>
|
<span class="input-label">From</span>
|
||||||
<input ng-model="newtravel.from" type="text" placeholder="">
|
<input ng-model="newtravel.from" type="text" placeholder="">
|
||||||
</label>
|
</label>
|
||||||
<label class="item item-input">
|
<label class="item item-input">
|
||||||
|
<img class='o-imgMenu' src="img/localization.png" />
|
||||||
<span class="input-label">To</span>
|
<span class="input-label">To</span>
|
||||||
<input ng-model="newtravel.to" type="text" placeholder="">
|
<input ng-model="newtravel.to" type="text" placeholder="">
|
||||||
</label>
|
</label>
|
||||||
@@ -24,7 +26,10 @@
|
|||||||
<span class="input-label">nºSeats</span>
|
<span class="input-label">nºSeats</span>
|
||||||
<input ng-model="newtravel.seats" type="number" placeholder="">
|
<input ng-model="newtravel.seats" type="number" placeholder="">
|
||||||
</label>
|
</label>
|
||||||
|
<ion-toggle ng-model="newtravel.package" toggle-class="toggle-calm">
|
||||||
|
<img class='o-imgMenu' src="img/package.png" />
|
||||||
|
Can carry package
|
||||||
|
</ion-toggle>
|
||||||
<label class="item item-input">
|
<label class="item item-input">
|
||||||
<span class="input-label">Date</span>
|
<span class="input-label">Date</span>
|
||||||
<input ng-model="newtravel.date" type="date" placeholder="">
|
<input ng-model="newtravel.date" type="date" placeholder="">
|
||||||
@@ -34,18 +39,25 @@
|
|||||||
<input ng-model="newtravel.date" type="time" placeholder="">
|
<input ng-model="newtravel.date" type="time" placeholder="">
|
||||||
</label>
|
</label>
|
||||||
<label class="item item-input">
|
<label class="item item-input">
|
||||||
<span class="input-label">phone contact</span>
|
<span class="input-label"><i class="icon ion-iphone"></i> phone contact</span>
|
||||||
<input ng-model="newtravel.phone" type="number" placeholder="">
|
<input ng-model="newtravel.phone" type="number" placeholder="">
|
||||||
</label>
|
</label>
|
||||||
|
<label class="item item-input">
|
||||||
|
<span class="input-label">telegram user</span>
|
||||||
|
<input ng-model="newtravel.telegram" type="text" placeholder="">
|
||||||
|
</label>
|
||||||
|
<ion-toggle ng-model="newtravel.collectivized" toggle-class="toggle-calm">
|
||||||
|
Collectivized car
|
||||||
|
</ion-toggle>
|
||||||
|
|
||||||
<label class="item item-input item-floating-label">
|
<label class="item item-input item-floating-label">
|
||||||
<span class="input-label">Description</span>
|
<span class="input-label">Description</span>
|
||||||
<input ng-model="newtravel.description" type="text" placeholder="Description">
|
<input ng-model="newtravel.description" type="text" placeholder="Description">
|
||||||
</label>
|
</label>
|
||||||
<button ng-click="closeNewTravel()" class="button button-assertive">
|
<button ng-click="closeNewOfferingTravel()" class="button button-assertive">
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button ng-click="doNewTravel()" class="button button-calm">
|
<button ng-click="doNewOfferingTravel()" class="button button-calm">
|
||||||
Create travel
|
Create travel
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -1,12 +1,19 @@
|
|||||||
<ion-view view-title="Travel">
|
<ion-view view-title="Travel">
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<div class="item item-avatar">
|
<div class="item item-avatar">
|
||||||
<img ng-src="img/carimg/{{travel.icon}}.png">
|
<img ng-src="img/{{travel.modality}}.png" />
|
||||||
|
<span class="badge badge-balanced" ng-show="travel.collectivized">Collectivized</span>
|
||||||
<h2>{{travel.title}}</h2>
|
<h2>{{travel.title}}</h2>
|
||||||
<p>{{travel.owner}}</p>
|
<p>{{travel.owner}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="item item-body">
|
<div class="item item-body">
|
||||||
<div class="badge item-note">{{travel.date | date:"dd/MM HH:mm a"}}</div>
|
<div class='o-float-right o-text-right'>
|
||||||
|
<div class="">{{travel.date | date:"dd/MM HH:mm a"}}</div>
|
||||||
|
<br>
|
||||||
|
<div class="royal" ng-show="travel.package">[periodic travel]</div>
|
||||||
|
<br>
|
||||||
|
<div class="o-mini-text" ng-show="travel.package">can carry package<img src="img/package.png" class="o-imgMenu" /></div>
|
||||||
|
</div>
|
||||||
<p><img class='o-imgTitle' src="img/from-to.png" />{{travel.from}} - {{travel.to}}</p>
|
<p><img class='o-imgTitle' src="img/from-to.png" />{{travel.from}} - {{travel.to}}</p>
|
||||||
<p>nº car seats: {{trave.seats}}</p>
|
<p>nº car seats: {{trave.seats}}</p>
|
||||||
<p class="o-bold">{{travel.description}}</p>
|
<p class="o-bold">{{travel.description}}</p>
|
||||||
@@ -14,6 +21,9 @@
|
|||||||
<p>
|
<p>
|
||||||
<img class='o-imgMenu' src="img/smartphone.png" /> {{travel.phone}}
|
<img class='o-imgMenu' src="img/smartphone.png" /> {{travel.phone}}
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<img class='o-imgMenu' src="img/telegram.png" /> {{travel.telegram}}
|
||||||
|
</p>
|
||||||
|
|
||||||
<p class='text-right'>
|
<p class='text-right'>
|
||||||
<a href="#" class="button button-calm o-pull-right">Ask to join</a>
|
<a href="#" class="button button-calm o-pull-right">Ask to join</a>
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
||||||
<div class="list">
|
<div class="list">
|
||||||
<div class="">
|
<div class="o-float-right">
|
||||||
<a ng-click="showNewTravel()" class="button icon ion-plus o-float-right"></a>
|
<a ng-click="showNewAskingTravel()" class="button icon ion-help"></a>
|
||||||
|
<a ng-click="showNewOfferingTravel()" class="button icon ion-plus"></a>
|
||||||
</div>
|
</div>
|
||||||
<a ng-repeat="travel in travels | orderBy: 'date'" class="item item-avatar" href="#/app/travels/{{travel._id}}">
|
<a ng-repeat="travel in travels | orderBy: 'date'" class="item item-avatar" href="#/app/travels/{{travel._id}}">
|
||||||
<img ng-src="img/carimg/{{travel.icon}}.png">
|
<img ng-src="img/{{travel.modality}}.png">
|
||||||
<h2>{{travel.title}}</h2>
|
<h2>{{travel.title}}</h2>
|
||||||
<p>
|
<p>
|
||||||
{{travel.description}}
|
{{travel.description}}
|
||||||
|
|||||||
@@ -57,10 +57,15 @@ exports.addTravel = function(req, res) {
|
|||||||
from: req.body.from,
|
from: req.body.from,
|
||||||
to: req.body.to,
|
to: req.body.to,
|
||||||
date: req.body.date,
|
date: req.body.date,
|
||||||
|
periodic: req.body.periodic,
|
||||||
generateddate: req.body.generateddate,
|
generateddate: req.body.generateddate,
|
||||||
seats: req.body.seats,
|
seats: req.body.seats,
|
||||||
|
package: req.body.package,
|
||||||
icon: req.body.icon,
|
icon: req.body.icon,
|
||||||
phone: req.body.phone
|
phone: req.body.phone,
|
||||||
|
telegram: req.body.telegram,
|
||||||
|
collectivized: req.body.collectivized,
|
||||||
|
modality: req.body.modality
|
||||||
});
|
});
|
||||||
|
|
||||||
travel.save(function(err, travel) {
|
travel.save(function(err, travel) {
|
||||||
|
|||||||
@@ -9,9 +9,17 @@ var travelSchema = new Schema({
|
|||||||
from: { type: String },
|
from: { type: String },
|
||||||
to: { type: String },
|
to: { type: String },
|
||||||
date: { type: Date },
|
date: { type: Date },
|
||||||
|
periodic: { type: Boolean },
|
||||||
generateddate: { type: Date },
|
generateddate: { type: Date },
|
||||||
seats: { type: Number },
|
seats: { type: Number },
|
||||||
|
package: { type: Boolean },
|
||||||
icon: { type: String },
|
icon: { type: String },
|
||||||
phone: { type: Number }
|
phone: { type: Number },
|
||||||
|
telegram: { type: String },
|
||||||
|
collectivized: { type: Boolean },
|
||||||
|
modality: { type: String } //if is an offering travel or asking for travel
|
||||||
})
|
})
|
||||||
module.exports = mongoose.model('travelModel', travelSchema);
|
module.exports = mongoose.model('travelModel', travelSchema);
|
||||||
|
|
||||||
|
|
||||||
|
//modality can be: offering, asking
|
||||||
|
|||||||