Commit 6d6faf043ee6b8d34c6b63ec18c0ec994e81d2d4
1 parent
76955028f0
Exists in
master
pregunta antes de eliminar
Showing
2 changed files
with
20 additions
and
10 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, puntoDescarga) { |
71 | focaModalPuntoDescargaService.eliminarPuntoDescarga(id).then(function() { | 71 | focaModalService.confirm('¿Está seguro que desea borrar el punto de descarga '+ |
72 | $scope.puntosDescarga.splice(idx, 1); | 72 | puntoDescarga.descripcion + '?').then(function(data) { |
73 | }); | 73 | if(data) { |
74 | focaModalPuntoDescargaService | ||
75 | .eliminarPuntoDescarga(puntoDescarga.id) | ||
76 | .then(function() { | ||
77 | $scope.puntosDescarga.splice(idx, 1); | ||
78 | }); | ||
79 | } | ||
80 | }); | ||
74 | }; | 81 | }; |
75 | 82 | ||
76 | $scope.seleccionarPunto = function(idx, esCheckbox) { | 83 | $scope.seleccionarPunto = function(idx, esCheckbox) { |
77 | var indexPunto = $scope.puntosSeleccionados.indexOf(idx); | 84 | var indexPunto = $scope.puntosSeleccionados.indexOf(idx); |
78 | if(indexPunto !== -1) { | 85 | if(indexPunto !== -1) { |
79 | if(!esCheckbox){ | 86 | if(!esCheckbox){ |
80 | $scope.puntosDescarga[idx].seleccionado = false; | 87 | $scope.puntosDescarga[idx].seleccionado = false; |
81 | } | 88 | } |
82 | $scope.puntosSeleccionados.splice(indexPunto, 1); | 89 | $scope.puntosSeleccionados.splice(indexPunto, 1); |
83 | }else { | 90 | }else { |
84 | if(!esCheckbox){ | 91 | if(!esCheckbox){ |
85 | $scope.puntosDescarga[idx].seleccionado = true; | 92 | $scope.puntosDescarga[idx].seleccionado = true; |
86 | } | 93 | } |
87 | $scope.puntosSeleccionados.push(idx); | 94 | $scope.puntosSeleccionados.push(idx); |
88 | } | 95 | } |
89 | }; | 96 | }; |
90 | 97 | ||
91 | $scope.agregarArticulo = function(punto, key) { | 98 | $scope.agregarArticulo = function(punto, key) { |
92 | key = (typeof key === 'undefined') ? 13 : key; | 99 | key = (typeof key === 'undefined') ? 13 : key; |
93 | 100 | ||
94 | if(key === 13){ | 101 | if(key === 13){ |
95 | var articulo = $scope.articulos[$scope.articuloSeleccionado], | 102 | var articulo = $scope.articulos[$scope.articuloSeleccionado], |
96 | cantidadRestante = articulo.restante - punto.cantidadACargar; | 103 | cantidadRestante = articulo.restante - punto.cantidadACargar; |
97 | 104 | ||
98 | if(cantidadRestante < 0) { | 105 | if(cantidadRestante < 0) { |
99 | focaModalService.alert('La cantidad a cargar debe ser menor o igual al restante'); | 106 | focaModalService |
107 | .alert('La cantidad a cargar debe ser menor o igual al restante'); | ||
100 | }else if(punto.cantidadACargar <= 0) { | 108 | }else if(punto.cantidadACargar <= 0) { |
101 | focaModalService.alert('La cantidad a cargar debe ser mayor que cero'); | 109 | focaModalService |
110 | .alert('La cantidad a cargar debe ser mayor que cero'); | ||
102 | }else { | 111 | }else { |
103 | punto.cargado += parseInt(punto.cantidadACargar); | 112 | punto.cargado += parseInt(punto.cantidadACargar); |
104 | articulo.restante = cantidadRestante; | 113 | articulo.restante = cantidadRestante; |
105 | var existeArticulo = punto.articulosAgregados.filter( | 114 | var existeArticulo = punto.articulosAgregados.filter( |
106 | function (articuloAAgregar) { | 115 | function (articuloAAgregar) { |
107 | return articuloAAgregar.id === articulo.idArticulo; | 116 | return articuloAAgregar.id === articulo.idArticulo; |
108 | }); | 117 | }); |
109 | //Si el articulo ya fue agregado | 118 | //Si el articulo ya fue agregado |
110 | if(existeArticulo.length) { | 119 | if(existeArticulo.length) { |
111 | //Solo sumo cantidad | 120 | //Solo sumo cantidad |
112 | var total = parseInt(existeArticulo[0].cantidad) + parseInt(punto.cantidadACargar); | 121 | var total = parseInt(existeArticulo[0].cantidad) + |
122 | parseInt(punto.cantidadACargar); | ||
113 | existeArticulo[0].cantidad = total; | 123 | existeArticulo[0].cantidad = total; |
114 | }else { | 124 | }else { |
115 | //Agrego el articulo con la cantidad | 125 | //Agrego el articulo con la cantidad |
116 | punto.articulosAgregados.push({ | 126 | punto.articulosAgregados.push({ |
117 | id: articulo.idArticulo, | 127 | id: articulo.idArticulo, |
118 | descripcion: articulo.descripcion, | 128 | descripcion: articulo.descripcion, |
119 | cantidad: punto.cantidadACargar, | 129 | cantidad: punto.cantidadACargar, |
120 | index: $scope.articuloSeleccionado | 130 | index: $scope.articuloSeleccionado |
121 | }); | 131 | }); |
122 | } | 132 | } |
123 | punto.cantidadACargar = 0; | 133 | punto.cantidadACargar = 0; |
124 | } | 134 | } |
125 | } | 135 | } |
126 | }; | 136 | }; |
127 | 137 | ||
128 | $scope.quitarArticulo = function(articulo, idx, punto) { | 138 | $scope.quitarArticulo = function(articulo, idx, punto) { |
129 | var articuloAEliminar = $scope.articulos.filter(function(art) { | 139 | var articuloAEliminar = $scope.articulos.filter(function(art) { |
130 | return art.id == articulo.id; | 140 | return art.id === articulo.id; |
131 | }); | 141 | }); |
132 | var restante = parseInt(articuloAEliminar[0].restante); | 142 | var restante = parseInt(articuloAEliminar[0].restante); |
133 | restante += parseInt(articulo.cantidad); | 143 | restante += parseInt(articulo.cantidad); |
134 | articuloAEliminar[0].restante = restante; | 144 | articuloAEliminar[0].restante = restante; |
135 | 145 | ||
136 | punto.cargado -= parseInt(punto.articulosAgregados[idx].cantidad); | 146 | punto.cargado -= parseInt(punto.articulosAgregados[idx].cantidad); |
137 | punto.articulosAgregados.splice(idx, 1); | 147 | punto.articulosAgregados.splice(idx, 1); |
138 | }; | 148 | }; |
139 | 149 | ||
140 | function actualizarTabla() { | 150 | function actualizarTabla() { |
141 | focaModalPuntoDescargaService | 151 | focaModalPuntoDescargaService |
142 | .getPuntosDescargaByClienDom(filters.idDomicilio, filters.idCliente) | 152 | .getPuntosDescargaByClienDom(filters.idDomicilio, filters.idCliente) |
143 | .then(function(res) { | 153 | .then(function(res) { |
144 | $scope.puntosDescarga = res.data; | 154 | $scope.puntosDescarga = res.data; |
145 | }); | 155 | }); |
146 | } | 156 | } |
147 | function verCargaArticulos() { | 157 | function verCargaArticulos() { |
148 | $scope.puntosACargar = []; | 158 | $scope.puntosACargar = []; |
149 | $scope.cargaArticulos = true; | 159 | $scope.cargaArticulos = true; |
150 | $scope.puntosSeleccionados.forEach(function(idx) { | 160 | $scope.puntosSeleccionados.forEach(function(idx) { |
151 | $scope.puntosACargar.push($scope.puntosDescarga[idx]); | 161 | $scope.puntosACargar.push($scope.puntosDescarga[idx]); |
152 | }); | 162 | }); |
153 | 163 | ||
154 | $scope.puntosACargar.map(function(punto) { | 164 | $scope.puntosACargar.map(function(punto) { |
155 | punto.articulosAgregados = []; | 165 | punto.articulosAgregados = []; |
156 | punto.cantidadACargar = 0; | 166 | punto.cantidadACargar = 0; |
157 | punto.cargado = 0; | 167 | punto.cargado = 0; |
158 | }); | 168 | }); |
159 | } | 169 | } |
160 | function cargarArticulos() { | 170 | function cargarArticulos() { |
161 | $uibModalInstance.close($scope.puntosACargar); | 171 | $uibModalInstance.close($scope.puntosACargar); |
162 | } | 172 | } |
163 | function cargarPuntos(puntosDescarga) { | 173 | function cargarPuntos(puntosDescarga) { |
164 | //Si existen puntos ya cargados | 174 | //Si existen puntos ya cargados |
165 | if(puntosDescarga) { | 175 | if(puntosDescarga) { |
166 | if(!puntosDescarga[0].cargado) { | 176 | if(!puntosDescarga[0].cargado) { |
167 | agregarTotalCargado(puntosDescarga); | 177 | agregarTotalCargado(puntosDescarga); |
168 | } | 178 | } |
169 | $scope.puntosACargar = puntosDescarga; | 179 | $scope.puntosACargar = puntosDescarga; |
170 | $scope.cargaArticulos = true; | 180 | $scope.cargaArticulos = true; |
171 | //Recorro los puntos | 181 | //Recorro los puntos |
172 | puntosDescarga.forEach(function(punto) { | 182 | puntosDescarga.forEach(function(punto) { |
173 | //Recorro los articulos cargados en cada punto | 183 | //Recorro los articulos cargados en cada punto |
174 | punto.articulosAgregados.forEach(function(articulo) { | 184 | punto.articulosAgregados.forEach(function(articulo) { |
175 | var articuloARestar = $scope.articulos.filter(function(art) { | 185 | var articuloARestar = $scope.articulos.filter(function(art) { |
176 | return art.idArticulo == articulo.id; | 186 | return art.idArticulo === articulo.id; |
177 | }); | 187 | }); |
178 | articuloARestar[0].restante -= articulo.cantidad; | 188 | articuloARestar[0].restante -= articulo.cantidad; |
179 | }); | 189 | }); |
180 | }); | 190 | }); |
181 | } | 191 | } |
182 | } | 192 | } |
183 | function agregarTotalCargado(puntosDescarga) { | 193 | function agregarTotalCargado(puntosDescarga) { |
184 | puntosDescarga.map(function(punto) { | 194 | puntosDescarga.map(function(punto) { |
185 | punto.cantidadACargar = 0; | 195 | punto.cantidadACargar = 0; |
186 | punto.cargado = 0; | 196 | punto.cargado = 0; |
187 | }); | 197 | }); |
188 | //Agrego cantidad de combustible cargada en los puntos de descarga | 198 | //Agrego cantidad de combustible cargada en los puntos de descarga |
189 | puntosDescarga.forEach(function(punto) { | 199 | puntosDescarga.forEach(function(punto) { |
190 | punto.articulosAgregados.forEach(function(articulo) { | 200 | punto.articulosAgregados.forEach(function(articulo) { |
191 | punto.cargado += articulo.cantidad; | 201 | punto.cargado += articulo.cantidad; |
192 | }); | 202 | }); |
193 | }); | 203 | }); |
194 | } | 204 | } |
195 | }] | 205 | }] |
196 | ); | 206 | ); |
197 | 207 |
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 | 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.id)" | 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 | /> | 196 | /> |
197 | </div> | 197 | </div> |
198 | <div class="col-6"> | 198 | <div class="col-6"> |
199 | <label>Longitud</label> | 199 | <label>Longitud</label> |
200 | <input | 200 | <input |
201 | type="text" | 201 | type="text" |
202 | class="form-control form-control-sm" | 202 | class="form-control form-control-sm" |
203 | ng-model="puntoDescarga.longitud" | 203 | ng-model="puntoDescarga.longitud" |
204 | ng-required="true" | 204 | ng-required="true" |
205 | /> | 205 | /> |
206 | </div> | 206 | </div> |
207 | </div> | 207 | </div> |
208 | <osm-punto-descarga | 208 | <osm-punto-descarga |
209 | latitud="puntoDescarga.latitud" | 209 | latitud="puntoDescarga.latitud" |
210 | longitud="puntoDescarga.longitud" | 210 | longitud="puntoDescarga.longitud" |
211 | zoom="14" | 211 | zoom="14" |
212 | ng-if="ingreso" | 212 | ng-if="ingreso" |
213 | /> | 213 | /> |
214 | </form> | 214 | </form> |
215 | </div> | 215 | </div> |
216 | <div class="modal-footer"> | 216 | <div class="modal-footer"> |
217 | <button | 217 | <button |
218 | class="btn btn-sm btn-secondary my-1" | 218 | class="btn btn-sm btn-secondary my-1" |
219 | type="button" | 219 | type="button" |
220 | ng-click="cancel()">Cancelar</button> | 220 | ng-click="cancel()">Cancelar</button> |
221 | <button | 221 | <button |
222 | class="btn btn-sm btn-primary my-1" | 222 | class="btn btn-sm btn-primary my-1" |
223 | type="button" | 223 | type="button" |
224 | ng-click="aceptar()" | 224 | ng-click="aceptar()" |
225 | ng-hide="ingreso">Aceptar</button> | 225 | ng-hide="ingreso">Aceptar</button> |
226 | <button | 226 | <button |
227 | class="btn btn-sm btn-primary my-1" | 227 | class="btn btn-sm btn-primary my-1" |
228 | type="button" | 228 | type="button" |
229 | ng-click="guardar()" | 229 | ng-click="guardar()" |
230 | ng-show="ingreso">Guardar</button> | 230 | ng-show="ingreso">Guardar</button> |
231 | </div> | 231 | </div> |
232 | 232 |