Compare View

switch
from
...
to
 
Commits (41)
1 1 {
2 2 "name": "foca-modal-precio-condiciones",
3   - "version": "0.0.1",
  3 + "version": "v0.1.1A",
4 4 "description": "Modal de búsqueda de precios y condiciones",
5 5 "main": "index.js",
6 6 "scripts": {
  7 + "refresh": "gulp uglify && cp tmp/foca-modal-precio-condiciones.js ../wrapper-demo/node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js",
7 8 "test": "echo \"Error: no test specified\" && exit 1",
8 9 "gulp-pre-commit": "gulp pre-commit",
9 10 "compile": "gulp uglify",
... ... @@ -22,8 +23,8 @@
22 23 "devDependencies": {
23 24 "angular": "^1.7.5",
24 25 "bootstrap": "^4.1.3",
25   - "foca-directivas": "git+ssh://git@git.focasoftware.com:npm/foca-directivas.git",
26   - "foca-modal": "git+ssh://git@git.focasoftware.com:npm/foca-modal.git",
  26 + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
  27 + "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git",
27 28 "font-awesome": "^4.7.0",
28 29 "gulp": "^3.9.1",
29 30 "gulp-angular-templatecache": "^2.2.2",
... ... @@ -38,6 +39,7 @@
38 39 "jquery": "^3.3.1",
39 40 "jshint": "^2.9.6",
40 41 "pump": "^3.0.0",
41   - "ui-bootstrap4": "^3.0.5"
  42 + "ui-bootstrap4": "^3.0.5",
  43 + "popper.js": "^1.15.0"
42 44 }
43 45 }
src/js/controller.js
1 1 angular.module('focaModalPrecioCondicion')
2   - .controller('focaModalPrecioCondicionController',
  2 + .controller('focaModalPrecioCondicionController',
3 3 [
4 4 '$timeout',
5 5 '$filter',
... ... @@ -8,167 +8,88 @@ angular.module('focaModalPrecioCondicion')
8 8 '$uibModalInstance',
9 9 'focaModalService',
10 10 'focaModalPrecioCondicionService',
11   - 'idListaPrecio',
12   - function(
  11 + 'parametros',
  12 + function (
13 13 $timeout, $filter, $scope, $uibModal, $uibModalInstance,
14   - focaModalService, focaModalPrecioCondicionService, idListaPrecio
  14 + focaModalService, focaModalPrecioCondicionService, parametros
15 15 ) {
16   -
17   - $scope.filters = '';
18   - $scope.ingreso = false;
19   - $scope.plazosNuevos = [];
20   - $scope.plazoACargar =
21   - {
22   - item: 1
23   - };
24   - // pagination
25   - $scope.numPerPage = 10;
26   - $scope.currentPage = 1;
27   - $scope.filteredPrecioCondicion = [];
28   - $scope.currentPagePrecioCondicion = [];
29   - $scope.selectedPrecioCondicion = -1;
30   -
31   - var funcionGet = idListaPrecio ? 'getPreciosCondicionesByIdListaPrecio' :
32   - 'getPreciosCondiciones';
33   -
34   - focaModalPrecioCondicionService
35   - [funcionGet](idListaPrecio)
36   - .then(function(res) {
37   - for (var i = 0; i < res.data.length; i++) {
38   - var plazosTemp = '';
39   - res.data[i].plazoPago.sort(function(a, b) {
40   - return a.dias - b.dias;
41   - });
42   - for (var j = 0; j < res.data[i].plazoPago.length; j++) {
43   - if (j + 1 === res.data[i].plazoPago.length) {
44   - plazosTemp += res.data[i].plazoPago[j].dias;
45   - } else {
46   - plazosTemp += res.data[i].plazoPago[j].dias + ', ';
47   - }
48   - }
49   - res.data[i].plazos = plazosTemp.trim();
50   - }
51   - $scope.precioCondicion = res.data;
52   - $scope.search();
53   - });
54   -
55   - //METODOS
56   - $scope.agregarPlazo = function(key) {
57   - if(key === 13) {
58   - if(!$scope.plazoACargar.dias) {
59   - focaModalService.alert('Ingrese cantidad de días');
60   - return;
61   - }
62   - var tieneEseDia = $scope.plazosNuevos.filter(function(a) {
63   - return a.dias === $scope.plazoACargar.dias;
  16 + $scope.plazos = [
  17 + {
  18 + dias: 0,
  19 + idCliente: parametros.idCliente,
  20 + activo: true
  21 + }
  22 + ];
  23 + $scope.remito = parametros.remito;
  24 + $scope.notaPedido = parametros.notaPedido;
  25 + $scope.openModalListaDePrecios = false;
  26 + $scope.associatedList = true;
  27 + $scope.listaDePreciosAlternativa = null;
  28 +
  29 + onInit();
  30 +
  31 + function onInit() {
  32 + //Metodo para traer la lista de precio asociada al cliente
  33 + focaModalPrecioCondicionService.getListaPrecio(parametros.idListaPrecio)
  34 + .then(function (res) {
  35 + $scope.listaDePreciosAsociada = res.data[0];
  36 + })
  37 + .catch(function (e) { console.error(e) });
  38 + focaModalPrecioCondicionService.getPlazosByIdCliente(parametros.idCliente)
  39 + .then(function (res) {
  40 + res.data.forEach(function (item) {
  41 + $scope.plazos.push(item);
64 42 });
65   - if(tieneEseDia.length > 0) {
66   - focaModalService.alert('Ya ha ingresado un plazo con esos días');
67   - return;
68   - }
69   - $scope.plazosNuevos.push($scope.plazoACargar);
70   - $scope.plazoACargar =
71   - {
72   - item: $scope.plazosNuevos.length + 1
73   - };
74   - }
75   - };
76   -
77   - $scope.volver = function() {
78   - $scope.ingreso = false;
79   - $scope.plazosNuevos = [];
80   - $scope.plazoACargar =
81   - {
82   - item: $scope.plazosNuevos.length + 1
83   - };
84   - };
  43 + })
  44 + .catch(function (e) { console.error(e) });
  45 + }
85 46  
86   - $scope.quitarPlazo = function(key) {
87   - $scope.plazosNuevos.splice(key, 1);
88   - $scope.plazoACargar =
89   - {
90   - item: $scope.plazosNuevos.length + 1
91   - };
92   - };
93   -
94   - $scope.search = function(pressed) {
95   - $scope.filteredPrecioCondicion = $filter('filter')(
96   - $scope.precioCondicion,
97   - {$: $scope.filters}
98   - );
99   -
100   - if(pressed) {
101   - if($scope.filteredPrecioCondicion.length === 0) {
102   - $timeout(function() {
103   - angular.element('#search')[0].focus();
104   - $scope.filters = '';
  47 + //#region Metodos para la lista de precios
  48 + $scope.openListaDePrecios = function () {
  49 + var datos = null;
  50 + focaModalPrecioCondicionService.getAllListaPrecio()
  51 + .then(function (res) {
  52 + datos = res.data;
  53 + focaModalService.modal({
  54 + titulo: 'Lista de precios',
  55 + data: datos,
  56 + size: 'md',
  57 + columnas: [
  58 + {
  59 + propiedad: 'ID',
  60 + nombre: 'Codigo'
  61 + },
  62 + {
  63 + propiedad: 'DES',
  64 + NOMBRE: 'Nombre'
  65 + }
  66 + ],
  67 + }).then(function (res) {
  68 + focaModalService.confirm('¿Desea cambiar la lista de precios?\n'+
  69 + 'Se perderan los productos ingresados').then(function (data){
  70 + if (data) {
  71 + if ($scope.notaPedido) {
  72 + if ($scope.notaPedido.articulosNotaPedido.length > 0) {
  73 + $scope.notaPedido.articulosNotaPedido = [];
  74 + }
  75 + } else if ($scope.remito) {
  76 + if ($scope.remito.articulosRemito.length > 0) {
  77 + $scope.remito.articulosRemito = [];
  78 + }
  79 + }
  80 + $scope.associatedList = false;
  81 + $scope.listaDePreciosAlternativa = res;
  82 + }
105 83 });
106   - }else {
107   - primera();
108   - }
109   - }
110   -
111   - $scope.lastPage = Math.ceil(
112   - $scope.filteredPrecioCondicion.length / $scope.numPerPage
113   - );
114   -
115   - $scope.resetPage();
116   - };
117   -
118   - $scope.resetPage = function() {
119   - $scope.currentPage = 1;
120   - $scope.selectPage(1);
121   - };
122   -
123   - $scope.selectPage = function(page) {
124   - var start = (page - 1) * $scope.numPerPage;
125   - var end = start + $scope.numPerPage;
126   - $scope.paginas = [];
127   - $scope.paginas = calcularPages(page);
128   - $scope.currentPagePrecioCondicion =
129   - $scope.filteredPrecioCondicion.slice(start, end);
130   - $scope.currentPage = page;
131   - };
132   -
133   - $scope.select = function(precioCondicion) {
134   - $uibModalInstance.close(precioCondicion);
135   - };
136   -
137   - $scope.cancel = function() {
138   - $uibModalInstance.dismiss('cancel');
139   - };
140   -
141   - $scope.busquedaDown = function(key) {
142   - if (key === 40) {
143   - primera(key);
144   - }
145   - };
146   -
147   - $scope.busquedaPress = function(key) {
148   - if (key === 13) {
149   - $scope.search(true);
150   - }
  84 + }).catch(function (e) {
  85 + console.error(e);
  86 + });
  87 + });
151 88 };
152   -
153   - $scope.itemProducto = function(key) {
154   - if (key === 38) {
155   - anterior(key);
156   - }
157   -
158   - if (key === 40) {
159   - siguiente(key);
160   - }
161   -
162   - if (key === 37) {
163   - retrocederPagina();
164   - }
165   -
166   - if (key === 39) {
167   - avanzarPagina();
168   - }
  89 + $scope.selectListaDePrecios = function () {
  90 + $scope.associatedList = true;
169 91 };
170   -
171   - $scope.verListaPrecio = function(id) {
  92 + $scope.verListaProductos = function (id) {
172 93 $uibModal.open(
173 94 {
174 95 ariaLabelledBy: 'Busqueda de Productos',
... ... @@ -176,7 +97,7 @@ angular.module(&#39;focaModalPrecioCondicion&#39;)
176 97 controller: 'modalBusquedaProductosCtrl',
177 98 resolve: {
178 99 parametroProducto: {
179   - idLista: id,
  100 + idLista: parseInt(id),
180 101 cotizacion: 1,
181 102 simbolo: '$',
182 103 soloMostrar: true
... ... @@ -186,71 +107,55 @@ angular.module(&#39;focaModalPrecioCondicion&#39;)
186 107 }
187 108 );
188 109 };
189   -
190   - function calcularPages(paginaActual) {
191   - var paginas = [];
192   - paginas.push(paginaActual);
193   -
194   - if (paginaActual - 1 > 1) {
195   -
196   - paginas.unshift(paginaActual - 1);
197   - if (paginaActual - 2 > 1) {
198   - paginas.unshift(paginaActual - 2);
199   - }
200   - }
201   -
202   - if (paginaActual + 1 < $scope.lastPage) {
203   - paginas.push(paginaActual + 1);
204   - if (paginaActual + 2 < $scope.lastPage) {
205   - paginas.push(paginaActual + 2);
  110 + //#endregion
  111 +
  112 + //#region Metodos para los plazos
  113 + $scope.addPlazo = function (key) {
  114 + if (key != 13) return;
  115 + if ($scope.plazos.length === 100) return;
  116 + for (var i = 1; i < $scope.plazos.length; i++) {
  117 + if ($scope.plazos[0].dias == $scope.plazos[i].dias && $scope.plazos[i].activo == true) {
  118 + focaModalService.alert("Ya existe un plazo con este valor");
  119 + return;
206 120 }
207 121 }
208   -
209   - if (paginaActual !== 1) {
210   - paginas.unshift(1);
211   - }
212   -
213   - if (paginaActual !== $scope.lastPage) {
214   - paginas.push($scope.lastPage);
215   - }
216   -
217   - return paginas;
218   - }
219   -
220   - function primera() {
221   - $scope.selectedPrecioCondicion = 0;
222   - }
223   -
224   - function anterior() {
225   - if ($scope.selectedPrecioCondicion === 0 && $scope.currentPage > 1) {
226   - retrocederPagina();
227   - } else {
228   - $scope.selectedPrecioCondicion--;
  122 + $scope.plazos.unshift({ dias: 0, idCliente: parametros.idCliente, activo: true });
  123 + $scope.focused = 1;
  124 + };
  125 + $scope.deletePlazo = function (index) {
  126 + $scope.plazos[index].activo = false;
  127 + };
  128 + $scope.validateMinMax = function (plazo, min, max) {
  129 + plazo.dias = parseInt(plazo.dias);
  130 + if (plazo.dias === null || plazo.dias === undefined || isNaN(plazo.dias)) {
  131 + plazo.dias = '0';
  132 + return;
229 133 }
230   - }
231   -
232   - function siguiente() {
233   - if ($scope.selectedPrecioCondicion <
234   - $scope.currentPagePrecioCondicion.length ) {
235   - $scope.selectedPrecioCondicion++;
236   - } else {
237   - avanzarPagina();
  134 + if (parseInt(plazo.dias) < min) {
  135 + plazo.dias = '0';
  136 + return;
238 137 }
239   - }
240   -
241   - function retrocederPagina() {
242   - if ($scope.currentPage > 1) {
243   - $scope.selectPage($scope.currentPage - 1);
244   - $scope.selectedPrecioCondicion = $scope.numPerPage - 1;
  138 + if (parseInt(plazo.dias) > max) {
  139 + plazo.dias = '365';
  140 + return;
245 141 }
246   - }
  142 + };
  143 + //#endregion
247 144  
248   - function avanzarPagina() {
249   - if ($scope.currentPage < $scope.lastPage) {
250   - $scope.selectPage($scope.currentPage + 1);
251   - $scope.selectedPrecioCondicion = 0;
252   - }
253   - }
  145 + $scope.closeModalPrecioCondicion = function () {
  146 + $uibModalInstance.dismiss('cancel');
  147 + };
  148 + $scope.guardarPrecioCondicion = function () {
  149 + $scope.plazos.shift();
  150 + focaModalPrecioCondicionService.createPlazo($scope.plazos)
  151 + .then(function () {
  152 + var precioCondicion = {
  153 + listaPrecio: $scope.associatedList ? $scope.listaDePreciosAsociada : $scope.listaDePreciosAlternativa,
  154 + plazoPago: $filter('filter')($scope.plazos, { activo: true }, true)
  155 + };
  156 + $uibModalInstance.close(precioCondicion);
  157 + })
  158 + .catch(function (e) { console.error(e) })
  159 + };
254 160 }
255   - ]
256   - );
  161 + ]);
src/js/controllerCliente.js
... ... @@ -0,0 +1,179 @@
  1 +angular.module('focaModalPrecioCondicion')
  2 + .controller('focaModalListaPreciosController',
  3 + [
  4 + '$timeout',
  5 + '$filter',
  6 + '$scope',
  7 + '$uibModal',
  8 + '$uibModalInstance',
  9 + 'focaModalService',
  10 + 'focaModalPrecioCondicionService',
  11 + 'parametros',
  12 + function (
  13 + $timeout, $filter, $scope, $uibModal, $uibModalInstance,
  14 + focaModalService, focaModalPrecioCondicionService, parametros
  15 + ) {
  16 + $scope.openModalListaDePrecios = false;
  17 + $scope.associatedList = true;
  18 + $scope.listaDePreciosAlternativa = null;
  19 +
  20 + onInit();
  21 +
  22 + function onInit() {
  23 + //Metodo para traer la lista de precio asociada al cliente
  24 + focaModalPrecioCondicionService.getListaPrecio(parametros.idListaPrecio)
  25 + .then(function (res) {
  26 + $scope.listaDePreciosAsociada = res.data[0];
  27 + })
  28 + .catch(function (e) { console.error(e) });
  29 + }
  30 +
  31 + //#region Metodos para la lista de precios
  32 + $scope.openListaDePrecios = function () {
  33 + var datos = null;
  34 + focaModalPrecioCondicionService.getAllListaPrecio()
  35 + .then(function (res) {
  36 + datos = res.data;
  37 + focaModalService.modal({
  38 + titulo: 'Lista de precios',
  39 + data: datos,
  40 + size: 'md',
  41 + columnas: [
  42 + {
  43 + propiedad: 'ID',
  44 + nombre: 'Codigo'
  45 + },
  46 + {
  47 + propiedad: 'DES',
  48 + NOMBRE: 'Nombre'
  49 + }
  50 + ],
  51 + }).then(function (res) {
  52 + $scope.associatedList = false;
  53 + $scope.listaDePreciosAlternativa = res;
  54 + }).catch(function (e) {
  55 + console.error(e);
  56 + });
  57 + });
  58 + };
  59 + $scope.selectListaDePrecios = function () {
  60 + $scope.associatedList = true;
  61 + };
  62 + $scope.verListaProductos = function (id) {
  63 + $uibModal.open(
  64 + {
  65 + ariaLabelledBy: 'Busqueda de Productos',
  66 + templateUrl: 'modal-busqueda-productos.html',
  67 + controller: 'modalBusquedaProductosCtrl',
  68 + resolve: {
  69 + parametroProducto: {
  70 + idLista: parseInt(id),
  71 + cotizacion: 1,
  72 + simbolo: '$',
  73 + soloMostrar: true
  74 + }
  75 + },
  76 + size: 'md'
  77 + }
  78 + );
  79 + };
  80 + //#endregion
  81 + $scope.closeModalPrecioCondicion = function () {
  82 + $uibModalInstance.dismiss('cancel');
  83 + };
  84 + $scope.guardarPrecioCondicion = function () {
  85 + var mod = $scope.associatedList ? parseInt($scope.listaDePreciosAsociada.ID) : parseInt($scope.listaDePreciosAlternativa.ID);
  86 +
  87 + focaModalPrecioCondicionService.actualizarLista(parametros.idCliente, mod).then(function (){
  88 + var precioCondicion = {
  89 + listaPrecio: $scope.associatedList ? $scope.listaDePreciosAsociada : $scope.listaDePreciosAlternativa,
  90 + };
  91 + $uibModalInstance.close(precioCondicion);
  92 + });
  93 + };
  94 + }
  95 + ])
  96 +
  97 + .controller('focaModalListaPlazosController',
  98 + [
  99 + '$timeout',
  100 + '$filter',
  101 + '$scope',
  102 + '$uibModal',
  103 + '$uibModalInstance',
  104 + 'focaModalService',
  105 + 'focaModalPrecioCondicionService',
  106 + 'parametros',
  107 + function (
  108 + $timeout, $filter, $scope, $uibModal, $uibModalInstance,
  109 + focaModalService, focaModalPrecioCondicionService,parametros
  110 + ) {
  111 + $scope.plazos = [
  112 + {
  113 + dias: 0,
  114 + idCliente: parametros.idCliente,
  115 + activo: true
  116 + }
  117 + ];
  118 +
  119 + onInit();
  120 +
  121 + function onInit() {
  122 + focaModalPrecioCondicionService.getPlazosByIdCliente(parametros.idCliente)
  123 + .then(function (res) {
  124 + res.data.forEach(function (item) {
  125 + $scope.plazos.push(item);
  126 + });
  127 + })
  128 + .catch(function (e) { console.error(e) });
  129 + }
  130 +
  131 + //#region Metodos para los plazos
  132 + $scope.addPlazo = function (key) {
  133 + if (key != 13) return;
  134 + if ($scope.plazos.length === 100) return;
  135 + for (var i = 1; i < $scope.plazos.length; i++) {
  136 + if ($scope.plazos[0].dias == $scope.plazos[i].dias && $scope.plazos[i].activo == true) {
  137 + focaModalService.alert("Ya existe un plazo con este valor");
  138 + return;
  139 + }
  140 + }
  141 + $scope.plazos.unshift({ dias: 0, idCliente: parametros.idCliente, activo: true });
  142 + $scope.focused = 1;
  143 + };
  144 + $scope.deletePlazo = function (index) {
  145 + $scope.plazos[index].activo = false;
  146 + };
  147 + $scope.validateMinMax = function (plazo, min, max) {
  148 + plazo.dias = parseInt(plazo.dias);
  149 + if (plazo.dias === null || plazo.dias === undefined || isNaN(plazo.dias)) {
  150 + plazo.dias = '0';
  151 + return;
  152 + }
  153 + if (parseInt(plazo.dias) < min) {
  154 + plazo.dias = '0';
  155 + return;
  156 + }
  157 + if (parseInt(plazo.dias) > max) {
  158 + plazo.dias = '365';
  159 + return;
  160 + }
  161 + };
  162 + //#endregion
  163 +
  164 + $scope.closeModalPrecioCondicion = function () {
  165 + $uibModalInstance.dismiss('cancel');
  166 + };
  167 + $scope.guardarPlazos = function () {
  168 + $scope.plazos.shift();
  169 + focaModalPrecioCondicionService.createPlazo($scope.plazos)
  170 + .then(function () {
  171 + var precioCondicion = {
  172 + plazoPago: $filter('filter')($scope.plazos, { activo: true }, true)
  173 + };
  174 + $uibModalInstance.close(precioCondicion);
  175 + })
  176 + .catch(function (e) { console.error(e) })
  177 + };
  178 + }
  179 + ]);
... ... @@ -2,17 +2,33 @@ angular.module(&#39;focaModalPrecioCondicion&#39;)
2 2 .service('focaModalPrecioCondicionService', [
3 3 '$http',
4 4 'API_ENDPOINT',
5   - function($http, API_ENDPOINT) {
  5 + function ($http, API_ENDPOINT) {
6 6 return {
7   - getPlazosByIdPrecioCondicion: function(id) {
  7 + getPlazosByIdPrecioCondicion: function (id) {
8 8 return $http.get(API_ENDPOINT.URL + '/plazo-pago/precio-condicion/' + id);
9 9 },
10   - getPreciosCondiciones: function() {
  10 + getPreciosCondiciones: function () {
11 11 return $http.get(API_ENDPOINT.URL + '/precio-condicion/plazo-pago');
12 12 },
13   - getPreciosCondicionesByIdListaPrecio: function(idListaPrecio) {
  13 + getPreciosCondicionesByIdListaPrecio: function (idListaPrecio) {
14 14 return $http.get(API_ENDPOINT.URL + '/precio-condicion/plazo-pago/' +
15 15 idListaPrecio);
  16 + },
  17 + getListaPrecio: function (idListaPrecio) {
  18 + return $http.get(API_ENDPOINT.URL + '/lista-precio/' +
  19 + idListaPrecio);
  20 + },
  21 + getAllListaPrecio: function () {
  22 + return $http.get(API_ENDPOINT.URL + '/lista-precio');
  23 + },
  24 + getPlazosByIdCliente: function (id) {
  25 + return $http.get(API_ENDPOINT.URL + '/plazo-pago/cliente/' + id);
  26 + },
  27 + createPlazo: function (plazosPago){
  28 + return $http.post(API_ENDPOINT.URL + '/plazos-pago', { plazosPago: plazosPago });
  29 + },
  30 + actualizarLista: function(id , mod) {
  31 + return $http.post(API_ENDPOINT.URL + '/cliente/update/mod', { id: id, mod: mod});
16 32 }
17 33 };
18 34 }
src/views/modal-plazos.html
... ... @@ -0,0 +1,72 @@
  1 +<div class="modal-header py-1">
  2 + <div class="row w-100">
  3 + <div class="col-lg-6">
  4 + <h5 class="modal-title my-1">Precio-Condición: Plazos</h5>
  5 + </div>
  6 + </div>
  7 +</div>
  8 +<div class="modal-body" id="modal-body">
  9 + <div ng-show="!ingreso">
  10 + <div class="row px-2">
  11 + <div class="col-lg-12">
  12 + <div class="row py-1">
  13 + <div class="col text-center font-weight-bold">Plazos</div>
  14 + </div>
  15 + <div class="row">
  16 + <div class="col">
  17 + <table class="table table-sm table-striped">
  18 + <thead>
  19 + <tr>
  20 + <th colspan="2">Dias</th>
  21 + </tr>
  22 + </thead>
  23 + <tbody>
  24 + <tr ng-repeat="(i, plazo) in plazos" ng-show="plazo.activo">
  25 + <td align="center" ng-class="{'pt-2': i > 0}">
  26 + <span
  27 + ng-show="i > 0"
  28 + ng-bind="plazo.dias">
  29 + </span>
  30 + <input
  31 + ng-show="i == 0"
  32 + type="text"
  33 + class="form-control form-control-sm text-center"
  34 + ng-model="plazo.dias"
  35 + limite-numeros-max="3"
  36 + ng-keyup="validateMinMax(plazo, 0, 365)"
  37 + ng-keypress="addPlazo($event.keyCode)"
  38 + foca-focus="focused == 1"
  39 + select-on-click
  40 + teclado-virtual
  41 + foca-tipo-input
  42 + solo-positivos>
  43 + </td>
  44 + <td>
  45 + <button
  46 + ng-show="i === 0"
  47 + class="btn btn-primary"
  48 + ng-click="addPlazo(13)">
  49 + <span class="fa fa-save"></span>
  50 + </button>
  51 + <button
  52 + ng-show="i > 0"
  53 + class="btn btn-default"
  54 + ng-click="deletePlazo(i)">
  55 + <span class="fa fa-trash"></span>
  56 + </button>
  57 + </td>
  58 + </tr>
  59 + </tbody>
  60 + </table>
  61 + </div>
  62 + </div>
  63 + </div>
  64 + </div>
  65 + </div>
  66 +</div>
  67 +<div class="modal-footer py-2">
  68 + <button class="btn btn-sm btn-secondary" type="button" ng-click="closeModalPrecioCondicion()">Cerrar
  69 + </button>
  70 + <button class="btn btn-sm btn-primary" type="button" ng-click="guardarPlazos()">Guardar
  71 + </button>
  72 +</div>
src/views/modal-precio-condicion.html
1 1 <div class="modal-header py-1">
2 2 <div class="row w-100">
3 3 <div class="col-lg-6">
4   - <h5 ng-show="!ingreso" class="modal-title my-1">Búsqueda de Precio-Condición</h5>
5   - <h5 ng-show="ingreso" class="modal-title my-1">Nuevos Plazos</h5>
6   - </div>
7   - <div class="input-group col-lg-6 pr-0 my-2" ng-show="!ingreso">
8   - <input
9   - type="text"
10   - class="form-control form-control-sm"
11   - id="search"
12   - placeholder="Busqueda"
13   - ng-model="filters"
14   - ng-change="search()"
15   - ng-keydown="busquedaDown($event.keyCode)"
16   - ng-keypress="busquedaPress($event.keyCode)"
17   - foca-focus="selectedPrecioCondicion == -1"
18   - ng-focus="selectedPrecioCondicion = -1"
19   - teclado-virtual
20   - >
21   - <div class="input-group-append">
22   - <button
23   - class="btn btn-outline-secondary"
24   - type="button"
25   - title="Buscar"
26   - ng-click="busquedaPress(13)">
27   - <i class="fa fa-search" aria-hidden="true"></i>
28   - </button>
29   - </div>
  4 + <h5 class="modal-title my-1">Precio-Condición</h5>
30 5 </div>
31 6 </div>
32 7 </div>
33 8 <div class="modal-body" id="modal-body">
34   -
35   -
36   - <table ng-show="!ingreso" class="table table-striped table-sm">
37   - <thead>
38   - <tr>
39   - <th>Código</th>
40   - <th>Nombre</th>
41   - <th>Lista Precio</th>
42   - <th>Plazos</th>
43   - <th></th>
44   - </tr>
45   - </thead>
46   - <tbody>
47   - <tr ng-show="currentPagePrecioCondicion.length == 0">
48   - <td colspan="6">
49   - No se encontraron resultados.
50   - </td>
51   - </tr>
52   - <tr>
53   - <td colspan="4" ng-show="!ingreso">
54   - <input
55   - class="form-control form-control-sm"
56   - type="text"
57   - placeholder="Selección manual"
58   - readonly
59   - ng-click="ingreso = !ingreso"
60   - />
61   - </td>
62   - <td colspan="1" ng-show="!ingreso">
63   - <button
64   - type="button"
65   - class="btn btn-sm p-1 float-right"
66   - ng-class="{
67   - 'btn-secondary': selectedPrecioCondicion != 0,
68   - 'btn-primary': selectedPrecioCondicion == 0
69   - }"
70   - foca-focus="selectedPrecioCondicion == 0"
71   - ng-keydown="itemProducto($event.keyCode)"
72   - ng-click="ingreso = !ingreso"
73   - >
74   - <i class="fa fa-circle-thin" aria-hidden="true"></i>
75   - </button>
76   - </td>
77   - </tr>
78   - <tr class="selectable"
79   - ng-repeat="(key, precioCondicion) in currentPagePrecioCondicion">
80   - <td ng-bind="precioCondicion.id | rellenarDigitos: 4: 0"
81   - ng-click="select(precioCondicion)"></td>
82   - <td ng-bind="precioCondicion.nombre"
83   - ng-click="select(precioCondicion)"></td>
84   - <td ng-bind="precioCondicion.idListaPrecio"
85   - ng-click="select(precioCondicion)"></td>
86   - <td ng-bind="precioCondicion.plazos"
87   - ng-click="select(precioCondicion)"></td>
88   - <td>
89   - <button
90   - type="button"
91   - class="btn btn-sm p-1 float-right"
92   - title="Seleccionar"
93   - ng-class="{
94   - 'btn-secondary': selectedPrecioCondicion != key + 1,
95   - 'btn-primary': selectedPrecioCondicion == key + 1
96   - }"
97   - foca-focus="selectedPrecioCondicion == {{key + 1}}"
98   - ng-keydown="itemProducto($event.keyCode)"
99   - ng-click="select(precioCondicion)"
100   - >
101   - <i class="fa fa-circle-thin" aria-hidden="true"></i>
102   - </button>
103   - <button
104   - type="button"
105   - class="btn btn-sm p-1 float-right btn-secondary mr-2"
106   - title="Ver lista precio"
107   - ng-click="verListaPrecio(precioCondicion.idListaPrecio)"
108   - >
109   - <i class="fa fa-eye" aria-hidden="true"></i>
110   - </button>
111   - </td>
112   - </tr>
113   - </tbody>
114   - </table>
115   -
116   - <table class="table table-striped table-sm" ng-show="ingreso">
117   - <thead>
118   - <tr>
119   - <th>Item</th>
120   - <th>Días</th>
121   - <th></th>
122   - </tr>
123   - </thead>
124   - <tbody>
125   - <tr>
126   - <td>
127   - <input
128   - type="number"
129   - class="form-control text-right"
130   - ng-model="plazoACargar.item"
131   - readonly
132   - />
133   - </td>
134   - <td>
135   - <input
136   - type="number"
137   - class="form-control text-right"
138   - min="0"
139   - ng-model="plazoACargar.dias"
140   - ng-keypress="agregarPlazo($event.keyCode)"
141   - foca-focus="ingreso"
142   - />
143   - </td>
144   - <td class="text-center">
145   - <button
146   - class="btn btn-outline-secondary"
147   - title="Agregar"
148   - ng-click="agregarPlazo(13)"
149   - >
150   - <i class="fa fa-save"></i>
151   - </button>
152   - </td>
153   - </tr>
154   - <tr ng-repeat="(key, plazo) in plazosNuevos">
155   - <td class="text-right" ng-bind="key + 1"></td>
156   - <td class="text-right" ng-bind="plazo.dias"></td>
157   - <td class="text-center">
158   - <button
159   - class="btn btn-outline-secondary"
160   - title="Eliminar"
161   - ng-click="quitarPlazo(key)"
162   - >
163   - <i class="fa fa-trash"></i>
164   - </button>
165   - </td>
166   - </tr>
167   - </tbody>
168   - </table>
  9 + <div ng-show="!ingreso">
  10 + <div class="row" ng-show="listaDePreciosAsociada.length == 0">
  11 + <div class="col">
  12 + No se encontraron resultados.
  13 + </div>
  14 + </div>
  15 + <div class="row px-2">
  16 + <div class="col-lg-6">
  17 + <div class="row border-top py-2">
  18 + <div class="col-lg-9 col-9">Lista asociada al cliente</div>
  19 + <div class="col-lg-3 col-3 text-center">
  20 + <button
  21 + ng-class="{'btn-primary': associatedList, 'btn-default': !associatedList}"
  22 + class="btn btn-sm p-1"
  23 + ng-click="selectListaDePrecios(listaDePreciosAsociada)">
  24 + <span class="fa fa-circle-thin"></span>
  25 + </button>
  26 + </div>
  27 + </div>
  28 + <div class="row align-items-center pb-2">
  29 + <div class="col-lg-2 col-2 text-center" ng-bind="listaDePreciosAsociada.ID"></div>
  30 + <div class="col-lg-7 col-7" ng-bind="listaDePreciosAsociada.DES"></div>
  31 + <div class="col-lg-3 col-3 text-center">
  32 + <button ng-click="verListaProductos(listaDePreciosAsociada.ID)" class="btn btn-sm p-1">
  33 + <span class="fa fa-eye"></span>
  34 + </button>
  35 + </div>
  36 + </div>
  37 + <div class="row border-top py-2">
  38 + <div class="col-lg-9 col-9">Trabajar con otra lista</div>
  39 + <div class="col-lg-3 col-3 text-center">
  40 + <button
  41 + ng-class="{'btn-primary': !associatedList, 'btn-default': associatedList}"
  42 + class="btn btn-sm btn-default p-1"
  43 + ng-click="openListaDePrecios()">
  44 + <span class="fa fa-circle-thin"></span>
  45 + </button>
  46 + </div>
  47 + </div>
  48 + <div ng-show="listaDePreciosAlternativa != null" class="row align-items-center pb-1">
  49 + <div class="col-lg-2 col-2 text-center" ng-bind="listaDePreciosAlternativa.ID"></div>
  50 + <div class="col-lg-7 col-7" ng-bind="listaDePreciosAlternativa.DES"></div>
  51 + <div class="col-lg-3 col-3 text-center">
  52 + <button ng-click="verListaProductos(listaDePreciosAlternativa.ID)" class="btn btn-sm p-1">
  53 + <span class="fa fa-eye"></span>
  54 + </button>
  55 + </div>
  56 + </div>
  57 + </div>
  58 + <div class="col">
  59 + <div class="row py-1">
  60 + <div class="col text-center font-weight-bold">Plazos</div>
  61 + </div>
  62 + <div class="row">
  63 + <div class="col">
  64 + <table class="table table-sm table-striped">
  65 + <thead>
  66 + <tr>
  67 + <th colspan="2">Dias</th>
  68 + </tr>
  69 + </thead>
  70 + <tbody>
  71 + <tr ng-repeat="(i, plazo) in plazos" ng-show="plazo.activo">
  72 + <td align="center" ng-class="{'pt-2': i > 0}">
  73 + <span
  74 + ng-show="i > 0"
  75 + ng-bind="plazo.dias">
  76 + </span>
  77 + <input
  78 + ng-show="i == 0"
  79 + type="text"
  80 + class="form-control form-control-sm text-center"
  81 + ng-model="plazo.dias"
  82 + limite-numeros-max="3"
  83 + ng-keyup="validateMinMax(plazo, 0, 365)"
  84 + ng-keypress="addPlazo($event.keyCode)"
  85 + foca-focus="focused == 1"
  86 + select-on-click
  87 + teclado-virtual
  88 + foca-tipo-input
  89 + solo-positivos>
  90 + </td>
  91 + <td>
  92 + <button
  93 + ng-show="i === 0"
  94 + class="btn btn-primary"
  95 + ng-click="addPlazo(13)">
  96 + <span class="fa fa-save"></span>
  97 + </button>
  98 + <button
  99 + ng-show="i > 0"
  100 + class="btn btn-default"
  101 + ng-click="deletePlazo(i)">
  102 + <span class="fa fa-trash"></span>
  103 + </button>
  104 + </td>
  105 + </tr>
  106 + </tbody>
  107 + </table>
  108 + </div>
  109 + </div>
  110 + </div>
  111 + </div>
  112 + </div>
169 113 </div>
170   -<div class="modal-footer py-1">
171   - <nav ng-show="currentPagePrecioCondicion.length > 0 && !ingreso" class="mr-auto">
172   - <ul class="pagination pagination-sm mb-0">
173   - <li class="page-item" ng-class="{'disabled': currentPage == 1}">
174   - <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)">
175   - <span aria-hidden="true">&laquo;</span>
176   - <span class="sr-only">Anterior</span>
177   - </a>
178   - </li>
179   - <li
180   - class="page-item"
181   - ng-repeat="pagina in paginas"
182   - ng-class="{'active': pagina == currentPage}"
183   - >
184   - <a
185   - class="page-link"
186   - href="javascript:void();"
187   - ng-click="selectPage(pagina)"
188   - ng-bind="pagina"
189   - ></a>
190   - </li>
191   - <li class="page-item" ng-class="{'disabled': currentPage == lastPage}">
192   - <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)">
193   - <span aria-hidden="true">&raquo;</span>
194   - <span class="sr-only">Siguiente</span>
195   - </a>
196   - </li>
197   - </ul>
198   - </nav>
199   - <button
200   - ng-show="!ingreso"
201   - class="btn btn-sm btn-secondary"
202   - type="button"
203   - ng-click="cancel()"
204   - >Cancelar
205   - </button>
206   - <button
207   - ng-show="ingreso"
208   - ng-disabled="plazosNuevos.length === 0"
209   - class="btn btn-sm btn-primary"
210   - type="button"
211   - ng-click="select(plazosNuevos)"
212   - >Aceptar
  114 +<div class="modal-footer py-2">
  115 + <button class="btn btn-sm btn-secondary" type="button" ng-click="closeModalPrecioCondicion()">Cerrar
213 116 </button>
214   - <button
215   - ng-show="ingreso"
216   - class="btn btn-sm btn-secondary"
217   - type="button"
218   - ng-click="volver()"
219   - >Volver
  117 + <button class="btn btn-sm btn-primary" type="button" ng-click="guardarPrecioCondicion()">Guardar
220 118 </button>
221 119 </div>
src/views/modal-precios.html
... ... @@ -0,0 +1,66 @@
  1 +<div class="modal-header py-1">
  2 + <div class="row w-100">
  3 + <div class="col-lg-6">
  4 + <h5 class="modal-title my-1">Precio-Condición: Listas</h5>
  5 + </div>
  6 + </div>
  7 +</div>
  8 +<div class="modal-body" id="modal-body">
  9 + <div ng-show="!ingreso">
  10 + <div class="row" ng-show="listaDePreciosAsociada.length == 0">
  11 + <div class="col">
  12 + No se encontraron resultados.
  13 + </div>
  14 + </div>
  15 + <div class="row px-2">
  16 + <div class="col-lg-12">
  17 + <div class="row border-top py-2">
  18 + <div class="col-lg-9 col-9">Lista asociada al cliente</div>
  19 + <div class="col-lg-3 col-3 text-center">
  20 + <button
  21 + ng-class="{'btn-primary': associatedList, 'btn-default': !associatedList}"
  22 + class="btn btn-sm p-1"
  23 + ng-click="selectListaDePrecios(listaDePreciosAsociada)">
  24 + <span class="fa fa-circle-thin"></span>
  25 + </button>
  26 + </div>
  27 + </div>
  28 + <div class="row align-items-center pb-2">
  29 + <div class="col-lg-2 col-2 text-center" ng-bind="listaDePreciosAsociada.ID"></div>
  30 + <div class="col-lg-7 col-7" ng-bind="listaDePreciosAsociada.DES"></div>
  31 + <div class="col-lg-3 col-3 text-center">
  32 + <button ng-click="verListaProductos(listaDePreciosAsociada.ID)" class="btn btn-sm p-1">
  33 + <span class="fa fa-eye"></span>
  34 + </button>
  35 + </div>
  36 + </div>
  37 + <div class="row border-top py-2">
  38 + <div class="col-lg-9 col-9">Trabajar con otra lista</div>
  39 + <div class="col-lg-3 col-3 text-center">
  40 + <button
  41 + ng-class="{'btn-primary': !associatedList, 'btn-default': associatedList}"
  42 + class="btn btn-sm btn-default p-1"
  43 + ng-click="openListaDePrecios()">
  44 + <span class="fa fa-circle-thin"></span>
  45 + </button>
  46 + </div>
  47 + </div>
  48 + <div ng-show="listaDePreciosAlternativa != null" class="row align-items-center pb-1">
  49 + <div class="col-lg-2 col-2 text-center" ng-bind="listaDePreciosAlternativa.ID"></div>
  50 + <div class="col-lg-7 col-7" ng-bind="listaDePreciosAlternativa.DES"></div>
  51 + <div class="col-lg-3 col-3 text-center">
  52 + <button ng-click="verListaProductos(listaDePreciosAlternativa.ID)" class="btn btn-sm p-1">
  53 + <span class="fa fa-eye"></span>
  54 + </button>
  55 + </div>
  56 + </div>
  57 + </div>
  58 + </div>
  59 + </div>
  60 +</div>
  61 +<div class="modal-footer py-2">
  62 + <button class="btn btn-sm btn-secondary" type="button" ng-click="closeModalPrecioCondicion()">Cerrar
  63 + </button>
  64 + <button class="btn btn-sm btn-primary" type="button" ng-click="guardarPrecioCondicion()">Guardar
  65 + </button>
  66 +</div>