diff --git a/src/js/controller.js b/src/js/controller.js index 57934d0..25227a4 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -4,8 +4,8 @@ angular.module('focaCrearRemito') .controller('remitoController', 'focaModalService', 'remitoBusinessService', function( $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, - remitoBusinessService - ) { + remitoBusinessService) + { $scope.botonera = [ {texto: 'Nota Pedido', accion: function() { varlidarRemitoFacturado($scope.seleccionarNotaPedido);}}, @@ -67,8 +67,6 @@ angular.module('focaCrearRemito') .controller('remitoController', $scope.articulosTabla = []; $scope.idLista = undefined; - //La pantalla solo se usa para cargar remitos - //var remitoTemp = crearRemitoService.getRemito(); crearRemitoService.getPrecioCondicion().then( function(res) { @@ -105,9 +103,8 @@ angular.module('focaCrearRemito') .controller('remitoController', function(notaPedido) { //aƱado cabeceras $scope.notaPedido.id = notaPedido.id; - removeCabecera('Moneda:'); - removeCabecera('Fecha cotizacion:'); - removeCabecera('Cotizacion:'); + removeCabecera('Bomba:'); + removeCabecera('Kilometros:'); var cabeceras = [ { label: 'Moneda:', @@ -139,16 +136,17 @@ angular.module('focaCrearRemito') .controller('remitoController', valor: notaPedido.proveedor[0].NOM }, { + label: 'Precio condicion:', + valor: valorPrecioCondicion() + ' ' + + remitoBusinessService.plazoToString(notaPedido.plazoPago) + }, + { label: 'Flete:', valor: notaPedido.fob === 1 ? 'FOB' : ( notaPedido.flete === 1 ? 'Si' : 'No') - }, - { - label: 'Precio condicion:', - valor: valorPrecioCondicion() } ]; - //TODO: CUANDO MOSTRAR PLAZOS + function valorPrecioCondicion() { if(notaPedido.idPrecioCondicion > 0) { return notaPedido.precioCondicion[0].nombre; @@ -159,12 +157,12 @@ angular.module('focaCrearRemito') .controller('remitoController', if(notaPedido.flete === 1) { var cabeceraBomba = { - label: 'Bomba', + label: 'Bomba:', valor: notaPedido.bomba === 1 ? 'Si' : 'No' }; if(notaPedido.kilometros) { var cabeceraKilometros = { - label: 'Kilometros', + label: 'Kilometros:', valor: notaPedido.kilometros }; cabeceras.push(cabeceraKilometros); @@ -175,11 +173,11 @@ angular.module('focaCrearRemito') .controller('remitoController', for (var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { notaPedido.articulosNotaPedido[i].id = 0; } - + $scope.articulosTabla = notaPedido.articulosNotaPedido; remitoBusinessService.calcularArticulos($scope.articulosTabla, notaPedido.cotizacion[0].VENDEDOR); - + if(notaPedido.precioCondicion.length > 0) { $scope.idLista = notaPedido.precioCondicion[0].idListaPrecio; } else { @@ -264,7 +262,6 @@ angular.module('focaCrearRemito') .controller('remitoController', } else { return 'Ingreso Manual'; } - } if(remito.flete === 1) { @@ -303,45 +300,6 @@ angular.module('focaCrearRemito') .controller('remitoController', ); }; - //La pantalla solo se usa para cargar remitos - // if (remitoTemp !== undefined) { - // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); - // $scope.remito = remitoTemp; - // $scope.remito.flete = ($scope.remito.flete).toString(); - // $scope.remito.bomba = ($scope.remito.bomba).toString(); - // $scope.idLista = $scope.remito.precioCondicion; - // crearRemitoService - // .getArticulosByIdRemito($scope.remito.id).then( - // function(res) { - // $scope.articulosTabla = res.data; - // } - // ); - //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO - //(NO REQUERIDO EN ESTA VERSION) - // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( - // function(res) { - // $scope.remito.domicilio = res.data; - // } - // ); - // } else { - // $scope.remito.fechaCarga = new Date(); - // $scope.remito.bomba = '0'; - // $scope.remito.flete = '0'; - // $scope.idLista = undefined; - // } - //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO - // $scope.addNewDom = function() { - // $scope.remito.domicilio.push({ 'id': 0 }); - // }; - // $scope.removeNewChoice = function(choice) { - // if ($scope.remito.domicilio.length > 1) { - // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( - // function(c) { - // return c.$$hashKey === choice.$$hashKey; - // } - // ), 1); - // } - // }; //validacion por domicilio y por plazo pago $scope.crearRemito = function() { if(!$scope.remito.vendedor) { @@ -367,14 +325,11 @@ angular.module('focaCrearRemito') .controller('remitoController', } else if($scope.articulosTabla.length === 0) { focaModalService.alert('Debe cargar al menos un articulo'); return; - } - var date = new Date(); + } var save = { remito: { id: $scope.remito.id, - fechaRemito: - new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) - .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter + fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), idCliente: $scope.remito.cliente.COD, nombreCliente: $scope.remito.cliente.NOM, cuitCliente: $scope.remito.cliente.CUIT, @@ -881,41 +836,4 @@ angular.module('focaCrearRemito') .controller('remitoController', } } } - ] -) -.controller('remitoListaCtrl', [ - '$scope', - 'crearRemitoService', - '$location', - function($scope, crearRemitoService, $location) { - crearRemitoService.obtenerRemito().then(function(datos) { - $scope.remitos = datos.data; - }); - $scope.editar = function(remito) { - crearRemitoService.setRemito(remito); - $location.path('/venta-nota-remito/abm/'); - }; - $scope.crearRemito = function() { - crearRemitoService.clearRemito(); - $location.path('/venta-nota-remito/abm/'); - }; - } -]) -.controller('focaCrearRemitoFichaClienteController', [ - '$scope', - 'crearRemitoService', - '$location', - function($scope, crearRemitoService, $location) { - crearRemitoService.obtenerRemito().then(function(datos) { - $scope.remitos = datos.data; - }); - $scope.editar = function(remito) { - crearRemitoService.setRemito(remito); - $location.path('/venta-nota-remito/abm/'); - }; - $scope.crearRemito = function() { - crearRemitoService.clearRemito(); - $location.path('/venta-nota-remito/abm/'); - }; - } -]); + ]);