Commit e409f6c42fc754aa16a59ffef5949108793b34d9
Exists in
master
Merge branch 'develop' into 'master'
Develop See merge request !5
Showing
2 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -6,18 +6,18 @@ angular.module('focaModalDetalles') |
6 | 6 | 'focaModalService', |
7 | 7 | 'APP', |
8 | 8 | '$timeout', |
9 | - 'sugerido', | |
10 | - function($scope, $uibModalInstance, focaModalService, APP, $timeout, sugerido) { | |
9 | + 'parametros', | |
10 | + function($scope, $uibModalInstance, focaModalService, APP, $timeout, parametros) { | |
11 | + | |
11 | 12 | $scope.mobile = APP === 'cobranza'; |
12 | - $scope.files = []; | |
13 | - $scope.importe = Math.abs(sugerido); | |
13 | + $scope.detalles = parametros; | |
14 | 14 | |
15 | - $scope.$watch('files', function() { | |
15 | + $scope.$watch('detalles.files', function() { | |
16 | 16 | validarExtSize(); |
17 | 17 | }); |
18 | 18 | |
19 | 19 | $scope.eliminarImg = function(key) { |
20 | - $scope.files.splice(key, 1); | |
20 | + $scope.detalles.files.splice(key, 1); | |
21 | 21 | }; |
22 | 22 | |
23 | 23 | $scope.cancel = function() { |
... | ... | @@ -25,11 +25,9 @@ angular.module('focaModalDetalles') |
25 | 25 | }; |
26 | 26 | |
27 | 27 | $scope.aceptar = function() { |
28 | - $uibModalInstance.close({ | |
29 | - observacion: $scope.observaciones, | |
30 | - monto: $scope.importe, | |
31 | - imgs: $scope.files | |
32 | - }); | |
28 | + | |
29 | + $scope.detalles.importe = parseFloat($scope.detalles.importe); | |
30 | + $uibModalInstance.close($scope.detalles); | |
33 | 31 | }; |
34 | 32 | |
35 | 33 | $scope.seleccionarFoto = function() { |
... | ... | @@ -57,7 +55,7 @@ angular.module('focaModalDetalles') |
57 | 55 | base64: imageBase64, |
58 | 56 | }; |
59 | 57 | $timeout(function() { |
60 | - $scope.files.push(imagen); | |
58 | + $scope.detalles.files.push(imagen); | |
61 | 59 | }); |
62 | 60 | } |
63 | 61 | function cameraError(err) { |
... | ... | @@ -76,11 +74,10 @@ angular.module('focaModalDetalles') |
76 | 74 | }; |
77 | 75 | return options; |
78 | 76 | } |
79 | - | |
80 | 77 | function validarExtSize() { |
81 | 78 | var totalSize = 0; |
82 | 79 | var invalidExt = false; |
83 | - $scope.files.forEach(function(file) { | |
80 | + $scope.detalles.files.forEach(function(file) { | |
84 | 81 | //CONVIERTO BYTES A MB |
85 | 82 | totalSize += file.size / 1000000; |
86 | 83 | var fileExt = file.name.split('.').pop(); |
... | ... | @@ -92,10 +89,10 @@ angular.module('focaModalDetalles') |
92 | 89 | |
93 | 90 | if (totalSize > 150) { |
94 | 91 | focaModalService.alert('El/los archivo/s exceden la capacidad máxima'); |
95 | - $scope.files = []; | |
92 | + $scope.detalles.files = []; | |
96 | 93 | } else if (invalidExt) { |
97 | 94 | focaModalService.alert('Ha ingresado un archivo con extensión inválida'); |
98 | - $scope.files = []; | |
95 | + $scope.detalles.files = []; | |
99 | 96 | } |
100 | 97 | } |
101 | 98 | } |
src/views/modal-detalles.html
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | <textarea |
12 | 12 | teclado-virtual |
13 | 13 | rows="5" |
14 | - ng-model="observaciones" | |
14 | + ng-model="detalles.observacion" | |
15 | 15 | class="form-control form-control-sm" |
16 | 16 | foca-focus="focused == 9" |
17 | 17 | ng-focus="focused = 9" |
... | ... | @@ -29,17 +29,17 @@ |
29 | 29 | teclado-virtual |
30 | 30 | class="form-control form-control-sm" |
31 | 31 | placeholder="Importe" |
32 | - ng-model="importe" | |
32 | + ng-model="detalles.importe" | |
33 | 33 | ng-keypress="next($event.keyCode)" |
34 | 34 | ng-required="true" |
35 | 35 | foca-focus="focused == 6" |
36 | 36 | ng-focus="focused = 6"/> |
37 | 37 | </div> |
38 | 38 | <div class="col-md-5" ng-if="!mobile"> |
39 | - <input | |
39 | + <input | |
40 | 40 | type="file" |
41 | 41 | class="form-control-file" |
42 | - ng-file-model="files" | |
42 | + ng-file-model="detalles.files" | |
43 | 43 | multiple |
44 | 44 | accept=".jpg,.png"> |
45 | 45 | <small>Solo .jpg y .png - Tamaño máximo 150mb</small> |
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | </div> |
68 | 68 | </form> |
69 | 69 | <div class="row" ng-if="!mobile"> |
70 | - <div class="col-md-3" ng-repeat="(key, file) in files"> | |
70 | + <div class="col-md-3" ng-repeat="(key, file) in detalles.files"> | |
71 | 71 | <img ng-src="{{file.url}}" alt="" class="col-md-12 p-0"> |
72 | 72 | <button |
73 | 73 | type="button" |
... | ... | @@ -79,7 +79,7 @@ |
79 | 79 | </div> |
80 | 80 | </div> |
81 | 81 | <div class="row" ng-if="mobile"> |
82 | - <div class="col-12 d-flex justify-content-between" ng-repeat="(key, file) in files"> | |
82 | + <div class="col-12 d-flex justify-content-between" ng-repeat="(key, file) in detalles.files"> | |
83 | 83 | <strong ng-bind="file.name"></strong> |
84 | 84 | <button |
85 | 85 | type="button" |