diff --git a/src/js/controller.js b/src/js/controller.js index af49014..ef052af 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -73,6 +73,14 @@ angular.module('focaCrearFactura').controller('facturaController', [ despachos: [] }; + $scope.estadoCuenta = { + autorizado: 0.0, + extracciones: 0.0, + saldo: 0.0, + situacion: false, + facturasVencidas: 0.0 + }; + $scope.factura.articulosFactura = []; $scope.idLista = undefined; @@ -252,21 +260,31 @@ angular.module('focaCrearFactura').controller('facturaController', [ ); modalInstance.result.then( function (cliente) { - var modalInstance = $uibModal.open( - { - templateUrl: 'modal-estado-cuenta.html', - controller: 'focaModalEstadoCuentaController', - size: 'lg', - resolve: { - parametros: function () { - return { - idCliente: cliente.COD, - nombreCliente: cliente.NOM - }; - }, - } - } - ); + crearFacturaService.getResumenCuenta(cliente.COD) + .then(function (res) { + $scope.estadoCuenta = res.data[0]; + if ($scope.estadoCuenta.autorizado > 0) { + var modalInstance = $uibModal.open( + { + templateUrl: 'modal-estado-cuenta.html', + controller: 'focaModalEstadoCuentaController', + size: 'lg', + resolve: { + parametros: function () { + return { + idCliente: cliente.COD, + nombreCliente: cliente.NOM + }; + }, + } + } + ) + }; + + }) + .catch(function (err) { console.error(err); }) + + modalInstance.result .then(function (data) { @@ -660,20 +678,20 @@ angular.module('focaCrearFactura').controller('facturaController', [ producto: producto.despachos[0].PRO, carga: producto.despachos[0].CAR }) - .then(function () { - $scope.factura.articulosFactura.push(articulo); - $scope.factura.despachos.push(producto.despachos[0]); - }) - .catch(function (err) { + .then(function () { + $scope.factura.articulosFactura.push(articulo); + $scope.factura.despachos.push(producto.despachos[0]); + }) + .catch(function (err) { - console.error(err); - focaModalService.alert('El despacho esta en uso'); - }); + console.error(err); + focaModalService.alert('El despacho esta en uso'); + }); }) - .catch(function (err) { - console.error(err); - }); + .catch(function (err) { + console.error(err); + }); }; diff --git a/src/views/modal-estado-cuenta.html b/src/views/modal-estado-cuenta.html index 24014dd..6c13848 100644 --- a/src/views/modal-estado-cuenta.html +++ b/src/views/modal-estado-cuenta.html @@ -8,12 +8,6 @@
Cliente
@@ -22,56 +16,56 @@Autorizado
- +Autorizado
+ +Extracciones
- +Extracciones
+ +Saldo
- +Saldo
+ +Situacion
-Permitido -
-No permitido -
- +Situacion
+Permitido +
+No permitido +
+ +Facturas Vencidas
- +Facturas Vencidas
+ +