From 536013389cebad60c9b2b5ee23ffabb1002098c9 Mon Sep 17 00:00:00 2001 From: Pablo Marco del Pont Date: Tue, 23 Oct 2018 15:14:47 -0300 Subject: [PATCH] =?UTF-8?q?Implementaci=C3=B3n=20parcial=20de=20cambios=20?= =?UTF-8?q?solicitados.=20-=20Agregu=C3=A9=20botonera=20secundaria.=20-=20?= =?UTF-8?q?Quit=C3=A9=20elementos=20no=20usados.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/controller.js | 62 +++++----- src/js/service.js | 10 +- src/views/nota-pedido.html | 288 +++++++++++++++------------------------------ 3 files changed, 135 insertions(+), 225 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index f4613e7..ba9d130 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -2,6 +2,16 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', ['$scope', '$uibModal', 'crearNotaPedidoService', 'focaModalService', function($scope, $uibModal, crearNotaPedidoService, focaModalService) { + $scope.botonera = [ + {texto: 'moneda', accion: function(){console.log('moneda');}}, + { + texto: 'precios y condiciones', + accion: function(){$scope.abrirModalListaPrecio();}}, + {texto: 'flete', accion: function(){$scope.abrirModalFlete();}}, + {texto: 'bomba', accion: function(){}}, + {texto: 'detalle', accion: function(){}}, + {texto: 'totales', accion: function(){}} + ]; $scope.show = false; $scope.cargando = true; $scope.dateOptions = { @@ -15,7 +25,7 @@ angular.module('focaCrearNotaPedido') }; $scope.articulosTabla = []; var idLista; - var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); + var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); crearNotaPedidoService.getPrecioCondicion().then( function(res) { $scope.precioCondiciones = res.data; @@ -41,7 +51,7 @@ angular.module('focaCrearNotaPedido') // } // ); } else { - $scope.notaPedido.fechaCarga = new Date(); + $scope.notaPedido.fechaCarga = new Date(); $scope.notaPedido.bomba = '0'; $scope.notaPedido.flete = '0'; idLista = undefined; @@ -83,7 +93,7 @@ angular.module('focaCrearNotaPedido') crearNotaPedidoService.crearNotaPedido(notaPedido).then( function(data) { focaModalService.alert('Nota pedido creada'); - if($scope.notaPedido.flete === 1) { + if($scope.notaPedido.flete === 1) { var flete = { idNotaPedido: data.data.id, idTransportista: $scope.notaPedido.fleteId, @@ -221,7 +231,7 @@ angular.module('focaCrearNotaPedido') ); }; $scope.getTotal = function() { - var total = 0; + var total = 0; var arrayTempArticulos = $scope.articulosTabla; for (var i = 0; i < arrayTempArticulos.length; i++) { total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; @@ -231,7 +241,7 @@ angular.module('focaCrearNotaPedido') $scope.getSubTotal = function() { if($scope.articuloACargar) { return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; - } + } }; $scope.abrirModalListaPrecio = function() { var modalInstance = $uibModal.open( @@ -253,27 +263,25 @@ angular.module('focaCrearNotaPedido') ); }; $scope.abrirModalFlete = function() { - if($scope.notaPedido.flete === '1') { - var modalInstance = $uibModal.open( - { - ariaLabelledBy: 'Busqueda de Flete', - templateUrl: 'modal-flete.html', - controller: 'focaModalFleteController', - size: 'lg' - } - ); - modalInstance.result.then( - function(flete) { - $scope.limpiarFlete(); - $scope.notaPedido.fleteNombre = flete.nombre; - $scope.notaPedido.fleteId = flete.id; - $scope.choferes = flete.chofer; - $scope.vehiculos = flete.vehiculo; - }, function() { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Flete', + templateUrl: 'modal-flete.html', + controller: 'focaModalFleteController', + size: 'lg' + } + ); + modalInstance.result.then( + function(flete) { + $scope.limpiarFlete(); + $scope.notaPedido.fleteNombre = flete.nombre; + $scope.notaPedido.fleteId = flete.id; + $scope.choferes = flete.chofer; + $scope.vehiculos = flete.vehiculo; + }, function() { - } - ); - } + } + ); }; $scope.agregarATabla = function(key) { if(key === 13) { @@ -287,7 +295,7 @@ angular.module('focaCrearNotaPedido') $scope.cargando = true; } }; - $scope.quitarArticulo = function(key) { + $scope.quitarArticulo = function(key) { $scope.articulosTabla.splice(key, 1); }; $scope.editarArticulo = function(key, articulo) { @@ -329,7 +337,7 @@ angular.module('focaCrearNotaPedido') }; $scope.selectFocus = function($event) { $event.target.select(); - }; + }; } ] ) diff --git a/src/js/service.js b/src/js/service.js index 7d48c2f..20ad7b0 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -1,9 +1,9 @@ angular.module('focaCrearNotaPedido') - .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { + .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { var route = API_ENDPOINT.URL; - return { - crearNotaPedido: function(notaPedido) { - return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); + return { + crearNotaPedido: function(notaPedido) { + return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); }, obtenerNotaPedido: function() { return $http.get(route +'/nota-pedido'); @@ -43,5 +43,5 @@ angular.module('focaCrearNotaPedido') crearFlete: function(flete) { return $http.post(route + '/flete', {flete : flete}); } - }; + }; }]); diff --git a/src/views/nota-pedido.html b/src/views/nota-pedido.html index 18d257f..faca52d 100644 --- a/src/views/nota-pedido.html +++ b/src/views/nota-pedido.html @@ -1,191 +1,68 @@
-
-
-
-
- - - - -
-
-
-
- - - - -
-
-
-
- - - - -
-
-
- -
-
- -
-
- -
- - -
-
- - -
-
-
- -
- - +
+
+
+
+
+
+ + + + +
+
-
- - +
+
+
+ + + + +
+
-
- -
-
- -
-
- -
-
- -
-
- +
+
+
+
-
- -
@@ -198,13 +75,22 @@ Sector Código - Descripción + Descripción Precio Unitario Cantidad SubTotal - @@ -212,12 +98,13 @@ - + + @@ -251,7 +138,7 @@ esc-key="resetFilter()" ng-keypress="agregarATabla($event.keyCode)">
+
+
+ +
+