Blame view

app/partials/viewCompany/viewCompany.service.js 6.63 KB
4bb02bb84   Rishav   new integration w...
1
2
3
  (function(){
   'use strict';    
      angular.module('acufuel')
55e075d7e   Rishav   add contact, add ...
4
        .service('ViewCompanyService', ['$q', '$http', 'BASE_URL', ViewCompanyService]);
4bb02bb84   Rishav   new integration w...
5

55e075d7e   Rishav   add contact, add ...
6
        function ViewCompanyService($q, $http, BASE_URL) {        
4bb02bb84   Rishav   new integration w...
7
          
55e075d7e   Rishav   add contact, add ...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
        	this.getCompany = function(id) {
  
            var deferred = $q.defer();
            $http({
                method : 'GET',
                url : BASE_URL.url +'/company/'+id,
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result.data);
            },function (result){
                deferred.resolve(result.data);
            })
            return deferred.promise;
          }
  
          this.getContact = function(id) {
  
            var deferred = $q.defer();
            $http({
                method : 'GET',
3cab9e8a3   Rishav   implement view co...
29
                url : BASE_URL.url +'/company/contacts/'+id,
55e075d7e   Rishav   add contact, add ...
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result.data);
            },function (result){
                deferred.resolve(result.data);
            })
            return deferred.promise;
          }
  
          this.addContact = function(data) {
  
            var deferred = $q.defer();
            $http({
                method : 'POST',
3a9f4472b   Rishav   Implement contact...
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
                url : BASE_URL.url +'/company/contact',
                data : data,
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result);
            },function (result){
                deferred.resolve(result);
            })
            return deferred.promise;
          }
  
          this.addCustomField = function(data){
            var deferred = $q.defer();
            $http({
                method : 'POST',
                url : BASE_URL.url +'/company/custom/contacts',
                data : data,
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result.data);
            },function (result){
                deferred.resolve(result.data);
            })
            return deferred.promise;
e9a2edf03   Rishav   update custom field
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
          }
  
          this.updateCustomField = function(data){
            var deferred = $q.defer();
            $http({
                method : 'PUT',
                url : BASE_URL.url +'/company/custom/contacts',
                data : data,
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result.data);
            },function (result){
                deferred.resolve(result.data);
            })
            return deferred.promise;
3a9f4472b   Rishav   Implement contact...
87
88
89
90
91
92
93
          }
  
          this.addPrimaryContact = function(data){
            var deferred = $q.defer();
            $http({
                method : 'POST',
                url : BASE_URL.url +'/company/contact/createPrimaryContact',
55e075d7e   Rishav   add contact, add ...
94
95
96
97
98
99
100
101
102
                data : data,
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result.data);
            },function (result){
                deferred.resolve(result.data);
            })
            return deferred.promise;
fd20aa6ce   Rishav   send confirmation...
103
104
105
106
107
108
109
          }
  
          this.sendMail = function(id) {
  
            var deferred = $q.defer();
            $http({
                method : 'POST',
6efd9a0a8   Anchit Jindal   new desing changes
110
                url : BASE_URL.url +'/company/mailPriceToContacts/'+id,
fd20aa6ce   Rishav   send confirmation...
111
112
113
114
115
116
117
118
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result.data);
            },function (result){
                deferred.resolve(result.data);
            })
            return deferred.promise;
55e075d7e   Rishav   add contact, add ...
119
          }
b1f6160d4   Rishav   add contact and a...
120

3a9f4472b   Rishav   Implement contact...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
          this.changeStatus = function(companyId, data){
              var deferred = $q.defer();
              $http({
                  method : 'PUT',
                  url : BASE_URL.url +'/company/status/'+companyId,
                  data : data,
                  headers : {'Content-Type': 'application/json'},
              })
              .then(function (result){
                  deferred.resolve(result.data);
              },function (result){
                  deferred.resolve(result.data);
              })
              return deferred.promise;
          }
8670c5905   Jaideep Singh   new changes
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
           this.fuelerPricingChange = function(companyId, data){
              var deferred = $q.defer();
              $http({
                  method : 'PUT',
                  url : BASE_URL.url +'/company/contact/disablePriceEmail/'+companyId,
                  data : data,
                  headers : {'Content-Type': 'application/json'},
              })
              .then(function (result){
                  deferred.resolve(result.data);
              },function (result){
                  deferred.resolve(result.data);
              })
              return deferred.promise;
          }     
cdf775224   Anchit Jindal   fixed company and...
151
          this.updateCompany = function(data) {
48ed0c7bb   Rishav   update company co...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
  
            var deferred = $q.defer();
            $http({
                method : 'PUT',
                url : BASE_URL.url +'/company',
                data : data,
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result.data);
            },function (result){
                deferred.resolve(result.data);
            })
            return deferred.promise;
          }
b1f6160d4   Rishav   add contact and a...
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
          this.getAircraft = function(id) {
  
            var deferred = $q.defer();
            $http({
                method : 'GET',
                url : BASE_URL.url +'/company/aircrafts/'+id,
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result.data);
            },function (result){
                deferred.resolve(result.data);
            })
            return deferred.promise;
          }
3a9f4472b   Rishav   Implement contact...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
  
          this.checkPrimaryContact = function(id){
            var deferred = $q.defer();
            $http({
                method : 'GET',
                url : BASE_URL.url +'/company/contact/check/primaryContact/'+id,
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result);
            },function (result){
                deferred.resolve(result);
            })
            return deferred.promise;
          }
67044e31e   Rishav Singla   modify changes an...
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
  
          this.deleteAircraft = function(id){
            var deferred = $q.defer();
            $http({
                method : 'DELETE',
                url : BASE_URL.url +'/company/aircraft/'+id,
                headers : {'Content-Type': 'application/json'},
            })
            .then(function (result){
                deferred.resolve(result);
            },function (result){
                deferred.resolve(result);
            })
            return deferred.promise;
          }
4bb02bb84   Rishav   new integration w...
212
213
214
215
          
        }
        
  })();