Commit 3f6f25d021fa6f7a691fc84d6f55e1517ac45253

Authored by Anchit Jindal
Exists in master

Merge branch 'master' of http://git.viithiisys.com/viithiisys/acufuel

... ... @@ -138,6 +138,7 @@
138 138 <script src="partials/viewcontact/viewcontact.controller.js"></script>
139 139 <script src="partials/viewFuelVendor/viewFuelVendor.controller.js"></script>
140 140 <script src="partials/accountSetting/accountSetting.Controller.js"></script>
  141 + <script src="partials/viewVendorContact/viewVendorContact.Controller.js"></script>
141 142  
142 143 <script src="partials/main/main.controller.js"></script>
143 144 <div ui-view></div>
... ... @@ -173,6 +174,7 @@
173 174 <script src="partials/viewcontact/viewcontact.service.js"></script>
174 175 <script src="partials/viewFuelVendor/viewFuelVendor.service.js"></script>
175 176 <script src="partials/accountSetting/accountSetting.Service.js"></script>
  177 + <script src="partials/viewVendorContact/viewVendorContact.Service.js"></script>
176 178  
177 179 <script src="partials/main/main.service.js"></script>
178 180  
... ...
... ... @@ -233,6 +233,13 @@
233 233 templateUrl: "partials/viewcontact/viewcontact.html",
234 234 controller: "viewcontactController"
235 235 })
  236 +
  237 + .state("app.viewVendorContact", {
  238 + url: "/viewVendorContact/:id",
  239 + templateUrl: "partials/viewVendorContact/viewVendorContact.html",
  240 + controller: "viewVendorContactController"
  241 + })
  242 +
236 243 }
237 244 ])
238 245  
... ...
app/partials/viewCompany/viewCompany.controller.js
... ... @@ -10,7 +10,6 @@
10 10 $scope.aircraft = {};
11 11 $scope.primayData = {};
12 12 $scope.showLoader = false;
13   - $scope.showLoader = true;
14 13 $scope.showUpdateBtn = false;
15 14 $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId'));
16 15  
... ... @@ -20,9 +19,9 @@
20 19 });
21 20 });
22 21  
23   - CustomersService.getMargin().then(function(result) {
24   - $scope.marginList = result;
25   - })
  22 + // CustomersService.getMargin().then(function(result) {
  23 + // $scope.marginList = result;
  24 + // })
26 25  
27 26 var value = "";
28 27 var companyId = $stateParams.id;
... ... @@ -117,6 +116,7 @@
117 116 // })
118 117 $('#contact-modal-3').modal('hide');
119 118 $scope.primayData.id = result.data;
  119 + $scope.data = {};
120 120 $scope.sendPrimaryContact();
121 121 getContactList();
122 122 }else{
... ... @@ -279,12 +279,12 @@
279 279 }
280 280  
281 281 $scope.sendMail = function(){
  282 + $('#confirm1').css('display', 'none');
282 283 ViewCompanyService.sendMail(companyId).then(function(result) {
283 284 if(result != null && result.success){
284 285 toastr.success(''+result.success+'', {
285 286 closeButton: true
286 287 })
287   - $('#confirm1').css('display', 'none');
288 288 }else{
289 289 toastr.error(''+result.statusText+'', {
290 290 closeButton: true
... ...
app/partials/viewCompany/viewCompany.html
... ... @@ -210,28 +210,17 @@
210 210 <input type="tel" style="width: 50%;" ng-hide="showAddress" ng-model="companyData.addressTwo" class="form-control" />
211 211 </div>
212 212  
213   - <!-- <p ng-repeat="data in companyData.companyCustomContacts" ng-if="data.contactNumber != null">
214   - <i class="fa fa-phone" ng-hide="showEditContact"></i>
215   - <span ng-hide="showEditContact">{{data.contactNumber}} &nbsp;</span>
216   - <i ng-click="showEditContact = ! showEditContact" ng-hide="showEditContact" class="fa fa-pencil-square-o" aria-hidden="true"></i>
217   -
218   - <input type="tel" class="form-control" placeholder="min" ng-model="data.contactNumber" style="width: 50%;" ng-show="showEditContact">
219   - <span ng-show="showEditContact"></br></span>
220   - </p> -->
221 213 <p ng-repeat="data in companyData.companyCustomContacts" ng-if="data.contactNumber != null">
222 214 <i class="fa fa-phone" ng-hide="showEditContact"></i>
223 215 <span ng-hide="showEditContact">{{data.contactNumber}} &nbsp;</span>
224 216 <i ng-click="showContact(data, 'phone')" ng-hide="showEditContact" class="fa fa-pencil-square-o" aria-hidden="true"></i>
225 217  
226   - <!-- <input type="tel" class="form-control" placeholder="min" ng-model="data.contactNumber" style="width: 50%;" ng-show="showEditContact">
227   - <span ng-show="showEditContact"></br></span> -->
228 218 </p>
229 219 <p ng-repeat="data in companyData.companyCustomContacts" ng-if="data.email != null">
230 220 <i class="fa fa-envelope" ng-hide="showEditEmail"></i>
231 221 <span ng-hide="showEditEmail">{{data.email}} &nbsp;</span>
232 222 <i ng-click="showContact(data, 'email')" ng-hide="showEditEmail" class="fa fa-pencil-square-o" aria-hidden="true"></i>
233 223  
234   - <!-- <input type="tel" style="width: 50%;" class="form-control" placeholder="min" ng-model="data.email" ng-show="showEditEmail"> -->
235 224 </p>
236 225 </div>
237 226 <div class="new-add-select">
... ... @@ -332,7 +321,7 @@
332 321 </thead>
333 322 <tbody>
334 323 <tr ng-repeat="contact in companyContactList" style="cursor: pointer;" ui-sref="app.viewContact({id : contact.id})">
335   - <td><toggle ng-model="contact.priceEmail" size="customToogle"></toggle></td>
  324 + <td><toggle ng-model="contact.priceEmail" ng-change="changePriceEmail(contact.id, $index)" size="customToogle"></toggle></td>
336 325 <td>
337 326 {{contact.firstName}}
338 327 </td>
... ... @@ -372,7 +361,7 @@
372 361 <td>${{fuel.fuelPricing.papMargin}}</td>
373 362 <td style="color:#55AF8B;">${{fuel.fuelPricing.papTotal}}</td>
374 363 <td style="color:#F90">{{fuel.fuelPricing.expirationDate}}</td>
375   - </tr>.
  364 + </tr>
376 365 </tbody>
377 366 </table>
378 367 </div>
... ...
app/partials/viewFuelVendor/viewFuelVendor.controller.js
... ... @@ -4,16 +4,63 @@
4 4 //Load controller
5 5 angular.module('acufuel')
6 6  
7   - .controller('ViewFuelVendorController', ['$scope','$uibModal', '$stateParams', 'ViewFuelVendorService', 'CustomersService', function($scope , $uibModal, $stateParams, ViewFuelVendorService, CustomersService) {
  7 + .controller('ViewFuelVendorController', ['$scope','$uibModal', '$stateParams', 'ViewFuelVendorService', 'CustomersService', 'ViewCompanyService', 'updateFuelManagerService', function($scope , $uibModal, $stateParams, ViewFuelVendorService, CustomersService, ViewCompanyService, updateFuelManagerService) {
8 8 $scope.data = {};
9 9 $scope.data.priceEmail = true;
10   - $scope.aircraft = {};
  10 + $scope.primayData = {};
11 11 $scope.showLoader = false;
12   - var value = "";
  12 + $scope.showUpdateBtn = false;
  13 + $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId'));
  14 +
  15 + $(document).ready(function() {
  16 + $("#reset").click(function() {
  17 + $("input").val("");
  18 + });
  19 + });
  20 +
13 21 var vendorId = $stateParams.id;
14   - ViewFuelVendorService.getFuelOrder(vendorId).then(function(result) {
15   - $scope.vendorData = result;
16   - })
  22 + $scope.vendorData = {};
  23 + getVendorDetail();
  24 +
  25 + function getVendorDetail(){
  26 + ViewFuelVendorService.getFuelOrder(vendorId).then(function(result) {
  27 + $scope.vendorData = result;
  28 + if(result.margin != null){
  29 + $scope.vendorData.masterMargin = result.margin.id;
  30 + }
  31 + if(result.marginAVGAS != null){
  32 + $scope.vendorData.avgasMargin = result.marginAVGAS.id;
  33 + }
  34 + })
  35 + }
  36 +
  37 +
  38 + $scope.changeCompanyStatus = function(){
  39 + $('#deleteVendor').css('display', 'block');
  40 + if($scope.vendorData.activate == true){
  41 + $scope.statusMessage = 'Please confirm! Are you sure you want to ACTIVATE this company?'
  42 + }else{
  43 + $scope.statusMessage = 'Please confirm! Are you sure you want to DEACTIVATE this company?'
  44 + }
  45 + }
  46 +
  47 + $scope.companyStatus = function(){
  48 + var statusData = "status=" + $scope.vendorData.activate;
  49 + ViewFuelVendorService.changeStatus(vendorId, statusData).then(function(result) {
  50 + if(result.success){
  51 + $('#deleteVendor').css('display', 'none');
  52 + toastr.success(''+result.success+'', {
  53 + closeButton: true
  54 + })
  55 + getContactList();
  56 + }
  57 + })
  58 + }
  59 +
  60 + $scope.cancelStatus = function(){
  61 + $('#deleteVendor').css('display', 'none');
  62 + $scope.vendorData.activate = !$scope.vendorData.activate;
  63 + }
17 64  
18 65 getContactList();
19 66 function getContactList(){
... ... @@ -22,25 +69,17 @@
22 69 })
23 70 }
24 71  
25   - getAircraftList();
26   - function getAircraftList(){
27   - ViewFuelVendorService.getAircraft(vendorId).then(function(result) {
28   - $scope.contactAircraftList = result;
29   - })
30   - }
31   -
32   -
33 72 $scope.contactData = {};
34 73 $scope.contactData.contactList = [];
35 74 $scope.addContact = function(){
36   - $scope.data.vendorId = vendorId;
  75 + $scope.data.companyId = vendorId;
37 76 $scope.contactData.contactList.push($scope.data);
38 77 ViewFuelVendorService.addContact($scope.contactData).then(function(result) {
39   - if(result.success){
40   - toastr.success(''+result.success+'', {
41   - closeButton: true
42   - })
  78 + if(result.status == 200){
43 79 $('#contact-modal-3').modal('hide');
  80 + $scope.primayData.id = result.data;
  81 + $scope.sendPrimaryContact();
  82 + $scope.data = {};
44 83 getContactList();
45 84 }else{
46 85 toastr.error(''+result.statusText+'', {
... ... @@ -50,153 +89,250 @@
50 89 })
51 90 }
52 91  
53   - getData();
54   - function getData(){
55   - CustomersService.getAircraftMake().then(function(result) {
56   - $scope.aircraftMakeList = result;
57   - })
58   - }
59   -
60   - $scope.clearAircrafts = function(){
61   - $scope.aircraftDetails = [];
62   - $scope.aircraftDetails = [{
63   - 'tail':'',
64   - 'make': '',
65   - 'model': '',
66   - 'sizeId' : '',
67   - 'marginId': ''
68   - }];
69   - }
70   -
71   - $scope.addNew = function(){
72   - $scope.aircraftDetails.push({
73   - 'tail':'',
74   - 'make': '',
75   - 'model': '',
76   - 'sizeId' : ''
77   - });
78   - console.log($scope.aircraftDetails)
79   - };
80   -
81   - $scope.getModal = function(makeId, index){
82   - $scope.showLoader = true;
83   - $scope.aircraft.make = makeId;
84   - //var makeId = makeId;
85   - CustomersService.getModal($scope.aircraft.make).then(function(result) {
86   - $scope.showLoader = false;
87   - $scope.aircraftDetails[index].aircraftModalList = result;
88   - //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0];
89   - })
90   - }
91   -
92   - $scope.getSize = function(model, index){
93   - $scope.showLoader = true;
94   - CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) {
95   - $scope.showLoader = false;
96   - $scope.aircraftDetails[index].aircraftSizeList = result;
97   - //$scope.aircraftDetails[index].size = $scope.aircraftSizeList[0];
98   - })
99   - }
100   -
101   - $scope.aircraftListData = {};
102   - //$scope.addData = [];
103   - $scope.saveVendorData = function(){
104   - $scope.addData = [];
105   - for(var i=0; i<$scope.aircraftDetails.length;i++){
106   - $scope.addData.push({
107   - 'tail': $scope.aircraftDetails[i].tail,
108   - 'make': $scope.aircraftDetails[i].make,
109   - 'model': $scope.aircraftDetails[i].model,
110   - 'sizeId' : $scope.aircraftDetails[i].sizeId
111   - });
  92 + $scope.showNoteData = true;
  93 + $scope.showCompanyName = true;
  94 + $scope.showAddress = true;
  95 + $scope.showNote = function(){
  96 + $scope.showNoteData = false;
  97 + $scope.showUpdateBtn = true;
112 98 }
113   - console.log($scope.addData)
114   - $scope.aircraftListData.aircraftList = $scope.addData;
115   - $scope.aircraftListData.accountId = vendorId;
116   -
117   - CustomersService.addAircraft($scope.aircraftListData).then(function(result) {
118   - if(result != null && result.success){
119   - toastr.success(''+result.success+'', {
120   - closeButton: true
121   - })
122   - $('#aircraft-modal-3').modal('hide');
123   - getAircraftList();
124   - }else{
125   - toastr.error(''+result.statusText+'', {
126   - closeButton: true
127   - })
128   - }
129   - });
130   -
131   - }
132   - $scope.showNoteData = true;
133   - $scope.showCompanyName = true;
134   - $scope.showAddress = true;
135   - $scope.showNote = function(){
136   - $scope.showNoteData = false;
137   - }
138   -
139   - $scope.company = function(){
140   - $scope.showCompanyName = false;
141   - }
142   -
143   - $scope.addressChange = function(){
144   - $scope.showAddress = false;
145   - }
146   -
147   - $scope.editData = function(inputName) {
148   - console.log($scope.vendorData)
149   - if(inputName == 'showNoteData'){
  99 +
  100 + $scope.company = function(){
  101 + $scope.showCompanyName = false;
  102 + $scope.showUpdateBtn = true;
  103 + }
  104 +
  105 + $scope.addressChange = function(){
  106 + $scope.showAddress = false;
  107 + $scope.showUpdateBtn = true;
  108 + }
  109 +
  110 + $scope.editData = function(inputName) {
  111 + console.log($scope.vendorData)
  112 + $scope.showLoader = true;
  113 + // if(inputName == 'showNoteData'){
  114 + // $scope.showNoteData = true;
  115 + // }else if(inputName == 'showCompanyName'){
  116 + // $scope.showCompanyName = true;
  117 + // }else if(inputName == 'showAddress'){
  118 + // $scope.showAddress = true;
  119 + // }
  120 + $scope.showNoteData = true;
  121 + $scope.showCompanyName = true;
  122 + $scope.showAddress = true;
  123 +
  124 + var vendorData = "vendorName=" + $scope.vendorData.vendorName + "&masterMargin=" + $scope.vendorData.masterMargin
  125 + + "&addressOne=" + $scope.vendorData.addressOne + "&addressTwo=" + $scope.vendorData.addressTwo + "&city=" + $scope.vendorData.city + "&state="
  126 + + $scope.vendorData.state + "&country=" + $scope.vendorData.country + "&zipcode=" + $scope.vendorData.zipcode + "&internalNote="
  127 + + $scope.vendorData.internalNote + "&certificateType=" + $scope.vendorData.certificateType + "&baseTenant=" + $scope.vendorData.baseTenant
  128 + + "&fuelerlinxCustomer=" + $scope.vendorData.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.vendorData.contractFuelVendor
  129 + + "&activate=" + $scope.vendorData.activate + "&baseIcao=" + $scope.vendorData.baseIcao + "&vendorId=" + vendorId;
  130 +
  131 + ViewFuelVendorService.updateContact(vendorData).then(function(result) {
  132 + if(result != null && result.success){
  133 + toastr.success(''+result.success+'', {
  134 + closeButton: true
  135 + })
  136 + $scope.showUpdateBtn = false;
  137 + }else{
  138 + toastr.error(''+result.statusText+'', {
  139 + closeButton: true
  140 + })
  141 + $scope.showUpdateBtn = true;
  142 + }
  143 + $scope.showLoader = false;
  144 + })
  145 +
  146 + }
  147 +
  148 + $scope.cancelData = function(){
150 149 $scope.showNoteData = true;
151   - }else if(inputName == 'showCompanyName'){
152 150 $scope.showCompanyName = true;
153   - }else if(inputName == 'showAddress'){
154   - $scope.showAddress = true;
  151 + $scope.showAddress = true;
  152 + $scope.showUpdateBtn = false;
  153 + }
  154 +
  155 + $scope.sendMail = function(){
  156 + $('#confirm2').css('display', 'none');
  157 + ViewFuelVendorService.sendMail(vendorId).then(function(result) {
  158 + if(result != null && result.success){
  159 + toastr.success(''+result.success+'', {
  160 + closeButton: true
  161 + })
  162 + }else{
  163 + toastr.error(''+result.statusText+'', {
  164 + closeButton: true
  165 + })
  166 + }
  167 + })
  168 + }
  169 +
  170 + $scope.openConfirmMail = function(){
  171 + $('#confirm2').css('display', 'block');
  172 + }
  173 +
  174 +
  175 + $scope.cancelAndCloseConfirm = function(){
  176 + $('#confirm2').css('display', 'none');
  177 + }
  178 +
  179 + $scope.primaryContact = false;
  180 + $scope.cancelPrimaryContact = function(){
  181 + $('#primaryContact').css('display', 'none');
  182 + $scope.primaryContact = false;
  183 + }
  184 +
  185 + $scope.checkPrimaryContact = function(){
  186 + if($scope.primaryContact == true){
  187 + $scope.primaryContact = true;
  188 + ViewFuelVendorService.checkPrimaryContact(vendorId).then(function(result) {
  189 + console.log(result)
  190 + if(result.status == 422){
  191 + $('#primaryContact').css('display', 'block');
  192 + }
  193 + })
  194 + }
  195 + }
  196 +
  197 + $scope.sendPrimaryContact = function(){
  198 + $('#primaryContact').css('display', 'none');
  199 + if($scope.primayData.id != null || $scope.primayData.id != undefined){
  200 + var priamryContactData = "vendorContactId=" + $scope.primayData.id + "&primary=" + $scope.primaryContact;
  201 +
  202 + ViewFuelVendorService.addPrimaryContact(priamryContactData).then(function(result) {
  203 + console.log(result)
  204 + })
155 205 }
  206 +
  207 + }
156 208  
157   - var vendorData = "vendorName=" + $scope.vendorData.vendorName + "&masterMargin=" + $scope.vendorData.masterMargin
158   - + "&addressOne=" + $scope.vendorData.addressOne + "&addressTwo=" + $scope.vendorData.addressTwo + "&city=" + $scope.vendorData.city + "&state="
159   - + $scope.vendorData.state + "&country=" + $scope.vendorData.country + "&zipcode=" + $scope.vendorData.zipcode + "&internalNote="
160   - + $scope.vendorData.internalNote + "&certificateType=" + $scope.vendorData.certificateType + "&baseTenant=" + $scope.vendorData.baseTenant
161   - + "&fuelerlinxCustomer=" + $scope.vendorData.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.vendorData.contractFuelVendor
162   - + "&activate=" + $scope.vendorData.activate + "&baseIcao=" + $scope.vendorData.baseIcao + "&vendorId=" + vendorId;
163   -
164   - ViewFuelVendorService.updateContact(vendorData).then(function(result) {
165   - if(result != null && result.success){
166   - toastr.success(''+result.success+'', {
167   - closeButton: true
168   - })
  209 + var newContactName = "";
  210 + $scope.updateData = ""
  211 + $scope.showContact = function(data, value){
  212 + $('#updateContact').css('display', 'block');
  213 + $scope.updateData = data;
  214 + newContactName = value;
  215 + console.log($scope.updateData)
  216 + if($scope.updateData.email == null){
  217 + $scope.updateData.content = data.contactNumber;
  218 + }else{
  219 + $scope.updateData.content = data.email;
  220 + }
  221 + }
  222 +
  223 + $scope.acceptUpdateField = function(){
  224 + console.log($scope.updateData)
  225 + if($scope.updateData.content == undefined){
  226 + toastr.error('Please add some content', {
  227 + closeButton: true
  228 + })
  229 + }else{
  230 + if(newContactName == 'phone'){
  231 + var updateCustomData = "vendorId=" + vendorId + "&contactNumber=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id
  232 + + "&title=" + $scope.updateData.title;
169 233 }else{
170   - toastr.error(''+result.statusText+'', {
171   - closeButton: true
172   - })
  234 + var updateCustomData = "vendorId=" + vendorId + "&email=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id
  235 + + "&title=" + $scope.updateData.title;
173 236 }
174   - })
175   -
176   - }
177   -
178   - $scope.sendMail = function(){
179   - ViewFuelVendorService.sendMail(vendorId).then(function(result) {
180   - if(result != null && result.success){
181   - toastr.success(''+result.success+'', {
182   - closeButton: true
183   - })
  237 + ViewFuelVendorService.updateCustomField(updateCustomData).then(function(result) {
  238 + console.log(result)
  239 + if(result != null && result.success){
  240 + $('#updateContact').css('display', 'none');
  241 + getVendorDetail();
  242 + }
  243 + })
  244 + }
  245 + }
  246 +
  247 + $scope.cancelUpdateField = function(){
  248 + $('#updateContact').css('display', 'none');
  249 + }
  250 +
  251 + $scope.showEditTier2 = function(number){
  252 + console.log(number)
  253 + $scope.contactNumber = number;
  254 + }
  255 +
  256 +
  257 +
  258 + var contactName = '';
  259 + $scope.addCustom = function(value){
  260 + console.log(value)
  261 + if(value != null){
  262 + contactName = value;
  263 + $('#customField').css('display', 'block');
  264 + }
  265 + $scope.custom = {};
  266 + }
  267 +
  268 + $scope.cancelCustomField = function(){
  269 + $('#customField').css('display', 'none');
  270 + }
  271 +
  272 + $scope.acceptCustomField = function(){
  273 + if($scope.custom.content == undefined){
  274 + toastr.error('Please add some content', {
  275 + closeButton: true
  276 + })
  277 + }else{
  278 + if(contactName == 'phone'){
  279 + var customData = "vendorId=" + vendorId + "&contactNumber=" + $scope.custom.content
  280 + + "&title=" + $scope.custom.title;
184 281 }else{
185   - toastr.error(''+result.statusText+'', {
186   - closeButton: true
187   - })
  282 + var customData = "vendorId=" + vendorId + "&email=" + $scope.custom.content
  283 + + "&title=" + $scope.custom.title;
  284 + }
  285 + ViewFuelVendorService.addCustomField(customData).then(function(result) {
  286 + console.log(result)
  287 + if(result.status == 200){
  288 + $('#customField').css('display', 'none');
  289 + getVendorDetail();
  290 + }
  291 + })
  292 + }
  293 + }
  294 +
  295 + updateFuelManagerService.getFuelPricingNew().then(function(result) {
  296 + $scope.fuelPricing = result;
  297 + for (var i = 0; i<$scope.fuelPricing.length; i++) {
  298 + if ($scope.fuelPricing[i].fuelPricing.expirationDate != null) {
  299 + $scope.fuelPricing[i].fuelPricing.expirationDate = new Date($scope.fuelPricing[i].fuelPricing.expirationDate);
  300 + var newTime = new Date($scope.fuelPricing[i].fuelPricing.expirationDate);
  301 + var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
  302 + var dday = newTime.getUTCDate();
  303 + var dyear = newTime.getUTCFullYear();
  304 + $scope.fuelPricing[i].fuelPricing.expirationDate = dmonth+'/'+dday+'/'+dyear;
188 305 }
  306 + }
189 307 })
190   - }
191 308  
  309 +
  310 + CustomersService.getJetMargin($scope.userProfileId).then(function(result) {
  311 + $scope.jetMarginList = result;
  312 + })
192 313  
193   - $scope.openConfirmMail = function(){
194   - $('#confirm2').css('display', 'block');
195   - }
  314 + CustomersService.getAvgMargin($scope.userProfileId).then(function(result) {
  315 + $scope.avgsMarginList = result;
  316 + })
196 317  
  318 + $scope.changePriceEmail = function(id, index){
  319 + event.stopPropagation();
  320 + var contactId = id;
  321 + var statusData = "status=" + $scope.vendorContactList[index].priceEmail;
  322 + ViewFuelVendorService.changePriceEmail(contactId, statusData).then(function(result) {
  323 + if(result.success){
  324 + $('#toogleMail').css('display', 'block');
  325 + if($scope.vendorContactList[index].priceEmail == true){
  326 + $scope.messageText = 'You have enabled price distribution for this contact';
  327 + }else{
  328 + $scope.messageText = 'You have disabled price distribution for this contact';
  329 + }
  330 + }
  331 + })
  332 + }
197 333  
198   - $scope.cancelAndCloseConfirm = function(){
199   - $('#confirm2').css('display', 'none');
200   - }
  334 + $scope.cancelToogle = function(){
  335 + $('#toogleMail').css('display', 'none');
  336 + }
201 337  
202 338 }]);
203 339 \ No newline at end of file
... ...
app/partials/viewFuelVendor/viewFuelVendor.html
... ... @@ -118,13 +118,17 @@
118 118 }
119 119  
120 120 </style>
121   -<div class="col-xs-12 col-md-11">
  121 +<div class="myLoader" ng-show="showLoader">
  122 + <img src="../img/hourglass.gif" width="50px;">
  123 +</div>
  124 +
  125 +<div class="col-xs-12 col-md-12">
122 126 <div class="row" style="margin-left:0px">
123 127 <div class="col-md-12">
124 128 <div class="widget">
125 129 <div class="widget-header">
126 130 <i class="fa fa-building-o" aria-hidden="true"></i>
127   - <h3>{{vendorData.vendorName}}</h3>
  131 + <h3>{{vendorData.vendorName}} <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteVendor(vendorData.id)" aria-hidden="true"></i></h3>
128 132 <i class="fa fa-times timess" ui-sref="app.customers" aria-hidden="true"></i>
129 133 </div>
130 134 <!-- /widget-header -->
... ... @@ -145,17 +149,14 @@
145 149 <h4 ng-show="showCompanyName" ng-if="vendorData.vendorName != 'undefined'">
146 150 <b style="color:#F90;">{{vendorData.vendorName}}</b> &nbsp;<i class="fa fa-pencil-square-o" ng-click="company()" style="font-size: 14px;" aria-hidden="true"></i>
147 151 </h4>
148   - <input type="tel" ng-hide="showCompanyName" ng-model="vendorData.vendorName" class="form-control" ng-blur="editData('showCompanyName')"/>
  152 + <input type="tel" ng-hide="showCompanyName" ng-model="vendorData.vendorName" class="form-control">
149 153 </div>
150 154 </div>
151 155 <div>
152 156 <p class="new-label">
153 157 <span>Master Margin Setting </span>
154   - <select class="form-control" style="width: 135px;padding: 4px 8px;" ng-model="vendorData.masterMargin" ng-change="editData()">
155   - <option value="margin1">Margin1</option>
156   - <option value="margin2">Margin2</option>
157   - <option value="vendorsonly">Vendors Only</option>
158   - <option value="margintenants">Margin Tenants</option>
  158 + <select class="form-control" style="width: 135px;padding: 4px 8px;" ng-change="editData()" ng-model="vendorData.masterMargin">
  159 + <option ng-repeat="margin in jetMarginList" value="{{margin.id}}">{{margin.marginName}}</option>
159 160 </select>
160 161 <span>&nbsp;$1.7500</span>
161 162 <div class="clearfix"></div>
... ... @@ -164,37 +165,49 @@
164 165  
165 166 </br>
166 167 <div class="new-address">
167   - <p ng-show="showAddress"><i class="fa fa-map-marker"></i>
168   - <span ng-if="vendorData.addressOne != 'undefined'">{{vendorData.addressOne}} </span>
169   - <span ng-if="vendorData.addressTwo != 'undefined'">{{vendorData.addressTwo}} </span>
170   - &nbsp;<i class="fa fa-pencil-square-o" ng-click="addressChange()" aria-hidden="true"></i> </p>
  168 +
  169 + <p ng-show="showAddress"><i class="fa fa-map-marker"></i> {{vendorData.addressOne}} {{vendorData.addressTwo}} &nbsp;<i class="fa fa-pencil-square-o" ng-click="addressChange()" aria-hidden="true"></i> </p>
171 170  
172   - <div ng-hide="showAddress">
173   - <label>Address1</label>
174   - <input type="tel" ng-hide="showAddress" ng-model="vendorData.addressOne" class="form-control" ng-blur="editData('showAddress')"/>
175   - <label>Address2</label>
176   - <input type="tel" ng-hide="showAddress" ng-model="vendorData.addressTwo" class="form-control" ng-blur="editData('showAddress')"/>
177   - </div>
  171 + <div ng-hide="showAddress">
  172 + <label>Address1</label>
  173 + <input type="tel" style="width: 50%;" ng-hide="showAddress" ng-model="vendorData.addressOne" class="form-control" />
  174 + <label>Address2</label>
  175 + <input type="tel" style="width: 50%;" ng-hide="showAddress" ng-model="vendorData.addressTwo" class="form-control" />
  176 + </div>
  177 +
  178 + <p ng-repeat="data in vendorData.vendorCustomContacts" ng-if="data.contactNumber != null">
  179 + <i class="fa fa-phone" ng-hide="showEditContact"></i>
  180 + <span ng-hide="showEditContact">{{data.contactNumber}} &nbsp;</span>
  181 + <i ng-click="showContact(data, 'phone')" ng-hide="showEditContact" class="fa fa-pencil-square-o" aria-hidden="true"></i>
178 182  
179   - <p><i class="fa fa-phone"></i> (310) 2342-3433 &nbsp;<i class="fa fa-pencil-square-o" aria-hidden="true"></i></p>
180   - <p><i class="fa fa-envelope"></i> freed@gmail.com &nbsp;<i class="fa fa-pencil-square-o" aria-hidden="true"></i></p>
  183 + </p>
  184 + <p ng-repeat="data in vendorData.vendorCustomContacts" ng-if="data.email != null">
  185 + <i class="fa fa-envelope" ng-hide="showEditEmail"></i>
  186 + <span ng-hide="showEditEmail">{{data.email}} &nbsp;</span>
  187 + <i ng-click="showContact(data, 'email')" ng-hide="showEditEmail" class="fa fa-pencil-square-o" aria-hidden="true"></i>
  188 +
  189 + </p>
181 190 </div>
182 191 <div class="new-add-select">
183   - <select class="form-control" style="background: #ebebeb;padding: 4px 8px;width: 115px;">
184   - <option disabled selected>Add Field</option>
185   - <option class="optionclass">Add Phone</option>
186   - <option class="optionclass">Add Email</option>
  192 + <select class="form-control" ng-model="value" ng-click="addCustom(value)" style="background: #ebebeb;padding: 4px 8px;width: 115px;">
  193 + <option value="" disabled selected>Add Field</option>
  194 + <option value="phone" class="optionclass">Add Phone</option>
  195 + <option value="email" class="optionclass">Add Email</option>
187 196 </select>
188 197 </div>
189 198 <div>
190   - <p style="margin-bottom: 0;"><b>Company Notes</b> &nbsp;<i class="fa fa-pencil-square-o" ng-click="showNote()" aria-hidden="true"></i></p>
191   - <p ng-show="showNoteData" ng-if="vendorData.internalNote != 'undefined'">{{vendorData.internalNote}}</p>
192   - <textarea name="message" ng-hide="showNoteData" style="margin-bottom: 6px;" class="form-control" ng-model="vendorData.internalNote" ng-blur="editData('showNoteData')" rows="4" cols="34"></textarea>
  199 + <p style="margin-bottom: 0;"><b>Company Notes</b> &nbsp;<i class="fa fa-pencil-square-o" ng-click="showNote()" aria-hidden="true"></i></p>
  200 + <p ng-show="showNoteData">{{vendorData.internalNote}}</p>
  201 + <textarea name="message" ng-hide="showNoteData" style="margin-bottom: 6px;" class="form-control" ng-model="vendorData.internalNote" rows="4" cols="34"></textarea>
193 202 </div>
194   - <div class="dis">
195   - <button type="button" ng-click="openConfirmMail()" class="btn btn-primary">Distribute Price to Company Contacts</button>
  203 + <div class="pull-left">
  204 + <button ng-click="editData()" ng-show="showUpdateBtn" class="btn btn-success">Save</button>
  205 + <button ng-click="cancelData()" ng-show="showUpdateBtn" class="btn btn-default">Cancel</button>
196 206 </div>
197   - <div><button type="button" class="btn btn-info">Setup Fuel</button></div>
  207 + <div class="pull-right">
  208 + <button type="button" ng-click="openConfirmMail()" class="btn btn-primary">Distribute Price to Company Contacts</button>
  209 + </div>
  210 + <div class="clearfix"></div>
198 211 </div>
199 212 </div>
200 213 </div>
... ... @@ -218,38 +231,13 @@
218 231 </tr>
219 232 </thead>
220 233 <tbody>
221   - <tr>
222   - <td><input type="checkbox"></td>
223   - <td>Jet-A Full Service</td>
224   - <td>$2.123</td>
225   - <td>$23000</td>
226   - <td style="color:#55AF8B;">$3659</td>
227   - <td style="color:#F90">3/15/2017</td>
228   - </tr>
229   - <tr>
230   - <td><input type="checkbox"></td>
231   - <td>Jet-A Full Service</td>
232   - <td>$2.123</td>
233   - <td>$23000</td>
234   - <td style="color:#55AF8B;">$3659</td>
235   - <td style="color:#F90">3/15/2017</td>
236   - </tr>
237   - <tr>
238   - <tr>
239   - <td><input type="checkbox"></td>
240   - <td>Jet-A Full Service</td>
241   - <td>$2.123</td>
242   - <td>$23000</td>
243   - <td style="color:#55AF8B;">$3659</td>
244   - <td style="color:#F90">3/15/2017</td>
245   - </tr>
246   - <tr>
247   - <td><input type="checkbox"></td>
248   - <td>Jet-A Full Service</td>
249   - <td>$2.123</td>
250   - <td>$23000</td>
251   - <td style="color:#55AF8B;">$3659</td>
252   - <td style="color:#F90">3/15/2017</td>
  234 + <tr ng-repeat="fuel in fuelPricing">
  235 + <td><input type="checkbox" ng-model="fuel.status"></td>
  236 + <td>{{fuel.name}}</td>
  237 + <td>${{fuel.fuelPricing.cost}}</td>
  238 + <td>${{fuel.fuelPricing.papMargin}}</td>
  239 + <td style="color:#55AF8B;">${{fuel.fuelPricing.papTotal}}</td>
  240 + <td style="color:#F90">{{fuel.fuelPricing.expirationDate}}</td>
253 241 </tr>
254 242 </tbody>
255 243 </table>
... ... @@ -280,13 +268,9 @@
280 268 </tr>
281 269 </thead>
282 270 <tbody>
283   - <tr ng-repeat="contact in vendorContactList">
  271 + <tr ng-repeat="contact in vendorContactList" style="cursor: pointer;" ui-sref="app.viewVendorContact({id : contact.id})">
284 272 <td><toggle ng-model="contact.priceEmail" ng-change="changePriceEmail(contact.id, $index)"></toggle></td>
285   - <td>
286   - <a href="#!/viewContact/{{contact.id}}">
287   - {{contact.firstName}}
288   - </a>
289   - </td>
  273 + <td>{{contact.firstName}}</td>
290 274 <td>{{contact.lastName}}</td>
291 275 <td>{{contact.title}}</td>
292 276 </tr>
... ... @@ -436,7 +420,7 @@
436 420 <div class="col-md-3">
437 421 <div class="pull-left my-toggle-switch">
438 422 <div style="color: #ff9a01;">Primary Contact &nbsp &nbsp
439   - <input type="checkbox" ng-model="data.primaryContact">
  423 + <input type="checkbox" ng-click="checkPrimaryContact()" ng-model="primaryContact">
440 424 </div>
441 425 </div>
442 426 <div class="clearfix"></div>
... ... @@ -460,7 +444,7 @@
460 444 </div>
461 445 </div>
462 446 <div class="modal-footer" style="border-top: 0;">
463   - <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  447 + <button type="button" class="btn btn-default" id="reset" data-dismiss="modal">Cancel</button>
464 448 <button type="button" class="btn btn-primary step step-1" data-step="1" ng-click="addContact()">Save</button>
465 449 </div>
466 450 </div>
... ... @@ -468,88 +452,6 @@
468 452 </form>
469 453 <div class="clearfix"></div>
470 454  
471   -<form class="modal multi-step" id="aircraft-modal-3" name="aircraftForm">
472   - <div class="modal-dialog modal-lg">
473   - <div class="modal-content">
474   - <div class="modal-body step-2" data-step="2" style="padding: 0;">
475   - <div>
476   - <div class="row" style="margin: 0;">
477   - <div>
478   - <div class="widget" style="margin-bottom: 0;box-shadow: none;">
479   - <div class="widget-header">
480   - <i class="icon-pencil"></i>
481   - <i class="fa fa-tasks" aria-hidden="true"></i>
482   - <h3>Add a New Aircraft</h3>
483   - <div class="clearfix"></div>
484   - </div>
485   - <div class="widget-content" style="padding-left: 0; padding-right: 0; border-bottom: 0;">
486   - <div class="col-xs-12">
487   - <div class="widget-header">
488   - <i class="fa fa-list"></i>
489   - <h3>Aircraft List</h3>
490   - </div>
491   - <div class="widget-content" style="padding:0px;border: 0px; padding: 0px !important;">
492   - <div class="table-responsive">
493   - <table class="table table-striped table-bordered">
494   - <thead>
495   - <tr>
496   - <!-- <th><input type="checkbox" ng-model="selectedAll" ng-click="checkAll()" /></th> -->
497   - <th>Tail</th>
498   - <th>Make</th>
499   - <th>Model</th>
500   - <th>Size</th>
501   - </tr>
502   - </thead>
503   - <tbody>
504   - <tr ng-repeat="aircraftData in aircraftDetails track by $index">
505   - <!-- <td>
506   - <input type="checkbox" ng-model="aircraftData.selected"/>
507   - </td> -->
508   - <td style="width: 20%">
509   - <input type="tel" class="form-control" ng-model="aircraftData.tail" required/>
510   - </td>
511   - <td style="width: 20%">
512   - <select class="form-control" ng-model="aircraftData.make" ng-change="getModal(aircraftData.make, $index)">
513   - <option ng-repeat="make in aircraftMakeList">{{make}}</option>
514   - </select>
515   - </td>
516   - <td style="width: 20%">
517   - <select class="form-control" ng-model="aircraftData.model" ng-change="getSize(aircraftData.model, $index)">
518   - <option ng-repeat="model in aircraftData.aircraftModalList">{{model}}</option>
519   - </select>
520   - </td>
521   - <td style="width: 20%">
522   - <select class="form-control" ng-model="aircraftData.sizeId" ng-options="size.aircraftSize.id as size.aircraftSize.size for size in aircraftData.aircraftSizeList"></select>
523   - <!-- <select class="form-control" ng-model="aircraftData.size">
524   - <option ng-repeat="size in aircraftData.aircraftSizeList">{{size}}</option>
525   - </select> -->
526   - </td>
527   - </tr>
528   - </tbody>
529   - </table>
530   - </div>
531   - <div class="clearfix"></div>
532   - </div>
533   - </div>
534   - <div class="clearfix"></div>
535   - <div class="col-xs-12" style="margin-bottom: 50px;margin-top: 10px;">
536   - <button ng-click="addNew()" class="button1 turquoise pull-right"><span>+</span>Add Aircraft</button>
537   - </div>
538   - </div>
539   - </div>
540   - <div class="clearfix"></div>
541   - </div>
542   - </div>
543   - </div>
544   - </div>
545   - <div class="modal-footer" style="border-top: 0;">
546   - <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
547   - <button type="button" class="btn btn-primary step step-1" data-step="1" ng-click="saveVendorData()">Save</button>
548   - </div>
549   - </div>
550   - </div>
551   -</form>
552   -
553 455 <div class="customConfirmPopBackdrop" id="confirm2">
554 456 <div class="customModalInner" style="max-width: 400px;">
555 457 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
... ... @@ -570,6 +472,90 @@
570 472 </div>
571 473 </div>
572 474 </div>
  475 +
  476 +<div class="customConfirmPopBackdrop" id="deleteVendor">
  477 + <div class="customModalInner" style="max-width: 400px;">
  478 + <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
  479 + <table>
  480 + <tr>
  481 + <td>
  482 + <img src="img/info.png" style="width: 50px;">
  483 + </td>
  484 + <td>
  485 + <p style="padding: 5px 10px; margin-bottom: 0;">{{statusMessage}}</p>
  486 + </td>
  487 + </tr>
  488 + </table>
  489 + </div>
  490 + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
  491 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="companyStatus()">Accept</button>
  492 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelStatus()">Cancel</button>
  493 + </div>
  494 + </div>
  495 +</div>
  496 +
  497 +<div class="customConfirmPopBackdrop" id="customField">
  498 + <div class="customModalInner" style="max-width: 400px;">
  499 + <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
  500 + <div class="col-md-2"><img class="src-image" src="img/images.jpg"></div>
  501 + <div class="col-md-10">
  502 + <form>
  503 + Title:<br>
  504 + <input type="text" name="firstname" ng-model="custom.title"><br>
  505 + Content:<br>
  506 + <input type="text" name="lastname" ng-model="custom.content">
  507 + </form>
  508 + </div>
  509 + <div class="clearfix"></div>
  510 + </div>
  511 + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
  512 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="acceptCustomField()">Accept</button>
  513 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelCustomField()">Cancel</button>
  514 + </div>
  515 + </div>
  516 +</div>
  517 +
  518 +<div class="customConfirmPopBackdrop" id="toogleMail">
  519 + <div class="customModalInner" style="max-width: 400px;">
  520 + <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
  521 + <table>
  522 + <tr>
  523 + <!-- <td>
  524 + <img src="" style="width: 50px;">
  525 + </td> -->
  526 + <td>
  527 + <p style="padding: 5px 10px; margin-bottom: 0;text-align: center;">{{messageText}}</p>
  528 + </td>
  529 + </tr>
  530 + </table>
  531 + </div>
  532 + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
  533 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelToogle()">Cancel</button>
  534 + </div>
  535 + </div>
  536 +</div>
  537 +
  538 +<div class="customConfirmPopBackdrop" id="updateContact">
  539 + <div class="customModalInner" style="max-width: 400px;">
  540 + <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
  541 + <div class="col-md-2"><img class="src-image" src="img/images.jpg"></div>
  542 + <div class="col-md-10">
  543 + <form>
  544 + Title:<br>
  545 + <input type="text" name="firstname" ng-model="updateData.title"><br>
  546 + Content:<br>
  547 + <input type="text" name="lastname" ng-model="updateData.content">
  548 + </form>
  549 + </div>
  550 + <div class="clearfix"></div>
  551 + </div>
  552 + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
  553 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="acceptUpdateField()">Accept</button>
  554 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelUpdateField()">Cancel</button>
  555 + </div>
  556 + </div>
  557 +</div>
  558 +
573 559 <!-- Le javascript
574 560 ================================================== -->
575 561 <!-- Placed at the end of the document so the pages load faster -->
... ...
app/partials/viewFuelVendor/viewFuelVendor.service.js
... ... @@ -37,12 +37,58 @@
37 37 return deferred.promise;
38 38 }
39 39  
40   - this.addContact = function(data) {
  40 + this.updateCustomField = function(data){
  41 + var deferred = $q.defer();
  42 + $http({
  43 + method : 'PUT',
  44 + url : BASE_URL.url +'/vendor/custom/contacts',
  45 + data : data,
  46 + headers : {'Content-Type': 'application/json'},
  47 + })
  48 + .then(function (result){
  49 + deferred.resolve(result.data);
  50 + },function (result){
  51 + deferred.resolve(result.data);
  52 + })
  53 + return deferred.promise;
  54 + }
  55 +
  56 + this.checkPrimaryContact = function(id){
  57 + var deferred = $q.defer();
  58 + $http({
  59 + method : 'GET',
  60 + url : BASE_URL.url +'/vendor/contact/check/primaryContact/'+id,
  61 + headers : {'Content-Type': 'application/json'},
  62 + })
  63 + .then(function (result){
  64 + deferred.resolve(result);
  65 + },function (result){
  66 + deferred.resolve(result);
  67 + })
  68 + return deferred.promise;
  69 + }
41 70  
  71 + this.addPrimaryContact = function(data){
42 72 var deferred = $q.defer();
43 73 $http({
44 74 method : 'POST',
45   - url : BASE_URL.url +'/vendor/contact',
  75 + url : BASE_URL.url +'/vendor/contact/createPrimaryContact',
  76 + data : data,
  77 + headers : {'Content-Type': 'application/json'},
  78 + })
  79 + .then(function (result){
  80 + deferred.resolve(result.data);
  81 + },function (result){
  82 + deferred.resolve(result.data);
  83 + })
  84 + return deferred.promise;
  85 + }
  86 +
  87 + this.changeStatus = function(vendorId, data){
  88 + var deferred = $q.defer();
  89 + $http({
  90 + method : 'PUT',
  91 + url : BASE_URL.url +'/vendor/status/'+vendorId,
46 92 data : data,
47 93 headers : {'Content-Type': 'application/json'},
48 94 })
... ... @@ -54,12 +100,45 @@
54 100 return deferred.promise;
55 101 }
56 102  
  103 + this.addCustomField = function(data){
  104 + var deferred = $q.defer();
  105 + $http({
  106 + method : 'POST',
  107 + url : BASE_URL.url +'/vendor/custom/contacts',
  108 + data : data,
  109 + headers : {'Content-Type': 'application/json'},
  110 + })
  111 + .then(function (result){
  112 + deferred.resolve(result);
  113 + },function (result){
  114 + deferred.resolve(result);
  115 + })
  116 + return deferred.promise;
  117 + }
  118 +
  119 + this.addContact = function(data) {
  120 +
  121 + var deferred = $q.defer();
  122 + $http({
  123 + method : 'POST',
  124 + url : BASE_URL.url +'/vendor/contact',
  125 + data : data,
  126 + headers : {'Content-Type': 'application/json'},
  127 + })
  128 + .then(function (result){
  129 + deferred.resolve(result);
  130 + },function (result){
  131 + deferred.resolve(result);
  132 + })
  133 + return deferred.promise;
  134 + }
  135 +
57 136 this.sendMail = function(id) {
58 137  
59 138 var deferred = $q.defer();
60 139 $http({
61 140 method : 'POST',
62   - url : BASE_URL.url +'/mailPriceToContacts/'+id,
  141 + url : BASE_URL.url +'/vendor/mailPriceToContacts/'+id,
63 142 headers : {'Content-Type': 'application/json'},
64 143 })
65 144 .then(function (result){
... ... @@ -102,6 +181,22 @@
102 181 })
103 182 return deferred.promise;
104 183 }
  184 +
  185 + this.changePriceEmail = function(contactId, data) {
  186 + var deferred = $q.defer();
  187 + $http({
  188 + method : 'PUT',
  189 + url : BASE_URL.url +'/vendor/contact/status/'+ contactId,
  190 + data : data,
  191 + headers : {'Content-Type': 'application/json'},
  192 + })
  193 + .then(function (result){
  194 + deferred.resolve(result.data);
  195 + },function (result){
  196 + deferred.resolve(result.data);
  197 + })
  198 + return deferred.promise;
  199 + }
105 200  
106 201 }
107 202  
... ...
app/partials/viewVendorContact/viewVendorContact.Controller.js
... ... @@ -0,0 +1,222 @@
  1 +'use strict';
  2 +
  3 + //Load controller
  4 + angular.module('acufuel')
  5 +
  6 + .controller('viewVendorContactController', ['$scope', '$stateParams', '$state', 'ViewvendorContactService', 'ViewFuelVendorService', function($scope, $stateParams, $state, ViewvendorContactService, ViewFuelVendorService) {
  7 + $scope.showLoader = true;
  8 + $scope.showUpdateBtn = false;
  9 + var contactId = $stateParams.id;
  10 + $scope.contactDetail = {};
  11 + var contactCompanyId = "";
  12 + ViewvendorContactService.getContact(contactId).then(function(result) {
  13 + $scope.contactDetail = result;
  14 + $scope.showLoader = false;
  15 + contactCompanyId = result.owner.id;
  16 + })
  17 +
  18 + $scope.contactIdList = {};
  19 + var index;
  20 + var one = 1;
  21 + var selectedId;
  22 +
  23 + ViewvendorContactService.getContactsList(contactId).then(function(list){
  24 + $scope.contactIdList = list;
  25 + index = $scope.contactIdList.indexOf(contactId);
  26 + selectedId = $scope.contactIdList[index];
  27 + })
  28 +
  29 + $scope.nextContact = function(){
  30 + $scope.showLoader = true;
  31 + index = index + one;
  32 + selectedId = $scope.contactIdList[index];
  33 + ViewvendorContactService.getContact(selectedId).then(function(result) {
  34 + $scope.contactDetail = result;
  35 + $scope.showLoader = false;
  36 + })
  37 + }
  38 +
  39 + $scope.prevContact = function(){
  40 + $scope.showLoader = true;
  41 + index = index - one;
  42 + selectedId = $scope.contactIdList[index];
  43 + ViewvendorContactService.getContact(selectedId).then(function(result) {
  44 + $scope.contactDetail = result;
  45 + $scope.showLoader = false;
  46 + })
  47 + }
  48 +
  49 + $scope.changePriceEmail = function(id){
  50 + var statusData = "status=" + $scope.contactDetail.priceEmail;
  51 + ViewvendorContactService.changePriceEmail(id, statusData).then(function(result) {
  52 + if(result.success){
  53 + $('#toogleMail').css('display', 'block');
  54 + if($scope.contactDetail.priceEmail == true){
  55 + $scope.messageText = 'You have enabled price distribution for this contact';
  56 + }else{
  57 + $scope.messageText = 'You have disabled price distribution for this contact';
  58 + }
  59 + }
  60 + })
  61 + }
  62 +
  63 + $scope.cancelToogle = function(){
  64 + $('#toogleMail').css('display', 'none');
  65 + }
  66 +
  67 + setInterval(function(){
  68 + var checkMaxLength = $scope.contactIdList.length - one;
  69 + if (index === checkMaxLength) {
  70 + $scope.disableNext = true;
  71 + }else{
  72 + $scope.disableNext = false;
  73 + }
  74 + if (index === 0) {
  75 + $scope.disablePrev = true;
  76 + }else{
  77 + $scope.disablePrev = false;
  78 + }
  79 + }, 3);
  80 +
  81 + $scope.editName = true;
  82 + $scope.editCompany = true;
  83 + $scope.editAddress = true;
  84 + $scope.editPhone = true;
  85 + $scope.editMobile = true;
  86 + $scope.editEmail = true;
  87 + $scope.editContactNotes = true;
  88 +
  89 + $scope.nameEdit = function(){
  90 + $scope.editName = false;
  91 + $scope.showUpdateBtn = true;
  92 + }
  93 + $scope.addressEdit = function(){
  94 + $scope.editAddress = false;
  95 + $scope.showUpdateBtn = true;
  96 + }
  97 + $scope.phoneEdit = function(){
  98 + $scope.editPhone = false;
  99 + $scope.showUpdateBtn = true;
  100 + }
  101 + $scope.mobileEdit = function(){
  102 + $scope.editMobile = false;
  103 + $scope.showUpdateBtn = true;
  104 + }
  105 + $scope.emailEdit = function(){
  106 + $scope.editEmail = false;
  107 + $scope.showUpdateBtn = true;
  108 + }
  109 + $scope.notesEdit = function(){
  110 + $scope.editContactNotes = false;
  111 + $scope.showUpdateBtn = true;
  112 + }
  113 +
  114 + $scope.conData = {};
  115 + $scope.contactData = {};
  116 + $scope.contactData.contactList = [];
  117 + $scope.updateContact = function(data){
  118 + $scope.showLoader = true;
  119 + $scope.editName = true;
  120 + $scope.editCompany = true;
  121 + $scope.editAddress = true;
  122 + $scope.editPhone = true;
  123 + $scope.editMobile = true;
  124 + $scope.editEmail = true;
  125 + $scope.editContactNotes = true;
  126 +
  127 + $scope.conData.address = data.address;
  128 + $scope.conData.email = data.email;
  129 + $scope.conData.firstName = data.firstName;
  130 + $scope.conData.id = data.id;
  131 + $scope.conData.lastName = data.lastName;
  132 + $scope.conData.mobilePhone = data.mobilePhone;
  133 + $scope.conData.note = data.note;
  134 + $scope.conData.password = data.password;
  135 + $scope.conData.priceEmail = data.priceEmail;
  136 + $scope.conData.primaryContact = data.primaryContact;
  137 + $scope.conData.title = data.title;
  138 + $scope.conData.userName = data.userName;
  139 + $scope.conData.workPhone = data.workPhone;
  140 + $scope.conData.companyId = data.owner.id;
  141 +
  142 + $scope.contactData.contactList.push($scope.conData);
  143 + $scope.contactData.contactList.push();
  144 + ViewvendorContactService.updateContact($scope.contactData).then(function(result) {
  145 + if(result.success){
  146 + toastr.success(''+result.success+'', {
  147 + closeButton: true
  148 + })
  149 + $scope.showUpdateBtn = false;
  150 + }else{
  151 + toastr.error(''+result.statusText+'', {
  152 + closeButton: true
  153 + })
  154 + }
  155 + $scope.showLoader = false;
  156 + })
  157 + }
  158 +
  159 + $scope.cancelContact = function(){
  160 + $scope.editName = true;
  161 + $scope.editCompany = true;
  162 + $scope.editAddress = true;
  163 + $scope.editPhone = true;
  164 + $scope.editMobile = true;
  165 + $scope.editEmail = true;
  166 + $scope.editContactNotes = true;
  167 + $scope.showUpdateBtn = false;
  168 + }
  169 +
  170 + $scope.checkPrimaryContact = function(companyId){
  171 + if($scope.contactDetail.primaryContact == true){
  172 + ViewFuelVendorService.checkPrimaryContact(companyId).then(function(result) {
  173 + console.log(result)
  174 + if(result.status == 422){
  175 + $('#primaryContact').css('display', 'block');
  176 + }
  177 + })
  178 + }
  179 + }
  180 +
  181 + $scope.cancelPrimaryContact = function(){
  182 + $('#primaryContact').css('display', 'none');
  183 + $scope.contactDetail.primaryContact = false;
  184 + console.log($scope.contactDetail.primaryContact)
  185 + }
  186 +
  187 + $scope.sendPrimaryContact = function(id){
  188 + $('#primaryContact').css('display', 'none');
  189 + var priamryContactData = "companyContactId=" + id + "&primary=" + $scope.contactDetail.primaryContact;
  190 +
  191 + ViewFuelVendorService.addPrimaryContact(priamryContactData).then(function(result) {
  192 + console.log(result)
  193 + })
  194 +
  195 + }
  196 +
  197 + var deleteContact = "";
  198 + $scope.deleteContact = function(id){
  199 + $('#delete2').css('display', 'block');
  200 + deleteContact = id;
  201 + }
  202 +
  203 + $scope.contactDelete = function(){
  204 + ViewvendorContactService.deleteContact(deleteContact).then(function(result) {
  205 + console.log(result)
  206 + if(result.success){
  207 + deleteContact = "";
  208 + $('#delete2').css('display', 'none');
  209 + toastr.success(''+result.success+'', {
  210 + closeButton: true
  211 + })
  212 + $state.go('app.viewFuelVendor', {"id": contactCompanyId});
  213 + }
  214 +
  215 + })
  216 + }
  217 +
  218 + $scope.cancelDelete = function(){
  219 + $('#delete2').css('display', 'none');
  220 + }
  221 +
  222 + }]);
... ...
app/partials/viewVendorContact/viewVendorContact.Service.js
... ... @@ -0,0 +1,89 @@
  1 +(function(){
  2 + 'use strict';
  3 + angular.module('acufuel')
  4 + .service('ViewvendorContactService', ['$q', '$http', 'BASE_URL', ViewvendorContactService]);
  5 +
  6 + function ViewvendorContactService($q, $http, BASE_URL) {
  7 +
  8 + this.getContact = function(id) {
  9 +
  10 + var deferred = $q.defer();
  11 + $http({
  12 + method : 'GET',
  13 + url : BASE_URL.url +'/vendor/contact/'+id,
  14 + headers : {'Content-Type': 'application/json'},
  15 + })
  16 + .then(function (result){
  17 + deferred.resolve(result.data);
  18 + },function (result){
  19 + deferred.resolve(result.data);
  20 + })
  21 + return deferred.promise;
  22 + }
  23 +
  24 + this.getContactsList = function(id) {
  25 +
  26 + var deferred = $q.defer();
  27 + $http({
  28 + method : 'GET',
  29 + url : BASE_URL.url +'/vendor/contact/idList/'+id,
  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 + this.updateContact = function(data) {
  41 + var deferred = $q.defer();
  42 + $http({
  43 + method : 'PUT',
  44 + url : BASE_URL.url +'/vendor/contact',
  45 + data : data,
  46 + headers : {'Content-Type': 'application/json'},
  47 + })
  48 + .then(function (result){
  49 + deferred.resolve(result.data);
  50 + },function (result){
  51 + deferred.resolve(result.data);
  52 + })
  53 + return deferred.promise;
  54 + }
  55 +
  56 + this.changePriceEmail = function(contactId, data) {
  57 + var deferred = $q.defer();
  58 + $http({
  59 + method : 'PUT',
  60 + url : BASE_URL.url +'/vendor/contact/status/'+ contactId,
  61 + data : data,
  62 + headers : {'Content-Type': 'application/json'},
  63 + })
  64 + .then(function (result){
  65 + deferred.resolve(result.data);
  66 + },function (result){
  67 + deferred.resolve(result.data);
  68 + })
  69 + return deferred.promise;
  70 + }
  71 +
  72 + this.deleteContact = function(contactId){
  73 + var deferred = $q.defer();
  74 + $http({
  75 + method : 'DELETE',
  76 + url : BASE_URL.url +'/vendor/contact/'+ contactId,
  77 + headers : {'Content-Type': 'application/json'},
  78 + })
  79 + .then(function (result){
  80 + deferred.resolve(result.data);
  81 + },function (result){
  82 + deferred.resolve(result.data);
  83 + })
  84 + return deferred.promise;
  85 + }
  86 +
  87 + }
  88 +
  89 +})();
0 90 \ No newline at end of file
... ...
app/partials/viewVendorContact/viewVendorContact.html
... ... @@ -0,0 +1,177 @@
  1 +<div class="myLoader" ng-show="showLoader">
  2 + <img src="../img/hourglass.gif" width="50px;">
  3 +</div>
  4 +<div class="container">
  5 + <div class="row">
  6 + <div class="col-md-10" style="padding-right: 60px; margin-bottom: 30px;">
  7 + <div class="widget">
  8 + <div class="widget-header">
  9 + <i class="icon-pencil"></i>
  10 + <i class="fa fa-building-o" aria-hidden="true"></i>
  11 + <h3>Antioch Flight Department</h3>
  12 + </div>
  13 + <div class="widget-content" style="padding-left: 0; padding-right: 0; ">
  14 + <div class="container">
  15 + <div style="margin-bottom: 25px;">
  16 + <button ng-disabled="disablePrev" class="newButtons" ng-click="prevContact()">
  17 + <i class="fa fa-long-arrow-left" aria-hidden="true"></i>
  18 + Previous Contact
  19 + </button>
  20 + <button ng-disabled="disableNext" class="newButtons" ng-click="nextContact()">
  21 + Next Contact
  22 + <i class="fa fa-long-arrow-right" aria-hidden="true"></i>
  23 + </button>
  24 + </div>
  25 + <div class="row">
  26 + <div class="col-md-6" style="margin-left: 20px;">
  27 + <div class="widget stacked">
  28 + <div class="widget-header">
  29 + <i class="fa fa-building-o" aria-hidden="true"></i>
  30 + <h3 style="margin-right: 0px;">Contact Detail</h3>
  31 + <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteContact(contactDetail.id)" style="color: white;" aria-hidden="true"></i>
  32 + <div class="pull-right" style="margin-top: 5px; margin-right: 10px;">
  33 + <toggle ng-model="contactDetail.priceEmail" ng-change="changePriceEmail(contactDetail.id)" size="customToogle" on="PRICE EMAIL ON" off="PRICE EMAIL OFF"></toggle>
  34 + </div>
  35 +
  36 + </div>
  37 + <div class="widget-content">
  38 + <div class="row" style="margin-left:0px">
  39 + <div class="col-md-6" style="padding-left: 0px;">
  40 + <h3>
  41 + <b ng-show="editName" style="color:#F90;">{{contactDetail.firstName}} {{contactDetail.lastName}}</b>
  42 + <input type="text" ng-hide="editName" class="form-control" style="width: 49%; float: left; margin-right: 1%;" ng-model="contactDetail.firstName">
  43 + <input type="text" ng-hide="editName" class="form-control" style="width: 49%;" ng-model="contactDetail.lastName">
  44 + &nbsp;<i class="fa fa-pencil-square-o" ng-show="editName" ng-click="nameEdit()" style="font-size: 11px;" aria-hidden="true"></i>
  45 + </h3>
  46 + {{contactDetail.owner.companyName}}
  47 + </div>
  48 + <div class="col-md-6">
  49 + <div style="margin-bottom: 10px" class="input-group email-password">
  50 + <span class="input-group-addon email-password"><i class="glyphicon glyphicon-user email-password-icon"></i></span>
  51 + <input id="login-username" type="text" ng-model="contactDetail.userName" class="form-control email-password" placeholder="username or email">
  52 + </div>
  53 +
  54 + <!-- <div class="input-group email-password">
  55 + <span class="input-group-addon email-password"><i class="fa fa-key" aria-hidden="true"></i></span>
  56 + <input id="login-password" type="password" class="form-control email-password" name="password" placeholder="password">
  57 + </div> -->
  58 + </div>
  59 + </div>
  60 + <div>
  61 + <p>
  62 + <span ng-show="editAddress">
  63 + <i class="fa fa-map-marker"></i> {{contactDetail.address}} &nbsp;
  64 + <i class="fa fa-pencil-square-o" ng-click="addressEdit()" style="font-size: 11px;" aria-hidden="true"></i>
  65 + </span>
  66 +
  67 + <input type="text" ng-hide="editAddress" style="width: 50%;" class="form-control" ng-model="contactDetail.address">
  68 + </p>
  69 +
  70 + <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>
  71 + <p ng-hide="editPhone">
  72 + <input type="text" style="width: 50%;" ng-model="contactDetail.mobilePhone" class="form-control">
  73 + </p>
  74 +
  75 + <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>
  76 + <p ng-hide="editMobile">
  77 + <input type="text" style="width: 50%;" ng-model="contactDetail.workPhone" class="form-control">
  78 + </p>
  79 +
  80 + <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>
  81 + <p ng-hide="editEmail">
  82 + <input type="email" style="width: 50%;" ng-model="contactDetail.email" class="form-control">
  83 + </p>
  84 + <div>
  85 + <input type="checkbox" ng-checked="contactDetail.primaryContact" ng-click="checkPrimaryContact(contactDetail.owner.id)" ng-model="contactDetail.primaryContact">&nbsp;
  86 + <span>Primary Contact </span>
  87 + </div>
  88 + </div>
  89 + </br>
  90 + <div>
  91 + <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>
  92 + <p ng-show="editContactNotes">{{contactDetail.note}}</p>
  93 + <p ng-hide="editContactNotes">
  94 + <textarea ng-model="contactDetail.note" class="form-control" style="resize: vertical;"></textarea>
  95 + </p>
  96 +
  97 + <div>
  98 + <button ng-click="updateContact(contactDetail)" ng-show="showUpdateBtn" class="btn btn-success pull-left">Update Contact</button>
  99 + <button ng-click="cancelContact()" style="margin-left: 5px;" ng-show="showUpdateBtn" class="btn btn-default pull-left">Cancel</button>
  100 + <button type="button" class="btn btn-primary pull-right">Send Price to This Contacts</button>
  101 + <div class="clearfix"></div>
  102 + </div>
  103 + </div>
  104 + <!-- <div class="col-md-6">
  105 + <button type="button" class="btn btn-primary">Send Price to This Contacts</button>
  106 + </div> -->
  107 + </div>
  108 + </div>
  109 + </div>
  110 + </div>
  111 + </div>
  112 + </div>
  113 + </div>
  114 + </div>
  115 +</div>
  116 +
  117 +<div class="customConfirmPopBackdrop" id="primaryContact">
  118 + <div class="customModalInner" style="max-width: 400px;">
  119 + <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
  120 + <table>
  121 + <tr>
  122 + <td>
  123 + <img src="img/info.png" style="width: 50px;">
  124 + </td>
  125 + <td>
  126 + <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure you want to set this person as your primary contact?</p>
  127 + </td>
  128 + </tr>
  129 + </table>
  130 + </div>
  131 + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
  132 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="sendPrimaryContact(contactDetail.id)">Yes</button>
  133 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelPrimaryContact()">Cancel</button>
  134 + </div>
  135 + </div>
  136 +</div>
  137 +
  138 +<div class="customConfirmPopBackdrop" id="toogleMail">
  139 + <div class="customModalInner" style="max-width: 400px;">
  140 + <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
  141 + <table>
  142 + <tr>
  143 + <!-- <td>
  144 + <img src="" style="width: 50px;">
  145 + </td> -->
  146 + <td>
  147 + <p style="padding: 5px 10px; margin-bottom: 0;text-align: center;">{{messageText}}</p>
  148 + </td>
  149 + </tr>
  150 + </table>
  151 + </div>
  152 + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
  153 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelToogle()">Cancel</button>
  154 + </div>
  155 + </div>
  156 +</div>
  157 +
  158 +<div class="customConfirmPopBackdrop" id="delete2">
  159 + <div class="customModalInner" style="max-width: 400px;">
  160 + <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
  161 + <table>
  162 + <tr>
  163 + <td>
  164 + <img src="img/info.png" style="width: 50px;">
  165 + </td>
  166 + <td>
  167 + <p style="padding: 5px 10px; margin-bottom: 0;">Please confirm! Are you sure you want to DELETE this Contact?</p>
  168 + </td>
  169 + </tr>
  170 + </table>
  171 + </div>
  172 + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
  173 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="contactDelete()">Accept</button>
  174 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelDelete()">Cancel</button>
  175 + </div>
  176 + </div>
  177 +</div>
0 178 \ No newline at end of file
... ...
app/partials/viewcontact/viewcontact.controller.js
... ... @@ -3,15 +3,16 @@
3 3 //Load controller
4 4 angular.module('acufuel')
5 5  
6   - .controller('viewcontactController', ['$scope', '$stateParams', 'ViewcontactService', 'ViewCompanyService', function($scope, $stateParams, ViewcontactService, ViewCompanyService) {
  6 + .controller('viewcontactController', ['$scope', '$stateParams', '$state', 'ViewcontactService', 'ViewCompanyService', function($scope, $stateParams, $state, ViewcontactService, ViewCompanyService) {
7 7 $scope.showLoader = true;
8 8 $scope.showUpdateBtn = false;
9 9 var contactId = $stateParams.id;
10 10 $scope.contactDetail = {};
11   - var value = "";
  11 + var contactCompanyId = "";
12 12 ViewcontactService.getContact(contactId).then(function(result) {
13 13 $scope.contactDetail = result;
14 14 $scope.showLoader = false;
  15 + contactCompanyId = result.owner.id;
15 16 })
16 17  
17 18 $scope.contactIdList = {};
... ... @@ -208,7 +209,7 @@
208 209 toastr.success(''+result.success+'', {
209 210 closeButton: true
210 211 })
211   - location.reload();
  212 + $state.go('app.viewCompany', {"id": contactCompanyId});
212 213 }
213 214  
214 215 })
... ...