Commit e5448f30270992a145fd061fb6f29b0ec72e9ca1

Authored by Kuldeep Arora
1 parent 4c25c98b52
Exists in master

delete fuelvendor UI

app/partials/FuelVendors/FuelVendors.controller.js
... ... @@ -26,7 +26,7 @@
26 26 function getAllVendor(){
27 27 $scope.showLoader = true;
28 28 FuelVendorsService.getAllVendor().then(function(result) {
29   - console.log(result)
  29 + //console.log(result)
30 30 $scope.companyList = result;
31 31 for (var i = 0; i < $scope.companyList.length; i++) {
32 32 if ($scope.companyList[i].companyContact != null) {
... ...
app/partials/viewFuelVendor/viewFuelVendor.controller.js
... ... @@ -4,7 +4,7 @@
4 4 //Load controller
5 5 angular.module('acufuel')
6 6  
7   - .controller('ViewFuelVendorController', ['$scope','$uibModal', '$stateParams', 'ViewFuelVendorService', 'CustomersService', 'ViewCompanyService', 'updateFuelManagerService', function($scope , $uibModal, $stateParams, ViewFuelVendorService, CustomersService, ViewCompanyService, updateFuelManagerService) {
  7 + .controller('ViewFuelVendorController', ['$scope','$uibModal', '$stateParams', 'ViewFuelVendorService', 'CustomersService', 'ViewCompanyService', 'updateFuelManagerService','$state', function($scope , $uibModal, $stateParams, ViewFuelVendorService, CustomersService, ViewCompanyService, updateFuelManagerService,$state) {
8 8 $scope.data = {};
9 9 $scope.data.priceEmail = true;
10 10 $scope.primayData = {};
... ... @@ -81,6 +81,7 @@
81 81 $scope.sendPrimaryContact();
82 82 $scope.contactData.contactList = [];
83 83 $scope.data = {};
  84 + $scope.data.priceEmail = true;
84 85 getContactList();
85 86 }else{
86 87 toastr.error(''+result.statusText+'', {
... ... @@ -109,7 +110,7 @@
109 110 }
110 111  
111 112 $scope.editData = function(inputName) {
112   - console.log($scope.vendorData)
  113 + //console.log($scope.vendorData)
113 114 $scope.showLoader = true;
114 115 // if(inputName == 'showNoteData'){
115 116 // $scope.showNoteData = true;
... ... @@ -187,7 +188,7 @@
187 188 if($scope.primaryContact == true){
188 189 $scope.primaryContact = true;
189 190 ViewFuelVendorService.checkPrimaryContact(vendorId).then(function(result) {
190   - console.log(result)
  191 + //console.log(result)
191 192 if(result.status == 422){
192 193 $('#primaryContact').css('display', 'block');
193 194 }
... ... @@ -201,7 +202,7 @@
201 202 var priamryContactData = "vendorContactId=" + $scope.primayData.id + "&primary=" + $scope.primaryContact;
202 203  
203 204 ViewFuelVendorService.addPrimaryContact(priamryContactData).then(function(result) {
204   - console.log(result)
  205 + // console.log(result)
205 206 })
206 207 }
207 208  
... ... @@ -213,7 +214,7 @@
213 214 $('#updateContact').css('display', 'block');
214 215 $scope.updateData = data;
215 216 newContactName = value;
216   - console.log($scope.updateData)
  217 + // console.log($scope.updateData)
217 218 if($scope.updateData.email == null){
218 219 $scope.updateData.content = data.contactNumber;
219 220 }else{
... ... @@ -222,7 +223,7 @@
222 223 }
223 224  
224 225 $scope.acceptUpdateField = function(){
225   - console.log($scope.updateData)
  226 + // console.log($scope.updateData)
226 227 if($scope.updateData.content == undefined){
227 228 toastr.error('Please add some content', {
228 229 closeButton: true
... ... @@ -236,7 +237,7 @@
236 237 + "&title=" + $scope.updateData.title;
237 238 }
238 239 ViewFuelVendorService.updateCustomField(updateCustomData).then(function(result) {
239   - console.log(result)
  240 + // console.log(result)
240 241 if(result != null && result.success){
241 242 $('#updateContact').css('display', 'none');
242 243 getVendorDetail();
... ... @@ -250,7 +251,7 @@
250 251 }
251 252  
252 253 $scope.showEditTier2 = function(number){
253   - console.log(number)
  254 + // console.log(number)
254 255 $scope.contactNumber = number;
255 256 }
256 257  
... ... @@ -258,7 +259,7 @@
258 259  
259 260 var contactName = '';
260 261 $scope.addCustom = function(value){
261   - console.log(value)
  262 + // console.log(value)
262 263 if(value != null){
263 264 contactName = value;
264 265 $('#customField').css('display', 'block');
... ... @@ -284,7 +285,7 @@
284 285 + "&title=" + $scope.custom.title;
285 286 }
286 287 ViewFuelVendorService.addCustomField(customData).then(function(result) {
287   - console.log(result)
  288 + // console.log(result)
288 289 if(result.status == 200){
289 290 $('#customField').css('display', 'none');
290 291 getVendorDetail();
... ... @@ -357,4 +358,34 @@
357 358 })
358 359 }
359 360  
  361 + var deleteVendorId = "";
  362 + $scope.deleteVendor = function(vendorDataid){
  363 + $('#delete2').css('display', 'block');
  364 + // console.log("asda",vendorDataid)
  365 + deleteVendorId = vendorDataid;
  366 + }
  367 +
  368 + $scope.deleteVendorData = function(){
  369 + ViewFuelVendorService.deleteFuelVendor(deleteVendorId).then(function(result) {
  370 +
  371 + $('#delete2').css('display', 'none');
  372 + if(result.success){
  373 + toastr.success(''+result.success+'', {
  374 + closeButton: true
  375 +
  376 + })
  377 + }else{
  378 + toastr.error(''+result.statusText+'', {
  379 + closeButton: true
  380 +
  381 + })
  382 + }
  383 + $state.go('app.FuelVendors')
  384 + })
  385 + }
  386 + $scope.cancelDelete = function(){
  387 + $('#delete2').css('display', 'none');
  388 + }
  389 +
  390 +
360 391 }]);
361 392 \ No newline at end of file
... ...
app/partials/viewFuelVendor/viewFuelVendor.html
... ... @@ -122,6 +122,30 @@
122 122 <img src="../img/hourglass.gif" width="50px;">
123 123 </div>
124 124  
  125 +<!--Delete model-->
  126 +<div class="customConfirmPopBackdrop" id="delete2">
  127 + <div class="customModalInner" style="max-width: 400px;">
  128 + <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
  129 + <table>
  130 + <tr>
  131 + <td>
  132 + <img src="img/info.png" style="width: 50px;">
  133 + </td>
  134 + <td>
  135 + <p style="padding: 5px 10px; margin-bottom: 0;">Please confirm! Are you sure you want to DELETE this Fuel Vendor & its related data?</p>
  136 + </td>
  137 + </tr>
  138 + </table>
  139 + </div>
  140 + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
  141 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="deleteVendorData()">Accept</button>
  142 + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelDelete()">Cancel</button>
  143 + </div>
  144 + </div>
  145 +</div>
  146 +
  147 +
  148 +
125 149 <div class="col-xs-12 col-md-12">
126 150 <div class="row" style="margin-left:0px">
127 151 <div class="col-md-12">
... ...
app/partials/viewFuelVendor/viewFuelVendor.service.js
... ... @@ -215,6 +215,24 @@
215 215 return deferred.promise;
216 216 }
217 217  
  218 +
  219 + this.deleteFuelVendor = function(id) {
  220 +
  221 + var deferred = $q.defer();
  222 + $http({
  223 + method : 'DELETE',
  224 + url : BASE_URL.url +'/vendor/vendorid/'+id,
  225 + headers : {'Content-Type': 'application/json'},
  226 + })
  227 + .then(function (result){
  228 + deferred.resolve(result.data);
  229 + },function (result){
  230 + deferred.resolve(result.data);
  231 + })
  232 + return deferred.promise;
  233 + }
  234 +
  235 +
218 236 }
219 237  
220 238 })();
221 239 \ No newline at end of file
... ...