Commit 60f40f1dd4b0c3f2bea21700b69fd8ebf744ab8a

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

Merge branch 'master' into 'master'

Master

See merge request !1
File was created 1 /node_modules
2 /dist
3 package-lock\.json
4 /src/etc/develop.js
5
6 tmp/
7
File was created 1 {
2 /*
3 * ENVIRONMENTS
4 * =================
5 */
6
7 // Define globals exposed by modern browsers.
8 "browser": true,
9
10 // Define globals exposed by jQuery.
11 "jquery": true,
12
13 // Define globals exposed by Node.js.
14 "node": true,
15
16 // Allow ES6.
17 "esversion": 6,
18
19 /*
20 * ENFORCING OPTIONS
21 * =================
22 */
23
24 // Force all variable names to use either camelCase style or UPPER_CASE
25 // with underscores.
26 "camelcase": true,
27
28 // Prohibit use of == and != in favor of === and !==.
29 "eqeqeq": true,
30
31 // Enforce tab width of 2 spaces.
32 "indent": 4,
33
34 // Prohibit use of a variable before it is defined.
35 "latedef": false,
36
37 // Enforce line length to 100 characters
38 "maxlen": 100,
39
40 // Require capitalized names for constructor functions.
41 "newcap": true,
42
43 // Enforce use of single quotation marks for strings.
44 "quotmark": "single",
45
46 // Enforce placing 'use strict' at the top function scope
47 "strict": false,
48
49 // Prohibit use of explicitly undeclared variables.
50 "undef": true,
51
52 // Warn when variables are defined but never used.
53 "unused": true,
54
55 // Para que funcione en angular
56 "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"],
57 /*
58 * RELAXING OPTIONS
59 * =================
60 */
61
62 // Suppress warnings about == null comparisons.
63 "eqnull": true
64 }
65
File was created 1 const templateCache = require('gulp-angular-templatecache');
2 const clean = require('gulp-clean');
3 const concat = require('gulp-concat');
4 const htmlmin = require('gulp-htmlmin');
5 const rename = require('gulp-rename');
6 const uglify = require('gulp-uglify');
7 const gulp = require('gulp');
8 const pump = require('pump');
9 const jshint = require('gulp-jshint');
10 const replace = require('gulp-replace');
11 const connect = require('gulp-connect');
12
13 var paths = {
14 srcJS: 'src/js/*.js',
15 srcViews: 'src/views/*.html',
16 tmp: 'tmp',
17 dist: 'dist/'
18 };
19
20 gulp.task('templates', ['clean'], function() {
21 return pump(
22 [
23 gulp.src(paths.srcViews),
24 htmlmin(),
25 templateCache('views.js', {
26 module: 'focaParametros',
27 root: ''
28 }),
29 gulp.dest(paths.tmp)
30 ]
31 );
32 });
33
34 gulp.task('uglify', ['templates'], function() {
35 return pump(
36 [
37 gulp.src([
38 paths.srcJS,
39 'tmp/views.js'
40 ]),
41 concat('foca-parametros.js'),
42 replace('src/views/', ''),
43 replace("'ngRoute'", ''),
44 gulp.dest(paths.tmp),
45 rename('foca-parametros.min.js'),
46 uglify(),
47 gulp.dest(paths.dist)
48 ]
49 );
50 });
51
52 gulp.task('clean', function() {
53 return gulp.src(['tmp', 'dist'], {read: false})
54 .pipe(clean());
55 });
56
57 gulp.task('pre-commit', function() {
58 return pump(
59 [
60 gulp.src(paths.srcJS),
61 jshint('.jshintrc'),
62 jshint.reporter('default'),
63 jshint.reporter('fail')
64 ]
65 );
66
67 gulp.start('uglify');
68 });
69
70 gulp.task('webserver', function() {
71 pump [
72 connect.server({port: 3300, host: '0.0.0.0'})
73 ]
74 });
75
76 gulp.task('clean-post-install', function() {
77 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
78 'index.html'], {read: false})
79 .pipe(clean());
80 });
81
82 gulp.task('default', ['webserver']);
83
84 gulp.task('watch', function() {
85 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
86 });
87
File was created 1 {
2 "name": "foca-parametros",
3 "version": "0.0.1",
4 "description": "foca-parametros",
5 "main": "index.js",
6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp uglify",
9 "gulp-pre-commit": "gulp pre-commit",
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 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-remito.git"
12 },
13 "pre-commit": [
14 "gulp-pre-commit"
15 ],
16 "repository": {
17 "type": "git",
18 "url": "git+http://git.focasoftware.com/npm/foca-parametros.git"
19 },
20 "author": "Foca Software",
21 "license": "ISC",
22 "devDependencies": {
23 "angular": "^1.7.8",
24 "angular-ladda": "^0.4.3",
25 "angular-route": "^1.7.8",
26 "bootstrap": "^4.3.1",
27 "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
28 "foca-modal-remito": "git+http://git.focasoftware.com/npm/foca-modal-remito.git",
29 "font-awesome": "^4.7.0",
30 "gulp": "^3.9.1",
31 "gulp-angular-templatecache": "^2.2.6",
32 "gulp-clean": "^0.4.0",
33 "gulp-concat": "^2.6.1",
34 "gulp-connect": "^5.7.0",
35 "gulp-htmlmin": "^5.0.1",
36 "gulp-jshint": "^2.1.0",
37 "gulp-rename": "^1.4.0",
38 "gulp-replace": "^1.0.0",
39 "gulp-sequence": "^1.0.0",
40 "gulp-uglify": "^3.0.2",
41 "gulp-uglify-es": "^1.0.4",
42 "jasmine-core": "^3.4.0",
43 "jquery": "^3.4.0",
44 "jshint": "^2.10.2",
45 "ladda": "^1.0.6",
46 "pre-commit": "^1.2.2",
47 "pump": "^3.0.0",
48 "ui-bootstrap4": "^3.0.6"
49 }
50 }
51
src/etc/develop.js.ejemplo
File was created 1 angular.module('focaCrearHojaRuta')
2 .constant("API_ENDPOINT", {
3 'URL': '//127.0.0.1:9000'
4 });
5
File was created 1 angular.module('focaParametros', []);
2
src/js/controller.js
File was created 1 angular.module('focaParametros')
2 .controller('focaParametrosCtrl', [
3 '$scope',
4 'focaParametrosService',
5 'focaBotoneraLateralService',
6 '$filter',
7 'focaModalService',
8 '$timeout',
9 '$uibModal',
10 '$location',
11 function($scope, focaParametrosService, focaBotoneraLateralService, $filter,
12 focaModalService, $timeout, $uibModal, $location)
13 {
14
15 $scope.botonera = [];
16 $scope.now = new Date();
17
18 $scope.botoneraPrincipal = focaParametrosService.getBotonesPrincipal;
19
20 $timeout(function() {
21 focaBotoneraLateralService.showSalir(true);
22 focaBotoneraLateralService.showGuardar(true, $scope.guardar);
23 });
24
25 focaParametrosService.getParametros().then(function(res) {
26
27 $scope.$broadcast('cleanCabecera');
28 res.data.forEach(function(entidad) {
29
30 setearEntidad(entidad);
31 });
32 });
33
34 $scope.guardar = function() {
35
36 focaParametrosService.saveParametros(getObjGuardar()).then(function() {
37 focaModalService.alert('Parรกmetros guardados con รฉxito');
38 $location.url('/');
39 });
40 };
41
42 $scope.seleccionarPuntosDeDescarga = function() {
43 if (!$scope[getModulo()].cliente.COD || !$scope[getModulo()].domicilio.id) {
44 focaModalService.alert('Primero seleccione un cliente y un domicilio');
45 return;
46 } else {
47 var modalInstance = $uibModal.open(
48 {
49 ariaLabelledBy: 'Bรบsqueda de Puntos de descarga',
50 templateUrl: 'modal-punto-descarga.html',
51 controller: 'focaModalPuntoDescargaController',
52 size: 'lg',
53 resolve: {
54 filters: {
55 idDomicilio: $scope[getModulo()].domicilio.id,
56 idCliente: $scope[getModulo()].cliente.COD,
57 articulos: $scope[getModulo()].articulosNotaPedido || [],
58 puntoDescarga: $scope[getModulo()].notaPedidoPuntoDescarga,
59 domicilio: $scope[getModulo()].domicilio
60 }
61 }
62 }
63 );
64 modalInstance.result.then(
65 function(puntoDescarga) {
66 $scope[getModulo()].notaPedidoPuntoDescarga = puntoDescarga;
67
68 $scope.$broadcast('addCabecera', {
69 label: 'Puntos de descarga:',
70 seccion: getModulo('label'),
71 valor: getCabeceraPuntoDescarga(puntoDescarga)
72 });
73 }, function() {
74 $scope.abrirModalDomicilios($scope.cliente);
75 }
76 );
77 }
78 };
79
80 $scope.seleccionarFlete = function() {
81
82 if ($scope[getModulo()].flete === undefined) {
83 $scope[getModulo()].fob = undefined;
84 $scope[getModulo()].bomba = undefined;
85 $scope[getModulo()].kilometros = undefined;
86
87 }
88
89 var modalInstance = $uibModal.open(
90 {
91 ariaLabelledBy: 'Busqueda de Flete',
92 templateUrl: 'modal-flete.html',
93 controller: 'focaModalFleteController',
94 size: 'lg',
95 resolve: {
96 parametrosFlete:
97 function() {
98 return {
99 flete: $scope[getModulo()].fob ? 'FOB' :
100 ( $scope[getModulo()].flete ? '1' :
101 ($scope[getModulo()].flete === undefined ?
102 null : '0')),
103 bomba: $scope[getModulo()].bomba ? '1' :
104 ($scope[getModulo()].bomba === undefined ?
105 null : '0'),
106 kilometros: $scope[getModulo()].kilometros
107 };
108 }
109 }
110 }
111 );
112 modalInstance.result.then(
113 function(datos) {
114 $scope[getModulo()].flete = datos.flete;
115 $scope[getModulo()].fob = datos.FOB;
116 $scope[getModulo()].bomba = datos.bomba;
117 $scope[getModulo()].kilometros = datos.kilometros;
118 $scope.$broadcast('addCabecera', {
119 label: 'Flete:',
120 seccion: getModulo('label'),
121 valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No')
122 });
123 if (datos.flete) {
124 $scope.$broadcast('addCabecera', {
125 label: 'Bomba:',
126 seccion: getModulo('label'),
127 valor: datos.bomba ? 'Si' : 'No'
128 });
129 $scope.$broadcast('addCabecera', {
130 label: 'Kilometros:',
131 seccion: getModulo('label'),
132 valor: datos.kilometros
133 });
134 } else {
135 $scope.$broadcast('removeCabecera', 'Bomba:');
136 $scope.$broadcast('removeCabecera', 'Kilometros:');
137 $scope[getModulo()].bomba = false;
138 $scope[getModulo()].kilometros = null;
139 }
140 }, function() {
141 }
142 );
143 };
144
145 $scope.seleccionarVendedor = function() {
146
147 var parametrosModal = {
148 titulo: 'Bรบsqueda vendedores',
149 query: '/vendedor',
150 columnas: [
151 {
152 propiedad: 'NUM',
153 nombre: 'Cรณdigo',
154 filtro: {
155 nombre: 'rellenarDigitos',
156 parametro: 3
157 }
158 },
159 {
160 propiedad: 'NOM',
161 nombre: 'Nombre'
162 }
163 ],
164 size: 'md'
165 };
166 focaModalService.modal(parametrosModal).then(
167 function(vendedor) {
168 $scope.$broadcast('addCabecera', {
169 label: 'Vendedor:',
170 seccion: getModulo('label'),
171 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' +
172 vendedor.NOM
173 });
174 $scope[getModulo()].vendedor = vendedor;
175 }, function() {}
176 );
177 };
178
179 $scope.seleccionarCliente = function() {
180
181 if (!$scope[getModulo()].vendedor) {
182 focaModalService.alert('Seleccione Vendedor');
183 return;
184 }
185
186 var modalInstance = $uibModal.open(
187 {
188 ariaLabelledBy: 'Busqueda de Cliente',
189 templateUrl: 'foca-busqueda-cliente-modal.html',
190 controller: 'focaBusquedaClienteModalController',
191 resolve: {
192 vendedor: function() { return $scope.notaPedido.vendedor; },
193 cobrador: function() { return null; }
194 },
195 size: 'lg'
196 }
197 );
198 modalInstance.result.then(
199 function(cliente) {
200 $scope.abrirModalDomicilios(cliente);
201 }, function() { }
202 );
203 };
204
205 $scope.seleccionarProveedor = function() {
206
207 var parametrosModal = {
208 titulo: 'Bรบsqueda de Proveedor',
209 query: '/proveedor',
210 columnas: [
211 {
212 nombre: 'Cรณdigo',
213 propiedad: 'COD',
214 filtro: {
215 nombre: 'rellenarDigitos',
216 parametro: 5
217 }
218 },
219 {
220 nombre: 'Nombre',
221 propiedad: 'NOM'
222 },
223 {
224 nombre: 'CUIT',
225 propiedad: 'CUIT'
226 }
227 ],
228 tipo: 'POST',
229 json: {razonCuitCod: ''}
230 };
231 focaModalService.modal(parametrosModal).then(
232 function(proveedor) {
233 $scope[getModulo()].proveedor = proveedor;
234 $scope.$broadcast('addCabecera', {
235 label: 'Proveedor:',
236 seccion: getModulo('label'),
237 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' +
238 proveedor.NOM
239 });
240 }, function() {
241 }
242 );
243
244 };
245
246 $scope.abrirModalDomicilios = function(cliente) {
247 var modalInstanceDomicilio = $uibModal.open(
248 {
249 ariaLabelledBy: 'Busqueda de Domicilios',
250 templateUrl: 'modal-domicilio.html',
251 controller: 'focaModalDomicilioController',
252 resolve: {
253 idCliente: function() { return cliente.cod; },
254 esNuevo: function() { return cliente.esNuevo; }
255 },
256 size: 'lg',
257 }
258 );
259 modalInstanceDomicilio.result.then(
260 function(domicilio) {
261
262 $scope[getModulo()].domicilio = domicilio;
263
264 $scope[getModulo()].cliente = {
265 COD: cliente.cod,
266 CUIT: cliente.cuit,
267 NOM: cliente.nom,
268 MOD: cliente.mod
269 };
270
271 var domicilioStamp =
272 domicilio.Calle + ' ' + domicilio.Numero + ', ' +
273 domicilio.Localidad + ', ' + domicilio.Provincia;
274 $scope[getModulo()].domicilioStamp = domicilioStamp;
275
276 $scope[getModulo()].notaPedidoPuntoDescarga = domicilio.puntoDescarga;
277
278 $scope.$broadcast('addCabecera', {
279 label: 'Cliente:',
280 seccion: getModulo('label'),
281 valor: $filter('rellenarDigitos')(cliente.cod, 5) + ' - ' + cliente.nom
282 });
283 $scope.$broadcast('addCabecera', {
284 label: 'Domicilio:',
285 seccion: getModulo('label'),
286 valor: domicilioStamp
287 });
288 if (domicilio.verPuntos) {
289 delete $scope[getModulo()].domicilio.verPuntos;
290 $scope.seleccionarPuntosDeDescarga();
291 } else {
292 focaParametrosService
293 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
294 .then(function(res) {
295 if (res.data.length) $scope.seleccionarPuntosDeDescarga();
296 });
297 }
298 }, function() {
299 $scope.seleccionarCliente(true);
300 return;
301 }
302 );
303 };
304
305 $scope.seleccionarMoneda = function() {
306
307 var parametrosModal = {
308 titulo: 'Bรบsqueda de monedas',
309 query: '/moneda',
310 columnas: [
311 {
312 propiedad: 'DETALLE',
313 nombre: 'Nombre'
314 },
315 {
316 propiedad: 'SIMBOLO',
317 nombre: 'Sรญmbolo'
318 }
319 ],
320 size: 'md'
321 };
322 focaModalService.modal(parametrosModal).then(
323 function(moneda) {
324 $scope.abrirModalCotizacion(moneda);
325 }, function() {
326 }
327 );
328
329 };
330
331 $scope.abrirModalCotizacion = function(moneda) {
332 var modalInstance = $uibModal.open(
333 {
334 ariaLabelledBy: 'Busqueda de Cotizaciรณn',
335 templateUrl: 'modal-cotizacion.html',
336 controller: 'focaModalCotizacionController',
337 size: 'lg',
338 resolve: {
339 idMoneda: function() {
340 return moneda.ID;
341 }
342 }
343 }
344 );
345 modalInstance.result.then(
346 function(cotizacion) {
347 $scope[getModulo()].cotizacion = cotizacion;
348 $scope[getModulo()].cotizacion.moneda = moneda;
349
350 $scope.$broadcast('addCabecera', {
351 label: 'Moneda:',
352 seccion: getModulo('label'),
353 valor: moneda.DETALLE
354 });
355 $scope.$broadcast('addCabecera', {
356 label: 'Fecha cotizacion:',
357 seccion: getModulo('label'),
358 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
359 });
360 $scope.$broadcast('addCabecera', {
361 label: 'Cotizacion:',
362 seccion: getModulo('label'),
363 valor: $filter('number')(cotizacion.VENDEDOR, '2')
364 });
365
366 }, function() {
367
368 }
369 );
370 };
371
372 $scope.seleccionarObservaciones = function() {
373 var observacion = {
374 titulo: 'Ingrese Observaciones',
375 value: $scope[getModulo()].observaciones,
376 maxlength: 155,
377 textarea: true
378 };
379
380 focaModalService
381 .prompt(observacion)
382 .then(function(observaciones) {
383 $scope[getModulo()].observaciones = observaciones;
384 $scope.$broadcast('addCabecera', {
385 label: 'Observaciones:',
386 valor: observaciones
387 });
388 });
389 };
390
391 $scope.seleccionarPreciosYCondiciones = function() {
392 if (!$scope[getModulo()].cliente || !$scope[getModulo()].cliente.COD) {
393 focaModalService.alert('Primero seleccione un cliente');
394 return;
395 }
396
397 var modalInstance = $uibModal.open(
398 {
399 ariaLabelledBy: 'Busqueda de Precio Condiciรณn',
400 templateUrl: 'modal-precio-condicion.html',
401 controller: 'focaModalPrecioCondicionController',
402 size: 'lg',
403 resolve: {
404 idListaPrecio: function() {
405 return $scope[getModulo()].cliente.MOD || null;
406 }
407 }
408 }
409 );
410
411 modalInstance.result.then(
412 function(precioCondicion) {
413 var cabecera = '';
414 var plazosConcat = '';
415 if (!Array.isArray(precioCondicion)) {
416 $scope[getModulo()][getModulo() + 'Plazo' ]= precioCondicion.plazoPago;
417 $scope[getModulo()].precioCondicion = precioCondicion;
418 $scope[getModulo()].idPrecioCondicion = precioCondicion.id;
419 $scope.idLista = precioCondicion.idListaPrecio;
420 for (var i = 0; i < precioCondicion.plazoPago.length; i++) {
421 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
422 }
423 cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) +
424 ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim();
425 } else { //Cuando se ingresan los plazos manualmente
426 $scope[getModulo()].idPrecioCondicion = 0;
427 //-1, el modal productos busca todos los productos
428 $scope.idLista = -1;
429 $scope[getModulo()][ getModulo() + 'Plazo'] = precioCondicion;
430 for (var j = 0; j < precioCondicion.length; j++) {
431 plazosConcat += precioCondicion[j].dias + ' ';
432 }
433 cabecera = 'Ingreso manual ' + plazosConcat.trim();
434 }
435 $scope.$broadcast('addCabecera', {
436 label: 'Precios y condiciones:',
437 seccion: getModulo('label'),
438 valor: cabecera
439 });
440 }, function() {
441
442 }
443 );
444
445 };
446
447 $scope.$watch('botonera', function() {
448
449 // Creo el string en donde guardo el objeto parseado
450 $scope[getModulo()] = $scope[getModulo()] || {};
451
452 getCheckeds();
453 }, true);
454
455 $scope.botoneraPrincipal.forEach(function(botonPincipal) {
456
457 // watch en objetos principales para ir guardando los valores
458 $scope.$watch(botonPincipal.variable, function() {
459
460 $scope[botonPincipal.variable + 'String'] = {
461 jsonText: JSON.stringify($scope[botonPincipal.variable]),
462 modulo: botonPincipal.variable,
463 id: $scope[botonPincipal.variable + 'String'] ?
464 $scope[botonPincipal.variable + 'String'].id : undefined
465 };
466
467 getCheckeds();
468 }, true);
469
470 // creo las funciones para seleccionar boton principal
471 $scope[nombreFuncion(botonPincipal.label)] = function() {
472
473 $scope.botoneraPrincipal.filter(function(boton) {
474 boton.checked = false;
475 });
476
477 botonPincipal.checked = true;
478 $scope.botonera = focaParametrosService.getBotones(botonPincipal.modulo);
479 };
480
481 });
482
483 function nombreFuncion(string) {
484 var texto = 'seleccionar';
485 var arr = string.split(' ');
486 arr.forEach(function(palabra) {
487 palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1);
488 texto += palabra;
489 });
490 return texto;
491 }
492
493 function getModulo(propiedad) {
494 var nombre = '';
495
496 $scope.botoneraPrincipal.filter(function(boton) {
497 if (boton.checked) {
498 if(!propiedad) {
499 nombre = boton.variable;
500 } else {
501 nombre = boton[propiedad];
502 }
503 }
504 });
505 return nombre;
506 }
507
508 function getCheckeds() {
509
510 $scope.botonera.forEach(function(boton) {
511
512 if ($scope[getModulo()][boton.variable] !== undefined) {
513
514 boton.checked = true;
515
516 //Creo la funciรณn para limpiar obj
517 $scope['clean' + boton.variable] = function() {
518
519 focaModalService.alert('Esta seguro que desea eliminar el parรกmetro?')
520 .then(function() {
521 delete $scope[getModulo()][boton.variable];
522 $scope.$broadcast('cleanCabecera', {
523 seccion: getModulo('label')
524 });
525 setearEntidad({
526 jsonText: JSON.stringify($scope[getModulo()]),
527 modulo: getModulo(),
528 id: $scope[getModulo() + 'String'].id
529 });
530 });
531 };
532
533 } else {
534 boton.checked = false;
535 }
536 });
537 }
538
539 function getCabeceraPuntoDescarga(puntoDescarga) {
540 var puntosStamp = '';
541 puntoDescarga.forEach(function(punto, idx, arr) {
542 puntosStamp += punto.descripcion;
543 if ((idx + 1) !== arr.length) puntosStamp += ', ';
544 });
545 return puntosStamp;
546 }
547
548 function setearEntidad(entidad) {
549
550 $scope[entidad.modulo] = JSON.parse(entidad.jsonText) || {};
551 $scope[entidad.modulo + 'String'].id = entidad.id;
552
553 if (!$scope[entidad.modulo].domicilio) {
554 $scope[entidad.modulo].domicilio = {
555 id: $scope[entidad.modulo].idDomicilio
556 };
557 }
558
559 var cabeceras = [];
560
561 if ($scope[entidad.modulo].cotizacion) {
562 cabeceras.push({
563 label: 'Moneda:',
564 valor: $scope[entidad.modulo].cotizacion.moneda.DETALLE
565 });
566 cabeceras.push({
567 label: 'Fecha cotizacion:',
568 valor: $filter('date')($scope[entidad.modulo].cotizacion.FECHA,
569 'dd/MM/yyyy')
570 });
571 cabeceras.push({
572 label: 'Cotizacion:',
573 valor: $filter('number')($scope[entidad.modulo].cotizacion.VENDEDOR,
574 '2')
575 });
576 }
577
578 if ($scope[entidad.modulo].vendedor && $scope[entidad.modulo].vendedor.NUM) {
579 cabeceras.push({
580 label: 'Vendedor:',
581 valor: $filter('rellenarDigitos')($scope[entidad.modulo].vendedor.NUM, 3) +
582 ' - ' + $scope[entidad.modulo].vendedor.NOM
583 });
584 }
585
586 if ($scope[entidad.modulo].cliente && $scope[entidad.modulo].cliente.COD) {
587 cabeceras.push({
588 label: 'Cliente:',
589 valor: $scope[entidad.modulo].cliente.NOM
590 });
591 cabeceras.push({
592 label: 'Domicilio:',
593 valor: $scope[entidad.modulo].domicilioStamp
594 });
595 }
596
597 if ($scope[entidad.modulo].proveedor && $scope[entidad.modulo].proveedor.COD) {
598 cabeceras.push({
599 label: 'Proveedor:',
600 valor: $filter('rellenarDigitos')($scope[entidad.modulo].proveedor.COD, 5) +
601 ' - ' + $scope[entidad.modulo].proveedor.NOM
602 });
603 }
604
605 if ($scope[entidad.modulo][entidad + 'Plazo'] &&
606 $scope[entidad.modulo][entidad + 'Plazo'].length)
607 {
608 cabeceras.push({
609 label: 'Precios y condiciones:',
610 valor: valorPrecioCondicion() + ' ' +
611 focaParametrosService.plazoToString(
612 $scope[entidad.modulo][entidad.modulo + 'Plazo'])
613 });
614 }
615
616 if ($scope[entidad.modulo].flete !== undefined) {
617 cabeceras.push({
618 label: 'Flete:',
619 valor: $scope[entidad.modulo].fob === 1 ? 'FOB' : (
620 $scope[entidad.modulo].flete === 1 ? 'Si' : 'No')
621 });
622 }
623
624 function valorPrecioCondicion() {
625 if ($scope[entidad.modulo].idPrecioCondicion > 0) {
626 return $scope[entidad.modulo].precioCondicion.nombre;
627 } else {
628 return 'Ingreso Manual';
629 }
630 }
631
632 if ($scope[entidad.modulo].flete === 1) {
633 var cabeceraBomba = {
634 label: 'Bomba:',
635 valor: $scope[entidad.modulo].bomba === 1 ? 'Si' : 'No'
636 };
637 if ($scope[entidad.modulo].kilometros) {
638 var cabeceraKilometros = {
639 label: 'Kilometros:',
640 valor: $scope[entidad.modulo].kilometros
641 };
642 cabeceras.push(cabeceraKilometros);
643 }
644 cabeceras.push(cabeceraBomba);
645 }
646
647 if ($scope[entidad.modulo].idPrecioCondicion > 0) {
648 $scope.idLista = $scope[entidad.modulo].precioCondicion.idListaPrecio;
649 } else {
650 $scope.idLista = -1;
651 }
652
653 if ($scope[entidad.modulo][entidad.modulo + 'PuntoDescarga']) {
654 var puntos = [];
655 $scope[entidad.modulo][entidad.modulo + 'PuntoDescarga']
656 .forEach(function(entidadPuntoDescarga) {
657 puntos.push(entidadPuntoDescarga);
658 });
659 cabeceras.push({
660 label: 'Puntos de descarga: ',
661 valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntos))
662 });
663 }
664
665 addArrayCabecera(cabeceras, entidad.modulo);
666
667 }
668
669 function addArrayCabecera(array, entidad) {
670 for (var i = 0; i < array.length; i++) {
671 $scope.$broadcast('addCabecera', {
672 label: array[i].label,
673 valor: array[i].valor,
674 seccion: $filter('filter')
675 ($scope.botoneraPrincipal, {variable: entidad}, true)[0].label
676 });
677 }
678 }
679
680 function getObjGuardar() {
681 var guardar = [];
682 $scope.botoneraPrincipal.forEach(function(botonPincipal) {
683 if (!botonPincipal || !$scope[botonPincipal.variable + 'String']) return;
684 guardar.push($scope[botonPincipal.variable + 'String']);
685 });
686
687 return guardar;
688 }
689
690 }]);
691
File was created 1 angular.module('focaParametros')
2 .config(['$routeProvider', function($routeProvider) {
3 $routeProvider.when('/parametros', {
4 controller: 'focaParametrosCtrl',
5 templateUrl: 'src/views/foca-parametros.html'
6 });
7 }]);
8
File was created 1 angular.module('focaParametros')
2 .factory('focaParametrosService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) {
3 return {
4 getNotasPedido: function (fechaDesde, fechaHasta) {
5 return $http.get(API_ENDPOINT.URL + '/nota-pedido/listar/' + fechaDesde + '/' +
6 fechaHasta + '/sin-remito');
7 },
8 getPuntosDescargaByClienDom: function(idDomicilio, idCliente) {
9 return $http.get(API_ENDPOINT.URL + '/punto-descarga/' +
10 idDomicilio + '/' + idCliente);
11 },
12 saveParametros: function(parametros) {
13 return $http.post(API_ENDPOINT.URL + '/parametros', parametros);
14 },
15 getParametros: function() {
16 return $http.get(API_ENDPOINT.URL + '/parametros');
17 },
18 plazoToString: function(plazos) {
19
20 var result = '';
21
22 for(var i = 0; i < plazos.length; i++) {
23 result += plazos[i].dias + ' ';
24 }
25
26 return result.trim();
27 },
28 getBotones: function (modulo) {
29 var botones = [
30 {
31 label: 'Vendedor',
32 variable: 'vendedor',
33 image: 'vendedor.png',
34 modulo: [1, 2]
35 },
36 {
37 label: 'Cliente',
38 image: 'cliente.png',
39 variable: 'cliente',
40 modulo: [1, 2]
41 },
42 {
43 label: 'Proveedor',
44 image: 'proveedor.png',
45 variable: 'proveedor',
46 modulo: [1, 2]
47 },
48 {
49 label: 'Flete',
50 image: 'flete.png',
51 variable: 'flete',
52 modulo: [1, 2]
53 },
54 {
55 label: 'Moneda',
56 image: 'moneda.png',
57 variable: 'cotizacion',
58 modulo: [1, 2]
59 },
60 {
61 label: 'Precios y condiciones',
62 image: 'precios-condiciones.png',
63 variable: 'precioCondicion',
64 modulo: [1, 2]
65 },
66 {
67 label: 'Observaciones',
68 image: 'botonObservaciones.png',
69 variable: 'observaciones',
70 modulo: [1]
71 }
72 ];
73
74 // Devuelvo solo los botones correspondietes
75 // Modulo 1 = nota de pedido, 2 remito, 3 ambos
76 return botones.filter(function (p) {
77 return p.modulo.includes(modulo);
78 });
79 },
80 getBotonesPrincipal: [
81 {
82 label: 'Nota de Pedido',
83 image: 'notaPedido.png',
84 modulo: 1,
85 variable: 'notaPedido'
86 },
87 {
88 label: 'Remito',
89 image: 'remito.png',
90 modulo: 2,
91 variable: 'remito'
92 }
93 ]
94 };
95 }]);
96
src/views/foca-parametros.html
File was created 1 <div class="row">
2 <foca-cabecera-facturador
3 titulo="'Parametros'"
4 fecha="now"
5 class="mb-0 col-lg-12"
6 ></foca-cabecera-facturador>
7 </div>
8 <div class="col-10">
9
10 <div class="row py-2 botonera-secundaria border border-light rounded mb-5">
11 <div class="col-12 foca-facturador-px">
12 <foca-botonera-facturador botones="botoneraPrincipal" max="6" class="row"></foca-botonera-facturador>
13 </div>
14 </div>
15
16 <div class="row py-2 botonera-secundaria border border-light rounded">
17 <div class="col-12 foca-facturador-px">
18 <foca-botonera-facturador botones="botonera" max="18" class="row"></foca-botonera-facturador>
19 </div>
20 </div>
21 </div>
22