Commit 3c84f5504e746b9bca682bb794e4d531e25e89e4

Authored by Eric Fernandez
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

Master(efernandez)

See merge request !2
src/js/controller.js
1 angular.module('focaParametros') 1 angular.module('focaParametros')
2 .controller('focaParametrosCtrl', [ 2 .controller('focaParametrosCtrl', [
3 '$scope', 3 '$scope',
4 'focaParametrosService', 4 'focaParametrosService',
5 'focaBotoneraLateralService', 5 'focaBotoneraLateralService',
6 '$filter', 6 '$filter',
7 'focaModalService', 7 'focaModalService',
8 '$timeout', 8 '$timeout',
9 '$uibModal', 9 '$uibModal',
10 '$location', 10 '$location',
11 function($scope, focaParametrosService, focaBotoneraLateralService, $filter, 11 function($scope, focaParametrosService, focaBotoneraLateralService, $filter,
12 focaModalService, $timeout, $uibModal, $location) 12 focaModalService, $timeout, $uibModal, $location)
13 { 13 {
14 14
15 $scope.botonera = []; 15 $scope.botonera = [];
16 $scope.now = new Date(); 16 $scope.now = new Date();
17 17
18 $scope.botoneraPrincipal = focaParametrosService.getBotonesPrincipal; 18 $scope.botoneraPrincipal = focaParametrosService.getBotonesPrincipal;
19 19
20 $timeout(function() { 20 $timeout(function() {
21 focaBotoneraLateralService.showSalir(true); 21 focaBotoneraLateralService.showSalir(true);
22 focaBotoneraLateralService.showGuardar(true, $scope.guardar); 22 focaBotoneraLateralService.showGuardar(true, $scope.guardar);
23 }); 23 });
24 24
25 focaParametrosService.getParametros().then(function(res) { 25 focaParametrosService.getParametros().then(function(res) {
26 26
27 $scope.$broadcast('cleanCabecera'); 27 $scope.$broadcast('cleanCabecera');
28 res.data.forEach(function(entidad) { 28 res.data.forEach(function(entidad) {
29 29
30 setearEntidad(entidad); 30 setearEntidad(entidad);
31 }); 31 });
32 }); 32 });
33 33
34 $scope.guardar = function() { 34 $scope.guardar = function() {
35 35
36 focaParametrosService.saveParametros(getObjGuardar()).then(function() { 36 focaParametrosService.saveParametros(getObjGuardar()).then(function() {
37 focaModalService.alert('Parámetros guardados con éxito'); 37 focaModalService.alert('Parámetros guardados con éxito');
38 $location.url('/'); 38 $location.url('/');
39 }); 39 });
40 }; 40 };
41 41
42 $scope.seleccionarPuntosDeDescarga = function() { 42 $scope.seleccionarPuntosDeDescarga = function() {
43 if (!$scope[getModulo()].cliente.COD || !$scope[getModulo()].domicilio.id) { 43 if (!$scope[getModulo()].cliente.COD || !$scope[getModulo()].domicilio.id) {
44 focaModalService.alert('Primero seleccione un cliente y un domicilio'); 44 focaModalService.alert('Primero seleccione un cliente y un domicilio');
45 return; 45 return;
46 } else { 46 } else {
47 var modalInstance = $uibModal.open( 47 var modalInstance = $uibModal.open(
48 { 48 {
49 ariaLabelledBy: 'Búsqueda de Puntos de descarga', 49 ariaLabelledBy: 'Búsqueda de Puntos de descarga',
50 templateUrl: 'modal-punto-descarga.html', 50 templateUrl: 'modal-punto-descarga.html',
51 controller: 'focaModalPuntoDescargaController', 51 controller: 'focaModalPuntoDescargaController',
52 size: 'lg', 52 size: 'lg',
53 resolve: { 53 resolve: {
54 filters: { 54 filters: {
55 idDomicilio: $scope[getModulo()].domicilio.id, 55 idDomicilio: $scope[getModulo()].domicilio.id,
56 idCliente: $scope[getModulo()].cliente.COD, 56 idCliente: $scope[getModulo()].cliente.COD,
57 articulos: $scope[getModulo()].articulosNotaPedido || [], 57 articulos: $scope[getModulo()].articulosNotaPedido || [],
58 puntoDescarga: $scope[getModulo()].notaPedidoPuntoDescarga, 58 puntoDescarga: $scope[getModulo()].notaPedidoPuntoDescarga,
59 domicilio: $scope[getModulo()].domicilio 59 domicilio: $scope[getModulo()].domicilio
60 } 60 }
61 } 61 }
62 } 62 }
63 ); 63 );
64 modalInstance.result.then( 64 modalInstance.result.then(
65 function(puntoDescarga) { 65 function(puntoDescarga) {
66 $scope[getModulo()].notaPedidoPuntoDescarga = puntoDescarga; 66 $scope[getModulo()].notaPedidoPuntoDescarga = puntoDescarga;
67 67
68 $scope.$broadcast('addCabecera', { 68 $scope.$broadcast('addCabecera', {
69 label: 'Puntos de descarga:', 69 label: 'Puntos de descarga:',
70 seccion: getModulo('label'), 70 seccion: getModulo('label'),
71 valor: getCabeceraPuntoDescarga(puntoDescarga) 71 valor: getCabeceraPuntoDescarga(puntoDescarga)
72 }); 72 });
73 }, function() { 73 }, function() {
74 $scope.abrirModalDomicilios($scope.cliente); 74 $scope.abrirModalDomicilios($scope.cliente);
75 } 75 }
76 ); 76 );
77 } 77 }
78 }; 78 };
79 79
80 $scope.seleccionarFlete = function() { 80 $scope.seleccionarFlete = function() {
81 81
82 if ($scope[getModulo()].flete === undefined) { 82 if ($scope[getModulo()].flete === undefined) {
83 $scope[getModulo()].fob = undefined; 83 $scope[getModulo()].fob = undefined;
84 $scope[getModulo()].bomba = undefined; 84 $scope[getModulo()].bomba = undefined;
85 $scope[getModulo()].kilometros = undefined; 85 $scope[getModulo()].kilometros = undefined;
86 86
87 } 87 }
88 88
89 var modalInstance = $uibModal.open( 89 var modalInstance = $uibModal.open(
90 { 90 {
91 ariaLabelledBy: 'Busqueda de Flete', 91 ariaLabelledBy: 'Busqueda de Flete',
92 templateUrl: 'modal-flete.html', 92 templateUrl: 'modal-flete.html',
93 controller: 'focaModalFleteController', 93 controller: 'focaModalFleteController',
94 size: 'lg', 94 size: 'lg',
95 resolve: { 95 resolve: {
96 parametrosFlete: 96 parametrosFlete:
97 function() { 97 function() {
98 return { 98 return {
99 flete: $scope[getModulo()].fob ? 'FOB' : 99 flete: $scope[getModulo()].fob ? 'FOB' :
100 ( $scope[getModulo()].flete ? '1' : 100 ( $scope[getModulo()].flete ? '1' :
101 ($scope[getModulo()].flete === undefined ? 101 ($scope[getModulo()].flete === undefined ?
102 null : '0')), 102 null : '0')),
103 bomba: $scope[getModulo()].bomba ? '1' : 103 bomba: $scope[getModulo()].bomba ? '1' :
104 ($scope[getModulo()].bomba === undefined ? 104 ($scope[getModulo()].bomba === undefined ?
105 null : '0'), 105 null : '0'),
106 kilometros: $scope[getModulo()].kilometros 106 kilometros: $scope[getModulo()].kilometros
107 }; 107 };
108 } 108 }
109 } 109 }
110 } 110 }
111 ); 111 );
112 modalInstance.result.then( 112 modalInstance.result.then(
113 function(datos) { 113 function(datos) {
114 $scope[getModulo()].flete = datos.flete; 114 $scope[getModulo()].flete = datos.flete;
115 $scope[getModulo()].fob = datos.FOB; 115 $scope[getModulo()].fob = datos.FOB;
116 $scope[getModulo()].bomba = datos.bomba; 116 $scope[getModulo()].bomba = datos.bomba;
117 $scope[getModulo()].kilometros = datos.kilometros; 117 $scope[getModulo()].kilometros = datos.kilometros;
118 $scope.$broadcast('addCabecera', { 118 $scope.$broadcast('addCabecera', {
119 label: 'Flete:', 119 label: 'Flete:',
120 seccion: getModulo('label'), 120 seccion: getModulo('label'),
121 valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') 121 valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No')
122 }); 122 });
123 if (datos.flete) { 123 if (datos.flete) {
124 $scope.$broadcast('addCabecera', { 124 $scope.$broadcast('addCabecera', {
125 label: 'Bomba:', 125 label: 'Bomba:',
126 seccion: getModulo('label'), 126 seccion: getModulo('label'),
127 valor: datos.bomba ? 'Si' : 'No' 127 valor: datos.bomba ? 'Si' : 'No'
128 }); 128 });
129 $scope.$broadcast('addCabecera', { 129 $scope.$broadcast('addCabecera', {
130 label: 'Kilometros:', 130 label: 'Kilometros:',
131 seccion: getModulo('label'), 131 seccion: getModulo('label'),
132 valor: datos.kilometros 132 valor: datos.kilometros
133 }); 133 });
134 } else { 134 } else {
135 $scope.$broadcast('removeCabecera', 'Bomba:'); 135 $scope.$broadcast('removeCabecera', 'Bomba:');
136 $scope.$broadcast('removeCabecera', 'Kilometros:'); 136 $scope.$broadcast('removeCabecera', 'Kilometros:');
137 $scope[getModulo()].bomba = false; 137 $scope[getModulo()].bomba = false;
138 $scope[getModulo()].kilometros = null; 138 $scope[getModulo()].kilometros = null;
139 } 139 }
140 }, function() { 140 }, function() {
141 } 141 }
142 ); 142 );
143 }; 143 };
144 144
145 $scope.seleccionarVendedor = function() { 145 $scope.seleccionarVendedor = function() {
146 146
147 var parametrosModal = { 147 var parametrosModal = {
148 titulo: 'Búsqueda vendedores', 148 titulo: 'Búsqueda vendedores',
149 query: '/vendedor', 149 query: '/vendedor',
150 columnas: [ 150 columnas: [
151 { 151 {
152 propiedad: 'NUM', 152 propiedad: 'NUM',
153 nombre: 'Código', 153 nombre: 'Código',
154 filtro: { 154 filtro: {
155 nombre: 'rellenarDigitos', 155 nombre: 'rellenarDigitos',
156 parametro: 3 156 parametro: 3
157 } 157 }
158 }, 158 },
159 { 159 {
160 propiedad: 'NOM', 160 propiedad: 'NOM',
161 nombre: 'Nombre' 161 nombre: 'Nombre'
162 } 162 }
163 ], 163 ],
164 size: 'md' 164 size: 'md'
165 }; 165 };
166 focaModalService.modal(parametrosModal).then( 166 focaModalService.modal(parametrosModal).then(
167 function(vendedor) { 167 function(vendedor) {
168 $scope.$broadcast('addCabecera', { 168 $scope.$broadcast('addCabecera', {
169 label: 'Vendedor:', 169 label: 'Vendedor:',
170 seccion: getModulo('label'), 170 seccion: getModulo('label'),
171 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + 171 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' +
172 vendedor.NOM 172 vendedor.NOM
173 }); 173 });
174 $scope[getModulo()].vendedor = vendedor; 174 $scope[getModulo()].vendedor = vendedor;
175 }, function() {} 175 }, function() {}
176 ); 176 );
177 }; 177 };
178 178
179 $scope.seleccionarCliente = function() { 179 $scope.seleccionarCliente = function() {
180 180
181 if (!$scope[getModulo()].vendedor) { 181 if (!$scope[getModulo()].vendedor) {
182 focaModalService.alert('Seleccione Vendedor'); 182 focaModalService.alert('Seleccione Vendedor');
183 return; 183 return;
184 } 184 }
185 185
186 var modalInstance = $uibModal.open( 186 var modalInstance = $uibModal.open(
187 { 187 {
188 ariaLabelledBy: 'Busqueda de Cliente', 188 ariaLabelledBy: 'Busqueda de Cliente',
189 templateUrl: 'foca-busqueda-cliente-modal.html', 189 templateUrl: 'foca-busqueda-cliente-modal.html',
190 controller: 'focaBusquedaClienteModalController', 190 controller: 'focaBusquedaClienteModalController',
191 resolve: { 191 resolve: {
192 vendedor: function() { return $scope.notaPedido.vendedor; }, 192 vendedor: function() { return $scope.notaPedido.vendedor; },
193 cobrador: function() { return null; } 193 cobrador: function() { return null; }
194 }, 194 },
195 size: 'lg' 195 size: 'lg'
196 } 196 }
197 ); 197 );
198 modalInstance.result.then( 198 modalInstance.result.then(
199 function(cliente) { 199 function(cliente) {
200 $scope.abrirModalDomicilios(cliente); 200 $scope.abrirModalDomicilios(cliente);
201 }, function() { } 201 }, function() { }
202 ); 202 );
203 }; 203 };
204 204
205 $scope.seleccionarProveedor = function() { 205 $scope.seleccionarProveedor = function() {
206 206
207 var parametrosModal = { 207 var parametrosModal = {
208 titulo: 'Búsqueda de Proveedor', 208 titulo: 'Búsqueda de Proveedor',
209 query: '/proveedor', 209 query: '/proveedor',
210 columnas: [ 210 columnas: [
211 { 211 {
212 nombre: 'Código', 212 nombre: 'Código',
213 propiedad: 'COD', 213 propiedad: 'COD',
214 filtro: { 214 filtro: {
215 nombre: 'rellenarDigitos', 215 nombre: 'rellenarDigitos',
216 parametro: 5 216 parametro: 5
217 } 217 }
218 }, 218 },
219 { 219 {
220 nombre: 'Nombre', 220 nombre: 'Nombre',
221 propiedad: 'NOM' 221 propiedad: 'NOM'
222 }, 222 },
223 { 223 {
224 nombre: 'CUIT', 224 nombre: 'CUIT',
225 propiedad: 'CUIT' 225 propiedad: 'CUIT'
226 } 226 }
227 ], 227 ],
228 tipo: 'POST', 228 tipo: 'POST',
229 json: {razonCuitCod: ''} 229 json: {razonCuitCod: ''}
230 }; 230 };
231 focaModalService.modal(parametrosModal).then( 231 focaModalService.modal(parametrosModal).then(
232 function(proveedor) { 232 function(proveedor) {
233 $scope[getModulo()].proveedor = proveedor; 233 $scope[getModulo()].proveedor = proveedor;
234 $scope.$broadcast('addCabecera', { 234 $scope.$broadcast('addCabecera', {
235 label: 'Proveedor:', 235 label: 'Proveedor:',
236 seccion: getModulo('label'), 236 seccion: getModulo('label'),
237 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + 237 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' +
238 proveedor.NOM 238 proveedor.NOM
239 }); 239 });
240 }, function() { 240 }, function() {
241 } 241 }
242 ); 242 );
243 243
244 }; 244 };
245 245
246 $scope.abrirModalDomicilios = function(cliente) { 246 $scope.abrirModalDomicilios = function(cliente) {
247 var modalInstanceDomicilio = $uibModal.open( 247 var modalInstanceDomicilio = $uibModal.open(
248 { 248 {
249 ariaLabelledBy: 'Busqueda de Domicilios', 249 ariaLabelledBy: 'Busqueda de Domicilios',
250 templateUrl: 'modal-domicilio.html', 250 templateUrl: 'modal-domicilio.html',
251 controller: 'focaModalDomicilioController', 251 controller: 'focaModalDomicilioController',
252 resolve: { 252 resolve: {
253 idCliente: function() { return cliente.cod; }, 253 idCliente: function() { return cliente.cod; },
254 esNuevo: function() { return cliente.esNuevo; } 254 esNuevo: function() { return cliente.esNuevo; }
255 }, 255 },
256 size: 'lg', 256 size: 'lg',
257 } 257 }
258 ); 258 );
259 modalInstanceDomicilio.result.then( 259 modalInstanceDomicilio.result.then(
260 function(domicilio) { 260 function(domicilio) {
261 261
262 $scope[getModulo()].domicilio = domicilio; 262 $scope[getModulo()].domicilio = domicilio;
263 263
264 $scope[getModulo()].cliente = { 264 $scope[getModulo()].cliente = {
265 COD: cliente.cod, 265 COD: cliente.cod,
266 CUIT: cliente.cuit, 266 CUIT: cliente.cuit,
267 NOM: cliente.nom, 267 NOM: cliente.nom,
268 MOD: cliente.mod 268 MOD: cliente.mod
269 }; 269 };
270 270
271 var domicilioStamp = 271 var domicilioStamp =
272 domicilio.Calle + ' ' + domicilio.Numero + ', ' + 272 domicilio.Calle + ' ' + domicilio.Numero + ', ' +
273 domicilio.Localidad + ', ' + domicilio.Provincia; 273 domicilio.Localidad + ', ' + domicilio.Provincia;
274 $scope[getModulo()].domicilioStamp = domicilioStamp; 274 $scope[getModulo()].domicilioStamp = domicilioStamp;
275 275
276 $scope[getModulo()].notaPedidoPuntoDescarga = domicilio.puntoDescarga; 276 $scope[getModulo()].notaPedidoPuntoDescarga = domicilio.puntoDescarga;
277 277
278 $scope.$broadcast('addCabecera', { 278 $scope.$broadcast('addCabecera', {
279 label: 'Cliente:', 279 label: 'Cliente:',
280 seccion: getModulo('label'), 280 seccion: getModulo('label'),
281 valor: $filter('rellenarDigitos')(cliente.cod, 5) + ' - ' + cliente.nom 281 valor: $filter('rellenarDigitos')(cliente.cod, 5) + ' - ' + cliente.nom
282 }); 282 });
283 $scope.$broadcast('addCabecera', { 283 $scope.$broadcast('addCabecera', {
284 label: 'Domicilio:', 284 label: 'Domicilio:',
285 seccion: getModulo('label'), 285 seccion: getModulo('label'),
286 valor: domicilioStamp 286 valor: domicilioStamp
287 }); 287 });
288 if (domicilio.verPuntos) { 288 if (domicilio.verPuntos) {
289 delete $scope[getModulo()].domicilio.verPuntos; 289 delete $scope[getModulo()].domicilio.verPuntos;
290 $scope.seleccionarPuntosDeDescarga(); 290 $scope.seleccionarPuntosDeDescarga();
291 } else { 291 } else {
292 focaParametrosService 292 focaParametrosService
293 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) 293 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
294 .then(function(res) { 294 .then(function(res) {
295 if (res.data.length) $scope.seleccionarPuntosDeDescarga(); 295 if (res.data.length) $scope.seleccionarPuntosDeDescarga();
296 }); 296 });
297 } 297 }
298 }, function() { 298 }, function() {
299 $scope.seleccionarCliente(true); 299 $scope.seleccionarCliente(true);
300 return; 300 return;
301 } 301 }
302 ); 302 );
303 }; 303 };
304 304
305 $scope.seleccionarMoneda = function() { 305 $scope.seleccionarMoneda = function() {
306 306
307 var parametrosModal = { 307 var parametrosModal = {
308 titulo: 'Búsqueda de monedas', 308 titulo: 'Búsqueda de monedas',
309 query: '/moneda', 309 query: '/moneda',
310 columnas: [ 310 columnas: [
311 { 311 {
312 propiedad: 'DETALLE', 312 propiedad: 'DETALLE',
313 nombre: 'Nombre' 313 nombre: 'Nombre'
314 }, 314 },
315 { 315 {
316 propiedad: 'SIMBOLO', 316 propiedad: 'SIMBOLO',
317 nombre: 'Símbolo' 317 nombre: 'Símbolo'
318 } 318 }
319 ], 319 ],
320 size: 'md' 320 size: 'md'
321 }; 321 };
322 focaModalService.modal(parametrosModal).then( 322 focaModalService.modal(parametrosModal).then(
323 function(moneda) { 323 function(moneda) {
324 $scope.abrirModalCotizacion(moneda); 324 $scope.abrirModalCotizacion(moneda);
325 }, function() { 325 }, function() {
326 } 326 }
327 ); 327 );
328 328
329 }; 329 };
330 330
331 $scope.abrirModalCotizacion = function(moneda) { 331 $scope.abrirModalCotizacion = function(moneda) {
332 var modalInstance = $uibModal.open( 332 var modalInstance = $uibModal.open(
333 { 333 {
334 ariaLabelledBy: 'Busqueda de Cotización', 334 ariaLabelledBy: 'Busqueda de Cotización',
335 templateUrl: 'modal-cotizacion.html', 335 templateUrl: 'modal-cotizacion.html',
336 controller: 'focaModalCotizacionController', 336 controller: 'focaModalCotizacionController',
337 size: 'lg', 337 size: 'lg',
338 resolve: { 338 resolve: {
339 idMoneda: function() { 339 idMoneda: function() {
340 return moneda.ID; 340 return moneda.ID;
341 } 341 }
342 } 342 }
343 } 343 }
344 ); 344 );
345 modalInstance.result.then( 345 modalInstance.result.then(
346 function(cotizacion) { 346 function(cotizacion) {
347 $scope[getModulo()].cotizacion = cotizacion; 347 $scope[getModulo()].cotizacion = cotizacion;
348 $scope[getModulo()].cotizacion.moneda = moneda; 348 $scope[getModulo()].cotizacion.moneda = moneda;
349 349
350 $scope.$broadcast('addCabecera', { 350 $scope.$broadcast('addCabecera', {
351 label: 'Moneda:', 351 label: 'Moneda:',
352 seccion: getModulo('label'), 352 seccion: getModulo('label'),
353 valor: moneda.DETALLE 353 valor: moneda.DETALLE
354 }); 354 });
355 $scope.$broadcast('addCabecera', { 355 $scope.$broadcast('addCabecera', {
356 label: 'Fecha cotizacion:', 356 label: 'Fecha cotizacion:',
357 seccion: getModulo('label'), 357 seccion: getModulo('label'),
358 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 358 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
359 }); 359 });
360 $scope.$broadcast('addCabecera', { 360 $scope.$broadcast('addCabecera', {
361 label: 'Cotizacion:', 361 label: 'Cotizacion:',
362 seccion: getModulo('label'), 362 seccion: getModulo('label'),
363 valor: $filter('number')(cotizacion.VENDEDOR, '2') 363 valor: $filter('number')(cotizacion.VENDEDOR, '2')
364 }); 364 });
365 365
366 }, function() { 366 }, function() {
367 367
368 } 368 }
369 ); 369 );
370 }; 370 };
371 371
372 $scope.seleccionarObservaciones = function() { 372 $scope.seleccionarObservaciones = function() {
373 var observacion = { 373 var observacion = {
374 titulo: 'Ingrese Observaciones', 374 titulo: 'Ingrese Observaciones',
375 value: $scope[getModulo()].observaciones, 375 value: $scope[getModulo()].observaciones,
376 maxlength: 155, 376 maxlength: 155,
377 textarea: true 377 textarea: true
378 }; 378 };
379 379
380 focaModalService 380 focaModalService
381 .prompt(observacion) 381 .prompt(observacion)
382 .then(function(observaciones) { 382 .then(function(observaciones) {
383 $scope[getModulo()].observaciones = observaciones; 383 $scope[getModulo()].observaciones = observaciones;
384 $scope.$broadcast('addCabecera', { 384 $scope.$broadcast('addCabecera', {
385 label: 'Observaciones:', 385 label: 'Observaciones:',
386 valor: observaciones 386 valor: observaciones
387 }); 387 });
388 }); 388 });
389 }; 389 };
390 390
391 $scope.seleccionarPreciosYCondiciones = function() { 391 $scope.seleccionarPreciosYCondiciones = function() {
392 if (!$scope[getModulo()].cliente || !$scope[getModulo()].cliente.COD) { 392 if (!$scope[getModulo()].cliente || !$scope[getModulo()].cliente.COD) {
393 focaModalService.alert('Primero seleccione un cliente'); 393 focaModalService.alert('Primero seleccione un cliente');
394 return; 394 return;
395 } 395 }
396 396
397 var modalInstance = $uibModal.open( 397 var modalInstance = $uibModal.open(
398 { 398 {
399 ariaLabelledBy: 'Busqueda de Precio Condición', 399 ariaLabelledBy: 'Busqueda de Precio Condición',
400 templateUrl: 'modal-precio-condicion.html', 400 templateUrl: 'modal-precio-condicion.html',
401 controller: 'focaModalPrecioCondicionController', 401 controller: 'focaModalPrecioCondicionController',
402 size: 'lg', 402 size: 'lg',
403 resolve: { 403 resolve: {
404 idListaPrecio: function() { 404 idListaPrecio: function() {
405 return $scope[getModulo()].cliente.MOD || null; 405 return $scope[getModulo()].cliente.MOD || null;
406 } 406 }
407 } 407 }
408 } 408 }
409 ); 409 );
410 410
411 modalInstance.result.then( 411 modalInstance.result.then(
412 function(precioCondicion) { 412 function(precioCondicion) {
413 var cabecera = ''; 413 var cabecera = '';
414 var plazosConcat = ''; 414 var plazosConcat = '';
415 if (!Array.isArray(precioCondicion)) { 415 if (!Array.isArray(precioCondicion)) {
416 $scope[getModulo()][getModulo() + 'Plazo' ]= precioCondicion.plazoPago; 416 $scope[getModulo()][getModulo() + 'Plazo' ]= precioCondicion.plazoPago;
417 $scope[getModulo()].precioCondicion = precioCondicion; 417 $scope[getModulo()].precioCondicion = precioCondicion;
418 $scope[getModulo()].idPrecioCondicion = precioCondicion.id; 418 $scope[getModulo()].idPrecioCondicion = precioCondicion.id;
419 $scope.idLista = precioCondicion.idListaPrecio; 419 $scope.idLista = precioCondicion.idListaPrecio;
420 for (var i = 0; i < precioCondicion.plazoPago.length; i++) { 420 for (var i = 0; i < precioCondicion.plazoPago.length; i++) {
421 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 421 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
422 } 422 }
423 cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + 423 cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) +
424 ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); 424 ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim();
425 } else { //Cuando se ingresan los plazos manualmente 425 } else { //Cuando se ingresan los plazos manualmente
426 $scope[getModulo()].idPrecioCondicion = 0; 426 $scope[getModulo()].idPrecioCondicion = 0;
427 //-1, el modal productos busca todos los productos 427 //-1, el modal productos busca todos los productos
428 $scope.idLista = -1; 428 $scope.idLista = -1;
429 $scope[getModulo()][ getModulo() + 'Plazo'] = precioCondicion; 429 $scope[getModulo()][ getModulo() + 'Plazo'] = precioCondicion;
430 for (var j = 0; j < precioCondicion.length; j++) { 430 for (var j = 0; j < precioCondicion.length; j++) {
431 plazosConcat += precioCondicion[j].dias + ' '; 431 plazosConcat += precioCondicion[j].dias + ' ';
432 } 432 }
433 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 433 cabecera = 'Ingreso manual ' + plazosConcat.trim();
434 } 434 }
435 $scope.$broadcast('addCabecera', { 435 $scope.$broadcast('addCabecera', {
436 label: 'Precios y condiciones:', 436 label: 'Precios y condiciones:',
437 seccion: getModulo('label'), 437 seccion: getModulo('label'),
438 valor: cabecera 438 valor: cabecera
439 }); 439 });
440 }, function() { 440 }, function() {
441 441
442 } 442 }
443 ); 443 );
444 444
445 }; 445 };
446 446
447 $scope.seleccionarTarifario = function() {
448
449 focaModalService
450 .prompt({
451 titulo: 'Tarifa flete',
452 value: $scope[getModulo()].tarifario
453 })
454 .then(function(costo) {
455 if (isNaN(costo)) {
456 focaModalService
457 .alert('Ingrese un valor válido')
458 .then(function() {
459 $scope.seleccionarTarifario();
460 });
461
462 return;
463 }
464
465 $scope[getModulo()].tarifario = costo;
466
467 $scope.$broadcast('addCabecera', {
468 label: 'Tarifario:',
469 valor: costo,
470 seccion: getModulo('label')
471 });
472 });
473 };
474
475 $scope.seleccionarTransportista = function() {
476
477 var parametrosModal = {
478 titulo: 'Búsqueda de transportista',
479 query: '/transportista/no-relacion',
480 columnas: [
481 {
482 nombre: 'Código',
483 propiedad: 'COD'
484 },
485 {
486 nombre: 'Nombre',
487 propiedad: 'NOM'
488 },
489 {
490 nombre: 'CUIT',
491 propiedad: 'CUIT'
492 }
493 ]
494 };
495 focaModalService.modal(parametrosModal).then(
496 function(proveedor) {
497 $scope[getModulo()].transportista = proveedor;
498 $scope.$broadcast('addCabecera', {
499 label: 'Transportista:',
500 seccion: getModulo('label'),
501 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' +
502 proveedor.NOM
503 });
504 }, function() {
505 }
506 );
507 };
508
447 $scope.$watch('botonera', function() { 509 $scope.$watch('botonera', function() {
448 510
449 // Creo el string en donde guardo el objeto parseado 511 // Creo el string en donde guardo el objeto parseado
450 $scope[getModulo()] = $scope[getModulo()] || {}; 512 $scope[getModulo()] = $scope[getModulo()] || {};
451 513
452 getCheckeds(); 514 getCheckeds();
453 }, true); 515 }, true);
454 516
455 $scope.botoneraPrincipal.forEach(function(botonPincipal) { 517 $scope.botoneraPrincipal.forEach(function(botonPincipal) {
456 518
457 // watch en objetos principales para ir guardando los valores 519 // watch en objetos principales para ir guardando los valores
458 $scope.$watch(botonPincipal.variable, function() { 520 $scope.$watch(botonPincipal.variable, function() {
459 521
460 $scope[botonPincipal.variable + 'String'] = { 522 $scope[botonPincipal.variable + 'String'] = {
461 jsonText: JSON.stringify($scope[botonPincipal.variable]), 523 jsonText: JSON.stringify($scope[botonPincipal.variable]),
462 modulo: botonPincipal.variable, 524 modulo: botonPincipal.variable,
463 id: $scope[botonPincipal.variable + 'String'] ? 525 id: $scope[botonPincipal.variable + 'String'] ?
464 $scope[botonPincipal.variable + 'String'].id : undefined 526 $scope[botonPincipal.variable + 'String'].id : undefined
465 }; 527 };
466 528
467 getCheckeds(); 529 getCheckeds();
468 }, true); 530 }, true);
469 531
470 // creo las funciones para seleccionar boton principal 532 // creo las funciones para seleccionar boton principal
471 $scope[nombreFuncion(botonPincipal.label)] = function() { 533 $scope[nombreFuncion(botonPincipal.label)] = function() {
472 534
473 $scope.botoneraPrincipal.filter(function(boton) { 535 $scope.botoneraPrincipal.filter(function(boton) {
474 boton.checked = false; 536 boton.checked = false;
475 }); 537 });
476 538
477 botonPincipal.checked = true; 539 botonPincipal.checked = true;
478 $scope.botonera = focaParametrosService.getBotones(botonPincipal.modulo); 540 $scope.botonera = focaParametrosService.getBotones(botonPincipal.modulo);
479 }; 541 };
480 542
481 }); 543 });
482 544
483 function nombreFuncion(string) { 545 function nombreFuncion(string) {
484 var texto = 'seleccionar'; 546 var texto = 'seleccionar';
485 var arr = string.split(' '); 547 var arr = string.split(' ');
486 arr.forEach(function(palabra) { 548 arr.forEach(function(palabra) {
487 palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); 549 palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1);
488 texto += palabra; 550 texto += palabra;
489 }); 551 });
490 return texto; 552 return texto;
491 } 553 }
492 554
493 function getModulo(propiedad) { 555 function getModulo(propiedad) {
494 var nombre = ''; 556 var nombre = '';
495 557
496 $scope.botoneraPrincipal.filter(function(boton) { 558 $scope.botoneraPrincipal.filter(function(boton) {
497 if (boton.checked) { 559 if (boton.checked) {
498 if(!propiedad) { 560 if(!propiedad) {
499 nombre = boton.variable; 561 nombre = boton.variable;
500 } else { 562 } else {
501 nombre = boton[propiedad]; 563 nombre = boton[propiedad];
502 } 564 }
503 } 565 }
504 }); 566 });
505 return nombre; 567 return nombre;
506 } 568 }
507 569
508 function getCheckeds() { 570 function getCheckeds() {
509 571
510 $scope.botonera.forEach(function(boton) { 572 $scope.botonera.forEach(function(boton) {
511 573
512 if ($scope[getModulo()][boton.variable] !== undefined) { 574 if ($scope[getModulo()][boton.variable] !== undefined) {
513 575
514 boton.checked = true; 576 boton.checked = true;
515 577
516 //Creo la función para limpiar obj 578 //Creo la función para limpiar obj
517 $scope['clean' + boton.variable] = function() { 579 $scope['clean' + boton.variable] = function() {
518 580
519 focaModalService.alert('Esta seguro que desea eliminar el parámetro?') 581 focaModalService.alert('Esta seguro que desea eliminar el parámetro?')
520 .then(function() { 582 .then(function() {
521 delete $scope[getModulo()][boton.variable]; 583 delete $scope[getModulo()][boton.variable];
522 $scope.$broadcast('cleanCabecera', { 584 $scope.$broadcast('cleanCabecera', {
523 seccion: getModulo('label') 585 seccion: getModulo('label')
524 }); 586 });
525 setearEntidad({ 587 setearEntidad({
526 jsonText: JSON.stringify($scope[getModulo()]), 588 jsonText: JSON.stringify($scope[getModulo()]),
527 modulo: getModulo(), 589 modulo: getModulo(),
528 id: $scope[getModulo() + 'String'].id 590 id: $scope[getModulo() + 'String'].id
529 }); 591 });
530 }); 592 });
531 }; 593 };
532 594
533 } else { 595 } else {
534 boton.checked = false; 596 boton.checked = false;
535 } 597 }
536 }); 598 });
537 } 599 }
538 600
539 function getCabeceraPuntoDescarga(puntoDescarga) { 601 function getCabeceraPuntoDescarga(puntoDescarga) {
540 var puntosStamp = ''; 602 var puntosStamp = '';
541 puntoDescarga.forEach(function(punto, idx, arr) { 603 puntoDescarga.forEach(function(punto, idx, arr) {
542 puntosStamp += punto.descripcion; 604 puntosStamp += punto.descripcion;
543 if ((idx + 1) !== arr.length) puntosStamp += ', '; 605 if ((idx + 1) !== arr.length) puntosStamp += ', ';
544 }); 606 });
545 return puntosStamp; 607 return puntosStamp;
546 } 608 }
547 609
548 function setearEntidad(entidad) { 610 function setearEntidad(entidad) {
549 611
550 $scope[entidad.modulo] = JSON.parse(entidad.jsonText) || {}; 612 $scope[entidad.modulo] = JSON.parse(entidad.jsonText) || {};
551 $scope[entidad.modulo + 'String'].id = entidad.id; 613 $scope[entidad.modulo + 'String'].id = entidad.id;
552 614
553 if (!$scope[entidad.modulo].domicilio) { 615 if (!$scope[entidad.modulo].domicilio) {
554 $scope[entidad.modulo].domicilio = { 616 $scope[entidad.modulo].domicilio = {
555 id: $scope[entidad.modulo].idDomicilio 617 id: $scope[entidad.modulo].idDomicilio
556 }; 618 };
557 } 619 }
558 620
559 var cabeceras = []; 621 var cabeceras = [];
560 622
561 if ($scope[entidad.modulo].cotizacion) { 623 if ($scope[entidad.modulo].cotizacion) {
562 cabeceras.push({ 624 cabeceras.push({
563 label: 'Moneda:', 625 label: 'Moneda:',
564 valor: $scope[entidad.modulo].cotizacion.moneda.DETALLE 626 valor: $scope[entidad.modulo].cotizacion.moneda.DETALLE
565 }); 627 });
566 cabeceras.push({ 628 cabeceras.push({
567 label: 'Fecha cotizacion:', 629 label: 'Fecha cotizacion:',
568 valor: $filter('date')($scope[entidad.modulo].cotizacion.FECHA, 630 valor: $filter('date')($scope[entidad.modulo].cotizacion.FECHA,
569 'dd/MM/yyyy') 631 'dd/MM/yyyy')
570 }); 632 });
571 cabeceras.push({ 633 cabeceras.push({
572 label: 'Cotizacion:', 634 label: 'Cotizacion:',
573 valor: $filter('number')($scope[entidad.modulo].cotizacion.VENDEDOR, 635 valor: $filter('number')($scope[entidad.modulo].cotizacion.VENDEDOR,
574 '2') 636 '2')
575 }); 637 });
576 } 638 }
577 639
578 if ($scope[entidad.modulo].vendedor && $scope[entidad.modulo].vendedor.NUM) { 640 if ($scope[entidad.modulo].vendedor && $scope[entidad.modulo].vendedor.NUM) {
579 cabeceras.push({ 641 cabeceras.push({
580 label: 'Vendedor:', 642 label: 'Vendedor:',
581 valor: $filter('rellenarDigitos')($scope[entidad.modulo].vendedor.NUM, 3) + 643 valor: $filter('rellenarDigitos')($scope[entidad.modulo].vendedor.NUM, 3) +
582 ' - ' + $scope[entidad.modulo].vendedor.NOM 644 ' - ' + $scope[entidad.modulo].vendedor.NOM
583 }); 645 });
584 } 646 }
585 647
586 if ($scope[entidad.modulo].cliente && $scope[entidad.modulo].cliente.COD) { 648 if ($scope[entidad.modulo].cliente && $scope[entidad.modulo].cliente.COD) {
587 cabeceras.push({ 649 cabeceras.push({
588 label: 'Cliente:', 650 label: 'Cliente:',
589 valor: $scope[entidad.modulo].cliente.NOM 651 valor: $scope[entidad.modulo].cliente.NOM
590 }); 652 });
591 cabeceras.push({ 653 cabeceras.push({
592 label: 'Domicilio:', 654 label: 'Domicilio:',
593 valor: $scope[entidad.modulo].domicilioStamp 655 valor: $scope[entidad.modulo].domicilioStamp
594 }); 656 });
595 } 657 }
596 658
597 if ($scope[entidad.modulo].proveedor && $scope[entidad.modulo].proveedor.COD) { 659 if ($scope[entidad.modulo].proveedor && $scope[entidad.modulo].proveedor.COD) {
598 cabeceras.push({ 660 cabeceras.push({
599 label: 'Proveedor:', 661 label: 'Proveedor:',
600 valor: $filter('rellenarDigitos')($scope[entidad.modulo].proveedor.COD, 5) + 662 valor: $filter('rellenarDigitos')($scope[entidad.modulo].proveedor.COD, 5) +
601 ' - ' + $scope[entidad.modulo].proveedor.NOM 663 ' - ' + $scope[entidad.modulo].proveedor.NOM
602 }); 664 });
603 } 665 }
604 666
605 if ($scope[entidad.modulo][entidad + 'Plazo'] && 667 if ($scope[entidad.modulo][entidad + 'Plazo'] &&
606 $scope[entidad.modulo][entidad + 'Plazo'].length) 668 $scope[entidad.modulo][entidad + 'Plazo'].length)
607 { 669 {
608 cabeceras.push({ 670 cabeceras.push({
609 label: 'Precios y condiciones:', 671 label: 'Precios y condiciones:',
610 valor: valorPrecioCondicion() + ' ' + 672 valor: valorPrecioCondicion() + ' ' +
611 focaParametrosService.plazoToString( 673 focaParametrosService.plazoToString(
612 $scope[entidad.modulo][entidad.modulo + 'Plazo']) 674 $scope[entidad.modulo][entidad.modulo + 'Plazo'])
613 }); 675 });
614 } 676 }
615 677
616 if ($scope[entidad.modulo].flete !== undefined) { 678 if ($scope[entidad.modulo].flete !== undefined) {
617 cabeceras.push({ 679 cabeceras.push({
618 label: 'Flete:', 680 label: 'Flete:',
619 valor: $scope[entidad.modulo].fob === 1 ? 'FOB' : ( 681 valor: $scope[entidad.modulo].fob === 1 ? 'FOB' : (
620 $scope[entidad.modulo].flete === 1 ? 'Si' : 'No') 682 $scope[entidad.modulo].flete === 1 ? 'Si' : 'No')
621 }); 683 });
622 } 684 }
623 685
624 function valorPrecioCondicion() { 686 function valorPrecioCondicion() {
625 if ($scope[entidad.modulo].idPrecioCondicion > 0) { 687 if ($scope[entidad.modulo].idPrecioCondicion > 0) {
626 return $scope[entidad.modulo].precioCondicion.nombre; 688 return $scope[entidad.modulo].precioCondicion.nombre;
627 } else { 689 } else {
628 return 'Ingreso Manual'; 690 return 'Ingreso Manual';
629 } 691 }
630 } 692 }
631 693
632 if ($scope[entidad.modulo].flete === 1) { 694 if ($scope[entidad.modulo].flete === 1) {
633 var cabeceraBomba = { 695 var cabeceraBomba = {
634 label: 'Bomba:', 696 label: 'Bomba:',
635 valor: $scope[entidad.modulo].bomba === 1 ? 'Si' : 'No' 697 valor: $scope[entidad.modulo].bomba === 1 ? 'Si' : 'No'
636 }; 698 };
637 if ($scope[entidad.modulo].kilometros) { 699 if ($scope[entidad.modulo].kilometros) {
638 var cabeceraKilometros = { 700 var cabeceraKilometros = {
639 label: 'Kilometros:', 701 label: 'Kilometros:',
640 valor: $scope[entidad.modulo].kilometros 702 valor: $scope[entidad.modulo].kilometros
641 }; 703 };
642 cabeceras.push(cabeceraKilometros); 704 cabeceras.push(cabeceraKilometros);
643 } 705 }
644 cabeceras.push(cabeceraBomba); 706 cabeceras.push(cabeceraBomba);
645 } 707 }
646 708
647 if ($scope[entidad.modulo].idPrecioCondicion > 0) { 709 if ($scope[entidad.modulo].idPrecioCondicion > 0) {
648 $scope.idLista = $scope[entidad.modulo].precioCondicion.idListaPrecio; 710 $scope.idLista = $scope[entidad.modulo].precioCondicion.idListaPrecio;
649 } else { 711 } else {
650 $scope.idLista = -1; 712 $scope.idLista = -1;
651 } 713 }
652 714
653 if ($scope[entidad.modulo][entidad.modulo + 'PuntoDescarga']) { 715 if ($scope[entidad.modulo][entidad.modulo + 'PuntoDescarga']) {
654 var puntos = []; 716 var puntos = [];
655 $scope[entidad.modulo][entidad.modulo + 'PuntoDescarga'] 717 $scope[entidad.modulo][entidad.modulo + 'PuntoDescarga']
656 .forEach(function(entidadPuntoDescarga) { 718 .forEach(function(entidadPuntoDescarga) {
657 puntos.push(entidadPuntoDescarga); 719 puntos.push(entidadPuntoDescarga);
658 }); 720 });
659 cabeceras.push({ 721 cabeceras.push({
660 label: 'Puntos de descarga: ', 722 label: 'Puntos de descarga: ',
661 valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntos)) 723 valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntos))
662 }); 724 });
663 } 725 }
664 726
727 if ($scope[entidad.modulo].tarifario) {
728 cabeceras.push({
729 label: 'Tarifario',
730 valor: $scope[entidad.modulo].tarifario
731 });
732 }
733
665 addArrayCabecera(cabeceras, entidad.modulo); 734 addArrayCabecera(cabeceras, entidad.modulo);
666 735
667 } 736 }
668 737
669 function addArrayCabecera(array, entidad) { 738 function addArrayCabecera(array, entidad) {
670 for (var i = 0; i < array.length; i++) { 739 for (var i = 0; i < array.length; i++) {
671 $scope.$broadcast('addCabecera', { 740 $scope.$broadcast('addCabecera', {
672 label: array[i].label, 741 label: array[i].label,
673 valor: array[i].valor, 742 valor: array[i].valor,
674 seccion: $filter('filter') 743 seccion: $filter('filter')
675 ($scope.botoneraPrincipal, {variable: entidad}, true)[0].label 744 ($scope.botoneraPrincipal, {variable: entidad}, true)[0].label
676 }); 745 });
677 } 746 }
678 } 747 }
679 748
680 function getObjGuardar() { 749 function getObjGuardar() {
681 var guardar = []; 750 var guardar = [];
682 $scope.botoneraPrincipal.forEach(function(botonPincipal) { 751 $scope.botoneraPrincipal.forEach(function(botonPincipal) {
683 if (!botonPincipal || !$scope[botonPincipal.variable + 'String']) return; 752 if (!botonPincipal || !$scope[botonPincipal.variable + 'String']) return;
684 guardar.push($scope[botonPincipal.variable + 'String']); 753 guardar.push($scope[botonPincipal.variable + 'String']);
685 }); 754 });
686 755
687 return guardar; 756 return guardar;
688 } 757 }
689 758
690 }]); 759 }]);
691 760
1 angular.module('focaParametros') 1 angular.module('focaParametros')
2 .factory('focaParametrosService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { 2 .factory('focaParametrosService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) {
3 return { 3 return {
4 getNotasPedido: function (fechaDesde, fechaHasta) { 4 getNotasPedido: function (fechaDesde, fechaHasta) {
5 return $http.get(API_ENDPOINT.URL + '/nota-pedido/listar/' + fechaDesde + '/' + 5 return $http.get(API_ENDPOINT.URL + '/nota-pedido/listar/' + fechaDesde + '/' +
6 fechaHasta + '/sin-remito'); 6 fechaHasta + '/sin-remito');
7 }, 7 },
8 getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { 8 getPuntosDescargaByClienDom: function(idDomicilio, idCliente) {
9 return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + 9 return $http.get(API_ENDPOINT.URL + '/punto-descarga/' +
10 idDomicilio + '/' + idCliente); 10 idDomicilio + '/' + idCliente);
11 }, 11 },
12 saveParametros: function(parametros) { 12 saveParametros: function(parametros) {
13 return $http.post(API_ENDPOINT.URL + '/parametros', parametros); 13 return $http.post(API_ENDPOINT.URL + '/parametros', parametros);
14 }, 14 },
15 getParametros: function() { 15 getParametros: function() {
16 return $http.get(API_ENDPOINT.URL + '/parametros'); 16 return $http.get(API_ENDPOINT.URL + '/parametros');
17 }, 17 },
18 plazoToString: function(plazos) { 18 plazoToString: function(plazos) {
19 19
20 var result = ''; 20 var result = '';
21 21
22 for(var i = 0; i < plazos.length; i++) { 22 for(var i = 0; i < plazos.length; i++) {
23 result += plazos[i].dias + ' '; 23 result += plazos[i].dias + ' ';
24 } 24 }
25 25
26 return result.trim(); 26 return result.trim();
27 }, 27 },
28 getBotones: function (modulo) { 28 getBotones: function (modulo) {
29 var botones = [ 29 var botones = [
30 { 30 {
31 label: 'Vendedor', 31 label: 'Vendedor',
32 variable: 'vendedor', 32 variable: 'vendedor',
33 image: 'vendedor.png', 33 image: 'vendedor.png',
34 modulo: [1, 2] 34 modulo: [1, 2]
35 }, 35 },
36 { 36 {
37 label: 'Cliente', 37 label: 'Cliente',
38 image: 'cliente.png', 38 image: 'cliente.png',
39 variable: 'cliente', 39 variable: 'cliente',
40 modulo: [1, 2] 40 modulo: [1, 2]
41 }, 41 },
42 { 42 {
43 label: 'Proveedor', 43 label: 'Proveedor',
44 image: 'proveedor.png', 44 image: 'proveedor.png',
45 variable: 'proveedor', 45 variable: 'proveedor',
46 modulo: [1, 2] 46 modulo: [1, 2]
47 }, 47 },
48 { 48 {
49 label: 'Flete', 49 label: 'Flete',
50 image: 'flete.png', 50 image: 'flete.png',
51 variable: 'flete', 51 variable: 'flete',
52 modulo: [1, 2] 52 modulo: [1, 2]
53 }, 53 },
54 { 54 {
55 label: 'Moneda', 55 label: 'Moneda',
56 image: 'moneda.png', 56 image: 'moneda.png',
57 variable: 'cotizacion', 57 variable: 'cotizacion',
58 modulo: [1, 2] 58 modulo: [1, 2]
59 }, 59 },
60 { 60 {
61 label: 'Precios y condiciones', 61 label: 'Precios y condiciones',
62 image: 'precios-condiciones.png', 62 image: 'precios-condiciones.png',
63 variable: 'precioCondicion', 63 variable: 'precioCondicion',
64 modulo: [1, 2] 64 modulo: [1, 2]
65 }, 65 },
66 { 66 {
67 label: 'Observaciones', 67 label: 'Observaciones',
68 image: 'botonObservaciones.png', 68 image: 'botonObservaciones.png',
69 variable: 'observaciones', 69 variable: 'observaciones',
70 modulo: [1] 70 modulo: [1]
71 },
72 {
73 label: 'Transportista',
74 image: 'proveedor.png',
75 variable: 'transportista',
76 modulo: [3]
77 },
78 {
79 label: 'Tarifario',
80 image: 'tarifario.png',
81 variable: 'tarifario',
82 modulo: [3]
71 } 83 }
72 ]; 84 ];
73 85
74 // Devuelvo solo los botones correspondietes 86 // Devuelvo solo los botones correspondietes
75 // Modulo 1 = nota de pedido, 2 remito, 3 ambos 87 // Modulo 1 = nota de pedido, 2 remito, 3 ambos
76 return botones.filter(function (p) { 88 return botones.filter(function (p) {
77 return p.modulo.includes(modulo); 89 return p.modulo.includes(modulo);
78 }); 90 });
79 }, 91 },
80 getBotonesPrincipal: [ 92 getBotonesPrincipal: [
81 { 93 {
82 label: 'Nota de Pedido', 94 label: 'Nota de Pedido',
83 image: 'notaPedido.png', 95 image: 'notaPedido.png',
84 modulo: 1, 96 modulo: 1,
85 variable: 'notaPedido' 97 variable: 'notaPedido'
86 }, 98 },
87 { 99 {
88 label: 'Remito', 100 label: 'Remito',
89 image: 'remito.png', 101 image: 'remito.png',
90 modulo: 2, 102 modulo: 2,
91 variable: 'remito' 103 variable: 'remito'
104 },
105 {
106 label: 'Hoja ruta',
107 image: 'hoja-ruta.png',
108 modulo: 3,
109 variable: 'hojaRuta'
92 } 110 }
93 ] 111 ]
94 }; 112 };
95 }]); 113 }]);
96 114