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