Commit ad9469d2bd01dbbc0349c075bcf4fcebeeb8ba6f
1 parent
ad4591d555
Exists in
master
(Unificar precio y condición cambios anteriores)
Showing
6 changed files
with
391 additions
and
175 deletions
Show diff stats
package.json
... | ... | @@ -34,14 +34,14 @@ |
34 | 34 | "pump": "^3.0.x" |
35 | 35 | }, |
36 | 36 | "devDependencies": { |
37 | - "angular": "^1.7.7", | |
38 | - "angular-mocks": "^1.7.7", | |
39 | - "angular-route": "^1.7.7", | |
37 | + "angular": "^1.7.8", | |
38 | + "angular-mocks": "^1.7.8", | |
39 | + "angular-route": "^1.7.8", | |
40 | 40 | "bootstrap": "^4.2.1", |
41 | 41 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", |
42 | 42 | "font-awesome": "^4.7.0", |
43 | 43 | "gulp": "^3.9.1", |
44 | - "gulp-angular-templatecache": "^2.2.6", | |
44 | + "gulp-angular-templatecache": "^2.2.7", | |
45 | 45 | "gulp-clean": "^0.4.0", |
46 | 46 | "gulp-connect": "^5.7.0", |
47 | 47 | "gulp-htmlmin": "^5.0.1", |
... | ... | @@ -51,11 +51,14 @@ |
51 | 51 | "gulp-sequence": "^1.0.0", |
52 | 52 | "gulp-uglify": "^3.0.1", |
53 | 53 | "gulp-uglify-es": "^1.0.4", |
54 | - "jasmine-core": "^3.3.0", | |
55 | - "jquery": "^3.3.1", | |
56 | - "jshint": "^2.10.1", | |
54 | + "jasmine-core": "^3.4.0", | |
55 | + "jquery": "^3.4.1", | |
56 | + "jshint": "^2.10.2", | |
57 | 57 | "pre-commit": "^1.2.2", |
58 | 58 | "pump": "^3.0.0", |
59 | 59 | "ui-bootstrap4": "^3.0.6" |
60 | + }, | |
61 | + "dependencies": { | |
62 | + "popper.js": "^1.15.0" | |
60 | 63 | } |
61 | 64 | } |
src/js/controller.js
1 | 1 | angular.module('focaAbmPreciosCondiciones') |
2 | 2 | .controller('focaAbmPreciosCondicionesController', [ |
3 | 3 | '$scope', 'focaAbmPreciosCondicionesService', '$location', |
4 | - 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage', | |
4 | + 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage','$routeParams','$uibModal', | |
5 | 5 | function($scope, focaAbmPreciosCondicionesService, $location, |
6 | - focaModalService, focaBotoneraLateralService, $timeout, $localStorage) { | |
6 | + focaModalService, focaBotoneraLateralService, $timeout, $localStorage,$routeParams, $uibModal) { | |
7 | 7 | |
8 | 8 | $scope.focusSearch = false; |
9 | 9 | $scope.filters = ''; |
10 | 10 | $scope.now = new Date(); |
11 | + $scope.creando = false; | |
12 | + $scope.crear = false; | |
13 | + $scope.listaPrecioLabel = ''; | |
14 | + $scope.mostrarPlazos = $routeParams.id > 0; | |
15 | + | |
11 | 16 | $timeout(function() { |
12 | 17 | focaBotoneraLateralService.showSalir(true); |
13 | 18 | focaBotoneraLateralService.showPausar(false); |
14 | 19 | focaBotoneraLateralService.showCancelar(false); |
15 | - focaBotoneraLateralService.showGuardar(false); | |
20 | + focaBotoneraLateralService.showGuardar(true, $scope.guardar); | |
16 | 21 | |
17 | 22 | $scope.focusSearch = true; |
18 | 23 | }); |
19 | 24 | |
20 | - $scope.filters = ''; | |
21 | - $scope.now = new Date(); | |
22 | - $scope.editar = function(id) { | |
23 | - $location.path('/precio-condicion/' + id); | |
25 | + $scope.crearPrecioYCondicion = function () { | |
26 | + $scope.precioCondicion = { | |
27 | + id: 0, | |
28 | + codigo: '', | |
29 | + nombre: '', | |
30 | + idListaPrecio: 0, | |
31 | + vigencia: new Date(), | |
32 | + editando: true, | |
33 | + activo: true, | |
34 | + plazos: { | |
35 | + dias: 0 | |
36 | + } | |
37 | + }; | |
38 | + $scope.crear = false; | |
39 | + $scope.preciosCondiciones.unshift($scope.precioCondicion); | |
40 | + console.log('Nuevo:', $scope.precioCondicion); | |
41 | + }; | |
42 | + | |
43 | + $scope.guardarBD = function () { | |
44 | + console.log('Guardar BD: ', $scope.preciosCondiciones); | |
45 | + }; | |
46 | + | |
47 | + $scope.agregarPrecioYCondicion = function (precioCondicion) { | |
48 | + //push a plazos | |
49 | + if (!precioCondicion.nombre) { | |
50 | + focaModalService.alert('Ingrese un nombre'); | |
51 | + return; | |
52 | + } else if (!precioCondicion.listaPrecio) { | |
53 | + focaModalService.alert('Seleccione un precio'); | |
54 | + return; | |
55 | + } else if (!precioCondicion.plazos || precioCondicion.plazos === 0) { | |
56 | + focaModalService.alert('Ingrese almenos un plazo'); | |
57 | + return; | |
58 | + } | |
59 | + //Plazo | |
60 | + | |
61 | + precioCondicion.editando = false; | |
62 | + $scope.crear = true; | |
63 | + }; | |
64 | + | |
65 | + $scope.editar = function(precioCondicion) { | |
66 | + $scope.preciosCondiciones.forEach( function(precioCondicion) { | |
67 | + precioCondicion.editando = false; | |
68 | + $scope.crear = false; | |
69 | + }); | |
70 | + precioCondicion.editando = true; | |
71 | + $scope.inicial = angular.copy(precioCondicion); | |
72 | + }; | |
73 | + | |
74 | + $scope.volver = function (precioCondicion, key) { | |
75 | + if (precioCondicion.id === 0) { | |
76 | + $scope.preciosCondiciones.shift(); | |
77 | + $scope.crear = true; | |
78 | + } else { | |
79 | + $scope.preciosCondiciones[key] = $scope.inicial; | |
80 | + $scope.preciosCondiciones[key].editando = false; | |
81 | + $scope.crear = true; | |
82 | + } | |
24 | 83 | }; |
84 | + | |
25 | 85 | $scope.solicitarConfirmacion = function(precioCondicion) { |
26 | 86 | focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + |
27 | 87 | precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( |
... | ... | @@ -38,25 +98,126 @@ angular.module('focaAbmPreciosCondiciones') |
38 | 98 | }; |
39 | 99 | |
40 | 100 | $scope.buscar = function(key) { |
41 | - if(key === 13){ | |
101 | + if (key === 13) { | |
102 | + $scope.crear = true; | |
42 | 103 | focaAbmPreciosCondicionesService |
43 | 104 | .obtenerPreciosCondiciones($scope.filters) |
44 | 105 | .then(function(datos) { |
45 | 106 | $scope.preciosCondiciones = datos.data; |
46 | 107 | $scope.preciosCondiciones.forEach(function(precioCondicion) { |
47 | 108 | precioCondicion.plazoPago.sort(function(a, b) { |
48 | - return a.dias- b.dias; | |
109 | + return a.dias - b.dias; | |
49 | 110 | }); |
50 | 111 | }); |
51 | 112 | }); |
52 | 113 | } |
53 | 114 | }; |
54 | 115 | |
116 | + $scope.seleccionarListaPrecio = function(key) { | |
117 | + if (key === 13){ | |
118 | + var modalInstance = $uibModal.open( | |
119 | + { | |
120 | + ariaLabelledBy: 'Busqueda de Listas de precio', | |
121 | + templateUrl: 'modal-lista-precio.html', | |
122 | + controller: 'focaModalListaPrecioCtrl', | |
123 | + size: 'lg' | |
124 | + } | |
125 | + ); | |
126 | + modalInstance.result.then(function(listaPrecio) { | |
127 | + $scope.precioCondicion.idListaPrecio = listaPrecio.ID; | |
128 | + $scope.precioCondicion.listaPrecio = listaPrecio; | |
129 | + $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES; | |
130 | + $scope.focused = 4; | |
131 | + }); | |
132 | + } | |
133 | + }; | |
134 | + | |
135 | + $scope.verProductosListaPrecio = function() { | |
136 | + $uibModal.open( | |
137 | + { | |
138 | + ariaLabelledBy: 'Busqueda de Productos', | |
139 | + templateUrl: 'modal-busqueda-productos.html', | |
140 | + controller: 'modalBusquedaProductosCtrl', | |
141 | + resolve: { | |
142 | + parametroProducto: { | |
143 | + idLista: $scope.precioCondicion.listaPrecio.ID, | |
144 | + cotizacion: 1, | |
145 | + simbolo: '$', | |
146 | + soloMostrar: true | |
147 | + } | |
148 | + }, | |
149 | + size: 'md' | |
150 | + } | |
151 | + ); | |
152 | + }; | |
153 | + | |
55 | 154 | if ($localStorage.precioCondicion) { |
56 | 155 | var precioCondicion = JSON.parse($localStorage.precioCondicion); |
57 | 156 | if (!precioCondicion.id) { precioCondicion.id = 0; } |
58 | 157 | $location.path('/precio-condicion/' + precioCondicion.id); |
59 | 158 | } |
159 | + | |
160 | + | |
161 | + //Guardar | |
162 | + $scope.guardar = function() { | |
163 | + | |
164 | + var promises = []; | |
165 | + var precioCondicion = $scope.precioCondicion; | |
166 | + precioCondicion.idListaPrecio = precioCondicion.listaPrecio.ID; | |
167 | + // delete precioCondicion.listaPrecio; | |
168 | + if ($scope.mostrarPlazos) { | |
169 | + promises.push( | |
170 | + focaAbmPreciosCondicionesService | |
171 | + .guardarPlazosPago($scope.precioCondicion.plazos) | |
172 | + ); | |
173 | + $scope.plazosAEliminar.forEach(function(id) { | |
174 | + promises.push( | |
175 | + focaAbmPreciosCondicionesService | |
176 | + .borrarPlazoPago(id) | |
177 | + ); | |
178 | + }); | |
179 | + } | |
180 | + promises.push( | |
181 | + focaAbmPreciosCondicionesService | |
182 | + .guardarPrecioCondicion(precioCondicion) | |
183 | + ); | |
184 | + | |
185 | + Promise.all(promises).then(function() { | |
186 | + $timeout(function() { | |
187 | + $location.path('/precio-condicion'); | |
188 | + }, 0); | |
189 | + }, function(err){ | |
190 | + console.error(err); | |
191 | + }); | |
192 | + }; | |
193 | + | |
194 | + // Plazo pago | |
195 | + | |
196 | + // focaAbmPreciosCondicionesService.obtenerPrecioCondicion($scope.filters) | |
197 | + // .then(function(datos) { | |
198 | + // console.log('Precios y condiciones: ', datos); | |
199 | + // if (datos.data.id) { | |
200 | + // $scope.precioCondicion = datos.data; | |
201 | + // $scope.listaPrecioLabel = datos.data.listaPrecio.ID.trim() + | |
202 | + // ' - ' + datos.data.listaPrecio.DES; | |
203 | + // $scope.$broadcast('addCabecera', { | |
204 | + // label: 'Precio y condición:', | |
205 | + // valor: datos.data.nombre | |
206 | + // }); | |
207 | + // focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) | |
208 | + // .then(function(datos) { | |
209 | + // console.log('Plazos Pago: ', datos); | |
210 | + // $scope.precioCondicion.plazos = datos.data; | |
211 | + // $scope.precioCondicion.plazos.sort(function(a, b) { | |
212 | + // return a.dias- b.dias; | |
213 | + // }); | |
214 | + // $scope.plazoACargar = | |
215 | + // { | |
216 | + // item: datos.data.length + 1 | |
217 | + // }; | |
218 | + // }); | |
219 | + // } | |
220 | + // }); | |
60 | 221 | } |
61 | 222 | ]) |
62 | 223 | .controller('focaAbmPrecioCondicionController', [ |
... | ... | @@ -78,29 +239,30 @@ angular.module('focaAbmPreciosCondiciones') |
78 | 239 | idListaPrecio: 0, |
79 | 240 | vigencia: new Date() |
80 | 241 | }; |
81 | - focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) | |
82 | - .then(function(datos) { | |
83 | - if (datos.data.id) { | |
84 | - $scope.precioCondicion = datos.data; | |
85 | - $scope.listaPrecioLabel = datos.data.listaPrecio.ID.trim() + | |
86 | - ' - ' + datos.data.listaPrecio.DES; | |
87 | - $scope.$broadcast('addCabecera', { | |
88 | - label: 'Precio y condición:', | |
89 | - valor: datos.data.nombre | |
90 | - }); | |
91 | - focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) | |
92 | - .then(function(datos) { | |
93 | - $scope.precioCondicion.plazos = datos.data; | |
94 | - $scope.precioCondicion.plazos.sort(function(a, b) { | |
95 | - return a.dias- b.dias; | |
96 | - }); | |
97 | - $scope.plazoACargar = | |
98 | - { | |
99 | - item: datos.data.length + 1 | |
100 | - }; | |
101 | - }); | |
102 | - } | |
103 | - }); | |
242 | + // focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) | |
243 | + // .then(function(datos) { | |
244 | + // if (datos.data.id) { | |
245 | + // $scope.precioCondicion = datos.data; | |
246 | + // $scope.listaPrecioLabel = datos.data.listaPrecio.ID.trim() + | |
247 | + // ' - ' + datos.data.listaPrecio.DES; | |
248 | + // $scope.$broadcast('addCabecera', { | |
249 | + // label: 'Precio y condición:', | |
250 | + // valor: datos.data.nombre | |
251 | + // }); | |
252 | + // focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) | |
253 | + // .then(function(datos) { | |
254 | + // console.log('Datos: ', datos); | |
255 | + // $scope.precioCondicion.plazos = datos.data; | |
256 | + // $scope.precioCondicion.plazos.sort(function(a, b) { | |
257 | + // return a.dias- b.dias; | |
258 | + // }); | |
259 | + // $scope.plazoACargar = | |
260 | + // { | |
261 | + // item: datos.data.length + 1 | |
262 | + // }; | |
263 | + // }); | |
264 | + // } | |
265 | + // }); | |
104 | 266 | |
105 | 267 | $timeout(function() {getLSPrecioC();}); |
106 | 268 | |
... | ... | @@ -126,132 +288,91 @@ angular.module('focaAbmPreciosCondiciones') |
126 | 288 | $location.path('/precio-condicion'); |
127 | 289 | } |
128 | 290 | }; |
129 | - $scope.guardar = function() { | |
130 | - | |
131 | - if (!$scope.precioCondicion.nombre) { | |
132 | - focaModalService.alert('Ingrese nombre'); | |
133 | - return; | |
134 | - } else if (!$scope.precioCondicion.descripcion) { | |
135 | - focaModalService.alert('Ingrese descripcion'); | |
136 | - return; | |
137 | - } else if (!$scope.precioCondicion.idListaPrecio) { | |
138 | - focaModalService.alert('Seleccione precio'); | |
139 | - return; | |
140 | - } | |
141 | - | |
142 | - var promises = []; | |
143 | - var precioCondicion = $scope.precioCondicion; | |
144 | - precioCondicion.idListaPrecio = precioCondicion.listaPrecio.ID; | |
145 | - delete precioCondicion.listaPrecio; | |
146 | - if ($scope.mostrarPlazos) { | |
147 | - promises.push( | |
148 | - focaAbmPreciosCondicionesService | |
149 | - .guardarPlazosPago($scope.precioCondicion.plazos) | |
150 | - ); | |
151 | - $scope.plazosAEliminar.forEach(function(id) { | |
152 | - promises.push( | |
153 | - focaAbmPreciosCondicionesService | |
154 | - .borrarPlazoPago(id) | |
155 | - ); | |
156 | - }); | |
157 | - } | |
158 | - promises.push( | |
159 | - focaAbmPreciosCondicionesService | |
160 | - .guardarPrecioCondicion(precioCondicion) | |
161 | - ); | |
162 | - | |
163 | - Promise.all(promises).then(function() { | |
164 | - $timeout(function() { | |
165 | - $location.path('/precio-condicion'); | |
166 | - }, 0); | |
167 | - }, function(err){ | |
168 | - console.error(err); | |
169 | - }); | |
170 | - }; | |
291 | + | |
171 | 292 | |
172 | - $scope.agregarPlazo = function(key) { | |
173 | - if (key === 13) { | |
174 | - if (!$scope.plazoACargar.dias && $scope.plazoACargar.dias !== 0) { | |
175 | - focaModalService.alert('Ingrese cantidad de días'); | |
176 | - return; | |
177 | - } | |
178 | - var tieneEseDia = $scope.precioCondicion.plazos.filter(function(a) { | |
179 | - return a.dias === $scope.plazoACargar.dias; | |
180 | - }); | |
181 | - if (tieneEseDia.length > 0) { | |
182 | - focaModalService.alert('Ya ha ingresado un plazo con esos días'); | |
183 | - return; | |
184 | - } | |
185 | - $scope.plazoACargar.idPreciosCondiciones = $scope.precioCondicion.id; | |
186 | - $scope.plazoACargar.activo = true; | |
187 | - $scope.precioCondicion.plazos.push($scope.plazoACargar); | |
188 | - $scope.plazoACargar = | |
189 | - { | |
190 | - item: $scope.precioCondicion.plazos.length + 1 | |
191 | - }; | |
192 | - } | |
193 | - }; | |
194 | - $scope.quitarPlazo = function(key) { | |
195 | - if ($scope.precioCondicion.plazos[key].id) | |
196 | - $scope.plazosAEliminar.push($scope.precioCondicion.plazos[key].id); | |
293 | + // $scope.agregarPlazo = function(key) { | |
294 | + // if (key === 13) { | |
295 | + // if (!$scope.plazoACargar.dias && $scope.plazoACargar.dias !== 0) { | |
296 | + // focaModalService.alert('Ingrese cantidad de días'); | |
297 | + // return; | |
298 | + // } | |
299 | + // var tieneEseDia = $scope.precioCondicion.plazos.filter(function(a) { | |
300 | + // return a.dias === $scope.plazoACargar.dias; | |
301 | + // }); | |
302 | + // if (tieneEseDia.length > 0) { | |
303 | + // focaModalService.alert('Ya ha ingresado un plazo con esos días'); | |
304 | + // return; | |
305 | + // } | |
306 | + // $scope.plazoACargar.idPreciosCondiciones = $scope.precioCondicion.id; | |
307 | + // $scope.plazoACargar.activo = true; | |
308 | + // $scope.precioCondicion.plazos.push($scope.plazoACargar); | |
309 | + // $scope.plazoACargar = | |
310 | + // { | |
311 | + // item: $scope.precioCondicion.plazos.length + 1 | |
312 | + // }; | |
313 | + // } | |
314 | + // }; | |
315 | + // $scope.quitarPlazo = function(key) { | |
316 | + // if ($scope.precioCondicion.plazos[key].id) | |
317 | + // $scope.plazosAEliminar.push($scope.precioCondicion.plazos[key].id); | |
197 | 318 | |
198 | - $scope.precioCondicion.plazos.splice(key, 1); | |
199 | - $scope.plazoACargar = | |
200 | - { | |
201 | - item: $scope.precioCondicion.plazos.length + 1 | |
202 | - }; | |
203 | - }; | |
204 | - $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { | |
205 | - focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + | |
206 | - plazoPago.item + ' ' + plazoPago.dias + ' ?').then( | |
207 | - function(confirm) { | |
208 | - if (confirm) { | |
209 | - focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); | |
210 | - $scope.precioCondicion.plazos.splice( | |
211 | - $scope.precioCondicion.plazos.indexOf(plazoPago), 1 | |
212 | - ); | |
213 | - } | |
214 | - } | |
215 | - ); | |
216 | - }; | |
319 | + // $scope.precioCondicion.plazos.splice(key, 1); | |
320 | + // $scope.plazoACargar = | |
321 | + // { | |
322 | + // item: $scope.precioCondicion.plazos.length + 1 | |
323 | + // }; | |
324 | + // }; | |
325 | + // $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { | |
326 | + // focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + | |
327 | + // plazoPago.item + ' ' + plazoPago.dias + ' ?').then( | |
328 | + // function(confirm) { | |
329 | + // if (confirm) { | |
330 | + // focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); | |
331 | + // $scope.precioCondicion.plazos.splice( | |
332 | + // $scope.precioCondicion.plazos.indexOf(plazoPago), 1 | |
333 | + // ); | |
334 | + // } | |
335 | + // } | |
336 | + // ); | |
337 | + // }; | |
217 | 338 | |
218 | - $scope.seleccionarListaPrecio = function(key) { | |
219 | - if (key === 13){ | |
220 | - var modalInstance = $uibModal.open( | |
221 | - { | |
222 | - ariaLabelledBy: 'Busqueda de Listas de precio', | |
223 | - templateUrl: 'modal-lista-precio.html', | |
224 | - controller: 'focaModalListaPrecioCtrl', | |
225 | - size: 'lg' | |
226 | - } | |
227 | - ); | |
228 | - modalInstance.result.then(function(listaPrecio) { | |
229 | - $scope.precioCondicion.idListaPrecio = listaPrecio.ID; | |
230 | - $scope.precioCondicion.listaPrecio = listaPrecio; | |
231 | - $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES; | |
232 | - $scope.focused = 4; | |
233 | - }); | |
234 | - } | |
235 | - }; | |
339 | + // $scope.seleccionarListaPrecio = function(key) { | |
340 | + // if (key === 13){ | |
341 | + // var modalInstance = $uibModal.open( | |
342 | + // { | |
343 | + // ariaLabelledBy: 'Busqueda de Listas de precio', | |
344 | + // templateUrl: 'modal-lista-precio.html', | |
345 | + // controller: 'focaModalListaPrecioCtrl', | |
346 | + // size: 'lg' | |
347 | + // } | |
348 | + // ); | |
349 | + // modalInstance.result.then(function(listaPrecio) { | |
350 | + // $scope.precioCondicion.idListaPrecio = listaPrecio.ID; | |
351 | + // $scope.precioCondicion.listaPrecio = listaPrecio; | |
352 | + // $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES; | |
353 | + // $scope.focused = 4; | |
354 | + // }); | |
355 | + // } | |
356 | + // }; | |
236 | 357 | |
237 | - $scope.verProductosListaPrecio = function() { | |
238 | - $uibModal.open( | |
239 | - { | |
240 | - ariaLabelledBy: 'Busqueda de Productos', | |
241 | - templateUrl: 'modal-busqueda-productos.html', | |
242 | - controller: 'modalBusquedaProductosCtrl', | |
243 | - resolve: { | |
244 | - parametroProducto: { | |
245 | - idLista: $scope.precioCondicion.listaPrecio.ID, | |
246 | - cotizacion: 1, | |
247 | - simbolo: '$', | |
248 | - soloMostrar: true | |
249 | - } | |
250 | - }, | |
251 | - size: 'md' | |
252 | - } | |
253 | - ); | |
254 | - }; | |
358 | + // $scope.verProductosListaPrecio = function() { | |
359 | + // $uibModal.open( | |
360 | + // { | |
361 | + // ariaLabelledBy: 'Busqueda de Productos', | |
362 | + // templateUrl: 'modal-busqueda-productos.html', | |
363 | + // controller: 'modalBusquedaProductosCtrl', | |
364 | + // resolve: { | |
365 | + // parametroProducto: { | |
366 | + // idLista: $scope.precioCondicion.listaPrecio.ID, | |
367 | + // cotizacion: 1, | |
368 | + // simbolo: '$', | |
369 | + // soloMostrar: true | |
370 | + // } | |
371 | + // }, | |
372 | + // size: 'md' | |
373 | + // } | |
374 | + // ); | |
375 | + // }; | |
255 | 376 | |
256 | 377 | $scope.next = function(key) { |
257 | 378 | if (key === 13) $scope.focused++; |
src/js/service.js
... | ... | @@ -20,7 +20,7 @@ angular.module('focaAbmPreciosCondiciones') |
20 | 20 | }, |
21 | 21 | obtenerPlazoPago: function(idPrecioCondicion) { |
22 | 22 | return $http.get( |
23 | - API_ENDPOINT.URL + '/plazo-pago/precio-condicion/' + idPrecioCondicion | |
23 | + API_ENDPOINT.URL + '/precio-condicion/plazo-pago/' + idPrecioCondicion | |
24 | 24 | ); |
25 | 25 | }, |
26 | 26 | borrarPlazoPago: function(id) { |
src/views/foca-abm-precios-condiciones-item.html
src/views/foca-abm-precios-condiciones-listado.html
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | </button> |
30 | 30 | </div> |
31 | 31 | </div> |
32 | - <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | |
32 | + <table class="table table-default table-hover table-sm table-abm table-striped mb-0" > | |
33 | 33 | <thead> |
34 | 34 | <tr> |
35 | 35 | <th>Código</th> |
... | ... | @@ -38,28 +38,106 @@ |
38 | 38 | <th>Plazos</th> |
39 | 39 | <th colspan="2" class="text-center"> |
40 | 40 | <button |
41 | - title="Agregar" | |
41 | + title="Agregar Precio y Condicion" | |
42 | 42 | class="btn btn-outline-debo boton-accion" |
43 | - ng-click="editar(0)"> | |
43 | + ng-click="crearPrecioYCondicion()" | |
44 | + ng-disabled="!crear" | |
45 | + > | |
44 | 46 | <i class="fa fa-plus"></i> |
45 | 47 | </button> |
46 | 48 | </th> |
47 | 49 | </tr> |
48 | 50 | </thead> |
49 | 51 | <tbody> |
50 | - <tr ng-repeat="precioCondicion in preciosCondiciones"> | |
51 | - <td ng-bind="precioCondicion.id | rellenarDigitos: 4: 0"></td> | |
52 | - <td ng-bind="precioCondicion.nombre"></td> | |
53 | - <td ng-bind="precioCondicion.listaPrecio.ID + ' - ' + precioCondicion.listaPrecio.DES + ' - ' + precioCondicion.listaPrecio.moneda.DETALLE"></td> | |
54 | - <td><span | |
52 | + <tr ng-repeat="(key, precioCondicion) in preciosCondiciones" ng-hide="precioCondicion.desactivado"> | |
53 | + <td ng-bind="precioCondicion.id | rellenarDigitos: 4: 0" ng-hide="precioCondicion.editando"></td> | |
54 | + <td ng-show="precioCondicion.editando"> | |
55 | + <input | |
56 | + class="form-control" | |
57 | + type="text" | |
58 | + name="codigo" | |
59 | + ng-value="precioCondicion.id | rellenarDigitos: 4: 0" | |
60 | + autocomplete="off" | |
61 | + readonly | |
62 | + /> | |
63 | + </td> | |
64 | + <td ng-bind="precioCondicion.nombre" ng-hide="precioCondicion.editando"></td> | |
65 | + <td align="center" ng-show="precioCondicion.editando"> | |
66 | + <input | |
67 | + class="form-control" | |
68 | + type="text" | |
69 | + name="nombre" | |
70 | + ng-model="precioCondicion.nombre" | |
71 | + autocomplete="off" | |
72 | + foca-focus="focused == 1" | |
73 | + ng-focus="focused = 1" | |
74 | + ng-keypress="next($event.keyCode)" | |
75 | + teclado-virtual | |
76 | + esc-key="volver(precioCondicion, key)" | |
77 | + /> | |
78 | + </td> | |
79 | + <td ng-bind="precioCondicion.listaPrecio.ID + ' - ' + precioCondicion.listaPrecio.DES + ' - ' + precioCondicion.listaPrecio.moneda.DETALLE" ng-hide="precioCondicion.editando"></td> | |
80 | + <td align="center" ng-show="precioCondicion.editando"> | |
81 | + <div class="input-group p-0 m-0"> | |
82 | + <input | |
83 | + ng-model="listaPrecioLabel" | |
84 | + class="form-control" | |
85 | + foca-focus="focused == 3" | |
86 | + ng-focus="focused = 3" | |
87 | + ng-keypress="seleccionarListaPrecio($event.keyCode)" | |
88 | + readonly | |
89 | + /> | |
90 | + <div class="input-group-append"> | |
91 | + <button | |
92 | + class="btn btn-outline-secondary form-control" | |
93 | + title="Ver productos" | |
94 | + type="button" | |
95 | + ng-click="verProductosListaPrecio()" | |
96 | + ng-show="precioCondicion.listaPrecio" | |
97 | + > | |
98 | + <i class="fa fa-eye" aria-hidden="true"></i> | |
99 | + </button> | |
100 | + <button | |
101 | + ladda="searchLoading" | |
102 | + class="btn btn-outline-secondary form-control" | |
103 | + title="Buscar" | |
104 | + type="button" | |
105 | + ng-click="seleccionarListaPrecio(13)" | |
106 | + > | |
107 | + <i class="fa fa-search" aria-hidden="true"></i> | |
108 | + </button> | |
109 | + </div> | |
110 | + </div> | |
111 | + </td> | |
112 | + <!-- Consultar --> | |
113 | + <td ng-hide="precioCondicion.editando"> | |
114 | + <span | |
55 | 115 | ng-repeat="plazo in precioCondicion.plazoPago" |
56 | 116 | ng-if="plazo.activo" |
57 | - ng-bind="$last ? plazo.dias : plazo.dias + ', '"></span></td> | |
58 | - <td class="text-center"> | |
117 | + ng-bind="$last ? plazo.dias : plazo.dias + ', '" | |
118 | + > | |
119 | + </span> | |
120 | + </td> | |
121 | + | |
122 | + <td align="center" ng-show="precioCondicion.editando"> | |
123 | + <input | |
124 | + type="number" | |
125 | + class="form-control p-1 " | |
126 | + min="0" | |
127 | + max="31" | |
128 | + ng-model="precioCondicion.plazos.dias" | |
129 | + foca-focus="focused == 4" | |
130 | + ng-focus="focused = 4" | |
131 | + placeholder="Días" | |
132 | + teclado-virtual | |
133 | + esc-key="volver(precioCondicion, key)" | |
134 | + > | |
135 | + </td> | |
136 | + <td class="text-center" ng-hide="precioCondicion.editando"> | |
59 | 137 | <button |
60 | 138 | title="Editar" |
61 | 139 | class="btn btn-outline-dark boton-accion" |
62 | - ng-click="editar(precioCondicion.id)"> | |
140 | + ng-click="editar(precioCondicion)"> | |
63 | 141 | <i class="fa fa-pencil"></i> |
64 | 142 | </button> |
65 | 143 | <button |
... | ... | @@ -69,6 +147,20 @@ |
69 | 147 | <i class="fa fa-trash"></i> |
70 | 148 | </button> |
71 | 149 | </td> |
150 | + <td align="center" ng-show="precioCondicion.editando" > | |
151 | + <button | |
152 | + class="btn btn-outline-dark boton-accion" | |
153 | + ng-click="agregarPrecioYCondicion(precioCondicion)" | |
154 | + > | |
155 | + <i class="fa fa-save"></i> | |
156 | + </button> | |
157 | + <button | |
158 | + class="btn btn-outline-dark boton-accion" | |
159 | + ng-click="volver(precioCondicion, key)" | |
160 | + > | |
161 | + <i class="fa fa-undo" aria-hidden="true"></i> | |
162 | + </button> | |
163 | + </td> | |
72 | 164 | </tr> |
73 | 165 | </tbody> |
74 | 166 | </table> |
src/views/foca-abm-precios-condiciones-modal-confirmar.html