service.js 1.34 KB
angular.module('focaAbmPreciosCondiciones')
    .service('focaAbmPreciosCondicionesService', [
        '$http', 'API_ENDPOINT',
        function($http, API_ENDPOINT) {
            return {
                obtenerPreciosCondiciones: function() {
                    return $http.get(API_ENDPOINT.URL + '/precio-condicion');
                },
                obtenerPrecioCondicion: function(id) {
                    return $http.get(API_ENDPOINT.URL + '/precio-condicion/' + id);
                },
                guardarPrecioCondicion: function(precioCondicion) {
                    return $http.post(
                        API_ENDPOINT.URL + '/precio-condicion',
                        {precioCondicion: precioCondicion}
                    );
                },
                borrarPrecioCondicion: function(id) {
                    return $http.delete(API_ENDPOINT.URL + '/precio-condicion/' + id);
                }
            };
        }
    ])
    .service('focaAbmPlazoPagoService', [
        '$http', 'API_ENDPOINT',
        function($http, API_ENDPOINT) {
            return {
                obtenerPlazoPago: function(idPrecioCondicion) {
                    return $http.get(
                        API_ENDPOINT.URL + '/plazo-pago/precio-condicion/' + idPrecioCondicion
                    );
                }
            };
        }
    ]);