Commit c0a784cff91ce13822c4139f9954cfa745bef820

Authored by Marcelo Puebla
1 parent 4accc8e91e
Exists in master and in 2 other branches develop, lab

Agregada info para enviar al modal de detalle.

Showing 2 changed files with 25 additions and 21 deletions   Show diff stats
... ... @@ -4,6 +4,7 @@
4 4 "description": "foca-hoja-ruta",
5 5 "main": "index.js",
6 6 "scripts": {
  7 + "refresh" : "gulp uglify && cp tmp/foca-hoja-ruta.js ../wrapper-demo/node_modules/foca-hoja-ruta/dist/foca-hoja-ruta.min.js",
7 8 "test": "echo \"Error: no test specified\" && exit 1",
8 9 "compile": "gulp uglify",
9 10 "gulp-pre-commit": "gulp pre-commit",
src/js/controller.js
... ... @@ -10,7 +10,7 @@ angular.module('focaHojaRuta')
10 10 'focaModalService',
11 11 '$rootScope',
12 12 '$localStorage',
13   - function(
  13 + function (
14 14 $scope,
15 15 $location,
16 16 $filter,
... ... @@ -35,7 +35,7 @@ angular.module('focaHojaRuta')
35 35 $scope.comprobante = '00000000';
36 36 }
37 37  
38   - hojaRutaService.getHojaRuta(loginData.chofer).then(function(res) {
  38 + hojaRutaService.getHojaRuta(loginData.chofer).then(function (res) {
39 39  
40 40 if (res.data) {
41 41 var hojaRuta = res.data;
... ... @@ -61,12 +61,12 @@ angular.module('focaHojaRuta')
61 61  
62 62 function watch() {
63 63  
64   - $scope.$watch('hojaRuta', function(nuevoValor) {
  64 + $scope.$watch('hojaRuta', function (nuevoValor) {
65 65 $localStorage.hojaRuta = JSON.stringify(nuevoValor);
66 66 }, true);
67 67 }
68 68  
69   - $scope.verDetalle = function(remito) {
  69 + $scope.verDetalle = function (remito) {
70 70 var modalInstance = $uibModal.open(
71 71 {
72 72 ariaLabelledBy: 'Detalle hoja ruta',
... ... @@ -80,21 +80,21 @@ angular.module('focaHojaRuta')
80 80 size: 'lg'
81 81 }
82 82 );
83   - modalInstance.result.then(function() {
  83 + modalInstance.result.then(function () {
84 84 //funcion se ejecuta cuando se carga pantalla
85 85 });
86 86 };
87 87  
88 88 function addCabecera(label, valor) {
89   - var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
90   - if(propiedad.length === 1) {
  89 + var propiedad = $filter('filter')($scope.cabecera, { label: label }, true);
  90 + if (propiedad.length === 1) {
91 91 propiedad[0].valor = valor;
92 92 } else {
93   - $scope.cabecera.push({label: label, valor: valor});
  93 + $scope.cabecera.push({ label: label, valor: valor });
94 94 }
95 95 }
96 96  
97   - $scope.rellenar = function(relleno, longitud) {
  97 + $scope.rellenar = function (relleno, longitud) {
98 98 relleno = '' + relleno;
99 99 while (relleno.length < longitud) {
100 100 relleno = '0' + relleno;
... ... @@ -103,15 +103,15 @@ angular.module(&#39;focaHojaRuta&#39;)
103 103 return relleno;
104 104 };
105 105  
106   - $scope.salir = function() {
  106 + $scope.salir = function () {
107 107 $location.path('/');
108 108 };
109 109  
110   - $scope.terminarHojaRuta = function() {
  110 + $scope.terminarHojaRuta = function () {
111 111 focaModalService
112 112 .confirm('¿Desea terminar la hoja de ruta? No podra realizar ninguna ' +
113 113 'otra descarga ni modificación')
114   - .then(function() {$scope.datosExtraCierre(terminar);});
  114 + .then(function () { $scope.datosExtraCierre(terminar); });
115 115 function terminar(datosExtraCierre) {
116 116 $scope.hojaRuta = angular.extend({}, $scope.hojaRuta, datosExtraCierre);
117 117 //limpio objeto para guardar
... ... @@ -126,18 +126,18 @@ angular.module(&#39;focaHojaRuta&#39;)
126 126 $scope.hojaRuta.fechaReparto.slice(0, 19).replace('T', ' ');
127 127 $scope.hojaRuta.estado = 2;
128 128 hojaRutaService.terminarHojaRuta($scope.hojaRuta).then(
129   - function() {
  129 + function () {
130 130 focaModalService.alert(
131 131 'Hoja de ruta ' +
132 132 $filter('comprobante')([$scope.puntoVenta,
133   - $scope.comprobante]) + ' cerrada con éxito');
134   - $location.path('/');
  133 + $scope.comprobante]) + ' cerrada con éxito');
  134 + $location.path('/');
135 135 }
136 136 );
137 137 }
138 138 };
139 139  
140   - $scope.datosExtraCierre = function(terminar) {
  140 + $scope.datosExtraCierre = function (terminar) {
141 141 var modalInstance = $uibModal.open(
142 142 {
143 143 templateUrl: 'focaDatosExtra.html',
... ... @@ -147,22 +147,25 @@ angular.module(&#39;focaHojaRuta&#39;)
147 147 modalInstance.result.then(terminar);
148 148 };
149 149  
150   - $scope.modalDescargas = function() {
151   -
  150 + $scope.modalDescargas = function () {
  151 + delete $scope.hojaRuta.remitos[0].cliente;
152 152 var modalInstance = $uibModal.open(
153 153 {
154 154 templateUrl: 'foca-modal-descarga.html',
155   - controller: 'focaModalDescargaCtrl'
  155 + controller: 'focaModalDescargaCtrl',
  156 + resolve: {
  157 + remito: function () { return $scope.hojaRuta.remitos[0]; }
  158 + },
156 159 }
157 160 );
158 161  
159   - modalInstance.result.then(function(data) {
  162 + modalInstance.result.then(function (data) {
160 163  
161 164 console.log(data);
162 165 });
163 166 };
164 167  
165   - $rootScope.$on('estadoRed', function(event, value) {
  168 + $rootScope.$on('estadoRed', function (event, value) {
166 169 $scope.esatadoRed = value;
167 170 });
168 171