Commit c393faa6f8783ca9dbf9f6436a004b1e03b39b9b

Authored by Jose Pinto
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

Master

See merge request !27
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 const header = require('gulp-header'); 12 const header = require('gulp-header');
13 const footer = require('gulp-footer'); 13 const footer = require('gulp-footer');
14 const gulpSequence = require('gulp-sequence');
14 15
15 var paths = { 16 var paths = {
16 srcJS: 'src/js/*.js', 17 srcJS: 'src/js/*.js',
17 srcViews: 'src/views/*.html', 18 srcViews: 'src/views/*.html',
18 specs: 'spec/*.js', 19 specs: 'spec/*.js',
19 tmp: 'tmp', 20 tmp: 'tmp',
20 dist: 'dist/' 21 dist: 'dist/'
21 }; 22 };
22 23
23 gulp.task('templates', ['clean'], function() { 24 gulp.task('uglify', gulpSequence('clean', ['templates', 'uglify-spec'], 'uglify-app'));
25
26 gulp.task('templates', function() {
24 return pump( 27 return pump(
25 [ 28 [
26 gulp.src(paths.srcViews), 29 gulp.src(paths.srcViews),
27 htmlmin(), 30 htmlmin(),
28 templateCache('views.js', { 31 templateCache('views.js', {
29 module: 'focaCrearHojaRuta', 32 module: 'focaCrearHojaRuta',
30 root: '' 33 root: ''
31 }), 34 }),
32 gulp.dest(paths.tmp) 35 gulp.dest(paths.tmp)
33 ] 36 ]
34 ); 37 );
35 }); 38 });
36 39
37 gulp.task('uglify', ['templates', 'uglify-spec'], function() { 40 gulp.task('uglify-app', function() {
38 return pump( 41 return pump(
39 [ 42 [
40 gulp.src([ 43 gulp.src([
41 paths.srcJS, 44 paths.srcJS,
42 'tmp/views.js' 45 'tmp/views.js'
43 ]), 46 ]),
44 concat('foca-crear-hoja-ruta.js'), 47 concat('foca-crear-hoja-ruta.js'),
45 replace('src/views/', ''), 48 replace('src/views/', ''),
46 gulp.dest(paths.tmp), 49 gulp.dest(paths.tmp),
47 rename('foca-crear-hoja-ruta.min.js'), 50 rename('foca-crear-hoja-ruta.min.js'),
48 uglify(), 51 uglify(),
49 gulp.dest(paths.dist) 52 gulp.dest(paths.dist)
50 ] 53 ]
51 ); 54 );
52 }); 55 });
53 56
54 gulp.task('uglify-spec', function() { 57 gulp.task('uglify-spec', function() {
55 return pump([ 58 return pump([
56 gulp.src(paths.specs), 59 gulp.src(paths.specs),
57 concat('foca-crear-hoja-ruta.spec.js'), 60 concat('foca-crear-hoja-ruta.spec.js'),
58 replace("src/views/", ''), 61 replace("src/views/", ''),
59 header("describe('Módulo foca-crear-hoja-ruta', function() { \n"), 62 header("describe('Módulo foca-crear-hoja-ruta', function() { \n"),
60 footer("});"), 63 footer("});"),
61 gulp.dest(paths.dist) 64 gulp.dest(paths.dist)
62 ]); 65 ]);
63 }); 66 });
64 67
65 gulp.task('clean', function() { 68 gulp.task('clean', function() {
66 return gulp.src(['tmp', 'dist'], {read: false}) 69 return gulp.src(['tmp', 'dist'], {read: false})
67 .pipe(clean()); 70 .pipe(clean());
68 }); 71 });
69 72
70 gulp.task('pre-commit', function() { 73 gulp.task('pre-commit', function() {
71 return pump( 74 return pump(
72 [ 75 [
73 gulp.src([paths.srcJS, paths.specs]), 76 gulp.src([paths.srcJS, paths.specs]),
74 jshint('.jshintrc'), 77 jshint('.jshintrc'),
75 jshint.reporter('default'), 78 jshint.reporter('default'),
76 jshint.reporter('fail') 79 jshint.reporter('fail')
77 ] 80 ]
78 ); 81 );
79 82
80 gulp.start('uglify'); 83 gulp.start('uglify');
81 }); 84 });
82 85
83 gulp.task('webserver', function() { 86 gulp.task('webserver', function() {
84 pump [ 87 pump [
85 connect.server({port: 3300, host: '0.0.0.0'}) 88 connect.server({port: 3300, host: '0.0.0.0'})
86 ] 89 ];
87 }); 90 });
88 91
89 gulp.task('clean-post-install', function() { 92 gulp.task('clean-post-install', function() {
90 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', 93 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
91 'index.html', 'test.html', 'spec'], {read: false}) 94 'index.html', 'test.html', 'spec'], {read: false})
92 .pipe(clean()); 95 .pipe(clean());
93 }); 96 });
94 97
95 gulp.task('default', ['webserver']); 98 gulp.task('default', ['webserver']);
96 99
97 gulp.task('watch', function() { 100 gulp.task('watch', function() {
98 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); 101 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
99 }); 102 });
100 103
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 'focaLoginService', 11 'focaLoginService',
12 '$localStorage',
12 function($scope, $uibModal, $location, $filter, $timeout, 13 function($scope, $uibModal, $location, $filter, $timeout,
13 focaCrearHojaRutaService, focaModalService, focaBotoneraLateralService, 14 focaCrearHojaRutaService, focaModalService, focaBotoneraLateralService,
14 focaLoginSrv) 15 focaLoginSrv, $localStorage)
15 { 16 {
16 config(); 17 config();
17 18
18 function config() { 19 function config() {
19 $scope.botonera = focaCrearHojaRutaService.getBotonera(); 20 $scope.botonera = focaCrearHojaRutaService.getBotonera();
20 $scope.datepickerAbierto = false; 21 $scope.datepickerAbierto = false;
21 $scope.show = false; 22 $scope.show = false;
22 $scope.cargando = true; 23 $scope.cargando = true;
23 $scope.now = new Date(); 24 $scope.now = new Date();
24 $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); 25 $scope.puntoVenta = $filter('rellenarDigitos')(0, 4);
25 $scope.comprobante = $filter('rellenarDigitos')(0, 8); 26 $scope.comprobante = $filter('rellenarDigitos')(0, 8);
26 27
27 //SETEO BOTONERA LATERAL 28 //SETEO BOTONERA LATERAL
28 $timeout(function() { 29 $timeout(function() {
29 focaBotoneraLateralService.showSalir(false); 30 focaBotoneraLateralService.showSalir(false);
30 focaBotoneraLateralService.showPausar(true); 31 focaBotoneraLateralService.showPausar(true);
31 focaBotoneraLateralService.showGuardar(true, $scope.crearHojaRuta); 32 focaBotoneraLateralService.showGuardar(true, $scope.crearHojaRuta);
32 focaBotoneraLateralService.addCustomButton('Salir', salir); 33 focaBotoneraLateralService.addCustomButton('Salir', salir);
33 }); 34 });
34 35
35 init(); 36 init();
37 $timeout(function() {getLSHojaRuta();});
36 } 38 }
37 39
38 function init() { 40 function init() {
39 $scope.$broadcast('cleanCabecera'); 41 $scope.$broadcast('cleanCabecera');
40 42
41 $scope.hojaRuta = { 43 $scope.hojaRuta = {
42 fecha: new Date(), 44 fecha: new Date(),
43 litros: 0, 45 litros: 0,
44 chofer: {}, 46 chofer: {},
45 vehiculo: { 47 vehiculo: {
46 capacidad: 0 48 capacidad: 0
47 }, 49 },
48 transportista: {}, 50 transportista: {},
49 tarifario: { 51 tarifario: {
50 costo: null 52 costo: null
51 } 53 },
54 remitosTabla: []
52 }; 55 };
53
54 $scope.remitosTabla = [];
55 $scope.idLista = undefined; 56 $scope.idLista = undefined;
56 57
57 focaCrearHojaRutaService.getNumeroHojaRuta().then( 58 focaCrearHojaRutaService.getNumeroHojaRuta().then(
58 function(res) { 59 function(res) {
59 $scope.puntoVenta = $filter('rellenarDigitos')(res.data.sucursal, 4); 60 $scope.puntoVenta = $filter('rellenarDigitos')(res.data.sucursal, 4);
60 $scope.comprobante = $filter('rellenarDigitos')(res.data.numeroHojaRuta, 8); 61 $scope.comprobante = $filter('rellenarDigitos')(res.data.numeroHojaRuta, 8);
61 }, 62 },
62 function(err) { 63 function(err) {
63 focaModalService.alert('La terminal no esta configurada correctamente'); 64 focaModalService.alert('La terminal no esta configurada correctamente');
64 console.info(err); 65 console.info(err);
65 } 66 }
66 ); 67 );
67 68
68 $scope.inicial = { 69 $scope.inicial = angular.copy($scope.hojaRuta);
69 hojaRuta: angular.copy($scope.hojaRuta),
70 remitosTabla: angular.copy($scope.remitosTabla),
71 idLista: angular.copy($scope.idLista)
72 };
73 } 70 }
74 71
72 $scope.$watch('hojaRuta', function(newValue, oldValue) {
73 focaBotoneraLateralService.setPausarData({
74 label: 'hojaRuta',
75 val: newValue
76 });
77 }, true);
78
75 $scope.crearHojaRuta = function() { 79 $scope.crearHojaRuta = function() {
76 if(!$scope.remitosTabla.length) { 80 if(!$scope.hojaRuta.remitosTabla.length) {
77 focaModalService.alert('Ingrese Remitos'); 81 focaModalService.alert('Ingrese Remitos');
78 return; 82 return;
79 } 83 }
80 if(!$scope.hojaRuta.chofer.id) { 84 if(!$scope.hojaRuta.chofer.id) {
81 focaModalService.alert('Ingrese Chofer'); 85 focaModalService.alert('Ingrese Chofer');
82 return; 86 return;
83 } 87 }
84 if(!$scope.hojaRuta.vehiculo.id) { 88 if(!$scope.hojaRuta.vehiculo.id) {
85 focaModalService.alert('Ingrese Vehiculo'); 89 focaModalService.alert('Ingrese Vehiculo');
86 return; 90 return;
87 } 91 }
88 if(!$scope.hojaRuta.transportista.COD) { 92 if(!$scope.hojaRuta.transportista.COD) {
89 focaModalService.alert('Ingrese Transportista'); 93 focaModalService.alert('Ingrese Transportista');
90 return; 94 return;
91 } 95 }
92 if(!$scope.hojaRuta.tarifario.costo) { 96 if(!$scope.hojaRuta.tarifario.costo) {
93 focaModalService.alert('Ingrese Tarifario'); 97 focaModalService.alert('Ingrese Tarifario');
94 return; 98 return;
95 } 99 }
96 if(!$scope.hojaRuta.datosExtra) { 100 if(!$scope.hojaRuta.datosExtra) {
97 focaModalService.alert('Ingrese Datos extra'); 101 focaModalService.alert('Ingrese Datos extra');
98 return; 102 return;
99 } 103 }
100 var date = new Date(); 104 var date = new Date();
101 var save = { 105 var save = {
102 hojaRuta: { 106 hojaRuta: {
103 id: 0, 107 id: 0,
104 fechaCreacion: new Date(date.getTime()).toISOString().slice(0, 19) 108 fechaCreacion: new Date(date.getTime()).toISOString().slice(0, 19)
105 .replace('T', ' '), 109 .replace('T', ' '),
106 idTransportista: $scope.hojaRuta.transportista.COD, 110 idTransportista: $scope.hojaRuta.transportista.COD,
107 idChofer: $scope.hojaRuta.chofer.id, 111 idChofer: $scope.hojaRuta.chofer.id,
108 idVehiculo: $scope.hojaRuta.vehiculo.id, 112 idVehiculo: $scope.hojaRuta.vehiculo.id,
109 tarifaFlete: $scope.hojaRuta.tarifario.costo, 113 tarifaFlete: $scope.hojaRuta.tarifario.costo,
110 fechaReparto: $scope.fechaReparto.toISOString().substring(0, 10), 114 fechaReparto: new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10),
111 estado: 0 115 estado: 0
112 }, 116 },
113 remitos: $scope.remitosTabla 117 remitos: $scope.hojaRuta.remitosTabla
114 }; 118 };
115 save.hojaRuta = angular.extend({}, save.hojaRuta, $scope.hojaRuta.datosExtra); 119 save.hojaRuta = angular.extend({}, save.hojaRuta, $scope.hojaRuta.datosExtra);
116 focaCrearHojaRutaService.crearHojaRuta(save).then( 120 focaCrearHojaRutaService.crearHojaRuta(save).then(
117 function(data) { 121 function(data) {
118 focaModalService.alert( 122 focaModalService.alert(
119 'Hoja ruta creada Nº: ' + 123 'Hoja ruta creada Nº: ' +
120 $filter('rellenarDigitos')(data.data.sucursal, 4) + '-' + 124 $filter('rellenarDigitos')(data.data.sucursal, 4) + '-' +
121 $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) 125 $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8)
122 ); 126 );
123 127
124 init(); 128 init();
125 }, 129 },
126 function(error) { 130 function(error) {
127 focaModalService.alert('Hubo un error al crear la hoja de ruta'); 131 focaModalService.alert('Hubo un error al crear la hoja de ruta');
128 console.info(error); 132 console.info(error);
129 } 133 }
130 ); 134 );
131 }; 135 };
132 136
133 $scope.seleccionarTransportista = function() { 137 $scope.seleccionarTransportista = function() {
134 if(eligioPreConfirmado()) return; 138 if(eligioPreConfirmado()) return;
135 var parametrosModal = { 139 var parametrosModal = {
136 titulo: 'Búsqueda de transportista', 140 titulo: 'Búsqueda de transportista',
137 query: '/transportista', 141 query: '/transportista',
138 columnas: [ 142 columnas: [
139 { 143 {
140 nombre: 'Código', 144 nombre: 'Código',
141 propiedad: 'COD' 145 propiedad: 'COD'
142 }, 146 },
143 { 147 {
144 nombre: 'Nombre', 148 nombre: 'Nombre',
145 propiedad: 'NOM' 149 propiedad: 'NOM'
146 }, 150 },
147 { 151 {
148 nombre: 'CUIT', 152 nombre: 'CUIT',
149 propiedad: 'CUIT' 153 propiedad: 'CUIT'
150 } 154 }
151 ] 155 ]
152 }; 156 };
153 focaModalService.modal(parametrosModal).then( 157 focaModalService.modal(parametrosModal).then(
154 function(proveedor) { 158 function(proveedor) {
155 $scope.hojaRuta.transportista = proveedor; 159 $scope.hojaRuta.transportista = proveedor;
156 $scope.$broadcast('addCabecera', { 160 $scope.$broadcast('addCabecera', {
157 label: 'Transportista:', 161 label: 'Transportista:',
158 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + 162 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' +
159 proveedor.NOM 163 proveedor.NOM
160 }); 164 });
161 }, function() { 165 }, function() {
162 166
163 } 167 }
164 ); 168 );
165 }; 169 };
166 170
167 $scope.seleccionarChofer = function() { 171 $scope.seleccionarChofer = function() {
168 var parametrosModal = { 172 var parametrosModal = {
169 titulo: 'Búsqueda de Chofer', 173 titulo: 'Búsqueda de Chofer',
170 query: '/chofer', 174 query: '/chofer',
171 columnas: [ 175 columnas: [
172 { 176 {
173 propiedad: 'id', 177 propiedad: 'id',
174 nombre: 'Código', 178 nombre: 'Código',
175 filtro: { 179 filtro: {
176 nombre: 'rellenarDigitos', 180 nombre: 'rellenarDigitos',
177 parametro: 3 181 parametro: 3
178 } 182 }
179 }, 183 },
180 { 184 {
181 propiedad: 'nombre', 185 propiedad: 'nombre',
182 nombre: 'Nombre' 186 nombre: 'Nombre'
183 }, 187 },
184 { 188 {
185 propiedad: 'dni', 189 propiedad: 'dni',
186 nombre: 'DNI' 190 nombre: 'DNI'
187 }, 191 },
188 { 192 {
189 propiedad: 'telefono', 193 propiedad: 'telefono',
190 nombre: 'Teléfono' 194 nombre: 'Teléfono'
191 } 195 }
192 ] 196 ]
193 }; 197 };
194 focaModalService.modal(parametrosModal).then( 198 focaModalService.modal(parametrosModal).then(
195 function(chofer) { 199 function(chofer) {
196 $scope.hojaRuta.chofer = chofer; 200 $scope.hojaRuta.chofer = chofer;
197 $scope.$broadcast('addCabecera', { 201 $scope.$broadcast('addCabecera', {
198 label: 'Chofer:', 202 label: 'Chofer:',
199 valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' +chofer.nombre 203 valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' +chofer.nombre
200 }); 204 });
201 }, function() { 205 }, function() {
202 // funcion ejecutada cuando se cancela el modal 206 // funcion ejecutada cuando se cancela el modal
203 } 207 }
204 ); 208 );
205 }; 209 };
206 210
207 $scope.seleccionarVehiculo = function() { 211 $scope.seleccionarVehiculo = function() {
208 if(!eligioFecha() || eligioPreConfirmado()) return; 212 if(!eligioFecha() || eligioPreConfirmado()) return;
209 modalVehiculos(); 213 modalVehiculos();
210 }; 214 };
211 215
212 $scope.seleccionarTarifario = function() { 216 $scope.seleccionarTarifario = function() {
213 var modalInstance = $uibModal.open( 217 var modalInstance = $uibModal.open(
214 { 218 {
215 ariaLabelledBy: 'Busqueda de Tarifario', 219 ariaLabelledBy: 'Busqueda de Tarifario',
216 templateUrl: 'modal-tarifa-flete.html', 220 templateUrl: 'modal-tarifa-flete.html',
217 controller: 'focaModalTarifaFleteController', 221 controller: 'focaModalTarifaFleteController',
218 size: 'lg', 222 size: 'lg',
219 resolve: { 223 resolve: {
220 parametrosTarifaFlete: function() { 224 parametrosTarifaFlete: function() {
221 return $scope.hojaRuta.tarifario.costo; 225 return $scope.hojaRuta.tarifario.costo;
222 } 226 }
223 } 227 }
224 } 228 }
225 ); 229 );
226 230
227 modalInstance.result.then( 231 modalInstance.result.then(
228 function(tarifario) { 232 function(tarifario) {
229 $scope.hojaRuta.tarifario = tarifario; 233 $scope.hojaRuta.tarifario = tarifario;
230 $scope.$broadcast('addCabecera', { 234 $scope.$broadcast('addCabecera', {
231 label: 'Tarifario:', 235 label: 'Tarifario:',
232 valor: tarifario.costo 236 valor: tarifario.costo
233 }); 237 });
234 }, function() { 238 }, function() {
235 // funcion ejecutada cuando se cancela el modal 239 // funcion ejecutada cuando se cancela el modal
236 } 240 }
237 ); 241 );
238 }; 242 };
239 243
240 $scope.seleccionarRemitos = function() { 244 $scope.seleccionarRemitos = function() {
241 if(eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; 245 if(eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return;
242 var modalInstance = $uibModal.open( 246 var modalInstance = $uibModal.open(
243 { 247 {
244 ariaLabelledBy: 'Busqueda de Remito', 248 ariaLabelledBy: 'Busqueda de Remito',
245 templateUrl: 'foca-modal-remito.html', 249 templateUrl: 'foca-modal-remito.html',
246 controller: 'focaModalRemitoController', 250 controller: 'focaModalRemitoController',
247 size: 'lg', 251 size: 'lg',
248 resolve: {usadoPor: function() {return 'hojaRuta';}} 252 resolve: {usadoPor: function() {return 'hojaRuta';}}
249 } 253 }
250 ); 254 );
251 modalInstance.result.then( 255 modalInstance.result.then(
252 function(remito) { 256 function(remito) {
253 // TODO: borrar cuando no se use definitivamente 257 // TODO: borrar cuando no se use definitivamente
254 // for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { 258 // for (var i = $scope.hojaRuta.remitosTabla.length - 1; i >= 0; i--) {
255 // if ($scope.remitosTabla[i].id === remito.id) { 259 // if ($scope.hojaRuta.remitosTabla[i].id === remito.id) {
256 // focaModalService.alert('Remito ya incluido'); 260 // focaModalService.alert('Remito ya incluido');
257 // return; 261 // return;
258 // } 262 // }
259 // } 263 // }
260 264
261 // var litros = 0; 265 // var litros = 0;
262 // for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { 266 // for (var j = remito.articulosRemito.length - 1; j >= 0; j--) {
263 // litros = litros + parseFloat(remito.articulosRemito[j].cantidad); 267 // litros = litros + parseFloat(remito.articulosRemito[j].cantidad);
264 // } 268 // }
265 269
266 // if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { 270 // if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) {
267 // focaModalService.alert( 271 // focaModalService.alert(
268 // 'Debe ingresar toda la información para el transporte' 272 // 'Debe ingresar toda la información para el transporte'
269 // ); 273 // );
270 // return; 274 // return;
271 // } 275 // }
272 276
273 //if($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) 277 //if($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad)
274 // { 278 // {
275 // var litrostotales = litros; 279 // var litrostotales = litros;
276 // litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; 280 // litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros;
277 // focaModalService.alert( 281 // focaModalService.alert(
278 // 'La carga excede la capacidad disponible del vehiculo. ' + 282 // 'La carga excede la capacidad disponible del vehiculo. ' +
279 // 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' 283 // 'Excedente no cargado: ' + (litrostotales - litros) + ' litros'
280 // ); 284 // );
281 // } 285 // }
282 286
283 // remito.litros = litros; 287 // remito.litros = litros;
284 // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; 288 // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros;
285 $scope.cargarCisterna(remito.id).then(function() { 289 $scope.cargarCisterna(remito.id).then(function() {
286 $scope.remitosTabla.push(remito); 290 $scope.hojaRuta.remitosTabla.push(remito);
287 $scope.seleccionarRemitos(); 291 $scope.seleccionarRemitos();
288 }, function() { 292 }, function() {
289 $scope.seleccionarRemitos(); 293 $scope.seleccionarRemitos();
290 }); 294 });
291 }, function() { 295 }, function() {
292 // funcion ejecutada cuando se cancela el modal 296 // funcion ejecutada cuando se cancela el modal
293 } 297 }
294 ); 298 );
295 }; 299 };
296 300
297 $scope.seleccionarVehiculosPrecargados = function() { 301 $scope.seleccionarVehiculosPrecargados = function() {
298 if(!eligioFecha()) return; 302 if(!eligioFecha()) return;
299 modalVehiculos(true); 303 modalVehiculos(true);
300 }; 304 };
301 305
302 $scope.cargarCisterna = function(idRemito) { 306 $scope.cargarCisterna = function(idRemito) {
303 if(!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; 307 if(!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return;
304 var modalInstance = $uibModal.open( 308 var modalInstance = $uibModal.open(
305 { 309 {
306 ariaLabelledBy: 'Busqueda de Vehiculo', 310 ariaLabelledBy: 'Busqueda de Vehiculo',
307 templateUrl: 'foca-detalle-vehiculo.html', 311 templateUrl: 'foca-detalle-vehiculo.html',
308 controller: 'focaDetalleVehiculo', 312 controller: 'focaDetalleVehiculo',
309 size: 'lg', 313 size: 'lg',
310 resolve: { 314 resolve: {
311 idVehiculo: function() {return $scope.hojaRuta.vehiculo.id;}, 315 idVehiculo: function() {return $scope.hojaRuta.vehiculo.id;},
312 idRemito: function() {return idRemito;}, 316 idRemito: function() {return idRemito;},
313 fechaReparto: function() {return $scope.fechaReparto;} 317 fechaReparto: function() {return $scope.hojaRuta.fechaReparto;}
314 } 318 }
315 } 319 }
316 ); 320 );
317 return modalInstance.result; 321 return modalInstance.result;
318 }; 322 };
319 323
320 $scope.seleccionarFechaEntrega = function() { 324 $scope.seleccionarFechaEntrega = function() {
321 if(!$scope.fechaReparto) { 325 if (!$scope.hojaRuta.fechaReparto) {
322 elegirFecha(); 326 elegirFecha();
323 return; 327 return;
324 } 328 }
325 focaModalService 329 focaModalService
326 .confirm('Si cambia la fecha se perderán los datos actuales') 330 .confirm('Si cambia la fecha se perderán los datos actuales')
327 .then(function() { 331 .then(function() {
328 elegirFecha(); 332 elegirFecha();
329 }, function() { 333 }, function() {
330 return ; 334 return ;
331 }); 335 });
332 }; 336 };
333 337
334 $scope.seleccionarDatosExtra = function() { 338 $scope.seleccionarDatosExtra = function() {
335 var datosHojaRuta = $scope.hojaRuta.datosExtra; 339 var datosHojaRuta = $scope.hojaRuta.datosExtra;
336 var modalInstance = $uibModal.open( 340 var modalInstance = $uibModal.open(
337 { 341 {
338 templateUrl: 'foca-modal-datos-hoja-ruta.html', 342 templateUrl: 'foca-modal-datos-hoja-ruta.html',
339 controller: 'focaModalDatosHojaRutaCtrl', 343 controller: 'focaModalDatosHojaRutaCtrl',
340 size: 'lg', 344 size: 'lg',
341 resolve: { 345 resolve: {
342 parametrosDatos: function() { 346 parametrosDatos: function() {
343 return { 347 return {
344 datosHojaRuta: datosHojaRuta 348 datosHojaRuta: datosHojaRuta
345 }; 349 };
346 } 350 }
347 } 351 }
348 } 352 }
349 ); 353 );
350 return modalInstance.result.then(function(datosExtra) { 354 return modalInstance.result.then(function(datosExtra) {
351 $scope.hojaRuta.datosExtra = datosExtra; 355 $scope.hojaRuta.datosExtra = datosExtra;
352 }, function() { 356 }, function() {
353 //se ejecuta cuando se cancela el modal 357 //se ejecuta cuando se cancela el modal
354 }); 358 });
355 }; 359 };
356 360
357 $scope.desasociarRemito = function(key, idRemito) { 361 $scope.desasociarRemito = function(key, idRemito) {
358 var idsRemito = [idRemito]; 362 var idsRemito = [idRemito];
359 focaModalService.confirm('¿Está seguro que desea desasociar este remito del' + 363 focaModalService.confirm('¿Está seguro que desea desasociar este remito del' +
360 ' vehículo?').then(function() { 364 ' vehículo?').then(function() {
361 focaCrearHojaRutaService.desasociarRemitos(idsRemito, 365 focaCrearHojaRutaService.desasociarRemitos(idsRemito,
362 $scope.hojaRuta.vehiculo.id, $scope.remitosTabla.length <= 1).then( 366 $scope.hojaRuta.vehiculo.id, $scope.hojaRuta.remitosTabla.length <= 1).then(
363 function() { 367 function() {
364 $scope.remitosTabla.splice(key, 1); 368 $scope.hojaRuta.remitosTabla.splice(key, 1);
365 focaModalService.alert('Remito desasociado con éxito'); 369 focaModalService.alert('Remito desasociado con éxito');
366 } 370 }
367 ); 371 );
368 }); 372 });
369 }; 373 };
370 374
371 function elegirFecha() { 375 function elegirFecha() {
372 focaModalService.modalFecha('Fecha de entrega').then(function(fecha) { 376 focaModalService.modalFecha('Fecha de entrega').then(function(fecha) {
373 $scope.$broadcast('addCabecera', { 377 $scope.$broadcast('addCabecera', {
374 label: 'Fecha de entrega:', 378 label: 'Fecha de entrega:',
375 valor: fecha.toLocaleDateString() 379 valor: fecha.toLocaleDateString()
376 }); 380 });
377 $scope.fechaReparto = fecha; 381 $scope.hojaRuta.fechaReparto = fecha;
378 }); 382 });
379 } 383 }
380 384
381 function eligioPreConfirmado() { 385 function eligioPreConfirmado() {
382 if($scope.eligioPreConfirmado) { 386 if($scope.eligioPreConfirmado) {
383 focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado'); 387 focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado');
384 return true; 388 return true;
385 } 389 }
386 return false; 390 return false;
387 } 391 }
388 392
389 function eligioFecha() { 393 function eligioFecha() {
390 if(!$scope.fechaReparto) { 394 if(!$scope.hojaRuta.fechaReparto) {
391 focaModalService.alert('Primero seleccione fecha de reparto'); 395 focaModalService.alert('Primero seleccione fecha de reparto');
392 return false; 396 return false;
393 } 397 }
394 return true; 398 return true;
395 } 399 }
396 400
397 function eligioVehiculo() { 401 function eligioVehiculo() {
398 if(!$scope.hojaRuta.vehiculo.id) { 402 if(!$scope.hojaRuta.vehiculo.id) {
399 focaModalService.alert('Primero seleccione vehiculo'); 403 focaModalService.alert('Primero seleccione vehiculo');
400 return false; 404 return false;
401 } 405 }
402 return true; 406 return true;
403 } 407 }
404 408
405 function modalVehiculos(preCargados) { 409 function modalVehiculos(preCargados) {
406 var parametrosModal = {}; 410 var parametrosModal = {};
407 if(preCargados) { 411 if(preCargados) {
408 parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' + 412 parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' +
409 $scope.fechaReparto.toISOString().substring(0, 10); 413 new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10);
410 parametrosModal.titulo = 'Búsqueda de vehiculos pre confirmados'; 414 parametrosModal.titulo = 'Búsqueda de vehiculos pre confirmados';
411 }else { 415 }else {
412 parametrosModal.query = '/vehiculo'; 416 parametrosModal.query = '/vehiculo';
413 parametrosModal.titulo = 'Búsqueda de vehículos'; 417 parametrosModal.titulo = 'Búsqueda de vehículos';
414 } 418 }
415 parametrosModal.columnas = [ 419 parametrosModal.columnas = [
416 { 420 {
417 propiedad: 'codigo', 421 propiedad: 'codigo',
418 nombre: 'Código' 422 nombre: 'Código'
419 }, 423 },
420 { 424 {
421 propiedad: 'tractor', 425 propiedad: 'tractor',
422 nombre: 'tractor' 426 nombre: 'tractor'
423 }, 427 },
424 { 428 {
425 propiedad: 'semi', 429 propiedad: 'semi',
426 nombre: 'Semi' 430 nombre: 'Semi'
427 } 431 }
428 ]; 432 ];
429 focaModalService.modal(parametrosModal).then(function(vehiculo) { 433 focaModalService.modal(parametrosModal).then(function(vehiculo) {
430 if(!preCargados && vehiculoEnUso(vehiculo)) return; 434 if(!preCargados && vehiculoEnUso(vehiculo)) return;
431 $scope.hojaRuta.vehiculo = vehiculo; 435 $scope.hojaRuta.vehiculo = vehiculo;
432 $scope.hojaRuta.transportista = vehiculo.transportista; 436 $scope.hojaRuta.transportista = vehiculo.transportista;
433 if(preCargados) { 437 if(preCargados) {
434 $scope.eligioPreConfirmado = true; 438 $scope.eligioPreConfirmado = true;
435 $scope.hojaRuta.vehiculo = vehiculo; 439 $scope.hojaRuta.vehiculo = vehiculo;
436 $scope.$broadcast('addCabecera', { 440 $scope.$broadcast('addCabecera', {
437 label: 'Transportista:', 441 label: 'Transportista:',
438 valor: $filter('rellenarDigitos')(vehiculo.transportista.COD, 5) + 442 valor: $filter('rellenarDigitos')(vehiculo.transportista.COD, 5) +
439 ' - ' + vehiculo.transportista.NOM 443 ' - ' + vehiculo.transportista.NOM
440 }); 444 });
441 focaCrearHojaRutaService 445 focaCrearHojaRutaService
442 .getRemitosByIdVehiculo(vehiculo.id, $scope.fechaReparto) 446 .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto)
443 .then(function(res) { 447 .then(function(res) {
444 $scope.remitosTabla = res.data; 448 $scope.hojaRuta.remitosTabla = res.data;
445 }); 449 });
446 }else { 450 }else {
447 focaCrearHojaRutaService 451 focaCrearHojaRutaService
448 .getRemitosByIdVehiculo(vehiculo.id, $scope.fechaReparto, true) 452 .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto, true)
449 .then(function(res) { 453 .then(function(res) {
450 $scope.remitosTabla = res.data; 454 $scope.hojaRuta.remitosTabla = res.data;
451 }); 455 });
452 } 456 }
453 $scope.$broadcast('addCabecera', { 457 $scope.$broadcast('addCabecera', {
454 label: 'Tractor:', 458 label: 'Tractor:',
455 valor: vehiculo.tractor 459 valor: vehiculo.tractor
456 }); 460 });
457 $scope.$broadcast('addCabecera', { 461 $scope.$broadcast('addCabecera', {
458 label: 'Semi:', 462 label: 'Semi:',
459 valor: vehiculo.semi 463 valor: vehiculo.semi
460 }); 464 });
461 $scope.$broadcast('addCabecera', { 465 $scope.$broadcast('addCabecera', {
462 label: 'Capacidad:', 466 label: 'Capacidad:',
463 valor: vehiculo.capacidad 467 valor: vehiculo.capacidad
464 }); 468 });
465 }); 469 });
466 } 470 }
467 471
468 function vehiculoEnUso(vehiculo) { 472 function vehiculoEnUso(vehiculo) {
469 var idUsuario = focaLoginSrv.getLoginData().vendedorCobrador; 473 var idUsuario = focaLoginSrv.getLoginData().vendedorCobrador;
470 for(var i = 0; i < vehiculo.cisternas.length; i++) { 474 for (var i = 0; i < vehiculo.cisternas.length; i++) {
471 for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { 475 for (var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) {
472 var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; 476 var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j];
473 if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto 477 if (cisternaCarga.fechaReparto.substring(0, 10) ===
474 .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso && 478 new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10) &&
479 cisternaCarga.idUsuarioProceso &&
475 cisternaCarga.idUsuarioProceso !== idUsuario) 480 cisternaCarga.idUsuarioProceso !== idUsuario)
476 { 481 {
477 focaModalService.alert('El vehículo está siendo usado por otro' + 482 focaModalService.alert('El vehículo está siendo usado por otro' +
478 ' usuario'); 483 ' usuario');
479 return true; 484 return true;
480 } 485 }
481 } 486 }
482 } 487 }
483 return false; 488 return false;
484 } 489 }
485 490
486 function salir() { 491 function salir() {
487 var confirmacion = false; 492 var confirmacion = false;
488 493
489 angular.forEach($scope.inicial, function(valor, key) { 494 if (!angular.equals($scope.hojaRuta, $scope.inicial)) {
490 if (!angular.equals($scope[key], $scope.inicial[key])) { 495 confirmacion = true;
491 confirmacion = true; 496 }
492 }
493 });
494 497
495 if (confirmacion) { 498 if (confirmacion) {
496 focaModalService.confirm( 499 focaModalService.confirm(
497 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' 500 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
498 ).then(function(data) { 501 ).then(function(data) {
499 if (data) { 502 if (data) {
500 $location.path('/'); 503 $location.path('/');
501 } 504 }
502 }); 505 });
503 } else { 506 } else {
504 $location.path('/'); 507 $location.path('/');
505 } 508 }
506 } 509 }
510
511 function setearHojaRuta(hojaRuta) {
512 $scope.$broadcast('cleanCabecera');
513
514 var cabeceras = [];
515 if (hojaRuta.fechaReparto) {
516 cabeceras.push({
517 label: 'Fecha de entrega:',
518 valor: $filter('date')(hojaRuta.fechaReparto, 'dd/MM/yyyy')
519 });
520 }
521 if (hojaRuta.transportista.COD) {
522 cabeceras.push({
523 label: 'Transportista:',
524 valor: $filter('rellenarDigitos')(hojaRuta.transportista.COD, 5) + ' - ' +
525 hojaRuta.transportista.NOM
526 });
527 }
528 if (hojaRuta.chofer.id) {
529 cabeceras.push({
530 label: 'Chofer:',
531 valor: $filter('rellenarDigitos')(hojaRuta.chofer.id, 3) +
532 ' - ' + hojaRuta.chofer.nombre
533 });
534 }
535 if (hojaRuta.vehiculo.id) {
536 cabeceras.push({
537 label: 'Tractor:',
538 valor: hojaRuta.vehiculo.tractor
539 });
540 cabeceras.push({
541 label: 'Semi:',
542 valor: hojaRuta.vehiculo.semi
543 });
544 cabeceras.push({
545 label: 'Capacidad:',
546 valor: hojaRuta.vehiculo.capacidad
547 });
548 }
549 if (hojaRuta.tarifario.costo) {
550 cabeceras.push({
551 label: 'Tarifario:',
552 valor: hojaRuta.tarifario.costo
553 });
554 }
555
556 addArrayCabecera(cabeceras);
557 $scope.hojaRuta = hojaRuta;
558 }
559
560 function getLSHojaRuta() {
561 var hojaRuta = JSON.parse($localStorage.hojaRuta || null);
562 if (hojaRuta) {
563 setearHojaRuta(hojaRuta);
564 delete $localStorage.hojaRuta;
565 }
566 }
567 function addArrayCabecera(array) {
568 for(var i = 0; i < array.length; i++) {
569 $scope.$broadcast('addCabecera', {
1 angular.module('focaCrearHojaRuta') 1 angular.module('focaCrearHojaRuta')
2 .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT',
3 function($http, API_ENDPOINT) {
3 var route = API_ENDPOINT.URL; 4 var route = API_ENDPOINT.URL;
4 return { 5 return {
5 crearHojaRuta: function(hojaRuta) { 6 crearHojaRuta: function(hojaRuta) {
6 return $http.post(route + '/hoja-ruta', hojaRuta); 7 return $http.post(route + '/hoja-ruta', hojaRuta);
7 }, 8 },
8 obtenerHojaRuta: function() { 9 obtenerHojaRuta: function() {
9 return $http.get(route +'/hoja-ruta'); 10 return $http.get(route +'/hoja-ruta');
10 }, 11 },
11 setHojaRuta: function(hojaRuta) { 12 setHojaRuta: function(hojaRuta) {
12 this.hojaRuta = hojaRuta; 13 this.hojaRuta = hojaRuta;
13 }, 14 },
14 clearHojaRuta: function() { 15 clearHojaRuta: function() {
15 this.hojaRuta = undefined; 16 this.hojaRuta = undefined;
16 }, 17 },
17 getHojaRuta: function() { 18 getHojaRuta: function() {
18 return this.hojaRuta; 19 return this.hojaRuta;
19 }, 20 },
20 getArticulosByIdHojaRuta: function(id) { 21 getArticulosByIdHojaRuta: function(id) {
21 return $http.get(route+'/articulos/hoja-ruta/'+id); 22 return $http.get(route+'/articulos/hoja-ruta/'+id);
22 }, 23 },
23 crearArticulosParaHojaRuta: function(articuloHojaRuta) { 24 crearArticulosParaHojaRuta: function(articuloHojaRuta) {
24 return $http.post(route + '/articulos/hoja-ruta', 25 return $http.post(route + '/articulos/hoja-ruta',
25 {articuloHojaRuta: articuloHojaRuta}); 26 {articuloHojaRuta: articuloHojaRuta});
26 }, 27 },
27 getDomiciliosByIdHojaRuta: function(id) { 28 getDomiciliosByIdHojaRuta: function(id) {
28 return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); 29 return $http.get(route +'/hoja-ruta/' + id + '/domicilios');
29 }, 30 },
30 getDomiciliosByIdCliente: function(id) { 31 getDomiciliosByIdCliente: function(id) {
31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) 32 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega)
32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); 33 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id );
33 }, 34 },
34 getPrecioCondicion: function() { 35 getPrecioCondicion: function() {
35 return $http.get(route + '/precio-condicion'); 36 return $http.get(route + '/precio-condicion');
36 }, 37 },
37 getPrecioCondicionById: function(id) { 38 getPrecioCondicionById: function(id) {
38 return $http.get(route + '/precio-condicion/' + id); 39 return $http.get(route + '/precio-condicion/' + id);
39 }, 40 },
40 getPlazoPagoByPrecioCondicion: function(id) { 41 getPlazoPagoByPrecioCondicion: function(id) {
41 return $http.get(route + '/plazo-pago/precio-condicion/' + id); 42 return $http.get(route + '/plazo-pago/precio-condicion/' + id);
42 }, 43 },
43 crearFlete: function(flete) { 44 crearFlete: function(flete) {
44 return $http.post(route + '/flete', {flete : flete}); 45 return $http.post(route + '/flete', {flete : flete});
45 }, 46 },
46 crearPlazosParaHojaRuta: function(plazos) { 47 crearPlazosParaHojaRuta: function(plazos) {
47 return $http.post(route + '/plazo-pago/hoja-ruta', plazos); 48 return $http.post(route + '/plazo-pago/hoja-ruta', plazos);
48 }, 49 },
49 getCotizacionByIdMoneda: function(id) { 50 getCotizacionByIdMoneda: function(id) {
50 return $http.get(route + '/moneda/' + id); 51 return $http.get(route + '/moneda/' + id);
51 }, 52 },
52 crearEstadoParaHojaRuta: function(estado) { 53 crearEstadoParaHojaRuta: function(estado) {
53 return $http.post(route + '/estado', {estado: estado}); 54 return $http.post(route + '/estado', {estado: estado});
54 }, 55 },
55 getNumeroHojaRuta: function() { 56 getNumeroHojaRuta: function() {
56 return $http.get(route + '/hoja-ruta/numero-siguiente'); 57 return $http.get(route + '/hoja-ruta/numero-siguiente');
57 }, 58 },
58 getRemitosByIdVehiculo: function(idVehiculo, fechaReparto, sinConfirmar) { 59 getRemitosByIdVehiculo: function(idVehiculo, fechaReparto, sinConfirmar) {
59 var noCofirmados = sinConfirmar ? '/sinConfirmar' : ''; 60 var noCofirmados = sinConfirmar ? '/sinConfirmar' : '';
60 return $http.get(route + '/vehiculo/obtener/remitos/' + 61 return $http.get(route + '/vehiculo/obtener/remitos/' +
61 idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10) + noCofirmados); 62 idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10) + noCofirmados);
62 }, 63 },
63 desasociarRemitos: function(idsRemitos, idVehiculo, sinRemitos) { 64 desasociarRemitos: function(idsRemitos, idVehiculo, sinRemitos) {
64 return $http.post(route + '/vehiculo/desasociar-remitos', 65 return $http.post(route + '/vehiculo/desasociar-remitos',
65 { 66 {
66 idsRemitos: idsRemitos, 67 idsRemitos: idsRemitos,
67 idVehiculo: idVehiculo, 68 idVehiculo: idVehiculo,
68 vehiculoSinRemitos: sinRemitos 69 vehiculoSinRemitos: sinRemitos
69 }); 70 });
70 }, 71 },
71 getBotonera: function() { 72 getBotonera: function() {
72 return [ 73 return [
73 { 74 {
74 label: 'Fecha Entrega', 75 label: 'Fecha Entrega',
75 image: 'fechaDeReparto.png' 76 image: 'fechaDeReparto.png'
76 }, 77 },
77 { 78 {
78 label: 'Transportista', 79 label: 'Transportista',
79 image: 'transportista.png' 80 image: 'transportista.png'
80 }, 81 },
81 { 82 {
82 label: 'Chofer', 83 label: 'Chofer',
83 image: 'chofer.png' 84 image: 'chofer.png'
84 }, 85 },
85 { 86 {
86 label: 'Vehiculo', 87 label: 'Vehiculo',
87 image: 'vehiculos.png' 88 image: 'vehiculos.png'
88 }, 89 },
89 { 90 {
90 label: 'Tarifario', 91 label: 'Tarifario',
91 image: 'tarifario.png' 92 image: 'tarifario.png'
92 }, 93 },
93 { 94 {
94 label: 'Remitos', 95 label: 'Remitos',
95 image: 'remito.png' 96 image: 'remito.png'
96 }, 97 },
97 { 98 {
98 label: 'Vehiculos precargados', 99 label: 'Vehiculos precargados',
99 image: 'vehiculos.png' 100 image: 'vehiculos.png'
100 }, 101 },
101 { 102 {
102 label: 'Datos extra', 103 label: 'Datos extra',
103 image: 'tarifario.png' 104 image: 'tarifario.png'
104 } 105 }
105 ]; 106 ];
106 } 107 }
107 }; 108 };
108 }]); 109 }]);
109 110
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="4" 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 hojaRuta.remitosTabla"
49 class="d-flex" 49 class="d-flex"
50 ng-show="show || key == remitosTabla.length - 1" 50 ng-show="show || key == hojaRuta.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="desasociarRemito(key, remito.id)" 62 ng-click="desasociarRemito(key, remito.id)"
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="hojaRuta.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 </div> 84 </div>
85 </div> 85 </div>
86 </div> 86 </div>
87 </div> 87 </div>
88 88