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