Commit c715b4d4c1cf7b83f97d2bb8538a2bf908d3a6f6
1 parent
0994b282cc
Exists in
master
cc abre solo si cliente posee cc
Showing
2 changed files
with
96 additions
and
84 deletions
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,31 @@ 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 | + }) | |
285 | + .catch(function (err) { console.error(err); }) | |
286 | + | |
287 | + | |
270 | 288 | modalInstance.result |
271 | 289 | .then(function (data) { |
272 | 290 | |
... | ... | @@ -660,20 +678,20 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
660 | 678 | producto: producto.despachos[0].PRO, |
661 | 679 | carga: producto.despachos[0].CAR |
662 | 680 | }) |
663 | - .then(function () { | |
664 | - $scope.factura.articulosFactura.push(articulo); | |
665 | - $scope.factura.despachos.push(producto.despachos[0]); | |
666 | - }) | |
667 | - .catch(function (err) { | |
681 | + .then(function () { | |
682 | + $scope.factura.articulosFactura.push(articulo); | |
683 | + $scope.factura.despachos.push(producto.despachos[0]); | |
684 | + }) | |
685 | + .catch(function (err) { | |
668 | 686 | |
669 | - console.error(err); | |
670 | - focaModalService.alert('El despacho esta en uso'); | |
671 | - }); | |
687 | + console.error(err); | |
688 | + focaModalService.alert('El despacho esta en uso'); | |
689 | + }); | |
672 | 690 | |
673 | 691 | }) |
674 | - .catch(function (err) { | |
675 | - console.error(err); | |
676 | - }); | |
692 | + .catch(function (err) { | |
693 | + console.error(err); | |
694 | + }); | |
677 | 695 | |
678 | 696 | }; |
679 | 697 |
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> |
... | ... | @@ -87,29 +81,29 @@ |
87 | 81 | <div class="row h-25 align-items-center mx-0 botonera-secundaria"> |
88 | 82 | <div class="col-6 col-sm-4 offset-sm-2"> |
89 | 83 | <button |
90 | - type="button" | |
84 | + type="button" | |
91 | 85 | class="btn btn-sm btn-block btn-tarjeta rounded border p-1" |
92 | 86 | ng-disabled="!estadoCuenta.situacion" |
93 | 87 | ng-click="elegirTipoDePago({tipo: 'Contado', formaDePago: 1})" |
94 | - > | |
88 | + > | |
95 | 89 | <img ng-src="./img/contado.png" alt=""> |
96 | 90 | <p class="m-0">Contado</p> |
97 | 91 | </button> |
98 | 92 | </div> |
99 | 93 | <div class="col-6 col-sm-4"> |
100 | 94 | <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})" | |
95 | + type="button" | |
96 | + class="btn btn-sm btn-block btn-tarjeta rounded border p-1" | |
97 | + ng-disabled="!estadoCuenta.situacion" | |
98 | + foca-focus="true" | |
99 | + ng-click="elegirTipoDePago({tipo: 'Cuenta Corriente', formaDePago: 2})" | |
106 | 100 | > |
107 | - <img ng-src="./img/cuentaCorriente.png" alt=""> | |
108 | - <p class="m-0">Cta. Corriente</p> | |
109 | - </button> | |
110 | - </div> | |
101 | + <img ng-src="./img/cuentaCorriente.png" alt=""> | |
102 | + <p class="m-0">Cta. Corriente</p> | |
103 | + </button> | |
111 | 104 | </div> |
112 | 105 | </div> |
106 | +</div> | |
113 | 107 | <div class="modal-footer py-2"> |
114 | 108 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
115 | 109 | </div> |