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
| 1 | { | 1 | { |
| 2 | "name": "foca-abm-precios-condiciones", | 2 | "name": "foca-abm-precios-condiciones", |
| 3 | "version": "1.0.0", | 3 | "version": "1.0.0", |
| 4 | "description": "ABM de precios y condiciones", | 4 | "description": "ABM de precios y condiciones", |
| 5 | "main": "dist/foca-abm-precios-condiciones.js", | 5 | "main": "dist/foca-abm-precios-condiciones.js", |
| 6 | "scripts": { | 6 | "scripts": { |
| 7 | "test": "test.html", | 7 | "test": "test.html", |
| 8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
| 9 | "gulp-pre-commit": "gulp pre-commit", | 9 | "gulp-pre-commit": "gulp pre-commit", |
| 10 | "postinstall": "npm run compile && gulp clean-post-install", | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
| 11 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify gulp-replace jquery jshint pump angular-mocks git+http://git.focasoftware.com/npm/foca-modal.git" | 11 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify gulp-replace jquery jshint pump angular-mocks git+http://git.focasoftware.com/npm/foca-modal.git" |
| 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": "https://192.168.0.11/modulos-npm/foca-abm-precios-condiciones.git" | 18 | "url": "https://192.168.0.11/modulos-npm/foca-abm-precios-condiciones.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.x", | 23 | "angular": "^1.7.x", |
| 24 | "bootstrap": "^4.1.x", | 24 | "bootstrap": "^4.1.x", |
| 25 | "jquery": "^3.3.x", | 25 | "jquery": "^3.3.x", |
| 26 | "font-awesome": "^4.7.x", | 26 | "font-awesome": "^4.7.x", |
| 27 | "gulp": "^3.9.x", | 27 | "gulp": "^3.9.x", |
| 28 | "gulp-concat": "2.6.x", | 28 | "gulp-concat": "2.6.x", |
| 29 | "gulp-jshint": "^2.1.x", | 29 | "gulp-jshint": "^2.1.x", |
| 30 | "gulp-rename": "^1.4.x", | 30 | "gulp-rename": "^1.4.x", |
| 31 | "gulp-replace": "^1.0.x", | 31 | "gulp-replace": "^1.0.x", |
| 32 | "gulp-uglify-es": "^1.0.x", | 32 | "gulp-uglify-es": "^1.0.x", |
| 33 | "jshint": "^2.9.x", | 33 | "jshint": "^2.9.x", |
| 34 | "pump": "^3.0.x" | 34 | "pump": "^3.0.x" |
| 35 | }, | 35 | }, |
| 36 | "devDependencies": { | 36 | "devDependencies": { |
| 37 | "angular": "^1.7.7", | 37 | "angular": "^1.7.8", |
| 38 | "angular-mocks": "^1.7.7", | 38 | "angular-mocks": "^1.7.8", |
| 39 | "angular-route": "^1.7.7", | 39 | "angular-route": "^1.7.8", |
| 40 | "bootstrap": "^4.2.1", | 40 | "bootstrap": "^4.2.1", |
| 41 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", | 41 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", |
| 42 | "font-awesome": "^4.7.0", | 42 | "font-awesome": "^4.7.0", |
| 43 | "gulp": "^3.9.1", | 43 | "gulp": "^3.9.1", |
| 44 | "gulp-angular-templatecache": "^2.2.6", | 44 | "gulp-angular-templatecache": "^2.2.7", |
| 45 | "gulp-clean": "^0.4.0", | 45 | "gulp-clean": "^0.4.0", |
| 46 | "gulp-connect": "^5.7.0", | 46 | "gulp-connect": "^5.7.0", |
| 47 | "gulp-htmlmin": "^5.0.1", | 47 | "gulp-htmlmin": "^5.0.1", |
| 48 | "gulp-jshint": "^2.1.0", | 48 | "gulp-jshint": "^2.1.0", |
| 49 | "gulp-rename": "^1.4.0", | 49 | "gulp-rename": "^1.4.0", |
| 50 | "gulp-replace": "^1.0.0", | 50 | "gulp-replace": "^1.0.0", |
| 51 | "gulp-sequence": "^1.0.0", | 51 | "gulp-sequence": "^1.0.0", |
| 52 | "gulp-uglify": "^3.0.1", | 52 | "gulp-uglify": "^3.0.1", |
| 53 | "gulp-uglify-es": "^1.0.4", | 53 | "gulp-uglify-es": "^1.0.4", |
| 54 | "jasmine-core": "^3.3.0", | 54 | "jasmine-core": "^3.4.0", |
| 55 | "jquery": "^3.3.1", | 55 | "jquery": "^3.4.1", |
| 56 | "jshint": "^2.10.1", | 56 | "jshint": "^2.10.2", |
| 57 | "pre-commit": "^1.2.2", | 57 | "pre-commit": "^1.2.2", |
| 58 | "pump": "^3.0.0", | 58 | "pump": "^3.0.0", |
| 59 | "ui-bootstrap4": "^3.0.6" | 59 | "ui-bootstrap4": "^3.0.6" |
| 60 | }, | ||
| 61 | "dependencies": { | ||
| 62 | "popper.js": "^1.15.0" | ||
| 60 | } | 63 | } |
| 61 | } | 64 | } |
| 62 | 65 |
src/js/controller.js
| 1 | angular.module('focaAbmPreciosCondiciones') | 1 | angular.module('focaAbmPreciosCondiciones') |
| 2 | .controller('focaAbmPreciosCondicionesController', [ | 2 | .controller('focaAbmPreciosCondicionesController', [ |
| 3 | '$scope', 'focaAbmPreciosCondicionesService', '$location', | 3 | '$scope', 'focaAbmPreciosCondicionesService', '$location', |
| 4 | 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage', | 4 | 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage','$routeParams','$uibModal', |
| 5 | function($scope, focaAbmPreciosCondicionesService, $location, | 5 | function($scope, focaAbmPreciosCondicionesService, $location, |
| 6 | focaModalService, focaBotoneraLateralService, $timeout, $localStorage) { | 6 | focaModalService, focaBotoneraLateralService, $timeout, $localStorage,$routeParams, $uibModal) { |
| 7 | 7 | ||
| 8 | $scope.focusSearch = false; | 8 | $scope.focusSearch = false; |
| 9 | $scope.filters = ''; | 9 | $scope.filters = ''; |
| 10 | $scope.now = new Date(); | 10 | $scope.now = new Date(); |
| 11 | $scope.creando = false; | ||
| 12 | $scope.crear = false; | ||
| 13 | $scope.listaPrecioLabel = ''; | ||
| 14 | $scope.mostrarPlazos = $routeParams.id > 0; | ||
| 15 | |||
| 11 | $timeout(function() { | 16 | $timeout(function() { |
| 12 | focaBotoneraLateralService.showSalir(true); | 17 | focaBotoneraLateralService.showSalir(true); |
| 13 | focaBotoneraLateralService.showPausar(false); | 18 | focaBotoneraLateralService.showPausar(false); |
| 14 | focaBotoneraLateralService.showCancelar(false); | 19 | focaBotoneraLateralService.showCancelar(false); |
| 15 | focaBotoneraLateralService.showGuardar(false); | 20 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
| 16 | 21 | ||
| 17 | $scope.focusSearch = true; | 22 | $scope.focusSearch = true; |
| 18 | }); | 23 | }); |
| 19 | 24 | ||
| 20 | $scope.filters = ''; | 25 | $scope.crearPrecioYCondicion = function () { |
| 21 | $scope.now = new Date(); | 26 | $scope.precioCondicion = { |
| 22 | $scope.editar = function(id) { | 27 | id: 0, |
| 23 | $location.path('/precio-condicion/' + id); | 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 | $scope.solicitarConfirmacion = function(precioCondicion) { | 85 | $scope.solicitarConfirmacion = function(precioCondicion) { |
| 26 | focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + | 86 | focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + |
| 27 | precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( | 87 | precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( |
| 28 | function(data) { | 88 | function(data) { |
| 29 | if (data) { | 89 | if (data) { |
| 30 | focaAbmPreciosCondicionesService | 90 | focaAbmPreciosCondicionesService |
| 31 | .borrarPrecioCondicion(precioCondicion.id); | 91 | .borrarPrecioCondicion(precioCondicion.id); |
| 32 | $scope.preciosCondiciones.splice( | 92 | $scope.preciosCondiciones.splice( |
| 33 | $scope.preciosCondiciones.indexOf(precioCondicion), 1 | 93 | $scope.preciosCondiciones.indexOf(precioCondicion), 1 |
| 34 | ); | 94 | ); |
| 35 | } | 95 | } |
| 36 | } | 96 | } |
| 37 | ); | 97 | ); |
| 38 | }; | 98 | }; |
| 39 | 99 | ||
| 40 | $scope.buscar = function(key) { | 100 | $scope.buscar = function(key) { |
| 41 | if(key === 13){ | 101 | if (key === 13) { |
| 102 | $scope.crear = true; | ||
| 42 | focaAbmPreciosCondicionesService | 103 | focaAbmPreciosCondicionesService |
| 43 | .obtenerPreciosCondiciones($scope.filters) | 104 | .obtenerPreciosCondiciones($scope.filters) |
| 44 | .then(function(datos) { | 105 | .then(function(datos) { |
| 45 | $scope.preciosCondiciones = datos.data; | 106 | $scope.preciosCondiciones = datos.data; |
| 46 | $scope.preciosCondiciones.forEach(function(precioCondicion) { | 107 | $scope.preciosCondiciones.forEach(function(precioCondicion) { |
| 47 | precioCondicion.plazoPago.sort(function(a, b) { | 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 | if ($localStorage.precioCondicion) { | 154 | if ($localStorage.precioCondicion) { |
| 56 | var precioCondicion = JSON.parse($localStorage.precioCondicion); | 155 | var precioCondicion = JSON.parse($localStorage.precioCondicion); |
| 57 | if (!precioCondicion.id) { precioCondicion.id = 0; } | 156 | if (!precioCondicion.id) { precioCondicion.id = 0; } |
| 58 | $location.path('/precio-condicion/' + precioCondicion.id); | 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 | .controller('focaAbmPrecioCondicionController', [ | 223 | .controller('focaAbmPrecioCondicionController', [ |
| 63 | '$scope', 'focaAbmPreciosCondicionesService', 'focaBotoneraLateralService', | 224 | '$scope', 'focaAbmPreciosCondicionesService', 'focaBotoneraLateralService', |
| 64 | '$routeParams', '$location', 'focaModalService', '$timeout', '$uibModal', '$window', '$localStorage', '$filter', | 225 | '$routeParams', '$location', 'focaModalService', '$timeout', '$uibModal', '$window', '$localStorage', '$filter', |
| 65 | function( | 226 | function( |
| 66 | $scope, focaAbmPreciosCondicionesService, focaBotoneraLateralService, | 227 | $scope, focaAbmPreciosCondicionesService, focaBotoneraLateralService, |
| 67 | $routeParams, $location, focaModalService, $timeout, $uibModal, $window, $localStorage, $filter) { | 228 | $routeParams, $location, focaModalService, $timeout, $uibModal, $window, $localStorage, $filter) { |
| 68 | $scope.focused = 1; | 229 | $scope.focused = 1; |
| 69 | $scope.plazosAEliminar = []; | 230 | $scope.plazosAEliminar = []; |
| 70 | $scope.mostrarPlazos = $routeParams.id > 0; | 231 | $scope.mostrarPlazos = $routeParams.id > 0; |
| 71 | $scope.now = new Date(); | 232 | $scope.now = new Date(); |
| 72 | $scope.listaPrecioLabel = ''; | 233 | $scope.listaPrecioLabel = ''; |
| 73 | $scope.precioCondicion = { | 234 | $scope.precioCondicion = { |
| 74 | id: 0, | 235 | id: 0, |
| 75 | codigo: '', | 236 | codigo: '', |
| 76 | nombre: '', | 237 | nombre: '', |
| 77 | descripcion: '', | 238 | descripcion: '', |
| 78 | idListaPrecio: 0, | 239 | idListaPrecio: 0, |
| 79 | vigencia: new Date() | 240 | vigencia: new Date() |
| 80 | }; | 241 | }; |
| 81 | focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) | 242 | // focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) |
| 82 | .then(function(datos) { | 243 | // .then(function(datos) { |
| 83 | if (datos.data.id) { | 244 | // if (datos.data.id) { |
| 84 | $scope.precioCondicion = datos.data; | 245 | // $scope.precioCondicion = datos.data; |
| 85 | $scope.listaPrecioLabel = datos.data.listaPrecio.ID.trim() + | 246 | // $scope.listaPrecioLabel = datos.data.listaPrecio.ID.trim() + |
| 86 | ' - ' + datos.data.listaPrecio.DES; | 247 | // ' - ' + datos.data.listaPrecio.DES; |
| 87 | $scope.$broadcast('addCabecera', { | 248 | // $scope.$broadcast('addCabecera', { |
| 88 | label: 'Precio y condición:', | 249 | // label: 'Precio y condición:', |
| 89 | valor: datos.data.nombre | 250 | // valor: datos.data.nombre |
| 90 | }); | 251 | // }); |
| 91 | focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) | 252 | // focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) |
| 92 | .then(function(datos) { | 253 | // .then(function(datos) { |
| 93 | $scope.precioCondicion.plazos = datos.data; | 254 | // console.log('Datos: ', datos); |
| 94 | $scope.precioCondicion.plazos.sort(function(a, b) { | 255 | // $scope.precioCondicion.plazos = datos.data; |
| 95 | return a.dias- b.dias; | 256 | // $scope.precioCondicion.plazos.sort(function(a, b) { |
| 96 | }); | 257 | // return a.dias- b.dias; |
| 97 | $scope.plazoACargar = | 258 | // }); |
| 98 | { | 259 | // $scope.plazoACargar = |
| 99 | item: datos.data.length + 1 | 260 | // { |
| 100 | }; | 261 | // item: datos.data.length + 1 |
| 101 | }); | 262 | // }; |
| 102 | } | 263 | // }); |
| 103 | }); | 264 | // } |
| 265 | // }); | ||
| 104 | 266 | ||
| 105 | $timeout(function() {getLSPrecioC();}); | 267 | $timeout(function() {getLSPrecioC();}); |
| 106 | 268 | ||
| 107 | $timeout(function() { | 269 | $timeout(function() { |
| 108 | focaBotoneraLateralService.showSalir(false); | 270 | focaBotoneraLateralService.showSalir(false); |
| 109 | focaBotoneraLateralService.showPausar(true); | 271 | focaBotoneraLateralService.showPausar(true); |
| 110 | focaBotoneraLateralService.showCancelar(false); | 272 | focaBotoneraLateralService.showCancelar(false); |
| 111 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | 273 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
| 112 | focaBotoneraLateralService.addCustomButton('Salir', $scope.salir); | 274 | focaBotoneraLateralService.addCustomButton('Salir', $scope.salir); |
| 113 | }); | 275 | }); |
| 114 | 276 | ||
| 115 | $scope.salir = function() { | 277 | $scope.salir = function() { |
| 116 | 278 | ||
| 117 | if ($scope.formPrecioCondicion.$pristine == false) { | 279 | if ($scope.formPrecioCondicion.$pristine == false) { |
| 118 | focaModalService.confirm( | 280 | focaModalService.confirm( |
| 119 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 281 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
| 120 | ).then(function(data) { | 282 | ).then(function(data) { |
| 121 | if (data) { | 283 | if (data) { |
| 122 | $location.path('/precio-condicion'); | 284 | $location.path('/precio-condicion'); |
| 123 | } | 285 | } |
| 124 | }); | 286 | }); |
| 125 | } else { | 287 | } else { |
| 126 | $location.path('/precio-condicion'); | 288 | $location.path('/precio-condicion'); |
| 127 | } | 289 | } |
| 128 | }; | 290 | }; |
| 129 | $scope.guardar = function() { | 291 | |
| 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 | }; | ||
| 171 | 292 | ||
| 172 | $scope.agregarPlazo = function(key) { | 293 | // $scope.agregarPlazo = function(key) { |
| 173 | if (key === 13) { | 294 | // if (key === 13) { |
| 174 | if (!$scope.plazoACargar.dias && $scope.plazoACargar.dias !== 0) { | 295 | // if (!$scope.plazoACargar.dias && $scope.plazoACargar.dias !== 0) { |
| 175 | focaModalService.alert('Ingrese cantidad de días'); | 296 | // focaModalService.alert('Ingrese cantidad de días'); |
| 176 | return; | 297 | // return; |
| 177 | } | 298 | // } |
| 178 | var tieneEseDia = $scope.precioCondicion.plazos.filter(function(a) { | 299 | // var tieneEseDia = $scope.precioCondicion.plazos.filter(function(a) { |
| 179 | return a.dias === $scope.plazoACargar.dias; | 300 | // return a.dias === $scope.plazoACargar.dias; |
| 180 | }); | 301 | // }); |
| 181 | if (tieneEseDia.length > 0) { | 302 | // if (tieneEseDia.length > 0) { |
| 182 | focaModalService.alert('Ya ha ingresado un plazo con esos días'); | 303 | // focaModalService.alert('Ya ha ingresado un plazo con esos días'); |
| 183 | return; | 304 | // return; |
| 184 | } | 305 | // } |
| 185 | $scope.plazoACargar.idPreciosCondiciones = $scope.precioCondicion.id; | 306 | // $scope.plazoACargar.idPreciosCondiciones = $scope.precioCondicion.id; |
| 186 | $scope.plazoACargar.activo = true; | 307 | // $scope.plazoACargar.activo = true; |
| 187 | $scope.precioCondicion.plazos.push($scope.plazoACargar); | 308 | // $scope.precioCondicion.plazos.push($scope.plazoACargar); |
| 188 | $scope.plazoACargar = | 309 | // $scope.plazoACargar = |
| 189 | { | 310 | // { |
| 190 | item: $scope.precioCondicion.plazos.length + 1 | 311 | // item: $scope.precioCondicion.plazos.length + 1 |
| 191 | }; | 312 | // }; |
| 192 | } | 313 | // } |
| 193 | }; | 314 | // }; |
| 194 | $scope.quitarPlazo = function(key) { | 315 | // $scope.quitarPlazo = function(key) { |
| 195 | if ($scope.precioCondicion.plazos[key].id) | 316 | // if ($scope.precioCondicion.plazos[key].id) |
| 196 | $scope.plazosAEliminar.push($scope.precioCondicion.plazos[key].id); | 317 | // $scope.plazosAEliminar.push($scope.precioCondicion.plazos[key].id); |
| 197 | 318 | ||
| 198 | $scope.precioCondicion.plazos.splice(key, 1); | 319 | // $scope.precioCondicion.plazos.splice(key, 1); |
| 199 | $scope.plazoACargar = | 320 | // $scope.plazoACargar = |
| 200 | { | 321 | // { |
| 201 | item: $scope.precioCondicion.plazos.length + 1 | 322 | // item: $scope.precioCondicion.plazos.length + 1 |
| 202 | }; | 323 | // }; |
| 203 | }; | 324 | // }; |
| 204 | $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { | 325 | // $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { |
| 205 | focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + | 326 | // focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + |
| 206 | plazoPago.item + ' ' + plazoPago.dias + ' ?').then( | 327 | // plazoPago.item + ' ' + plazoPago.dias + ' ?').then( |
| 207 | function(confirm) { | 328 | // function(confirm) { |
| 208 | if (confirm) { | 329 | // if (confirm) { |
| 209 | focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); | 330 | // focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); |
| 210 | $scope.precioCondicion.plazos.splice( | 331 | // $scope.precioCondicion.plazos.splice( |
| 211 | $scope.precioCondicion.plazos.indexOf(plazoPago), 1 | 332 | // $scope.precioCondicion.plazos.indexOf(plazoPago), 1 |
| 212 | ); | 333 | // ); |
| 213 | } | 334 | // } |
| 214 | } | 335 | // } |
| 215 | ); | 336 | // ); |
| 216 | }; | 337 | // }; |
| 217 | 338 | ||
| 218 | $scope.seleccionarListaPrecio = function(key) { | 339 | // $scope.seleccionarListaPrecio = function(key) { |
| 219 | if (key === 13){ | 340 | // if (key === 13){ |
| 220 | var modalInstance = $uibModal.open( | 341 | // var modalInstance = $uibModal.open( |
| 221 | { | 342 | // { |
| 222 | ariaLabelledBy: 'Busqueda de Listas de precio', | 343 | // ariaLabelledBy: 'Busqueda de Listas de precio', |
| 223 | templateUrl: 'modal-lista-precio.html', | 344 | // templateUrl: 'modal-lista-precio.html', |
| 224 | controller: 'focaModalListaPrecioCtrl', | 345 | // controller: 'focaModalListaPrecioCtrl', |
| 225 | size: 'lg' | 346 | // size: 'lg' |
| 226 | } | 347 | // } |
| 227 | ); | 348 | // ); |
| 228 | modalInstance.result.then(function(listaPrecio) { | 349 | // modalInstance.result.then(function(listaPrecio) { |
| 229 | $scope.precioCondicion.idListaPrecio = listaPrecio.ID; | 350 | // $scope.precioCondicion.idListaPrecio = listaPrecio.ID; |
| 230 | $scope.precioCondicion.listaPrecio = listaPrecio; | 351 | // $scope.precioCondicion.listaPrecio = listaPrecio; |
| 231 | $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES; | 352 | // $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES; |
| 232 | $scope.focused = 4; | 353 | // $scope.focused = 4; |
| 233 | }); | 354 | // }); |
| 234 | } | 355 | // } |
| 235 | }; | 356 | // }; |
| 236 | 357 | ||
| 237 | $scope.verProductosListaPrecio = function() { | 358 | // $scope.verProductosListaPrecio = function() { |
| 238 | $uibModal.open( | 359 | // $uibModal.open( |
| 239 | { | 360 | // { |
| 240 | ariaLabelledBy: 'Busqueda de Productos', | 361 | // ariaLabelledBy: 'Busqueda de Productos', |
| 241 | templateUrl: 'modal-busqueda-productos.html', | 362 | // templateUrl: 'modal-busqueda-productos.html', |
| 242 | controller: 'modalBusquedaProductosCtrl', | 363 | // controller: 'modalBusquedaProductosCtrl', |
| 243 | resolve: { | 364 | // resolve: { |
| 244 | parametroProducto: { | 365 | // parametroProducto: { |
| 245 | idLista: $scope.precioCondicion.listaPrecio.ID, | 366 | // idLista: $scope.precioCondicion.listaPrecio.ID, |
src/js/service.js
| 1 | angular.module('focaAbmPreciosCondiciones') | 1 | angular.module('focaAbmPreciosCondiciones') |
| 2 | .service('focaAbmPreciosCondicionesService', [ | 2 | .service('focaAbmPreciosCondicionesService', [ |
| 3 | '$http', 'API_ENDPOINT', | 3 | '$http', 'API_ENDPOINT', |
| 4 | function($http, API_ENDPOINT) { | 4 | function($http, API_ENDPOINT) { |
| 5 | return { | 5 | return { |
| 6 | obtenerPreciosCondiciones: function(nombre) { | 6 | obtenerPreciosCondiciones: function(nombre) { |
| 7 | return $http.post(API_ENDPOINT.URL + '/precios-condiciones', {nombre: nombre}); | 7 | return $http.post(API_ENDPOINT.URL + '/precios-condiciones', {nombre: nombre}); |
| 8 | }, | 8 | }, |
| 9 | obtenerPrecioCondicion: function(id) { | 9 | obtenerPrecioCondicion: function(id) { |
| 10 | return $http.get(API_ENDPOINT.URL + '/precio-condicion/' + id); | 10 | return $http.get(API_ENDPOINT.URL + '/precio-condicion/' + id); |
| 11 | }, | 11 | }, |
| 12 | guardarPrecioCondicion: function(precioCondicion) { | 12 | guardarPrecioCondicion: function(precioCondicion) { |
| 13 | return $http.post( | 13 | return $http.post( |
| 14 | API_ENDPOINT.URL + '/precio-condicion', | 14 | API_ENDPOINT.URL + '/precio-condicion', |
| 15 | {precioCondicion: precioCondicion} | 15 | {precioCondicion: precioCondicion} |
| 16 | ); | 16 | ); |
| 17 | }, | 17 | }, |
| 18 | borrarPrecioCondicion: function(id) { | 18 | borrarPrecioCondicion: function(id) { |
| 19 | return $http.delete(API_ENDPOINT.URL + '/precio-condicion/' + id); | 19 | return $http.delete(API_ENDPOINT.URL + '/precio-condicion/' + id); |
| 20 | }, | 20 | }, |
| 21 | obtenerPlazoPago: function(idPrecioCondicion) { | 21 | obtenerPlazoPago: function(idPrecioCondicion) { |
| 22 | return $http.get( | 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 | borrarPlazoPago: function(id) { | 26 | borrarPlazoPago: function(id) { |
| 27 | return $http.delete(API_ENDPOINT.URL + '/plazo-pago/' + id); | 27 | return $http.delete(API_ENDPOINT.URL + '/plazo-pago/' + id); |
| 28 | }, | 28 | }, |
| 29 | guardarPlazosPago: function(plazos) { | 29 | guardarPlazosPago: function(plazos) { |
| 30 | return $http.post( | 30 | return $http.post( |
| 31 | API_ENDPOINT.URL + '/plazos-pago', | 31 | API_ENDPOINT.URL + '/plazos-pago', |
| 32 | {plazosPago: plazos} | 32 | {plazosPago: plazos} |
| 33 | ); | 33 | ); |
| 34 | } | 34 | } |
| 35 | }; | 35 | }; |
| 36 | } | 36 | } |
| 37 | ]); | 37 | ]); |
| 38 | 38 |
src/views/foca-abm-precios-condiciones-item.html
| 1 | <div class="row"> | 1 | <div class="row"> |
| 2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
| 3 | titulo="'Precios y condiciones'" | 3 | titulo="'Precios y condiciones'" |
| 4 | fecha="now" | 4 | fecha="now" |
| 5 | class="mb-0 col-lg-12" | 5 | class="mb-0 col-lg-12" |
| 6 | ></foca-cabecera-facturador> | 6 | ></foca-cabecera-facturador> |
| 7 | </div> | 7 | </div> |
| 8 | <div class="row"> | 8 | <div class="row"> |
| 9 | <form class= "col-md-10" name="formPrecioCondicion"> | 9 | <form class= "col-md-10" name="formPrecioCondicion"> |
| 10 | <input type="hidden" name="id" ng-model="precioCondicion.id" /> | 10 | <input type="hidden" name="id" ng-model="precioCondicion.id" /> |
| 11 | <div class="row mb-3"> | 11 | <div class="row mb-3"> |
| 12 | <label class="col-sm-2 col-form-label">Código</label> | 12 | <label class="col-sm-2 col-form-label">Código</label> |
| 13 | <input | 13 | <input |
| 14 | class="form-control col-sm-4" | 14 | class="form-control col-sm-4" |
| 15 | type="text" | 15 | type="text" |
| 16 | name="codigo" | 16 | name="codigo" |
| 17 | ng-value="precioCondicion.id | rellenarDigitos: 4: 0" | 17 | ng-value="precioCondicion.id | rellenarDigitos: 4: 0" |
| 18 | autocomplete="off" | 18 | autocomplete="off" |
| 19 | readonly | 19 | readonly |
| 20 | /> | 20 | /> |
| 21 | <label class="col-sm-2 col-form-label">Nombre</label> | 21 | <label class="col-sm-2 col-form-label">Nombre</label> |
| 22 | <input | 22 | <input |
| 23 | class="form-control col-sm-4" | 23 | class="form-control col-sm-4" |
| 24 | type="text" | 24 | type="text" |
| 25 | name="nombre" | 25 | name="nombre" |
| 26 | ng-model="precioCondicion.nombre" | 26 | ng-model="precioCondicion.nombre" |
| 27 | autocomplete="off" | 27 | autocomplete="off" |
| 28 | foca-focus="focused == 1" | 28 | foca-focus="focused == 1" |
| 29 | ng-focus="focused = 1" | 29 | ng-focus="focused = 1" |
| 30 | ng-keypress="next($event.keyCode)" | 30 | ng-keypress="next($event.keyCode)" |
| 31 | teclado-virtual | 31 | teclado-virtual |
| 32 | /> | 32 | /> |
| 33 | </div> | 33 | </div> |
| 34 | <div class="form-group row"> | 34 | <div class="form-group row"> |
| 35 | <label class="col-sm-2 col-form-label">Descripción</label> | 35 | <label class="col-sm-2 col-form-label">Descripción</label> |
| 36 | <input | 36 | <input |
| 37 | class="form-control col-sm-10" | 37 | class="form-control col-sm-10" |
| 38 | type="text" | 38 | type="text" |
| 39 | name="nombre" | 39 | name="nombre" |
| 40 | ng-model="precioCondicion.descripcion" | 40 | ng-model="precioCondicion.descripcion" |
| 41 | autocomplete="off" | 41 | autocomplete="off" |
| 42 | foca-focus="focused == 2" | 42 | foca-focus="focused == 2" |
| 43 | ng-focus="focused = 2" | 43 | ng-focus="focused = 2" |
| 44 | ng-keypress="next($event.keyCode)" | 44 | ng-keypress="next($event.keyCode)" |
| 45 | teclado-virtual | 45 | teclado-virtual |
| 46 | /> | 46 | /> |
| 47 | </div> | 47 | </div> |
| 48 | <div class="row"> | 48 | <div class="row"> |
| 49 | <label class="col-sm-2 col-form-label">Lista de precios</label> | 49 | <label class="col-sm-2 col-form-label">Lista de precios</label> |
| 50 | <div class="col-sm-4 input-group p-0"> | 50 | <div class="col-sm-2 input-group p-0"> |
| 51 | <input | 51 | <input |
| 52 | ng-model="listaPrecioLabel" | 52 | ng-model="listaPrecioLabel" |
| 53 | class="form-control" | 53 | class="form-control" |
| 54 | foca-focus="focused == 3" | 54 | foca-focus="focused == 3" |
| 55 | ng-focus="focused = 3" | 55 | ng-focus="focused = 3" |
| 56 | ng-keypress="seleccionarListaPrecio($event.keyCode)" | 56 | ng-keypress="seleccionarListaPrecio($event.keyCode)" |
| 57 | readonly | 57 | readonly |
| 58 | /> | 58 | /> |
| 59 | <div class="input-group-append"> | 59 | <div class="input-group-append"> |
| 60 | <button | 60 | <button |
| 61 | class="btn btn-outline-secondary form-control" | 61 | class="btn btn-outline-secondary form-control" |
| 62 | title="Ver productos" | 62 | title="Ver productos" |
| 63 | type="button" | 63 | type="button" |
| 64 | ng-click="verProductosListaPrecio()" | 64 | ng-click="verProductosListaPrecio()" |
| 65 | ng-show="precioCondicion.listaPrecio" | 65 | ng-show="precioCondicion.listaPrecio" |
| 66 | > | 66 | > |
| 67 | <i class="fa fa-eye" aria-hidden="true"></i> | 67 | <i class="fa fa-eye" aria-hidden="true"></i> |
| 68 | </button> | 68 | </button> |
| 69 | <button | 69 | <button |
| 70 | ladda="searchLoading" | 70 | ladda="searchLoading" |
| 71 | class="btn btn-outline-secondary form-control" | 71 | class="btn btn-outline-secondary form-control" |
| 72 | title="Buscar" | 72 | title="Buscar" |
| 73 | type="button" | 73 | type="button" |
| 74 | ng-click="seleccionarListaPrecio(13)" | 74 | ng-click="seleccionarListaPrecio(13)" |
| 75 | > | 75 | > |
| 76 | <i class="fa fa-search" aria-hidden="true"></i> | 76 | <i class="fa fa-search" aria-hidden="true"></i> |
| 77 | </button> | 77 | </button> |
| 78 | </div> | 78 | </div> |
| 79 | </div> | 79 | </div> |
| 80 | <label class="col-sm-2 col-form-label" ng-show="mostrarPlazos">Plazos</label> | 80 | <label class="col-sm-2 col-form-label" ng-show="mostrarPlazos">Plazos</label> |
| 81 | <div class="col-sm-4 p-0" ng-show="mostrarPlazos"> | 81 | <div class="col-sm-4 p-0" ng-show="mostrarPlazos"> |
| 82 | <div class="input-group p-0"> | 82 | <div class="input-group p-0"> |
| 83 | <input | 83 | <input |
| 84 | type="number" | 84 | type="number" |
| 85 | class="form-control text-right" | 85 | class="form-control text-right" |
| 86 | min="0" | 86 | min="0" |
| 87 | ng-model="plazoACargar.dias" | 87 | ng-model="plazoACargar.dias" |
| 88 | ng-keypress="agregarPlazo($event.keyCode)" | 88 | ng-keypress="agregarPlazo($event.keyCode)" |
| 89 | foca-focus="focused == 4" | 89 | foca-focus="focused == 4" |
| 90 | ng-focus="focused = 4" | 90 | ng-focus="focused = 4" |
| 91 | placeholder="Días" | 91 | placeholder="Días" |
| 92 | teclado-virtual | 92 | teclado-virtual |
| 93 | /> | 93 | /> |
| 94 | <div class="input-group-append"> | 94 | <div class="input-group-append"> |
| 95 | <button | 95 | <button |
| 96 | class="btn btn-outline-secondary form-control" | 96 | class="btn btn-outline-secondary form-control" |
| 97 | title="Agregar" | 97 | title="Agregar" |
| 98 | type="button" | 98 | type="button" |
| 99 | ng-click="agregarPlazo(13)" | 99 | ng-click="agregarPlazo(13)" |
| 100 | > | 100 | > |
| 101 | <i class="fa fa-save" aria-hidden="true"></i> | 101 | <i class="fa fa-save" aria-hidden="true"></i> |
| 102 | </button> | 102 | </button> |
| 103 | </div> | 103 | </div> |
| 104 | </div> | 104 | </div> |
| 105 | <table class="table table-striped table-sm"> | 105 | <table class="table table-striped table-sm"> |
| 106 | <tbody> | 106 | <tbody> |
| 107 | <tr ng-repeat="(key, plazo) in precioCondicion.plazos"> | 107 | <tr ng-repeat="(key, plazo) in precioCondicion.plazos"> |
| 108 | <td class="text-right" > | 108 | <td class="text-right" > |
| 109 | <span ng-bind="plazo.dias + ' días'"></span> | 109 | <span ng-bind="plazo.dias + ' días'"></span> |
| 110 | <button | 110 | <button |
| 111 | type="button" | 111 | type="button" |
| 112 | title="Eliminar" | 112 | title="Eliminar" |
| 113 | class="btn btn-outline-secondary ml-1" | 113 | class="btn btn-outline-secondary ml-1" |
| 114 | ng-click="quitarPlazo(key)" | 114 | ng-click="quitarPlazo(key)" |
| 115 | > | 115 | > |
| 116 | <i class="fa fa-trash"></i> | 116 | <i class="fa fa-trash"></i> |
| 117 | </button> | 117 | </button> |
| 118 | </td> | 118 | </td> |
| 119 | </tr> | 119 | </tr> |
| 120 | </tbody> | 120 | </tbody> |
| 121 | </table> | 121 | </table> |
| 122 | </div> | 122 | </div> |
| 123 | </div> | 123 | </div> |
| 124 | </form> | 124 | </form> |
| 125 | </div> | 125 | </div> |
| 126 | 126 |
src/views/foca-abm-precios-condiciones-listado.html
| 1 | <div class="row"> | 1 | <div class="row"> |
| 2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
| 3 | titulo="'Precios y condiciones'" | 3 | titulo="'Precios y condiciones'" |
| 4 | fecha="now" | 4 | fecha="now" |
| 5 | class="mb-0 col-lg-12" | 5 | class="mb-0 col-lg-12" |
| 6 | ></foca-cabecera-facturador> | 6 | ></foca-cabecera-facturador> |
| 7 | </div> | 7 | </div> |
| 8 | <div class="row"> | 8 | <div class="row"> |
| 9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> | 9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> |
| 10 | <div class="form-group input-group mt-3 px-5"> | 10 | <div class="form-group input-group mt-3 px-5"> |
| 11 | <input | 11 | <input |
| 12 | type="text" | 12 | type="text" |
| 13 | class="form-control form-control-sm" | 13 | class="form-control form-control-sm" |
| 14 | id="search" | 14 | id="search" |
| 15 | placeholder="Búsqueda" | 15 | placeholder="Búsqueda" |
| 16 | teclado-virtual | 16 | teclado-virtual |
| 17 | ng-keypress="buscar($event.keyCode)" | 17 | ng-keypress="buscar($event.keyCode)" |
| 18 | ng-model="filters" | 18 | ng-model="filters" |
| 19 | foca-focus="focusSearch" | 19 | foca-focus="focusSearch" |
| 20 | /> | 20 | /> |
| 21 | <div class="input-group-append"> | 21 | <div class="input-group-append"> |
| 22 | <button | 22 | <button |
| 23 | ladda="searchLoading" | 23 | ladda="searchLoading" |
| 24 | class="btn btn-outline-secondary" | 24 | class="btn btn-outline-secondary" |
| 25 | type="button" | 25 | type="button" |
| 26 | ng-click="buscar(13)" | 26 | ng-click="buscar(13)" |
| 27 | > | 27 | > |
| 28 | <i class="fa fa-search" aria-hidden="true"></i> | 28 | <i class="fa fa-search" aria-hidden="true"></i> |
| 29 | </button> | 29 | </button> |
| 30 | </div> | 30 | </div> |
| 31 | </div> | 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 | <thead> | 33 | <thead> |
| 34 | <tr> | 34 | <tr> |
| 35 | <th>Código</th> | 35 | <th>Código</th> |
| 36 | <th>Nombre</th> | 36 | <th>Nombre</th> |
| 37 | <th>Lista de precio</th> | 37 | <th>Lista de precio</th> |
| 38 | <th>Plazos</th> | 38 | <th>Plazos</th> |
| 39 | <th colspan="2" class="text-center"> | 39 | <th colspan="2" class="text-center"> |
| 40 | <button | 40 | <button |
| 41 | title="Agregar" | 41 | title="Agregar Precio y Condicion" |
| 42 | class="btn btn-outline-debo boton-accion" | 42 | class="btn btn-outline-debo boton-accion" |
| 43 | ng-click="editar(0)"> | 43 | ng-click="crearPrecioYCondicion()" |
| 44 | ng-disabled="!crear" | ||
| 45 | > | ||
| 44 | <i class="fa fa-plus"></i> | 46 | <i class="fa fa-plus"></i> |
| 45 | </button> | 47 | </button> |
| 46 | </th> | 48 | </th> |
| 47 | </tr> | 49 | </tr> |
| 48 | </thead> | 50 | </thead> |
| 49 | <tbody> | 51 | <tbody> |
| 50 | <tr ng-repeat="precioCondicion in preciosCondiciones"> | 52 | <tr ng-repeat="(key, precioCondicion) in preciosCondiciones" ng-hide="precioCondicion.desactivado"> |
| 51 | <td ng-bind="precioCondicion.id | rellenarDigitos: 4: 0"></td> | 53 | <td ng-bind="precioCondicion.id | rellenarDigitos: 4: 0" ng-hide="precioCondicion.editando"></td> |
| 52 | <td ng-bind="precioCondicion.nombre"></td> | 54 | <td ng-show="precioCondicion.editando"> |
| 53 | <td ng-bind="precioCondicion.listaPrecio.ID + ' - ' + precioCondicion.listaPrecio.DES + ' - ' + precioCondicion.listaPrecio.moneda.DETALLE"></td> | 55 | <input |
| 54 | <td><span | 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 | ng-repeat="plazo in precioCondicion.plazoPago" | 115 | ng-repeat="plazo in precioCondicion.plazoPago" |
| 56 | ng-if="plazo.activo" | 116 | ng-if="plazo.activo" |
| 57 | ng-bind="$last ? plazo.dias : plazo.dias + ', '"></span></td> | 117 | ng-bind="$last ? plazo.dias : plazo.dias + ', '" |
| 58 | <td class="text-center"> | 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 | <button | 137 | <button |
| 60 | title="Editar" | 138 | title="Editar" |
| 61 | class="btn btn-outline-dark boton-accion" | 139 | class="btn btn-outline-dark boton-accion" |
| 62 | ng-click="editar(precioCondicion.id)"> | 140 | ng-click="editar(precioCondicion)"> |
| 63 | <i class="fa fa-pencil"></i> | 141 | <i class="fa fa-pencil"></i> |
| 64 | </button> | 142 | </button> |
| 65 | <button | 143 | <button |
| 66 | title="Eliminar" | 144 | title="Eliminar" |
| 67 | class="btn btn-outline-dark boton-accion" | 145 | class="btn btn-outline-dark boton-accion" |
| 68 | ng-click="solicitarConfirmacion(precioCondicion)"> | 146 | ng-click="solicitarConfirmacion(precioCondicion)"> |
| 69 | <i class="fa fa-trash"></i> | 147 | <i class="fa fa-trash"></i> |
| 70 | </button> | 148 | </button> |
| 71 | </td> | 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 | </tr> | 164 | </tr> |
| 73 | </tbody> | 165 | </tbody> |
| 74 | </table> | 166 | </table> |
| 75 | </div> | 167 | </div> |
| 76 | </div> | 168 | </div> |
| 77 | 169 |
src/views/foca-abm-precios-condiciones-modal-confirmar.html
| 1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
| 2 | <h4>Confirmar</h4> | 2 | <h4>Confirmar</h4> |
| 3 | </div> | 3 | </div> |
| 4 | <div class="modal-body"> | 4 | <div class="modal-body"> |
| 5 | <p> | 5 | <p> |
| 6 | ¿Está seguro que desea borrar el precio condición | 6 | ¿Está seguro que desea borrar el precio condición |
| 7 | {{precioCondicion.codigo}} {{precioCondicion.nombre}}? | 7 | {{precioCondicion.codigo}} {{precioCondicion.nombre}}? |
| 8 | </p> | 8 | </p> |
| 9 | </div> | 9 | </div> |
| 10 | <div class="modal-footer"> | 10 | <div class="modal-footer"> |
| 11 | <button class="btn btn-danger" ng-click="borrar()">Borrar</button> | 11 | <button class="btn btn-danger" ng-click="borrar()">Borrar</button> |
| 12 | <button class="btn btn-default" ng-click="cancelar()">Cancelar</button> | 12 | <button class="btn btn-default" ng-click="cancelar()">Cancelar</button> |
| 13 | </div> | 13 | </div> |
| 14 | <a href="#!/" title="Salir" | 14 | <a href="#!/" title="Salir" |
| 15 | class="btn btn-secondary btn-block float-right col-md-2" | 15 | class="btn btn-secondary btn-block float-right col-md-2" |
| 16 | > | 16 | > |
| 17 | Salir | 17 | Salir |
| 18 | </a> | 18 | </a> |
| 19 | 19 |