Commit d3306bd9836f572797cc669a614967f61d0d2a90
Exists in
master
Merge branch 'master' into 'develop'
Master(benjamin) See merge request !46
Showing
2 changed files
Show diff stats
src/js/controller.js
| ... | ... | @@ -73,6 +73,14 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 73 | 73 | despachos: [] |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | + $scope.estadoCuenta = { | |
| 77 | + autorizado: 0.0, | |
| 78 | + extracciones: 0.0, | |
| 79 | + saldo: 0.0, | |
| 80 | + situacion: false, | |
| 81 | + facturasVencidas: 0.0 | |
| 82 | + }; | |
| 83 | + | |
| 76 | 84 | $scope.factura.articulosFactura = []; |
| 77 | 85 | $scope.idLista = undefined; |
| 78 | 86 | |
| ... | ... | @@ -252,21 +260,29 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 252 | 260 | ); |
| 253 | 261 | modalInstance.result.then( |
| 254 | 262 | function (cliente) { |
| 255 | - var modalInstance = $uibModal.open( | |
| 256 | - { | |
| 257 | - templateUrl: 'modal-estado-cuenta.html', | |
| 258 | - controller: 'focaModalEstadoCuentaController', | |
| 259 | - size: 'lg', | |
| 260 | - resolve: { | |
| 261 | - parametros: function () { | |
| 262 | - return { | |
| 263 | - idCliente: cliente.COD, | |
| 264 | - nombreCliente: cliente.NOM | |
| 265 | - }; | |
| 266 | - }, | |
| 267 | - } | |
| 268 | - } | |
| 269 | - ); | |
| 263 | + crearFacturaService.getResumenCuenta(cliente.COD) | |
| 264 | + .then(function (res) { | |
| 265 | + $scope.estadoCuenta = res.data[0]; | |
| 266 | + if ($scope.estadoCuenta.autorizado > 0) { | |
| 267 | + var modalInstance = $uibModal.open( | |
| 268 | + { | |
| 269 | + templateUrl: 'modal-estado-cuenta.html', | |
| 270 | + controller: 'focaModalEstadoCuentaController', | |
| 271 | + size: 'lg', | |
| 272 | + resolve: { | |
| 273 | + parametros: function () { | |
| 274 | + return { | |
| 275 | + idCliente: cliente.COD, | |
| 276 | + nombreCliente: cliente.NOM | |
| 277 | + }; | |
| 278 | + }, | |
| 279 | + } | |
| 280 | + } | |
| 281 | + ) | |
| 282 | + }; | |
| 283 | + }) | |
| 284 | + .catch(function (err) { console.error(err); }) | |
| 285 | + | |
| 270 | 286 | modalInstance.result |
| 271 | 287 | .then(function (data) { |
| 272 | 288 | |
| ... | ... | @@ -660,20 +676,20 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 660 | 676 | producto: producto.despachos[0].PRO, |
| 661 | 677 | carga: producto.despachos[0].CAR |
| 662 | 678 | }) |
| 663 | - .then(function () { | |
| 664 | - $scope.factura.articulosFactura.push(articulo); | |
| 665 | - $scope.factura.despachos.push(producto.despachos[0]); | |
| 666 | - }) | |
| 667 | - .catch(function (err) { | |
| 679 | + .then(function () { | |
| 680 | + $scope.factura.articulosFactura.push(articulo); | |
| 681 | + $scope.factura.despachos.push(producto.despachos[0]); | |
| 682 | + }) | |
| 683 | + .catch(function (err) { | |
| 668 | 684 | |
| 669 | - console.error(err); | |
| 670 | - focaModalService.alert('El despacho estรก en uso'); | |
| 671 | - }); | |
| 685 | + console.error(err); | |
| 686 | + focaModalService.alert('El despacho esta en uso'); | |
| 687 | + }); | |
| 672 | 688 | |
| 673 | 689 | }) |
| 674 | - .catch(function (err) { | |
| 675 | - console.error(err); | |
| 676 | - }); | |
| 690 | + .catch(function (err) { | |
| 691 | + console.error(err); | |
| 692 | + }); | |
| 677 | 693 | |
| 678 | 694 | }; |
| 679 | 695 |
src/views/modal-estado-cuenta.html
| ... | ... | @@ -8,12 +8,6 @@ |
| 8 | 8 | <div class="modal-body" id="modal-body"> |
| 9 | 9 | <div class="row m-3"> |
| 10 | 10 | <div class="col"> |
| 11 | - <!-- <div class="row mb-2"> | |
| 12 | - <div class="col text-center"> | |
| 13 | - <p class="m-0">Autorizado</p> | |
| 14 | - <p class="h5 m-0" ng-bind="estadoCuenta.autorizado | currency"></p> | |
| 15 | - </div> | |
| 16 | - </div> --> | |
| 17 | 11 | <div class="row mb-2"> |
| 18 | 12 | <div class="col text-center"> |
| 19 | 13 | <p class="m-0">Cliente</p> |
| ... | ... | @@ -22,56 +16,56 @@ |
| 22 | 16 | <label class="h5" ng-bind="cliente.nombreCliente"></label> |
| 23 | 17 | </div> |
| 24 | 18 | </div> |
| 25 | - <div class="row border-top mb-2"> | |
| 26 | - <div class="col text-center"> | |
| 27 | - <p class="m-0">Autorizado</p> | |
| 28 | - <p class="h5 m-0" ng-bind="estadoCuenta.autorizado | currency"></p> | |
| 19 | + <div class="row border-top mb-2"> | |
| 20 | + <div class="col text-center"> | |
| 21 | + <p class="m-0">Autorizado</p> | |
| 22 | + <p class="h5 m-0" ng-bind="estadoCuenta.autorizado | currency"></p> | |
| 23 | + </div> | |
| 29 | 24 | </div> |
| 30 | - </div> | |
| 31 | - <div class="row border-top mb-2"> | |
| 32 | - <div class="col text-center"> | |
| 33 | - <p class="m-0">Extracciones</p> | |
| 34 | - <p class="h5 m-0" ng-bind="estadoCuenta.extracciones | currency"></p> | |
| 25 | + <div class="row border-top mb-2"> | |
| 26 | + <div class="col text-center"> | |
| 27 | + <p class="m-0">Extracciones</p> | |
| 28 | + <p class="h5 m-0" ng-bind="estadoCuenta.extracciones | currency"></p> | |
| 29 | + </div> | |
| 35 | 30 | </div> |
| 36 | - </div> | |
| 37 | - <div class="row border-top mb-2"> | |
| 38 | - <div class="col text-center"> | |
| 39 | - <p class="m-0">Saldo</p> | |
| 40 | - <p class="h5 m-0" ng-bind="estadoCuenta.saldo | currency"></p> | |
| 31 | + <div class="row border-top mb-2"> | |
| 32 | + <div class="col text-center"> | |
| 33 | + <p class="m-0">Saldo</p> | |
| 34 | + <p class="h5 m-0" ng-bind="estadoCuenta.saldo | currency"></p> | |
| 35 | + </div> | |
| 41 | 36 | </div> |
| 42 | - </div> | |
| 43 | - <div class="row border-top mb-2"> | |
| 44 | - <div class="col text-center"> | |
| 45 | - <p class="m-0">Situacion</p> | |
| 46 | - <h4> | |
| 47 | - <p | |
| 48 | - ng-show="estadoCuenta.situacion" | |
| 49 | - class="badge badge-success m-0 px-3">Permitido | |
| 50 | - </p> | |
| 51 | - <p | |
| 52 | - ng-show="!estadoCuenta.situacion" | |
| 53 | - class="badge badge-danger m-0 px-3">No permitido | |
| 54 | - </p> | |
| 55 | - </h4> | |
| 37 | + <div class="row border-top mb-2"> | |
| 38 | + <div class="col text-center"> | |
| 39 | + <p class="m-0">Situacion</p> | |
| 40 | + <h4> | |
| 41 | + <p | |
| 42 | + ng-show="estadoCuenta.situacion" | |
| 43 | + class="badge badge-success m-0 px-3">Permitido | |
| 44 | + </p> | |
| 45 | + <p | |
| 46 | + ng-show="!estadoCuenta.situacion" | |
| 47 | + class="badge badge-danger m-0 px-3">No permitido | |
| 48 | + </p> | |
| 49 | + </h4> | |
| 50 | + </div> | |
| 56 | 51 | </div> |
| 57 | - </div> | |
| 58 | - <div class="row border-top mb-2"> | |
| 59 | - <div class="col text-center"> | |
| 60 | - <p class="m-0">Facturas Vencidas</p> | |
| 61 | - <p class="h5 m-0" ng-bind="estadoCuenta.facturasvencidas | currency"></p> | |
| 52 | + <div class="row border-top mb-2"> | |
| 53 | + <div class="col text-center"> | |
| 54 | + <p class="m-0">Facturas Vencidas</p> | |
| 55 | + <p class="h5 m-0" ng-bind="estadoCuenta.facturasvencidas | currency"></p> | |
| 56 | + </div> | |
| 62 | 57 | </div> |
| 63 | - </div> | |
| 64 | - <!-- <div class="row border-top"> | |
| 65 | - <div class="col text-center"> | |
| 66 | - <p class="m-0">Situacion</p> | |
| 67 | - <h4> | |
| 68 | - <p | |
| 58 | + <!-- <div class="row border-top"> | |
| 59 | + <div class="col text-center"> | |
| 60 | + <p class="m-0">Situacion</p> | |
| 61 | + <h4> | |
| 62 | + <p | |
| 69 | 63 | ng-show="estadoCuenta.situacion" |
| 70 | 64 | class="badge badge-success m-0 px-3">Permitido |
| 71 | 65 | </p> |
| 72 | 66 | <p |
| 73 | - ng-show="!estadoCuenta.situacion" | |
| 74 | - class="badge badge-danger m-0 px-3">No permitido | |
| 67 | + ng-show="!estadoCuenta.situacion" | |
| 68 | + class="badge badge-danger m-0 px-3">No permitido | |
| 75 | 69 | </p> |
| 76 | 70 | </h4> |
| 77 | 71 | </div> |
| ... | ... | @@ -90,26 +84,25 @@ |
| 90 | 84 | type="button" |
| 91 | 85 | class="btn btn-sm btn-block btn-tarjeta rounded border p-1" |
| 92 | 86 | ng-disabled="!estadoCuenta.situacion" |
| 93 | - ng-click="elegirTipoDePago({tipo: 'Contado', formaDePago: 1})" | |
| 94 | - > | |
| 87 | + ng-click="elegirTipoDePago({tipo: 'Contado', formaDePago: 1})"> | |
| 95 | 88 | <img ng-src="./img/contado.png" alt=""> |
| 96 | 89 | <p class="m-0">Contado</p> |
| 97 | 90 | </button> |
| 98 | 91 | </div> |
| 99 | 92 | <div class="col-6 col-sm-4"> |
| 100 | 93 | <button |
| 101 | - type="button" | |
| 102 | - class="btn btn-sm btn-block btn-tarjeta rounded border p-1" | |
| 103 | - ng-disabled="!estadoCuenta.situacion" | |
| 104 | - foca-focus="true" | |
| 105 | - ng-click="elegirTipoDePago({tipo: 'Cuenta Corriente', formaDePago: 2})" | |
| 94 | + type="button" | |
| 95 | + class="btn btn-sm btn-block btn-tarjeta rounded border p-1" | |
| 96 | + ng-disabled="!estadoCuenta.situacion" | |
| 97 | + foca-focus="true" | |
| 98 | + ng-click="elegirTipoDePago({tipo: 'Cuenta Corriente', formaDePago: 2})" | |
| 106 | 99 | > |
| 107 | - <img ng-src="./img/cuentaCorriente.png" alt=""> | |
| 108 | - <p class="m-0">Cta. Corriente</p> | |
| 109 | - </button> | |
| 110 | - </div> | |
| 100 | + <img ng-src="./img/cuentaCorriente.png" alt=""> | |
| 101 | + <p class="m-0">Cta. Corriente</p> | |
| 102 | + </button> | |
| 111 | 103 | </div> |
| 112 | 104 | </div> |
| 105 | +</div> | |
| 113 | 106 | <div class="modal-footer py-2"> |
| 114 | 107 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
| 115 | 108 | </div> |