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