Commit 5860b1ef94d2ca258d7259f6f7be489d500d8712
1 parent
92521b388e
Exists in
master
and in
1 other branch
- Agregué botones Vendedor y Cliente.
- Modifiqué los botones, primera letra en mayúsculas. - Agregue los métodos relacionados con cada botón. - Agregué la lógica para selección de moneda. - Removí la llamada a limpiarPantalla. - Modifiqué la estructura de los componentes.
Showing
2 changed files
with
180 additions
and
200 deletions
Show diff stats
src/js/controller.js
| 1 | angular.module('focaCrearNotaPedido') | 1 | angular.module('focaCrearNotaPedido') |
| 2 | .controller('notaPedidoCtrl', | 2 | .controller('notaPedidoCtrl', |
| 3 | ['$scope', '$uibModal', 'crearNotaPedidoService', 'focaModalService', | 3 | ['$scope', '$uibModal', 'crearNotaPedidoService', 'focaModalService', |
| 4 | function($scope, $uibModal, crearNotaPedidoService, focaModalService) { | 4 | function($scope, $uibModal, crearNotaPedidoService, focaModalService) { |
| 5 | $scope.botonera = [ | 5 | $scope.botonera = [ |
| 6 | {texto: 'moneda', accion: function() {$scope.abrirModalMoneda();}}, | 6 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
| 7 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | ||
| 8 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | ||
| 7 | { | 9 | { |
| 8 | texto: 'precios y condiciones', | 10 | texto: 'Precios y condiciones', |
| 9 | accion: function() {$scope.abrirModalListaPrecio();}}, | 11 | accion: function() {$scope.abrirModalListaPrecio();}}, |
| 10 | {texto: 'flete', accion: function() {$scope.abrirModalFlete();}}, | 12 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
| 11 | {texto: 'bomba', accion: function() {}}, | 13 | {texto: 'Bomba', accion: function() {}}, |
| 12 | {texto: 'detalle', accion: function() {}}, | 14 | {texto: 'Detalle', accion: function() {}}, |
| 13 | {texto: 'totales', accion: function() {}} | 15 | {texto: 'Totales', accion: function() {}} |
| 14 | ]; | 16 | ]; |
| 15 | $scope.show = false; | 17 | $scope.show = false; |
| 16 | $scope.cargando = true; | 18 | $scope.cargando = true; |
| 17 | $scope.dateOptions = { | 19 | $scope.dateOptions = { |
| 18 | maxDate: new Date(), | 20 | maxDate: new Date(), |
| 19 | minDate: new Date(2010, 0, 1) | 21 | minDate: new Date(2010, 0, 1) |
| 20 | }; | 22 | }; |
| 21 | $scope.notaPedido = { | 23 | $scope.notaPedido = { |
| 22 | vendedor: {}, | 24 | vendedor: {}, |
| 23 | cliente: {}, | 25 | cliente: {}, |
| 24 | domicilio: { dom: ''} | 26 | domicilio: {dom: ''}, |
| 27 | moneda: {detalle: ''} | ||
| 25 | }; | 28 | }; |
| 26 | $scope.articulosTabla = []; | 29 | $scope.articulosTabla = []; |
| 27 | var idLista; | 30 | var idLista; |
| 28 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 31 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
| 29 | crearNotaPedidoService.getPrecioCondicion().then( | 32 | crearNotaPedidoService.getPrecioCondicion().then( |
| 30 | function(res) { | 33 | function(res) { |
| 31 | $scope.precioCondiciones = res.data; | 34 | $scope.precioCondiciones = res.data; |
| 32 | } | 35 | } |
| 33 | ); | 36 | ); |
| 34 | if (notaPedidoTemp !== undefined) { | 37 | if (notaPedidoTemp !== undefined) { |
| 35 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 38 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
| 36 | $scope.notaPedido = notaPedidoTemp; | 39 | $scope.notaPedido = notaPedidoTemp; |
| 37 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 40 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
| 38 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 41 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
| 39 | idLista = $scope.notaPedido.precioCondicion; | 42 | idLista = $scope.notaPedido.precioCondicion; |
| 40 | crearNotaPedidoService | 43 | crearNotaPedidoService |
| 41 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 44 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
| 42 | function(res) { | 45 | function(res) { |
| 43 | $scope.articulosTabla = res.data; | 46 | $scope.articulosTabla = res.data; |
| 44 | } | 47 | } |
| 45 | ); | 48 | ); |
| 46 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 49 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
| 47 | //(NO REQUERIDO EN ESTA VERSION) | 50 | //(NO REQUERIDO EN ESTA VERSION) |
| 48 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 51 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
| 49 | // function(res) { | 52 | // function(res) { |
| 50 | // $scope.notaPedido.domicilio = res.data; | 53 | // $scope.notaPedido.domicilio = res.data; |
| 51 | // } | 54 | // } |
| 52 | // ); | 55 | // ); |
| 53 | } else { | 56 | } else { |
| 54 | $scope.notaPedido.fechaCarga = new Date(); | 57 | $scope.notaPedido.fechaCarga = new Date(); |
| 55 | $scope.notaPedido.bomba = '0'; | 58 | $scope.notaPedido.bomba = '0'; |
| 56 | $scope.notaPedido.flete = '0'; | 59 | $scope.notaPedido.flete = '0'; |
| 57 | idLista = undefined; | 60 | idLista = undefined; |
| 58 | } | 61 | } |
| 59 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 62 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
| 60 | // $scope.addNewDom = function() { | 63 | // $scope.addNewDom = function() { |
| 61 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); | 64 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); |
| 62 | // }; | 65 | // }; |
| 63 | // $scope.removeNewChoice = function(choice) { | 66 | // $scope.removeNewChoice = function(choice) { |
| 64 | // if ($scope.notaPedido.domicilio.length > 1) { | 67 | // if ($scope.notaPedido.domicilio.length > 1) { |
| 65 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 68 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
| 66 | // function(c) { | 69 | // function(c) { |
| 67 | // return c.$$hashKey === choice.$$hashKey; | 70 | // return c.$$hashKey === choice.$$hashKey; |
| 68 | // } | 71 | // } |
| 69 | // ), 1); | 72 | // ), 1); |
| 70 | // } | 73 | // } |
| 71 | // }; | 74 | // }; |
| 72 | $scope.crearNotaPedido = function() { | 75 | $scope.crearNotaPedido = function() { |
| 73 | if($scope.articulosTabla.length === 0) { | 76 | if($scope.articulosTabla.length === 0) { |
| 74 | focaModalService.alert('Debe cargar almenos un articulo'); | 77 | focaModalService.alert('Debe cargar almenos un articulo'); |
| 75 | return; | 78 | return; |
| 76 | } | 79 | } |
| 77 | if($scope.notaPedido.domicilio.id === undefined) { | 80 | if($scope.notaPedido.domicilio.id === undefined) { |
| 78 | $scope.notaPedido.domicilio.id = 0; | 81 | $scope.notaPedido.domicilio.id = 0; |
| 79 | } | 82 | } |
| 80 | var date = new Date(); | 83 | var date = new Date(); |
| 81 | var notaPedido = { | 84 | var notaPedido = { |
| 82 | id: 0, | 85 | id: 0, |
| 83 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 86 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
| 84 | .toISOString().slice(0, 19).replace('T', ' '), | 87 | .toISOString().slice(0, 19).replace('T', ' '), |
| 85 | vendedor: $scope.notaPedido.vendedor.nombre, | 88 | vendedor: $scope.notaPedido.vendedor.nombre, |
| 86 | idCliente: $scope.notaPedido.cliente.id, | 89 | idCliente: $scope.notaPedido.cliente.id, |
| 87 | domicilio: $scope.notaPedido.domicilio, | 90 | domicilio: $scope.notaPedido.domicilio, |
| 88 | precioCondicion: $scope.notaPedido.precioCondicion, | 91 | precioCondicion: $scope.notaPedido.precioCondicion, |
| 89 | bomba: $scope.notaPedido.bomba, | 92 | bomba: $scope.notaPedido.bomba, |
| 90 | flete: $scope.notaPedido.flete, | 93 | flete: $scope.notaPedido.flete, |
| 91 | total: $scope.getTotal() | 94 | total: $scope.getTotal() |
| 92 | }; | 95 | }; |
| 93 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 96 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
| 94 | function(data) { | 97 | function(data) { |
| 95 | focaModalService.alert('Nota pedido creada'); | 98 | focaModalService.alert('Nota pedido creada'); |
| 96 | if($scope.notaPedido.flete === 1) { | 99 | if($scope.notaPedido.flete === 1) { |
| 97 | var flete = { | 100 | var flete = { |
| 98 | idNotaPedido: data.data.id, | 101 | idNotaPedido: data.data.id, |
| 99 | idTransportista: $scope.notaPedido.fleteId, | 102 | idTransportista: $scope.notaPedido.fleteId, |
| 100 | idChofer: $scope.notaPedido.chofer.id, | 103 | idChofer: $scope.notaPedido.chofer.id, |
| 101 | idVehiculo: $scope.notaPedido.vehiculo.id, | 104 | idVehiculo: $scope.notaPedido.vehiculo.id, |
| 102 | kilometros: $scope.notaPedido.kilometros, | 105 | kilometros: $scope.notaPedido.kilometros, |
| 103 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 106 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
| 104 | }; | 107 | }; |
| 105 | crearNotaPedidoService.crearFlete(flete); | 108 | crearNotaPedidoService.crearFlete(flete); |
| 106 | } | 109 | } |
| 107 | var articulosNotaPedido = $scope.articulosTabla; | 110 | var articulosNotaPedido = $scope.articulosTabla; |
| 108 | for(var i = 0; i < articulosNotaPedido.length; i++) { | 111 | for(var i = 0; i < articulosNotaPedido.length; i++) { |
| 109 | delete articulosNotaPedido[i].edit; | 112 | delete articulosNotaPedido[i].edit; |
| 110 | articulosNotaPedido[i].idNotaPedido = data.data.id; | 113 | articulosNotaPedido[i].idNotaPedido = data.data.id; |
| 111 | crearNotaPedidoService | 114 | crearNotaPedidoService |
| 112 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | 115 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
| 113 | } | 116 | } |
| 114 | $scope.limpiarPantalla(); | 117 | $scope.limpiarPantalla(); |
| 115 | } | 118 | } |
| 116 | ); | 119 | ); |
| 117 | }; | 120 | }; |
| 118 | $scope.seleccionarArticulo = function() { | 121 | $scope.seleccionarArticulo = function() { |
| 119 | if (idLista === undefined) { | 122 | if (idLista === undefined) { |
| 120 | focaModalService.alert( | 123 | focaModalService.alert( |
| 121 | 'Primero seleccione una lista de precio y condicion'); | 124 | 'Primero seleccione una lista de precio y condicion'); |
| 122 | return; | 125 | return; |
| 123 | } | 126 | } |
| 124 | var modalInstance = $uibModal.open( | 127 | var modalInstance = $uibModal.open( |
| 125 | { | 128 | { |
| 126 | ariaLabelledBy: 'Busqueda de Productos', | 129 | ariaLabelledBy: 'Busqueda de Productos', |
| 127 | templateUrl: 'modal-busqueda-productos.html', | 130 | templateUrl: 'modal-busqueda-productos.html', |
| 128 | controller: 'modalBusquedaProductosCtrl', | 131 | controller: 'modalBusquedaProductosCtrl', |
| 129 | resolve: { idLista: function() { return idLista; } }, | 132 | resolve: { idLista: function() { return idLista; } }, |
| 130 | size: 'lg' | 133 | size: 'lg' |
| 131 | } | 134 | } |
| 132 | ); | 135 | ); |
| 133 | modalInstance.result.then( | 136 | modalInstance.result.then( |
| 134 | function(producto) { | 137 | function(producto) { |
| 135 | var newArt = | 138 | var newArt = |
| 136 | { | 139 | { |
| 137 | id: 0, | 140 | id: 0, |
| 138 | codigo: producto.codigo, | 141 | codigo: producto.codigo, |
| 139 | sector: producto.sector, | 142 | sector: producto.sector, |
| 140 | descripcion: producto.descripcion, | 143 | descripcion: producto.descripcion, |
| 141 | item: $scope.articulosTabla.length + 1, | 144 | item: $scope.articulosTabla.length + 1, |
| 142 | nombre: producto.descripcion, | 145 | nombre: producto.descripcion, |
| 143 | precio: producto.precio.toFixed(2), | 146 | precio: producto.precio.toFixed(2), |
| 144 | costoUnitario: producto.costo, | 147 | costoUnitario: producto.costo, |
| 145 | edit: false | 148 | edit: false |
| 146 | }; | 149 | }; |
| 147 | $scope.articuloACargar = newArt; | 150 | $scope.articuloACargar = newArt; |
| 148 | $scope.cargando = false; | 151 | $scope.cargando = false; |
| 149 | }, function() { | 152 | }, function() { |
| 150 | // funcion ejecutada cuando se cancela el modal | 153 | // funcion ejecutada cuando se cancela el modal |
| 151 | } | 154 | } |
| 152 | ); | 155 | ); |
| 153 | }; | 156 | }; |
| 154 | $scope.seleccionarVendedor = function() { | 157 | $scope.seleccionarVendedor = function() { |
| 155 | var modalInstance = $uibModal.open( | 158 | var modalInstance = $uibModal.open( |
| 156 | { | 159 | { |
| 157 | ariaLabelledBy: 'Busqueda de Vendedores', | 160 | ariaLabelledBy: 'Busqueda de Vendedores', |
| 158 | templateUrl: 'modal-vendedores.html', | 161 | templateUrl: 'modal-vendedores.html', |
| 159 | controller: 'modalVendedoresCtrl', | 162 | controller: 'modalVendedoresCtrl', |
| 160 | size: 'lg' | 163 | size: 'lg' |
| 161 | } | 164 | } |
| 162 | ); | 165 | ); |
| 163 | modalInstance.result.then( | 166 | modalInstance.result.then( |
| 164 | function(vendedor) { | 167 | function(vendedor) { |
| 165 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 168 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
| 166 | }, function() { | 169 | }, function() { |
| 167 | 170 | ||
| 168 | } | 171 | } |
| 169 | ); | 172 | ); |
| 170 | }; | 173 | }; |
| 171 | $scope.seleccionarPetrolera = function() { | 174 | $scope.seleccionarPetrolera = function() { |
| 172 | var modalInstance = $uibModal.open( | 175 | var modalInstance = $uibModal.open( |
| 173 | { | 176 | { |
| 174 | ariaLabelledBy: 'Busqueda de Petrolera', | 177 | ariaLabelledBy: 'Busqueda de Petrolera', |
| 175 | templateUrl: 'modal-petroleras.html', | 178 | templateUrl: 'modal-petroleras.html', |
| 176 | controller: 'modalPetrolerasCtrl', | 179 | controller: 'modalPetrolerasCtrl', |
| 177 | size: 'lg' | 180 | size: 'lg' |
| 178 | } | 181 | } |
| 179 | ); | 182 | ); |
| 180 | modalInstance.result.then( | 183 | modalInstance.result.then( |
| 181 | function(petrolera) { | 184 | function(petrolera) { |
| 182 | $scope.notaPedido.petrolera = petrolera.NOM; | 185 | $scope.notaPedido.petrolera = petrolera.NOM; |
| 183 | }, function() { | 186 | }, function() { |
| 184 | 187 | ||
| 185 | } | 188 | } |
| 186 | ); | 189 | ); |
| 187 | }; | 190 | }; |
| 188 | $scope.seleccionarCliente = function() { | 191 | $scope.seleccionarCliente = function() { |
| 189 | var modalInstance = $uibModal.open( | 192 | var modalInstance = $uibModal.open( |
| 190 | { | 193 | { |
| 191 | ariaLabelledBy: 'Busqueda de Cliente', | 194 | ariaLabelledBy: 'Busqueda de Cliente', |
| 192 | templateUrl: 'foca-busqueda-cliente-modal.html', | 195 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 193 | controller: 'focaBusquedaClienteModalController', | 196 | controller: 'focaBusquedaClienteModalController', |
| 194 | size: 'lg' | 197 | size: 'lg' |
| 195 | } | 198 | } |
| 196 | ); | 199 | ); |
| 197 | modalInstance.result.then( | 200 | modalInstance.result.then( |
| 198 | function(cliente) { | 201 | function(cliente) { |
| 199 | $scope.limpiarPantalla(); | ||
| 200 | $scope.notaPedido.cliente.nombre = cliente.nom; | 202 | $scope.notaPedido.cliente.nombre = cliente.nom; |
| 201 | $scope.notaPedido.cliente.id = cliente.cod; | 203 | $scope.notaPedido.cliente.id = cliente.cod; |
| 202 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( | 204 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( |
| 203 | function(data) { | 205 | function(data) { |
| 204 | if(data.data.length === 0){ | 206 | if(data.data.length === 0){ |
| 205 | focaModalService | 207 | focaModalService |
| 206 | .alert('El cliente no tienen domicilios de entrega') | 208 | .alert('El cliente no tienen domicilios de entrega') |
| 207 | .then( | 209 | .then( |
| 208 | function() { | 210 | function() { |
| 209 | $scope.seleccionarCliente(); | 211 | $scope.seleccionarCliente(); |
| 210 | $scope.notaPedido.cliente = {nombre: ''}; | 212 | $scope.notaPedido.cliente = {nombre: ''}; |
| 211 | } | 213 | } |
| 212 | ); | 214 | ); |
| 213 | return; | 215 | return; |
| 214 | } | 216 | } |
| 215 | $scope.domiciliosCliente = data.data; | 217 | $scope.domiciliosCliente = data.data; |
| 216 | } | 218 | } |
| 217 | ); | 219 | ); |
| 218 | }, function() { | 220 | }, function() { |
| 219 | 221 | ||
| 220 | } | 222 | } |
| 221 | ); | 223 | ); |
| 222 | }; | 224 | }; |
| 223 | $scope.mostrarFichaCliente = function() { | 225 | $scope.mostrarFichaCliente = function() { |
| 224 | $uibModal.open( | 226 | $uibModal.open( |
| 225 | { | 227 | { |
| 226 | ariaLabelledBy: 'Datos del Cliente', | 228 | ariaLabelledBy: 'Datos del Cliente', |
| 227 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 229 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
| 228 | controller: 'focaCrearNotaPedidoFichaClienteController', | 230 | controller: 'focaCrearNotaPedidoFichaClienteController', |
| 229 | size: 'lg' | 231 | size: 'lg' |
| 230 | } | 232 | } |
| 231 | ); | 233 | ); |
| 232 | }; | 234 | }; |
| 233 | $scope.getTotal = function() { | 235 | $scope.getTotal = function() { |
| 234 | var total = 0; | 236 | var total = 0; |
| 235 | var arrayTempArticulos = $scope.articulosTabla; | 237 | var arrayTempArticulos = $scope.articulosTabla; |
| 236 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 238 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
| 237 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 239 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 238 | } | 240 | } |
| 239 | return total.toFixed(2); | 241 | return total.toFixed(2); |
| 240 | }; | 242 | }; |
| 241 | $scope.getSubTotal = function() { | 243 | $scope.getSubTotal = function() { |
| 242 | if($scope.articuloACargar) { | 244 | if($scope.articuloACargar) { |
| 243 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 245 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 244 | } | 246 | } |
| 245 | }; | 247 | }; |
| 246 | $scope.abrirModalListaPrecio = function() { | 248 | $scope.abrirModalListaPrecio = function() { |
| 247 | var modalInstance = $uibModal.open( | 249 | var modalInstance = $uibModal.open( |
| 248 | { | 250 | { |
| 249 | ariaLabelledBy: 'Busqueda de Precio Condición', | 251 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| 250 | templateUrl: 'modal-precio-condicion.html', | 252 | templateUrl: 'modal-precio-condicion.html', |
| 251 | controller: 'focaModalPrecioCondicionController', | 253 | controller: 'focaModalPrecioCondicionController', |
| 252 | size: 'lg' | 254 | size: 'lg' |
| 253 | } | 255 | } |
| 254 | ); | 256 | ); |
| 255 | modalInstance.result.then( | 257 | modalInstance.result.then( |
| 256 | function(precioCondicion) { | 258 | function(precioCondicion) { |
| 257 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 259 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
| 258 | idLista = precioCondicion.idListaPrecio; | 260 | idLista = precioCondicion.idListaPrecio; |
| 259 | $scope.articulosTabla = []; | 261 | $scope.articulosTabla = []; |
| 260 | }, function() { | 262 | }, function() { |
| 261 | 263 | ||
| 262 | } | 264 | } |
| 263 | ); | 265 | ); |
| 264 | }; | 266 | }; |
| 265 | $scope.abrirModalFlete = function() { | 267 | $scope.abrirModalFlete = function() { |
| 266 | var modalInstance = $uibModal.open( | 268 | var modalInstance = $uibModal.open( |
| 267 | { | 269 | { |
| 268 | ariaLabelledBy: 'Busqueda de Flete', | 270 | ariaLabelledBy: 'Busqueda de Flete', |
| 269 | templateUrl: 'modal-flete.html', | 271 | templateUrl: 'modal-flete.html', |
| 270 | controller: 'focaModalFleteController', | 272 | controller: 'focaModalFleteController', |
| 271 | size: 'lg' | 273 | size: 'lg' |
| 272 | } | 274 | } |
| 273 | ); | 275 | ); |
| 274 | modalInstance.result.then( | 276 | modalInstance.result.then( |
| 275 | function(flete) { | 277 | function(flete) { |
| 276 | $scope.limpiarFlete(); | 278 | $scope.limpiarFlete(); |
| 277 | $scope.notaPedido.fleteNombre = flete.nombre; | 279 | $scope.notaPedido.fleteNombre = flete.nombre; |
| 278 | $scope.notaPedido.fleteId = flete.id; | 280 | $scope.notaPedido.fleteId = flete.id; |
| 279 | $scope.choferes = flete.chofer; | 281 | $scope.choferes = flete.chofer; |
| 280 | $scope.vehiculos = flete.vehiculo; | 282 | $scope.vehiculos = flete.vehiculo; |
| 281 | }, function() { | 283 | }, function() { |
| 282 | 284 | ||
| 283 | } | 285 | } |
| 284 | ); | 286 | ); |
| 285 | }; | 287 | }; |
| 286 | $scope.abrirModalMoneda = function() { | 288 | $scope.abrirModalMoneda = function() { |
| 287 | var modalInstance = $uibModal.open( | 289 | var modalInstance = $uibModal.open( |
| 288 | { | 290 | { |
| 289 | ariaLabelledBy: 'Busqueda de Moneda', | 291 | ariaLabelledBy: 'Busqueda de Moneda', |
| 290 | templateUrl: 'modal-moneda.html', | 292 | templateUrl: 'modal-moneda.html', |
| 291 | controller: 'focaModalMonedaController', | 293 | controller: 'focaModalMonedaController', |
| 292 | size: 'lg' | 294 | size: 'lg' |
| 293 | } | 295 | } |
| 294 | ); | 296 | ); |
| 295 | modalInstance.result.then( | 297 | modalInstance.result.then( |
| 296 | function(moneda) { | 298 | function(moneda) { |
| 297 | console.log('moneda', moneda); | 299 | $scope.notaPedido.moneda = { |
| 300 | id: moneda.ID, | ||
| 301 | detalle: moneda.DETALLE, | ||
| 302 | simbolo: moneda.SIMBOLO | ||
| 303 | }; | ||
| 298 | }, function() { | 304 | }, function() { |
| 299 | 305 | ||
| 300 | } | 306 | } |
| 301 | ); | 307 | ); |
| 302 | }; | 308 | }; |
| 303 | $scope.agregarATabla = function(key) { | 309 | $scope.agregarATabla = function(key) { |
| 304 | if(key === 13) { | 310 | if(key === 13) { |
| 305 | if($scope.articuloACargar.cantidad === undefined || | 311 | if($scope.articuloACargar.cantidad === undefined || |
| 306 | $scope.articuloACargar.cantidad === 0 || | 312 | $scope.articuloACargar.cantidad === 0 || |
| 307 | $scope.articuloACargar.cantidad === null ){ | 313 | $scope.articuloACargar.cantidad === null ){ |
| 308 | focaModalService.alert('El valor debe ser al menos 1'); | 314 | focaModalService.alert('El valor debe ser al menos 1'); |
| 309 | return; | 315 | return; |
| 310 | } | 316 | } |
| 311 | $scope.articulosTabla.unshift($scope.articuloACargar); | 317 | $scope.articulosTabla.unshift($scope.articuloACargar); |
| 312 | $scope.cargando = true; | 318 | $scope.cargando = true; |
| 313 | } | 319 | } |
| 314 | }; | 320 | }; |
| 315 | $scope.quitarArticulo = function(key) { | 321 | $scope.quitarArticulo = function(key) { |
| 316 | $scope.articulosTabla.splice(key, 1); | 322 | $scope.articulosTabla.splice(key, 1); |
| 317 | }; | 323 | }; |
| 318 | $scope.editarArticulo = function(key, articulo) { | 324 | $scope.editarArticulo = function(key, articulo) { |
| 319 | if(key === 13) { | 325 | if(key === 13) { |
| 320 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 326 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
| 321 | articulo.cantidad === undefined){ | 327 | articulo.cantidad === undefined){ |
| 322 | focaModalService.alert('El valor debe ser al menos 1'); | 328 | focaModalService.alert('El valor debe ser al menos 1'); |
| 323 | return; | 329 | return; |
| 324 | } | 330 | } |
| 325 | articulo.edit = false; | 331 | articulo.edit = false; |
| 326 | } | 332 | } |
| 327 | }; | 333 | }; |
| 328 | $scope.cambioEdit = function(articulo) { | 334 | $scope.cambioEdit = function(articulo) { |
| 329 | articulo.edit = true; | 335 | articulo.edit = true; |
| 330 | }; | 336 | }; |
| 331 | $scope.limpiarFlete = function() { | 337 | $scope.limpiarFlete = function() { |
| 332 | $scope.notaPedido.fleteNombre = ''; | 338 | $scope.notaPedido.fleteNombre = ''; |
| 333 | $scope.notaPedido.chofer = ''; | 339 | $scope.notaPedido.chofer = ''; |
| 334 | $scope.notaPedido.vehiculo = ''; | 340 | $scope.notaPedido.vehiculo = ''; |
| 335 | $scope.notaPedido.kilometros = ''; | 341 | $scope.notaPedido.kilometros = ''; |
| 336 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 342 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
| 337 | $scope.choferes = ''; | 343 | $scope.choferes = ''; |
| 338 | $scope.vehiculos = ''; | 344 | $scope.vehiculos = ''; |
| 339 | }; | 345 | }; |
| 340 | $scope.limpiarPantalla = function() { | 346 | $scope.limpiarPantalla = function() { |
| 341 | $scope.limpiarFlete(); | 347 | $scope.limpiarFlete(); |
| 342 | $scope.notaPedido.flete = '0'; | 348 | $scope.notaPedido.flete = '0'; |
| 343 | $scope.notaPedido.bomba = '0'; | 349 | $scope.notaPedido.bomba = '0'; |
| 344 | $scope.notaPedido.precioCondicion = ''; | 350 | $scope.notaPedido.precioCondicion = ''; |
| 345 | $scope.articulosTabla = []; | 351 | $scope.articulosTabla = []; |
| 346 | $scope.notaPedido.vendedor.nombre = ''; | 352 | $scope.notaPedido.vendedor.nombre = ''; |
| 347 | $scope.notaPedido.cliente = {nombre: ''}; | 353 | $scope.notaPedido.cliente = {nombre: ''}; |
| 348 | $scope.notaPedido.domicilio = {dom: ''}; | 354 | $scope.notaPedido.domicilio = {dom: ''}; |
| 349 | $scope.domiciliosCliente = []; | 355 | $scope.domiciliosCliente = []; |
| 350 | }; | 356 | }; |
| 351 | $scope.resetFilter = function() { | 357 | $scope.resetFilter = function() { |
| 352 | $scope.articuloACargar = {}; | 358 | $scope.articuloACargar = {}; |
| 353 | $scope.cargando = true; | 359 | $scope.cargando = true; |
| 354 | }; | 360 | }; |
| 355 | $scope.selectFocus = function($event) { | 361 | $scope.selectFocus = function($event) { |
| 356 | $event.target.select(); | 362 | $event.target.select(); |
| 357 | }; | 363 | }; |
| 358 | } | 364 | } |
| 359 | ] | 365 | ] |
| 360 | ) | 366 | ) |
| 361 | .controller('notaPedidoListaCtrl', [ | 367 | .controller('notaPedidoListaCtrl', [ |
| 362 | '$scope', | 368 | '$scope', |
| 363 | 'crearNotaPedidoService', | 369 | 'crearNotaPedidoService', |
| 364 | '$location', | 370 | '$location', |
| 365 | function($scope, crearNotaPedidoService, $location) { | 371 | function($scope, crearNotaPedidoService, $location) { |
| 366 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 372 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
| 367 | $scope.notaPedidos = datos.data; | 373 | $scope.notaPedidos = datos.data; |
| 368 | }); | 374 | }); |
| 369 | $scope.editar = function(notaPedido) { | 375 | $scope.editar = function(notaPedido) { |
| 370 | crearNotaPedidoService.setNotaPedido(notaPedido); | 376 | crearNotaPedidoService.setNotaPedido(notaPedido); |
| 371 | $location.path('/venta-nota-pedido/abm/'); | 377 | $location.path('/venta-nota-pedido/abm/'); |
| 372 | }; | 378 | }; |
| 373 | $scope.crearPedido = function() { | 379 | $scope.crearPedido = function() { |
| 374 | crearNotaPedidoService.clearNotaPedido(); | 380 | crearNotaPedidoService.clearNotaPedido(); |
| 375 | $location.path('/venta-nota-pedido/abm/'); | 381 | $location.path('/venta-nota-pedido/abm/'); |
| 376 | }; | 382 | }; |
| 377 | } | 383 | } |
| 378 | ]) | 384 | ]) |
| 379 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 385 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
| 380 | '$scope', | 386 | '$scope', |
| 381 | 'crearNotaPedidoService', | 387 | 'crearNotaPedidoService', |
| 382 | '$location', | 388 | '$location', |
| 383 | function($scope, crearNotaPedidoService, $location) { | 389 | function($scope, crearNotaPedidoService, $location) { |
| 384 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 390 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
| 385 | $scope.notaPedidos = datos.data; | 391 | $scope.notaPedidos = datos.data; |
| 386 | }); | 392 | }); |
| 387 | $scope.editar = function(notaPedido) { | 393 | $scope.editar = function(notaPedido) { |
| 388 | crearNotaPedidoService.setNotaPedido(notaPedido); | 394 | crearNotaPedidoService.setNotaPedido(notaPedido); |
| 389 | $location.path('/venta-nota-pedido/abm/'); | 395 | $location.path('/venta-nota-pedido/abm/'); |
| 390 | }; | 396 | }; |
| 391 | $scope.crearPedido = function() { | 397 | $scope.crearPedido = function() { |
| 392 | crearNotaPedidoService.clearNotaPedido(); | 398 | crearNotaPedidoService.clearNotaPedido(); |
| 393 | $location.path('/venta-nota-pedido/abm/'); | 399 | $location.path('/venta-nota-pedido/abm/'); |
| 394 | }; | 400 | }; |
| 395 | } | 401 | } |
| 396 | ]); | 402 | ]); |
src/views/nota-pedido.html
| 1 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> | 1 | <div class="crear-nota-pedido"> |
| 2 | <div class="row"> | 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> |
| 3 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | 3 | <div class="row"> |
| 4 | <div class="row p-2 panel-informativo"> | 4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> |
| 5 | <div class="col"> | 5 | <div class="row p-1 panel-informativo"> |
| 6 | <div class="row"> | 6 | <div class="col-12"> |
| 7 | <div class="form-group col-12 col-sm-6 col-md-4"> | 7 | <div class="row"> |
| 8 | <div class="input-group"> | 8 | <div class="col-5"> |
| 9 | <input | 9 | <span class="label">Vendedor:</span> |
| 10 | class="form-control form-control-sm selectable" | 10 | <span class="valor" ng-bind="notaPedido.vendedor.nombre"></span> |
| 11 | type="text" | 11 | </div> |
| 12 | ng-model="notaPedido.cliente.nombre" | 12 | <div class="col-4"> |
| 13 | placeholder="Seleccione Cliente" | 13 | <span class="label">Moneda:</span> |
| 14 | readonly="true" | 14 | <span class="valor" ng-bind="notaPedido.moneda.detalle"></span> |
| 15 | ng-click="seleccionarCliente()" | 15 | </div> |
| 16 | ng-required="true" | 16 | <div class="col-3"> |
| 17 | foca-focus="true" | 17 | <span class="label">Flete:</span> |
| 18 | > | 18 | <span class="valor" ng-bind="notaPedido.flete"></span> |
| 19 | <span class="input-group-append"> | ||
| 20 | <button | ||
| 21 | type="button" | ||
| 22 | class="btn btn-default" | ||
| 23 | ng-click="seleccionarCliente()" | ||
| 24 | > | ||
| 25 | <i class="fa fa-search"></i> | ||
| 26 | </button> | ||
| 27 | </span> | ||
| 28 | </div> | 19 | </div> |
| 29 | </div> | 20 | </div> |
| 30 | </div> | 21 | <div class="row"> |
| 31 | <div class="row"> | 22 | <div class="col-5"> |
| 32 | <div class="form-group col-12 col-sm-6 col-md-4"> | 23 | <span class="label">Cliente:</span> |
| 33 | <div class="input-group"> | 24 | <span class="valor" ng-bind="notaPedido.cliente.nombre"></span> |
| 34 | <input | 25 | </div> |
| 35 | class="form-control form-control-sm" | 26 | <div class="col-5"> |
| 36 | type="text" | 27 | <span class="label">Precios y condiciones:</span> |
| 37 | ng-model="notaPedido.vendedor.nombre" | 28 | <span class="valor" ng-bind="notaPedido.cliente.nombre"></span> |
| 38 | placeholder="Seleccione Vendedor" | 29 | </div> |
| 39 | readonly="true" | 30 | <div class="col-3"> |
| 40 | > | 31 | <span class="label">Bomba:</span> |
| 41 | <span class="input-group-append"> | 32 | <span class="valor" ng-bind="notaPedido.bomba"></span> |
| 42 | <button | ||
| 43 | type="button" | ||
| 44 | class="btn btn-default" | ||
| 45 | ng-click="seleccionarVendedor()" | ||
| 46 | > | ||
| 47 | <i class="fa fa-search"></i> | ||
| 48 | </button> | ||
| 49 | </span> | ||
| 50 | </div> | 33 | </div> |
| 51 | </div> | 34 | </div> |
| 52 | </div> | 35 | </div> |
| 53 | </div> | 36 | </div> |
| 54 | </div> | 37 | <div class="row p-1 botonera-secundaria"> |
| 55 | <div class="row p-2 botonera-secundaria"> | 38 | <div class=" col-12 col-sm-6 col-md-3 botonera" ng-repeat="boton in botonera"> |
| 56 | <div class=" col-12 col-sm-6 col-md-3 botonera" ng-repeat="boton in botonera"> | 39 | <button |
| 57 | <button | 40 | type="button" |
| 58 | type="button" | 41 | class="btn btn-default btn-block btn-xs" |
| 59 | class="btn btn-default btn-block btn-sm" | 42 | ng-bind="boton.texto" |
| 60 | ng-bind="boton.texto" | 43 | ng-click="boton.accion()" |
| 61 | ng-click="boton.accion()" | 44 | ></button> |
| 62 | ></button> | 45 | </div> |
| 63 | </div> | 46 | </div> |
| 64 | </div> | 47 | </div> |
| 65 | </div> | 48 | </div> |
| 66 | </div> | 49 | </form> |
| 67 | </form> | 50 | <div class="row"> |
| 68 | <div class="row"> | 51 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
| 69 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 52 | <div class="row grilla-articulos align-items-end"> |
| 70 | <div class="row"> | 53 | <table class="table table-striped table-sm table-dark"> |
| 71 | </div> | 54 | <thead> |
| 72 | <div class="row"> | 55 | <tr> |
| 73 | <table class="table table-striped table-sm"> | 56 | <th>Sector</th> |
| 74 | <thead> | 57 | <th>Código</th> |
| 75 | <tr> | 58 | <th>Descripción</th> |
| 76 | <th>Sector</th> | 59 | <th>Precio Unitario</th> |
| 77 | <th>Código</th> | 60 | <th>Cantidad</th> |
| 78 | <th>Descripción</th> | 61 | <th>SubTotal</th> |
| 79 | <th>Precio Unitario</th> | 62 | <th> |
| 80 | <th>Cantidad</th> | 63 | <button |
| 81 | <th>SubTotal</th> | 64 | class="btn btn-outline-secondary selectable" |
| 82 | <th> | 65 | style="float: right;" |
| 83 | <button | 66 | ng-click="show = !show; masMenos()" |
| 84 | class="btn btn-outline-secondary selectable" | ||
| 85 | style="float: right;" | ||
| 86 | ng-click="show = !show; masMenos()" | ||
| 87 | > | ||
| 88 | <i | ||
| 89 | class="fa fa-chevron-down" | ||
| 90 | ng-hide="show" | ||
| 91 | aria-hidden="true" | ||
| 92 | > | 67 | > |
| 68 | <i | ||
| 69 | class="fa fa-chevron-down" | ||
| 70 | ng-hide="show" | ||
| 71 | aria-hidden="true" | ||
| 72 | > | ||
| 73 | </i> | ||
| 74 | <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i> | ||
| 75 | </button> | ||
| 76 | </th> | ||
| 77 | </tr> | ||
| 78 | </thead> | ||
| 79 | <tbody> | ||
| 80 | <tr ng-show="!cargando"> | ||
| 81 | <td><input | ||
| 82 | class="form-control" | ||
| 83 | ng-model="articuloACargar.sector" | ||
| 84 | readonly></td> | ||
| 85 | <td><input | ||
| 86 | class="form-control" | ||
| 87 | ng-model="articuloACargar.codigo" | ||
| 88 | readonly></td> | ||
| 89 | <td><input | ||
| 90 | class="form-control" | ||
| 91 | ng-model="articuloACargar.descripcion" | ||
| 92 | readonly></td> | ||
| 93 | <td><input | ||
| 94 | class="form-control" | ||
| 95 | ng-value="articuloACargar.precio | currency:'$'" | ||
| 96 | readonly></td> | ||
| 97 | <td><input | ||
| 98 | class="form-control" | ||
| 99 | type="number" | ||
| 100 | min="1" | ||
| 101 | ng-model="articuloACargar.cantidad" | ||
| 102 | foca-focus="!cargando" | ||
| 103 | esc-key="resetFilter()" | ||
| 104 | ng-keypress="agregarATabla($event.keyCode)"></td> | ||
| 105 | <td><input | ||
| 106 | class="form-control" | ||
| 107 | ng-value="getSubTotal() | currency:'$'" | ||
| 108 | readonly></td> | ||
| 109 | <td class="text-center"><button | ||
| 110 | class="btn btn-outline-secondary btn-sm" | ||
| 111 | ng-click="agregarATabla(13)"> | ||
| 112 | <i class="fa fa-save"></i> | ||
| 113 | </button></td> | ||
| 114 | </tr> | ||
| 115 | <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0"> | ||
| 116 | <td ng-bind="articulo.sector"></td> | ||
| 117 | <td ng-bind="articulo.codigo"></td> | ||
| 118 | <td ng-bind="articulo.descripcion"></td> | ||
| 119 | <td ng-bind="articulo.precio | currency:'$'"></td> | ||
| 120 | <td><input | ||
| 121 | ng-show="articulo.edit" | ||
| 122 | ng-model="articulo.cantidad" | ||
| 123 | class="form-control" | ||
| 124 | type="number" | ||
| 125 | min="1" | ||
| 126 | foca-focus="articulo.edit" | ||
| 127 | ng-keypress="editarArticulo($event.keyCode, articulo)" | ||
| 128 | ng-focus="selectFocus($event)" | ||
| 129 | > | ||
| 130 | <i | ||
| 131 | class="selectable" | ||
| 132 | ng-click="cambioEdit(articulo)" | ||
| 133 | ng-hide="articulo.edit" | ||
| 134 | ng-bind="articulo.cantidad"> | ||
| 93 | </i> | 135 | </i> |
| 94 | <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i> | 136 | </td> |
| 95 | </button> | 137 | <td ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"></td> |
| 96 | </th> | 138 | <td class="text-center"> |
| 97 | </tr> | 139 | <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo(key)"> |
| 98 | </thead> | 140 | <i class="fa fa-trash"></i> |
| 99 | <tbody> | 141 | </button> |
| 100 | <tr ng-show="cargando"> | 142 | </td> |
| 101 | <td colspan="2"> | 143 | </tr> |
| 102 | <input | 144 | <tr ng-show="cargando"> |
| 103 | placeholder="Seleccione Articulo" | 145 | <td colspan="7"> |
| 104 | class="form-control" | 146 | <input |
| 105 | readonly | 147 | placeholder="Seleccione Articulo" |
| 106 | ng-click="seleccionarArticulo()" | 148 | class="form-control form-control-sm" |
| 107 | /> | 149 | readonly |
| 108 | </td> | 150 | ng-click="seleccionarArticulo()" |
| 109 | <td></td> | 151 | /> |
| 110 | <td></td> | 152 | </td> |
| 111 | <td></td> | 153 | </tr> |
| 112 | <td></td> | 154 | </tbody> |
| 113 | <td></td> | 155 | <tfoot> |
| 114 | </tr> | 156 | <tr class=""> |
| 115 | <tr ng-show="!cargando"> | 157 | <td colspan="4"> |
| 116 | <td><input | 158 | <strong>Cantidad Items:</strong> |
| 117 | class="form-control" | 159 | <a ng-bind="articulosTabla.length"></a> |
| 118 | ng-model="articuloACargar.sector" | 160 | </td> |
| 119 | readonly></td> | 161 | <td class="text-right table-celda-total"><h3>Total:</h3></td> |
| 120 | <td><input | 162 | <td class="table-celda-total text-right" colspan="1"><h3>{{getTotal() | currency:'$'}}</h3></td> |
| 121 | class="form-control" | 163 | <td colspan="2"></td> |
| 122 | ng-model="articuloACargar.codigo" | 164 | </tr> |
| 123 | readonly></td> | 165 | </tfoot> |
| 124 | <td><input | 166 | </table> |
| 125 | class="form-control" | 167 | </div> |
| 126 | ng-model="articuloACargar.descripcion" | 168 | </div> |
| 127 | readonly></td> | 169 | <div class="col-auto my-2"> |
| 128 | <td><input | 170 | <button |
| 129 | class="form-control" | 171 | ng-click="crearNotaPedido()" |
| 130 | ng-value="articuloACargar.precio | currency:'$'" | 172 | type="submit" |
| 131 | readonly></td> | 173 | title="Crear nota pedido" |
| 132 | <td><input | 174 | class="btn btn-primary float-right"> |
| 133 | class="form-control" | 175 | Guardar |
| 134 | type="number" | 176 | </button> |
| 135 | min="1" | ||
| 136 | ng-model="articuloACargar.cantidad" | ||
| 137 | foca-focus="!cargando" | ||
| 138 | esc-key="resetFilter()" | ||
| 139 | ng-keypress="agregarATabla($event.keyCode)"></td> | ||
| 140 | <td><input | ||
| 141 | class="form-control" | ||
| 142 | ng-value="getSubTotal() | currency:'$'" | ||
| 143 | readonly></td> | ||
| 144 | <td class="text-center"><button | ||
| 145 | class="btn btn-outline-secondary btn-sm" | ||
| 146 | ng-click="agregarATabla(13)"> | ||
| 147 | <i class="fa fa-save"></i> | ||
| 148 | </button></td> | ||
| 149 | </tr> | ||
| 150 | <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0"> | ||
| 151 | <td ng-bind="articulo.sector"></td> | ||
| 152 | <td ng-bind="articulo.codigo"></td> | ||
| 153 | <td ng-bind="articulo.descripcion"></td> | ||
| 154 | <td ng-bind="articulo.precio | currency:'$'"></td> | ||
| 155 | <td><input | ||
| 156 | ng-show="articulo.edit" | ||
| 157 | ng-model="articulo.cantidad" | ||
| 158 | class="form-control" | ||
| 159 | type="number" | ||
| 160 | min="1" | ||
| 161 | foca-focus="articulo.edit" | ||
| 162 | ng-keypress="editarArticulo($event.keyCode, articulo)" | ||
| 163 | ng-focus="selectFocus($event)" | ||
| 164 | > | ||
| 165 | <i | ||
| 166 | class="selectable" | ||
| 167 | ng-click="cambioEdit(articulo)" | ||
| 168 | ng-hide="articulo.edit" | ||
| 169 | ng-bind="articulo.cantidad"> | ||
| 170 | </i> | ||
| 171 | </td> | ||
| 172 | <td ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"></td> | ||
| 173 | <td class="text-center"> | ||
| 174 | <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo(key)"> | ||
| 175 | <i class="fa fa-trash"></i> | ||
| 176 | </button> | ||
| 177 | </td> | ||
| 178 | </tr> | ||
| 179 | </tbody> | ||
| 180 | <tfoot> | ||
| 181 | <tr class="table-secondary"> | ||
| 182 | <td colspan="4"> | ||
| 183 | <strong>Cantidad Items:</strong> | ||
| 184 | <a ng-bind="articulosTabla.length"></a> | ||
| 185 | </td> | ||
| 186 | <td class="text-right"><strong>Total:</strong></td> | ||
| 187 | <td colspan="3">{{getTotal() | currency:'$'}}</td> | ||
| 188 | </tr> | ||
| 189 | </tfoot> | ||
| 190 | </table> | ||
| 191 | </div> | 177 | </div> |
| 192 | </div> | 178 | </div> |
| 193 | </div> | 179 | </div> |
| 194 | <div class="row"> | ||
| 195 | <div class="col-auto my-2"> | ||
| 196 | <button | ||
| 197 | ng-click="crearNotaPedido()" | ||
| 198 | type="submit" | ||
| 199 | title="Crear nota pedido" | ||
| 200 | class="btn btn-primary float-right"> | ||
| 201 | Guardar | ||
| 202 | </button> | ||
| 203 | </div> | ||
| 204 | </div> | ||
| 205 | |||
| 206 | <!-- | 180 | <!-- |
| 207 | <form name="formCrearNota"> | 181 | <form name="formCrearNota"> |
| 208 | <uib-tabset active="active"> | 182 | <uib-tabset active="active"> |
| 209 | <uib-tab index="0" heading="General"> | 183 | <uib-tab index="0" heading="General"> |
| 210 | <input type="hidden" name="id" ng-model="notaPedido.id" /> | 184 | <input type="hidden" name="id" ng-model="notaPedido.id" /> |
| 211 | <div> | 185 | <div> |
| 212 | <div class="col-auto my-2"> | 186 | <div class="col-auto my-2"> |
| 213 | <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> | 187 | <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> |
| 214 | </div> | 188 | </div> |
| 215 | </div> | 189 | </div> |
| 216 | <br> | 190 | <br> |
| 217 | <br> | 191 | <br> |
| 218 | <div class="row"> | 192 | <div class="row"> |
| 219 | <div class="col-md-2"> | 193 | <div class="col-md-2"> |
| 220 | <div class="col-auto"> | 194 | <div class="col-auto"> |
| 221 | <label>Fecha de carga</label> | 195 | <label>Fecha de carga</label> |
| 222 | </div> | 196 | </div> |
| 223 | </div> | 197 | </div> |
| 224 | <div class="col-md-3"> | 198 | <div class="col-md-3"> |
| 225 | <div class="col-auto"> | 199 | <div class="col-auto"> |
| 226 | <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> | 200 | <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> |
| 227 | </div> | 201 | </div> |
| 228 | </div> | 202 | </div> |
| 229 | <div class="col-md-2"> | 203 | <div class="col-md-2"> |
| 230 | <div class="col-auto"> | 204 | <div class="col-auto"> |
| 231 | <label>Kilómetros</label> | 205 | <label>Kilómetros</label> |
| 232 | </div> | 206 | </div> |
| 233 | </div> | 207 | </div> |
| 234 | <div class="col-md-3"> | 208 | <div class="col-md-3"> |
| 235 | <div class="col-auto"> | 209 | <div class="col-auto"> |
| 236 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" | 210 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" |
| 237 | ng-model="notaPedido.kilometros" ng-required="true"> | 211 | ng-model="notaPedido.kilometros" ng-required="true"> |
| 238 | </div> | 212 | </div> |
| 239 | </div> | 213 | </div> |
| 240 | </div> | 214 | </div> |
| 241 | <div class="row my-3"> | 215 | <div class="row my-3"> |
| 242 | <div class="col-md-2"> | 216 | <div class="col-md-2"> |
| 243 | <div class="col-auto"> | 217 | <div class="col-auto"> |
| 244 | <label>Jurisdicción de IIBB</label> | 218 | <label>Jurisdicción de IIBB</label> |
| 245 | </div> | 219 | </div> |
| 246 | </div> | 220 | </div> |
| 247 | <div class="col-md-3"> | 221 | <div class="col-md-3"> |
| 248 | <div class="col-auto"> | 222 | <div class="col-auto"> |
| 249 | <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" | 223 | <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" |
| 250 | ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> | 224 | ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> |
| 251 | </div> | 225 | </div> |
| 252 | </div> | 226 | </div> |
| 253 | <div class="col-md-2"> | 227 | <div class="col-md-2"> |
| 254 | <div class="col-auto"> | 228 | <div class="col-auto"> |
| 255 | <label>Costo de financiación</label> | 229 | <label>Costo de financiación</label> |
| 256 | </div> | 230 | </div> |
| 257 | </div> | 231 | </div> |
| 258 | <div class="col-md-3"> | 232 | <div class="col-md-3"> |
| 259 | <div class="col-auto"> | 233 | <div class="col-auto"> |
| 260 | <div class="input-group mb-2"> | 234 | <div class="input-group mb-2"> |
| 261 | <div class="input-group-prepend"> | 235 | <div class="input-group-prepend"> |
| 262 | <div class="input-group-text">$</div> | 236 | <div class="input-group-text">$</div> |
| 263 | </div> | 237 | </div> |
| 264 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" | 238 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" |
| 265 | ng-model="notaPedido.costoFinanciacion"> | 239 | ng-model="notaPedido.costoFinanciacion"> |
| 266 | </div> | 240 | </div> |
| 267 | </div> | 241 | </div> |
| 268 | </div> | 242 | </div> |
| 269 | </div> | 243 | </div> |
| 270 | <div class="row"> | 244 | <div class="row"> |
| 271 | <div class="col-md-2"> | 245 | <div class="col-md-2"> |
| 272 | <div class="col-auto"> | 246 | <div class="col-auto"> |
| 273 | <label>Bomba</label> | 247 | <label>Bomba</label> |
| 274 | </div> | 248 | </div> |
| 275 | </div> | 249 | </div> |
| 276 | <div class="col-md-1"> | 250 | <div class="col-md-1"> |
| 277 | <div class="col-auto"> | 251 | <div class="col-auto"> |
| 278 | <div class="form-check custom-radio custom-control-inline"> | 252 | <div class="form-check custom-radio custom-control-inline"> |
| 279 | <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> | 253 | <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> |
| 280 | <label class="form-check-label"> | 254 | <label class="form-check-label"> |
| 281 | Si | 255 | Si |
| 282 | </label> | 256 | </label> |
| 283 | </div> | 257 | </div> |
| 284 | <div class="form-check custom-radio custom-control-inline"> | 258 | <div class="form-check custom-radio custom-control-inline"> |
| 285 | <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> | 259 | <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> |
| 286 | <label class="form-check-label"> | 260 | <label class="form-check-label"> |
| 287 | No | 261 | No |
| 288 | </label> | 262 | </label> |
| 289 | </div> | 263 | </div> |
| 290 | </div> | 264 | </div> |
| 291 | </div> | 265 | </div> |
| 292 | <div class="col-md-1"> | 266 | <div class="col-md-1"> |
| 293 | <div class="col-auto"> | 267 | <div class="col-auto"> |
| 294 | <label>Flete</label> | 268 | <label>Flete</label> |
| 295 | </div> | 269 | </div> |
| 296 | </div> | 270 | </div> |
| 297 | <div class="col-md-1"> | 271 | <div class="col-md-1"> |
| 298 | <div class="col-auto"> | 272 | <div class="col-auto"> |
| 299 | <div class="form-check custom-radio custom-control-inline"> | 273 | <div class="form-check custom-radio custom-control-inline"> |
| 300 | <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> | 274 | <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> |
| 301 | <label class="form-check-label"> | 275 | <label class="form-check-label"> |
| 302 | Si | 276 | Si |
| 303 | </label> | 277 | </label> |
| 304 | </div> | 278 | </div> |
| 305 | <div class="form-check custom-radio custom-control-inline"> | 279 | <div class="form-check custom-radio custom-control-inline"> |
| 306 | <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> | 280 | <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> |
| 307 | <label class="form-check-label"> | 281 | <label class="form-check-label"> |
| 308 | FOB | 282 | FOB |
| 309 | </label> | 283 | </label> |
| 310 | </div> | 284 | </div> |
| 311 | </div> | 285 | </div> |
| 312 | </div> | 286 | </div> |
| 313 | <div class="col-md-2"> | 287 | <div class="col-md-2"> |
| 314 | <div class="col-auto"> | 288 | <div class="col-auto"> |
| 315 | <label>Costo unitario kilometro flete</label> | 289 | <label>Costo unitario kilometro flete</label> |
| 316 | </div> | 290 | </div> |
| 317 | </div> | 291 | </div> |
| 318 | <div class="col-md-3"> | 292 | <div class="col-md-3"> |
| 319 | <div class="col-auto"> | 293 | <div class="col-auto"> |
| 320 | <div class="input-group mb-2"> | 294 | <div class="input-group mb-2"> |
| 321 | <div class="input-group-prepend"> | 295 | <div class="input-group-prepend"> |
| 322 | <div class="input-group-text">$</div> | 296 | <div class="input-group-text">$</div> |
| 323 | </div> | 297 | </div> |
| 324 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" | 298 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" |
| 325 | ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> | 299 | ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> |
| 326 | </div> | 300 | </div> |
| 327 | </div> | 301 | </div> |
| 328 | </div> | 302 | </div> |
| 329 | </div> | 303 | </div> |
| 330 | <div class="row my-3"> | 304 | <div class="row my-3"> |
| 331 | <div class="col-md-2"> | 305 | <div class="col-md-2"> |
| 332 | <div class="col-auto"> | 306 | <div class="col-auto"> |
| 333 | <label>Vendedor</label> | 307 | <label>Vendedor</label> |
| 334 | </div> | 308 | </div> |
| 335 | </div> | 309 | </div> |
| 336 | <div class="col-md-3"> | 310 | <div class="col-md-3"> |
| 337 | <div class="col-auto"> | 311 | <div class="col-auto"> |
| 338 | <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" | 312 | <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" |
| 339 | ng-click="seleccionarVendedor()" readonly> | 313 | ng-click="seleccionarVendedor()" readonly> |
| 340 | </div> | 314 | </div> |
| 341 | </div> | 315 | </div> |
| 342 | <div class="col-md-2"> | 316 | <div class="col-md-2"> |
| 343 | <div class="col-auto"> | 317 | <div class="col-auto"> |
| 344 | <label>Petrolera</label> | 318 | <label>Petrolera</label> |
| 345 | </div> | 319 | </div> |
| 346 | </div> | 320 | </div> |
| 347 | <div class="col-md-3"> | 321 | <div class="col-md-3"> |
| 348 | <div class="col-auto"> | 322 | <div class="col-auto"> |
| 349 | <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera" | 323 | <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera" |
| 350 | ng-click="seleccionarPetrolera()" readonly> | 324 | ng-click="seleccionarPetrolera()" readonly> |
| 351 | </div> | 325 | </div> |
| 352 | </div> | 326 | </div> |
| 353 | </div> | 327 | </div> |
| 354 | </div> | 328 | </div> |
| 355 | <div class="row"> | 329 | <div class="row"> |
| 356 | <div class="col-md-2"> | 330 | <div class="col-md-2"> |
| 357 | <div class="col-auto"> | 331 | <div class="col-auto"> |
| 358 | <label>Cliente</label> | 332 | <label>Cliente</label> |
| 359 | </div> | 333 | </div> |
| 360 | </div> | 334 | </div> |
| 361 | <div class="col-md-3"> | 335 | <div class="col-md-3"> |
| 362 | <div class="col-auto"> | 336 | <div class="col-auto"> |
| 363 | <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" | 337 | <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" |
| 364 | ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> | 338 | ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> |
| 365 | </div> | 339 | </div> |
| 366 | </div> | 340 | </div> |
| 367 | <div class="col-md-2"> | 341 | <div class="col-md-2"> |
| 368 | <div class="col-auto"> | 342 | <div class="col-auto"> |
| 369 | <label>Domicilio</label> | 343 | <label>Domicilio</label> |
| 370 | </div> | 344 | </div> |
| 371 | </div> | 345 | </div> |
| 372 | <div class="col-md-4"> | 346 | <div class="col-md-4"> |
| 373 | <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> | 347 | <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> |
| 374 | <div class="col-auto"> | 348 | <div class="col-auto"> |
| 375 | <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" | 349 | <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" |
| 376 | domi.dom | 350 | domi.dom |
| 377 | for domi | 351 | for domi |
| 378 | in domiciliosCliente | 352 | in domiciliosCliente |
| 379 | " | 353 | " |
| 380 | typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" | 354 | typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" |
| 381 | class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> | 355 | class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> |
| 382 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> | 356 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> |
| 383 | <div ng-show="sinResultados"> | 357 | <div ng-show="sinResultados"> |
| 384 | No se encontraron resultados. | 358 | No se encontraron resultados. |