Blame view

app/partials/fuelOrders/fuelOrders.controller.js 2.94 KB
4bb02bb84   Rishav   new integration w...
1
  'use strict';
6284a85b9   Jaideep Singh   fuel orders page ...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  angular.module('acufuel')
  
  .controller('fuelOrdersController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', 'NgTableParams','fuelOrdersService', fuelOrdersController]);
  
  function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgTableParams,fuelOrdersService) {
  
      $scope.showFuelOrderModal = false;
      $scope.optionSelected;
  
       $scope.data = {};
       
            fuelOrdersService.getOrders().then(function(result) {
              $scope.orderdata = result;
              for(var i=0;i<$scope.orderdata.length;i++){
                  $scope.orderdata[i].departingDate = new Date($scope.orderdata[i].departingDate);
  
                   var str = ""+$scope.orderdata[i].departingDate;
                   str = str.slice(4,16)
                  $scope.orderdata[i].departingDateString = str
                  console.log(str);
  
              }
             
               $scope.displayFuelOrderList = new NgTableParams({
                page: 1,
                count: 10,
              }, {
                data: $scope.orderdata
              });
            })
           
  
       $scope.onDTSelect = function() {
         if($scope.optionSelected == 'dt'){
         $('#demo-modal-4').css('display', 'block');
        }
    }
dd378d69f   Mr. Hot Foods   changes in flight...
39
40
41
42
43
44
     $scope.attachmentid = ""
     $scope.attachment = function(id, value) {
         console.log(id, value)
         $scope.attachmentid = id
         if(value == 'uploadAttachment'){
         $('#demo-modal-6').css('display', 'block');
c277275bb   Mr. Hot Foods   login changes
45
46
47
48
        }else if(value == 'viewAttachment'){
         $('#demo-modal-7').css('display', 'block');
        }else if(value == 'deleteAttachment'){
         $('#delete1').css('display', 'block');
dd378d69f   Mr. Hot Foods   changes in flight...
49
50
        }
    }
c277275bb   Mr. Hot Foods   login changes
51
52
53
54
55
56
57
58
59
60
    $scope.cancelDeleteAttachment = function() {
          $('#delete1').css('display', '');
    }
  
    $scope.deleteAttachment = function() {
      fuelOrdersService.deleteAttachment($scope.data).then(function(result) {
              console.log(result)
            })
          $('#delete1').css('display', '');
    }
dd378d69f   Mr. Hot Foods   changes in flight...
61
     $scope.saveUploadAttachment = function(attachmentData) {
38628e5f5   Anchit Jindal   minor changes
62
63
64
65
66
67
68
  	   	$scope.data.media = attachmentData
  	   	$scope.data.id = $scope.attachmentid
  		fuelOrdersService.uploadAttachment($scope.data).then(function(result) {
  		
  		})
          $('#demo-modal-6').css('display', 'none');
     }
dd378d69f   Mr. Hot Foods   changes in flight...
69
70
  
    $scope.cancelUploadAttachment = function() {
38628e5f5   Anchit Jindal   minor changes
71
          $('#demo-modal-6').css('display', 'none');
dd378d69f   Mr. Hot Foods   changes in flight...
72
    }
6284a85b9   Jaideep Singh   fuel orders page ...
73

dd378d69f   Mr. Hot Foods   changes in flight...
74
    $scope.editdata = {};
6284a85b9   Jaideep Singh   fuel orders page ...
75
76
77
78
79
80
81
82
83
84
85
86
    $scope.editTableRow = function(rowData){
      console.log('row data', rowData);
      $scope.editdata = rowData;
      $('#demo-modal-5').css('display', 'block');
    }
  
    $scope.cancelData = function() {
          $('#demo-modal-4').css('display', '');
    }
    $scope.canceleditdata = function() {
          $('#demo-modal-5').css('display', '');
    }
dd378d69f   Mr. Hot Foods   changes in flight...
87
   
6284a85b9   Jaideep Singh   fuel orders page ...
88
89
90
91
92
93
94
  	$scope.companyList = {};
  
  	fuelOrdersService.getAllCompanies().then(function(result) {
  		$scope.showLoader = false;
  		$scope.companyList = result;
      console.log(result)
  	})
4bb02bb84   Rishav   new integration w...
95

6284a85b9   Jaideep Singh   fuel orders page ...
96
    $scope.sourceList = [{source:"Direct Jet-A"},{source:"Direct AVGAS 100LL"}];
4bb02bb84   Rishav   new integration w...
97

6284a85b9   Jaideep Singh   fuel orders page ...
98
99
100
    $scope.data = {};
    
   
4bb02bb84   Rishav   new integration w...
101

6284a85b9   Jaideep Singh   fuel orders page ...
102
     }