Commit 08f86b7ab220b7a12d2f1f0161b1950f29241acb
Exists in
master
and in
2 other branches
Merge branch 'develop' into 'master'
Develop See merge request !8
Showing
4 changed files
Show diff stats
src/js/controller.js
1 | 1 | angular.module('focaActivarHojaRuta') |
2 | 2 | .controller('focaActivarHojaRutaController', [ |
3 | 3 | '$scope', 'focaActivarHojaRutaService', 'focaModalService', 'focaBotoneraLateralService', |
4 | - '$filter', | |
4 | + '$filter','$uibModal', | |
5 | 5 | function($scope, focaActivarHojaRutaService, focaModalService, focaBotoneraLateralService, |
6 | - $filter) { | |
6 | + $filter, $uibModal) { | |
7 | 7 | config(); |
8 | 8 | |
9 | 9 | //METODOS |
... | ... | @@ -70,9 +70,40 @@ angular.module('focaActivarHojaRuta') |
70 | 70 | ); |
71 | 71 | }; |
72 | 72 | |
73 | + $scope.mostrarRemitos = function (hojasRutas) { | |
74 | + $uibModal.open( | |
75 | + { | |
76 | + ariaLabelledBy: '', | |
77 | + templateUrl: 'modal-remitos.html', | |
78 | + controller: 'focaModalDetalleController', | |
79 | + resolve: { | |
80 | + hojasRutas: function () { return hojasRutas; }, | |
81 | + }, | |
82 | + size: 'lg', | |
83 | + } | |
84 | + ); | |
85 | + }; | |
86 | + | |
87 | + $scope.setearEstado = function (estado) { | |
88 | + var texto = ''; | |
89 | + switch (estado) { | |
90 | + case 0: | |
91 | + texto = 'Disponible'; | |
92 | + break; | |
93 | + case 1: | |
94 | + texto = 'Asignada'; | |
95 | + break; | |
96 | + case 2: | |
97 | + texto = 'Terminada'; | |
98 | + break; | |
99 | + default: | |
100 | + break; | |
101 | + } | |
102 | + return texto; | |
103 | + }; | |
104 | + | |
73 | 105 | $scope.activarHojaRuta = function(hojaRuta) { |
74 | 106 | validarChoferDisponible().then(function(hojaRutaAsignada) { |
75 | - | |
76 | 107 | if (hojaRutaAsignada) { |
77 | 108 | var texto = 'El chofer tiene asignada la Hoja de Ruta Nº ' + |
78 | 109 | $filter('comprobante')([hojaRutaAsignada.sucursal, |
... | ... | @@ -92,11 +123,11 @@ angular.module('focaActivarHojaRuta') |
92 | 123 | focaActivarHojaRutaService |
93 | 124 | .activarHojaRuta(hojaRuta.id, $scope.chofer) |
94 | 125 | .then(function() { |
126 | + hojaRuta.estado = 1; | |
95 | 127 | init(); |
96 | 128 | focaModalService.alert('Hoja de ruta activada'); |
97 | 129 | }); |
98 | 130 | } |
99 | - | |
100 | 131 | }); |
101 | 132 | }; |
102 | 133 |
src/js/controllerDetalle.js
... | ... | @@ -0,0 +1,15 @@ |
1 | +angular.module('focaActivarHojaRuta') | |
2 | + .controller('focaModalDetalleController', [ | |
3 | + '$scope', '$timeout', '$uibModalInstance', 'focaModalService', | |
4 | + 'focaActivarHojaRutaService','hojasRutas', | |
5 | + function ($scope, $timeout, $uibModalInstance, focaModalService, | |
6 | + focaActivarHojaRutaService, hojasRutas) { | |
7 | + | |
8 | + $scope.mostrar = false; | |
9 | + $scope.hojasRutas = hojasRutas; | |
10 | + | |
11 | + $scope.cancel = function () { | |
12 | + $uibModalInstance.close(hojasRutas); | |
13 | + }; | |
14 | + } | |
15 | +]); |
src/views/activar-hoja-ruta.html
... | ... | @@ -27,6 +27,8 @@ |
27 | 27 | <th>Número</th> |
28 | 28 | <th>Fecha</th> |
29 | 29 | <th>Remitos</th> |
30 | + <th>Estados</th> | |
31 | + <th></th> | |
30 | 32 | <th class="text-center"> |
31 | 33 | </th> |
32 | 34 | </tr> |
... | ... | @@ -35,7 +37,20 @@ |
35 | 37 | <tr ng-repeat="hojaRuta in hojasRuta | filter:filtros"> |
36 | 38 | <td ng-bind="[hojaRuta.sucursal, hojaRuta.numeroHojaRuta] | comprobante"></td> |
37 | 39 | <td ng-bind="hojaRuta.fechaReparto | date:'yyyy-MM-dd':'-0300'"></td> |
38 | - <td ng-bind="hojaRuta.remitos.length"></td> | |
40 | + <td> | |
41 | + <div ng-bind="hojaRuta.remitos.length" class="d-inline-block"></div> | |
42 | + <button class="btn btn-outline-dark boton-accion" ng-click="mostrarRemitos(hojaRuta)"> | |
43 | + <i class="fa fa-eye"></i> | |
44 | + </button> | |
45 | + </td> | |
46 | + <td | |
47 | + ng-bind="setearEstado(hojaRuta.estado)" | |
48 | + ng-class="{'text-white':hojaRuta.estado == 0, | |
49 | + 'text-danger':hojaRuta.estado == 1, | |
50 | + 'text-dark': hojaRuta.estado == 2 | |
51 | + }" | |
52 | + ></td> | |
53 | + <td></td> | |
39 | 54 | <td class="text-center"> |
40 | 55 | <button |
41 | 56 | class="btn btn-outline-dark boton-accion" |
src/views/modal-remitos.html
... | ... | @@ -0,0 +1,45 @@ |
1 | +<div class="modal-header py-1"> | |
2 | + <div class="row w-100"> | |
3 | + <div class="col-lg-6"> | |
4 | + <h5 class="modal-title my-1">Hoja de Ruta</h5> | |
5 | + </div> | |
6 | + </div> | |
7 | + </div> | |
8 | + <div class="row"> | |
9 | + <div class="col ml-3 mt-2"> | |
10 | + <span class=" text-left"> | |
11 | + Transportista <b>{{hojasRutas.idTransportista}} {{hojasRutas.transportista.NOM}}</b> | |
12 | + Unidad <b>{{hojasRutas.vehiculo.codigo}}</b> Tractor <b>{{hojasRutas.vehiculo.tractor}}</b> | |
13 | + </span> | |
14 | + | |
15 | + </div> | |
16 | + </div> | |
17 | + <div class="row"> | |
18 | + <div class="col ml-3"> | |
19 | + <span class=" text-left">Fecha <b>{{hojasRutas.fechaCreacion | date:'yyyy-MM-dd':'-0300'}}</b></span> | |
20 | + </div> | |
21 | + </div> | |
22 | + <div class="modal-body" id="modal-body"> | |
23 | + <table class="table table-hover table-sm table-striped"> | |
24 | + <thead> | |
25 | + <tr> | |
26 | + <th>Remito</th> | |
27 | + <th>Cliente</th> | |
28 | + <th>Domicilio</th> | |
29 | + </tr> | |
30 | + </thead> | |
31 | + <tbody> | |
32 | + <tr | |
33 | + ng-repeat="remito in hojasRutas.remitos" | |
34 | + > | |
35 | + <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> | |
36 | + <td ng-bind="remito.nombreCliente"></td> | |
37 | + <td ng-bind="remito.domicilioStamp"></td> | |
38 | + </tr> | |
39 | + </tbody> | |
40 | + </table> | |
41 | + </div> | |
42 | + <div class="modal-footer py-1"> | |
43 | + <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | |
44 | + </div> | |
45 | +</div> |