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