Commit 8cfb61baaa60a4f3952ee6c96d8328467511311c
Exists in
master
Merge branch 'master' into 'master'
Master See merge request modulos-npm/foca-crear-nota-pedido!97
Showing
4 changed files
Show diff stats
src/js/businessService.js
| ... | ... | @@ -27,6 +27,13 @@ angular.module('focaCrearNotaPedido') |
| 27 | 27 | for(var i = 0; i < articulos.length; i++) { |
| 28 | 28 | articulos[i].precio = articulos[i].precio / cotizacion; |
| 29 | 29 | } |
| 30 | + }, | |
| 31 | + plazoToString: function(plazos) { | |
| 32 | + var result = ''; | |
| 33 | + for(var i = 0; i < plazos.length; i++) { | |
| 34 | + result += plazos[i].dias + ' '; | |
| 35 | + } | |
| 36 | + return result.trim(); | |
| 30 | 37 | } |
| 31 | 38 | }; |
| 32 | 39 | }]); |
src/js/controller.js
| ... | ... | @@ -4,8 +4,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 4 | 4 | 'focaModalService', 'notaPedidoBusinessService', '$rootScope', 'focaSeguimientoService', |
| 5 | 5 | function( |
| 6 | 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, |
| 7 | - notaPedidoBusinessService, $rootScope, focaSeguimientoService | |
| 8 | - ) { | |
| 7 | + notaPedidoBusinessService, $rootScope, focaSeguimientoService) | |
| 8 | + { | |
| 9 | 9 | $scope.botonera = [ |
| 10 | 10 | {texto: 'Vendedor', accion: function() { |
| 11 | 11 | validarNotaRemitada($scope.seleccionarVendedor);}}, |
| ... | ... | @@ -61,8 +61,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 61 | 61 | $scope.comprobante = '00000000'; |
| 62 | 62 | $scope.articulosTabla = []; |
| 63 | 63 | $scope.idLista = undefined; |
| 64 | - //La pantalla solo se usa para cargar pedidos | |
| 65 | - //var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | |
| 66 | 64 | |
| 67 | 65 | crearNotaPedidoService.getPrecioCondicion().then( |
| 68 | 66 | function(res) { |
| ... | ... | @@ -80,45 +78,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 80 | 78 | console.info(err); |
| 81 | 79 | } |
| 82 | 80 | ); |
| 83 | - //La pantalla solo se usa para cargar pedidos | |
| 84 | - // if (notaPedidoTemp !== undefined) { | |
| 85 | - // notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | |
| 86 | - // $scope.notaPedido = notaPedidoTemp; | |
| 87 | - // $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | |
| 88 | - // $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | |
| 89 | - // $scope.idLista = $scope.notaPedido.precioCondicion; | |
| 90 | - // crearNotaPedidoService | |
| 91 | - // .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | |
| 92 | - // function(res) { | |
| 93 | - // $scope.articulosTabla = res.data; | |
| 94 | - // } | |
| 95 | - // ); | |
| 96 | - //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | |
| 97 | - //(NO REQUERIDO EN ESTA VERSION) | |
| 98 | - // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | |
| 99 | - // function(res) { | |
| 100 | - // $scope.notaPedido.domicilio = res.data; | |
| 101 | - // } | |
| 102 | - // ); | |
| 103 | - // } else { | |
| 104 | - // $scope.notaPedido.fechaCarga = new Date(); | |
| 105 | - // $scope.notaPedido.bomba = '0'; | |
| 106 | - // $scope.notaPedido.flete = '0'; | |
| 107 | - // $scope.idLista = undefined; | |
| 108 | - // } | |
| 109 | - //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | |
| 110 | - // $scope.addNewDom = function() { | |
| 111 | - // $scope.notaPedido.domicilio.push({ 'id': 0 }); | |
| 112 | - // }; | |
| 113 | - // $scope.removeNewChoice = function(choice) { | |
| 114 | - // if ($scope.notaPedido.domicilio.length > 1) { | |
| 115 | - // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | |
| 116 | - // function(c) { | |
| 117 | - // return c.$$hashKey === choice.$$hashKey; | |
| 118 | - // } | |
| 119 | - // ), 1); | |
| 120 | - // } | |
| 121 | - // }; | |
| 122 | 81 | |
| 123 | 82 | $scope.crearNotaPedido = function() { |
| 124 | 83 | if(!$scope.notaPedido.vendedor.CodVen) { |
| ... | ... | @@ -250,9 +209,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 250 | 209 | $scope.now = new Date(notaPedido.fechaCarga); |
| 251 | 210 | //añado cabeceras |
| 252 | 211 | $scope.notaPedido.id = notaPedido.id; |
| 253 | - removeCabecera('Moneda:'); | |
| 254 | - removeCabecera('Fecha cotizacion:'); | |
| 255 | - removeCabecera('Cotizacion:'); | |
| 212 | + removeCabecera('Bomba:'); | |
| 213 | + removeCabecera('Kilometros:'); | |
| 256 | 214 | var cabeceras = [ |
| 257 | 215 | { |
| 258 | 216 | label: 'Moneda:', |
| ... | ... | @@ -284,16 +242,17 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 284 | 242 | valor: notaPedido.proveedor[0].NOM |
| 285 | 243 | }, |
| 286 | 244 | { |
| 245 | + label: 'Precio condicion:', | |
| 246 | + valor: valorPrecioCondicion() + ' ' + | |
| 247 | + notaPedidoBusinessService.plazoToString(notaPedido.plazoPago) | |
| 248 | + }, | |
| 249 | + { | |
| 287 | 250 | label: 'Flete:', |
| 288 | 251 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
| 289 | 252 | notaPedido.flete === 1 ? 'Si' : 'No') |
| 290 | - }, | |
| 291 | - { | |
| 292 | - label: 'Precio condicion:', | |
| 293 | - valor: valorPrecioCondicion() | |
| 294 | 253 | } |
| 295 | 254 | ]; |
| 296 | - //TODO MOSTRAR PLAZOS | |
| 255 | + | |
| 297 | 256 | function valorPrecioCondicion() { |
| 298 | 257 | if(notaPedido.idPrecioCondicion > 0) { |
| 299 | 258 | return notaPedido.precioCondicion[0].nombre; |
| ... | ... | @@ -304,12 +263,12 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 304 | 263 | |
| 305 | 264 | if(notaPedido.flete === 1) { |
| 306 | 265 | var cabeceraBomba = { |
| 307 | - label: 'Bomba', | |
| 266 | + label: 'Bomba:', | |
| 308 | 267 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
| 309 | 268 | }; |
| 310 | 269 | if(notaPedido.kilometros) { |
| 311 | 270 | var cabeceraKilometros = { |
| 312 | - label: 'Kilometros', | |
| 271 | + label: 'Kilometros:', | |
| 313 | 272 | valor: notaPedido.kilometros |
| 314 | 273 | }; |
| 315 | 274 | cabeceras.push(cabeceraKilometros); |
| ... | ... | @@ -685,28 +644,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 685 | 644 | } |
| 686 | 645 | }; |
| 687 | 646 | |
| 688 | - $scope.limpiarFlete = function() { | |
| 689 | - $scope.notaPedido.fleteNombre = ''; | |
| 690 | - $scope.notaPedido.chofer = ''; | |
| 691 | - $scope.notaPedido.vehiculo = ''; | |
| 692 | - $scope.notaPedido.kilometros = ''; | |
| 693 | - $scope.notaPedido.costoUnitarioKmFlete = ''; | |
| 694 | - $scope.choferes = ''; | |
| 695 | - $scope.vehiculos = ''; | |
| 696 | - }; | |
| 697 | - | |
| 698 | - $scope.limpiarPantalla = function() { | |
| 699 | - $scope.limpiarFlete(); | |
| 700 | - $scope.notaPedido.flete = '0'; | |
| 701 | - $scope.notaPedido.bomba = '0'; | |
| 702 | - $scope.notaPedido.precioCondicion = ''; | |
| 703 | - $scope.articulosTabla = []; | |
| 704 | - $scope.notaPedido.vendedor.nombre = ''; | |
| 705 | - $scope.notaPedido.cliente = {nombre: ''}; | |
| 706 | - $scope.notaPedido.domicilio = {dom: ''}; | |
| 707 | - $scope.domiciliosCliente = []; | |
| 708 | - }; | |
| 709 | - | |
| 710 | 647 | $scope.resetFilter = function() { |
| 711 | 648 | $scope.articuloACargar = {}; |
| 712 | 649 | $scope.cargando = true; |
| ... | ... | @@ -777,41 +714,4 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 777 | 714 | } |
| 778 | 715 | } |
| 779 | 716 | } |
| 780 | - ] | |
| 781 | -) | |
| 782 | -.controller('notaPedidoListaCtrl', [ | |
| 783 | - '$scope', | |
| 784 | - 'crearNotaPedidoService', | |
| 785 | - '$location', | |
| 786 | - function($scope, crearNotaPedidoService, $location) { | |
| 787 | - crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | |
| 788 | - $scope.notaPedidos = datos.data; | |
| 789 | - }); | |
| 790 | - $scope.editar = function(notaPedido) { | |
| 791 | - crearNotaPedidoService.setNotaPedido(notaPedido); | |
| 792 | - $location.path('/venta-nota-pedido/abm/'); | |
| 793 | - }; | |
| 794 | - $scope.crearPedido = function() { | |
| 795 | - crearNotaPedidoService.clearNotaPedido(); | |
| 796 | - $location.path('/venta-nota-pedido/abm/'); | |
| 797 | - }; | |
| 798 | - } | |
| 799 | -]) | |
| 800 | -.controller('focaCrearNotaPedidoFichaClienteController', [ | |
| 801 | - '$scope', | |
| 802 | - 'crearNotaPedidoService', | |
| 803 | - '$location', | |
| 804 | - function($scope, crearNotaPedidoService, $location) { | |
| 805 | - crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | |
| 806 | - $scope.notaPedidos = datos.data; | |
| 807 | - }); | |
| 808 | - $scope.editar = function(notaPedido) { | |
| 809 | - crearNotaPedidoService.setNotaPedido(notaPedido); | |
| 810 | - $location.path('/venta-nota-pedido/abm/'); | |
| 811 | - }; | |
| 812 | - $scope.crearPedido = function() { | |
| 813 | - crearNotaPedidoService.clearNotaPedido(); | |
| 814 | - $location.path('/venta-nota-pedido/abm/'); | |
| 815 | - }; | |
| 816 | - } | |
| 817 | -]); | |
| 717 | + ]); |
src/views/foca-crear-nota-pedido-ficha-cliente.html
| ... | ... | @@ -1,78 +0,0 @@ |
| 1 | -<div class="modal-header"> | |
| 2 | - <h3 class="modal-title"></h3> | |
| 3 | -</div> | |
| 4 | -<div class="modal-body" id="modal-body"> | |
| 5 | - <div class="input-group mb-3"> | |
| 6 | - <input | |
| 7 | - type="text" | |
| 8 | - class="form-control" | |
| 9 | - placeholder="Busqueda" | |
| 10 | - ng-model="filters" | |
| 11 | - ng-change="search()" | |
| 12 | - ng-keydown="busquedaDown($event.keyCode)" | |
| 13 | - ng-keypress="busquedaPress($event.keyCode)" | |
| 14 | - foca-focus="selectedVendedor == -1" | |
| 15 | - ng-focus="selectedVendedor = -1" | |
| 16 | - > | |
| 17 | - <table class="table table-striped table-sm"> | |
| 18 | - <thead> | |
| 19 | - <tr> | |
| 20 | - <th>Código</th> | |
| 21 | - <th>Nombre</th> | |
| 22 | - <th></th> | |
| 23 | - </tr> | |
| 24 | - </thead> | |
| 25 | - <tbody> | |
| 26 | - <tr ng-repeat="(key, vendedor) in currentPageVendedores"> | |
| 27 | - <td ng-bind="vendedor.CodVen"></td> | |
| 28 | - <td ng-bind="vendedor.NomVen"></td> | |
| 29 | - <td> | |
| 30 | - <button | |
| 31 | - type="button" | |
| 32 | - class="btn p-2 float-right btn-sm" | |
| 33 | - ng-class="{ | |
| 34 | - 'btn-secondary': selectedVendedor != key, | |
| 35 | - 'btn-primary': selectedVendedor == key | |
| 36 | - }" | |
| 37 | - ng-click="select(vendedor)" | |
| 38 | - foca-focus="selectedVendedor == {{key}}" | |
| 39 | - ng-keydown="itemVendedor($event.keyCode)"> | |
| 40 | - <i class="fa fa-arrow-right" aria-hidden="true"></i> | |
| 41 | - </button> | |
| 42 | - </td> | |
| 43 | - </tr> | |
| 44 | - </tbody> | |
| 45 | - </table> | |
| 46 | - <nav> | |
| 47 | - <ul class="pagination justify-content-end"> | |
| 48 | - <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | |
| 49 | - <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> | |
| 50 | - <span aria-hidden="true">«</span> | |
| 51 | - <span class="sr-only">Anterior</span> | |
| 52 | - </a> | |
| 53 | - </li> | |
| 54 | - <li | |
| 55 | - class="page-item" | |
| 56 | - ng-repeat="pagina in paginas" | |
| 57 | - ng-class="{'active': pagina == currentPage}" | |
| 58 | - > | |
| 59 | - <a | |
| 60 | - class="page-link" | |
| 61 | - href="javascript:void();" | |
| 62 | - ng-click="selectPage(pagina)" | |
| 63 | - ng-bind="pagina" | |
| 64 | - ></a> | |
| 65 | - </li> | |
| 66 | - <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | |
| 67 | - <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> | |
| 68 | - <span aria-hidden="true">»</span> | |
| 69 | - <span class="sr-only">Siguiente</span> | |
| 70 | - </a> | |
| 71 | - </li> | |
| 72 | - </ul> | |
| 73 | - </nav> | |
| 74 | - </div> | |
| 75 | -</div> | |
| 76 | -<div class="modal-footer"> | |
| 77 | - <button class="btn btn-secondary" data-dismiss="modal">Cerrar</button> | |
| 78 | -</div> |
src/views/nota-pedido-lista.html
| ... | ... | @@ -1,25 +0,0 @@ |
| 1 | -<table class="table table-sm table-hover table-nonfluid"> | |
| 2 | - <thead> | |
| 3 | - <tr> | |
| 4 | - <th>Código</th> | |
| 5 | - <th>Vendedor</th> | |
| 6 | - <th>Cliente</th> | |
| 7 | - <th>Proveedor</th> | |
| 8 | - <th>Total</th> | |
| 9 | - <th><button class="btn btn-primary" ng-click="crearPedido()">Crear</button></th> | |
| 10 | - </tr> | |
| 11 | - </thead> | |
| 12 | - <tbody> | |
| 13 | - <tr ng-repeat="item in notaPedidos"> | |
| 14 | - <td ng-bind="item.id"></td> | |
| 15 | - <td ng-bind="item.vendedor"></td> | |
| 16 | - <td ng-bind="item.cliente"></td> | |
| 17 | - <td ng-bind="item.proveedor"></td> | |
| 18 | - <td ng-bind="(item.total | 0) | currency"></td> | |
| 19 | - <td> | |
| 20 | - <button class="btn btn-info" ng-show="false" ng-click="editar(item)"><i class="fa fa-edit"></i></button> | |
| 21 | - <!-- <button class="btn btn-danger" ng-click="borrar(item.id)"><i class="fa fa-trash"></i></button> --> | |
| 22 | - </td> | |
| 23 | - </tr> | |
| 24 | - </tbody> | |
| 25 | -</table> |