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