Commit 7170485c7611e2e8e444d16df88d8ef58c8445d7

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

agrego foca-botonera-facturador

See merge request !9
... ... @@ -34,6 +34,7 @@
34 34 <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script>
35 35 <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script>
36 36 <script src="node_modules/foca-modal-nota-pedido/dist/foca-modal-nota-pedido.min.js"></script>
  37 + <script src="node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js"></script>
37 38  
38 39 <script src="src/js/app.js"></script>
39 40 <script src="src/js/controller.js"></script>
... ... @@ -8,7 +8,7 @@
8 8 "compile": "gulp uglify",
9 9 "gulp-pre-commit": "gulp pre-commit",
10 10 "postinstall": "npm run compile && gulp clean-post-install",
11   - "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route angular-cookies bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git git+https://debo.suite.repo/modulos-npm/foca-configuracion.git"
  11 + "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route angular-cookies bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+http://git.focasoftware.com/npm/foca-directivas.git git+http://git.focasoftware.com/npm/foca-modal-vendedores.git git+http://git.focasoftware.com/npm/foca-modal-proveedor.git git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git git+http://git.focasoftware.com/npm/foca-modal-flete.git git+http://git.focasoftware.com/npm/foca-modal.git git+http://git.focasoftware.com/npm/foca-modal-domicilio.git git+http://git.focasoftware.com/npm/foca-seguimiento.git git+http://git.focasoftware.com/npm/foca-modal-moneda.git git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git git+http://git.focasoftware.com/npm/foca-configuracion.git"
12 12 },
13 13 "pre-commit": [
14 14 "gulp-pre-commit"
... ... @@ -20,12 +20,12 @@
20 20 "author": "Foca Software",
21 21 "license": "ISC",
22 22 "peerDependencies": {
23   - "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git",
24   - "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git",
25   - "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos",
26   - "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git",
27   - "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git",
28   - "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git"
  23 + "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git",
  24 + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
  25 + "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git",
  26 + "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git",
  27 + "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git",
  28 + "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git"
29 29 },
30 30 "devDependencies": {
31 31 "angular": "^1.7.5",
... ... @@ -33,19 +33,20 @@
33 33 "angular-ladda": "^0.4.3",
34 34 "angular-route": "^1.7.5",
35 35 "bootstrap": "^4.1.3",
36   - "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git",
37   - "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git",
38   - "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git",
39   - "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git",
40   - "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos",
41   - "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git",
42   - "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git",
43   - "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete",
44   - "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git",
45   - "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git",
46   - "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git",
47   - "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git",
48   - "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git",
  36 + "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git",
  37 + "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git",
  38 + "foca-configuracion": "git+http://git.focasoftware.com/npm/foca-configuracion.git",
  39 + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
  40 + "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git",
  41 + "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git",
  42 + "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git",
  43 + "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git",
  44 + "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git",
  45 + "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git",
  46 + "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git",
  47 + "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git",
  48 + "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git",
  49 + "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git",
49 50 "font-awesome": "^4.7.0",
50 51 "gulp": "^3.9.1",
51 52 "gulp-angular-templatecache": "^2.2.5",
src/js/controller.js
... ... @@ -6,30 +6,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
6 6 $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService,
7 7 remitoBusinessService, $rootScope)
8 8 {
9   - $scope.botonera = [
10   - {texto: 'Nota Pedido', imagen: '../img/abmPrecios.png', accion: function() {
11   - varlidarRemitoFacturado($scope.seleccionarNotaPedido);}},
12   - {texto: 'Vendedor', imagen: '../img/abmPrecios.png', accion: function() {
13   - varlidarRemitoFacturado($scope.seleccionarVendedor);}},
14   - {texto: 'Cliente', imagen: '../img/abmPrecios.png', accion: function() {
15   - varlidarRemitoFacturado($scope.seleccionarCliente);}},
16   - {texto: 'Proveedor', imagen: '../img/abmPrecios.png', accion: function() {
17   - varlidarRemitoFacturado($scope.seleccionarProveedor);}},
18   - {texto: 'Moneda', imagen: '../img/abmPrecios.png', accion: function() {
19   - varlidarRemitoFacturado($scope.abrirModalMoneda);}},
20   - {texto: 'Precios y condiciones', imagen: '../img/abmPrecios.png',
21   - accion: function() {varlidarRemitoFacturado($scope.abrirModalListaPrecio);}},
22   - {texto: 'Flete', imagen: '../img/abmPrecios.png', accion: function() {
23   - varlidarRemitoFacturado($scope.abrirModalFlete);}},
24   - {texto: 'Productos', imagen: '../img/abmPrecios.png', accion: function() {
25   - $scope.seleccionarArticulo();
26   - }},
27   - {texto: '', accion: function() {}},
28   - {texto: '', accion: function() {}},
29   - {texto: '', accion: function() {}},
30   - {texto: '', accion: function() {}}
31   -
32   - ];
  9 + $scope.botonera = crearRemitoService.getBotonera();
33 10 $scope.isNumber = angular.isNumber;
34 11 $scope.datepickerAbierto = false;
35 12 $scope.show = false;
... ... @@ -89,115 +66,118 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
89 66 );
90 67  
91 68 $scope.seleccionarNotaPedido = function() {
92   - var modalInstance = $uibModal.open(
93   - {
94   - ariaLabelledBy: 'Busqueda de Nota de Pedido',
95   - templateUrl: 'foca-modal-nota-pedido.html',
96   - controller: 'focaModalNotaPedidoController',
97   - size: 'lg',
98   - resolve: {
99   - usadoPor: function() {
100   - return 'remito';
  69 + if(varlidarRemitoFacturado()) {
  70 + var modalInstance = $uibModal.open(
  71 + {
  72 + ariaLabelledBy: 'Busqueda de Nota de Pedido',
  73 + templateUrl: 'foca-modal-nota-pedido.html',
  74 + controller: 'focaModalNotaPedidoController',
  75 + size: 'lg',
  76 + resolve: {
  77 + usadoPor: function() {
  78 + return 'remito';
  79 + }
101 80 }
102 81 }
103   - }
104   - );
105   - modalInstance.result.then(
106   - function(notaPedido) {
107   - //aรฑado cabeceras
108   - $scope.notaPedido.id = notaPedido.id;
109   - removeCabecera('Bomba:');
110   - removeCabecera('Kilometros:');
111   - var cabeceras = [
112   - {
113   - label: 'Moneda:',
114   - valor: notaPedido.cotizacion.moneda.DETALLE
115   - },
116   - {
117   - label: 'Fecha cotizacion:',
118   - valor: $filter('date')(notaPedido.cotizacion.FECHA,
119   - 'dd/MM/yyyy')
120   - },
121   - {
122   - label: 'Cotizacion:',
123   - valor: notaPedido.cotizacion.VENDEDOR
124   - },
125   - {
126   - label: 'Cliente:',
127   - valor: notaPedido.cliente.NOM
128   - },
129   - {
130   - label: 'Domicilio:',
131   - valor: notaPedido.domicilioStamp
132   - },
133   - {
134   - label: 'Vendedor:',
135   - valor: notaPedido.vendedor.NomVen
136   - },
137   - {
138   - label: 'Proveedor:',
139   - valor: notaPedido.proveedor.NOM
140   - },
141   - {
142   - label: 'Precio condicion:',
143   - valor: valorPrecioCondicion() + ' ' +
144   - remitoBusinessService.plazoToString(notaPedido.notaPedidoPlazo)
145   - },
146   - {
147   - label: 'Flete:',
148   - valor: notaPedido.fob === 1 ? 'FOB' : (
149   - notaPedido.flete === 1 ? 'Si' : 'No')
150   - }
151   - ];
152   -
153   - function valorPrecioCondicion() {
154   - if(notaPedido.idPrecioCondicion > 0) {
155   - return notaPedido.precioCondicion.nombre;
156   - } else {
157   - return 'Ingreso Manual';
  82 + );
  83 + modalInstance.result.then(
  84 + function(notaPedido) {
  85 + //aรฑado cabeceras
  86 + $scope.notaPedido.id = notaPedido.id;
  87 + $scope.$broadcast('removeCabecera', 'Bomba:');
  88 + $scope.$broadcast('removeCabecera', 'Kilometros:');
  89 + var cabeceras = [
  90 + {
  91 + label: 'Moneda:',
  92 + valor: notaPedido.cotizacion.moneda.DETALLE
  93 + },
  94 + {
  95 + label: 'Fecha cotizacion:',
  96 + valor: $filter('date')(notaPedido.cotizacion.FECHA,
  97 + 'dd/MM/yyyy')
  98 + },
  99 + {
  100 + label: 'Cotizacion:',
  101 + valor: notaPedido.cotizacion.VENDEDOR
  102 + },
  103 + {
  104 + label: 'Cliente:',
  105 + valor: notaPedido.cliente.NOM
  106 + },
  107 + {
  108 + label: 'Domicilio:',
  109 + valor: notaPedido.domicilioStamp
  110 + },
  111 + {
  112 + label: 'Vendedor:',
  113 + valor: notaPedido.vendedor.NomVen
  114 + },
  115 + {
  116 + label: 'Proveedor:',
  117 + valor: notaPedido.proveedor.NOM
  118 + },
  119 + {
  120 + label: 'Precio condicion:',
  121 + valor: valorPrecioCondicion() + ' ' +
  122 + remitoBusinessService
  123 + .plazoToString(notaPedido.notaPedidoPlazo)
  124 + },
  125 + {
  126 + label: 'Flete:',
  127 + valor: notaPedido.fob === 1 ? 'FOB' : (
  128 + notaPedido.flete === 1 ? 'Si' : 'No')
  129 + }
  130 + ];
  131 +
  132 + function valorPrecioCondicion() {
  133 + if(notaPedido.idPrecioCondicion > 0) {
  134 + return notaPedido.precioCondicion.nombre;
  135 + }else {
  136 + return 'Ingreso Manual';
  137 + }
158 138 }
159   - }
160   -
161   - if(notaPedido.flete === 1) {
162   - var cabeceraBomba = {
163   - label: 'Bomba:',
164   - valor: notaPedido.bomba === 1 ? 'Si' : 'No'
165   - };
166   - if(notaPedido.kilometros) {
167   - var cabeceraKilometros = {
168   - label: 'Kilometros:',
169   - valor: notaPedido.kilometros
  139 +
  140 + if(notaPedido.flete === 1) {
  141 + var cabeceraBomba = {
  142 + label: 'Bomba:',
  143 + valor: notaPedido.bomba === 1 ? 'Si' : 'No'
170 144 };
171   - cabeceras.push(cabeceraKilometros);
  145 + if(notaPedido.kilometros) {
  146 + var cabeceraKilometros = {
  147 + label: 'Kilometros:',
  148 + valor: notaPedido.kilometros
  149 + };
  150 + cabeceras.push(cabeceraKilometros);
  151 + }
  152 + cabeceras.push(cabeceraBomba);
172 153 }
173   - cabeceras.push(cabeceraBomba);
174   - }
175   -
176   - for (var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) {
177   - notaPedido.articulosNotaPedido[i].id = 0;
178   - }
179   -
180   - $scope.articulosTabla = notaPedido.articulosNotaPedido;
181   - remitoBusinessService.calcularArticulos($scope.articulosTabla,
182   - notaPedido.cotizacion.VENDEDOR);
183   -
184   - if(notaPedido.idPrecioCondicion > 0) {
185   - $scope.idLista = notaPedido.precioCondicion.idListaPrecio;
186   - } else {
187   - $scope.idLista = -1;
  154 +
  155 + for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) {
  156 + notaPedido.articulosNotaPedido[i].id = 0;
  157 + }
  158 +
  159 + $scope.articulosTabla = notaPedido.articulosNotaPedido;
  160 + remitoBusinessService.calcularArticulos($scope.articulosTabla,
  161 + notaPedido.cotizacion.VENDEDOR);
  162 +
  163 + if(notaPedido.idPrecioCondicion > 0) {
  164 + $scope.idLista = notaPedido.precioCondicion.idListaPrecio;
  165 + }else {
  166 + $scope.idLista = -1;
  167 + }
  168 +
  169 + delete notaPedido.id;
  170 + $scope.remito = notaPedido;
  171 + $scope.remito.id = 0;
  172 + $scope.remito.moneda = notaPedido.cotizacion.moneda;
  173 + $scope.plazosPagos = notaPedido.notaPedidoPlazo;
  174 + addArrayCabecera(cabeceras);
  175 +
  176 + }, function() {
  177 + // funcion ejecutada cuando se cancela el modal
188 178 }
189   -
190   - delete notaPedido.id;
191   - $scope.remito = notaPedido;
192   - $scope.remito.id = 0;
193   - $scope.remito.moneda = notaPedido.cotizacion.moneda;
194   - $scope.plazosPagos = notaPedido.notaPedidoPlazo;
195   - addArrayCabecera(cabeceras);
196   -
197   - }, function() {
198   - // funcion ejecutada cuando se cancela el modal
199   - }
200   - );
  179 + );
  180 + }
201 181 };
202 182  
203 183 $scope.seleccionarRemito = function() {
... ... @@ -213,9 +193,9 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
213 193 modalInstance.result.then(
214 194 function(remito) {
215 195 //aรฑado cabeceras
216   - removeCabecera('Moneda:');
217   - removeCabecera('Fecha cotizacion:');
218   - removeCabecera('Cotizacion:');
  196 + $scope.$broadcast('removeCabecera', 'Moneda:');
  197 + $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
  198 + $scope.$broadcast('removeCabecera', 'Cotizacion:');
219 199 var cabeceras = [
220 200 {
221 201 label: 'Moneda:',
... ... @@ -260,7 +240,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
260 240 function valorPrecioCondicion() {
261 241 if(remito.idPrecioCondicion > 0) {
262 242 return remito.precioCondicion.nombre;
263   - } else {
  243 + }else {
264 244 return 'Ingreso Manual';
265 245 }
266 246 }
... ... @@ -284,7 +264,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
284 264 remito.cotizacion.VENDEDOR);
285 265 if(remito.idPrecioCondicion > 0) {
286 266 $scope.idLista = remito.precioCondicion.idListaPrecio;
287   - } else {
  267 + }else {
288 268 $scope.idLista = -1;
289 269 }
290 270 $scope.puntoVenta = rellenar(remito.sucursal, 4);
... ... @@ -304,24 +284,24 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
304 284 if(!$scope.remito.vendedor) {
305 285 focaModalService.alert('Ingrese Vendedor');
306 286 return;
307   - } else if(!$scope.remito.cliente) {
  287 + }else if(!$scope.remito.cliente) {
308 288 focaModalService.alert('Ingrese Cliente');
309 289 return;
310   - } else if(!$scope.remito.proveedor) {
  290 + }else if(!$scope.remito.proveedor) {
311 291 focaModalService.alert('Ingrese Proveedor');
312 292 return;
313   - } else if(!$scope.remito.moneda.id && !$scope.remito.moneda.ID) {
  293 + }else if(!$scope.remito.moneda.id && !$scope.remito.moneda.ID) {
314 294 focaModalService.alert('Ingrese Moneda');
315 295 return;
316   - } else if(!$scope.remito.cotizacion.ID) {
  296 + }else if(!$scope.remito.cotizacion.ID) {
317 297 focaModalService.alert('Ingrese Cotizaciรณn');
318 298 return;
319   - } else if(
  299 + }else if(
320 300 $scope.remito.flete === undefined || $scope.remito.flete === null)
321 301 {
322 302 focaModalService.alert('Ingrese Flete');
323 303 return;
324   - } else if($scope.articulosTabla.length === 0) {
  304 + }else if($scope.articulosTabla.length === 0) {
325 305 focaModalService.alert('Debe cargar al menos un articulo');
326 306 return;
327 307 }
... ... @@ -392,14 +372,19 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
392 372 }
393 373 }
394 374  
395   - $scope.cabecera = [];
396   -
397   - addCabecera('Moneda:', $scope.remito.moneda.DETALLE);
398   - addCabecera(
399   - 'Fecha cotizacion:',
400   - $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy')
401   - );
402   - addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION);
  375 + $scope.$broadcast('cleanCabecera');
  376 + $scope.$broadcast('addCabecera',{
  377 + label: 'Moneda:',
  378 + valor: $scope.remito.moneda.DETALLE
  379 + });
  380 + $scope.$broadcast('addCabecera',{
  381 + label: 'Fecha cotizacion:',
  382 + valor: $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy')
  383 + });
  384 + $scope.$broadcast('addCabecera',{
  385 + label: 'Cotizacion:',
  386 + valor: $scope.remito.cotizacion.COTIZACION
  387 + });
403 388 $scope.remito.vendedor = {};
404 389 $scope.remito.cliente = {};
405 390 $scope.remito.proveedor = {};
... ... @@ -431,8 +416,8 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
431 416 );
432 417 };
433 418  
434   - $scope.seleccionarArticulo = function() {
435   - if ($scope.idLista === undefined) {
  419 + $scope.seleccionarProductos = function() {
  420 + if($scope.idLista === undefined) {
436 421 focaModalService.alert(
437 422 'Primero seleccione una lista de precio y condicion');
438 423 return;
... ... @@ -486,65 +471,76 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
486 471 };
487 472  
488 473 $scope.seleccionarVendedor = function() {
489   - var modalInstance = $uibModal.open(
490   - {
491   - ariaLabelledBy: 'Busqueda de Vendedores',
492   - templateUrl: 'modal-vendedores.html',
493   - controller: 'modalVendedoresCtrl',
494   - size: 'lg'
495   - }
496   - );
497   - modalInstance.result.then(
498   - function(vendedor) {
499   - addCabecera('Vendedor:', vendedor.NomVen);
500   - $scope.remito.idVendedor = vendedor.CodVen;
501   - }, function() {
502   -
503   - }
504   - );
  474 + if(varlidarRemitoFacturado()) {
  475 + var modalInstance = $uibModal.open(
  476 + {
  477 + ariaLabelledBy: 'Busqueda de Vendedores',
  478 + templateUrl: 'modal-vendedores.html',
  479 + controller: 'modalVendedoresCtrl',
  480 + size: 'lg'
  481 + }
  482 + );
  483 + modalInstance.result.then(
  484 + function(vendedor) {
  485 + $scope.$broadcast('addCabecera',{
  486 + label: 'Vendedor:',
  487 + valor: vendedor.NomVen
  488 + });
  489 + $scope.remito.idVendedor = vendedor.CodVen;
  490 + }, function() {
  491 +
  492 + }
  493 + );
  494 + }
505 495 };
506 496  
507 497 $scope.seleccionarProveedor = function() {
508   - var modalInstance = $uibModal.open(
509   - {
510   - ariaLabelledBy: 'Busqueda de Proveedor',
511   - templateUrl: 'modal-proveedor.html',
512   - controller: 'focaModalProveedorCtrl',
513   - size: 'lg',
514   - resolve: {
515   - transportista: function() {
516   - return false;
  498 + if(varlidarRemitoFacturado()) {
  499 + var modalInstance = $uibModal.open(
  500 + {
  501 + ariaLabelledBy: 'Busqueda de Proveedor',
  502 + templateUrl: 'modal-proveedor.html',
  503 + controller: 'focaModalProveedorCtrl',
  504 + size: 'lg',
  505 + resolve: {
  506 + transportista: function() {
  507 + return false;
  508 + }
517 509 }
518 510 }
519   - }
520   - );
521   - modalInstance.result.then(
522   - function(proveedor) {
523   - $scope.remito.idProveedor = proveedor.COD;
524   - addCabecera('Proveedor:', proveedor.NOM);
525   - }, function() {
526   -
527   - }
528   - );
  511 + );
  512 + modalInstance.result.then(
  513 + function(proveedor) {
  514 + $scope.remito.idProveedor = proveedor.COD;
  515 + $scope.$broadcast('addCabecera',{
  516 + label: 'Proveedor:',
  517 + valor: proveedor.NOM
  518 + });
  519 + }, function() {
  520 +
  521 + }
  522 + );
  523 + }
529 524 };
530 525  
531 526 $scope.seleccionarCliente = function() {
532   -
533   - var modalInstance = $uibModal.open(
534   - {
535   - ariaLabelledBy: 'Busqueda de Cliente',
536   - templateUrl: 'foca-busqueda-cliente-modal.html',
537   - controller: 'focaBusquedaClienteModalController',
538   - size: 'lg'
539   - }
540   - );
541   - modalInstance.result.then(
542   - function(cliente) {
543   - $scope.abrirModalDomicilios(cliente);
544   - }, function() {
545   -
546   - }
547   - );
  527 + if(varlidarRemitoFacturado()) {
  528 + var modalInstance = $uibModal.open(
  529 + {
  530 + ariaLabelledBy: 'Busqueda de Cliente',
  531 + templateUrl: 'foca-busqueda-cliente-modal.html',
  532 + controller: 'focaBusquedaClienteModalController',
  533 + size: 'lg'
  534 + }
  535 + );
  536 + modalInstance.result.then(
  537 + function(cliente) {
  538 + $scope.abrirModalDomicilios(cliente);
  539 + }, function() {
  540 +
  541 + }
  542 + );
  543 + }
548 544 };
549 545  
550 546 $scope.abrirModalDomicilios = function(cliente) {
... ... @@ -566,12 +562,20 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
566 562 NOM: cliente.nom
567 563 };
568 564  
569   - addCabecera('Cliente:', cliente.nom);
  565 +
570 566 var domicilioStamp =
571 567 domicilio.Calle + ' ' + domicilio.Numero + ', ' +
572 568 domicilio.Localidad + ', ' + domicilio.Provincia;
573 569 $scope.remito.domicilioStamp = domicilioStamp;
574   - addCabecera('Domicilio:', domicilioStamp);
  570 +
  571 + $scope.$broadcast('addCabecera',{
  572 + label: 'Cliente:',
  573 + valor: cliente.nom
  574 + });
  575 + $scope.$broadcast('addCabecera',{
  576 + label: 'Domicilio:',
  577 + valor: domicilioStamp
  578 + });
575 579 }, function() {
576 580 $scope.seleccionarCliente();
577 581 return;
... ... @@ -593,7 +597,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
593 597 $scope.getTotal = function() {
594 598 var total = 0;
595 599 var arrayTempArticulos = $scope.articulosTabla;
596   - for (var i = 0; i < arrayTempArticulos.length; i++) {
  600 + for(var i = 0; i < arrayTempArticulos.length; i++) {
597 601 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
598 602 }
599 603 return parseFloat(total.toFixed(2));
... ... @@ -605,107 +609,125 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
605 609 }
606 610 };
607 611  
608   - $scope.abrirModalListaPrecio = function() {
609   - var modalInstance = $uibModal.open(
610   - {
611   - ariaLabelledBy: 'Busqueda de Precio Condiciรณn',
612   - templateUrl: 'modal-precio-condicion.html',
613   - controller: 'focaModalPrecioCondicionController',
614   - size: 'lg'
615   - }
616   - );
617   - modalInstance.result.then(
618   - function(precioCondicion) {
619   - var cabecera = '';
620   - var plazosConcat = '';
621   - if(!Array.isArray(precioCondicion)) {
622   - $scope.remito.idPrecioCondicion = precioCondicion.id;
623   - $scope.plazosPagos = precioCondicion.plazoPago;
624   - $scope.idLista = precioCondicion.idListaPrecio;
625   - for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
626   - plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
627   - }
628   - cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
629   - } else { //Cuando se ingresan los plazos manualmente
630   - $scope.remito.idPrecioCondicion = 0;
631   - $scope.idLista = -1; //-1, el modal productos busca todos los productos
632   - $scope.plazosPagos = precioCondicion;
633   - for(var j = 0; j < precioCondicion.length; j++) {
634   - plazosConcat += precioCondicion[j].dias + ' ';
  612 + $scope.seleccionarPreciosYCondiciones = function() {
  613 + if(varlidarRemitoFacturado()) {
  614 + var modalInstance = $uibModal.open(
  615 + {
  616 + ariaLabelledBy: 'Busqueda de Precio Condiciรณn',
  617 + templateUrl: 'modal-precio-condicion.html',
  618 + controller: 'focaModalPrecioCondicionController',
  619 + size: 'lg'
  620 + }
  621 + );
  622 + modalInstance.result.then(
  623 + function(precioCondicion) {
  624 + var cabecera = '';
  625 + var plazosConcat = '';
  626 + if(!Array.isArray(precioCondicion)) {
  627 + $scope.remito.idPrecioCondicion = precioCondicion.id;
  628 + $scope.plazosPagos = precioCondicion.plazoPago;
  629 + $scope.idLista = precioCondicion.idListaPrecio;
  630 + for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
  631 + plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
  632 + }
  633 + cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
  634 + }else { //Cuando se ingresan los plazos manualmente
  635 + $scope.remito.idPrecioCondicion = 0;
  636 + //-1, el modal productos busca todos los productos
  637 + $scope.idLista = -1;
  638 + $scope.plazosPagos = precioCondicion;
  639 + for(var j = 0; j < precioCondicion.length; j++) {
  640 + plazosConcat += precioCondicion[j].dias + ' ';
  641 + }
  642 + cabecera = 'Ingreso manual ' + plazosConcat.trim();
635 643 }
636   - cabecera = 'Ingreso manual ' + plazosConcat.trim();
  644 + $scope.articulosTabla = [];
  645 + $scope.$broadcast('addCabecera',{
  646 + label: 'Precios y condiciones:',
  647 + valor: cabecera
  648 + });
  649 + }, function() {
  650 +
637 651 }
638   - $scope.articulosTabla = [];
639   - addCabecera('Precios y condiciones:', cabecera);
640   - }, function() {
641   -
642   - }
643   - );
  652 + );
  653 + }
644 654 };
645 655  
646   - $scope.abrirModalFlete = function() {
647   - var modalInstance = $uibModal.open(
648   - {
649   - ariaLabelledBy: 'Busqueda de Flete',
650   - templateUrl: 'modal-flete.html',
651   - controller: 'focaModalFleteController',
652   - size: 'lg',
653   - resolve: {
654   - parametrosFlete:
655   - function() {
656   - return {
657   - flete: $scope.remito.flete ? '1' :
658   - ($scope.remito.fob ? 'FOB' :
659   - ($scope.remito.flete === undefined ? null : '0')),
660   - bomba: $scope.remito.bomba ? '1' :
661   - ($scope.remito.bomba === undefined ? null : '0'),
662   - kilometros: $scope.remito.kilometros
663   - };
664   - }
  656 + $scope.seleccionarFlete = function() {
  657 + if(varlidarRemitoFacturado()) {
  658 + var modalInstance = $uibModal.open(
  659 + {
  660 + ariaLabelledBy: 'Busqueda de Flete',
  661 + templateUrl: 'modal-flete.html',
  662 + controller: 'focaModalFleteController',
  663 + size: 'lg',
  664 + resolve: {
  665 + parametrosFlete:
  666 + function() {
  667 + return {
  668 + flete: $scope.remito.flete ? '1' :
  669 + ($scope.remito.fob ? 'FOB' :
  670 + ($scope.remito.flete === undefined ? null : '0')),
  671 + bomba: $scope.remito.bomba ? '1' :
  672 + ($scope.remito.bomba === undefined ? null : '0'),
  673 + kilometros: $scope.remito.kilometros
  674 + };
  675 + }
  676 + }
665 677 }
666   - }
667   - );
668   - modalInstance.result.then(
669   - function(datos) {
670   - $scope.remito.flete = datos.flete;
671   - $scope.remito.fob = datos.FOB;
672   - $scope.remito.bomba = datos.bomba;
673   - $scope.remito.kilometros = datos.kilometros;
674   -
675   - addCabecera('Flete:', datos.flete ? 'Si' :
676   - ($scope.remito.fob ? 'FOB' : 'No'));
677   - if(datos.flete) {
678   - addCabecera('Bomba:', datos.bomba ? 'Si' : 'No');
679   - addCabecera('Kilometros:', datos.kilometros);
680   - } else {
681   - removeCabecera('Bomba:');
682   - removeCabecera('Kilometros:');
683   - $scope.remito.fob = false;
684   - $scope.remito.bomba = false;
685   - $scope.remito.kilometros = null;
  678 + );
  679 + modalInstance.result.then(
  680 + function(datos) {
  681 + $scope.remito.flete = datos.flete;
  682 + $scope.remito.fob = datos.FOB;
  683 + $scope.remito.bomba = datos.bomba;
  684 + $scope.remito.kilometros = datos.kilometros;
  685 +
  686 + $scope.$broadcast('addCabecera',{
  687 + label: 'Flete:',
  688 + valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No')
  689 + });
  690 + if(datos.flete) {
  691 + $scope.$broadcast('addCabecera',{
  692 + label: 'Bomba:',
  693 + valor: datos.bomba ? 'Si' : 'No'
  694 + });
  695 + $scope.$broadcast('addCabecera',{
  696 + label: 'Kilometros:',
  697 + valor: datos.kilometros
  698 + });
  699 + }else {
  700 + $scope.$broadcast('removeCabecera', 'Bomba:');
  701 + $scope.$broadcast('removeCabecera', 'Kilometros:');
  702 + $scope.remito.fob = false;
  703 + $scope.remito.bomba = false;
  704 + $scope.remito.kilometros = null;
  705 + }
  706 + }, function() {
  707 +
686 708 }
687   - }, function() {
688   -
689   - }
690   - );
  709 + );
  710 + }
691 711 };
692 712  
693   - $scope.abrirModalMoneda = function() {
694   - var modalInstance = $uibModal.open(
695   - {
696   - ariaLabelledBy: 'Busqueda de Moneda',
697   - templateUrl: 'modal-moneda.html',
698   - controller: 'focaModalMonedaController',
699   - size: 'lg'
700   - }
701   - );
702   - modalInstance.result.then(
703   - function(moneda) {
704   - $scope.abrirModalCotizacion(moneda);
705   - }, function() {
706   -
707   - }
708   - );
  713 + $scope.seleccionarMoneda = function() {
  714 + if(varlidarRemitoFacturado()) {
  715 + var modalInstance = $uibModal.open(
  716 + {
  717 + ariaLabelledBy: 'Busqueda de Moneda',
  718 + templateUrl: 'modal-moneda.html',
  719 + controller: 'focaModalMonedaController',
  720 + size: 'lg'
  721 + }
  722 + );
  723 + modalInstance.result.then(
  724 + function(moneda) {
  725 + $scope.abrirModalCotizacion(moneda);
  726 + }, function() {
  727 +
  728 + }
  729 + );
  730 + }
709 731 };
710 732  
711 733 $scope.abrirModalCotizacion = function(moneda) {
... ... @@ -731,16 +753,22 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
731 753 $scope.remito.moneda = moneda;
732 754 $scope.remito.cotizacion = cotizacion;
733 755 if(moneda.DETALLE === 'PESOS ARGENTINOS') {
734   - removeCabecera('Moneda:');
735   - removeCabecera('Fecha cotizacion:');
736   - removeCabecera('Cotizacion:');
  756 + $scope.$broadcast('removeCabecera', 'Moneda:');
  757 + $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
  758 + $scope.$broadcast('removeCabecera', 'Cotizacion:');
737 759 }else {
738   - addCabecera('Moneda:', moneda.DETALLE);
739   - addCabecera(
740   - 'Fecha cotizacion:',
741   - $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
742   - );
743   - addCabecera('Cotizacion:', cotizacion.COTIZACION);
  760 + $scope.$broadcast('addCabecera',{
  761 + label: 'Moneda:',
  762 + valor: moneda.DETALLE
  763 + });
  764 + $scope.$broadcast('addCabecera',{
  765 + label: 'Fecha cotizacion:',
  766 + valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
  767 + });
  768 + $scope.$broadcast('addCabecera',{
  769 + label: 'Cotizacion:',
  770 + valor: cotizacion.COTIZACION
  771 + });
744 772 }
745 773 }, function() {
746 774  
... ... @@ -781,7 +809,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
781 809 $scope.cambioEdit = function(articulo, propiedad) {
782 810 if(propiedad === 'cantidad') {
783 811 articulo.editCantidad = true;
784   - } else if(propiedad === 'precio') {
  812 + }else if(propiedad === 'precio') {
785 813 articulo.editPrecio = true;
786 814 }
787 815 };
... ... @@ -834,23 +862,10 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
834 862 };
835 863 function addArrayCabecera(array) {
836 864 for(var i = 0; i < array.length; i++) {
837   - addCabecera(array[i].label, array[i].valor);
838   - }
839   - }
840   -
841   - function addCabecera(label, valor) {
842   - var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
843   - if(propiedad.length === 1) {
844   - propiedad[0].valor = valor;
845   - } else {
846   - $scope.cabecera.push({label: label, valor: valor});
847   - }
848   - }
849   -
850   - function removeCabecera(label) {
851   - var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
852   - if(propiedad.length === 1) {
853   - $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
  865 + $scope.$broadcast('addCabecera',{
  866 + label: array[i].label,
  867 + valor: array[i].valor
  868 + });
854 869 }
855 870 }
856 871  
... ... @@ -863,12 +878,12 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
863 878 return relleno;
864 879 }
865 880  
866   - function varlidarRemitoFacturado(funcion) {
867   - if($scope.remito.estado === 5) {
  881 + function varlidarRemitoFacturado() {
  882 + if($scope.remito.estado !== 5) {
  883 + return true;
  884 + }else {
868 885 focaModalService.alert('No se puede editar un remito facturado');
869   - }
870   - else {
871   - funcion();
  886 + return false();
872 887 }
873 888 }
874 889 }
... ... @@ -55,6 +55,10 @@ angular.module(&#39;focaCrearRemito&#39;)
55 55 },
56 56 getNumeroRemito: function() {
57 57 return $http.get(route + '/remito/numero-siguiente');
  58 + },
  59 + getBotonera: function() {
  60 + return ['Nota pedido', 'Vendedor', 'Cliente', 'Proveedor',
  61 + 'Moneda', 'Precios y condiciones', 'Flete', 'Productos'];
58 62 }
59 63 };
60 64 }]);
src/views/remito.html
1 1 <div class="crear-nota-remito foca-crear row">
2   - <form name="formCrearNota" ng-submit="crearRemito()" 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 border border-white border-left-0 align-middle nota-remito">
9   - <h5 class="mb-0">REMITO</h5>
10   - </div>
11   - <div class="col-12 col-sm-3 border border-white align-middle numero-remito"
12   - >
13   - Nยบ {{puntoVenta}}-{{comprobante}}
14   - <button
15   - class="btn btn-xs btn-outline-light float-right"
16   - type="button"
17   - ng-click="seleccionarRemito()"
18   - >
19   - <i class="fa fa-search"></i>
20   - </button>
21   - </div>
22   - <div class="col-7 col-sm-3 border border-white align-middle">
23   - Fecha:
24   - <span
25   - ng-show="!datepickerAbierto"
26   - ng-bind="now | date:'dd/MM/yyyy'"
27   - ng-click="datepickerAbierto = true"
28   - >
29   - </span>
30   - <input
31   - ng-show="datepickerAbierto"
32   - type="date"
33   - ng-model="now"
34   - ng-change="datepickerAbierto = false"
35   - ng-blur="datepickerAbierto = false"
36   - class="form-control form-control-sm col-8 float-right"
37   - foca-focus="datepickerAbierto"
38   - hasta-hoy
39   - />
40   - </div>
41   - <div class="col-5 col-sm-3 border border-white border-right-0 align-middle">
42   - Hora:
43   - <span
44   - ng-show="!datepickerAbierto"
45   - ng-bind="now | date:'HH:mm'"
46   - ng-click="datepickerAbierto = true"
47   - >
48   - </span>
49   - </div>
50   - </div>
51   - <div class="row py-2">
52   - <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
53   - <span class="label" ng-bind="cab.label"></span>
54   - <span class="valor" ng-bind="cab.valor" ng-if="!isNumber(cab.valor)"></span>
55   - <span class="valor" ng-bind="cab.valor | number:2" ng-if="isNumber(cab.valor)"></span>
56   - </div>
57   - <a
58   - class="btn col-12 btn-secondary d-sm-none"
59   - ng-show="cabecera.length > 0"
60   - ng-click="showCabecera = !showCabecera"
61   - >
62   - <i
63   - class="fa fa-chevron-down"
64   - ng-hide="showCabecera"
65   - aria-hidden="true"
66   - >
67   - </i>
68   - <i
69   - class="fa fa-chevron-up"
70   - ng-show="showCabecera"
71   - aria-hidden="true">
72   - </i>
73   - </a>
74   - </div>
75   - </div>
76   - </div>
77   -
78   - </div>
79   - </div>
80   - </form>
  2 + <foca-cabecera-facturador
  3 + titulo="'REMITO'"
  4 + numero="puntoVenta + '-' + comprobante"
  5 + fecha="now"
  6 + class="mb-0 col-lg-12"
  7 + busqueda="seleccionarRemito"
  8 + ></foca-cabecera-facturador>
81 9 <div class="col-lg-12">
82 10 <div class="row mt-4">
83 11 <div class="col-12 col-md-10 col-lg-10 border border-light rounded">
84 12 <div class="row p-1 botonera-secundaria px-5 py-2">
85 13 <div class="col-12">
86   - <div class="row">
87   - <div
88   - class="col-6 col-sm-2 px-1 py-1 m-auto m-md-0"
89   - ng-repeat="boton in botonera"
90   - ng-class="{'d-none d-md-grid': boton.texto == ''}">
91   - <button
92   - type="button"
93   - class="btn btn-default btn-block btn-xs text-center py-1 rounded border border-light"
94   - ng-click="boton.accion()"
95   - ng-class="{'d-sm-block h-100': boton.texto == ''}"
96   - >
97   - <img src="{{boton.imagen}}" alt="" ng-if="boton.imagen">
98   - <span>{{boton.texto}}</span>
99   - </button>
100   - </div>
101   - </div>
  14 + <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador>
102 15 </div>
103 16 </div>
104 17 <!-- PC -->
... ... @@ -114,7 +27,7 @@
114 27 <th class="col text-right">SubTotal</th>
115 28 <th class="text-right">
116 29 <button
117   - class="btn btn-outline-secondary selectable"
  30 + class="btn btn-outline-light selectable"
118 31 ng-click="show = !show; masMenos()"
119 32 >
120 33 <i
... ... @@ -192,7 +105,7 @@
192 105 </td>
193 106 <td class="text-center">
194 107 <button
195   - class="btn btn-outline-secondary"
  108 + class="btn btn-outline-light"
196 109 ng-click="quitarArticulo(key)"
197 110 >
198 111 <i class="fa fa-trash"></i>
... ... @@ -258,7 +171,7 @@
258 171 ></td>
259 172 <td class="text-center align-middle">
260 173 <button
261   - class="btn btn-outline-secondary"
  174 + class="btn btn-outline-light"
262 175 ng-click="agregarATabla(13)"
263 176 >
264 177 <i class="fa fa-save"></i>
... ... @@ -292,7 +205,7 @@
292 205  
293 206 <!-- MOBILE -->
294 207 <div class="row d-sm-none">
295   - <table class="table table-sm table-striped table-dark margin-bottom-mobile">
  208 + <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile">
296 209 <thead>
297 210 <tr class="d-flex">
298 211 <th class="">#</th>
... ... @@ -369,7 +282,7 @@
369 282 </div>
370 283 <div class="align-middle p-1">
371 284 <button
372   - class="btn btn-outline-secondary"
  285 + class="btn btn-outline-light"
373 286 ng-click="quitarArticulo(key)"
374 287 >
375 288 <i class="fa fa-trash"></i>
... ... @@ -421,7 +334,7 @@
421 334 </td>
422 335 <td class="text-center align-middle">
423 336 <button
424   - class="btn btn-outline-secondary"
  337 + class="btn btn-outline-light"
425 338 ng-click="agregarATabla(13)"
426 339 >
427 340 <i class="fa fa-save"></i>
... ... @@ -432,7 +345,7 @@
432 345 <tr>
433 346 <td class="col">
434 347 <button
435   - class="btn btn-outline-secondary selectable w-100"
  348 + class="btn btn-outline-light selectable w-100"
436 349 ng-click="show = !show; masMenos()"
437 350 ng-show="articulosTabla.length > 0"
438 351 >