Commit c277275bbbf3e723d87e850029b1f1f3e228f9d2

Authored by Mr. Hot Foods
1 parent 945fcf7445
Exists in master

login changes

... ... @@ -364,7 +364,11 @@
364 364 $state.go('app.dashboard');
365 365 }
366 366 }else{
367   - $state.go('app.flightDepDashboard');
  367 + // if (next.name == 'login') {
  368 + // event.preventDefault();
  369 + // $state.go('app.flightDepDashboard');
  370 + // }
  371 +
368 372  
369 373 }
370 374 });
... ...
app/partials/fuelOrders/fuelOrders.controller.js
... ... @@ -43,9 +43,24 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT
43 43 $scope.attachmentid = id
44 44 if(value == 'uploadAttachment'){
45 45 $('#demo-modal-6').css('display', 'block');
  46 + }else if(value == 'viewAttachment'){
  47 + $('#demo-modal-7').css('display', 'block');
  48 + }else if(value == 'deleteAttachment'){
  49 + $('#delete1').css('display', 'block');
46 50 }
47 51 }
48 52  
  53 + $scope.cancelDeleteAttachment = function() {
  54 + $('#delete1').css('display', '');
  55 + }
  56 +
  57 + $scope.deleteAttachment = function() {
  58 + fuelOrdersService.deleteAttachment($scope.data).then(function(result) {
  59 + console.log(result)
  60 + })
  61 + $('#delete1').css('display', '');
  62 + }
  63 +
49 64 $scope.saveUploadAttachment = function(attachmentData) {
50 65 $scope.data.media = attachmentData
51 66 $scope.data.id = $scope.attachmentid
... ...
app/partials/fuelOrders/fuelOrders.html
... ... @@ -885,6 +885,27 @@
885 885 </div>
886 886 </form>
887 887  
  888 +<div class="customConfirmPopBackdrop" id="delete1">
  889 + <div class="customModalInner" style="max-width: 400px;">
  890 + <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
  891 + <table>
  892 + <tr>
  893 + <td>
  894 + <img src="img/info.png" style="width: 50px;">
  895 + </td>
  896 + <td>
  897 + <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure you want to delete the attachment?</p>
  898 + </td>
  899 + </tr>
  900 + </table>
  901 + </div>
  902 + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
  903 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="deleteAttachment()">Yes</button>
  904 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelDeleteAttachment()">No</button>
  905 + </div>
  906 + </div>
  907 +</div>
  908 +
888 909  
889 910  
890 911 <div class="myLoader" ng-show="showLoader">
... ...
app/partials/fuelOrders/fuelOrders.service.js
... ... @@ -81,6 +81,32 @@
81 81 return deffered.promise;
82 82 }
83 83  
  84 + this.deleteAttachment = function (data) {
  85 + var fd = new FormData();
  86 +
  87 + angular.forEach(data, function(value, key) {
  88 + fd.append(key, value);
  89 + })
  90 +
  91 + var deffered = $q.defer();
  92 + $http({
  93 + method : 'POST',
  94 + transformRequest: angular.identity,
  95 + headers: {'Content-Type': undefined},
  96 + url : BE+'/fuelOrder/upload/invoice',
  97 + data : fd
  98 + })
  99 + .success(function (data, status, headers, config) {
  100 + //console.log(data);
  101 + deffered.resolve(status);
  102 + })
  103 + .error(function (data, status, headers, config) {
  104 + //console.log(data);
  105 + deffered.reject(status);
  106 + });
  107 + return deffered.promise;
  108 + }
  109 +
84 110  
85 111  
86 112 }
... ...
app/partials/login/login.controller.js
... ... @@ -11,6 +11,7 @@
11 11 var loginData = "username=" + $scope.data.username + "&password=" + $scope.data.password;
12 12 LoginService.loginUser(loginData).then(function(result) {
13 13 LoginService.authenticate();
  14 + console.log("result is " ,result)
14 15 //LoginService.setAuth(true);
15 16  
16 17 })
... ...
app/partials/login/login.service.js
... ... @@ -47,9 +47,12 @@
47 47 url : BASE_URL.url+'/user/authenticate',
48 48 headers : {'Content-Type': 'application/x-www-form-urlencoded'}
49 49 }).then(function (result){
50   - if(result.data.userProfile.userType.type == 'ADMIN' || result.data.userProfile.userType.type == 'FBO' || result.data.userProfile.userType.type == 'FLIGHT_DEPT'){
  50 + if(result.data.userProfile.userType.type == 'ADMIN' || result.data.userProfile.userType.type == 'FBO'){
51 51 authService.setUser(result.data);
52 52 $state.go('app.dashboard')
  53 + }else if(result.data.userProfile.userType.type == 'FLIGHT_DEPT'){
  54 + authService.setUser(result.data);
  55 + $state.go('app.flightDepDashboard')
53 56 }else{
54 57 localStorage.clear();
55 58 toastr.info("Please check username and password");
... ...