Commit 93dad1280a5939996e3421a173f378669ef1e890
Exists in
master
Merge remote-tracking branch 'upstream/master'
Showing
2 changed files
 
Show diff stats
src/js/controller.js
| 1 | angular.module('focaModalPuntoDescarga') | 1 | angular.module('focaModalPuntoDescarga') | 
| 2 | .controller('focaModalPuntoDescargaController', [ | 2 | .controller('focaModalPuntoDescargaController', [ | 
| 3 | '$timeout', | ||
| 4 | '$filter', | ||
| 5 | '$scope', | 3 | '$scope', | 
| 6 | '$uibModalInstance', | 4 | '$uibModalInstance', | 
| 7 | 'focaModalPuntoDescargaService', | 5 | 'focaModalPuntoDescargaService', | 
| 8 | 'filters', | 6 | 'filters', | 
| 9 | 'focaModalService', | 7 | 'focaModalService', | 
| 10 | function($timeout, $filter, $scope, $uibModalInstance, | 8 | function($scope, $uibModalInstance, | 
| 11 | focaModalPuntoDescargaService, filters, focaModalService) { | 9 | focaModalPuntoDescargaService, filters, focaModalService) { | 
| 12 | 10 | ||
| 11 | $scope.cantidadArticulo = 0; | ||
| 12 | $scope.articuloSeleccionado = 0; | ||
| 13 | $scope.cantidadArticulo = 0; | 13 | $scope.ivas = []; | 
| 14 | $scope.articuloSeleccionado = 0; | 14 | $scope.puntosSeleccionados = []; | 
| 15 | $scope.ivas = []; | 15 | $scope.editando = false; | 
| 16 | $scope.puntosSeleccionados = []; | 16 | $scope.puntoDescarga = { | 
| 17 | $scope.editando = false; | 17 | id: 0, | 
| 18 | $scope.puntoDescarga = { | 18 | id_cliente: filters.idCliente, | 
| 19 | id: 0, | 19 | id_da_config_0: filters.idDomicilio, | 
| 20 | id_cliente: filters.idCliente, | 20 | latitud: filters.domicilio.Latitud, | 
| 21 | id_da_config_0: filters.idDomicilio, | 21 | longitud: filters.domicilio.Longitud | 
| 22 | latitud: filters.domicilio.Latitud, | 22 | }; | 
| 23 | longitud: filters.domicilio.Longitud | 23 | |
| 24 | }; | 24 | $scope.articulos = angular.copy(filters.articulos); | 
| 25 | 25 | $scope.articulos.map(function(articulo) { | |
| 26 | $scope.articulos = angular.copy(filters.articulos); | 26 | articulo.restante = articulo.cantidad; | 
| 27 | $scope.articulos.map(function(articulo) { | 27 | }); | 
| 28 | articulo.restante = articulo.cantidad; | 28 | actualizarTabla(); | 
| 29 | }); | 29 | cargarPuntos(filters.puntosDescarga); | 
| 30 | actualizarTabla(); | 30 | |
| 31 | cargarPuntos(filters.puntosDescarga); | 31 | $scope.cancel = function() { | 
| 32 | 32 | if ($scope.ingreso) { | |
| 33 | $scope.cancel = function() { | 33 | $scope.ingreso = false; | 
| 34 | if ($scope.ingreso) { | 34 | $scope.puntoDescarga = { | 
| 35 | $scope.ingreso = false; | 35 | id: 0, | 
| 36 | $scope.puntoDescarga = { | 36 | id_cliente: filters.idCliente, | 
| 37 | id: 0, | 37 | id_da_config_0: filters.idDomicilio, | 
| 38 | id_cliente: filters.idCliente, | 38 | latitud: filters.domicilio.Latitud, | 
| 39 | id_da_config_0: filters.idDomicilio, | 39 | longitud: filters.domicilio.Longitud | 
| 40 | latitud: filters.domicilio.Latitud, | 40 | }; | 
| 41 | longitud: filters.domicilio.Longitud | 41 | $scope.editando = false; | 
| 42 | }; | 42 | } else { | 
| 43 | $scope.editando = false; | 43 | $uibModalInstance.dismiss('cancel'); | 
| 44 | } else { | 44 | } | 
| 45 | $uibModalInstance.dismiss('cancel'); | 45 | }; | 
| 46 | } | 46 | |
| 47 | }; | 47 | $scope.aceptar = function() { | 
| 48 | 48 | if ($scope.cargaArticulos) { | |
| 49 | $scope.aceptar = function() { | 49 | cargarArticulos(); | 
| 50 | if ($scope.cargaArticulos) { | 50 | } else if(!$scope.puntosSeleccionados.length) { | 
| 51 | cargarArticulos(); | 51 | $uibModalInstance.dismiss('cancel'); | 
| 52 | } else if(!$scope.puntosSeleccionados.length) { | 52 | } else { | 
| 53 | $uibModalInstance.dismiss('cancel'); | 53 | enviarPuntos(); | 
| 54 | } else { | 54 | } | 
| 55 | enviarPuntos(); | 55 | }; | 
| 56 | } | 56 | |
| 57 | }; | 57 | $scope.guardar = function(key) { | 
| 58 | 58 | if(key === 13) { | |
| 59 | $scope.guardar = function(key) { | 59 | focaModalPuntoDescargaService | 
| 60 | if(key === 13) { | 60 | .guardarPuntoDescarga($scope.puntoDescarga) | 
| 61 | focaModalPuntoDescargaService | 61 | .then(function() { | 
| 62 | .guardarPuntoDescarga($scope.puntoDescarga) | 62 | actualizarTabla(); | 
| 63 | .then(function() { | 63 | $scope.ingreso = false; | 
| 64 | actualizarTabla(); | 64 | $scope.puntoDescarga = { | 
| 65 | $scope.ingreso = false; | 65 | id: 0, | 
| 66 | $scope.puntoDescarga = { | 66 | id_cliente: filters.idCliente, | 
| 67 | id: 0, | 67 | id_da_config_0: filters.idDomicilio, | 
| 68 | id_cliente: filters.idCliente, | 68 | latitud: filters.domicilio.Latitud, | 
| 69 | id_da_config_0: filters.idDomicilio, | 69 | longitud: filters.domicilio.Longitud | 
| 70 | latitud: filters.domicilio.Latitud, | 70 | }; | 
| 71 | longitud: filters.domicilio.Longitud | 71 | $scope.editando = false; | 
| 72 | }; | 72 | }); | 
| 73 | $scope.editando = false; | 73 | } | 
| 74 | }); | 74 | }; | 
| 75 | } | 75 | |
| 76 | }; | 76 | $scope.editar = function(id) { | 
| 77 | 77 | focaModalPuntoDescargaService.getPuntoDescargaById(id).then(function(res) { | |
| 78 | $scope.editar = function(id) { | 78 | $scope.puntoDescarga = res.data; | 
| 79 | focaModalPuntoDescargaService.getPuntoDescargaById(id).then(function(res) { | 79 | $scope.ingreso = true; | 
| 80 | $scope.puntoDescarga = res.data; | 80 | $scope.editando = true; | 
| 81 | $scope.ingreso = true; | 81 | }); | 
| 82 | $scope.editando = true; | 82 | }; | 
| 83 | }); | 83 | |
| 84 | }; | 84 | $scope.eliminar = function(idx, puntoDescarga) { | 
| 85 | 85 | focaModalService.confirm('¿Está seguro que desea borrar el punto de descarga '+ | |
| 86 | $scope.eliminar = function(idx, puntoDescarga) { | 86 | puntoDescarga.descripcion + '?').then(function(data) { | 
| 87 | focaModalService.confirm('¿Está seguro que desea borrar el punto de descarga '+ | 87 | if (data) { | 
| 88 | puntoDescarga.descripcion + '?').then(function(data) { | 88 | focaModalPuntoDescargaService | 
| 89 | if (data) { | 89 | .eliminarPuntoDescarga(puntoDescarga.id) | 
| 90 | focaModalPuntoDescargaService | 90 | .then(function() { | 
| 91 | .eliminarPuntoDescarga(puntoDescarga.id) | 91 | $scope.puntosDescarga.splice(idx, 1); | 
| 92 | .then(function() { | 92 | }); | 
| 93 | $scope.puntosDescarga.splice(idx, 1); | 93 | } | 
| 94 | }); | 94 | }); | 
| 95 | } | 95 | }; | 
| 96 | }); | 96 | |
| 97 | }; | 97 | $scope.seleccionarPunto = function(idx, esCheckbox) { | 
| 98 | 98 | var indexPunto = $scope.puntosSeleccionados.indexOf(idx); | |
| 99 | $scope.seleccionarPunto = function(idx, esCheckbox) { | 99 | if (indexPunto !== -1) { | 
| 100 | var indexPunto = $scope.puntosSeleccionados.indexOf(idx); | 100 | if (!esCheckbox) { | 
| 101 | if (indexPunto !== -1) { | 101 | $scope.puntosDescarga[idx].seleccionado = false; | 
| 102 | if (!esCheckbox) { | 102 | } | 
| 103 | $scope.puntosDescarga[idx].seleccionado = false; | 103 | $scope.puntosSeleccionados.splice(indexPunto, 1); | 
| 104 | } | 104 | } else { | 
| 105 | $scope.puntosSeleccionados.splice(indexPunto, 1); | 105 | if (!esCheckbox) { | 
| 106 | } else { | 106 | $scope.puntosDescarga[idx].seleccionado = true; | 
| 107 | if (!esCheckbox) { | 107 | } | 
| 108 | $scope.puntosDescarga[idx].seleccionado = true; | 108 | $scope.puntosSeleccionados.push(idx); | 
| 109 | } | 109 | } | 
| 110 | $scope.puntosSeleccionados.push(idx); | 110 | }; | 
| 111 | } | 111 | |
| 112 | }; | 112 | $scope.agregarArticulo = function(punto, key) { | 
| 113 | 113 | key = (typeof key === 'undefined') ? 13 : key; | |
| 114 | $scope.agregarArticulo = function(punto, key) { | 114 | |
| 115 | key = (typeof key === 'undefined') ? 13 : key; | 115 | if (key === 13) { | 
| 116 | 116 | var articulo = $scope.articulos[$scope.articuloSeleccionado], | |
| 117 | if (key === 13) { | 117 | cantidadRestante = articulo.restante - punto.cantidadACargar; | 
| 118 | var articulo = $scope.articulos[$scope.articuloSeleccionado], | 118 | |
| 119 | cantidadRestante = articulo.restante - punto.cantidadACargar; | 119 | if (cantidadRestante < 0) { | 
| 120 | 120 | focaModalService | |
| 121 | if (cantidadRestante < 0) { | 121 | .alert('La cantidad a cargar debe ser menor o igual al restante'); | 
| 122 | focaModalService | 122 | } else if (punto.cantidadACargar <= 0) { | 
| 123 | .alert('La cantidad a cargar debe ser menor o igual al restante'); | 123 | focaModalService | 
| 124 | } else if (punto.cantidadACargar <= 0) { | 124 | .alert('La cantidad a cargar debe ser mayor que cero'); | 
| 125 | focaModalService | 125 | } else { | 
| 126 | .alert('La cantidad a cargar debe ser mayor que cero'); | 126 | punto.cargado += parseInt(punto.cantidadACargar); | 
| 127 | } else { | 127 | articulo.restante = cantidadRestante; | 
| 128 | punto.cargado += parseInt(punto.cantidadACargar); | 128 | var existeArticulo = punto.articulosAgregados.filter( | 
| 129 | articulo.restante = cantidadRestante; | 129 | function (articuloAAgregar) { | 
| 130 | var existeArticulo = punto.articulosAgregados.filter( | 130 | return articuloAAgregar.id === articulo.idArticulo; | 
| 131 | function (articuloAAgregar) { | 131 | }); | 
| 132 | return articuloAAgregar.id === articulo.idArticulo; | 132 | //Si el articulo ya fue agregado | 
| 133 | }); | 133 | if (existeArticulo.length) { | 
| 134 | //Si el articulo ya fue agregado | 134 | //Solo sumo cantidad | 
| 135 | if (existeArticulo.length) { | 135 | var total = parseInt(existeArticulo[0].cantidad) + | 
| 136 | //Solo sumo cantidad | 136 | parseInt(punto.cantidadACargar); | 
| 137 | var total = parseInt(existeArticulo[0].cantidad) + | 137 | existeArticulo[0].cantidad = total; | 
| 138 | parseInt(punto.cantidadACargar); | 138 | } else { | 
| 139 | existeArticulo[0].cantidad = total; | 139 | //Agrego el articulo con la cantidad | 
| 140 | } else { | 140 | punto.articulosAgregados.push({ | 
| 141 | //Agrego el articulo con la cantidad | 141 | id: articulo.idArticulo, | 
| 142 | punto.articulosAgregados.push({ | 142 | descripcion: articulo.descripcion, | 
| 143 | id: articulo.idArticulo, | 143 | cantidad: punto.cantidadACargar, | 
| 144 | descripcion: articulo.descripcion, | 144 | index: $scope.articuloSeleccionado | 
| 145 | cantidad: punto.cantidadACargar, | 145 | }); | 
| 146 | index: $scope.articuloSeleccionado | 146 | } | 
| 147 | }); | 147 | punto.cantidadACargar = 0; | 
| 148 | } | 148 | } | 
| 149 | punto.cantidadACargar = 0; | 149 | } | 
| 150 | } | 150 | }; | 
| 151 | } | 151 | |
| 152 | }; | 152 | $scope.quitarArticulo = function(articulo, idx, punto) { | 
| 153 | 153 | var articuloAEliminar = $scope.articulos.filter(function(art) { | |
| 154 | $scope.quitarArticulo = function(articulo, idx, punto) { | 154 | return art.id === articulo.id; | 
| 155 | var articuloAEliminar = $scope.articulos.filter(function(art) { | 155 | }); | 
| 156 | return art.id === articulo.id; | 156 | var restante = parseInt(articuloAEliminar[0].restante); | 
| 157 | }); | 157 | restante += parseInt(articulo.cantidad); | 
| 158 | var restante = parseInt(articuloAEliminar[0].restante); | 158 | articuloAEliminar[0].restante = restante; | 
| 159 | restante += parseInt(articulo.cantidad); | 159 | |
| 160 | articuloAEliminar[0].restante = restante; | 160 | punto.cargado -= parseInt(punto.articulosAgregados[idx].cantidad); | 
| 161 | 161 | punto.articulosAgregados.splice(idx, 1); | |
| 162 | punto.cargado -= parseInt(punto.articulosAgregados[idx].cantidad); | 162 | }; | 
| 163 | punto.articulosAgregados.splice(idx, 1); | 163 | |
| 164 | }; | 164 | function actualizarTabla() { | 
| 165 | 165 | focaModalPuntoDescargaService | |
| 166 | function actualizarTabla() { | 166 | .getPuntosDescargaByClienDom(filters.idDomicilio, filters.idCliente) | 
| 167 | focaModalPuntoDescargaService | 167 | .then(function(res) { | 
| 168 | .getPuntosDescargaByClienDom(filters.idDomicilio, filters.idCliente) | 168 | $scope.puntosDescarga = res.data; | 
| 169 | .then(function(res) { | 169 | }); | 
| 170 | $scope.puntosDescarga = res.data; | 170 | } | 
| 171 | }); | 171 | function verCargaArticulos() { | 
| 172 | } | 172 | $scope.puntosACargar = []; | 
| 173 | function verCargaArticulos() { | 173 | $scope.cargaArticulos = true; | 
| 174 | $scope.puntosACargar = []; | 174 | $scope.puntosSeleccionados.forEach(function(idx) { | 
| 175 | $scope.cargaArticulos = true; | 175 | $scope.puntosACargar.push($scope.puntosDescarga[idx]); | 
| 176 | $scope.puntosSeleccionados.forEach(function(idx) { | 176 | }); | 
| 177 | $scope.puntosACargar.push($scope.puntosDescarga[idx]); | 177 | |
| 178 | }); | 178 | $scope.puntosACargar.map(function(punto) { | 
| 179 | 179 | punto.articulosAgregados = []; | |
| 180 | $scope.puntosACargar.map(function(punto) { | 180 | punto.cantidadACargar = 0; | 
| 181 | punto.articulosAgregados = []; | 181 | punto.cargado = 0; | 
| 182 | punto.cantidadACargar = 0; | 182 | }); | 
| 183 | punto.cargado = 0; | 183 | } | 
| 184 | }); | 184 | function cargarArticulos() { | 
| 185 | } | 185 | $uibModalInstance.close($scope.puntosACargar); | 
| 186 | function cargarArticulos() { | 186 | } | 
| 187 | $uibModalInstance.close($scope.puntosACargar); | 187 | function cargarPuntos(puntosDescarga) { | 
| 188 | } | 188 | //Si existen puntos ya cargados | 
| 189 | function cargarPuntos(puntosDescarga) { | 189 | if (puntosDescarga) { | 
| 190 | //Si existen puntos ya cargados | 190 | if (!puntosDescarga[0].cargado) { | 
| 191 | if (puntosDescarga) { | 191 | agregarTotalCargado(puntosDescarga); | 
| 192 | if (!puntosDescarga[0].cargado) { | 192 | } | 
| 193 | agregarTotalCargado(puntosDescarga); | 193 | $scope.puntosACargar = puntosDescarga; | 
| 194 | } | 194 | $scope.cargaArticulos = true; | 
| 195 | $scope.puntosACargar = puntosDescarga; | 195 | //Recorro los puntos | 
| 196 | $scope.cargaArticulos = true; | 196 | puntosDescarga.forEach(function(punto) { | 
| 197 | //Recorro los puntos | 197 | //Recorro los articulos cargados en cada punto | 
| 198 | puntosDescarga.forEach(function(punto) { | 198 | punto.articulosAgregados.forEach(function(articulo) { | 
| 199 | //Recorro los articulos cargados en cada punto | 199 | var articuloARestar = $scope.articulos.filter(function(art) { | 
| 200 | punto.articulosAgregados.forEach(function(articulo) { | 200 | return art.idArticulo === articulo.id; | 
| 201 | var articuloARestar = $scope.articulos.filter(function(art) { | 201 | }); | 
| 202 | return art.idArticulo === articulo.id; | 202 | articuloARestar[0].restante -= articulo.cantidad; | 
| 203 | }); | 203 | }); | 
| 204 | articuloARestar[0].restante -= articulo.cantidad; | 204 | }); | 
| 205 | }); | 205 | } | 
| 206 | }); | 206 | } | 
| 207 | } | 207 | function agregarTotalCargado(puntosDescarga) { | 
| 208 | } | 208 | puntosDescarga.map(function(punto) { | 
| 209 | function agregarTotalCargado(puntosDescarga) { | 209 | punto.cantidadACargar = 0; | 
| 210 | puntosDescarga.map(function(punto) { | 210 | punto.cargado = 0; | 
| 211 | punto.cantidadACargar = 0; | 211 | }); | 
| 212 | punto.cargado = 0; | 212 | //Agrego cantidad de combustible cargada en los puntos de descarga | 
| 213 | }); | 213 | puntosDescarga.forEach(function(punto) { | 
| 214 | //Agrego cantidad de combustible cargada en los puntos de descarga | 214 | punto.articulosAgregados.forEach(function(articulo) { | 
| 215 | puntosDescarga.forEach(function(punto) { | 215 | punto.cargado += articulo.cantidad; | 
| 216 | punto.articulosAgregados.forEach(function(articulo) { | 216 | }); | 
| 217 | punto.cargado += articulo.cantidad; | 217 | }); | 
| 218 | }); | 218 | } | 
| 219 | }); | 219 | function enviarPuntos() { | 
| 220 | } | 220 | var result = []; | 
| 221 | function enviarPuntos() { | 221 | $scope.puntosSeleccionados.forEach(function(idx) { | 
| 222 | var result = []; | 222 | result.push($scope.puntosDescarga[idx]); | 
| 223 | $scope.puntosSeleccionados.forEach(function(idx) { | 223 | }); | 
| 224 | result.push($scope.puntosDescarga[idx]); | 224 | $uibModalInstance.close(result); | 
| 225 | }); | 225 | } | 
| 226 | $uibModalInstance.close(result); | 226 | }] | 
| 227 | } | 227 | ); | 
| 228 | }] | 228 | 
src/views/modal-punto-descarga.html
| 1 | <div class="modal-header d-flex"> | 1 | <div class="modal-header d-flex"> | 
| 2 | <h5 class="modal-title my-1" ng-hide="ingreso || cargaArticulos">Búsqueda de puntos de descarga</h5> | 2 | <h5 class="modal-title my-1" ng-hide="ingreso || cargaArticulos">Búsqueda de puntos de descarga</h5> | 
| 3 | <h5 class="modal-title my-1" ng-show="ingreso">Crear punto de descarga</h5> | 3 | <h5 class="modal-title my-1" ng-show="ingreso">Crear punto de descarga</h5> | 
| 4 | <h5 class="modal-title my-1" ng-show="cargaArticulos">Cargar artículos en puntos de descarga</h5> | 4 | <h5 class="modal-title my-1" ng-show="cargaArticulos">Cargar artículos en puntos de descarga</h5> | 
| 5 | <button | 5 | <button | 
| 6 | class="btn btn-primary" | 6 | class="btn btn-outline-debo" | 
| 7 | title="Nuevo" | 7 | title="Nuevo" | 
| 8 | ng-click="ingreso = true" | 8 | ng-click="ingreso = true" | 
| 9 | ng-hide="ingreso || cargaArticulos"> | 9 | ng-hide="ingreso || cargaArticulos"> | 
| 10 | <i class="fa fa-plus" aria-hidden="true"></i> | 10 | <i class="fa fa-plus" aria-hidden="true"></i> | 
| 11 | </button> | 11 | </button> | 
| 12 | </div> | 12 | </div> | 
| 13 | <div class="modal-body" id="modal-body"> | 13 | <div class="modal-body" id="modal-body"> | 
| 14 | <table | 14 | <table | 
| 15 | class="table table-striped table-sm col-12" | 15 | class="table table-striped table-sm col-12" | 
| 16 | ng-hide="ingreso || cargaArticulos"> | 16 | ng-hide="ingreso || cargaArticulos"> | 
| 17 | <thead> | 17 | <thead> | 
| 18 | <tr> | 18 | <tr> | 
| 19 | <th>Código</th> | 19 | <th>Código</th> | 
| 20 | <th>Descripción</th> | 20 | <th>Descripción</th> | 
| 21 | <th></th> | 21 | <th></th> | 
| 22 | </tr> | 22 | </tr> | 
| 23 | </thead> | 23 | </thead> | 
| 24 | <tbody> | 24 | <tbody> | 
| 25 | <tr ng-show="!puntosDescarga.length"> | 25 | <tr ng-show="!puntosDescarga.length"> | 
| 26 | <td colspan="5"> | 26 | <td colspan="5"> | 
| 27 | No se encontraron resultados. | 27 | No se encontraron resultados. | 
| 28 | </td> | 28 | </td> | 
| 29 | </tr> | 29 | </tr> | 
| 30 | <tr class="selected" | 30 | <tr class="selected" | 
| 31 | ng-repeat="(key, puntoDescarga) in puntosDescarga | filter: filters" | 31 | ng-repeat="(key, puntoDescarga) in puntosDescarga | filter: filters" | 
| 32 | > | 32 | > | 
| 33 | <td | 33 | <td | 
| 34 | ng-bind="puntoDescarga.id | rellenarDigitos: 3: 0" | 34 | ng-bind="puntoDescarga.id | rellenarDigitos: 3: 0" | 
| 35 | ng-click="seleccionarPunto(key)"></td> | 35 | ng-click="seleccionarPunto(key)"></td> | 
| 36 | <td | 36 | <td | 
| 37 | ng-bind="puntoDescarga.descripcion" | 37 | ng-bind="puntoDescarga.descripcion" | 
| 38 | ng-click="seleccionarPunto(key)"></td> | 38 | ng-click="seleccionarPunto(key)"></td> | 
| 39 | <td> | 39 | <td> | 
| 40 | <input | 40 | <input | 
| 41 | type="checkbox" | 41 | type="checkbox" | 
| 42 | class="custom-control-input float-right" | 42 | class="custom-control-input float-right" | 
| 43 | id="checkSelect{{key}}" | 43 | id="checkSelect{{key}}" | 
| 44 | ng-model="puntoDescarga.seleccionado" | 44 | ng-model="puntoDescarga.seleccionado" | 
| 45 | ng-change="seleccionarPunto(key, true)" | 45 | ng-change="seleccionarPunto(key, true)" | 
| 46 | teclado-virtual | ||
| 46 | > | 47 | > | 
| 47 | <label | 48 | <label | 
| 48 | class="custom-control-label float-right" | 49 | class="custom-control-label float-right" | 
| 49 | for="checkSelect{{key}}"></label> | 50 | for="checkSelect{{key}}"></label> | 
| 50 | <button | 51 | <button | 
| 51 | type="button" | 52 | type="button" | 
| 52 | class="btn btn-xs p-1 float-right mr-5" | 53 | class="btn btn-xs p-1 float-right mr-5" | 
| 53 | ng-click="eliminar(key, puntoDescarga)" | 54 | ng-click="eliminar(key, puntoDescarga)" | 
| 54 | title="Eliminar"> | 55 | title="Eliminar"> | 
| 55 | <i class="fa fa-trash" aria-hidden="true"></i> | 56 | <i class="fa fa-trash" aria-hidden="true"></i> | 
| 56 | </button> | 57 | </button> | 
| 57 | <button | 58 | <button | 
| 58 | type="button" | 59 | type="button" | 
| 59 | class="btn btn-xs p-1 float-right mr-1" | 60 | class="btn btn-xs p-1 float-right mr-1" | 
| 60 | ng-click="editar(puntoDescarga.id)" | 61 | ng-click="editar(puntoDescarga.id)" | 
| 61 | title="Editar"> | 62 | title="Editar"> | 
| 62 | <i class="fa fa-pencil" aria-hidden="true"></i> | 63 | <i class="fa fa-pencil" aria-hidden="true"></i> | 
| 63 | </button> | 64 | </button> | 
| 64 | </td> | 65 | </td> | 
| 65 | </tr> | 66 | </tr> | 
| 66 | </tbody> | 67 | </tbody> | 
| 67 | </table> | 68 | </table> | 
| 68 | <div ng-show="cargaArticulos"> | 69 | <div ng-show="cargaArticulos"> | 
| 69 | <div ng-show="!articulos.length"> | 70 | <div ng-show="!articulos.length"> | 
| 70 | <h6>No existen articulos para agregar</h6> | 71 | <h6>No existen articulos para agregar</h6> | 
| 71 | </div> | 72 | </div> | 
| 72 | <div ng-show="articulos.length"> | 73 | <div ng-show="articulos.length"> | 
| 73 | <div class="row"> | 74 | <div class="row"> | 
| 74 | <div class="col-12"> | 75 | <div class="col-12"> | 
| 75 | <table class="table table-sm"> | 76 | <table class="table table-sm"> | 
| 76 | <thead> | 77 | <thead> | 
| 77 | <tr> | 78 | <tr> | 
| 78 | <th></th> | 79 | <th></th> | 
| 79 | <th>Articulo</th> | 80 | <th>Articulo</th> | 
| 80 | <th>Total</th> | 81 | <th>Total</th> | 
| 81 | <th>Restante</th> | 82 | <th>Restante</th> | 
| 82 | </tr> | 83 | </tr> | 
| 83 | </thead> | 84 | </thead> | 
| 84 | <tbody> | 85 | <tbody> | 
| 85 | <tr ng-repeat="(key, articulo) in articulos"> | 86 | <tr ng-repeat="(key, articulo) in articulos"> | 
| 86 | <td> | 87 | <td> | 
| 87 | <input | 88 | <input | 
| 88 | type="radio" | 89 | type="radio" | 
| 89 | ng-value="key" | 90 | ng-value="key" | 
| 90 | ng-model="$parent.articuloSeleccionado" | 91 | ng-model="$parent.articuloSeleccionado" | 
| 91 | > | 92 | > | 
| 92 | </td> | 93 | </td> | 
| 93 | <td ng-bind="articulo.descripcion"></td> | 94 | <td ng-bind="articulo.descripcion"></td> | 
| 94 | <td ng-bind="articulo.cantidad"></td> | 95 | <td ng-bind="articulo.cantidad"></td> | 
| 95 | <td ng-bind="articulo.restante"></td> | 96 | <td ng-bind="articulo.restante"></td> | 
| 96 | </tr> | 97 | </tr> | 
| 97 | </tbody> | 98 | </tbody> | 
| 98 | </table> | 99 | </table> | 
| 99 | </div> | 100 | </div> | 
| 100 | </div> | 101 | </div> | 
| 101 | <div class="row"> | 102 | <div class="row"> | 
| 102 | <div class="col-12"> | 103 | <div class="col-12"> | 
| 103 | <h5 class="col-12 my-3">Puntos de descarga</h5> | 104 | <h5 class="col-12 my-3">Puntos de descarga</h5> | 
| 104 | <table class="table table-sm"> | 105 | <table class="table table-sm"> | 
| 105 | <thead> | 106 | <thead> | 
| 106 | <tr> | 107 | <tr> | 
| 107 | <th>Lugar</th> | 108 | <th>Lugar</th> | 
| 108 | <th class="text-right">Total cargado</th> | 109 | <th class="text-right">Total cargado</th> | 
| 109 | <th class="text-right">Cantidad</th> | 110 | <th class="text-right">Cantidad</th> | 
| 110 | <th></th> | 111 | <th></th> | 
| 111 | </tr> | 112 | </tr> | 
| 112 | </thead> | 113 | </thead> | 
| 113 | <tbody> | 114 | <tbody> | 
| 114 | <tr ng-repeat="punto in puntosACargar"> | 115 | <tr ng-repeat="punto in puntosACargar"> | 
| 115 | <td ng-bind="punto.descripcion"></td> | 116 | <td ng-bind="punto.descripcion"></td> | 
| 116 | <td ng-bind="punto.cargado" class="text-right"></td> | 117 | <td ng-bind="punto.cargado" class="text-right"></td> | 
| 117 | <td> | 118 | <td> | 
| 118 | <input | 119 | <input | 
| 119 | type="text" | 120 | type="text" | 
| 120 | class="form-control col-4 float-right" | 121 | class="form-control col-4 float-right" | 
| 121 | id="inputCantidad" | 122 | id="inputCantidad" | 
| 122 | placeholder="A cargar" | 123 | placeholder="A cargar" | 
| 123 | ng-model="punto.cantidadACargar" | 124 | ng-model="punto.cantidadACargar" | 
| 124 | ng-keypress="agregarArticulo(punto, $event.keyCode)" | 125 | ng-keypress="agregarArticulo(punto, $event.keyCode)" | 
| 125 | > | 126 | > | 
| 126 | </td> | 127 | </td> | 
| 127 | <td> | 128 | <td> | 
| 128 | <button | 129 | <button | 
| 129 | class="btn btn-sm btn-outline-primary ml-auto" | 130 | class="btn btn-sm btn-outline-primary ml-auto" | 
| 130 | type="button" | 131 | type="button" | 
| 131 | ng-click="agregarArticulo(punto)" | 132 | ng-click="agregarArticulo(punto)" | 
| 132 | > | 133 | > | 
| 133 | Agregar | 134 | Agregar | 
| 134 | </button> | 135 | </button> | 
| 135 | </td> | 136 | </td> | 
| 136 | </tr> | 137 | </tr> | 
| 137 | </tbody> | 138 | </tbody> | 
| 138 | </table> | 139 | </table> | 
| 139 | <table class="table table-sm"> | 140 | <table class="table table-sm"> | 
| 140 | <thead> | 141 | <thead> | 
| 141 | <tr> | 142 | <tr> | 
| 142 | <th>Lugar</th> | 143 | <th>Lugar</th> | 
| 143 | <th>Articulo</th> | 144 | <th>Articulo</th> | 
| 144 | <th class="text-right">Cantidad</th> | 145 | <th class="text-right">Cantidad</th> | 
| 145 | <th></th> | 146 | <th></th> | 
| 146 | </tr> | 147 | </tr> | 
| 147 | </thead> | 148 | </thead> | 
| 148 | <tbody ng-repeat="punto in puntosACargar"> | 149 | <tbody ng-repeat="punto in puntosACargar"> | 
| 149 | <tr ng-repeat="(key, articulo) in punto.articulosAgregados"> | 150 | <tr ng-repeat="(key, articulo) in punto.articulosAgregados"> | 
| 150 | <td ng-bind="punto.descripcion"></td> | 151 | <td ng-bind="punto.descripcion"></td> | 
| 151 | <td ng-bind="articulo.descripcion" class="p-2"></td> | 152 | <td ng-bind="articulo.descripcion" class="p-2"></td> | 
| 152 | <td ng-bind="articulo.cantidad" class="text-right p-2"></td> | 153 | <td ng-bind="articulo.cantidad" class="text-right p-2"></td> | 
| 153 | <td class="p-2"> | 154 | <td class="p-2"> | 
| 154 | <button | 155 | <button | 
| 155 | type="button" | 156 | type="button" | 
| 156 | class="btn btn-xs p-1 float-right mr-5" | 157 | class="btn btn-xs p-1 float-right mr-5" | 
| 157 | ng-click="quitarArticulo(articulo, key, punto)" | 158 | ng-click="quitarArticulo(articulo, key, punto)" | 
| 158 | title="Eliminar"> | 159 | title="Eliminar"> | 
| 159 | <i class="fa fa-trash" aria-hidden="true"></i> | 160 | <i class="fa fa-trash" aria-hidden="true"></i> | 
| 160 | </button> | 161 | </button> | 
| 161 | </td> | 162 | </td> | 
| 162 | </tr> | 163 | </tr> | 
| 163 | </tbody> | 164 | </tbody> | 
| 164 | </table> | 165 | </table> | 
| 165 | </div> | 166 | </div> | 
| 166 | </div> | 167 | </div> | 
| 167 | </div> | 168 | </div> | 
| 168 | </div> | 169 | </div> | 
| 169 | <form ng-show="ingreso"> | 170 | <form ng-show="ingreso"> | 
| 170 | <div class="row"> | 171 | <div class="row"> | 
| 171 | <div class="col-12"> | 172 | <div class="col-12"> | 
| 172 | <label>Descripción</label> | 173 | <label>Descripción</label> | 
| 173 | <input | 174 | <input | 
| 174 | type="text" | 175 | type="text" | 
| 175 | class="form-control form-control-sm" | 176 | class="form-control form-control-sm" | 
| 176 | ng-model="puntoDescarga.descripcion" | 177 | ng-model="puntoDescarga.descripcion" | 
| 177 | foca-focus="ingreso" | 178 | foca-focus="ingreso" | 
| 178 | ng-keypress="guardar($event.keyCode)" | 179 | ng-keypress="guardar($event.keyCode)" | 
| 179 | uppercase-only> | 180 | uppercase-only | 
| 181 | teclado-virtual | ||
| 182 | /> | ||
| 180 | </div> | 183 | </div> | 
| 181 | </div> | 184 | </div> | 
| 182 | <div class="row"> | 185 | <div class="row"> | 
| 183 | <div class="col-6"> | 186 | <div class="col-6"> | 
| 184 | <label>Latitud</label> | 187 | <label>Latitud</label> | 
| 185 | <input | 188 | <input | 
| 186 | type="text" | 189 | type="text" | 
| 187 | class="form-control form-control-sm" | 190 | class="form-control form-control-sm" | 
| 188 | ng-model="puntoDescarga.latitud" | 191 | ng-model="puntoDescarga.latitud" | 
| 189 | ng-required="true" | 192 | ng-required="true" | 
| 190 | ng-readonly="editando" | 193 | ng-readonly="editando" | 
| 194 | teclado-virtual | ||
| 191 | /> | 195 | /> | 
| 192 | </div> | 196 | </div> | 
| 193 | <div class="col-6"> | 197 | <div class="col-6"> | 
| 194 | <label>Longitud</label> | 198 | <label>Longitud</label> | 
| 195 | <input | 199 | <input | 
| 196 | type="text" | 200 | type="text" | 
| 197 | class="form-control form-control-sm" | 201 | class="form-control form-control-sm" | 
| 198 | ng-model="puntoDescarga.longitud" | 202 | ng-model="puntoDescarga.longitud" | 
| 199 | ng-required="true" | 203 | ng-required="true" | 
| 200 | ng-readonly="editando" | 204 | ng-readonly="editando" | 
| 205 | teclado-virtual | ||
| 201 | /> | 206 | /> | 
| 202 | </div> | 207 | </div> | 
| 203 | </div> | 208 | </div> | 
| 204 | <osm-punto-descarga | 209 | <osm-punto-descarga | 
| 205 | latitud="puntoDescarga.latitud" | 210 | latitud="puntoDescarga.latitud" | 
| 206 | longitud="puntoDescarga.longitud" | 211 | longitud="puntoDescarga.longitud" | 
| 207 | zoom="14" | 212 | zoom="14" | 
| 208 | ng-if="ingreso", | 213 | ng-if="ingreso", | 
| 209 | draggable="!editando" | 214 | draggable="!editando" | 
| 210 | /> | 215 | /> | 
| 211 | </form> | 216 | </form> | 
| 212 | </div> | 217 | </div> | 
| 213 | <div class="modal-footer"> | 218 | <div class="modal-footer"> | 
| 214 | <button | 219 | <button | 
| 215 | class="btn btn-sm btn-secondary my-1" | 220 | class="btn btn-sm btn-secondary my-1" | 
| 216 | type="button" | 221 | type="button" | 
| 217 | ng-click="cancel()">Cancelar</button> | 222 | ng-click="cancel()">Cancelar</button> | 
| 218 | <button | 223 | <button | 
| 219 | class="btn btn-sm btn-primary my-1" | 224 | class="btn btn-sm btn-primary my-1" | 
| 220 | type="button" | 225 | type="button" | 
| 221 | ng-click="aceptar()" | 226 | ng-click="aceptar()" | 
| 222 | ng-hide="ingreso">Aceptar</button> | 227 | ng-hide="ingreso">Aceptar</button> | 
| 223 | <button | 228 | <button | 
| 224 | class="btn btn-sm btn-primary my-1" | 229 | class="btn btn-sm btn-primary my-1" | 
| 225 | type="button" | 230 | type="button" | 
| 226 | ng-click="guardar(13)" | 231 | ng-click="guardar(13)" | 
| 227 | ng-show="ingreso">Guardar</button> | 232 | ng-show="ingreso">Guardar</button> | 
| 228 | </div> | 233 | </div> | 
| 229 | 234 |