Commit d13de269b202a3e0fe37ff1f5dbb3bb9cc675d8c

Authored by Eric Fernandez
Exists in master and in 2 other branches develop, lab

Merge branch 'master' into 'develop'

Master(mpuebla)

See merge request !15
src/js/controller.js
... ... @@ -91,7 +91,7 @@ angular.module('focaActivarHojaRuta')
91 91 texto = 'Disponible';
92 92 break;
93 93 case 1:
94   - texto = 'Asignada';
  94 + texto = 'Activada';
95 95 break;
96 96 case 2:
97 97 texto = 'Terminada';
... ... @@ -103,85 +103,14 @@ 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?';
112   -
113   - // focaModalService
114   - // .confirm(texto)
115   - // .then(function (res) {
116   - // if (res) activar();
117   - // });
118   - // } else {
119   - // activar();
120   - // }
121   -
122   - // function activar() {
123 106 focaActivarHojaRutaService
124 107 .activarHojaRuta(hojaRuta.id, $scope.chofer)
125 108 .then(function () {
126   - hojaRuta.estado = 1;
127   - // init();
128   - focaModalService.alert('Hoja de ruta activada');
  109 + hojaRuta.estado = hojaRuta.estado === 0 ? 1 : 0;
  110 + focaModalService
  111 + .alert(hojaRuta.estado === 1 ?
  112 + 'Hoja de ruta activada' : 'Hoja de ruta desactivada');
129 113 });
130   - // }
131   - // });
132 114 };
133   -
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   - // if(focaActivarHojaRutaService.transportistaSeleccionado.COD) {
147   - // elegirTransportista(focaActivarHojaRutaService.transportistaSeleccionado);
148   - // }
149   - // focaActivarHojaRutaService.cleanCisternasLocal();
150   - // $scope.editar = function(id) {
151   - // $location.path('/vehiculo/' + id + '/' + $scope.idTransportista);
152   - // };
153   - // $scope.solicitarConfirmacion = function(vehiculo) {
154   - // focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' +
155   - // vehiculo.id + ' ' + vehiculo.tractor + ' ?').then(
156   - // function(data) {
157   - // if(data) {
158   - // focaActivarHojaRutaService.deleteVehiculo(vehiculo.id);
159   - // $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1);
160   - // }
161   - // }
162   - // );
163   - // };
164   -
165   - // function elegirTransportista(transportista) {
166   - // var codigo = ('00000' + transportista.COD).slice(-5);
167   - // $scope.idTransportista = transportista.COD;
168   - // $scope.filtros = transportista.NOM.trim();
169   - // $timeout(function() {
170   - // $scope.$broadcast('addCabecera', {
171   - // label: 'Transportista:',
172   - // valor: codigo + ' - ' + transportista.NOM
173   - // });
174   - // });
175   - // buscar(transportista.COD);
176   - // }
177   -
178   - // function buscar(idTransportista) {
179   - // focaActivarHojaRutaService
180   - // .getVehiculosPorTransportista(idTransportista)
181   - // .then(function(datos) {
182   - // $scope.vehiculos = datos.data;
183   - // });
184   - // }
185   - //#endregion
186 115 }
187 116 ]);
... ... @@ -5,7 +5,8 @@ angular.module('focaActivarHojaRuta')
5 5 return $http.get(API_ENDPOINT.URL + '/hoja-ruta/disponible/' + chofer);
6 6 },
7 7 activarHojaRuta: function (hoja_ruta, chofer) {
8   - return $http.get(API_ENDPOINT.URL + '/hoja-ruta/activar/' + hoja_ruta + '/' + chofer);
  8 + return $http.get(API_ENDPOINT.URL + '/hoja-ruta/activar/' +
  9 + hoja_ruta + '/' + chofer);
9 10 },
10 11 getHojaRutaByIdChofer: function (chofer) {
11 12 return $http.get(API_ENDPOINT.URL + '/hoja-ruta/chofer/' + chofer);
src/views/activar-hoja-ruta.html
... ... @@ -61,8 +61,11 @@
61 61 title="Activar"
62 62 ng-click="activarHojaRuta(hojaRuta)"
63 63 >
64   - <i class="fa fa-check"></i>
65   - </button>
  64 + <i
  65 + ng-class="{'fa-check': hojaRuta.estado == 0,'fa-times': hojaRuta.estado == 1}"
  66 + class="fa">
  67 + </i>
  68 + </button>
66 69 </td>
67 70 </tr>
68 71 </body>