@ -1,112 +1,29 @@ |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-sm-4"> |
|||
<div ng-repeat="travel in travels"> |
|||
<div class="card"> |
|||
<div class="card-body" style="color:#ffffff; background-image: url('img/userProfileBackground.png');"> |
|||
<div class="pull-right">{{travel.date | date}}</div> |
|||
<h4 class="card-title"><b>{{travel.title}}</b></h4> |
|||
</div> |
|||
<div class="card-body"> |
|||
<div class="pull-right"> |
|||
<a ng-href="#!/user/{{travel.user._id}}"> |
|||
<img class="circle" style="max-width: 30px; max-height:30px;" ng-src="{{travel.user.avatar}}" /> |
|||
{{travel.user.username}} |
|||
</a> |
|||
</div> |
|||
<p> |
|||
From: <b>{{travel.from.name}}</b> |
|||
</p> |
|||
<p> |
|||
To: <b>{{travel.to.name}}</b> |
|||
</p> |
|||
<p> |
|||
{{travel.joins.length}}/{{travel.seats}} |
|||
</p> |
|||
<p ng-show="travel.package"> |
|||
Can transport package |
|||
</p> |
|||
<a href="#" class="card-link">Go somewhere</a> |
|||
</div> |
|||
</div> |
|||
<br><br> |
|||
</div> |
|||
<div ng-repeat="travel in travels"> |
|||
<div class="card"> |
|||
<img class="card-img-top" src="..." alt="Card image cap"> |
|||
<div class="card-body"> |
|||
<h4 class="card-title">Card title</h4> |
|||
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> |
|||
<a href="#" class="btn btn-primary">Go somewhere</a> |
|||
</div> |
|||
</div> |
|||
<br><br> |
|||
<div ng-repeat="travel in travels" ng-if="$index % 3 == 0"> |
|||
<a ng-href="#!/travel/{{travel._id}}"> |
|||
<div ng-include="'views/travelCardTemplate.html'"></div> |
|||
</a> |
|||
<br> |
|||
</div> |
|||
</div> |
|||
<div class="col-sm-4"> |
|||
<div class="panel"> |
|||
<div class="panel-heading c_deepPurpleG500to300"> |
|||
<h3 class="panel-title"> |
|||
Travels Feed |
|||
<span class="badge badge-secondary pull-right c_deepPurpleG500to300">{{travels.length}}</span> |
|||
</h3> |
|||
</div> |
|||
<div class="panel-body" style="max-height: 500px;overflow-y: scroll;"> |
|||
<table class="table table-striped table-hover "> |
|||
<thead> |
|||
<tr> |
|||
<th>Type</th> |
|||
<th>Title</th> |
|||
<th>From</th> |
|||
<th>To</th> |
|||
<th>Date</th> |
|||
<th>User</th> |
|||
<th>nºJoins/Seats</th> |
|||
<th></th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr ng-repeat="travel in travels"> |
|||
<a ng-href="#!/travel/{{travel._id}}"> |
|||
<td> |
|||
<i ng-show="travel.type=='offering'" title="offering" class="fa fa-car fa-2x"></i> |
|||
<i ng-show="travel.type=='asking'" title="asking" class="fa fa-question fa-2x"></i> |
|||
<i ng-show="travel.type=='package'" title="package" class="fa fa-archive fa-2x"></i> |
|||
</td> |
|||
<td>{{travel.title}}</td> |
|||
<td> |
|||
<b>{{travel.from.name}}</b> |
|||
</td> |
|||
<td> |
|||
<b>{{travel.to.name}}</b> |
|||
</td> |
|||
<td>{{travel.date | date}}</td> |
|||
<td> |
|||
<a ng-href="#!/user/{{travel.user._id}}"> |
|||
<img class="circle" style="max-width: 30px; max-height:30px;" ng-src="{{travel.user.avatar}}" /> |
|||
{{travel.user.username}} |
|||
</a> |
|||
</td> |
|||
<td>{{travel.joins.length}}/{{travel.seats}}</td> |
|||
<td><a ng-href="#!/travel/{{travel._id}}">View</a></td> |
|||
</a> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div ng-repeat="travel in travels" ng-if="$index % 3 == 1"> |
|||
<a ng-href="#!/travel/{{travel._id}}"> |
|||
<div ng-include="'views/travelCardTemplate.html'"></div> |
|||
</a> |
|||
<br> |
|||
</div> |
|||
</div> |
|||
<div class="col-sm-2"> |
|||
<div class="panel"> |
|||
<div class="panel-heading c_deepPurpleG500to300"> |
|||
<h3 class="panel-title">Actions</h3> |
|||
</div> |
|||
<div class="panel-body"> |
|||
<div class="btn btn-block btn-sm c_green300">Create user</div> |
|||
<div class="btn btn-block btn-sm c_blue300">Create travel</div> |
|||
<a href="#!/network" class="btn btn-block btn-sm c_deepPurpleG500to300">View network</a> |
|||
</div> |
|||
<div class="col-sm-4"> |
|||
<div ng-repeat="travel in travels" ng-if="$index % 3 == 2"> |
|||
<a ng-href="#!/travel/{{travel._id}}"> |
|||
<div ng-include="'views/travelCardTemplate.html'"></div> |
|||
</a> |
|||
<br> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
@ -1,45 +1,53 @@ |
|||
<div ng-controller="NavbarCtrl"> |
|||
<div ng-show="storageuser" class="navbar c_deepPurpleG500to300"> |
|||
<div class="container-fluid"> |
|||
<div class="navbar-header"> |
|||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse"> |
|||
<div ng-show="storageuser" class="navbar c_deepPurpleG500to300"> |
|||
<div class="container-fluid"> |
|||
<div class="navbar-header"> |
|||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse"> |
|||
<span class="icon-bar"></span> |
|||
<span class="icon-bar"></span> |
|||
<span class="icon-bar"></span> |
|||
</button> |
|||
<a class="navbar-brand" href="/">Common Routes</a> |
|||
</div> |
|||
<div class="navbar-collapse collapse navbar-responsive-collapse"> |
|||
<ul class="nav navbar-nav"> |
|||
<li class="active"><a href="#!/users">Users</a></li> |
|||
<li><a href="#!/travels">Travels</a></li> |
|||
</ul> |
|||
<form ng-submit="search()" class="navbar-form navbar-left"> |
|||
<div class="form-group"> |
|||
<input ng-model="searchString" class="form-control col-md-8" placeholder="Search" type="text"> |
|||
</div> |
|||
</form> |
|||
<ul class="nav navbar-nav navbar-right"> |
|||
<li><a href="#!/new"> |
|||
<i title="post new travel" class="fa fa-plus fa-2x"></i> |
|||
</a></li> |
|||
<li class="dropdown"> |
|||
<a href="" data-target="#" class="dropdown-toggle" data-toggle="dropdown">Settings |
|||
<b class="caret"></b></a> |
|||
<ul class="dropdown-menu"> |
|||
<li><a href="javascript:void(0)">Action</a></li> |
|||
<li><a href="javascript:void(0)">Another action</a></li> |
|||
<li><a href="javascript:void(0)">Something else here</a></li> |
|||
<li class="divider"></li> |
|||
<li><a href="javascript:void(0)">Separated link</a></li> |
|||
</ul> |
|||
</li> |
|||
<li><a href="" ng-click="logout()">Logout</a></li> |
|||
</ul> |
|||
<a class="navbar-brand" href="/">Common Routes</a> |
|||
</div> |
|||
<div class="navbar-collapse collapse navbar-responsive-collapse"> |
|||
<ul class="nav navbar-nav"> |
|||
<li><a href="#!/users">Users</a></li><!-- class="active" --> |
|||
<li><a href="#!/travels">Travels</a></li> |
|||
</ul> |
|||
<form ng-submit="search()" class="navbar-form navbar-left"> |
|||
<div class="form-group"> |
|||
<input ng-model="searchString" class="form-control col-md-8" placeholder="Search" type="text"> |
|||
</div> |
|||
</form> |
|||
<ul class="nav navbar-nav navbar-right"> |
|||
<li> |
|||
<a href="#!/newTravel"> |
|||
<i title="Post new travel" class="fa fa-plus fa-2x"></i> |
|||
</a> |
|||
</li> |
|||
<li class="dropdown"> |
|||
<a href="" data-target="#" class="dropdown-toggle" data-toggle="dropdown"> |
|||
<i title="Post new travel" class="fa fa-cog fa-2x"></i> |
|||
<b class="caret"></b> |
|||
</a> |
|||
<ul class="dropdown-menu"> |
|||
<li><a href="javascript:void(0)">Action</a></li> |
|||
<li><a href="javascript:void(0)">Another action</a></li> |
|||
<li><a href="javascript:void(0)">Something else here</a></li> |
|||
<li class="divider"></li> |
|||
<li><a href="javascript:void(0)">Separated link</a></li> |
|||
</ul> |
|||
</li> |
|||
<li> |
|||
<a href="" ng-click="logout()"> |
|||
<i title="Post new travel" class="fa fa-power-off fa-2x"></i> |
|||
</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- |
|||
<!-- |
|||
<div ng-click="goBack()" class="btn"><span class="glyphicon glyphicon-arrow-left"></span> Back</div> |
|||
--> |
|||
</div> |
@ -0,0 +1,34 @@ |
|||
<div class="container"> |
|||
<div class="row"> |
|||
<div class="col-sm-2"> |
|||
<button ng-click="selectType('offering')" type="button" class="btn btn-outline-success">Offering travel</button><br> |
|||
<button ng-click="selectType('asking')" type="button" class="btn btn-outline-success">Asking travel</button><br> |
|||
<button ng-click="selectType('package')" type="button" class="btn btn-outline-success">Asking package</button> |
|||
</div> |
|||
<div class="col-sm-10"> |
|||
<div class="panel"> |
|||
<div class="panel-heading c_deepPurpleG500to300"> |
|||
<h3 class="panel-title"> |
|||
<i ng-show="travel.type=='offering'" title="offering" class="fa fa-car fa-2x"></i> |
|||
<i ng-show="travel.type=='asking'" title="asking" class="fa fa-question fa-2x"></i> |
|||
<i ng-show="travel.type=='package'" title="package" class="fa fa-archive fa-2x"></i> |
|||
<i style="margin-right: 20px;"></i> |
|||
New {{travel.type}} travel |
|||
</h3> |
|||
</div> |
|||
<div class="panel-body"> |
|||
<div class="row"> |
|||
<div class="col-sm-4"> |
|||
<div ng-include="'views/newTravel/newofferingForm.html'"></div> |
|||
</div> |
|||
<div class="col-sm-8"> |
|||
<leaflet width="100%" height="500px" markers="markers" center="center" |
|||
tiles="tiles" id="map-simple-map"></leaflet> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
@ -0,0 +1,66 @@ |
|||
'use strict'; |
|||
|
|||
angular.module('app.newTravel', ['ngRoute']) |
|||
|
|||
.config(['$routeProvider', function($routeProvider) { |
|||
$routeProvider.when('/newTravel', { |
|||
templateUrl: 'views/newTravel/newTravel.html', |
|||
controller: 'NewTravelCtrl' |
|||
}); |
|||
}]) |
|||
|
|||
.controller('NewTravelCtrl', function($scope, $http, toastr) { |
|||
$scope.travel = {}; |
|||
|
|||
$scope.selectType = function(type) { |
|||
$scope.travel.type = type; |
|||
}; |
|||
|
|||
//map
|
|||
$scope.center = { |
|||
/*lat: 0, |
|||
lng: 0, |
|||
zoom: 1*/ |
|||
}; |
|||
$scope.bounds = {}; |
|||
$scope.markers = []; |
|||
$scope.tiles = { |
|||
url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", |
|||
options: { |
|||
attribution: '<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' |
|||
} |
|||
}; |
|||
|
|||
$scope.doNewTravel = function() { |
|||
$scope.postNewTravel(); |
|||
}; |
|||
$scope.postNewTravel = function() { |
|||
$http({ |
|||
url: urlapi + 'travels', |
|||
method: "POST", |
|||
data: $scope.travel |
|||
}) |
|||
.then(function(data) { |
|||
console.log(data); |
|||
window.location = "#app/travels"; |
|||
}, |
|||
function(data) { // optional
|
|||
// failed
|
|||
console.log(data); |
|||
toastr.warning('Complete all parameters first'); |
|||
|
|||
}); |
|||
}; |
|||
$scope.allParametersCompleted = function() { |
|||
if (($scope.travel.title != undefined) && |
|||
($scope.travel.from != undefined) && |
|||
($scope.travel.to != undefined) && |
|||
($scope.travel.date != undefined) && |
|||
($scope.travel.seats != undefined) && |
|||
($scope.travel.type != undefined)) { |
|||
return true; |
|||
} else { |
|||
return false; |
|||
} |
|||
}; |
|||
}); |
@ -0,0 +1,52 @@ |
|||
<div class="form-group label-floating"> |
|||
<input ng-model="travel.title" abmFormControl class="form-control" placeholder="Title" type="text"> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="form-group label-floating col-md-6"> |
|||
<input ng-model="travel.from.name" abmFormControl class="form-control" placeholder="From" type="text"> |
|||
</div> |
|||
<div class="form-group label-floating col-md-6"> |
|||
<input ng-model="travel.to.name" abmFormControl class="form-control" placeholder="To" type="text"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row"> |
|||
<div class="form-group label-floating col-md-7"> |
|||
<input ng-model="travel.date" abmFormControl class="form-control" placeholder="Date" type="date"> |
|||
</div> |
|||
<div class="form-group label-floatin col-md-5"> |
|||
<input class="form-control" type="time" name="usr_time" ng-model="travel.hour"> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="form-group col-md-4"> |
|||
<input class="form-control" type="number" name="seats" min="1" max="20" ng-model="travel.seats" placeholder="nºSeats"> |
|||
</div> |
|||
<div class="col-md-8"> |
|||
<div class="form-group label-floating"> |
|||
<!--<input ng-model="travel.package" abmFormControl class="form-control" placeholder="Can carry package" type="text">--> |
|||
<label class="form-check-label"> |
|||
<input class="form-check-input" type="checkbox" ng-model="travel.package"> Can carry package |
|||
</label> |
|||
</div> |
|||
<div class="form-group label-floating"> |
|||
<!--<input ng-model="travel.collectivized" abmFormControl class="form-control" placeholder="Collectivized" type="text">--> |
|||
<label class="form-check-label"> |
|||
<input class="form-check-input" type="checkbox" ng-model="travel.collectivized"> Collectivized |
|||
</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group label-floating"> |
|||
<input ng-model="travel.description" abmFormControl class="form-control" placeholder="Description" type="text"> |
|||
</div> |
|||
|
|||
<p class="padding" ng-show="allParametersCompleted()"> |
|||
<button ng-click="closeNewOfferingTravel()" class="btn btn-raised c_grey500"> |
|||
Cancel |
|||
</button> |
|||
<button ng-click="doNewTravel()" class="btn btn-raised c_deepPurple300 pull-right"> |
|||
Create travel |
|||
</button> |
|||
</p> |
|||
</form> |
@ -0,0 +1,32 @@ |
|||
<div class="card"> |
|||
<div class="card-body" style="color:#ffffff; background-image: url('img/userProfileBackground.png');"> |
|||
<div class="pull-right">{{travel.date | date}}</div> |
|||
<h4 class="card-title"> |
|||
<i ng-show="travel.type=='offering'" title="offering" class="fa fa-car fa-2x"></i> |
|||
<i ng-show="travel.type=='asking'" title="asking" class="fa fa-question fa-2x"></i> |
|||
<i ng-show="travel.type=='package'" title="package" class="fa fa-archive fa-2x"></i> |
|||
<i style="margin-right: 20px;"></i> |
|||
<b>{{travel.title}}</b> |
|||
</h4> |
|||
</div> |
|||
<div class="card-body"> |
|||
<div class="pull-right"> |
|||
<a ng-href="#!/user/{{travel.user._id}}"> |
|||
<img class="circle" style="max-width: 30px; max-height:30px;" ng-src="{{travel.user.avatar}}" /> |
|||
{{travel.user.username}} |
|||
</a> |
|||
</div> |
|||
<p> |
|||
From: <b>{{travel.from.name}}</b> |
|||
</p> |
|||
<p> |
|||
To: <b>{{travel.to.name}}</b> |
|||
</p> |
|||
<p> |
|||
Seats: {{travel.joins.length}}/{{travel.seats}} |
|||
</p> |
|||
<p ng-show="travel.package"> |
|||
Can transport package |
|||
</p> |
|||
</div> |
|||
</div> |