Commit afbb823b5e2f400508686a2f98db69dd2742a120
Exists in
master
Merge branch 'master' of git.viithiisys.com:viithiisys/acufuel
Showing
3 changed files
Show diff stats
app/partials/fuelOrders/fuelOrders.controller.js
... | ... | @@ -8,6 +8,7 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT |
8 | 8 | |
9 | 9 | $scope.showFuelOrderModal = false; |
10 | 10 | $scope.optionSelected; |
11 | + $scope.orderdata = {} | |
11 | 12 | |
12 | 13 | $scope.data = {}; |
13 | 14 | |
... | ... | @@ -37,14 +38,18 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT |
37 | 38 | $('#demo-modal-4').css('display', 'block'); |
38 | 39 | } |
39 | 40 | } |
40 | - $scope.attachmentid = "" | |
41 | - $scope.attachment = function(id, value) { | |
41 | + $scope.attachmentrowid = "" | |
42 | + | |
43 | + | |
44 | + $scope.attachment = function(id, value, url) { | |
42 | 45 | console.log(id, value) |
43 | - $scope.attachmentid = id | |
46 | + $scope.attachmentrowid = id | |
47 | + // $scope.attachmentdeleteid = attachdeleteid | |
44 | 48 | if(value == 'uploadAttachment'){ |
45 | 49 | $('#demo-modal-6').css('display', 'block'); |
46 | 50 | }else if(value == 'viewAttachment'){ |
47 | - $('#demo-modal-7').css('display', 'block'); | |
51 | + var win = window.open(url, '_blank'); | |
52 | + win.focus(); | |
48 | 53 | }else if(value == 'deleteAttachment'){ |
49 | 54 | $('#delete1').css('display', 'block'); |
50 | 55 | } |
... | ... | @@ -55,15 +60,15 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT |
55 | 60 | } |
56 | 61 | |
57 | 62 | $scope.deleteAttachment = function() { |
58 | - fuelOrdersService.deleteAttachment($scope.data).then(function(result) { | |
59 | - console.log(result) | |
63 | + fuelOrdersService.deleteAttachment($scope.attachmentrowid).then(function(result) { | |
64 | + console.log(result, $scope.attachmentrowid) | |
60 | 65 | }) |
61 | 66 | $('#delete1').css('display', ''); |
62 | 67 | } |
63 | 68 | |
64 | 69 | $scope.saveUploadAttachment = function(attachmentData) { |
65 | 70 | $scope.data.media = attachmentData |
66 | - $scope.data.id = $scope.attachmentid | |
71 | + $scope.data.id = $scope.attachmentrowid | |
67 | 72 | fuelOrdersService.uploadAttachment($scope.data).then(function(result) { |
68 | 73 | |
69 | 74 | }) | ... | ... |
app/partials/fuelOrders/fuelOrders.html
... | ... | @@ -118,7 +118,7 @@ |
118 | 118 | {{row.status}} |
119 | 119 | </td> |
120 | 120 | <td data-title="'Attachments'" filter="{allIn: 'text'}" sortable="'allIn'"> |
121 | - <select class="btn btn-regular" ng-model="attachOptionSelected" ng-change="attachment(row.id,attachOptionSelected)" > | |
121 | + <select class="btn btn-regular" ng-model="attachOptionSelected" ng-change="attachment(row.id,attachOptionSelected,row.orderInvoice.link, row)" > | |
122 | 122 | <option value="" disabled selected="selected" >Invoice</option> |
123 | 123 | <option value="viewAttachment" >View</option> |
124 | 124 | <option value="deleteAttachment" >Delete</option> |
... | ... | @@ -129,7 +129,7 @@ |
129 | 129 | </tr> |
130 | 130 | </table> |
131 | 131 | |
132 | - <select class="btn btn-warning exportBtn" ng-model="optionSelected" ng-change="onDTSelect()"> | |
132 | + <select class="btn btn-primary exportBtn" ng-model="optionSelected" ng-change="onDTSelect()"> | |
133 | 133 | <option value="" disabled selected="selected">Fuel Widget</option> |
134 | 134 | <option value="dt" >Direct Transaction</option> |
135 | 135 | <option value="efo" >Export Fuel Orders</option> |
... | ... | @@ -858,9 +858,11 @@ |
858 | 858 | <div class="col-md-6"> |
859 | 859 | <div class="pull-left" style="width: 110px;"> |
860 | 860 | <label class="new-input-label"><b>Upload</b></label> |
861 | + <br> | |
862 | + <br> | |
861 | 863 | </div> |
862 | 864 | <div class="pull-left" style="width: calc(100% - 110px);"> |
863 | - <input type="file" file-model = "uploadFile.attachment"> | |
865 | + <input type="file" accept=".pdf" file-model = "uploadFile.attachment"> | |
864 | 866 | <!--<md-datepicker ng-model="myDate" md-placeholder="Enter date"></md-datepicker>--> |
865 | 867 | </div> |
866 | 868 | <div class="clearfix"></div> | ... | ... |
app/partials/fuelOrders/fuelOrders.service.js
... | ... | @@ -6,27 +6,83 @@ |
6 | 6 | function fuelOrdersService($q, $http, BASE_URL) { |
7 | 7 | |
8 | 8 | this.getAllCompanies = function() { |
9 | - var deferred = $q.defer(); | |
10 | - $http({ | |
11 | - method : 'GET', | |
12 | - url : BASE_URL.url +'/user/allCompanies', | |
13 | - headers : {'Content-Type': 'application/json'}, | |
14 | - }) | |
15 | - .then(function (result){ | |
16 | - deferred.resolve(result.data); | |
17 | - },function (result){ | |
18 | - deferred.resolve(result.data); | |
19 | - }) | |
20 | - return deferred.promise; | |
21 | - } | |
9 | + var deferred = $q.defer(); | |
10 | + $http({ | |
11 | + method : 'GET', | |
12 | + url : BASE_URL.url +'/user/allCompanies', | |
13 | + headers : {'Content-Type': 'application/json'}, | |
14 | + }) | |
15 | + .then(function (result){ | |
16 | + deferred.resolve(result.data); | |
17 | + },function (result){ | |
18 | + deferred.resolve(result.data); | |
19 | + }) | |
20 | + return deferred.promise; | |
21 | + } | |
22 | 22 | |
23 | 23 | |
24 | 24 | this.getOrders = function() { |
25 | 25 | |
26 | + var deferred = $q.defer(); | |
27 | + $http({ | |
28 | + method : 'GET', | |
29 | + url : BASE_URL.url +'/user/orders', | |
30 | + headers : {'Content-Type': 'application/json'}, | |
31 | + }) | |
32 | + .then(function (result){ | |
33 | + deferred.resolve(result.data); | |
34 | + },function (result){ | |
35 | + deferred.resolve(result.data); | |
36 | + }) | |
37 | + return deferred.promise; | |
38 | + } | |
39 | + | |
40 | + | |
41 | + | |
42 | + this.dispathFuelOrder = function(data) { | |
43 | + var deferred = $q.defer(); | |
44 | + $http({ | |
45 | + method : 'POST', | |
46 | + url : BASE_URL.url +'/fuelOrder', | |
47 | + headers : {'Content-Type': 'application/json'}, | |
48 | + data: data | |
49 | + }) | |
50 | + .then(function (result){ | |
51 | + deferred.resolve(result.data); | |
52 | + },function (result){ | |
53 | + deferred.resolve(result.data); | |
54 | + }) | |
55 | + return deferred.promise; | |
56 | + } | |
57 | + | |
58 | + this.uploadAttachment = function (data) { | |
59 | + var fd = new FormData(); | |
60 | + | |
61 | + angular.forEach(data, function(value, key) { | |
62 | + fd.append(key, value); | |
63 | + }) | |
64 | + | |
65 | + var deffered = $q.defer(); | |
66 | + $http({ | |
67 | + method : 'POST', | |
68 | + transformRequest: angular.identity, | |
69 | + headers: {'Content-Type': undefined}, | |
70 | + url : BASE_URL.url+'/fuelOrder/upload/invoice', | |
71 | + data : fd | |
72 | + }) | |
73 | + .then(function (result){ | |
74 | + deffered.resolve(result); | |
75 | + },function (result){ | |
76 | + deffered.resolve(result); | |
77 | + }) | |
78 | + return deffered.promise; | |
79 | + } | |
80 | + | |
81 | + this.deleteAttachment = function(id){ | |
26 | 82 | var deferred = $q.defer(); |
27 | 83 | $http({ |
28 | - method : 'GET', | |
29 | - url : BASE_URL.url +'/user/orders', | |
84 | + method : 'DELETE', | |
85 | + url : BASE_URL.url +'/fuelOrder/invoice/'+id, | |
30 | 86 | headers : {'Content-Type': 'application/json'}, |
31 | 87 | }) |
32 | 88 | .then(function (result){ |
... | ... | @@ -37,73 +93,6 @@ |
37 | 93 | return deferred.promise; |
38 | 94 | } |
39 | 95 | |
40 | - | |
41 | - | |
42 | - this.dispathFuelOrder = function(data) { | |
43 | - var deferred = $q.defer(); | |
44 | - $http({ | |
45 | - method : 'POST', | |
46 | - url : BASE_URL.url +'/fuelOrder', | |
47 | - headers : {'Content-Type': 'application/json'}, | |
48 | - data: data | |
49 | - }) | |
50 | - .then(function (result){ | |
51 | - deferred.resolve(result.data); | |
52 | - },function (result){ | |
53 | - deferred.resolve(result.data); | |
54 | - }) | |
55 | - return deferred.promise; | |
56 | - } | |
57 | - | |
58 | - this.uploadAttachment = function (data) { | |
59 | - var fd = new FormData(); | |
60 | - | |
61 | - angular.forEach(data, function(value, key) { | |
62 | - fd.append(key, value); | |
63 | - }) | |
64 | - | |
65 | - var deffered = $q.defer(); | |
66 | - $http({ | |
67 | - method : 'POST', | |
68 | - transformRequest: angular.identity, | |
69 | - headers: {'Content-Type': undefined}, | |
70 | - url : BASE_URL.url+'/fuelOrder/upload/invoice', | |
71 | - data : fd | |
72 | - }) | |
73 | - .then(function (result){ | |
74 | - deffered.resolve(result); | |
75 | - },function (result){ | |
76 | - deffered.resolve(result); | |
77 | - }) | |
78 | - return deffered.promise; | |
79 | - } | |
80 | - | |
81 | - this.deleteAttachment = function (data) { | |
82 | - var fd = new FormData(); | |
83 | - | |
84 | - angular.forEach(data, function(value, key) { | |
85 | - fd.append(key, value); | |
86 | - }) | |
87 | - | |
88 | - var deffered = $q.defer(); | |
89 | - $http({ | |
90 | - method : 'POST', | |
91 | - transformRequest: angular.identity, | |
92 | - headers: {'Content-Type': undefined}, | |
93 | - url : BE+'/fuelOrder/upload/invoice', | |
94 | - data : fd | |
95 | - }) | |
96 | - .success(function (data, status, headers, config) { | |
97 | - //console.log(data); | |
98 | - deffered.resolve(status); | |
99 | - }) | |
100 | - .error(function (data, status, headers, config) { | |
101 | - //console.log(data); | |
102 | - deffered.reject(status); | |
103 | - }); | |
104 | - return deffered.promise; | |
105 | - } | |
106 | - | |
107 | 96 | |
108 | 97 | |
109 | 98 | } | ... | ... |