From 16b4381fa73358dee72c718544e8edfc506e2f1f Mon Sep 17 00:00:00 2001 From: mpuebla Date: Thu, 11 Jul 2019 16:32:10 -0300 Subject: [PATCH] Se puede activar mas de una hoja de ruta. --- src/js/controller.js | 72 ++++++++++++++++++++++++++-------------------------- src/js/service.js | 8 +++--- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index 36fff4c..35df87e 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -103,46 +103,46 @@ angular.module('focaActivarHojaRuta') }; $scope.activarHojaRuta = function (hojaRuta) { - validarChoferDisponible().then(function (hojaRutaAsignada) { - if (hojaRutaAsignada) { - var texto = 'El chofer tiene asignada la Hoja de Ruta Nº ' + - $filter('comprobante')([hojaRutaAsignada.sucursal, - hojaRutaAsignada.numeroHojaRuta]) + - ', ¿desea reemplazarla por esta?'; + // validarChoferDisponible().then(function (hojaRutaAsignada) { + // if (hojaRutaAsignada) { + // var texto = 'El chofer tiene asignada la Hoja de Ruta Nº ' + + // $filter('comprobante')([hojaRutaAsignada.sucursal, + // hojaRutaAsignada.numeroHojaRuta]) + + // ', ¿desea reemplazarla por esta?'; - focaModalService - .confirm(texto) - .then(function (res) { - if (res) activar(); - }); - } else { - activar(); - } + // focaModalService + // .confirm(texto) + // .then(function (res) { + // if (res) activar(); + // }); + // } else { + // activar(); + // } - function activar() { - focaActivarHojaRutaService - .activarHojaRuta(hojaRuta.id, $scope.chofer) - .then(function () { - hojaRuta.estado = 1; - init(); - focaModalService.alert('Hoja de ruta activada'); - }); - } - }); + // function activar() { + focaActivarHojaRutaService + .activarHojaRuta(hojaRuta.id, $scope.chofer) + .then(function () { + hojaRuta.estado = 1; + // init(); + focaModalService.alert('Hoja de ruta activada'); + }); + // } + // }); }; - - function validarChoferDisponible() { - return new Promise(function (resolve, reject) { - focaActivarHojaRutaService - .getHojaRutaByIdChofer($scope.chofer) - .then(function (res) { - resolve(res.data); - }) - .catch(reject); - }); - } - + //#region Codigo Comentado + // function validarChoferDisponible() { + // return new Promise(function (resolve, reject) { + // focaActivarHojaRutaService + // .getHojaRutaByIdChofer($scope.chofer) + // .then(function (res) { + // resolve(res.data); + // }) + // .catch(reject); + // }); + // } + // if(focaActivarHojaRutaService.transportistaSeleccionado.COD) { // elegirTransportista(focaActivarHojaRutaService.transportistaSeleccionado); // } diff --git a/src/js/service.js b/src/js/service.js index 4573463..8850c12 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -1,13 +1,13 @@ angular.module('focaActivarHojaRuta') - .factory('focaActivarHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { + .factory('focaActivarHojaRutaService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { return { - getHojasRutas: function(chofer) { + getHojasRutas: function (chofer) { return $http.get(API_ENDPOINT.URL + '/hoja-ruta/disponible/' + chofer); }, - activarHojaRuta: function(hoja_ruta, chofer) { + activarHojaRuta: function (hoja_ruta, chofer) { return $http.get(API_ENDPOINT.URL + '/hoja-ruta/activar/' + hoja_ruta + '/' + chofer); }, - getHojaRutaByIdChofer: function(chofer) { + getHojaRutaByIdChofer: function (chofer) { return $http.get(API_ENDPOINT.URL + '/hoja-ruta/chofer/' + chofer); } }; -- 1.9.1