Commit 229e98b836d18c5abb770ffefd57e64cca66f6c9

Authored by Mr. Hot Foods
1 parent 1e35fc06ba
Exists in master

api hit on send price to contact in view contact

app/partials/fuelOrders/fuelOrders.controller.js
1 'use strict'; 1 'use strict';
2 2
3 angular.module('acufuel') 3 angular.module('acufuel')
4 4
5 .controller('fuelOrdersController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', 'NgTableParams','fuelOrdersService', fuelOrdersController]); 5 .controller('fuelOrdersController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', 'NgTableParams','fuelOrdersService', fuelOrdersController]);
6 6
7 function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgTableParams,fuelOrdersService) { 7 function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgTableParams,fuelOrdersService) {
8 8
9 $scope.showFuelOrderModal = false; 9 $scope.showFuelOrderModal = false;
10 $scope.optionSelected; 10 $scope.optionSelected;
11 $scope.orderdata = {} 11 $scope.orderdata = {}
12 12
13 $scope.data = {}; 13 $scope.data = {};
14 14
15 fuelOrdersService.getOrders().then(function(result) { 15 fuelOrdersService.getOrders().then(function(result) {
16 $scope.orderdata = result; 16 $scope.orderdata = result;
17 for(var i=0;i<$scope.orderdata.length;i++){ 17 for(var i=0;i<$scope.orderdata.length;i++){
18 $scope.orderdata[i].departingDate = new Date($scope.orderdata[i].departingDate); 18 $scope.orderdata[i].departingDate = new Date($scope.orderdata[i].departingDate);
19 19
20 var str = ""+$scope.orderdata[i].departingDate; 20 var str = ""+$scope.orderdata[i].departingDate;
21 str = str.slice(4,16) 21 str = str.slice(4,16)
22 $scope.orderdata[i].departingDateString = str 22 $scope.orderdata[i].departingDateString = str
23 console.log(str); 23 console.log(str);
24 24
25 } 25 }
26 26
27 $scope.displayFuelOrderList = new NgTableParams({ 27 $scope.displayFuelOrderList = new NgTableParams({
28 page: 1, 28 page: 1,
29 count: 10, 29 count: 10,
30 }, { 30 }, {
31 data: $scope.orderdata 31 data: $scope.orderdata
32 }); 32 });
33 }) 33 })
34 34
35 35
36 $scope.onDTSelect = function() { 36 $scope.onDTSelect = function() {
37 if($scope.optionSelected == 'dt'){ 37 if($scope.optionSelected == 'dt'){
38 $('#demo-modal-4').css('display', 'block'); 38 $('#demo-modal-4').css('display', 'block');
39 } 39 }
40 } 40 }
41 $scope.attachmentrowid = "" 41 $scope.attachmentrowid = ""
42 42
43 43
44 $scope.attachment = function(id, value, url) { 44 $scope.attachment = function(id, value, url) {
45 console.log(id, value) 45 console.log(id, value)
46 $scope.attachmentrowid = id 46 $scope.attachmentrowid = id
47 // $scope.attachmentdeleteid = attachdeleteid 47 // $scope.attachmentdeleteid = attachdeleteid
48 if(value == 'uploadAttachment'){ 48 if(value == 'uploadAttachment'){
49 $('#demo-modal-6').css('display', 'block'); 49 $('#demo-modal-6').css('display', 'block');
50 }else if(value == 'viewAttachment'){ 50 }else if(value == 'viewAttachment'){
51 var win = window.open(url, '_blank'); 51 var win = window.open(url, '_blank');
52 win.focus(); 52 win.focus();
53 }else if(value == 'deleteAttachment'){ 53 }else if(value == 'deleteAttachment'){
54 $('#delete1').css('display', 'block'); 54 $('#delete1').css('display', 'block');
55 } 55 }
56 } 56 }
57 57
58 $scope.cancelDeleteAttachment = function() { 58 $scope.cancelDeleteAttachment = function() {
59 $('#delete1').css('display', ''); 59 $('#delete1').css('display', '');
60 } 60 }
61 61
62 $scope.deleteAttachment = function() { 62 $scope.deleteAttachment = function() {
63 fuelOrdersService.deleteAttachment($scope.attachmentrowid).then(function(result) { 63 fuelOrdersService.deleteAttachment($scope.attachmentrowid).then(function(result) {
64 console.log(result, $scope.attachmentrowid) 64 console.log(result, $scope.attachmentrowid)
65 }) 65
66 if(result.success){
67 toastr.success(''+result.success+'', {
68 closeButton: true
69 })
70 }
71 })
66 $('#delete1').css('display', ''); 72 $('#delete1').css('display', '');
67 } 73 }
68 74
69 $scope.saveUploadAttachment = function(attachmentData) { 75 $scope.saveUploadAttachment = function(attachmentData) {
70 $scope.data.media = attachmentData 76 $scope.data.media = attachmentData
71 $scope.data.id = $scope.attachmentrowid 77 $scope.data.id = $scope.attachmentrowid
72 fuelOrdersService.uploadAttachment($scope.data).then(function(result) { 78 fuelOrdersService.uploadAttachment($scope.data).then(function(result) {
79 console.log(result)
80 if(result){
81 // console.log(result.success)
82 toastr.success(''+"Upload Successful"+'', {
83 closeButton: true
84 })
85 }
73 86
74 }) 87 })
75 $('#demo-modal-6').css('display', 'none'); 88 $('#demo-modal-6').css('display', 'none');
76 } 89 }
77 90
78 $scope.cancelUploadAttachment = function() { 91 $scope.cancelUploadAttachment = function() {
79 $('#demo-modal-6').css('display', 'none'); 92 $('#demo-modal-6').css('display', 'none');
80 } 93 }
81 94
82 $scope.editdata = {}; 95 $scope.editdata = {};
83 $scope.editTableRow = function(rowData){ 96 $scope.editTableRow = function(rowData){
84 console.log('row data', rowData); 97 console.log('row data', rowData);
85 $scope.editdata = rowData; 98 $scope.editdata = rowData;
86 $('#demo-modal-5').css('display', 'block'); 99 $('#demo-modal-5').css('display', 'block');
87 } 100 }
88 101
89 $scope.cancelData = function() { 102 $scope.cancelData = function() {
90 $('#demo-modal-4').css('display', ''); 103 $('#demo-modal-4').css('display', '');
91 } 104 }
92 $scope.canceleditdata = function() { 105 $scope.canceleditdata = function() {
93 $('#demo-modal-5').css('display', ''); 106 $('#demo-modal-5').css('display', '');
94 } 107 }
95 108
96 109
97 110
98 $scope.companyList = {}; 111 $scope.companyList = {};
99 112
100 fuelOrdersService.getAllCompanies().then(function(result) { 113 fuelOrdersService.getAllCompanies().then(function(result) {
101 $scope.showLoader = false; 114 $scope.showLoader = false;
102 $scope.companyList = result; 115 $scope.companyList = result;
103 console.log(result) 116 console.log(result)
104 }) 117 })
105 118
106 $scope.sourceList = [{source:"Direct Jet-A"},{source:"Direct AVGAS 100LL"}]; 119 $scope.sourceList = [{source:"Direct Jet-A"},{source:"Direct AVGAS 100LL"}];
107 120
108 $scope.data = {}; 121 $scope.data = {};
109 122
110 123
111 124
112 } 125 }
app/partials/viewcontact/viewcontact.controller.js
1 'use strict'; 1 'use strict';
2 2
3 //Load controller 3 //Load controller
4 angular.module('acufuel') 4 angular.module('acufuel')
5 5
6 .controller('viewcontactController', ['$scope', '$stateParams', '$state', 'ViewcontactService', 'ViewCompanyService', function($scope, $stateParams, $state, ViewcontactService, ViewCompanyService) { 6 .controller('viewcontactController', ['$scope', '$stateParams', '$state', 'ViewcontactService', 'ViewCompanyService', function($scope, $stateParams, $state, ViewcontactService, ViewCompanyService) {
7 7
8 $(document).ready(function() { 8 $(document).ready(function() {
9 $('.animation_select').click( function(){ 9 $('.animation_select').click( function(){
10 $('#animation_box').removeAttr('class').attr('class', ''); 10 $('#animation_box').removeAttr('class').attr('class', '');
11 var animation = $(this).attr("data-animation"); 11 var animation = $(this).attr("data-animation");
12 $('#animation_box').addClass('animated'); 12 $('#animation_box').addClass('animated');
13 $('#animation_box').addClass(animation); 13 $('#animation_box').addClass(animation);
14 return false; 14 return false;
15 }); 15 });
16 }); 16 });
17 17
18 $scope.showLoader = true; 18 $scope.showLoader = true;
19 $scope.showUpdateBtn = false; 19 $scope.showUpdateBtn = false;
20 var contactId = $stateParams.id; 20 var contactId = $stateParams.id;
21 $scope.contactDetail = {}; 21 $scope.contactDetail = {};
22 var contactCompanyId = ""; 22 var contactCompanyId = "";
23 ViewcontactService.getContact(contactId).then(function(result) { 23 ViewcontactService.getContact(contactId).then(function(result) {
24 $scope.contactDetail = result; 24 $scope.contactDetail = result;
25 $scope.showLoader = false; 25 $scope.showLoader = false;
26 contactCompanyId = result.owner.id; 26 contactCompanyId = result.owner.id;
27 }) 27 })
28 28
29 $scope.goBack = function(){ 29 $scope.goBack = function(){
30 window.history.back(); 30 window.history.back();
31 } 31 }
32 32
33 $scope.contactIdList = {}; 33 $scope.contactIdList = {};
34 var index; 34 var index;
35 var one = 1; 35 var one = 1;
36 var selectedId; 36 var selectedId;
37 37
38 ViewcontactService.getContactsList(contactId).then(function(list){ 38 ViewcontactService.getContactsList(contactId).then(function(list){
39 $scope.contactIdList = list; 39 $scope.contactIdList = list;
40 index = $scope.contactIdList.indexOf(contactId); 40 index = $scope.contactIdList.indexOf(contactId);
41 selectedId = $scope.contactIdList[index]; 41 selectedId = $scope.contactIdList[index];
42 }) 42 })
43 43
44 $scope.nextContact = function(){ 44 $scope.nextContact = function(){
45 //$scope.showLoader = true; 45 //$scope.showLoader = true;
46 index = index + one; 46 index = index + one;
47 selectedId = $scope.contactIdList[index]; 47 selectedId = $scope.contactIdList[index];
48 ViewcontactService.getContact(selectedId).then(function(result) { 48 ViewcontactService.getContact(selectedId).then(function(result) {
49 $scope.contactDetail = result; 49 $scope.contactDetail = result;
50 //$scope.showLoader = false; 50 //$scope.showLoader = false;
51 }) 51 })
52 } 52 }
53 53
54 $scope.prevContact = function(){ 54 $scope.prevContact = function(){
55 //$scope.showLoader = true; 55 //$scope.showLoader = true;
56 index = index - one; 56 index = index - one;
57 selectedId = $scope.contactIdList[index]; 57 selectedId = $scope.contactIdList[index];
58 ViewcontactService.getContact(selectedId).then(function(result) { 58 ViewcontactService.getContact(selectedId).then(function(result) {
59 $scope.contactDetail = result; 59 $scope.contactDetail = result;
60 //$scope.showLoader = false; 60 //$scope.showLoader = false;
61 }) 61 })
62 } 62 }
63 63
64 $scope.changePriceEmail = function(id){ 64 $scope.changePriceEmail = function(id){
65 var statusData = "status=" + $scope.contactDetail.priceEmail; 65 var statusData = "status=" + $scope.contactDetail.priceEmail;
66 ViewcontactService.changePriceEmail(id, statusData).then(function(result) { 66 ViewcontactService.changePriceEmail(id, statusData).then(function(result) {
67 if(result.success){ 67 if(result.success){
68 $('#toogleMail').css('display', 'block'); 68 $('#toogleMail').css('display', 'block');
69 if($scope.contactDetail.priceEmail == true){ 69 if($scope.contactDetail.priceEmail == true){
70 $scope.messageText = 'You have enabled price distribution for this contact'; 70 $scope.messageText = 'You have enabled price distribution for this contact';
71 }else{ 71 }else{
72 $scope.messageText = 'You have disabled price distribution for this contact'; 72 $scope.messageText = 'You have disabled price distribution for this contact';
73 } 73 }
74 } 74 }
75 }) 75 })
76 } 76 }
77 77
78 $scope.cancelToogle = function(){ 78 $scope.cancelToogle = function(){
79 $('#toogleMail').css('display', 'none'); 79 $('#toogleMail').css('display', 'none');
80 } 80 }
81 $scope.disableNext = true; 81 $scope.disableNext = true;
82 $scope.disablePrev = true; 82 $scope.disablePrev = true;
83 setInterval(function(){ 83 setInterval(function(){
84 var checkMaxLength = $scope.contactIdList.length - one; 84 var checkMaxLength = $scope.contactIdList.length - one;
85 if (index === checkMaxLength) { 85 if (index === checkMaxLength) {
86 $scope.disableNext = true; 86 $scope.disableNext = true;
87 }else{ 87 }else{
88 $scope.disableNext = false; 88 $scope.disableNext = false;
89 } 89 }
90 if (index === 0) { 90 if (index === 0) {
91 $scope.disablePrev = true; 91 $scope.disablePrev = true;
92 }else{ 92 }else{
93 $scope.disablePrev = false; 93 $scope.disablePrev = false;
94 } 94 }
95 }, 1); 95 }, 1);
96 96
97 $scope.editName = true; 97 $scope.editName = true;
98 $scope.editCompany = true; 98 $scope.editCompany = true;
99 $scope.editAddress = true; 99 $scope.editAddress = true;
100 $scope.editPhone = true; 100 $scope.editPhone = true;
101 $scope.editMobile = true; 101 $scope.editMobile = true;
102 $scope.editEmail = true; 102 $scope.editEmail = true;
103 $scope.editContactNotes = true; 103 $scope.editContactNotes = true;
104 104
105 $scope.nameEdit = function(){ 105 $scope.nameEdit = function(){
106 $scope.editName = false; 106 $scope.editName = false;
107 $scope.showUpdateBtn = true; 107 $scope.showUpdateBtn = true;
108 } 108 }
109 $scope.addressEdit = function(){ 109 $scope.addressEdit = function(){
110 $scope.editAddress = false; 110 $scope.editAddress = false;
111 $scope.showUpdateBtn = true; 111 $scope.showUpdateBtn = true;
112 } 112 }
113 $scope.phoneEdit = function(){ 113 $scope.phoneEdit = function(){
114 $scope.editPhone = false; 114 $scope.editPhone = false;
115 $scope.showUpdateBtn = true; 115 $scope.showUpdateBtn = true;
116 } 116 }
117 $scope.mobileEdit = function(){ 117 $scope.mobileEdit = function(){
118 $scope.editMobile = false; 118 $scope.editMobile = false;
119 $scope.showUpdateBtn = true; 119 $scope.showUpdateBtn = true;
120 } 120 }
121 $scope.emailEdit = function(){ 121 $scope.emailEdit = function(){
122 $scope.editEmail = false; 122 $scope.editEmail = false;
123 $scope.showUpdateBtn = true; 123 $scope.showUpdateBtn = true;
124 } 124 }
125 $scope.notesEdit = function(){ 125 $scope.notesEdit = function(){
126 $scope.editContactNotes = false; 126 $scope.editContactNotes = false;
127 $scope.showUpdateBtn = true; 127 $scope.showUpdateBtn = true;
128 } 128 }
129 129
130 $scope.conData = {}; 130 $scope.conData = {};
131 $scope.contactData = {}; 131 $scope.contactData = {};
132 $scope.contactData.contactList = []; 132 $scope.contactData.contactList = [];
133 $scope.updateContact = function(data){ 133 $scope.updateContact = function(data){
134 $scope.showLoader = true; 134 $scope.showLoader = true;
135 $scope.editName = true; 135 $scope.editName = true;
136 $scope.editCompany = true; 136 $scope.editCompany = true;
137 $scope.editAddress = true; 137 $scope.editAddress = true;
138 $scope.editPhone = true; 138 $scope.editPhone = true;
139 $scope.editMobile = true; 139 $scope.editMobile = true;
140 $scope.editEmail = true; 140 $scope.editEmail = true;
141 $scope.editContactNotes = true; 141 $scope.editContactNotes = true;
142 142
143 $scope.conData.address = data.address; 143 $scope.conData.address = data.address;
144 $scope.conData.email = data.email; 144 $scope.conData.email = data.email;
145 $scope.conData.firstName = data.firstName; 145 $scope.conData.firstName = data.firstName;
146 $scope.conData.id = data.id; 146 $scope.conData.id = data.id;
147 $scope.conData.lastName = data.lastName; 147 $scope.conData.lastName = data.lastName;
148 $scope.conData.mobilePhone = data.mobilePhone; 148 $scope.conData.mobilePhone = data.mobilePhone;
149 $scope.conData.note = data.note; 149 $scope.conData.note = data.note;
150 $scope.conData.password = data.password; 150 $scope.conData.password = data.password;
151 $scope.conData.priceEmail = data.priceEmail; 151 $scope.conData.priceEmail = data.priceEmail;
152 $scope.conData.primaryContact = data.primaryContact; 152 $scope.conData.primaryContact = data.primaryContact;
153 $scope.conData.title = data.title; 153 $scope.conData.title = data.title;
154 $scope.conData.userName = data.userName; 154 $scope.conData.userName = data.userName;
155 $scope.conData.workPhone = data.workPhone; 155 $scope.conData.workPhone = data.workPhone;
156 $scope.conData.companyId = data.owner.id; 156 $scope.conData.companyId = data.owner.id;
157 157
158 $scope.contactData.contactList.push($scope.conData); 158 $scope.contactData.contactList.push($scope.conData);
159 $scope.contactData.contactList.push(); 159 $scope.contactData.contactList.push();
160 ViewcontactService.updateContact($scope.contactData).then(function(result) { 160 ViewcontactService.updateContact($scope.contactData).then(function(result) {
161 if(result.success){ 161 if(result.success){
162 toastr.success(''+result.success+'', { 162 toastr.success(''+result.success+'', {
163 closeButton: true 163 closeButton: true
164 }) 164 })
165 $scope.showUpdateBtn = false; 165 $scope.showUpdateBtn = false;
166 }else{ 166 }else{
167 toastr.error(''+result.statusText+'', { 167 toastr.error(''+result.statusText+'', {
168 closeButton: true 168 closeButton: true
169 }) 169 })
170 } 170 }
171 $scope.showLoader = false; 171 $scope.showLoader = false;
172 }) 172 })
173 } 173 }
174 174
175 $scope.cancelContact = function(){ 175 $scope.cancelContact = function(){
176 $scope.editName = true; 176 $scope.editName = true;
177 $scope.editCompany = true; 177 $scope.editCompany = true;
178 $scope.editAddress = true; 178 $scope.editAddress = true;
179 $scope.editPhone = true; 179 $scope.editPhone = true;
180 $scope.editMobile = true; 180 $scope.editMobile = true;
181 $scope.editEmail = true; 181 $scope.editEmail = true;
182 $scope.editContactNotes = true; 182 $scope.editContactNotes = true;
183 $scope.showUpdateBtn = false; 183 $scope.showUpdateBtn = false;
184 } 184 }
185 185
186 $scope.checkPrimaryContact = function(companyId){ 186 $scope.checkPrimaryContact = function(companyId){
187 if($scope.contactDetail.primaryContact == true){ 187 if($scope.contactDetail.primaryContact == true){
188 ViewCompanyService.checkPrimaryContact(companyId).then(function(result) { 188 ViewCompanyService.checkPrimaryContact(companyId).then(function(result) {
189 console.log(result) 189 console.log(result)
190 if(result.status == 422 || result.status == 200){ 190 if(result.status == 422 || result.status == 200){
191 $('#primaryContact').css('display', 'block'); 191 $('#primaryContact').css('display', 'block');
192 } 192 }
193 }) 193 })
194 }else{ 194 }else{
195 var primaryContactData = "companyContactId=" + $scope.contactDetail.id + "&primary=false"; 195 var primaryContactData = "companyContactId=" + $scope.contactDetail.id + "&primary=false";
196 196
197 ViewCompanyService.addPrimaryContact(primaryContactData).then(function(result) { 197 ViewCompanyService.addPrimaryContact(primaryContactData).then(function(result) {
198 console.log(result) 198 console.log(result)
199 }) 199 })
200 } 200 }
201 } 201 }
202 202
203 $scope.cancelPrimaryContact = function(){ 203 $scope.cancelPrimaryContact = function(){
204 $('#primaryContact').css('display', 'none'); 204 $('#primaryContact').css('display', 'none');
205 $scope.contactDetail.primaryContact = false; 205 $scope.contactDetail.primaryContact = false;
206 console.log($scope.contactDetail.primaryContact) 206 console.log($scope.contactDetail.primaryContact)
207 } 207 }
208 208
209 $scope.sendPrimaryContact = function(id){ 209 $scope.sendPrimaryContact = function(id){
210 $('#primaryContact').css('display', 'none'); 210 $('#primaryContact').css('display', 'none');
211 var primaryContactData = "companyContactId=" + id + "&primary=" + $scope.contactDetail.primaryContact; 211 var primaryContactData = "companyContactId=" + id + "&primary=" + $scope.contactDetail.primaryContact;
212 212
213 ViewCompanyService.addPrimaryContact(primaryContactData).then(function(result) { 213 ViewCompanyService.addPrimaryContact(primaryContactData).then(function(result) {
214 console.log(result) 214 console.log(result)
215 }) 215 })
216 216
217 } 217 }
218 218
219 var deleteContact = ""; 219 var deleteContact = "";
220 $scope.deleteContact = function(id){ 220 $scope.deleteContact = function(id){
221 $('#delete2').css('display', 'block'); 221 $('#delete2').css('display', 'block');
222 deleteContact = id; 222 deleteContact = id;
223 } 223 }
224 224
225 $scope.contactDelete = function(){ 225 $scope.contactDelete = function(){
226 ViewcontactService.deleteContact(deleteContact).then(function(result) { 226 ViewcontactService.deleteContact(deleteContact).then(function(result) {
227 console.log(result) 227 console.log(result)
228 if(result.success){ 228 if(result.success){
229 deleteContact = ""; 229 deleteContact = "";
230 $('#delete2').css('display', 'none'); 230 $('#delete2').css('display', 'none');
231 toastr.success(''+result.success+'', { 231 toastr.success(''+result.success+'', {
232 closeButton: true 232 closeButton: true
233 }) 233 })
234 $state.go('app.viewCompany', {"id": contactCompanyId}); 234 $state.go('app.viewCompany', {"id": contactCompanyId});
235 } 235 }
236 236
237 }) 237 })
238 } 238 }
239 239
240 $scope.cancelDelete = function(){ 240 $scope.cancelDelete = function(){
241 $('#delete2').css('display', 'none'); 241 $('#delete2').css('display', 'none');
242 } 242 }
243
244 $scope.confirmMail = function(){
245
246 $('#confirm1').css('display', 'block');
247
248 }
249
250 $scope.saveAndCloseConfirm = function(){
251 $('#confirm1').css('display', 'none');
252 ViewcontactService.sendMailTo(contactId).then(function(result) {
253 toastr.success(''+result.success+'', {
254 closeButton: true
255 })
256 })
257 }
258 $scope.cancelAndCloseConfirm = function(){
259 $scope.sendEmail = {};
260 $scope.sendEmail.pricing = '';
261 $('#confirm1').css('display', 'none');
262 }
243 263
244 }]); 264 }]);
245 265
app/partials/viewcontact/viewcontact.html
1 <style type="text/css"> 1 <style type="text/css">
2 .toggle.btn{ 2 .toggle.btn{
3 width: 140px !important; 3 width: 140px !important;
4 } 4 }
5 </style> 5 </style>
6 6
7 <div class="myLoader" ng-show="showLoader"> 7 <div class="myLoader" ng-show="showLoader">
8 <img src="../img/hourglass.gif" width="50px;"> 8 <img src="../img/hourglass.gif" width="50px;">
9 </div> 9 </div>
10 <div class="container"> 10 <div class="container">
11 <div class="row"> 11 <div class="row">
12 <div class="col-md-10" style="padding-right: 60px; margin-bottom: 30px;"> 12 <div class="col-md-10" style="padding-right: 60px; margin-bottom: 30px;">
13 <div class="widget"> 13 <div class="widget">
14 <div class="widget-header"> 14 <div class="widget-header">
15 <i class="icon-pencil"></i> 15 <i class="icon-pencil"></i>
16 <i class="fa fa-building-o" aria-hidden="true"></i> 16 <i class="fa fa-building-o" aria-hidden="true"></i>
17 <h3>Antioch Flight Department</h3> 17 <h3>Antioch Flight Department</h3>
18 <i class="fa fa-times" areia-hidden="true" ng-click="goBack()" style="float: right; margin-top: 10px; margin-right: 10px; cursor: pointer;"></i> 18 <i class="fa fa-times" areia-hidden="true" ng-click="goBack()" style="float: right; margin-top: 10px; margin-right: 10px; cursor: pointer;"></i>
19 </div> 19 </div>
20 <div class="widget-content" style="padding-left: 0; padding-right: 0; "> 20 <div class="widget-content" style="padding-left: 0; padding-right: 0; ">
21 <div class="container"> 21 <div class="container">
22 <div style="margin-bottom: 25px;"> 22 <div style="margin-bottom: 25px;">
23 <button ng-disabled="disablePrev" class="newButtons animation_select" ng-click="prevContact()" data-animation="fadeInLeft"> 23 <button ng-disabled="disablePrev" class="newButtons animation_select" ng-click="prevContact()" data-animation="fadeInLeft">
24 <i class="fa fa-long-arrow-left" aria-hidden="true"></i> 24 <i class="fa fa-long-arrow-left" aria-hidden="true"></i>
25 Previous Contact 25 Previous Contact
26 </button> 26 </button>
27 <button ng-disabled="disableNext" class="newButtons animation_select" ng-click="nextContact()" data-animation="fadeInRight"> 27 <button ng-disabled="disableNext" class="newButtons animation_select" ng-click="nextContact()" data-animation="fadeInRight">
28 Next Contact 28 Next Contact
29 <i class="fa fa-long-arrow-right" aria-hidden="true"></i> 29 <i class="fa fa-long-arrow-right" aria-hidden="true"></i>
30 </button> 30 </button>
31 </div> 31 </div>
32 <div class="row"> 32 <div class="row">
33 <div class="col-md-6" style="margin-left: 20px;"> 33 <div class="col-md-6" style="margin-left: 20px;">
34 <div class="widget stacked" id="animation_box"> 34 <div class="widget stacked" id="animation_box">
35 <div class="widget-header"> 35 <div class="widget-header">
36 <i class="fa fa-building-o" aria-hidden="true"></i> 36 <i class="fa fa-building-o" aria-hidden="true"></i>
37 <h3 style="margin-right: 0px;">Contact Detail</h3> 37 <h3 style="margin-right: 0px;">Contact Detail</h3>
38 <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteContact(contactDetail.id)" style="color: white;" aria-hidden="true"></i> 38 <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteContact(contactDetail.id)" style="color: white;" aria-hidden="true"></i>
39 <div class="pull-right" style="margin-top: 5px; margin-right: 10px;"> 39 <div class="pull-right" style="margin-top: 5px; margin-right: 10px;">
40 <toggle ng-model="contactDetail.priceEmail" style="width: 140px;" ng-change="changePriceEmail(contactDetail.id)" size="customToogle" on="PRICE EMAIL ON" off="PRICE EMAIL OFF"></toggle> 40 <toggle ng-model="contactDetail.priceEmail" style="width: 140px;" ng-change="changePriceEmail(contactDetail.id)" size="customToogle" on="PRICE EMAIL ON" off="PRICE EMAIL OFF"></toggle>
41 </div> 41 </div>
42 42
43 </div> 43 </div>
44 <div class="widget-content"> 44 <div class="widget-content">
45 <div class="row" style="margin-left:0px"> 45 <div class="row" style="margin-left:0px">
46 <div class="col-md-6" style="padding-left: 0px;"> 46 <div class="col-md-6" style="padding-left: 0px;">
47 <h3> 47 <h3>
48 <b ng-show="editName" style="color:#F90;">{{contactDetail.firstName}} {{contactDetail.lastName}}</b> 48 <b ng-show="editName" style="color:#F90;">{{contactDetail.firstName}} {{contactDetail.lastName}}</b>
49 <input type="text" ng-hide="editName" class="form-control" style="width: 49%; float: left; margin-right: 1%;" ng-model="contactDetail.firstName"> 49 <input type="text" ng-hide="editName" class="form-control" style="width: 49%; float: left; margin-right: 1%;" ng-model="contactDetail.firstName">
50 <input type="text" ng-hide="editName" class="form-control" style="width: 49%;" ng-model="contactDetail.lastName"> 50 <input type="text" ng-hide="editName" class="form-control" style="width: 49%;" ng-model="contactDetail.lastName">
51 &nbsp;<i class="fa fa-pencil-square-o" ng-show="editName" ng-click="nameEdit()" style="font-size: 11px;" aria-hidden="true"></i> 51 &nbsp;<i class="fa fa-pencil-square-o" ng-show="editName" ng-click="nameEdit()" style="font-size: 11px;" aria-hidden="true"></i>
52 </h3> 52 </h3>
53 {{contactDetail.owner.companyName}} 53 {{contactDetail.owner.companyName}}
54 </div> 54 </div>
55 <div class="col-md-6"> 55 <div class="col-md-6">
56 <div style="margin-bottom: 10px" class="input-group email-password"> 56 <div style="margin-bottom: 10px" class="input-group email-password">
57 <span class="input-group-addon email-password"><i class="glyphicon glyphicon-user email-password-icon"></i></span> 57 <span class="input-group-addon email-password"><i class="glyphicon glyphicon-user email-password-icon"></i></span>
58 <input id="login-username" type="text" ng-model="contactDetail.userName" class="form-control email-password" placeholder="username or email"> 58 <input id="login-username" type="text" ng-model="contactDetail.userName" class="form-control email-password" placeholder="username or email">
59 </div> 59 </div>
60 60
61 <!-- <div class="input-group email-password"> 61 <!-- <div class="input-group email-password">
62 <span class="input-group-addon email-password"><i class="fa fa-key" aria-hidden="true"></i></span> 62 <span class="input-group-addon email-password"><i class="fa fa-key" aria-hidden="true"></i></span>
63 <input id="login-password" type="password" class="form-control email-password" name="password" placeholder="password"> 63 <input id="login-password" type="password" class="form-control email-password" name="password" placeholder="password">
64 </div> --> 64 </div> -->
65 </div> 65 </div>
66 </div> 66 </div>
67 <div> 67 <div>
68 <p> 68 <p>
69 <span ng-show="editAddress"> 69 <span ng-show="editAddress">
70 <i class="fa fa-map-marker"></i> {{contactDetail.address}} &nbsp; 70 <i class="fa fa-map-marker"></i> {{contactDetail.address}} &nbsp;
71 <i class="fa fa-pencil-square-o" ng-click="addressEdit()" style="font-size: 11px;" aria-hidden="true"></i> 71 <i class="fa fa-pencil-square-o" ng-click="addressEdit()" style="font-size: 11px;" aria-hidden="true"></i>
72 </span> 72 </span>
73 73
74 <input type="text" ng-hide="editAddress" style="width: 50%;" class="form-control" ng-model="contactDetail.address"> 74 <input type="text" ng-hide="editAddress" style="width: 50%;" class="form-control" ng-model="contactDetail.address">
75 </p> 75 </p>
76 76
77 <p ng-show="editPhone"><i class="fa fa-phone"></i> {{contactDetail.mobilePhone}} &nbsp;<i class="fa fa-pencil-square-o" ng-click="phoneEdit()" style="font-size: 11px;" aria-hidden="true"></i></p> 77 <p ng-show="editPhone"><i class="fa fa-phone"></i> {{contactDetail.mobilePhone}} &nbsp;<i class="fa fa-pencil-square-o" ng-click="phoneEdit()" style="font-size: 11px;" aria-hidden="true"></i></p>
78 <p ng-hide="editPhone"> 78 <p ng-hide="editPhone">
79 <input type="text" style="width: 50%;" ng-model="contactDetail.mobilePhone" class="form-control"> 79 <input type="text" style="width: 50%;" ng-model="contactDetail.mobilePhone" class="form-control">
80 </p> 80 </p>
81 81
82 <p ng-show="editMobile"><i class="fa fa-mobile"></i> {{contactDetail.workPhone}} &nbsp;<i class="fa fa-pencil-square-o" ng-click="mobileEdit()" style="font-size: 11px;" aria-hidden="true"></i></p> 82 <p ng-show="editMobile"><i class="fa fa-mobile"></i> {{contactDetail.workPhone}} &nbsp;<i class="fa fa-pencil-square-o" ng-click="mobileEdit()" style="font-size: 11px;" aria-hidden="true"></i></p>
83 <p ng-hide="editMobile"> 83 <p ng-hide="editMobile">
84 <input type="text" style="width: 50%;" ng-model="contactDetail.workPhone" class="form-control"> 84 <input type="text" style="width: 50%;" ng-model="contactDetail.workPhone" class="form-control">
85 </p> 85 </p>
86 86
87 <p ng-show="editEmail"><i class="fa fa-envelope"></i> {{contactDetail.email}} &nbsp;<i class="fa fa-pencil-square-o" ng-click="emailEdit()" style="font-size: 11px;" aria-hidden="true"></i></p> 87 <p ng-show="editEmail"><i class="fa fa-envelope"></i> {{contactDetail.email}} &nbsp;<i class="fa fa-pencil-square-o" ng-click="emailEdit()" style="font-size: 11px;" aria-hidden="true"></i></p>
88 <p ng-hide="editEmail"> 88 <p ng-hide="editEmail">
89 <input type="email" style="width: 50%;" ng-model="contactDetail.email" class="form-control"> 89 <input type="email" style="width: 50%;" ng-model="contactDetail.email" class="form-control">
90 </p> 90 </p>
91 <div> 91 <div>
92 <input type="checkbox" ng-checked="contactDetail.primaryContact" ng-click="checkPrimaryContact(contactDetail.owner.id)" ng-model="contactDetail.primaryContact">&nbsp; 92 <input type="checkbox" ng-checked="contactDetail.primaryContact" ng-click="checkPrimaryContact(contactDetail.owner.id)" ng-model="contactDetail.primaryContact">&nbsp;
93 <span>Primary Contact </span> 93 <span>Primary Contact </span>
94 </div> 94 </div>
95 </div> 95 </div>
96 </br> 96 </br>
97 <div> 97 <div>
98 <p><b>Contact Notes</b> &nbsp;<i ng-show="editContactNotes" class="fa fa-pencil-square-o" ng-click="notesEdit()" style="font-size: 11px;" aria-hidden="true"></i> 98 <p><b>Contact Notes</b> &nbsp;<i ng-show="editContactNotes" class="fa fa-pencil-square-o" ng-click="notesEdit()" style="font-size: 11px;" aria-hidden="true"></i>
99 <p ng-show="editContactNotes">{{contactDetail.note}}</p> 99 <p ng-show="editContactNotes">{{contactDetail.note}}</p>
100 <p ng-hide="editContactNotes"> 100 <p ng-hide="editContactNotes">
101 <textarea ng-model="contactDetail.note" class="form-control" style="resize: vertical;"></textarea> 101 <textarea ng-model="contactDetail.note" class="form-control" style="resize: vertical;"></textarea>
102 </p> 102 </p>
103 103
104 <div> 104 <div>
105 <button ng-click="updateContact(contactDetail)" ng-show="showUpdateBtn" class="btn btn-success pull-left">Update Contact</button> 105 <button ng-click="updateContact(contactDetail)" ng-show="showUpdateBtn" class="btn btn-success pull-left">Update Contact</button>
106 <button ng-click="cancelContact()" style="margin-left: 5px;" ng-show="showUpdateBtn" class="btn btn-default pull-left">Cancel</button> 106 <button ng-click="cancelContact()" style="margin-left: 5px;" ng-show="showUpdateBtn" class="btn btn-default pull-left">Cancel</button>
107 <button type="button" class="btn btn-primary pull-right">Send Price to This Contacts</button> 107 <button type="button" class="btn btn-primary pull-right" ng-click="confirmMail()">Send Price to This Contacts</button>
108 <div class="clearfix"></div> 108 <div class="clearfix"></div>
109 </div> 109 </div>
110 </div> 110 </div>
111 <!-- <div class="col-md-6"> 111 <!-- <div class="col-md-6">
112 <button type="button" class="btn btn-primary">Send Price to This Contacts</button> 112 <button type="button" class="btn btn-primary">Send Price to This Contacts</button>
113 </div> --> 113 </div> -->
114 </div> 114 </div>
115 </div> 115 </div>
116 </div> 116 </div>
117 </div> 117 </div>
118 </div> 118 </div>
119 </div> 119 </div>
120 </div> 120 </div>
121 </div> 121 </div>
122 </div> 122 </div>
123 123
124 <div class="customConfirmPopBackdrop" id="primaryContact"> 124 <div class="customConfirmPopBackdrop" id="primaryContact">
125 <div class="customModalInner" style="max-width: 400px;"> 125 <div class="customModalInner" style="max-width: 400px;">
126 <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> 126 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
127 <table> 127 <table>
128 <tr> 128 <tr>
129 <td> 129 <td>
130 <img src="img/info.png" style="width: 50px;"> 130 <img src="img/info.png" style="width: 50px;">
131 </td> 131 </td>
132 <td> 132 <td>
133 <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure you want to set this person as your primary contact?</p> 133 <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure you want to set this person as your primary contact?</p>
134 </td> 134 </td>
135 </tr> 135 </tr>
136 </table> 136 </table>
137 </div> 137 </div>
138 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> 138 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
139 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="sendPrimaryContact(contactDetail.id)">Yes</button> 139 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="sendPrimaryContact(contactDetail.id)">Yes</button>
140 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelPrimaryContact()">Cancel</button> 140 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelPrimaryContact()">Cancel</button>
141 </div> 141 </div>
142 </div> 142 </div>
143 </div> 143 </div>
144 144
145 <div class="customConfirmPopBackdrop" id="toogleMail"> 145 <div class="customConfirmPopBackdrop" id="toogleMail">
146 <div class="customModalInner" style="max-width: 400px;"> 146 <div class="customModalInner" style="max-width: 400px;">
147 <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> 147 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
148 <table> 148 <table>
149 <tr> 149 <tr>
150 <!-- <td> 150 <!-- <td>
151 <img src="" style="width: 50px;"> 151 <img src="" style="width: 50px;">
152 </td> --> 152 </td> -->
153 <td> 153 <td>
154 <p style="padding: 5px 10px; margin-bottom: 0;text-align: center;">{{messageText}}</p> 154 <p style="padding: 5px 10px; margin-bottom: 0;text-align: center;">{{messageText}}</p>
155 </td> 155 </td>
156 </tr> 156 </tr>
157 </table> 157 </table>
158 </div> 158 </div>
159 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> 159 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
160 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelToogle()">Cancel</button> 160 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelToogle()">Cancel</button>
161 </div> 161 </div>
162 </div> 162 </div>
163 </div> 163 </div>
164 164
165 <div class="customConfirmPopBackdrop" id="delete2"> 165 <div class="customConfirmPopBackdrop" id="delete2">
166 <div class="customModalInner" style="max-width: 400px;"> 166 <div class="customModalInner" style="max-width: 400px;">
167 <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> 167 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
168 <table> 168 <table>
169 <tr> 169 <tr>
170 <td> 170 <td>
171 <img src="img/info.png" style="width: 50px;"> 171 <img src="img/info.png" style="width: 50px;">
172 </td> 172 </td>
173 <td> 173 <td>
174 <p style="padding: 5px 10px; margin-bottom: 0;">Please confirm! Are you sure you want to DELETE this Contact?</p> 174 <p style="padding: 5px 10px; margin-bottom: 0;">Please confirm! Are you sure you want to DELETE this Contact?</p>
175 </td> 175 </td>
176 </tr> 176 </tr>
177 </table> 177 </table>
178 </div> 178 </div>
179 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> 179 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
180 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="contactDelete()">Accept</button> 180 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="contactDelete()">Accept</button>
181 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelDelete()">Cancel</button> 181 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelDelete()">Cancel</button>
182 </div> 182 </div>
183 </div> 183 </div>
184 </div>
185
186 <div class="customConfirmPopBackdrop" id="confirm1" style="display: none;">
187 <div class="customModalInner">
188 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
189 <table>
190 <tr>
191 <td>
192 <img src="img/info.png" style="width: 50px;">
193 </td>
194 <td>
195 <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to email pricing to this contact?</p>
196 </td>
197 </tr>
198 </table>
199 </div>
200 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
201 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="saveAndCloseConfirm()">Yes</button>
202 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelAndCloseConfirm()">Cancel</button>
203 </div>
204 </div>
184 </div> 205 </div>
app/partials/viewcontact/viewcontact.service.js
1 (function(){ 1 (function(){
2 'use strict'; 2 'use strict';
3 angular.module('acufuel') 3 angular.module('acufuel')
4 .service('ViewcontactService', ['$q', '$http', 'BASE_URL', ViewcontactService]); 4 .service('ViewcontactService', ['$q', '$http', 'BASE_URL', ViewcontactService]);
5 5
6 function ViewcontactService($q, $http, BASE_URL) { 6 function ViewcontactService($q, $http, BASE_URL) {
7 7
8 this.getContact = function(id) { 8 this.getContact = function(id) {
9 9
10 var deferred = $q.defer(); 10 var deferred = $q.defer();
11 $http({ 11 $http({
12 method : 'GET', 12 method : 'GET',
13 url : BASE_URL.url +'/company/contact/'+id, 13 url : BASE_URL.url +'/company/contact/'+id,
14 headers : {'Content-Type': 'application/json'}, 14 headers : {'Content-Type': 'application/json'},
15 }) 15 })
16 .then(function (result){ 16 .then(function (result){
17 deferred.resolve(result.data); 17 deferred.resolve(result.data);
18 },function (result){ 18 },function (result){
19 deferred.resolve(result.data); 19 deferred.resolve(result.data);
20 }) 20 })
21 return deferred.promise; 21 return deferred.promise;
22 } 22 }
23 23
24 this.getContactsList = function(id) { 24 this.getContactsList = function(id) {
25 25
26 var deferred = $q.defer(); 26 var deferred = $q.defer();
27 $http({ 27 $http({
28 method : 'GET', 28 method : 'GET',
29 url : BASE_URL.url +'/company/contact/idList/'+id, 29 url : BASE_URL.url +'/company/contact/idList/'+id,
30 headers : {'Content-Type': 'application/json'}, 30 headers : {'Content-Type': 'application/json'},
31 }) 31 })
32 .then(function (result){ 32 .then(function (result){
33 deferred.resolve(result.data); 33 deferred.resolve(result.data);
34 },function (result){ 34 },function (result){
35 deferred.resolve(result.data); 35 deferred.resolve(result.data);
36 }) 36 })
37 return deferred.promise; 37 return deferred.promise;
38 } 38 }
39 39
40 this.updateContact = function(data) { 40 this.updateContact = function(data) {
41 var deferred = $q.defer(); 41 var deferred = $q.defer();
42 $http({ 42 $http({
43 method : 'PUT', 43 method : 'PUT',
44 url : BASE_URL.url +'/company/contact', 44 url : BASE_URL.url +'/company/contact',
45 data : data, 45 data : data,
46 headers : {'Content-Type': 'application/json'}, 46 headers : {'Content-Type': 'application/json'},
47 }) 47 })
48 .then(function (result){ 48 .then(function (result){
49 deferred.resolve(result.data); 49 deferred.resolve(result.data);
50 },function (result){ 50 },function (result){
51 deferred.resolve(result.data); 51 deferred.resolve(result.data);
52 }) 52 })
53 return deferred.promise; 53 return deferred.promise;
54 } 54 }
55 55
56 this.changePriceEmail = function(contactId, data) { 56 this.changePriceEmail = function(contactId, data) {
57 var deferred = $q.defer(); 57 var deferred = $q.defer();
58 $http({ 58 $http({
59 method : 'PUT', 59 method : 'PUT',
60 url : BASE_URL.url +'/company/contact/status/'+ contactId, 60 url : BASE_URL.url +'/company/contact/status/'+ contactId,
61 data : data, 61 data : data,
62 headers : {'Content-Type': 'application/json'}, 62 headers : {'Content-Type': 'application/json'},
63 }) 63 })
64 .then(function (result){ 64 .then(function (result){
65 deferred.resolve(result.data); 65 deferred.resolve(result.data);
66 },function (result){ 66 },function (result){
67 deferred.resolve(result.data); 67 deferred.resolve(result.data);
68 }) 68 })
69 return deferred.promise; 69 return deferred.promise;
70 } 70 }
71 71
72 this.deleteContact = function(contactId){ 72 this.deleteContact = function(contactId){
73 var deferred = $q.defer(); 73 var deferred = $q.defer();
74 $http({ 74 $http({
75 method : 'DELETE', 75 method : 'DELETE',
76 url : BASE_URL.url +'/company/contact/'+ contactId, 76 url : BASE_URL.url +'/company/contact/'+ contactId,
77 headers : {'Content-Type': 'application/json'}, 77 headers : {'Content-Type': 'application/json'},
78 }) 78 })
79 .then(function (result){ 79 .then(function (result){
80 deferred.resolve(result.data); 80 deferred.resolve(result.data);
81 },function (result){ 81 },function (result){
82 deferred.resolve(result.data); 82 deferred.resolve(result.data);
83 }) 83 })
84 return deferred.promise; 84 return deferred.promise;
85 } 85 }
86
87 this.sendMailTo = function(contactid){
88 var deferred = $q.defer();
89 $http({
90 method : 'POST',
91 url : BASE_URL.url +'/company/contact/mailPriceToContacts/'+contactid,
92 headers : {'Content-Type': 'application/json'}
93 })
94 .then(function (result){
95 deferred.resolve(result.data);
96 },function (result){
97 deferred.resolve(result.data);
98 })
99 return deferred.promise;
100 }
86 101
87 } 102 }
88 103
89 })(); 104 })();