Commit a4c70cb02c0bf6dd2b832c63e4bec71bc3d4632c

Authored by Nicolás Guarnieri
Exists in master and in 2 other branches develop, lab

Merge remote-tracking branch 'origin/master'

1 const templateCache = require('gulp-angular-templatecache'); 1 const templateCache = require('gulp-angular-templatecache');
2 const clean = require('gulp-clean'); 2 const clean = require('gulp-clean');
3 const concat = require('gulp-concat'); 3 const concat = require('gulp-concat');
4 const htmlmin = require('gulp-htmlmin'); 4 const htmlmin = require('gulp-htmlmin');
5 const rename = require('gulp-rename'); 5 const rename = require('gulp-rename');
6 const uglify = require('gulp-uglify'); 6 const uglify = require('gulp-uglify');
7 const gulp = require('gulp'); 7 const gulp = require('gulp');
8 const pump = require('pump'); 8 const pump = require('pump');
9 const jshint = require('gulp-jshint'); 9 const jshint = require('gulp-jshint');
10 const replace = require('gulp-replace'); 10 const replace = require('gulp-replace');
11 const connect = require('gulp-connect'); 11 const connect = require('gulp-connect');
12 12
13 var paths = { 13 var paths = {
14 srcJS: 'src/js/*.js', 14 srcJS: 'src/js/*.js',
15 srcViews: 'src/views/*.html', 15 srcViews: 'src/views/*.html',
16 tmp: 'tmp', 16 tmp: 'tmp',
17 dist: 'dist/' 17 dist: 'dist/'
18 }; 18 };
19 19
20 gulp.task('templates', ['clean'], function() { 20 gulp.task('templates', ['clean'], function() {
21 return pump( 21 return pump(
22 [ 22 [
23 gulp.src(paths.srcViews), 23 gulp.src(paths.srcViews),
24 htmlmin(), 24 htmlmin(),
25 templateCache('views.js', { 25 templateCache('views.js', {
26 module: 'focaCrearHojaRuta', 26 module: 'focaCrearHojaRuta',
27 root: '' 27 root: ''
28 }), 28 }),
29 gulp.dest(paths.tmp) 29 gulp.dest(paths.tmp)
30 ] 30 ]
31 ); 31 );
32 }); 32 });
33 33
34 gulp.task('uglify', ['templates'], function() { 34 gulp.task('uglify', ['templates'], function() {
35 return pump( 35 return pump(
36 [ 36 [
37 gulp.src([ 37 gulp.src([
38 paths.srcJS, 38 paths.srcJS,
39 'tmp/views.js' 39 'tmp/views.js'
40 ]), 40 ]),
41 concat('foca-crear-hoja-ruta.js'), 41 concat('foca-crear-hoja-ruta.js'),
42 replace('src/views/', ''), 42 replace('src/views/', ''),
43 replace("'ngRoute', 'focaModalRemito', 'ui.bootstrap'", ''), 43 replace("'ngRoute','focaModalRemito','ui.bootstrap','focaBotoneraLateral'", ''),
44 gulp.dest(paths.tmp), 44 gulp.dest(paths.tmp),
45 rename('foca-crear-hoja-ruta.min.js'), 45 rename('foca-crear-hoja-ruta.min.js'),
46 uglify(), 46 uglify(),
47 gulp.dest(paths.dist) 47 gulp.dest(paths.dist)
48 ] 48 ]
49 ); 49 );
50 }); 50 });
51 51
52 gulp.task('clean', function() { 52 gulp.task('clean', function() {
53 return gulp.src(['tmp', 'dist'], {read: false}) 53 return gulp.src(['tmp', 'dist'], {read: false})
54 .pipe(clean()); 54 .pipe(clean());
55 }); 55 });
56 56
57 gulp.task('pre-commit', function() { 57 gulp.task('pre-commit', function() {
58 return pump( 58 return pump(
59 [ 59 [
60 gulp.src(paths.srcJS), 60 gulp.src(paths.srcJS),
61 jshint('.jshintrc'), 61 jshint('.jshintrc'),
62 jshint.reporter('default'), 62 jshint.reporter('default'),
63 jshint.reporter('fail') 63 jshint.reporter('fail')
64 ] 64 ]
65 ); 65 );
66 66
67 gulp.start('uglify'); 67 gulp.start('uglify');
68 }); 68 });
69 69
70 gulp.task('webserver', function() { 70 gulp.task('webserver', function() {
71 pump [ 71 pump [
72 connect.server({port: 3300, host: '0.0.0.0'}) 72 connect.server({port: 3300, host: '0.0.0.0'})
73 ] 73 ]
74 }); 74 });
75 75
76 gulp.task('clean-post-install', function() { 76 gulp.task('clean-post-install', function() {
77 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', 77 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
78 'index.html'], {read: false}) 78 'index.html'], {read: false})
79 .pipe(clean()); 79 .pipe(clean());
80 }); 80 });
81 81
82 gulp.task('default', ['webserver']); 82 gulp.task('default', ['webserver']);
83 83
84 gulp.task('watch', function() { 84 gulp.task('watch', function() {
85 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); 85 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
86 }); 86 });
87 87
1 { 1 {
2 "name": "foca-crear-hoja-ruta", 2 "name": "foca-crear-hoja-ruta",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "foca-crear-hoja-ruta", 4 "description": "foca-crear-hoja-ruta",
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1", 7 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp uglify", 8 "compile": "gulp uglify",
9 "gulp-pre-commit": "gulp pre-commit", 9 "gulp-pre-commit": "gulp pre-commit",
10 "postinstall": "npm run compile && gulp clean-post-install", 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+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-remito.git" 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-botonera-facturador.git git+http://git.focasoftware.com/npm/foca-directivas.git git+http://git.focasoftware.com/npm/foca-modal-remito.git"
12 }, 12 },
13 "pre-commit": [ 13 "pre-commit": [
14 "gulp-pre-commit" 14 "gulp-pre-commit"
15 ], 15 ],
16 "repository": { 16 "repository": {
17 "type": "git", 17 "type": "git",
18 "url": "https://debo.suite.repo/modulos-npm/foca-crear-hoja-ruta.git" 18 "url": "https://debo.suite.repo/modulos-npm/foca-crear-hoja-ruta.git"
19 }, 19 },
20 "author": "Foca Software", 20 "author": "Foca Software",
21 "license": "ISC", 21 "license": "ISC",
22 "devDependencies": { 22 "devDependencies": {
23 "angular": "^1.7.5", 23 "angular": "^1.7.5",
24 "angular-ladda": "^0.4.3", 24 "angular-ladda": "^0.4.3",
25 "angular-route": "^1.7.5", 25 "angular-route": "^1.7.5",
26 "bootstrap": "^4.1.3", 26 "bootstrap": "^4.1.3",
27 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", 27 "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git",
28 "foca-modal-remito": "git+https://debo.suite.repo/modulos-npm/foca-modal-remito.git", 28 "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
29 "foca-modal-remito": "git+http://git.focasoftware.com/npm/foca-modal-remito.git",
29 "font-awesome": "^4.7.0", 30 "font-awesome": "^4.7.0",
30 "gulp": "^3.9.1", 31 "gulp": "^3.9.1",
31 "gulp-angular-templatecache": "^2.2.5", 32 "gulp-angular-templatecache": "^2.2.5",
32 "gulp-clean": "^0.4.0", 33 "gulp-clean": "^0.4.0",
33 "gulp-concat": "^2.6.1", 34 "gulp-concat": "^2.6.1",
34 "gulp-connect": "^5.6.1", 35 "gulp-connect": "^5.6.1",
35 "gulp-htmlmin": "^5.0.1", 36 "gulp-htmlmin": "^5.0.1",
36 "gulp-jshint": "^2.1.0", 37 "gulp-jshint": "^2.1.0",
37 "gulp-rename": "^1.4.0", 38 "gulp-rename": "^1.4.0",
38 "gulp-replace": "^1.0.0", 39 "gulp-replace": "^1.0.0",
39 "gulp-sequence": "^1.0.0", 40 "gulp-sequence": "^1.0.0",
40 "gulp-uglify": "^3.0.1", 41 "gulp-uglify": "^3.0.1",
41 "jasmine-core": "^3.3.0", 42 "jasmine-core": "^3.3.0",
42 "jquery": "^3.3.1", 43 "jquery": "^3.3.1",
43 "jshint": "^2.9.6", 44 "jshint": "^2.9.6",
44 "ladda": "1.0.6", 45 "ladda": "1.0.6",
45 "pre-commit": "^1.2.2", 46 "pre-commit": "^1.2.2",
46 "pump": "^3.0.0", 47 "pump": "^3.0.0",
47 "ui-bootstrap4": "^3.0.5" 48 "ui-bootstrap4": "^3.0.5"
48 } 49 }
49 } 50 }
50 51
1 angular.module('focaCrearHojaRuta', ['ngRoute', 'focaModalRemito', 'ui.bootstrap'/*, 1 angular.module('focaCrearHojaRuta', [
2 'focaBusquedaProductos', 2 'ngRoute',
3 'focaModalRemito',
4 'ui.bootstrap',
5 'focaBotoneraLateral',
6 /*'focaBusquedaProductos',
3 'focaModalProveedor', 7 'focaModalProveedor',
4 'focaBusquedaCliente', 8 'focaBusquedaCliente',
5 'focaModalPrecioCondicion', 9 'focaModalPrecioCondicion',
6 'focaModalFlete', 10 'focaModalFlete',
7 'focaDirectivas', 11 'focaDirectivas',
8 'focaModal', 12 'focaModal',
9 'focaModalDomicilio', 13 'focaModalDomicilio',
10 'focaModalMoneda', 14 'focaModalMoneda',
11 'focaModalCotizacion', 15 'focaModalCotizacion',
12 'focaSeguimiento', 16 'focaSeguimiento',
13 'angular-ladda', 17 'angular-ladda',
14 'cordovaGeolocationModule'*/ 18 'cordovaGeolocationModule'*/
15 ]); 19 ]);
16 20
src/js/controller.js
1 angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', 1 angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
2 [ 2 [
3 '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', 'focaModalService', 3 '$scope',
4 function($scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService) { 4 '$uibModal',
5 $scope.botonera = [ 5 '$location',
6 {texto: 'Transportista', accion: function() {$scope.seleccionarProveedor();}}, 6 '$filter',
7 {texto: 'Chofer', accion: function() {$scope.seleccionarChofer();}}, 7 '$timeout',
8 {texto: 'Vehiculo', accion: function() {$scope.seleccionarVehiculo();}}, 8 'crearHojaRutaService',
9 {texto: 'Tarifario', accion: function() {$scope.seleccionarTarifario();}}, 9 'focaModalService',
10 {texto: 'Remitos', accion: function() {$scope.seleccionarRemito();}}, 10 'focaBotoneraLateralService',
11 {texto: '', accion: function() {}}, 11 function($scope, $uibModal, $location, $filter, $timeout,
12 {texto: '', accion: function() {}}, 12 crearHojaRutaService, focaModalService, focaBotoneraLateralService) {
13 {texto: '', accion: function() {}} 13
14 ]; 14 $scope.botonera = crearHojaRutaService.getBotonera();
15 $scope.datepickerAbierto = false; 15 $scope.datepickerAbierto = false;
16 16
17 $scope.show = false; 17 $scope.show = false;
18 $scope.cargando = true; 18 $scope.cargando = true;
19 $scope.dateOptions = { 19 $scope.dateOptions = {
20 maxDate: new Date(), 20 maxDate: new Date(),
21 minDate: new Date(2010, 0, 1) 21 minDate: new Date(2010, 0, 1)
22 }; 22 };
23 23
24 $scope.hojaRuta = { 24 $scope.hojaRuta = {
25 fecha: new Date(), 25 fecha: new Date(),
26 litros: 0, 26 litros: 0,
27 chofer: {}, 27 chofer: {},
28 vehiculo: { 28 vehiculo: {
29 capacidad: 0 29 capacidad: 0
30 }, 30 },
31 transportista: {}, 31 transportista: {},
32 tarifario: { 32 tarifario: {
33 costo: null 33 costo: null
34 } 34 }
35 }; 35 };
36 36
37 $scope.cabecera = [];
38 $scope.showCabecera = true; 37 $scope.showCabecera = true;
39 38
40 $scope.now = new Date(); 39 $scope.now = new Date();
41 $scope.puntoVenta = '0000'; 40 $scope.puntoVenta = '0000';
42 $scope.comprobante = '00000000'; 41 $scope.comprobante = '00000000';
43 $scope.remitosTabla = []; 42 $scope.remitosTabla = [];
44 $scope.idLista = undefined; 43 $scope.idLista = undefined;
45 //La pantalla solo se usa para cargar pedidos 44 //La pantalla solo se usa para cargar pedidos
46 //var hojaRutaTemp = crearHojaRutaService.getHojaRuta(); 45 //var hojaRutaTemp = crearHojaRutaService.getHojaRuta();
47 46
47 //SETEO BOTONERA LATERAL
48 $timeout(function() {
49 focaBotoneraLateralService.showSalir(true);
50 focaBotoneraLateralService.showPausar(true);
51 focaBotoneraLateralService.showGuardar(true, $scope.crearHojaRuta);
52 });
53
48 crearHojaRutaService.getNumeroHojaRuta().then( 54 crearHojaRutaService.getNumeroHojaRuta().then(
49 function(res) { 55 function(res) {
50 $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); 56 $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4);
51 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); 57 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8);
52 }, 58 },
53 function(err) { 59 function(err) {
54 focaModalService.alert('La terminal no esta configurada correctamente'); 60 focaModalService.alert('La terminal no esta configurada correctamente');
55 console.info(err); 61 console.info(err);
56 } 62 }
57 ); 63 );
58 //La pantalla solo se usa para cargar pedidos 64 //La pantalla solo se usa para cargar pedidos
59 // if (hojaRutaTemp !== undefined) { 65 // if (hojaRutaTemp !== undefined) {
60 // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga); 66 // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga);
61 // $scope.hojaRuta = hojaRutaTemp; 67 // $scope.hojaRuta = hojaRutaTemp;
62 // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString(); 68 // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString();
63 // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString(); 69 // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString();
64 // $scope.idLista = $scope.hojaRuta.precioCondicion; 70 // $scope.idLista = $scope.hojaRuta.precioCondicion;
65 // crearHojaRutaService 71 // crearHojaRutaService
66 // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then( 72 // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then(
67 // function(res) { 73 // function(res) {
68 // $scope.remitosTabla = res.data; 74 // $scope.remitosTabla = res.data;
69 // } 75 // }
70 // ); 76 // );
71 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO 77 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO
72 //(NO REQUERIDO EN ESTA VERSION) 78 //(NO REQUERIDO EN ESTA VERSION)
73 // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then( 79 // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then(
74 // function(res) { 80 // function(res) {
75 // $scope.hojaRuta.domicilio = res.data; 81 // $scope.hojaRuta.domicilio = res.data;
76 // } 82 // }
77 // ); 83 // );
78 // } else { 84 // } else {
79 // $scope.hojaRuta.fechaCarga = new Date(); 85 // $scope.hojaRuta.fechaCarga = new Date();
80 // $scope.hojaRuta.bomba = '0'; 86 // $scope.hojaRuta.bomba = '0';
81 // $scope.hojaRuta.flete = '0'; 87 // $scope.hojaRuta.flete = '0';
82 // $scope.idLista = undefined; 88 // $scope.idLista = undefined;
83 // } 89 // }
84 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 90 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
85 // $scope.addNewDom = function() { 91 // $scope.addNewDom = function() {
86 // $scope.hojaRuta.domicilio.push({ 'id': 0 }); 92 // $scope.hojaRuta.domicilio.push({ 'id': 0 });
87 // }; 93 // };
88 // $scope.removeNewChoice = function(choice) { 94 // $scope.removeNewChoice = function(choice) {
89 // if ($scope.hojaRuta.domicilio.length > 1) { 95 // if ($scope.hojaRuta.domicilio.length > 1) {
90 // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex( 96 // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex(
91 // function(c) { 97 // function(c) {
92 // return c.$$hashKey === choice.$$hashKey; 98 // return c.$$hashKey === choice.$$hashKey;
93 // } 99 // }
94 // ), 1); 100 // ), 1);
95 // } 101 // }
96 // }; 102 // };
97 103
98 $scope.crearHojaRuta = function() { 104 $scope.crearHojaRuta = function() {
99 if($scope.hojaRuta.litros <= 0) { 105 if($scope.hojaRuta.litros <= 0) {
100 focaModalService.alert('Ingrese Remitos'); 106 focaModalService.alert('Ingrese Remitos');
101 return; 107 return;
102 } 108 }
103 109
104 if(!$scope.hojaRuta.chofer.id) { 110 if(!$scope.hojaRuta.chofer.id) {
105 focaModalService.alert('Ingrese Chofer'); 111 focaModalService.alert('Ingrese Chofer');
106 return; 112 return;
107 } 113 }
108 114
109 if(!$scope.hojaRuta.vehiculo.id) { 115 if(!$scope.hojaRuta.vehiculo.id) {
110 focaModalService.alert('Ingrese Vehiculo'); 116 focaModalService.alert('Ingrese Vehiculo');
111 return; 117 return;
112 } 118 }
113 119
114 if(!$scope.hojaRuta.transportista.codigo) { 120 if(!$scope.hojaRuta.transportista.codigo) {
115 focaModalService.alert('Ingrese Transportista'); 121 focaModalService.alert('Ingrese Transportista');
116 return; 122 return;
117 } 123 }
118 124
119 if($scope.hojaRuta.vehiculo.capacidad < $scope.hojaRuta.litros) { 125 if($scope.hojaRuta.vehiculo.capacidad < $scope.hojaRuta.litros) {
120 focaModalService.alert( 126 focaModalService.alert(
121 'La capacidad del Vehiculo es menor a lo ingresado en Remitos' 127 'La capacidad del Vehiculo es menor a lo ingresado en Remitos'
122 ); 128 );
123 return; 129 return;
124 } 130 }
125 131
126 if(!$scope.hojaRuta.tarifario.costo) { 132 if(!$scope.hojaRuta.tarifario.costo) {
127 focaModalService.alert('Ingrese Tarifario'); 133 focaModalService.alert('Ingrese Tarifario');
128 return; 134 return;
129 } 135 }
130 136
131 var date = new Date(); 137 var date = new Date();
132 var save = { 138 var save = {
133 hojaRuta: { 139 hojaRuta: {
134 id: 0, 140 id: 0,
135 fechaCreacion: 141 fechaCreacion:
136 new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 142 new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
137 .toISOString().slice(0, 19) .replace('T', ' '), 143 .toISOString().slice(0, 19) .replace('T', ' '),
138 idTransportista: $scope.hojaRuta.transportista.codigo, 144 idTransportista: $scope.hojaRuta.transportista.codigo,
139 idChofer: $scope.hojaRuta.chofer.id, 145 idChofer: $scope.hojaRuta.chofer.id,
140 idVehiculo: $scope.hojaRuta.vehiculo.id, 146 idVehiculo: $scope.hojaRuta.vehiculo.id,
141 tarifaFlete: $scope.hojaRuta.tarifario.costo 147 tarifaFlete: $scope.hojaRuta.tarifario.costo
142 }, 148 },
143 remitos: $scope.remitosTabla 149 remitos: $scope.remitosTabla
144 }; 150 };
145 151
146 crearHojaRutaService.crearHojaRuta(save).then( 152 crearHojaRutaService.crearHojaRuta(save).then(
147 function(data) { 153 function(data) {
148 focaModalService.alert( 154 focaModalService.alert(
149 'Hoja ruta creada Nº: ' + 155 'Hoja ruta creada Nº: ' +
150 $scope.rellenar(data.data.sucursal, 4) + 156 $scope.rellenar(data.data.sucursal, 4) +
151 '-' + 157 '-' +
152 $scope.rellenar(data.data.numeroHojaRuta, 8) 158 $scope.rellenar(data.data.numeroHojaRuta, 8)
153 ); 159 );
154 $scope.hojaRuta = { 160 $scope.hojaRuta = {
155 fecha: new Date(), 161 fecha: new Date(),
156 litros: 0, 162 litros: 0,
157 chofer: {}, 163 chofer: {},
158 vehiculo: { 164 vehiculo: {
159 capacidad: 0 165 capacidad: 0
160 }, 166 },
161 transportista: {}, 167 transportista: {},
162 tarifario: { 168 tarifario: {
163 costo: null 169 costo: null
164 } 170 }
165 }; 171 };
166 172
167 $scope.remitosTabla = []; 173 $scope.remitosTabla = [];
168 $scope.cabecera = []; 174 $scope.$broadcast('cleanCabecera');
169 175
170 crearHojaRutaService.getNumeroHojaRuta().then(function(res) { 176 crearHojaRutaService.getNumeroHojaRuta().then(function(res) {
171 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); 177 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8);
172 }); 178 });
173 }, 179 },
174 function(error) { 180 function(error) {
175 focaModalService.alert('Hubo un error al crear la nota de pedido'); 181 focaModalService.alert('Hubo un error al crear la nota de pedido');
176 console.info(error); 182 console.info(error);
177 } 183 }
178 ); 184 );
179 }; 185 };
180 186
181 $scope.seleccionarProveedor = function() { 187 $scope.seleccionarTransportista = function() {
182 var modalInstance = $uibModal.open( 188 var modalInstance = $uibModal.open(
183 { 189 {
184 ariaLabelledBy: 'Busqueda de Transportista', 190 ariaLabelledBy: 'Busqueda de Transportista',
185 templateUrl: 'modal-proveedor.html', 191 templateUrl: 'modal-proveedor.html',
186 controller: 'focaModalProveedorCtrl', 192 controller: 'focaModalProveedorCtrl',
187 size: 'lg', 193 size: 'lg',
188 resolve: { 194 resolve: {
189 transportista: function() { 195 transportista: function() {
190 return true; 196 return true;
191 } 197 }
192 } 198 }
193 } 199 }
194 ); 200 );
195 modalInstance.result.then( 201 modalInstance.result.then(
196 function(proveedor) { 202 function(proveedor) {
197 console.info($scope.hojaRuta); 203 console.info($scope.hojaRuta);
198 $scope.hojaRuta.transportista.codigo = proveedor.COD; 204 $scope.hojaRuta.transportista.codigo = proveedor.COD;
199 addCabecera('Transportista:', proveedor.NOM); 205 $scope.$broadcast('addCabecera', {
206 label: 'Transportista:',
207 valor: proveedor.NOM
208 });
200 }, function() { 209 }, function() {
201 210
202 } 211 }
203 ); 212 );
204 }; 213 };
205 214
206 $scope.seleccionarChofer = function() { 215 $scope.seleccionarChofer = function() {
207 var modalInstance = $uibModal.open( 216 var modalInstance = $uibModal.open(
208 { 217 {
209 ariaLabelledBy: 'Busqueda de Chofer', 218 ariaLabelledBy: 'Busqueda de Chofer',
210 templateUrl: 'modal-chofer.html', 219 templateUrl: 'modal-chofer.html',
211 controller: 'focaModalChoferController', 220 controller: 'focaModalChoferController',
212 size: 'lg' 221 size: 'lg'
213 } 222 }
214 ); 223 );
215 224
216 modalInstance.result.then( 225 modalInstance.result.then(
217 function(chofer) { 226 function(chofer) {
218 $scope.hojaRuta.chofer = chofer; 227 $scope.hojaRuta.chofer = chofer;
219 addCabecera('Chofer: ', chofer.nombre); 228 $scope.$broadcast('addCabecera', {
229 label: 'Chofer:',
230 valor: chofer.nombre
231 });
220 }, function() { 232 }, function() {
221 // funcion ejecutada cuando se cancela el modal 233 // funcion ejecutada cuando se cancela el modal
222 } 234 }
223 ); 235 );
224 }; 236 };
225 237
226 $scope.seleccionarVehiculo = function() { 238 $scope.seleccionarVehiculo = function() {
227 var modalInstance = $uibModal.open( 239 var modalInstance = $uibModal.open(
228 { 240 {
229 ariaLabelledBy: 'Busqueda de Vehiculo', 241 ariaLabelledBy: 'Busqueda de Vehiculo',
230 templateUrl: 'modal-vehiculo.html', 242 templateUrl: 'modal-vehiculo.html',
231 controller: 'focaModalVehiculoController', 243 controller: 'focaModalVehiculoController',
232 size: 'lg', 244 size: 'lg',
233 resolve: { 245 resolve: {
234 idTransportista: function() { 246 idTransportista: function() {
235 return -1; 247 return -1;
236 } 248 }
237 } 249 }
238 } 250 }
239 ); 251 );
240 252
241 modalInstance.result.then( 253 modalInstance.result.then(
254 function(vehiculo) {
255 $scope.hojaRuta.vehiculo = vehiculo;
256 $scope.$broadcast('addCabecera', {
257 label: 'Tractor:',
258 valor: vehiculo.tractor
259 });
260 $scope.$broadcast('addCabecera', {
261 label: 'Semi:',
262 valor: vehiculo.semi
242 function(vehiculo) { 263 });
243 $scope.hojaRuta.vehiculo = vehiculo; 264 $scope.$broadcast('addCabecera', {
244 addCabecera('Tractor: ', vehiculo.tractor); 265 label: 'Capacidad:',
245 addCabecera('Semi: ', vehiculo.semi); 266 valor: vehiculo.capacidad
246 addCabecera('Capacidad: ', vehiculo.capacidad); 267 });
247 }, function() { 268 }, function() {
248 // funcion ejecutada cuando se cancela el modal 269 // funcion ejecutada cuando se cancela el modal
249 } 270 }
250 ); 271 );
251 }; 272 };
252 273
253 $scope.seleccionarTarifario = function() { 274 $scope.seleccionarTarifario = function() {
254 var modalInstance = $uibModal.open( 275 var modalInstance = $uibModal.open(
255 { 276 {
256 ariaLabelledBy: 'Busqueda de Tarifario', 277 ariaLabelledBy: 'Busqueda de Tarifario',
257 templateUrl: 'modal-tarifa-flete.html', 278 templateUrl: 'modal-tarifa-flete.html',
258 controller: 'focaModalTarifaFleteController', 279 controller: 'focaModalTarifaFleteController',
259 size: 'lg', 280 size: 'lg',
260 resolve: { 281 resolve: {
261 parametrosTarifaFlete: function() { 282 parametrosTarifaFlete: function() {
262 return $scope.hojaRuta.tarifario.costo; 283 return $scope.hojaRuta.tarifario.costo;
263 } 284 }
264 } 285 }
265 } 286 }
266 ); 287 );
288
289 modalInstance.result.then(
290 function(tarifario) {
267 291 $scope.hojaRuta.tarifario = tarifario;
268 modalInstance.result.then( 292 $scope.$broadcast('addCabecera', {
269 function(tarifario) { 293 label: 'Tarifario:',
270 $scope.hojaRuta.tarifario = tarifario; 294 valor: tarifario.costo
271 addCabecera('Tarifario: ', tarifario.costo); 295 });
272 }, function() { 296 }, function() {
273 // funcion ejecutada cuando se cancela el modal 297 // funcion ejecutada cuando se cancela el modal
274 } 298 }
275 ); 299 );
276 }; 300 };
277 301
278 $scope.seleccionarRemito = function() { 302 $scope.seleccionarRemitos = function() {
279 var modalInstance = $uibModal.open( 303 var modalInstance = $uibModal.open(
280 { 304 {
281 ariaLabelledBy: 'Busqueda de Remito', 305 ariaLabelledBy: 'Busqueda de Remito',
282 templateUrl: 'foca-modal-remito.html', 306 templateUrl: 'foca-modal-remito.html',
283 controller: 'focaModalRemitoController', 307 controller: 'focaModalRemitoController',
284 size: 'lg', 308 size: 'lg',
285 resolve: {usadoPor: function() {return 'hojaRuta';}} 309 resolve: {usadoPor: function() {return 'hojaRuta';}}
286 } 310 }
287 ); 311 );
288 modalInstance.result.then( 312 modalInstance.result.then(
289 function(remito) { 313 function(remito) {
290 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { 314 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) {
291 if ($scope.remitosTabla[i].id === remito.id) { 315 if ($scope.remitosTabla[i].id === remito.id) {
292 focaModalService.alert('Remito ya incluido'); 316 focaModalService.alert('Remito ya incluido');
293 return; 317 return;
294 } 318 }
295 } 319 }
296 320
297 var litros = 0; 321 var litros = 0;
298 for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { 322 for (var j = remito.articulosRemito.length - 1; j >= 0; j--) {
299 litros = litros + parseFloat(remito.articulosRemito[j].cantidad); 323 litros = litros + parseFloat(remito.articulosRemito[j].cantidad);
300 } 324 }
301 325
302 if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { 326 if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) {
303 focaModalService.alert( 327 focaModalService.alert(
304 'Debe ingresar toda la información para el transporte' 328 'Debe ingresar toda la información para el transporte'
305 ); 329 );
306 return; 330 return;
307 } 331 }
308 332
309 if ($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) 333 if ($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad)
310 { 334 {
311 var litrostotales = litros; 335 var litrostotales = litros;
312 litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; 336 litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros;
313 focaModalService.alert( 337 focaModalService.alert(
314 'La carga excede la capacidad disponible del vehiculo. ' + 338 'La carga excede la capacidad disponible del vehiculo. ' +
315 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' 339 'Excedente no cargado: ' + (litrostotales - litros) + ' litros'
316 ); 340 );
317 } 341 }
318 342
319 remito.litros = litros; 343 remito.litros = litros;
320 $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; 344 $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros;
321 $scope.remitosTabla.push(remito); 345 $scope.remitosTabla.push(remito);
322 }, function() { 346 }, function() {
323 // funcion ejecutada cuando se cancela el modal 347 // funcion ejecutada cuando se cancela el modal
324 } 348 }
325 ); 349 );
326 }; 350 };
327 351
328 $scope.getTotal = function() { 352 $scope.getTotal = function() {
329 var total = 0; 353 var total = 0;
330 var arrayTempArticulos = $scope.remitosTabla; 354 var arrayTempArticulos = $scope.remitosTabla;
331 for (var i = 0; i < arrayTempArticulos.length; i++) { 355 for (var i = 0; i < arrayTempArticulos.length; i++) {
332 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 356 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
333 } 357 }
334 return parseFloat(total.toFixed(2)); 358 return parseFloat(total.toFixed(2));
335 }; 359 };
336 360
337 $scope.getSubTotal = function() { 361 $scope.getSubTotal = function() {
338 if($scope.articuloACargar) { 362 if($scope.articuloACargar) {
339 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 363 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
340 } 364 }
341 }; 365 };
342 366
343 $scope.limpiarPantalla = function() { 367 $scope.limpiarPantalla = function() {
344 $scope.limpiarFlete(); 368 $scope.limpiarFlete();
345 $scope.hojaRuta.flete = '0'; 369 $scope.hojaRuta.flete = '0';
346 $scope.hojaRuta.bomba = '0'; 370 $scope.hojaRuta.bomba = '0';
347 $scope.hojaRuta.precioCondicion = ''; 371 $scope.hojaRuta.precioCondicion = '';
348 $scope.remitosTabla = []; 372 $scope.remitosTabla = [];
349 $scope.hojaRuta.vendedor.nombre = ''; 373 $scope.hojaRuta.vendedor.nombre = '';
350 $scope.hojaRuta.cliente = {nombre: ''}; 374 $scope.hojaRuta.cliente = {nombre: ''};
351 $scope.hojaRuta.domicilio = {dom: ''}; 375 $scope.hojaRuta.domicilio = {dom: ''};
352 $scope.hojaRuta.litros = 0; 376 $scope.hojaRuta.litros = 0;
353 $scope.domiciliosCliente = []; 377 $scope.domiciliosCliente = [];
354 }; 378 };
355 //Recibe aviso si el teclado está en uso 379 //Recibe aviso si el teclado está en uso
356 // $rootScope.$on('usarTeclado', function(event, data) { 380 // $rootScope.$on('usarTeclado', function(event, data) {
357 // if(data) { 381 // if(data) {
358 // $scope.mostrarTeclado = true; 382 // $scope.mostrarTeclado = true;
359 // return; 383 // return;
360 // } 384 // }
361 // $scope.mostrarTeclado = false; 385 // $scope.mostrarTeclado = false;
362 // }) 386 // })
363 $scope.selectFocus = function($event) { 387 $scope.selectFocus = function($event) {
364 //Si el teclado esta en uso no selecciona el valor 388 //Si el teclado esta en uso no selecciona el valor
365 // if($scope.mostrarTeclado) { 389 // if($scope.mostrarTeclado) {
366 // return; 390 // return;
367 // } 391 // }
368 $event.target.select(); 392 $event.target.select();
369 }; 393 };
370 394
371 $scope.salir = function() { 395 $scope.salir = function() {
372 $location.path('/'); 396 $location.path('/');
373 }; 397 };
374 398
375 $scope.parsearATexto = function(articulo) { 399 $scope.parsearATexto = function(articulo) {
376 articulo.cantidad = parseFloat(articulo.cantidad); 400 articulo.cantidad = parseFloat(articulo.cantidad);
377 articulo.precio = parseFloat(articulo.precio); 401 articulo.precio = parseFloat(articulo.precio);
378 }; 402 };
379 403
380 $scope.rellenar = function(relleno, longitud) { 404 $scope.rellenar = function(relleno, longitud) {
381 relleno = '' + relleno; 405 relleno = '' + relleno;
382 while (relleno.length < longitud) { 406 while (relleno.length < longitud) {
383 relleno = '0' + relleno; 407 relleno = '0' + relleno;
384 } 408 }
385 409
386 return relleno; 410 return relleno;
387 }; 411 };
388 412
389 $scope.quitarArticulo = function(key) { 413 $scope.quitarArticulo = function(key) {
390 $scope.remitosTabla.splice(key, 1); 414 $scope.remitosTabla.splice(key, 1);
391 var litros = 0; 415 var litros = 0;
392 416
393 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { 417 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) {
394 litros += parseFloat($scope.remitosTabla[i].litros); 418 litros += parseFloat($scope.remitosTabla[i].litros);
395 }
396
397 $scope.hojaRuta.litros = litros;
398
399 };
400
401 function addCabecera(label, valor) {
402 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
403 if(propiedad.length === 1) {
404 propiedad[0].valor = valor;
405 } else {
406 $scope.cabecera.push({label: label, valor: valor});
407 }
408 }
409
410 /*function removeCabecera(label) {
411 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 419 }
412 if(propiedad.length === 1){ 420
413 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 421 $scope.hojaRuta.litros = litros;
414 } 422
415 }*/ 423 };
416 } 424 }
417 ] 425 ]
418 ) 426 )
419 .controller('hojaRutaListaCtrl', [ 427 .controller('hojaRutaListaCtrl', [
420 '$scope', 428 '$scope',
421 'crearHojaRutaService', 429 'crearHojaRutaService',
422 '$location', 430 '$location',
423 function($scope, crearHojaRutaService, $location) { 431 function($scope, crearHojaRutaService, $location) {
424 crearHojaRutaService.obtenerHojaRuta().then(function(datos) { 432 crearHojaRutaService.obtenerHojaRuta().then(function(datos) {
425 $scope.hojaRutas = datos.data; 433 $scope.hojaRutas = datos.data;
426 }); 434 });
427 $scope.editar = function(hojaRuta) { 435 $scope.editar = function(hojaRuta) {
428 crearHojaRutaService.setHojaRuta(hojaRuta); 436 crearHojaRutaService.setHojaRuta(hojaRuta);
429 $location.path('/venta-nota-pedido/abm/'); 437 $location.path('/venta-nota-pedido/abm/');
430 }; 438 };
431 $scope.crearPedido = function() { 439 $scope.crearPedido = function() {
432 crearHojaRutaService.clearHojaRuta(); 440 crearHojaRutaService.clearHojaRuta();
433 $location.path('/venta-nota-pedido/abm/'); 441 $location.path('/venta-nota-pedido/abm/');
434 }; 442 };
435 } 443 }
436 ]) 444 ])
437 .controller('focaCrearHojaRutaFichaClienteController', [ 445 .controller('focaCrearHojaRutaFichaClienteController', [
438 '$scope', 446 '$scope',
1 angular.module('focaCrearHojaRuta') 1 angular.module('focaCrearHojaRuta')
2 .service('crearHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .service('crearHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 var route = API_ENDPOINT.URL; 3 var route = API_ENDPOINT.URL;
4 return { 4 return {
5 crearHojaRuta: function(hojaRuta) { 5 crearHojaRuta: function(hojaRuta) {
6 return $http.post(route + '/hoja-ruta', hojaRuta); 6 return $http.post(route + '/hoja-ruta', hojaRuta);
7 }, 7 },
8 obtenerHojaRuta: function() { 8 obtenerHojaRuta: function() {
9 return $http.get(route +'/hoja-ruta'); 9 return $http.get(route +'/hoja-ruta');
10 }, 10 },
11 setHojaRuta: function(hojaRuta) { 11 setHojaRuta: function(hojaRuta) {
12 this.hojaRuta = hojaRuta; 12 this.hojaRuta = hojaRuta;
13 }, 13 },
14 clearHojaRuta: function() { 14 clearHojaRuta: function() {
15 this.hojaRuta = undefined; 15 this.hojaRuta = undefined;
16 }, 16 },
17 getHojaRuta: function() { 17 getHojaRuta: function() {
18 return this.hojaRuta; 18 return this.hojaRuta;
19 }, 19 },
20 getArticulosByIdHojaRuta: function(id) { 20 getArticulosByIdHojaRuta: function(id) {
21 return $http.get(route+'/articulos/hoja-ruta/'+id); 21 return $http.get(route+'/articulos/hoja-ruta/'+id);
22 }, 22 },
23 crearArticulosParaHojaRuta: function(articuloHojaRuta) { 23 crearArticulosParaHojaRuta: function(articuloHojaRuta) {
24 return $http.post(route + '/articulos/hoja-ruta', 24 return $http.post(route + '/articulos/hoja-ruta',
25 {articuloHojaRuta: articuloHojaRuta}); 25 {articuloHojaRuta: articuloHojaRuta});
26 }, 26 },
27 getDomiciliosByIdHojaRuta: function(id) { 27 getDomiciliosByIdHojaRuta: function(id) {
28 return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); 28 return $http.get(route +'/hoja-ruta/' + id + '/domicilios');
29 }, 29 },
30 getDomiciliosByIdCliente: function(id) { 30 getDomiciliosByIdCliente: function(id) {
31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) 31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega)
32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); 32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id );
33 }, 33 },
34 getPrecioCondicion: function() { 34 getPrecioCondicion: function() {
35 return $http.get(route + '/precio-condicion'); 35 return $http.get(route + '/precio-condicion');
36 }, 36 },
37 getPrecioCondicionById: function(id) { 37 getPrecioCondicionById: function(id) {
38 return $http.get(route + '/precio-condicion/' + id); 38 return $http.get(route + '/precio-condicion/' + id);
39 }, 39 },
40 getPlazoPagoByPrecioCondicion: function(id) { 40 getPlazoPagoByPrecioCondicion: function(id) {
41 return $http.get(route + '/plazo-pago/precio-condicion/' + id); 41 return $http.get(route + '/plazo-pago/precio-condicion/' + id);
42 }, 42 },
43 crearFlete: function(flete) { 43 crearFlete: function(flete) {
44 return $http.post(route + '/flete', {flete : flete}); 44 return $http.post(route + '/flete', {flete : flete});
45 }, 45 },
46 crearPlazosParaHojaRuta: function(plazos) { 46 crearPlazosParaHojaRuta: function(plazos) {
47 return $http.post(route + '/plazo-pago/hoja-ruta', plazos); 47 return $http.post(route + '/plazo-pago/hoja-ruta', plazos);
48 }, 48 },
49 getCotizacionByIdMoneda: function(id) { 49 getCotizacionByIdMoneda: function(id) {
50 return $http.get(route + '/moneda/' + id); 50 return $http.get(route + '/moneda/' + id);
51 }, 51 },
52 crearEstadoParaHojaRuta: function(estado) { 52 crearEstadoParaHojaRuta: function(estado) {
53 return $http.post(route + '/estado', {estado: estado}); 53 return $http.post(route + '/estado', {estado: estado});
54 }, 54 },
55 getNumeroHojaRuta: function() { 55 getNumeroHojaRuta: function() {
56 return $http.get(route + '/hoja-ruta/numero-siguiente'); 56 return $http.get(route + '/hoja-ruta/numero-siguiente');
57 },
58 getBotonera: function() {
59 return ['Transportista', 'Chofer', 'Vehiculo', 'Tarifario', 'Remitos'];
57 } 60 }
58 }; 61 };
59 }]); 62 }]);
60 63
src/views/hoja-ruta.html
1 <div class="crear-nota-pedido"> 1 <div class="crear-hoja-ruta foca-crear row">
2 <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0"> 2 <foca-cabecera-facturador
3 <div class="row"> 3 titulo="'Hoja de ruta'"
4 <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> 4 numero="puntoVenta + '-' + comprobante"
5 <div class="row p-1 panel-informativo"> 5 fecha="now"
6 class="mb-0 col-lg-12"
7 ></foca-cabecera-facturador>
8 <div class="col-lg-12">
9 <div class="row mt-4">
10 <div class="col-12 col-md-10 border border-light rounded">
11 <div class="row px-5 py-2 botonera-secundaria">
6 <div class="col-12"> 12 <div class="col-12">
7 <div class="row"> 13 <foca-botonera-facturador botones="botonera" extra="7" class="row"></foca-botonera-facturador>
8 <div class="col-12 col-sm-4 nota-pedido">
9 <h5>HOJA DE RUTA</h5>
10 </div>
11 <div class="col-5 col-sm-4 numero-pedido"
12 >Nº {{puntoVenta}}-{{comprobante}}
13 </div>
14 <div class="col-7 col-sm-4 text-right">
15 Fecha:
16 <span
17 ng-show="!datepickerAbierto"
18 ng-bind="now | date:'dd/MM/yyyy HH:mm'"
19 ng-click="datepickerAbierto = true"
20 >
21 </span>
22 <input
23 ng-show="datepickerAbierto"
24 type="date"
25 ng-model="now"
26 ng-change="datepickerAbierto = false"
27 ng-blur="datepickerAbierto = false"
28 class="form-control form-control-sm col-8 float-right"
29 foca-focus="datepickerAbierto"
30 hasta-hoy
31 />
32 </div>
33 </div>
34 <div class="row">
35 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
36 <span class="label" ng-bind="cab.label"></span>
37 <span class="valor" ng-bind="cab.valor"></span>
38 </div>
39 <a
40 class="btn col-12 btn-secondary d-sm-none"
41 ng-show="cabecera.length > 0"
42 ng-click="showCabecera = !showCabecera"
43 >
44 <i
45 class="fa fa-chevron-down"
46 ng-hide="showCabecera"
47 aria-hidden="true"
48 >
49 </i>
50 <i
51 class="fa fa-chevron-up"
52 ng-show="showCabecera"
53 aria-hidden="true">
54 </i>
55 </a>
56 </div>
57 </div>
58 </div>
59 <div class="row p-1 botonera-secundaria">
60 <div class="col-12">
61 <div class="row">
62 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera">
63 <button
64 type="button"
65 class="btn btn-default btn-block btn-xs text-left py-2"
66 ng-click="boton.accion()"
67 ng-class="{'d-none d-sm-block': boton.texto == ''}"
68 >
69 <i
70 class="fa fa-arrow-circle-right"
71 ng-show="boton.texto != ''"
72 ></i>
73 &nbsp;
74 {{boton.texto}}
75 </button>
76 </div>
77 </div>
78 </div> 14 </div>
79 </div> 15 </div>
80 </div> 16 <!-- PC -->
81 </div> 17 <div class="row grilla-articulo align-items-end d-none d-sm-flex">
82 </form> 18 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
83 <div class="row"> 19 <thead>
84 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 20 <tr class="d-flex">
85 <!-- PC --> 21 <th class="col-auto">#</th>
86 <div class="row grilla-articulo align-items-end d-none d-sm-flex"> 22 <th class="col-2">Remito</th>
87 <table class="table tabla-articulo table-striped table-sm table-dark"> 23 <th class="col">Cliente</th>
88 <thead> 24 <th class="col">Dirección</th>
89 <tr class="d-flex"> 25 <th class="text-right" style="width: 80px">Cantidad</th>
90 <th class="col-auto">#</th> 26 <th class="col-auto">
91 <th class="col-2">Remito</th> 27 <button
92 <th class="col">Cliente</th> 28 class="btn btn-outline-light selectable"
93 <th class="col">Dirección</th> 29 ng-click="show = !show; masMenos()"
94 <th class="text-right" style="width: 80px">Cantidad</th>
95 <th class="col-auto">
96 <button
97 class="btn btn-outline-secondary selectable"
98 ng-click="show = !show; masMenos()"
99 >
100 <i
101 class="fa fa-chevron-down"
102 ng-show="show"
103 aria-hidden="true"
104 > 30 >
105 </i> 31 <i
106 <i 32 class="fa fa-chevron-down"
107 class="fa fa-chevron-up" 33 ng-show="show"
108 ng-hide="show" 34 aria-hidden="true"
109 aria-hidden="true"> 35 >
110 </i> 36 </i>
111 </button> 37 <i
112 </th> 38 class="fa fa-chevron-up"
113 </th> 39 ng-hide="show"
114 </tr> 40 aria-hidden="true">
115 </thead> 41 </i>
116 <tbody class="tabla-articulo-body"> 42 </button>
117 <tr 43 </th>
118 ng-repeat="(key, remito) in remitosTabla" 44 </th>
119 class="d-flex" 45 </tr>
120 ng-show="show || key == remitosTabla.length - 1" 46 </thead>
121 > 47 <tbody class="tabla-articulo-body">
122 <td ng-bind="key + 1" class="col-auto"></td> 48 <tr
123 <td 49 ng-repeat="(key, remito) in remitosTabla"
124 class="col-2" 50 class="d-flex"
125 ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" 51 ng-show="show || key == remitosTabla.length - 1"
126 ></td> 52 >
127 <th class="col" ng-bind="remito.cliente[0].NOM"></th> 53 <td ng-bind="key + 1" class="col-auto"></td>
128 <th class="col" ng-bind="remito.domicilioStamp"></th> 54 <td
129 <th class="text-right" ng-bind="remito.litros" style="width: 80px"></th> 55 class="col-2"
130 <td class="text-center col-auto"> 56 ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)"
131 <button 57 ></td>
132 class="btn btn-outline-secondary" 58 <th class="col" ng-bind="remito.cliente[0].NOM"></th>
133 ng-click="quitarArticulo(key)" 59 <th class="col" ng-bind="remito.domicilioStamp"></th>
134 > 60 <th class="text-right" ng-bind="remito.litros" style="width: 80px"></th>
135 <i class="fa fa-trash"></i> 61 <td class="text-center col-auto">
136 </button> 62 <button
137 </td> 63 class="btn btn-outline-light"
138 </tr> 64 ng-click="quitarArticulo(key)"
139 </tbody> 65 >
140 <tfoot> 66 <i class="fa fa-trash"></i>
141 <tr class="d-flex"> 67 </button>
142 <td class="col-auto px-1"> 68 </td>
143 <strong>Remitos:</strong> 69 </tr>
144 <a ng-bind="remitosTabla.length"></a> 70 </tbody>
145 </td> 71 <tfoot>
146 <td class="col"></td> 72 <tr class="d-flex">
147 <td class="col-auto px-1"> 73 <td class="col-auto px-1">
148 <strong>Cantidad:</strong> 74 <strong>Remitos:</strong>
149 <a ng-bind="hojaRuta.litros"></a> 75 <a ng-bind="remitosTabla.length"></a>
150 </td> 76 </td>
151 </tr> 77 <td class="col"></td>
152 </tfoot> 78 <td class="col-auto px-1">
153 </table> 79 <strong>Cantidad:</strong>
154 </div> 80 <a ng-bind="hojaRuta.litros"></a>
155 81 </td>
156 <!-- MOBILE --> 82 </tr>
157 <div class="row d-sm-none"> 83 </tfoot>
158 <table class="table table-sm table-striped table-dark margin-bottom-mobile"> 84 </table>
159 <thead> 85 </div>
160 <tr class="d-flex"> 86
161 <th class="">#</th> 87 <!-- MOBILE -->
162 <th class="col px-0"> 88 <div class="row d-sm-none">
163 <div class="d-flex"> 89 <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile">
164 <div class="col-4 px-1">Código</div> 90 <thead>
165 <div class="col-8 px-1">Descripción</div> 91 <tr class="d-flex">
166 </div> 92 <th class="">#</th>
167 <div class="d-flex"> 93 <th class="col px-0">
168 <div class="col-3 px-1">Cantidad</div> 94 <div class="d-flex">
169 <div class="col px-1 text-right">P. Uni.</div> 95 <div class="col-4 px-1">Código</div>
170 <div class="col px-1 text-right">Subtotal</div> 96 <div class="col-8 px-1">Descripción</div>
171 </div> 97 </div>
172 </th> 98 <div class="d-flex">
173 <th class="text-center tamaño-boton"> 99 <div class="col-3 px-1">Cantidad</div>
174 &nbsp; 100 <div class="col px-1 text-right">P. Uni.</div>
175 </th> 101 <div class="col px-1 text-right">Subtotal</div>
176 </tr> 102 </div>
177 </thead> 103 </th>
178 <tbody> 104 <th class="text-center tamaño-boton">
179 <tr 105 &nbsp;
180 ng-repeat="(key, articulo) in remitosTabla" 106 </th>
181 ng-show="show || key == remitosTabla.length - 1" 107 </tr>
182 > 108 </thead>
183 <td class="w-100 align-middle d-flex p-0"> 109 <tbody>
184 <div class="align-middle p-1"> 110 <tr
185 <span ng-bind="key+1" class="align-middle"></span> 111 ng-repeat="(key, articulo) in remitosTabla"
186 </div> 112 ng-show="show || key == remitosTabla.length - 1"
187 <div class="col px-0"> 113 >
114 <td class="w-100 align-middle d-flex p-0">
115 <div class="align-middle p-1">
116 <span ng-bind="key+1" class="align-middle"></span>
117 </div>
118 <div class="col px-0">
119 <div class="d-flex">
120 <div class="col-4 px-1">
121 <span
122 ng-bind="articulo.sector + '-' + articulo.codigo"
123 ></span>
124 </div>
125 <div class="col-8 px-1">
126 <span ng-bind="articulo.descripcion"></span>
127 </div>
128 </div>
129 <div class="d-flex">
130 <div class="col-3 px-1">
131 <span ng-bind="'x' + articulo.cantidad"></span>
132 </div>
133 <div class="col-3 px-1 text-right">
134 <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span>
135 </div>
136 <div class="col px-1 text-right">
137 <span
138 ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo"
139 >
140 </span>
141 </div>
142 </div>
143 </div>
144 <div class="align-middle p-1">
145 <button
146 class="btn btn-outline-light"
147 ng-click="quitarArticulo(key)"
148 >
149 <i class="fa fa-trash"></i>
150 </button>
151 </div>
152 </td>
153 </tr>
154 </tbody>
155 <tfoot>
156 <!-- CARGANDO ITEM -->
157 <tr ng-show="!cargando" class="d-flex">
158 <td
159 class="align-middle p-1"
160 ng-bind="remitosTabla.length + 1"
161 ></td>
162 <td class="col p-0">
188 <div class="d-flex"> 163 <div class="d-flex">
189 <div class="col-4 px-1"> 164 <div class="col-4 px-1">
190 <span 165 <span
191 ng-bind="articulo.sector + '-' + articulo.codigo" 166 ng-bind="articuloACargar.sectorCodigo"
192 ></span> 167 ></span>
193 </div> 168 </div>
194 <div class="col-8 px-1"> 169 <div class="col-8 px-1">
195 <span ng-bind="articulo.descripcion"></span> 170 <span ng-bind="articuloACargar.descripcion"></span>
196 </div> 171 </div>
197 </div> 172 </div>
198 <div class="d-flex"> 173 <div class="d-flex">
199 <div class="col-3 px-1"> 174 <div class="col-3 px-1 m-1">
200 <span ng-bind="'x' + articulo.cantidad"></span> 175 <input
176 class="form-control p-1"
177 type="number"
178 min="1"
179 ng-model="articuloACargar.cantidad"
180 foca-focus="!cargando"
181 ng-keypress="agregarATabla($event.keyCode)"
182 style="height: auto; line-height: 1.1em"
183 >
201 </div> 184 </div>
202 <div class="col-3 px-1 text-right"> 185 <div class="col-3 px-1 text-right">
203 <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span> 186 <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span>
204 </div> 187 </div>
205 <div class="col px-1 text-right"> 188 <div class="col px-1 text-right">
206 <span 189 <span
207 ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo" 190 ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo"
208 > 191 >
209 </span> 192 </span>
210 </div> 193 </div>
211 </div> 194 </div>
212 </div> 195 </td>
213 <div class="align-middle p-1"> 196 <td class="text-center align-middle">
214 <button 197 <button
215 class="btn btn-outline-secondary" 198 class="btn btn-outline-light"
216 ng-click="quitarArticulo(key)" 199 ng-click="agregarATabla(13)"
217 > 200 >
218 <i class="fa fa-trash"></i> 201 <i class="fa fa-save"></i>
219 </button> 202 </button>
220 </div> 203 </td>
221 </td> 204 </tr>
222 </tr> 205 <!-- SELECCIONAR PRODUCTO -->
223 </tbody> 206 <tr ng-show="cargando" class="d-flex">
224 <tfoot> 207 <td class="col-12">
225 <!-- CARGANDO ITEM --> 208 <input
226 <tr ng-show="!cargando" class="d-flex"> 209 placeholder="Seleccione Articulo"
227 <td 210 class="form-control form-control-sm"
228 class="align-middle p-1" 211 readonly
229 ng-bind="remitosTabla.length + 1" 212 ng-click="seleccionarArticulo()"
230 ></td> 213 />
231 <td class="col p-0"> 214 </td>
232 <div class="d-flex"> 215 </tr>
233 <div class="col-4 px-1"> 216 <!-- TOOGLE EXPANDIR -->
234 <span 217 <tr>
235 ng-bind="articuloACargar.sectorCodigo" 218 <td class="col">
236 ></span> 219 <button
237 </div> 220 class="btn btn-outline-light selectable w-100"
238 <div class="col-8 px-1"> 221 ng-click="show = !show; masMenos()"
239 <span ng-bind="articuloACargar.descripcion"></span> 222 ng-show="remitosTabla.length > 0"
240 </div>
241 </div>
242 <div class="d-flex">
243 <div class="col-3 px-1 m-1">
244 <input
245 class="form-control p-1"
246 type="number"
247 min="1"
248 ng-model="articuloACargar.cantidad"
249 foca-focus="!cargando"
250 ng-keypress="agregarATabla($event.keyCode)"
251 style="height: auto; line-height: 1.1em"
252 >
253 </div>
254 <div class="col-3 px-1 text-right">
255 <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span>
256 </div>
257 <div class="col px-1 text-right">
258 <span
259 ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo"
260 >
261 </span>
262 </div>
263 </div>
264 </td>
265 <td class="text-center align-middle">
266 <button
267 class="btn btn-outline-secondary"
268 ng-click="agregarATabla(13)"
269 >
270 <i class="fa fa-save"></i>
271 </button>
272 </td>
273 </tr>
274 <!-- SELECCIONAR PRODUCTO -->
275 <tr ng-show="cargando" class="d-flex">
276 <td class="col-12">
277 <input
278 placeholder="Seleccione Articulo"
279 class="form-control form-control-sm"
280 readonly
281 ng-click="seleccionarArticulo()"
282 />
283 </td>
284 </tr>
285 <!-- TOOGLE EXPANDIR -->
286 <tr>
287 <td class="col">
288 <button
289 class="btn btn-outline-secondary selectable w-100"