Commit b2fc56e26eb59a880232393072b2833db6e03d39
Exists in
master
Merge branch 'master' into 'master'
agrego foca-cabecera See merge request !2
Showing
2 changed files
Show diff stats
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', | 4 | 'focaModalService', 'focaBotoneraLateralService', '$timeout', |
5 | function($scope, focaAbmPreciosCondicionesService, $location, | 5 | function($scope, focaAbmPreciosCondicionesService, $location, |
6 | focaModalService, focaBotoneraLateralService, $timeout) { | 6 | focaModalService, focaBotoneraLateralService, $timeout) { |
7 | focaAbmPreciosCondicionesService.obtenerPreciosCondiciones().then(function(datos) { | 7 | focaAbmPreciosCondicionesService.obtenerPreciosCondiciones().then(function(datos) { |
8 | $scope.preciosCondiciones = datos.data; | 8 | $scope.preciosCondiciones = datos.data; |
9 | }); | 9 | }); |
10 | 10 | ||
11 | $timeout(function() { | 11 | $timeout(function() { |
12 | focaBotoneraLateralService.showSalir(true); | 12 | focaBotoneraLateralService.showSalir(true); |
13 | focaBotoneraLateralService.showPausar(false); | 13 | focaBotoneraLateralService.showPausar(false); |
14 | focaBotoneraLateralService.showCancelar(false); | 14 | focaBotoneraLateralService.showCancelar(false); |
15 | focaBotoneraLateralService.showGuardar(false); | 15 | focaBotoneraLateralService.showGuardar(false); |
16 | }); | 16 | }); |
17 | 17 | ||
18 | $scope.now = new Date(); | ||
18 | $scope.editar = function(id) { | 19 | $scope.editar = function(id) { |
19 | $location.path('/precio-condicion/' + id); | 20 | $location.path('/precio-condicion/' + id); |
20 | }; | 21 | }; |
21 | $scope.solicitarConfirmacion = function(precioCondicion) { | 22 | $scope.solicitarConfirmacion = function(precioCondicion) { |
22 | focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + | 23 | focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + |
23 | precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( | 24 | precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( |
24 | function(data) { | 25 | function(data) { |
25 | if (data) { | 26 | if (data) { |
26 | focaAbmPreciosCondicionesService | 27 | focaAbmPreciosCondicionesService |
27 | .borrarPrecioCondicion(precioCondicion.id); | 28 | .borrarPrecioCondicion(precioCondicion.id); |
28 | $scope.preciosCondiciones.splice( | 29 | $scope.preciosCondiciones.splice( |
29 | $scope.preciosCondiciones.indexOf(precioCondicion), 1 | 30 | $scope.preciosCondiciones.indexOf(precioCondicion), 1 |
30 | ); | 31 | ); |
31 | } | 32 | } |
32 | } | 33 | } |
33 | ); | 34 | ); |
34 | }; | 35 | }; |
35 | } | 36 | } |
36 | ]) | 37 | ]) |
37 | .controller('focaAbmPrecioCondicionController', [ | 38 | .controller('focaAbmPrecioCondicionController', [ |
38 | '$scope', 'focaAbmPreciosCondicionesService', 'focaBotoneraLateralService', | 39 | '$scope', 'focaAbmPreciosCondicionesService', 'focaBotoneraLateralService', |
39 | '$routeParams', '$location', 'focaModalService', '$timeout', | 40 | '$routeParams', '$location', 'focaModalService', '$timeout', |
40 | function( | 41 | function( |
41 | $scope, focaAbmPreciosCondicionesService, focaBotoneraLateralService, | 42 | $scope, focaAbmPreciosCondicionesService, focaBotoneraLateralService, |
42 | $routeParams, $location, focaModalService, $timeout | 43 | $routeParams, $location, focaModalService, $timeout |
43 | ) { | 44 | ) { |
44 | $scope.mostrarPlazos = $routeParams.id > 0; | 45 | $scope.mostrarPlazos = $routeParams.id > 0; |
45 | focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) | 46 | focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) |
46 | .then(function(datos) { | 47 | .then(function(datos) { |
47 | $scope.precioCondicion = { | 48 | $scope.precioCondicion = { |
48 | id: 0, | 49 | id: 0, |
49 | codigo: '', | 50 | codigo: '', |
50 | nombre: '', | 51 | nombre: '', |
51 | descripcion: '', | 52 | descripcion: '', |
52 | idListaPrecio: 0, | 53 | idListaPrecio: 0, |
53 | vigencia: new Date() | 54 | vigencia: new Date() |
54 | }; | 55 | }; |
55 | if (datos.data.id) { | 56 | if (datos.data.id) { |
56 | $scope.precioCondicion = datos.data; | 57 | $scope.precioCondicion = datos.data; |
57 | focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) | 58 | focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) |
58 | .then(function(datos) { | 59 | .then(function(datos) { |
59 | $scope.precioCondicion.plazos = datos.data; | 60 | $scope.precioCondicion.plazos = datos.data; |
60 | }); | 61 | }); |
61 | } | 62 | } |
62 | }); | 63 | }); |
63 | 64 | ||
64 | $timeout(function() { | 65 | $timeout(function() { |
65 | focaBotoneraLateralService.showSalir(false); | 66 | focaBotoneraLateralService.showSalir(false); |
66 | focaBotoneraLateralService.showPausar(true); | 67 | focaBotoneraLateralService.showPausar(true); |
67 | focaBotoneraLateralService.showCancelar(true); | 68 | focaBotoneraLateralService.showCancelar(true); |
68 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | 69 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
69 | }); | 70 | }); |
70 | 71 | ||
71 | $scope.cancelar = function() { | 72 | $scope.cancelar = function() { |
72 | $location.path('/precio-condicion'); | 73 | $location.path('/precio-condicion'); |
73 | }; | 74 | }; |
74 | $scope.guardar = function(precioCondicion) { | 75 | $scope.guardar = function(precioCondicion) { |
75 | focaAbmPreciosCondicionesService.guardarPrecioCondicion(precioCondicion) | 76 | focaAbmPreciosCondicionesService.guardarPrecioCondicion(precioCondicion) |
76 | .then(function() { | 77 | .then(function() { |
77 | $location.path('/precio-condicion'); | 78 | $location.path('/precio-condicion'); |
78 | }); | 79 | }); |
79 | }; | 80 | }; |
80 | $scope.editarPlazoPago = function(id) { | 81 | $scope.editarPlazoPago = function(id) { |
81 | $location.path( | 82 | $location.path( |
82 | '/precio-condicion/' + $scope.precioCondicion.id + | 83 | '/precio-condicion/' + $scope.precioCondicion.id + |
83 | '/plazo-pago/' + id | 84 | '/plazo-pago/' + id |
84 | ); | 85 | ); |
85 | }; | 86 | }; |
86 | $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { | 87 | $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { |
87 | focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + | 88 | focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + |
88 | plazoPago.item + ' ' + plazoPago.dias + ' ?').then( | 89 | plazoPago.item + ' ' + plazoPago.dias + ' ?').then( |
89 | function(confirm) { | 90 | function(confirm) { |
90 | if (confirm) { | 91 | if (confirm) { |
91 | focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); | 92 | focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); |
92 | $scope.precioCondicion.plazos.splice( | 93 | $scope.precioCondicion.plazos.splice( |
93 | $scope.precioCondicion.plazos.indexOf(plazoPago), 1 | 94 | $scope.precioCondicion.plazos.indexOf(plazoPago), 1 |
94 | ); | 95 | ); |
95 | } | 96 | } |
96 | } | 97 | } |
97 | ); | 98 | ); |
98 | }; | 99 | }; |
99 | } | 100 | } |
100 | ]); | 101 | ]); |
101 | 102 |
src/views/foca-abm-precios-condiciones-listado.html
1 | <foca-cabecera-facturador | ||
2 | titulo="'Precios y condiciones'" | ||
3 | fecha="now" | ||
4 | class="mb-0 col-lg-12" | ||
5 | ></foca-cabecera-facturador> | ||
1 | <div class="lista"> | 6 | <div class="lista"> |
2 | <h4>Precios y Condiciones</h4> | ||
3 | <table class="table table-sm table-hover table-nonfluid"> | 7 | <table class="table table-sm table-hover table-nonfluid"> |
4 | <thead> | 8 | <thead> |
5 | <tr> | 9 | <tr> |
6 | <th>Código</th> | 10 | <th>Código</th> |
7 | <th>Nombre</th> | 11 | <th>Nombre</th> |
8 | <th colspan="2" class="text-center"> | 12 | <th colspan="2" class="text-center"> |
9 | <button class="btn btn-default boton-accion" ng-click="editar(0)"> | 13 | <button class="btn btn-default boton-accion" ng-click="editar(0)"> |
10 | <i class="fa fa-plus"></i> | 14 | <i class="fa fa-plus"></i> |
11 | </button> | 15 | </button> |
12 | </th> | 16 | </th> |
13 | </tr> | 17 | </tr> |
14 | </thead> | 18 | </thead> |
15 | <tbody> | 19 | <tbody> |
16 | <tr ng-repeat="precioCondicion in preciosCondiciones"> | 20 | <tr ng-repeat="precioCondicion in preciosCondiciones"> |
17 | <td ng-bind="precioCondicion.codigo"></td> | 21 | <td ng-bind="precioCondicion.codigo"></td> |
18 | <td ng-bind="precioCondicion.nombre"></td> | 22 | <td ng-bind="precioCondicion.nombre"></td> |
19 | <td> | 23 | <td> |
20 | <button class="btn btn-default boton-accion" ng-click="editar(precioCondicion.id)"> | 24 | <button class="btn btn-default boton-accion" ng-click="editar(precioCondicion.id)"> |
21 | <i class="fa fa-pencil"></i> | 25 | <i class="fa fa-pencil"></i> |
22 | </button> | 26 | </button> |
23 | <button class="btn btn-default boton-accion" ng-click="solicitarConfirmacion(precioCondicion)"> | 27 | <button class="btn btn-default boton-accion" ng-click="solicitarConfirmacion(precioCondicion)"> |
24 | <i class="fa fa-trash"></i> | 28 | <i class="fa fa-trash"></i> |
25 | </button> | 29 | </button> |
26 | </td> | 30 | </td> |
27 | </tr> | 31 | </tr> |
28 | </tbody> | 32 | </tbody> |
29 | </table> | 33 | </table> |
30 | </div> | 34 | </div> |