angular.module('focaParametros') .factory('focaParametrosService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { return { getNotasPedido: function (fechaDesde, fechaHasta) { return $http.get(API_ENDPOINT.URL + '/nota-pedido/listar/' + fechaDesde + '/' + fechaHasta + '/sin-remito'); }, getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + idDomicilio + '/' + idCliente); }, saveParametros: function(parametros) { return $http.post(API_ENDPOINT.URL + '/parametros', parametros); }, getParametros: function() { return $http.get(API_ENDPOINT.URL + '/parametros'); }, plazoToString: function(plazos) { var result = ''; for(var i = 0; i < plazos.length; i++) { result += plazos[i].dias + ' '; } return result.trim(); }, getBotones: function (modulo) { var botones = [ { label: 'Vendedor', variable: 'vendedor', image: 'vendedor.png', modulo: [1, 2] }, { label: 'Cliente', image: 'cliente.png', variable: 'cliente', modulo: [1, 2] }, { label: 'Proveedor', image: 'proveedor.png', variable: 'proveedor', modulo: [1, 2] }, { label: 'Flete', image: 'flete.png', variable: 'flete', modulo: [1, 2] }, { label: 'Moneda', image: 'moneda.png', variable: 'cotizacion', modulo: [1, 2] }, { label: 'Precios y condiciones', image: 'precios-condiciones.png', variable: 'precioCondicion', modulo: [1, 2] }, { label: 'Observaciones', image: 'botonObservaciones.png', variable: 'observaciones', modulo: [1] } ]; // Devuelvo solo los botones correspondietes // Modulo 1 = nota de pedido, 2 remito, 3 ambos return botones.filter(function (p) { return p.modulo.includes(modulo); }); }, getBotonesPrincipal: [ { label: 'Nota de Pedido', image: 'notaPedido.png', modulo: 1, variable: 'notaPedido' }, { label: 'Remito', image: 'remito.png', modulo: 2, variable: 'remito' } ] }; }]);