Commit 5100750a0d3efff21c17f37a9fddece1a11793fd

Authored by Eric Fernandez
Exists in master and in 2 other branches develop, lab

Merge branch 'develop' into 'master'

Develop

See merge request !59
src/js/businessService.js
1 1 angular.module('focaCrearHojaRuta')
2 2 .factory('hojaRutaBusinessService', [
3   - 'crearHojaRutaService',
  3 + 'focaCrearHojaRutaService',
4 4 function(crearHojaRutaService) {
5 5 return {
6   - addArticulos: function(articulosHojaRuta, idHojaRuta, cotizacion) {
  6 + addArticulos: function(articulosHojaRuta, idRemito, cotizacion) {
7 7 for(var i = 0; i < articulosHojaRuta.length; i++) {
8 8 delete articulosHojaRuta[i].editCantidad;
9 9 delete articulosHojaRuta[i].editPrecio;
10   - articulosHojaRuta[i].idHojaRuta = idHojaRuta;
  10 + delete articulosHojaRuta[i].sectorCodigo;
  11 + articulosHojaRuta[i].idRemito = idRemito;
11 12 articulosHojaRuta[i].precio = articulosHojaRuta[i].precio * cotizacion;
12 13 crearHojaRutaService.crearArticulosParaHojaRuta(articulosHojaRuta[i]);
13 14 }
... ... @@ -22,6 +23,6 @@ angular.module(&#39;focaCrearHojaRuta&#39;)
22 23 idVendedor: idVendedor
23 24 };
24 25 crearHojaRutaService.crearEstadoParaHojaRuta(estado);
25   - }
  26 + },
26 27 };
27 28 }]);
src/js/controller.js
1   -angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
  1 +angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl',
2 2 [
3 3 '$scope',
4 4 '$uibModal',
... ... @@ -10,48 +10,55 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
10 10 'focaBotoneraLateralService',
11 11 'focaLoginService',
12 12 '$localStorage',
13   - function($scope, $uibModal, $location, $filter, $timeout,
  13 + 'hojaRutaBusinessService',
  14 + '$cookies',
  15 + function ($scope, $uibModal, $location, $filter, $timeout,
14 16 focaCrearHojaRutaService, focaModalService, focaBotoneraLateralService,
15   - focaLoginSrv, $localStorage)
16   - {
  17 + focaLoginSrv, $localStorage, hojaRutaBusinessService, $cookies) {
17 18 config();
18 19  
19 20 function config() {
20   - $scope.botonera = focaCrearHojaRutaService.getBotonera();
  21 +
  22 + $scope.botoneraPrincipal = focaCrearHojaRutaService.getBotones();
  23 + $scope.botonera = [];
21 24 $scope.datepickerAbierto = false;
22 25 $scope.show = false;
  26 + $scope.cisternaCargas = [];
23 27 $scope.cargando = true;
  28 + $scope.articulos = [];
  29 + $scope.remito = {
  30 + id: '',
  31 + numeroRemito: ''
  32 + };
24 33 $scope.now = new Date();
25 34 $scope.puntoVenta = $filter('rellenarDigitos')(0, 4);
26 35 $scope.comprobante = $filter('rellenarDigitos')(0, 8);
27 36  
28 37 //SETEO BOTONERA LATERAL
29   - $timeout(function() {
  38 + $timeout(function () {
30 39 focaBotoneraLateralService.showSalir(false);
31 40 focaBotoneraLateralService.showPausar(true);
32 41 focaBotoneraLateralService.showGuardar(true, $scope.crearHojaRuta);
33 42 focaBotoneraLateralService.addCustomButton('Salir', salir);
34 43 });
35 44  
36   - focaCrearHojaRutaService.getParametros().then(function(res) {
  45 + focaCrearHojaRutaService.getParametros().then(function (res) {
37 46  
38 47 var parametros = JSON.parse(res.data[0].jsonText);
39 48  
40 49 if ($localStorage.hojaRuta) {
41   - $timeout(function() {getLSHojaRuta();});
  50 + $timeout(function () { getLSHojaRuta(); });
42 51 } else {
43   -
44   - for(var property in parametros) {
  52 + for (var property in parametros) {
45 53 $scope.hojaRuta[property] = parametros[property];
46 54 $scope.inicial[property] = parametros[property];
47 55 }
48   -
49   - setearHojaRuta($scope.hojaRuta);
  56 + //Setear Hoja de Ruta
  57 + //setearHojaRuta($scope.hojaRuta);
50 58 }
51 59 });
52 60 init();
53 61 }
54   -
55 62 function init() {
56 63 $scope.$broadcast('cleanCabecera');
57 64  
... ... @@ -68,11 +75,11 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
68 75 $scope.idLista = undefined;
69 76  
70 77 focaCrearHojaRutaService.getNumeroHojaRuta().then(
71   - function(res) {
  78 + function (res) {
72 79 $scope.puntoVenta = $filter('rellenarDigitos')(res.data.sucursal, 4);
73 80 $scope.comprobante = $filter('rellenarDigitos')(res.data.numeroHojaRuta, 8);
74 81 },
75   - function(err) {
  82 + function (err) {
76 83 focaModalService.alert('La terminal no esta configurada correctamente');
77 84 console.info(err);
78 85 }
... ... @@ -81,49 +88,496 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
81 88 $scope.inicial = angular.copy($scope.hojaRuta);
82 89 }
83 90  
84   - $scope.$watch('hojaRuta', function(newValue) {
85   -
86   - // Seteo checked en remitos
87   - if ($scope.hojaRuta.remitosTabla.length) {
  91 + // $scope.$watch('hojaRuta', function(newValue) {
  92 +
  93 + // // Seteo checked en remitos
  94 + // if ($scope.hojaRuta.remitosTabla.length) {
  95 + // $filter('filter')($scope.botonera, {
  96 + // label: 'Remitos',
  97 + // })[0].checked = true;
  98 + // } else {
  99 + // $filter('filter')($scope.botonera, {
  100 + // label: 'Remitos',
  101 + // })[0].checked = false;
  102 + // }
  103 +
  104 + // focaBotoneraLateralService.setPausarData({
  105 + // label: 'hojaRuta',
  106 + // val: newValue
  107 + // });
  108 + // }, true);
  109 +
  110 + $scope.seleccionarRemitoAbierto = function () {
  111 + $scope.remitoAbierto = true;
  112 + $scope.cargaRemito = false;
  113 + $scope.precargado = false;
  114 +
  115 + var isBotoneraDirty = $scope.botonera.find(function (boton) {
  116 + return boton.checked;
  117 + });
88 118  
89   - $filter('filter')($scope.botonera, {
90   - label: 'Remitos',
  119 + config();
  120 +
  121 + if (isBotoneraDirty) {
  122 + $scope.$broadcast('cleanCabecera');
  123 + focaModalService.confirm('Se perderan los cambios')
  124 + .then(function () {
  125 + limpiarBotonera($scope.botonera);
  126 + limpiarBotonera($scope.botoneraPrincipal);
  127 + $filter('filter')($scope.botoneraPrincipal, {
  128 + label: 'Remito Abierto',
  129 + })[0].checked = true;
  130 + $scope.botonera = focaCrearHojaRutaService.getBotonFecha();
  131 +
  132 + });
  133 + } else {
  134 + $scope.$broadcast('cleanCabecera');
  135 + limpiarBotonera($scope.botoneraPrincipal);
  136 + $filter('filter')($scope.botoneraPrincipal, {
  137 + label: 'Remito Abierto',
91 138 })[0].checked = true;
  139 + $scope.botonera = focaCrearHojaRutaService.getBotonFecha();
  140 +
  141 + }
  142 +
  143 + $scope.botonera = focaCrearHojaRutaService.getRemitoAbierto();
  144 + };
  145 +
  146 + $scope.seleccionarCargarRemitos = function () {
  147 + $scope.cargaRemito = true;
  148 + $scope.remitoAbierto = false;
  149 + $scope.precargado = false;
  150 +
  151 + var isBotoneraDirty = $scope.botonera.find(function (boton) {
  152 + return boton.checked;
  153 + });
  154 +
  155 + config();
  156 +
  157 + if (isBotoneraDirty) {
  158 + $scope.$broadcast('cleanCabecera');
  159 + focaModalService.confirm('Se perderan los cambios')
  160 + .then(function () {
  161 + limpiarBotonera($scope.botonera);
  162 + limpiarBotonera($scope.botoneraPrincipal);
  163 + $scope.preCargados = false;
  164 + $filter('filter')($scope.botoneraPrincipal, {
  165 + label: 'Cargar Remitos',
  166 + })[0].checked = true;
  167 + $scope.botonera = focaCrearHojaRutaService.getBotonFecha();
  168 + });
92 169 } else {
93   - $filter('filter')($scope.botonera, {
94   - label: 'Remitos',
95   - })[0].checked = false;
  170 + $scope.$broadcast('cleanCabecera');
  171 + limpiarBotonera($scope.botoneraPrincipal);
  172 + $filter('filter')($scope.botoneraPrincipal, {
  173 + label: 'Cargar Remitos',
  174 + })[0].checked = true;
  175 + $scope.botonera = focaCrearHojaRutaService.getBotonFecha();
96 176 }
  177 + $scope.precargado = false;
  178 + };
97 179  
98   - focaBotoneraLateralService.setPausarData({
99   - label: 'hojaRuta',
100   - val: newValue
  180 + $scope.seleccionarPrecargados = function () {
  181 + $scope.precargado = true;
  182 + $scope.cargaRemito = false;
  183 + $scope.remitoAbierto = false;
  184 + var isBotoneraDirty = $scope.botonera.find(function (boton) {
  185 + return boton.checked;
101 186 });
102   - }, true);
103 187  
104   - $scope.crearHojaRuta = function() {
105   - if (!$scope.hojaRuta.remitosTabla.length) {
106   - focaModalService.alert('Ingrese Remitos');
107   - return;
  188 + config();
  189 +
  190 + if (isBotoneraDirty) {
  191 + focaModalService.confirm('Se perderan los cambios')
  192 + .then(function () {
  193 + $scope.$broadcast('cleanCabecera');
  194 + limpiarBotonera($scope.botonera);
  195 + limpiarBotonera($scope.botoneraPrincipal);
  196 + $filter('filter')($scope.botoneraPrincipal, {
  197 + label: 'Precargado',
  198 + })[0].checked = true;
  199 + $scope.botonera = focaCrearHojaRutaService.getBotonFecha();
  200 + });
  201 + } else {
  202 + $scope.$broadcast('cleanCabecera');
  203 + limpiarBotonera($scope.botoneraPrincipal);
  204 + $filter('filter')($scope.botoneraPrincipal, {
  205 + label: 'Precargado',
  206 + })[0].checked = true;
  207 + $scope.botonera = focaCrearHojaRutaService.getBotonFecha();
108 208 }
109   - if (!$scope.hojaRuta.chofer.id) {
110   - focaModalService.alert('Ingrese Chofer');
111   - return;
  209 + };
  210 +
  211 + $scope.quitarArticulo = function (key ,articulo) {
  212 + $scope.articulos.splice(key, 1);
  213 + };
  214 +
  215 + function validarHojaRuta() {
  216 + if ($scope.precargado) {
  217 + if (!$scope.hojaRuta.chofer.id) {
  218 + focaModalService.alert('Ingrese Chofer');
  219 + return false;
  220 + }
  221 + if (!$scope.hojaRuta.vehiculo.id) {
  222 + focaModalService.alert('Ingrese Vehiculo');
  223 + return false;
  224 + }
  225 + if (!$scope.hojaRuta.transportista.COD) {
  226 + focaModalService.alert('Ingrese Transportista');
  227 + return false;
  228 + }
  229 + if (!$scope.hojaRuta.datosExtra) {
  230 + focaModalService.alert('Ingrese Datos extra');
  231 + return false;
  232 + }
  233 + } else if ($scope.cargaRemito) {
  234 + if (!$scope.hojaRuta.remitosTabla.length) {
  235 + focaModalService.alert('Ingrese Remitos');
  236 + return false;
  237 + } else if (!$scope.hojaRuta.chofer.id) {
  238 + focaModalService.alert('Ingrese Chofer');
  239 + return false;
  240 + }
  241 + if (!$scope.hojaRuta.vehiculo.id) {
  242 + focaModalService.alert('Ingrese Vehiculo');
  243 + return false;
  244 + }
  245 + if (!$scope.hojaRuta.transportista.COD) {
  246 + focaModalService.alert('Ingrese Transportista');
  247 + return false;
  248 + }
  249 + if (!$scope.hojaRuta.datosExtra) {
  250 + focaModalService.alert('Ingrese Datos extra');
  251 + return false;
  252 + }
  253 + } else if ($scope.remitoAbierto) {
  254 + if (!$scope.hojaRuta.transportista.COD) {
  255 + focaModalService.alert('Ingrese Transportista');
  256 + return false;
  257 + } else if (!$scope.hojaRuta.vehiculo.id) {
  258 + focaModalService.alert('Ingrese Vehiculo');
  259 + return false;
  260 + } else if (!$scope.hojaRuta.chofer.id) {
  261 + focaModalService.alert('Ingrese Chofer');
  262 + return false;
  263 + } else if (!$scope.hojaRuta.proveedor.COD) {
  264 + focaModalService.alert('Ingrese Proveedor');
  265 + return false;
  266 + } else if (!$scope.hojaRuta.cliente.COD) {
  267 + focaModalService.alert('Ingrese un Cliente');
  268 + return;
  269 + }
112 270 }
113   - if (!$scope.hojaRuta.vehiculo.id) {
114   - focaModalService.alert('Ingrese Vehiculo');
  271 + return true;
  272 +
  273 + }
  274 +
  275 + function getImporte(propiedad) {
  276 + var importe = 0;
  277 +
  278 + $scope.articulos.forEach(function (articulo) {
  279 +
  280 + if (articulo[propiedad]) {
  281 + importe += articulo[propiedad] * articulo.cantidad;
  282 + }
115 283 return;
  284 +
  285 + });
  286 +
  287 + return importe;
  288 + }
  289 +
  290 + function guardarRemitoAbierto() {
  291 + //guardar nuevo objeto (?)
  292 + var date = new Date();
  293 + if ($scope.hojaRuta !== null) {
  294 + focaBotoneraLateralService.startGuardar();
  295 + var save = {
  296 + remito: {
  297 + id: 0,
  298 + fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '),
  299 + idCliente: $scope.hojaRuta.cliente.COD,
  300 + nombreCliente: $scope.hojaRuta.cliente.NOM,
  301 + cuitCliente: $scope.hojaRuta.cliente.CUIT,
  302 + idVendedor: $cookies.get('vendedorCobrador'),
  303 + idProveedor: $scope.hojaRuta.proveedor.COD,
  304 + idDomicilio: $scope.hojaRuta.idDomicilio || $scope.hojaRuta.domicilio.id,
  305 + idCotizacion: $scope.hojaRuta.cotizacion.ID,
  306 + domicilioStamp: $scope.hojaRuta.domicilioStamp,
  307 + observaciones: $scope.hojaRuta.observaciones,
  308 + idListaPrecio: $scope.hojaRuta.cliente.MOD.trim(),
  309 + total: getImporte('total') || 0,
  310 + descuento: 0,//TODO,
  311 + importeNeto: getImporte('netoUnitario') || 0, //TODO: arreglar,
  312 + importeExento: getImporte('exentoUnitario'),
  313 + importeIva: getImporte('ivaUnitario') || 0, //TODO: arreglar
  314 + importeIvaServicios: 0,//TODO
  315 + importeImpuestoInterno: getImporte('impuestoInternoUnitario'),
  316 + importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'),
  317 + importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'),
  318 + percepcion: 0,//TODO
  319 + percepcionIva: 0,//TODO
  320 + redondeo: 0,//TODO
  321 + anulado: false,
  322 + planilla: $filter('date')($scope.now, 'ddMMyyyy'),
  323 + lugar: parseInt($scope.puntoVenta),
  324 + cuentaMadre: 0,//TODO
  325 + cuentaContable: 0,//TODO
  326 + asiento: 0,//TODO
  327 + e_hd: '',//TODO
  328 + c_hd: '',
  329 + numeroLiquidoProducto: 0,//TODO
  330 + estado: 0,
  331 + destinoVenta: 0,//TODO
  332 + operacionTipo: 0, //TODO
  333 + },
  334 + notaPedido: {
  335 + id: 0
  336 + }
  337 + };
  338 + focaCrearHojaRutaService.crearRemito(save).then(
  339 + function (data) {
  340 + focaBotoneraLateralService.endGuardar(true);
  341 + $scope.saveLoading = false;
  342 +
  343 + $scope.remito.id = data.data.id;
  344 +
  345 + focaCrearHojaRutaService.guardarCisternas({
  346 + cisternaCargas: $scope.cisternaCargas,
  347 + cisternaMovimientos: $scope.cisternaMovimientos,
  348 + fechaReparto: $scope.hojaRuta.fechaReparto,
  349 + idVehiculo: $scope.hojaRuta.vehiculo.id
  350 + }, data.data.id);
  351 + $scope.remito.numeroRemito = data.data.numero;
  352 +
  353 + // if ($scope.remito.remitoPuntoDescarga.length > 0) {
  354 + // remitoBusinessService.addPuntosDescarga(data.data.id,
  355 + // $scope.remito.remitoPuntoDescarga);
  356 + // }
  357 +
  358 + hojaRutaBusinessService.addArticulos($scope.articulosRecibidos,
  359 + data.data.id, $scope.hojaRuta.cotizacion.VENDEDOR);
  360 +
  361 + guardarHojaRuta(data.data.id);
  362 +
  363 + }, function (error) {
  364 + focaModalService.alert(error.data || 'Hubo un error al crear el remito');
  365 + focaBotoneraLateralService.endGuardar();
  366 + $scope.saveLoading = false;
  367 + console.info(error);
  368 + }
  369 + );
  370 +
  371 + function guardarHojaRuta(idRemito) {
  372 +
  373 + var save2 = {
  374 + hojaRuta: {
  375 + id: 0,
  376 + fechaCreacion: new Date(date.getTime()).toISOString().slice(0, 19)
  377 + .replace('T', ' '),
  378 + idTransportista: $scope.hojaRuta.transportista.COD,
  379 + idChofer: $scope.hojaRuta.chofer.id,
  380 + idVehiculo: $scope.hojaRuta.vehiculo.id,
  381 + proveedor: $scope.hojaRuta.proveedor.id,
  382 + fechaReparto:
  383 + new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10),
  384 + estado: 0,
  385 + abierta: 1
  386 + },
  387 + remitos: [{id: idRemito}]
  388 + }
  389 + save2.hojaRuta = angular.extend({}, save2.hojaRuta, $scope.hojaRuta.datosExtra);
  390 + focaCrearHojaRutaService.crearHojaRuta(save2).then(
  391 + function (data) {
  392 + var remitoNumero;
  393 + data.data.remitos.forEach(function(idRemitos) {
  394 + remitoNumero = idRemitos;
  395 + });
  396 + focaModalService.alert(
  397 + 'Hoja ruta creada Nยบ: ' +
  398 + $filter('rellenarDigitos')(data.data.sucursal, 4) + '-' +
  399 + $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) +
  400 + '\nRemito Abierto Nยบ: ' +
  401 + $filter('rellenarDigitos')(remitoNumero.sucursal, 4) + '-' +
  402 + $filter('rellenarDigitos')(remitoNumero.numeroRemito,8)
  403 + );
  404 +
  405 + config();
  406 + },
  407 + function (error) {
  408 + focaModalService.alert('Hubo un error al crear la hoja de ruta');
  409 + console.info(error);
  410 + }
  411 + );
  412 + }
116 413 }
117   - if (!$scope.hojaRuta.transportista.COD) {
118   - focaModalService.alert('Ingrese Transportista');
  414 + }
  415 +
  416 + $scope.seleccionarCliente = function () {
  417 + var modalInstance = $uibModal.open(
  418 + {
  419 + ariaLabelledBy: 'Busqueda de Cliente',
  420 + templateUrl: 'foca-busqueda-cliente-modal.html',
  421 + controller: 'focaBusquedaClienteModalController',
  422 + resolve: {
  423 + vendedor: function () { return null; },
  424 + cobrador: function () { return null; }
  425 + },
  426 + size: 'lg'
  427 + }
  428 + );
  429 + modalInstance.result.then(
  430 + function (cliente) {
  431 + $scope.abrirModalDomicilios(cliente);
  432 + $scope.cliente = cliente;
  433 + }, function () {
  434 + }
  435 + );
  436 + };
  437 +
  438 + $scope.abrirModalDomicilios = function (cliente) {
  439 + var modalInstanceDomicilio = $uibModal.open(
  440 + {
  441 + ariaLabelledBy: 'Busqueda de Domicilios',
  442 + templateUrl: 'modal-domicilio.html',
  443 + controller: 'focaModalDomicilioController',
  444 + size: 'lg',
  445 + resolve: {
  446 + idCliente: function () { return cliente.cod; },
  447 + esNuevo: function () { return cliente.esNuevo; }
  448 + }
  449 + }
  450 + );
  451 + modalInstanceDomicilio.result.then(
  452 + function (domicilio) {
  453 + $scope.hojaRuta.domicilio = domicilio;
  454 + $scope.hojaRuta.cliente = {
  455 + COD: cliente.cod,
  456 + CUIT: cliente.cuit,
  457 + NOM: cliente.nom,
  458 + MAIL: cliente.mail,
  459 + MOD: cliente.mod,
  460 + IVA: cliente.iva,
  461 + VEN: cliente.ven
  462 + };
  463 + focaCrearHojaRutaService.getVendedorById($scope.hojaRuta.cliente.VEN)
  464 + .then(function (res) {
  465 + if (res.data !== '') {
  466 + $scope.hojaRuta.vendedor = res.data;
  467 + $scope.$broadcast('addCabecera', {
  468 + label: 'Vendedor:',
  469 + valor: $filter('rellenarDigitos')($scope.hojaRuta.vendedor
  470 + .NUM, 3) +' - ' + $scope.hojaRuta.vendedor.NOM
  471 + });
  472 + }
  473 + var domicilioStamp =
  474 + domicilio.Calle + ' ' + domicilio.Numero + ', ' +
  475 + domicilio.Localidad + ', ' + domicilio.Provincia;
  476 + $scope.hojaRuta.domicilioStamp = domicilioStamp;
  477 + $scope.$broadcast('addCabecera', {
  478 + label: 'Cliente:',
  479 + valor: $filter('rellenarDigitos')(cliente.cod, 3) +
  480 + ' - ' + cliente.nom
  481 + });
  482 + $scope.$broadcast('addCabecera', {
  483 + label: 'Domicilio:',
  484 + valor: domicilioStamp
  485 + });
  486 +
  487 + if (domicilio.verPuntos) {
  488 + delete $scope.hojaRuta.domicilio.verPuntos;
  489 + $scope.seleccionarPuntosDeDescarga();
  490 + } else {
  491 + focaCrearHojaRutaService
  492 + .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
  493 + .then(function (res) {
  494 + if (res.data.length) {
  495 + $scope.seleccionarPuntosDeDescarga();
  496 + }
  497 + });
  498 + }
  499 +
  500 + $filter('filter')($scope.botonera, {
  501 + label: 'Cliente',
  502 + })[0].checked = true;
  503 + })
  504 + .catch(function (e) { console.log(e); });
  505 + }, function () {
  506 + $scope.seleccionarCliente(true);
  507 + return;
  508 + }
  509 + );
  510 + };
  511 +
  512 + $scope.seleccionarPuntosDeDescarga = function () {
  513 + if (!$scope.hojaRuta.cliente.COD || !$scope.hojaRuta.domicilio.id) {
  514 + focaModalService.alert('Primero seleccione un cliente y un domicilio');
119 515 return;
  516 + } else {
  517 + var modalInstance = $uibModal.open(
  518 + {
  519 + ariaLabelledBy: 'Bรบsqueda de Puntos de descarga',
  520 + templateUrl: 'modal-punto-descarga.html',
  521 + controller: 'focaModalPuntoDescargaController',
  522 + size: 'lg',
  523 + resolve: {
  524 + filters: {
  525 + idDomicilio: $scope.remito.domicilio.id,
  526 + idCliente: $scope.remito.cliente.COD,
  527 + articulos: $scope.remito.articulosRemito,
  528 + puntosDescarga: $scope.remito.remitoPuntoDescarga,
  529 + domicilio: $scope.remito.domicilio
  530 + }
  531 + }
  532 + }
  533 + );
  534 + modalInstance.result.then(
  535 + function(puntosDescarga) {
  536 +
  537 + puntosDescarga.forEach(function(punto) {
  538 + $scope.hojaRuta.remitoPuntoDescarga.push(
  539 + {
  540 + puntoDescarga: punto
  541 + }
  542 + );
  543 + });
  544 +
  545 + $scope.$broadcast('addCabecera', {
  546 + label: 'Puntos de descarga:',
  547 + valor: getCabeceraPuntoDescarga(puntosDescarga)
  548 + });
  549 + }, function () {
  550 + $scope.abrirModalDomicilios($scope.cliente);
  551 + }
  552 + );
120 553 }
121   - if (!$scope.hojaRuta.tarifario) {
122   - focaModalService.alert('Ingrese Tarifario');
  554 + };
  555 +
  556 + $scope.seleccionarDetalleDeCarga = function () {
  557 + if ($scope.hojaRuta.vehiculo.capacidad === 0) {
  558 + focaModalService.alert('Debe ingresar vehiculo');
123 559 return;
  560 + } else {
  561 + $scope.mostrarDetalle($scope.hojaRuta);
124 562 }
125   - if (!$scope.hojaRuta.datosExtra) {
126   - focaModalService.alert('Ingrese Datos extra');
  563 + };
  564 +
  565 + function getCabeceraPuntoDescarga(puntosDescarga) {
  566 + var puntosStamp = '';
  567 + puntosDescarga.forEach(function (punto, idx, arr) {
  568 + puntosStamp += punto.descripcion;
  569 + if ((idx + 1) !== arr.length) puntosStamp += ', ';
  570 + });
  571 + return puntosStamp;
  572 + }
  573 +
  574 + $scope.crearHojaRuta = function () {
  575 +
  576 + var continuar = validarHojaRuta();
  577 + if (!continuar) {
  578 + return;
  579 + } else if ($scope.remitoAbierto) {
  580 + guardarRemitoAbierto();
127 581 return;
128 582 }
129 583 var date = new Date();
... ... @@ -142,9 +596,10 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
142 596 },
143 597 remitos: $scope.hojaRuta.remitosTabla
144 598 };
  599 +
145 600 save.hojaRuta = angular.extend({}, save.hojaRuta, $scope.hojaRuta.datosExtra);
146 601 focaCrearHojaRutaService.crearHojaRuta(save).then(
147   - function(data) {
  602 + function (data) {
148 603 focaModalService.alert(
149 604 'Hoja ruta creada Nยบ: ' +
150 605 $filter('rellenarDigitos')(data.data.sucursal, 4) + '-' +
... ... @@ -153,14 +608,54 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
153 608  
154 609 config();
155 610 },
156   - function(error) {
  611 + function (error) {
157 612 focaModalService.alert('Hubo un error al crear la hoja de ruta');
158 613 console.info(error);
159 614 }
160 615 );
161 616 };
162 617  
163   - $scope.seleccionarTransportista = function() {
  618 + $scope.seleccionarProveedor = function () {
  619 + var parametrosModal = {
  620 + titulo: 'Bรบsqueda de Proveedor',
  621 + query: '/proveedor',
  622 + columnas: [
  623 + {
  624 + nombre: 'Cรณdigo',
  625 + propiedad: 'COD',
  626 + filtro: {
  627 + nombre: 'rellenarDigitos',
  628 + parametro: 5
  629 + }
  630 + },
  631 + {
  632 + nombre: 'Nombre',
  633 + propiedad: 'NOM'
  634 + },
  635 + {
  636 + nombre: 'CUIT',
  637 + propiedad: 'CUIT'
  638 + }
  639 + ],
  640 + tipo: 'POST',
  641 + json: { razonCuitCod: '' }
  642 + };
  643 + focaModalService.modal(parametrosModal).then(
  644 + function (proveedor) {
  645 + $filter('filter')($scope.botonera, {
  646 + label: 'Proveedor',
  647 + })[0].checked = true;
  648 +
  649 + $scope.$broadcast('addCabecera', {
  650 + label: 'Proveedor:',
  651 + valor: proveedor.COD + ' - ' + proveedor.NOM
  652 + });
  653 + $scope.hojaRuta.proveedor = proveedor;
  654 + }, function () { }
  655 + );
  656 + };
  657 +
  658 + $scope.seleccionarTransportista = function () {
164 659 if (eligioPreConfirmado()) return;
165 660 var parametrosModal = {
166 661 titulo: 'Bรบsqueda de transportista',
... ... @@ -181,7 +676,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
181 676 ]
182 677 };
183 678 focaModalService.modal(parametrosModal).then(
184   - function(proveedor) {
  679 + function (proveedor) {
185 680 $scope.hojaRuta.transportista = proveedor;
186 681 $scope.$broadcast('addCabecera', {
187 682 label: 'Transportista:',
... ... @@ -192,13 +687,13 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
192 687 $filter('filter')($scope.botonera, {
193 688 label: 'Transportista',
194 689 })[0].checked = true;
195   - }, function() {
  690 + }, function () {
196 691  
197 692 }
198 693 );
199 694 };
200 695  
201   - $scope.seleccionarChofer = function() {
  696 + $scope.seleccionarChofer = function () {
202 697 var parametrosModal = {
203 698 titulo: 'Bรบsqueda de Chofer',
204 699 query: '/chofer',
... ... @@ -226,41 +721,41 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
226 721 ]
227 722 };
228 723 focaModalService.modal(parametrosModal).then(
229   - function(chofer) {
  724 + function (chofer) {
230 725 $scope.hojaRuta.chofer = chofer;
231 726 $scope.$broadcast('addCabecera', {
232 727 label: 'Chofer:',
233   - valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' +chofer.nombre
  728 + valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' + chofer.nombre
234 729 });
235 730  
236 731 $filter('filter')($scope.botonera, {
237 732 label: 'Chofer',
238 733 })[0].checked = true;
239   - }, function() {
  734 + }, function () {
240 735 // funcion ejecutada cuando se cancela el modal
241 736 }
242 737 );
243 738 };
244 739  
245   - $scope.seleccionarVehiculo = function() {
  740 + $scope.seleccionarVehiculo = function () {
246 741 if (!eligioFecha() || eligioPreConfirmado()) return;
247 742 modalVehiculos();
248 743 };
249 744  
250   - $scope.seleccionarTarifario = function() {
  745 + $scope.seleccionarTarifario = function () {
251 746 focaModalService
252 747 .prompt({
253 748 titulo: 'Tarifa flete',
254 749 value: $scope.hojaRuta.tarifario
255 750 })
256   - .then(function(costo) {
  751 + .then(function (costo) {
257 752 if (isNaN(costo)) {
258 753 focaModalService
259 754 .alert('Ingrese un valor vรกlido')
260   - .then(function() {
  755 + .then(function () {
261 756 $scope.seleccionarTarifario();
262 757 });
263   -
  758 +
264 759 return;
265 760 }
266 761  
... ... @@ -276,7 +771,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
276 771 });
277 772 };
278 773  
279   - $scope.seleccionarRemitos = function() {
  774 + $scope.seleccionarRemitos = function () {
280 775 if (eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return;
281 776 var modalInstance = $uibModal.open(
282 777 {
... ... @@ -284,11 +779,11 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
284 779 templateUrl: 'foca-modal-remito.html',
285 780 controller: 'focaModalRemitoController',
286 781 size: 'lg',
287   - resolve: {usadoPor: function() {return 'hojaRuta';}}
  782 + resolve: { usadoPor: function () { return 'hojaRuta'; } }
288 783 }
289 784 );
290 785 modalInstance.result.then(
291   - function(remito) {
  786 + function (remito) {
292 787 // TODO: borrar cuando no se use definitivamente
293 788 // for (var i = $scope.hojaRuta.remitosTabla.length - 1; i >= 0; i--) {
294 789 // if ($scope.hojaRuta.remitosTabla[i].id === remito.id) {
... ... @@ -321,36 +816,27 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
321 816  
322 817 // remito.litros = litros;
323 818 // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros;
324   - $scope.cargarCisterna(remito.id).then(function() {
  819 + $scope.cargarCisterna(remito.id).then(function () {
325 820 $scope.hojaRuta.remitosTabla.push(remito);
326   - }, function(error) {
327   -
328   - if (error && error !== 'backdrop click') {
329   -
330   - focaModalService
331   - .alert(error || 'Ha ocurrido un error')
332   - .then(function() {
333   - $scope.seleccionarRemitos();
334   - });
  821 + $filter('filter')($scope.botonera, {
  822 + label: 'Remitos',
  823 + })[0].checked = true;
335 824  
336   - } else {
337   -
338   - $scope.seleccionarRemitos();
339   -
340   - }
  825 + }, function (error) {
  826 + error.then($scope.seleccionarRemitos);
341 827 });
342   - }, function() {
  828 + }, function () {
343 829 // funcion ejecutada cuando se cancela el modal
344 830 }
345 831 );
346 832 };
347 833  
348   - $scope.seleccionarVehiculosPrecargados = function() {
  834 + $scope.seleccionarVehiculosPrecargados = function () {
349 835 if (!eligioFecha()) return;
350 836 modalVehiculos(true);
351 837 };
352 838  
353   - $scope.cargarCisterna = function(idRemito) {
  839 + $scope.cargarCisterna = function (idRemito) {
354 840 if (!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return;
355 841 var modalInstance = $uibModal.open(
356 842 {
... ... @@ -359,31 +845,28 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
359 845 controller: 'focaDetalleVehiculo',
360 846 size: 'lg',
361 847 resolve: {
362   - idVehiculo: function() {return $scope.hojaRuta.vehiculo.id;},
363   - idRemito: function() {return idRemito;},
364   - fechaReparto: function() {return $scope.hojaRuta.fechaReparto;}
  848 + idVehiculo: function () { return $scope.hojaRuta.vehiculo.id; },
  849 + idRemito: function () { return idRemito; },
  850 + fechaReparto: function () { return $scope.hojaRuta.fechaReparto; }
365 851 }
366 852 }
367 853 );
368 854 return modalInstance.result;
369 855 };
370 856  
371   - $scope.seleccionarFechaEntrega = function() {
  857 + $scope.seleccionarFechaEntrega = function () {
  858 +
372 859 var confirmacion = false;
373   - var hasVehiculoId = $scope.hojaRuta.vehiculo.id !== undefined;
374   - var hasTarifario = $scope.hojaRuta.tarifario !== null;
375   - var hasTransportista = Object.keys($scope.hojaRuta.transportista).length > 0;
376   - var hasChofer = Object.keys($scope.hojaRuta.chofer).length > 0;
377   - var hasDatosExtra = $scope.hojaRuta.datosExtra !== undefined;
378   -
379   - if (hasVehiculoId || hasTarifario || hasTransportista ||
380   - hasChofer || hasDatosExtra) {
  860 +
  861 + if (!angular.equals($scope.hojaRuta, $scope.inicial)) {
381 862 confirmacion = true;
382   - if (confirmacion) {
383   - focaModalService
  863 + }
  864 +
  865 + if (confirmacion) {
  866 + focaModalService
384 867 .confirm('Si cambia la fecha se perderรกn los datos actuales')
385   - .then(function(data) {
386   - if(data) {
  868 + .then(function (data) {
  869 + if (data) {
387 870 $scope.hojaRuta.vehiculo.id = undefined;
388 871 $scope.hojaRuta.tarifario = null;
389 872 $scope.hojaRuta.transportista = {};
... ... @@ -391,17 +874,16 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
391 874 $scope.hojaRuta.datosExtra = undefined;
392 875 elegirFecha();
393 876 }
394   - }, function() {
395   - return ;
  877 + }, function () {
  878 + return;
396 879 });
397   - }
398 880 } else {
399 881 elegirFecha();
400 882 }
401 883 };
402 884  
403 885 function setearFecha(fecha) {
404   - $timeout(function() {
  886 + $timeout(function () {
405 887 $scope.$broadcast('addCabecera', {
406 888 label: 'Fecha de entrega: ',
407 889 valor: fecha.toLocaleDateString()
... ... @@ -411,7 +893,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
411 893 });
412 894 }
413 895  
414   - $scope.seleccionarDatosExtra = function() {
  896 + $scope.seleccionarDatosExtra = function () {
415 897 var datosHojaRuta = $scope.hojaRuta.datosExtra;
416 898 var modalInstance = $uibModal.open(
417 899 {
... ... @@ -419,7 +901,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
419 901 controller: 'focaModalDatosHojaRutaCtrl',
420 902 size: 'lg',
421 903 resolve: {
422   - parametrosDatos: function() {
  904 + parametrosDatos: function () {
423 905 return {
424 906 datosHojaRuta: datosHojaRuta
425 907 };
... ... @@ -427,32 +909,32 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
427 909 }
428 910 }
429 911 );
430   - return modalInstance.result.then(function(datosExtra) {
  912 + return modalInstance.result.then(function (datosExtra) {
431 913  
432 914 $filter('filter')($scope.botonera, {
433 915 label: 'Datos extra',
434 916 })[0].checked = true;
435 917  
436 918 $scope.hojaRuta.datosExtra = datosExtra;
437   - }, function() {
  919 + }, function () {
438 920 //se ejecuta cuando se cancela el modal
439 921 });
440 922 };
441 923  
442   - $scope.desasociarRemito = function(key, idRemito) {
  924 + $scope.desasociarRemito = function (key, idRemito) {
443 925 var idsRemito = [idRemito];
444 926 focaModalService.confirm('ยฟEstรก seguro que desea desasociar este remito del' +
445   - ' vehรญculo?').then(function() {
  927 + ' vehรญculo?').then(function () {
446 928 focaCrearHojaRutaService.desasociarRemitos(idsRemito,
447 929 $scope.hojaRuta.vehiculo.id, $scope.hojaRuta.remitosTabla.length <= 1)
448   - .then(function() {
449   - $scope.hojaRuta.remitosTabla.splice(key, 1);
450   - focaModalService.alert('Remito desasociado con รฉxito');
451   - });
  930 + .then(function () {
  931 + $scope.hojaRuta.remitosTabla.splice(key, 1);
  932 + focaModalService.alert('Remito desasociado con รฉxito');
  933 + });
452 934 });
453 935 };
454 936  
455   - $scope.verProductosRemito = function(idRemito) {
  937 + $scope.verProductosRemito = function (idRemito) {
456 938 var parametrosModal = {
457 939 titulo: 'Articulos remito',
458 940 query: '/articulos/remito/' + idRemito,
... ... @@ -475,12 +957,40 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
475 957 focaModalService.modal(parametrosModal).then();
476 958 };
477 959  
  960 + $scope.mostrarDetalle = function (hojasRutas) {
  961 + var modalInstance =$uibModal.open(
  962 + {
  963 + ariaLabelledBy: '',
  964 + templateUrl: 'modal-detalle-carga.html',
  965 + controller: 'focaModalDetalleController',
  966 + resolve: {
  967 + hojasRutas: function () { return hojasRutas; }
  968 + },
  969 + size: 'lg',
  970 + backdrop: false
  971 + }
  972 + );
  973 + return modalInstance.result.then(function (res) {
  974 + res.cisternas.forEach( function (cisterna) {
  975 + $scope.cisternaCargas.push(cisterna.cisternaCarga);
  976 + });
  977 + $scope.cisternaMovimientos = res.movimientos;
  978 + $scope.articulosRecibidos = res.articulos;
  979 + $scope.articulos = res.articulos;
  980 + $filter('filter')($scope.botonera, {
  981 + label: 'Detalle de Carga',
  982 + })[0].checked = true;
  983 + }, function () {
  984 + //se ejecuta cuando se cancela el modal
  985 + });
  986 + };
  987 +
478 988 function elegirFecha() {
479   - var fechaEntrega = {
  989 + var fechaEntrega = {
480 990 titulo: 'Fecha de entrega',
481 991 minDate: new Date()
482 992 };
483   - focaModalService.modalFecha(fechaEntrega).then(function(fecha) {
  993 + focaModalService.modalFecha(fechaEntrega).then(function (fecha) {
484 994  
485 995 $scope.hojaRuta.fechaReparto = fecha;
486 996  
... ... @@ -488,6 +998,22 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
488 998 label: 'Fecha de entrega: ',
489 999 valor: fecha.toLocaleDateString()
490 1000 });
  1001 + //habilitar los otros botones
  1002 + var temp = [];
  1003 + if ($scope.botonera.length > 1) {
  1004 + limpiarBotonera($scope.botonera);
  1005 + } else if ($scope.precargado) {
  1006 + temp = focaCrearHojaRutaService.getBotoneraPrecargado();
  1007 + modalVehiculos(true);
  1008 + } else if ($scope.cargaRemito && $scope.precargado === false) {
  1009 + temp = focaCrearHojaRutaService.getBotoneraCargarRemito();
  1010 + } else {
  1011 + temp = focaCrearHojaRutaService.getBotoneraCargarRemito();
  1012 + modalVehiculos(true);
  1013 + }
  1014 + temp.forEach(function (e) {
  1015 + $scope.botonera.push(e);
  1016 + });
491 1017  
492 1018 $filter('filter')($scope.botonera, {
493 1019 label: 'Fecha Entrega',
... ... @@ -498,7 +1024,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
498 1024 function eligioPreConfirmado() {
499 1025 if ($scope.eligioPreConfirmado) {
500 1026 focaModalService.alert('No puede elegir si eligiรณ un vehiculo pre cargado');
501   - return true;
  1027 + return true;
502 1028 }
503 1029 return false;
504 1030 }
... ... @@ -524,7 +1050,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
524 1050 if (preCargados) {
525 1051 parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' +
526 1052 new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10);
527   - parametrosModal.titulo = 'Bรบsqueda de vehiculos pre confirmados';
  1053 + parametrosModal.titulo = 'Bรบsqueda de vehiculos precargados';
528 1054 } else {
529 1055 parametrosModal.query = '/vehiculo';
530 1056 parametrosModal.titulo = 'Bรบsqueda de vehรญculos';
... ... @@ -543,10 +1069,11 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
543 1069 nombre: 'Semi'
544 1070 }
545 1071 ];
546   - focaModalService.modal(parametrosModal).then(function(vehiculo) {
  1072 + focaModalService.modal(parametrosModal).then(function (vehiculo) {
547 1073 if (!preCargados && vehiculoEnUso(vehiculo)) return;
548 1074 $scope.hojaRuta.vehiculo = vehiculo;
549 1075 $scope.hojaRuta.transportista = vehiculo.transportista;
  1076 + // mostrarDetalle(vehiculo);
550 1077 if (preCargados) {
551 1078 $scope.eligioPreConfirmado = true;
552 1079 $scope.hojaRuta.vehiculo = vehiculo;
... ... @@ -557,10 +1084,13 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
557 1084 });
558 1085 focaCrearHojaRutaService
559 1086 .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto)
560   - .then(function(res) {
561   -
  1087 + .then(function (res) {
562 1088 $filter('filter')($scope.botonera, {
563   - label: 'Vehiculos precargados',
  1089 + label: 'Transportista',
  1090 + })[0].checked = true;
  1091 +
  1092 + $filter('filter')($scope.botonera, {
  1093 + label: 'Vehiculo',
564 1094 })[0].checked = true;
565 1095  
566 1096 $scope.hojaRuta.remitosTabla = res.data;
... ... @@ -568,7 +1098,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
568 1098 } else {
569 1099 focaCrearHojaRutaService
570 1100 .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto, true)
571   - .then(function(res) {
  1101 + .then(function (res) {
572 1102  
573 1103 $filter('filter')($scope.botonera, {
574 1104 label: 'Vehiculo',
... ... @@ -598,11 +1128,10 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
598 1128 for (var i = 0; i < vehiculo.cisternas.length; i++) {
599 1129 for (var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) {
600 1130 var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j];
601   - if (cisternaCarga.fechaReparto.substring(0, 10) ===
  1131 + if (cisternaCarga.fechaReparto.substring(0, 10) ===
602 1132 new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10) &&
603 1133 cisternaCarga.idUsuarioProceso &&
604   - cisternaCarga.idUsuarioProceso !== idUsuario)
605   - {
  1134 + cisternaCarga.idUsuarioProceso !== idUsuario) {
606 1135 focaModalService.alert('El vehรญculo estรก siendo usado por otro' +
607 1136 ' usuario');
608 1137 return true;
... ... @@ -622,7 +1151,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
622 1151 if (confirmacion) {
623 1152 focaModalService.confirm(
624 1153 'ยฟEstรก seguro de que desea salir? Se perderรกn todos los datos cargados.'
625   - ).then(function(data) {
  1154 + ).then(function (data) {
626 1155 if (data) {
627 1156 $location.path('/');
628 1157 }
... ... @@ -632,6 +1161,11 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
632 1161 }
633 1162 }
634 1163  
  1164 + function limpiarBotonera(botonera) {
  1165 + botonera.forEach(function (boton) {
  1166 + boton.checked = false;
  1167 + });
  1168 + }
635 1169 function setearHojaRuta(hojaRuta) {
636 1170 $scope.$broadcast('cleanCabecera');
637 1171  
... ... @@ -642,7 +1176,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
642 1176 valor: $filter('date')(hojaRuta.fechaReparto, 'dd/MM/yyyy')
643 1177 });
644 1178  
645   - $filter('filter')( $scope.botonera, {
  1179 + $filter('filter')($scope.botonera, {
646 1180 label: 'Fecha Entrega'
647 1181 })[0].checked = true;
648 1182 }
... ... @@ -653,7 +1187,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
653 1187 hojaRuta.transportista.NOM
654 1188 });
655 1189  
656   - $filter('filter')( $scope.botonera, {
  1190 + $filter('filter')($scope.botonera, {
657 1191 label: 'Transportista'
658 1192 })[0].checked = true;
659 1193 }
... ... @@ -664,7 +1198,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
664 1198 ' - ' + hojaRuta.chofer.nombre
665 1199 });
666 1200  
667   - $filter('filter')( $scope.botonera, {
  1201 + $filter('filter')($scope.botonera, {
668 1202 label: 'Chofer'
669 1203 })[0].checked = true;
670 1204 }
... ... @@ -682,7 +1216,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
682 1216 valor: hojaRuta.vehiculo.capacidad
683 1217 });
684 1218  
685   - $filter('filter')( $scope.botonera, {
  1219 + $filter('filter')($scope.botonera, {
686 1220 label: 'Vehiculo'
687 1221 })[0].checked = true;
688 1222 }
... ... @@ -692,7 +1226,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
692 1226 valor: hojaRuta.tarifario
693 1227 });
694 1228  
695   - $filter('filter')( $scope.botonera, {
  1229 + $filter('filter')($scope.botonera, {
696 1230 label: 'Tarifario'
697 1231 })[0].checked = true;
698 1232 }
... ... @@ -709,7 +1243,7 @@ angular.module(&#39;focaCrearHojaRuta&#39;) .controller(&#39;hojaRutaCtrl&#39;,
709 1243 }
710 1244 }
711 1245 function addArrayCabecera(array) {
712   - for(var i = 0; i < array.length; i++) {
  1246 + for (var i = 0; i < array.length; i++) {
713 1247 $scope.$broadcast('addCabecera', {
714 1248 label: array[i].label,
715 1249 valor: array[i].valor
src/js/controllerDetalles.js
... ... @@ -0,0 +1,170 @@
  1 +angular.module('focaCrearHojaRuta')
  2 + .controller('focaModalDetalleController', [
  3 + '$scope', '$timeout', '$uibModalInstance', 'focaModalService',
  4 + 'focaCrearHojaRutaService', 'hojasRutas', '$uibModal', '$filter',
  5 + function ($scope, $timeout, $uibModalInstance, focaModalService,
  6 + focaCrearHojaRutaService, hojasRutas, $uibModal, $filter) {
  7 +
  8 + $scope.mostrar = false;
  9 + $scope.articulos = [];
  10 + $scope.cisternaMovimientos = [];
  11 +
  12 + init();
  13 + function init() {
  14 + $scope.hojasRutas = hojasRutas;
  15 +
  16 + $scope.hojasRutas.vehiculo.cisternas = $scope.hojasRutas.vehiculo.cisternas.filter(
  17 + function (cisterna) {
  18 + return !cisterna.desactivado;
  19 + }
  20 + );
  21 + focaCrearHojaRutaService.getArticulos()
  22 + .then(function (articulos) {
  23 + $scope.articulos = articulos.data;
  24 + });
  25 + }
  26 +
  27 + $scope.validarCisternaDisponible = function (cisterna) {
  28 + if (parseInt(cisterna.disponible) > cisterna.capacidad) {
  29 + focaModalService.alert('No se puede ingresar una capacidad disponible ' +
  30 + 'superior a la ' + 'capacidad del vehiculo ');
  31 + cisterna.disponible = cisterna.capacidad;
  32 + return;
  33 + }
  34 + };
  35 +
  36 + $scope.seleccionarProductos = function (key, cisterna) {
  37 + focaModalService.modal({
  38 + titulo: 'Productos',
  39 + data: $scope.articulos,
  40 + size: 'md',
  41 + columnas: [
  42 + {
  43 + propiedad: 'CodRub',
  44 + nombre: 'Codigo'
  45 + },
  46 + {
  47 + propiedad: 'descripcion',
  48 + nombre: 'Nombre'
  49 + },
  50 + ],
  51 + }).then(function (res) {
  52 + cisterna.disponible = cisterna.capacidad;
  53 + var newArt =
  54 + {
  55 + id: 0,
  56 + idRemito: 0,
  57 + codigo: res.codigo,
  58 + sector: res.sector,
  59 + sectorCodigo: res.sector + '-' + res.codigo,
  60 + descripcion: res.descripcion,
  61 + item: key + 1,
  62 + nombre: res.descripcion,
  63 + precio: parseFloat(res.precio).toFixed(4),
  64 + costoUnitario: res.costo,
  65 + editCantidad: false,
  66 + editPrecio: false,
  67 + rubro: res.CodRub,
  68 + ivaUnitario: res.IMPIVA,
  69 + impuestoInternoUnitario: res.ImpInt,
  70 + impuestoInterno1Unitario: res.ImpInt2,
  71 + impuestoInterno2Unitario: res.ImpInt3,
  72 + precioLista: res.precio,
  73 + combustible: 1,
  74 + facturado: 0,
  75 + idArticulo: res.id,
  76 + tasaIva: res.tasaIVA
  77 + };
  78 +
  79 + newArt.exentoUnitario = newArt.ivaUnitario ? 0 : res.neto;
  80 + newArt.netoUnitario = newArt.ivaUnitario ? res.neto : 0;
  81 +
  82 + cisterna.articuloSeleccionado = newArt;
  83 + cisterna.nombreArticulo = res.descripcion;
  84 + }).catch(function (e) {
  85 + console.log(e);
  86 + });
  87 + };
  88 +
  89 + $scope.guardar = function () {
  90 +
  91 + var cisternasFilter = validarArticulos();
  92 +
  93 + var articulos = [];
  94 + if (cisternasFilter === undefined) {
  95 + return;
  96 + }
  97 + cisternasFilter.forEach(function (cisterna) {
  98 +
  99 + var fechaReparto = $scope.hojasRutas.fechaReparto;
  100 +
  101 + var filtroCisternaCarga = cisterna.cisternasCarga.filter(function(carga) {
  102 + return carga.fechaReparto === fechaReparto;
  103 + });
  104 +
  105 + if (filtroCisternaCarga.length) {
  106 + cisterna.cisternaCarga = filtroCisternaCarga[0];
  107 + } else {
  108 + cisterna.cisternaCarga = {
  109 + confirmado: null,
  110 + fechaReparto: fechaReparto,
  111 + idCisterna: cisterna.id,
  112 + };
  113 + }
  114 +
  115 + //cargar
  116 + if (cisterna.cisternaCarga.cantidad) {
  117 + cisterna.cisternaCarga.cantidad += cisterna.disponible;
  118 + } else {
  119 + cisterna.cisternaCarga.cantidad = cisterna.disponible;
  120 + cisterna.cisternaCarga.idProducto =
  121 + cisterna.articuloSeleccionado.idArticulo;
  122 + }
  123 +
  124 + //Guardar
  125 + var now = new Date();
  126 + var cisternaMovimiento = {
  127 + fecha: now.toISOString().slice(0, 19).replace('T', ' '),
  128 + cantidad: cisterna.disponible,
  129 + metodo: 'carga',
  130 + idCisternaCarga: cisterna.cisternaCarga.id,
  131 + };
  132 +
  133 + cisterna.cisternaCarga.fechaReparto = fechaReparto;
  134 + cisterna.articuloSeleccionado.cantidad = cisterna.disponible;
  135 + articulos.push(cisterna.articuloSeleccionado);
  136 + $scope.cisternaMovimientos.push(cisternaMovimiento);
  137 + });
  138 +
  139 + $uibModalInstance.close({
  140 + cisternas: cisternasFilter,
  141 + movimientos: $scope.cisternaMovimientos,
  142 + articulos: articulos
  143 + });
  144 + };
  145 +
  146 + $scope.cancel = function () {
  147 + var validarCisternas = validarArticulos();
  148 + if (validarCisternas !== undefined) {
  149 + $uibModalInstance.dismiss(null);
  150 + }
  151 + };
  152 +
  153 + function validarArticulos () {
  154 + var cisternasFilter = $scope.hojasRutas.vehiculo.cisternas.filter(function (cisterna) {
  155 + return parseInt(cisterna.disponible) > 0 || cisterna.articuloSeleccionado;
  156 + });
  157 +
  158 + var cisternasIncompletas = cisternasFilter.filter(function(cisterna) {
  159 + return (cisterna.articuloSeleccionado && !cisterna.disponible) ||
  160 + (!cisterna.articuloSeleccionado && cisterna.disponible);
  161 + });
  162 +
  163 + if (cisternasIncompletas.length || !cisternasFilter.length) {
  164 + focaModalService.alert('Ingrese todos los campos para completar el remito');
  165 + cisternasFilter = undefined;
  166 + }
  167 + return cisternasFilter;
  168 + }
  169 + }
  170 + ]);
1 1 angular.module('focaCrearHojaRuta')
2   - .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT',
3   - function($http, API_ENDPOINT) {
  2 + .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT', '$cookies',
  3 + function($http, API_ENDPOINT, $cookies) {
4 4 var route = API_ENDPOINT.URL;
5 5 return {
  6 + idUsuario: $cookies.get('vendedorCobrador'),
6 7 crearHojaRuta: function(hojaRuta) {
7 8 return $http.post(route + '/hoja-ruta', hojaRuta);
8 9 },
  10 + crearRemito: function(remito) {
  11 + console.log('Crear remito-----: ', remito);
  12 + // TODO: Cambiar para usar el servicio /remito
  13 + return $http.post(route + '/remito', remito);
  14 + },
9 15 obtenerHojaRuta: function() {
10 16 return $http.get(route +'/hoja-ruta');
11 17 },
... ... @@ -22,8 +28,8 @@ angular.module(&#39;focaCrearHojaRuta&#39;)
22 28 return $http.get(route+'/articulos/hoja-ruta/'+id);
23 29 },
24 30 crearArticulosParaHojaRuta: function(articuloHojaRuta) {
25   - return $http.post(route + '/articulos/hoja-ruta',
26   - {articuloHojaRuta: articuloHojaRuta});
  31 + return $http.post(route + '/articulos/remito',
  32 + {articuloRemito: articuloHojaRuta});
27 33 },
28 34 getDomiciliosByIdHojaRuta: function(id) {
29 35 return $http.get(route +'/hoja-ruta/' + id + '/domicilios');
... ... @@ -107,6 +113,142 @@ angular.module(&#39;focaCrearHojaRuta&#39;)
107 113 image: 'tarifario.png'
108 114 }
109 115 ];
  116 + },
  117 + getBotones: function () {
  118 + return [
  119 + {
  120 + label: 'Precargados',
  121 + image: 'vehiculos.png'
  122 + },
  123 + {
  124 + label: 'Cargar Remitos',
  125 + image: 'remito.png'
  126 + },
  127 + {
  128 + label: 'Remito Abierto',
  129 + image: 'remitoabierto.png'
  130 + }
  131 + ];
  132 + },
  133 + getRemitoAbierto: function () {
  134 + return [
  135 + {
  136 + label: 'Fecha Entrega',
  137 + image: 'FechaEntrega.png'
  138 + },
  139 + {
  140 + label: 'Transportista',
  141 + image: 'transportista.png'
  142 + },
  143 + {
  144 + label: 'Vehiculo',
  145 + image: 'vehiculos.png'
  146 + },
  147 + {
  148 + label: 'Chofer',
  149 + image: 'chofer.png'
  150 + },
  151 + {
  152 + label: 'Proveedor',
  153 + image: 'proveedor.png'
  154 + },
  155 + {
  156 + label: 'Tarifario',
  157 + image: 'tarifario.png'
  158 + },
  159 + {
  160 + label: 'Cliente',
  161 + image: 'cliente.png'
  162 + },
  163 + {
  164 + label: 'Detalle de Carga',
  165 + image: 'detalleDeCarga.png'
  166 + }
  167 + ];
  168 + },
  169 + getArticulos : function () {
  170 + return $http.get(API_ENDPOINT.URL + '/articulos');
  171 + },
  172 + getVendedorById : function (idVendedor) {
  173 + return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + idVendedor);
  174 + },
  175 + getPuntosDescargaByClienDom: function(idDomicilio, idCliente) {
  176 + return $http.get(API_ENDPOINT.URL + '/punto-descarga/' +
  177 + idDomicilio + '/' + idCliente);
  178 + },
  179 + getBotonFecha : function () {
  180 + return [
  181 + {
  182 + label: 'Fecha Entrega',
  183 + image: 'FechaEntrega.png'
  184 + },
  185 + ];
  186 + },
  187 + getBotoneraPrecargado: function () {
  188 + return [
  189 +
  190 + {
  191 + label: 'Transportista',
  192 + image: 'transportista.png'
  193 + },
  194 + {
  195 + label: 'Chofer',
  196 + image: 'chofer.png'
  197 + },
  198 + {
  199 + label: 'Vehiculo',
  200 + image: 'vehiculos.png'
  201 + },
  202 + {
  203 + label: 'Tarifario',
  204 + image: 'tarifario.png'
  205 + },
  206 + {
  207 + label: 'Datos extra',
  208 + image: 'tarifario.png'
  209 + }
  210 + ];
  211 + },
  212 + getBotoneraCargarRemito: function () {
  213 + return [
  214 + {
  215 + label: 'Transportista',
  216 + image: 'transportista.png'
  217 + },
  218 + {
  219 + label: 'Chofer',
  220 + image: 'chofer.png'
  221 + },
  222 + {
  223 + label: 'Vehiculo',
  224 + image: 'flete.png'
  225 + },
  226 + {
  227 + label: 'Remitos',
  228 + image: 'remito.png'
  229 + },
  230 + {
  231 + label: 'Tarifario',
  232 + image: 'tarifario.png'
  233 + },
  234 + {
  235 + label: 'Datos extra',
  236 + image: 'tarifario.png'
  237 + }
  238 + ];
  239 + },
  240 + guardarCisternas: function(cisterna, idRemito) {
  241 +
  242 + cisterna.cisternaMovimientos.forEach(function(cisternaMovimiento) {
  243 + cisternaMovimiento.idRemito = idRemito;
  244 + });
  245 +
  246 + return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar/' +
  247 + this.idUsuario + '/' + idRemito, cisterna);
  248 + },
  249 + crearArticulosParaRemito: function(articuloRemito) {
  250 + return $http.post(route + '/articulos/remito',
  251 + {articuloRemito: articuloRemito});
110 252 }
111 253 };
112 254 }]);
src/views/hoja-ruta.html
... ... @@ -9,86 +9,192 @@
9 9 <div class="row mt-4">
10 10 <div class="col-12 col-md-10 border border-light rounded">
11 11 <div class="row px-5 py-2 botonera-secundaria">
12   - <div class="col-12">
13   - <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador>
  12 + <div class="col">
  13 + <foca-botonera-facturador botones="botoneraPrincipal" max="botoneraPrincipal.length" class="row"></foca-botonera-facturador>
14 14 </div>
15 15 </div>
16   - <!-- PC -->
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">
19   - <thead>
20   - <tr class="d-flex">
21   - <th class="col-auto">#</th>
22   - <th class="col-2">Remito</th>
23   - <th class="col">Cliente</th>
24   - <th class="col">Direcciรณn</th>
25   - <th class="col-auto"></th>
26   - <th class="col-auto">
27   - <button
28   - class="btn btn-outline-light selectable"
29   - ng-click="show = !show; masMenos()"
30   - >
31   - <i
32   - class="fa fa-chevron-down"
33   - ng-show="show"
34   - aria-hidden="true"
35   - >
36   - </i>
37   - <i
38   - class="fa fa-chevron-up"
39   - ng-hide="show"
40   - aria-hidden="true">
41   - </i>
42   - </button>
43   - </th>
44   - </tr>
45   - </thead>
46   - <tbody class="tabla-articulo-body">
47   - <tr
48   - ng-repeat="(key, remito) in hojaRuta.remitosTabla"
49   - class="d-flex"
50   - ng-show="show || key == hojaRuta.remitosTabla.length - 1"
51   - >
52   - <td ng-bind="key + 1" class="col-auto"></td>
53   - <td
54   - class="col-2"
55   - >{{remito.sucursal | rellenarDigitos: 4}}-{{remito.numeroRemito | rellenarDigitos: 8}}</td>
56   - <th class="col" ng-bind="remito.nombreCliente"></th>
57   - <th class="col" ng-bind="remito.domicilioStamp"></th>
58   - <td class="text-center col-auto">
59   - <button
60   - class="btn btn-outline-light"
61   - ng-click="verProductosRemito(remito.id)"
62   - title="Ver productos"
63   - >
64   - <i class="fa fa-eye"></i>
65   - </button>
66   - </td>
67   - <td class="text-center col-auto">
68   - <button
69   - class="btn btn-outline-light"
70   - ng-click="desasociarRemito(key, remito.id)"
71   - title="Eliminar"
  16 + </div>
  17 + </div>
  18 + <div class="row mt-2">
  19 + <div class="col-12 col-md-10 border border-light rounded">
  20 + <div class="row px-5 py-2 botonera-secundaria">
  21 + <div class="col">
  22 + <foca-botonera-facturador botones="botonera" max="botonera.length" class="row"></foca-botonera-facturador>
  23 + </div>
  24 + </div>
  25 + <div class="row">
  26 + <div class="col">
  27 + <!-- PC -->
  28 + <div class="row grilla-articulo align-items-end d-none d-sm-flex">
  29 + <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
  30 + <thead>
  31 + <tr class="d-flex">
  32 + <th class="">#</th>
  33 + <th class="col">Cรณdigo</th>
  34 + <th class="col-4">Descripciรณn</th>
  35 + <th class="col text-right">Cantidad</th>
  36 + <th class="col text-right">Precio Unitario</th>
  37 + <th class="col text-right">SubTotal</th>
  38 + <th class="text-right">
  39 + <button
  40 + class="btn btn-outline-light selectable"
  41 + ng-click="show = !show; masMenos()"
  42 + >
  43 + <i
  44 + class="fa fa-chevron-down"
  45 + ng-show="show"
  46 + aria-hidden="true"
  47 + >
  48 + </i>
  49 + <i
  50 + class="fa fa-chevron-up"
  51 + ng-hide="show"
  52 + aria-hidden="true">
  53 + </i>
  54 + </button>
  55 + </th>
  56 + </tr>
  57 + </thead>
  58 + <tbody class="tabla-articulo-body">
  59 + <tr
  60 + ng-repeat="(key, articulo) in articulos"
  61 + ng-show="show || key == (articulos.length - 1)"
  62 + class="d-flex"
72 63 >
73   - <i class="fa fa-trash"></i>
74   - </button>
75   - </td>
76   - </tr>
77   - </tbody>
78   - <tfoot>
79   - <tr class="d-flex">
80   - <td class="col-auto px-1">
81   - <strong>Remitos:</strong>
82   - <a ng-bind="hojaRuta.remitosTabla.length"></a>
83   - </td>
84   - <td class="col"></td>
85   - <td class="col-auto px-1">
86   - <strong>Cantidad:</strong>
87   - <a ng-bind="hojaRuta.litros"></a>
88   - </td>
89   - </tr>
90   - </tfoot>
91   - </table>
  64 + <td ng-bind="key + 1"></td>
  65 + <td
  66 + class="col"
  67 + ng-bind="articulo.sector + '-' + articulo.codigo"
  68 + ></td>
  69 + <td
  70 + class="col-4"
  71 + ng-bind="articulo.descripcion"
  72 + ></td>
  73 + <td class="col text-right">
  74 + <input
  75 + ng-show="articulo.editCantidad"
  76 + ng-model="tmpCantidad"
  77 + class="form-control"
  78 + foca-tipo-input
  79 + min="1"
  80 + foca-focus="articulo.editCantidad"
  81 + ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);"
  82 + esc-key="cancelarEditar(articulo)"
  83 + ng-focus="selectFocus($event);
  84 + tmpCantidad = articulo.cantidad;
  85 + tmpPrecio = 0"
  86 + teclado-virtual
  87 + >
  88 + <i
  89 + class="selectable"
  90 + ng-click="cambioEdit(articulo, 'cantidad')"
  91 + ng-hide="articulo.editCantidad"
  92 + ng-bind="articulo.cantidad">
  93 + </i>
  94 + </td>
  95 + <td class="col text-right">
  96 + <i
  97 + class="selectable"
  98 + ng-bind="0 | number: 4">
  99 + </i>
  100 + </td>
  101 + <td
  102 + class="col text-right"
  103 + ng-bind="0 | number: 2">
  104 + </td>
  105 + <td class="text-center">
  106 + <button
  107 + class="btn btn-outline-light"
  108 + ng-click="quitarArticulo(key, articulo)"
  109 + >
  110 + <i class="fa fa-trash"></i>
  111 + </button>
  112 + </td>
  113 + </tr>
  114 + </tbody>
  115 + <tfoot>
  116 + <tr ng-show="!cargando" class="d-flex">
  117 + <td
  118 + class="align-middle"
  119 + ng-bind="articulosFiltro.length + 1"
  120 + ></td>
  121 + <td class="col">
  122 + <input
  123 + class="form-control"
  124 + ng-model="articuloACargar.sectorCodigo"
  125 + readonly
  126 + >
  127 + </td>
  128 + <td class="col-4 tabla-articulo-descripcion">
  129 + <input
  130 + class="form-control"
  131 + ng-model="articuloACargar.descripcion"
  132 + readonly
  133 + >
  134 + </td>
  135 + <td class="col text-right">
  136 + <input
  137 + class="form-control"
  138 + foca-tipo-input
  139 + min="1"
  140 + ng-model="articuloACargar.cantidad"
  141 + foca-focus="!cargando"
  142 + esc-key="resetFilter()"
  143 + ng-keypress="agregarATabla($event.keyCode)"
  144 + teclado-virtual
  145 + >
  146 + </td>
  147 + <td class="col text-right">
  148 + <input
  149 + class="form-control"
  150 + ng-model="articuloACargar.precio"
  151 + ng-show="idLista != -1"
  152 + ng-keypress="agregarATabla($event.keyCode)"
  153 + >
  154 + <input
  155 + class="form-control"
  156 + foca-tipo-input
  157 + step="0.0001"
  158 + ng-model="articuloACargar.precio"
  159 + esc-key="resetFilter()"
  160 + ng-keypress="agregarATabla($event.keyCode)"
  161 + ng-show="idLista == -1"
  162 + teclado-virtual
  163 + >
  164 + </td>
  165 + <td class="col text-right">
  166 + <input
  167 + class="form-control"
  168 + ng-value="getSubTotal() | number: 2"
  169 + readonly
  170 + >
  171 + </td>
  172 + </tr>
  173 +
  174 + <tr class="d-flex">
  175 + <td colspan="4" class="no-border-top">
  176 + <strong>Items:</strong>
  177 + <a ng-bind="articulos.length"></a>
  178 + </td>
  179 + <td class="text-right ml-auto table-celda-total no-border-top">
  180 + <h3>Total:</h3>
  181 + </td>
  182 + <td class="table-celda-total text-right no-border-top" colspan="1">
  183 + <h3>{{getTotal() | currency: hojaRuta.cotizacion.moneda.SIMBOLO}}</h3>
  184 + </td>
  185 + <td class="text-right no-border-top">
  186 + <button
  187 + type="button"
  188 + class="btn btn-sm"
  189 + >
  190 + Totales
  191 + </button>
  192 + </td>
  193 + </tr>
  194 + </tfoot>
  195 + </table>
  196 + </div>
  197 + </div>
92 198 </div>
93 199 </div>
94 200 </div>
src/views/modal-detalle-carga.html
... ... @@ -0,0 +1,76 @@
  1 +<div class="modal-header py-1">
  2 + <div class="row w-100">
  3 + <div class="col-lg-6">
  4 + <h5 class="modal-title my-1">Detalle de Carga</h5>
  5 + </div>
  6 + </div>
  7 + </div>
  8 + <div class="row">
  9 + <div class="col ml-3 mt-2">
  10 + <span class=" text-left">
  11 + Transportista <b>{{hojasRutas.idTransportista}} {{hojasRutas.transportista.NOM}}</b>
  12 + Unidad <b>{{hojasRutas.vehiculo.codigo}}</b> Tractor <b>{{hojasRutas.vehiculo.tractor}}</b>
  13 + </span>
  14 +
  15 + </div>
  16 + </div>
  17 + <div class="row">
  18 + <div class="col ml-3">
  19 + <span class=" text-left">Fecha <b>{{hojasRutas.fecha | date:'yyyy-MM-dd':'-0300'}}</b></span>
  20 + </div>
  21 + </div>
  22 + <div class="modal-body" id="modal-body">
  23 + <table class="table table-hover table-sm table-striped">
  24 + <thead>
  25 + <tr>
  26 + <th>Cisterna</th>
  27 + <th>Capacidad</th>
  28 + <th>Disponibles</th>
  29 + <th>Articulo Cargado</th>
  30 + </tr>
  31 + </thead>
  32 + <tbody>
  33 + <tr
  34 + ng-repeat="(key, cisterna) in hojasRutas.vehiculo.cisternas"
  35 + >
  36 + <td ng-bind="cisterna.id"></td>
  37 + <td ng-bind="cisterna.capacidad"></td>
  38 + <td class="w-50">
  39 + <input
  40 + ng-focus="$event.target.select();"
  41 + ng-model="cisterna.disponible"
  42 + ng-keyup="validarCisternaDisponible(cisterna)"
  43 + class="form-control"
  44 + solo-positivos
  45 + foca-tipo-input
  46 + />
  47 + </td>
  48 + <td class="w-25">
  49 + <div class="input-group ">
  50 + <input
  51 + ng-model="cisterna.nombreArticulo"
  52 + class="form-control"
  53 + ng-click="seleccionarProductos(key, cisterna)"
  54 + readonly
  55 + />
  56 + <div class="input-group-append">
  57 + <button
  58 + ladda="searchLoading"
  59 + class="btn btn-outline-secondary form-control"
  60 + type="button"
  61 + ng-click="seleccionarProductos(key, cisterna)"
  62 + >
  63 + <i class="fa fa-search" aria-hidden="true"></i>
  64 + </button>
  65 + </div>
  66 + </div>
  67 + </td>
  68 + </tr>
  69 + </tbody>
  70 + </table>
  71 + </div>
  72 + <div class="modal-footer py-1">
  73 + <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button>
  74 + <button class="btn btn-sm btn-primary" type="button" ng-click="guardar()">Guardar</button>
  75 + </div>
  76 +</div>
0 77 \ No newline at end of file