Commit 838be37ae102ba7a70fe2b9e1964dd30ea9c6806

Authored by Luigi
Exists in master and in 1 other branch develop

Merge branch 'master' into 'develop'

Master

See merge request !15
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',
5 function($scope, focaAbmPreciosCondicionesService, $location, 5 function($scope, focaAbmPreciosCondicionesService, $location,
6 focaModalService, focaBotoneraLateralService, $timeout, $localStorage) { 6 focaModalService, focaBotoneraLateralService, $timeout, $localStorage) {
7 7
8 $scope.focusSearch = false;
9 $scope.filters = '';
10 $scope.now = new Date();
8 $timeout(function() { 11 $timeout(function() {
9 focaBotoneraLateralService.showSalir(true); 12 focaBotoneraLateralService.showSalir(true);
10 focaBotoneraLateralService.showPausar(false); 13 focaBotoneraLateralService.showPausar(false);
11 focaBotoneraLateralService.showCancelar(false); 14 focaBotoneraLateralService.showCancelar(false);
12 focaBotoneraLateralService.showGuardar(false); 15 focaBotoneraLateralService.showGuardar(false);
16
17 $scope.focusSearch = true;
13 }); 18 });
14 19
15 $scope.filters = ''; 20 $scope.filters = '';
16 $scope.now = new Date(); 21 $scope.now = new Date();
17 $scope.editar = function(id) { 22 $scope.editar = function(id) {
18 $location.path('/precio-condicion/' + id); 23 $location.path('/precio-condicion/' + id);
19 }; 24 };
20 $scope.solicitarConfirmacion = function(precioCondicion) { 25 $scope.solicitarConfirmacion = function(precioCondicion) {
21 focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + 26 focaModalService.confirm('¿Está seguro que desea borrar el precio condición' +
22 precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( 27 precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then(
23 function(data) { 28 function(data) {
24 if (data) { 29 if (data) {
25 focaAbmPreciosCondicionesService 30 focaAbmPreciosCondicionesService
26 .borrarPrecioCondicion(precioCondicion.id); 31 .borrarPrecioCondicion(precioCondicion.id);
27 $scope.preciosCondiciones.splice( 32 $scope.preciosCondiciones.splice(
28 $scope.preciosCondiciones.indexOf(precioCondicion), 1 33 $scope.preciosCondiciones.indexOf(precioCondicion), 1
29 ); 34 );
30 } 35 }
31 } 36 }
32 ); 37 );
33 }; 38 };
34 39
35 $scope.buscar = function(key) { 40 $scope.buscar = function(key) {
36 if(key === 13){ 41 if(key === 13){
37 focaAbmPreciosCondicionesService 42 focaAbmPreciosCondicionesService
38 .obtenerPreciosCondiciones($scope.filters) 43 .obtenerPreciosCondiciones($scope.filters)
39 .then(function(datos) { 44 .then(function(datos) {
40 $scope.preciosCondiciones = datos.data; 45 $scope.preciosCondiciones = datos.data;
41 $scope.preciosCondiciones.forEach(function(precioCondicion) { 46 $scope.preciosCondiciones.forEach(function(precioCondicion) {
42 precioCondicion.plazoPago.sort(function(a, b) { 47 precioCondicion.plazoPago.sort(function(a, b) {
43 return a.dias- b.dias; 48 return a.dias- b.dias;
44 }); 49 });
45 }); 50 });
46 }); 51 });
47 } 52 }
48 }; 53 };
49 54
50 if ($localStorage.precioCondicion) { 55 if ($localStorage.precioCondicion) {
51 var precioCondicion = JSON.parse($localStorage.precioCondicion); 56 var precioCondicion = JSON.parse($localStorage.precioCondicion);
52 if (!precioCondicion.id) { precioCondicion.id = 0; } 57 if (!precioCondicion.id) { precioCondicion.id = 0; }
53 $location.path('/precio-condicion/' + precioCondicion.id); 58 $location.path('/precio-condicion/' + precioCondicion.id);
54 } 59 }
55 } 60 }
56 ]) 61 ])
57 .controller('focaAbmPrecioCondicionController', [ 62 .controller('focaAbmPrecioCondicionController', [
58 '$scope', 'focaAbmPreciosCondicionesService', 'focaBotoneraLateralService', 63 '$scope', 'focaAbmPreciosCondicionesService', 'focaBotoneraLateralService',
59 '$routeParams', '$location', 'focaModalService', '$timeout', '$uibModal', '$window', '$localStorage', '$filter', 64 '$routeParams', '$location', 'focaModalService', '$timeout', '$uibModal', '$window', '$localStorage', '$filter',
60 function( 65 function(
61 $scope, focaAbmPreciosCondicionesService, focaBotoneraLateralService, 66 $scope, focaAbmPreciosCondicionesService, focaBotoneraLateralService,
62 $routeParams, $location, focaModalService, $timeout, $uibModal, $window, $localStorage, $filter) { 67 $routeParams, $location, focaModalService, $timeout, $uibModal, $window, $localStorage, $filter) {
63 $scope.focused = 1; 68 $scope.focused = 1;
64 $scope.plazosAEliminar = []; 69 $scope.plazosAEliminar = [];
65 $scope.mostrarPlazos = $routeParams.id > 0; 70 $scope.mostrarPlazos = $routeParams.id > 0;
66 $scope.now = new Date(); 71 $scope.now = new Date();
67 $scope.listaPrecioLabel = ''; 72 $scope.listaPrecioLabel = '';
68 focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) 73 focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id)
69 .then(function(datos) { 74 .then(function(datos) {
70 $scope.precioCondicion = { 75 $scope.precioCondicion = {
71 id: 0, 76 id: 0,
72 codigo: '', 77 codigo: '',
73 nombre: '', 78 nombre: '',
74 descripcion: '', 79 descripcion: '',
75 idListaPrecio: 0, 80 idListaPrecio: 0,
76 vigencia: new Date() 81 vigencia: new Date()
77 }; 82 };
78 if (datos.data.id) { 83 if (datos.data.id) {
79 $scope.precioCondicion = datos.data; 84 $scope.precioCondicion = datos.data;
80 $scope.listaPrecioLabel = datos.data.listaPrecio.ID.trim() + 85 $scope.listaPrecioLabel = datos.data.listaPrecio.ID.trim() +
81 ' - ' + datos.data.listaPrecio.DES; 86 ' - ' + datos.data.listaPrecio.DES;
82 $scope.$broadcast('addCabecera', { 87 $scope.$broadcast('addCabecera', {
83 label: 'Precio y condición:', 88 label: 'Precio y condición:',
84 valor: datos.data.nombre 89 valor: datos.data.nombre
85 }); 90 });
86 focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) 91 focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id)
87 .then(function(datos) { 92 .then(function(datos) {
88 $scope.precioCondicion.plazos = datos.data; 93 $scope.precioCondicion.plazos = datos.data;
89 $scope.precioCondicion.plazos.sort(function(a, b) { 94 $scope.precioCondicion.plazos.sort(function(a, b) {
90 return a.dias- b.dias; 95 return a.dias- b.dias;
91 }); 96 });
92 $scope.plazoACargar = 97 $scope.plazoACargar =
93 { 98 {
94 item: datos.data.length + 1 99 item: datos.data.length + 1
95 }; 100 };
96 }); 101 });
97 } 102 }
98 }); 103 });
99 104
100 $timeout(function() {getLSPrecioC();}); 105 $timeout(function() {getLSPrecioC();});
101 106
102 $timeout(function() { 107 $timeout(function() {
103 focaBotoneraLateralService.showSalir(false); 108 focaBotoneraLateralService.showSalir(false);
104 focaBotoneraLateralService.showPausar(true); 109 focaBotoneraLateralService.showPausar(true);
105 focaBotoneraLateralService.showCancelar(false); 110 focaBotoneraLateralService.showCancelar(false);
106 focaBotoneraLateralService.showGuardar(true, $scope.guardar); 111 focaBotoneraLateralService.showGuardar(true, $scope.guardar);
107 focaBotoneraLateralService.addCustomButton('Salir', $scope.salir); 112 focaBotoneraLateralService.addCustomButton('Salir', $scope.salir);
108 }); 113 });
109 114
110 $scope.salir = function() { 115 $scope.salir = function() {
111 116
112 if ($scope.formPrecioCondicion.$pristine == false) { 117 if ($scope.formPrecioCondicion.$pristine == false) {
113 focaModalService.confirm( 118 focaModalService.confirm(
114 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' 119 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
115 ).then(function(data) { 120 ).then(function(data) {
116 if (data) { 121 if (data) {
117 $location.path('/precio-condicion'); 122 $location.path('/precio-condicion');
118 } 123 }
119 }); 124 });
120 } else { 125 } else {
121 $location.path('/precio-condicion'); 126 $location.path('/precio-condicion');
122 } 127 }
123 }; 128 };
124 $scope.guardar = function() { 129 $scope.guardar = function() {
125 130
126 if (!$scope.precioCondicion.nombre) { 131 if (!$scope.precioCondicion.nombre) {
127 focaModalService.alert('Ingrese nombre'); 132 focaModalService.alert('Ingrese nombre');
128 return; 133 return;
129 } else if (!$scope.precioCondicion.descripcion) { 134 } else if (!$scope.precioCondicion.descripcion) {
130 focaModalService.alert('Ingrese descripcion'); 135 focaModalService.alert('Ingrese descripcion');
131 return; 136 return;
132 } else if (!$scope.precioCondicion.idListaPrecio) { 137 } else if (!$scope.precioCondicion.idListaPrecio) {
133 focaModalService.alert('Seleccione precio'); 138 focaModalService.alert('Seleccione precio');
134 return; 139 return;
135 } 140 }
136 141
137 var promises = []; 142 var promises = [];
138 var precioCondicion = $scope.precioCondicion; 143 var precioCondicion = $scope.precioCondicion;
139 precioCondicion.idListaPrecio = precioCondicion.listaPrecio.ID; 144 precioCondicion.idListaPrecio = precioCondicion.listaPrecio.ID;
140 delete precioCondicion.listaPrecio; 145 delete precioCondicion.listaPrecio;
141 if ($scope.mostrarPlazos) { 146 if ($scope.mostrarPlazos) {
142 promises.push( 147 promises.push(
143 focaAbmPreciosCondicionesService 148 focaAbmPreciosCondicionesService
144 .guardarPlazosPago($scope.precioCondicion.plazos) 149 .guardarPlazosPago($scope.precioCondicion.plazos)
145 ); 150 );
146 $scope.plazosAEliminar.forEach(function(id) { 151 $scope.plazosAEliminar.forEach(function(id) {
147 promises.push( 152 promises.push(
148 focaAbmPreciosCondicionesService 153 focaAbmPreciosCondicionesService
149 .borrarPlazoPago(id) 154 .borrarPlazoPago(id)
150 ); 155 );
151 }); 156 });
152 } 157 }
153 promises.push( 158 promises.push(
154 focaAbmPreciosCondicionesService 159 focaAbmPreciosCondicionesService
155 .guardarPrecioCondicion(precioCondicion) 160 .guardarPrecioCondicion(precioCondicion)
156 ); 161 );
157 162
158 Promise.all(promises).then(function() { 163 Promise.all(promises).then(function() {
159 $timeout(function() { 164 $timeout(function() {
160 $location.path('/precio-condicion'); 165 $location.path('/precio-condicion');
161 }, 0); 166 }, 0);
162 }, function(err){ 167 }, function(err){
163 console.error(err); 168 console.error(err);
164 }); 169 });
165 }; 170 };
166 171
167 $scope.agregarPlazo = function(key) { 172 $scope.agregarPlazo = function(key) {
168 if (key === 13) { 173 if (key === 13) {
169 if (!$scope.plazoACargar.dias && $scope.plazoACargar.dias !== 0) { 174 if (!$scope.plazoACargar.dias && $scope.plazoACargar.dias !== 0) {
170 focaModalService.alert('Ingrese cantidad de días'); 175 focaModalService.alert('Ingrese cantidad de días');
171 return; 176 return;
172 } 177 }
173 var tieneEseDia = $scope.precioCondicion.plazos.filter(function(a) { 178 var tieneEseDia = $scope.precioCondicion.plazos.filter(function(a) {
174 return a.dias === $scope.plazoACargar.dias; 179 return a.dias === $scope.plazoACargar.dias;
175 }); 180 });
176 if (tieneEseDia.length > 0) { 181 if (tieneEseDia.length > 0) {
177 focaModalService.alert('Ya ha ingresado un plazo con esos días'); 182 focaModalService.alert('Ya ha ingresado un plazo con esos días');
178 return; 183 return;
179 } 184 }
180 $scope.plazoACargar.idPreciosCondiciones = $scope.precioCondicion.id; 185 $scope.plazoACargar.idPreciosCondiciones = $scope.precioCondicion.id;
181 $scope.plazoACargar.activo = true; 186 $scope.plazoACargar.activo = true;
182 $scope.precioCondicion.plazos.push($scope.plazoACargar); 187 $scope.precioCondicion.plazos.push($scope.plazoACargar);
183 $scope.plazoACargar = 188 $scope.plazoACargar =
184 { 189 {
185 item: $scope.precioCondicion.plazos.length + 1 190 item: $scope.precioCondicion.plazos.length + 1
186 }; 191 };
187 } 192 }
188 }; 193 };
189 $scope.quitarPlazo = function(key) { 194 $scope.quitarPlazo = function(key) {
190 if ($scope.precioCondicion.plazos[key].id) 195 if ($scope.precioCondicion.plazos[key].id)
191 $scope.plazosAEliminar.push($scope.precioCondicion.plazos[key].id); 196 $scope.plazosAEliminar.push($scope.precioCondicion.plazos[key].id);
192 197
193 $scope.precioCondicion.plazos.splice(key, 1); 198 $scope.precioCondicion.plazos.splice(key, 1);
194 $scope.plazoACargar = 199 $scope.plazoACargar =
195 { 200 {
196 item: $scope.precioCondicion.plazos.length + 1 201 item: $scope.precioCondicion.plazos.length + 1
197 }; 202 };
198 }; 203 };
199 $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { 204 $scope.solicitarConfirmacionPlazoPago = function(plazoPago) {
200 focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + 205 focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' +
201 plazoPago.item + ' ' + plazoPago.dias + ' ?').then( 206 plazoPago.item + ' ' + plazoPago.dias + ' ?').then(
202 function(confirm) { 207 function(confirm) {
203 if (confirm) { 208 if (confirm) {
204 focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); 209 focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id);
205 $scope.precioCondicion.plazos.splice( 210 $scope.precioCondicion.plazos.splice(
206 $scope.precioCondicion.plazos.indexOf(plazoPago), 1 211 $scope.precioCondicion.plazos.indexOf(plazoPago), 1
207 ); 212 );
208 } 213 }
209 } 214 }
210 ); 215 );
211 }; 216 };
212 217
213 $scope.seleccionarListaPrecio = function(key) { 218 $scope.seleccionarListaPrecio = function(key) {
214 if (key === 13){ 219 if (key === 13){
215 var modalInstance = $uibModal.open( 220 var modalInstance = $uibModal.open(
216 { 221 {
217 ariaLabelledBy: 'Busqueda de Listas de precio', 222 ariaLabelledBy: 'Busqueda de Listas de precio',
218 templateUrl: 'modal-lista-precio.html', 223 templateUrl: 'modal-lista-precio.html',
219 controller: 'focaModalListaPrecioCtrl', 224 controller: 'focaModalListaPrecioCtrl',
220 size: 'lg' 225 size: 'lg'
221 } 226 }
222 ); 227 );
223 modalInstance.result.then(function(listaPrecio) { 228 modalInstance.result.then(function(listaPrecio) {
224 $scope.precioCondicion.idListaPrecio = listaPrecio.ID; 229 $scope.precioCondicion.idListaPrecio = listaPrecio.ID;
225 $scope.precioCondicion.listaPrecio = listaPrecio; 230 $scope.precioCondicion.listaPrecio = listaPrecio;
226 $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES; 231 $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES;
227 $scope.focused = 4; 232 $scope.focused = 4;
228 }); 233 });
229 } 234 }
230 }; 235 };
231 236
232 $scope.verProductosListaPrecio = function() { 237 $scope.verProductosListaPrecio = function() {
233 $uibModal.open( 238 $uibModal.open(
234 { 239 {
235 ariaLabelledBy: 'Busqueda de Productos', 240 ariaLabelledBy: 'Busqueda de Productos',
236 templateUrl: 'modal-busqueda-productos.html', 241 templateUrl: 'modal-busqueda-productos.html',
237 controller: 'modalBusquedaProductosCtrl', 242 controller: 'modalBusquedaProductosCtrl',
238 resolve: { 243 resolve: {
239 parametroProducto: { 244 parametroProducto: {
240 idLista: $scope.precioCondicion.listaPrecio.ID, 245 idLista: $scope.precioCondicion.listaPrecio.ID,
241 cotizacion: 1, 246 cotizacion: 1,
242 simbolo: '$', 247 simbolo: '$',
243 soloMostrar: true 248 soloMostrar: true
244 } 249 }
245 }, 250 },
246 size: 'md' 251 size: 'md'
247 } 252 }
248 ); 253 );
249 }; 254 };
250 255
251 $scope.next = function(key) { 256 $scope.next = function(key) {
252 if (key === 13) $scope.focused++; 257 if (key === 13) $scope.focused++;
253 }; 258 };
254 259
255 //watch 260 //watch
256 $scope.$watch('precioCondicion', function(newValue) { 261 $scope.$watch('precioCondicion', function(newValue) {
257 focaBotoneraLateralService.setPausarData({ 262 focaBotoneraLateralService.setPausarData({
258 label: 'precioCondicion', 263 label: 'precioCondicion',
259 val: newValue 264 val: newValue
260 }); 265 });
261 }, true); 266 }, true);
262 267
263 function setearPrecioCondicion(precioCondicion) { 268 function setearPrecioCondicion(precioCondicion) {
264 $scope.precioCondicion = precioCondicion; 269 $scope.precioCondicion = precioCondicion;
265 $scope.$broadcast('addCabecera', { 270 $scope.$broadcast('addCabecera', {
266 label: 'Precio y Condicion:', 271 label: 'Precio y Condicion:',
267 valor: $filter('rellenarDigitos')(precioCondicion.id) 272 valor: $filter('rellenarDigitos')(precioCondicion.id)
268 }); 273 });
269 } 274 }
270 275
271 function getLSPrecioC() { 276 function getLSPrecioC() {
272 var precioCondicion = JSON.parse($localStorage.precioCondicion || null); 277 var precioCondicion = JSON.parse($localStorage.precioCondicion || null);
273 278
274 if (precioCondicion) { 279 if (precioCondicion) {
275 setearPrecioCondicion(precioCondicion); 280 setearPrecioCondicion(precioCondicion);
276 delete $localStorage.precioCondicion; 281 delete $localStorage.precioCondicion;
277 } 282 }
278 } 283 }
279 } 284 }
280 ]); 285 ]);
281 286
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-4 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 /> 93 />
93 <div class="input-group-append"> 94 <div class="input-group-append">
94 <button 95 <button
95 class="btn btn-outline-secondary form-control" 96 class="btn btn-outline-secondary form-control"
96 title="Agregar" 97 title="Agregar"
97 type="button" 98 type="button"
98 ng-click="agregarPlazo(13)" 99 ng-click="agregarPlazo(13)"
99 > 100 >
100 <i class="fa fa-save" aria-hidden="true"></i> 101 <i class="fa fa-save" aria-hidden="true"></i>
101 </button> 102 </button>
102 </div> 103 </div>
103 </div> 104 </div>
104 <table class="table table-striped table-sm"> 105 <table class="table table-striped table-sm">
105 <tbody> 106 <tbody>
106 <tr ng-repeat="(key, plazo) in precioCondicion.plazos"> 107 <tr ng-repeat="(key, plazo) in precioCondicion.plazos">
107 <td class="text-right" > 108 <td class="text-right" >
108 <span ng-bind="plazo.dias + ' días'"></span> 109 <span ng-bind="plazo.dias + ' días'"></span>
109 <button 110 <button
110 type="button" 111 type="button"
111 title="Eliminar" 112 title="Eliminar"
112 class="btn btn-outline-secondary ml-1" 113 class="btn btn-outline-secondary ml-1"
113 ng-click="quitarPlazo(key)" 114 ng-click="quitarPlazo(key)"
114 > 115 >
115 <i class="fa fa-trash"></i> 116 <i class="fa fa-trash"></i>
116 </button> 117 </button>
117 </td> 118 </td>
118 </tr> 119 </tr>
119 </tbody> 120 </tbody>
120 </table> 121 </table>
121 </div> 122 </div>
122 </div> 123 </div>
123 </form> 124 </form>
124 </div> 125 </div>
125 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 /> 20 />
20 <div class="input-group-append"> 21 <div class="input-group-append">
21 <button 22 <button
22 ladda="searchLoading" 23 ladda="searchLoading"
23 class="btn btn-outline-secondary" 24 class="btn btn-outline-secondary"
24 type="button" 25 type="button"
25 ng-click="buscar(13)" 26 ng-click="buscar(13)"
26 > 27 >
27 <i class="fa fa-search" aria-hidden="true"></i> 28 <i class="fa fa-search" aria-hidden="true"></i>
28 </button> 29 </button>
29 </div> 30 </div>
30 </div> 31 </div>
31 <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">
32 <thead> 33 <thead>
33 <tr> 34 <tr>
34 <th>Código</th> 35 <th>Código</th>
35 <th>Nombre</th> 36 <th>Nombre</th>
36 <th>Lista de precio</th> 37 <th>Lista de precio</th>
37 <th>Plazos</th> 38 <th>Plazos</th>
38 <th colspan="2" class="text-center"> 39 <th colspan="2" class="text-center">
39 <button 40 <button
40 title="Agregar" 41 title="Agregar"
41 class="btn btn-outline-debo boton-accion" 42 class="btn btn-outline-debo boton-accion"
42 ng-click="editar(0)"> 43 ng-click="editar(0)">
43 <i class="fa fa-plus"></i> 44 <i class="fa fa-plus"></i>
44 </button> 45 </button>
45 </th> 46 </th>
46 </tr> 47 </tr>
47 </thead> 48 </thead>
48 <tbody> 49 <tbody>
49 <tr ng-repeat="precioCondicion in preciosCondiciones"> 50 <tr ng-repeat="precioCondicion in preciosCondiciones">
50 <td ng-bind="precioCondicion.id | rellenarDigitos: 4: 0"></td> 51 <td ng-bind="precioCondicion.id | rellenarDigitos: 4: 0"></td>
51 <td ng-bind="precioCondicion.nombre"></td> 52 <td ng-bind="precioCondicion.nombre"></td>
52 <td ng-bind="precioCondicion.listaPrecio.ID + ' - ' + precioCondicion.listaPrecio.DES + ' - ' + precioCondicion.listaPrecio.moneda.DETALLE"></td> 53 <td ng-bind="precioCondicion.listaPrecio.ID + ' - ' + precioCondicion.listaPrecio.DES + ' - ' + precioCondicion.listaPrecio.moneda.DETALLE"></td>
53 <td><span 54 <td><span
54 ng-repeat="plazo in precioCondicion.plazoPago" 55 ng-repeat="plazo in precioCondicion.plazoPago"
55 ng-if="plazo.activo" 56 ng-if="plazo.activo"
56 ng-bind="$last ? plazo.dias : plazo.dias + ', '"></span></td> 57 ng-bind="$last ? plazo.dias : plazo.dias + ', '"></span></td>
57 <td class="text-center"> 58 <td class="text-center">
58 <button 59 <button
59 title="Editar" 60 title="Editar"
60 class="btn btn-outline-dark boton-accion" 61 class="btn btn-outline-dark boton-accion"
61 ng-click="editar(precioCondicion.id)"> 62 ng-click="editar(precioCondicion.id)">
62 <i class="fa fa-pencil"></i> 63 <i class="fa fa-pencil"></i>
63 </button> 64 </button>
64 <button 65 <button
65 title="Eliminar" 66 title="Eliminar"
66 class="btn btn-outline-dark boton-accion" 67 class="btn btn-outline-dark boton-accion"
67 ng-click="solicitarConfirmacion(precioCondicion)"> 68 ng-click="solicitarConfirmacion(precioCondicion)">
68 <i class="fa fa-trash"></i> 69 <i class="fa fa-trash"></i>
69 </button> 70 </button>
70 </td> 71 </td>
71 </tr> 72 </tr>
72 </tbody> 73 </tbody>
73 </table> 74 </table>
74 </div> 75 </div>
75 </div> 76 </div>
76 77