Blame view

app/partials/viewCompany/viewCompany.service.js 5.09 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
71
72
73
74
75
76
77
                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;
          }
  
          this.addPrimaryContact = function(data){
            var deferred = $q.defer();
            $http({
                method : 'POST',
                url : BASE_URL.url +'/company/contact/createPrimaryContact',
55e075d7e   Rishav   add contact, add ...
78
79
80
81
82
83
84
85
86
                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...
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
          }
  
          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 ...
103
          }
b1f6160d4   Rishav   add contact and a...
104

3a9f4472b   Rishav   Implement contact...
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
          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...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
          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...
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
          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...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
  
          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;
          }
4bb02bb84   Rishav   new integration w...
166
167
168
169
          
        }
        
  })();