Commit 60232d349d988b294c777971e3b28ab917c4a24b
Exists in
master
Merge branch 'master' into 'master'
agrego foca-cabecera-facturador See merge request !23
Showing
2 changed files
Show diff stats
src/js/controller.js
| ... | ... | @@ -11,6 +11,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 11 | 11 | function($scope, $uibModal, $location, $filter, focaCrearCobranzaService, focaModalService, |
| 12 | 12 | $cookies, focaSeguimientoService) |
| 13 | 13 | { |
| 14 | + | |
| 14 | 15 | $scope.botonera = focaCrearCobranzaService.getBotonera(); |
| 15 | 16 | $scope.datepickerAbierto = false; |
| 16 | 17 | $scope.cobroDeuda = true; |
| ... | ... | @@ -21,9 +22,6 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 21 | 22 | minDate: new Date(2010, 0, 1) |
| 22 | 23 | }; |
| 23 | 24 | |
| 24 | - $scope.cabecera = []; | |
| 25 | - $scope.showCabecera = true; | |
| 26 | - | |
| 27 | 25 | $scope.cobranza = {}; |
| 28 | 26 | |
| 29 | 27 | $scope.fecha = new Date(); |
| ... | ... | @@ -224,7 +222,7 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 224 | 222 | setearMonedaPorDefecto(); |
| 225 | 223 | obtenerNumeroComprobante(); |
| 226 | 224 | |
| 227 | - $scope.cabecera = []; | |
| 225 | + $scope.$broadcast('cleanCabecera'); | |
| 228 | 226 | $scope.fecha = new Date(); |
| 229 | 227 | $scope.facturaTabla = []; |
| 230 | 228 | $scope.cobrosTabla = []; |
| ... | ... | @@ -256,14 +254,20 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 256 | 254 | ); |
| 257 | 255 | modalInstance.result.then(function(cobranza) { |
| 258 | 256 | $scope.editando = true; |
| 259 | - $scope.cabecera = []; | |
| 260 | 257 | $scope.facturaTabla = []; |
| 261 | 258 | $scope.cobrosTabla = []; |
| 259 | + $scope.$broadcast('cleanCabecera'); | |
| 262 | 260 | |
| 263 | 261 | $scope.fecha = new Date(cobranza.fecha); |
| 264 | 262 | |
| 265 | - addCabecera('Cliente:', cobranza.cliente.NOM); | |
| 266 | - addCabecera('Cobrador:', cobranza.cobrador); | |
| 263 | + $scope.$broadcast('addCabecera', { | |
| 264 | + label: 'Cliente:', | |
| 265 | + valor: cobranza.cliente.NOM | |
| 266 | + }); | |
| 267 | + $scope.$broadcast('addCabecera', { | |
| 268 | + label: 'Cobrador:', | |
| 269 | + valor: cobranza.cobrador | |
| 270 | + }); | |
| 267 | 271 | |
| 268 | 272 | $scope.facturaTabla = cobranza.facturas; |
| 269 | 273 | $scope.cobrosTabla = cobranza.cobros; |
| ... | ... | @@ -283,7 +287,10 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 283 | 287 | ); |
| 284 | 288 | modalInstance.result.then( |
| 285 | 289 | function(cliente) { |
| 286 | - addCabecera('Cliente:', cliente.nom); | |
| 290 | + $scope.$broadcast('addCabecera', { | |
| 291 | + label: 'Cliente:', | |
| 292 | + valor: cliente.nom | |
| 293 | + }); | |
| 287 | 294 | $scope.cobranza.cliente = { |
| 288 | 295 | COD: cliente.cod, |
| 289 | 296 | CUIT: cliente.cuit, |
| ... | ... | @@ -423,12 +430,24 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 423 | 430 | function(cotizacion) { |
| 424 | 431 | $scope.cobranza.moneda = moneda; |
| 425 | 432 | $scope.cobranza.cotizacion = cotizacion; |
| 426 | - addCabecera('Moneda:', moneda.DETALLE); | |
| 427 | - addCabecera( | |
| 428 | - 'Fecha cotizacion:', | |
| 429 | - $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | |
| 430 | - ); | |
| 431 | - addCabecera('Cotizacion:', cotizacion.VENDEDOR); | |
| 433 | + if(moneda.DETALLE === 'PESOS ARGENTINOS') { | |
| 434 | + $scope.$broadcast('removeCabecera', 'Moneda:'); | |
| 435 | + $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | |
| 436 | + $scope.$broadcast('removeCabecera', 'Cotizacion:'); | |
| 437 | + }else { | |
| 438 | + $scope.$broadcast('addCabecera', { | |
| 439 | + label: 'Moneda:', | |
| 440 | + valor: moneda.DETALLE | |
| 441 | + }); | |
| 442 | + $scope.$broadcast('addCabecera', { | |
| 443 | + label: 'Fecha cotizacion:', | |
| 444 | + valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | |
| 445 | + }); | |
| 446 | + $scope.$broadcast('addCabecera', { | |
| 447 | + label: 'Cotizacion:', | |
| 448 | + valor: cotizacion.VENDEDOR | |
| 449 | + }); | |
| 450 | + } | |
| 432 | 451 | }, function() { |
| 433 | 452 | |
| 434 | 453 | } |
| ... | ... | @@ -446,7 +465,10 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 446 | 465 | ); |
| 447 | 466 | modalInstance.result.then( |
| 448 | 467 | function(cobrador) { |
| 449 | - addCabecera('Cobrador:', cobrador.nombre); | |
| 468 | + $scope.$broadcast('addCabecera', { | |
| 469 | + label: 'Cobrador:', | |
| 470 | + valor: cobrador.nombre | |
| 471 | + }); | |
| 450 | 472 | $scope.cobranza.cobrador = cobrador; |
| 451 | 473 | }, function() { |
| 452 | 474 | |
| ... | ... | @@ -517,21 +539,6 @@ angular.module('focaCrearCobranza') .controller('cobranzaController', |
| 517 | 539 | $scope.cobrosTabla.splice(key, 1); |
| 518 | 540 | }; |
| 519 | 541 | |
| 520 | - function addCabecera(label, valor) { | |
| 521 | - var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | |
| 522 | - if(propiedad.length === 1) { | |
| 523 | - propiedad[0].valor = valor; | |
| 524 | - } else { | |
| 525 | - $scope.cabecera.push({label: label, valor: valor}); | |
| 526 | - } | |
| 527 | - } | |
| 528 | - // TODO: descomentar cuando se use | |
| 529 | - /*function removeCabecera(label) { | |
| 530 | - var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | |
| 531 | - if(propiedad.length === 1){ | |
| 532 | - $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | |
| 533 | - } | |
| 534 | - }*/ | |
| 535 | 542 | function setearMonedaPorDefecto() { |
| 536 | 543 | var monedaPorDefecto; |
| 537 | 544 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
src/views/cobranza.html
| 1 | 1 | <div class="crear-nota-pedido foca-crear one-row row"> |
| 2 | - <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0 col-lg-12"> | |
| 3 | - <div class="row"> | |
| 4 | - <div class="col-md-10 col-lg-12"> | |
| 5 | - <div class="row panel-informativo"> | |
| 6 | - <div class="col-12"> | |
| 7 | - <div class="row titulares"> | |
| 8 | - <div class="col-12 col-sm-3 nota-pedido border border-left-0 border-white align-middle"> | |
| 9 | - <h5 class="mb-0">RECIBO DE COBRANZA</h5> | |
| 10 | - </div> | |
| 11 | - <div class="col-12 col-sm-3 numero-pedido text-center text-md-left border border-white align-middle" | |
| 12 | - >Nº {{puntoVenta}}-{{comprobante}} | |
| 13 | - <button | |
| 14 | - class="btn btn-xs btn-outline-light float-right" | |
| 15 | - type="button" | |
| 16 | - ng-click="seleccionarCobranza()" | |
| 17 | - > | |
| 18 | - <i class="fa fa-search"></i> | |
| 19 | - </button> | |
| 20 | - </div> | |
| 21 | - <div class="col-7 col-sm-3 border border-white align-middle"> | |
| 22 | - Fecha: | |
| 23 | - <span | |
| 24 | - ng-show="!datepickerAbierto" | |
| 25 | - ng-bind="fecha | date:'dd/MM/yyyy'" | |
| 26 | - ng-click="datepickerAbierto = true" | |
| 27 | - > | |
| 28 | - </span> | |
| 29 | - <input | |
| 30 | - ng-show="datepickerAbierto" | |
| 31 | - type="date" | |
| 32 | - ng-model="fecha" | |
| 33 | - ng-change="datepickerAbierto = false" | |
| 34 | - ng-blur="datepickerAbierto = false" | |
| 35 | - class="form-control form-control-sm col-8 float-right" | |
| 36 | - foca-focus="datepickerAbierto" | |
| 37 | - hasta-hoy | |
| 38 | - /> | |
| 39 | - </div> | |
| 40 | - <div class="col-5 col-sm-3 border border-white border-right-0 align-middle"> | |
| 41 | - Hora: | |
| 42 | - <span | |
| 43 | - ng-show="!datepickerAbierto" | |
| 44 | - ng-bind="fecha | date:'HH:mm'" | |
| 45 | - ng-click="datepickerAbierto = true" | |
| 46 | - > | |
| 47 | - </span> | |
| 48 | - </div> | |
| 49 | - </div> | |
| 50 | - <div class="row py-2"> | |
| 51 | - <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | |
| 52 | - <span class="label" ng-bind="cab.label"></span> | |
| 53 | - <span class="valor" ng-bind="cab.valor"></span> | |
| 54 | - </div> | |
| 55 | - <a | |
| 56 | - class="btn col-12 btn-secondary d-sm-none" | |
| 57 | - ng-show="cabecera.length > 0" | |
| 58 | - ng-click="showCabecera = !showCabecera" | |
| 59 | - > | |
| 60 | - <i | |
| 61 | - class="fa fa-chevron-down" | |
| 62 | - ng-hide="showCabecera" | |
| 63 | - aria-hidden="true" | |
| 64 | - > | |
| 65 | - </i> | |
| 66 | - <i | |
| 67 | - class="fa fa-chevron-up" | |
| 68 | - ng-show="showCabecera" | |
| 69 | - aria-hidden="true"> | |
| 70 | - </i> | |
| 71 | - </a> | |
| 72 | - </div> | |
| 73 | - </div> | |
| 74 | - </div> | |
| 75 | - </div> | |
| 76 | - </div> | |
| 77 | - </form> | |
| 2 | + <foca-cabecera-facturador | |
| 3 | + titulo="'RECIBO DE COBRANZA'" | |
| 4 | + numero="puntoVenta + '-' + comprobante" | |
| 5 | + fecha="fecha" | |
| 6 | + class="mb-0 col-lg-12" | |
| 7 | + busqueda="seleccionarCobranza" | |
| 8 | + ></foca-cabecera-facturador> | |
| 78 | 9 | <div class="col-lg-12"> |
| 79 | 10 | <div class="row mt-4"> |
| 80 | 11 | <div class="col-12 col-md-10 border border-light rounded"> |
| ... | ... | @@ -508,8 +439,7 @@ |
| 508 | 439 | ng-click="crearCobranza()" |
| 509 | 440 | title="Crear nota pedido" |
| 510 | 441 | class="btn btn-default btn-block mb-2 border border-dark" |
| 511 | - ng-disabled="editando || saveLoading" | |
| 512 | - > | |
| 442 | + ng-disabled="editando || saveLoading"> | |
| 513 | 443 | <strong>GUARDAR</strong> |
| 514 | 444 | </button> |
| 515 | 445 | <button |