Commit 3ff7da96d9f1667ef5c7108570ed2a327d260ae1

Authored by Luis Suarez
1 parent 2e56280b60
Exists in develop

desactivar Guardar si Total > monto máximo permitido

Showing 2 changed files with 13 additions and 1 deletions   Show diff stats
src/js/controller.js
... ... @@ -966,7 +966,7 @@ angular.module('focaCrearRemito').controller('remitoController',
966 966 focaModalService.alert('Los valores no pueden ser negativos');
967 967 return;
968 968 } else if (!Number.isInteger(+$scope.articuloACargar.cantidad)) {
969   - focaModalService.alert('Debes introducir un número entero');
  969 + focaModalService.alert('La cantidad debe ser un número entero');
970 970 return;
971 971 } else if ($scope.articuloACargar.cantidad > 100000) {
972 972 focaModalService.alert('La cantidad máxima permitida es 100.000');
... ... @@ -1023,6 +1023,17 @@ angular.module('focaCrearRemito').controller('remitoController',
1023 1023 }
1024 1024 }
1025 1025 };
  1026 + //Si el monto Total es superior a $10.000.000.000,00 desactivo el botón Guardar
  1027 + $scope.comprobarTotal = function() {
  1028 + if ($scope.getTotal() >= 10000000000) {
  1029 + focaModalService.alert('El monto total debe ser menor a $10.000.000.000,00, elimina un artículo o reduce las cantidades');
  1030 + $( "#guardar" ).prop( "disabled", true );
  1031 + return true;
  1032 + } else {
  1033 + $( "#guardar" ).prop( "disabled", false );
  1034 + return false;
  1035 + }
  1036 + };
1026 1037  
1027 1038 $scope.cancelarEditar = function (articulo) {
1028 1039 $scope.tmpCantidad = articulo.cantidad;
src/views/remito.html
... ... @@ -228,6 +228,7 @@
228 228 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
229 229 <span
230 230 class="mr-3 ml-auto"
  231 + ng-disabled="comprobarTotal()"
231 232 ng-class="saveLoading ? 'text-muted' : ''"
232 233 ng-click="crearRemito()"
233 234 ladda="saveLoading"