Commit 0e13a3f82824b0e66ad1b223220b63d30efa0af3
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !9
Showing
3 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -6,7 +6,6 @@ angular.module('focaHojaRuta') |
6 | 6 | '$filter', |
7 | 7 | '$uibModal', |
8 | 8 | 'hojaRutaService', |
9 | - 'focaSeguimientoService', | |
10 | 9 | 'focaLoginService', |
11 | 10 | 'focaModalService', |
12 | 11 | function( |
... | ... | @@ -15,7 +14,6 @@ angular.module('focaHojaRuta') |
15 | 14 | $filter, |
16 | 15 | $uibModal, |
17 | 16 | hojaRutaService, |
18 | - focaSeguimientoService, | |
19 | 17 | focaLoginService, |
20 | 18 | focaModalService |
21 | 19 | ) { |
... | ... | @@ -93,18 +91,30 @@ angular.module('focaHojaRuta') |
93 | 91 | focaModalService |
94 | 92 | .confirm('¿Desea terminar la hoja de ruta? No podra realizar ninguna ' + |
95 | 93 | 'otra descarga ni modificación') |
96 | - .then(terminar); | |
97 | - function terminar() { | |
98 | - hojaRutaService.terminarHojaRuta($scope.hojasRuta.id).then( | |
99 | - function() { | |
100 | - focaModalService.alert( | |
101 | - 'Hoja de ruta ' + | |
102 | - $filter('comprobante')([$scope.puntoVenta, | |
103 | - $scope.comprobante]) + ' cerrada con éxito'); | |
104 | - $location.path('/'); | |
105 | - } | |
106 | - ); | |
94 | + .then(function() {$scope.datosExtraCierre(terminar);}); | |
95 | + function terminar(hojaRuta) { | |
96 | + console.log(hojaRuta); | |
97 | + //TODO: refactor servivcio para recibir nuevos parámetros | |
98 | + // hojaRutaService.terminarHojaRuta($scope.hojasRuta.id).then( | |
99 | + // function() { | |
100 | + // focaModalService.alert( | |
101 | + // 'Hoja de ruta ' + | |
102 | + // $filter('comprobante')([$scope.puntoVenta, | |
103 | + // $scope.comprobante]) + ' cerrada con éxito'); | |
104 | + // $location.path('/'); | |
105 | + // } | |
106 | + // ); | |
107 | 107 | } |
108 | 108 | }; |
109 | + | |
110 | + $scope.datosExtraCierre = function(terminar) { | |
111 | + var modalInstance = $uibModal.open( | |
112 | + { | |
113 | + templateUrl: 'focaDatosExtra.html', | |
114 | + controller: 'focaModalDatosExtraCierre', | |
115 | + } | |
116 | + ); | |
117 | + modalInstance.result.then(terminar); | |
118 | + }; | |
109 | 119 | } |
110 | - ]); | |
120 | + ]); |
src/js/controllerDatosExtra.js
... | ... | @@ -0,0 +1,30 @@ |
1 | +angular.module('focaHojaRuta') | |
2 | + .controller('focaModalDatosExtraCierre', | |
3 | + [ | |
4 | + '$scope', | |
5 | + '$uibModalInstance', | |
6 | + 'focaModalService', | |
7 | + function($scope, $uibModalInstance, focaModalService) { | |
8 | + $scope.datosHojaRutaCierre = {}; | |
9 | + $scope.focused = 0; | |
10 | + | |
11 | + $scope.aceptar = function(key) { | |
12 | + if(key === 13) { | |
13 | + if(!$scope.formDatosHojaRutaCierre.$valid) { | |
14 | + focaModalService.alert('Formulario inválido'); | |
15 | + return; | |
16 | + } | |
17 | + $uibModalInstance.close($scope.datosHojaRutaCierre); | |
18 | + } | |
19 | + }; | |
20 | + | |
21 | + $scope.next = function(key) { | |
22 | + if(key === 13) $scope.focused++; | |
23 | + }; | |
24 | + | |
25 | + $scope.cancel = function() { | |
26 | + $uibModalInstance.dismiss('cancel'); | |
27 | + }; | |
28 | + } | |
29 | + ] | |
30 | + ); |
src/views/focaDatosExtra.html
... | ... | @@ -0,0 +1,63 @@ |
1 | +<div class="modal-header"> | |
2 | + <h3 class="modal-title">Datos de la hoja de ruta</h3> | |
3 | +</div> | |
4 | +<div class="modal-body" id="modal-body"> | |
5 | + <form name="formDatosHojaRutaCierre"> | |
6 | + <div class="row"> | |
7 | + <div class="col-12"> | |
8 | + <label class="form-control-sm">Kilómetros finales del vehículo:</label> | |
9 | + </div> | |
10 | + <div class="col-12"> | |
11 | + <input | |
12 | + type="number" | |
13 | + foca-focus="focused === 0" | |
14 | + ng-focus="focused = 0" | |
15 | + teclado-virtual | |
16 | + class="form-control form-control-sm" | |
17 | + placeholder="Kilómetros finales" | |
18 | + ng-model="datosHojaRutaCierre.kmFinalVehiculo" | |
19 | + ng-required="true" | |
20 | + ng-keypress="next($event.keyCode)" | |
21 | + /> | |
22 | + </div> | |
23 | + <div class="col-12"> | |
24 | + <label class="form-control-sm">Aforador final del vehículo:</label> | |
25 | + </div> | |
26 | + <div class="col-12"> | |
27 | + <input | |
28 | + foca-tipo-input | |
29 | + teclado-virtual | |
30 | + foca-focus="focused === 1" | |
31 | + ng-focus="focused = 1" | |
32 | + class="form-control form-control-sm" | |
33 | + placeholder="Aforador final" | |
34 | + ng-model="datosHojaRutaCierre.aforadorFinalVehiculo" | |
35 | + ng-required="true" | |
36 | + ng-keypress="next($event.keyCode)"/> | |
37 | + </div> | |
38 | + <div class="col-12"> | |
39 | + <label class="form-control-sm">Litros descargados por gravedad:</label> | |
40 | + </div> | |
41 | + <div class="col-12"> | |
42 | + <input | |
43 | + foca-tipo-input | |
44 | + teclado-virtual | |
45 | + foca-focus="focused === 2" | |
46 | + ng-focus="focused = 2" | |
47 | + class="form-control form-control-sm" | |
48 | + placeholder="Listros descargados por gravedad" | |
49 | + ng-model="datosHojaRutaCierre.litrosDescargadosPorGravedad" | |
50 | + ng-required="true" | |
51 | + ng-keypress="aceptar($event.keyCode)"/> | |
52 | + </div> | |
53 | + </form> | |
54 | +</div> | |
55 | +<div class="modal-footer"> | |
56 | + <button | |
57 | + class="btn btn-primary" | |
58 | + type="button" | |
59 | + ng-click="aceptar(13)" | |
60 | + ng-disabled="!formDatosHojaRutaCierre.$valid" | |
61 | + >Aceptar</button> | |
62 | + <button class="btn btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | |
63 | +</div> |