Commit 536013389cebad60c9b2b5ee23ffabb1002098c9
1 parent
fff86d0098
Exists in
master
Implementación parcial de cambios solicitados.
- Agregué botonera secundaria. - Quité elementos no usados.
Showing
3 changed files
with
135 additions
and
225 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 = [ | ||
6 | {texto: 'moneda', accion: function(){console.log('moneda');}}, | ||
7 | { | ||
8 | texto: 'precios y condiciones', | ||
9 | accion: function(){$scope.abrirModalListaPrecio();}}, | ||
10 | {texto: 'flete', accion: function(){$scope.abrirModalFlete();}}, | ||
11 | {texto: 'bomba', accion: function(){}}, | ||
12 | {texto: 'detalle', accion: function(){}}, | ||
13 | {texto: 'totales', accion: function(){}} | ||
14 | ]; | ||
5 | $scope.show = false; | 15 | $scope.show = false; |
6 | $scope.cargando = true; | 16 | $scope.cargando = true; |
7 | $scope.dateOptions = { | 17 | $scope.dateOptions = { |
8 | maxDate: new Date(), | 18 | maxDate: new Date(), |
9 | minDate: new Date(2010, 0, 1) | 19 | minDate: new Date(2010, 0, 1) |
10 | }; | 20 | }; |
11 | $scope.notaPedido = { | 21 | $scope.notaPedido = { |
12 | vendedor: {}, | 22 | vendedor: {}, |
13 | cliente: {}, | 23 | cliente: {}, |
14 | domicilio: { dom: ''} | 24 | domicilio: { dom: ''} |
15 | }; | 25 | }; |
16 | $scope.articulosTabla = []; | 26 | $scope.articulosTabla = []; |
17 | var idLista; | 27 | var idLista; |
18 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 28 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
19 | crearNotaPedidoService.getPrecioCondicion().then( | 29 | crearNotaPedidoService.getPrecioCondicion().then( |
20 | function(res) { | 30 | function(res) { |
21 | $scope.precioCondiciones = res.data; | 31 | $scope.precioCondiciones = res.data; |
22 | } | 32 | } |
23 | ); | 33 | ); |
24 | if (notaPedidoTemp !== undefined) { | 34 | if (notaPedidoTemp !== undefined) { |
25 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 35 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
26 | $scope.notaPedido = notaPedidoTemp; | 36 | $scope.notaPedido = notaPedidoTemp; |
27 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 37 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
28 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 38 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
29 | idLista = $scope.notaPedido.precioCondicion; | 39 | idLista = $scope.notaPedido.precioCondicion; |
30 | crearNotaPedidoService | 40 | crearNotaPedidoService |
31 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 41 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
32 | function(res) { | 42 | function(res) { |
33 | $scope.articulosTabla = res.data; | 43 | $scope.articulosTabla = res.data; |
34 | } | 44 | } |
35 | ); | 45 | ); |
36 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 46 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
37 | //(NO REQUERIDO EN ESTA VERSION) | 47 | //(NO REQUERIDO EN ESTA VERSION) |
38 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 48 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
39 | // function(res) { | 49 | // function(res) { |
40 | // $scope.notaPedido.domicilio = res.data; | 50 | // $scope.notaPedido.domicilio = res.data; |
41 | // } | 51 | // } |
42 | // ); | 52 | // ); |
43 | } else { | 53 | } else { |
44 | $scope.notaPedido.fechaCarga = new Date(); | 54 | $scope.notaPedido.fechaCarga = new Date(); |
45 | $scope.notaPedido.bomba = '0'; | 55 | $scope.notaPedido.bomba = '0'; |
46 | $scope.notaPedido.flete = '0'; | 56 | $scope.notaPedido.flete = '0'; |
47 | idLista = undefined; | 57 | idLista = undefined; |
48 | } | 58 | } |
49 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 59 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
50 | // $scope.addNewDom = function() { | 60 | // $scope.addNewDom = function() { |
51 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); | 61 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); |
52 | // }; | 62 | // }; |
53 | // $scope.removeNewChoice = function(choice) { | 63 | // $scope.removeNewChoice = function(choice) { |
54 | // if ($scope.notaPedido.domicilio.length > 1) { | 64 | // if ($scope.notaPedido.domicilio.length > 1) { |
55 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 65 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
56 | // function(c) { | 66 | // function(c) { |
57 | // return c.$$hashKey === choice.$$hashKey; | 67 | // return c.$$hashKey === choice.$$hashKey; |
58 | // } | 68 | // } |
59 | // ), 1); | 69 | // ), 1); |
60 | // } | 70 | // } |
61 | // }; | 71 | // }; |
62 | $scope.crearNotaPedido = function() { | 72 | $scope.crearNotaPedido = function() { |
63 | if($scope.articulosTabla.length === 0) { | 73 | if($scope.articulosTabla.length === 0) { |
64 | focaModalService.alert('Debe cargar almenos un articulo'); | 74 | focaModalService.alert('Debe cargar almenos un articulo'); |
65 | return; | 75 | return; |
66 | } | 76 | } |
67 | if($scope.notaPedido.domicilio.id === undefined) { | 77 | if($scope.notaPedido.domicilio.id === undefined) { |
68 | $scope.notaPedido.domicilio.id = 0; | 78 | $scope.notaPedido.domicilio.id = 0; |
69 | } | 79 | } |
70 | var date = new Date(); | 80 | var date = new Date(); |
71 | var notaPedido = { | 81 | var notaPedido = { |
72 | id: 0, | 82 | id: 0, |
73 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 83 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
74 | .toISOString().slice(0, 19).replace('T', ' '), | 84 | .toISOString().slice(0, 19).replace('T', ' '), |
75 | vendedor: $scope.notaPedido.vendedor.nombre, | 85 | vendedor: $scope.notaPedido.vendedor.nombre, |
76 | idCliente: $scope.notaPedido.cliente.id, | 86 | idCliente: $scope.notaPedido.cliente.id, |
77 | domicilio: $scope.notaPedido.domicilio, | 87 | domicilio: $scope.notaPedido.domicilio, |
78 | precioCondicion: $scope.notaPedido.precioCondicion, | 88 | precioCondicion: $scope.notaPedido.precioCondicion, |
79 | bomba: $scope.notaPedido.bomba, | 89 | bomba: $scope.notaPedido.bomba, |
80 | flete: $scope.notaPedido.flete, | 90 | flete: $scope.notaPedido.flete, |
81 | total: $scope.getTotal() | 91 | total: $scope.getTotal() |
82 | }; | 92 | }; |
83 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 93 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
84 | function(data) { | 94 | function(data) { |
85 | focaModalService.alert('Nota pedido creada'); | 95 | focaModalService.alert('Nota pedido creada'); |
86 | if($scope.notaPedido.flete === 1) { | 96 | if($scope.notaPedido.flete === 1) { |
87 | var flete = { | 97 | var flete = { |
88 | idNotaPedido: data.data.id, | 98 | idNotaPedido: data.data.id, |
89 | idTransportista: $scope.notaPedido.fleteId, | 99 | idTransportista: $scope.notaPedido.fleteId, |
90 | idChofer: $scope.notaPedido.chofer.id, | 100 | idChofer: $scope.notaPedido.chofer.id, |
91 | idVehiculo: $scope.notaPedido.vehiculo.id, | 101 | idVehiculo: $scope.notaPedido.vehiculo.id, |
92 | kilometros: $scope.notaPedido.kilometros, | 102 | kilometros: $scope.notaPedido.kilometros, |
93 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 103 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
94 | }; | 104 | }; |
95 | crearNotaPedidoService.crearFlete(flete); | 105 | crearNotaPedidoService.crearFlete(flete); |
96 | } | 106 | } |
97 | var articulosNotaPedido = $scope.articulosTabla; | 107 | var articulosNotaPedido = $scope.articulosTabla; |
98 | for(var i = 0; i < articulosNotaPedido.length; i++) { | 108 | for(var i = 0; i < articulosNotaPedido.length; i++) { |
99 | delete articulosNotaPedido[i].edit; | 109 | delete articulosNotaPedido[i].edit; |
100 | articulosNotaPedido[i].idNotaPedido = data.data.id; | 110 | articulosNotaPedido[i].idNotaPedido = data.data.id; |
101 | crearNotaPedidoService | 111 | crearNotaPedidoService |
102 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | 112 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
103 | } | 113 | } |
104 | $scope.limpiarPantalla(); | 114 | $scope.limpiarPantalla(); |
105 | } | 115 | } |
106 | ); | 116 | ); |
107 | }; | 117 | }; |
108 | $scope.seleccionarArticulo = function() { | 118 | $scope.seleccionarArticulo = function() { |
109 | if (idLista === undefined) { | 119 | if (idLista === undefined) { |
110 | focaModalService.alert( | 120 | focaModalService.alert( |
111 | 'Primero seleccione una lista de precio y condicion'); | 121 | 'Primero seleccione una lista de precio y condicion'); |
112 | return; | 122 | return; |
113 | } | 123 | } |
114 | var modalInstance = $uibModal.open( | 124 | var modalInstance = $uibModal.open( |
115 | { | 125 | { |
116 | ariaLabelledBy: 'Busqueda de Productos', | 126 | ariaLabelledBy: 'Busqueda de Productos', |
117 | templateUrl: 'modal-busqueda-productos.html', | 127 | templateUrl: 'modal-busqueda-productos.html', |
118 | controller: 'modalBusquedaProductosCtrl', | 128 | controller: 'modalBusquedaProductosCtrl', |
119 | resolve: { idLista: function() { return idLista; } }, | 129 | resolve: { idLista: function() { return idLista; } }, |
120 | size: 'lg' | 130 | size: 'lg' |
121 | } | 131 | } |
122 | ); | 132 | ); |
123 | modalInstance.result.then( | 133 | modalInstance.result.then( |
124 | function(producto) { | 134 | function(producto) { |
125 | var newArt = | 135 | var newArt = |
126 | { | 136 | { |
127 | id: 0, | 137 | id: 0, |
128 | codigo: producto.codigo, | 138 | codigo: producto.codigo, |
129 | sector: producto.sector, | 139 | sector: producto.sector, |
130 | descripcion: producto.descripcion, | 140 | descripcion: producto.descripcion, |
131 | item: $scope.articulosTabla.length + 1, | 141 | item: $scope.articulosTabla.length + 1, |
132 | nombre: producto.descripcion, | 142 | nombre: producto.descripcion, |
133 | precio: producto.precio.toFixed(2), | 143 | precio: producto.precio.toFixed(2), |
134 | costoUnitario: producto.costo, | 144 | costoUnitario: producto.costo, |
135 | edit: false | 145 | edit: false |
136 | }; | 146 | }; |
137 | $scope.articuloACargar = newArt; | 147 | $scope.articuloACargar = newArt; |
138 | $scope.cargando = false; | 148 | $scope.cargando = false; |
139 | }, function() { | 149 | }, function() { |
140 | // funcion ejecutada cuando se cancela el modal | 150 | // funcion ejecutada cuando se cancela el modal |
141 | } | 151 | } |
142 | ); | 152 | ); |
143 | }; | 153 | }; |
144 | $scope.seleccionarVendedor = function() { | 154 | $scope.seleccionarVendedor = function() { |
145 | var modalInstance = $uibModal.open( | 155 | var modalInstance = $uibModal.open( |
146 | { | 156 | { |
147 | ariaLabelledBy: 'Busqueda de Vendedores', | 157 | ariaLabelledBy: 'Busqueda de Vendedores', |
148 | templateUrl: 'modal-vendedores.html', | 158 | templateUrl: 'modal-vendedores.html', |
149 | controller: 'modalVendedoresCtrl', | 159 | controller: 'modalVendedoresCtrl', |
150 | size: 'lg' | 160 | size: 'lg' |
151 | } | 161 | } |
152 | ); | 162 | ); |
153 | modalInstance.result.then( | 163 | modalInstance.result.then( |
154 | function(vendedor) { | 164 | function(vendedor) { |
155 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 165 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
156 | }, function() { | 166 | }, function() { |
157 | 167 | ||
158 | } | 168 | } |
159 | ); | 169 | ); |
160 | }; | 170 | }; |
161 | $scope.seleccionarPetrolera = function() { | 171 | $scope.seleccionarPetrolera = function() { |
162 | var modalInstance = $uibModal.open( | 172 | var modalInstance = $uibModal.open( |
163 | { | 173 | { |
164 | ariaLabelledBy: 'Busqueda de Petrolera', | 174 | ariaLabelledBy: 'Busqueda de Petrolera', |
165 | templateUrl: 'modal-petroleras.html', | 175 | templateUrl: 'modal-petroleras.html', |
166 | controller: 'modalPetrolerasCtrl', | 176 | controller: 'modalPetrolerasCtrl', |
167 | size: 'lg' | 177 | size: 'lg' |
168 | } | 178 | } |
169 | ); | 179 | ); |
170 | modalInstance.result.then( | 180 | modalInstance.result.then( |
171 | function(petrolera) { | 181 | function(petrolera) { |
172 | $scope.notaPedido.petrolera = petrolera.NOM; | 182 | $scope.notaPedido.petrolera = petrolera.NOM; |
173 | }, function() { | 183 | }, function() { |
174 | 184 | ||
175 | } | 185 | } |
176 | ); | 186 | ); |
177 | }; | 187 | }; |
178 | $scope.seleccionarCliente = function() { | 188 | $scope.seleccionarCliente = function() { |
179 | var modalInstance = $uibModal.open( | 189 | var modalInstance = $uibModal.open( |
180 | { | 190 | { |
181 | ariaLabelledBy: 'Busqueda de Cliente', | 191 | ariaLabelledBy: 'Busqueda de Cliente', |
182 | templateUrl: 'foca-busqueda-cliente-modal.html', | 192 | templateUrl: 'foca-busqueda-cliente-modal.html', |
183 | controller: 'focaBusquedaClienteModalController', | 193 | controller: 'focaBusquedaClienteModalController', |
184 | size: 'lg' | 194 | size: 'lg' |
185 | } | 195 | } |
186 | ); | 196 | ); |
187 | modalInstance.result.then( | 197 | modalInstance.result.then( |
188 | function(cliente) { | 198 | function(cliente) { |
189 | $scope.limpiarPantalla(); | 199 | $scope.limpiarPantalla(); |
190 | $scope.notaPedido.cliente.nombre = cliente.nom; | 200 | $scope.notaPedido.cliente.nombre = cliente.nom; |
191 | $scope.notaPedido.cliente.id = cliente.cod; | 201 | $scope.notaPedido.cliente.id = cliente.cod; |
192 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( | 202 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( |
193 | function(data) { | 203 | function(data) { |
194 | if(data.data.length === 0){ | 204 | if(data.data.length === 0){ |
195 | focaModalService | 205 | focaModalService |
196 | .alert('El cliente no tienen domicilios de entrega') | 206 | .alert('El cliente no tienen domicilios de entrega') |
197 | .then( | 207 | .then( |
198 | function() { | 208 | function() { |
199 | $scope.seleccionarCliente(); | 209 | $scope.seleccionarCliente(); |
200 | $scope.notaPedido.cliente = {nombre: ''}; | 210 | $scope.notaPedido.cliente = {nombre: ''}; |
201 | } | 211 | } |
202 | ); | 212 | ); |
203 | return; | 213 | return; |
204 | } | 214 | } |
205 | $scope.domiciliosCliente = data.data; | 215 | $scope.domiciliosCliente = data.data; |
206 | } | 216 | } |
207 | ); | 217 | ); |
208 | }, function() { | 218 | }, function() { |
209 | 219 | ||
210 | } | 220 | } |
211 | ); | 221 | ); |
212 | }; | 222 | }; |
213 | $scope.mostrarFichaCliente = function() { | 223 | $scope.mostrarFichaCliente = function() { |
214 | $uibModal.open( | 224 | $uibModal.open( |
215 | { | 225 | { |
216 | ariaLabelledBy: 'Datos del Cliente', | 226 | ariaLabelledBy: 'Datos del Cliente', |
217 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 227 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
218 | controller: 'focaCrearNotaPedidoFichaClienteController', | 228 | controller: 'focaCrearNotaPedidoFichaClienteController', |
219 | size: 'lg' | 229 | size: 'lg' |
220 | } | 230 | } |
221 | ); | 231 | ); |
222 | }; | 232 | }; |
223 | $scope.getTotal = function() { | 233 | $scope.getTotal = function() { |
224 | var total = 0; | 234 | var total = 0; |
225 | var arrayTempArticulos = $scope.articulosTabla; | 235 | var arrayTempArticulos = $scope.articulosTabla; |
226 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 236 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
227 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 237 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
228 | } | 238 | } |
229 | return total.toFixed(2); | 239 | return total.toFixed(2); |
230 | }; | 240 | }; |
231 | $scope.getSubTotal = function() { | 241 | $scope.getSubTotal = function() { |
232 | if($scope.articuloACargar) { | 242 | if($scope.articuloACargar) { |
233 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 243 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
234 | } | 244 | } |
235 | }; | 245 | }; |
236 | $scope.abrirModalListaPrecio = function() { | 246 | $scope.abrirModalListaPrecio = function() { |
237 | var modalInstance = $uibModal.open( | 247 | var modalInstance = $uibModal.open( |
238 | { | 248 | { |
239 | ariaLabelledBy: 'Busqueda de Precio Condición', | 249 | ariaLabelledBy: 'Busqueda de Precio Condición', |
240 | templateUrl: 'modal-precio-condicion.html', | 250 | templateUrl: 'modal-precio-condicion.html', |
241 | controller: 'focaModalPrecioCondicionController', | 251 | controller: 'focaModalPrecioCondicionController', |
242 | size: 'lg' | 252 | size: 'lg' |
243 | } | 253 | } |
244 | ); | 254 | ); |
245 | modalInstance.result.then( | 255 | modalInstance.result.then( |
246 | function(precioCondicion) { | 256 | function(precioCondicion) { |
247 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 257 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
248 | idLista = precioCondicion.idListaPrecio; | 258 | idLista = precioCondicion.idListaPrecio; |
249 | $scope.articulosTabla = []; | 259 | $scope.articulosTabla = []; |
250 | }, function() { | 260 | }, function() { |
251 | 261 | ||
252 | } | 262 | } |
253 | ); | 263 | ); |
254 | }; | 264 | }; |
255 | $scope.abrirModalFlete = function() { | 265 | $scope.abrirModalFlete = function() { |
256 | if($scope.notaPedido.flete === '1') { | 266 | var modalInstance = $uibModal.open( |
257 | var modalInstance = $uibModal.open( | 267 | { |
258 | { | 268 | ariaLabelledBy: 'Busqueda de Flete', |
259 | ariaLabelledBy: 'Busqueda de Flete', | 269 | templateUrl: 'modal-flete.html', |
260 | templateUrl: 'modal-flete.html', | 270 | controller: 'focaModalFleteController', |
261 | controller: 'focaModalFleteController', | 271 | size: 'lg' |
262 | size: 'lg' | 272 | } |
263 | } | 273 | ); |
264 | ); | 274 | modalInstance.result.then( |
265 | modalInstance.result.then( | 275 | function(flete) { |
266 | function(flete) { | 276 | $scope.limpiarFlete(); |
267 | $scope.limpiarFlete(); | 277 | $scope.notaPedido.fleteNombre = flete.nombre; |
268 | $scope.notaPedido.fleteNombre = flete.nombre; | 278 | $scope.notaPedido.fleteId = flete.id; |
269 | $scope.notaPedido.fleteId = flete.id; | 279 | $scope.choferes = flete.chofer; |
270 | $scope.choferes = flete.chofer; | 280 | $scope.vehiculos = flete.vehiculo; |
271 | $scope.vehiculos = flete.vehiculo; | 281 | }, function() { |
272 | }, function() { | ||
273 | 282 | ||
274 | } | 283 | } |
275 | ); | 284 | ); |
276 | } | ||
277 | }; | 285 | }; |
278 | $scope.agregarATabla = function(key) { | 286 | $scope.agregarATabla = function(key) { |
279 | if(key === 13) { | 287 | if(key === 13) { |
280 | if($scope.articuloACargar.cantidad === undefined || | 288 | if($scope.articuloACargar.cantidad === undefined || |
281 | $scope.articuloACargar.cantidad === 0 || | 289 | $scope.articuloACargar.cantidad === 0 || |
282 | $scope.articuloACargar.cantidad === null ){ | 290 | $scope.articuloACargar.cantidad === null ){ |
283 | focaModalService.alert('El valor debe ser al menos 1'); | 291 | focaModalService.alert('El valor debe ser al menos 1'); |
284 | return; | 292 | return; |
285 | } | 293 | } |
286 | $scope.articulosTabla.unshift($scope.articuloACargar); | 294 | $scope.articulosTabla.unshift($scope.articuloACargar); |
287 | $scope.cargando = true; | 295 | $scope.cargando = true; |
288 | } | 296 | } |
289 | }; | 297 | }; |
290 | $scope.quitarArticulo = function(key) { | 298 | $scope.quitarArticulo = function(key) { |
291 | $scope.articulosTabla.splice(key, 1); | 299 | $scope.articulosTabla.splice(key, 1); |
292 | }; | 300 | }; |
293 | $scope.editarArticulo = function(key, articulo) { | 301 | $scope.editarArticulo = function(key, articulo) { |
294 | if(key === 13) { | 302 | if(key === 13) { |
295 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 303 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
296 | articulo.cantidad === undefined){ | 304 | articulo.cantidad === undefined){ |
297 | focaModalService.alert('El valor debe ser al menos 1'); | 305 | focaModalService.alert('El valor debe ser al menos 1'); |
298 | return; | 306 | return; |
299 | } | 307 | } |
300 | articulo.edit = false; | 308 | articulo.edit = false; |
301 | } | 309 | } |
302 | }; | 310 | }; |
303 | $scope.cambioEdit = function(articulo) { | 311 | $scope.cambioEdit = function(articulo) { |
304 | articulo.edit = true; | 312 | articulo.edit = true; |
305 | }; | 313 | }; |
306 | $scope.limpiarFlete = function() { | 314 | $scope.limpiarFlete = function() { |
307 | $scope.notaPedido.fleteNombre = ''; | 315 | $scope.notaPedido.fleteNombre = ''; |
308 | $scope.notaPedido.chofer = ''; | 316 | $scope.notaPedido.chofer = ''; |
309 | $scope.notaPedido.vehiculo = ''; | 317 | $scope.notaPedido.vehiculo = ''; |
310 | $scope.notaPedido.kilometros = ''; | 318 | $scope.notaPedido.kilometros = ''; |
311 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 319 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
312 | $scope.choferes = ''; | 320 | $scope.choferes = ''; |
313 | $scope.vehiculos = ''; | 321 | $scope.vehiculos = ''; |
314 | }; | 322 | }; |
315 | $scope.limpiarPantalla = function() { | 323 | $scope.limpiarPantalla = function() { |
316 | $scope.limpiarFlete(); | 324 | $scope.limpiarFlete(); |
317 | $scope.notaPedido.flete = '0'; | 325 | $scope.notaPedido.flete = '0'; |
318 | $scope.notaPedido.bomba = '0'; | 326 | $scope.notaPedido.bomba = '0'; |
319 | $scope.notaPedido.precioCondicion = ''; | 327 | $scope.notaPedido.precioCondicion = ''; |
320 | $scope.articulosTabla = []; | 328 | $scope.articulosTabla = []; |
321 | $scope.notaPedido.vendedor.nombre = ''; | 329 | $scope.notaPedido.vendedor.nombre = ''; |
322 | $scope.notaPedido.cliente = {nombre: ''}; | 330 | $scope.notaPedido.cliente = {nombre: ''}; |
323 | $scope.notaPedido.domicilio = {dom: ''}; | 331 | $scope.notaPedido.domicilio = {dom: ''}; |
324 | $scope.domiciliosCliente = []; | 332 | $scope.domiciliosCliente = []; |
325 | }; | 333 | }; |
326 | $scope.resetFilter = function() { | 334 | $scope.resetFilter = function() { |
327 | $scope.articuloACargar = {}; | 335 | $scope.articuloACargar = {}; |
328 | $scope.cargando = true; | 336 | $scope.cargando = true; |
329 | }; | 337 | }; |
330 | $scope.selectFocus = function($event) { | 338 | $scope.selectFocus = function($event) { |
331 | $event.target.select(); | 339 | $event.target.select(); |
332 | }; | 340 | }; |
333 | } | 341 | } |
334 | ] | 342 | ] |
335 | ) | 343 | ) |
336 | .controller('notaPedidoListaCtrl', [ | 344 | .controller('notaPedidoListaCtrl', [ |
337 | '$scope', | 345 | '$scope', |
338 | 'crearNotaPedidoService', | 346 | 'crearNotaPedidoService', |
339 | '$location', | 347 | '$location', |
340 | function($scope, crearNotaPedidoService, $location) { | 348 | function($scope, crearNotaPedidoService, $location) { |
341 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 349 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
342 | $scope.notaPedidos = datos.data; | 350 | $scope.notaPedidos = datos.data; |
343 | }); | 351 | }); |
344 | $scope.editar = function(notaPedido) { | 352 | $scope.editar = function(notaPedido) { |
345 | crearNotaPedidoService.setNotaPedido(notaPedido); | 353 | crearNotaPedidoService.setNotaPedido(notaPedido); |
346 | $location.path('/venta-nota-pedido/abm/'); | 354 | $location.path('/venta-nota-pedido/abm/'); |
347 | }; | 355 | }; |
348 | $scope.crearPedido = function() { | 356 | $scope.crearPedido = function() { |
349 | crearNotaPedidoService.clearNotaPedido(); | 357 | crearNotaPedidoService.clearNotaPedido(); |
350 | $location.path('/venta-nota-pedido/abm/'); | 358 | $location.path('/venta-nota-pedido/abm/'); |
351 | }; | 359 | }; |
352 | } | 360 | } |
353 | ]) | 361 | ]) |
354 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 362 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
355 | '$scope', | 363 | '$scope', |
356 | 'crearNotaPedidoService', | 364 | 'crearNotaPedidoService', |
357 | '$location', | 365 | '$location', |
358 | function($scope, crearNotaPedidoService, $location) { | 366 | function($scope, crearNotaPedidoService, $location) { |
359 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 367 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
360 | $scope.notaPedidos = datos.data; | 368 | $scope.notaPedidos = datos.data; |
361 | }); | 369 | }); |
362 | $scope.editar = function(notaPedido) { | 370 | $scope.editar = function(notaPedido) { |
363 | crearNotaPedidoService.setNotaPedido(notaPedido); | 371 | crearNotaPedidoService.setNotaPedido(notaPedido); |
364 | $location.path('/venta-nota-pedido/abm/'); | 372 | $location.path('/venta-nota-pedido/abm/'); |
365 | }; | 373 | }; |
366 | $scope.crearPedido = function() { | 374 | $scope.crearPedido = function() { |
367 | crearNotaPedidoService.clearNotaPedido(); | 375 | crearNotaPedidoService.clearNotaPedido(); |
368 | $location.path('/venta-nota-pedido/abm/'); | 376 | $location.path('/venta-nota-pedido/abm/'); |
369 | }; | 377 | }; |
370 | } | 378 | } |
src/js/service.js
1 | angular.module('focaCrearNotaPedido') | 1 | angular.module('focaCrearNotaPedido') |
2 | .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
3 | var route = API_ENDPOINT.URL; | 3 | var route = API_ENDPOINT.URL; |
4 | return { | 4 | return { |
5 | crearNotaPedido: function(notaPedido) { | 5 | crearNotaPedido: function(notaPedido) { |
6 | return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); | 6 | return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); |
7 | }, | 7 | }, |
8 | obtenerNotaPedido: function() { | 8 | obtenerNotaPedido: function() { |
9 | return $http.get(route +'/nota-pedido'); | 9 | return $http.get(route +'/nota-pedido'); |
10 | }, | 10 | }, |
11 | setNotaPedido: function(notaPedido) { | 11 | setNotaPedido: function(notaPedido) { |
12 | this.notaPedido = notaPedido; | 12 | this.notaPedido = notaPedido; |
13 | }, | 13 | }, |
14 | clearNotaPedido: function() { | 14 | clearNotaPedido: function() { |
15 | this.notaPedido = undefined; | 15 | this.notaPedido = undefined; |
16 | }, | 16 | }, |
17 | getNotaPedido: function() { | 17 | getNotaPedido: function() { |
18 | return this.notaPedido; | 18 | return this.notaPedido; |
19 | }, | 19 | }, |
20 | getArticulosByIdNotaPedido: function(id) { | 20 | getArticulosByIdNotaPedido: function(id) { |
21 | return $http.get(route+'/articulos/nota-pedido/'+id); | 21 | return $http.get(route+'/articulos/nota-pedido/'+id); |
22 | }, | 22 | }, |
23 | crearArticulosParaNotaPedido: function(articuloNotaPedido) { | 23 | crearArticulosParaNotaPedido: function(articuloNotaPedido) { |
24 | return $http.post(route + '/articulos/nota-pedido', | 24 | return $http.post(route + '/articulos/nota-pedido', |
25 | {articuloNotaPedido: articuloNotaPedido}); | 25 | {articuloNotaPedido: articuloNotaPedido}); |
26 | }, | 26 | }, |
27 | getDomiciliosByIdNotaPedido: function(id) { | 27 | getDomiciliosByIdNotaPedido: function(id) { |
28 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); | 28 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); |
29 | }, | 29 | }, |
30 | getDomiciliosByIdCliente: function(id) { | 30 | getDomiciliosByIdCliente: function(id) { |
31 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 31 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) |
32 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 32 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); |
33 | }, | 33 | }, |
34 | getPrecioCondicion: function() { | 34 | getPrecioCondicion: function() { |
35 | return $http.get(route + '/precio-condicion'); | 35 | return $http.get(route + '/precio-condicion'); |
36 | }, | 36 | }, |
37 | getPrecioCondicionById: function(id) { | 37 | getPrecioCondicionById: function(id) { |
38 | return $http.get(route + '/precio-condicion/' + id); | 38 | return $http.get(route + '/precio-condicion/' + id); |
39 | }, | 39 | }, |
40 | getPlazoPagoByPrecioCondicion: function(id) { | 40 | getPlazoPagoByPrecioCondicion: function(id) { |
41 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | 41 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); |
42 | }, | 42 | }, |
43 | crearFlete: function(flete) { | 43 | crearFlete: function(flete) { |
44 | return $http.post(route + '/flete', {flete : flete}); | 44 | return $http.post(route + '/flete', {flete : flete}); |
45 | } | 45 | } |
46 | }; | 46 | }; |
47 | }]); | 47 | }]); |
48 | 48 |
src/views/nota-pedido.html
1 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> | 1 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> |
2 | <div class="row"> | 2 | <div class="row"> |
3 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 3 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> |
4 | <div class="row bg-secondary p-3"> | 4 | <div class="row p-2 panel-informativo"> |
5 | <div class="form-group col-12 col-sm-6 col-md-4"> | 5 | <div class="col"> |
6 | <div class="input-group"> | 6 | <div class="row"> |
7 | <input | 7 | <div class="form-group col-12 col-sm-6 col-md-4"> |
8 | type="text" | 8 | <div class="input-group"> |
9 | class="form-control" | 9 | <input |
10 | uib-datepicker-popup="dd/MM/yyyy" | 10 | class="form-control form-control-sm selectable" |
11 | ng-model="notaPedido.fechaCarga" | 11 | type="text" |
12 | is-open="popup1.opened" | 12 | ng-model="notaPedido.cliente.nombre" |
13 | datepicker-options="dateOptions" | 13 | placeholder="Seleccione Cliente" |
14 | close-text="Cerrar" | 14 | readonly="true" |
15 | current-text="Hoy" | 15 | ng-click="seleccionarCliente()" |
16 | clear-text="Borrar" | 16 | ng-required="true" |
17 | alt-input-formats="altInputFormats" | 17 | foca-focus="true" |
18 | ng-required="true" | 18 | > |
19 | /> | 19 | <span class="input-group-append"> |
20 | <span class="input-group-append"> | 20 | <button |
21 | <button type="button" class="btn btn-default" ng-click="popup1.opened = true"> | 21 | type="button" |
22 | <i class="fa fa-calendar"></i> | 22 | class="btn btn-default" |
23 | </button> | 23 | ng-click="seleccionarCliente()" |
24 | </span> | 24 | > |
25 | </div> | 25 | <i class="fa fa-search"></i> |
26 | </div> | 26 | </button> |
27 | <div class="form-group col-12 col-sm-6 col-md-4"> | 27 | </span> |
28 | <div class="input-group"> | 28 | </div> |
29 | <input | 29 | </div> |
30 | class="form-control selectable" | ||
31 | type="text" | ||
32 | ng-model="notaPedido.cliente.nombre" | ||
33 | placeholder="Seleccione Cliente" | ||
34 | readonly="true" | ||
35 | ng-click="seleccionarCliente()" | ||
36 | ng-required="true" | ||
37 | foca-focus="true" | ||
38 | > | ||
39 | <span class="input-group-append"> | ||
40 | <button type="button" class="btn btn-default" ng-click="seleccionarCliente()"> | ||
41 | <i class="fa fa-search"></i> | ||
42 | </button> | ||
43 | </span> | ||
44 | </div> | ||
45 | </div> | ||
46 | <div class="form-group col-12 col-sm-6 col-md-4"> | ||
47 | <div class="input-group"> | ||
48 | <input | ||
49 | class="form-control" | ||
50 | type="text" | ||
51 | ng-model="notaPedido.vendedor.nombre" | ||
52 | placeholder="Seleccione Vendedor" | ||
53 | readonly="true" | ||
54 | > | ||
55 | <span class="input-group-append"> | ||
56 | <button type="button" class="btn btn-default" ng-click="seleccionarVendedor()"> | ||
57 | <i class="fa fa-search"></i> | ||
58 | </button> | ||
59 | </span> | ||
60 | </div> | ||
61 | </div> | ||
62 | <div class="form-group col-12 col-sm-6 col-md-4"> | ||
63 | <input | ||
64 | class="form-control selectable" | ||
65 | type="text" | ||
66 | ng-model="notaPedido.domicilio" | ||
67 | placeholder="Seleccione Domicilio" | ||
68 | typeahead-min-length="0" | ||
69 | uib-typeahead="domi as domi.dom for domi in domiciliosCliente" | ||
70 | > | ||
71 | </div> | ||
72 | <div class="form-group col-12 col-sm-6 col-md-4"> | ||
73 | <input | ||
74 | class="form-control selectable" | ||
75 | type="text" | ||
76 | readonly="true" | ||
77 | ng-model="notaPedido.precioCondicion" | ||
78 | ng-click="abrirModalListaPrecio()" | ||
79 | placeholder="Seleccione Lista de precio" | ||
80 | > | ||
81 | </div> | ||
82 | <div class="form-group col-12 col-sm-6 col-md-4"> | ||
83 | <label>Bomba</label> | ||
84 | <div class="form-check custom-radio custom-control-inline"> | ||
85 | <input | ||
86 | class="form-check-input" | ||
87 | type="radio" | ||
88 | name="radioBomba" | ||
89 | value="1" | ||
90 | ng-model="notaPedido.bomba"> | ||
91 | <label class="form-check-label">Si</label> | ||
92 | </div> | ||
93 | <div class="form-check custom-radio custom-control-inline"> | ||
94 | <input | ||
95 | class="form-check-input" | ||
96 | type="radio" | ||
97 | name="radioBomba" | ||
98 | value="0" | ||
99 | ng-model="notaPedido.bomba"> | ||
100 | <label class="form-check-label">No</label> | ||
101 | </div> | ||
102 | </div> | ||
103 | <div class="form-group col-12 col-sm-6 col-md-4"> | ||
104 | <label>Flete</label> | ||
105 | <div class="form-check custom-radio custom-control-inline"> | ||
106 | <input | ||
107 | ng-change="limpiarFlete()" | ||
108 | class="form-check-input" | ||
109 | type="radio" | ||
110 | name="radioFlete" | ||
111 | value="1" | ||
112 | ng-model="notaPedido.flete"> | ||
113 | <label class="form-check-label">Si</label> | ||
114 | </div> | 30 | </div> |
115 | <div class="form-check custom-radio custom-control-inline"> | 31 | <div class="row"> |
116 | <input | 32 | <div class="form-group col-12 col-sm-6 col-md-4"> |
117 | class="form-check-input" | 33 | <div class="input-group"> |
118 | type="radio" | 34 | <input |
119 | name="radioFlete" | 35 | class="form-control form-control-sm" |
120 | value="0" | 36 | type="text" |
121 | ng-model="notaPedido.flete"> | 37 | ng-model="notaPedido.vendedor.nombre" |
122 | <label class="form-check-label">No</label> | 38 | placeholder="Seleccione Vendedor" |
39 | readonly="true" | ||
40 | > | ||
41 | <span class="input-group-append"> | ||
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> | ||
51 | </div> | ||
123 | </div> | 52 | </div> |
124 | </div> | 53 | </div> |
125 | <div class="form-group col-12 col-sm-6 col-md-4"> | 54 | </div> |
126 | <input | 55 | <div class="row p-2 botonera-secundaria"> |
127 | class="form-control selectable" | 56 | <div class=" col-12 col-sm-6 col-md-3 botonera" ng-repeat="boton in botonera"> |
128 | type="text" | 57 | <button |
129 | readonly="true" | 58 | type="button" |
130 | ng-show="notaPedido.flete == 1" | 59 | class="btn btn-default btn-block btn-sm" |
131 | ng-model="notaPedido.fleteNombre" | 60 | ng-bind="boton.texto" |
132 | ng-click="abrirModalFlete()" | 61 | ng-click="boton.accion()" |
133 | placeholder="Seleccione Flete" | 62 | ></button> |
134 | > | ||
135 | </div> | ||
136 | <div class="form-group col-12 col-sm-6 col-md-4"> | ||
137 | <input | ||
138 | class="form-control selectable" | ||
139 | type="text" | ||
140 | ng-show="notaPedido.flete == 1" | ||
141 | ng-model="notaPedido.chofer" | ||
142 | placeholder="Seleccione Chofer" | ||
143 | uib-typeahead="chofer as chofer.nombre for chofer in choferes" | ||
144 | typeahead-min-length="0" | ||
145 | > | ||
146 | </div> | ||
147 | <div class="form-group col-12 col-sm-6 col-md-4"> | ||
148 | <input | ||
149 | class="form-control selectable" | ||
150 | type="text" | ||
151 | ng-show="notaPedido.flete == 1" | ||
152 | ng-model="notaPedido.vehiculo" | ||
153 | placeholder="Seleccione Vehículo" | ||
154 | uib-typeahead="vehiculo as vehiculo.tractor for vehiculo in vehiculos" | ||
155 | typeahead-min-length="0" | ||
156 | > | ||
157 | </div> | ||
158 | <div class="form-group col-12 col-sm-6 col-md-4"> | ||
159 | <input | ||
160 | class="form-control selectable" | ||
161 | type="number" | ||
162 | step="0.01" | ||
163 | ng-show="notaPedido.flete == 1" | ||
164 | ng-model="notaPedido.costoUnitarioKmFlete" | ||
165 | placeholder="Costo por kilómetro" | ||
166 | > | ||
167 | </div> | ||
168 | <div class="form-group col-12 col-sm-6 col-md-4"> | ||
169 | <input | ||
170 | class="form-control selectable" | ||
171 | type="number" | ||
172 | step="0.1" | ||
173 | ng-show="notaPedido.flete == 1" | ||
174 | ng-model="notaPedido.kilometros" | ||
175 | placeholder="Kilómetros recorridos" | ||
176 | > | ||
177 | </div> | 63 | </div> |
178 | </div> | 64 | </div> |
179 | </div> | 65 | </div> |
180 | <div class="col-auto my-2"> | ||
181 | <button | ||
182 | ng-click="crearNotaPedido()" | ||
183 | type="submit" | ||
184 | title="Crear nota pedido" | ||
185 | class="btn btn-primary float-right"> | ||
186 | Guardar | ||
187 | </button> | ||
188 | </div> | ||
189 | </div> | 66 | </div> |
190 | </form> | 67 | </form> |
191 | <div class="row"> | 68 | <div class="row"> |
192 | <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"> |
193 | <div class="row"> | 70 | <div class="row"> |
194 | </div> | 71 | </div> |
195 | <div class="row"> | 72 | <div class="row"> |
196 | <table class="table table-striped table-sm"> | 73 | <table class="table table-striped table-sm"> |
197 | <thead> | 74 | <thead> |
198 | <tr> | 75 | <tr> |
199 | <th>Sector</th> | 76 | <th>Sector</th> |
200 | <th>Código</th> | 77 | <th>Código</th> |
201 | <th>Descripción</th> | 78 | <th>Descripción</th> |
202 | <th>Precio Unitario</th> | 79 | <th>Precio Unitario</th> |
203 | <th>Cantidad</th> | 80 | <th>Cantidad</th> |
204 | <th>SubTotal</th> | 81 | <th>SubTotal</th> |
205 | <th> | 82 | <th> |
206 | <button class="btn btn-outline-secondary selectable" style="float: right;" ng-click="show = !show; masMenos()" > | 83 | <button |
207 | <i class="fa fa-chevron-down" ng-hide="show" aria-hidden="true"></i> | 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 | > | ||
93 | </i> | ||
208 | <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i> | 94 | <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i> |
209 | </button> | 95 | </button> |
210 | </th> | 96 | </th> |
211 | </tr> | 97 | </tr> |
212 | </thead> | 98 | </thead> |
213 | <tbody> | 99 | <tbody> |
214 | <tr ng-show="cargando"> | 100 | <tr ng-show="cargando"> |
215 | <td colspan="2"><input | 101 | <td colspan="2"> |
216 | placeholder="Seleccione Articulo" | 102 | <input |
217 | class="form-control" | 103 | placeholder="Seleccione Articulo" |
218 | readonly | 104 | class="form-control" |
219 | ng-click="seleccionarArticulo()" | 105 | readonly |
220 | > | 106 | ng-click="seleccionarArticulo()" |
107 | /> | ||
221 | </td> | 108 | </td> |
222 | <td></td> | 109 | <td></td> |
223 | <td></td> | 110 | <td></td> |
224 | <td></td> | 111 | <td></td> |
225 | <td></td> | 112 | <td></td> |
226 | <td></td> | 113 | <td></td> |
227 | </tr> | 114 | </tr> |
228 | <tr ng-show="!cargando"> | 115 | <tr ng-show="!cargando"> |
229 | <td><input | 116 | <td><input |
230 | class="form-control" | 117 | class="form-control" |
231 | ng-model="articuloACargar.sector" | 118 | ng-model="articuloACargar.sector" |
232 | readonly></td> | 119 | readonly></td> |
233 | <td><input | 120 | <td><input |
234 | class="form-control" | 121 | class="form-control" |
235 | ng-model="articuloACargar.codigo" | 122 | ng-model="articuloACargar.codigo" |
236 | readonly></td> | 123 | readonly></td> |
237 | <td><input | 124 | <td><input |
238 | class="form-control" | 125 | class="form-control" |
239 | ng-model="articuloACargar.descripcion" | 126 | ng-model="articuloACargar.descripcion" |
240 | readonly></td> | 127 | readonly></td> |
241 | <td><input | 128 | <td><input |
242 | class="form-control" | 129 | class="form-control" |
243 | ng-value="articuloACargar.precio | currency:'$'" | 130 | ng-value="articuloACargar.precio | currency:'$'" |
244 | readonly></td> | 131 | readonly></td> |
245 | <td><input | 132 | <td><input |
246 | class="form-control" | 133 | class="form-control" |
247 | type="number" | 134 | type="number" |
248 | min="1" | 135 | min="1" |
249 | ng-model="articuloACargar.cantidad" | 136 | ng-model="articuloACargar.cantidad" |
250 | foca-focus="!cargando" | 137 | foca-focus="!cargando" |
251 | esc-key="resetFilter()" | 138 | esc-key="resetFilter()" |
252 | ng-keypress="agregarATabla($event.keyCode)"></td> | 139 | ng-keypress="agregarATabla($event.keyCode)"></td> |
253 | <td><input | 140 | <td><input |
254 | class="form-control" | 141 | class="form-control" |
255 | ng-value="getSubTotal() | currency:'$'" | 142 | ng-value="getSubTotal() | currency:'$'" |
256 | readonly></td> | 143 | readonly></td> |
257 | <td class="text-center"><button | 144 | <td class="text-center"><button |
258 | class="btn btn-outline-secondary btn-sm" | 145 | class="btn btn-outline-secondary btn-sm" |
259 | ng-click="agregarATabla(13)"> | 146 | ng-click="agregarATabla(13)"> |
260 | <i class="fa fa-save"></i> | 147 | <i class="fa fa-save"></i> |
261 | </button></td> | 148 | </button></td> |
262 | </tr> | 149 | </tr> |
263 | <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0"> | 150 | <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0"> |
264 | <td ng-bind="articulo.sector"></td> | 151 | <td ng-bind="articulo.sector"></td> |
265 | <td ng-bind="articulo.codigo"></td> | 152 | <td ng-bind="articulo.codigo"></td> |
266 | <td ng-bind="articulo.descripcion"></td> | 153 | <td ng-bind="articulo.descripcion"></td> |
267 | <td ng-bind="articulo.precio | currency:'$'"></td> | 154 | <td ng-bind="articulo.precio | currency:'$'"></td> |
268 | <td><input | 155 | <td><input |
269 | ng-show="articulo.edit" | 156 | ng-show="articulo.edit" |
270 | ng-model="articulo.cantidad" | 157 | ng-model="articulo.cantidad" |
271 | class="form-control" | 158 | class="form-control" |
272 | type="number" | 159 | type="number" |
273 | min="1" | 160 | min="1" |
274 | foca-focus="articulo.edit" | 161 | foca-focus="articulo.edit" |
275 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 162 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
276 | ng-focus="selectFocus($event)" | 163 | ng-focus="selectFocus($event)" |
277 | > | 164 | > |
278 | <i | 165 | <i |
279 | class="selectable" | 166 | class="selectable" |
280 | ng-click="cambioEdit(articulo)" | 167 | ng-click="cambioEdit(articulo)" |
281 | ng-hide="articulo.edit" | 168 | ng-hide="articulo.edit" |
282 | ng-bind="articulo.cantidad"> | 169 | ng-bind="articulo.cantidad"> |
283 | </i> | 170 | </i> |
284 | </td> | 171 | </td> |
285 | <td ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"></td> | 172 | <td ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"></td> |
286 | <td class="text-center"> | 173 | <td class="text-center"> |
287 | <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo(key)"> | 174 | <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo(key)"> |
288 | <i class="fa fa-trash"></i> | 175 | <i class="fa fa-trash"></i> |
289 | </button> | 176 | </button> |
290 | </td> | 177 | </td> |
291 | </tr> | 178 | </tr> |
292 | </tbody> | 179 | </tbody> |
293 | <tfoot> | 180 | <tfoot> |
294 | <tr class="table-secondary"> | 181 | <tr class="table-secondary"> |
295 | <td colspan="5"><b>Cantidad Items:</b> <a ng-bind="articulosTabla.length"></a> </td> | 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> | ||
296 | <td colspan="3">{{getTotal() | currency:'$'}}</td> | 187 | <td colspan="3">{{getTotal() | currency:'$'}}</td> |
297 | </tr> | 188 | </tr> |
298 | </tfoot> | 189 | </tfoot> |
299 | </table> | 190 | </table> |
300 | </div> | 191 | </div> |
301 | </div> | 192 | </div> |
302 | </div> | 193 | </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> | ||
303 | 205 | ||
304 | <!-- | 206 | <!-- |
305 | <form name="formCrearNota"> | 207 | <form name="formCrearNota"> |
306 | <uib-tabset active="active"> | 208 | <uib-tabset active="active"> |
307 | <uib-tab index="0" heading="General"> | 209 | <uib-tab index="0" heading="General"> |
308 | <input type="hidden" name="id" ng-model="notaPedido.id" /> | 210 | <input type="hidden" name="id" ng-model="notaPedido.id" /> |
309 | <div> | 211 | <div> |
310 | <div class="col-auto my-2"> | 212 | <div class="col-auto my-2"> |
311 | <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> | 213 | <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> |
312 | </div> | 214 | </div> |
313 | </div> | 215 | </div> |
314 | <br> | 216 | <br> |
315 | <br> | 217 | <br> |
316 | <div class="row"> | 218 | <div class="row"> |
317 | <div class="col-md-2"> | 219 | <div class="col-md-2"> |
318 | <div class="col-auto"> | 220 | <div class="col-auto"> |
319 | <label>Fecha de carga</label> | 221 | <label>Fecha de carga</label> |
320 | </div> | 222 | </div> |
321 | </div> | 223 | </div> |
322 | <div class="col-md-3"> | 224 | <div class="col-md-3"> |
323 | <div class="col-auto"> | 225 | <div class="col-auto"> |
324 | <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> | 226 | <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> |
325 | </div> | 227 | </div> |
326 | </div> | 228 | </div> |
327 | <div class="col-md-2"> | 229 | <div class="col-md-2"> |
328 | <div class="col-auto"> | 230 | <div class="col-auto"> |
329 | <label>Kilómetros</label> | 231 | <label>Kilómetros</label> |
330 | </div> | 232 | </div> |
331 | </div> | 233 | </div> |
332 | <div class="col-md-3"> | 234 | <div class="col-md-3"> |
333 | <div class="col-auto"> | 235 | <div class="col-auto"> |
334 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" | 236 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" |
335 | ng-model="notaPedido.kilometros" ng-required="true"> | 237 | ng-model="notaPedido.kilometros" ng-required="true"> |
336 | </div> | 238 | </div> |
337 | </div> | 239 | </div> |
338 | </div> | 240 | </div> |
339 | <div class="row my-3"> | 241 | <div class="row my-3"> |
340 | <div class="col-md-2"> | 242 | <div class="col-md-2"> |
341 | <div class="col-auto"> | 243 | <div class="col-auto"> |
342 | <label>Jurisdicción de IIBB</label> | 244 | <label>Jurisdicción de IIBB</label> |
343 | </div> | 245 | </div> |
344 | </div> | 246 | </div> |
345 | <div class="col-md-3"> | 247 | <div class="col-md-3"> |
346 | <div class="col-auto"> | 248 | <div class="col-auto"> |
347 | <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" | 249 | <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" |
348 | ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> | 250 | ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> |
349 | </div> | 251 | </div> |
350 | </div> | 252 | </div> |
351 | <div class="col-md-2"> | 253 | <div class="col-md-2"> |
352 | <div class="col-auto"> | 254 | <div class="col-auto"> |
353 | <label>Costo de financiación</label> | 255 | <label>Costo de financiación</label> |
354 | </div> | 256 | </div> |
355 | </div> | 257 | </div> |
356 | <div class="col-md-3"> | 258 | <div class="col-md-3"> |
357 | <div class="col-auto"> | 259 | <div class="col-auto"> |
358 | <div class="input-group mb-2"> | 260 | <div class="input-group mb-2"> |
359 | <div class="input-group-prepend"> | 261 | <div class="input-group-prepend"> |
360 | <div class="input-group-text">$</div> | 262 | <div class="input-group-text">$</div> |
361 | </div> | 263 | </div> |
362 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" | 264 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" |
363 | ng-model="notaPedido.costoFinanciacion"> | 265 | ng-model="notaPedido.costoFinanciacion"> |
364 | </div> | 266 | </div> |
365 | </div> | 267 | </div> |
366 | </div> | 268 | </div> |
367 | </div> | 269 | </div> |
368 | <div class="row"> | 270 | <div class="row"> |
369 | <div class="col-md-2"> | 271 | <div class="col-md-2"> |
370 | <div class="col-auto"> | 272 | <div class="col-auto"> |
371 | <label>Bomba</label> | 273 | <label>Bomba</label> |
372 | </div> | 274 | </div> |
373 | </div> | 275 | </div> |
374 | <div class="col-md-1"> | 276 | <div class="col-md-1"> |
375 | <div class="col-auto"> | 277 | <div class="col-auto"> |
376 | <div class="form-check custom-radio custom-control-inline"> | 278 | <div class="form-check custom-radio custom-control-inline"> |
377 | <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> | 279 | <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> |
378 | <label class="form-check-label"> | 280 | <label class="form-check-label"> |
379 | Si | 281 | Si |
380 | </label> | 282 | </label> |
381 | </div> | 283 | </div> |
382 | <div class="form-check custom-radio custom-control-inline"> | 284 | <div class="form-check custom-radio custom-control-inline"> |
383 | <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> | 285 | <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> |
384 | <label class="form-check-label"> | 286 | <label class="form-check-label"> |
385 | No | 287 | No |
386 | </label> | 288 | </label> |
387 | </div> | 289 | </div> |
388 | </div> | 290 | </div> |
389 | </div> | 291 | </div> |
390 | <div class="col-md-1"> | 292 | <div class="col-md-1"> |
391 | <div class="col-auto"> | 293 | <div class="col-auto"> |
392 | <label>Flete</label> | 294 | <label>Flete</label> |
393 | </div> | 295 | </div> |
394 | </div> | 296 | </div> |
395 | <div class="col-md-1"> | 297 | <div class="col-md-1"> |
396 | <div class="col-auto"> | 298 | <div class="col-auto"> |
397 | <div class="form-check custom-radio custom-control-inline"> | 299 | <div class="form-check custom-radio custom-control-inline"> |
398 | <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> | 300 | <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> |
399 | <label class="form-check-label"> | 301 | <label class="form-check-label"> |
400 | Si | 302 | Si |
401 | </label> | 303 | </label> |
402 | </div> | 304 | </div> |
403 | <div class="form-check custom-radio custom-control-inline"> | 305 | <div class="form-check custom-radio custom-control-inline"> |
404 | <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> | 306 | <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> |
405 | <label class="form-check-label"> | 307 | <label class="form-check-label"> |
406 | FOB | 308 | FOB |
407 | </label> | 309 | </label> |
408 | </div> | 310 | </div> |
409 | </div> | 311 | </div> |
410 | </div> | 312 | </div> |
411 | <div class="col-md-2"> | 313 | <div class="col-md-2"> |
412 | <div class="col-auto"> | 314 | <div class="col-auto"> |
413 | <label>Costo unitario kilometro flete</label> | 315 | <label>Costo unitario kilometro flete</label> |
414 | </div> | 316 | </div> |
415 | </div> | 317 | </div> |
416 | <div class="col-md-3"> | 318 | <div class="col-md-3"> |
417 | <div class="col-auto"> | 319 | <div class="col-auto"> |
418 | <div class="input-group mb-2"> | 320 | <div class="input-group mb-2"> |
419 | <div class="input-group-prepend"> | 321 | <div class="input-group-prepend"> |
420 | <div class="input-group-text">$</div> | 322 | <div class="input-group-text">$</div> |
421 | </div> | 323 | </div> |
422 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" | 324 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" |
423 | ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> | 325 | ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> |
424 | </div> | 326 | </div> |
425 | </div> | 327 | </div> |
426 | </div> | 328 | </div> |
427 | </div> | 329 | </div> |
428 | <div class="row my-3"> | 330 | <div class="row my-3"> |
429 | <div class="col-md-2"> | 331 | <div class="col-md-2"> |
430 | <div class="col-auto"> | 332 | <div class="col-auto"> |
431 | <label>Vendedor</label> | 333 | <label>Vendedor</label> |
432 | </div> | 334 | </div> |
433 | </div> | 335 | </div> |
434 | <div class="col-md-3"> | 336 | <div class="col-md-3"> |
435 | <div class="col-auto"> | 337 | <div class="col-auto"> |
436 | <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" | 338 | <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" |
437 | ng-click="seleccionarVendedor()" readonly> | 339 | ng-click="seleccionarVendedor()" readonly> |
438 | </div> | 340 | </div> |
439 | </div> | 341 | </div> |
440 | <div class="col-md-2"> | 342 | <div class="col-md-2"> |
441 | <div class="col-auto"> | 343 | <div class="col-auto"> |
442 | <label>Petrolera</label> | 344 | <label>Petrolera</label> |
443 | </div> | 345 | </div> |
444 | </div> | 346 | </div> |
445 | <div class="col-md-3"> | 347 | <div class="col-md-3"> |
446 | <div class="col-auto"> | 348 | <div class="col-auto"> |
447 | <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera" | 349 | <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera" |
448 | ng-click="seleccionarPetrolera()" readonly> | 350 | ng-click="seleccionarPetrolera()" readonly> |
449 | </div> | 351 | </div> |
450 | </div> | 352 | </div> |
451 | </div> | 353 | </div> |
452 | </div> | 354 | </div> |
453 | <div class="row"> | 355 | <div class="row"> |
454 | <div class="col-md-2"> | 356 | <div class="col-md-2"> |
455 | <div class="col-auto"> | 357 | <div class="col-auto"> |
456 | <label>Cliente</label> | 358 | <label>Cliente</label> |
457 | </div> | 359 | </div> |
458 | </div> | 360 | </div> |
459 | <div class="col-md-3"> | 361 | <div class="col-md-3"> |
460 | <div class="col-auto"> | 362 | <div class="col-auto"> |
461 | <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" | 363 | <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" |
462 | ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> | 364 | ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> |
463 | </div> | 365 | </div> |
464 | </div> | 366 | </div> |
465 | <div class="col-md-2"> | 367 | <div class="col-md-2"> |
466 | <div class="col-auto"> | 368 | <div class="col-auto"> |
467 | <label>Domicilio</label> | 369 | <label>Domicilio</label> |
468 | </div> | 370 | </div> |
469 | </div> | 371 | </div> |
470 | <div class="col-md-4"> | 372 | <div class="col-md-4"> |
471 | <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> | 373 | <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> |
472 | <div class="col-auto"> | 374 | <div class="col-auto"> |
473 | <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" | 375 | <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" |
474 | domi.dom | 376 | domi.dom |
475 | for domi | 377 | for domi |
476 | in domiciliosCliente | 378 | in domiciliosCliente |
477 | " | 379 | " |
478 | typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" | 380 | typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" |
479 | class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> | 381 | class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> |
480 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> | 382 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> |
481 | <div ng-show="sinResultados"> | 383 | <div ng-show="sinResultados"> |
482 | No se encontraron resultados. | 384 | No se encontraron resultados. |
483 | </div> | 385 | </div> |
484 | </div> | 386 | </div> |
485 | <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a> | 387 | <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a> |
486 | <a class="btn" ng-click="addNewDom()">+</a> | 388 | <a class="btn" ng-click="addNewDom()">+</a> |
487 | </div> | 389 | </div> |
488 | </div> | 390 | </div> |
489 | </div> | 391 | </div> |
490 | </uib-tab> | 392 | </uib-tab> |
491 | <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid"> | 393 | <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid"> |
492 | <div> | 394 | <div> |
493 | <div class="col-auto my-2"> | 395 | <div class="col-auto my-2"> |
494 | <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button> | 396 | <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button> |
495 | </div> | 397 | </div> |
496 | </div> | 398 | </div> |
497 | <br> | 399 | <br> |
498 | <br> | 400 | <br> |
499 | <div class="row"> | 401 | <div class="row"> |
500 | <div class="col-md-2"> | 402 | <div class="col-md-2"> |
501 | <div class="col-auto"> | 403 | <div class="col-auto"> |
502 | <label>Precios y condiciones</label> | 404 | <label>Precios y condiciones</label> |
503 | </div> | 405 | </div> |
504 | </div> | 406 | </div> |
505 | <div class="col-md-4"> | 407 | <div class="col-md-4"> |
506 | <div class="col-auto"> | 408 | <div class="col-auto"> |
507 | <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones"> | 409 | <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones"> |
508 | </select> | 410 | </select> |
509 | </div> | 411 | </div> |
510 | </div> | 412 | </div> |
511 | <div class="col-md-2"> | 413 | <div class="col-md-2"> |