@ -0,0 +1,23 @@ |
|||
angular.module('app.userTravels', ['pascalprecht.translate']) |
|||
|
|||
.controller('UserTravelsCtrl', function($scope, $http, $ionicModal, |
|||
$timeout, $ionicLoading, $filter, $stateParams) { |
|||
|
|||
$scope.storageuser = JSON.parse(localStorage.getItem("cim_app_userdata")); |
|||
$scope.travels=[]; |
|||
$scope.joins=[]; |
|||
$scope.doRefresh = function(){ |
|||
$http.get(urlapi + 'users/id/travels/'+$stateParams.userid) |
|||
.then(function(data, status, headers,config){ |
|||
console.log('data success'); |
|||
console.log(data); |
|||
$scope.travels = data.data.travels; |
|||
$scope.joins = data.data.joins; |
|||
$scope.$broadcast('scroll.refreshComplete');//refresher stop
|
|||
},function(data, status, headers,config){ |
|||
console.log('data error'); |
|||
$scope.$broadcast('scroll.refreshComplete');//refresher stop
|
|||
}); |
|||
}; |
|||
$scope.doRefresh(); |
|||
}); |
@ -0,0 +1,46 @@ |
|||
<ion-view view-title="{{' travels' | translate}}"> |
|||
<ion-content class="has-footer"> |
|||
<ion-refresher |
|||
pulling-text="{{'Pull_to_refresh' | translate}}..." |
|||
on-refresh="doRefresh()"> |
|||
</ion-refresher> |
|||
<div class="list"> |
|||
<div class="item item-divider o_purple300" ng-show="travels[0]"> |
|||
Travels offering |
|||
</div> |
|||
<a ng-repeat="travel in travels | orderBy: 'date'" |
|||
class="item item-icon-left" href="#/app/travels/{{travel._id}}"> |
|||
<i class="icon ion-android-car o_text_grey700"></i> |
|||
<h2 class="o_text_grey800">{{travel.title}}</h2> |
|||
<div class="item-note text-right"> |
|||
<div class="o_text_purple300">{{travel.date | date:"dd/MM"}}</div> |
|||
<div class="o_text_purple300">{{travel.date | date:"HH:mm"}}h</div> |
|||
</div> |
|||
<p> |
|||
{{travel.from.name}} |
|||
</p> |
|||
<p> |
|||
{{travel.to.name}} |
|||
</p> |
|||
</a> |
|||
<div class="item item-divider o_purple300" ng-show="joins[0]"> |
|||
Travels joining |
|||
</div> |
|||
<a ng-repeat="travel in joins | orderBy: 'date'" |
|||
class="item item-icon-left" href="#/app/travels/{{travel._id}}"> |
|||
<i class="icon ion-android-car o_text_grey700"></i> |
|||
<h2 class="o_text_grey800">{{travel.title}}</h2> |
|||
<div class="item-note text-right"> |
|||
<div class="o_text_purple300">{{travel.date | date:"dd/MM"}}</div> |
|||
<div class="o_text_purple300">{{travel.date | date:"HH:mm"}}h</div> |
|||
</div> |
|||
<p> |
|||
{{travel.from.name}} |
|||
</p> |
|||
<p> |
|||
{{travel.to.name}} |
|||
</p> |
|||
</a> |
|||
</div> |
|||
</ion-content> |
|||
</ion-view> |