Blame view

app/partials/viewCompany/viewCompany.service.js 6.05 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
110
111
112
113
114
115
116
117
118
          }
  
          this.sendMail = function(id) {
  
            var deferred = $q.defer();
            $http({
                method : 'POST',
                url : BASE_URL.url +'/mailPriceToContacts/'+id,
                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;
          }
48ed0c7bb   Rishav   update company co...
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
          this.updateContact = function(data) {
  
            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...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
          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...
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
  
          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...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
  
          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...
197
198
199
200
          
        }
        
  })();