Commit c0938b7d0f18548845fd3196267723fd5727a285
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !17
Showing
2 changed files
Show diff stats
src/js/controller.js
| ... | ... | @@ -68,7 +68,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 68 | 68 | var cuerpos = []; |
| 69 | 69 | //TODO: habilitar edición |
| 70 | 70 | $scope.editando = false; |
| 71 | - | |
| 71 | + $scope.saveLoading = true; | |
| 72 | 72 | for (var i = 0; i < $scope.facturaTabla.length; i++) { |
| 73 | 73 | var cuerpoFactura = { |
| 74 | 74 | CYV: 'V', |
| ... | ... | @@ -210,45 +210,39 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 210 | 210 | CLI: $scope.cobranza.cliente.COD |
| 211 | 211 | } |
| 212 | 212 | }; |
| 213 | - focaCrearCobranzaService.guardarCobranza(cobranza).then(function(result) { | |
| 214 | - focaModalService.alert('Cobranza guardada con éxito'); | |
| 215 | - console.info(result); | |
| 216 | - | |
| 217 | - console.info({ | |
| 218 | - numero: result.data.numero, | |
| 219 | - actividad: 'Cobranza', | |
| 220 | - observaciones: 'Nº: ' + $filter('comprobante')([ | |
| 221 | - result.data.sucursal, | |
| 222 | - result.data.numero | |
| 223 | - ]) + '<br/>' + | |
| 224 | - 'Vendedor: ' + $scope.cobranza.cobrador.nombre + '<br/>' + | |
| 225 | - 'Total: ' + $filter('currency')($scope.getTotalCobrado()), | |
| 226 | - sucursal: result.data.sucursal | |
| 227 | - }); | |
| 228 | - | |
| 229 | - focaSeguimientoService.guardarPosicion( | |
| 230 | - result.data.numero, | |
| 231 | - 'Cobranza', | |
| 232 | - 'Nº: ' + $filter('comprobante')([ | |
| 233 | - result.data.sucursal, | |
| 234 | - result.data.numero | |
| 235 | - ]) + '<br/>' + | |
| 236 | - 'Vendedor: ' + $scope.cobranza.cobrador.nombre + '<br/>' + | |
| 237 | - 'Total: ' + $filter('currency')($scope.getTotalCobrado()), | |
| 238 | - result.data.sucursal | |
| 239 | - ); | |
| 240 | - | |
| 241 | - $scope.cobranza = { | |
| 242 | - fecha: new Date() | |
| 243 | - }; | |
| 244 | - setearMonedaPorDefecto(); | |
| 245 | - obtenerNumeroComprobante(); | |
| 213 | + focaCrearCobranzaService.guardarCobranza(cobranza).then( | |
| 214 | + function(result) { | |
| 215 | + $scope.saveLoading = false; | |
| 216 | + focaModalService.alert('Cobranza guardada con éxito'); | |
| 217 | + | |
| 218 | + focaSeguimientoService.guardarPosicion( | |
| 219 | + result.data.numero, | |
| 220 | + 'Cobranza', | |
| 221 | + 'Nº: ' + $filter('comprobante')([ | |
| 222 | + result.data.sucursal, | |
| 223 | + result.data.numero | |
| 224 | + ]) + '<br/>' + | |
| 225 | + 'Vendedor: ' + $scope.cobranza.cobrador.nombre + '<br/>' + | |
| 226 | + 'Total: ' + $filter('currency')($scope.getTotalCobrado()), | |
| 227 | + result.data.sucursal | |
| 228 | + ); | |
| 246 | 229 | |
| 247 | - $scope.cabecera = []; | |
| 248 | - $scope.fecha = new Date(); | |
| 249 | - $scope.facturaTabla = []; | |
| 250 | - $scope.cobrosTabla = []; | |
| 251 | - }); | |
| 230 | + $scope.cobranza = { | |
| 231 | + fecha: new Date() | |
| 232 | + }; | |
| 233 | + setearMonedaPorDefecto(); | |
| 234 | + obtenerNumeroComprobante(); | |
| 235 | + | |
| 236 | + $scope.cabecera = []; | |
| 237 | + $scope.fecha = new Date(); | |
| 238 | + $scope.facturaTabla = []; | |
| 239 | + $scope.cobrosTabla = []; | |
| 240 | + }, function(error) { | |
| 241 | + focaModalService.alert('Hubo un problema al cargar la cobranza'); | |
| 242 | + $scope.saveLoading = false; | |
| 243 | + console.info(error); | |
| 244 | + } | |
| 245 | + ); | |
| 252 | 246 | }; |
| 253 | 247 | |
| 254 | 248 | $scope.swichCobro = function() { |
src/views/cobranza.html
| ... | ... | @@ -512,6 +512,8 @@ |
| 512 | 512 | <div class="row align-items-end"> |
| 513 | 513 | <div class="col-12"> |
| 514 | 514 | <button |
| 515 | + ladda="saveLoading" | |
| 516 | + data-spinner-color="#FF0000" | |
| 515 | 517 | ng-click="crearCobranza()" |
| 516 | 518 | title="Crear nota pedido" |
| 517 | 519 | class="btn btn-default btn-block mb-2" |
| ... | ... | @@ -533,7 +535,14 @@ |
| 533 | 535 | <div class="row d-md-none fixed-bottom"> |
| 534 | 536 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
| 535 | 537 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
| 536 | - <span class="mr-3 ml-auto" ng-click="crearCobranza()" ng-show="!editando">Guardar</span> | |
| 538 | + <span | |
| 539 | + class="mr-3 ml-auto" | |
| 540 | + ng-class="saveLoading ? 'text-muted' : ''" | |
| 541 | + ng-click="crearCobranza()" | |
| 542 | + ng-show="!editando" | |
| 543 | + ladda="saveLoading" | |
| 544 | + data-style="expand-left" | |
| 545 | + >Guardar</span> | |
| 537 | 546 | </div> |
| 538 | 547 | </div> |
| 539 | 548 | </div> |