Commit ab932f68ed69dd73a9ade0104c60e653cec0ccbe
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !11
Showing
5 changed files
Show diff stats
gulpfile.js
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','focaBotoneraLateral'", ''), | ||
44 | gulp.dest(paths.tmp), | 43 | gulp.dest(paths.tmp), |
45 | rename('foca-crear-hoja-ruta.min.js'), | 44 | rename('foca-crear-hoja-ruta.min.js'), |
46 | uglify(), | 45 | uglify(), |
47 | gulp.dest(paths.dist) | 46 | gulp.dest(paths.dist) |
48 | ] | 47 | ] |
49 | ); | 48 | ); |
50 | }); | 49 | }); |
51 | 50 | ||
52 | gulp.task('clean', function() { | 51 | gulp.task('clean', function() { |
53 | return gulp.src(['tmp', 'dist'], {read: false}) | 52 | return gulp.src(['tmp', 'dist'], {read: false}) |
54 | .pipe(clean()); | 53 | .pipe(clean()); |
55 | }); | 54 | }); |
56 | 55 | ||
57 | gulp.task('pre-commit', function() { | 56 | gulp.task('pre-commit', function() { |
58 | return pump( | 57 | return pump( |
59 | [ | 58 | [ |
60 | gulp.src(paths.srcJS), | 59 | gulp.src(paths.srcJS), |
61 | jshint('.jshintrc'), | 60 | jshint('.jshintrc'), |
62 | jshint.reporter('default'), | 61 | jshint.reporter('default'), |
63 | jshint.reporter('fail') | 62 | jshint.reporter('fail') |
64 | ] | 63 | ] |
65 | ); | 64 | ); |
66 | 65 | ||
67 | gulp.start('uglify'); | 66 | gulp.start('uglify'); |
68 | }); | 67 | }); |
69 | 68 | ||
70 | gulp.task('webserver', function() { | 69 | gulp.task('webserver', function() { |
71 | pump [ | 70 | pump [ |
72 | connect.server({port: 3300, host: '0.0.0.0'}) | 71 | connect.server({port: 3300, host: '0.0.0.0'}) |
73 | ] | 72 | ] |
74 | }); | 73 | }); |
75 | 74 | ||
76 | gulp.task('clean-post-install', function() { | 75 | gulp.task('clean-post-install', function() { |
77 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 76 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
78 | 'index.html'], {read: false}) | 77 | 'index.html'], {read: false}) |
79 | .pipe(clean()); | 78 | .pipe(clean()); |
80 | }); | 79 | }); |
81 | 80 | ||
82 | gulp.task('default', ['webserver']); | 81 | gulp.task('default', ['webserver']); |
83 | 82 | ||
84 | gulp.task('watch', function() { | 83 | gulp.task('watch', function() { |
85 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 84 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
86 | }); | 85 | }); |
87 | 86 |
src/js/app.js
1 | angular.module('focaCrearHojaRuta', [ | 1 | angular.module('focaCrearHojaRuta', []); |
2 | 'ngRoute', | ||
3 | 'focaModalRemito', | ||
4 | 'ui.bootstrap', | ||
5 | 'focaBotoneraLateral', | ||
6 | /*'focaBusquedaProductos', | ||
7 | 'focaModalProveedor', | ||
8 | 'focaBusquedaCliente', | ||
9 | 'focaModalPrecioCondicion', | ||
10 | 'focaModalFlete', | ||
11 | 'focaDirectivas', | ||
12 | 'focaModal', | ||
13 | 'focaModalDomicilio', | ||
14 | 'focaModalMoneda', | ||
15 | 'focaModalCotizacion', | ||
16 | 'focaSeguimiento', | ||
17 | 'angular-ladda', | ||
18 | 'cordovaGeolocationModule'*/ | ||
19 | ]); | ||
20 | 2 |
src/js/controller.js
1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', | 1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
2 | [ | 2 | [ |
3 | '$scope', | 3 | '$scope', |
4 | '$uibModal', | 4 | '$uibModal', |
5 | '$location', | 5 | '$location', |
6 | '$filter', | 6 | '$filter', |
7 | '$timeout', | 7 | '$timeout', |
8 | 'focaCrearHojaRutaService', | 8 | 'focaCrearHojaRutaService', |
9 | 'focaModalService', | 9 | 'focaModalService', |
10 | 'focaBotoneraLateralService', | 10 | 'focaBotoneraLateralService', |
11 | function($scope, $uibModal, $location, $filter, $timeout, | 11 | function($scope, $uibModal, $location, $filter, $timeout, |
12 | focaCrearHojaRutaService, focaModalService, focaBotoneraLateralService) { | 12 | focaCrearHojaRutaService, focaModalService, focaBotoneraLateralService) { |
13 | 13 | ||
14 | $scope.botonera = focaCrearHojaRutaService.getBotonera(); | 14 | $scope.botonera = focaCrearHojaRutaService.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 | 19 | ||
20 | function nuevaHojaRuta() { | 20 | function nuevaHojaRuta() { |
21 | $scope.hojaRuta = { | 21 | $scope.hojaRuta = { |
22 | fecha: new Date(), | 22 | fecha: new Date(), |
23 | litros: 0, | 23 | litros: 0, |
24 | chofer: {}, | 24 | chofer: {}, |
25 | vehiculo: { | 25 | vehiculo: { |
26 | capacidad: 0 | 26 | capacidad: 0 |
27 | }, | 27 | }, |
28 | transportista: {}, | 28 | transportista: {}, |
29 | tarifario: { | 29 | tarifario: { |
30 | costo: null | 30 | costo: null |
31 | } | 31 | } |
32 | }; | 32 | }; |
33 | } | 33 | } |
34 | nuevaHojaRuta(); | 34 | nuevaHojaRuta(); |
35 | $scope.showCabecera = true; | 35 | $scope.showCabecera = true; |
36 | 36 | ||
37 | $scope.now = new Date(); | 37 | $scope.now = new Date(); |
38 | $scope.puntoVenta = '0000'; | 38 | $scope.puntoVenta = '0000'; |
39 | $scope.comprobante = '00000000'; | 39 | $scope.comprobante = '00000000'; |
40 | $scope.remitosTabla = []; | 40 | $scope.remitosTabla = []; |
41 | $scope.idLista = undefined; | 41 | $scope.idLista = undefined; |
42 | 42 | ||
43 | //SETEO BOTONERA LATERAL | 43 | //SETEO BOTONERA LATERAL |
44 | $timeout(function() { | 44 | $timeout(function() { |
45 | focaBotoneraLateralService.showSalir(true); | 45 | focaBotoneraLateralService.showSalir(true); |
46 | focaBotoneraLateralService.showPausar(true); | 46 | focaBotoneraLateralService.showPausar(true); |
47 | focaBotoneraLateralService.showGuardar(true, $scope.crearHojaRuta); | 47 | focaBotoneraLateralService.showGuardar(true, $scope.crearHojaRuta); |
48 | }); | 48 | }); |
49 | 49 | ||
50 | focaCrearHojaRutaService.getNumeroHojaRuta().then( | 50 | focaCrearHojaRutaService.getNumeroHojaRuta().then( |
51 | function(res) { | 51 | function(res) { |
52 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); | 52 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); |
53 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); | 53 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); |
54 | }, | 54 | }, |
55 | function(err) { | 55 | function(err) { |
56 | focaModalService.alert('La terminal no esta configurada correctamente'); | 56 | focaModalService.alert('La terminal no esta configurada correctamente'); |
57 | console.info(err); | 57 | console.info(err); |
58 | } | 58 | } |
59 | ); | 59 | ); |
60 | $scope.crearHojaRuta = function() { | 60 | $scope.crearHojaRuta = function() { |
61 | if(!$scope.remitosTabla.length) { | 61 | if(!$scope.remitosTabla.length) { |
62 | focaModalService.alert('Ingrese Remitos'); | 62 | focaModalService.alert('Ingrese Remitos'); |
63 | return; | 63 | return; |
64 | } | 64 | } |
65 | if(!$scope.hojaRuta.chofer.id) { | 65 | if(!$scope.hojaRuta.chofer.id) { |
66 | focaModalService.alert('Ingrese Chofer'); | 66 | focaModalService.alert('Ingrese Chofer'); |
67 | return; | 67 | return; |
68 | } | 68 | } |
69 | if(!$scope.hojaRuta.vehiculo.id) { | 69 | if(!$scope.hojaRuta.vehiculo.id) { |
70 | focaModalService.alert('Ingrese Vehiculo'); | 70 | focaModalService.alert('Ingrese Vehiculo'); |
71 | return; | 71 | return; |
72 | } | 72 | } |
73 | if(!$scope.hojaRuta.transportista.COD) { | 73 | if(!$scope.hojaRuta.transportista.COD) { |
74 | focaModalService.alert('Ingrese Transportista'); | 74 | focaModalService.alert('Ingrese Transportista'); |
75 | return; | 75 | return; |
76 | } | 76 | } |
77 | if(!$scope.hojaRuta.tarifario.costo) { | 77 | if(!$scope.hojaRuta.tarifario.costo) { |
78 | focaModalService.alert('Ingrese Tarifario'); | 78 | focaModalService.alert('Ingrese Tarifario'); |
79 | return; | 79 | return; |
80 | } | 80 | } |
81 | if(!$scope.hojaRuta.datosExtra) { | ||
82 | focaModalService.alert('Ingrese Datos extra'); | ||
83 | return; | ||
84 | } | ||
81 | var date = new Date(); | 85 | var date = new Date(); |
82 | var save = { | 86 | var save = { |
83 | hojaRuta: { | 87 | hojaRuta: { |
84 | id: 0, | 88 | id: 0, |
85 | fechaCreacion: new Date(date.getTime()).toISOString().slice(0, 19) | 89 | fechaCreacion: new Date(date.getTime()).toISOString().slice(0, 19) |
86 | .replace('T', ' '), | 90 | .replace('T', ' '), |
87 | idTransportista: $scope.hojaRuta.transportista.COD, | 91 | idTransportista: $scope.hojaRuta.transportista.COD, |
88 | idChofer: $scope.hojaRuta.chofer.id, | 92 | idChofer: $scope.hojaRuta.chofer.id, |
89 | idVehiculo: $scope.hojaRuta.vehiculo.id, | 93 | idVehiculo: $scope.hojaRuta.vehiculo.id, |
90 | tarifaFlete: $scope.hojaRuta.tarifario.costo, | 94 | tarifaFlete: $scope.hojaRuta.tarifario.costo, |
91 | fechaReparto: $scope.fechaReparto.toISOString().substring(0, 10), | 95 | fechaReparto: $scope.fechaReparto.toISOString().substring(0, 10), |
92 | estado: 0 | 96 | estado: 0 |
93 | }, | 97 | }, |
94 | remitos: $scope.remitosTabla | 98 | remitos: $scope.remitosTabla |
95 | }; | 99 | }; |
96 | 100 | save.hojaRuta = angular.extend({}, save.hojaRuta, $scope.hojaRuta.datosExtra); | |
97 | focaCrearHojaRutaService.crearHojaRuta(save).then( | 101 | focaCrearHojaRutaService.crearHojaRuta(save).then( |
98 | function(data) { | 102 | function(data) { |
99 | focaModalService.alert( | 103 | focaModalService.alert( |
100 | 'Hoja ruta creada Nº: ' + | 104 | 'Hoja ruta creada Nº: ' + |
101 | $scope.rellenar(data.data.sucursal, 4) + | 105 | $scope.rellenar(data.data.sucursal, 4) + |
102 | '-' + | 106 | '-' + |
103 | $scope.rellenar(data.data.numeroHojaRuta, 8) | 107 | $scope.rellenar(data.data.numeroHojaRuta, 8) |
104 | ); | 108 | ); |
105 | nuevaHojaRuta(); | 109 | nuevaHojaRuta(); |
106 | $scope.remitosTabla = []; | 110 | $scope.remitosTabla = []; |
107 | $scope.$broadcast('cleanCabecera'); | 111 | $scope.$broadcast('cleanCabecera'); |
108 | 112 | ||
109 | focaCrearHojaRutaService.getNumeroHojaRuta().then(function(res) { | 113 | focaCrearHojaRutaService.getNumeroHojaRuta().then(function(res) { |
110 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); | 114 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); |
111 | }); | 115 | }); |
112 | }, | 116 | }, |
113 | function(error) { | 117 | function(error) { |
114 | focaModalService.alert('Hubo un error al crear la hoja de ruta'); | 118 | focaModalService.alert('Hubo un error al crear la hoja de ruta'); |
115 | console.info(error); | 119 | console.info(error); |
116 | } | 120 | } |
117 | ); | 121 | ); |
118 | }; | 122 | }; |
119 | 123 | ||
120 | $scope.seleccionarTransportista = function() { | 124 | $scope.seleccionarTransportista = function() { |
121 | if(eligioPreConfirmado()) return; | 125 | if(eligioPreConfirmado()) return; |
122 | var modalInstance = $uibModal.open( | 126 | var modalInstance = $uibModal.open( |
123 | { | 127 | { |
124 | ariaLabelledBy: 'Busqueda de Transportista', | 128 | ariaLabelledBy: 'Busqueda de Transportista', |
125 | templateUrl: 'modal-proveedor.html', | 129 | templateUrl: 'modal-proveedor.html', |
126 | controller: 'focaModalProveedorCtrl', | 130 | controller: 'focaModalProveedorCtrl', |
127 | size: 'lg', | 131 | size: 'lg', |
128 | resolve: { | 132 | resolve: { |
129 | transportista: function() { | 133 | transportista: function() { |
130 | return true; | 134 | return true; |
131 | } | 135 | } |
132 | } | 136 | } |
133 | } | 137 | } |
134 | ); | 138 | ); |
135 | modalInstance.result.then( | 139 | modalInstance.result.then( |
136 | function(proveedor) { | 140 | function(proveedor) { |
137 | $scope.hojaRuta.transportista = proveedor; | 141 | $scope.hojaRuta.transportista = proveedor; |
138 | $scope.$broadcast('addCabecera', { | 142 | $scope.$broadcast('addCabecera', { |
139 | label: 'Transportista:', | 143 | label: 'Transportista:', |
140 | valor: proveedor.NOM | 144 | valor: proveedor.NOM |
141 | }); | 145 | }); |
142 | }, function() { | 146 | }, function() { |
143 | 147 | ||
144 | } | 148 | } |
145 | ); | 149 | ); |
146 | }; | 150 | }; |
147 | 151 | ||
148 | $scope.seleccionarChofer = function() { | 152 | $scope.seleccionarChofer = function() { |
149 | var modalInstance = $uibModal.open( | 153 | var modalInstance = $uibModal.open( |
150 | { | 154 | { |
151 | ariaLabelledBy: 'Busqueda de Chofer', | 155 | ariaLabelledBy: 'Busqueda de Chofer', |
152 | templateUrl: 'modal-chofer.html', | 156 | templateUrl: 'modal-chofer.html', |
153 | controller: 'focaModalChoferController', | 157 | controller: 'focaModalChoferController', |
154 | size: 'lg' | 158 | size: 'lg' |
155 | } | 159 | } |
156 | ); | 160 | ); |
157 | 161 | ||
158 | modalInstance.result.then( | 162 | modalInstance.result.then( |
159 | function(chofer) { | 163 | function(chofer) { |
160 | $scope.hojaRuta.chofer = chofer; | 164 | $scope.hojaRuta.chofer = chofer; |
161 | $scope.$broadcast('addCabecera', { | 165 | $scope.$broadcast('addCabecera', { |
162 | label: 'Chofer:', | 166 | label: 'Chofer:', |
163 | valor: chofer.nombre | 167 | valor: chofer.nombre |
164 | }); | 168 | }); |
165 | }, function() { | 169 | }, function() { |
166 | // funcion ejecutada cuando se cancela el modal | 170 | // funcion ejecutada cuando se cancela el modal |
167 | } | 171 | } |
168 | ); | 172 | ); |
169 | }; | 173 | }; |
170 | 174 | ||
171 | $scope.seleccionarVehiculo = function() { | 175 | $scope.seleccionarVehiculo = function() { |
172 | if(eligioPreConfirmado()) return; | 176 | if(eligioPreConfirmado()) return; |
173 | modalVehiculos(); | 177 | modalVehiculos(); |
174 | }; | 178 | }; |
175 | 179 | ||
176 | $scope.seleccionarTarifario = function() { | 180 | $scope.seleccionarTarifario = function() { |
177 | var modalInstance = $uibModal.open( | 181 | var modalInstance = $uibModal.open( |
178 | { | 182 | { |
179 | ariaLabelledBy: 'Busqueda de Tarifario', | 183 | ariaLabelledBy: 'Busqueda de Tarifario', |
180 | templateUrl: 'modal-tarifa-flete.html', | 184 | templateUrl: 'modal-tarifa-flete.html', |
181 | controller: 'focaModalTarifaFleteController', | 185 | controller: 'focaModalTarifaFleteController', |
182 | size: 'lg', | 186 | size: 'lg', |
183 | resolve: { | 187 | resolve: { |
184 | parametrosTarifaFlete: function() { | 188 | parametrosTarifaFlete: function() { |
185 | return $scope.hojaRuta.tarifario.costo; | 189 | return $scope.hojaRuta.tarifario.costo; |
186 | } | 190 | } |
187 | } | 191 | } |
188 | } | 192 | } |
189 | ); | 193 | ); |
190 | 194 | ||
191 | modalInstance.result.then( | 195 | modalInstance.result.then( |
192 | function(tarifario) { | 196 | function(tarifario) { |
193 | $scope.hojaRuta.tarifario = tarifario; | 197 | $scope.hojaRuta.tarifario = tarifario; |
194 | $scope.$broadcast('addCabecera', { | 198 | $scope.$broadcast('addCabecera', { |
195 | label: 'Tarifario:', | 199 | label: 'Tarifario:', |
196 | valor: tarifario.costo | 200 | valor: tarifario.costo |
197 | }); | 201 | }); |
198 | }, function() { | 202 | }, function() { |
199 | // funcion ejecutada cuando se cancela el modal | 203 | // funcion ejecutada cuando se cancela el modal |
200 | } | 204 | } |
201 | ); | 205 | ); |
202 | }; | 206 | }; |
203 | 207 | ||
204 | $scope.seleccionarRemitos = function() { | 208 | $scope.seleccionarRemitos = function() { |
205 | if(eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; | 209 | if(eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; |
206 | var modalInstance = $uibModal.open( | 210 | var modalInstance = $uibModal.open( |
207 | { | 211 | { |
208 | ariaLabelledBy: 'Busqueda de Remito', | 212 | ariaLabelledBy: 'Busqueda de Remito', |
209 | templateUrl: 'foca-modal-remito.html', | 213 | templateUrl: 'foca-modal-remito.html', |
210 | controller: 'focaModalRemitoController', | 214 | controller: 'focaModalRemitoController', |
211 | size: 'lg', | 215 | size: 'lg', |
212 | resolve: {usadoPor: function() {return 'hojaRuta';}} | 216 | resolve: {usadoPor: function() {return 'hojaRuta';}} |
213 | } | 217 | } |
214 | ); | 218 | ); |
215 | modalInstance.result.then( | 219 | modalInstance.result.then( |
216 | function(remito) { | 220 | function(remito) { |
217 | // TODO: borrar cuando no se use definitivamente | 221 | // TODO: borrar cuando no se use definitivamente |
218 | // for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { | 222 | // for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { |
219 | // if ($scope.remitosTabla[i].id === remito.id) { | 223 | // if ($scope.remitosTabla[i].id === remito.id) { |
220 | // focaModalService.alert('Remito ya incluido'); | 224 | // focaModalService.alert('Remito ya incluido'); |
221 | // return; | 225 | // return; |
222 | // } | 226 | // } |
223 | // } | 227 | // } |
224 | 228 | ||
225 | // var litros = 0; | 229 | // var litros = 0; |
226 | // for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { | 230 | // for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { |
227 | // litros = litros + parseFloat(remito.articulosRemito[j].cantidad); | 231 | // litros = litros + parseFloat(remito.articulosRemito[j].cantidad); |
228 | // } | 232 | // } |
229 | 233 | ||
230 | // if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { | 234 | // if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { |
231 | // focaModalService.alert( | 235 | // focaModalService.alert( |
232 | // 'Debe ingresar toda la información para el transporte' | 236 | // 'Debe ingresar toda la información para el transporte' |
233 | // ); | 237 | // ); |
234 | // return; | 238 | // return; |
235 | // } | 239 | // } |
236 | 240 | ||
237 | //if($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) | 241 | //if($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) |
238 | // { | 242 | // { |
239 | // var litrostotales = litros; | 243 | // var litrostotales = litros; |
240 | // litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; | 244 | // litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; |
241 | // focaModalService.alert( | 245 | // focaModalService.alert( |
242 | // 'La carga excede la capacidad disponible del vehiculo. ' + | 246 | // 'La carga excede la capacidad disponible del vehiculo. ' + |
243 | // 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' | 247 | // 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' |
244 | // ); | 248 | // ); |
245 | // } | 249 | // } |
246 | 250 | ||
247 | // remito.litros = litros; | 251 | // remito.litros = litros; |
248 | // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; | 252 | // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; |
249 | $scope.cargarCisterna(remito.id).then(function() { | 253 | $scope.cargarCisterna(remito.id).then(function() { |
250 | $scope.remitosTabla.push(remito); | 254 | $scope.remitosTabla.push(remito); |
251 | }, function() { | 255 | }, function() { |
252 | // funcion ejecutada cuando se cancela el modal | 256 | // funcion ejecutada cuando se cancela el modal |
253 | }); | 257 | }); |
254 | }, function() { | 258 | }, function() { |
255 | // funcion ejecutada cuando se cancela el modal | 259 | // funcion ejecutada cuando se cancela el modal |
256 | } | 260 | } |
257 | ); | 261 | ); |
258 | }; | 262 | }; |
259 | 263 | ||
260 | $scope.seleccionarVehiculosPrecargados = function() { | 264 | $scope.seleccionarVehiculosPrecargados = function() { |
261 | if(!eligioFecha()) return; | 265 | if(!eligioFecha()) return; |
262 | modalVehiculos(true); | 266 | modalVehiculos(true); |
263 | }; | 267 | }; |
264 | 268 | ||
265 | $scope.cargarCisterna = function(idRemito) { | 269 | $scope.cargarCisterna = function(idRemito) { |
266 | if(!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; | 270 | if(!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; |
267 | var modalInstance = $uibModal.open( | 271 | var modalInstance = $uibModal.open( |
268 | { | 272 | { |
269 | ariaLabelledBy: 'Busqueda de Vehiculo', | 273 | ariaLabelledBy: 'Busqueda de Vehiculo', |
270 | templateUrl: 'foca-detalle-vehiculo.html', | 274 | templateUrl: 'foca-detalle-vehiculo.html', |
271 | controller: 'focaDetalleVehiculo', | 275 | controller: 'focaDetalleVehiculo', |
272 | size: 'lg', | 276 | size: 'lg', |
273 | resolve: { | 277 | resolve: { |
274 | idVehiculo: function() {return $scope.hojaRuta.vehiculo.id;}, | 278 | idVehiculo: function() {return $scope.hojaRuta.vehiculo.id;}, |
275 | idRemito: function() {return idRemito;}, | 279 | idRemito: function() {return idRemito;}, |
276 | fechaReparto: function() {return $scope.fechaReparto;} | 280 | fechaReparto: function() {return $scope.fechaReparto;} |
277 | } | 281 | } |
278 | } | 282 | } |
279 | ); | 283 | ); |
280 | return modalInstance.result; | 284 | return modalInstance.result; |
281 | }; | 285 | }; |
282 | 286 | ||
283 | $scope.seleccionarFechaEntrega = function() { | 287 | $scope.seleccionarFechaEntrega = function() { |
284 | if(!$scope.fechaReparto) { | 288 | if(!$scope.fechaReparto) { |
285 | elegirFecha(); | 289 | elegirFecha(); |
286 | return; | 290 | return; |
287 | } | 291 | } |
288 | focaModalService | 292 | focaModalService |
289 | .confirm('Si cambia la fecha se perderán los datos actuales') | 293 | .confirm('Si cambia la fecha se perderán los datos actuales') |
290 | .then(function() { | 294 | .then(function() { |
291 | elegirFecha(); | 295 | elegirFecha(); |
292 | }, function() { | 296 | }, function() { |
293 | return ; | 297 | return ; |
294 | }); | 298 | }); |
295 | }; | 299 | }; |
296 | 300 | ||
301 | $scope.seleccionarDatosExtra = function() { | ||
302 | var datosHojaRuta = $scope.hojaRuta.datosExtra; | ||
303 | var modalInstance = $uibModal.open( | ||
304 | { | ||
305 | templateUrl: 'foca-modal-datos-hoja-ruta.html', | ||
306 | controller: 'focaModalDatosHojaRutaCtrl', | ||
307 | size: 'lg', | ||
308 | resolve: { | ||
309 | parametrosDatos: function() { | ||
310 | return { | ||
311 | datosHojaRuta: datosHojaRuta | ||
312 | }; | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | ); | ||
317 | return modalInstance.result.then(function(datosExtra) { | ||
318 | $scope.hojaRuta.datosExtra = datosExtra; | ||
319 | }, function() { | ||
320 | //se ejecuta cuando se cancela el modal | ||
321 | }); | ||
322 | }; | ||
323 | |||
297 | function elegirFecha() { | 324 | function elegirFecha() { |
298 | focaModalService.modalFecha('Fecha de entrega').then(function(fecha) { | 325 | focaModalService.modalFecha('Fecha de entrega').then(function(fecha) { |
299 | $scope.$broadcast('addCabecera', { | 326 | $scope.$broadcast('addCabecera', { |
300 | label: 'Fecha de entrega:', | 327 | label: 'Fecha de entrega:', |
301 | valor: fecha.toLocaleDateString() | 328 | valor: fecha.toLocaleDateString() |
302 | }); | 329 | }); |
303 | $scope.fechaReparto = fecha; | 330 | $scope.fechaReparto = fecha; |
304 | nuevaHojaRuta(); | 331 | nuevaHojaRuta(); |
305 | }); | 332 | }); |
306 | } | 333 | } |
307 | 334 | ||
308 | $scope.rellenar = function(relleno, longitud) { | 335 | $scope.rellenar = function(relleno, longitud) { |
309 | relleno = '' + relleno; | 336 | relleno = '' + relleno; |
310 | while (relleno.length < longitud) { | 337 | while (relleno.length < longitud) { |
311 | relleno = '0' + relleno; | 338 | relleno = '0' + relleno; |
312 | } | 339 | } |
313 | return relleno; | 340 | return relleno; |
314 | }; | 341 | }; |
315 | 342 | ||
316 | function eligioPreConfirmado() { | 343 | function eligioPreConfirmado() { |
317 | if($scope.eligioPreConfirmado) { | 344 | if($scope.eligioPreConfirmado) { |
318 | focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado'); | 345 | focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado'); |
319 | return true; | 346 | return true; |
320 | } | 347 | } |
321 | return false; | 348 | return false; |
322 | } | 349 | } |
323 | 350 | ||
324 | function eligioFecha() { | 351 | function eligioFecha() { |
325 | if(!$scope.fechaReparto) { | 352 | if(!$scope.fechaReparto) { |
326 | focaModalService.alert('Primero seleccione fecha de reparto'); | 353 | focaModalService.alert('Primero seleccione fecha de reparto'); |
327 | return false; | 354 | return false; |
328 | } | 355 | } |
329 | return true; | 356 | return true; |
330 | } | 357 | } |
331 | 358 | ||
332 | function eligioVehiculo() { | 359 | function eligioVehiculo() { |
333 | if(!$scope.hojaRuta.vehiculo.id) { | 360 | if(!$scope.hojaRuta.vehiculo.id) { |
334 | focaModalService.alert('Primero seleccione vehiculo'); | 361 | focaModalService.alert('Primero seleccione vehiculo'); |
335 | return false; | 362 | return false; |
336 | } | 363 | } |
337 | return true; | 364 | return true; |
338 | } | 365 | } |
339 | 366 | ||
340 | function modalVehiculos(preCargados) { | 367 | function modalVehiculos(preCargados) { |
341 | var query = ''; | 368 | var query = ''; |
342 | var titulo = ''; | 369 | var titulo = ''; |
343 | if(preCargados) { | 370 | if(preCargados) { |
344 | query = '/vehiculo/obtener/pre-confirmados/' + $scope.fechaReparto | 371 | query = '/vehiculo/obtener/pre-confirmados/' + $scope.fechaReparto |
345 | .toISOString().substring(0, 10); | 372 | .toISOString().substring(0, 10); |
346 | titulo = 'Búsqueda de vehiculos pre confirmados'; | 373 | titulo = 'Búsqueda de vehiculos pre confirmados'; |
347 | }else { | 374 | }else { |
348 | query = '/vehiculo'; | 375 | query = '/vehiculo'; |
349 | titulo = 'Búsqueda de vehículos'; | 376 | titulo = 'Búsqueda de vehículos'; |
350 | } | 377 | } |
351 | var columnas = { | 378 | var columnas = { |
352 | nombre: ['Código', 'tractor', 'Semi'], | 379 | nombre: ['Código', 'tractor', 'Semi'], |
353 | propiedad: ['codigo', 'tractor', 'semi'] | 380 | propiedad: ['codigo', 'tractor', 'semi'] |
354 | }; | 381 | }; |
355 | focaModalService.modal(columnas, query, titulo).then(function(vehiculo) { | 382 | focaModalService.modal(columnas, query, titulo).then(function(vehiculo) { |
356 | $scope.hojaRuta.vehiculo = vehiculo; | 383 | $scope.hojaRuta.vehiculo = vehiculo; |
357 | $scope.hojaRuta.transportista = vehiculo.transportista; | 384 | $scope.hojaRuta.transportista = vehiculo.transportista; |
358 | if(preCargados) { | 385 | if(preCargados) { |
359 | $scope.eligioPreConfirmado = true; | 386 | $scope.eligioPreConfirmado = true; |
360 | $scope.hojaRuta.vehiculo = vehiculo; | 387 | $scope.hojaRuta.vehiculo = vehiculo; |
361 | $scope.$broadcast('addCabecera', { | 388 | $scope.$broadcast('addCabecera', { |
362 | label: 'Transportista:', | 389 | label: 'Transportista:', |
363 | valor: vehiculo.transportista.NOM | 390 | valor: vehiculo.transportista.NOM |
364 | }); | 391 | }); |
365 | focaCrearHojaRutaService | 392 | focaCrearHojaRutaService |
366 | .getRemitosByIdVehiculo(vehiculo.id, $scope.fechaReparto) | 393 | .getRemitosByIdVehiculo(vehiculo.id, $scope.fechaReparto) |
367 | .then(function(res) { | 394 | .then(function(res) { |
368 | $scope.remitosTabla = res.data; | 395 | $scope.remitosTabla = res.data; |
369 | }); | 396 | }); |
370 | } | 397 | } |
371 | $scope.$broadcast('addCabecera', { | 398 | $scope.$broadcast('addCabecera', { |
372 | label: 'Tractor:', | 399 | label: 'Tractor:', |
373 | valor: vehiculo.tractor | 400 | valor: vehiculo.tractor |
374 | }); | 401 | }); |
375 | $scope.$broadcast('addCabecera', { | 402 | $scope.$broadcast('addCabecera', { |
376 | label: 'Semi:', | 403 | label: 'Semi:', |
377 | valor: vehiculo.semi | 404 | valor: vehiculo.semi |
378 | }); | 405 | }); |
379 | $scope.$broadcast('addCabecera', { | 406 | $scope.$broadcast('addCabecera', { |
380 | label: 'Capacidad:', | 407 | label: 'Capacidad:', |
381 | valor: vehiculo.capacidad | 408 | valor: vehiculo.capacidad |
382 | }); | 409 | }); |
383 | }); | 410 | }); |
384 | } | 411 | } |
385 | } | 412 | } |
386 | ]); | 413 | ]); |
387 | 414 |
src/js/service.js
1 | angular.module('focaCrearHojaRuta') | 1 | angular.module('focaCrearHojaRuta') |
2 | .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .service('focaCrearHojaRutaService', ['$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 | }, | 57 | }, |
58 | getRemitosByIdVehiculo: function(idVehiculo, fechaReparto) { | 58 | getRemitosByIdVehiculo: function(idVehiculo, fechaReparto) { |
59 | return $http.get(route + '/vehiculo/obtener/remitos/' + | 59 | return $http.get(route + '/vehiculo/obtener/remitos/' + |
60 | idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10)); | 60 | idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10)); |
61 | }, | 61 | }, |
62 | getBotonera: function() { | 62 | getBotonera: function() { |
63 | return [ | 63 | return [ |
64 | { | 64 | { |
65 | label: 'Fecha Entrega', | 65 | label: 'Fecha Entrega', |
66 | image: 'fechaDeReparto.png' | 66 | image: 'fechaDeReparto.png' |
67 | }, | 67 | }, |
68 | { | 68 | { |
69 | label: 'Transportista', | 69 | label: 'Transportista', |
70 | image: 'transportista.png' | 70 | image: 'transportista.png' |
71 | }, | 71 | }, |
72 | { | 72 | { |
73 | label: 'Chofer', | 73 | label: 'Chofer', |
74 | image: 'chofer.png' | 74 | image: 'chofer.png' |
75 | }, | 75 | }, |
76 | { | 76 | { |
77 | label: 'Vehiculo', | 77 | label: 'Vehiculo', |
78 | image: 'vehiculos.png' | 78 | image: 'vehiculos.png' |
79 | }, | 79 | }, |
80 | { | 80 | { |
81 | label: 'Tarifario', | 81 | label: 'Tarifario', |
82 | image: 'tarifario.png' | 82 | image: 'tarifario.png' |
83 | }, | 83 | }, |
84 | { | 84 | { |
85 | label: 'Remitos', | 85 | label: 'Remitos', |
86 | image: 'remito.png' | 86 | image: 'remito.png' |
87 | }, | 87 | }, |
88 | { | 88 | { |
89 | label: 'Vehiculos precargados', | 89 | label: 'Vehiculos precargados', |
90 | image: 'vehiculos.png' | 90 | image: 'vehiculos.png' |
91 | }, | ||
92 | { | ||
93 | label: 'Datos extra', | ||
94 | image: 'tarifario.png' | ||
91 | } | 95 | } |
92 | ]; | 96 | ]; |
93 | } | 97 | } |
94 | }; | 98 | }; |
95 | }]); | 99 | }]); |
96 | 100 |
src/views/hoja-ruta.html
1 | <div class="crear-hoja-ruta foca-crear row"> | 1 | <div class="crear-hoja-ruta foca-crear row"> |
2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
3 | titulo="'Hoja de ruta'" | 3 | titulo="'Hoja de ruta'" |
4 | numero="puntoVenta + '-' + comprobante" | 4 | numero="puntoVenta + '-' + comprobante" |
5 | fecha="now" | 5 | fecha="now" |
6 | class="mb-0 col-lg-12" | 6 | class="mb-0 col-lg-12" |
7 | ></foca-cabecera-facturador> | 7 | ></foca-cabecera-facturador> |
8 | <div class="col-lg-12"> | 8 | <div class="col-lg-12"> |
9 | <div class="row mt-4"> | 9 | <div class="row mt-4"> |
10 | <div class="col-12 col-md-10 border border-light rounded"> | 10 | <div class="col-12 col-md-10 border border-light rounded"> |
11 | <div class="row px-5 py-2 botonera-secundaria"> | 11 | <div class="row px-5 py-2 botonera-secundaria"> |
12 | <div class="col-12"> | 12 | <div class="col-12"> |
13 | <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> | 13 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> |
14 | </div> | 14 | </div> |
15 | </div> | 15 | </div> |
16 | <!-- PC --> | 16 | <!-- PC --> |
17 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 17 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
18 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 18 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
19 | <thead> | 19 | <thead> |
20 | <tr class="d-flex"> | 20 | <tr class="d-flex"> |
21 | <th class="col-auto">#</th> | 21 | <th class="col-auto">#</th> |
22 | <th class="col-2">Remito</th> | 22 | <th class="col-2">Remito</th> |
23 | <th class="col">Cliente</th> | 23 | <th class="col">Cliente</th> |
24 | <th class="col">Dirección</th> | 24 | <th class="col">Dirección</th> |
25 | <th class="col-auto"> | 25 | <th class="col-auto"> |
26 | <button | 26 | <button |
27 | class="btn btn-outline-light selectable" | 27 | class="btn btn-outline-light selectable" |
28 | ng-click="show = !show; masMenos()" | 28 | ng-click="show = !show; masMenos()" |
29 | > | 29 | > |
30 | <i | 30 | <i |
31 | class="fa fa-chevron-down" | 31 | class="fa fa-chevron-down" |
32 | ng-show="show" | 32 | ng-show="show" |
33 | aria-hidden="true" | 33 | aria-hidden="true" |
34 | > | 34 | > |
35 | </i> | 35 | </i> |
36 | <i | 36 | <i |
37 | class="fa fa-chevron-up" | 37 | class="fa fa-chevron-up" |
38 | ng-hide="show" | 38 | ng-hide="show" |
39 | aria-hidden="true"> | 39 | aria-hidden="true"> |
40 | </i> | 40 | </i> |
41 | </button> | 41 | </button> |
42 | </th> | 42 | </th> |
43 | </th> | 43 | </th> |
44 | </tr> | 44 | </tr> |
45 | </thead> | 45 | </thead> |
46 | <tbody class="tabla-articulo-body"> | 46 | <tbody class="tabla-articulo-body"> |
47 | <tr | 47 | <tr |
48 | ng-repeat="(key, remito) in remitosTabla" | 48 | ng-repeat="(key, remito) in remitosTabla" |
49 | class="d-flex" | 49 | class="d-flex" |
50 | ng-show="show || key == remitosTabla.length - 1" | 50 | ng-show="show || key == remitosTabla.length - 1" |
51 | > | 51 | > |
52 | <td ng-bind="key + 1" class="col-auto"></td> | 52 | <td ng-bind="key + 1" class="col-auto"></td> |
53 | <td | 53 | <td |
54 | class="col-2" | 54 | class="col-2" |
55 | ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" | 55 | ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" |
56 | ></td> | 56 | ></td> |
57 | <th class="col" ng-bind="remito.nombreCliente"></th> | 57 | <th class="col" ng-bind="remito.nombreCliente"></th> |
58 | <th class="col" ng-bind="remito.domicilioStamp"></th> | 58 | <th class="col" ng-bind="remito.domicilioStamp"></th> |
59 | <td class="text-center col-auto"> | 59 | <td class="text-center col-auto"> |
60 | <button | 60 | <button |
61 | class="btn btn-outline-light" | 61 | class="btn btn-outline-light" |
62 | ng-click="quitarArticulo(key)" | 62 | ng-click="quitarArticulo(key)" |
63 | > | 63 | > |
64 | <i class="fa fa-trash"></i> | 64 | <i class="fa fa-trash"></i> |
65 | </button> | 65 | </button> |
66 | </td> | 66 | </td> |
67 | </tr> | 67 | </tr> |
68 | </tbody> | 68 | </tbody> |
69 | <tfoot> | 69 | <tfoot> |
70 | <tr class="d-flex"> | 70 | <tr class="d-flex"> |
71 | <td class="col-auto px-1"> | 71 | <td class="col-auto px-1"> |
72 | <strong>Remitos:</strong> | 72 | <strong>Remitos:</strong> |
73 | <a ng-bind="remitosTabla.length"></a> | 73 | <a ng-bind="remitosTabla.length"></a> |
74 | </td> | 74 | </td> |
75 | <td class="col"></td> | 75 | <td class="col"></td> |
76 | <td class="col-auto px-1"> | 76 | <td class="col-auto px-1"> |
77 | <strong>Cantidad:</strong> | 77 | <strong>Cantidad:</strong> |
78 | <a ng-bind="hojaRuta.litros"></a> | 78 | <a ng-bind="hojaRuta.litros"></a> |
79 | </td> | 79 | </td> |
80 | </tr> | 80 | </tr> |
81 | </tfoot> | 81 | </tfoot> |
82 | </table> | 82 | </table> |
83 | </div> | 83 | </div> |
84 | |||
85 | <!-- MOBILE --> | ||
86 | <div class="row d-sm-none"> | ||
87 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> | ||
88 | <thead> | ||
89 | <tr class="d-flex"> | ||
90 | <th class="">#</th> | ||
91 | <th class="col px-0"> | ||
92 | <div class="d-flex"> | ||
93 | <div class="col-4 px-1">Código</div> | ||
94 | <div class="col-8 px-1">Descripción</div> | ||
95 | </div> | ||
96 | <div class="d-flex"> | ||
97 | <div class="col-3 px-1">Cantidad</div> | ||
98 | <div class="col px-1 text-right">P. Uni.</div> | ||
99 | <div class="col px-1 text-right">Subtotal</div> | ||
100 | </div> | ||
101 | </th> | ||
102 | <th class="text-center tamaño-boton"> | ||
103 | | ||
104 | </th> | ||
105 | </tr> | ||
106 | </thead> | ||
107 | <tbody> | ||
108 | <tr | ||
109 | ng-repeat="(key, articulo) in remitosTabla" | ||
110 | ng-show="show || key == remitosTabla.length - 1" | ||
111 | > | ||
112 | <td class="w-100 align-middle d-flex p-0"> | ||
113 | <div class="align-middle p-1"> | ||
114 | <span ng-bind="key+1" class="align-middle"></span> | ||
115 | </div> | ||
116 | <div class="col px-0"> | ||
117 | <div class="d-flex"> | ||
118 | <div class="col-4 px-1"> | ||
119 | <span | ||
120 | ng-bind="articulo.sector + '-' + articulo.codigo" | ||
121 | ></span> | ||
122 | </div> | ||
123 | <div class="col-8 px-1"> | ||
124 | <span ng-bind="articulo.descripcion"></span> | ||
125 | </div> | ||
126 | </div> | ||
127 | <div class="d-flex"> | ||
128 | <div class="col-3 px-1"> | ||
129 | <span ng-bind="'x' + articulo.cantidad"></span> | ||
130 | </div> | ||
131 | <div class="col-3 px-1 text-right"> | ||
132 | <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span> | ||
133 | </div> | ||
134 | <div class="col px-1 text-right"> | ||
135 | <span | ||
136 | ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo" | ||
137 | > | ||
138 | </span> | ||
139 | </div> | ||
140 | </div> | ||
141 | </div> | ||
142 | <div class="align-middle p-1"> | ||
143 | <button | ||
144 | class="btn btn-outline-light" | ||
145 | ng-click="quitarArticulo(key)" | ||
146 | > | ||
147 | <i class="fa fa-trash"></i> | ||
148 | </button> | ||
149 | </div> | ||
150 | </td> | ||
151 | </tr> | ||
152 | </tbody> | ||
153 | <tfoot> | ||
154 | <!-- CARGANDO ITEM --> | ||
155 | <tr ng-show="!cargando" class="d-flex"> | ||
156 | <td | ||
157 | class="align-middle p-1" | ||
158 | ng-bind="remitosTabla.length + 1" | ||
159 | ></td> | ||
160 | <td class="col p-0"> | ||
161 | <div class="d-flex"> | ||
162 | <div class="col-4 px-1"> | ||
163 | <span | ||
164 | ng-bind="articuloACargar.sectorCodigo" | ||
165 | ></span> | ||
166 | </div> | ||
167 | <div class="col-8 px-1"> | ||
168 | <span ng-bind="articuloACargar.descripcion"></span> | ||
169 | </div> | ||
170 | </div> | ||
171 | <div class="d-flex"> | ||
172 | <div class="col-3 px-1 m-1"> | ||
173 | <input | ||
174 | class="form-control p-1" | ||
175 | type="number" | ||
176 | min="1" | ||
177 | ng-model="articuloACargar.cantidad" | ||
178 | foca-focus="!cargando" | ||
179 | ng-keypress="agregarATabla($event.keyCode)" | ||
180 | style="height: auto; line-height: 1.1em" | ||
181 | > | ||
182 | </div> | ||
183 | <div class="col-3 px-1 text-right"> | ||
184 | <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span> | ||
185 | </div> | ||
186 | <div class="col px-1 text-right"> | ||
187 | <span | ||
188 | ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo" | ||
189 | > | ||
190 | </span> | ||
191 | </div> | ||
192 | </div> | ||
193 | </td> | ||
194 | <td class="text-center align-middle"> | ||
195 | <button | ||
196 | class="btn btn-outline-light" | ||
197 | ng-click="agregarATabla(13)" | ||
198 | > | ||
199 | <i class="fa fa-save"></i> | ||
200 | </button> | ||
201 | </td> | ||
202 | </tr> | ||
203 | <!-- SELECCIONAR PRODUCTO --> | ||
204 | <tr ng-show="cargando" class="d-flex"> | ||
205 | <td class="col-12"> | ||
206 | <input | ||
207 | placeholder="Seleccione Articulo" | ||
208 | class="form-control form-control-sm" | ||
209 | readonly | ||
210 | ng-click="seleccionarArticulo()" | ||
211 | /> | ||
212 | </td> | ||
213 | </tr> | ||
214 | <!-- TOOGLE EXPANDIR --> | ||
215 | <tr> | ||
216 | <td class="col"> | ||
217 | <button | ||
218 | class="btn btn-outline-light selectable w-100" | ||
219 | ng-click="show = !show; masMenos()" | ||
220 | ng-show="remitosTabla.length > 0" | ||
221 | > | ||
222 | <i | ||
223 | class="fa fa-chevron-down" | ||
224 | ng-hide="show" | ||
225 | aria-hidden="true" | ||
226 | > | ||
227 | </i> | ||
228 | <i | ||
229 | class="fa fa-chevron-up" | ||
230 | ng-show="show" | ||
231 | aria-hidden="true"> | ||
232 | </i> | ||
233 | </button> | ||
234 | </td> | ||
235 | </tr> | ||
236 | <!-- FOOTER --> | ||
237 | <tr class="d-flex"> | ||
238 | <td class="align-middle no-border-top" colspan="2"> | ||
239 | <strong>Cantidad Items:</strong> | ||
240 | <a ng-bind="remitosTabla.length"></a> | ||
241 | </td> | ||
242 | <td class="text-right ml-auto table-celda-total no-border-top"> | ||
243 | <h3>Total:</h3> | ||
244 | </td> | ||
245 | <td class="table-celda-total text-right no-border-top"> | ||
246 | <h3>{{getTotal() | currency: hojaRuta.moneda.simbolo}}</h3> | ||
247 | </td> | ||
248 | </tr> | ||
249 | </tfoot> | ||
250 | </table> | ||
251 | </div> | ||
252 | </div> | 84 | </div> |
253 | </div> | 85 | </div> |
254 | </div> | 86 | </div> |
255 | <div class="row d-md-none fixed-bottom"> | ||
256 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | ||
257 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | ||
258 | <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span> | ||
259 | </div> | ||
260 | </div> | ||
261 | </div> | 87 | </div> |
262 | 88 |