Commit 81cc98782d853365332bbb4d788d3ecde1add889
Exists in
master
Merge branch 'master' into 'develop'
Master See merge request !3
Showing
2 changed files
Show diff stats
src/js/controller.js
| ... | ... | @@ -9,15 +9,18 @@ angular.module('focaModalDetalles') |
| 9 | 9 | 'sugerido', |
| 10 | 10 | function($scope, $uibModalInstance, focaModalService, APP, $timeout, sugerido) { |
| 11 | 11 | $scope.mobile = APP === 'cobranza'; |
| 12 | - $scope.files = []; | |
| 13 | - $scope.importe = Math.abs(sugerido); | |
| 12 | + $scope.detalles = { | |
| 13 | + files: [], | |
| 14 | + observaciones: '', | |
| 15 | + importe: Math.abs(sugerido) || 0 | |
| 16 | + }; | |
| 14 | 17 | |
| 15 | - $scope.$watch('files', function() { | |
| 18 | + $scope.$watch('detalles.files', function() { | |
| 16 | 19 | validarExtSize(); |
| 17 | 20 | }); |
| 18 | 21 | |
| 19 | 22 | $scope.eliminarImg = function(key) { |
| 20 | - $scope.files.splice(key, 1); | |
| 23 | + $scope.detalles.files.splice(key, 1); | |
| 21 | 24 | }; |
| 22 | 25 | |
| 23 | 26 | $scope.cancel = function() { |
| ... | ... | @@ -25,11 +28,7 @@ angular.module('focaModalDetalles') |
| 25 | 28 | }; |
| 26 | 29 | |
| 27 | 30 | $scope.aceptar = function() { |
| 28 | - $uibModalInstance.close({ | |
| 29 | - observacion: $scope.observaciones, | |
| 30 | - monto: $scope.importe, | |
| 31 | - imgs: $scope.files | |
| 32 | - }); | |
| 31 | + $uibModalInstance.close($scope.detalles); | |
| 33 | 32 | }; |
| 34 | 33 | |
| 35 | 34 | $scope.seleccionarFoto = function() { |
| ... | ... | @@ -57,7 +56,7 @@ angular.module('focaModalDetalles') |
| 57 | 56 | base64: imageBase64, |
| 58 | 57 | }; |
| 59 | 58 | $timeout(function() { |
| 60 | - $scope.files.push(imagen); | |
| 59 | + $scope.detalles.files.push(imagen); | |
| 61 | 60 | }); |
| 62 | 61 | } |
| 63 | 62 | function cameraError(err) { |
| ... | ... | @@ -80,7 +79,7 @@ angular.module('focaModalDetalles') |
| 80 | 79 | function validarExtSize() { |
| 81 | 80 | var totalSize = 0; |
| 82 | 81 | var invalidExt = false; |
| 83 | - $scope.files.forEach(function(file) { | |
| 82 | + $scope.detalles.files.forEach(function(file) { | |
| 84 | 83 | //CONVIERTO BYTES A MB |
| 85 | 84 | totalSize += file.size / 1000000; |
| 86 | 85 | var fileExt = file.name.split('.').pop(); |
| ... | ... | @@ -92,10 +91,10 @@ angular.module('focaModalDetalles') |
| 92 | 91 | |
| 93 | 92 | if (totalSize > 150) { |
| 94 | 93 | focaModalService.alert('El/los archivo/s exceden la capacidad máxima'); |
| 95 | - $scope.files = []; | |
| 94 | + $scope.detalles.files = []; | |
| 96 | 95 | } else if (invalidExt) { |
| 97 | 96 | focaModalService.alert('Ha ingresado un archivo con extensión inválida'); |
| 98 | - $scope.files = []; | |
| 97 | + $scope.detalles.files = []; | |
| 99 | 98 | } |
| 100 | 99 | } |
| 101 | 100 | } |
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.observaciones" | |
| 15 | 15 | class="form-control form-control-sm" |
| 16 | 16 | foca-focus="focused == 9" |
| 17 | 17 | ng-focus="focused = 9" |
| ... | ... | @@ -29,7 +29,7 @@ |
| 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" |
| ... | ... | @@ -39,7 +39,7 @@ |
| 39 | 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" |