angular.module('focaCrearHojaRuta') .service('crearHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { var route = API_ENDPOINT.URL; return { crearHojaRuta: function(hojaRuta) { return $http.post(route + '/hoja-ruta', hojaRuta); }, obtenerHojaRuta: function() { return $http.get(route +'/hoja-ruta'); }, setHojaRuta: function(hojaRuta) { this.hojaRuta = hojaRuta; }, clearHojaRuta: function() { this.hojaRuta = undefined; }, getHojaRuta: function() { return this.hojaRuta; }, getArticulosByIdHojaRuta: function(id) { return $http.get(route+'/articulos/hoja-ruta/'+id); }, crearArticulosParaHojaRuta: function(articuloHojaRuta) { return $http.post(route + '/articulos/hoja-ruta', {articuloHojaRuta: articuloHojaRuta}); }, getDomiciliosByIdHojaRuta: function(id) { return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); }, getDomiciliosByIdCliente: function(id) { var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); }, getPrecioCondicion: function() { return $http.get(route + '/precio-condicion'); }, getPrecioCondicionById: function(id) { return $http.get(route + '/precio-condicion/' + id); }, getPlazoPagoByPrecioCondicion: function(id) { return $http.get(route + '/plazo-pago/precio-condicion/' + id); }, crearFlete: function(flete) { return $http.post(route + '/flete', {flete : flete}); }, crearPlazosParaHojaRuta: function(plazos) { return $http.post(route + '/plazo-pago/hoja-ruta', plazos); }, getCotizacionByIdMoneda: function(id) { return $http.get(route + '/moneda/' + id); }, crearEstadoParaHojaRuta: function(estado) { return $http.post(route + '/estado', {estado: estado}); }, getNumeroHojaRuta: function() { return $http.get(route + '/hoja-ruta/numero-siguiente'); }, getBotonera: function() { return ['Transportista', 'Chofer', 'Vehiculo', 'Tarifario', 'Remitos']; } }; }]);