diff --git a/src/js/controller.js b/src/js/controller.js index 034ec5a..92074a0 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -4,8 +4,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', 'focaModalService', 'notaPedidoBusinessService', '$rootScope', 'focaSeguimientoService', function( $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, - notaPedidoBusinessService, $rootScope, focaSeguimientoService - ) { + notaPedidoBusinessService, $rootScope, focaSeguimientoService) + { $scope.botonera = [ {texto: 'Vendedor', accion: function() { validarNotaRemitada($scope.seleccionarVendedor);}}, @@ -61,8 +61,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', $scope.comprobante = '00000000'; $scope.articulosTabla = []; $scope.idLista = undefined; - //La pantalla solo se usa para cargar pedidos - //var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); crearNotaPedidoService.getPrecioCondicion().then( function(res) { @@ -80,45 +78,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', console.info(err); } ); - //La pantalla solo se usa para cargar pedidos - // if (notaPedidoTemp !== undefined) { - // notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); - // $scope.notaPedido = notaPedidoTemp; - // $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); - // $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); - // $scope.idLista = $scope.notaPedido.precioCondicion; - // crearNotaPedidoService - // .getArticulosByIdNotaPedido($scope.notaPedido.id).then( - // function(res) { - // $scope.articulosTabla = res.data; - // } - // ); - //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO - //(NO REQUERIDO EN ESTA VERSION) - // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( - // function(res) { - // $scope.notaPedido.domicilio = res.data; - // } - // ); - // } else { - // $scope.notaPedido.fechaCarga = new Date(); - // $scope.notaPedido.bomba = '0'; - // $scope.notaPedido.flete = '0'; - // $scope.idLista = undefined; - // } - //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO - // $scope.addNewDom = function() { - // $scope.notaPedido.domicilio.push({ 'id': 0 }); - // }; - // $scope.removeNewChoice = function(choice) { - // if ($scope.notaPedido.domicilio.length > 1) { - // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( - // function(c) { - // return c.$$hashKey === choice.$$hashKey; - // } - // ), 1); - // } - // }; $scope.crearNotaPedido = function() { if(!$scope.notaPedido.vendedor.CodVen) { @@ -250,9 +209,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', $scope.now = new Date(notaPedido.fechaCarga); //aƱado cabeceras $scope.notaPedido.id = notaPedido.id; - removeCabecera('Moneda:'); - removeCabecera('Fecha cotizacion:'); - removeCabecera('Cotizacion:'); + removeCabecera('Bomba:'); + removeCabecera('Kilometros:'); var cabeceras = [ { label: 'Moneda:', @@ -284,16 +242,17 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', valor: notaPedido.proveedor[0].NOM }, { + label: 'Precio condicion:', + valor: valorPrecioCondicion() + ' ' + + notaPedidoBusinessService.plazoToString(notaPedido.plazoPago) + }, + { label: 'Flete:', valor: notaPedido.fob === 1 ? 'FOB' : ( notaPedido.flete === 1 ? 'Si' : 'No') - }, - { - label: 'Precio condicion:', - valor: valorPrecioCondicion() } ]; - //TODO MOSTRAR PLAZOS + function valorPrecioCondicion() { if(notaPedido.idPrecioCondicion > 0) { return notaPedido.precioCondicion[0].nombre; @@ -304,12 +263,12 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', 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); @@ -685,28 +644,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', } }; - $scope.limpiarFlete = function() { - $scope.notaPedido.fleteNombre = ''; - $scope.notaPedido.chofer = ''; - $scope.notaPedido.vehiculo = ''; - $scope.notaPedido.kilometros = ''; - $scope.notaPedido.costoUnitarioKmFlete = ''; - $scope.choferes = ''; - $scope.vehiculos = ''; - }; - - $scope.limpiarPantalla = function() { - $scope.limpiarFlete(); - $scope.notaPedido.flete = '0'; - $scope.notaPedido.bomba = '0'; - $scope.notaPedido.precioCondicion = ''; - $scope.articulosTabla = []; - $scope.notaPedido.vendedor.nombre = ''; - $scope.notaPedido.cliente = {nombre: ''}; - $scope.notaPedido.domicilio = {dom: ''}; - $scope.domiciliosCliente = []; - }; - $scope.resetFilter = function() { $scope.articuloACargar = {}; $scope.cargando = true; @@ -777,41 +714,4 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', } } } - ] -) -.controller('notaPedidoListaCtrl', [ - '$scope', - 'crearNotaPedidoService', - '$location', - function($scope, crearNotaPedidoService, $location) { - crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { - $scope.notaPedidos = datos.data; - }); - $scope.editar = function(notaPedido) { - crearNotaPedidoService.setNotaPedido(notaPedido); - $location.path('/venta-nota-pedido/abm/'); - }; - $scope.crearPedido = function() { - crearNotaPedidoService.clearNotaPedido(); - $location.path('/venta-nota-pedido/abm/'); - }; - } -]) -.controller('focaCrearNotaPedidoFichaClienteController', [ - '$scope', - 'crearNotaPedidoService', - '$location', - function($scope, crearNotaPedidoService, $location) { - crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { - $scope.notaPedidos = datos.data; - }); - $scope.editar = function(notaPedido) { - crearNotaPedidoService.setNotaPedido(notaPedido); - $location.path('/venta-nota-pedido/abm/'); - }; - $scope.crearPedido = function() { - crearNotaPedidoService.clearNotaPedido(); - $location.path('/venta-nota-pedido/abm/'); - }; - } -]); + ]);