Commit 658aafc9a0683eca98f3c7aae451485f7937ac1d
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !7
Showing
4 changed files
Show diff stats
src/js/controllerDetalleVehiculo.js
... | ... | @@ -24,9 +24,7 @@ angular.module('focaLogisticaPedidoRuta') |
24 | 24 | focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito).then( |
25 | 25 | function(res) { |
26 | 26 | $scope.remito = res.data; |
27 | - if($scope.remito.idUsuarioProceso && $scope.remito.idUsuarioProceso !== | |
28 | - focaLogisticaPedidoRutaService.idUsuario) | |
29 | - { | |
27 | + if($scope.remito.idUsuarioProceso) { | |
30 | 28 | focaModalService.alert('El remito esta siendo cargado por otro usario'); |
31 | 29 | $uibModalInstance.close(); |
32 | 30 | } |
src/js/controllerHojaRuta.js
... | ... | @@ -63,4 +63,24 @@ angular.module('focaLogisticaPedidoRuta') |
63 | 63 | } |
64 | 64 | ); |
65 | 65 | }; |
66 | + $scope.eliminarRemitos = function() { | |
67 | + var remitosDel = $filter('filter')($scope.remitos, {checked: true}); | |
68 | + focaModalService.alert('¿Seguro que desea desasociar estos remitos del vehículo?') | |
69 | + .then(function() { | |
70 | + eliminarRemitos(remitosDel); | |
71 | + } | |
72 | + ); | |
73 | + }; | |
74 | + $scope.minimoUnoChecked = function() { | |
75 | + var remitosChequeados = $filter('filter')($scope.remitos, {checked: true}); | |
76 | + return !remitosChequeados.length; | |
77 | + }; | |
78 | + function eliminarRemitos(remitosDel) { | |
79 | + var nuevosRemitos = $filter('filter')($scope.remitos, {checked: !true}); | |
80 | + focaLogisticaPedidoRutaService.desasociarRemitos(remitosDel, $scope.vehiculo.id, | |
81 | + nuevosRemitos ? true : false).then(function() { | |
82 | + focaModalService.alert('Remitos desasociados con éxito'); | |
83 | + $scope.remitos = nuevosRemitos; | |
84 | + }); | |
85 | + } | |
66 | 86 | }]); |
src/js/service.js
... | ... | @@ -30,6 +30,18 @@ angular.module('focaLogisticaPedidoRuta') |
30 | 30 | crearHojaRuta: function(hojaRuta) { |
31 | 31 | return $http.post(API_ENDPOINT.URL + '/hoja-ruta', hojaRuta); |
32 | 32 | }, |
33 | + desasociarRemitos: function(remitos, idVehiculo, sinRemitos) { | |
34 | + var idsRemitos = []; | |
35 | + for (var i = 0; i < remitos.length; i++) { | |
36 | + idsRemitos.push(remitos[i].id); | |
37 | + } | |
38 | + return $http.post(API_ENDPOINT.URL + '/vehiculo/desasociar-remitos', | |
39 | + { | |
40 | + idsRemitos: idsRemitos, | |
41 | + idVehiculo: idVehiculo, | |
42 | + vehiculoSinRemitos: sinRemitos | |
43 | + }); | |
44 | + }, | |
33 | 45 | obtenerRemitosDeCarga: function(remitos) { |
34 | 46 | var remitosRes = []; |
35 | 47 | for(var i = 0; i < remitos.cisternas.length; i++) { |
... | ... | @@ -43,7 +55,8 @@ angular.module('focaLogisticaPedidoRuta') |
43 | 55 | } |
44 | 56 | } |
45 | 57 | function procesoMovimiento(movimiento) { |
46 | - if(movimiento.remito && !movimiento.remito.idHojaRuta) { | |
58 | + if(!movimiento.anulado && movimiento.remito && | |
59 | + !movimiento.remito.idHojaRuta) { | |
47 | 60 | var remito = movimiento.remito; |
48 | 61 | var yaEstaCargado = $filter('filter')(remitosRes, {id: remito.id}); |
49 | 62 | if(!yaEstaCargado.length && movimiento.metodo === 'carga') { |
src/views/foca-modal-crear-hoja-ruta.html
... | ... | @@ -84,12 +84,27 @@ |
84 | 84 | <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> |
85 | 85 | <td ng-bind="remito.nombreCliente"></td> |
86 | 86 | <td ng-bind="remito.domicilioStamp"></td> |
87 | - </tr> | |
87 | + <td> | |
88 | + <div class="custom-control custom-checkbox"> | |
89 | + <input | |
90 | + type="checkbox" | |
91 | + ng-model="remito.checked" | |
92 | + class="custom-control-input" | |
93 | + id="{{remito.id}}"> | |
94 | + <label class="custom-control-label" for="{{remito.id}}"></label> | |
95 | + </div> | |
96 | + </td> | |
97 | + </tr> | |
88 | 98 | </tbody> |
89 | 99 | </table> |
90 | 100 | </div> |
91 | 101 | <div class="modal-footer py-1"> |
92 | 102 | <button |
103 | + class="btn btn-sm btn-danger" | |
104 | + type="button" | |
105 | + ng-click="eliminarRemitos()" | |
106 | + ng-disabled="minimoUnoChecked()">Eliminar</button> | |
107 | + <button | |
93 | 108 | class="btn btn-sm btn-secondary" |
94 | 109 | ladda="cargando" |
95 | 110 | type="button" |