service.js 1.84 KB
angular.module('focaEstadoCisternas')
    .factory('focaEstadoCisternasService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
        return {
            getVehiculos: function() {
                return $http.get(API_ENDPOINT.URL + '/vehiculo');
            },
            getTransportistas: function() {
                return $http.get(API_ENDPOINT.URL + '/transportista');
            },
            getCisternadoPorVehiculo: function(idVehiculo) {
                return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo);
            },
            getCisterna: function(id) {
                return $http.get(API_ENDPOINT.URL + '/cisterna/obtener/' + id);
            },
            guardarCisterna: function(cisterna) {
                return $http.post(API_ENDPOINT.URL + '/cisterna/guardar', {cisterna: cisterna});
            },
            deleteCisterna: function(id) {
                return $http.delete(API_ENDPOINT.URL + '/cisterna/borrar/' + id);
            },
            getVehiculosPorTransportista: function(id) {
                return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id);
            },
            getEstadoCisterna: function(id, fecha) {
                return $http.post(API_ENDPOINT.URL + '/cisterna/stock',
                    {idCisterna: id, fecha: fecha});
            },
            getBotonera: function() {
                return [
                    {
                        label: 'Vehiculo',
                        image: 'vehiculos.png'
                    },
                    {
                        label: 'Fecha entrega',
                        image: 'FechaEntrega.png'
                    },
                    {
                        label: 'Grafico',
                        image: 'fechaDeReparto.png'
                    }
                ];
            }
        };
    }]);