Commit dc17cb33d1788da8d44b9bfc1355f2feab72c45a
Exists in
master
Merge branch 'master' into 'master'
Master See merge request !4
Showing
5 changed files
Show diff stats
index.html
File was created | 1 | <html ng-app="focaModalPuntoDescarga"> | |
2 | <head> | ||
3 | <meta charset="UTF-8"/> | ||
4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
5 | |||
6 | <!--CSS--> | ||
7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> | ||
8 | <link href="node_modules/leaflet/dist/leaflet.css" rel="stylesheet"/> | ||
9 | <style> | ||
10 | osm>div { | ||
11 | width: 100%; | ||
12 | height: 576px; | ||
13 | } | ||
14 | </style> | ||
15 | |||
16 | <!--VENDOR JS--> | ||
17 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | ||
18 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | ||
19 | <script src="node_modules/angular/angular.min.js"></script> | ||
20 | <script src="node_modules/angular-route/angular-route.min.js"></script> | ||
21 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | ||
22 | <script src="node_modules/leaflet/dist/leaflet.js"></script> | ||
23 | |||
24 | <!-- BUILD --> | ||
25 | <script src="src/js/app.js"></script> | ||
26 | <script src="src/js/controller.js"></script> | ||
27 | <script src="src/js/route.js"></script> | ||
28 | <script src="src/js/service.js"></script> | ||
29 | <script src="src/js/osm-directive.js"></script> | ||
30 | <!-- /BUILD --> | ||
31 | |||
32 | <!-- CONFIG PARA DEVELOP --> | ||
33 | <script src="src/etc/develop.js"></script> | ||
34 | </head> | ||
35 | <body> | ||
36 | <div ng-view class="container-fluid"></div> | ||
37 | </body> | ||
38 | </html> | ||
39 |
package.json
1 | { | 1 | { |
2 | "name": "foca-modal-punto-descarga", | 2 | "name": "foca-modal-punto-descarga", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Modal para seleccionar punto de descarga", | 4 | "description": "Modal para seleccionar punto de descarga", |
5 | "main": "index.js", | 5 | "main": "index.js", |
6 | "scripts": { | 6 | "scripts": { |
7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
8 | "gulp-pre-commit": "gulp pre-commit", | 8 | "gulp-pre-commit": "gulp pre-commit", |
9 | "compile": "gulp uglify", | 9 | "compile": "gulp uglify", |
10 | "postinstall": "npm run compile && gulp clean-post-install", | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
11 | "install-dev": "npm i --ignore-scripts" | 11 | "install-dev": "npm i --ignore-scripts" |
12 | }, | 12 | }, |
13 | "pre-commit": [ | 13 | "pre-commit": [ |
14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
15 | ], | 15 | ], |
16 | "repository": { | 16 | "repository": { |
17 | "type": "git", | 17 | "type": "git", |
18 | "url": "http://git.focasoftware.com/npm/foca-modal-punto-descarga.git" | 18 | "url": "http://git.focasoftware.com/npm/foca-modal-punto-descarga.git" |
19 | }, | 19 | }, |
20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
21 | "license": "ISC", | 21 | "license": "ISC", |
22 | "peerDependencies": { | 22 | "peerDependencies": { |
23 | "angular": "^1.7.4", | 23 | "angular": "^1.7.4", |
24 | "bootstrap": "^4.1.3", | 24 | "bootstrap": "^4.1.3", |
25 | "font-awesome": "^4.7.0", | 25 | "font-awesome": "^4.7.0", |
26 | "ui-bootstrap4": "^3.0.4", | 26 | "ui-bootstrap4": "^3.0.4", |
27 | "gulp": "^3.9.1", | 27 | "gulp": "^3.9.1", |
28 | "gulp-angular-templatecache": "^2.2.1", | 28 | "gulp-angular-templatecache": "^2.2.1", |
29 | "gulp-concat": "^2.6.1", | 29 | "gulp-concat": "^2.6.1", |
30 | "gulp-connect": "^5.6.1", | 30 | "gulp-connect": "^5.6.1", |
31 | "gulp-htmlmin": "^5.0.1", | 31 | "gulp-htmlmin": "^5.0.1", |
32 | "gulp-rename": "^1.4.0", | 32 | "gulp-rename": "^1.4.0", |
33 | "gulp-replace": "^1.0.0", | 33 | "gulp-replace": "^1.0.0", |
34 | "gulp-uglify": "^3.0.1", | 34 | "gulp-uglify": "^3.0.1", |
35 | "jquery": "^3.3.1", | 35 | "jquery": "^3.3.1", |
36 | "pump": "^3.0.0", | 36 | "pump": "^3.0.0", |
37 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git" | 37 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git" |
38 | }, | 38 | }, |
39 | "devDependencies": { | 39 | "devDependencies": { |
40 | "angular": "^1.7.5", | 40 | "angular": "^1.7.5", |
41 | "angular-ladda": "^0.4.3", | 41 | "angular-ladda": "^0.4.3", |
42 | "bootstrap": "^4.1.3", | 42 | "bootstrap": "^4.1.3", |
43 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | 43 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", |
44 | "font-awesome": "^4.7.0", | 44 | "font-awesome": "^4.7.0", |
45 | "gulp": "^3.9.1", | 45 | "gulp": "^3.9.1", |
46 | "gulp-angular-templatecache": "^2.2.5", | 46 | "gulp-angular-templatecache": "^2.2.5", |
47 | "gulp-clean": "^0.4.0", | 47 | "gulp-clean": "^0.4.0", |
48 | "gulp-concat": "^2.6.1", | 48 | "gulp-concat": "^2.6.1", |
49 | "gulp-connect": "^5.6.1", | 49 | "gulp-connect": "^5.6.1", |
50 | "gulp-htmlmin": "^5.0.1", | 50 | "gulp-htmlmin": "^5.0.1", |
51 | "gulp-jshint": "^2.1.0", | 51 | "gulp-jshint": "^2.1.0", |
52 | "gulp-rename": "^1.4.0", | 52 | "gulp-rename": "^1.4.0", |
53 | "gulp-replace": "^1.0.0", | 53 | "gulp-replace": "^1.0.0", |
54 | "gulp-uglify": "^3.0.1", | 54 | "gulp-uglify": "^3.0.1", |
55 | "jasmine-core": "^3.3.0", | 55 | "jasmine-core": "^3.3.0", |
56 | "jquery": "^3.3.1", | 56 | "jquery": "^3.3.1", |
57 | "jshint": "^2.9.6", | 57 | "jshint": "^2.9.6", |
58 | "ladda": "^1.0.6", | 58 | "ladda": "^1.0.6", |
59 | "leaflet": "^1.3.4", | ||
59 | "pre-commit": "^1.2.2", | 60 | "pre-commit": "^1.2.2", |
60 | "pump": "^3.0.0", | 61 | "pump": "^3.0.0", |
61 | "ui-bootstrap4": "^3.0.5" | 62 | "ui-bootstrap4": "^3.0.5" |
62 | } | 63 | } |
63 | } | 64 | } |
64 | 65 |
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, | ||
22 | longitud: -68.84572999101856 | ||
21 | }; | 23 | }; |
22 | $scope.articulos = angular.copy(filters.articulos); | 24 | $scope.articulos = angular.copy(filters.articulos); |
23 | $scope.articulos.map(function(articulo) { | 25 | $scope.articulos.map(function(articulo) { |
24 | articulo.restante = articulo.cantidad; | 26 | articulo.restante = articulo.cantidad; |
25 | }); | 27 | }); |
26 | actualizarTabla(); | 28 | actualizarTabla(); |
27 | cargarPuntos(filters.puntosDescarga); | 29 | cargarPuntos(filters.puntosDescarga); |
28 | 30 | ||
29 | $scope.cancel = function() { | 31 | $scope.cancel = function() { |
30 | if($scope.ingreso) { | 32 | if($scope.ingreso) { |
31 | $scope.ingreso = false; | 33 | $scope.ingreso = false; |
32 | }else { | 34 | }else { |
33 | $uibModalInstance.dismiss('cancel'); | 35 | $uibModalInstance.dismiss('cancel'); |
34 | } | 36 | } |
35 | }; | 37 | }; |
36 | 38 | ||
37 | $scope.aceptar = function() { | 39 | $scope.aceptar = function() { |
38 | if($scope.cargaArticulos) { | 40 | if($scope.cargaArticulos) { |
39 | cargarArticulos(); | 41 | cargarArticulos(); |
40 | }else { | 42 | }else { |
41 | verCargaArticulos(); | 43 | verCargaArticulos(); |
42 | } | 44 | } |
43 | }; | 45 | }; |
44 | 46 | ||
45 | $scope.guardar = function() { | 47 | $scope.guardar = function() { |
46 | focaModalPuntoDescargaService | 48 | focaModalPuntoDescargaService |
47 | .guardarPuntoDescarga($scope.puntoDescarga) | 49 | .guardarPuntoDescarga($scope.puntoDescarga) |
48 | .then(function() { | 50 | .then(function() { |
49 | actualizarTabla(); | 51 | actualizarTabla(); |
50 | $scope.ingreso = false; | 52 | $scope.ingreso = false; |
51 | }); | 53 | }); |
52 | }; | 54 | }; |
53 | 55 | ||
54 | $scope.editar = function(id) { | 56 | $scope.editar = function(id) { |
55 | focaModalPuntoDescargaService.getPuntoDescargaById(id).then(function(res) { | 57 | focaModalPuntoDescargaService.getPuntoDescargaById(id).then(function(res) { |
56 | $scope.puntoDescarga = res.data; | 58 | $scope.puntoDescarga = res.data; |
57 | $scope.ingreso = true; | 59 | $scope.ingreso = true; |
58 | }); | 60 | }); |
59 | }; | 61 | }; |
60 | 62 | ||
61 | $scope.eliminar = function(idx, id) { | 63 | $scope.eliminar = function(idx, id) { |
62 | focaModalPuntoDescargaService.eliminarPuntoDescarga(id).then(function() { | 64 | focaModalPuntoDescargaService.eliminarPuntoDescarga(id).then(function() { |
63 | $scope.puntosDescarga.splice(idx, 1); | 65 | $scope.puntosDescarga.splice(idx, 1); |
64 | }); | 66 | }); |
65 | }; | 67 | }; |
66 | 68 | ||
67 | $scope.seleccionarPunto = function(idx) { | 69 | $scope.seleccionarPunto = function(idx) { |
68 | var indexPunto = $scope.puntosSeleccionados.indexOf(idx); | 70 | var indexPunto = $scope.puntosSeleccionados.indexOf(idx); |
69 | if(indexPunto !== -1) { | 71 | if(indexPunto !== -1) { |
70 | $scope.puntosSeleccionados.splice(indexPunto, 1); | 72 | $scope.puntosSeleccionados.splice(indexPunto, 1); |
71 | }else { | 73 | }else { |
72 | $scope.puntosSeleccionados.push(idx); | 74 | $scope.puntosSeleccionados.push(idx); |
73 | } | 75 | } |
74 | }; | 76 | }; |
75 | 77 | ||
76 | $scope.agregarArticulo = function(punto) { | 78 | $scope.agregarArticulo = function(punto) { |
77 | var articulo = $scope.articulos[$scope.articuloSeleccionado], | 79 | var articulo = $scope.articulos[$scope.articuloSeleccionado], |
78 | cantidadRestante = articulo.restante - punto.cantidadACargar; | 80 | cantidadRestante = articulo.restante - punto.cantidadACargar; |
79 | 81 | ||
80 | if(cantidadRestante < 0) { | 82 | if(cantidadRestante < 0) { |
81 | focaModalService.alert('La cantidad a cargar debe ser menor o igual al restante'); | 83 | focaModalService.alert('La cantidad a cargar debe ser menor o igual al restante'); |
82 | }else if(punto.cantidadACargar <= 0) { | 84 | }else if(punto.cantidadACargar <= 0) { |
83 | focaModalService.alert('La cantidad a cargar debe ser mayor que cero'); | 85 | focaModalService.alert('La cantidad a cargar debe ser mayor que cero'); |
84 | }else { | 86 | }else { |
85 | punto.cargado += parseInt(punto.cantidadACargar); | 87 | punto.cargado += parseInt(punto.cantidadACargar); |
86 | articulo.restante = cantidadRestante; | 88 | articulo.restante = cantidadRestante; |
87 | var existeArticulo = punto.articulosAgregados.filter( | 89 | var existeArticulo = punto.articulosAgregados.filter( |
88 | function (articuloAAgregar) { | 90 | function (articuloAAgregar) { |
89 | return articuloAAgregar.id === articulo.id; | 91 | return articuloAAgregar.id === articulo.id; |
90 | }); | 92 | }); |
91 | //Si el articulo ya fue agregado | 93 | //Si el articulo ya fue agregado |
92 | if(existeArticulo.length) { | 94 | if(existeArticulo.length) { |
93 | //Solo sumo cantidad | 95 | //Solo sumo cantidad |
94 | var total = parseInt(existeArticulo[0].cantidad) + parseInt(punto.cantidadACargar); | 96 | var total = parseInt(existeArticulo[0].cantidad) + parseInt(punto.cantidadACargar); |
95 | existeArticulo[0].cantidad = total; | 97 | existeArticulo[0].cantidad = total; |
96 | }else { | 98 | }else { |
97 | //Agrego el articulo con la cantidad | 99 | //Agrego el articulo con la cantidad |
98 | punto.articulosAgregados.push({ | 100 | punto.articulosAgregados.push({ |
99 | id: articulo.id, | 101 | id: articulo.id, |
100 | descripcion: articulo.descripcion, | 102 | descripcion: articulo.descripcion, |
101 | cantidad: punto.cantidadACargar, | 103 | cantidad: punto.cantidadACargar, |
102 | index: $scope.articuloSeleccionado | 104 | index: $scope.articuloSeleccionado |
103 | }); | 105 | }); |
104 | } | 106 | } |
105 | punto.cantidadACargar = 0; | 107 | punto.cantidadACargar = 0; |
106 | } | 108 | } |
107 | }; | 109 | }; |
108 | 110 | ||
109 | $scope.quitarArticulo = function(articulo, idx, punto) { | 111 | $scope.quitarArticulo = function(articulo, idx, punto) { |
110 | var articuloAEliminar = $scope.articulos.filter(function(art) { | 112 | var articuloAEliminar = $scope.articulos.filter(function(art) { |
111 | return art.id == articulo.id; | 113 | return art.id == articulo.id; |
112 | }); | 114 | }); |
113 | var restante = parseInt(articuloAEliminar[0].restante); | 115 | var restante = parseInt(articuloAEliminar[0].restante); |
114 | restante += parseInt(articulo.cantidad); | 116 | restante += parseInt(articulo.cantidad); |
115 | articuloAEliminar[0].restante = restante; | 117 | articuloAEliminar[0].restante = restante; |
116 | 118 | ||
117 | punto.cargado -= parseInt(punto.articulosAgregados[idx].cantidad); | 119 | punto.cargado -= parseInt(punto.articulosAgregados[idx].cantidad); |
118 | punto.articulosAgregados.splice(idx, 1); | 120 | punto.articulosAgregados.splice(idx, 1); |
119 | }; | 121 | }; |
120 | 122 | ||
121 | function actualizarTabla() { | 123 | function actualizarTabla() { |
122 | focaModalPuntoDescargaService | 124 | focaModalPuntoDescargaService |
123 | .getPuntosDescargaByClienDom(filters.idDomicilio, filters.idCliente) | 125 | .getPuntosDescargaByClienDom(filters.idDomicilio, filters.idCliente) |
124 | .then(function(res) { | 126 | .then(function(res) { |
125 | $scope.puntosDescarga = res.data; | 127 | $scope.puntosDescarga = res.data; |
126 | }); | 128 | }); |
127 | } | 129 | } |
128 | function verCargaArticulos() { | 130 | function verCargaArticulos() { |
129 | $scope.puntosACargar = []; | 131 | $scope.puntosACargar = []; |
130 | $scope.cargaArticulos = true; | 132 | $scope.cargaArticulos = true; |
131 | $scope.puntosSeleccionados.forEach(function(idx) { | 133 | $scope.puntosSeleccionados.forEach(function(idx) { |
132 | $scope.puntosACargar.push($scope.puntosDescarga[idx]); | 134 | $scope.puntosACargar.push($scope.puntosDescarga[idx]); |
133 | }); | 135 | }); |
134 | 136 | ||
135 | $scope.puntosACargar.map(function(punto) { | 137 | $scope.puntosACargar.map(function(punto) { |
136 | punto.articulosAgregados = []; | 138 | punto.articulosAgregados = []; |
137 | punto.cantidadACargar = 0; | 139 | punto.cantidadACargar = 0; |
138 | punto.cargado = 0; | 140 | punto.cargado = 0; |
139 | }); | 141 | }); |
140 | } | 142 | } |
141 | function cargarArticulos() { | 143 | function cargarArticulos() { |
142 | $uibModalInstance.close($scope.puntosACargar); | 144 | $uibModalInstance.close($scope.puntosACargar); |
143 | } | 145 | } |
144 | function cargarPuntos(puntosDescarga) { | 146 | function cargarPuntos(puntosDescarga) { |
145 | //Si existen puntos ya cargados | 147 | //Si existen puntos ya cargados |
146 | if(puntosDescarga) { | 148 | if(puntosDescarga) { |
147 | if(!puntosDescarga[0].cargado) { | 149 | if(!puntosDescarga[0].cargado) { |
148 | agregarTotalCargado(puntosDescarga); | 150 | agregarTotalCargado(puntosDescarga); |
149 | } | 151 | } |
150 | $scope.puntosACargar = puntosDescarga; | 152 | $scope.puntosACargar = puntosDescarga; |
151 | $scope.cargaArticulos = true; | 153 | $scope.cargaArticulos = true; |
152 | //Recorro los puntos | 154 | //Recorro los puntos |
153 | puntosDescarga.forEach(function(punto) { | 155 | puntosDescarga.forEach(function(punto) { |
154 | //Recorro los articulos cargados en cada punto | 156 | //Recorro los articulos cargados en cada punto |
155 | punto.articulosAgregados.forEach(function(articulo) { | 157 | punto.articulosAgregados.forEach(function(articulo) { |
156 | var articuloARestar = $scope.articulos.filter(function(art) { | 158 | var articuloARestar = $scope.articulos.filter(function(art) { |
157 | return art.id == articulo.id; | 159 | return art.id == articulo.id; |
158 | }); | 160 | }); |
159 | articuloARestar[0].restante -= articulo.cantidad; | 161 | articuloARestar[0].restante -= articulo.cantidad; |
160 | }); | 162 | }); |
161 | }); | 163 | }); |
162 | } | 164 | } |
163 | } | 165 | } |
164 | function agregarTotalCargado(puntosDescarga) { | 166 | function agregarTotalCargado(puntosDescarga) { |
165 | puntosDescarga.map(function(punto) { | 167 | puntosDescarga.map(function(punto) { |
166 | punto.cantidadACargar = 0; | 168 | punto.cantidadACargar = 0; |
167 | punto.cargado = 0; | 169 | punto.cargado = 0; |
168 | }); | 170 | }); |
169 | //Agrego cantidad de combustible cargada en los puntos de descarga | 171 | //Agrego cantidad de combustible cargada en los puntos de descarga |
170 | puntosDescarga.forEach(function(punto) { | 172 | puntosDescarga.forEach(function(punto) { |
171 | punto.articulosAgregados.forEach(function(articulo) { | 173 | punto.articulosAgregados.forEach(function(articulo) { |
172 | punto.cargado += articulo.cantidad; | 174 | punto.cargado += articulo.cantidad; |
173 | }); | 175 | }); |
174 | }); | 176 | }); |
175 | } | 177 | } |
176 | }] | 178 | }] |
177 | ); | 179 | ); |
178 | 180 |
src/js/osm-directive.js
File was created | 1 | angular.module('focaLogisticaPedidoRuta').directive('osmPuntoDescarga', function() { | |
2 | return { | ||
3 | restrict: 'E', | ||
4 | link: function(scope, el, attrs) { | ||
5 | var contenedor = document.createElement('div'); | ||
6 | contenedor.className = 'w-100 h-50 mt-3'; | ||
7 | el.append(contenedor); | ||
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); | ||
10 | }, | ||
11 | controller: ['$scope', '$timeout', function($scope, $timeout) { | ||
12 | //resuelve bug mapa gris en modales | ||
13 | $timeout(function() { | ||
14 | $scope.map.invalidateSize(); | ||
15 | }, 1000); | ||
16 | |||
17 | $scope.markers = []; | ||
18 | $scope.$watchGroup(['latitud', 'longitud'], function() { | ||
19 | for(var i in $scope.markers) { | ||
20 | $scope.map.removeLayer($scope.markers[i]); | ||
21 | } | ||
22 | $scope.markers.push( | ||
23 | L.marker([$scope.latitud, $scope.longitud], {draggable:'true'}) | ||
24 | .addTo($scope.map) | ||
25 | .on('dragend', function() { | ||
26 | $scope.latitud = this.getLatLng().lat; | ||
27 | $scope.longitud = this.getLatLng().lng; | ||
28 | $scope.$apply(); | ||
29 | }) | ||
30 | ); | ||
31 | }); | ||
32 | }], | ||
33 | scope: { | ||
34 | latitud: '=', | ||
35 | longitud: '=', | ||
36 | zoom: '=' | ||
37 | } | ||
38 | }; | ||
39 | }); | ||
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 articulos 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 | ng-click="ingreso = true" | 7 | ng-click="ingreso = true" |
8 | ng-hide="ingreso || cargaArticulos"> | 8 | ng-hide="ingreso || cargaArticulos"> |
9 | <i class="fa fa-plus" aria-hidden="true"></i> | 9 | <i class="fa fa-plus" aria-hidden="true"></i> |
10 | </button> | 10 | </button> |
11 | </div> | 11 | </div> |
12 | <div class="modal-body" id="modal-body"> | 12 | <div class="modal-body" id="modal-body"> |
13 | <table | 13 | <table |
14 | class="table table-striped table-sm col-12" | 14 | class="table table-striped table-sm col-12" |
15 | ng-hide="ingreso || cargaArticulos"> | 15 | ng-hide="ingreso || cargaArticulos"> |
16 | <thead> | 16 | <thead> |
17 | <tr> | 17 | <tr> |
18 | <th>Código</th> | 18 | <th>Código</th> |
19 | <th>Descripción</th> | 19 | <th>Descripción</th> |
20 | <th>Latitud</th> | 20 | <th>Latitud</th> |
21 | <th>Longitud</th> | 21 | <th>Longitud</th> |
22 | <th></th> | 22 | <th></th> |
23 | </tr> | 23 | </tr> |
24 | </thead> | 24 | </thead> |
25 | <tbody> | 25 | <tbody> |
26 | <tr ng-show="puntosDescarga.length == 0"> | 26 | <tr ng-show="!puntosDescarga.length"> |
27 | <td colspan="3"> | 27 | <td colspan="3"> |
28 | No se encontraron resultados. | 28 | No se encontraron resultados. |
29 | </td> | 29 | </td> |
30 | </tr> | 30 | </tr> |
31 | <tr class="selected" | 31 | <tr class="selected" |
32 | ng-repeat="(key, puntoDescarga) in puntosDescarga | filter: filters" | 32 | ng-repeat="(key, puntoDescarga) in puntosDescarga | filter: filters" |
33 | > | 33 | > |
34 | <td ng-bind="puntoDescarga.id | rellenarDigitos: 3: 0"></td> | 34 | <td ng-bind="puntoDescarga.id | rellenarDigitos: 3: 0"></td> |
35 | <td ng-bind="puntoDescarga.descripcion"></td> | 35 | <td ng-bind="puntoDescarga.descripcion"></td> |
36 | <td ng-bind="puntoDescarga.latitud"></td> | 36 | <td ng-bind="puntoDescarga.latitud"></td> |
37 | <td ng-bind="puntoDescarga.longitud"></td> | 37 | <td ng-bind="puntoDescarga.longitud"></td> |
38 | <td class="d-md-none text-primary"> | 38 | <td class="d-md-none text-primary"> |
39 | <i class="fa fa-circle-thin" aria-hidden="true"></i> | 39 | <i class="fa fa-circle-thin" aria-hidden="true"></i> |
40 | </td> | 40 | </td> |
41 | <td class="d-none d-md-table-cell"> | 41 | <td class="d-none d-md-table-cell"> |
42 | <input | 42 | <input |
43 | type="checkbox" | 43 | type="checkbox" |
44 | class="custom-control-input float-right" | 44 | class="custom-control-input float-right" |
45 | id="checkSelect{{key}}"> | 45 | id="checkSelect{{key}}"> |
46 | <label | 46 | <label |
47 | class="custom-control-label float-right" | 47 | class="custom-control-label float-right" |
48 | for="checkSelect{{key}}" | 48 | for="checkSelect{{key}}" |
49 | ng-click="seleccionarPunto(key)"></label> | 49 | ng-click="seleccionarPunto(key)"></label> |
50 | <button | 50 | <button |
51 | type="button" | 51 | type="button" |
52 | class="btn btn-xs p-1 float-right mr-5" | 52 | class="btn btn-xs p-1 float-right mr-5" |
53 | ng-click="eliminar(key, puntoDescarga.id)" | 53 | ng-click="eliminar(key, puntoDescarga.id)" |
54 | title="Eliminar"> | 54 | title="Eliminar"> |
55 | <i class="fa fa-trash" aria-hidden="true"></i> | 55 | <i class="fa fa-trash" aria-hidden="true"></i> |
56 | </button> | 56 | </button> |
57 | <button | 57 | <button |
58 | type="button" | 58 | type="button" |
59 | class="btn btn-xs p-1 float-right mr-1" | 59 | class="btn btn-xs p-1 float-right mr-1" |
60 | ng-click="editar(puntoDescarga.id)" | 60 | ng-click="editar(puntoDescarga.id)" |
61 | title="Editar"> | 61 | title="Editar"> |
62 | <i class="fa fa-pencil" aria-hidden="true"></i> | 62 | <i class="fa fa-pencil" aria-hidden="true"></i> |
63 | </button> | 63 | </button> |
64 | </td> | 64 | </td> |
65 | </tr> | 65 | </tr> |
66 | </tbody> | 66 | </tbody> |
67 | </table> | 67 | </table> |
68 | <form ng-show="ingreso"> | ||
69 | <div class="row"> | ||
70 | <div class="col-6"> | ||
71 | <label>Latitud</label> | ||
72 | <input | ||
73 | type="text" | ||
74 | class="form-control form-control-sm" | ||
75 | ng-model="puntoDescarga.latitud" | ||
76 | ng-required="true" | ||
77 | /> | ||
78 | </div> | ||
79 | <div class="col-6"> | ||
80 | <label>Longitud</label> | ||
81 | <input | ||
82 | type="text" | ||
83 | class="form-control form-control-sm" | ||
84 | ng-model="puntoDescarga.longitud" | ||
85 | ng-required="true" | ||
86 | /> | ||
87 | </div> | ||
88 | </div> | ||
89 | <div class="row"> | ||
90 | <div class="col-12"> | ||
91 | <label>Descripción</label> | ||
92 | <textarea | ||
93 | class="form-control form-control-sm text-uppercase" | ||
94 | cols="30" | ||
95 | rows="5" | ||
96 | ng-model="puntoDescarga.descripcion"> | ||
97 | </textarea> | ||
98 | </div> | ||
99 | </div> | ||
100 | </form> | ||
101 | <div ng-show="cargaArticulos"> | 68 | <div ng-show="cargaArticulos"> |
102 | <div ng-show="articulos.length === 0"> | 69 | <div ng-show="!articulos.length"> |
103 | <h6>No existen articulos para agregar</h6> | 70 | <h6>No existen articulos para agregar</h6> |
104 | </div> | 71 | </div> |
105 | <div ng-show="articulos.length > 0"> | 72 | <div ng-show="articulos.length"> |
106 | <div class="row"> | 73 | <div class="row"> |
107 | <div class="col-12"> | 74 | <div class="col-12"> |
108 | <table class="table table-sm"> | 75 | <table class="table table-sm"> |
109 | <thead> | 76 | <thead> |
110 | <tr> | 77 | <tr> |
111 | <th></th> | 78 | <th></th> |
112 | <th>Articulo</th> | 79 | <th>Articulo</th> |
113 | <th>Total</th> | 80 | <th>Total</th> |
114 | <th>Restante</th> | 81 | <th>Restante</th> |
115 | </tr> | 82 | </tr> |
116 | </thead> | 83 | </thead> |
117 | <tbody> | 84 | <tbody> |
118 | <tr ng-repeat="(key, articulo) in articulos"> | 85 | <tr ng-repeat="(key, articulo) in articulos"> |
119 | <td> | 86 | <td> |
120 | <input | 87 | <input |
121 | type="radio" | 88 | type="radio" |
122 | ng-value="key" | 89 | ng-value="key" |
123 | ng-model="$parent.articuloSeleccionado" | 90 | ng-model="$parent.articuloSeleccionado" |
124 | > | 91 | > |
125 | </td> | 92 | </td> |
126 | <td ng-bind="articulo.descripcion"></td> | 93 | <td ng-bind="articulo.descripcion"></td> |
127 | <td ng-bind="articulo.cantidad"></td> | 94 | <td ng-bind="articulo.cantidad"></td> |
128 | <td ng-bind="articulo.restante"></td> | 95 | <td ng-bind="articulo.restante"></td> |
129 | </tr> | 96 | </tr> |
130 | </tbody> | 97 | </tbody> |
131 | </table> | 98 | </table> |
132 | </div> | 99 | </div> |
133 | </div> | 100 | </div> |
134 | <div class="row"> | 101 | <div class="row"> |
135 | <div class="col-12"> | 102 | <div class="col-12"> |
136 | <h5 class="col-12 my-3">Puntos de descarga</h5> | 103 | <h5 class="col-12 my-3">Puntos de descarga</h5> |
137 | <table class="table table-sm"> | 104 | <table class="table table-sm"> |
138 | <thead> | 105 | <thead> |
139 | <tr> | 106 | <tr> |
140 | <th>Lugar</th> | 107 | <th>Lugar</th> |
141 | <th class="text-right">Total cargado</th> | 108 | <th class="text-right">Total cargado</th> |
142 | <th class="text-right">Cantidad</th> | 109 | <th class="text-right">Cantidad</th> |
143 | <th></th> | 110 | <th></th> |
144 | </tr> | 111 | </tr> |
145 | </thead> | 112 | </thead> |
146 | <tbody> | 113 | <tbody> |
147 | <tr ng-repeat="punto in puntosACargar"> | 114 | <tr ng-repeat="punto in puntosACargar"> |
148 | <td ng-bind="punto.descripcion"></td> | 115 | <td ng-bind="punto.descripcion"></td> |
149 | <td ng-bind="punto.cargado" class="text-right"></td> | 116 | <td ng-bind="punto.cargado" class="text-right"></td> |
150 | <td> | 117 | <td> |
151 | <input | 118 | <input |
152 | type="text" | 119 | type="text" |
153 | class="form-control col-4 float-right" | 120 | class="form-control col-4 float-right" |
154 | id="inputCantidad" | 121 | id="inputCantidad" |
155 | placeholder="A cargar" | 122 | placeholder="A cargar" |
156 | ng-model="punto.cantidadACargar" | 123 | ng-model="punto.cantidadACargar" |
157 | > | 124 | > |
158 | </td> | 125 | </td> |
159 | <td> | 126 | <td> |
160 | <button | 127 | <button |
161 | class="btn btn-sm btn-outline-primary ml-auto" | 128 | class="btn btn-sm btn-outline-primary ml-auto" |
162 | type="button" | 129 | type="button" |
163 | ng-click="agregarArticulo(punto)" | 130 | ng-click="agregarArticulo(punto)" |
164 | > | 131 | > |
165 | Agregar | 132 | Agregar |
166 | </button> | 133 | </button> |
167 | </td> | 134 | </td> |
168 | </tr> | 135 | </tr> |
169 | </tbody> | 136 | </tbody> |
170 | </table> | 137 | </table> |
171 | <table class="table table-sm"> | 138 | <table class="table table-sm"> |
172 | <thead> | 139 | <thead> |
173 | <tr> | 140 | <tr> |
174 | <th>Lugar</th> | 141 | <th>Lugar</th> |
175 | <th>Articulo</th> | 142 | <th>Articulo</th> |
176 | <th class="text-right">Cantidad</th> | 143 | <th class="text-right">Cantidad</th> |
177 | <th></th> | 144 | <th></th> |
178 | </tr> | 145 | </tr> |
179 | </thead> | 146 | </thead> |
180 | <tbody ng-repeat="punto in puntosACargar"> | 147 | <tbody ng-repeat="punto in puntosACargar"> |
181 | <tr ng-repeat="(key, articulo) in punto.articulosAgregados"> | 148 | <tr ng-repeat="(key, articulo) in punto.articulosAgregados"> |
182 | <td ng-bind="punto.descripcion"></td> | 149 | <td ng-bind="punto.descripcion"></td> |
183 | <td ng-bind="articulo.descripcion" class="p-2"></td> | 150 | <td ng-bind="articulo.descripcion" class="p-2"></td> |
184 | <td ng-bind="articulo.cantidad" class="text-right p-2"></td> | 151 | <td ng-bind="articulo.cantidad" class="text-right p-2"></td> |
185 | <td class="p-2"> | 152 | <td class="p-2"> |
186 | <button | 153 | <button |
187 | type="button" | 154 | type="button" |
188 | class="btn btn-xs p-1 float-right mr-5" | 155 | class="btn btn-xs p-1 float-right mr-5" |
189 | ng-click="quitarArticulo(articulo, key, punto)" | 156 | ng-click="quitarArticulo(articulo, key, punto)" |
190 | title="Eliminar"> | 157 | title="Eliminar"> |
191 | <i class="fa fa-trash" aria-hidden="true"></i> | 158 | <i class="fa fa-trash" aria-hidden="true"></i> |
192 | </button> | 159 | </button> |
193 | </td> | 160 | </td> |
194 | </tr> | 161 | </tr> |
195 | </tbody> | 162 | </tbody> |
196 | </table> | 163 | </table> |
197 | </div> | 164 | </div> |
198 | </div> | 165 | </div> |
199 | </div> | 166 | </div> |
200 | </div> | 167 | </div> |
168 | <form ng-show="ingreso"> | ||
169 | <div class="row"> | ||
170 | <div class="col-12"> | ||
171 | <label>Descripción</label> | ||
172 | <input | ||
173 | type="text" | ||
174 | class="form-control form-control-sm" | ||
175 | ng-model="puntoDescarga.descripcion" | ||
176 | uppercase-only> | ||
177 | </div> | ||
178 | </div> | ||
179 | <div class="row"> | ||
180 | <div class="col-6"> | ||
181 | <label>Latitud</label> | ||
182 | <input | ||
183 | type="text" | ||
184 | class="form-control form-control-sm" | ||
185 | ng-model="puntoDescarga.latitud" | ||
186 | ng-required="true" | ||
187 | /> | ||
188 | </div> | ||
189 | <div class="col-6"> |