Commit 012e6078288dba29db8084654bedff63ce471ed0
Exists in
master
and in
1 other branch
Merge branch 'develop' into 'master'
Develop See merge request !18
Showing
3 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 | console.log('filters', filters); | ||
12 | |||
13 | $scope.cantidadArticulo = 0; | 13 | $scope.cantidadArticulo = 0; |
14 | $scope.articuloSeleccionado = 0; | 14 | $scope.articuloSeleccionado = 0; |
15 | $scope.ivas = []; | 15 | $scope.ivas = []; |
16 | $scope.puntosSeleccionados = []; | 16 | $scope.puntosSeleccionados = []; |
17 | $scope.editando = false; | 17 | $scope.editando = false; |
18 | $scope.puntoDescarga = { | 18 | $scope.puntoDescarga = { |
19 | id: 0, | 19 | id: 0, |
20 | id_cliente: filters.idCliente, | 20 | id_cliente: filters.idCliente, |
21 | id_da_config_0: filters.idDomicilio, | 21 | id_da_config_0: filters.idDomicilio, |
22 | latitud: -32.89214159952345, | 22 | latitud: filters.domicilio.Latitud, |
23 | longitud: -68.84572999101856 | 23 | longitud: filters.domicilio.Longitud |
24 | }; | 24 | }; |
25 | |||
25 | $scope.articulos = angular.copy(filters.articulos); | 26 | $scope.articulos = angular.copy(filters.articulos); |
26 | $scope.articulos.map(function(articulo) { | 27 | $scope.articulos.map(function(articulo) { |
27 | articulo.restante = articulo.cantidad; | 28 | articulo.restante = articulo.cantidad; |
28 | }); | 29 | }); |
29 | actualizarTabla(); | 30 | actualizarTabla(); |
30 | cargarPuntos(filters.puntosDescarga); | 31 | cargarPuntos(filters.puntosDescarga); |
31 | 32 | ||
32 | $scope.cancel = function() { | 33 | $scope.cancel = function() { |
33 | if($scope.ingreso) { | 34 | if ($scope.ingreso) { |
34 | $scope.ingreso = false; | 35 | $scope.ingreso = false; |
35 | $scope.puntoDescarga = { | 36 | $scope.puntoDescarga = { |
36 | id: 0, | 37 | id: 0, |
37 | id_cliente: filters.idCliente, | 38 | id_cliente: filters.idCliente, |
38 | id_da_config_0: filters.idDomicilio, | 39 | id_da_config_0: filters.idDomicilio, |
39 | latitud: -32.89214159952345, | 40 | latitud: filters.domicilio.Latitud, |
40 | longitud: -68.84572999101856 | 41 | longitud: filters.domicilio.Longitud |
41 | }; | 42 | }; |
42 | $scope.editando = false; | 43 | $scope.editando = false; |
43 | }else { | 44 | } else { |
44 | $uibModalInstance.dismiss('cancel'); | 45 | $uibModalInstance.dismiss('cancel'); |
45 | } | 46 | } |
46 | }; | 47 | }; |
47 | 48 | ||
48 | $scope.aceptar = function() { | 49 | $scope.aceptar = function() { |
49 | if($scope.cargaArticulos) { | 50 | if ($scope.cargaArticulos) { |
50 | cargarArticulos(); | 51 | cargarArticulos(); |
51 | }else if(!$scope.puntosSeleccionados.length) { | 52 | } else if(!$scope.puntosSeleccionados.length) { |
52 | $uibModalInstance.dismiss('cancel'); | 53 | $uibModalInstance.dismiss('cancel'); |
53 | }else { | 54 | } else { |
54 | enviarPuntos(); | 55 | enviarPuntos(); |
55 | } | 56 | } |
56 | }; | 57 | }; |
57 | 58 | ||
58 | $scope.guardar = function(key) { | 59 | $scope.guardar = function(key) { |
59 | if(key === 13) { | 60 | if(key === 13) { |
60 | focaModalPuntoDescargaService | 61 | focaModalPuntoDescargaService |
61 | .guardarPuntoDescarga($scope.puntoDescarga) | 62 | .guardarPuntoDescarga($scope.puntoDescarga) |
62 | .then(function() { | 63 | .then(function() { |
63 | actualizarTabla(); | 64 | actualizarTabla(); |
64 | $scope.ingreso = false; | 65 | $scope.ingreso = false; |
65 | $scope.puntoDescarga = { | 66 | $scope.puntoDescarga = { |
66 | id: 0, | 67 | id: 0, |
67 | id_cliente: filters.idCliente, | 68 | id_cliente: filters.idCliente, |
68 | id_da_config_0: filters.idDomicilio, | 69 | id_da_config_0: filters.idDomicilio, |
69 | latitud: -32.89214159952345, | 70 | latitud: filters.domicilio.Latitud, |
70 | longitud: -68.84572999101856 | 71 | longitud: filters.domicilio.Longitud |
71 | }; | 72 | }; |
72 | $scope.editando = false; | 73 | $scope.editando = false; |
73 | }); | 74 | }); |
74 | } | 75 | } |
75 | }; | 76 | }; |
76 | 77 | ||
77 | $scope.editar = function(id) { | 78 | $scope.editar = function(id) { |
78 | focaModalPuntoDescargaService.getPuntoDescargaById(id).then(function(res) { | 79 | focaModalPuntoDescargaService.getPuntoDescargaById(id).then(function(res) { |
79 | $scope.puntoDescarga = res.data; | 80 | $scope.puntoDescarga = res.data; |
80 | $scope.ingreso = true; | 81 | $scope.ingreso = true; |
81 | $scope.editando = true; | 82 | $scope.editando = true; |
82 | }); | 83 | }); |
83 | }; | 84 | }; |
84 | 85 | ||
85 | $scope.eliminar = function(idx, puntoDescarga) { | 86 | $scope.eliminar = function(idx, puntoDescarga) { |
86 | focaModalService.confirm('¿Está seguro que desea borrar el punto de descarga '+ | 87 | focaModalService.confirm('¿Está seguro que desea borrar el punto de descarga '+ |
87 | puntoDescarga.descripcion + '?').then(function(data) { | 88 | puntoDescarga.descripcion + '?').then(function(data) { |
88 | if(data) { | 89 | if (data) { |
89 | focaModalPuntoDescargaService | 90 | focaModalPuntoDescargaService |
90 | .eliminarPuntoDescarga(puntoDescarga.id) | 91 | .eliminarPuntoDescarga(puntoDescarga.id) |
91 | .then(function() { | 92 | .then(function() { |
92 | $scope.puntosDescarga.splice(idx, 1); | 93 | $scope.puntosDescarga.splice(idx, 1); |
93 | }); | 94 | }); |
94 | } | 95 | } |
95 | }); | 96 | }); |
96 | }; | 97 | }; |
97 | 98 | ||
98 | $scope.seleccionarPunto = function(idx, esCheckbox) { | 99 | $scope.seleccionarPunto = function(idx, esCheckbox) { |
99 | var indexPunto = $scope.puntosSeleccionados.indexOf(idx); | 100 | var indexPunto = $scope.puntosSeleccionados.indexOf(idx); |
100 | if(indexPunto !== -1) { | 101 | if (indexPunto !== -1) { |
101 | if(!esCheckbox){ | 102 | if (!esCheckbox) { |
102 | $scope.puntosDescarga[idx].seleccionado = false; | 103 | $scope.puntosDescarga[idx].seleccionado = false; |
103 | } | 104 | } |
104 | $scope.puntosSeleccionados.splice(indexPunto, 1); | 105 | $scope.puntosSeleccionados.splice(indexPunto, 1); |
105 | }else { | 106 | } else { |
106 | if(!esCheckbox){ | 107 | if (!esCheckbox) { |
107 | $scope.puntosDescarga[idx].seleccionado = true; | 108 | $scope.puntosDescarga[idx].seleccionado = true; |
108 | } | 109 | } |
109 | $scope.puntosSeleccionados.push(idx); | 110 | $scope.puntosSeleccionados.push(idx); |
110 | } | 111 | } |
111 | }; | 112 | }; |
112 | 113 | ||
113 | $scope.agregarArticulo = function(punto, key) { | 114 | $scope.agregarArticulo = function(punto, key) { |
114 | key = (typeof key === 'undefined') ? 13 : key; | 115 | key = (typeof key === 'undefined') ? 13 : key; |
115 | 116 | ||
116 | if(key === 13){ | 117 | if (key === 13) { |
117 | var articulo = $scope.articulos[$scope.articuloSeleccionado], | 118 | var articulo = $scope.articulos[$scope.articuloSeleccionado], |
118 | cantidadRestante = articulo.restante - punto.cantidadACargar; | 119 | cantidadRestante = articulo.restante - punto.cantidadACargar; |
119 | 120 | ||
120 | if(cantidadRestante < 0) { | 121 | if (cantidadRestante < 0) { |
121 | focaModalService | 122 | focaModalService |
122 | .alert('La cantidad a cargar debe ser menor o igual al restante'); | 123 | .alert('La cantidad a cargar debe ser menor o igual al restante'); |
123 | }else if(punto.cantidadACargar <= 0) { | 124 | } else if (punto.cantidadACargar <= 0) { |
124 | focaModalService | 125 | focaModalService |
125 | .alert('La cantidad a cargar debe ser mayor que cero'); | 126 | .alert('La cantidad a cargar debe ser mayor que cero'); |
126 | }else { | 127 | } else { |
127 | punto.cargado += parseInt(punto.cantidadACargar); | 128 | punto.cargado += parseInt(punto.cantidadACargar); |
128 | articulo.restante = cantidadRestante; | 129 | articulo.restante = cantidadRestante; |
129 | var existeArticulo = punto.articulosAgregados.filter( | 130 | var existeArticulo = punto.articulosAgregados.filter( |
130 | function (articuloAAgregar) { | 131 | function (articuloAAgregar) { |
131 | return articuloAAgregar.id === articulo.idArticulo; | 132 | return articuloAAgregar.id === articulo.idArticulo; |
132 | }); | 133 | }); |
133 | //Si el articulo ya fue agregado | 134 | //Si el articulo ya fue agregado |
134 | if(existeArticulo.length) { | 135 | if (existeArticulo.length) { |
135 | //Solo sumo cantidad | 136 | //Solo sumo cantidad |
136 | var total = parseInt(existeArticulo[0].cantidad) + | 137 | var total = parseInt(existeArticulo[0].cantidad) + |
137 | parseInt(punto.cantidadACargar); | 138 | parseInt(punto.cantidadACargar); |
138 | existeArticulo[0].cantidad = total; | 139 | existeArticulo[0].cantidad = total; |
139 | }else { | 140 | } else { |
140 | //Agrego el articulo con la cantidad | 141 | //Agrego el articulo con la cantidad |
141 | punto.articulosAgregados.push({ | 142 | punto.articulosAgregados.push({ |
142 | id: articulo.idArticulo, | 143 | id: articulo.idArticulo, |
143 | descripcion: articulo.descripcion, | 144 | descripcion: articulo.descripcion, |
144 | cantidad: punto.cantidadACargar, | 145 | cantidad: punto.cantidadACargar, |
145 | index: $scope.articuloSeleccionado | 146 | index: $scope.articuloSeleccionado |
146 | }); | 147 | }); |
147 | } | 148 | } |
148 | punto.cantidadACargar = 0; | 149 | punto.cantidadACargar = 0; |
149 | } | 150 | } |
150 | } | 151 | } |
151 | }; | 152 | }; |
152 | 153 | ||
153 | $scope.quitarArticulo = function(articulo, idx, punto) { | 154 | $scope.quitarArticulo = function(articulo, idx, punto) { |
154 | var articuloAEliminar = $scope.articulos.filter(function(art) { | 155 | var articuloAEliminar = $scope.articulos.filter(function(art) { |
155 | return art.id === articulo.id; | 156 | return art.id === articulo.id; |
156 | }); | 157 | }); |
157 | var restante = parseInt(articuloAEliminar[0].restante); | 158 | var restante = parseInt(articuloAEliminar[0].restante); |
158 | restante += parseInt(articulo.cantidad); | 159 | restante += parseInt(articulo.cantidad); |
159 | articuloAEliminar[0].restante = restante; | 160 | articuloAEliminar[0].restante = restante; |
160 | 161 | ||
161 | punto.cargado -= parseInt(punto.articulosAgregados[idx].cantidad); | 162 | punto.cargado -= parseInt(punto.articulosAgregados[idx].cantidad); |
162 | punto.articulosAgregados.splice(idx, 1); | 163 | punto.articulosAgregados.splice(idx, 1); |
163 | }; | 164 | }; |
164 | 165 | ||
165 | function actualizarTabla() { | 166 | function actualizarTabla() { |
166 | focaModalPuntoDescargaService | 167 | focaModalPuntoDescargaService |
167 | .getPuntosDescargaByClienDom(filters.idDomicilio, filters.idCliente) | 168 | .getPuntosDescargaByClienDom(filters.idDomicilio, filters.idCliente) |
168 | .then(function(res) { | 169 | .then(function(res) { |
169 | $scope.puntosDescarga = res.data; | 170 | $scope.puntosDescarga = res.data; |
170 | }); | 171 | }); |
171 | } | 172 | } |
172 | function verCargaArticulos() { | 173 | function verCargaArticulos() { |
173 | $scope.puntosACargar = []; | 174 | $scope.puntosACargar = []; |
174 | $scope.cargaArticulos = true; | 175 | $scope.cargaArticulos = true; |
175 | $scope.puntosSeleccionados.forEach(function(idx) { | 176 | $scope.puntosSeleccionados.forEach(function(idx) { |
176 | $scope.puntosACargar.push($scope.puntosDescarga[idx]); | 177 | $scope.puntosACargar.push($scope.puntosDescarga[idx]); |
177 | }); | 178 | }); |
178 | 179 | ||
179 | $scope.puntosACargar.map(function(punto) { | 180 | $scope.puntosACargar.map(function(punto) { |
180 | punto.articulosAgregados = []; | 181 | punto.articulosAgregados = []; |
181 | punto.cantidadACargar = 0; | 182 | punto.cantidadACargar = 0; |
182 | punto.cargado = 0; | 183 | punto.cargado = 0; |
183 | }); | 184 | }); |
184 | } | 185 | } |
185 | function cargarArticulos() { | 186 | function cargarArticulos() { |
186 | $uibModalInstance.close($scope.puntosACargar); | 187 | $uibModalInstance.close($scope.puntosACargar); |
187 | } | 188 | } |
188 | function cargarPuntos(puntosDescarga) { | 189 | function cargarPuntos(puntosDescarga) { |
189 | //Si existen puntos ya cargados | 190 | //Si existen puntos ya cargados |
190 | if(puntosDescarga) { | 191 | if (puntosDescarga) { |
191 | if(!puntosDescarga[0].cargado) { | 192 | if (!puntosDescarga[0].cargado) { |
192 | agregarTotalCargado(puntosDescarga); | 193 | agregarTotalCargado(puntosDescarga); |
193 | } | 194 | } |
194 | $scope.puntosACargar = puntosDescarga; | 195 | $scope.puntosACargar = puntosDescarga; |
195 | $scope.cargaArticulos = true; | 196 | $scope.cargaArticulos = true; |
196 | //Recorro los puntos | 197 | //Recorro los puntos |
197 | puntosDescarga.forEach(function(punto) { | 198 | puntosDescarga.forEach(function(punto) { |
198 | //Recorro los articulos cargados en cada punto | 199 | //Recorro los articulos cargados en cada punto |
199 | punto.articulosAgregados.forEach(function(articulo) { | 200 | punto.articulosAgregados.forEach(function(articulo) { |
200 | var articuloARestar = $scope.articulos.filter(function(art) { | 201 | var articuloARestar = $scope.articulos.filter(function(art) { |
201 | return art.idArticulo === articulo.id; | 202 | return art.idArticulo === articulo.id; |
202 | }); | 203 | }); |
203 | articuloARestar[0].restante -= articulo.cantidad; | 204 | articuloARestar[0].restante -= articulo.cantidad; |
204 | }); | 205 | }); |
205 | }); | 206 | }); |
206 | } | 207 | } |
207 | } | 208 | } |
208 | function agregarTotalCargado(puntosDescarga) { | 209 | function agregarTotalCargado(puntosDescarga) { |
209 | puntosDescarga.map(function(punto) { | 210 | puntosDescarga.map(function(punto) { |
210 | punto.cantidadACargar = 0; | 211 | punto.cantidadACargar = 0; |
211 | punto.cargado = 0; | 212 | punto.cargado = 0; |
212 | }); | 213 | }); |
213 | //Agrego cantidad de combustible cargada en los puntos de descarga | 214 | //Agrego cantidad de combustible cargada en los puntos de descarga |
214 | puntosDescarga.forEach(function(punto) { | 215 | puntosDescarga.forEach(function(punto) { |
215 | punto.articulosAgregados.forEach(function(articulo) { | 216 | punto.articulosAgregados.forEach(function(articulo) { |
216 | punto.cargado += articulo.cantidad; | 217 | punto.cargado += articulo.cantidad; |
217 | }); | 218 | }); |
218 | }); | 219 | }); |
219 | } | 220 | } |
220 | function enviarPuntos() { | 221 | function enviarPuntos() { |
221 | var result = []; | 222 | var result = []; |
222 | $scope.puntosSeleccionados.forEach(function(idx) { | 223 | $scope.puntosSeleccionados.forEach(function(idx) { |
223 | result.push($scope.puntosDescarga[idx]); | 224 | result.push($scope.puntosDescarga[idx]); |
224 | }); | 225 | }); |
225 | $uibModalInstance.close(result); | 226 | $uibModalInstance.close(result); |
226 | } | 227 | } |
227 | }] | 228 | }] |
src/js/osm-directive.js
1 | angular.module('focaModalPuntoDescarga').directive('osmPuntoDescarga', function() { | 1 | angular.module('focaModalPuntoDescarga').directive('osmPuntoDescarga', function() { |
2 | return { | 2 | return { |
3 | restrict: 'E', | 3 | restrict: 'E', |
4 | link: function(scope, el, attrs) { | 4 | link: function(scope, el, attrs) { |
5 | var contenedor = document.createElement('div'); | 5 | var contenedor = document.createElement('div'); |
6 | contenedor.className = 'w-100 h-50 mt-3'; | 6 | contenedor.className = 'w-100 h-50 mt-3'; |
7 | el.append(contenedor); | 7 | el.append(contenedor); |
8 | scope.map = L.map(contenedor).setView([-32.89214159952345, -68.84572999101856], attrs.zoom); | 8 | scope.map = L.map(contenedor); |
9 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); | 9 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); |
10 | }, | 10 | }, |
11 | controller: ['$scope', '$timeout', function($scope, $timeout) { | 11 | controller: ['$scope', '$timeout', function($scope, $timeout) { |
12 | //resuelve bug mapa gris en modales | 12 | //resuelve bug mapa gris en modales |
13 | $timeout(function() { | 13 | $timeout(function() { |
14 | $scope.map.invalidateSize(); | 14 | $scope.map.invalidateSize(); |
15 | }, 100); | 15 | }, 100); |
16 | 16 | ||
17 | $scope.markers = []; | 17 | $scope.markers = []; |
18 | $scope.$watchGroup(['latitud', 'longitud'], function() { | 18 | $scope.$watchGroup(['latitud', 'longitud'], function() { |
19 | for(var i in $scope.markers) { | 19 | for(var i in $scope.markers) { |
20 | $scope.map.removeLayer($scope.markers[i]); | 20 | $scope.map.removeLayer($scope.markers[i]); |
21 | } | 21 | } |
22 | $scope.map.setView([$scope.latitud, $scope.longitud], 14); | ||
22 | $scope.markers.push( | 23 | $scope.markers.push( |
23 | L.marker([$scope.latitud, $scope.longitud], {draggable: $scope.draggable}) | 24 | L.marker([$scope.latitud, $scope.longitud], {draggable: true}) |
24 | .addTo($scope.map) | 25 | .addTo($scope.map) |
25 | .on('dragend', function() { | 26 | .on('dragend', function() { |
26 | $scope.latitud = this.getLatLng().lat; | 27 | $scope.latitud = this.getLatLng().lat; |
27 | $scope.longitud = this.getLatLng().lng; | 28 | $scope.longitud = this.getLatLng().lng; |
28 | $scope.$apply(); | 29 | $scope.$apply(); |
29 | }) | 30 | }) |
30 | ); | 31 | ); |
31 | }); | 32 | }); |
32 | }], | 33 | }], |
33 | scope: { | 34 | scope: { |
34 | latitud: '=', | 35 | latitud: '=', |
35 | longitud: '=', | 36 | longitud: '=', |
36 | zoom: '=', | 37 | zoom: '=' |
37 | draggable: '<' | ||
38 | } | 38 | } |
39 | }; | 39 | }; |
40 | }); | 40 | }); |
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 |