Commit 0b3fabdcffbbfe88d4fcb67253e110c08bdaa8c2

Authored by Eric Fernandez
Exists in master and in 1 other branch develop

Merge branch 'master' into 'develop'

Master(efernandez)

See merge request !83
src/js/controller.js
... ... @@ -97,14 +97,14 @@ angular.module('focaCrearRemito').controller('remitoController',
97 97  
98 98 $scope.seleccionarNotaPedido = function () {
99 99 if ($scope.remitoIsDirty) {
100   - focaModalService.confirm("¿Desea continuar? Se perderan los cambios")
  100 + focaModalService.confirm('¿Desea continuar? Se perderan los cambios')
101 101 .then(function () {
102 102 $scope.getNotaPedidoModal();
103 103 });
104 104 } else {
105 105 $scope.getNotaPedidoModal();
106 106 }
107   - }
  107 + };
108 108  
109 109 $scope.getNotaPedidoModal = function () {
110 110 if (varlidarRemitoFacturado()) {
... ... @@ -603,8 +603,8 @@ angular.module('focaCrearRemito').controller('remitoController',
603 603 $scope.remito.vendedor = res.data;
604 604 $scope.$broadcast('addCabecera', {
605 605 label: 'Vendedor:',
606   - valor: $filter('rellenarDigitos')($scope.remito.vendedor.NUM, 3) + ' - ' +
607   - $scope.remito.vendedor.NOM
  606 + valor: $filter('rellenarDigitos')($scope.remito.vendedor
  607 + .NUM, 3) +' - ' + $scope.remito.vendedor.NOM
608 608 });
609 609 }
610 610 var domicilioStamp =
... ... @@ -613,7 +613,8 @@ angular.module('focaCrearRemito').controller('remitoController',
613 613 $scope.remito.domicilioStamp = domicilioStamp;
614 614 $scope.$broadcast('addCabecera', {
615 615 label: 'Cliente:',
616   - valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom
  616 + valor: $filter('rellenarDigitos')(cliente.cod, 3) +
  617 + ' - ' + cliente.nom
617 618 });
618 619 $scope.$broadcast('addCabecera', {
619 620 label: 'Domicilio:',
... ... @@ -627,13 +628,16 @@ angular.module('focaCrearRemito').controller('remitoController',
627 628 crearRemitoService
628 629 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
629 630 .then(function (res) {
630   - if (res.data.length) $scope.seleccionarPuntosDeDescarga();
  631 + if (res.data.length) {
  632 + $scope.seleccionarPuntosDeDescarga();
  633 + }
631 634 });
632 635 }
633 636  
634   - $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true;
  637 + $filter('filter')($scope.botonera,
  638 + { label: 'Cliente' })[0].checked = true;
635 639 })
636   - .catch(function (e) { console.log(e); })
  640 + .catch(function (e) { console.log(e); });
637 641 }, function () {
638 642 $scope.seleccionarCliente(true);
639 643 return;
... ... @@ -902,9 +906,7 @@ angular.module('focaCrearRemito').controller('remitoController',
902 906  
903 907 $scope.agregarATabla = function (key) {
904 908 if (key === 13) {
905   - if ($scope.articuloACargar.cantidad === undefined ||
906   - $scope.articuloACargar.cantidad === 0 ||
907   - $scope.articuloACargar.cantidad === null) {
  909 + if (!$scope.articuloACargar.cantidad || !$scope.articuloACargar.precio) {
908 910 focaModalService.alert('El valor debe ser al menos 1');
909 911 return;
910 912 }
... ... @@ -935,7 +937,7 @@ angular.module('focaCrearRemito').controller('remitoController',
935 937  
936 938 $scope.editarArticulo = function (key, articulo, tmpCantidad, tmpPrecio) {
937 939 if (key === 13) {
938   - if (!articulo.cantidad || !articulo.precio) {
  940 + if (!articulo.cantidad || !articulo.precio || !tmpCantidad || !tmpPrecio) {
939 941 focaModalService.alert('Los valores deben ser al menos 1');
940 942 return;
941 943 } else if (articulo.cantidad < 0 || articulo.precio < 0) {
... ... @@ -1174,16 +1176,17 @@ angular.module(&#39;focaCrearRemito&#39;).controller(&#39;remitoController&#39;,
1174 1176 }
1175 1177 }
1176 1178  
1177   - function deleteCliente() {
1178   - $scope.remito.domicilioStamp = '';
1179   - $scope.remito.remitoPuntoDescarga = [];
1180   - $scope.remito.domicilio = { dom: '' };
1181   - $scope.remito.cliente = {};
1182   - $scope.$broadcast('removeCabecera', 'Cliente:');
1183   - $scope.$broadcast('removeCabecera', 'Domicilio:');
1184   - $scope.$broadcast('removeCabecera', 'Puntos de descarga:');
1185   - $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = false;
1186   - }
  1179 + // TODO: Descomentar cuando se use
  1180 + // function deleteCliente() {
  1181 + // $scope.remito.domicilioStamp = '';
  1182 + // $scope.remito.remitoPuntoDescarga = [];
  1183 + // $scope.remito.domicilio = { dom: '' };
  1184 + // $scope.remito.cliente = {};
  1185 + // $scope.$broadcast('removeCabecera', 'Cliente:');
  1186 + // $scope.$broadcast('removeCabecera', 'Domicilio:');
  1187 + // $scope.$broadcast('removeCabecera', 'Puntos de descarga:');
  1188 + // $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = false;
  1189 + // }
1187 1190  
1188 1191 function getCabeceraPuntoDescarga(puntosDescarga) {
1189 1192 var puntosStamp = '';