Commit 16b4381fa73358dee72c718544e8edfc506e2f1f
1 parent
5817eeeef2
Exists in
master
and in
2 other branches
Se puede activar mas de una hoja de ruta.
Showing
2 changed files
with
40 additions
and
40 deletions
 
Show diff stats
src/js/controller.js
| ... | ... | @@ -103,46 +103,46 @@ angular.module('focaActivarHojaRuta') | 
| 103 | 103 | }; | 
| 104 | 104 | |
| 105 | 105 | $scope.activarHojaRuta = function (hojaRuta) { | 
| 106 | - validarChoferDisponible().then(function (hojaRutaAsignada) { | |
| 107 | - if (hojaRutaAsignada) { | |
| 108 | - var texto = 'El chofer tiene asignada la Hoja de Ruta Nº ' + | |
| 109 | - $filter('comprobante')([hojaRutaAsignada.sucursal, | |
| 110 | - hojaRutaAsignada.numeroHojaRuta]) + | |
| 111 | - ', ¿desea reemplazarla por esta?'; | |
| 106 | + // validarChoferDisponible().then(function (hojaRutaAsignada) { | |
| 107 | + // if (hojaRutaAsignada) { | |
| 108 | + // var texto = 'El chofer tiene asignada la Hoja de Ruta Nº ' + | |
| 109 | + // $filter('comprobante')([hojaRutaAsignada.sucursal, | |
| 110 | + // hojaRutaAsignada.numeroHojaRuta]) + | |
| 111 | + // ', ¿desea reemplazarla por esta?'; | |
| 112 | 112 | |
| 113 | - focaModalService | |
| 114 | - .confirm(texto) | |
| 115 | - .then(function (res) { | |
| 116 | - if (res) activar(); | |
| 117 | - }); | |
| 118 | - } else { | |
| 119 | - activar(); | |
| 120 | - } | |
| 113 | + // focaModalService | |
| 114 | + // .confirm(texto) | |
| 115 | + // .then(function (res) { | |
| 116 | + // if (res) activar(); | |
| 117 | + // }); | |
| 118 | + // } else { | |
| 119 | + // activar(); | |
| 120 | + // } | |
| 121 | 121 | |
| 122 | - function activar() { | |
| 123 | - focaActivarHojaRutaService | |
| 124 | - .activarHojaRuta(hojaRuta.id, $scope.chofer) | |
| 125 | - .then(function () { | |
| 126 | - hojaRuta.estado = 1; | |
| 127 | - init(); | |
| 128 | - focaModalService.alert('Hoja de ruta activada'); | |
| 129 | - }); | |
| 130 | - } | |
| 131 | - }); | |
| 122 | + // function activar() { | |
| 123 | + focaActivarHojaRutaService | |
| 124 | + .activarHojaRuta(hojaRuta.id, $scope.chofer) | |
| 125 | + .then(function () { | |
| 126 | + hojaRuta.estado = 1; | |
| 127 | + // init(); | |
| 128 | + focaModalService.alert('Hoja de ruta activada'); | |
| 129 | + }); | |
| 130 | + // } | |
| 131 | + // }); | |
| 132 | 132 | }; | 
| 133 | - | |
| 134 | - function validarChoferDisponible() { | |
| 135 | - return new Promise(function (resolve, reject) { | |
| 136 | - focaActivarHojaRutaService | |
| 137 | - .getHojaRutaByIdChofer($scope.chofer) | |
| 138 | - .then(function (res) { | |
| 139 | - resolve(res.data); | |
| 140 | - }) | |
| 141 | - .catch(reject); | |
| 142 | - }); | |
| 143 | - } | |
| 144 | - | |
| 133 | + | |
| 145 | 134 | //#region Codigo Comentado | 
| 135 | + // function validarChoferDisponible() { | |
| 136 | + // return new Promise(function (resolve, reject) { | |
| 137 | + // focaActivarHojaRutaService | |
| 138 | + // .getHojaRutaByIdChofer($scope.chofer) | |
| 139 | + // .then(function (res) { | |
| 140 | + // resolve(res.data); | |
| 141 | + // }) | |
| 142 | + // .catch(reject); | |
| 143 | + // }); | |
| 144 | + // } | |
| 145 | + | |
| 146 | 146 | // if(focaActivarHojaRutaService.transportistaSeleccionado.COD) { | 
| 147 | 147 | // elegirTransportista(focaActivarHojaRutaService.transportistaSeleccionado); | 
| 148 | 148 | // } | 
src/js/service.js
| 1 | 1 | angular.module('focaActivarHojaRuta') | 
| 2 | - .factory('focaActivarHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | |
| 2 | + .factory('focaActivarHojaRutaService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { | |
| 3 | 3 | return { | 
| 4 | - getHojasRutas: function(chofer) { | |
| 4 | + getHojasRutas: function (chofer) { | |
| 5 | 5 | return $http.get(API_ENDPOINT.URL + '/hoja-ruta/disponible/' + chofer); | 
| 6 | 6 | }, | 
| 7 | - activarHojaRuta: function(hoja_ruta, chofer) { | |
| 7 | + activarHojaRuta: function (hoja_ruta, chofer) { | |
| 8 | 8 | return $http.get(API_ENDPOINT.URL + '/hoja-ruta/activar/' + hoja_ruta + '/' + chofer); | 
| 9 | 9 | }, | 
| 10 | - getHojaRutaByIdChofer: function(chofer) { | |
| 10 | + getHojaRutaByIdChofer: function (chofer) { | |
| 11 | 11 | return $http.get(API_ENDPOINT.URL + '/hoja-ruta/chofer/' + chofer); | 
| 12 | 12 | } | 
| 13 | 13 | }; |