Browse Source

offering travel model changed, adding askingtravel functionallity to the app

pull/1/head
nau 8 years ago
parent
commit
7a6cc6b51e
15 changed files with 148 additions and 23 deletions
  1. +7
    -0
      app/www/css/style.css
  2. BIN
      app/www/img/asking.png
  3. BIN
      app/www/img/collectivized.png
  4. BIN
      app/www/img/localization.png
  5. BIN
      app/www/img/offering.png
  6. +0
    -0
      app/www/img/package.png
  7. BIN
      app/www/img/telegram.png
  8. +27
    -8
      app/www/js/controllers.js
  9. +1
    -4
      app/www/templates/menu.html
  10. +66
    -0
      app/www/templates/newaskingtravel.html
  11. +16
    -4
      app/www/templates/newofferingtravel.html
  12. +12
    -2
      app/www/templates/travel.html
  13. +4
    -3
      app/www/templates/travels.html
  14. +6
    -1
      server/controllers/travelController.js
  15. +9
    -1
      server/models/travelModel.js

+ 7
- 0
app/www/css/style.css

@ -13,3 +13,10 @@
.o-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

Before After
Width: 512  |  Height: 512  |  Size: 8.3 KiB

BIN
app/www/img/collectivized.png

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

BIN
app/www/img/localization.png

Before After
Width: 32  |  Height: 32  |  Size: 891 B

BIN
app/www/img/offering.png

Before After
Width: 512  |  Height: 512  |  Size: 9.8 KiB

app/www/img/box.png → app/www/img/package.png


BIN
app/www/img/telegram.png

Before After
Width: 32  |  Height: 32  |  Size: 1013 B

+ 27
- 8
app/www/js/controllers.js

@ -61,26 +61,45 @@ angular.module('starter.controllers', [])
$scope.newtravel={};
// Create the login modal that we will use later
$ionicModal.fromTemplateUrl('templates/newtravel.html', {
$ionicModal.fromTemplateUrl('templates/newofferingtravel.html', {
scope: $scope
}).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
$scope.closeNewTravel = function() {
$scope.modal.hide();
$scope.closeNewOfferingTravel = function() {
$scope.modalOffering.hide();
};
// Triggered in the login modal to close it
$scope.closeNewAskingTravel = function() {
$scope.modalAsking.hide();
};
// Open the login modal
$scope.showNewTravel = function() {
$scope.modal.show();
$scope.showNewOfferingTravel = function() {
$scope.modalOffering.show();
};
// Open the login modal
$scope.showNewAskingTravel = function() {
$scope.modalAsking.show();
};
// Perform the login action when the user submits the login form
$scope.doNewTravel = function() {
$scope.doNewOfferingTravel = function() {
console.log('Doing new travel', $scope.newtravel);
$scope.newtravel.icon="lorry";
$scope.newtravel.generateddate=$scope.newtravel.date;
$scope.newtravel.owner="user";
$scope.newtravel.modality="offering";
console.log($scope.newtravel);
$http({
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
// code if using a login system
$timeout(function() {
$scope.closeNewTravel();
$scope.closeNewOfferingTravel();
}, 1000);
};
})

+ 1
- 4
app/www/templates/menu.html

@ -30,16 +30,13 @@
Travels
</ion-item>
<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
</ion-item>
<ion-item menu-close href="#/app/search">
<img class='o-imgMenu' src="img/carimg/station-wagon.png" />
Available cars
</ion-item>
<ion-item menu-close href="#/app/browse">
Ask for a car
</ion-item>
<ion-item menu-close href="#/app/browse">
<img class='o-imgMenu' src="img/community.png" />
Users

+ 66
- 0
app/www/templates/newaskingtravel.html

@ -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>

app/www/templates/newtravel.html → app/www/templates/newofferingtravel.html

@ -12,10 +12,12 @@
</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>
@ -24,7 +26,10 @@
<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="">
@ -34,18 +39,25 @@
<input ng-model="newtravel.date" type="time" placeholder="">
</label>
<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="">
</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="closeNewTravel()" class="button button-assertive">
<button ng-click="closeNewOfferingTravel()" class="button button-assertive">
Cancel
</button>
<button ng-click="doNewTravel()" class="button button-calm">
<button ng-click="doNewOfferingTravel()" class="button button-calm">
Create travel
</button>
</form>

+ 12
- 2
app/www/templates/travel.html

@ -1,12 +1,19 @@
<ion-view view-title="Travel">
<ion-content>
<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>
<p>{{travel.owner}}</p>
</div>
<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>nº car seats: {{trave.seats}}</p>
<p class="o-bold">{{travel.description}}</p>
@ -14,6 +21,9 @@
<p>
<img class='o-imgMenu' src="img/smartphone.png" /> {{travel.phone}}
</p>
<p>
<img class='o-imgMenu' src="img/telegram.png" /> {{travel.telegram}}
</p>
<p class='text-right'>
<a href="#" class="button button-calm o-pull-right">Ask to join</a>

+ 4
- 3
app/www/templates/travels.html

@ -2,11 +2,12 @@
<ion-content>
<div class="list">
<div class="">
<a ng-click="showNewTravel()" class="button icon ion-plus o-float-right"></a>
<div class="o-float-right">
<a ng-click="showNewAskingTravel()" class="button icon ion-help"></a>
<a ng-click="showNewOfferingTravel()" class="button icon ion-plus"></a>
</div>
<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>
<p>
{{travel.description}}

+ 6
- 1
server/controllers/travelController.js

@ -57,10 +57,15 @@ exports.addTravel = function(req, res) {
from: req.body.from,
to: req.body.to,
date: req.body.date,
periodic: req.body.periodic,
generateddate: req.body.generateddate,
seats: req.body.seats,
package: req.body.package,
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) {

+ 9
- 1
server/models/travelModel.js

@ -9,9 +9,17 @@ var travelSchema = new Schema({
from: { type: String },
to: { type: String },
date: { type: Date },
periodic: { type: Boolean },
generateddate: { type: Date },
seats: { type: Number },
package: { type: Boolean },
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);
//modality can be: offering, asking

Loading…
Cancel
Save