Browse Source

telegram and phone on new travel, added from data storage, no input

master
idoctnef 8 years ago
parent
commit
6559dc163b
5 changed files with 63 additions and 9 deletions
  1. +54
    -2
      www/js/controllers.js
  2. +3
    -1
      www/templates/help.html
  3. +2
    -2
      www/templates/newaskingpackage.html
  4. +2
    -2
      www/templates/newaskingtravel.html
  5. +2
    -2
      www/templates/newofferingtravel.html

+ 54
- 2
www/js/controllers.js

@ -71,6 +71,8 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
localStorage.setItem("c_token", response.data.token); localStorage.setItem("c_token", response.data.token);
localStorage.setItem("c_userid", response.data.userid); localStorage.setItem("c_userid", response.data.userid);
localStorage.setItem("c_avatar", response.data.avatar); localStorage.setItem("c_avatar", response.data.avatar);
localStorage.setItem("c_userdata", JSON.stringify(response.data.userdata));
}else{ }else{
console.log("login failed"); console.log("login failed");
} }
@ -172,6 +174,7 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
localStorage.removeItem("c_token"); localStorage.removeItem("c_token");
localStorage.removeItem("c_avatar"); localStorage.removeItem("c_avatar");
localStorage.removeItem("c_userid"); localStorage.removeItem("c_userid");
localStorage.removeItem("c_userdata");
$window.location.reload(true); $window.location.reload(true);
}; };
}) })
@ -192,8 +195,11 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
$scope.travels=""; $scope.travels="";
$scope.travels=JSON.parse(localStorage.getItem('c_travels')); $scope.travels=JSON.parse(localStorage.getItem('c_travels'));
$scope.userdata=JSON.parse(localStorage.getItem('c_userdata'));
console.log($scope.userdata);
$scope.doRefresh = function() { $scope.doRefresh = function() {
/* travels refresh: */
$http.get(urlapi + 'travels') $http.get(urlapi + 'travels')
.success(function(data, status, headers,config){ .success(function(data, status, headers,config){
console.log('data success'); console.log('data success');
@ -214,6 +220,23 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
travels = result.data; travels = result.data;
$ionicLoading.show({ template: 'Travels actualized from server!', noBackdrop: true, duration: 2000 }); $ionicLoading.show({ template: 'Travels actualized from server!', noBackdrop: true, duration: 2000 });
}); });
/* users refresh: */
$http.get(urlapi + 'users')
.success(function(data, status, headers, config){
console.log('data success');
console.log(data); // for browser console
$scope.users = data; // for UI
localStorage.setItem('c_users', JSON.stringify($scope.users));
$scope.$broadcast('scroll.refreshComplete');//refresher stop
})
.error(function(data, status, headers,config){
console.log('data error');
$scope.$broadcast('scroll.refreshComplete');//refresher stop
})
.then(function(result){
users = result.data;
});
}; };
$scope.newtravel={}; $scope.newtravel={};
/*$scope.newtravel={ /*$scope.newtravel={
@ -277,7 +300,8 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
$scope.newtravel.icon="lorry"; $scope.newtravel.icon="lorry";
$scope.newtravel.generateddate=$scope.newtravel.date; $scope.newtravel.generateddate=$scope.newtravel.date;
$scope.newtravel.owner=localStorage.getItem("c_username"); $scope.newtravel.owner=localStorage.getItem("c_username");
$scope.newtravel.telegram=JSON.parse(localStorage.getItem("c_userdata")).telegram;
$scope.newtravel.phone=JSON.parse(localStorage.getItem("c_userdata")).phone;
$scope.newtravel.modality="offering"; $scope.newtravel.modality="offering";
//$scope.newtravel.token=localStorage.getItem("c_token"); //$scope.newtravel.token=localStorage.getItem("c_token");
console.log($scope.newtravel); console.log($scope.newtravel);
@ -317,6 +341,8 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
$scope.newtravel.icon="lorry"; $scope.newtravel.icon="lorry";
$scope.newtravel.generateddate=$scope.newtravel.date; $scope.newtravel.generateddate=$scope.newtravel.date;
$scope.newtravel.owner=localStorage.getItem("c_username"); $scope.newtravel.owner=localStorage.getItem("c_username");
$scope.newtravel.telegram=JSON.parse(localStorage.getItem("c_userdata")).telegram;
$scope.newtravel.phone=JSON.parse(localStorage.getItem("c_userdata")).phone;
$scope.newtravel.modality="asking"; $scope.newtravel.modality="asking";
console.log($scope.newtravel); console.log($scope.newtravel);
@ -356,6 +382,9 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
$scope.newtravel.icon="lorry"; $scope.newtravel.icon="lorry";
$scope.newtravel.generateddate=$scope.newtravel.date; $scope.newtravel.generateddate=$scope.newtravel.date;
$scope.newtravel.owner=localStorage.getItem("c_username"); $scope.newtravel.owner=localStorage.getItem("c_username");
$scope.newtravel.telegram=JSON.parse(localStorage.getItem("c_userdata")).telegram;
$scope.newtravel.phone=JSON.parse(localStorage.getItem("c_userdata")).phone;
$scope.newtravel.package=true; $scope.newtravel.package=true;
$scope.newtravel.modality="package"; $scope.newtravel.modality="package";
@ -556,12 +585,35 @@ console.log($scope.newComment);
} }
}) })
.controller('UsersCtrl', function($scope, $http, $ionicModal, $timeout) {
.controller('UsersCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading) {
$scope.users=""; $scope.users="";
$scope.users=JSON.parse(localStorage.getItem('c_users')); $scope.users=JSON.parse(localStorage.getItem('c_users'));
$scope.doRefresh = function() { $scope.doRefresh = function() {
/* travels refresh: */
$http.get(urlapi + 'travels')
.success(function(data, status, headers,config){
console.log('data success');
console.log(data); // for browser console
$scope.travels = data; // for UI
localStorage.setItem('c_travels', JSON.stringify($scope.travels));
localStorage.setItem('c_travelsLastDate', JSON.stringify(new Date()));
$scope.$broadcast('scroll.refreshComplete');//refresher stop
})
.error(function(data, status, headers,config){
console.log('data error');
$scope.$broadcast('scroll.refreshComplete');//refresher stop
$ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
})
.then(function(result){
travels = result.data;
$ionicLoading.show({ template: 'Travels actualized from server!', noBackdrop: true, duration: 2000 });
});
/* users refresh: */
$http.get(urlapi + 'users') $http.get(urlapi + 'users')
.success(function(data, status, headers, config){ .success(function(data, status, headers, config){
console.log('data success'); console.log('data success');

+ 3
- 1
www/templates/help.html

@ -1,7 +1,9 @@
<ion-view view-title="{{'Help' | translate}}"> <ion-view view-title="{{'Help' | translate}}">
<ion-content> <ion-content>
<h1>{{'Help' | translate}}</h1> <h1>{{'Help' | translate}}</h1>
<p>
help instructions here
</p>
<p> <p>
<img ng-src="img/newpackage.png" class="o-img-new"/> <img ng-src="img/newpackage.png" class="o-img-new"/>
<img ng-src="img/newasking.png" class="o-img-new"/> <img ng-src="img/newasking.png" class="o-img-new"/>

+ 2
- 2
www/templates/newaskingpackage.html

@ -29,14 +29,14 @@
<span class="input-label">{{'Hour' | translate}}</span> <span class="input-label">{{'Hour' | translate}}</span>
<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"><i class="icon ion-iphone"></i> {{'Phone_contact' | translate}}</span> <span class="input-label"><i class="icon ion-iphone"></i> {{'Phone_contact' | translate}}</span>
<input ng-model="newtravel.phone" type="number" placeholder=""> <input ng-model="newtravel.phone" type="number" placeholder="">
</label> </label>
<label class="item item-input"> <label class="item item-input">
<span class="input-label">{{'Telegram_user' | translate}}</span> <span class="input-label">{{'Telegram_user' | translate}}</span>
<input ng-model="newtravel.telegram" type="text" placeholder=""> <input ng-model="newtravel.telegram" type="text" placeholder="">
</label>
</label>-->
<label class="item item-input item-floating-label"> <label class="item item-input item-floating-label">
<span class="input-label">{{'Description' | translate}}</span> <span class="input-label">{{'Description' | translate}}</span>

+ 2
- 2
www/templates/newaskingtravel.html

@ -34,14 +34,14 @@
<span class="input-label">{{'Hour' | translate }}</span> <span class="input-label">{{'Hour' | translate }}</span>
<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"><i class="icon ion-iphone"></i> {{'Phone_contact' | translate }}</span> <span class="input-label"><i class="icon ion-iphone"></i> {{'Phone_contact' | translate }}</span>
<input ng-model="newtravel.phone" type="number" placeholder=""> <input ng-model="newtravel.phone" type="number" placeholder="">
</label> </label>
<label class="item item-input"> <label class="item item-input">
<span class="input-label">{{'Telegram_user' | translate }}</span> <span class="input-label">{{'Telegram_user' | translate }}</span>
<input ng-model="newtravel.telegram" type="text" placeholder=""> <input ng-model="newtravel.telegram" type="text" placeholder="">
</label>
</label>-->
<ion-toggle ng-model="newtravel.package" toggle-class="toggle-calm"> <ion-toggle ng-model="newtravel.package" toggle-class="toggle-calm">
<img class='o-imgMenu' src="img/package.png" /> <img class='o-imgMenu' src="img/package.png" />
{{'Need_to_carry_package' | translate }} {{'Need_to_carry_package' | translate }}

+ 2
- 2
www/templates/newofferingtravel.html

@ -34,14 +34,14 @@
<span class="input-label">{{'Hour' | translate}}</span> <span class="input-label">{{'Hour' | translate}}</span>
<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"><i class="icon ion-iphone"></i> {{'Phone_contact' | translate}}</span> <span class="input-label"><i class="icon ion-iphone"></i> {{'Phone_contact' | translate}}</span>
<input ng-model="newtravel.phone" type="number" placeholder=""> <input ng-model="newtravel.phone" type="number" placeholder="">
</label> </label>
<label class="item item-input"> <label class="item item-input">
<span class="input-label">{{'Telegram_user' | translate}}</span> <span class="input-label">{{'Telegram_user' | translate}}</span>
<input ng-model="newtravel.telegram" type="text" placeholder=""> <input ng-model="newtravel.telegram" type="text" placeholder="">
</label>
</label>-->
<ion-toggle ng-model="newtravel.package" toggle-class="toggle-calm"> <ion-toggle ng-model="newtravel.package" toggle-class="toggle-calm">
<img class='o-imgMenu' src="img/package.png" /> <img class='o-imgMenu' src="img/package.png" />
{{'Can_carry_package' | translate}} {{'Can_carry_package' | translate}}

Loading…
Cancel
Save