Commit b8ff8f46030412959589395571071fa8a0ac7416
1 parent
914f3b2ef0
Exists in
master
Identación
Showing
1 changed file
with
30 additions
and
26 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -127,7 +127,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 127 | 127 | }, true); |
| 128 | 128 | |
| 129 | 129 | $scope.crearNotaPedido = function() { |
| 130 | - if ($scope.notaPedido.idRemito === -1) { | |
| 130 | + if (!$scope.notaPedido.cliente.COD) { | |
| 131 | + focaModalService.alert('Ingrese un cliente'); | |
| 132 | + return; | |
| 133 | + } else if ($scope.notaPedido.idRemito === -1) { | |
| 131 | 134 | focaBotoneraLateralService.alert('No se puede modificar esta nota de pedido'); |
| 132 | 135 | return; |
| 133 | 136 | } else if (!$scope.notaPedido.proveedor.COD) { |
| ... | ... | @@ -154,30 +157,31 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 154 | 157 | focaModalService.alert('Debe cargar al menos un articulo'); |
| 155 | 158 | return; |
| 156 | 159 | } |
| 160 | + | |
| 157 | 161 | focaBotoneraLateralService.startGuardar(); |
| 158 | - $scope.saveLoading = true; | |
| 159 | - var notaPedido = { | |
| 160 | - id: $scope.notaPedido.id, | |
| 161 | - fechaCarga: new Date($scope.notaPedido.fechaCarga) | |
| 162 | - .toISOString().slice(0, 19).replace('T', ' '), | |
| 163 | - idVendedor: $scope.notaPedido.vendedor.id, | |
| 164 | - idCliente: $scope.notaPedido.cliente.COD, | |
| 165 | - nombreCliente: $scope.notaPedido.cliente.NOM, | |
| 166 | - cuitCliente: $scope.notaPedido.cliente.CUIT, | |
| 167 | - idProveedor: $scope.notaPedido.proveedor.COD, | |
| 168 | - idDomicilio: $scope.notaPedido.domicilio.id, | |
| 169 | - idCotizacion: $scope.notaPedido.cotizacion.ID, | |
| 170 | - idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, | |
| 171 | - cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | |
| 172 | - flete: $scope.notaPedido.flete, | |
| 173 | - fob: $scope.notaPedido.fob, | |
| 174 | - bomba: $scope.notaPedido.bomba, | |
| 175 | - kilometros: $scope.notaPedido.kilometros, | |
| 176 | - domicilioStamp: $scope.notaPedido.domicilioStamp, | |
| 177 | - observaciones: $scope.notaPedido.observaciones, | |
| 178 | - estado: 0, | |
| 179 | - total: $scope.getTotal() | |
| 180 | - }; | |
| 162 | + $scope.saveLoading = true; | |
| 163 | + var notaPedido = { | |
| 164 | + id: $scope.notaPedido.id, | |
| 165 | + fechaCarga: new Date($scope.notaPedido.fechaCarga) | |
| 166 | + .toISOString().slice(0, 19).replace('T', ' '), | |
| 167 | + idVendedor: $scope.notaPedido.vendedor.id, | |
| 168 | + idCliente: $scope.notaPedido.cliente.COD, | |
| 169 | + nombreCliente: $scope.notaPedido.cliente.NOM, | |
| 170 | + cuitCliente: $scope.notaPedido.cliente.CUIT, | |
| 171 | + idProveedor: $scope.notaPedido.proveedor.COD, | |
| 172 | + idDomicilio: $scope.notaPedido.domicilio.id, | |
| 173 | + idCotizacion: $scope.notaPedido.cotizacion.ID, | |
| 174 | + idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, | |
| 175 | + cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | |
| 176 | + flete: $scope.notaPedido.flete, | |
| 177 | + fob: $scope.notaPedido.fob, | |
| 178 | + bomba: $scope.notaPedido.bomba, | |
| 179 | + kilometros: $scope.notaPedido.kilometros, | |
| 180 | + domicilioStamp: $scope.notaPedido.domicilioStamp, | |
| 181 | + observaciones: $scope.notaPedido.observaciones, | |
| 182 | + estado: 0, | |
| 183 | + total: $scope.getTotal() | |
| 184 | + }; | |
| 181 | 185 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
| 182 | 186 | function(data) { |
| 183 | 187 | // Al guardar los datos de la nota de pedido logueamos la |
| ... | ... | @@ -768,12 +772,12 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 768 | 772 | articulo.editCantidad = articulo.editPrecio = false; |
| 769 | 773 | } |
| 770 | 774 | }; |
| 771 | - | |
| 775 | + | |
| 772 | 776 | $scope.cancelarEditar = function(articulo) { |
| 773 | 777 | $scope.tmpCantidad = articulo.cantidad; |
| 774 | 778 | $scope.tmpPrecio = articulo.precio; |
| 775 | 779 | articulo.editCantidad = articulo.editPrecio = false; |
| 776 | - }; | |
| 780 | + }; | |
| 777 | 781 | |
| 778 | 782 | $scope.cambioEdit = function(articulo, propiedad) { |
| 779 | 783 | if (propiedad === 'cantidad') { |