service.js
1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
angular.module('focaAbmPreciosCondiciones')
    .service('focaAbmPreciosCondicionesService', [
        '$http', 'API_ENDPOINT',
        function($http, API_ENDPOINT) {
            return {
                obtenerPreciosCondiciones: function(nombre) {
                    return $http.post(API_ENDPOINT.URL + '/precios-condiciones', {nombre: nombre});
                },
                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);
                },
                obtenerPlazoPago: function(idPrecioCondicion) {
                    return $http.get(
                        API_ENDPOINT.URL + '/plazo-pago/precio-condicion/' + idPrecioCondicion
                    );
                },
                borrarPlazoPago: function(id) {
                    return $http.delete(API_ENDPOINT.URL + '/plazo-pago/' + id);
                },
                guardarPlazosPago: function(plazos) {
                    return $http.post(
                        API_ENDPOINT.URL + '/plazos-pago',
                        {plazosPago: plazos}
                    );
                }
            };
        }
    ]);